Prev: CE21 Up: Map Next: D076
CEB8: Character Initialisations
Used by the routines at Character_Chooser and Customer_Frame_01.
Writes a "bandit opening the door" to the door flags/ cache.
Init_Bandit_Open CEB8 LD DE,$D192 Writes Prep_Bandit_Open to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
CEBB LD L,(IX+$00)
CEBE LD H,(IX+$01)
CEC1 LD (HL),E
CEC2 INC HL
CEC3 LD (HL),D
CEC4 LD HL,$D076 Handles copying 0007 bytes of data from the address contained at (depending on which door is currently being actioned);
Address Door
Door_Source_01 Door 1
Door_Source_02 Door 2
Door_Source_03 Door 3
to D076.
CEC7 LD E,(IX+$02)
CECA LD D,(IX+$03)
CECD LD BC,$0007
CED0 LDIR
CED2 LD A,$01 Writes 01 to D18F and return.
CED4 LD ($D18F),A
CED7 RET
Writes a "bandit closing the door" to the door flags/ cache.
Init_Bandit_Close CED8 LD DE,$D1B7 Writes Prep_Bandit_Close to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
CEDB LD L,(IX+$00)
CEDE LD H,(IX+$01)
CEE1 LD (HL),E
CEE2 INC HL
CEE3 LD (HL),D
CEE4 LD HL,$D07D Handles copying 0007 bytes of data from the address contained at (depending on which door is currently being actioned);
Address Door
Door_Source_01 Door 1
Door_Source_02 Door 2
Door_Source_03 Door 3
to D07D.
CEE7 LD E,(IX+$02)
CEEA LD D,(IX+$03)
CEED LD BC,$0007
CEF0 LDIR
CEF2 LD A,$01 Writes 01 to D18F.
CEF4 LD ($D18F),A
CEF7 LD (IX+$07),$01
CEFB RET
Writes "Bowie" to the door flags/ cache.
Init_Bowie CEFC LD DE,$D1DC Writes Prep_Bowie to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
CEFF LD L,(IX+$00)
CF02 LD H,(IX+$01)
CF05 LD (HL),E
CF06 INC HL
CF07 LD (HL),D
CF08 CALL Random_Number Generate a random number. If bit 3 is set, Bowie will have a bomb instead of money. Set the "money / bomb" flag for Bowie in D084.
CF0B AND $08
CF0D LD HL,$D084
CF10 LD (HL),$00
CF12 JR Z,Init_Bowie_Set_Flag
CF14 LD (HL),$01
Init_Bowie_Set_Flag CF16 LD E,(IX+$02) Copy to the values for this door.
CF19 LD D,(IX+$03)
CF1C LD BC,$0009 3 values.
CF1F LDIR Do the copy.
CF21 LD DE,$D863 Copy the routine at Bowie_Shot_Action (shot Bowie) to the door's "gun action" routine.
CF24 LD (IX+$04),E
CF27 LD (IX+$05),D
CF2A RET
Writes "Green Jordan opening the door" to the door flags/ cache.
Init_Customer_Open CF2B LD L,(IX+$00) Writes Prep_Customer to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
CF2E LD H,(IX+$01)
CF31 LD DE,$D201
CF34 LD (HL),E
CF35 INC HL
CF36 LD (HL),D
CF37 CALL Random_Number Generate a random number. If bits 2 and 7 are not set, then Jack Vicious will turn up. Set the "surprised" flag for Green Jordan in D0A1.
CF3A AND $82
CF3C LD HL,$D0A1
CF3F LD (HL),$00
CF41 JR NZ,Init_Customer_Open_Set_Flag
CF43 LD (HL),$01
Init_Customer_Open_Set_Flag CF45 LD HL,$D09C Character defaults for Green Jordan.
CF48 LD E,(IX+$02) Copy to the values for this door.
CF4B LD D,(IX+$03)
CF4E LD BC,$000F 15 values.
CF51 LD A,($D18F) If the "don't copy values" flag is set, return early.
CF54 AND A
CF55 LD A,$00
CF57 LD ($D18F),A
CF5A RET NZ
CF5B LDIR Do the copy and return.
CF5D RET
Writes "Daisy opening the door" to the door flags/ cache.
Init_Customer_Close CF5E LD L,(IX+$00) Writes Prep_Customer to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
CF61 LD H,(IX+$01)
CF64 LD DE,$D201
CF67 LD (HL),E
CF68 INC HL
CF69 LD (HL),D
CF6A CALL Random_Number Generate a random number. If bits 1 and 6 are not set, then Jack Vicious will turn up. Set the "surprised" flag for Daisy in D092.
CF6D AND $41
CF6F LD HL,$D092
CF72 LD (HL),$00
CF74 JR NZ,Init_Customer_Close_Set_Flag
CF76 LD (HL),$01
Init_Customer_Close_Set_Flag CF78 LD HL,$D08D Character defaults for Daisy.
CF7B LD E,(IX+$02) Copy to the values for this door.
CF7E LD D,(IX+$03)
CF81 LD BC,$000F 15 values.
CF84 LD A,($D18F) If the "don't copy values" flag is set, return early.
CF87 AND A
CF88 LD A,$00
CF8A LD ($D18F),A
CF8D RET NZ
CF8E LDIR Do the copy and return.
CF90 RET
Writes a "customer being shot" to the door flags/ cache.
Init_Customer_Shot CF91 LD DE,$D226 Writes Prep_Customer_Shot to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
CF94 LD L,(IX+$00)
CF97 LD H,(IX+$01)
CF9A LD (HL),E
CF9B INC HL
CF9C LD (HL),D
CF9D LD E,(IX+$02) Loads e.g. Door_Source_01 (depending on which door is currently being actioned) into DE.
CFA0 LD D,(IX+$03)
CFA3 LD HL,$D0AB HL=D0AB.
CFA6 INC DE Increase DE by 06.
CFA7 INC DE
CFA8 INC DE
CFA9 INC DE
CFAA INC DE
CFAB INC DE
CFAC LD BC,$0003 Copies three sequential bytes of data from HL to DE.
CFAF LDIR
CFB1 LD HL,$D18F Writes 01 to D18F and return.
CFB4 LD (HL),$01
CFB6 RET
Writes "Julius opening the door" to the door flags/ cache.
Init_Julius_Open CFB7 LD DE,$D241 Writes Prep_Julius_Open to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
CFBA LD L,(IX+$00)
CFBD LD H,(IX+$01)
CFC0 LD (HL),E
CFC1 INC HL
CFC2 LD (HL),D
CFC3 LD HL,$D0AE Defaults for Julius.
CFC6 LD (HL),$00 Generate a random number. If bit 5 is set, Julius will be "bad" and draw a gun.
CFC8 CALL Random_Number
CFCB AND $20
CFCD JR NZ,Init_Julius_Open_Set_Flag
CFCF LD (HL),$01
Init_Julius_Open_Set_Flag CFD1 LD E,(IX+$02) Copy to the values for this door.
CFD4 LD D,(IX+$03)
CFD7 LD BC,$000A 10 values.
CFDA LDIR Do the copy.
CFDC RET
Writes "Julius closing the door" to the door flags/ cache.
Init_Julius_Close CFDD LD A,$01 Writes 01 to D0B8.
CFDF LD ($D0B8),A
CFE2 LD DE,$D265 Writes Prep_Julius_Close to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
CFE5 LD L,(IX+$00)
CFE8 LD H,(IX+$01)
CFEB LD (HL),E
CFEC INC HL
CFED LD (HL),D
CFEE LD HL,$D0B8 Handles copying 0009 bytes of data from the address (plus 1) contained at (depending on which door is currently being actioned);
Address Door
Door_Source_01 Door 1
Door_Source_02 Door 2
Door_Source_03 Door 3
to D0B8.
CFF1 LD E,(IX+$02)
CFF4 LD D,(IX+$03)
CFF7 INC DE
CFF8 LD BC,$0009
CFFB LDIR
CFFD LD A,$01 A=01.
CFFF LD ($D18F),A
D002 LD HL,$D0B8 HL=D0B8.
D005 LD A,(HL)
D006 LD (IX+$07),$02
D00A LD (IX+$06),$05
D00E AND A
D00F RET Z
D010 XOR A
D011 LD (IX+$07),A
D014 LD (IX+$06),A
D017 LD (HL),A
D018 RET Return.
Writes a "drawing bandit opening the door" to the door flags/ cache. This entry point is used by the routine at CAE7.
Init_Bandit_Draw_Open D019 LD DE,$D289 Writes Prep_Bandit_Draw_Open to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
D01C LD L,(IX+$00)
D01F LD H,(IX+$01)
D022 LD (HL),E
D023 INC HL
D024 LD (HL),D
D025 LD L,(IX+$0C) Copies 000B bytes of data from (depending on which door is currently being actioned);
Source Destination Door
Door_Char_Source_01 Door_Source_01 Door 1
Door_Char_Source_02 Door_Source_02 Door 2
Door_Char_Source_03 Door_Source_03 Door 3
D028 LD H,(IX+$0D)
D02B LD E,(IX+$02)
D02E LD D,(IX+$03)
D031 LD BC,$000B
D034 LDIR
D036 RET Return.
Writes "Bandit closing the door" to the door flags/ cache;
Todo_Door_Reset D037 LD A,$01 Writes 01 to the address contained at (depending on which door is currently being actioned);
Address Door
Door_Char_Buffer_01 Door 1
Door_Char_Buffer_02 Door 2
Door_Char_Buffer_03 Door 3
This is the first byte of character state data.
D039 LD L,(IX+$0A)
D03C LD H,(IX+$0B)
D03F LD (HL),A
D040 LD DE,$D2AD Writes Prep_Bandit_Draw_Close to the address contained at (depending on which door is currently being actioned);
Address Door Target
Door_Flags_01 Door 1 Door_Routine_01
Door_Flags_02 Door 2 Door_Routine_02
Door_Flags_03 Door 3 Door_Routine_03
This is copying the actual source data into the cache where it can be manipulated by the game events.
D043 LD L,(IX+$00)
D046 LD H,(IX+$01)
D049 LD (HL),E
D04A INC HL
D04B LD (HL),D
D04C LD L,(IX+$0A) Copies 000B bytes of data from (depending on which door is currently being actioned);
Source Destination Door
Door_Char_Buffer_01 Door_Source_01 Door 1
Door_Char_Buffer_02 Door_Source_02 Door 2
Door_Char_Buffer_03 Door_Source_03 Door 3
D04F LD H,(IX+$0B)
D052 LD E,(IX+$02)
D055 LD D,(IX+$03)
D058 LD BC,$000B
D05B LDIR
D05D LD A,$01 Initialise D18F (writes 01 to it).
D05F LD ($D18F),A
D062 LD L,(IX+$0A) Loads A with the flag from the address contained at (depending on which door is currently being actioned);
Address Door
Door_Char_Buffer_01 Door 1
Door_Char_Buffer_02 Door 2
Door_Char_Buffer_03 Door 3
As per Todo_Door_Reset, this should be 01.
D065 LD H,(IX+$0B)
D068 LD A,(HL)
D069 LD (IX+$07),$02
D06D AND A
D06E RET Z
D06F LD (IX+$07),$00
D073 LD (HL),$00
D075 RET Return.
Prev: CE21 Up: Map Next: D076