Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
How would you go about comparing a single value to see if it is logic true or false and then acting upon it depending on the result?

Also how would you get the z80 CPU to lets say wait 5 seconds before restarting a program? Like halt for 5 seconds and then reset the program counter to memory location 0?
Hello embers, and welcome to Cemetech! If you want to compare values, I would take a look at the flags outputted by different processor instructions, such as the zero and carry flags, which are used the most. For checking the time, you can either use the specified timer ports, or you can use the bcall _GetTime. Actually, are you looking for more specific info, such the opcodes for this? If so, could you please elaborate a little more on specifically what you would like to logically compare? Thanks in advance! Smile
I would just like to know how to make the Z80 cpu wait for 5 seconds with using the op codes. I figured out the comparing thing I was going on about.
embers wrote:
I would just like to know how to make the Z80 cpu wait for 5 seconds with using the op codes. I figured out the comparing thing I was going on about.
You said you have a 1MHz z80. You want to waste 5 million cycles, then. Opcodes take 3 to 21 cycles to complete, so use a loop to repeat some operations (like push and pop or inc and dec) that cancel each other out until you've spent 5 million cycles.

http://www.ticalc.org/archives/files/fileinfo/1/110.html
I apologize, I wrongly assumed this was for the z80 line of calcs. But yes, if you want, you can waste 5 million cycles (Or do something useful Razz ).

This might be a good place to get an idea for a waste cycle loop:

Code:
ld bc,(Number of Times)
Loop:
 nop  ; Delay
 dec c
 jr nz,Loop
 djnz Loop

Of course, you still have to do timings and stuff to figure that out. Smile
Ok thank you for your input, it has really helped me!
  
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 GMT - 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