A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [FLA] Chip8 emulator gfx bugs

  1. #1
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357

    [FLA] Chip8 emulator gfx bugs

    Hey guys, as promised an emulator in Flash

    Currently it takes ages but displays '0' text from the RAM in the top corner, but there's a bug that I think that it's in the draw_sprite8() function. Will try to fix a.s.a.p

    RipX
    Attached Files Attached Files

  2. #2
    Tetris Downstacker Hasufel's Avatar
    Join Date
    Feb 2004
    Location
    Near by
    Posts
    247
    Looks promising, i indeed got the "00" but something like 2 minutes after the start of the emulation.
    I don't know what rom you embeded. I can remember this game "Joust" i was playing on a chip8 emu on the hp48 calculator.
    Will your emulator be able to run that kind of game ?
    If so, then, all i can say, bravo, you did the only emulator in Flash i know

    [edit] I noticed you use for var loops, and big ones, like the clear memory one:
    code:

    clear_mem = function () {
    for (var z = 0; z<8192; z++) {
    mem[z] = 0;
    }
    trace("memory cleared");
    };


    . Would you use while -- loops, you'll save something like 15%-20% run time, maybe is it needed ?
    Fastest loop so far seems to be "do while".

    Results:
    -------
    for (local length var): 47.2 ms (8192 times)
    for (.length property): 54.1 ms (8192 times)
    for..in: 45.7 ms (8192 times)
    for var: 48 ms (8192 times)
    while ++: 43.9 ms (8192 times)
    while --: 40.5 ms (8192 times)
    do --: 40.2 ms (8192 times)

    [/edit]
    Last edited by Hasufel; 01-04-2005 at 02:59 PM.
    Bubble Islands - Your arcade puzzle game !
    Dot-invasion Team
    Tales from the code front: stimunation developers blog
    Puzzle Bobble - The arcade port!
    2iceMP framework - Flash Multiuser Server: multiplayer tetris, chess, othello, connect4 ...
    Frozen Bubble - shoot da bubbles!
    The Pi Game - game for geeks

  3. #3
    avatar free
    Join Date
    Jul 2002
    Location
    UK
    Posts
    835
    What is it supposed to do? I just see a large array of 0's and a black box next to the debug info.

    On the clearing thing: Are those arrays that need clearing always the same size? If they are can't you just use

    code:

    clear_mem = function () {
    mem = new Array(8192);
    trace("memory cleared");
    };



    Or something similar?

    Still, looks pretty good. Just wish I could see a game

    Edit
    OK, I thought too fast . You want the array initialised to 0, and my code makes them null. D'oh.
    Last edited by jonmack; 01-04-2005 at 04:30 PM.
    jonmack
    flash racer blog - advanced arcade racer development blog

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357
    lol - I wish that I could see a game too! All the little blinky numbers and stuff is most of the emulation, being able to graphically see this thing is a nightmare, I can't find where the problem is with the bit that shows the actual graphics but i'm working on it.

    The big array is the VRAM (which aint doing anything cos of the problem) I was using that to try to see where I was going wrong, the most important part is those register values, which show that it's emulating the internal workings correctly

    The big loops only run a couple of times, I made 'em like that to set them all to 0's but were just a hacky temporary thing!

    It could in theory play the joust game when it's finished but never practically, this was only ever done as a "this is possible" thing, and will never really run at any practical speed, even with dropping frames (at least I don't think so). Just wanted to try to do something that was not thought possible and make it open source for people to start learning how emulators work using a language that you guys understand so I get some votes for the open source thing this year! lol

    RipX

  5. #5
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Originally posted by RipX
    Just wanted to try to do something that was not thought possible and make it open source for people to start learning how emulators work using a language that you guys understand so I get some votes for the open source thing this year!
    Got my vote already! Nice work.

  6. #6
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357
    oh... the ROM was Breakout

    RipX

  7. #7
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357

    back...

    Bringing this back to life...I have re-writen the core over the last 2 days (similar to the old one), added graphics using the flash8 bmp functions..I need to add sound, play with some XOR mode font issues and add controls but it should be up and running soon!

    Using the flash8 bmp functions has made the emulator run quickly (definatly playable) with the new core (written in AS1 :|)! It is not yet complete though. The swf is refreshing every frame which means that using frameskip later will increase the speed considerably - all good news - i'll upload the source as soon as it's complete! P.S. the ROM is breakout!

    next....xbox360 lol

    RipX
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center