![]() |
Routines |
| Prev: D415 | Up: Map | Next: D4EF |
|
Used by the routine at DRAW_WALL_COLUMN.
The number at IY picks the tile from TILE_TABLE: a height byte, then two bytes a row, the bottom row first. It is drawn at DRAW_X and the line in D exactly as PUT_EDGE draws an edge picture -- the same four cases, the same pages, the second face mirrored -- except that a tile is solid: its 16 pixels are written over what is under them rather than ORed in. A shifted row covers three buffer bytes; the middle one is wholly the tile's, and in the first and the last the pixels outside the tile are kept by AND masks. The masks come from TILE_MASKS by the shift and are patched into the four ANDs (TILE_MASK_FIRST, TILE_MASK_LAST, and the same in the mirrored run), the first byte's mask keeping the pixels to the left of the tile and its complement those to the right.
|
||||||||||||
| PUT_TILE | D425 | LD A,(IY+$00) | HL = the tile (TILE_TABLE) | |||||||||
| D428 | LD BC,TILE_TABLE | |||||||||||
| D42B | CALL TABLE_WORD | |||||||||||
| D42E | LD A,D | Starting below the play area: CLIP_TILE | ||||||||||
| D42F | SUB $48 | |||||||||||
| D431 | JR C,CLIP_TILE | |||||||||||
| D433 | SUB $70 | At or above its top, nothing; A = the rows, the height or as many as fit below the top | ||||||||||
| D435 | RET NC | |||||||||||
| D436 | NEG | |||||||||||
| D438 | CP (HL) | |||||||||||
| D439 | JR C,PUT_TILE_0 | |||||||||||
| D43B | LD A,(HL) | |||||||||||
| PUT_TILE_0 | D43C | INC HL | ||||||||||
|
This entry point is used by the routine at CLIP_TILE.
|
||||||||||||
| PUT_TILE_1 | D43D | EX AF,AF' | The count into A'; DE = the buffer address (BUFFER_ADDRESS) | |||||||||
| D43E | EX DE,HL | |||||||||||
| D43F | CALL BUFFER_ADDRESS | |||||||||||
| D442 | EX DE,HL | |||||||||||
| D443 | PUSH HL | The shift's mask from TILE_MASKS: x / 2, bits 0-1 | ||||||||||
| D444 | LD A,(DRAW_X) | |||||||||||
| D447 | RRCA | |||||||||||
| D448 | AND $03 | |||||||||||
| D44A | LD HL,TILE_MASKS | |||||||||||
| D44D | CALL ADD_HL_A | |||||||||||
| D450 | LD A,(HL) | Into the first byte's two ANDs... | ||||||||||
| D451 | LD ($D47C),A | |||||||||||
| D454 | LD ($D4A3),A | |||||||||||
| D457 | CPL | ...and its complement into the last byte's | ||||||||||
| D458 | LD ($D48A),A | |||||||||||
| D45B | LD ($D4B2),A | |||||||||||
| D45E | POP HL | SP onto the tile's rows, the real one in SAVED_SP | ||||||||||
| D45F | LD (SAVED_SP),SP | |||||||||||
| D463 | LD SP,HL | |||||||||||
| D464 | LD A,(DRAW_X) | Aligned: the plain cases | ||||||||||
| D467 | AND $06 | |||||||||||
| D469 | JR Z,PUT_TILE_6 | |||||||||||
| D46B | OR $F0 | H = the shift's pages: $F2, $F4 or $F6 mirrored (the second face), $FA, $FC or $FE not | ||||||||||
| D46D | LD H,A | |||||||||||
| D46E | LD A,(DRAW_PASS) | |||||||||||
| D471 | AND A | |||||||||||
| D472 | JR NZ,PUT_TILE_4 | |||||||||||
| D474 | SET 3,H | |||||||||||
| D476 | EX AF,AF' | A row: the first buffer byte kept left of the tile (patched mask), the tile's first part put in | ||||||||||
| PUT_TILE_2 | D477 | EX AF,AF' | ||||||||||
| D478 | POP BC | |||||||||||
| D479 | LD L,C | |||||||||||
| D47A | LD A,(DE) | |||||||||||
| TILE_MASK_FIRST | D47B | AND $00 | ||||||||||
| D47D | OR (HL) | |||||||||||
| D47E | LD (DE),A | |||||||||||
| D47F | INC DE | The middle byte wholly the tile's | ||||||||||
| D480 | INC H | |||||||||||
| D481 | LD A,(HL) | |||||||||||
| D482 | DEC H | |||||||||||
| D483 | LD L,B | |||||||||||
| D484 | OR (HL) | |||||||||||
| D485 | LD (DE),A | |||||||||||
| D486 | INC DE | The last kept right of the tile (patched mask), the tile's last part put in | ||||||||||
| D487 | INC H | |||||||||||
| D488 | LD A,(DE) | |||||||||||
| TILE_MASK_LAST | D489 | AND $00 | ||||||||||
| D48B | OR (HL) | |||||||||||
| D48C | LD (DE),A | |||||||||||
| D48D | DEC H | |||||||||||
| D48E | EX DE,HL | Up a line, until the rows run out | ||||||||||
| D48F | LD BC,$0016 | |||||||||||
| D492 | ADD HL,BC | |||||||||||
| D493 | EX DE,HL | |||||||||||
| D494 | EX AF,AF' | |||||||||||
| D495 | DEC A | |||||||||||
| D496 | JR NZ,PUT_TILE_2 | |||||||||||
| PUT_TILE_3 | D498 | LD SP,(SAVED_SP) | The real stack pointer back | |||||||||
| D49C | RET | |||||||||||
| PUT_TILE_4 | D49D | EX AF,AF' | Mirrored: the same, the row's second byte first, through the reversing pages | |||||||||
| PUT_TILE_5 | D49E | EX AF,AF' | ||||||||||
| D49F | POP BC | |||||||||||
| D4A0 | LD L,B | |||||||||||
| D4A1 | LD A,(DE) | |||||||||||
| TILE_MASK_FIRST_TURNED | D4A2 | AND $00 | ||||||||||
| D4A4 | OR (HL) | |||||||||||
| D4A5 | LD (DE),A | |||||||||||
| D4A6 | INC DE | |||||||||||
| D4A7 | INC H | |||||||||||
| D4A8 | LD B,(HL) | |||||||||||
| D4A9 | DEC H | |||||||||||
| D4AA | LD L,C | |||||||||||
| D4AB | LD A,(HL) | |||||||||||
| D4AC | OR B | |||||||||||
| D4AD | LD (DE),A | |||||||||||
| D4AE | INC DE | |||||||||||
| D4AF | INC H | |||||||||||
| D4B0 | LD A,(DE) | |||||||||||
| TILE_MASK_LAST_TURNED | D4B1 | AND $00 | ||||||||||
| D4B3 | OR (HL) | |||||||||||
| D4B4 | LD (DE),A | |||||||||||
| D4B5 | DEC H | |||||||||||
| D4B6 | EX DE,HL | |||||||||||
| D4B7 | LD BC,$0016 | |||||||||||
| D4BA | ADD HL,BC | |||||||||||
| D4BB | EX DE,HL | |||||||||||
| D4BC | EX AF,AF' | |||||||||||
| D4BD | DEC A | |||||||||||
| D4BE | JR NZ,PUT_TILE_5 | |||||||||||
| D4C0 | JR PUT_TILE_3 | |||||||||||
| PUT_TILE_6 | D4C2 | EX DE,HL | Aligned: the two bytes written in as they are | |||||||||
| D4C3 | LD A,(DRAW_PASS) | |||||||||||
| D4C6 | AND A | |||||||||||
| D4C7 | JR NZ,PUT_TILE_8 | |||||||||||
| D4C9 | LD BC,$0017 | |||||||||||
| D4CC | EX AF,AF' | |||||||||||
| PUT_TILE_7 | D4CD | EX AF,AF' | ||||||||||
| D4CE | POP DE | |||||||||||
| D4CF | LD (HL),E | |||||||||||
| D4D0 | INC HL | |||||||||||
| D4D1 | LD (HL),D | |||||||||||
| D4D2 | ADD HL,BC | |||||||||||
| D4D3 | EX AF,AF' | |||||||||||
| D4D4 | DEC A | |||||||||||
| D4D5 | JR NZ,PUT_TILE_7 | |||||||||||
| D4D7 | JR PUT_TILE_3 | |||||||||||
| PUT_TILE_8 | D4D9 | LD B,$F9 | Aligned and mirrored: each reversed (REVERSE_TABLE), the second first | |||||||||
| D4DB | EX AF,AF' | |||||||||||
| PUT_TILE_9 | D4DC | EX AF,AF' | ||||||||||
| D4DD | POP DE | |||||||||||
| D4DE | LD C,D | |||||||||||
| D4DF | LD A,(BC) | |||||||||||
| D4E0 | LD (HL),A | |||||||||||
| D4E1 | INC HL | |||||||||||
| D4E2 | LD C,E | |||||||||||
| D4E3 | LD A,(BC) | |||||||||||
| D4E4 | LD (HL),A | |||||||||||
| D4E5 | LD DE,$0017 | |||||||||||
| D4E8 | ADD HL,DE | |||||||||||
| D4E9 | EX AF,AF' | |||||||||||
| D4EA | DEC A | |||||||||||
| D4EB | JR NZ,PUT_TILE_9 | |||||||||||
| D4ED | JR PUT_TILE_3 | |||||||||||
| Prev: D415 | Up: Map | Next: D4EF |