Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
One-instruction set computer
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Reverse subtract and skip if borrow === In a ''reverse subtract and skip if borrow'' (RSSB) instruction, the [[Accumulator (computing)|accumulator]] is subtracted from the memory location and the next instruction is skipped if there was a borrow (memory location was smaller than the accumulator). The result is stored in both the accumulator and the memory location. The [[program counter]] is mapped to memory location 0. The accumulator is mapped to memory location 1.<ref name=caamp /> '''Instruction''' <syntaxhighlight lang="nasm" inline>rssb x</syntaxhighlight> ACCUM = Mem[x] - ACCUM Mem[x] = ACCUM '''if''' (ACCUM < 0) '''goto''' PC + 2 ==== Example ==== To set x to the value of y minus z: <syntaxhighlight lang="asm"> # First, move z to the destination location x. RSSB temp # Three instructions required to clear acc, temp [See Note 1] RSSB temp RSSB temp RSSB x # Two instructions clear acc, x, since acc is already clear RSSB x RSSB y # Load y into acc: no borrow RSSB temp # Store -y into acc, temp: always borrow and skip RSSB temp # Skipped RSSB x # Store y into x, acc # Second, perform the operation. RSSB temp # Three instructions required to clear acc, temp RSSB temp RSSB temp RSSB z # Load z RSSB x # x = y - z [See Note 2] </syntaxhighlight> * [Note 1] If the value stored at "temp" is initially a negative value and the instruction that executed right before the first "RSSB temp" in this routine borrowed, then four "RSSB temp" instructions will be required for the routine to work. * [Note 2] If the value stored at "z" is initially a negative value then the final "RSSB x" will be skipped and thus the routine will not work.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)