Sorry if this might be a duplicate, but I'm not sure how to google this.

I know that from computer science that the registers are for high-speed variables so I've been trying to minimize my use of ram. How much of a difference can this actually make? What is the speed differences of something like this:

Code:

ld a, b
; and
pop af
; or even
ld a, (0x1234)


I have seen references to people talking about counting T-states of their programs but how do I know how long each line takes?

Again sorry if this has been asked a million times before.
Yes, in general using registers will be faster than using memory. However, memory does include the bytes of the instructions themselves. So for example, loading a constant into a register will be slower than loading a register into it. This is what leads to optimizations like XOR A instead of LD A,0.

In any case, you can use helpful references like this to see the technical information for every instruction: https://clrhome.org/table/
  
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 1 of 1
» 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