Banner
Views: 705,699,829
Time:
6 users online: Eminus, Gloomy, kiki79250, LHB, NGB, reggen57 - Guests: 32 - Bots: 135Users: 36,868 (1,443 active)
Latest: TheReborn
Tip: When determining a time limit, remember that players won't be as familiar with the level as you are. If you normally complete the level with the timer around 100, others might run out of time on their first try.Not logged in.
Super Chip8x - A Chip-8 Emulator for the SNES
Forum Index - Sunken Ghost Ship - C3 Museum - Winter 2018 - Super Chip8x - A Chip-8 Emulator for the SNES
Pages: « 1 »
yo dawg i heard you like emulation so i put an emulator in your emulator so you can emulate while you emulate

title screen

++~~**//PROJECT PAGE\\**~~++
++~~**//ROM DOWNLOAD\\**~~++ hardware controller bug fixed
Quick control overview:
Start to go forward a ROM
Select to go backwards a ROM
I manually gave each ROM a custom control layout which hopefully is intuitive (as the system officially contains 16 keys).

What on earth is this?


The "Super Chip8x" (name subject to change?) is an emulator for the Chip-8 written for the SNES as a homebrew ROM. It's capable of emulating all (regular) chip-8 ROMs including sound.

The chip-8 ROMs are included within the homebrew ROM as the system isn't really copyrighted or proprietary. None of the ROMs are written by me.

What is the chip-8?
In very simple terms, it's a virtual system which uses a 64x32 screen to display stuff. The system actually doesn't physically exist, but the specifications are simple and adequate enough for emulation. It's like the "hello world!" of programming. I referred to this document for the technical specifications.

How are its memory and opcodes?
The memory is a feeble 0x1000 bytes, 0x200 of which is "reserved for the interpreter". In modern emulation, it contains the 0-9A-F characters at offset 0.

It may be a feeble 0x1000 bytes, but it's more than enough room for the chip-8. Each opcode (including its parameter) is two bytes, and sprites are at least 1 byte, at most 15 bytes - each byte is one row of pixels of the sprite drawn.

How do the display and sprites work?
The system isn't tile-based. It doesn't tell the screen to "draw a tile at X Y with graphics Z" or whatever, rather, it's pure coordinate-based pixel drawing. The screen is one big tile, if you will.

The pixels that are drawn on the screen are "sprites". Sprites are 8 tiles wide and 1-15 tiles high and can be drawn anywhere on the screen. There's no actual memory which keeps track of sprites.

The pixels only have two colors, "on" and "off" for simplicity's sake. The system XORs pixels to the screen i.e. if you write a pixel to a coordinate which contains a pixel already, the existing pixel gets un-drawn. This sets the collision flag. Thus, this is how the system also checks for collisions between sprites.

This means that if you want a 'moving' sprite, you'll first have to undraw the existing sprite (by drawing over the exact copy of the sprite over the existing sprite), increase some value in the RAM, then draw the sprite on the screen again. This is what causes the flickering of moving sprites.

What is its clock speed?
There is no defined speed, so it is up to the author of the emulator to define one. 10 opcodes per frame is the sweet spot for me.

Here are some more screenshots:

Tetris (good ol' Tetris)

Pong (good ol' Pong)

Blinky (good ol' Pacman)

Kaleid (Kaleidoscopes are pretty cool)

Bricks (brick breaker stuff)

There are more ROMs, some of which are debug ROMs (such as keypad, RNG and BCD testing).

Bugs


The "VBRIX" game sometimes doesn't spawn the ball and I absolutely have no idea why. It's seemingly random. The VBRIX ROM itself might need debugging.

The "RUSH HOUR" game seems to have trouble handling two button presses at the same time. You need to press a button and use the D pad to move blocks, but you can't seem to do that on my emulator. It's weird because I don't think the system is supposed to keep track of multiple button presses to begin with, but I could be wrong, in which case I'll have to rewrite the entire controller subroutines just to make this game work _

Notable difficulties


The screen setup
I was really worried about how I would present a 64x32 screen on the SNES, until p4plus2 mentioned I could use mode 7 and scale the screen 2x. I thought it was a pretty damn good idea.

DrawPixel subroutine
I spent an entire day trying to this one out. Once I started to draw squares/a grid on my whiteboard it finally hit me: My math should be made from two portions: one which selects the SNES tile number, and one which selects the pixel within that tile.

One opcode behaving weird until I looked closer
Don't forget your RTS and RTL, people.

The entire project
I'm surprised I got this far to begin with. I've never completely finished a SNES homebrew ROM before. I guess I can cross this off on my bucket list now.

Closing thoughts


I originally was looking into emulation in general because I had a certain SNES project in mind (which you'll probably see some other C3?). Google Now suggested me a certain chip-8 article which sparked my interest and I got sidetracked from there thinking "hey, this system could very well be emulated on the SNES!". I finished this in less than a month.

I did have to reference the source code of other emulators in the beginning but it was a learning process to begin with. I also had to borrow 2-3 routines from SMW which I think is pretty funny.

All in all, being able to legitimately write the words "written entirely in the 65c816 assembly language" makes me proud as a programmer.
My blog. I could post stuff now and then
Layout by Counterfeit.
Oh my !!

Excellent job for you!

I can play for many hours
looks very interesting #tb{:D}

if i have time ill look into that controller issue

--------------------
僕の日本語を失礼します。
This is really cute!
wow, this is actually really cool. something never really seen before.

i myself don't know the ins and outs of snes hardware (atleast, not yet ;D), but i DO have a snes flashcart, so feel free to dm me on discord if you need anything tested.

--------------------
[Twitter]
yeah controls are completely borked on hardware. can barely change games

i assembled with this in controller update:

Code
ControllerUpdate:
		LSR $4212
		BCS ControllerUpdate
		LDA $4218


and it seems to work now (so that was the issue; controller update ran before automatic read was finished)

with the above i get these results on the controller test:

Up: 2
Dw: 8
Lf: 4
Rt: 6

A: C
B: 3
X: 2
Y: 1

LA: D
LB: 6
LX: 5
LY: 4

RA: E
RB: 9
RX: 8
RY: 7

LRA: F
LRB: B
LRX: 0
LRY: A


edit: also i guess the controls are a bit sensitive? not all games though. like in the card flipping/matching one its hard to pick a card in the middle because the selector goes all the way in the direction you pressed; you have to p much press in one frame. there was another game where holding/pressing left or right would make the thingy zoom across the bottom. im unsure whether these are issues with the games themselves or with your controller handler

--------------------
僕の日本語を失礼します。
It's perfect!

Only left 'til Christmas!
Something that you SHOULD even try: Thin Tofu Brownies.
Next thing ya know, they'll be saying I've gone soft. Morph, knock it off.
RIP, Stan Lee (1922 - 2018).
This is really incredibly sweet, actually!
When you said 800 bytes of memory, I thought you meant RAM at first but that seems to actually be ROM so how much RAM does this have?
Oh, I was unclear with that.

The memory is shared by both ROM and RAM. I guess it's technically possible to make a program write to the ROM but this has little to no use.

@ Ladida that's the intended behavior. I didn't know it was such a simple fix. Thank you a lot!

Quote
edit: also i guess the controls are a bit sensitive? not all games though. like in the card flipping/matching one its hard to pick a card in the middle because the selector goes all the way in the direction you pressed; you have to p much press in one frame. there was another game where holding/pressing left or right would make the thingy zoom across the bottom. im unsure whether these are issues with the games themselves or with your controller handler

It feels like that, but I guess it's just hardware limitations or bad programming. On PC emulators you don't notice it much because because of that one Windows feature - when you hold down a key, there's a delay after the first keypress until it starts rapidly repeating. But on SNES you don't have that so everything repeats every frame. This is incredibly noticeable in the Connect 4 game lmao

It used to be even more sensitive because it used to poll for input every frame rather than when an input-related opcode was executed. I'd say the controls are pretty accurate now.
My blog. I could post stuff now and then
Layout by Counterfeit.
This is cool

--------------------

NoALT



Captain Toad is returning to your SNES.
My first completed SMB 1 hack is finished.
Uncle Mario Bros.
Haha, a quick google search shows that I wasn't the first one who came up with this idea. Too bad all the links in that thread are broken.

Guess I basically revived a ~3 year old idea without even being aware of it!
My blog. I could post stuff now and then
Layout by Counterfeit.
The whole chip 8 games. Hmmm I swear I've seen something like this before. Maybe it was something very similar and this is different, but the concept was the same the chip 8 games are very small and basic games.

So basically what you did was allow these other games from another platform to run on the SNES via an emulator.

So the emulator was coded for the SNES and it plays these chip 8 games.

Okay great, wonderful... so how do I play these on my real snes? I have a flashcart. Just need to know the procedure.

[edit]

okay i actually found the thing that i was looking for. i originally thought you did an emulator for pico-8.

https://www.lexaloffle.com/pico-8.php
Pages: « 1 »
Forum Index - Sunken Ghost Ship - C3 Museum - Winter 2018 - Super Chip8x - A Chip-8 Emulator for the SNES

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2018 - SMW Central
Legal Information - Privacy Policy - Link To Us


Total queries: 24

Menu

Follow Us On

  • Facebook
  • Twitter
  • YouTube

Affiliates

  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • ROMhacking.net
  • MFGG
  • Gaming Reinvented