HOME

Part 7: Using a W65C02 Simulator:

Check and Buffer 4 Valid Key Presses

Overview

This routine reads four consecutive key presses, buffers them and outputs them to the screen one at a time.

When all four have been entered successfully, a "$" is displayed followed by all four buffered key presses.

If a hex number other than 0-9, A-F and a-f is entered, it's erased and the program waits for a successful key press. That is accomplished in the full program,  SBC3.0_ACIA-VIA__8j.asm, using "jsr kpChecker", but in the interest of program demo speed it's commented out in this test code.

 

Run through the program testFourChars.asm using the method you learned in Part 6.

 

If you like you could change lines like 22, 31, 39, 47 from "lda #$3?" to "lda $7001" and provide the "key press" through the Input Terminal portion of the Peripheral Devices window.

Note: I added "pha" in line 11 and "pla" in line 72 to show some Stack activity so the 4 line numbers mentioned above may be offset by 1.

 

You'll notice in the adjacent screenshot that Memory Editor 3 is positioned to show the contents of the buffer at address $0310, Memory Editor 2 watches the Stack at $01FF, and Memory Editor 1 lists the entire program.

Oshonsoft 6502 Simulator IDE

(Click to Enlarge)

 

 

 

Updated 2023-07-25 @ 8am

 

TOP

 

HOME