;-------------------------------------------------------------------- ; Move_a_Block (1_Mar_84) ;------------------------ ; 1) This routine moves a block of memory. The block can overlay itself. ; 2) Register Usage: ; BC -> Byte Count ; DE -> Destination ; HL -> Source ; Move_a_Block: ld a,b ;If (Length of move is zero) or c ret z ; Return push hl or a ;(clear the carry) sbc hl,de ;If (Source eq Destination) pop hl ret z ; Return jr c,MBSk1 ;Else If (Source gt Destination) ldir ; Move the Block Up ret ; Return MBSk1: push hl ex de,hl ;Else (Source lt Destination) or a ; (clear the carry) add hl,bc ; Dest:= Dest + Byte_Count dec hl ; (move pointer back to last char) ex de,hl pop hl add hl,bc ; Source:= Source + Byte_Count dec hl ; (move pointer back to last char) lddr ; Move the Block Down ret ; Return page