Omnimaga

General Discussion => Technology and Development => Other => Topic started by: Keoni29 on November 11, 2013, 06:14:14 am

Title: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 11, 2013, 06:14:14 am
Original post: http://8times8.host56.com/?p=334

I started porting the cartreader software to the eZ8 microcontroller. It is already possible to read cartridges.

Because the eZ8 has 29I/O pins I don't have to use latches to expand the address bus. This means I only need two IC's for the entire build: A max232 for serial communication and the microcontroller! This greatly reduces the cost of the entire thing. It also makes it much easier to build than its arduino counterpart.
(http://8times8.host56.com/wp-content/uploads/2013/11/IMG-20131108-WA0000-300x225.jpg) (http://8times8.host56.com/wp-content/uploads/2013/11/IMG-20131108-WA0000.jpg)(http://8times8.host56.com/wp-content/uploads/2013/11/IMG-20131110-WA0009-300x225.jpg) (http://8times8.host56.com/wp-content/uploads/2013/11/IMG-20131110-WA0009.jpg)
(http://8times8.host56.com/wp-content/uploads/2013/11/IMG-20131110-WA0007-300x225.jpg) (http://8times8.host56.com/wp-content/uploads/2013/11/IMG-20131110-WA0007.jpg)(http://8times8.host56.com/wp-content/uploads/2013/11/IMG-20131110-WA0005-300x225.jpg) (http://8times8.host56.com/wp-content/uploads/2013/11/IMG-20131110-WA0005.jpg)

The cartreader V2 has a renewed communication protocol. Instead of dividing the cartridge address range in pages you can have random access to the cartridge via the pc and do block transfers. Every block has a header like this:

Code: [Select]
mode = [0x00..0x01] (0x00=read, 0x01=write)
size = [0x00..0xFF] (0x00=1byte, 0xFF=256bytes)
addrH = [0x00..0x0F](12 bit start address)
addrL = [0x00..0xFF]

If write mode was selected [size] bytes will follow. These are buffered and then written to the cartridge starting at the 12 bit start address.

In the next couple of days I will modify the romclient.exe pc software so it works with the eZ8 version. I will rename it to romclient2.exe to avoid confusion.
Title: Re: Atari2600 Cartridge Reader V2
Post by: Sorunome on November 11, 2013, 09:29:25 am
Wha, that looks pretty awesome, great job! :D
Title: Re: Atari2600 Cartridge Reader V2
Post by: TheMachine02 on November 11, 2013, 09:46:48 am
indeed that pretty interesting. Block transfer is really cool  :D
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 11, 2013, 12:23:02 pm
Yup, nice job Keoni./me has no hardware stuff. :/
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 11, 2013, 03:35:56 pm
I just succesfully modified the romclient.exe to work with the new block transfers. It works even better than before. I tested it with these games so far:
Demon Attack
Yar's Revenge
Video Pinball

The next thing I am going to implement is bankswitching. I am not sure how I want to do this yet though. I might create a simple interpreter for it. Example for an 8KB cartridge with 2 4k banks:
Code: [Select]
000[4k],sw[FF9],000[4k]Result:
Code: [Select]
Read 4Kbytes starting at 0x000
Bankswitch by putting address 0FF9 on the address bus
Read 4Kbytes starting at 0x000
This results in an 8KB file on the computer.
Title: Re: Atari2600 Cartridge Reader V2
Post by: DJ Omnimaga on November 11, 2013, 03:37:32 pm
Good job again Keoni :).
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 11, 2013, 05:30:59 pm
Oh also: my code assembles to 218 bytes.
Title: Re: Atari2600 Cartridge Reader V2
Post by: DJ Omnimaga on November 11, 2013, 10:33:33 pm
Nice. By the way you should make a video of it in action at one point. :D
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 12, 2013, 03:31:50 am
I just uploaded an old video of the arduino version in action. I want to get one type of bankswitching to work today: F8. I described that method in my previous post. The cool thing about the new block transfer communication is that it allows for bankswitching to be controlled by the pc. No need to change any of the microcontroller's firmware.

I am also going to draw the schematics for the new cartreader.


Edit: I almost got the first bankswitching method to work. There is a little bit of glitching going on though. I might have to add some delay.
Edit2: After I modified the rom dump with a hex editor I got it to work. I fixed the bug that caused the dump file to have a 1 byte offset on every bank. This was because I did not read the byte returned from the bankswitching!

I managed to dump Asteroids which is an atari 8k game that uses F8 bankswitching!


Edit: I do not own any more F8 bankswitching games sadly, but I tested some other games now too:
Slot Racers
Combat
Pac-Man
Outlaw
Chopper Command
Megamania
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 12, 2013, 12:39:11 pm
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 12, 2013, 03:49:27 pm
Wow that's pretty awesome, great job !
Title: Re: Atari2600 Cartridge Reader V2
Post by: Sorunome on November 12, 2013, 04:44:35 pm
^that, it is looking epic! Great job!
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 12, 2013, 04:53:55 pm
Working on a better multicartridge as well. This one will support F8 bankswitching! There are three IC's in the cartridge that take care of the bankswitching. The cartridge will also feature a much larger RAM chip than the last one. This one has 128KB ram which can hold up to 16 8k games!
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 14, 2013, 06:24:46 am
Allright! I can write to my old 8k multicartridge with the new cartreader now! I had to do some bugfixing. The timeout on the serial port is now higher so there is plenty of time for the cartridge to dump its data.

The firmware on the cartreader is now 316 bytes :P
Title: Re: Atari2600 Cartridge Reader V2
Post by: TIfanx1999 on November 14, 2013, 08:29:53 am
Cool stuff Keoni! I can't watch the video atm cause youtube is acting up. I'll check it again later. :)
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 14, 2013, 10:46:48 am
Thanks! I am so glad that I can write to the multicart now! It took me so long to figure out what was wrong with the firmware. There turned out to be two major bugs:
1. On the cartreader side: When writing to the cartridge the serial buffer overwrites the block size parameter. Fixed.
2. On the PC side: Serial timeout not set. It expected the serial to be ready instantly. Fixed.

Things to fix: remove delay from pc program to gain speed.

It is more difficult to fix bugs on the pc because I don't have a C debugger installed yet and it's far from low-level.
Title: Re: Atari2600 Cartridge Reader V2
Post by: DJ Omnimaga on November 14, 2013, 11:01:51 pm
Very nice video Keoni :)
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 15, 2013, 05:46:35 am
I made the new backup cartridge and it worked right away. I did not make any mistakes while building it. O.O
This marks the beginning of a new era :P

Now I have to install the bankswitching hardware. Lets hope that works too!

Edit: it appears that the bankswitching hardware is very unreliable. It might be a design flaw though, because the mismatch with the orignal file is consistent and the readout is always the same. I will check if all the wires are attached correctly and then assess the situation.
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 17, 2013, 09:22:23 am
I wired some stuff the wrong way around. Using my oscilloscope and debugger cable I managed to track down the bug. Now the backup cartridge has F8 bankswitching hardware! Yay! I can play E.T. now (which is an F8 bankswitching game) along with 15 other 8k games. I can put 4k games on this cart as well.
Title: Re: Re: Atari2600 Cartridge Reader V2
Post by: DJ Omnimaga on November 17, 2013, 11:52:33 am
Wait... E.T is not 4K? O.O
I was sure it wasn't even 1K...
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 17, 2013, 12:55:42 pm
No, those advanced graphics took up most of the space.

Edit: cleaning up the source of my computer program to allow for easier implementation of various bankswitching methods as well as bankswitch detection.
Edit:

I almost finished building my second multi-cartridge. This one has F8 bankswitching hardware built in. It can hold up to 16 8k games or 16 4k games (gets copied twice to the cart so when a bankswitch occurs it does not affect the game)
After cleaning up the code of the pc connectivity tool that goes with the cartreader I could easily make changes to the bankswitching code. The cartreader still only supports F8, but F6 is pretty easy to implement too. I do not own any F6 games to test it with, so I am going to have to get some F6 games first.

It seems like I don't have to make any hardware modifications to the cartreader, so I will solder up a prototype and put it in an enclosure soon!
Title: Re: Atari2600 Cartridge Reader V2
Post by: DJ Omnimaga on November 17, 2013, 07:17:36 pm
Lol I see now. Also glad to see more progress :)
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 23, 2013, 11:57:25 am
(http://8times8.host56.com/wp-content/uploads/2013/11/cartreader3-300x225.jpg)

More pictures: http://8times8.host56.com/?p=345
Soldered the device up and put it in an enclosure. Almost finished!
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 24, 2013, 03:02:10 am
Wow, inside your comp. O.O Pretty cool idea. ;)
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 24, 2013, 08:47:20 am
I was messing around trying to come up with the best solution to put it all together. Hot glue and a plastic back on metal is not ideal. I have to come up with something that sticks better.
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 24, 2013, 08:50:52 am
What's the game select switch for BTW ?
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 24, 2013, 08:53:20 am
I took this piece of plastic from an actual atari2600. Normally you'd find the game select switch next to the cartridge slot. I slip the programming cable that is required for my multicartridge trough this hole :P.
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 26, 2013, 04:38:16 pm
Building a case for it. Notice the molex connector on the back. It feeds right off the PSU. My cartreader has a built in 5v regulator so it can be powered with a 9v wallwart when it is not in a pc.
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 29, 2013, 02:17:44 pm
Title: Re: Atari2600 Cartridge Reader V2
Post by: utz on November 29, 2013, 07:08:41 pm
vet!
Spoiler For Spoiler:
also "I have no idea what's on that bank... oh, E.T." haaahahahaha suuuure ;)
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 29, 2013, 07:33:48 pm
I knew ET was on there somewhere but I did not know it was on that bank.

Edit: I wrote a batch file which automatically loads games from the cartridge and plays them with just one click. You can also drag a rom file on the batch file and it will write the file to the cartridge (only works with a special multicartridge)
Title: Re: Atari2600 Cartridge Reader V2
Post by: utz on November 30, 2013, 08:37:18 am
Man, you really should put some good sh*t (http://www.pouet.net/prod.php?which=62139) on your cart.
Ah, but I suppose you're using your own 2x4k one? No 32k for you then :p
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 30, 2013, 09:12:55 am
I might make a cartridge with programmable logic in it one day. It will be able to emulate various types of bankswitching.
Title: Re: Atari2600 Cartridge Reader V2
Post by: Sorunome on November 30, 2013, 09:16:21 am
That case makes it look far cooler, great job! :D
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 30, 2013, 09:28:10 am
Yeah it's really pretty epic ! :D
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 30, 2013, 09:31:46 am
I just played some atari games on an emulator using the cartreader and my joystick adapter. I can play real games using the original joystick on my computer!
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 30, 2013, 09:34:40 am
Even more epic then. You really made quite a thing man ! :thumbsup:
Title: Re: Atari2600 Cartridge Reader V2
Post by: Sorunome on November 30, 2013, 09:35:14 am
Yep, that is awesome!
Pacman for ever :P
Title: Re: Atari2600 Cartridge Reader V2
Post by: Eiyeron on November 30, 2013, 09:35:44 am
Atari-man, the hero of the lost Generation.

Good work here! Dump some games for the prosperity!
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 30, 2013, 09:36:06 am
Funny that you mention pac-man. I have 3 versions of pac-man on the multicartridge. The original atari version, ms pac-man and a homebrew called pac-man 4k.
Title: Re: Atari2600 Cartridge Reader V2
Post by: Sorunome on November 30, 2013, 09:49:59 am
Funny that you mention pac-man. I have 3 versions of pac-man on the multicartridge. The original atari version, ms pac-man and a homebrew called pac-man 4k.
Ah, nice! Now play them all at once :trollface:
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 30, 2013, 09:51:09 am
Lol. What CPU is in the Atari ? You should try making your own game now ! :D
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 30, 2013, 09:54:40 am
It is ridiculously hard to program for the atari2600. The video signal is generated by the software and it only has 128 bytes of ram.
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 30, 2013, 09:55:50 am
Yeah I know that, that's the challenging part about it. It should be pretty fun !
Title: Re: Atari2600 Cartridge Reader V2
Post by: Sorunome on November 30, 2013, 09:56:25 am
Program a z80 emulator on it :P
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 30, 2013, 09:57:42 am
/me wants it if you do it :D
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 30, 2013, 10:00:35 am
How about putting an actual Z80 in an atari2600 cartridge as a co-processor :D
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 30, 2013, 10:01:11 am
Sounds like a deal !
Title: Re: Atari2600 Cartridge Reader V2
Post by: Sorunome on November 30, 2013, 10:02:10 am
How about have multiple prozessors which you can switch between - while it is on :D
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 30, 2013, 10:02:47 am
How about an i7 ? :trollface:
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on November 30, 2013, 10:03:30 am
I can switch between games while it is on. Sometimes you get pretty neat results like super high scores.
Title: Re: Atari2600 Cartridge Reader V2
Post by: Streetwalrus on November 30, 2013, 10:04:27 am
Oh that's epic. XD
Title: Re: Atari2600 Cartridge Reader V2
Post by: Keoni29 on December 07, 2013, 03:58:53 am
I tried to run the pc software that goes with the cartreader on my windows XP machine, but the program crashes. Apparently windows XP uses a different windows API. Does anyone know how to write to the serial port in windows XP? I use C to program.

Edit: It has something to do with the way the files work in windows XP. Apparently you cannot read from a non existing file without crashing.