Prev: CEDE Up: Map Next: CF43
CEFE: 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 CEFE BIT 7,A Call AdvanceScriptPointerByCommandSize_AdvanceTwo if bit 7 is set (extended command).
CF00 CALL NZ,AdvanceScriptPointerByCommandSize_AdvanceTwo
This entry point is used by the routine at ContinueScriptExecution.
AdvanceScriptPointerByCommandSize_ExtractType CF03 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.
CF05 CP $0F Jump to AdvanceScriptPointerByCommandSize_AdvanceOne for command type 0F.
CF07 JR Z,AdvanceScriptPointerByCommandSize_AdvanceOne
CF09 CP $08 Jump to AdvanceScriptPointerByCommandSize_AdvanceTwo for command types:
  • 08
  • 09
  • 01
CF0B JR Z,AdvanceScriptPointerByCommandSize_AdvanceTwo
CF0D CP $09
CF0F JR Z,AdvanceScriptPointerByCommandSize_AdvanceTwo
CF11 CP $01
CF13 JR Z,AdvanceScriptPointerByCommandSize_AdvanceTwo
CF15 CP $02 Jump to AdvanceScriptPointerByCommandSize_AdvanceFour for command type 02.
CF17 JR Z,AdvanceScriptPointerByCommandSize_AdvanceFour
CF19 CP $03 Jump to AdvanceScriptPointerByCommandSize_AdvanceThree for command type 03.
CF1B JR Z,AdvanceScriptPointerByCommandSize_AdvanceThree
CF1D CP $0D Jump to AdvanceScriptPointerByCommandSize_AdvanceTwo for command type 0D.
CF1F JR Z,AdvanceScriptPointerByCommandSize_AdvanceTwo
CF21 CP $0E Jump to AdvanceScriptPointerByCommandSize_AdvanceThree for command type 0E.
CF23 JR Z,AdvanceScriptPointerByCommandSize_AdvanceThree
CF25 CP $07 Jump to AdvanceScriptPointerByCommandSize_AdvanceFive for command types:
  • 07
  • 0C
CF27 JR Z,AdvanceScriptPointerByCommandSize_AdvanceFive
CF29 CP $0C
CF2B JR Z,AdvanceScriptPointerByCommandSize_AdvanceFive
CF2D CP $0B Jump to AdvanceScriptPointerByCommandSize_AdvanceOne for command types:
  • 0B
  • 0A
CF2F JR Z,AdvanceScriptPointerByCommandSize_AdvanceOne
CF31 CP $0A
CF33 JR Z,AdvanceScriptPointerByCommandSize_AdvanceOne
CF35 CP $05 Jump to AdvanceScriptPointerByCommandSize_AdvanceFour for command type 05.
CF37 JR Z,AdvanceScriptPointerByCommandSize_AdvanceFour
CF39 CP $04 Jump to AdvanceScriptPointerByCommandSize_AdvanceThree for command type 04.
CF3B JR NZ,AdvanceScriptPointerByCommandSize_AdvanceThree
AdvanceScriptPointerByCommandSize_AdvanceFive CF3D INC HL Advance HL by five bytes.
AdvanceScriptPointerByCommandSize_AdvanceFour CF3E INC HL Advance HL by four bytes.
AdvanceScriptPointerByCommandSize_AdvanceThree CF3F INC HL Advance HL by three bytes.
This entry point is used by the routine at ContinueScriptExecution.
AdvanceScriptPointerByCommandSize_AdvanceTwo CF40 INC HL Advance HL by two bytes.
AdvanceScriptPointerByCommandSize_AdvanceOne CF41 INC HL Advance HL by one byte.
CF42 RET Return.
Prev: CEDE Up: Map Next: CF43