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 > Cartridge - C64 Game System, System 3 Memory Management
2016-08-18 16:37
TWW

Registered: Jul 2009
Posts: 545
Cartridge - C64 Game System, System 3 Memory Management

Does these cartridges allow memory management in terms of normal ROM/RAM/IO? I.E. Can I use the RAM under $a000-$bfff, $d000-$dfff and $e000-$efff?

Reason I ask i coz I made a frame for this cartridge in CRT format and it loads and executes fine. However I am only able to access ROM and IO.

http://vice-emu.sourceforge.net/vice_15.html#SEC319
 
... 12 posts hidden. Click here to view all posts....
 
2016-08-19 08:49
chatGPZ

Registered: Dec 2001
Posts: 11386
indeed, its a bit silly that they didnt do that in the kernal before the CBM80 check :)
2016-08-19 09:00
Krill

Registered: Apr 2002
Posts: 2980
Maybe due to circumstantial or even technical reasons. Leaving the CPU port to all-inputs in order not to break whatever would be connected in the final design, before cartridge code takes over, or something like that. Or it's really just a silly oversight. :)
2016-08-19 09:21
oziphantom

Registered: Oct 2014
Posts: 490
Quoting soci
Quoting TWW
Alright GPZ, I will check out the source when I sober up, meanwhile, here is the simple frame-setup (I checked it with a hex-editor and it's identical headers for the cartridge and the chips to the original described in the docs):
Simple is this not. Now that you've learned how to do it the hard way, I'd like to suggest a different solution this the problem.

Create a raw 512 KiB file instead and let cartconv to do the container for you:
cartconv -i in.bin -o out.crt -t gs -n "cartname"

ps.: Cartconv is part of VICE, just like c1541.


Pro tip. Don't bother forcing the assembler to make the right sized file and let cart conv do it for you with -p ;)
2016-08-19 09:22
tlr

Registered: Sep 2003
Posts: 1790
I actually think it's nice that the cartridge hook starts up with as little setup before it as possible. That enables all sorts of hacks to the hardware without changing the kernal.
2016-08-19 11:03
TWW

Registered: Jul 2009
Posts: 545
Yes, strangely enough I initially did set the DDR for the MPU. However when I did, the cartridge ROM would not appear at all.

For sake of good order I added the boot sequence as follows:

    .pseudopc CartridgeLocation {

        .word CartridgeColdStart
        .word CartridgeWarmStart
        .byte $c3, $c2, $cd, $38, $30  // CBM80

    CartridgeColdStart:
    CartridgeWarmStart:
	stx $d016
	jsr $fda3
	jsr $fd50
	jsr $fd15
	jsr $ff5b
	cli
	jsr $e453
	jsr $e3bf
	jsr $e422
	ldx #$fb
	txs

        sei
        lda #$35
        sta $01

!:      dec $d020
        jmp !-
    }


The boot sequence is followed nicely (basic screen comes up) but once I manipulate $01 to #$35 (Try to access LO/HIRAM), the Cartridge ROM disappears and the border color cycle snippet at the end is never executed but instead a BRK from RAM below Cartridge ROM happens.

EDIT: I could relocate the code and access HI/LORAM from outside Cartridge ROM off course...
2016-08-19 12:01
tlr

Registered: Sep 2003
Posts: 1790
Quoting TWW
Yes, strangely enough I initially did set the DDR for the MPU. However when I did, the cartridge ROM would not appear at all.

Maybe you just set the DDR before $01? The correct sequence is:
LDA #$37
STA $01
LDA #$2F
STA $00

When doing cartridge setup you really should have thoroughly examined the kernal startup code first so you know what's originally there.
2016-08-19 12:05
tlr

Registered: Sep 2003
Posts: 1790
Quoting TWW
The boot sequence is followed nicely (basic screen comes up) but once I manipulate $01 to #$35 (Try to access LO/HIRAM), the Cartridge ROM disappears and the border color cycle snippet at the end is never executed but instead a BRK from RAM below Cartridge ROM happens.

EDIT: I could relocate the code and access HI/LORAM from outside Cartridge ROM off course...

This seems obvious? You run code in ROM and try to switch out the ROM and it doesn't work.

If you need to read RAM below ROM you need to use a small accessor somewhere. Writing is possible without switching out ROM though. Even $d000-$dfff can be written using $33->$01.
2016-08-19 13:47
oziphantom

Registered: Oct 2014
Posts: 490
Quoting TWW

The boot sequence is followed nicely (basic screen comes up) but once I manipulate $01 to #$35 (Try to access LO/HIRAM), the Cartridge ROM disappears and the border color cycle snippet at the end is never executed but instead a BRK from RAM below Cartridge ROM happens.

EDIT: I could relocate the code and access HI/LORAM from outside Cartridge ROM off course...


So then it works as expected.
You pull the ROM out from under the CPU and put the RAM there instead, its hits a $00 stored in the RAM, it breaks. That is the correct behaviour.
You want to be able to access the RAM and execute code from the ROM, can't do it. ROM at memory or RAM at memory. But you can write to the RAM at any time.
2016-08-19 14:13
TWW

Registered: Jul 2009
Posts: 545
Quote: Quoting TWW
Yes, strangely enough I initially did set the DDR for the MPU. However when I did, the cartridge ROM would not appear at all.

Maybe you just set the DDR before $01? The correct sequence is:
LDA #$37
STA $01
LDA #$2F
STA $00

When doing cartridge setup you really should have thoroughly examined the kernal startup code first so you know what's originally there.


Well to be fair it writes #$e7 ;-)

Not sure why it would write to the port prior to setting the DDR but I guess it's like aligning the valves before opening the manifoil (metafor intended).

And yes I see no that I was too caught up in the GAME/EXROM lines to actually see that there is no memory configuration allowing what I wanted (All RAM + CART @ $8000 + IO).

Nevertheless this only means (practically) that one can not access the RAM under LO/HIROM or IO from CARTROM.

Thanks for the guidance to all + other input.
2016-08-19 14:22
tlr

Registered: Sep 2003
Posts: 1790
Quoting TWW
Well to be fair it writes #$e7 ;-)

True, although the effect is the same.
Quoting TWW
Not sure why it would write to the port prior to setting the DDR but I guess it's like aligning the valves before opening the manifoil (metafor intended).

Yes, something like that.

The way it works is that upon reset all bits in $00 are set to inputs. The pullups inside the 6502 will then keep the three lower bits effectively high (=$x7). When you set the correct DDR value the contents of $01 will start to affect those bits. If they haven't been set to the desired configuration, boom!
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
csabanw
tlr
MWR/Visdom
JackAsser/Booze Design
Flex/Artline Designs
Guests online: 92
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 Triad  (9.3)
5 Censor Design  (9.3)
Top Graphicians
1 Mirage  (9.8)
2 Archmage  (9.7)
3 Pal  (9.6)
4 Carrion  (9.6)
5 Sulevi  (9.6)

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