title 'bank & move module for CP/M3 linked BIOS' version equ 08 ;5/22/83 working xmove rcl ;ver$mv db 07h ;add xmove 5/2/83 ;maclib cpm3cnfg maclib z80 interbank equ 0ffh public @banks, ver$mv cseg ;must be in common memory ; ; port to set extended address (or bank select) ; memctl: equ 0feh ;for SSM CB1 public ver$mv public ?move,?xmove,?bank extrn @cbnk ?xmove: if interbank ; sbcd @banks ;save for later mov a,b ;dest sta to mov a,c ;source sta from mvi a,0ffh sta xflag endif ;interbank ret ?move: if interbank ; lbcd @banks ;get banks b=source c=dest ; mov a,b ; ora c ;see if both are zero lda xflag ora a jrz same$bank ; ; de=source hl=dest bc =byte count ; ; push h ;save dest push b ;save byte count ; ; move from source to buffer ; lda from out memctl xchg ;source in hl lxi d,xbuffer ldir shld source$end ;will need this when done ; ; move from buffer to dest ; lda to out memctl lxi h,xbuffer pop b ;recover size pop d ;recover dest ldir xra a sta xflag ; sbcd @banks ;reset so next move is within bank xchg ;hl = end of dest lded source$end ;de = end of source ; ; restore original bank ; @cnbk is still valid cause all bank switching was done ; internally in this module and not through bioskrnl ; lda @cbnk out memctl ret ;with hl & de at next address after move same$bank: endif ;interbank xchg ; we are passed source in DE and dest in HL ldir ; use Z80 block move instruction xchg ; need next addresses in same regs ret ; ; move/xmove data ; if interbank @banks: to: db 0 ;c reg l from: db 0 ;b reg h xflag: db 0 ;nz if interbank xbuffer: ds 128 source$end ds 2 endif ; ; switch to memory bank in a ; ?bank: out memctl ;to memory manager on zpu card ret dseg ver$mv: db 'move ' db version / 10 + '0', version mod 10 + '0',0 end