Prev: A19C Up: Map Next: A1F3
A1D3: Plot one 8x8 tile and step right
Used by the routines at ADD_SCORE, PRINT_STRING and DRAW_SCROLL.
Copies eight bytes from the current tile source to a character cell. The source base is the pointer at $5E01, so the meaning of the tile code depends on what that currently points at -- see PLOT_TILE's note below.
Input
A Tile code; the source is ($5E01) + A * 8
HL Display file address of the cell to draw into. On exit, advanced to the next cell to the right.
PLOT_TILE A1D3 PUSH BC
A1D4 PUSH DE
A1D5 PUSH HL
A1D6 LD L,A A * 8 -- eight bytes per tile.
A1D7 LD H,$00
A1D9 ADD HL,HL
A1DA ADD HL,HL
A1DB ADD HL,HL
A1DC LD DE,($5E01) The current tile source. Not a fixed font: callers repoint it.
A1E0 ADD HL,DE
A1E1 EX DE,HL
A1E2 POP HL
A1E3 LD B,$08 INC H walks down the eight scan lines of a character cell, which works because the cell never crosses a third boundary.
PLOT_TILE_0 A1E5 LD A,(DE)
A1E6 LD (HL),A
A1E7 INC DE
A1E8 INC H
A1E9 DJNZ PLOT_TILE_0
A1EB POP DE
A1EC POP BC
A1ED LD A,H Undo the eight INC Hs, then INC L to land on the next cell to the right.
A1EE SUB $08
A1F0 LD H,A
A1F1 INC L
A1F2 RET
The tile source at $5E01 is deliberately biased by its callers. Initialised to TEXT_FONT less $100, where a tile code is simply an ASCII character, it is repointed during play -- while the score is on screen it holds FONT_DIGITS, which is TEXT_FONT + $80, so that a raw digit 0-9 indexes the characters '0' to '9' directly with no adjustment at the call site.
Prev: A19C Up: Map Next: A1F3