• Advertisement
Sign in to follow this  
  • entries
    177
  • comments
    531
  • views
    163906

mmmmmm 2-bit greyscale

Sign in to follow this  

157 views





That's right. I've started working on LittleBoy, the GameBoy/GB Colour emulator to go along with FatMan. FatMan is hardly a dead project, I just got bored working on the same thing for so long.

The screenshots above are from memory dumps, not cartridge ROMS. I'm still working on the Z80(actually Sharp80) core and I can't even start to try stuff out before it's done. As you can see the tile render function works, but the palettes are exactly right(kirbies should be lighter). The tool dialogs have FatMan have been imported and operate in almost the same way except the addresses have changed.

[cool]
Sign in to follow this  


4 Comments


Recommended Comments

Wow that was fast [smile]

The system itself is very simplistic, but still it takes a lot of patience to make an emulator. Building the CPU core takes a long time and even when it's "done", the chances of it working right are pretty slim.

I can't get that link to work, but I'd stick with the VisualBoyAdvance source anyway. It has both the GB and GBA, and is in C/C++. Thanks for trying to help though [smile]

Share this comment


Link to comment
How exactly do you load from ROMs? Do they present themselves as an extension to the available addresses in memory?

Share this comment


Link to comment
I'm not really sure what you're asking. Is it how the ROM memory works? I'll try to explain that.

The GB has 64KB of onboard memory. ROM can be 2MB in size and external RAM can be 128KB, both are located in the cartridge.

unsigned char *Memory[0x10];
unsigned char ROM[0x200000];
unsigned char RAM[0x20000];

The GB has 2 ROM banks, 16KB each in size, at 0x0000-0x7FFF. The first ROM bank is always bank 0(0x0000-0x3FFF of the ROM). On startup the second bank is set to ROM bank 1(0x4000-0x7FFF of the ROM, this can never be bank 0).

The GB has one 8KB RAM bank at 0xA000. At startup this is set to bank 0(0x0000-0x1FFF of external RAM).

So when I load a ROM(or memory dump):

Read each byte of the ROM file into ROM;
clear RAM;
Memory[0x0]=&ROM[0x0];
Memory[0x1]=&ROM[0x1000];
Memory[0x2]=&ROM[0x2000];
Memory[0x3]=&ROM[0x3000];
Memory[0x4]=&ROM[0x4000];
Memory[0x5]=&ROM[0x5000];
Memory[0x6]=&ROM[0x6000];
Memory[0x7]=&ROM[0x7000];
Memory[0xA]=&RAM[0x0];
Memory[0xB]=&RAM[0x1000];

To change the ROM bank(in say mapper #1) one must write a byte between 0x2000 and 0x3FFF. The lower 5 bits of that byte become the new address for bank 2(0x4000-0x7FFF).

RomBank=Value&0x1F;
if(RomBank==0){RomBank++;}
RomBank<<=14;
Memory[0x4]=&ROM[RomBank];
Memory[0x5]=&ROM[RomBank+0x1000];
Memory[0x6]=&ROM[RomBank+0x2000];
Memory[0x7]=&ROM[RomBank+0x3000];

It works in a somewhat similar fashiion for RAM switching. Basically to access the mappers and change banks, a byte with the right information is written to the onboard read-only memory at 0x0000-0x7FFF.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement