mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 11:06:19 +02:00
+ implemented crt.delay for i8086-msdos
git-svn-id: trunk@24680 -
This commit is contained in:
parent
56d3197ef2
commit
0446ccbba7
@ -14,6 +14,8 @@
|
|||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
unit crt;
|
unit crt;
|
||||||
|
|
||||||
|
{$GOTO on}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
{$i crth.inc}
|
{$i crth.inc}
|
||||||
@ -392,65 +394,72 @@ end;
|
|||||||
Delay
|
Delay
|
||||||
*************************************************************************}
|
*************************************************************************}
|
||||||
|
|
||||||
procedure Delayloop;assembler;
|
procedure Delayloop;assembler;nostackframe;
|
||||||
|
label
|
||||||
|
LDelayLoop1, LDelayLoop2;
|
||||||
asm
|
asm
|
||||||
{ TODO: implement }
|
{ input:
|
||||||
{.LDelayLoop1:
|
es:di = $40:$6c
|
||||||
subl $1,%eax
|
bx = value of [es:dx] before the call
|
||||||
|
dx:ax = counter }
|
||||||
|
LDelayLoop1:
|
||||||
|
sub ax, 1
|
||||||
|
sbb dx, 0
|
||||||
jc .LDelayLoop2
|
jc .LDelayLoop2
|
||||||
cmpl %fs:(%edi),%ebx
|
cmp bx, word es:[di]
|
||||||
je .LDelayLoop1
|
je .LDelayLoop1
|
||||||
.LDelayLoop2:}
|
LDelayLoop2:
|
||||||
end ['EAX'];
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure initdelay;assembler;
|
procedure initdelay;
|
||||||
asm
|
label
|
||||||
{ TODO: implement }
|
LInitDel1;
|
||||||
{ pushl %ebx
|
begin
|
||||||
pushl %edi}
|
asm
|
||||||
{ for some reason, using int $31/ax=$901 doesn't work here }
|
{ for some reason, using int $31/ax=$901 doesn't work here }
|
||||||
{ and interrupts are always disabled at this point when }
|
{ and interrupts are always disabled at this point when }
|
||||||
{ running a program inside gdb(pas). Web bug 1345 (JM) }
|
{ running a program inside gdb(pas). Web bug 1345 (JM) }
|
||||||
{ sti
|
sti
|
||||||
movl $0x46c,%edi
|
mov ax, $40
|
||||||
movl $-28,%edx
|
mov es, ax
|
||||||
movl %fs:(%edi),%ebx
|
mov di, $6c
|
||||||
.LInitDel1:
|
mov bx, es:[di]
|
||||||
cmpl %fs:(%edi),%ebx
|
LInitDel1:
|
||||||
je .LInitDel1
|
cmp bx, es:[di]
|
||||||
movl %fs:(%edi),%ebx
|
je LInitDel1
|
||||||
movl %edx,%eax
|
mov bx, es:[di]
|
||||||
|
mov ax, $FFFF
|
||||||
|
mov dx, $FFFF
|
||||||
call DelayLoop
|
call DelayLoop
|
||||||
|
|
||||||
notl %eax
|
mov [DelayCnt], ax
|
||||||
xorl %edx,%edx
|
mov [DelayCnt + 2], dx
|
||||||
movl $55,%ecx
|
end ['AX','BX','DX', 'DI'];
|
||||||
divl %ecx
|
DelayCnt := -DelayCnt div $55;
|
||||||
movl %eax,DelayCnt
|
end;
|
||||||
popl %edi
|
|
||||||
popl %ebx}
|
|
||||||
end ['EAX','ECX','EDX'];
|
|
||||||
|
|
||||||
|
|
||||||
procedure Delay(MS: Word);assembler;
|
procedure Delay(MS: Word);assembler;
|
||||||
|
label
|
||||||
|
LDelay1, LDelay2;
|
||||||
asm
|
asm
|
||||||
{ TODO: implement }
|
mov ax, $40
|
||||||
{ pushl %ebx
|
mov es, ax
|
||||||
pushl %edi
|
mov di, $6c
|
||||||
movzwl MS,%ecx
|
|
||||||
jecxz .LDelay2
|
mov cx, MS
|
||||||
movl $0x400,%edi
|
test cx, cx
|
||||||
movl DelayCnt,%edx
|
jz LDelay2
|
||||||
movl %fs:(%edi),%ebx
|
mov si, [DelayCnt + 2]
|
||||||
.LDelay1:
|
LDelay1:
|
||||||
movl %edx,%eax
|
mov ax, [DelayCnt]
|
||||||
|
mov dx, si
|
||||||
|
mov bx, es:[di]
|
||||||
call DelayLoop
|
call DelayLoop
|
||||||
loop .LDelay1
|
loop LDelay1
|
||||||
.LDelay2:
|
LDelay2:
|
||||||
popl %edi
|
end;
|
||||||
popl %ebx}
|
|
||||||
end ['EAX','ECX','EDX'];
|
|
||||||
|
|
||||||
|
|
||||||
procedure sound(hz : word);
|
procedure sound(hz : word);
|
||||||
@ -526,7 +535,6 @@ var
|
|||||||
my,y : longint;
|
my,y : longint;
|
||||||
fil : word;
|
fil : word;
|
||||||
begin
|
begin
|
||||||
{ TODO: implement }
|
|
||||||
fil:=32 or (textattr shl 8);
|
fil:=32 or (textattr shl 8);
|
||||||
y:=WhereY;
|
y:=WhereY;
|
||||||
my:=WinMaxY-WinMinY;
|
my:=WinMaxY-WinMinY;
|
||||||
|
Loading…
Reference in New Issue
Block a user