Author |
Topic: How to divide with SIC sbn instruction (Read 7051 times) |
|
MOR
Newbie
Posts: 2
|
|
How to divide with SIC sbn instruction
« on: Mar 25th, 2013, 2:26am » |
Quote Modify
|
Hello there, I want to implement the C code Code: on SIC with sbn instruction. Any help with this? The command does the following: sbn a,b,c # Mem[a] = Mem[a] – Mem[b];if (Mem[a]<0) go to c I am looking forward to hearing from you and i would appreciate any kind of help. thank you.
|
|
IP Logged |
|
|
|
akasina9
Newbie
x = 0x2B | ~ 0x2B. x is the question
Gender:
Posts: 9
|
|
Re: How to divide with SIC sbn instruction
« Reply #1 on: Apr 2nd, 2013, 9:29pm » |
Quote Modify
|
You can look at division as a subtraction loop. The following code block assumes that the initial instruction starts at address n: Code:sbn u, u # Initialize u to 0 sbn c, c # Initialize c to 0 sbn u, ONE # Initialize u to -1 sbn a, b, n+6 # Subtract b from a until it is less than zero sbn c, u # increment c by one each time a is positive sbn ZERO, ONE, n+3 # Unconditional jump to the subtraction step exit |
|
|
|
IP Logged |
|
|
|
|