mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 08:09:29 +02:00
+ implemented GetProcessID for i8086-msdos (returns the PSP)
git-svn-id: branches/i8086@24057 -
This commit is contained in:
parent
1ab42714c3
commit
b61a9ba6a6
@ -1,91 +1,103 @@
|
||||
; nasm -f obj -o prt0.o prt0.asm
|
||||
|
||||
cpu 8086
|
||||
cpu 8086
|
||||
|
||||
segment text use16
|
||||
segment text use16
|
||||
|
||||
extern PASCALMAIN
|
||||
extern PASCALMAIN
|
||||
extern dos_psp
|
||||
|
||||
..start:
|
||||
mov ax, dgroup
|
||||
mov ss, ax
|
||||
mov sp, stacktop
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
jmp PASCALMAIN
|
||||
; init the stack
|
||||
mov ax, dgroup
|
||||
mov ss, ax
|
||||
mov sp, stacktop
|
||||
|
||||
; save the Program Segment Prefix
|
||||
push ds
|
||||
|
||||
; init DS and ES
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
; pop the PSP from stack and store it in the pascal variable dos_psp
|
||||
pop ax
|
||||
mov word [dos_psp], ax
|
||||
|
||||
jmp PASCALMAIN
|
||||
|
||||
global FPC_MSDOS
|
||||
FPC_MSDOS:
|
||||
mov dx, ax
|
||||
mov al, 21h
|
||||
global FPC_INTR
|
||||
global FPC_INTR
|
||||
FPC_INTR:
|
||||
mov byte [cs:int_number], al
|
||||
mov byte [cs:int_number], al
|
||||
push bp
|
||||
push es
|
||||
push di
|
||||
push bx
|
||||
push cx
|
||||
push si
|
||||
push es
|
||||
push di
|
||||
push bx
|
||||
push cx
|
||||
push si
|
||||
push dx
|
||||
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
|
||||
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
|
||||
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 dx
|
||||
pop si
|
||||
pop cx
|
||||
pop bx
|
||||
pop di
|
||||
pop es
|
||||
pop si
|
||||
pop cx
|
||||
pop bx
|
||||
pop di
|
||||
pop es
|
||||
pop bp
|
||||
ret
|
||||
ret
|
||||
|
||||
segment stack stack class=stack
|
||||
resb 4096
|
||||
stacktop:
|
||||
segment stack stack class=stack
|
||||
resb 4096
|
||||
stacktop:
|
||||
|
||||
group dgroup stack
|
||||
group dgroup stack
|
||||
|
@ -49,6 +49,8 @@ var
|
||||
envp:PPchar; //!! public name 'operatingsystem_parameter_envp';
|
||||
dos_argv0 : pchar; //!! public name 'dos_argv0';
|
||||
|
||||
dos_psp:Word;public name 'dos_psp';
|
||||
|
||||
AllFilesMask: string [3];
|
||||
{$ifndef RTLLITE}
|
||||
{ System info }
|
||||
@ -143,7 +145,7 @@ end;
|
||||
|
||||
function GetProcessID: SizeUInt;
|
||||
begin
|
||||
GetProcessID := 1;
|
||||
GetProcessID := dos_psp;
|
||||
end;
|
||||
|
||||
function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
|
||||
|
Loading…
Reference in New Issue
Block a user