More than 5 years have passed since last update.
32bitのCコンパイラの出力を参考にZ80アセンブラのサブルーチン呼び出しを検討してみる。
👁 image.png
https://godbolt.org/z/RP5mD0
;10 bload "program.bin",r
CHPUT equ $00a2
org $d000
start:
ld hl,7 ; y
push hl
ld hl,$40 ; x
push hl
call hoge
pop hl ; 空読みx2
pop hl
call CHPUT
ret
; byte hoge(word x, word y)
_x equ 2
_y equ 4
hoge:
ld (spwk),sp
ld ix,(spwk)
ld a,(ix+_x)
add a,(ix+_y)
ret
spwk: dw 0
end start
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
