Contention pattern for HALT

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Patrik Rak
Microbot
Posts: 117
Joined: Mon Apr 13, 2020 3:07 pm

Re: Contention pattern for HALT

Post by Patrik Rak »

Fair enough.
User avatar
ketmar
Manic Miner
Posts: 744
Joined: Tue Jun 16, 2020 5:25 pm
Location: Ukraine

Re: Contention pattern for HALT

Post by ketmar »

by the way, i am Teh Official Idiot. what Patrik says in the following quote is not only right, but the official Zilog manual explicitly says exactly that — and i should have read the manual before trying to reply anything.
Patrik Rak wrote: Fri Jan 19, 2024 5:50 pm Only the first fetch of the HALT itself. Then it executes NOPs internally, with PC already being PC+1.

(So it's not like it keeps executing itself similar to LDIR, which is what people originally believed.)
Zilog manual:
The purpose of executing NOP instructions while in the HALT state is to keep the memory refresh signals active. Each cycle in the HALT state is a normal M1 (fetch) cycle except that the data received from the memory is ignored and an NOP instruction is forced internally to the CPU.
that is, Z80 sets all the signals as usual ("normal M1 (fetch) cycle"), but it skips sampling the data bus (which still contains the read opcode), and the whole instruction decoding. this is also why PC is not advanced further (no decode). it still puts refresh address on A0-A6 and increments R, though.
Post Reply