Prev: 31626 Up: Map Next: 31690
31634: DrawSprite
Renders a 10-character text label at the current draw position (31257). The "sprite" data is the 10-byte text entry at 28221 + A×10 (see RoomNameTable / UIStringTable); each byte is used as a tile index into 26869, which is laid out so that index N == ASCII N produces the glyph for that character. After drawing 10 columns, advances 31257 to the next character row accounting for the ZX Spectrum display-file row wrapping.
Input
A = text/label index (255 → use blank label, entry 92)
31257 = screen destination address
Used by the routines at 31417, 33610, 35290, 35451, 35578, 36457, 36859, 37018, 37490, 38379, 40826, 44880 and 45401.
31634 CP 255 sprite index 255 = invalid/absent
31636 JR NZ,31640 valid index: draw it
31638 LD A,92 substitute blank sprite (index 92)
31640 LD L,A L = sprite index
31641 LD H,0
31643 ADD HL,HL HL = index × 2
31644 PUSH HL save HL = index × 2
31645 ADD HL,HL HL = index × 4
31646 ADD HL,HL HL = index × 8
31647 POP DE DE = index × 2
31648 ADD HL,DE HL = index × 10 (label record size)
31649 LD DE,28221 DE = 28221 (RoomNameTable base)
31652 ADD HL,DE HL = address of the 10-byte text entry
31653 EX DE,HL DE = source pointer (10 ASCII tile-indices)
31654 LD B,10 10 character columns per label
31656 PUSH BC save column counter
31657 PUSH DE save sprite data pointer
31658 CALL 31369 DrawSpriteRow: draw one tile column (8px tall)
31661 POP DE restore sprite data pointer
31662 INC DE advance to next tile index byte
31663 LD HL,31257 HL → draw pointer (31241)
31666 INC (HL) move draw pointer right by 1 character column
31667 POP BC
31668 DJNZ 31656 repeat for all 10 columns
31670 LD HL,(31257) HL = draw pointer after last column
31673 DEC L back to start of this character row
31674 LD DE,23 advance 23 columns to next row (normal case)
31677 LD A,L
31678 CP 224 $E0: check for display-file third-bank boundary
31680 JR C,31685 below $E0: normal row advance (+23)
31682 LD DE,1815 at/above $E0: large offset to wrap to next band
31685 ADD HL,DE move draw pointer to start of next character row
31686 LD (31257),HL save updated draw pointer
31689 RET
Prev: 31626 Up: Map Next: 31690