Next Generation Emulation banner

1 - 20 of 22 Posts

·
Emu Author
Joined
·
613 Posts
Discussion Starter #1 (Edited)
well after a few days of work i finally have something to show for my effort. my drawing op codes are not complete so i only know of pong really working right now but it seems to play as its supposed to, after i fixed my drawing op code not drawing stuff in the right place and my ret op code.

i attached an image that also shows how long it takes to complete each opcode which also includes drawing speed. keyboard input works like its supposed to as well, for now it runs at 60 cycles per second which for pong seems to be slow but it works :D.
 

·
Registered
Joined
·
16 Posts
Nicely done, congratz :)
I havent touch mine.. too much work and homeworks :(
I only need timers and graphics...
I think the hardest part, might work on it soon u.u

HEY CONGRATZ!! GREAT JOB!
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #4 (Edited)
well heres an update, i checked a total of 26 normal chip 8 games and all but 1 worked flawlessly, the one that is not is blitz due to my drawing code putting the bottom on top and causing a game over, but i plan to fix it momentarly, i am not finished with the scrolling op codes so can not fully test schip yet but some of the coded needed to perfect schip is already in place as far as normal drawing is concerned.

anyone recommend a system to tackle after chip 8?
 

·
Level 9998
Joined
·
9,384 Posts
Nice. Can't be more perfect. :)

Anyway... mm... a system after Chip-8? Whichever one, actually.

Though... since you got Chip-8 working, maybe try Gameboy next. Gameboy is quite a piece of work.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #6
well still looking for something easy since it will only be my 2nd emulator, but i suppose a good challenge is nice as well, i am getting ready to put in the last few opcodes that are missing which is mainly just scrolling, than to test the last schip games i have and fix any bugs, than to tackle putting in sound that works on both xp and vista XD. btw is it true that the beep function wont work in x64 vista?
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #7 (Edited)
ok i just fixed what looked to be an issue with my font but now that i fixed it i think i bugged something else, like when i load alien, when it gets to the actual game, what is supposed to be drawn in the middle of the screen, my game now draws the 2 numbers 89, i checked neochip 8 and it draws nothing there, another emulator i have for testing draws 4 numbers there so i was wondering what the real output for that part is supposed to be? going through checking stuff now.

i already checked if the font is correct so i am thinking maybe i am miscalculating something if this is not right?

EDIT: nm i figured out what i did, when i changed my font code so not reload font based on which mode i am in, i messed up the schip font lol. so technically it was loading the right characters just what was stored there was wrong, its fixed now. now to work on scrolling lol.
 

·
Level 9998
Joined
·
9,384 Posts
Oh yeah, and a new way to implement the drawing opcode (faster than pixel-by-pixel), I think would be... XOR a complete line of bits into VRAM. Namely... you have 8 bits (1 byte) for the first scanline of the sprite, you just XOR that into the video memory.

Then check that memory section after XORing and if it's not equal to the original sprite data of the scanline (8 bits long, ya), then something was erased, and collision flag needs to be set.

Just another tip. I get the feeling people are doing it pixel by pixel and checking for which bit is erased... which might be quite tedious. ;)
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #9 (Edited)
well i just ran through 128 chip 8 and schip games and 105 work and output what should be seen from what i can tell, i know of maybe 5 that i can not get working maybe 6 due to being hybrid games that do not show anything and i think 1 game is made differently that mostly works but after a bit it gets jubbled up from the problem i read about that i may try to fix later.

most games that are not working are schip as i only got down scrolling implemented and from the loops it may not be correct. in one of the car games, it looks liek it renders the scroll correctly until the first car appears and it just indefinitely stretches the car from the top of the screen.

here is my scroll down code:
Code:
program_counter = (ushort)(program_counter + 2);
                if (mode == (int)graphics_mode.schip)
                {
                    for (int y = 63; y >= 0; y--)
                    {
                        for (int x = 0; x < 128; x++)
                        {
                            if ((y + opdata_h) <= 63)
                            {
                                set_pixel(x, y + opdata_h, get_pixel(x, y));
                            }
                        }
                    }
                }
                else
                {
                    int temp_scroll_lines = opdata_h / 2;

                    for (int y = 31; y >= 0; y--)
                    {
                        for (int x = 0; x < 64; x++)
                        {
                            if ((opdata_h % 2) != 0)
                            {
                                for (int i = 0; i < temp_scroll_lines; i++)
                                {
                                    if ((y + (temp_scroll_lines + 1)) <= 31)
                                    {
                                        set_pixel(x, y + (temp_scroll_lines + 1), get_pixel(x, y));
                                    }
                                }
                                if ((y + 1) <= 31)
                                {
                                    set_half_pixel(x, y + 1, get_pixel(x, y));
                                }
                            }
                        }
                    }
                }
                draw_screen();
i am certain something is off, but hap's emutest works perfectly with the half pixel scroll and alien and another game that uses scroll down works perfectly so i am not entirely sure what might be up. i am about to put in left and right scrolling.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #11 (Edited)
thank you, that worked like a charm, i had tried something like that before but i had placed the call to zero the previous pixel in the wrong place, now to work on horizontal scrolling and i should be all done.

well i put in the rest of my horizontal scrolling code, most of it appears to work great, now all but 8 games work, ant seems to sort of work but it and the dragon 2 game(helicopter) when they draw the ground, it skips every other section, i am sure its not due to my drawing code its self since every other game does work perfectly so i am thinking it might be my horizontal scrolling thats causing it.

Code:
if (mode == (int)graphics_mode.schip)
                {
                    for (int i = 1; i <= 4; i++)
                    {
                        for (int y = 0; y < 64; y++)
                        {
                            for (int x = 0; x < 128; x++)
                            {
                                if ((x - i) >= 0)
                                {
                                    set_pixel(x - i, y, get_pixel(x, y));
                                    set_pixel(x, y, 0);
                                }
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 1; i <= 2; i++)
                    {
                        for (int y = 0; y < 32; y++)
                        {
                            for (int x = 0; x < 64; x++)
                            {
                                if ((x - i) >= 0)
                                {
                                    set_pixel(x - i, y, get_pixel(x, y));
                                    set_pixel(x, y, 0);
                                }
                            }
                        }
                    }
                }
                draw_screen();
so i have hit a wall which deals with the hp48 flags, i seen my test emulator run some schip test that scrolled a sprite across the screen side ways and downwards but on mine it does next to nothing, i narrowed it down to a bug which prevents the program from working right due to a variable that is set by the hp48 flags at the start, on mine its set to 0 but i can already tell that doing so is wrong, so would anyone by chance know what the values might be for these flags or a way to get around this issue? i can post the rom if anyone needs to look at it.
 

·
Level 9998
Joined
·
9,384 Posts
Try switching your left scroll and right scroll functions.

The HP48 flags might not do anything... since I can get the games you mentioned to work fine without relying on that flag.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #13 (Edited)
tried to switch to scrolling op codes but that prevented any scrolling, i wonder if maybe i am scrolling to much?

i attached the test program i was talking about. at the start it loads 4 values into registers 0-3 and puts 0 into register 4, later on it compares 0 and 4, and because they are equal later on because none of them change it skips the addition opcodes and so it never moves the image like its supposed to.
 

·
Level 9998
Joined
·
9,384 Posts
Mmmm... I've seen that kind of output at some point... but I can't remember what caused it. Maybe you're indeed scrolling too much. Should be about 4 pixels per scroll? (2 in Chip-8 Hybrid mode)

So far, I haven't seen anything but tests making use of the Chip-8 hybrid features, or the HP48 flags and instructions.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #15
well as my code shows it should be scrolling 4 pixels, if my pixel plotting code was wrong it should have shown up much sooner, i tried to change it to 2 but than it was definitely not scrolling enough, setting to 3, made the gaps smaller but not small enough, but i would think 2 and a half would possibly do it but i am sure it would be more trouble for other games that currently work.

i may try to set the hp48 0 flag to a value later and see if it makes that game function, if so i could just make an estimated guess as to the value its expecting.

currently also looking into gameboy emulation but from reading this document i may opt for something a bit easier first lol.
 

·
Level 9998
Joined
·
9,384 Posts
lol Gameboy is much too hard? I think it's just because of the way they documented it. I don't remember where but I got a much better way to document the opcodes of the CPU...

Maybe I'll take my time to write some docs soon...
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #18
thanks to @ruantec and a bit of thinking i figured out the program, so i removed the i counter and made it move the pixel by 4 instead of by 1 each time and it solved the issue, now ant has full ground as well as dragon 2 and i managed to fix all horizontal scrolling now.

but now that ant is fixed i found a bug with it that i read about somewhere but forgot how to fix it now, the ant wont move unless i use jump, is there something i am forgetting to set to allow him to move?

also the test program i hardcoded the r[0] flag to 8 and it allowed a tiny bit of horizontal scrolling in that test program before it went back to what it usually does so i think it was what i suspected, going to try to figure out the values it expects. also setting that flag to 8, allows hap's version of loopz to run longer before it reaches an out of memory error(its an error i put in to prevent it from actually getting a reach out of error message and crashing).
 

·
Level 9998
Joined
·
9,384 Posts
You read about it in the Chip-8 thread. Shendo was having the same problem. :p

Look back at your subtraction opcode. The flag should be set also when the result of the subtraction is 0, not just when the result is less than 0. VF is actually a carry AND zero flag, not just a carry flag.

Cowgod forgot to put that in his document. Or maybe he didn't know about that himself.
 

·
Emu Author
Joined
·
613 Posts
Discussion Starter #20 (Edited)
thank you so much, i knew i was forgetting something like that, i tried to keep it in mind and forgot :D.

Ant is now working perfectly, and now i am pretty much finished with my emulator, now to optimize it here and there and than i will release it :D.
 
1 - 20 of 22 Posts
Top