Author Topic: A Couple of Technical Questions  (Read 3473 times)

0 Members and 3 Guests are viewing this topic.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
A Couple of Technical Questions
« on: September 29, 2011, 03:05:54 pm »
What can I say?  I'm a curious guy :D

1. Do auto-repeat instructions on the Z80, such as LDIR and CPDR, alter PC?  I'm wondering how the calculator knows to repeat whilst allowing interrupts.
2. Since the calculator isn't really "turned off" until all batteries are removed, does the calculator do a constant "halt" until the ON button is pressed?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: A Couple of Technical Questions
« Reply #1 on: September 29, 2011, 04:47:13 pm »
1. LDIR does not change PC until BC=0. So, if the processor is interrupted while LDIR'ing, it just returns to performing LDIR.
2. More or less, yes, though in a low-power mode.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

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 Technical Questions
« Reply #2 on: September 29, 2011, 04:51:49 pm »
1. Technically, PC is increased by 2 when fetching the instruction, then it is decreased by 2 if BC is not 0 (causing an extra 5 cycles and the instruction to be fetched again).
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: A Couple of Technical Questions
« Reply #3 on: September 29, 2011, 04:56:28 pm »
I meant relative to the whole instruction. :P Does doing that make the hardware implementation simpler?
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: A Couple of Technical Questions
« Reply #4 on: September 29, 2011, 10:01:26 pm »
2. More or less, yes, though in a low-power mode.

According to the z80 documentation, the halt instruction enters low power mode anyways, so I guess my question was when the calculator is off, halt is executed over and over, right?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: A Couple of Technical Questions
« Reply #5 on: September 29, 2011, 10:03:00 pm »
As far as I am aware, yes. (Until an interrupt is triggered, of course.)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

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 Technical Questions
« Reply #6 on: September 29, 2011, 10:24:26 pm »
2. More or less, yes, though in a low-power mode.

According to the z80 documentation, the halt instruction enters low power mode anyways, so I guess my question was when the calculator is off, halt is executed over and over, right?

Well, the CPU is in low power mode any time you halt, but other parts of the calculator only enter low-power mode if you halt when bit 3 of port 3 is reset. That's the difference when the calculator is "off" rather than "idle".
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman