Ah ok, thanks for clearing things up. Is there any way to subtract from another variable other than A?
|
The registers aren't like BASIC variables, they are constantly changing and will practically never hold long-term values (with the possible exception of the index registers), so generally if you want to subtract two 8-bit numbers you will put the number you want to subtract from into a first. You can also add negative numbers to simulate subtraction, for example if you want to do "e-a", you can do:
Code:
...essentially, you are doing "-a + e".
If you want to do something like e-d, that's more straightforward:
Code:
...essentially loading e into a and then doing a-d.
You can also use SBC (subtract with carry) to subtract a 16-bit register from hl, just watch out for the carry. If the carry is set it will subtract an extra 1.
Code:
neg ; (this is basically "a * -1 -> a")
add a,e
If you want to do something like e-d, that's more straightforward:
Code:
ld e,a
sub d
You can also use SBC (subtract with carry) to subtract a 16-bit register from hl, just watch out for the carry. If the carry is set it will subtract an extra 1.
Sorry with the broken link. There was a problem with the OneDrive Sync on Windows 10 TP build 9879, so I downloaded the table document, deleted the table document from OneDrive, and re-uploaded the table document.
Here's the new link:
http://1drv.ms/1v7UJIr
Here's the new link:
http://1drv.ms/1v7UJIr
I like this idea, and I added a couple more. At one point I was working on a list like this as well as a tutorial. I have no clue where it went GOod luck!
I think the last two are backwards, you've got the assembly in the BASIC section and the BASIC in the asm side.
chickendude wrote:
I think the last two are backwards, you've got the assembly in the BASIC section and the BASIC in the asm side.
Oops! Thanks
Updated Table:
Updated table:
I have Asperger's Syndrome
WizardC 7.3: http://www.cemetech.net/programs/index.php?mode=file&id=1150
WizardC 7.3: http://www.cemetech.net/programs/index.php?mode=file&id=1150
Updated table:
I have Asperger's Syndrome
WizardC 7.3: http://www.cemetech.net/programs/index.php?mode=file&id=1150
WizardC 7.3: http://www.cemetech.net/programs/index.php?mode=file&id=1150
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
» Go to Registration page
» Goto page Previous 1, 2
» View previous topic :: View next topic
» View previous topic :: View next topic
Page 2 of 2
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Advertisement