Prev: BACE Up: Map Next: BB3E
BAD8: Initialize character data
Used by the routines at 8155 and 8184.
BAD8 LD IY,$BC67 Set the current player buffer (B09D) to Wally. (BC67)
BADC LD ($B09D),IY
Copy the initial object states. Objects 00 - 1E are held in rooms, the remainder are held by the characters.
BAE0 LD HL,$BB3E Point HL at the initial collectable object states. (BB3E)
BAE3 LD DE,$BCE9 Point DE at the start of the room object data. (BCE9)
BAE6 LD B,$1F 1F items to initialise
BAE8 PUSH BC Remember this value.
BAE9 LD A,(DE) Get the next byte.
BAEA CP $FF Is it an end marker?
BAEC JR NZ,$BAF1 Move forward if it isn't ie: there are objects here.
BAEE INC DE Otherwise move to the next byte and check the next room.
BAEF JR $BAE9
An object was found. Copy the template data.
BAF1 LDI Copy the object ID.
BAF3 INC DE Skip over the co-ordinates which are fixed.
BAF4 INC DE
BAF5 LDI Copy the flags.
BAF7 POP BC Restore the flags.
BAF8 DJNZ $BAE8 Loop while there are more objects to initialise.
Copy the initial data for the characters.
BAFA LD BC,$00AF Number of bytes to copy.
BAFD LD HL,$BB7C Copy from the initial template. (BB7C)
BB00 LD DE,$BC30 Copy to start of main buffer. (BC30)
BB03 LDIR Do the copy.
Set initial flags;
BB05 XOR A Set A to zero, which will be set for some flags.
BB06 LD ($ECF5),A Set the next reward screen (ECF5) to 0 (morning).
BB09 LD ($ECFE),A Set the money earned (ECFE) to £0.
BB0C LD ($ECFF),A
BB0F INC A Set 0 letters brought to the safe. (EDC5)
BB10 LD ($EDC5),A
Set up initial data on School Lane.
BB13 LD A,$14 Set 14 asteroids left to hit. (F9F4)
BB15 LD ($F9F4),A
BB18 LD A,$28 Set the lightning bolts in School Lane to cover just the pylon area, making it inaccessible.
BB1A LD ($F5BE),A
BB1D LD A,$3C
BB1F LD ($F5C2),A
BB22 LD A,$20
BB24 LD ($F5C6),A
Reset the money table.
BB27 LD HL,$EC5C Point HL at the earnings buffer.
BB2A LD B,$20 20 entries to look at.
BB2C LD (HL),$00 Set the ID to 0.
BB2E INC HL Point HL at the next entry.
BB2F INC HL
BB30 INC HL
BB31 DJNZ $BB2C Loop while there are more entries to update.
BB33 LD HL,$EC0F Point HL at the game flags. (EC0F)
BB36 LD B,$0E 0E entries to update.
BB38 LD (HL),$00 Reset the flag.
BB3A INC HL Point HL at the next one.
BB3B DJNZ $BB38 Loop while there are more flags to reset.
BB3D RET Return.
Prev: BACE Up: Map Next: BB3E