| Startup routines

56576: Prepare the bottom 4 lines of the screen

Used by the routine at 61630.
56576 | NOP |
56577 | NOP |
56578 | NOP |
56579 | LD H,80 | Clear the bottom 4 lines (32 pixel rows) of the display file
56581 | LD L,128
56583 | XOR A
56584 | LD (HL),A
56585 | INC L
56586 | JR NZ,56584
56588 | INC H
56589 | BIT 3,H
56591 | JR Z,56581
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
--- | ---
55040 | 126 bytes
55296 | 126 bytes
55552 | 126 bytes
55808 | 126 bytes
56064 | 72 bytes
56593 | LD HL,55040 | Point HL at the first byte to be copied to the screen
56596 | LD DE,20640 | Point DE at the first display file location to be written
56599 | LD C,24 | There are 24 bytes per row of pixels
56601 | PUSH DE | Save the display file pointer
56602 | LD B,24 | There are 24 rows of pixels to be drawn
56604 | LD A,(HL) | Pick up a byte to copy
56605 | LD (DE),A | Copy the byte to the screen
56606 | INC L | Move HL along to the next byte to copy
56607 | LD A,L | Have we reached the end of a segment?
56608 | SUB 126
56610 | JR NZ,56614 | Jump if not
56612 | LD L,A | Point HL at the first byte in the next segment
56613 | INC H
56614 | INC D | Point DE at the next pixel row down on the screen
56615 | BIT 3,D | Have we just copied a byte to the 8th or 16th row of pixels?
56617 | JR Z,56625 | Jump if not
56619 | LD D,80 | Otherwise point DE at the 9th or 17th row of pixels
56621 | LD A,E
56622 | ADD A,32
56624 | LD E,A
56625 | DJNZ 56604 | Jump back until a column of 24 bytes has been copied
56627 | POP DE | Restore the display file pointer
56628 | INC E | Point DE at the top byte in the next column along
56629 | DEC C | Have we finished all 24 columns?
56630 | JR NZ,56601 | 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.
56632 | LD HL,23168 | Point HL at the first attribute byte of the line where on-screen messages will be displayed
56635 | LD B,32 | There are 32 attribute bytes in this line
56637 | LD (HL),15 | Set each attribute byte to 15 (INK 7: PAPER 1)
56639 | INC L
56640 | DJNZ 56637
56642 | LD C,3 | There are 3 lines at the bottom of the screen that still need their attribute bytes set
56644 | LD B,8 | The first 8 bytes in each line correspond to the Contact Sam Cruise logo
56646 | LD (HL),23 | Set these attribute bytes to 23 (INK 7: PAPER 2)
56648 | INC L
56649 | DJNZ 56646
56651 | LD B,12 | The next 12 bytes in each line correspond to the icon panel
56653 | LD (HL),54 | Set these attribute bytes to 54 (INK 6: PAPER 6)
56655 | INC L
56656 | DJNZ 56653
56658 | LD B,9 | The next 9 bytes in each line correspond to the score box
56660 | LD (HL),32 | Set these attribute bytes to 32 (INK 0: PAPER 4)
56662 | INC L
56663 | DJNZ 56660
56665 | LD B,3 | The last 3 bytes in each line correspond to the disguise box
56667 | LD (HL),23 | Set these attribute bytes to 23 (INK 7: PAPER 2)
56669 | INC L
56670 | DJNZ 56667
56672 | DEC C | Have we done all 3 lines at the bottom of the screen?
56673 | JR NZ,56644 | Jump back to do the next line if not
56675 | RET |