![]() |
Routines |
| Prev: F602 | Up: Map | Next: F640 |
|
Used by the routine at GameStart.
Sample Kempston (1F) or the keyboard table at Table_ControlKeyCodes into the control input bitmap. Pause (H / bit 06) waits for the key to be released and pressed again before returning.
|
||||
|
Clear the bitmap, then try Kempston if enabled.
|
||||
| Read_PlayerControls | F603 | XOR A | Clear A, then clear the control input bitmap. | |
| F604 | LD ($F5F8),A | |||
| F607 | LD A,($F602) | Fetch the Kempston-enabled flag. Is Kempston selected? If not, read the keyboard at Read_PlayerControls_Keyboard. | ||
| F60A | OR A | |||
| F60B | JR Z,Read_PlayerControls_Keyboard | |||
| F60D | IN A,($1F) | Read Kempston port 1F. | ||
| F60F | AND %00011111 | Keep bits 00–04. | ||
| F611 | JR NZ,Read_PlayerControls_WriteBitmap | If any direction/fire is pressed, store it at Read_PlayerControls_WriteBitmap. | ||
|
Match the pressed key against Table_ControlKeyCodes and set the corresponding bit.
|
||||
| Read_PlayerControls_Keyboard | F613 | CALL Read_KeyboardControls | Call Read_KeyboardControls to read a key code. | |
| F616 | OR A | Was a key pressed? If not, return with the bitmap clear. | ||
| F617 | RET Z | |||
| F618 | LD E,$01 | Start the bit mask at 01 (bit 00 = Right). | ||
| F61A | LD B,$07 | Load B with 07 table entries. | ||
| F61C | LD HL,$F5FB | Point HL at Table_ControlKeyCodes. | ||
|
Scan Table_ControlKeyCodes for the pressed key and build the matching bit of ControlInputBitmap.
|
||||
| Read_PlayerControls_ScanTable | F61F | CP (HL) | Does this table slot match the pressed key? If so, handle it at Read_PlayerControls_Matched. | |
| F620 | JR Z,Read_PlayerControls_Matched | |||
| F622 | INC HL | Advance to the next slot. | ||
| F623 | SLA E | Shift the bit mask left by one. | ||
| F625 | DJNZ Read_PlayerControls_ScanTable | Loop until the table is exhausted. | ||
| F627 | XOR A | Clear A (unrecognised key), then store a clear bitmap at Read_PlayerControls_WriteBitmap. | ||
| F628 | JR Read_PlayerControls_WriteBitmap | |||
|
Matched a control key: handle pause specially, otherwise write the bitmap.
|
||||
| Read_PlayerControls_Matched | F62A | LD A,E | Keep the matched bit mask in A. | |
| F62B | BIT 6,A | Is it the pause key (bit 06)? If so, debounce pause at Read_PlayerControls_PauseRelease. | ||
| F62D | JR NZ,Read_PlayerControls_PauseRelease | |||
|
Store the assembled control bits into ControlInputBitmap.
|
||||
| Read_PlayerControls_WriteBitmap | F62F | LD ($F5F8),A | Write the control input bitmap to ControlInputBitmap. | |
| F632 | RET | Return. | ||
|
Wait for pause to be released, then for any key to resume.
|
||||
| Read_PlayerControls_PauseRelease | F633 | CALL Read_KeyboardControls | Call Read_KeyboardControls. Is a key still held? If so, keep waiting at Read_PlayerControls_PauseRelease. | |
| F636 | OR A | |||
| F637 | JR NZ,Read_PlayerControls_PauseRelease | |||
|
After pause release, wait for any key before resuming play.
|
||||
| Read_PlayerControls_PauseResume | F639 | CALL Read_KeyboardControls | Call Read_KeyboardControls. Has a key been pressed to resume? If not, keep waiting at Read_PlayerControls_PauseResume. | |
| F63C | OR A | |||
| F63D | JR Z,Read_PlayerControls_PauseResume | |||
| F63F | RET | Return. | ||
| Prev: F602 | Up: Map | Next: F640 |