; TURGEN SYSTEM
; Plugin: Standard
; Move routine - Move block of data to lower addresses
; ATASM
; From www.6502.org

         *=1024
         
         BUFRLO=50
         BUFRHI=51
         BFENLO=52
         BFENHI=53

SIZEL    .BYTE 0        ; TS fills these fields
SIZEH    .BYTE 0

         LDA #0         ; TS modifies opcodes
         STA BUFRLO   
         LDA #0
         STA BUFRHI
         LDA #0
         STA BFENLO
         LDA #0
         STA BFENHI

MOVEDOWN LDY #0
         LDX SIZEH
         BEQ MD2
MD1      LDA (BUFRLO),Y ; Move a page at a time
         STA (BFENLO),Y
         INY
         BNE MD1
         INC BUFRLO+1
         INC BFENLO+1
         DEX
         BNE MD1
MD2      LDX SIZEL
         BEQ MD4
MD3      LDA (BUFRLO),Y ; Move the remaining bytes
         STA (BFENLO),Y
         INY
         DEX
         BNE MD3
MD4      JMP (736)      ; Run the moved program
