| Startup routines

DD00: Prepare the bottom 4 lines of the screen

Used by the routine at F0BE.
DD00 | NOP |
DD01 | NOP |
DD02 | NOP |
DD03 | LD H,$50 | Clear the bottom 4 lines (32 pixel rows) of the display file
DD05 | LD L,$80
DD07 | XOR A
DD08 | LD (HL),A
DD09 | INC L
DD0A | JR NZ,$DD08
DD0C | INC H
DD0D | BIT 3,H
DD0F | JR Z,$DD05
Now the first 24 character squares on each of the bottom 3 lines (24 pixel rows) of the screen are filled with graphic data. The 576 bytes of graphic data are copied to the screen from the following 5 segments:
Address | Length
--- | ---
D700 | 126 bytes
D800 | 126 bytes
D900 | 126 bytes
DA00 | 126 bytes
DB00 | 72 bytes
DD11 | LD HL,$D700 | Point HL at the first byte to be copied to the screen
DD14 | LD DE,$50A0 | Point DE at the first display file location to be written
DD17 | LD C,$18 | There are 24 bytes per row of pixels
DD19 | PUSH DE | Save the display file pointer
DD1A | LD B,$18 | There are 24 rows of pixels to be drawn
DD1C | LD A,(HL) | Pick up a byte to copy
DD1D | LD (DE),A | Copy the byte to the screen
DD1E | INC L | Move HL along to the next byte to copy
DD1F | LD A,L | Have we reached the end of a segment?
DD20 | SUB $7E
DD22 | JR NZ,$DD26 | Jump if not
DD24 | LD L,A | Point HL at the first byte in the next segment
DD25 | INC H
DD26 | INC D | Point DE at the next pixel row down on the screen
DD27 | BIT 3,D | Have we just copied a byte to the 8th or 16th row of pixels?
DD29 | JR Z,$DD31 | Jump if not
DD2B | LD D,$50 | Otherwise point DE at the 9th or 17th row of pixels
DD2D | LD A,E
DD2E | ADD A,$20
DD30 | LD E,A
DD31 | DJNZ $DD1C | Jump back until a column of 24 bytes has been copied
DD33 | POP DE | Restore the display file pointer
DD34 | INC E | Point DE at the top byte in the next column along
DD35 | DEC C | Have we finished all 24 columns?
DD36 | JR NZ,$DD19 | Jump back if not
Now that the bottom 4 lines of the display file are ready, it's time to prepare the bottom 4 lines of the attribute file.
DD38 | LD HL,$5A80 | Point HL at the first attribute byte of the line where on-screen messages will be displayed
DD3B | LD B,$20 | There are 32 attribute bytes in this line
DD3D | LD (HL),$0F | Set each attribute byte to 0x0F (INK 7: PAPER 1)
DD3F | INC L
DD40 | DJNZ $DD3D
DD42 | LD C,$03 | There are 3 lines at the bottom of the screen that still need their attribute bytes set
DD44 | LD B,$08 | The first 8 bytes in each line correspond to the Contact Sam Cruise logo
DD46 | LD (HL),$17 | Set these attribute bytes to 0x17 (INK 7: PAPER 2)
DD48 | INC L
DD49 | DJNZ $DD46
DD4B | LD B,$0C | The next 12 bytes in each line correspond to the icon panel
DD4D | LD (HL),$36 | Set these attribute bytes to 0x36 (INK 6: PAPER 6)
DD4F | INC L
DD50 | DJNZ $DD4D
DD52 | LD B,$09 | The next 9 bytes in each line correspond to the score box
DD54 | LD (HL),$20 | Set these attribute bytes to 0x20 (INK 0: PAPER 4)
DD56 | INC L
DD57 | DJNZ $DD54
DD59 | LD B,$03 | The last 3 bytes in each line correspond to the disguise box
DD5B | LD (HL),$17 | Set these attribute bytes to 0x17 (INK 7: PAPER 2)
DD5D | INC L
DD5E | DJNZ $DD5B
DD60 | DEC C | Have we done all 3 lines at the bottom of the screen?
DD61 | JR NZ,$DD44 | Jump back to do the next line if not
DD63 | RET |