Guest User

Untitled

a guest
Jun 13th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; This program swaps the first element of an array of byte-length data with the last
  2. ; element, the 2nd element with 2nd to last, and so on.
  3.  
  4. data        equ $1000
  5. prog        equ     $2000
  6.        
  7.         org     data
  8. L       dc.b    $05
  9. array       db      1,2,3,4,5
  10.  
  11.         org     prog
  12.         ldb L
  13.         ldx     #$0002
  14.         idiv
  15.         pshx
  16.         puld
  17.         exg A,B
  18.         ldy     #$1000
  19.         ldb     L
  20.         aby
  21.         ldx #array
  22.  
  23. loop        tsta
  24.         beq done
  25.         movb    0,Y,0,SP
  26.         movb    0,X,1,Y-
  27.         movb    0,SP,1,X+
  28.         deca
  29.         bne loop
  30. done        swi
  31.         end
Add Comment
Please, Sign In to add comment