Mega-Cart hacking and writing the NvRAM...

Basic and Machine Language

Moderator: Moderators

tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Mega-Cart hacking and writing the NvRAM...

Post by tlr »

When I got the Mega-Cart and read about the NvRAM I decided it could be very useful for small developer tool kits.
The only problem was that all of the NvRAM was supposedly used by the menu system and would therefore interfere with normal operations.
After quite a bit of reverse-engineering I found that it was possible to use the NvRAM overlapping the control registers ($9c80-$9fff).

Here is a collection of a NvRAM writing utility and some technical information:
mega-tools-20090731.tar.gz

As a side effect of all this I got enough information to implement emulation of the Mega-Cart hardware in VICE. Available as of development version v2.1.15.

Note: Only write the NvRAM if you know what you are doing as you can easily corrupt your prefs if you write the wrong locations.

Image
Last edited by tlr on Mon Aug 03, 2009 7:49 am, edited 2 times in total.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: Mega-Cart hacking and writing the NvRAM...

Post by nbla000 »

tlr wrote:Here is a collection of a NvRAM writing utility...
Hey, My compliment to your brillant research work and for your excellent programming abilities.

I've tested your Mega-inject tool for my next SJLoad patch for JiffyDos and uIEC/SD2IEC drives and it works has expected, you have "recycled" the Mega-Cart graphics by keeping the same look and feel of the menu, very great job.

As said, be careful, this programs must be used only if you know what you are doing, may be doungerous for your Mega-Cart if used improperly.

As a side effect of all this I got enough information to implement emulation of the Mega-Cart hardware in VICE. Available as of development version v2.1.15.
Wow, are you a Vice developer ?

It will be nice for users to test the Mega-Cart before to buy, this is a very big thing !!!

Again my compliments for your work, do you work for CIA or something similar ? :wink:
Mega-Cart: the cartridge you plug in once and for all.
User avatar
Pedro Lambrini
Vic 20 Scientist
Posts: 1132
Joined: Mon Dec 01, 2008 11:36 am

Post by Pedro Lambrini »

Wow! A while back I asked if it was possible to emulate the Mega-Cart and the answer seemed to be a no. It just shows that give a hacker/coder enough time and they can do anything! Well done.

PS: Is there going to be a public build of Vice available with this anytime soon? :)
"...That of the Eastern tribe being like a multitude of colours as if a rainbow had settled upon its brow..." Daniels 1:3
Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Post by Diddl »

@tlr

I would like to see another cartridge emulation in VICE also.

We are shortly bevore releasing our final expansion v3.1: click



I could give you all information needed for this emulation of FE3.1. It would be highly appreciated to have such a emulation in VICE, but I can't so this job.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

hey tlr a lot of work for you in the next months :wink:
Mega-Cart: the cartridge you plug in once and for all.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Post by tlr »

Thanks for all the compliments!

Yes, I'm a VICE developer. The hard part was to rewrite the cartridge system to be modular like on the c64 emulation.
Adding another cart should be relatively straight forward. Wait and see.

Now back to the NvRAM and other Mega-Cart discussions...
Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Post by Diddl »

@TLR
Many thanks for emulation of MegaCart and FE3 in VICE!


I'm deep impressed!! It works perfectly! It is wonderful, nearly like christmas!
Lozza
Vic 20 Amateur
Posts: 63
Joined: Wed Feb 16, 2005 4:50 pm

Post by Lozza »

it works ?

ok i'd love to have a squizz..

where to get this beta vice ?

and where for images of the 2 carts !?
oi oi saveloy
Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Post by Diddl »

>where to get this beta vice ?
you have to compile it yourself


>and where for images of the 2 carts !?
MegaCart I don't know.

FE3: click, and also here
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

Lozza wrote:and where for images of the 2 carts !?
Each Mega-cart has a custom user firmware, when the new Vice version will be out, all Mega-Cart users will may use a tool to extract their Vice Image, for the moment you may enjoy it just on real hardware :wink:

Please be patient...


PS: Lozza, your old avatar was better :oops:
Mega-Cart: the cartridge you plug in once and for all.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

I've had the joy of trying the injector now. Very nice work, and writing to $9E00 isn't much slower than downloading those nearly daily Microsoft Windows updates. ;-)
Anders Carlsson

Image Image Image Image Image
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Post by tlr »

Those MS updates are a few more bytes though... :)
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

Yes tlr does a very good work, my new SJLOAD patch for IO3 (based on Diddl SJLOAD routines) works very well and now we don't need to overwrite music data to add turbo support for sd2uiec and JiffyDos based drives.

This was possible only with your tool tlr, many thanks again for your work and many thanks to Diddl for his routines of course.

Btw my latest SJLOAD patch works from $9C86 to $9FFD so we need to find a new location for your Vic-Tracker patch, I suggest IO2 $9800-> $987F

PS: I wish release the final SJLOAD patch for all Mega-Cart users with a stand alone program to install the SJLOAD patch without user interaction, just LOAD and RUN, there is a standard way or do I need to hack your INJECTOR a bit :wink: ?
Mega-Cart: the cartridge you plug in once and for all.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Post by tlr »

nbla000 wrote:This was possible only with your tool tlr, many thanks again for your work and many thanks to Diddl for his routines of course.
yw. I'm glad you find it useful.
nbla000 wrote:Btw my latest SJLOAD patch works from $9C86 to $9FFD so we need to find a new location for your Vic-Tracker patch, I suggest IO2 $9800-> $987F
...or you just make your patch 34 bytes shorter... :wink:
The vt patch is relocatable so you can just put it where you think it fits.
nbla000 wrote:PS: I wish release the final SJLOAD patch for all Mega-Cart users with a stand alone program to install the SJLOAD patch without user interaction, just LOAD and RUN, there is a standard way or do I need to hack your INJECTOR a bit :wink: ?
There is a standard way. From the readme:

Code: Select all

Special feature:

Mega-Inject can be made to automatically inject a binary (after asking).

  1. Copy mega-inject.prg to a new file.
  2. Change the last byte of the new file to $00 (originally $ff).
  3. Append a structure like below to the end of the file:
     0      zero-terminated string shown before accepting.
            (Max two lines + one empty recommended)
     n      Start address to write
     n+2    Last address to write
     n+4... data to write

Example:
    dc.b    "STRINGSTRINGSTRINGSTRI"
    dc.b    "STRINGSTRINGSTRINGSTRI"
    dc.b    0
    dc.w    $9df1
    dc.w    $9e0f
    dc.b    1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
    dc.b    20,21,22,23,24,25,26,27,28,29,30,31
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

tlr wrote:The vt patch is relocatable so you can just put it where you think it fits.
OK, I will inform you for the new location in case you want to change your VT patch inside the tar.gz archive.
nbla000 wrote:PS: I wish release the final SJLOAD patch for all Mega-Cart users with a stand alone program ...
There is a standard way. From the readme:
Sorry, i didn't read your readme :oops:

Next week I will try it, time for holidays now :wink:
Mega-Cart: the cartridge you plug in once and for all.
Post Reply