Does anyone has experinece on how memory banks work in z180 cpu?
this code
global lcall, lret, lretp, __Lbasecode
psect lowtext,class=CODE
BBR equ 39h ;Bank base register
; lcall - perform a far call
lcall: ex af,af' ;save new bank number
in0 a,(BBR) ;get current bank
push af ;save it
ex af,af' ;restore new bank
sub __Lbasecode/1000h ;adjust bank number
out0 (BBR),a
jp (HL) ;go to new routine
lret: pop af ;restore bank number
out0 (BBR),a ;select it
ret ;back to caller
lretp: push bc ;get adjustment
exx ;get some unused regs
pop hl ;adjustment value
pop af ;bank number
pop de ;return address
add hl,sp
ld sp,hl ;remove parameters
push de ;push return address back
exx
out0 (BBR),a ;restore bank
ret ;done.
should manage "long calls" i.e. calls to functions outside the active banks
I need to modify it to support ASCII 8K megaroms.
Any suggestion?