Is learing assembly worth the effort?
Yes, z80 is a far better language than TI-BASIC
 60%  [ 3 ]
No, z80 is an evil language!
 40%  [ 2 ]
Total Votes : 5

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 Smile (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.
http://nwps.ws/~dragonfire/Asmin28/lesson/day07.html Very Happy
Hehe...yay for mirrors!
KermMartian wrote:
Hehe...yay for mirrors!


Confused
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.
Ya, for me too. I have a four-day weekend though Very Happy Smile Very Happy Cool Good Idea Good Idea
I had one last week, then only three days of school this week. Very Happy Very Happy
What was the occasion last weekend?
State fair day, then teacher inservice. Too bad these things don't happen more often. Sad
Chipmaster wrote:
SBC will only work for subtracting from hl

That is incorrect.

Code:
sbc d
will subtract d with carry from a and
Code:
sbc hl,de
will subtract de with carry from hl. Sub is the one that only works for only a and not hl.
calc84maniac wrote:
Chipmaster wrote:
SBC will only work for subtracting from hl

That is incorrect.

Code:
sbc d
will subtract d with carry from a and
Code:
sbc hl,de
will subtract de with carry from hl. Sub is the one that only works for only a and not hl.


*cough* post times *cough*
Holy crap.... Do you realize that you just necroposted a thread that is going on 1 year old? Laughing
It is his first time (I think), so lets just let him know and move on (hey, I did this a few times).
Whoops... Neutral
calc84maniac wrote:
Chipmaster wrote:
SBC will only work for subtracting from hl

That is incorrect.

Code:
sbc d
will subtract d with carry from a and
Code:
sbc hl,de
will subtract de with carry from hl. Sub is the one that only works for only a and not hl.


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.
And I'll have you know that even a year after the fact, I still don't know much about assembly.
Holy necroposting! Remember that if you need to subtract hl from de without the carry, the proper method is:

Code:
or a
sbc hl,de
  
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
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

 

Advertisement