WIP console with PIC32MX & MCP2200

Discuss anything not related to the current Uzebox design like successors and other open source gaming hardware
HardlyUnique
Posts: 65
Joined: Tue Dec 08, 2009 7:44 pm

Re: WIP console with PIC32MX & MCP2200

Post by HardlyUnique »

Yet another mini-milestone reached! :D

My little game system can now run it's very first game. Well, "run" is being pretty generous; you can't interact with it yet:
Zork1-1.png
Zork1-1.png (17.6 KiB) Viewed 7737 times
If I scroll up, you can see my "advanced" debugging methodology that let me get this far: just spam the UART and see where it stops! :P Hey, it works!
Zork1-debugging.png
Zork1-debugging.png (46.48 KiB) Viewed 7729 times
HardlyUnique
Posts: 65
Joined: Tue Dec 08, 2009 7:44 pm

Re: WIP console with PIC32MX & MCP2200

Post by HardlyUnique »

Things are sure moving fast over here! :ugeek: :mrgreen:

Thanks to more UART-spam, I found what was keeping me from playing! It looks like Frotz comes with an "undo" feature that was trying to access some files or something. I doubt the original Zork had this feature; at any rate, it was easy to disable!

So, I still need to remove all my debugging-spam but look, I appear to actually be playing the game :shock: :
Zork1 working!.png
Zork1 working!.png (57.3 KiB) Viewed 7740 times
Huzzah! :D

I have no idea if it's fully functional or not; I guess there's only one way to find out! ... :lol:
User avatar
mapes
Posts: 174
Joined: Sun Feb 13, 2011 7:04 am
Location: Seattle

Re: WIP console with PIC32MX & MCP2200

Post by mapes »

If you have ever beaten Zork, it should only take you about an hour to 2 hours to run through it and beat the game. Just don't forget to:

1: Get the ivory torch right away so you keep your lantern's battery life up for the mine.
2: put the ivory torch in the basket and lower it BEFORE you go into the gas room/mine "I forgot to lower the basket once, and its a long annoying maze."
3: Have the candle, book and bell ready at hell's gate to get the crystal skull.
4: Have the garlic out at all times in case you go back into the bat room.

That's about it.
HardlyUnique
Posts: 65
Joined: Tue Dec 08, 2009 7:44 pm

Re: WIP console with PIC32MX & MCP2200

Post by HardlyUnique »

Waaaah!

Heeeey!

"Spoiler alert!" :lol:

...

I've never even played Zork before!

I've been playing it, though. It's confusing as heck. I'll move east then move west and not be where I started. That kind of thing happens all the time :(.

I also added backspace support and managed to get Hitchhiker's Guide to the Galaxy up and running. You can even select between Zork and HHG. I actually have played the latter before now, but only the version with graphics on the BBC's website, and I haven't beaten it. If you've ever played it, you know that occasionally you'll be told about the "destructiveness of idle chatter" or something like that, when the game quotes an unknown command you gave it previously. Ironically, it's right after getting that unnecessary text that the game crashed for me :(.

I think I really need to implement saves before I get too far into either game.
User avatar
mapes
Posts: 174
Joined: Sun Feb 13, 2011 7:04 am
Location: Seattle

Re: WIP console with PIC32MX & MCP2200

Post by mapes »

If this is the first time you have played Zork and you do NOT intend to cheat and get a map online, I HIGHLY encourage you to get a LARGE piece of paper (at least 11X17) and make your own map as your explore how the rooms are connected. I.E. Going north in one room does not mean you go south next room to come back to it. I also recommend writing in pencil, because the 2 mazes will require a lot of exploration. :mrgreen:
HardlyUnique
Posts: 65
Joined: Tue Dec 08, 2009 7:44 pm

Re: WIP console with PIC32MX & MCP2200

Post by HardlyUnique »

Image

:D

Well, as you can see, I've made some progress on this thing! I guess I took a break for a while, but I was inspired to get back into it by miniLD #45: Low-Level Jam.

I got the clock-switching working. It was pretty easy. The only gotcha is that while you can change the multiplier and source on the fly, you can't change the PLL input divisor, and the PLL wants a signal from 4 to 5 mhz. Not a huge deal at this stage of design.

So right now, I have the tv working off this 14.31818 mhz CB3LV oscillator:
Image

I'm presently clocking the system at 85.90908 mhz, three times the Uzebox speed. That's with an 18x multiplier. The chip also has 16 - 21, and 24 times multipliers so there's some room for experimentation.

One thing I noticed though - I couldn't get the UART to work at any speed if the chip is even one SMIDGE above the rated 80mhz. This chip can run its peripheral bus slower, though, so overclocking the CPU while running the peripheral bus at half speed (which is the next fastest setting) may be worth investigating.

As I said before, the USB needs its own clock source and that needs to be a multiple of 4 mhz. It needs the same divisor as the other clock source which means only a 12 mhz oscillator will do here. I was able to find that in a DIP package with the SG51P:
Image

I'm leaning towards the AD723 encoder right now, but if I used say, the ad7434, the system would need 27 mhz and 24 mhz oscillators.

I need to package up the code and post it, but it's really, really simple C code. One thing I noticed though: At first, I spent a couple of days counting cycles in the simulator and getting them PERFECT for each section, only to learn later that you CAN'T rely on Microchip's simulator!! The cycle count was WAY off - in fact, I had to increase the clock multiplier just to get the TV to sync!

Later, I changed my strategy to just reading and writing to the system clock. After I took that approach, getting some simple imagery on the screen was disgustingly easy! :mrgreen:
It is just simple C-code and so there is some jitter, but it's not bad at all.

TODO:
  • Clean-up and update project files, schematics and post them.
  • Move to interrupt-based, assembly-based kernel (See if it's worth using an RTOS).
  • Add AD723 and DAC (COLOR!)
  • Refine bootloader - pages that haven't changed shouldn't be reflashed.
Other "Fun" facts:
MPLAB X kind of really sucks :(
Due to the above, my Frotz project became corrupted and won't compile. When I try to make a new project, it wants to use library f____ functions and says the ones I've supplied are redundant. The ones in the lib don't work, of course. So basically, I gained a test video project and lost Frotz :evil:
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: WIP console with PIC32MX & MCP2200

Post by uze6666 »

Good work! Seeing stuff on the monitor is always the most satisfying part. :-D
Post Reply