Prev: B140 Up: Map Next: B2B6
B203: Print a set of task buttons
Used by the routine at AE77.
Input
A Index of the button to draw
HL Pointer to button data
B203 LD B,$02 Two buttons to draw
B205 PUSH BC Remember this
B206 SRL A Divide index by 2
B208 LD ($A433),A Store it
B20B LD B,$00
B20D RL B
B20F LD C,(HL) Put next value in C
B210 INC HL Point to next entry in the room data
B211 LD ($A434),BC Store the character offset
B215 SLA B Convert to screen offset
B217 SLA B
B219 SLA B
B21B LD A,(HL) Get character
B21C LD ($A45F),A Store it
B21F INC HL Point to next entry in the room data
B220 ADD A,A Shift characters to become an offset from the task button data
B221 ADD A,A
B222 PUSH HL Remember this
B223 LD HL,$9000 Load base address of screen 2
B226 ADD HL,BC Add offset
B227 LD E,A Remember this
B228 LD D,$04 Four characters
B22A LD A,E Get next character
B22B LD BC,($A467) Get base address of task button UDGs
B22F CALL $B730 Print the character
B232 BIT 0,D Is this one of the rightmost characters?
B234 JR Z,$B241 Move forward of it isn't
B236 DEC L Move back one character
B237 LD A,L Move down a line
B238 ADD A,$1F
B23A LD L,A
B23B JR NC,$B241 Move forward if we're still on the same third of a screen
B23D LD A,H Move forward to the next third of a screen
B23E XOR $08
B240 LD H,A
B241 INC E Next character in store
B242 DEC D Repeat if there are more characters to print
B243 JR NZ,$B22A
B245 POP HL Restore registers clobbered by the above routine
B246 POP BC
B247 DEC B Next button
B248 JR Z,$B25C Jump forward if both buttons are done
B24A LD A,($A433)
B24D LD ($A430),A
B250 LD DE,($A434)
B254 LD ($A431),DE
B258 LD A,(HL) Get next button data
B259 INC HL Point to next entry in the room data
B25A JR $B205 Do the next button
Draw the task button attributes
B25C LD A,(HL) Get the attribute
B25D LD ($A436),A Store it
B260 INC HL Point to next entry in the room data
B261 PUSH HL Remember this
B262 LD DE,$A200 Point DE to the base address of attributes 2
B265 LD BC,$001F
B268 LD A,($A457)
B26B AND $80
B26D LD HL,$A45B
B270 LD A,($A430)
B273 JR Z,$B28A
B275 BIT 3,(HL)
B277 JR Z,$B288
B279 LD A,($A422)
B27C LD HL,$A43B
B27F XOR (HL)
B280 LD A,($A430)
B283 JR NZ,$B28A
B285 SCF
B286 JR $B28A
B288 OR $80
B28A PUSH AF
B28B LD HL,($A431)
B28E CALL $B2C9 Copy the attribute onto screen 2
B291 LD HL,($A434)
B294 POP AF
B295 LD A,($A433)
B298 RLA
B299 RRCA
B29A CALL $B2C9 Copy the attribute onto screen 2
B29D POP HL
B29E LD A,($A45F)
B2A1 RLA
B2A2 JR C,$B2AC
B2A4 XOR A
B2A5 LD ($A45F),A
B2A8 LD ($A460),A
B2AB RET
B2AC LD ($A45F),HL
B2AF LD A,(HL)
B2B0 INC HL
B2B1 INC HL
B2B2 RLA
B2B3 JR C,$B2AF
B2B5 RET
Prev: B140 Up: Map Next: B2B6