HOME

OS Apps:

Add Two 4-digit Hex Numbers (16-bit Words)

Overview:

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

 

Tester:

Oshonsoft 6502 Simulator IDE v1.45

 

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 31,32,33,34,41,42,43,44

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

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

- (Cnv4LoHi) at $0208

- Num1_LoHi at $0040

- Num2_LoHi at $0042

- Rslt_LoHi at $0044

- Rslt_NSB at $0046

 

SIM Breakpoints:

BPs needed are at 2671, 2690, 2729 and 2736. The first ones will allow you to see the add operation.

The last 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

- 3

- 5678

- ABCD

 

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-09 @ 8am

 

HOME