Hi all,
I'm working on writing some ez80 programs and I'm stuck at trying to call a subroutine from ADL mode, to Z80 mode.
I've tried using the .l and .s suffix on call and I've tried manually typing in the byte prefix to the call. I can't seem to get it to switch modes. When it reaches an RET, it crashes upon execution (it appears to be not returning to the correct address). I've fiddled with mb, both in code and via the emulator, I've manually corrected the address upon RET (via the emulator), and it still crashes. The only thing that I can get to work is a regular call Does anyone have any tips? I'm using SPASM and CEmu and UM0077.pdf for reference.
I just want to get back to writing programs Thanks!
Code:
I'm sure I just missed some piece of documentation or misinterpreted something; I'd appreciate the help.
I'm working on writing some ez80 programs and I'm stuck at trying to call a subroutine from ADL mode, to Z80 mode.
I've tried using the .l and .s suffix on call and I've tried manually typing in the byte prefix to the call. I can't seem to get it to switch modes. When it reaches an RET, it crashes upon execution (it appears to be not returning to the correct address). I've fiddled with mb, both in code and via the emulator, I've manually corrected the address upon RET (via the emulator), and it still crashes. The only thing that I can get to work is a regular call Does anyone have any tips? I'm using SPASM and CEmu and UM0077.pdf for reference.
I just want to get back to writing programs Thanks!
Code:
_HomeUp = 020828h
_ClrScrnFull = 020810h
_DispHL = 021EE0h
.assume ADL=1
.db $EF,$7B
.org 0D1A881h
call _HomeUp
call _ClrScrnFull
di
ld ix,op0
ld a,$D1
ld mb,a
call.s mlt24
ld hl,(ix+6)
jp _DispHL
.assume ADL=0
mlt24:
;ix points to the first input
;ix+3 points to the second
;ix+6 points to the output
ld c,(ix) \ ld b,(ix+3) \ mlt bc \ ld (ix+6),bc
ld c,(ix+1) \ ld b,(ix+4) \ mlt bc \ ld (ix+8),bc
ld c,(ix+2) \ ld b,(ix+5) \ mlt bc \ ld (ix+10),bc
ld l,(ix+0) \ ld h,(ix+4) \ mlt hl
ld c,(ix+1) \ ld b,(ix+3) \ mlt bc
xor a
add hl,bc \ ld (ix+12),hl
ld l,(ix+1) \ ld h,(ix+5) \ mlt hl
ld c,(ix+2) \ ld b,(ix+4) \ mlt bc
adc hl,bc \ ld (ix+14),hl \ jr nc,$+5 \ inc (ix+11)
ld l,(ix) \ ld h,(ix+5) \ mlt hl
ld c,(ix+2) \ ld b,(ix+3) \ mlt bc
add hl,bc
ld bc,(ix+8)
add hl,bc
ld (ix+8),hl
jr nc,+_
ld hl,(ix+10)
inc hl
ld (ix+10),hl
_:
ld hl,(ix+12)
ld bc,(ix+7)
add hl,bc
ld (ix+7),hl
ld hl,(ix+14)
ld bc,(ix+9)
adc hl,bc
ld (ix+9),hl
ret nc
inc (ix+11)
ret
.echo $-mlt24
.echo $-0D1A881h
;001122
; 0112
; 1021
; 02
; 20
op0:
.db 1,2,3
op1:
.db 1,2,3
out:
.db 0,0,0,0,0,0
.db 0,0,0,0
I'm sure I just missed some piece of documentation or misinterpreted something; I'd appreciate the help.