![]() |
Routines |
| Prev: 811B | Up: Map | Next: 815B |
|
|
||||
|
Second menu (811B) - checks for one of two key press options (both checked using the same keyboard port).
|
||||
| 812D | LD BC,$BFFE | Keyboard port address for keys H, J, K, L, Enter | ||
| 8130 | IN A,(C) | Read port input | ||
| 8132 | LD C,A | Temp store value in C register for next check | ||
|
Check if ENTER is being pressed
|
||||
| 8133 | OR %11111110 | Need to check bit 0, so set all other bits | ||
| 8135 | CP %11111110 | Check for the ENTER key | ||
| 8137 | LD A,$00 | Set "New Game" flag (0) in advance of a positive check | ||
| 8139 | JR Z,$8150 | Finish check/jump out here if ENTER is pressed | ||
|
Check if LOAD ("J") is being pressed
|
||||
| 813B | LD A,C | Retrieve keyboard port address input from C register | ||
| 813C | OR %11110111 | Need to check bit 3, so set all other bits | ||
| 813E | CP %11111111 | Check for "J" key | ||
| 8140 | JR Z,$812D | If it's not being pressed, jump back and keep scanning for ENTER or LOAD keys | ||
|
LOAD ("J") has been pressed
|
||||
| 8142 | CALL $815B | LOAD has been selected. Clear the screen (pixels) | ||
| 8145 | LD DE,$8CCD | Get address of text string ("LOAD SAVED GAME") | ||
| 8148 | LD HL,$48C8 | Set screen position for printing text | ||
| 814B | CALL $8179 | Print "LOAD SAVED GAME" on screen | ||
| 814E | LD A,$01 | Set "Load game" flag (1) | ||
|
ENTER or LOAD has now been selected, and the A register contains flag for either new game (0) or load game (1)
|
||||
| 8150 | LD ($8BAB),A | Store game flag (0 = New Game, 1 = Load Saved Game) | ||
| 8153 | CP $01 | |||
| 8155 | JR Z,$815A | Load game - don't clear the screen (skip the next instruction to leave "LOAD SAVED GAME" message on-screen) | ||
| 8157 | CALL $815B | New game - clear the screen (pixels) | ||
| 815A | RET | |||
| Prev: 811B | Up: Map | Next: 815B |