Routines |
Prev: 7D3D | Up: Map | Next: 7E6B |
Used by the routines at LifeLost, InitialiseNewGame, Print_GameOver, PlayGame, Handler_Showdown, GirlWonRound, PlayerWonRound, PlayerLostRound, GirlLostRound, MarkCards, PlayerAction_Drop, PlayerAction_Raise, PlayerAction_Hold, HandlerRaising, GirlArtificialIntelligence, GirlAction_Raise and GirlAction_Hold.
|
||||||||
13 is the highest message block ID.
|
||||||||
Messaging_Girl | 7D97 | LD ($8CEF),A | Write the given message block ID to *CurrentMessageBlock. | |||||
7D9A | CP $13 | Return if the message block ID is equal to or higher than 13. | ||||||
7D9C | RET NC | |||||||
7D9D | INC A | Increment A by one. | ||||||
7D9E | LD HL,$8CAE | HL=8CAE (i.e. Table_InGameMessaging-03). | ||||||
Find the relevant message block.
|
||||||||
FindMessagingBlock | 7DA1 | INC HL | Increment HL by three. | |||||
7DA2 | INC HL | |||||||
7DA3 | INC HL | |||||||
7DA4 | DEC A | Decrease A by one and keep jumping back to FindMessagingBlock until it is zero. | ||||||
7DA5 | JR NZ,FindMessagingBlock | |||||||
Reference the message block data.
|
||||||||
7DA7 | LD E,(HL) | Load the referenced message block into DE. | ||||||
7DA8 | INC HL | |||||||
7DA9 | LD D,(HL) | |||||||
7DAA | INC HL | Write the number of messages in this message block to *CurrentNumberOfMessagesInBlock. | ||||||
7DAB | LD A,(HL) | |||||||
7DAC | LD ($8CEA),A | |||||||
7DAF | LD ($8CEB),DE | Write DE to both *PointerToStartOfCurrentMessageBlock and *PointerCurrentMessageString. | ||||||
7DB3 | LD ($8CED),DE | |||||||
Loop through each message in this message block until the random number generator returns a number less than 0A. This is likely a completely arbitrary number.
|
||||||||
PickRandomMessage | 7DB7 | LD B,A | B=the number of messages in this message block. | |||||
PickRandomMessage_Loop | 7DB8 | CALL GetRandomNumber | Call GetRandomNumber. | |||||
7DBB | CP $0A | Jump to Prepare_GirlMessaging if the picked random number is lower than 0A. | ||||||
7DBD | JR C,Prepare_GirlMessaging | |||||||
Each message is 0036 bytes long, so here we're moving to the address of the next message.
|
||||||||
7DBF | LD DE,$0036 | HL=*PointerCurrentMessageString+0036. | ||||||
7DC2 | LD HL,($8CED) | |||||||
7DC5 | ADD HL,DE | |||||||
7DC6 | LD ($8CED),HL | Write HL to *PointerCurrentMessageString. | ||||||
7DC9 | DJNZ PickRandomMessage_Loop | Decrease counter by one and loop back to PickRandomMessage_Loop until counter is zero. | ||||||
Nothing was picked, so refresh the message count and repoint *PointerCurrentMessageString to the first message again.
|
||||||||
7DCB | LD HL,($8CEB) | Write *PointerToStartOfCurrentMessageBlock to *PointerCurrentMessageString. | ||||||
7DCE | LD ($8CED),HL | |||||||
7DD1 | LD A,($8CEA) | A=*CurrentNumberOfMessagesInBlock. | ||||||
7DD4 | JR PickRandomMessage | Jump to PickRandomMessage. | ||||||
A message has been picked, so prepare the display for printing it.
|
||||||||
Prepare_GirlMessaging | 7DD6 | XOR A | Set the current line as 00. | |||||
Print_GirlMessaging_Loop | 7DD7 | PUSH AF | Stash the current line on the stack. | |||||
Set the speech bubble attributes.
|
||||||||
7DD8 | LD A,$10 | Set INK: BLACK. | ||||||
7DDA | RST $10 | |||||||
7DDB | XOR A | |||||||
7DDC | RST $10 | |||||||
7DDD | LD A,$11 | Set PAPER: WHITE. | ||||||
7DDF | RST $10 | |||||||
7DE0 | LD A,$07 | |||||||
7DE2 | RST $10 | |||||||
7DE3 | LD A,$16 | PRINT AT: 00, 0D. | ||||||
7DE5 | RST $10 | |||||||
7DE6 | POP AF | |||||||
7DE7 | PUSH AF | |||||||
7DE8 | RST $10 | |||||||
7DE9 | LD A,$0D | |||||||
7DEB | RST $10 | |||||||
7DEC | LD A,$13 | BRIGHT: ON. | ||||||
7DEE | RST $10 | |||||||
7DEF | LD A,$01 | |||||||
7DF1 | RST $10 | |||||||
7DF2 | LD DE,($8CED) | DE=*PointerCurrentMessageString. | ||||||
7DF6 | LD BC,$000E | Set the line length 000E in BC. | ||||||
7DF9 | POP AF | Restore the current line from the stack. | ||||||
The last line is two characters less than the previous lines. This gives us a slight "speech bubble" effect. Kind of... Sorta...
|
||||||||
7DFA | CP $03 | Are we on line 03? | ||||||
7DFC | PUSH AF | Stash the current line on the stack. | ||||||
7DFD | JR NZ,Print_GirlMessaging | Jump to Print_GirlMessaging if we're not yet on line 03. | ||||||
7DFF | DEC BC | Decrease the message length by two. | ||||||
7E00 | DEC BC | |||||||
Print the current line.
|
||||||||
Print_GirlMessaging | 7E01 | CALL Print40ColumnText | Call Print40ColumnText. | |||||
On return, DE points to the start of the next line - so update the pointer.
|
||||||||
7E04 | LD ($8CED),DE | Write DE to *PointerCurrentMessageString. | ||||||
7E08 | POP AF | Restore the current line from the stack. | ||||||
7E09 | CP $03 | Jump to Printed_GirlMessaging if we're on line 03. | ||||||
7E0B | JR Z,Printed_GirlMessaging | |||||||
7E0D | INC A | Increment A by one. | ||||||
7E0E | JR Print_GirlMessaging_Loop | Jump to Print_GirlMessaging_Loop. | ||||||
The messaging has been printed.
|
||||||||
Printed_GirlMessaging | 7E10 | LD A,($8CEF) | Jump to Messaging_Girl_0 if *CurrentMessageBlock is equal to either 11 or 0F. | |||||
7E13 | CP $11 | |||||||
7E15 | JR Z,Messaging_Girl_0 | |||||||
7E17 | CP $0F | |||||||
7E19 | JR Z,Messaging_Girl_0 | |||||||
7E1B | JR GirlMessaging_GetInput | Jump to GirlMessaging_GetInput. | ||||||
Messaging_Girl_0 | 7E1D | LD A,$00 | Write 00 to *92C5. | |||||
7E1F | LD ($92C5),A | |||||||
GirlMessaging_GetInput | 7E22 | CALL Controls | Call Controls. | |||||
7E25 | CP $05 | Jump to GirlMessaging_GetInput if A is higher than 05. | ||||||
7E27 | JR NC,GirlMessaging_GetInput | |||||||
7E29 | LD A,($8CEF) | Jump to RemoveSpeechBubble if *CurrentMessageBlock is not equal to 12. | ||||||
7E2C | CP $12 | |||||||
7E2E | JR NZ,RemoveSpeechBubble | |||||||
7E30 | LD HL,$5800 | HL=5800 (screen buffer location). | ||||||
7E33 | LD DE,$583F | DE=583F (attribute buffer location). | ||||||
7E36 | LD C,$20 | C=20. | ||||||
Messaging_Girl_1 | 7E38 | PUSH HL | Stash HL and DE on the stack. | |||||
7E39 | PUSH DE | |||||||
7E3A | LD B,$06 | B=06. | ||||||
Messaging_Girl_2 | 7E3C | XOR A | A=00. | |||||
7E3D | LD (HL),$00 | Write 00 to *HL. | ||||||
7E3F | LD (DE),A | Write A to *DE. | ||||||
7E40 | PUSH DE | Stash DE on the stack. | ||||||
7E41 | LD DE,$0040 | HL+=0040. | ||||||
7E44 | ADD HL,DE | |||||||
7E45 | PUSH HL | IX=HL (using the stack). | ||||||
7E46 | POP IX | |||||||
7E48 | POP HL | Restore HL from the stack. | ||||||
7E49 | ADD HL,DE | HL+=DE. | ||||||
7E4A | EX DE,HL | Exchange the DE and HL registers. | ||||||
7E4B | PUSH IX | HL=IX (using the stack). | ||||||
7E4D | POP HL | |||||||
7E4E | DJNZ Messaging_Girl_2 | Decrease counter by one and loop back to Messaging_Girl_2 until counter is zero. | ||||||
7E50 | LD A,$0E | A=0E. | ||||||
Messaging_Girl_3 | 7E52 | DJNZ Messaging_Girl_3 | Decrease counter by one and loop back to Messaging_Girl_3 until counter is zero. | |||||
7E54 | DEC A | Decrease A by one. | ||||||
7E55 | JR NZ,Messaging_Girl_3 | Jump to Messaging_Girl_3 until A is zero. | ||||||
7E57 | POP DE | Restore DE and HL from the stack. | ||||||
7E58 | POP HL | |||||||
7E59 | INC HL | Increment HL by one. | ||||||
7E5A | DEC DE | Decrease DE by one. | ||||||
7E5B | DEC C | Decrease C by one. | ||||||
7E5C | JR NZ,Messaging_Girl_1 | Jump to Messaging_Girl_1 until C is zero. | ||||||
Count to 50000 to give the player a chance to read the messaging.
|
||||||||
7E5E | LD B,$05 | Set a counter for 05 loops. | ||||||
Messaging_Girl_PauseLoop | 7E60 | LD HL,$0000 | HL=0000. | |||||
Messaging_Girl_InnerPauseLoop | 7E63 | DEC HL | Decrease HL by one. | |||||
7E64 | LD A,H | Loop back to Messaging_Girl_InnerPauseLoop until HL is zero. | ||||||
7E65 | OR L | |||||||
7E66 | JR NZ,Messaging_Girl_InnerPauseLoop | |||||||
7E68 | DJNZ Messaging_Girl_PauseLoop | Decrease the counter by one and loop back to Messaging_Girl_PauseLoop until the counter is zero. | ||||||
7E6A | RET | Return. |
Prev: 7D3D | Up: Map | Next: 7E6B |