I'm creating a Sjasm macro, so I can use:
L_E52A:
ld hl, $58A0
ld c, $12
_do
inc hl
ld b, $1E
_do
ld (hl), a
inc hl
_djnz
inc hl
dec c
_while nz
ret
I scratch this, but it doesn't work:
DLOOP_3 = 0
DLOOP_2 = 0
DLOOP_TOP = 0
MACRO DLOOP_PUSH arg
DLOOP_3 = DLOOP_2
DLOOP_2 = DLOOP_TOP
DLOOP_TOP = arg
ENDM
MACRO DLOOP_POP
DLOOP_TOP = DLOOP_2
DLOOP_2 = DLOOP_3
DLOOP_3 = 0
ENDM
MACRO _do
DLOOP_PUSH $
DLOOP_TOP:
ENDM
MACRO _while flag
jr flag, DLOOP_TOP
DLOOP_POP
ENDM
MACRO _djnz
djnz DLOOP_TOP
DLOOP_POP
ENDM
The DLOOP_TOP isn't replaced with the actual value of DLOOP_TOP
I'd like to have this working so I can see the asm a little bit mot like js
I'm a noob on Z80 asm.
Please help.
The assembler knows "reusable labels", see the documentation.
So you don't need the stack to organize your loop labels.