VOOZH about

URL: https://qiita.com/Stosstruppe/items/b76a43c5f6c0ab433d64

⇱ Z80アセンブラにおけるサブルーチン呼び出しの検討 #MSX - Qiita


👁 Image
1

Go to list of users who liked

0

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@Stosstruppe

Z80アセンブラにおけるサブルーチン呼び出しの検討

1
Posted at

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
1

Go to list of users who liked

0
1

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1

Go to list of users who liked

0