Advertisement
Chdata

Untitled

Apr 7th, 2014
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;16bit JSL pointer By: Imamelia ;;
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4. Here's another version of my pointer subroutine. This one should be JSL-able.
  5.  
  6. ExecutePointer16BitOutside:
  7.  
  8. ; this subroutine can be JSL'd to, unlike my other version,
  9. ; which had to remain within the current bank
  10. ; Note: The code assumes that $05-$06 already contained the starting address of the pointer table.
  11. ; (For example, you can LDA PtrsStart STA $05 INC STA $06 in 8-bit mode.)
  12.  
  13. PHA ; preserve our index
  14. PHB ;
  15. PLA ;
  16. STA $09 ; get the data bank from before into the bank byte of the pointer
  17. PLA ; pull our index back
  18. REP #$30 ; 16-bit AXY
  19. AND.w #$00FF ; clear the high 8 bits just in case
  20. ASL A ; multiply the base value by 2 since the pointers are 16-bit
  21. PHX ; preserve X
  22. TAX ; transfer to X, our index
  23. LDA ($05,x) ; load an address from the address in $05-$06, plus whatever our index is
  24. STA $07 ; that depends on the index
  25. SEP #$30 ; go back to 8-bit AXY
  26. PLX ; pull back X
  27. PHK ; push a 24-bit return address:
  28. PER Return-$01 ; bank byte first, then the two lower bytes
  29. JML [$0007] ; jump to the set pointer
  30. Return: ;
  31. RTL ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement