Prev: CEFE Up: Map Next: CF80
CF43: Clear Script Command Flags
Used by the routine at ContinueScriptExecution.
Clears flag bytes in a script command based on the command type and flag bits. Different command types require clearing different numbers of flag bytes to mark them as processed.
Input
IX Pointer to script command data
ClearScriptCommandFlags CF43 LD A,(IX+$00) Read the command flag byte.
Clear the first flag byte if certain flag bits are set, indicating those conditions have been processed.
CF46 BIT 7,A Call ClearScriptCommandFlags_ClearFirst if bit 7 is set.
CF48 CALL NZ,ClearScriptCommandFlags_ClearFirst
CF4B BIT 4,A Call ClearScriptCommandFlags_ClearFirst if bit 4 is set.
CF4D CALL NZ,ClearScriptCommandFlags_ClearFirst
CF50 AND %00001111 Extract the command type (bits 0-3).
Route to the appropriate handler based on command type to clear the required number of flag bytes.
CF52 CP $01 Jump to ClearScriptCommandFlags_ClearFirst for command type 01.
CF54 JR Z,ClearScriptCommandFlags_ClearFirst
CF56 CP $02 Jump to ClearScriptCommandFlags_ClearTwo for command types:
  • 02
  • 05
  • 07
CF58 JR Z,ClearScriptCommandFlags_ClearTwo
CF5A CP $05
CF5C JR Z,ClearScriptCommandFlags_ClearTwo
CF5E CP $07
CF60 JR Z,ClearScriptCommandFlags_ClearOne
CF62 CP $06 Jump to ClearScriptCommandFlags_ClearOneAlt for command type 06.
CF64 JR Z,ClearScriptCommandFlags_ClearOneAlt
CF66 CP $04 Call ClearScriptCommandFlags_ClearSecond for command type 04.
ClearScriptCommandFlags_ClearOne CF68 CALL Z,ClearScriptCommandFlags_ClearSecond Clear one flag byte.
ClearScriptCommandFlags_ClearTwo CF6B CALL Z,ClearScriptCommandFlags_ClearFirst Call ClearScriptCommandFlags_ClearFirst for command type 04 (alternative path).
CF6E CP $03 Call ClearScriptCommandFlags_ClearSecond for command type 03.
ClearScriptCommandFlags_ClearOneAlt CF70 CALL Z,ClearScriptCommandFlags_ClearSecond Clear one flag byte.
ClearScriptCommandFlags_ClearFirst CF73 LD (IX+$00),$00 Clear the first flag byte.
CF77 INC IX Advance the pointer.
ClearScriptCommandFlags_ClearSecond CF79 LD (IX+$00),$00 Clear the second flag byte.
CF7D INC IX Advance the pointer.
CF7F RET Return.
Prev: CEFE Up: Map Next: CF80