Prev: 860F Up: Map Next: 86F6
865A: Draw the pre-game screen
Used by the routine at run_pregame_screen.
draw_pregame 865A LD HL,$77D8 Address of data
dp_loop 865D LD A,(HL) A = *HL
865E AND A Set flags
865F JP Z,draw_pregame_10 Jump to rendering messages only, if zero
8662 INC HL HL++
8663 CP $D0 Jump if < $D0
8665 JR C,draw_pregame_2
8667 CP $E0 Jump if < $E0 -- $D0..DF
8669 JR C,draw_pregame_0
866B CP $F0 Jump if >= $F0
866D JR NC,draw_pregame_1
Otherwise handle $E0..$EF. This just seems to set a value.
866F SUB $E0 A -= $E0
8671 LD ($86C9),A Self modify draw_pregame_7 with A
8674 JR dp_loop Loop
Handle $D0..DF.
draw_pregame_0 8676 SUB $D0 A -= $D0
8678 RLCA Self modify 86C2 with A * 8
8679 RLCA
867A RLCA
867B LD ($86C3),A
867E JR dp_loop Loop
Handle $F0..FF.
draw_pregame_1 8680 LD D,A D = A
8681 LD E,(HL) E = *HL++
8682 INC HL
8683 JR dp_loop Loop
Handle $00..$CF.
draw_pregame_2 8685 CP $1F
8687 LD B,$01 B = 1 single tile?
8689 JR NC,draw_pregame_3 Jump if >= $1F
868B LD B,A B = A run of tiles?
868C LD A,(HL) A = *HL++
868D INC HL
Handle $1F..?
draw_pregame_3 868E PUSH HL
868F SUB $1F A -= $1F A is now a tile index
8691 RLCA multiply by 8 - size of tile
8692 RLCA
8693 RLA why the different rotates?
8694 PUSH BC
8695 LD C,A BC = A
8696 LD B,$00
8698 RL B shift in carry flag?
869A LD HL,$78A7 Address of base of tiles
869D ADD HL,BC Point at tile we need
869E POP BC
869F EX DE,HL
label=loop_86a0
draw_pregame_4 86A0 PUSH BC
86A1 PUSH DE
86A2 PUSH HL
Plot a tile.
86A3 LD B,$08 B = 8
draw_pregame_5 86A5 LD A,(DE) *HL = *DE++
86A6 LD (HL),A
86A7 INC DE
86A8 INC H H++
86A9 DJNZ draw_pregame_5 Loop
86AB POP BC
86AC LD A,B D = (B << 2) & $20
86AD RLA
86AE RLA
86AF AND $20
86B1 LD D,A
86B2 LD A,C E = (C & $1F) + D
86B3 AND $1F
86B5 ADD A,D
86B6 LD E,A
86B7 LD A,C A = (C & $E0) << 1
86B8 AND $E0
86BA ADD A,A
86BB LD D,$59 D = $59
86BD JR NC,draw_pregame_6
86BF INC D D++
draw_pregame_6 86C0 ADD A,E A += E
86C1 LD E,A E = A
86C2 LD A,$00 A = xx Self modified
86C4 AND A Set flags
86C5 JR Z,draw_pregame_7 Jump if zero
86C7 LD (DE),A *DE = A
draw_pregame_7 86C8 LD A,$00 A = xx Self modified
86CA DEC A A--
86CB JR Z,draw_pregame_8 Jump if zero
86CD LD A,H A = H & $0F
86CE AND $0F
86D0 JR NZ,draw_pregame_9 Jump if non-zero
86D2 LD A,H H -= $10
86D3 SUB $10
86D5 LD H,A
86D6 LD A,L L += $20
86D7 ADD A,$20
86D9 LD L,A
86DA JR draw_pregame_9
draw_pregame_8 86DC LD H,B HL = BC
86DD LD L,C
86DE INC L L++
draw_pregame_9 86DF POP DE
86E0 POP BC
86E1 DJNZ draw_pregame_4 Loop loop_86a0 while B
86E3 EX DE,HL
86E4 POP HL
86E5 JP dp_loop Loop
draw_pregame_10 86E8 LD B,$04 4 messages to print
86EA LD HL,$7798 Address of pre_game_messages
draw_pregame_11 86ED LD A,$04 Flags TBD
86EF DEC HL HL--
86F0 CALL print_message Call print_message
86F3 DJNZ draw_pregame_11 Loop while B > 0
86F5 RET Return
Prev: 860F Up: Map Next: 86F6