Log In  


New games:

Cart #14478 | 2015-09-22 | Code ▽ | Embed ▽ | No License
19


Cart #14477 | 2015-09-21 | Code ▽ | Embed ▽ | No License
19

Games:

Cart #14411 | 2015-09-20 | Code ▽ | Embed ▽ | No License
19


Cart #14384 | 2015-09-20 | Code ▽ | Embed ▽ | No License
19


Cart #14387 | 2015-09-20 | Code ▽ | Embed ▽ | No License
19

Demos:

Cart #14479 | 2015-09-22 | Code ▽ | Embed ▽ | No License
19

I am back with new experiment - real emulator of my second favorite retro platform for my first favorite retro platform :)

You can show virtual keypad by pressing B on P2 controller, then use P2 arrows and A button to press keys.

Emulator is preloaded with those games:

  • Rush Hour by Hap
  • Astro Dodge (hi-res)
  • Worm V4 (hi-res)
  • Space Invaders by David Winter
  • Tetris.
  • TRIP8 hi-res demo

Rush Hour controls:

  • ARROWS - movement
  • Z - select
    Only code I found: 4A10 :D

Worm V4 controls:

  • ARROWS - movement
  • Z - reset

Astro Doge controls:

  • ARROWS - movement
  • Z - start

Space Invaders controls:

  • LEFT/RIGHT - movement
  • Z - shoot

Tetris controls:

  • LEFT/RIGHT - move
  • UP - rotate
  • DOWN - drop

Some technical details:

  • emulator runs at 1500 cycles per second (successfully tested at 3000 cycles per second)
  • timers are set correctly to 60Hz
  • game rom is stored as map data (currently 1 game per pico rom)
  • screen is stored directly in spritesheet
  • pico keys are custom-mapped to chip8 keys
  • cpu specification: 35 opcodes, 16 8-bit registers, 64x32 b/w screen, 4k rom/ram

Changelog:

1.5

  • fixed sprite drawing
  • added emulator restart button (for games that end in loop or halt)
    1.4
  • fixed clear screen routine
  • added support for hi-res mode
    1.3
  • fixed key handling
  • added full chip8 keypad (p2 controller)
    1.2
  • fixed font sprite location to reflect emulator's default font position in memory
    1.1
  • simple debugger mode easily switchable by variables
  • wait for key-press fixed
  • beep fixed
  • shl and shr instructions fixed

If anyone want to take a look and play, please use RUSH-HOUR rom. Many bugs I found are fixed there ;)

19


I swear to god, if this is real, I am going to have a screeching session. AKA 'WEEEE!".

This is purely amazing.
I understand that PICO-8 is running Lua code, but that's like the NES running Atari 2600 games!


Thanks, it's still not perfect, most problematic thing is that pico uses only 16-bit signed numbers, but chip8 need unsigned ones. I don't know yet what will happen when rom try to work with 16-bit register, but it seems to work on games I tried. Later I will release utility that will compile chip8 rom into pico cartridge, so you can easily add your favorite games.

If you really want to add your games, download first version of this utility that I used. You will have to manually copy map data into .p8 file.


Very impressive! I was thinking about porting my GB/GBC emulator to pico8 at some point, but figured that there's not enough code space and that even with compression it would only be able to run single bank roms.

I like dark blue as black, adds a little character to it. :P


This is the first time I hear about CHIP-8. Could you share some good programming tutorials for it and link to some good devtools/emulators? Would love to play with it.


Chip-8 is pretty limited (4k of rom/ram, 35 opcodes, etc.) so don't expect any high-level language to work with. There is assembler available or you can use any hex editor to create your programs. Try to google for some tutorials or you can jump straight in using Opcode table and emulator.


Added virtual keypad :D Use B on P2 controller to show it. Available only on 1.3 and never roms.


Dude, wow. I don't even know what CHIP-8 is, so I'd happily ingest some info on that if you'd want to present some, but even without knowing what it is, playing even more restrictive games on an already very restrictive console is all kinds of cool.


Nice! I think rush-hour is the best CHIP-8 game, maybe this will inspire me to pick my C++ CHIP-8 emu back up.


For those who want to try create something for CHIP-8, I have created simple demo with commented source code.

Cart #14497 | 2015-09-22 | Code ▽ | Embed ▽ | No License

You can compile it using chipper:
source code
win64 binary


Can you do Blinky?


AfBu - your intro animation on your carts is so fantastic!


Your function HEX could be updated to smaller code:

function newhex(o)
local p=5
  if (o<=15) p=6
  return sub(tostr(o,1),p,6)
end

Here is your current code:

function hex(o)
    local hs,h,l = {0,1,2,3,4,5,6,7,8,9,"a","b","c","d","e","f"}

    o = byte(o)

    if (o <= 15)    return hs[o+1]

    h = shr(band(o,0xf0),4)
    l = band(o,0x0f)

    return hs[h+1]..hs[l+1]
end

 function byte(n)
    while (n>255) do
        n -= 256
    end
    while (n<0) do
        n += 256
    end
    return n
end

BTW, how do I see the sourcecode for the game ? I know you stored it in maps, but viewing maps does not reveal the sprite # beneath. Wouldn't it be easier to code instead as a hex-string or something ?


1

Well, since this thread has been bumped anyway, I'll take this opportunity to plug Octo, a high-level language and IDE that allows you to program CHIP-8 games with a modern toolset. @darkhog, you're probably not very active here on the BBS anymore, but Octo is definitely what you want. It offers many nifty assembling directives that Chipper et al don't give you.

I'll also let everyone know that the sixth annual Octojam is currently going through October. It's a CHIP-8 game jam! I already made a game, it was very fun!

I hope someone will check out CHIP-8, it's very neat and even more restricted than PICO-8.

@dw817: I'm pretty sure the map data is the source code itself, ie. it's the bytecode. If you open one of the carts in eg. Notepad, you'll see the instructions right there. First are the 0x1FF (511) bytes that were traditionally reserved for the CHIP-8 interpreter, which are all 0, except for the hard-coded sprites for the hex numerals. Then the game's actual instructions start at byte number 0x200.


I could just barely do 6502 assembly years ago so I suspect I'm not going to be very good at this.

Now I MIGHT be able to doodle together a 4-bit fantasy processor, I still have the notes for it. But I suspect it will not be based on an actual and existing system AFAIK.


Just found your post. I just got my Chip8 emulator working in Pico-8. Can't wait to check your code out. Mine is slow so I have to re-think it. I can drag and drop .ch8 files onto it and run them. I also do code disassembly and it lets your step through code and shows register values and I am putting in code editing. But I have to get the speed going. Nice job!!!



[Please log in to post a comment]