X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp-cpm3.git/blobdiff_plain/ea5293bb6ce484bf1ec9ab70befe10c3a36a70c2..a28ee78cdd671f113af301e41ecf857d2f2c9d41:/cbios/move.180 diff --git a/cbios/move.180 b/cbios/move.180 index 0ebfdfc..aac1840 100644 --- a/cbios/move.180 +++ b/cbios/move.180 @@ -43,45 +43,37 @@ endif ret - if banked + if banked inter_bank_move: ; source in HL, dest in DE, count in BC - if 0 ; *** DOES NOT WORK PROPERLY - ; (Crossing Bank boundary problems) - push bc - push de - push hl -;TODO: check if source range crosses bank/common boundary + if 1 ; works with new memory map + out0 (bcr0l),c ; setup DMA count + out0 (bcr0h),b + + push hl + push de ld a,(src$bnk) call bnk2phy - out0 (sar0l),l ; setup DMA src address out0 (sar0h),h out0 (sar0b),a -;TODO: check if destination range crosses bank/common boundary - ex de,hl ld a,(dst$bnk) call bnk2phy - out0 (dar0l),l ; setup DMA dst address out0 (dar0h),h out0 (dar0b),a ld a,M_MMOD ; DMA burst mode out0 (dmode),a - out0 (bcr0l),c ; setup DMA count - out0 (bcr0h),b ld a,M_DE0+M_NDWE1 ; enable DMA0 out0 (dstat),a ; move the block - pop hl pop de - pop bc - + pop hl add hl,bc ; src must point past end block ex de,hl add hl,bc ; and so must dst @@ -92,7 +84,7 @@ inter_bank_move: ; source in HL, dest in DE, count in BC ret ; return with src in DE, dst in HL, count = 0 - else ; *** INNEFICIENT, BUT WORKS + else ; inefficient fall back ld (tmp$sp),sp ld sp,tmp$stk @@ -107,12 +99,9 @@ mv$blk: call ?bank ex af,af' ; ld (de),a - inc hl inc de - dec bc - ld a,b - or c - jr nz,mv$blk + cpi + jp pe,mv$blk ld a,(@cbnk) call ?bank ld a,0FEh @@ -127,12 +116,12 @@ mv$blk: tmp$stk: tmp$sp: ds 2 - endif + endif src$bnk: db 0FEh dst$bnk: db 0FEh - endif ;banked + endif ;banked end