Omnimaga
Calculator Community => TI Calculators => ASM => Topic started by: Hot_Dog 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?
-
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.
-
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).
-
I meant relative to the whole instruction. :P Does doing that make the hardware implementation simpler?
-
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?
-
As far as I am aware, yes. (Until an interrupt is triggered, of course.)
-
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".