Shop OBEX P1 Docs P2 Docs Learn Events
Gameboy on prop idea — Parallax Forums

Gameboy on prop idea

jaegjaeg Posts: 156
edited 2010-10-01 08:26 in Propeller 1
CPU: 8-bit custom Sharp microprocessor running at 4.19 MHz. Similar to the 8080 with some of the z80s instructions
RAM - 8kb Internal sram
Video RAM - 8kb
ROM - On-CPU 256-byte bootstrap; 256 kb, 512 kb, 1 Mb, 2 Mb, 4 Mb and 8 Mb cartridges

So I tend to have random ideas and this was one of them. With the exception of cartridge sizes I think the propeller could pull this off assuming the emulation of the instruction set can be pulled off with less than 16kb.

I'm going to assume that the data on the cartridges is only pulled off when it's needed because of the 8kb ram limit. My idea is to put the roms on an SD card and just pull the data as needed. The graphics can't be too big since they are only 2bit and only 4 shades of grey.

What do you guys think? I was thinking of trying something like this on my gadgetgangster board with the touch screen. Have on screen controls since there is only a handful of buttons needed. It would make for a cool time waster I think.

EDIT - I did some more looking and it's been done with the arduino so I'm positive it can be done with the Prop.
http://technabob.com/blog/2008/10/27/arduino-gamepack-make-your-own-open-source-gameboy/

Comments

  • trodosstrodoss Posts: 577
    edited 2010-09-30 09:52
    jaeg,

    The NES (6502-based) has been successfully emulated before (see: http://forums.parallax.com/showthread.php?t=119075), so it probably could be done.

    Heater's ZiCog (http://forums.parallax.com/showthread.php?p=788511) would be useful.

    There were a few other threads discussing the Gameboy here:
    http://forums.parallax.com/showthread.php?t=119839
    http://forums.parallax.com/showthread.php?t=111208

    jaeg wrote: »
    EDIT - I did some more looking and it's been done with the arduino so I'm positive it can be done with the Prop.
    http://technabob.com/blog/2008/10/27/arduino-gamepack-make-your-own-open-source-gameboy/

    As far as I can tell the arduino GamePak kit doesn't look like it is a Gameboy emulation. However if you did want to make a Gameboy-like system, that is certianly a good way of doing it.
  • Heater.Heater. Posts: 21,230
    edited 2010-09-30 10:50
    No idea about the GameBoy but Z80 and 8080 are already done on the Prop.

    ZiCog is my Z80 that runs CP/M 2 as linked above.

    User PullMoll has an even more advanced version that runs MP/M and has been used for Sinclair ZX81 and Spectrum emulators I believe. See here:

    http://forums.parallax.com/showthread.php?t=121579&highlight=shot
  • jaegjaeg Posts: 156
    edited 2010-09-30 16:25
    Ok, thanks guys/gals.

    I was wrong about the RAM. Some cartridges expand the RAM available to the unit so it would require some extra ram to work. So this might require more hardware than I thought at first. Same thing goes for the NES were the cartridge can add RAM.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-09-30 19:53
    We pondered this a few months back but since then there are more emulations and I think the hardware is already done - dracblade or cluos's triblade. We have 512k of ram and also a gigabyte or more on an sd card, so you could easily put every cartridge ever sold on one sd card. The software would need a handful of extra Z80 instructions coded - I think there are about 10 that are unique to the gameboy. Someone needs to code those unique instructions and then add in the display driver (probably use pullmoll's color genie driver) Not impossible by any means - probably about a week of coding. Coding in LMM is a bit tricky - every time you add a new Z80 instruction you need to change the PASM LMM code in about 4 places.
  • jaegjaeg Posts: 156
    edited 2010-09-30 20:24
    I might hold this idea off until I'm more experienced with the Propeller. I've had several interesting ideas lately that I've been writing down. I'm better with software than I am with hardware so my ideas include a simple Windows 1.0 style interface to play around with the touch screen of the board I'm getting. Another is a virtual pet type thing. I also want to make a bunch of Game and Watch style games.
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-09-30 20:39
    Ultimately this would be great to emulate too on the prop. Last week I discovered my kids Gameboy when moving. Normally I would have thrown it, but I kept it with an emulation in mind. No time for now thought - but for later - definately worth a look.
  • jaegjaeg Posts: 156
    edited 2010-09-30 20:53
    Yes I agree. We have the hardware just have to put our minds to it and get it to work. This is definitely on my list of things to do along with a couple of other system emulators. I think Game & Watch game would be easy. They are pretty simple. I'm not sure if they would be considered emulation rather than remakes. Wow I'm getting off subject. Sorry I do that a lot lol
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-09-30 21:04
    If you get CP/M working on a board then it makes debugging a lot easier. You can feed data into new instructions and see if they work properly. Easier to debug one new instruction at a time. From a quick look at the code I think the hard parts will be those new instructions and the display driver. For starters, this is what needs to be added: http://www.z80.info/z80gboy.txt You will save some space as there is an entire table of DD and FD opcodes that are not needed.
  • Heater.Heater. Posts: 21,230
    edited 2010-09-30 21:37
    This discussion sounds awfully familiar.

    Didn't someone already start a GameBoy emulation project?
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-09-30 22:07
    I don't recall the discussion getting to the point of emulating those specific opcodes. One problem we were all running up against until a few months ago was running out of cog space for opcode emulation. Pullmoll's LMM emulation solves that, so now it will be a lot simpler, as you can take the existing code for a similar instruction, and add a new instruction in LMM.
  • Heater.Heater. Posts: 21,230
    edited 2010-09-30 22:11
    Strangely enough my latest version of ZiCog uses LMM as well:)

    Where is PullMoll he's been very quite recently?
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-09-30 22:43
    Excellent, so you could add those opcodes in your code too?

    I do suspect it would be a net saving in memory given all the Z80 codes not used.

    I think pullmoll has been doing some paid work. Hopefully not taking too much time away from the propeller - his input here would be most appreciated.
  • Heater.Heater. Posts: 21,230
    edited 2010-09-30 22:50
    That's the plan. I keep meaning to get back to it. As you know ZiCog is very close to having all documented ops working.

    Also I want to make a ZiCog that uses Bill's VM Cog for external memory so that it will run on any platform that is supported by VmCog. Will be slower but at least pretty much anyone could run it.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-10-01 08:26
    Going into the detail of the instructions, there are a number in the Gameboy opcodes that do nothing. So we could just leave the things as they are in the qZ80/Zicog code.

    Of the ones that are different, take as an example
                   Z80           Gameboy
    22         LD (word),HL   LD (HLI),A       Save A at (HL) and increment HL
    
    from the qZ80
    		{22}	long	imm16_to_ea	| hl_to_alu        << 9	| wr_word_ea  
    
    so instead that is going to be the same as LD (HL),A which happens to be opcode 77, and then INC HL which is opcode 23.

    Looking at the Gameboy opcodes, I think there are a number of examples where we don't actually need any new opcode emulation, but rather, a different combination of existing opcodes. So that ought to make coding those handful of unique codes a lot easier.

    With BST maybe we could add an #ifdef for Gameboy and put some #ifdefs around those handful of opcodes?
Sign In or Register to comment.