ChipAte Emulation

This is a discussion on ChipAte Emulation within the C Programming forums, part of the General Programming Boards category; I am writing my first wmulator and since there arent many good tutorials out there... I want to make sure ...

  1. #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;
      }
    }

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You mean other than the fact that you're using globals everywhere?

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #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 Attached Files

  4. #4
    .
    Join Date
    Nov 2003
    Posts
    307
    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.

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    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...

  6. #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...

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,643
    Out of curiosity, I looked up chip-8 and found alot of info on this forum.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

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

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