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 - Bank switching with devkitSMS

Reply to topic
Author Message
  • Joined: 06 Aug 2021
  • Posts: 49
Reply with quote
Bank switching with devkitSMS
Post Posted: Wed Oct 20, 2021 8:44 pm
Hey, I've been working on a project in devkitSMS, and I need to start using bank switching. I've looked over the resources on the git, but when I run my build.bat it doesn't work. The last working batch file I had looked like this:


@echo off

REM Here we have assets for everything up to the title screen
assets2banks ..\gfx

sdcc -c -mz80 bank2.c

sdcc -c -mz80 main.c

sdcc -o output.ihx -mz80 --data-loc 0xC000 --no-std-crt0 ..\crt0\crt0_sms.rel main.rel ..\lib\SMSlib.lib bank2.rel

..\utl\ihx2sms output.ihx output.sms


What do I need to change in order to have more banks for graphics?

I also tried using folder2c, but when I do, it keeps creating .c files of size 0 without any assets.

Any help is much appreciated!
  View user's profile Send private message
  • Joined: 16 May 2002
  • Posts: 1355
  • Location: italy
Reply with quote
Post Posted: Thu Oct 21, 2021 7:36 am
Did you try reading this?
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3758
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Thu Oct 21, 2021 7:39 am
Last edited by sverx on Fri Oct 22, 2021 6:56 am; edited 1 time in total
assets2banks will create as many bankN.c files as needed, so you just compile them declaring them as data banks
sdcc -c -mz80 --constseg BANK2 bank2.c
sdcc -c -mz80 --constseg BANK3 bank3.c


then in the linking phase you need to add a switch to tell the linker that the data should go at address 0x8000 and this means for instance adding
-Wl-b_BANK2=0x8000 -Wl-b_BANK3=0x8000
when you have bank2 and bank3

to access the data in the banks, you need to use the
SMS_mapROMBank(n)
macro

check this section: https://github.com/sverx/devkitSMS#how-to-use-more-than-48kib-in-your-rom-rom-pa... for a complete explanation

edit: also, you don't need bank switching if your ROM is 48 KB, but you need it to go over that.
  View user's profile Send private message Visit poster's website
  • Joined: 06 Aug 2021
  • Posts: 49
Reply with quote
Post Posted: Thu Oct 21, 2021 12:32 pm
Tom wrote
Did you try reading this?


No I hadn't! This is incredibly valuable! I was able to get it working with this and sverx's advice on this thread! Thank you so much!
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!