Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BRA instruction
#2
The reason is quite simple: VASYL instructions are either 8- or 16-bit. There are not enough bit combinations available in this space to encode jump instruction with a wider range.

However, this can be easily worked around using DLIST2 register:

; jump to anywhere in the current bank
MOV VREG_DLIST2L, <MY_DESTINATION_ADDRESS
MOV VREG_DLIST2H, >MY_DESTINATION_ADDRESS
MOV VREG_DL2STROBE, 0
; now executing at MY_DESTINATION_ADDRESS

This will need three cycles to execute, so if timing is tight you may prefer to preload DLIST2[H/L] earlier and only execute the jump (by writing to DL2STROBE) at the right time.
Additionally, you may also switch the bank while jumping:

; jump to anywhere in any bank
MOV VREG_DLIST2L, <MY_DESTINATION_ADDRESS
MOV VREG_DLIST2H, >MY_DESTINATION_ADDRESS
MOV VREG_DL2STROBE, 8 | DESTINATION_BANK   ; bank number from 0 to 7
; now executing at MY_DESTINATION_ADDRESS in DESTINATION_BANK

Just keep in mind that when the new frame starts, the display list execution will be restarted from the address stored in DLIST register (not DLIST2!), but in the current (DESTINATION_BANK) bank. This may lead to unexpected behavior, so plan for that, by either ensuring that there is some sensible code in the current bank at that location, by adjusting DLIST content, or by reverting to the original bank before the frame ends.
Reply


Messages In This Thread
BRA instruction - by Hank - 2022-06-29, 10:02 PM
RE: BRA instruction - by laubzega - 2022-07-02, 06:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)