Prev: 51578 Up: Map Next: 51739
51695: Print String
Used by the routine at DisplayMenu.
Prints a string in the main font, at a position given in pixels measured from the bottom left of the screen. The string ends with a character that has bit 7 set. The attribute for the whole string is in AF', unless the string is printed by entering at PrintStringWithAttribute, which takes the attribute from the first byte of the string.
After PrintString
print-string
Input
A' Attribute
DE Address of the string
HL Position (X in L, Y in H)
Set the font and find the screen address.
PrintString 51695 PUSH HL Stash the position on the stack.
51696 LD HL,27486 Write 27486 to FontPointer.
51699 LD (48044),HL
51702 POP HL Restore the position from the stack.
51703 CALL CalculateScreenAddress Call CalculateScreenAddress.
51706 JR PrintString_Loop Jump to PrintString_Loop.
This entry point is used by the routines at StartGame and GameOver.
Prints a string that starts with an attribute.
PrintStringWithAttribute 51708 PUSH HL Stash the position on the stack.
51709 LD HL,27486 Write 27486 to FontPointer.
51712 LD (48044),HL
51715 POP HL Restore the position from the stack.
51716 CALL CalculateScreenAddress Call CalculateScreenAddress.
51719 LD A,(DE) Fetch the attribute.
51720 INC DE Move on to the string.
51721 EX AF,AF' Keep the attribute in AF'.
Print each character of the string.
PrintString_Loop 51722 LD A,(DE) Fetch the next character.
51723 INC DE Move on to the next character.
51724 BIT 7,A Jump to PrintString_Last if it is the last one.
51726 JR NZ,PrintString_Last
51728 CALL PrintCharacterWithAttribute Call PrintCharacterWithAttribute.
51731 INC L Move on to the next position.
51732 JR PrintString_Loop Jump to PrintString_Loop.
Print the last character.
PrintString_Last 51734 AND %01111111 Keep bits 0 to 6.
51736 JP PrintCharacterWithAttribute Jump to PrintCharacterWithAttribute.
Prev: 51578 Up: Map Next: 51739