Prev: 91A1 Up: Map Next: 920D
91CC: Display planet name and sprites
Used by the routine at display_planet.
Input
HL Address of planet name prefixed by length
display_planet_name_and_sprites 91CC PUSH HL Save address
91CD CALL clear_row_7 clear_row_7 where the planet name is displayed
91D0 LD A,$20 32
91D2 SUB (HL) 32 - length
91D3 SRL A (32 - length) / 2
91D5 LD DE,$18E0 Name table address of row
91D8 EX DE,HL
91D9 RST $08 Add A to HL
91DA EX DE,HL DE = display address
91DB LD C,(HL) Get length
91DC LD B,$00
91DE INC HL Advance source to text
91DF RST $38 WRITE_VRAM
91E0 POP HL Restore address
91E1 LD A,(HL) Get length
91E2 INC A Length + 1
91E3 RST $08 Add A to HL. Now HL points after text.
91E4 LD B,(HL) Get number of sprites
91E5 INC HL Next source byte
91E6 LD C,(HL) Get color
91E7 INC HL Next source byte
91E8 LD A,(HL) Get pattern?
91E9 ADD A,$20 Add 32
91EB LD E,A Store in E
91EC INC HL Next source byte
display_planet_name_and_sprites_0 91ED RST $28 Allocate sprite
91EE LD (IX+$00),$00 Mark as allocated (set type)
91F2 LD A,(HL) Get y
91F3 LD D,A Store in D
91F4 AND $7F Only use 7 bits of y
91F6 LD (IX+$08),A Set y
91F9 INC HL Next source byte
91FA LD A,(HL) Get x
91FB LD (IX+$09),A Set x
91FE INC HL Next source byte
91FF LD (IX+$0A),E Set pattern
9202 LD (IX+$0B),C Set color
9205 BIT 7,D If bit 7 of y is set
9207 JR NZ,display_planet_name_and_sprites_1 Then skip
9209 INC E Else increment pattern
display_planet_name_and_sprites_1 920A DJNZ display_planet_name_and_sprites_0 Loop to next sprite
920C RET
Prev: 91A1 Up: Map Next: 920D