Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext Thread*Show in Threaded Mode


SubjectFlip8 v0.03 - Flash Chip8 emu Reply to this message
Posted bynewsdee
Posted on01/26/05 00:06 AM



Well, my Chip8 emulator is finally looking like something, and stopped suffering from abysmal performance.

To answer the question of "why on Earth another Chip8 emu", the point here is that this has been written from scratch in Flash (ActionScript 2.0, Flash Player 7 required), based on Dave Winter's docs. As far as I know, this is the only Flash emulator out there.

Flash is not good at all for pixel drawings, so it's a major challenge to get it to run fast (e.g. SCHIP8 emu doesn't work because 128x64 pixels are too much for Flash!). I've tried several graphics display algorithms until I came up with the current one. Profiling your functions really give you good ideas :-)

The emu also allows you to load any ROM sitting somewhere on the web. Just enter the URL in the appropriate box. Not everything works yet, so some games will definitely fail, but several give good output.

The interface is not the prettiest but it's functional :-) It will probably improve as time goes on, as long as I find this project fun :)





[download a life]


SubjectRe: Flip8 v0.03 - Flash Chip8 emu new Reply to this message
Posted byJonemaan
Posted on01/26/05 08:46 PM



That's funny, I've just written a chip8/schip emu too, also based on Dave Winter's docs. But just in plain old C. All games are working great, so if you've got specific emulation core related problems, feel free to ask.

Say, could you provide a download link of Tapeworm and Chip8-logo and perhaps others that are not included with Dave Winter's emulator ? Because those are all I can find. Not to play the games, I hate most of those games actually, but to look for bugs and get perfect emulation.

(note to mod: chip8 roms are pd)




SubjectRe: Flip8 v0.03 - Flash Chip8 emu new Reply to this message
Posted bynewsdee
Posted on01/27/05 07:45 AM



> That's funny, I've just written a chip8/schip emu too, also based on Dave
> Winter's docs. But just in plain old C. All games are working great, so if
> you've got specific emulation core related problems, feel free to ask.

Well, since you're offering, could you give me some insight on how to handle the BCD storage of numbers? :-)

I'd also be curious to see your schip8 scrolling functions. I've made a couple and they're really slow (although that's Flash's fault mostly, incapable of taking 128x64).

Finally do you know if the "save/load to/from Hp48 flags" command is used? Is it needed for game logic or is it just to keep high scores and stuff? (this is to know if I have to store the info as a cookie or just keep it in memory).

> Say, could you provide a download link of Tapeworm and Chip8-logo and perhaps
> others that are not included with Dave Winter's emulator ? Because those are

I can see why, these are pure test programs. For example, look at the code for the chip8 logo:

In reply to:


00 e0 a2 48 60 00 61 1e 62 00 d2 02 d2 12 72 08 32 40 12 0a 60 00 61 3e 62 02 a2 4a d0 2e d1 2e 72 0e d0 2e d1 2e a2 58 60 0b 61 08 d0 1f 70 0a a2 67 d0 1f 70 0a a2 76 d0 1f 70 03 a2 85 d0 1f 70 0a a2 94 d0 1f 12 46 ff ff c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 c0 ff 80 80 80 80 80 80 80 80 80 80 80 80 80 ff 81 81 81 81 81 81 81 ff 81 81 81 81 81 81 81 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 ff 81 81 81 81 81 81 ff 80 80 80 80 80 80 80 ff 81 81 81 81 81 81 ff 81 81 81 81 81 81 ff ff 00 00 00 00 00 00 00 00 00 00 00 00


Notice the string of "ff ff c0 c0" and "80 80"? That's the sprite data for the side bars and the "CHIP8" logo. So the program itself is roughly half of the code.

I can't remember where I've found them, it was a collection of programs with the "ch8" extension. There was also another logo program that draws the IBM logo, and other stuff I didn't try. I can't remember the source but here. I'll repost if I can find where they came from.

Tapeworm's title screen says 1999, so it was obviously a program written specifically for the HP48 calcs. I would guess that a lot of programs are available there that were seldom brought over to the PC. I believe I've seen a huge archive somewhere but that may be just my memory exaggerating David Winter's site :) [which has several chip8 and schip8 programs].

> (note to mod: chip8 roms are pd)

They're not even really ROMs, because they were -never- in a cart or any read-only memory chip or media in the first place. If anything, they're rAms at most :-)



[download a life]


SubjectRe: Flip8 v0.03 - Flash Chip8 emu new Reply to this message
Posted byJonemaan
Posted on01/27/05 10:13 AM



> Well, since you're offering, could you give me some insight on how to handle the
> BCD storage of numbers? :-)

BCD=binary coded decimal. It is used in many games to show a score larger than 9 on screen. eg. if the value is 123, store it into memory like this (pseudo code):

ram[i+0]=1 (um, don't mind the +0, it's there so wwwthreads won't intepret it as italic)
ram[i+1]=2
ram[i+3]=3

use base 10 modulo and integer divisions to get a specific decimal digit out of the value. if you don't understand, re-ask, and i'll paste my source of that.


> I'd also be curious to see your schip8 scrolling functions. I've made a couple
> and they're really slow (although that's Flash's fault mostly, incapable of
> taking 128x64).

because chip8 only uses 2 colours, i'm using a 1-bit bitmap here, so every bitmap byte is 8 pixels wide.

OPV4=opcode masked with 0xf
VRAM_SIZE=0x400 (1KB)

scroll left is the same as right, except for reverse shifts/x count.

static void scrld(void)
{ /* 0x0?cN - scroll_down */
/* scroll N lines down, no wrap (s-chip function) */

memmove(vram 16*OPV4,vram,VRAM_SIZE-16*OPV4); /* move yres-N rows down */
memset(vram,0,16*OPV4); /* empty N rows at the top */
update=SCREEN_UPDATE;
}

static void scrlr(void)
{ /* 0x0?fb - scroll_right */
/* scroll 4 pixels right, no wrap (s-chip function) */
int y; /* y count */
int x; /* x count */

for (y=0;y {
for (x=15;x>0;x--) { vram[x+y]=(vram[x+y]>>4)|(vram[x-1+y]<<4); }
vram[y]<<=4; /* last 4 bits */
}

update=SCREEN_UPDATE;
}



> Finally do you know if the "save/load to/from Hp48 flags" command is used? Is it
> needed for game logic or is it just to keep high scores and stuff? (this is to
> know if I have to store the info as a cookie or just keep it in memory).

No clue. I'm just keeping it in temp. memory.



Thanks for the ROMs! .. umm, RAMs ;p
nice chip8 emu development discussion there i'm 'hap' on that board.







SubjectRe: Flip8 v0.03 - Flash Chip8 emu new Reply to this message
Posted byJonemaan
Posted on01/27/05 10:18 AM



for (y=0;y

should be

for (y=0;y





SubjectRe: Flip8 v0.03 - Flash Chip8 emu new Reply to this message
Posted byJonemaan
Posted on01/27/05 10:21 AM



> for (y=0;y
>
> should be
>
> for (y=0;y
>

blaaahh, i tried editing with pre tags and everything, even reposting it... ok, *drumroll*, it should be:

for (y=0;y [smaller-than-sign] VRAM_SIZE;y [plus-sign] =16)

*edit*, and the empty space in memmove should also be a plus-sign



Subject--moving to emu programming-- new Reply to this message
Posted bynewsdee
Posted on01/28/05 00:16 AM



Reply to your post here (lets stop annoying gen em with our crazy talk :) )




[download a life]


Previous ThreadView All ThreadsNext Thread*Show in Threaded Mode