HOME

OS Apps:

Add Two 2-digit Hex Numbers (8-bit Bytes)

Overview:

A portion of the SBC30 code has been sliced and edited as  SBC30_TEST_OS_03b.asm for the Add Two 2-digit Hex Numbers function. The SIM will provide an input of "2" to select the menu item and then "AA" followed by "AB" as the two 2-digit hex numbers to be added.

 

Tester:

Oshonsoft 6502 Simulator IDE v1.41

 

Setup:

Setup your IDE as shown in the top screenshot adjacent.

In the Peripheral Devices window:

- set Device 1 to be an INput on port $5000 with a One-Shot IN value of 33 (for the number 3)

- Set Output Terminal to I/O Port $5000

- Set Input Terminal to I/O Port $5000

- Send Hex Bytes 41,41,41,42

Adjust the 2 Memory Editors to show addresses $0000 and $0200.

In the Watch Variables window, you may wish to add:

- Num1 at $0040

- Num2 at $0050

- AddSum at $0058

- Carry2NSB at $0070

 

SIM Breakpoints:

The only BPs needed are at 2823 and 2874. The first one will allow you to see the add operation.

The second BP is for the RTS to end the program.

 

Use <CTRL><F6> to get you to the breakpoints. Use <F2> at each to get a feel for what is occurring, then continue to the next BP using <CTRL><F6>.

 

App Operation:

Using the FlashROM code and not the Sim, here are the keystrokes needed to produce the adjacent lower screenshot. The Carry bit will be shown if you use $AA and $AB.

- Press Reset button

- O

- 2

- AA

- AB

 

IDE Operation:

If you wish to burn the code to flashROM, try this latest build: SBC30_0_R9.bin

Oshonsoft 6502 Simulator IDE

(Click to Enlarge)

 

Sim IDE

 

ASCII Terminal

 

 

 

 

Updated 2023-10-08 @ 8am

 

HOME