Prev: D5AE Up: Map Next: D623
D5C9: Draw Border
Used by the routine at DrawGameScreen.
Draws the border around the playfield, which is twenty-four tiles wide and sixteen high. The corners and the edges are the same tiles at the top and the left, drawn reflected for the bottom and the right.
border
Set the attribute and the tile set.
DrawBorder D5C9 LD A,$73 Set the attribute to INK:MAGENTA, PAPER:YELLOW (BRIGHT).
D5CB EX AF,AF'
D5CC LD BC,($A20F) Fetch TileSetAddress.
Draw the top left corner.
D5D0 LD HL,$4004 Point HL at 4004 (in the screen buffer).
Move it to the right in the town.
D5D3 CALL AddTownOffsetToHL Call AddTownOffsetToHL.
D5D6 LD A,$01 Set the tile to the top left corner.
D5D8 CALL DrawTile Call DrawTile.
Draw the top edge.
D5DB INC L Move on to the next column.
D5DC LD E,$16 Set a count of 16 tiles, and fetch the top edge.
D5DE LD A,$02
D5E0 CALL DrawTileRow Call DrawTileRow.
Draw the top right corner.
D5E3 LD HL,$401B Point HL at 401B (in the screen buffer).
Move it to the right in the town.
D5E6 CALL AddTownOffsetToHL Call AddTownOffsetToHL.
D5E9 LD A,$41 Set the tile to the top right corner.
D5EB CALL DrawTile Call DrawTile.
Draw the bottom left corner.
D5EE LD HL,$48E4 Point HL at 48E4 (in the screen buffer).
Move it to the right in the town.
D5F1 CALL AddTownOffsetToHL Call AddTownOffsetToHL.
D5F4 LD A,$81 Set the tile to the bottom left corner.
D5F6 CALL DrawTile Call DrawTile.
Draw the bottom edge.
D5F9 INC L Move on to the next column.
D5FA LD E,$16 Set a count of 16 tiles, and fetch the bottom edge.
D5FC LD A,$82
D5FE CALL DrawTileRow Call DrawTileRow.
Draw the bottom right corner.
D601 LD HL,$48FB Point HL at 48FB (in the screen buffer).
Move it to the right in the town.
D604 CALL AddTownOffsetToHL Call AddTownOffsetToHL.
D607 LD A,$C1 Set the tile to the bottom right corner.
D609 CALL DrawTile Call DrawTile.
Draw the left edge.
D60C LD HL,$4024 Point HL at 4024 (in the screen buffer).
Move it to the right in the town.
D60F CALL AddTownOffsetToHL Call AddTownOffsetToHL.
D612 LD E,$0E Set a count of 0E tiles, and fetch the left edge.
D614 LD A,$03
D616 CALL DrawTileColumn Call DrawTileColumn.
Draw the right edge.
D619 LD HL,$403B Point HL at 403B (in the screen buffer).
Move it to the right in the town.
D61C CALL AddTownOffsetToHL Call AddTownOffsetToHL.
D61F LD E,$0E Set a count of 0E tiles, and fetch the right edge.
D621 LD A,$43
Continue on to DrawTileColumn.
Prev: D5AE Up: Map Next: D623