Prev: BF60 Up: Map Next: C03F
BF9D: New game initialization - set up game data
Used by the routine at BF60.
This section initializes a bunch of new game data - copying bytes/addresses into the 'current game' state.
BF9D LD HL,$7172 Reset/store the address pointer to the start level text (Gatehouse Level)
BFA0 LD ($EB5B),HL
BFA3 LD HL,$6C7C Address pointer to warlock and creature stat tables
BFA6 LD ($EBC3),HL
BFA9 LD HL,$6CDC Address pointer to missile data tables
BFAC LD ($EBC1),HL
BFAF LD HL,$6DFC Reset/store the pointer to the start of spell list text (1st spell = MOVE)
BFB2 LD ($EB65),HL
BFB5 LD HL,$6FBC Reset/store the pointer to the start of spell name texts -1
BFB8 LD ($EB67),HL
BFBB LD HL,$6FBD Reset/store the pointer to the start of spell text messages ('Project thy soul' etc)
BFBE LD ($EB63),HL
BFC1 LD A,$1B 27 = total number of spells (for spell list at 6DFC)
BFC3 LD ($EB69),A
BFC6 LD HL,$97C3 Reset/store the pointer to the start of an address list pointing at graphics
BFC9 LD ($EB6A),HL
Code that was used to create the initial game menus and draw the decorative screen border gets overwritten for game data (the player doesn't return to the menu and the border doesn't get erased):
The following instructions initialize a number of address pointers to the new data sets. Each section is terminated with an end-of-data byte (255).
ROOM ITEM/OBJECT/SCENERY DATA SETS FOR THE CURRENT ROOM
BFCC LD HL,($DAEE) Address pointer to room item/object/scenery data sets at 7C00
BFCF LD DE,$0300 768 bytes reserved for this
BFD2 ADD HL,DE
BFD3 LD (HL),$FF
FOREGROUND SCENERY DATA SETS FOR CURRENT ROOM
BFD5 INC HL
BFD6 LD ($EB70),HL Address pointer to foreground scenery data sets at 7F01
BFD9 LD DE,$0070 112 bytes reserved for these
BFDC ADD HL,DE
BFDD LD (HL),$FF
MAROC'S INVENTORY - UP TO 4 OBJECTS
BFDF INC HL
BFE0 LD ($EBBA),HL Maroc's inventory ('pockets') - 64 bytes (4 object spaces x 16 bytes) at 7F72
BFE3 LD B,$04
BFE5 LD DE,$0010
BFE8 LD (HL),$00 Reset first byte of each inventory slots (0 = nothing carried)
BFEA ADD HL,DE
BFEB DJNZ $BFE8
BFED LD (HL),$FF
COLLISION/EVENT CHECKS FOR ELEMENTS IN THE CURRENT ROOM
BFEF INC HL
BFF0 LD ($EB6C),HL Address pointer to elements/objects/events going on in current room at 7FB3
BFF3 LD (HL),$FF 255 = no more events/collisions to check
BFF5 LD DE,$0080 128 bytes reserved for these
BFF8 ADD HL,DE
UNUSED DATA AREA
BFF9 LD ($EB5F),HL Skip over 32 bytes at 8033 (this data is unused)
BFFC LD DE,$0020
BFFF ADD HL,DE
FLIPPED/MIRRORED GRAPHICS
C000 LD ($EB61),HL Address pointer to flipped graphics store at 8053
MAROC'S INVENTORY SLOTS
C003 LD HL,($EBBA) Address pointer to start of Maroc's inventory (7F72)
C006 LD ($EBBC),HL Copy to current inventory address pointer
C009 LD DE,$0010 Advance 16 bytes to start of next inventory item address pointer
C00C ADD HL,DE
C00D LD ($EBBE),HL And store (32642) in current game data
Prepare graphics for Maroc's sprite
C010 LD A,$01
C012 LD ($EB50),A Graphics & frame offset (1 = no graphic address offset, start at frame #1) - sprite graphics pointer starts at 97C3
C015 CALL $E0C2 Set up graphics
C018 LD HL,($EB51) Store Maroc's calculated sprite graphic address pointer
C01B LD ($EAC2),HL
C01E LD A,$7C 'Dummy' graphic address (AD9C) - used where nothing needs to be drawn/printed
C020 CALL $E0C2
C023 LD HL,($EB51) Store calculated graphic address pointer
C026 LD ($EAF3),HL
C029 LD A,$7B Set up graphics for Maroc's shadow (at AD88)
C02B CALL $E0C2
C02E LD HL,($EB51) Get Maroc's shadow's calculated sprite graphic address pointer
C031 LD ($EAC4),HL ...and copy to game data store
C034 LD A,$69 Set up flickering barrier graphics (A9EC) used for spells such as SHIELD, PROTECT and DEFENCE
C036 CALL $E0C2
C039 LD HL,($EB51) Get the address pointer to these graphics
C03C LD ($EC96),HL ...and copy to the current game data store
Prev: BF60 Up: Map Next: C03F