Editor Version ×
Standard

1.Easy to use and quick to get started

2.The process supports design scales of 300 devices or 1000 pads

3.Supports simple circuit simulation

4.For students, teachers, creators

Profession

1.Brand new interactions and interfaces

2.Smooth support for design sizes of over 30,000 devices or 100,000 pads

3.More rigorous design constraints, more standardized processes

4.For enterprises, more professional users

Ongoing

STD Ogryzek V4

License: Public Domain

Mode: Editors' pick

  • 3.6k
  • 0
  • 6
Update time: 2022-02-05 20:55:42
Creation time: 2018-03-31 11:22:01
Description
![ogrv4.jpeg](//image.easyeda.com/pullimage/MxIirMSuZQ8uTk1fsUOQFQlBhgQFuUylmiAk4KMB.jpeg) **How to build own cartridge for Commodore 64.** Short describe. Firstly we need know what C64 sharing on the expansion port: ![a](https://easyeda.com/attachments/2018/5/GglFgrfHugJQ7l1GGGtX26U4zkByEiRufpurKsOa.png) Now we need know what for above signals/lines they are and haw they works so - GND – simply ground 4 times lead out - +5V – stabilize power source 5V - RESET – reset CPU line active in LOW state. When the reset going UP (also after POWER ON) to high state (logic 1), VCC on the CPU is no less than 4.75V then CPU starting machine code, going to ROM memory, reading RESET VECTOR which is placed under $FFFC (LO/HI byte) and going into the address which the RESET VECTOR was included. Important information: 6510/8500 CPU have own internal port under $00 (direction) and $01 (port) where 3 lowest bits they are responsible for memory configuration: o Bit 0 – LORAM o Bit 1 – HIRAM o Bit 2 – CHAREN After RESET or POWER ON above 3 bits have logic 1 (HIGH STATE) value, so when have all high state in the C64 PLA working and can cooperated with cartridge and setting memory for CPU access like bellow: # $02 to $9fff is the C64 RAM # • If cartridge is enabled $8000 to $9FFF can be shadowed by ROM/RAM of cartridge (IF EXROM = 0) # $A000 to $BFFF – C64 BASIC ROM # • If cartridge is enabled BASIC ROM $A000 to $BFFF can be shadowed by ROM/RAM of cartridge (IF GAME = 0) # $C000 to $CFFF – C64 RAM # # $D000 to $d02E – VIC Video Interface Chip (graphics unit) # R/W registers. This area is not full address decode and is mirrored to $D3FF after every one 63 ($3F) bytes, so for example $D040 is this same like $D000. VIC can be IRQ interrupts source. # $D400 to $d418 SID Sound Interface Chip (8580, 6581..) # registers WRITE ONLY area except any register for paddles. Like before here is no full address decode and SID region is repeated to $D7FF # $D800 to $DBFF - COLOR RAM # 1000 bytes, where active are lowest 4 bits (16 colors possibility) in every one byte. # $DC00 to $DC0F CIA #1 – Complex Interface Adapter # can be invoke IRQ – interrupts. This 16 R/W registers are mirrored 15 times over the $DCFF # $DD00 to $DD0F CIA #2 – Complex Interface Adapter # can be invoke NMI – interrupts. This 16 R/W registers are mirrored 15 times over the $DCFF # $DE00 to $DEFF – I/O1 AREA # This area is for external hardware, here we can use this for cartridge control. This AREA IS CONNECTED with /IO1 line WHEN LORAM,HIRAM and CHAREN have high state, and when CPU addressing this area this line going to logical 0 (LOW state). Also this area can be shadowed by external cartridge RAM/ROM # $DF00 to $DFFF – I/O2 AREA # This area is for external hardware, here we can use this for cartridge control. This AREA IS CONNECTED with /IO1 line WHEN LORAM,HIRAM and CHAREN have high state, and when CPU addressing this area this line going to logical 0 (LOW state). Also this area can be shadowed by external cartridge RAM/ROM. # $E000 to $FFFF – C64 KERNAL ROM – IO SYSTEM # Some times this area can be shadowed by external ROM/RAM of cartridge, when will be choose ULTIMAX MODE (GAME = 0, EXROM = 1). So by this trick we can changed the RESET, IRQ and NMI VECTORS, where they are placed **RESET - $FFFC/$FFFD LO/HI byte.** **IRQ - $FFFE/$FFFF LO/HI byte.** **NMI - $FFFA/$FFFB LO/HI byte.** So when LORAM is enabled (1) C64 PLA can be sending information to cartridge via ROML line (setting logical 0) when CPU addressing area $8000 - $9FFF ONLY WHEN EXROM = 0 and cartridge in this place can set up own ROM/RAM . Read phase only access. WHEN HIRAM is enabled (1) PLA can be sending information to cartridge via ROMH line (setting logical 0) when CPU addressing area $A000 - $BFFF ONLY WHEN GAME = 0 and cartridge in this place can set up own ROM/RAM . Read phase only access. In SPECIAL CASE – ULTIMAX MODE - WHEN HIRAM is enabled (1) PLA can be sending information to cartridge via ROMH line (setting logical 0) when CPU addressing area $E000 - $FFFF ONLY WHEN GAME = 0 AND EXROM = 1 and cartridge in this place can set up own ROM/RAM – Is not so easy guys, ULTIMAX MODE is a bit complex, and I don’t describe all of this subject. Read phase only access. OK – now we know, what for they are LORAM, HIRAM, how they have state after RESET and when we can using them and where they are placed. Now we can considering, how we can using any other signals included in expansion port for our own purposes. So naturally and how I mentioned before we should knowing how working 4 signals connected functionally between self - GAME - EXROM - ROML - ROMH # GAME # – from C64 SIDE IT’S INPUT LINE and this is information from the C64 PLA for manipulating ROMH (set to 0) when CPU addressing $A000 - $BFFF area or $E000-$FFFF in ULTIMAX MODE. Definitely is the OUTPUT LINE from cartridge side and this line manipulating cartridge always. # ROMH # – OUTPUT LINE from C64 side, and for cartridge is a INPUT line – Is a lead out of address decoder signal and this line going to low state (logical 0) when CPU addressing $A000 - $BFFF area or $E000-$FFFF in ULTIMAX MODE. When CPU addressing any other area this line going up to HIGH (1) immediately. So cartridge can using information from this line and getting shadowing mentioned above areas by own ROM or RAM. BUT STOP STOP STOP - Be patient be cause is not all information for cartridge, when hi can do this !!! For read operations only. Now we can properly suspect this same function for EXROM and ROML for $8000-$9FFF area and indeed. # EXROM # – from C64 SIDE IT’S INPUT LINE and this is information from the C64 PLA for manipulating ROML (set to 0) when CPU addressing $800-$9FFF. OUTPUT LINE from cartridge side and this line manipulating cartridge always. # ROML # – OUTPUT LINE from C64 side, and for cartridge is a INPUT line – Is a lead out of address decoder signal and this line going to low state (logical 0) when CPU addressing $8000-$9FFF. When CPU addressing any other area this line going up to HIGH (1) immediately. For read operations only. **ALLWAYS REMEMBER IT WORK WHEN LORAM FOR EXROM AND HIRAM FOR GAME IS ENABLED (1) ** Now we must considering 4 possibilities settings GAME and EXROM and what’s going on here: - GAME = 1, EXROM = 1 Nothing to do. No any information send from C64 to cartridge via ROML or ROMH They are still in HIGH (1) - GAME = 1, EXROM = 0 8KB cartridge in $8000-$9FFF area possibility. ROML still work. ROMH always in HIGH state (1) - GAME = 0, EXROM = 0 16 KB cartridge in $8000-$BFFF area possibility. ROML and ROMH both still work. - GAME = 0, EXROM = 1 – ULTIMAX MODE 8KB cartridge in $A000-$BFFF and $E000-$FFFF area possibility. ROMH still work. ROML always in HIGH state (1). Most often this same data are visible in $A000-$BFFF and $E000-$FFFF. Mirror, but we can try exchanged kernel. However be carefully. ULTIMAX MODE is a bit complicated. You need to read “C64 programmers reference guide” OKAY like before we have 2 next signals called: - /IO1 - /IO2 # /IO1 # When CPU addressing $DE00-$DEFF area this line going to LOW state (0). After this immediately go back to (1). OUTPUT LINE from C64 side and of course INPUT LINE from cartridge side. So cartridge can know when CPU addressing this page. THIS LINE WORKING FOR READ AND WRITE OPERATIONS # /IO2 # have this same function like /IO1 for $DF00-$DFFF area. It’s simple lead out of address decoder. R/W access like /IO1 # OK – now DATA BUS: # - D0 to D7 lines This is the data bus of CPU. From/to this lines we can get/put information from/to CPU. Important property – they are a bidirectional lines – from CARTRIDGE SIDE – when CPU doing write they are INPUTS and WHEN CPU READING they are as OUTPUT. # A0 – A15 ADDRESS BUS: # - A0 to A15 lines Here we have address where CPU read or write or execute. Most often it is from cartridge side INPUT DATA. When using DMA, it can be treat as OUTPUT but… Is much complicated. # IRQ LINE # – by this line using as OUTPUT from cartridge side, cartridge can be invoke IRQ interrupts by set this line to (0). Normal state for this line I (1). But remember interrupt here is invoke by LOW STATE. # NMI LINE # – by this line using as OUTPUT from cartridge side, cartridge can be invoke NMI interrupts by FALLING EDGE of this line. Most often used for take over control in freezers in ULTIMAX MODE. After FALLING EDGE on this line CPU going via NMI VECTOR located under ($FFFA) so of course when we talking about the falling edge so normal state of this line is (1). When in this time is kernel replaced the CPU starting program including in the cartridge ROM/RAM. # BA SIGNAL # – input line for cartridge – when CPU is busy hi set this line as logic (0). This is a information for cartridge “don’t do anything I’m busy”. This line working all the time, for example when VIC refreshing data for charset in every one 8th line CPU is stopped for 40 cycles. Also when VIC fetching sprite data BA going to LOW state. # DOT_CLOCK # – rectangular signal about 8MHZ freq, signal is lead out from VIC after gone every one pixel on the screen line. # R/W LINE # – very important line which send information when CPU read or write datas. Most often from cartridge side is input line. When CPU doing write operation this line going to LOW STATE (0), for read (1). By this line we can recognize what CPU doing and which one phase we awaiting. If cartridge want send data to data bus we need high state on this line, if cart need read data from C64 we need low state R/W. # DMA LINE # – by this line we can obtain DIRECT MEMORY ACCESS. When some lines they are not input only from cartridge side. However be carefully, DMA is not so easy to use. More experience you need for this. # PHI2 LINE – PHASE2 # – very important last one line. This line synchronize all R/W operations. Here we have rectangular signal freq about 1MHZ. When PHI2 have LOW state we have phase when VIC refreshing RAM. CPU working like this: When going RISING EDGE of PHI2 the CPU setting data, hi have 500ns time for this. After 500ms going FALLING EDGE of PHI2 and IN THIS MOMENT data are strobe. General rules for properly work is: 1. When CPU want READ and cartridge need set data for CPU it MUST BE done it in time of HIGH state of PHI2. (R/W = 1) 2. When cartridge needs to get any data from C64 (R/W = 0) it MUST be do it ON THE FALLING EDGE of PHI2. And now please don’t get me wrong – not when PHI2 = 0, BUT WHEN GOING FALLING EDGE OF PHI2 !!! OKAY we have short describe of expansion port Commodore 64, now we can get considerations what going on with this lines, how used they. EXAMPLE: We want enable 8KB cartridge in $8000 - $9FFF area how to do it ? For this we need information: 1. When CPU addressing $8000-$9FFF area for READ operations ? For this we need set the EXROM line to LOW state, also we need connected cartridge ROM to address bus and data bus, and checking when /ROML have a LOW state. This is a very simple and scheme bellow show properly connections: ![Read Access](https://easyeda.com/attachments/2018/5/CAbYTS7QsqqjNJpVcXKdNAJxT7wH1aWQvUaf7vqL.png) Now we can considering how we can get any data from CPU from /IO1 area. For this we need a few information: 2. When CPU addressing $DE00-$DEFF area ? 3. It is a WRITE operation of CPU ? 4. It is a FALLING EDGE of PHI2 ? Ad1 – For 1st point we need set the check /IO1 signal. Ad2 – Second information provide for us the R/W line, when it is in LOW state we can check 3rd value Ad3 – Basically we check PHI2 line In other words: IF /IO1 = 0 and R/W = 0 and PHI2 EDGE GOING TO DOWN THEN WE CAN CATCH DATA FROM DATABUS This task doing our cartridge. For more clarity we need check the timing diagrams this lines: ![Diagram](https://easyeda.com/attachments/2018/5/xhGl4DTPonttBpZz3QKJ4FBdnS3T15DgsDy7eWL3.png) You can see when data are stabilized and how many times are present after falling edge of PHI2. Sadly if we don’t use for this any CPLD or FPGA we need to find any logic unit which will be able doing this function. And for example 74LS138 can do it. ![138](https://easyeda.com/attachments/2018/5/cfX2gXf4i3Udm0699V8nFwdApSSdflwOqjN93aEZ.png) The Q0 (Y0) otput line most often is in high state. When A,B,C, G2A, G2B input lines are in low state (ZAP, RW, IO1) and PHI2 = 1 then Q0 take a LOW state and when PHI2 is going down the Q0 line send write strobe for catch data by 74LS273. After this when PHI2 will be changed to high, also RW and IO1 going to high state Q0 line is HIGH. # HOW WRITE STROBE WORK IN OGRYZEK V4 - STROBE TIMING # White line - moment of latching data from data bus ![STROBE.png](//image.easyeda.com/pullimage/uBQC9Y6j1vLtYidCVSpS5XrAqpbeXtHCTXOp4XiN.png) .
Design Drawing
schematic diagram
1 /
PCB
1 /
The preview image was not generated, please save it again in the editor.
ID Name Designator Footprint Quantity
1 74LS273 74LS273 DIP20 1
2 27C020/512/256 27C020/512/256 DIP32 1
3 0k VCC_DIP28,A17,A18,IO1_BR,IO2_BR C1206 5
4 10k 27C020_10K,10K C1206 2
5 RESET S1 TACTILE-PTH-SIDEEZ 1
6 100nF C1,C2 C1206 2
7 C3 C3 C1206 1
8 74LS138 74LS138 DIP16 1
9 LL4448 ROM_H,ROM_L,I/O2,GAME,EXROM,I/O1 SOD80_DO213AA_MINIMELF 6
10 74LS139 74LS139 DIP16 1
11 CART_C64 U1 CART_C64 1

Unfold

Project Members
Target complaint
Related Projects
Change a batch
Loading...
Add to album ×

Loading...

reminder ×

Do you need to add this project to the album?

服务时间

周一至周五 9:00~18:00
  • 0755 - 2382 4495
  • 153 6159 2675

服务时间

周一至周五 9:00~18:00
  • 立创EDA微信号

    easyeda

  • QQ交流群

    664186054

  • 立创EDA公众号

    lceda-cn