Skip to content

Commit 12598c4

Browse files
Sustituye "ld (xxxx), sp" en vez de "ld hl, 0 ; add hl, sp; ld (xxxx), hl"
1 parent d1a2323 commit 12598c4

File tree

6 files changed

+6
-18
lines changed

6 files changed

+6
-18
lines changed

src/arch/z80/backend/main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,9 +661,7 @@ def emit_prologue() -> list[str]:
661661
output.append("exx")
662662
output.append("push hl")
663663
output.append("exx")
664-
output.append("ld hl, 0")
665-
output.append("add hl, sp")
666-
output.append(f"ld ({common.CALL_BACK}), hl")
664+
output.append(f"ld ({common.CALL_BACK}), sp")
667665
output.append("ei")
668666

669667
output.extend(f"call {x}" for x in sorted(common.INITS))

src/arch/zxnext/backend/main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ def emit_prologue() -> list[str]:
7575
output.append("di")
7676
output.append("push iy")
7777
output.append("ld iy, 0x5C3A ; ZX Spectrum ROM variables address")
78-
output.append("ld hl, 0")
79-
output.append("add hl, sp")
80-
output.append(f"ld ({common.CALL_BACK}), hl")
78+
output.append(f"ld ({common.CALL_BACK}), sp")
8179
output.append("ei")
8280

8381
output.extend(f"call {x}" for x in sorted(common.INITS))

src/lib/arch/zx48k/runtime/arith/divf.asm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ ERR_SP EQU 23613
2727
ld (TMP), hl
2828
ld hl, __DIVBYZERO
2929
push hl
30-
ld hl, 0
31-
add hl, sp
32-
ld (ERR_SP), hl
30+
ld (ERR_SP), sp
3331

3432
; ------------- ROM DIV
3533
rst 28h

src/lib/arch/zx48k/runtime/val.asm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ SET_MIN EQU 16B0h
5959
;; Now put our error handler on ERR_SP
6060
ld hl, __VAL_ERROR
6161
push hl
62-
ld hl, 0
63-
add hl, sp
64-
ld (ERR_SP), hl
62+
ld (ERR_SP), sp
6563

6664
call STK_STO_S ; Enter it on the stack
6765

src/lib/arch/zxnext/runtime/arith/divf.asm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ ERR_SP EQU 23613
2727
ld (TMP), hl
2828
ld hl, __DIVBYZERO
2929
push hl
30-
ld hl, 0
31-
add hl, sp
32-
ld (ERR_SP), hl
30+
ld (ERR_SP), sp
3331

3432
; ------------- ROM DIV
3533
rst 28h

src/lib/arch/zxnext/runtime/val.asm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ SET_MIN EQU 16B0h
5959
;; Now put our error handler on ERR_SP
6060
ld hl, __VAL_ERROR
6161
push hl
62-
ld hl, 0
63-
add hl, sp
64-
ld (ERR_SP), hl
62+
ld (ERR_SP), sp
6563

6664
call STK_STO_S ; Enter it on the stack
6765

0 commit comments

Comments
 (0)