Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Making your own cartridge ROM
2009-02-28 20:15
Frantic

Registered: Mar 2003
Posts: 1648
Making your own cartridge ROM

Hello!

I wonder if there is any good reference/tutorial/info text material on creating your own cart ROM (primarily in "Retro Replay format"). I never did this myself, but I am planning to do so. I know there is a special "header" ("CBM80" or something?) first of all which makes the c64 recognize that a cart is plugged in, and then there is all the bank switching stuff (there are docs from Jens Schoenfeld on that I guess), and also assemblers with special features for memory bank handling and so on (dreamass has some features in this direction, or...?). Is the "action replay" source code available somewhere (I heard that this was "floating around on the net")? I think all kind of info like this would be nice to have on http://codebase64.org

The main point here is not primarily that I wouldn't be able to figure things out from various sources of information, but rather that it would be nice to collect already existing info on this on codebase, since there isn't that much on this topic there right now.

Anyone got some info/tutorials on this topic? If there isn't any available, then I would love to see someone write a little about the requirements for making cart software on codebase. Yeah?

(By the way.. Is it just me, or do you people also get "Frantic" as one of the hotlinks on google when searching for "CSDb"? Huh? I guess I must be a very important c64 scener? ;)

//FTC
2009-02-28 21:15
AlexC

Registered: Jan 2008
Posts: 299
Frantic, first of all there are 2 different types of cartridges - those for C64 and 128 only. The CBM80 signature at $8004 is for C64 only cartridges. C128 uses different scheme.

In c64:
You have to remember that cart memory is mapped from $8000-$9FFF and $A000-$FFFF. If you use high memory where normally kernel resides that you can use your own IRQ, NMI and RESET vectors.

Starting from $8000 you usually put:

$8000 - $8002 cold start vector
$8003 - $8003 warm start vector
$8004 - CBM80 signature ($C3, $C2, $CD, $38, $30)

However there are other schemes possible - Trilogic Expert is a good example. It uses NMI line. Don't forget about Ultimax mode - some old cars used it.

If you like I can do a short write up about it.
2009-02-28 23:24
Frantic

Registered: Mar 2003
Posts: 1648
So... You can't call Kernal routines from a cart?

I'd be most happy if you wrote something up on this topic!
2009-03-01 00:06
chatGPZ

Registered: Dec 2001
Posts: 11386
most (all?) freezer carts use the ultimax mode extensivly =)
2009-03-01 02:05
Twoflower

Registered: Jan 2002
Posts: 434
A very good and thorough explanation of the different cartridge format aswell as how carts uses the GAME, EXROM, ROML and ROML lines to arrange where in memory the cart is switched in can be found in the document CRT.TXT by Peter Schepers.

This is a document i've learned most stuff about carts from. The CRT.TXT is included in the FORMATS.ZIP-file which is a part of 64Copy V4.42. Information of some carttypes are missing from there though - most notably the Silverrock, Prophet 64 and the Mssiah carts.
2009-03-01 08:36
tlr

Registered: Sep 2003
Posts: 1790
Quote: So... You can't call Kernal routines from a cart?

I'd be most happy if you wrote something up on this topic!


You can usually use kernal. The kernal is unavailable only in Ultimax mode.

The "normal" cartridge operation modes are described in PRG.
PRG: C64 Memory Maps (several pages)

On top of this there are a lot of cartridges that incorporates extra registers that bankswitches and/or switches between the cartridge modes dynamically.
These registers are commonly mapped to the I/O1 and I/O2 regions ($DExx and $DFxx)

Kernal startup sequence:
>C:fffc  E2 FC
.C:fce2   A2 FF      LDX #$FF
.C:fce4   78         SEI
.C:fce5   9A         TXS
.C:fce6   D8         CLD
.C:fce7   20 02 FD   JSR $FD02    ; check for CBM80
.C:fcea   D0 03      BNE $FCEF
.C:fcec   6C 00 80   JMP ($8000)
.C:fcef   8E 16 D0   STX $D016
.C:fcf2   20 A3 FD   JSR $FDA3    ; setup I/O
.C:fcf5   20 50 FD   JSR $FD50    ; setup zp + memsize
.C:fcf8   20 15 FD   JSR $FD15    ; setup vectors
.C:fcfb   20 5B FF   JSR $FF5B    ; setup screen
.C:fcfe   58         CLI
.C:fcff   6C 00 A0   JMP ($A000)


EDIT: and the terminology LORAM/HIRAM/CHAREN are bits 0, 1 and 2 of $01 respectively.
EXROM and GAME are signals from the cartridge to the C64.
ROML, ROMH, I/O1 and I/O2 are chip select signals from the C64 to the cartridge.
2009-03-01 09:45
Angel of Death

Registered: Apr 2008
Posts: 211
Have been fiddling around with creating my own 'virtual' cartridges using the CRT format in emulators.
Probably the easiest thing, at least that's what I did, is to, indeed start with, peter schepers description of the CRT format and then with that same program copy the different chip packets from various cartridges and see how they work.
Because you have to keep in mind that the CRT format emulates physical hardware that belongs to the appropriate cartridge. (mainly concerning reading one or more mem locations regulating bank selection)
I wrote a source code for tass1.45 that constructs the headers and stuff and in which I can cut and paste the actual c64 code.
Haven't really figured out, yet, how all the control lines and the dynamic bankswitching works, though...

Source code is too big to put here. Could mail it, if you wish.

Oh, it isn't on codebase yet because it is in a bit of an embryonic state as far as annotation and structure goes.
2009-03-01 13:17
WVL

Registered: Mar 2002
Posts: 902
What kind of rom do you want to make anyway? There's already functionality in the flashprogram to flash standard programs in a bank and make them runnable. (maybe you didnt know this?)
2009-03-01 14:29
enthusi

Registered: May 2004
Posts: 677
I did some CRT "research" as well for the upcoming NEH edition :)
If you want a generic 8 or 16 KB cart its rather simple and a header I coded is pretty short.
Fiddling with EXROM and GAME is mostly only necessary when you use BASIC routines.
You can simply blend the ROM in/out via $01 otherwise.
So no need to have THAT specific hw knowledge about the crt.
The simple kind works well in vice and MMCR 0.55 too.
I can clean my code and post it too if someone needs it.
You have to be a bit careful about the INIT routines since some use BASIC area and you usually wont need them anyway.

cheers,
enthusi
2009-03-01 16:56
AlexC

Registered: Jan 2008
Posts: 299
Quote: So... You can't call Kernal routines from a cart?

I'd be most happy if you wrote something up on this topic!


No, you actually can - it all comes down to memory management. However keep in mind that most advance carts like Action Replay had their own RAM (this is why there are 2 method for writing into that RAM).

Code inside the EPROM is just part of the bigger design, especially if you want more than swapping out 8 or 16k.

I'll write something for codebase64 than. It's in line with my update regarding detecting cartridges :)
2009-03-01 22:24
Frantic

Registered: Mar 2003
Posts: 1648
Thank you everyone for your replies!

@WVL: The program in question is rather large (would require switching between ROM banks), and the reason for putting it into a cart would be to have as much ordinary C64 ram free as possible in order to make yet another bunch of features possible (so, not just loading it quickly from cart, even though the quick "loading" is also part of the picture here of course).

By the way.. I still wonder about assemblers.... Is there a reason for why you would need any other feature for assembling a cart ROM than some "pseudo PC" directive, like the one you use for drive code for example?

//FTC
 
... 19 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
TheRyk/MYD!
zscs
LKP/CFN
St0rmfr0nt/Quantum
MWR/Visdom
Chesoner/House Designs
katon/Lepsi De
The Syndrom/TIA/Pret..
Youth
Mike
Lazycow
Alakran_64
mutetus/Ald ^ Ons
Guests online: 145
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.059 sec.