Prev: 6113 Up: Map Next: 61F3
6150: Draw the enemy bikes
Used by the routine at 5F89.
6150 LD A,$60
6152 LD H,$48
6154 ADD A,C
6155 LD L,A
6156 LD A,($5DD6) Get the current distance to the bikes
6159 LD DE,$7184 Point DE at the enemy bike graphics UDG table at 7184
615C CP $02 Are the bikes far away?
615E JP M,$616A Jump forward if so
6161 CP $04 Are the bikes visible at all?
6163 LD DE,$71B4 71B4 - large bike UDGs
6166 JP M,$619F Jump if they are
6169 RET Bail out, no bikes to draw
Draw small bikes
616A EX DE,HL
616B LD A,($5DC1) Get the bike position and work out the screen offset
616E INC A
616F LD B,A
6170 LD A,($5DD6) Get the bike's image type
6173 LD C,A Convert this to a graphic address
6174 ADD A,A
6175 ADD A,C
6176 ADD A,B
6177 ADD A,A
6178 ADD A,A
6179 ADD A,A
617A LD B,$00
617C LD C,A
617D ADD HL,BC
Copy the bike onto screen
617E EX DE,HL
617F LD B,$08
6181 LD A,(DE)
6182 OR (HL)
6183 LD (HL),A
6184 INC H
6185 INC DE
6186 DJNZ $6181
6188 LD H,$48
618A LD A,$E0
618C ADD A,L
618D LD L,A
618E LD A,$10
6190 CP (HL)
6191 JR C,$619E
Copy the attribute
6193 LD A,$20
6195 ADD A,L
6196 LD L,A
6197 LD H,$59
6199 LD A,($5DC0)
619C OR (HL)
619D LD (HL),A
619E RET
Draw large bikes
619F EX DE,HL
61A0 LD A,($5DC1) Get the bike's position and work out its screen address
61A3 INC A
61A4 LD B,A
61A5 LD A,($5DD6) Get the bike's image type
61A8 ADD A,$FE Convert this to a graphic address
61AA LD C,A
61AB ADD A,A
61AC ADD A,C
61AD ADD A,B
61AE PUSH HL
61AF LD H,$00
61B1 LD L,A
61B2 ADD HL,HL
61B3 ADD HL,HL
61B4 ADD HL,HL
61B5 ADD HL,HL
61B6 POP BC
61B7 ADD HL,BC
Copy the bike onto screen
61B8 EX DE,HL
61B9 LD B,$08
61BB LD A,(DE)
61BC OR (HL)
61BD LD (HL),A
61BE INC H
61BF INC DE
61C0 DJNZ $61BB
61C2 LD H,$48
61C4 LD A,$40
61C6 ADD A,L
61C7 LD L,A
61C8 INC H
61C9 LD A,(HL)
61CA CP $00
61CC JR NZ,$61F2
Copy the attribute
61CE LD A,L
61CF SUB $40
61D1 LD L,A
61D2 LD H,$59
61D4 LD A,($5DC0)
61D7 LD C,A
61D8 LD A,(HL)
61D9 AND $F8
61DB OR C
61DC LD (HL),A
Copy the second row
61DD LD H,$48
61DF LD A,L
61E0 ADD A,$20
61E2 LD L,A
61E3 LD B,$08
61E5 LD A,(DE)
61E6 LD (HL),A
61E7 INC H
61E8 INC DE
61E9 DJNZ $61E5
Do the attribute
61EB LD H,$59
61ED LD A,(HL)
61EE AND $F8
61F0 OR C
61F1 LD (HL),A
61F2 RET
Prev: 6113 Up: Map Next: 61F3