All things in ASM are faster than Basic, so why bother. Do I understna correctly that the code you listed 3 posts up basically just defines the element size, array base, and starting element, then decrements a until a=0, then stores the element position in hl?
|
#1: It takes up less space and it is always a good idea to be more efficient. Plus or a is just as easy to write as cp 0.
#2: everything is true except if you remember djnz decrements b not a. So the reason I have that loop is to multiply the element by the element size. For example if i had an element size of 3 and I wanted to access the 4 element in the list I would find the array base, and then multiply the element size (3) by the element I want to access (4). That would be 12 so then I would add 12 to the array base and that would be the data location I wish to access.
#3: I recommend you read the section on flags and jumps before attempting to do arrays (I thought you had before and that was why I used that code)
#2: everything is true except if you remember djnz decrements b not a. So the reason I have that loop is to multiply the element by the element size. For example if i had an element size of 3 and I wanted to access the 4 element in the list I would find the array base, and then multiply the element size (3) by the element I want to access (4). That would be 12 so then I would add 12 to the array base and that would be the data location I wish to access.
#3: I recommend you read the section on flags and jumps before attempting to do arrays (I thought you had before and that was why I used that code)
Ok, that makes sense. I will read that. I read the section on flags already, so I'll have to look for the jump section. Thanks.
Hmm... Just skimming over it it doesn't look to hard. I might not get to it for a while, school has been slightly problematic recently.
Chipmaster wrote:
SBC will only work for subtracting from hl
That is incorrect.
Code:
sbc d
Code:
sbc hl,de
calc84maniac wrote:
Chipmaster wrote:
SBC will only work for subtracting from hl
That is incorrect.
Code:
sbc d
Code:
sbc hl,de
*cough* post times *cough*
It is his first time (I think), so lets just let him know and move on (hey, I did this a few times).
calc84maniac wrote:
Chipmaster wrote:
SBC will only work for subtracting from hl
That is incorrect.
Code:
sbc d
Code:
sbc hl,de
True, but this topic is around a year old, and I was much more n00bish then. Plus I was going by ASMin28days which never mentions any other form of sbc other than sbc hl,reg16.
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, 3, 4, 5
» View previous topic :: View next topic
» View previous topic :: View next topic
Page 5 of 5
» 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