Routines |
Prev: E77A | Up: Map | Next: E7E9 |
Used by the routine at GameLoop.
|
||||||||||||||||||||
Handler_ChangeCharacters | E79B | LD A,$F7 | Read from the keyboard;
|
|||||||||||||||||
E79D | IN A,($FE) | |||||||||||||||||||
E79F | OR %11100000 | Set bits 5-7. | ||||||||||||||||||
E7A1 | XOR %11111111 | Return if no keys have been pressed. | ||||||||||||||||||
E7A3 | RET Z | |||||||||||||||||||
Fetch room ID for the current character.
|
||||||||||||||||||||
E7A4 | LD B,(IY+$0F) | B=*IY+0F. | ||||||||||||||||||
E7A7 | PUSH IY | Stash the character pointer in IY on the stack. | ||||||||||||||||||
Loop through the port bits and correlate them with the base character reference in IY.
This associates each character with a keypress.
|
||||||||||||||||||||
E7A9 | LD IY,$BC67 | IY=FrameId_Wally. | ||||||||||||||||||
ChangeCharacters_WhichCharacter_Loop | E7AD | RRCA | Rotate A right once. | |||||||||||||||||
E7AE | JR C,ChangeCharacters_CheckRoom | If this key has been pressed, jump to ChangeCharacters_CheckRoom. | ||||||||||||||||||
The character data is "interlaced" hence we can increment to point to the next character in the sequence.
|
||||||||||||||||||||
E7B0 | INC IY | Increment IY by one. | ||||||||||||||||||
E7B2 | JR ChangeCharacters_WhichCharacter_Loop | Jump to ChangeCharacters_WhichCharacter_Loop. | ||||||||||||||||||
Check if the current character is in the same room as the selected character.
|
||||||||||||||||||||
ChangeCharacters_CheckRoom | E7B4 | LD A,(IY+$0F) | A=*IY+0F. | |||||||||||||||||
E7B7 | CP B | If this is the same room, jump to ChangeCharacters_Process. | ||||||||||||||||||
E7B8 | JR Z,ChangeCharacters_Process | |||||||||||||||||||
If the character is elsewhere, print where they are to the screen.
|
||||||||||||||||||||
E7BA | CALL Handler_DisplayCharacterLocation | Call Handler_DisplayCharacterLocation. | ||||||||||||||||||
Restore the current character pointer to IY and return.
|
||||||||||||||||||||
ChangeCharacters_Return | E7BD | POP IY | Restore the character pointer in IY from the stack. | |||||||||||||||||
E7BF | RET | Return. | ||||||||||||||||||
The chosen character is in the same room as the current character, so begin to action the request.
|
||||||||||||||||||||
ChangeCharacters_Process | E7C0 | CALL Character_Active | Call Character_Active. | |||||||||||||||||
E7C3 | JR Z,ChangeCharacters_Return | If the selected character is the current character, jump to ChangeCharacters_Return. | ||||||||||||||||||
E7C5 | LD ($B09D),IY | Write IY to *CurrentCharacter. | ||||||||||||||||||
E7C9 | POP IY | Restore IY from the stack. | ||||||||||||||||||
E7CB | LD A,B | A=B. | ||||||||||||||||||
E7CC | CALL $AC69 | Call AC69. | ||||||||||||||||||
E7CF | LD A,(HL) | A=*HL. | ||||||||||||||||||
E7D0 | LD (IY+$69),A | Write A to IY+69. | ||||||||||||||||||
E7D3 | INC HL | Increment HL by one. | ||||||||||||||||||
E7D4 | LD A,(HL) | A=*HL. | ||||||||||||||||||
E7D5 | LD (IY+$64),A | Write A to IY+64. | ||||||||||||||||||
E7D8 | INC HL | Increment HL by one. | ||||||||||||||||||
E7D9 | LD A,(HL) | A=*HL. | ||||||||||||||||||
E7DA | LD (IY+$73),A | Write A to IY+73. | ||||||||||||||||||
E7DD | LD (IY+$6E),$05 | Write 05 to IY+6E. | ||||||||||||||||||
E7E1 | LD IY,($B09D) | IY=*CurrentCharacter. | ||||||||||||||||||
Update the banner to show the updated character name.
|
||||||||||||||||||||
E7E5 | CALL PrintBanner | Call PrintBanner. | ||||||||||||||||||
E7E8 | RET | Return. |
Prev: E77A | Up: Map | Next: E7E9 |