HOME

OS Apps:

Multiply a 16-bit Hex Number by 3

Overview:

A portion of the SBC30 code has been sliced and edited as  SBC30_TEST_OS_03a.asm for the Multiply 16-bit Number by 3 function. The SIM will provide an input of "3" to select the menu item and then "8988" as the 4-digit number to be multiplied.

 

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 38,39,38,38

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

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

- AddrLoHi at $0006

- Cnv4LoHi at $0208

- NumLoHi at $0040

- Carry2NSB at $0070

 

SIM Breakpoints:

The only BPs needed are at 2725 and 2788. The first one will allow you to see the doubling and adding operation: 3x = 2x + x. 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:

- Press Reset button

- O

- 3

- 8988

 

To see the Carry bit in use:

- No Carry: $5555

- 1 Carry:    $5556 or $AAAA

- 2 Carrys: $AAAB or $FFFF

 

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