11) MMU control logic.
It's located on different places on the chip, so I decided to copy the different areas from the chip pictures,
to put them into a single picture, and to connect them with white lines.
Detection of 'LDA (ind),y' and 'STA (ind),y' plus the three Bit shift registers is located Nort of the P0 IO logic block.
The rest of the circuitry is crammed between the IO logic blocks, and a logic gate plus an inverter is West of the CPS pad.
;---
When the CPU responds to an interrupt, it does by forcing the instruction register to $00 forging a BRK instruction,
what discards the fetched instruction and initiates a BRK sequence.
For instruction fetches without a forged BRK, signal IBE# (Visual6502 Node 1077) is low.
We have two 9 input NOR gates (plus some inverters), which check the low_active D0_data_in#..D7_data_in# from the D0..D7 pads for:
$B1 (binary 10110001) at the D0..D7 pads = LDA (ind),y
$91 (binary 10010001) at the D0..D7 pads = STA (ind),y
when IBE# is low.
Point is, that if the CPU would be responding to an interrupt with a $91 or $B1 OpCode fetched,
we need to make sure that the MMU logic doesn't accidentally do bank switching during an interrupt sequence,
and that's why these two NOR gates also check if IBE# is low.
Hmm... for the average logic designer, it should be obvious that one NOR gate checks if D5 is 0, the other NOR checks if D5 is 1,
while all of the other inputs of both NOR gates are identical.
Means one could replace two 9 input NOR gates plus 5 inverters by one 8 input NOR gate plus 4 inverters, but I'm getting off topic.
;---
The outputs of the two 9 input NOR gates enter a two INPUT NOR, which feeds a 3 Bit shift register
(which, in the chip layout, doesn't instantly stick out as a shift register).
It's a 3 Bit shift register because the bank switching needs to be done in cycle T4,T5 during a LDA\STA (ind),y instruction:
T0: fetch OpCode
T1: fetch zero page indirect address
T2: fetch low order Byte of base address
T3: fetch high order Byte of base address
T4: fetch data from the same page
(T5: fetch data from the next page if there was a page crossing)
The output of the shift register sets a RS flipflop.
The RS flipflop tells the 2:1 multiplexers in the P0..P3 IO logic wheter to send register 0 or register 1 on the P0..P3 pads.
The RS flipflop is cleared either by a CPU RESET, or by the SYNC_early signal (indicating the next instruction fetch).
SYNC_early changes with PHI2, and goes through a latch controlled by PHI1 before it goes to the SYNC pin.
;---
Now for the circuitry generating the clock signals for the shift register.
The CPU does wait cycles when RDY=0 during reads,
so we have a NOR gate plus an inverter (West of the CPS pad) checking RDYP and WRITE1 to see if the CPU is out to do a wait cycle.
If there is a wait cycle, clock signal PHI1_MMU_hold goes active during PHI1.
If there is no wait cycle, clock signal PHI1_MMU_shift goes active during PHI1.
The pulse shaper generating these two clock signals looks pretty similar to the pulse shaper we already had in 5a) data read/write control.
Except that the capacitors are a bit smaller, and that it generates pulses during PHI1 instead of PHI2.
Attachment:
si6509_11_mmu_control.png [ 144.79 KiB | Viewed 1183 times ]
Attachment:
6509_11_mmu_control.png [ 175.7 KiB | Viewed 1183 times ]