Prev: 28334 Up: Map Next: 28510
28344: Room drawing: Draw a 2-by-2 block of brickwork, then move cursor right or down, depending upon brickwork-drawing-direction flag
Used by the routines at 27865, 29396 and 29414.
Input
A Architecture style index (e.g. A = C = 19, or 0)
28344 EXX Switch BC, DE and HL with BC', DE' and HL'
28345 LD L,A Load architecture style index into L
28346 OR A If architecture style index is not zero...
28347 JP NZ,28360 ...then jump ahead to 28360
28350 LD A,(23476) If brickwork-drawing-direction flag is zero (horizontal mode for floor and ceiling)...
28353 OR A ...
28354 JP Z,28510 ...then skip ahead to 28510 (blank out bitmap and set attribute to current value for 2-by-2 character block)
28357 JP 28471 Move location to print and terrain interaction cursor down two character rows observing y-wrap, then return
28360 LD H,0 Load four times architecture style index into HL, as entries are four bytes wide...
28362 LD A,L ...
28363 ADD A,A ...
28364 LD L,A ...
28365 ADD HL,HL ...
28366 LD DE,54617 Point DE at architecture styles lookup table
28369 ADD HL,DE Add HL (4 times architecture style index) as offset to this, in HL (as each entry is 4 bytes wide)
28370 LD DE,(36488) Load memory location to start printing character into DE...
28374 LD (23296),DE ...and store at 23296
28378 LD A,(HL) Load first architecture style element (top-left) into A
28379 CALL 36510 Draw a single character block part of a wall, ceiling or floor
28382 LD DE,(36488) Load memory location to start printing character into DE...
28386 INC DE Advance DE by one byte...
28387 LD (36488),DE ...and load into memory location to start printing character
28391 INC HL Advance HL to next architecture style element (top-right)
28392 LD A,(HL) Load next architecture style element into A
28393 CALL 36510 Draw a single character block part of a wall, ceiling or floor
28396 INC HL Advance HL to next architecture style index (bottom-left)
28397 EX DE,HL Switch HL and DE (HL now display file address to print to and DE now pointer to architecture style)
28398 LD HL,(23296) Advance this pointer down a character row (32 bytes from original stored value)...
28401 LD BC,32 ...
28404 ADD HL,BC ...
28405 LD (36488),HL Load new position into memory location to start printing character
28408 EX DE,HL Switch DE and HL back (HL now pointer to architecture style and DE now display file address to print to)
28409 LD A,(23469) Load brickwork drawing mode into A
28412 CP 1 If this is 1 [only draw one row of "bricks"]...
28414 JR Z,28441 ...then jump ahead to 28441
28416 CP 2 If it is not 2 [draw row of bricks and blank row beneath]...
28418 JR NZ,28423 ...then jump ahead to 28423...
28420 LD HL,54617 ...else point HL at first entry (blank, i.e. no brickwork)
28423 LD A,(HL) Load brickwork graphic index into A
28424 CALL 36510 Draw a single character block part of a wall, ceiling or floor
28427 LD DE,(36488) Load memory location to start printing character into DE...
28431 INC DE Advance DE by one byte...
28432 LD (36488),DE ...and load into memory location to start printing character
28436 INC HL Advance HL to next brickwork graphic index...
28437 LD A,(HL) ...and load into A
28438 CALL 36510 Draw a single character block part of a wall, ceiling or floor
28441 LD HL,(23296) Load previously stored memory location to start printing character into HL...
28444 LD (36488),HL ...and place back in character drawing routine
28447 LD A,(23483) Load stored, "current" terrain interaction parameter into A
28450 LD HL,(23481) Load current terrain interaction table cursor position into HL
28453 LD (HL),A Set this and the following character blocks to have the current terrain interaction flags...
28454 INC HL ...
28455 LD (HL),A ...
28456 LD A,(23469) Load brickwork drawing mode into A
28459 OR A If brickwork drawing mode is not zero (draw two rows) then skip ahead to 28471 (move location to print and terrain interaction cursor down two character rows observing y-wrap, then return)
28460 JP NZ,28471
28463 LD A,(HL) Load last written terrain interaction parameter back into A
28464 LD BC,31 Advance terrain interaction table cursor by 31 bytes (to character below starting position)...
28467 ADD HL,BC ...
28468 LD (HL),A Set this and the following character blocks to have the current terrain interaction flags...
28469 INC HL ...
28470 LD (HL),A ...
Mode 1 or 2, draw one row of bricks
This entry point is used by the routine at 28510.
28471 LD A,(23476) If brickwork-drawing-direction flag is not zero (horizontal mode for floor and ceiling) then skip ahead to 28561 (move location to print and terrain interaction cursor down two character rows with y-wrap, as in vertical mode)
28474 OR A
28475 JR NZ,28561
28477 CALL 36626 Advance display file pointer by two characters
28480 LD HL,(23481) Update current terrain interaction table cursor position onwards by two characters...
28483 INC HL ...
28484 INC HL ...
28485 LD (23481),HL ...
28488 LD A,(36488) Load LSB of memory location to start printing character into A
28491 AND 31 If this is not a multiple of 32 (i.e. not at start of a pixel row)...
28493 JR NZ,28508 ...then skip ahead to 28508
28495 CALL 37703 Move virtual text cursor down to start of next text row (as blocks are 2 characters high so we need to move down another character)
28498 LD BC,32 Update current terrain interaction table cursor position onwards by 32 characters (i.e. down one row)...
28501 LD HL,(23481) ...
28504 ADD HL,BC ...
28505 LD (23481),HL ...
28508 EXX Switch BC, DE and HL with BC', DE' and HL', restoring values as at input
28509 RET Return
Prev: 28334 Up: Map Next: 28510