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