Browse Source

+ implemented get_caller_addr and get_caller_frame for the Z80

git-svn-id: trunk@45146 -
nickysn 5 years ago
parent
commit
f202249711
1 changed files with 31 additions and 0 deletions
  1. 31 0
      rtl/z80/z80.inc

+ 31 - 0
rtl/z80/z80.inc

@@ -108,13 +108,44 @@ function get_frame:pointer;assembler;nostackframe;
 
 {$define FPC_SYSTEM_HAS_GET_CALLER_ADDR}
 function get_caller_addr(framebp:pointer;addr:pointer=nil):pointer;assembler;
+  label
+    framebp_null;
   asm
+    ld l, (framebp)
+    ld h, (framebp+1)
+
+    ld a, l
+    or a, h
+    jp Z, framebp_null
+
+    inc hl
+    inc hl
+
+    ld e, (hl)
+    inc hl
+    ld d, (hl)
+    ex de, hl
+framebp_null:
   end;
 
 
 {$define FPC_SYSTEM_HAS_GET_CALLER_FRAME}
 function get_caller_frame(framebp:pointer;addr:pointer=nil):pointer;assembler;
+  label
+    framebp_null;
   asm
+    ld l, (framebp)
+    ld h, (framebp+1)
+
+    ld a, l
+    or a, h
+    jp Z, framebp_null
+
+    ld e, (hl)
+    inc hl
+    ld d, (hl)
+    ex de, hl
+framebp_null:
   end;