Prev: 52958 Up: Map Next: 53059
52990: Advance Script Pointer By Command Size
Used by the routine at ProcessScriptCommandWithCounter.
Advances the script pointer past a command byte by the appropriate number of bytes based on the command type. Different command types have different data sizes, so the pointer must be advanced accordingly.
Input
A Command byte
Output
HL Updated script pointer
Extended commands (bit 7 set) require an extra 2-byte advance before the normal command type advance.
AdvanceScriptPointerByCommandSize 52990 BIT 7,A Call AdvanceScriptPointerByCommandSize_AdvanceTwo if bit 7 is set (extended command).
52992 CALL NZ,AdvanceScriptPointerByCommandSize_AdvanceTwo
This entry point is used by the routine at ContinueScriptExecution.
AdvanceScriptPointerByCommandSize_ExtractType 52995 AND %00001111 Extract the command type (bits 0-3).
Route to the appropriate handler based on command type to advance the script pointer by the correct number of bytes.
52997 CP 15 Jump to AdvanceScriptPointerByCommandSize_AdvanceOne for command type 15.
52999 JR Z,AdvanceScriptPointerByCommandSize_AdvanceOne
53001 CP 8 Jump to AdvanceScriptPointerByCommandSize_AdvanceTwo for command types:
  • 8
  • 9
  • 1
53003 JR Z,AdvanceScriptPointerByCommandSize_AdvanceTwo
53005 CP 9
53007 JR Z,AdvanceScriptPointerByCommandSize_AdvanceTwo
53009 CP 1
53011 JR Z,AdvanceScriptPointerByCommandSize_AdvanceTwo
53013 CP 2 Jump to AdvanceScriptPointerByCommandSize_AdvanceFour for command type 2.
53015 JR Z,AdvanceScriptPointerByCommandSize_AdvanceFour
53017 CP 3 Jump to AdvanceScriptPointerByCommandSize_AdvanceThree for command type 3.
53019 JR Z,AdvanceScriptPointerByCommandSize_AdvanceThree
53021 CP 13 Jump to AdvanceScriptPointerByCommandSize_AdvanceTwo for command type 13.
53023 JR Z,AdvanceScriptPointerByCommandSize_AdvanceTwo
53025 CP 14 Jump to AdvanceScriptPointerByCommandSize_AdvanceThree for command type 14.
53027 JR Z,AdvanceScriptPointerByCommandSize_AdvanceThree
53029 CP 7 Jump to AdvanceScriptPointerByCommandSize_AdvanceFive for command types:
  • 7
  • 12
53031 JR Z,AdvanceScriptPointerByCommandSize_AdvanceFive
53033 CP 12
53035 JR Z,AdvanceScriptPointerByCommandSize_AdvanceFive
53037 CP 11 Jump to AdvanceScriptPointerByCommandSize_AdvanceOne for command types:
  • 11
  • 10
53039 JR Z,AdvanceScriptPointerByCommandSize_AdvanceOne
53041 CP 10
53043 JR Z,AdvanceScriptPointerByCommandSize_AdvanceOne
53045 CP 5 Jump to AdvanceScriptPointerByCommandSize_AdvanceFour for command type 5.
53047 JR Z,AdvanceScriptPointerByCommandSize_AdvanceFour
53049 CP 4 Jump to AdvanceScriptPointerByCommandSize_AdvanceThree for command type 4.
53051 JR NZ,AdvanceScriptPointerByCommandSize_AdvanceThree
AdvanceScriptPointerByCommandSize_AdvanceFive 53053 INC HL Advance HL by five bytes.
AdvanceScriptPointerByCommandSize_AdvanceFour 53054 INC HL Advance HL by four bytes.
AdvanceScriptPointerByCommandSize_AdvanceThree 53055 INC HL Advance HL by three bytes.
This entry point is used by the routine at ContinueScriptExecution.
AdvanceScriptPointerByCommandSize_AdvanceTwo 53056 INC HL Advance HL by two bytes.
AdvanceScriptPointerByCommandSize_AdvanceOne 53057 INC HL Advance HL by one byte.
53058 RET Return.
Prev: 52958 Up: Map Next: 53059