Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; assembly version
  2.  
  3.  lda my     ;multiply my by 32
  4.  sta ptr_h  ;through shifting
  5.  ldy #0     ;a 16-bit var (ptr_h,ptr_l)
  6.  sty ptr_l  ;to the right for three times
  7. dup 3
  8.  lsr ptr_h  ;shift
  9.  ror ptr_l
  10. edup
  11.  lda ptr_l  ;add mx as 16-bit value
  12.  clc
  13.  adc mx
  14.  bcc @1
  15.  inc ptr_h
  16. @1:
  17.  clc
  18.  adc #<map  ;add map offset
  19.  sta ptr_l
  20.  lda ptr_h
  21.  adc #>map
  22.  sta ptr_h
  23.  lda [ptr_l],y  ;read the value
  24.  
  25.  
  26. // C version
  27.  
  28. n=map[(my<<5)+mx];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement