![]() |
| | #1 |
| i dont know Join Date: May 2002
Posts: 1,200
| ChipAte Emulation 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 | |
| | #2 |
| +++ OK NO CARRIER 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 | |
| | #3 |
| i dont know 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. |
| Vicious is offline | |
| | #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 | |
| | #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 | |
| | #6 |
| i dont know 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 | |
| | #7 |
| Registered User Join Date: Mar 2003
Posts: 3,878
| |
| Codeplug is online now | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |