![]() |
Routines |
| Prev: EEE7 | Up: Map | Next: EF82 |
|
Walks a message script pointed to by HL. Bytes below 20 are control codes; the rest print as literals via ClipAndPrintCharacter.
|
||||
| PrintMessage | EEF1 | LD A,(HL) | Fetch the next script byte. | |
| EEF2 | INC HL | |||
|
Codes 00-17 set the print row and column.
|
||||
| EEF3 | CP $18 | Jump to PrintMessage_SetPosition if A is less than 18. | ||
| EEF5 | JR C,PrintMessage_SetPosition | |||
|
Code 18 sets the print attribute.
|
||||
| EEF7 | JR Z,PrintMessage_SetAttribute | Jump to PrintMessage_SetAttribute if A is 18. | ||
|
Code 1A ends the script.
|
||||
| EEF9 | CP $1A | Return if A is 1A. | ||
| EEFB | RET Z | |||
|
Code 19 sets the print flags.
|
||||
| EEFC | JR C,PrintMessage_SetFlags | Jump to PrintMessage_SetFlags if A is less than 1A. | ||
|
Code 1B repeats the current character.
|
||||
| EEFE | CP $1C | Jump to PrintMessage_Repeat if A is less than 1C. | ||
| EF00 | JR C,PrintMessage_Repeat | |||
|
Code 1C fills a box of spaces.
|
||||
| EF02 | JR Z,PrintMessage_FillBox | Jump to PrintMessage_FillBox if A is 1C. | ||
|
Code 1D starts a new line from the left margin.
|
||||
| EF04 | CP $1E | Jump to PrintMessage_NewLine if A is less than 1E. | ||
| EF06 | JR C,PrintMessage_NewLine | |||
|
Code 1E adds to the column, then advances the row.
|
||||
| EF08 | JR Z,PrintMessage_AddColumn | Jump to PrintMessage_AddColumn if A is 1E. | ||
|
Code 1F calls a location-art sub-script.
|
||||
| EF0A | CP $1F | Jump to CallSubMessage if A is 1F. | ||
| EF0C | JP Z,CallSubMessage | |||
|
Literal character.
|
||||
| EF0F | LD ($5BF9),A | Write A to *PrintState_Character. | ||
| EF12 | CALL ClipAndPrintCharacter | Call ClipAndPrintCharacter. | ||
| EF15 | JR PrintMessage | Jump to PrintMessage. | ||
|
Set the print row, column and left margin.
|
||||
| PrintMessage_SetPosition | EF17 | LD ($5BF8),A | Write A to *PrintState_Row. | |
| EF1A | LD A,(HL) | Write the next script byte to *PrintState_Column. | ||
| EF1B | LD ($5BF7),A | |||
| EF1E | LD ($5B00),A | Write A to *PrintLeftMarginColumn. | ||
| EF21 | INC HL | Advance HL. | ||
| EF22 | JR PrintMessage | Jump to PrintMessage. | ||
|
Set the print attribute.
|
||||
| PrintMessage_SetAttribute | EF24 | LD A,(HL) | Write the next script byte to *PrintState. | |
| EF25 | LD ($5BF5),A | |||
| EF28 | INC HL | Advance HL. | ||
| EF29 | JR PrintMessage | Jump to PrintMessage. | ||
|
Set the print flags.
|
||||
| PrintMessage_SetFlags | EF2B | LD A,(HL) | Write the next script byte to *PrintState_Flags. | |
| EF2C | LD ($5BF6),A | |||
| EF2F | INC HL | Advance HL. | ||
| EF30 | JR PrintMessage | Jump to PrintMessage. | ||
|
Repeat the current character.
|
||||
| PrintMessage_Repeat | EF32 | LD A,(HL) | Load the repeat count from the script. | |
| EF33 | LD B,A | |||
| PrintMessage_Repeat_Loop | EF34 | CALL ClipAndPrintCharacter | Call ClipAndPrintCharacter until the count is done. | |
| EF37 | DJNZ PrintMessage_Repeat_Loop | |||
| EF39 | INC HL | Advance HL. | ||
| EF3A | JR PrintMessage | Jump to PrintMessage. | ||
|
Fill a box of spaces.
|
||||
| PrintMessage_FillBox | EF3C | LD B,(HL) | B=the row count. | |
| EF3D | LD A,$20 | Write a space to *PrintState_Character. | ||
| EF3F | LD ($5BF9),A | |||
| EF42 | INC HL | Write the next script byte to *PrintState. | ||
| EF43 | LD A,(HL) | |||
| EF44 | LD ($5BF5),A | |||
| EF47 | INC HL | Write the next script byte to *PrintState_Row. | ||
| EF48 | LD A,(HL) | |||
| EF49 | LD ($5BF8),A | |||
|
Print one row of the box.
|
||||
| PrintMessage_FillBox_Row | EF4C | PUSH BC | Stash the row counter on the stack. | |
| EF4D | LD B,$14 | Begin a row of 14 spaces from column 06. | ||
| EF4F | LD A,$06 | |||
| EF51 | LD ($5BF7),A | |||
| PrintMessage_FillBox_Column | EF54 | CALL ClipAndPrintCharacter | Call ClipAndPrintCharacter until the column count is done. | |
| EF57 | DJNZ PrintMessage_FillBox_Column | |||
| EF59 | LD A,($5BF8) | Advance *PrintState_Row. | ||
| EF5C | INC A | |||
| EF5D | LD ($5BF8),A | |||
| EF60 | POP BC | Restore the row counter and loop. | ||
| EF61 | DJNZ PrintMessage_FillBox_Row | |||
| EF63 | INC HL | Advance HL. | ||
| EF64 | JP PrintMessage | Jump to PrintMessage. | ||
|
Start a new line from the left margin.
|
||||
| PrintMessage_NewLine | EF67 | LD A,($5B00) | Restore the column from the left-margin copy at PrintLeftMarginColumn. | |
| EF6A | LD ($5BF7),A | |||
| PrintMessage_AdvanceRow | EF6D | LD A,($5BF8) | Advance *PrintState_Row. | |
| EF70 | INC A | |||
| EF71 | LD ($5BF8),A | |||
| EF74 | JP PrintMessage | Jump to PrintMessage. | ||
|
Add to the column, then advance the row.
|
||||
| PrintMessage_AddColumn | EF77 | LD B,(HL) | Add the next script byte to the left-margin column. | |
| EF78 | LD A,($5B00) | |||
| EF7B | ADD A,B | |||
| EF7C | LD ($5BF7),A | |||
| EF7F | INC HL | Advance HL. | ||
| EF80 | JR PrintMessage_AdvanceRow | Jump to PrintMessage_AdvanceRow. | ||
| Prev: EEE7 | Up: Map | Next: EF82 |