Author Topic: A couple of quick questions regarding the flags register  (Read 14152 times)

0 Members and 1 Guest are viewing this topic.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: A couple of quick questions regarding the flags register
« Reply #16 on: September 23, 2010, 06:17:27 pm »
Here's another reference I use all the time.  Just go to Appendices->Technical References and Datasheets ->Z80 Instruction Set.

Yup, that's what I use, but online: http://future_history.freehostia.com/Files/Resources/ASM/ASMin28Days/ref/z80is.html

Oh. Those are machine cycles. Since the shortest instruction is 4 T-cycles (I like to use the term "clock cycle" or CC for this), it might be easier to represent some instructions in terms of machine cycles. The only real benefit is dealing with smaller numbers, though I don't really like using them because of all those odd instructions that will not divide evenly with 4. Like your 2 byte ADD instructions (11CCs) and your two byte inc/dec instructions (6CCs).

Okay, so they don't really exist and are just T/4, is that it?
« Last Edit: September 23, 2010, 06:29:36 pm by Deep Thought »




Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: A couple of quick questions regarding the flags register
« Reply #17 on: September 23, 2010, 06:55:32 pm »
Oh. Those are machine cycles. Since the shortest instruction is 4 T-cycles (I like to use the term "clock cycle" or CC for this), it might be easier to represent some instructions in terms of machine cycles. The only real benefit is dealing with smaller numbers, though I don't really like using them because of all those odd instructions that will not divide evenly with 4. Like your 2 byte ADD instructions (11CCs) and your two byte inc/dec instructions (6CCs).

Okay, so they don't really exist and are just T/4, is that it?
I think they do exist, but they aren't very important to know about from a software-development standpoint. For example, the LD A,(HL) instruction takes 7 clock cycles and 2 machine cycles (4 cycles for the opcode execution and 3 cycles for the memory read).

On the Gameboy's GBZ80, though, machine cycles are always 4 cycles.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: A couple of quick questions regarding the flags register
« Reply #19 on: September 24, 2010, 10:25:35 pm »
I know this is off-topic, but Since when ticalc.org accepts anything else than zip files in the non-Windows/Mac/anything other than TI-81 directories? O.o

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: A couple of quick questions regarding the flags register
« Reply #20 on: September 25, 2010, 10:02:17 pm »
Hmm, does anyone have an info file that includes both the M and T cycles?

I know this is off-topic, but Since when ticalc.org accepts anything else than zip files in the non-Windows/Mac/anything other than TI-81 directories? O.o

It's an informational file, though...
« Last Edit: September 25, 2010, 10:02:59 pm by Deep Thought »




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: A couple of quick questions regarding the flags register
« Reply #21 on: September 25, 2010, 10:28:09 pm »
Weird, I always thought they were uploaded in zip files, though x.x, for the purpose of having the zip viewer thing at the bottom of the page

Offline AssemblyBandit

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 374
  • Rating: +60/-1
  • ~AssemblyBandit~
    • View Profile
    • briandm82.com
Re: A couple of quick questions regarding the flags register
« Reply #22 on: September 25, 2010, 11:31:51 pm »
The clock cycle information you guys are viewing isnt completely accurate. Depending on wether the register value has to be prefetched or not will actually increase the number of clocks. The links Ive looked over on this post dont mention this, but the values that they give are actually based off of the best possible scenario. Its been a while, and I could be wrong though. But if you really need to know the exact times of the instructions I would do some research on the prefetch. You probably dont need to get it that exact though  ;)
« Last Edit: September 25, 2010, 11:33:59 pm by AssemblyBandit »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: A couple of quick questions regarding the flags register
« Reply #23 on: September 25, 2010, 11:42:16 pm »
You probably dont need to get it that exact though  ;)

Working on a JS emu :P
« Last Edit: September 25, 2010, 11:42:27 pm by Deep Thought »




Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: A couple of quick questions regarding the flags register
« Reply #24 on: September 25, 2010, 11:44:22 pm »
The clock cycle information you guys are viewing isnt completely accurate. Depending on wether the register value has to be prefetched or not will actually increase the number of clocks. The links Ive looked over on this post dont mention this, but the values that they give are actually based off of the best possible scenario. Its been a while, and I could be wrong though. But if you really need to know the exact times of the instructions I would do some research on the prefetch. You probably dont need to get it that exact though  ;)
I don't think the Z80 is modern enough to have all that prefetching and junk messing with timing. Things were a lot simpler in the 80's :P
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

_player1537

  • Guest
Re: A couple of quick questions regarding the flags register
« Reply #25 on: September 26, 2010, 02:03:47 am »
You probably dont need to get it that exact though  ;)

Working on a JS emu :P

JS?  JavaScript?
* _player1537 is confused

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: A couple of quick questions regarding the flags register
« Reply #26 on: September 26, 2010, 02:04:34 am »
I am confused as well o.o

I know Netham45 wants to work on a JS emu, though (online calc emu)

Offline AssemblyBandit

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 374
  • Rating: +60/-1
  • ~AssemblyBandit~
    • View Profile
    • briandm82.com
Re: A couple of quick questions regarding the flags register
« Reply #27 on: September 26, 2010, 02:30:04 am »
Quote
I don't think the Z80 is modern enough to have all that prefetching and junk messing with timing. Things were a lot simpler in the 80's Tongue

Heres something to look at: http://www.ftp83plus.net/Tutorials/z80optiA.htm . You are correct, there is no prefetch on the z80. In the document he mentions the intel 8088 and I think that maybe he got confused. My information did not come from that file though, I had read it in an assembly programming book years ago. For the past hour I have been trying to find out exactly what the chip is doing. Ive read that Zilog has never released the internal sequencing to the z80 so I dont think that I can verify anything on paper. I remember reading about how if the same registers or instructions have already been fetched, the z80 will not have to fetch them for the next instruction, thus saving at least one clock cycle. Unfortunately, I dont have the book anymore.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: A couple of quick questions regarding the flags register
« Reply #28 on: September 26, 2010, 03:58:08 am »
Don't we have to take the rest of the hardware into account too, though?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: A couple of quick questions regarding the flags register
« Reply #29 on: September 26, 2010, 10:52:01 am »
I am confused as well o.o

I know Netham45 wants to work on a JS emu, though (online calc emu)

Yeah, I just started working on a Javascript emu. Messing with half-carry if fuuun... :P