Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: Hot_Dog on September 29, 2011, 03:05:54 pm

Title: A Couple of Technical Questions
Post 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?
Title: Re: A Couple of Technical Questions
Post by: calcdude84se 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.
Title: Re: A Couple of Technical Questions
Post by: calc84maniac 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).
Title: Re: A Couple of Technical Questions
Post by: calcdude84se on September 29, 2011, 04:56:28 pm
I meant relative to the whole instruction. :P Does doing that make the hardware implementation simpler?
Title: Re: A Couple of Technical Questions
Post by: Hot_Dog 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?
Title: Re: A Couple of Technical Questions
Post by: calcdude84se on September 29, 2011, 10:03:00 pm
As far as I am aware, yes. (Until an interrupt is triggered, of course.)
Title: Re: A Couple of Technical Questions
Post by: calc84maniac 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".