Prev: FDEA Up: Map Next: FE86
FE41: Print a character in the room
Used by the routine at FDEA.
Input
A Character to draw is in bits 0-3
H Y co-ordinate
L X co-ordinate
FE41 PUSH BC
FE42 AND $07 The bottom 3 bits contain the relevant character.
FE44 LD C,A Remember this.
FE45 ADD A,A Shift by 8 to get an offset in the graphics table.
FE46 ADD A,A
FE47 ADD A,A
FE48 ADD A,C
FE49 PUSH HL Remember screen position.
FE4A LD E,A Put the offset in DE.
FE4B LD D,$00
FE4D LD HL,$C54E C54E is the static character graphics table.
FE50 ADD HL,DE Get the right offset and put it in DE.
FE51 EX DE,HL
FE52 POP HL Restore screen position.
FE53 PUSH HL Remember screen position.
FE54 LD C,L Put X co-ordinate in C.
FE55 LD L,H Double Y co-ordinate to get a word offset.
FE56 LD H,$00
FE58 ADD HL,HL
FE59 PUSH DE Remember address of character.
FE5A LD DE,$EA60 EA60 is the screen offsets table.
FE5D ADD HL,DE Put the appropriate screen position in HL.
FE5E LD A,(HL)
FE5F INC HL
FE60 LD H,(HL)
FE61 LD L,A
Now copy the found graphic into the screen buffer. The first byte contains the attribute.
FE62 LD DE,$9260 Add this value to convert a screen address into an offset from D260.
FE65 ADD HL,DE
FE66 LD B,$00 Set B to 0 so BC can be used an offset.
FE68 POP DE Restore address of character.
FE69 ADD HL,BC Add the X offset so HL now points to the right place in the screen buffer.
FE6A LD A,(DE) Copy the next attribute and store it.
FE6B LD (IY+$00),A
FE6E INC DE Move onto the next byte.
Now copy the pixel data.
FE6F LD B,$08 8 rows to copy.
FE71 LD A,(DE) Copy this row.
FE72 LD (HL),A
FE73 INC H Move to the next row.
FE74 INC DE Move to the next graphic byte.
FE75 DJNZ $FE71 Loop while there is more to do.
FE77 INC IY Move to the next attribute address.
FE79 POP HL Restore HL and BC.
FE7A POP BC
FE7B INC L Move to the next column.
FE7C LD A,L Have we reached the end of a column?
FE7D AND $1F
FE7F RET NZ Return if not. Having reached the end of a column, need to point to the right place.
FE80 LD L,A Set the column back to 0.
FE81 LD A,H Move to the next segment on screen.
FE82 SUB $08
FE84 LD H,A
FE85 RET Return.
Prev: FDEA Up: Map Next: FE86