Prev: 26414 Up: Map Next: 26537
26479: 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 24915 and 15360.
Configurable_PrintString 26479 LD IX,24915 IX=24915.
26483 JR PrintString Jump to PrintString.
This entry point is used by the routines at Draw_AlienMothership, Print_ControlMenu, Handler_AlienExplosions and TitleScreen.
Print using: 15360.
SpectrumFont_PrintString 26485 LD IX,15360 IX=15360.
26489 JR PrintString Jump to PrintString.
This entry point is used by the routines at Draw_AlienMothership, Handler_Mothership and Handler_AlienExplosions.
Print using: 24915.
CustomFont_PrintString 26491 LD IX,24915 IX=24915.
Print the string to the screen buffer.
PrintString 26495 PUSH DE Stash the screen position and character counter/ attribute value on the stack
26496 PUSH BC
PrintString_CharacterLoop 26497 PUSH BC Stash the character counter/ attribute value, screen position and string pointer on the stack.
26498 PUSH DE
26499 PUSH HL
Calculate the address in the font data for the current character.
26500 LD L,(HL) Store the offset for the UDG data look-up in HL.
26501 LD H,0
26503 ADD HL,HL Multiply HL by 8 (as each character is 8 bytes in length).
26504 ADD HL,HL
26505 ADD HL,HL
26506 PUSH IX Copy IX containing the font base into BC (using the stack).
26508 POP BC
26509 ADD HL,BC Add the font base to HL so it now points at the correct font data for the currently processed character.
26510 LD B,8 Set a counter in B for 8 bytes/ data lines.
PrintString_Loop 26512 LD A,(HL) Copy one line of graphics data to the screen buffer.
26513 LD (DE),A
26514 INC HL Move to the next byte of graphics data.
26515 INC D Move down one pixel row.
26516 DJNZ PrintString_Loop Decrease the row counter by one and loop back to PrintString_Loop until all 8 lines of graphic data have been written to the screen.
26518 POP HL Restore the screen position pointer and screen position from the stack.
26519 POP DE
26520 INC DE Move to the next screen buffer position.
26521 INC HL Move to the next character in the string.
26522 POP BC Restore the character counter from the stack.
26523 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.
26525 DEC DE Move left one block to the last character position.
26526 CALL ConvertScreenToAttributeBufferAddress Call ConvertScreenToAttributeBufferAddress.
26529 POP BC Restore the character counter from the stack.
26530 LD A,C Fetch the attribute colour byte.
ColourPrintString_Loop 26531 LD (DE),A Write the attribute colour byte to the attribute buffer.
26532 DEC DE Move left one attribute block.
26533 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.
26535 POP DE Restore the original screen buffer position from the stack.
26536 RET Return.
Prev: 26414 Up: Map Next: 26537