What exactly is a slot in WLA?

Discussion of programming and development for the original Game Boy and Game Boy Color.
Post Reply
gnarlyWarlock
Posts: 18
Joined: Fri Jul 24, 2015 1:30 pm

What exactly is a slot in WLA?

Post by gnarlyWarlock »

So, I've specified that I want a pure ROM (.CARTRIDGETYPE 0), 16KB, just bank 0, and as such, in the beginning of my header I write

Code: Select all

.ROMBANKSIZE $4000 
.ROMBANKS 0
Now in the WLA documentation, it says that giving the 0 argument will force two banks, at 32KBytes (I presume it means total). HOWEVER, cartridge type ($0147) specifies 0 to be pure ROM, and $0148 specifies that the 0 argument will force each bank size to be 32KBytes (NO ROM banking...but then, how can there be no MBC when we have two banks, 0-$8000? So, what in the hell is .CARTRIDGETYPE 0? Just some nonexistent type?).

Now, outisde of my confusion, WLA doesn't even want to bother assembling. It just throws ".ROMBANKS needs a positive integer value"...So, 0 isn't even a valid value?>>!?[/strike]

P.S. A beginner question: what exactly is a SLOT? I've searched high and low and I can't find the proper explanation
Thanks
Last edited by gnarlyWarlock on Thu Aug 06, 2015 12:43 pm, edited 2 times in total.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: WLA - Pure ROM specifier in header

Post by tepples »

Does it copy the value directly into $0148, or does it take the base 2 logarithm?
gnarlyWarlock
Posts: 18
Joined: Fri Jul 24, 2015 1:30 pm

Re: WLA - Pure ROM specifier in header

Post by gnarlyWarlock »

Lol nvm, I should've read it more accurately. I realized the smallest amount of banks you can have is 2, since addresses $4000-$7FFF are always accessible, just that the MBC is used when you have more than 2 banks. Sorry about that.

But yeah, what is a SLOT, I still needa know lol

P.S. it's neither, it just does some hardcoded conversions I think, I launched bgb and it didn't throw any errors. So I assume when I specify .ROMBANKS 2 it writes a 0 to $0148
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: WLA - Pure ROM specifier in header

Post by tepples »

Google wla-dx slot returned this older topic, which defined "slot" as what the VESA spec calls a "window": part of the CPU address space through which a particular part of the ROM (a "bank") can be read.

On NES, an UNROM cartridge has 4 or 8 banks, which are mapped into two windows (or "slots") in the CPU address space. One window is $8000-$BFFF; writes to the mapper port select which bank is visible in this switchable window. The other window is $C000-$FFFF, and it is always mapped to the last bank of the ROM. MBCs on Game Boy work similarly: MBC1 has a window at $0000-$3FFF fixed to the first bank of the ROM and a switchable window at $4000-$7FFF controlled by writes to $2000.

A no-MBC cartridge (comparable to an NROM cartridge on NES) has one bank that encompasses the entire ROM, which is mapped into one window from $0000-$7FFF.
gnarlyWarlock
Posts: 18
Joined: Fri Jul 24, 2015 1:30 pm

Re: WLA - Pure ROM specifier in header

Post by gnarlyWarlock »

tepples wrote:Google wla-dx slot returned this older topic, which defined "slot" as what the VESA spec calls a "window": part of the CPU address space through which a particular part of the ROM (a "bank") can be read.

On NES, an UNROM cartridge has 4 or 8 banks, which are mapped into two windows (or "slots") in the CPU address space. One window is $8000-$BFFF; writes to the mapper port select which bank is visible in this switchable window. The other window is $C000-$FFFF, and it is always mapped to the last bank of the ROM. MBCs on Game Boy work similarly: MBC1 has a window at $0000-$3FFF fixed to the first bank of the ROM and a switchable window at $4000-$7FFF controlled by writes to $2000.

A no-MBC cartridge (comparable to an NROM cartridge on NES) has one bank that encompasses the entire ROM, which is mapped into one window from $0000-$7FFF.
Fair enough. So, slots are in essence an abstraction for the programmer? Could I specify, for example, 4 slots in bank 0, lets say a slot for bg tiles, sprites, program code, and header? I'm a bit confused, as you say that an UNROM is mapped to two windows, however, on an NROM, the window stretches across the entire ROM, so I guess the NES doesn't care about the slot sizes/locations

Are slots like sections, just to help you configure your ROM mapping the way you want it?
l0k1
Posts: 1
Joined: Fri Aug 07, 2015 9:53 am

Re: What exactly is a slot in WLA?

Post by l0k1 »

I use RGBDS, so take this answer with a grain of salt, but for GB/GBC, the "slot" would be the memory area from $0000-$3FFF, and $4000-$7FFF. It just references the addresses.

On all Gameboy cartridges, ROM bank 0 is mapped to $0000-$3FFF, and that bank is always available. You can't switch it out. The address range $4000-$7FFF is for ROM banks 1 -> xxxx, and those are switchable. The "slot" points to the address for range $0000-$3FFF and another points to $4000-$7FFF.
User avatar
nicklausw
Posts: 376
Joined: Sat Jan 03, 2015 5:58 pm
Location: ...
Contact:

Re: What exactly is a slot in WLA?

Post by nicklausw »

A slot is a location in memory. If you wanted $2000 bytes of ram at $c000, you'd make a slot with size $2000 at $c000 (obviously). So that would be:

Code: Select all

slotsize $2000
slot 0 $c000
You can also use slots for the Gameboy's two accessible banks:

Code: Select all

slotsize $4000
slot 0 $0000
slot 1 $4000
Post Reply