Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Mr. Ultra: a Game Gear WIP

Reply to topic Goto page 1, 2  Next
Author Message
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Mr. Ultra: a Game Gear WIP
Post Posted: Wed Sep 30, 2015 5:33 am
And now I will show what I have made with the Game Gear. A game I am working on called Mr. Ultra. It is a platformer like Mario or Mega Man. Actually, all you can do right now is walk right. The hole and the enemies repeat themselves. This won't be the case when I get to designing the level. Level 1 is the Funky Forest. Anyway, press Start to start the game, and during the game, press 1 to jump and Right to move right. If anyone has a Game Gear Everdrive, I am anxious to hear how good it works on a real Game Gear. You can access a little webpage I made about the game where you can download the ROM and stuff. It's at http://www.atari2600land.com/mrultra/
  View user's profile Send private message Visit poster's website
  • Joined: 01 Feb 2014
  • Posts: 295
Reply with quote
Post Posted: Wed Sep 30, 2015 4:23 pm
Nice. It reminds me a lot of the old Smurfs game for the Intellivision.
  View user's profile Send private message
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Sun Oct 04, 2015 2:15 pm
I'm running out of room for the first bank. Is there any example code on bankswitching? I'll need to once level 2 is finished, possibly sooner. I only have 29% free in bank 00.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Sun Oct 04, 2015 2:39 pm
Bank 1 free to use. If you're getting full then it must be mostly data, so banking should be easy.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Mon Oct 05, 2015 9:00 am
I found that when more than 48KB of ROM is needed, better to plan everything right from the beginning... and that means choosing a convenient rom bank configuration and exploit superfree sections.

I prefer this approach (this is for 128KB, using up to 32KB of code, but additional banks can be used if needed or removed if not needed):
.memorymap
defaultslot 0
slotsize $7ff0 ; ROM (I won't page this)
slot 0 $0000
slotsize $0010 ; Header (I won't page this too)
slot 1 $7ff0
slotsize $4000 ; ROM (...will page this!!!)
slot 2 $8000
slotsize $2000 ; RAM
slot 3 $c000
.endme

.rombankmap
bankstotal 8
banksize $7ff0 ; 32KB minus 16 bytes
banks 1
banksize $0010 ; 16 bytes
banks 1
banksize $4000 ; 16KB (each)
banks 6
.endro


then, you should declare your assets as superfree, like this:

; *********** SUPERFREE ASSETS (in slot 2) ************
.slot 2

.section "splash assets" superfree
splash_tiles:
.incbin "inc/splash_tiles.psgcompr"

splash_tilemap:
.incbin "inc/splash_tilemap.stmcompr"

splash_palette:
.incbin "inc/splash_palette.bin"
.ends

.section "Intro (MUSIC Asset)" superfree
Intro:
.incbin "inc/Intro.psgc"
.ends


so that they 'automatically' will fit into a bank that has enough free space. You'll access the correct bank using the :label WLA-DX syntax as in
PAGEINSLOT2 :splash_tiles   ; page in splash assets

where the macro is simply defined as
.define Slot2Page     $ffff       ; SEGA Mapper - see http://www.smspower.org/Development/Mappers
.macro PAGEINSLOT2
  ld a,\1
  ld (Slot2Page),a
.endm


Believe me, you'll save a lot of time later choosing this approach from the very beginning :)
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Mon Oct 05, 2015 12:46 pm
Thanks for the info. I want the game to be 64k. I'll put the game engine in one bank and have all the graphics, music and stuff in the other banks. I already have the game engine done, so all I'd need to do is modify it for each different level. I'm thinking if I can do it this way, I can have up to 8 different levels, perhaps more. Although if I can fit 8 levels into 32k, I'll just do that.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Mon Oct 05, 2015 12:58 pm
Actually, since my enemies and music files aren't horribly big, I think I can just use 32k. Could I do the game engine in bank 00 and put all the include files in bank 01 and then call them into bank 00 when necessary?
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Mon Oct 05, 2015 1:08 pm
If your ROM fits into 48 KB you don't need any bank-switching at all, which also means you can put your code and your assets anywhere you like and there won't be any problem.
You could even declare a 48 KB bank 0 in slot 0 and forget slots and bank and everything...
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Mon Oct 05, 2015 2:20 pm
OK, cool. How would I declare a 48k bank?
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Mon Oct 05, 2015 2:29 pm
I guess it's like this: (you should read WLA-DX readme to understand what's going on under the hood...)
.memorymap
 defaultslot 0
 slotsize $c000 ; 48KB (ROM)
 slot 0 $0000
 slotsize $2000 ; 8KB (RAM)
 slot 1 $c000
.endme

.rombankmap
bankstotal 1
banksize $c000 ; 48KB
banks 1
.endro


(note that RAM will be as 'slot 1' instead of 'slot 3')
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Mon Oct 05, 2015 2:53 pm
Doesn't PSGLib use slot 3? How would I make a slot 3?
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Mon Oct 05, 2015 3:00 pm
I did this and it seems to work fine:

.memorymap
 defaultslot 0
 slotsize $c000 ; 48KB (ROM)
 slot 0 $0000
 slotsize $2000 ; 8KB (RAM)
 slot 1 $c000
 
 slotsize $4000 ; ROM
 slot 2 $8000
 slotsize $100 ; RAM
 slot 3 $dd00

.endme

.rombankmap
bankstotal 1
banksize $c000 ; 48KB
banks 1
.endro


Also, I just ordered what I need to test this on a real Game Gear. I am so excited to see how it looks.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Mon Oct 05, 2015 7:18 pm
If you're not writing in the style of a Spectrum game then you'll have strong separation of code and data, and using paging is easy. I'd usually group related data together into larger sections, rather than use more, smaller sections (which can fit into the space more efficiently) to reduce the need for paging for each piece. If you need more than 32KB of code then either your code is really bad or really good, I'm not sure which...
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Mon Oct 05, 2015 7:46 pm
Gamegearguy wrote
Doesn't PSGLib use slot 3? How would I make a slot 3?


You don't need that weird memorymap, just change from 'slot 3' to 'slot 1' in PSGlib ramsection. Also, if you want ramsections to start from $dd00 you can simply change slot 1 address.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Mon Oct 05, 2015 7:48 pm
Maxim wrote
If you need more than 32KB of code then either your code is really bad or really good, I'm not sure which...


Well, you could also place LUTs and even some assets in there, if some space remains.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Mon Oct 05, 2015 8:20 pm
LUTs and assets are data, so they'd be outside that 32KB limit. You might want to avoid paging in a LUT that's used a lot, unless it turns out to be huge. A bankswitch is fairly cheap if you don't need to restore the previous bank.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Tue Oct 06, 2015 7:52 am
Maxim wrote
LUTs and assets are data, so they'd be outside that 32KB limit.


I just meant to say that in that 32KB ROM you won't page, you could also place LUTs and even some asset, if there's available space. Of course they're data, not code, but I never meant to say so :)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Tue Oct 06, 2015 8:05 am
What I meant was, if you're paging code (apart from music engines and credits, perhaps) then you either have a huge amount of code, or you're not managing the placement very well.

I like to pack into the smallest ROM possible (although for Everdrive compatibility you should go for a multiple of 64KB). Superfree sections help but if you have a large first slot then they can't go there; so use all 16KB slots if that's useful. It's also wasteful to page banks 0-1 into slot 2, so you can use a macro to wrap a check.

In reality, there's no real need to optimise for size...
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Tue Oct 06, 2015 8:32 am
I personally would avoid paging code, it makes everything much more complex... and since there's no real need to optimize for size, I still believe the best approach is to have up to 32KB available for code (should be always enough!) and n*16KB banks according to needs.

But I would anyway place LUTs with code (at least the very general purpose ones, for instance those used for divides and modulus) - again it means less burden. And when you're approaching completion, if you realize there's a bunch of KB free in your 32KB space, you can move some assets there.

That's what I did, in something you'll hopefully see soon :)
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Tue Oct 06, 2015 1:19 pm
How do I change this:

.rombankmap
bankstotal 1
banksize $c000 ; 48KB
banks 1
.endro

to 32k instead of 48k?
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Tue Oct 06, 2015 1:23 pm
never mind, I figured it out, it's 8000.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Tue Oct 06, 2015 4:04 pm
Last edited by Maxim on Wed Oct 07, 2015 8:52 am; edited 1 time in total
You should be able to write $8000 as 32 * 1024 if you prefer. There's no need to use hex unless you want to, and WLA DX (mostly) allows you to also use arithmetic wherever a number would go.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Wed Oct 07, 2015 8:17 am
Last edited by sverx on Wed Oct 07, 2015 11:01 am; edited 1 time in total
*useless post removed-please delete me*
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Wed Oct 07, 2015 8:53 am
Whoops :) Corrected in my post.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Sun Oct 11, 2015 9:56 pm
I just tried this on a real Game Gear. The sound works, but the graphics are all messed up. The colors are all wrong. Mr. Ultra should be wearing a red shirt, not yellow, and the white mountaintop on level 2 isn't showing up, and it's really disappointing. Is there a way to fix this?
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Mon Oct 12, 2015 3:05 am
I checked the header and it says it's an $4 (SMS Export.) How do I change this to $7 (GG International)?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Mon Oct 12, 2015 7:24 am
WLA DX doesn't support it right now. You don't really need it. It would probably be easy to add it though.

You can hex edit the ROM, look for the byte at address $7fff, it's probably $4c which you can change to $7c.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Mon Oct 12, 2015 8:58 am
Gamegearguy wrote
I just tried this on a real Game Gear. The sound works, but the graphics are all messed up.


Are you using an EverDrive-GG? I guess you have to rename your file extension to .gg or it may run in SMS mode...
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Mon Oct 12, 2015 9:45 am
I tried both those things and it still won't display the right graphics.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Mon Oct 12, 2015 1:04 pm
mmm... is it affecting colors only or you get corrupted images too?
  View user's profile Send private message Visit poster's website
  • Joined: 26 Jan 2014
  • Posts: 344
Reply with quote
Post Posted: Mon Oct 12, 2015 1:05 pm
Must be something in your code. When I convert the palette of the game to make it work on Master System, I also have wrong color.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Mon Oct 12, 2015 11:34 pm
Can someone look through my code and perhaps tell me what I'm doing wrong? A link to it is in post #1.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Tue Oct 13, 2015 8:04 am
I gave a look yesterday and couldn't find any bug (which doesn't mean there's no bug, anyway...). The matter is: if it's running correctly on emulator(s) [did you try Emulicious and MEKA?] and it's not running correctly on hardware then you may be writing 'too fast' to VRAM, even if in your code it seems to me it isn't so.
Again, is it affecting colors only or you get corrupted images too? And did you try your EverDrive-GG with some other demo/homebrew to ensure it's working flawlessly?
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Tue Oct 13, 2015 9:36 am
I haven't tested any other homebrews yet.
The game's title screen is all one color, his shirt is yellow, not red, and the words "mr. ultra" are all messed up. Or at least I think they are, I can't see them very well.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Tue Oct 13, 2015 9:40 am
Gamegearguy wrote
I haven't tested any other homebrews yet.

Please, do so. You might want to identify problems with your EverDrive ASAP, if that's the case.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Tue Oct 13, 2015 9:48 am
Both Fire Track and GG Nibbles will not work. I can't get past the Fire Track title screen, and GG Nibbles is too faint to play. However, Sonic Drive 2 works just fine.
  View user's profile Send private message Visit poster's website
  • Joined: 14 Apr 2013
  • Posts: 385
Reply with quote
Post Posted: Tue Oct 13, 2015 4:14 pm
sverx wrote
Gamegearguy wrote
I just tried this on a real Game Gear. The sound works, but the graphics are all messed up.


Are you using an EverDrive-GG? I guess you have to rename your file extension to .gg or it may run in SMS mode...

Why didn't you suggest to test the rom as SMS rom in an emulator? From his description it looks exactly as the outcome of running the game as an SMS rom.

Gamegearguy wrote
I haven't tested any other homebrews yet.
The game's title screen is all one color, his shirt is yellow, not red, and the words "mr. ultra" are all messed up. Or at least I think they are, I can't see them very well.

Does the attachment show what you're seeing?
mrultra-sms.png (4.23 KB)
mrultra-sms.png

  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Tue Oct 13, 2015 8:51 pm
Calindro wrote
Why didn't you suggest to test the rom as SMS rom in an emulator? From his description it looks exactly as the outcome of running the game as an SMS rom.


Because I tested the rom myself on emulators and it was running in GG mode, so it sounds like a problem with his everdrive :|
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Tue Oct 13, 2015 9:11 pm
Calindro wrote

Does the attachment show what you're seeing?

Yep, that's what it's displaying.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Mon Oct 19, 2015 4:33 am
For anyone who is trying to play my homebrew or any other homebrew Game Gear game, a guy from the Everdrive forums called "Overkill" had this to say:
"My guess is that your ROM filename is an 8.3 filename (up to 8 characters filename, 3 characters extension, no mixed-case) instead of a long filename.

I reported this bug a few months ago but never received a reply: http://krikzz.com/forum/index.php?topic=3230.0 -- and I'm guessing the random incompatiblities ("some GG games are booting as SMS") that other people are reporting for commercial games is the same issue.

I personally lost a lot of time trying to identify why the Everdrive GG was detecting some ROMs as Game Gear and others as SMS, and it turns out it's a bug related to the short filenames. I think what happens is that because FAT32 8.3 filenames ignore case, and store their names in upper-case ASCII, they end up having an extension of ".GG" instead of ".gg" and failing the extension checking that occurs when booting a ROM from the everdrive. You can see if a ROM is a short 8.3 filename or long filename in the Everdrive menu, because the short names will always be displayed in upper-case (even if they show as lowercase when mounting the SD card on a PC) and they won't display the . between the filename and its extension. Meanwhile, long filenames preserve case and show the extension separator.

The workaround for this is to rename "tinyname.gg" to "Really Long Filename.gg". I've tested this on personal homebrews, as well as various SMSpower ROMs and can confirm this works. I really wish this would get fixed soon!"

I renamed it mrultramrultramrultra.gg and it works perfectly. You might want to post this info somewhere.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Mon Oct 19, 2015 7:42 am
I'd have thought a mixed case filename would do the trick too.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Mon Oct 19, 2015 8:20 am
Gamegearguy wrote
[...] it turns out it's a bug related to the short filenames. I think what happens is that because FAT32 8.3 filenames ignore case, and store their names in upper-case ASCII, they end up having an extension of ".GG" instead of ".gg" and failing the extension checking that occurs when booting a ROM from the everdrive.


if the 'firmware' was open, we could fix that ourselves... :|
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Mon Oct 19, 2015 8:46 am
The source was released to an earlier version, before fat32 support. Its system detection was different (and kind of worse), but you could build a replacement from it. Licencing might be dubious though. http://www.smspower.org/forums/13347-MasterEverdriveSources
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Mon Oct 19, 2015 11:20 am
There's a code that checks both SEGA header region code and 'TMR' signature to see if it should start in SMS mode...
if (system < 5)r_start_cfg |= 1 << _CFG_SMS_MODE;
if (hd_ptr[0] != 'T' || hd_ptr[1] != 'M' || hd_ptr[2] != 'R')r_start_cfg |= 1 << _CFG_SMS_MODE;

('TMR' is required or it will run in SMS mode, region code should be $50 or more or, again, it will run in SMS mode)

There's no check of file extension. It probably has changed in more recent versions?
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Tue Oct 20, 2015 5:37 am
The version I got working on a Game Gear had the region code of a SMS one ($4). I wonder why this is and yet works on a Game Gear. I guess it's because it has TMR in it?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Tue Oct 20, 2015 7:37 am
I suspect the newer "os" uses the extension instead, for better compatibility with homebrew.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Tue Oct 20, 2015 8:44 am
I think I may have to go 64k on this. I have a few questions:
#1 - Can you set some includefiles in both banks, like suppose I want to have a few includes in bank 0 and some more in bank 1. Is this OK? Would I put the include files at the end of bank 0 before I start bank 1?
#2 - How would I bankswitch between banks, like suppose level 5 is in bank 0 and level 6 is in bank 1. Is it fairly easy to switch between banks 0 and 1 once level 5 is over?
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 1607
Reply with quote
Post Posted: Tue Oct 20, 2015 10:50 am
If you go 64 KB you'll have 4 16 KB banks. I would suggest you to keep your code in bank 0 (and 1 eventually) and your assets (graphics, music, sfx, etc) in the remaining banks (1),2,3 ... and do bank-switching on 'slot 2' only, which is the easier approach I could think.
So:
- bank 0 will always be in slot 0 (your code)
- bank 1 will always be in slot 1 (other code, assets you don't want to page out, etc...)
- banks 2-n will be mapped into slot 2 when needed, simply writing the needed bank number to memory location $FFFF (that's the minimalistic 'SEGA mapper').

ld a,#bank_you_need_to_map
ld ($ffff),a
  View user's profile Send private message Visit poster's website
  • Joined: 06 Sep 2015
  • Posts: 140
  • Location: United States
Reply with quote
Post Posted: Tue Oct 20, 2015 8:31 pm
How easy is it to hop to different banks if I want to split up the in-game code and put it in two different banks? Is there an example on how to bankswitch anywhere?
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 11556
  • Location: London
Reply with quote
Post Posted: Tue Oct 20, 2015 9:00 pm
Life's a lot easier if you don't page out code. Just keep code and data separate, and use the top 16KB to access data.

You page by writing the bank number to $ffff. Assuming you have configured the ROM bank map for WLA DX sensibly, you can put a colon before a label to retrieve its bank number at compile time, so you just select the bank before using the label to access the data.

If you must page code, you need to change the page from a safe location that won't be affected by the paging, either in another slot, low ROM or RAM.
  View user's profile Send private message Visit poster's website
Reply to topic Goto page 1, 2  Next



Back to the top of this page

Back to SMS Power!