Prev: B560 Up: Map Next: B77B
B715: Put a character on screen
Used by the routines at B34C and B8C4.
Input
A The ID of the object
C The attribute to display
D The y co-ordinate
E The x co-ordinate
B715 PUSH AF Store main registers.
B716 PUSH IX
B718 PUSH HL
B719 PUSH BC
B71A PUSH DE
B71B EX DE,HL Swap DE and HL.
First, set the attribute.
B71C PUSH HL Store the co-ordinates in HL.
B71D LD D,$58 Point the high byte of DE to the attribute buffer.
B71F LD E,L Point the low byte to the x co-ordinate.
B720 LD L,H Put the y co-ordinate in HL.
B721 LD H,$00
B723 ADD HL,HL Multiply by 16 to get the right offset.
B724 ADD HL,HL
B725 ADD HL,HL
B726 ADD HL,HL
B727 ADD HL,HL
B728 ADD HL,DE Add the earlier address in the attribute buffer.
B729 LD (HL),C Set the attribute to the colour specified.
B72A PUSH DE Remember the current address in DE.
B72B LD DE,$0020 Move forward a row.
B72E ADD HL,DE
B72F POP DE Restore DE.
B730 LD (HL),C Set the attribute.
B731 POP HL Restore the co-ordinates.
Now, set the graphic data.
B732 LD L,H Put the y co-ordinate in HL and set D to 0.
B733 LD D,$00
B735 LD H,D
B736 LD C,E Put the current column. in C.
B737 LD B,D Set B to the current row.
B738 ADD HL,HL Multiply HL by 8 to get a suitable offset.
B739 ADD HL,HL
B73A ADD HL,HL
B73B ADD HL,HL
B73C LD DE,$81F8 Add the base address for the screen offsets table. (81F8)
B73F ADD HL,DE
B740 PUSH HL Put this in IX.
B741 POP IX
B743 LD L,A Put the object ID in HL.
B744 LD H,$00
B746 ADD HL,HL Multiply it by 8 to get a suitable offset.
B747 ADD HL,HL
B748 ADD HL,HL
B749 LD DE,$DFDC Add the base address for the character set. (DFDC)
B74C ADD HL,DE
B74D EX DE,HL Swap DE and HL.
B74E LD A,$08 8 rows to update.
B750 LD L,(IX+$00) Get the screen offset for the start of the row in HL.
B753 LD H,(IX+$01)
B756 ADD HL,BC Add the offset for the current column and row.
B757 INC IX Point to the next entry in the screen offsets table.
B759 INC IX
B75B EX DE,HL Swap HL and DE, as the copying is done that way round.
B75C LDI Copy from HL (buffer) to DE (screen).
B75E EX DE,HL Swap HL and DE back again.
B75F INC BC Move forward a column .
B760 LD L,(IX+$00) Get the screen offset for the start of the row in HL.
B763 LD H,(IX+$01)
B766 ADD HL,BC Add the offset for the current column and row.
B767 INC IX Point to the next entry in the screen offsets table.
B769 INC IX
B76B DEC DE Move back a column.
B76C EX DE,HL Swap HL and DE, as the copying is done that way round.
B76D LDI Copy from HL (buffer) to DE (screen).
B76F EX DE,HL Swap HL and DE back again.
B770 INC BC Move forward a column .
B771 DEC A Loop while there are more rows to draw.
B772 JR NZ,$B750
B774 POP DE Restore main registers and return.
B775 POP BC
B776 POP HL
B777 POP IX
B779 POP AF
B77A RET
Prev: B560 Up: Map Next: B77B