Emuforums.com

Go Back   Emuforums.com > General Discussion > Web development / Programming
Home Register Downloads FAQ Members List Calendar Arcade Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
Old April 9th, 2009   #121 (permalink)
Dax
ライチュウ
 
Dax's Avatar
 
Join Date: Nov 2006
Location: USA
Posts: 3,289
I wrote a Chip8 disassembler in C#. You need .NET 2.0 or higher to use it. Please bug test for me[check for crashes, and if you know the chip8 assembly language, please check if I missed any opcodes]. It supports C8 and SC48 games.

Known bugs:
-Alignment bug due to how silly the alignment is in most C8 games. Can't really be fixed.

Source available at http://code.google.com/p/chip8-emu/source/list under the OmegaDax branch.
Attached Files
File Type: 7z Chip8DisASM.7z (6.0 KB, 4 views)

Last edited by Dax; April 9th, 2009 at 03:53..
Dax is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old April 10th, 2009   #122 (permalink)
Administrator
 
Chrono Archangel's Avatar
 
Join Date: Dec 2001
Location: Montreal, Canada
Posts: 7,842
Alright, I think I got everything working now.
Dax , there was indeed a stupid error with my BCD implementation XD
Also tweaked my draw method and now everything shows up correctly in Space Invaders (and all other games for that matter)

Only thing left is that it's too fast but I couldn't care less right now about that.

So what now....? Restart my NES emu... or start a GB emu?
Chrono Archangel is offline   Reply With Quote
Old April 10th, 2009   #123 (permalink)
Emu Author
 
Hatorijr's Avatar
 
Join Date: Dec 2004
Location: North Carolina
Posts: 374
since i wrote my chip 8 in c# i used a timer class to lock it to 60 fps and just chose how many opcodes to interpret per frame so as not to have it going way to fast.
Hatorijr is offline   Reply With Quote
Old April 14th, 2009   #124 (permalink)
Registered User
 
Join Date: Mar 2009
Location: United States
Posts: 9
Quick question. Do you guys know if the two SCHIP functions 'Shift Screen Left 4 Pixels' and 'Shift Screen Right 4 Pixels' are supposed to wrap the pixels that are cut off to the opposite side, or are they just supposed to be discarded? Also, the same question goes to the scroll down function.
jaskt7 is offline   Reply With Quote
Old April 14th, 2009   #125 (permalink)
Emu Author
 
Hatorijr's Avatar
 
Join Date: Dec 2004
Location: North Carolina
Posts: 374
once off the screen, the pixels are usually destroyed.
Hatorijr is offline   Reply With Quote
Old April 16th, 2009   #126 (permalink)
Dax
ライチュウ
 
Dax's Avatar
 
Join Date: Nov 2006
Location: USA
Posts: 3,289
I've been porting my emu to C# for the past few days. It's been really easy so far: I literally copy pasted my C++ CPU core into the project and added the needed type casts to bytes, ushorts, etc. It all seems to work decently too, except I'm struggling to rewrite the DirectX code since I'm not very experienced with D3D. Most of the games I've tested seem to show at least SOMETHING, which is good. The only game with perfect graphics is Pong, and perhaps Blitz, on the title screen.
Dax is offline   Reply With Quote
Old April 16th, 2009   #127 (permalink)
Administrator
 
Chrono Archangel's Avatar
 
Join Date: Dec 2001
Location: Montreal, Canada
Posts: 7,842
Keep it up What kind of graphics glitch are you getting in the other games? (like Space Invasion)
Chrono Archangel is offline   Reply With Quote
Old April 16th, 2009   #128 (permalink)
Dax
ライチュウ
 
Dax's Avatar
 
Join Date: Nov 2006
Location: USA
Posts: 3,289
The games draw way too high on the screen, including under the menu bar, that and it doesn't always draw everything on the screen. I borrowed code from Hatori again, so I'm still learning DirectX. I just wish I knew more DirectX, to figure out what the hell the deal is.

This is my video code if anyone cares:

http://code.google.com/p/chip8-emu/s...pec=svn33&r=33

It's really buggy and far from perfect at the moment. For instance, if I make the backbuffer size any bigger than native resolution, it never draws anything.


Also, I added my C# code as yet another branch to the emu.

http://code.google.com/p/chip8-emu/source/browse/
Dax is offline   Reply With Quote
Old April 17th, 2009   #129 (permalink)
Dax
ライチュウ
 
Dax's Avatar
 
Join Date: Nov 2006
Location: USA
Posts: 3,289
Well I'm extremely discouraged, almost to the point of quitting. For some reason, when i try to debug my CPU, I can't step through the code correctly anymore, almost as if the debugger has become bugged. Anyone who knows C#, could you please look at my CPU code? I really don't want to have to rewrite this core a 6th time, or however many rewrites I've done now..
Dax is offline   Reply With Quote
Old April 17th, 2009   #130 (permalink)
Registered User
 
dreampeppers99's Avatar
 
Join Date: Jul 2006
Location: you know...
Posts: 506
Quote:
Originally Posted by Dax View Post
Well I'm extremely discouraged, almost to the point of quitting. For some reason, when i try to debug my CPU, I can't step through the code correctly anymore, almost as if the debugger has become bugged. Anyone who knows C#, could you please look at my CPU code? I really don't want to have to rewrite this core a 6th time, or however many rewrites I've done now..
I know C# and I already did one SChip8 Emulator & Debugger... when you mean core is that class CPU.cs - chip8-emu - Google Code ? (Am I on the rigth place?)
__________________
The Empyrean
dreampeppers99 is offline   Reply With Quote
Old April 17th, 2009   #131 (permalink)
Emu Author
 
Hatorijr's Avatar
 
Join Date: Dec 2004
Location: North Carolina
Posts: 374
the major issue is that debugging in his emulator is getting messed up somewhere and i am not even sure where its happening and i have never seen a problem like it since i started working on c# as the c# debugger is usually very good.

even moving the core into a new project, allows it to work for a time before it goes right back to the same problem. and its not specific to 1 os either. when debugging, it never follows the execution path you'd expect it to, it jumps sparatically instead of going in a straight line. also, the program counter increments when it should not as well.
Hatorijr is offline   Reply With Quote
Old April 17th, 2009   #132 (permalink)
Administrator
 
Chrono Archangel's Avatar
 
Join Date: Dec 2001
Location: Montreal, Canada
Posts: 7,842
I'll take a look tonight DAX. I've done a bit of C# so I should be able to work my way around.
Chrono Archangel is offline   Reply With Quote
Old April 17th, 2009   #133 (permalink)
Emu author
 
@ruantec's Avatar
 
Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,380
Quote:
Originally Posted by Dax View Post
Well I'm extremely discouraged, almost to the point of quitting. For some reason, when i try to debug my CPU, I can't step through the code correctly anymore, almost as if the debugger has become bugged. Anyone who knows C#, could you please look at my CPU code? I really don't want to have to rewrite this core a 6th time, or however many rewrites I've done now..
the C# debugger is one of the most(if not the most) advanced debugger atm... just put some break points where you think it could fail.. then just step through using F10 or F11 to go inside each method or function and move the mouse over variables, classes whatever and open there properties and values and check them on each step you do.. i bet you will be able to find the problem.. if not then contact me through msn as you always do and i´ll help ya with that
__________________

Current development tools:

Visual C++.net, Visual C#.net
Visual VB.net, Visual Webdeveloper.net
Bloodshed Dev C++, Borland C++
Visual Basic 6
@ruantec is offline   Reply With Quote
Old April 17th, 2009   #134 (permalink)
Administrator
 
Chrono Archangel's Avatar
 
Join Date: Dec 2001
Location: Montreal, Canada
Posts: 7,842
Dax, well one thing your V_SIZE should be 16 and not 0x0F (15).
Now...crashes on dx stuff so, ill get back to you in a bit
Chrono Archangel is offline   Reply With Quote
Old April 17th, 2009   #135 (permalink)
Emu Author
 
Hatorijr's Avatar
 
Join Date: Dec 2004
Location: North Carolina
Posts: 374
whats wrong with the debugger is listed in my last post, and was unable to figure out why its doing what it is, i have been going over his code to figure out the issue and still unsure whats going on.
Hatorijr is offline   Reply With Quote
Old April 20th, 2009   #136 (permalink)
Dax
ライチュウ
 
Dax's Avatar
 
Join Date: Nov 2006
Location: USA
Posts: 3,289
Quote:
Originally Posted by @ruantec View Post
the C# debugger is one of the most(if not the most) advanced debugger atm... just put some break points where you think it could fail.. then just step through using F10 or F11 to go inside each method or function and move the mouse over variables, classes whatever and open there properties and values and check them on each step you do.. i bet you will be able to find the problem.. if not then contact me through msn as you always do and i´ll help ya with that
That's not really possible though, since stepping through the code goes to random places, or goes one/two steps in, then jumps BACKWARD out of the function..so I'm just going to rewrite it from scratch and hope for the best, I guess.
Dax is offline   Reply With Quote
Old April 22nd, 2009   #137 (permalink)
Emu author
 
@ruantec's Avatar
 
Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,380
Quote:
Originally Posted by Dax View Post
That's not really possible though, since stepping through the code goes to random places, or goes one/two steps in, then jumps BACKWARD out of the function..so I'm just going to rewrite it from scratch and hope for the best, I guess.
i think it´s possible now
__________________

Current development tools:

Visual C++.net, Visual C#.net
Visual VB.net, Visual Webdeveloper.net
Bloodshed Dev C++, Borland C++
Visual Basic 6
@ruantec is offline   Reply With Quote
Old April 22nd, 2009   #138 (permalink)
Dax
ライチュウ
 
Dax's Avatar
 
Join Date: Nov 2006
Location: USA
Posts: 3,289
Well @ru and I figured out[more so him than I, but still ] that I had a bit of bad logic in my timer handler, so that was what caused the debugger to go crazy. We put in a while loop in the timer that just executes opcodes, and boom, problem solved. Also, he informed me that nested switches were a no-no, so those were removed as well. Now I just need to add input and fix up the GUI!
Dax is offline   Reply With Quote
Old April 22nd, 2009   #139 (permalink)
Emu author
 
@ruantec's Avatar
 
Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,380
Actually the C# debugger was doing a great job there because the Timer was calling the "cpu.Execute" method each time even if you were inside of the method(break point) so the debugger tried to show you every single process step created by the Timer class.. making you think the code was jumping like crazy and at the end creating problems in your app... in fact the debugger was doing a damn great job lol..

nested switches are ok but it depends how you use it.. in your case some simple ifs were better and make the code a bit more readable i think. eitherway your problem is fixed now and you can go further
__________________

Current development tools:

Visual C++.net, Visual C#.net
Visual VB.net, Visual Webdeveloper.net
Bloodshed Dev C++, Borland C++
Visual Basic 6
@ruantec is offline   Reply With Quote
Old April 22nd, 2009   #140 (permalink)
Dax
ライチュウ
 
Dax's Avatar
 
Join Date: Nov 2006
Location: USA
Posts: 3,289
Now I just need to do input[not looking forward to this since my last input implementation was terrible], make a new GUI for the whole thing, and fix a few CPU bugs to fix games like Space Invaders.
Dax is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:52.

© 2006 - 2008 Emu Forums | About Emu Forums | Legal | A member of the Crowdgather Forum Community


Powered by vBulletin® Version 3.7.6
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5