+ implemented fpc_setjmp and fpc_longjmp for the Z80

git-svn-id: branches/z80@45095 -
This commit is contained in:
nickysn 2020-04-26 13:30:13 +00:00
parent 085fdcf3ab
commit 3afdab19a1
2 changed files with 41 additions and 2 deletions

View File

@ -16,11 +16,49 @@
function fpc_setjmp(var S : jmp_buf) : shortint;assembler;[Public, alias : 'FPC_SETJMP'];nostackframe;compilerproc;
asm
push ix
ld ix, 0
add ix,sp
ld l, (ix+4) { (S) }
ld h, (ix+5) { (S+1) }
ld iy, 0
add iy, sp
push iy
pop bc
ld (hl), c
inc hl
ld (hl), b
inc hl
ld l, 0
pop ix
end;
procedure fpc_longjmp(var S : jmp_buf;value : shortint);assembler;[Public, alias : 'FPC_LONGJMP'];compilerproc;
procedure fpc_longjmp(var S : jmp_buf;value : shortint);assembler;[Public, alias : 'FPC_LONGJMP'];nostackframe;compilerproc;
asm
push ix
ld ix, 0
add ix, sp
ld d, (ix+6) { (value) }
ld l, (ix+4) { (S) }
ld h, (ix+5) { (S+1) }
ld c, (hl)
inc hl
ld b, (hl)
inc hl
push bc
pop iy
ld sp, iy
ld l, d
pop ix
end;

View File

@ -16,7 +16,8 @@
type
jmp_buf = packed record
f,a,b,c,e,d,l,h,ixlo,ixhi,iylo,iyhi,splo,sphi,pclo,pchi : byte;
sp: word;
{ f,a,b,c,e,d,l,h,ixlo,ixhi,iylo,iyhi,splo,sphi,pclo,pchi : byte;}
end;
pjmp_buf = ^jmp_buf;