C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 06-29-2004, 01:00 PM   #1
i dont know
 
Vicious's Avatar
 
Join Date: May 2002
Posts: 1,200
ChipAte Emulation

I am writing my first wmulator and since there arent many good tutorials out there... I want to make sure Im on the right track.

My first question...

Is this the proper way of emulatiing the CPU?

Code:
void CpuEmulation()
{
  OpCode = (Memory[PC] << 8) + Memory[PC + 1];

  switch(OpCode&0xF000)
  {
    case 0x0000:
      if(OpCode&0x00F0 == 0xE)
        ClearScreen();
      PC+=2;
    break;

    case 0x1000:
      MemoryPosition = OpCode&0x0FFF;
      PC+=2;
    break;

    case 0x3000:
      if(V[OpCode&0x0F00] == OpCode&0x00FF) PC += 4;
      else PC += 2;
    break;

    case 0x5000:
      if(V[OpCode&0x0F00] == OpCode&0x00F0) PC += 4;
      else PC += 2;
    break;

    case 0x6000:
      V[OpCode&0x0F00] = OpCode&0x00FF;
      PC+=2;
    break;

    case 0x7000:
      V[OpCode&0x0F00] += OpCode&0x00FF;
      PC+=2;
    break;

    case 0x8000:
      if(OpCode&0x000F == 0)
        V[OpCode&0x0F00] = V[OpCode&0x00F0];
      PC+=2;
    break;

    case 0xB000:
      MemoryPosition = OpCode&0x0FFF + V[0];
      PC+=2;
    break;
  }
}
Vicious is offline   Reply With Quote
Old 06-29-2004, 02:23 PM   #2
+++ OK NO CARRIER
 
quzah's Avatar
 
Join Date: Oct 2001
Posts: 10,533
You mean other than the fact that you're using globals everywhere?

Quzah.
__________________
Hundreds of thousands of dipshits can't be wrong.


Are you up for the suck?
quzah is offline   Reply With Quote
Old 06-29-2004, 02:27 PM   #3
i dont know
 
Vicious's Avatar
 
Join Date: May 2002
Posts: 1,200
oh..

I take it, thats a bad thing....

Look, this is the first time ive tried to program anything other than a game. I am just trying to figure out if Im doing this the right way, or if there is a better way. I was thinking I might have to shift some more bits or something

I am going to attach my source code and see if any one can give me some pointers. Not to tell me how stupid I am for doing something, just to kindly give me advice.
Attached Files
File Type: zip ChipAte.zip (15.0 KB, 149 views)
Vicious is offline   Reply With Quote
Old 06-29-2004, 02:53 PM   #4
.
 
Join Date: Nov 2003
Posts: 293
Working from a decnet set of examples might be a good thing to try.

http://koti.mbnet.fi/~atjs/mc6809/

Last edited by jim mcnamara; 06-29-2004 at 02:58 PM.
jim mcnamara is offline   Reply With Quote
Old 06-29-2004, 07:29 PM   #5
Registered User
 
Join Date: May 2004
Posts: 1,362
whether you are close to writing it correctly or not its still a damn good attempt.
im sure i saw a whole lot of emulator dev tutorials somewhere...
sand_man is offline   Reply With Quote
Old 06-29-2004, 07:51 PM   #6
i dont know
 
Vicious's Avatar
 
Join Date: May 2002
Posts: 1,200
Why Thank You!

I have managed to load a rom and it actually draws a few thing on the screen. I found a really good explanation of all the Instructions of the chip8, but I cant figure out how to implement the 'I' address register...
Vicious is offline   Reply With Quote
Old 06-29-2004, 08:53 PM   #7
Registered User
 
Codeplug's Avatar
 
Join Date: Mar 2003
Posts: 3,878
Out of curiosity, I looked up chip-8 and found alot of info on this forum.

gg
Codeplug is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Emulation resources sand_man Tech Board 0 01-16-2005 06:25 PM
Emulation program fifi C Programming 4 05-07-2003 06:21 AM
video game emulation Shadow A Brief History of Cprogramming.com 21 04-26-2002 09:19 AM
XP 9x/ME emulation doubleanti A Brief History of Cprogramming.com 7 02-09-2002 07:56 PM
Emulation Generator C++ Programming 1 08-16-2001 03:44 PM


All times are GMT -6. The time now is 10:39 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22