Prev: 61159 Up: Map Next: 61314
61169: Print Message
Used by the routines at CallSubMessage, SubMessageSelect and LocationGraphicSetup.
Walks a message script pointed to by HL. Bytes below 32 are control codes; the rest print as literals via ClipAndPrintCharacter.
PrintMessage 61169 LD A,(HL) Fetch the next script byte.
61170 INC HL
Codes 0-23 set the print row and column.
61171 CP 24 Jump to PrintMessage_SetPosition if A is less than 24.
61173 JR C,PrintMessage_SetPosition
Code 24 sets the print attribute.
61175 JR Z,PrintMessage_SetAttribute Jump to PrintMessage_SetAttribute if A is 24.
Code 26 ends the script.
61177 CP 26 Return if A is 26.
61179 RET Z
Code 25 sets the print flags.
61180 JR C,PrintMessage_SetFlags Jump to PrintMessage_SetFlags if A is less than 26.
Code 27 repeats the current character.
61182 CP 28 Jump to PrintMessage_Repeat if A is less than 28.
61184 JR C,PrintMessage_Repeat
Code 28 fills a box of spaces.
61186 JR Z,PrintMessage_FillBox Jump to PrintMessage_FillBox if A is 28.
Code 29 starts a new line from the left margin.
61188 CP 30 Jump to PrintMessage_NewLine if A is less than 30.
61190 JR C,PrintMessage_NewLine
Code 30 adds to the column, then advances the row.
61192 JR Z,PrintMessage_AddColumn Jump to PrintMessage_AddColumn if A is 30.
Code 31 calls a location-art sub-script.
61194 CP 31 Jump to CallSubMessage if A is 31.
61196 JP Z,CallSubMessage
Literal character.
61199 LD (23545),A Write A to *PrintState_Character.
61202 CALL ClipAndPrintCharacter Call ClipAndPrintCharacter.
61205 JR PrintMessage Jump to PrintMessage.
Set the print row, column and left margin.
PrintMessage_SetPosition 61207 LD (23544),A Write A to *PrintState_Row.
61210 LD A,(HL) Write the next script byte to *PrintState_Column.
61211 LD (23543),A
61214 LD (23296),A Write A to *PrintLeftMarginColumn.
61217 INC HL Advance HL.
61218 JR PrintMessage Jump to PrintMessage.
Set the print attribute.
PrintMessage_SetAttribute 61220 LD A,(HL) Write the next script byte to *PrintState.
61221 LD (23541),A
61224 INC HL Advance HL.
61225 JR PrintMessage Jump to PrintMessage.
Set the print flags.
PrintMessage_SetFlags 61227 LD A,(HL) Write the next script byte to *PrintState_Flags.
61228 LD (23542),A
61231 INC HL Advance HL.
61232 JR PrintMessage Jump to PrintMessage.
Repeat the current character.
PrintMessage_Repeat 61234 LD A,(HL) Load the repeat count from the script.
61235 LD B,A
PrintMessage_Repeat_Loop 61236 CALL ClipAndPrintCharacter Call ClipAndPrintCharacter until the count is done.
61239 DJNZ PrintMessage_Repeat_Loop
61241 INC HL Advance HL.
61242 JR PrintMessage Jump to PrintMessage.
Fill a box of spaces.
PrintMessage_FillBox 61244 LD B,(HL) B=the row count.
61245 LD A,32 Write a space to *PrintState_Character.
61247 LD (23545),A
61250 INC HL Write the next script byte to *PrintState.
61251 LD A,(HL)
61252 LD (23541),A
61255 INC HL Write the next script byte to *PrintState_Row.
61256 LD A,(HL)
61257 LD (23544),A
Print one row of the box.
PrintMessage_FillBox_Row 61260 PUSH BC Stash the row counter on the stack.
61261 LD B,20 Begin a row of 20 spaces from column 6.
61263 LD A,6
61265 LD (23543),A
PrintMessage_FillBox_Column 61268 CALL ClipAndPrintCharacter Call ClipAndPrintCharacter until the column count is done.
61271 DJNZ PrintMessage_FillBox_Column
61273 LD A,(23544) Advance *PrintState_Row.
61276 INC A
61277 LD (23544),A
61280 POP BC Restore the row counter and loop.
61281 DJNZ PrintMessage_FillBox_Row
61283 INC HL Advance HL.
61284 JP PrintMessage Jump to PrintMessage.
Start a new line from the left margin.
PrintMessage_NewLine 61287 LD A,(23296) Restore the column from the left-margin copy at PrintLeftMarginColumn.
61290 LD (23543),A
PrintMessage_AdvanceRow 61293 LD A,(23544) Advance *PrintState_Row.
61296 INC A
61297 LD (23544),A
61300 JP PrintMessage Jump to PrintMessage.
Add to the column, then advance the row.
PrintMessage_AddColumn 61303 LD B,(HL) Add the next script byte to the left-margin column.
61304 LD A,(23296)
61307 ADD A,B
61308 LD (23543),A
61311 INC HL Advance HL.
61312 JR PrintMessage_AdvanceRow Jump to PrintMessage_AdvanceRow.
Prev: 61159 Up: Map Next: 61314