Prev: C0B0 Up: Map Next: C4BA
C47C: The game's first instruction
The loader returns here once it has checked its checksum and cleared itself. The stack goes near the top of SOURCE_AND_STACK; the loading tune plays until a key is pressed; IY is set to the variables, and interrupts turned off for the rest of the game; the object table and the templates are copied from where the tape has them to where the game reads them; a master copy of the object table, the variables and the knight's record is made at MASTER_OBJECTS, for each new game to start from; and the title page begins.
The game runs with interrupts off from here on (measured: the interrupt flip-flop stays clear in the simulator, and the ROM's frame counter in its system variables never moves). It has to: the sprites from SPRITE5B00 up lie over the ROM's system variables, which the ROM's interrupt routine writes to fifty times a second.
START C47C LD HL,STACK_TOP The stack: two bytes below the end of SOURCE_AND_STACK, over leftover source text.
C47F LD SP,HL
C480 CALL LOADING_TUNE The loading tune, until a key is pressed.
C483 LD IY,OBJECT_COUNT IY at the variables, from here on.
C487 DI Interrupts off for good (the tune turned them on as it returned).
C488 LD HL,OBJECTS_TAPE The object table, and 263 bytes of text after it: 3420 bytes from OBJECTS_TAPE to OBJECTS.
C48B LD DE,OBJECTS
C48E LD BC,$0D5C
C491 LDIR
C493 LD HL,TEMPLATES_TAPE The templates and the patches: 932 bytes from TEMPLATES_TAPE to TEMPLATES.
C496 LD DE,TEMPLATES
C499 LD BC,$03A4
C49C LDIR
C49E LD DE,MASTER_OBJECTS The master copy: the object table's first 1200 bytes...
C4A1 LD HL,OBJECTS
C4A4 LD BC,$04B0
C4A7 LDIR
C4A9 LD HL,OBJECT_COUNT ...the 61 bytes of variables a new game starts with (IY+$00 to IY+$3C; B is 0 after the LDIR)...
C4AC LD C,$3D
C4AE LDIR
C4B0 LD HL,KNIGHT ...and the knight's record.
C4B3 LD C,$14
C4B5 LDIR
C4B7 JP TITLE_SCREEN The title page.
Prev: C0B0 Up: Map Next: C4BA