Browse Source

+ added Intr and MsDos implementations for i8086-msdos

git-svn-id: branches/i8086@24037 -
nickysn 12 years ago
parent
commit
cd18b792ab
4 changed files with 81 additions and 0 deletions
  1. 1 0
      .gitattributes
  2. 62 0
      rtl/msdos/prt0.asm
  3. 9 0
      rtl/msdos/registers.inc
  4. 9 0
      rtl/msdos/system.pp

+ 1 - 0
.gitattributes

@@ -8202,6 +8202,7 @@ rtl/morphos/videodata.inc svneol=native#text/plain
 rtl/msdos/Makefile svneol=native#text/plain
 rtl/msdos/Makefile svneol=native#text/plain
 rtl/msdos/Makefile.fpc svneol=native#text/plain
 rtl/msdos/Makefile.fpc svneol=native#text/plain
 rtl/msdos/prt0.asm svneol=native#text/plain
 rtl/msdos/prt0.asm svneol=native#text/plain
+rtl/msdos/registers.inc svneol=native#text/plain
 rtl/msdos/sysdir.inc svneol=native#text/plain
 rtl/msdos/sysdir.inc svneol=native#text/plain
 rtl/msdos/sysfile.inc svneol=native#text/plain
 rtl/msdos/sysfile.inc svneol=native#text/plain
 rtl/msdos/sysheap.inc svneol=native#text/plain
 rtl/msdos/sysheap.inc svneol=native#text/plain

+ 62 - 0
rtl/msdos/prt0.asm

@@ -14,6 +14,68 @@
 	mov es, ax
 	mov es, ax
 	jmp PASCALMAIN
 	jmp PASCALMAIN
 
 
+	global FPC_INTR
+FPC_INTR:
+	mov byte [cs:int_number], al
+	push es
+	push di
+	push bx
+	push cx
+	push si
+	push ds
+	mov si, dx
+	mov ax, word [si + 16]
+	mov es, ax
+	mov ax, word [si + 18]  ; flags
+	push ax
+	mov ax, word [si + 14]  ; ds
+	push ax
+	mov ax, word [si]
+	mov bx, word [si + 2]
+	mov cx, word [si + 4]
+	mov dx, word [si + 6]
+	mov bp, word [si + 8]
+	mov di, word [si + 12]
+	mov si, word [si + 10]
+	
+	pop ds
+	popf
+	db 0CDh  ; opcode of INT xx
+int_number:
+	db 255
+	
+	pushf
+	push ds
+	push si
+	push bp
+	mov bp, sp
+	mov si, word [ss:bp + 8]
+	mov ds, si
+	mov si, word [ss:bp + 10]
+	mov word [si], ax
+	mov word [si + 2], bx
+	mov word [si + 4], cx
+	mov word [si + 6], dx
+	mov word [si + 12], di
+	mov ax, es
+	mov word [si + 16], ax
+	pop ax
+	mov word [si + 8], ax
+	pop ax
+	mov word [si + 10], ax
+	pop ax
+	mov word [si + 14], ax
+	pop ax
+	mov word [si + 18], ax
+	
+	pop ds
+	pop si
+	pop cx
+	pop bx
+	pop di
+	pop es
+	ret
+
 	segment stack stack class=stack
 	segment stack stack class=stack
 	resb 4096
 	resb 4096
 	stacktop:
 	stacktop:

+ 9 - 0
rtl/msdos/registers.inc

@@ -0,0 +1,9 @@
+{ Registers record used by Intr and MsDos. This include file is shared between
+  the system unit and the dos unit. }
+
+type
+  Registers = packed record
+    case Integer of
+      0: (AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags: Word);
+      1: (AL, AH, BL, BH, CL, CH, DL, DH: Byte);
+  end;

+ 9 - 0
rtl/msdos/system.pp

@@ -65,6 +65,15 @@ implementation
 
 
 {$I system.inc}
 {$I system.inc}
 
 
+{$I registers.inc}
+
+procedure Intr(IntNo: Byte; var Regs: Registers); external name 'FPC_INTR';
+
+procedure MsDos(var Regs: Registers);
+begin
+  Intr($21, Regs);
+end;
+
 procedure DebugWrite(const S: string);
 procedure DebugWrite(const S: string);
 begin
 begin
   asm
   asm