home *** CD-ROM | disk | FTP | other *** search
/ Antic Magazine 1983 April / Antic_April_1983_Vol_2_No_1.atr / move.asm < prev    next >
Assembly Source File  |  2021-01-21  |  2KB  |  1 lines

  1. 0100  .TITLE "MOVE for BASIC - 21 1982"¢0110 ;¢0120 ; BASIC callable subroutine to move¢0130 ; any number of bytes.¢0140 ;¢0150 ; By Bob Stewart, of The Logic Smiths¢0160 ; For ANTIC Magazine¢0170 ;¢0180 ; Calling sequence:¢0190 ;¢0200 ;  XX=USR(MOVE,INADD,OUTADD,COUNT)¢0210 ;¢0220 ;    XX    - Any useless variable¢0230 ;    MOVE  - Adress of MOVE code¢0240 ;    INADD - Input address¢0250 ;    OUTADD - Input adress¢0260 ;   COUNT - Number of bytes to move¢0270 ;¢0280 ; Notes:¢0290 ;¢0300 ;  Input area should not¢0310 ; overlap output area.¢0320 ;Uses page 0 for¢0330 ; temporary storage at 204-209.¢0340  *=$600 ;Actually relocatable¢0350 ;¢0360 ; Page 0 Temporary Storage¢0370 ;¢0380 INADD=204 ;Input address¢0390 OUTADD=206 ;Output address¢0400 COUNT=208 ;Byte count¢0410 ;¢0420 ; Get arguments¢0430 ;¢0440 MOVE PLA ;Ignore argument count¢0450  PLA ;Input adress hi¢0460  STA INADD+1¢0470  PLA ;Input adress lo¢0480  STA INADD¢0490  PLA ;Output adress hi¢0500  STA OUTADD+1¢0510  PLA ;Output adress lo¢0520  STA OUTADD¢0530  PLA ;Count hi¢0540  STA COUNT+1¢0550  PLA ;Count lo¢0560  STA COUNT¢0570  .PAGE¢0580 ;¢0590 ; Move 256 byte chunkc¢0600 ;¢0610  LDX COUNT+1 ;Get count hi¢0620  BEQ HIDONE ;If 0, hi done¢0630  LDY #0 ;Set to move 256¢0640 MORE LDA (INADD),Y ;Get byte¢0650  STA (OUTADD),Y ;And store it¢0660  DEY ;Decrement count¢0670  BNE MORE ;If not 0, more¢0680  INC INADD+1 ;Next input chunk¢0690  INC OUTADD+1 ;Next output chunk¢0700  DEX ;Decrement count hi¢0710  BNE MORE ;If not 0, more¢0720 ;¢0730 ; Move remainder¢0740 ;¢0750 HIDONE LDY COUNT ;Count remainder¢0760 CHKLO DEY ;Decrement count¢0770  CPY #255 ;Check against end¢0780  BEQ LODONE ;If equal, done¢0790  LDA (INADD),Y ;Get byte¢0800  STA (OUTADD),Y ;Put byte¢0810  CLC ;Do a relative...¢0820  BCC CHKLO JMP¢0830 LODONE RTS ;Fini, return¢0840  .END¢