Uzebox SD Gameloader V0.4.5

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
Post Reply
User avatar
uze6666
Site Admin
Posts: 4778
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Uzebox SD Gameloader V0.4.5

Post by uze6666 »

This is the official thread for the Uzebox Gameloader (aka bootloader). Thw Gameloader allows the loading of games stored on the SD card. Here's the features & limitations for this release:

Image

Features
----------
-240x224 graphics (40x28 characters)
-Basic sound
-Only regular SD cards are supported (SDHC won't work)
-FAT16 support only
-No fragmentation support yet. The SD card *must* be formatted before putting stuff on it or who knows what will happen!
-Only files in the root folder are detected
-Up to 128 .uze files, using page navigation
-Uses new ".uze" files. These binary versions of .HEX files with a 512 bytes header. The header includes info like game name, author, year, etc...I've made a C tool to convert .hex to .uze and it's made to be included in the MAKE process.
-When selecting a game, a check is performed against the program memory to not reprogram the same game. Uses the EEPROM to store a CRC of the flashed game. For the time being if your EEPROM is not yet "formatted", run Pac-Man, it will kindly do it for you! :)
-Fully open sourced


Installation
The Fuzebox owners out there, for now at least, are left if the blues. The Fuzebox already comes with a bootloader, and it *can not* overwrite itself since it has the protection fuses programmed. To flash this new bootloader you need and ISP programmer. There could be a way to reprogram the FTDI bootloader with some clever programming but then, you will not be able to reprogram any more games since the FTDI code will not be there anymore! Unless we can find a way to fit 2K in about 512 bytes...If anyone's interested let me know.

So this procedure is *only* for peoples with an ISP or high voltage programmer(i.e: AVRISPMKII, STK500 or USBtinyISP). I'm not responsible if you brick your chip using and FTDI cable!

Here's the code and procedure to install it. Note that I will only give the steps for AVR Studio since I don't know any other programmers. If you figure it out for AVR dude or other please post, I'll make a WIKI page for it.

First, you need to program the following fuses:
-BOOTSZ to 2048 words (4 Kbytes). Tells the AVR the size and start address of the bootloader.
-BOOTRST . Tells the AVR to reset into our bootloader.
Image

Then flash the following HEX:

Latest version 0.4.5
-Small fix to the way the bootloader detect that a game is already flashed.

Notes:
  • If you are confortable fiddling with fuses, after flashing the bootloader, you can set the bootloader lock bits. This will prevent game that exceeds 61440 bytes to overwrite the bootloader. In AVR Strudio: Progamming dialog->LockBits tab->BLB1="SPM Prohibited in Boot Section"
  • I've put Uzeamp in there, so you may want to add a few songs from here.
  • The movie demo will try to find the first ".uzm" file, if there's none it will start playing garbage. Get a movie file from here.
  • Get some pre-converted .UZE files from SVN by downloading this package.
  • Bootloader uses only .UZE files. Run the packrom tool to convert .HEX files to .UZE files. Check this wiki page for more info.
Insert, reset and enjoy...Up and down to select a game, press start to load it. Let me know how it goes and if I forgot anything (eh, it's almost 3:00AM here!). Also and any comments regarding the Gameloader is welcome.

Cheers,

-Uze
Attachments
uze-roms-june2015.zip
(1.2 MiB) Downloaded 1361 times
Bootloader_0_4_5.hex
(11.09 KiB) Downloaded 1797 times
Bootloader_0_4_4.hex
(11.08 KiB) Downloaded 1555 times
Bootloader_0_4_2.hex
(11.09 KiB) Downloaded 1360 times
User avatar
paul
Posts: 457
Joined: Sat May 02, 2009 8:41 am
Location: Brisbane, Australia

Re: Uzebox SD Gameloader Alpha...at last!

Post by paul »

Exceptional work, Uze! I would give feedback, but I *still* haven't made my Uzebox...

It's now a real console :D
cjoudrey
Posts: 6
Joined: Sat Jul 18, 2009 9:38 pm
Location: Montreal, QC

Re: Uzebox SD Gameloader Alpha...at last!

Post by cjoudrey »

1 word: AWESOME !!! :)

Good job to both of you !!

Really a step forward !! :)
User avatar
codecrank
Posts: 66
Joined: Sun Nov 16, 2008 10:13 pm
Location: Denver, Co

Re: Uzebox SD Gameloader Alpha...at last!

Post by codecrank »

you're the man !
rogerlevy
Posts: 7
Joined: Thu Jul 09, 2009 1:45 am

Re: Uzebox SD Gameloader Alpha...at last!

Post by rogerlevy »

Thanks for making this, uze.
Cheers
Roger
havok1919
Posts: 474
Joined: Thu Aug 28, 2008 9:44 pm
Location: Vancouver, WA
Contact:

Re: Uzebox SD Gameloader Alpha...at last!

Post by havok1919 »

Sweet! Thanks Uze. :) That was a lot of hard work, I'm sure!

I don't know if this is old news or not, but I ran across it the other day:

http://www.avrfreaks.net/index.php?modu ... pe=project

Could be something useful/interesting in there.

-Clay
User avatar
uze6666
Site Admin
Posts: 4778
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Uzebox SD Gameloader Alpha...at last!

Post by uze6666 »

Hey Clay, nice to see you around! Yeah that was indeed quite some work. But it was worth it, specially considering most of the stuff and size optimizations done will end up in the main kernel. :)
Thanks for the link, that will be useful info if we ever add FAT32 support. If you try the bootloader let me know your toughs/suggestions!

-Uze
braddock
Posts: 26
Joined: Fri Jul 31, 2009 12:09 pm

Re: Uzebox SD Gameloader Alpha...at last!

Post by braddock »

I want to use SD support in an app. How would I best do that? Is an "SD Core" now part of the kernel, or will I need to maintain a downstream copy?

Is this SD/FAT code from the bootloader checked in somewhere? Sorry, still learning where all the code lives...

thanks!
braddock
User avatar
uze6666
Site Admin
Posts: 4778
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Uzebox SD Gameloader Alpha...at last!

Post by uze6666 »

There's 'primitive' SD & FAT libraries in SVN under the beta4 branch: http://code.google.com/p/uzebox/source/ ... l-4-uzeamp. It has lots of limitations (ie: read only, no fragmentation support), but was more developed as a proof of concept. It's only used by Uzeamp and this bootloader demo (so far). Pragma id another developer of the bootloader and has worked to enhance (or should I say complete re-write :D ) my stuff to support fragmentation, offer write support, etc. Plus it been done in pure assembler to save lots of space and gain a bit of speed too. Once done, this code should become the baseline in the kernel. In the mean time, you'll have to hack something or use third party libraries...For this have a look at this:
http://www.avrfreaks.net/index.php?modu ... pe=project fat32 library for AVR. Don't know how it works, or it's size, but foir a non-bootloader application, it could work just fine.

-Uze
braddock
Posts: 26
Joined: Fri Jul 31, 2009 12:09 pm

Re: Uzebox SD Gameloader Alpha...at last!

Post by braddock »

My dream app requirements are read-only for only one or two FAT files and fragmentation isn't a concern since I'll be preparing the card myself. So it sounds like the dev branch SD/FAT functionality is appropriate - and will only get better with time.

Plus I imagine you could use an alpha tester. When I worked with embedded FAT USB drivers before, all sorts of whacky things turned up with some manufacturers.

But is the dev kernel branch in general (not just SD) basically stable enough to develop an app for, or am I asking for a world of hurt? What is the timeline for a release?

Thanks,
Braddock Gaskill
Post Reply