Page 1 of 1
Alucout signal and update of the C flag in the P register
Posted: Fri Feb 28, 2025 8:55 pm
by piorkov
Hey, I'm wondering how the alucout signal works - I understand that it is set when the result of the ALU operation does not fit into 8 bits in ALU - but do I understand correctly that this only happens in the second half of the cycle? How long is this signal active? IIs it deactivated if there is no carry in the ALU again in the second half of the next cycle?
How is flag C in register P updated? Does the alucout signal have to be active and does RCL have to set the ACR/C signal?
Re: Alucout signal and update of the C flag in the P registe
Posted: Sat Mar 01, 2025 1:59 pm
by BigEd
A belated welcome!
alucout is the raw carry out from the ALU - it's not always the result of a relevant computation, and it doesn't always affect the carry flag, because the update of the carry flag depends on which instruction is running.
I had a quick look around visual6502, and node 252 called #op-set-C (or ~op-set-C) seems to control whether C should be set:
http://visual6502.org/JSSim/expert.html ... =~op-set-C
It is derived from several outputs of the decode PLA.
It goes through a pipeline latch to the complex 8-input gate with output node 1082, which then goes through a latch to produce node 32, aka p0, aka C. Those 8 inputs will, I think, make up 4 "reasons" for the next value of C.
(That's if I haven't made a mistake!)