HOME

Using a W65c02 Simulator:

Buffer and Display 4 Key Presses

Overview: A portion of the SBC30 code has been sliced and edited as  SBC30_TestBloc.asm to only show us the buffering and display of 4 user key presses.

 

Actions: Oshonsoft 6502 Simulator IDE

Setup:

- IDE window: Tools | Assembler

- Assembler window: File | Open | SBC30_TestBlock.asm

- Assembler window: Tools | Assemble & Load

- Assembler window: Click in vertical column at line 38 that reads "TOP:", then right-click until "BP" appears.

- Assembler window: Repeat BPs for lines 91 & 156

- IDE window: Tools | Memory Editor. Use right-side scrollbar so you can see address 01F0 (the Stack).

- IDE window: Tools | Memory Editor2. Use right-side scrollbar so you can see address 0300 (character buffer)

- IDE window: Tools | Peripheral Devices (PD)

- PD window: Device 1: ON | IN | 5000.  Change the value of $00 to $46 in the white box to the left of Set one-shot IN value

- PD window: Output Terminal | 5000

- IDE window:  Tools | Watch Variables (WV)

- WV window: Add | 4char0300/Integer/0300. Repeat for 4char0302/Integer/0302 and 4char0304/Integer/0304

- WV window: Add | data/Integer/5000, status/Integer/5001

 

IDE Operation:

BPs are breakpoints. We want one at "TOP" for when the program starts and when we would like it to end. We also want one when "kpRead" executes at line 91 and one more at line 156 when "FourChars3" runs; this will be the final display of the 4 buffered characters.

We could change the port 5000 input value for each different character we would like shown and stored but it is easier to use "F" to both choose the menu item "FourChars" and as a hex value entered.

In the IDE window set "Rate" to "Ultimate"  and press <F1 > to start the Sim.

At the first BreakPoint, press <CTRL><F6> to continue.

At the second BP the preset value of $46 (the letter F) will be accepted if you press <F2> while in the IDE window to single-step to the next instruction. 46 should appear in the A register and the letter "F "should display in the PD output terminal window.

For each subsequent BP press <CTRL><F6> to continue on; we are only interested in the last BP at line 156.

Within the Watch Variables window, the FourChars buffer should be filling. We set aside 6 bytes in this window starting at $0300. We expect to see 4646 in 0300, 4646 in 0302 and 0000 in 0304 because the null termination character, 00, will have been placed in it in line 148.

Once the input and output have been displayed, the program should advance to line 38 where we placed a BP at label "TOP", which is the end of the program as far as we're concerned.

Our objective should have been met: "F" selects the "FourChars' app,  "F" is passed 4 times as the address we are buffering, and the buffer of those 4 characters is displayed on our screens.

Oshonsoft 6502 Simulator IDE

(Click to Enlarge)

 

Updated 2023-08-18 @ 8am

 

HOME