And here's the polite non-confrontational discussion-type reply to this message.
On Thu, 18 May 95 00:23:50 -0600, [EMAIL PROTECTED] said: > Therefore a LD HL,nn takes 12 t-states, 10 in theory > plus 2 for the 2 N's. I still haven't worked this out for all commands and > even for the ones I thought I had figured out when I wanted to calculate how > many instructions I could use before dumping out the next sample byte > I would be so happy if someone could > come up with a SAM emulator type of thing defining exactly how and WHEN the > instructions are executed etc. Most of the instructions are predictable. In fact there are only one or two that disobey the rule of "round up to the next multiple of 4". Of course we are talking about when the border is being drawn or when the screen is turned off, because the instructions go even slower at other times. The differences I've found so far are the block instructions and DJNZ and PUSH. The block instructions are a bit unpredictable, because for example a normal LDIR takes 4 T-states per byte longer than it does if you place the destination in ROM. In general though LDI takes 20 and LDIR takes 24 if I remember correctly, and the same for OUTI and OTIR. If you think that the main job of LD HL,nn is a fetch+decode cycle and two more fetches then it is obvious that it should take 10 cycles and actually takes 12, because the fetch+decode cycle always takes 4, and subsequent fetches and stores usually take 3. On the Sam it still takes 3, but you have to wait until the next multiple of 4 before you do it. So that's 4, then 3, then wait 1, then 3, then wait 1 before the next instruction - 12 in total. In the case of DJNZ I assume we usually have the fetch+decode (4) then the decrement (1) then another fetch (3) then if B>0 a jump (5). On the Sam this translates to 4+1+wait3+3+wait1 which is 12, if B=0, or 4+1+wait3+3+5 which is 16, otherwise. However it is unclear to me why PUSH should take 11 normally or 16 on the Sam. > As to the slowest instruction, how about the following combination: With respect sir we were talking about instructions, not combinations. The HALT instruction does not count, because it might only take 4 cycles if you execute it at the right time. > JR $ > JP $ > DJNZ $ These only take 12 each, or 16 in the case of DJNZ. The fact that they then repeat themselves is immaterial. > or for the grand finale, the one that does it every time: > LDIR This only takes 21, and the fact that it then repeats itself and crashes the machine is immaterial. > SAM C might have been written like this. Which brings me onto SAM C. Funny > that everyone is blowing it out of the water and coming up with all these > improvements AFTER it was released. Uptil it being announced I have never > heard a soul whisper about C on the SAM... Then you weren't listening, because someone claimed to have a C compiler on the Sam many months ago. And the point about improvements AFTER it is released is that we couldn't possibly point out improvements before it had been released because we didn't know what it was like! imc

