What's new

Chip 8

Doomulation

?????????????????????????
hap said:
Doomulation: that would be 'Field'. it, and many other games, look nicer if you implement horizontal and vertical sprite wrapping. what i mean with this is that if you'd draw a 2 by 2 square at 127,63 (bottom right), it would show as 4 pixels; one in each corner of the screen. Blitz has problems with vertical wrapping though, so i've made wrapping optional here.
Then either we are long from knowing how the real chip8 did here, or the chip8 simply did what currently our emulators does. Though I doubt that. David's (that was the authors name, right? He who wrote the chip8 doc most everyone uses... david winter I think) emulator emulates it differently from mine.
Shrug... well, I think I have near perfect emulation anyway :p
 

aprentice

Moderator
Doomulation said:
Then either we are long from knowing how the real chip8 did here, or the chip8 simply did what currently our emulators does. Though I doubt that. David's (that was the authors name, right? He who wrote the chip8 doc most everyone uses... david winter I think) emulator emulates it differently from mine.
Shrug... well, I think I have near perfect emulation anyway :p

have you tried disassembling the game and finding out for yourself how it suppose to work?
 

refraction

PCSX2 Coder
im sure its a carry flag problem or a shifting problem, had the same trouble on blinky with the ghosts not dissapearing when they should.

just try modifying how they work and see what results you get
 

Doomulation

?????????????????????????
aprentice said:
have you tried disassembling the game and finding out for yourself how it suppose to work?
No... what I find in the debugger doesn't help anymore. And it basically lists all instructions (what they do). Besides, I don't want to do reverse engineering >_< or well... ehh, finding out these things in general. You go get 'em, and i implemt 'em! :p
 

aprentice

Moderator
Decided to touch my chip8 for an hour or two, during that time i recoded the entire cpu, stole the directx code out of my gameboy emu (now it supports 16,24,32bit modes and looks cyrstal clear and hell of a lot faster), and recoded the chip8 gfx routines. This pretty much fixed all the bugs in regular chip8 games and tons of schip8 games work now, it might have a bug or two i havent found yet (if anyone is good at bug searching).

I'm releasing the source along with this picture so people can learn from it (if you steal my code don't forget to credit me, I can tell when people steal my code *wink*) :p

chip8_blinky.gif


source: http://darkengine.net/chip8/chip8src_jan24_05.zip
 

hap

New member
if i'm reading it correctly (haven't compiled/tested), your collision detection is broken. let's consider a square collides with a circle, then in your case it wouldn't be a collision, since the last pixel of the square doesn't collide with the circle. instead, put a reg.v[0x0f]=0; at the start of the sprite drawing function, and an if(!reg.v[0x0f]) { .... } around the collision detection. this way, the flag will only be set if it hasn't already been set in a previous spriteline.
 
Last edited:

refraction

PCSX2 Coder
hap said:
if i'm reading it correctly (haven't compiled/tested), your collision detection is broken. let's consider a square collides with a circle, then in your case it wouldn't be a collision, since the last pixel of the square doesn't collide with the circle. instead, put a reg.v[0x0f]=0; at the start of the sprite drawing function, and an if(!reg.v[0x0f]) { .... } around the collision detection. this way, the flag will only be set if it hasn't already been set in a previous spriteline.


nah i know exactly why hes done that, chip8 doesnt reset the colision detection anywhere, so if you did that, soon as there's a colision, nothing will get drawn, so its best to reset the collision flag at the beginning of the drawing routine.
 

hap

New member
Does anyone have roms that are different from the ones included with Dave Winter's emulator ? If so, knowing they all are pd, could you attach them ? The only one I could find was a Chip8 game 'Rocket', by the same guy who did the S-Chip game 'Alien'.
 

Doomulation

?????????????????????????
refraction said:
nah i know exactly why hes done that, chip8 doesnt reset the colision detection anywhere, so if you did that, soon as there's a colision, nothing will get drawn, so its best to reset the collision flag at the beginning of the drawing routine.
I must add that this does indeed fix quite some things. But how does the real system do it? Don't know.
Other games? Sorry mate, i never bothered to find any. Did you google?
 

hap

New member
I did Google around. What you've just linked to is the rom collection that's included in Dave Winter's emu, those are found everywhere.
 

Doomulation

?????????????????????????
Well... simply a suggestion. I did ask for a game that used half-pixel shift, but it seemed noone had heard of one =)
 

refraction

PCSX2 Coder
hap said:
I did Google around. What you've just linked to is the rom collection that's included in Dave Winter's emu, those are found everywhere.

apologies, but there isnt really any other games available on chip8 or schip8 to the ones youve got, it wasnt that popular system.

only ones different to that are Double Dragon and Rocket (which you have)

and a helecopter game called Dragon1 on the rom name, dunno why, but it good for testing your shifting routines.

Double Dragon is good for testing your emulator as a whole, it seemed very buggy on mine at first.
 

hap

New member
no problem refraction

Doomulation: good idea to make our own test rom then... hold on =p
 

hap

New member
attached is a chip8 test rom. what should happen:

- the rom should boot and not run random data: it is not word-aligned
- it should show a sprite (2 short lines) at the bottom left of the screen
- it should show an 8*16 sprite that looks like a vertical "HAP", and not something garbled: 16*16 in chip8 mode=8*16
- it should wait exactly 3 seconds before the next action, if not, your timer's messed up
- it should scroll 1/2 line down. the result should be that the bottom 2 lines are still visible, but the 2nd one has a smaller height than the 1st one: half pixel scroll
 

hap

New member
Thanks to newsdee from the retrogames.com forum: http://www.retrogames.com/cgi-bin/w...=0&view=expanded&mode=threaded&sb=7#Post81203

i'll attach them here for archiving.
(slightly renamed files to be able to coexist with the other ones)

new.zip:
c8pic: shows a 'chip8' picture on screen
cave: a game where you need to exit to the right and not touch walls
filter: a game where you need to catch balls
ibm: shows 'ibm' on screen
pong3: the middle line is different than in pong2, maybe other slight changes
rocket2: a rocket blastoff animation... or it's a game and my emu's bugged
tapeworm: a snake game where the snake keeps growing
x-mirror: dunno, all i see is a black screen

slight.zip:
invaders, guess, 15puzzle, maze. all have different code compared to the ones at dave winter's emu. but i don't notice any differences while running them.
 

hap

New member
it's garbled because you're drawing a 16*16 sprite, while you should draw an 8*16 one, because you're in chip8 drawmode and not in s-schip drawmode.

and the half pixel scroll: the only way to implement this is by doubling the chip8 low resolution i guess, making it 128x64 like s-chip.


from Dave Winter's doc:

Drawing the 16 x 16 pixels SCHIP sprite in CHIP-8 mode will display an 8 x 16 sprite (because only the first 16 bytes of this sprite will be used). The result is that a 16 x 16 SCHIP sprite will not be correctly displayed in the 64 x 32 resolution. However, this instruction allows drawing an 8 x 16 sprite, which cannot be performed with the standard CHIP-8 drawing instruction.

We saw that a pixel of the 64 x 32 resolution is twice bigger than one of the 128 x 64 one. Another consequence of this is that the vertical scrolling instruction is different in the 64 x 32 resolution. In this one, it will scroll half the lines it would have scrolled in SCHIP mode. Note that if the number of lines to scroll is ODD, the scroll will be performed with a half-pixel shift !
 

Top