Prev: 41173 Up: Map Next: 41459
41271: Draw 2 × 2 block with style index A at bitmap virtual text cursor then move right two characters
Used by the routines at 39216 and 39366.
Input
A Block style index
41271 EXX Switch registers
41272 LD H,0 Load HL with eight times block style index...
41274 LD L,A ...(see trivia)...
41275 ADD A,A ...
41276 LD L,A ...
41277 ADD HL,HL ...
41278 ADD HL,HL ...
41279 LD DE,49794 Load DE with start address of table of block style definitions...
41282 ADD HL,DE ...and add to HL as offset in HL
41283 LD A,(HL) Store attribute value in selected style at 23695...
41284 LD (23695),A ...
41287 INC HL Advance HL to terrain interaction parameter to apply...
41288 LD A,(HL) ...
41289 LD (23485),A ...and store at 23485
41292 INC HL Advance HL to terrain interaction parameter painting bitmap...
41293 LD A,(HL) ...
41294 LD (23298),A ...and store at 23298
41297 INC HL Advance HL to index of top-left block UDG...
41298 INC HL ...
41299 LD DE,(63018) Store display file address of bitmap virtual text cursor to 23296...
41303 LD (23296),DE ...
41307 LD A,(HL) Load A with index of top-left block UDG...
41308 CALL 63162 ...and draw at location of bitmap virtual text cursor
41311 PUSH HL Store HL (pointer to index of top-left block UDG)
41312 CALL 63247 Advance bitmap virtual text cursor right by one character
41315 POP HL Restore HL (pointer to index of top-left block UDG)
41316 INC HL Advance HL to index of top-right block UDG...
41317 LD A,(HL) ...load into A...
41318 CALL 63162 ...and draw at location of bitmap virtual text cursor
41321 PUSH HL Store HL (pointer to index of top-right block UDG)
41322 CALL 63247 Advance bitmap virtual text cursor right by one character (see trivia)
41325 LD A,(23298) Load B with terrain interaction parameter painting bitmap...
41328 LD B,A ...
41329 LD A,(23485) Load A with terrain interaction parameter to apply
41332 LD HL,(23709) Load HL with address of terrain interaction data for top-left character
41335 BIT 0,B If bit 0 of terrain interaction parameter painting bitmap is reset...
41337 JR Z,41340 ...then skip ahead to 41340
41339 LD (HL),A Apply current terrain interaction parameter to address in HL
41340 INC HL Advance HL (i.e. move right one character)
41341 BIT 1,B If bit 1 of terrain interaction parameter painting bitmap is reset...
41343 JR Z,41346 ...then skip ahead to 41346
41345 LD (HL),A Apply current terrain interaction parameter to address in HL
41346 POP HL Restore HL (pointer to index of top-right block UDG)
41347 LD A,(23461) If draw-2-×-1-blocks flag is set (see trivia)...
41350 OR A ...
41351 JR NZ,41457 ...then skip ahead to 41457
41353 INC HL Advance HL to index of bottom-left block UDG
41354 EX DE,HL Swap DE (now points to index of bottom-left block UDG) and HL
41355 LD HL,(23296) Restore display file address of bitmap virtual text cursor (top-left character) from 23296...
41358 LD (63018),HL ...
41361 CALL 63263 Advance bitmap virtual text cursor to start of next character row
41364 LD A,(23296) Load A with LSB of bitmap virtual text cursor display file address stored previously...
41367 AND 31 ...and clear bits 5, 6 and 7 to leave x-coordinate in characters
41369 LD HL,(63018) Load HL with address of bitmap virtual text cursor...
41372 OR L ...and add x-coordinate in characters to move to bottom-left character in 2 × 2 block...
41373 LD L,A ...
41374 LD (63018),HL Store updated address of bitmap virtual text cursor
41377 EX DE,HL Swap DE and HL (now points to index of bottom-left block UDG)
41378 LD A,(HL) Load A with index of bottom-left block UDG...
41379 CALL 63162 ...and draw at location of bitmap virtual text cursor
41382 PUSH HL Store HL (pointer to index of bottom-left block UDG)
41383 CALL 63247 Advance bitmap virtual text cursor right by one character
41386 POP HL Restore HL (pointer to index of bottom-left block UDG)
41387 INC HL Advance HL to index of bottom-right block UDG...
41388 LD A,(HL) ...load into A...
41389 CALL 63162 ...and draw at location of bitmap virtual text cursor
41392 LD HL,(23296) Restore display file address of bitmap virtual text cursor (top-left character) from 23296...
41395 LD (63018),HL ...
41398 LD A,(23298) Load B with terrain interaction parameter painting bitmap...
41401 LD B,A ...
41402 LD A,(23485) Load A with terrain interaction parameter to apply
41405 LD HL,(23709) Load HL with address of terrain interaction data for top-left character...
41408 LD BC,32 ...and add 32 to point to bottom-left character...
41411 ADD HL,BC ...
41412 BIT 2,B If bit 2 of terrain interaction parameter painting bitmap is reset... (bug)
41414 JR Z,41417 ...then skip ahead to 41417
41416 LD (HL),A Apply current terrain interaction parameter to address in HL
41417 INC HL Advance HL (i.e. move right one character)
41418 BIT 3,B If bit 3 of terrain interaction parameter painting bitmap is reset... (bug)
41420 JR Z,41423 ...then skip ahead to 41423
41422 LD (HL),A Apply current terrain interaction parameter to address in HL
41423 CALL 63247 Advance bitmap virtual text cursor right by two characters...
41426 CALL 63247 ...i.e. move to top-left character of next 2 × 2 block to the right
41429 LD HL,(23709) Load HL with address of terrain interaction data for top-left character...
41432 INC HL ...advance by two characters...
41433 INC HL ...
41434 LD (23709),HL ...and store at 23709
41437 LD A,(63018) Load A with LSB of bitmap virtual text cursor display file address...
41440 AND 31 ...and if at least one of bits 0-4 are set (i.e. we are not at the start of a new character row)...
41442 JR NZ,41457 ...then skip ahead to 41457
41444 CALL 63263 Advance bitmap virtual text cursor to start of next character row
41447 LD BC,32 Add 32 to address of terrain interaction data to move to next character row...
41450 LD HL,(23709) ...
41453 ADD HL,BC ...
41454 LD (23709),HL ...
41457 EXX Switch registers
41458 RET Return
Prev: 41173 Up: Map Next: 41459