|
|
Search
|
|||||||
| Home | Register | Downloads | FAQ | Members List | Calendar | Arcade | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
ライチュウ
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: USA
Posts: 3,289
|
CHIP8 thread
Inspired by RAP, I decided to write a C8 emulator too. Here's the progress so far: Documents used: 1. Chip8 thread on Emutalk: http://www.emutalk.net/showthread.php?t=19894 2. Chip8 thread on our forums 3. Cowgod's documentation: http://devernay.free.fr/hacks/chip8/C8TECH10.HTM 4. Wikipedia: http://en.wikipedia.org/wiki/CHIP-8 5. David Winter's docs: http://www.pdc.kth.se/~lfo/chip8/CHIP8.htm Opcodes: Regular C8: 0nnn - SYS addr: Yes(Ignored) 00E0 - CLS: Yes 00EE - RET: Yes 1nnn - JP: Yes 2nnn - CALL: Yes 3xkk - SE: Yes 4xkk - SNE: Yes 5xy0 - SE: Yes 6xkk - LD: Yes 7xkk - ADD: Yes 8xy0 - LD: Yes 8xy1 - OR: Yes 8xy2 - AND: Yes 8xy3 - XOR: Yes 8xy4 - ADD: Yes 8xy5 - SUB: Yes 8xy6 - SHR: Yes 8xy7 - SUBN: Yes 8xyE - SHL: Yes 9xy0 - SNE: Yes Annn - LD: Yes Bnnn - JP: Yes Cxkk - RND: Yes Dxyn - DRW: Yes Ex9E - SKP: Yes ExA1 - SKNP: Yes Fx07 - LD: Yes Fx0A - LD: Yes Fx15 - LD: Yes Fx18 - LD: Yes Fx1E - ADD: Yes Fx29 - LD: Yes Fx33 - LD: Yes Fx55 - LD: Yes Fx65 - LD: Yes Total: 35/35 Super C8: 00Cn - SCD: No 00FB - SCR: No 00FC - SCL: No 00FD - EXIT: No 00FE - LOW: No 00FF - HIGH: No Dxy0 - DRW: No Fx30 - LD: No Fx75 - LD: No Fx85 - LD: No Total: 0/10 Grand Total: 35/45 Compatibility List[Playable, Ingame, Title, Broken]: Pong: Title: Never crashes, graphics glitches. Blitz: Broken: Crashes after about 3 seconds, graphics glitches. Status: Registers/memory array written out: Yes. Graphics: Yes, DirectX for now. Sound: Not yet[Who cares? It's a bloody beep!]. Input: Not yet. Update March 26: It has graphics!! ![]() ![]() Update(2/27/2009): I'm going to rewrite this thing from scratch eventually in C++/SDL. Here's the 'final' version of the old source, for those who might want to see it: http://code.google.com/p/chip8-emu/ Update(3/26/2009): "Rewrite" is complete. The emulator is using C++/DirectX[for now]. No source release yet, as I want it to work as close to 100% as possible before sharing. If you want proof, I'll show the source, but it's not ready for general consumption yet.
__________________
Last edited by Dax; March 26th, 2009 at 18:19.. Reason: Status of emulator |
|
|
|
| Advertisement | [Remove Advertisement] | ||
|
|
|
|
#2 (permalink) |
|
Moderator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2006
Location: Croatia
Posts: 4,191
|
Cool. I highly recommend that you make a debugger also which can really help you to iron bugs.
__________________
C2D E8400 3.00 Ghz | EP45-DS3 | HD4850 512MB | 4GB DDR2 800 | 640 + 250 GB HDD
SyncMaster 2233BW 22" | Logitech G5 | Logitech G15 | Windows 7 x64 |
|
|
|
|
|
#3 (permalink) |
|
Behind ur girlfriend :D
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2006
Location: Sydney, Australia
Posts: 18,832
|
OpenGL or gtfo!
__________________
![]() ![]() VBA-M | Xtemu | NGOHQ | Post Impact Productions | TNHW | XBCD 0.2.6 | Satanic666's Emulator Compiles Don't be a NOOB, READ THE NGEmu/EmuForums Rules of Conduct Need Help with ePSXe? This is your first stop!. If you don't post all the required information, you don't get help. Everytime someone posts a romsite, God kills a beautiful woman. |
|
|
|
|
|
#5 (permalink) |
![]() ![]() ![]() ![]() Join Date: Sep 2006
Location: Sweden
Posts: 509
|
You DO know what SDL is, right?!
__________________
![]() ( #1 Core2Duo E8400 @ 3.61 Ghz, 3072 MB DDR2-RAM @ 802mhz, XFX Geforce GTX260 XT - N-Lited WinXP SP3 and Arch Linux 64-bit). <- http://www.myspace.com/preptile -> | /P. Rep. |
|
|
|
|
|
#6 (permalink) |
|
Behind ur girlfriend :D
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2006
Location: Sydney, Australia
Posts: 18,832
|
Simple Directmedia Layer, can connect with any available API in the system, most commonly video implementation connects to OpenGL.
__________________
![]() ![]() VBA-M | Xtemu | NGOHQ | Post Impact Productions | TNHW | XBCD 0.2.6 | Satanic666's Emulator Compiles Don't be a NOOB, READ THE NGEmu/EmuForums Rules of Conduct Need Help with ePSXe? This is your first stop!. If you don't post all the required information, you don't get help. Everytime someone posts a romsite, God kills a beautiful woman. |
|
|
|
|
|
#7 (permalink) | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Post-Apocalyptic Earth
Posts: 3,902
|
its basically a way to show you what instructions are being run and at what address; it also can show registers, and what they have in them. you can also make it so that the debugger goes by 1 instruction at a time, so you can find bugs easier. shendo has a pic of his debugger in his chip8 thread: ![]() anyways, its not really needed, but it helps 'debugging' for problems. pcsx2's debugger for example, doesn't even work.
__________________
Quote:
check out my blog ![]() |
|
|
|
|
|
|
#8 (permalink) |
|
Moderator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2006
Location: Croatia
Posts: 4,191
|
Well it doesn't have to be anything special. If you take a look at my thread you will see that my debugger is simply 2 listboxes, one showing values of registers and other disassembled code. When you have that you are able to check if each opcode you execute gives desired result. Edit: I see cottonvibes beat me to it
__________________
C2D E8400 3.00 Ghz | EP45-DS3 | HD4850 512MB | 4GB DDR2 800 | 640 + 250 GB HDD
SyncMaster 2233BW 22" | Logitech G5 | Logitech G15 | Windows 7 x64 |
|
|
|
|
|
#9 (permalink) |
|
Administrator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Dec 2001
Location: Montreal, Canada
Posts: 7,842
|
ITs always nice to see new people making emulators. Even if its just a small step, its sometimes enough to get them hooked ![]() Hmmm I should redo mine in a standard programming language eventually
|
|
|
|
|
|
#10 (permalink) | |
|
ライチュウ
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: USA
Posts: 3,289
|
I have a question. I'm looking at Cowgod's documentation(http://devernay.free.fr/hacks/chip8/C8TECH10.HTM#3.0) and he says the following about the character data/sprites: Quote:
Also, thanks for all the positive feedback. It's encouraging.
__________________
|
|
|
|
|
|
|
#11 (permalink) |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,205
|
Yep, put the characters anywhere. Later on, when you run across an opcode that asks for the address, point it there. ![]() P.S.: You may also put your own custom Chip8/SChip instructions there just for lols and giggles when something tries to call a system instruction in those addresses. But that's just for fun. It may mess what you are running up badly... so that's not very recommended.
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 |
|
|
|
|
|
#12 (permalink) |
|
ライチュウ
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: USA
Posts: 3,289
|
Well, the characters are in the first bytes[0x0-0x5d], the ROM gets loaded at 0x200, and the rest of the RAM is zeroed. Now I'm ready to start fetching opcodes, right? Or did I miss any steps?
__________________
|
|
|
|
|
|
#13 (permalink) |
|
Moderator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2006
Location: Croatia
Posts: 4,191
|
That's basically it. Don't forget that almost all opcodes increase program counter by 2.
__________________
C2D E8400 3.00 Ghz | EP45-DS3 | HD4850 512MB | 4GB DDR2 800 | 640 + 250 GB HDD
SyncMaster 2233BW 22" | Logitech G5 | Logitech G15 | Windows 7 x64 |
|
|
|
|
|
#14 (permalink) |
|
Emu author
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: idk
Posts: 251
|
On the subject.... kind of a silly question but.. how does one decode the opcodes from that list? I understand 1nnn is an address but what address? One that I specify? Last edited by Zack; November 21st, 2008 at 21:27.. |
|
|
|
|
|
#15 (permalink) |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,205
|
Actually, I think program counter should be increased by 2 after every opcode regardless. Then if it's an opcode that skips the next instruction, increase the program counter by 2, if it's an opcode that delays the instruction, decrease program counter by 2.
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 |
|
|
|
|
|
#16 (permalink) |
|
ライチュウ
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: USA
Posts: 3,289
|
Well I think I'm sort of getting it. I have it printing whatever opcodes it finds out to the screen[and it's wildly printing info like zeroes, FF98, etc], but I'm not sure if I'm reading the opcodes correctly. I set regs.PC equal to 0x200 and have it going from there. Code:
opcode = RAM[regs.PC] + RAM[regs.PC++]; cout << hex << opcode << endl;
__________________
|
|
|
|
|
|
#17 (permalink) | |
|
Moderator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2006
Location: Croatia
Posts: 4,191
|
opcode = (RAM[regs.PC]<<8) | RAM[regs.PC+1]; Quote:
by ANDing that opcode with 0xFFF you will get 0x342 which is the address you have to jump to.
__________________
C2D E8400 3.00 Ghz | EP45-DS3 | HD4850 512MB | 4GB DDR2 800 | 640 + 250 GB HDD
SyncMaster 2233BW 22" | Logitech G5 | Logitech G15 | Windows 7 x64 Last edited by ShendoXT; November 21st, 2008 at 21:38.. |
|
|
|
|
|
|
#19 (permalink) |
|
Moderator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2006
Location: Croatia
Posts: 4,191
|
If you are asking how to know what instruction should be executed when you fetch an opcode you should AND it with 0xF000 and shift it to the right by 12. You can also use higher part of the opcode (RAM[PC]) to get the same result: Code:
switch ((RAM[PC] & 0xF0)>>4)
{
case 0x00:
break;
case 0x01:
break;
case 0x02:
break;
...
}
__________________
C2D E8400 3.00 Ghz | EP45-DS3 | HD4850 512MB | 4GB DDR2 800 | 640 + 250 GB HDD
SyncMaster 2233BW 22" | Logitech G5 | Logitech G15 | Windows 7 x64 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|