User:TinySmall
Participation[edit | edit source]
DRAFTS[edit | edit source]
Comparing CIA 6526 and CIA 8520[edit | edit source]
i | This is not meant to explain the overall function of these components, you may go to appropriate pages to find out about it. |
Introduction[edit | edit source]
The CIA 6526 is a well known part in the 8-Bit retro computer world, that's why this page only want to show the differences.
The main difference in the naming of both of these CIAs is if it has the "A" after the name, the "A" is gives it away that it is capable of running at 2MHz what is needed in a C128 and C1581.
These components can be found in several Commodore 8- and 16 Bit Computers, some are in the following list
- CIA 6526(A)
- C64
- C128
- C1570/71 Floppy Drive
- CIA 8520(A) (other endings possible)
- Amiga Mainboards, used for serial, parallel and keyboard
- 1581 Floppy Drive
The 8520 is available in at least two different packages, the DIL40 what is used in a 1581 drive and some Amigas, or a PLCC44 what is used in some Amigas, the PLCC44 has 4 NC pins because it does have the same features as the DIL40.
In a 1581 the 8520 is connected to 2 MHz on the Amigas to 1 MHz.
Table with the registers of CIA 6526 and CIA 8520[edit | edit source]
More explanation afterwards
CIA 6526 | CIA 8520 | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bit7 | Bit6 | Bit5 | Bit4 | Bit3 | Bit2 | Bit1 | Bit0 | Function | Register | Function | Bit7 | Bit6 | Bit5 | Bit4 | Bit3 | Bit2 | Bit1 | Bit0 |
PRA | Data port A | $00 | Data port A | PRA | ||||||||||||||
PRB | Data port B | $01 | Data port B | PRB | ||||||||||||||
DDRA | Data direction A | $02 | Data direction A | DDRA | ||||||||||||||
DDRB | Data direction B | $03 | Data direction B | DDRB | ||||||||||||||
TALO | Timer A low | $04 | Timer A low | TALO | ||||||||||||||
TAHI | Timer A high | $05 | Timer A high | TAHI | ||||||||||||||
TBLO | Timer B low | $06 | Timer B low | TBLO | ||||||||||||||
TBHI | Timer B high | $07 | Timer B high | TBHI | ||||||||||||||
0 | 0 | 0 | 0 | TODS | Time Of Day [1/10 sec] | $08 | Event LSB | |||||||||||
0 | SECONDS_HIGH | SECONDS_LOW | Time Of Day [sec] | $09 | Event 8-15 | |||||||||||||
0 | MINUTES_HIGH | MINUTES_LOW | Time Of Day [min] | $0a | Event MSB | |||||||||||||
PM | 0 | 0 | HOURS_HIGH | HOURS_LOW | Time Of Day [hour] | $0b | unused | |||||||||||
SDR | Serial Data Register | $0c | Serial Data Register | SDR | ||||||||||||||
IR | 0 | 0 | FLAG | SP | ALARM | TB | TA | Interrupt Control Reg. | $0d | Interrupt Control Reg. | IR | 0 | 0 | FLAG | SP | ALARM | TB | TA |
TODIN | SPMODE | INMODE | LOAD | RUNMODE | OUTMODE | PBON | START | Control Register A | $0e | Control Register A | TODIN unused! |
SPMODE | INMODE | LOAD | RUNMODE | OUTMODE | PBON | START |
ALARM | INMODE | LOAD | RUNMODE | OUTMODE | PBON | START | Control Register B | $0f | Control Register B | ALARM | INMODE | LOAD | RUNMODE | OUTMODE | PBON | START |
Difference[edit | edit source]
The main difference of both CIAs are the registers 8 to 11 ($b).
They are used as Time Of Day (TOD) in the 6526
and as a 3-byte counter in the 8520 even it's still called TOD.
Both chips do their TOD-counting through the pin TODIN where the 6526 needs 50/60Hz from a powersource to accurately count the time,
whereas the 8520 just counts events, its description says "Positive edge transitions on this pin cause the binary counter to increment".
The 8520 still has the feature of an ALARM where an Interrupt (IRQ) can be generated when the value in the counter matches the ALARM.
The event counter needs to be accessed at a certain sequence, on both reading and writing start at register $a (MSB) then 9 then 8 (LSB).
The counter stops when one if its registers is accessed for writing and only starts again after a value is written to register 8.
While reading, the values of those 3 registers get latched to keep the counter constant during reading until after a read of register 8 (LSB).
For writing values for the ALARM, on both CIAs bit 7 in Control Register B (CRB) has to be set.
The only uncertainty (so far) on 8520 side is bit 7 in Control Register A (CRA), where the input frequency of the power supply can be set to either 50Hz or 60Hz on a 6526,
as the 8520 only counts events this setting does not really matter.
In the Link below you'll find a more in depth investigation about the hardware difference of the CIAs, mainly its about having a pullup resistor on not, and if it has a open collector output, also CRA7 is unused in the 8520.
1581 and CIA 8520[edit | edit source]
In the 1581 the CIA 8520 is interfacing the serial connection to the computer.
For the regular(slow) serial connection it uses the bit-banging method like in every other C= computer, and in addition the fast serial mode is used, what is only possible in connection with a C128.
The reason for this comparison-page is that there is a Jumper (J1) on 1581 motherboards, what is meant to select if there is a WD1770 or WD1772 floppy controller used.
This jumper is either open(default) or closed in case of a WD1772 is used.
If the jumper is shorted then it connects ø2 to pin TODIN of the CIA8520.
Now we want to know what does this actually do ?
The 8520 does not have an actual Time of Day like the 6526 has, also for being able to it would have needed a 50/60Hz source, what is not available on a 1581 board.
A first look into the source code does not reveal anything special about the TOD being used, in the Reset-routine only the Registers for the slow serial connection and the timer for fast serial mode are set.
But hiding in the "Controller Test" routine indeed there is an additional register of the 8520 used:
source code of a 1581:
C36A: A9 00 LDA #$00 C36C: 8D 08 40 STA $4008 ??? C36F: 20 2F AD JSR $AD2F wait 35 us C372: AD 08 40 LDA $4008 C375: D0 0F BNE $C386 C377: EE DA 01 INC $01DA Head speed C37A: EE DB 01 INC $01DB 12 ms per step C37D: EE DC 01 INC $01DC C380: EE DD 01 INC $01DD C383: EE DE 01 INC $01DE # skip from C375 C386: ...
But what does this do, the comment does not know either ?
more source code:
Controller commands C30C: A9 08 LDA #$08 Restore C30E: 8D DA 01 STA $01DA Head speed 6 ms per step C311: A9 18 LDA #$18 Seek: track search C313: 8D DB 01 STA $01DB C316: A9 28 LDA #$28 Step C318: 8D DC 01 STA $01DC C31B: A9 48 LDA #$48 Step-in C31D: 8D DD 01 STA $01DD C320: A9 68 LDA #$68 Step-out C322: 8D DE 01 STA $01DE C325: ... # same as above with other comments C36A: A9 00 LDA #$00 value $00 C36C: 8D 08 40 STA $4008 set event counter to $00 C36F: 20 2F AD JSR $AD2F wait 35 us C372: AD 08 40 LDA $4008 read event counter C375: D0 0F BNE $C386 is it still $00 ? C377: EE DA 01 INC $01DA Head speed 12 ms per step C37A: EE DB 01 INC $01DB C37D: EE DC 01 INC $01DC C380: EE DD 01 INC $01DD C383: EE DE 01 INC $01DE # skip from C375 value was $00 C386: ...
Here we can see that line C375 skips over the following commands in case the result is 0,
the initial set values for $01DA (and following) are probably for a WD1772
and in case the TOD did not count any events the Jumper (J1) is open and the code increases the values of $01DA to make the head speed slower for a WD1770.
Links[edit | edit source]
http://forum.6502.org/viewtopic.php?f=4&t=7418
Conclusion[edit | edit source]
The developers of the 1581 did some "sorcery" and abused the event counter of the 8520 to find out if a jumper is set or not. :)
The other point is that it should be able to use a 6526A the same way, although the 6526 counts different events, after resetting the TOD it should not be 0 after waiting 35us with the 2MHz input.
As mentioned in the link above a 8520 should not be replaces by a 6526 or 8521 due to the differences in the hardware interfaces, but I've seen people doing it and it seems to be working fine.
Power supply comparison[edit | edit source]
Pretty much every Commodore (Home-)Computer has a different Power supply.
All of them have some kind of 9V and these are needed to drive the Cassette Motor, either directly (C16) or generated using the 9VAC.
An exception is the C64/128 where the mains frequency (50/60Hz) gets filtered and lead to the CIA to drive its RTC, that's also the reason a CIA has the option to configure it for 50Hz or 60Hz.
On C64/128 the 9VAC are used to generate 12VDC what is used by the SID.
Also on C64/128 the internal generated 5VDC are used by the VIC-II and related ICs, as far as the schematics reveal. The external 5VDC are used by all the other ICs.
This is all depending what board is actually used, e.g. newer SIDs are using 9V instead of 12V.
Computer | external input | Port | 9VAC usage | ||||
---|---|---|---|---|---|---|---|
Tape | Userport | RTC | SID | ||||
VIC20 | 9V AC | 2-pin | ❎️ | ❎️ | ➖️ | ➖️ | |
5V DC, 9V AC | 7-pin DIN | ❎️ | ❎️ | ➖️ | ➖️ | ||
C64 | 5V DC, 9V AC | 7-pin DIN | ❎️ | ❎️ | ❎️ | ❎️ | |
SX64 | mains | IEC_60320 C14 | internal PSU providing 5VDC and 12VDC and 9VAC | ||||
C128 | 5V DC, 9V AC | 5-pin square | ❎️ | ❎️ | ❎️ | ❎️ | |
C128D | mains, 115/230V | IEC_60320 C14 | internal PSU providing 5VDC and 12VDC and 9VAC | ||||
C16/116 | 9V DC | coax | ❎️ | ➖️ | ➖️ | ➖️ | |
Plus4 | 5V DC, 9V AC | 4-pin square | ❎️ | ❎️ | ➖️ | ➖️ | |
Drives | |||||||
1540/41/70/71 | mains, 115/230V | IEC_60320 C14 | internal PSU providing 5VDC and 12VDC | ||||
1541-II / 1581 | 5V DC, 12V DC | 4-pin DIN | |||||
If a Computer has 9VAC it is only crucial for the C64/128 to have it at exact 50 or 60Hz as it is used for driving the clock in the CIA6526.
A VIC20 and Plus4 are not relying on that and only transferring the AC into 12VDC or 9VDC used for the tape motor (unregulated).
A Plus4 runs fine with just +5VDC, only the tape does not work.
If a Computer does not have an RTC or you don't need/want to have it working precisely on a C64/128 then it is probably possible to use 10 to 12VDC instead of 9VAC.
CPUs[edit | edit source]
MOS 6510/8500 used in C64 |
MOS 8502 used in C128 |
MOS 6510T used in C1551 drives |
MOS 8501/7501 used in C16 / Plus4 |
End of file