Prev: 672E Up: Map Next: 67A9
676F: Print String
Input
B String length
C Attribute value of string
DE Screen buffer address
HL Pointer to string data
This routine differs from SpectrumFont_PrintString and CustomFont_PrintString as the code self-modifies the address pointed to by IX, whereas the other two routines are always pointed to 6153 and 3C00.
Configurable_PrintString 676F LD IX,$6153 IX=6153.
6773 JR PrintString Jump to PrintString.
This entry point is used by the routines at Draw_AlienMothership, Print_ControlMenu, Handler_AlienExplosions and TitleScreen.
Print using: 3C00.
SpectrumFont_PrintString 6775 LD IX,$3C00 IX=3C00.
6779 JR PrintString Jump to PrintString.
This entry point is used by the routines at Draw_AlienMothership, Handler_Mothership and Handler_AlienExplosions.
Print using: 6153.
CustomFont_PrintString 677B LD IX,$6153 IX=6153.
Print the string to the screen buffer.
PrintString 677F PUSH DE Stash the screen position and character counter/ attribute value on the stack
6780 PUSH BC
PrintString_CharacterLoop 6781 PUSH BC Stash the character counter/ attribute value, screen position and string pointer on the stack.
6782 PUSH DE
6783 PUSH HL
Calculate the address in the font data for the current character.
6784 LD L,(HL) Store the offset for the UDG data look-up in HL.
6785 LD H,$00
6787 ADD HL,HL Multiply HL by 08 (as each character is 08 bytes in length).
6788 ADD HL,HL
6789 ADD HL,HL
678A PUSH IX Copy IX containing the font base into BC (using the stack).
678C POP BC
678D ADD HL,BC Add the font base to HL so it now points at the correct font data for the currently processed character.
678E LD B,$08 Set a counter in B for 08 bytes/ data lines.
PrintString_Loop 6790 LD A,(HL) Copy one line of graphics data to the screen buffer.
6791 LD (DE),A
6792 INC HL Move to the next byte of graphics data.
6793 INC D Move down one pixel row.
6794 DJNZ PrintString_Loop Decrease the row counter by one and loop back to PrintString_Loop until all 08 lines of graphic data have been written to the screen.
6796 POP HL Restore the screen position pointer and screen position from the stack.
6797 POP DE
6798 INC DE Move to the next screen buffer position.
6799 INC HL Move to the next character in the string.
679A POP BC Restore the character counter from the stack.
679B DJNZ PrintString_CharacterLoop Decrease the character counter by one and loop back to PrintString_CharacterLoop until all of the characters have been printed.
Apply attribute colours to the printed string.
679D DEC DE Move left one block to the last character position.
679E CALL ConvertScreenToAttributeBufferAddress Call ConvertScreenToAttributeBufferAddress.
67A1 POP BC Restore the character counter from the stack.
67A2 LD A,C Fetch the attribute colour byte.
ColourPrintString_Loop 67A3 LD (DE),A Write the attribute colour byte to the attribute buffer.
67A4 DEC DE Move left one attribute block.
67A5 DJNZ ColourPrintString_Loop Decrease the character counter by one and loop back to ColourPrintString_Loop until the whole string is now the desired attribute colouring.
67A7 POP DE Restore the original screen buffer position from the stack.
67A8 RET Return.
Prev: 672E Up: Map Next: 67A9