![]() |
Routines |
| Prev: 54293 | Up: Map | Next: 54511 |
|
Used by the routine at DrawWallStrips.
Draws a wall strip, sixteen pixels wide, into PixelBuffer. The graphic has the same format as DrawStripGraphic, but it replaces the buffer. The masks from WallStripMasks are written into the AND instructions. The graphic is flipped if MirrorFlag is not zero.
|
||||||||||||
|
Find the graphic and clip it to the buffer.
|
||||||||||||
| DrawWallStrip | 54309 | LD A,(IY+0) | Fetch the strip number. | |||||||||
| 54312 | LD BC,28214 | Point BC at WallStripTable. | ||||||||||
| 54315 | CALL GetTableEntry | Call GetTableEntry. | ||||||||||
| 54318 | LD A,D | Subtract 72 from the vertical position. | ||||||||||
| 54319 | SUB 72 | |||||||||||
| 54321 | JR C,ClipWallStripTop | Jump to ClipWallStripTop if it is below the bottom. | ||||||||||
| 54323 | SUB 112 | Subtract 112. | ||||||||||
| 54325 | RET NC | Return if it is above the top. | ||||||||||
| 54326 | NEG | Make it the number of rows in the buffer. | ||||||||||
| 54328 | CP (HL) | Compare it with the height of the graphic. | ||||||||||
| 54329 | JR C,DrawWallStrip_Height | Jump to DrawWallStrip_Height if it is fewer. | ||||||||||
| 54331 | LD A,(HL) | Use the height of the graphic. | ||||||||||
|
Draw the rows that are in the buffer.
|
||||||||||||
| DrawWallStrip_Height | 54332 | INC HL | Move on to the first row of the graphic. | |||||||||
|
This entry point is used by the routine at ClipWallStripTop.
|
||||||||||||
| DrawWallStrip_Draw | 54333 | EX AF,AF' | Keep the number of rows in A'. | |||||||||
| 54334 | EX DE,HL | Put the position in HL. | ||||||||||
| 54335 | CALL CalculateBufferAddress | Call CalculateBufferAddress. | ||||||||||
| 54338 | EX DE,HL | Switch the buffer and the graphic. | ||||||||||
| 54339 | PUSH HL | Stash the graphic on the stack. | ||||||||||
|
Write the masks from WallStripMasks into the AND instructions.
|
||||||||||||
| 54340 | LD A,(48054) | Fetch ScreenXPosition. | ||||||||||
| 54343 | RRCA | Move the shift into the lowest bits. | ||||||||||
| 54344 | AND %00000011 | Keep the lowest two bits. | ||||||||||
| 54346 | LD HL,54511 | Point HL at WallStripMasks. | ||||||||||
| 54349 | CALL AddAToHL | Call AddAToHL. | ||||||||||
| 54352 | LD A,(HL) | Fetch the mask. | ||||||||||
| 54353 | LD (54396),A | Set the left-hand AND operands. | ||||||||||
| 54356 | LD (54435),A | |||||||||||
| 54359 | CPL | Complement the mask. | ||||||||||
| 54360 | LD (54410),A | Set the right-hand AND operands. | ||||||||||
| 54363 | LD (54450),A | |||||||||||
|
Choose the draw path.
|
||||||||||||
| 54366 | POP HL | Restore the graphic from the stack. | ||||||||||
| 54367 | LD (48046),SP | Set SavedStackPointer. | ||||||||||
| 54371 | LD SP,HL | Point the stack at the graphic. | ||||||||||
| 54372 | LD A,(48054) | Fetch ScreenXPosition. | ||||||||||
| 54375 | AND %00000110 | Keep bits 1 and 2. | ||||||||||
| 54377 | JR Z,DrawWallStrip_Aligned | Jump to DrawWallStrip_Aligned if the graphic is aligned. | ||||||||||
| 54379 | OR %11110000 | Set the high bits of the page. | ||||||||||
| 54381 | LD H,A | Set H. | ||||||||||
| 54382 | LD A,(48114) | Fetch MirrorFlag. | ||||||||||
| 54385 | AND A | Jump to DrawWallStrip_MirroredShifted if it is set. | ||||||||||
| 54386 | JR NZ,DrawWallStrip_MirroredShifted | |||||||||||
| 54388 | SET 3,H | Set bit 3 of H. | ||||||||||
| 54390 | EX AF,AF' | Switch in the number of rows. | ||||||||||
|
Draw a shifted row.
|
||||||||||||
| DrawWallStrip_Shifted | 54391 | EX AF,AF' | Keep the number of rows in A'. | |||||||||
| 54392 | POP BC | Fetch a row and point at the first byte. | ||||||||||
| 54393 | LD L,C | |||||||||||
| 54394 | LD A,(DE) | Fetch the first byte of the buffer. | ||||||||||
| 54395 | AND %00000000 | Keep the bits which are not covered. | ||||||||||
| 54397 | OR (HL) | Combine it and store the byte. | ||||||||||
| 54398 | LD (DE),A | |||||||||||
| 54399 | INC DE | Move on to the next byte and page. | ||||||||||
| 54400 | INC H | |||||||||||
| 54401 | LD A,(HL) | Look up the bits which moved on. | ||||||||||
| 54402 | DEC H | Go back to the first page. | ||||||||||
| 54403 | LD L,B | Point at the second byte of the graphic. | ||||||||||
| 54404 | OR (HL) | Combine it and store the byte. | ||||||||||
| 54405 | LD (DE),A | |||||||||||
| 54406 | INC DE | Move on to the next byte and page. | ||||||||||
| 54407 | INC H | |||||||||||
| 54408 | LD A,(DE) | Fetch the third byte of the buffer. | ||||||||||
| 54409 | AND %00000000 | Keep the bits which are not covered. | ||||||||||
| 54411 | OR (HL) | Combine it and store the byte. | ||||||||||
| 54412 | LD (DE),A | |||||||||||
| 54413 | DEC H | Go back to the first page. | ||||||||||
| 54414 | EX DE,HL | Move on to the next row of the buffer. | ||||||||||
| 54415 | LD BC,22 | |||||||||||
| 54418 | ADD HL,BC | |||||||||||
| 54419 | EX DE,HL | |||||||||||
| 54420 | EX AF,AF' | Switch in the number of rows. | ||||||||||
| 54421 | DEC A | Count it down. | ||||||||||
| 54422 | JR NZ,DrawWallStrip_Shifted | Jump to DrawWallStrip_Shifted until the rows are done. | ||||||||||
|
Put the stack back.
|
||||||||||||
| DrawWallStrip_Done | 54424 | LD SP,(48046) | Fetch SavedStackPointer and return. | |||||||||
| 54428 | RET | |||||||||||
|
Draw a shifted row that is flipped.
|
||||||||||||
| DrawWallStrip_MirroredShifted | 54429 | EX AF,AF' | Switch in the number of rows. | |||||||||
| DrawWallStrip_MirroredLoop | 54430 | EX AF,AF' | Keep the number of rows in A'. | |||||||||
| 54431 | POP BC | Fetch a row and point at the second byte. | ||||||||||
| 54432 | LD L,B | |||||||||||
| 54433 | LD A,(DE) | Fetch the first byte of the buffer. | ||||||||||
| 54434 | AND %00000000 | Keep the bits which are not covered. | ||||||||||
| 54436 | OR (HL) | Combine it and store the byte. | ||||||||||
| 54437 | LD (DE),A | |||||||||||
| 54438 | INC DE | Move on to the next byte and page. | ||||||||||
| 54439 | INC H | |||||||||||
| 54440 | LD B,(HL) | Look up the bits which moved on. | ||||||||||
| 54441 | DEC H | Go back to the first page. | ||||||||||
| 54442 | LD L,C | Point at the first byte of the graphic. | ||||||||||
| 54443 | LD A,(HL) | Fetch the bits which stay. | ||||||||||
| 54444 | OR B | Combine them and store the byte. | ||||||||||
| 54445 | LD (DE),A | |||||||||||
| 54446 | INC DE | Move on to the next byte and page. | ||||||||||
| 54447 | INC H | |||||||||||
| 54448 | LD A,(DE) | Fetch the third byte of the buffer. | ||||||||||
| 54449 | AND %00000000 | Keep the bits which are not covered. | ||||||||||
| 54451 | OR (HL) | Combine it and store the byte. | ||||||||||
| 54452 | LD (DE),A | |||||||||||
| 54453 | DEC H | Go back to the first page. | ||||||||||
| 54454 | EX DE,HL | Move on to the next row of the buffer. | ||||||||||
| 54455 | LD BC,22 | |||||||||||
| 54458 | ADD HL,BC | |||||||||||
| 54459 | EX DE,HL | |||||||||||
| 54460 | EX AF,AF' | Switch in the number of rows. | ||||||||||
| 54461 | DEC A | Count it down. | ||||||||||
| 54462 | JR NZ,DrawWallStrip_MirroredLoop | Jump to DrawWallStrip_MirroredLoop until the rows are done. | ||||||||||
| 54464 | JR DrawWallStrip_Done | Jump to DrawWallStrip_Done. | ||||||||||
|
Draw an aligned graphic.
|
||||||||||||
| DrawWallStrip_Aligned | 54466 | EX DE,HL | Put the buffer address in HL. | |||||||||
| 54467 | LD A,(48114) | Fetch MirrorFlag and test it. | ||||||||||
| 54470 | AND A | |||||||||||
| 54471 | JR NZ,DrawWallStrip_AlignedMirrored | Jump to DrawWallStrip_AlignedMirrored if it is set. | ||||||||||
| 54473 | LD BC,23 | Set BC to 23. | ||||||||||
| 54476 | EX AF,AF' | Switch in the number of rows. | ||||||||||
| DrawWallStrip_AlignedLoop | 54477 | EX AF,AF' | Keep the number of rows in A'. | |||||||||
| 54478 | POP DE | Fetch a row of the graphic. | ||||||||||
| 54479 | LD (HL),E | Store the first byte and move on. | ||||||||||
| 54480 | INC HL | |||||||||||
| 54481 | LD (HL),D | Store the second byte. | ||||||||||
| 54482 | ADD HL,BC | Move on to the next row of the buffer. | ||||||||||
| 54483 | EX AF,AF' | Switch in the number of rows. | ||||||||||
| 54484 | DEC A | Count it down. | ||||||||||
| 54485 | JR NZ,DrawWallStrip_AlignedLoop | Jump to DrawWallStrip_AlignedLoop until the rows are done. | ||||||||||
| 54487 | JR DrawWallStrip_Done | Jump to DrawWallStrip_Done. | ||||||||||
|
Draw an aligned graphic that is flipped.
|
||||||||||||
| DrawWallStrip_AlignedMirrored | 54489 | LD B,249 | Point B at ReverseBitsTable. | |||||||||
| 54491 | EX AF,AF' | Switch in the number of rows. | ||||||||||
| DrawWallStrip_AlignedMirroredLoop | 54492 | EX AF,AF' | Keep the number of rows in A'. | |||||||||
| 54493 | POP DE | Fetch a row of the graphic. | ||||||||||
| 54494 | LD C,D | Point at the second byte, turned round. | ||||||||||
| 54495 | LD A,(BC) | Store it in the first byte of the buffer. | ||||||||||
| 54496 | LD (HL),A | |||||||||||
| 54497 | INC HL | Move on to the next byte of the buffer. | ||||||||||
| 54498 | LD C,E | Point at the first byte, turned round. | ||||||||||
| 54499 | LD A,(BC) | Store it in the second byte of the buffer. | ||||||||||
| 54500 | LD (HL),A | |||||||||||
| 54501 | LD DE,23 | Move on to the next row of the buffer. | ||||||||||
| 54504 | ADD HL,DE | |||||||||||
| 54505 | EX AF,AF' | Switch in the number of rows. | ||||||||||
| 54506 | DEC A | Count it down. | ||||||||||
| 54507 | JR NZ,DrawWallStrip_AlignedMirroredLoop | Jump to DrawWallStrip_AlignedMirroredLoop until the rows are done. | ||||||||||
| 54509 | JR DrawWallStrip_Done | Jump to DrawWallStrip_Done. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 54293 | Up: Map | Next: 54511 |