|
|
Search
|
|||||||
| Home | Register | Downloads | FAQ | Members List | Calendar | Arcade | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#41 (permalink) |
|
Registered User
Join Date: Sep 2006
Location: surrey
Posts: 45
|
I decided to go with directx instead. My emulator is progressing pretty well, it is now showing output to the screen. Still not quite right though. It's also quite slow. The main problem I'm having is that it freezes if I hold down a key, any ideas? (I'll post the source later) |
|
|
|
| Advertisement | [Remove Advertisement] | ||
|
|
|
|
#42 (permalink) | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Post-Apocalyptic Earth
Posts: 3,898
|
serge2k: how do you make a 'slow' chip8 emu using c++? ![]() also, a simple graphics solution is using StretchDIBits(). thats what i'm using for my NES emu (which is on a temporary hiatus since i'm occupied with pcsx2 coding :/)
__________________
Quote:
check out my blog ![]() |
|
|
|
|
|
|
#43 (permalink) |
|
Registered User
Join Date: Sep 2006
Location: surrey
Posts: 45
|
part of the problem is that although I've done plenty with java I'm still not very good with c++. The other part is that I haven't done any directx programming before. Unfortunately the second part led to me using such massive amounts of memory that the program would crash after about a minute. took 2 lines of code to fix. |
|
|
|
|
|
#44 (permalink) | |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,198
|
Quote:
I had a hell of a lot of problems with the output to the screen, and I really mean... hella lot. And then there were a lot of timing problems, too, but now I think I got everything quite right... well, bar the flickering filter since it breaks a few emu tests. The key freezing might attribute to that your key flag might be triggering a jump that is not jumping to where it should be... better pay attention to that. If I have the source codes to peek at, I'm sure we can work a thing or two out for both of these problems. Anyway, if you want to compare your screen output, maybe you can try my emu (attached to this post. You need Adobe AIR runtime to install and run it, Adobe AIR is available for free and is multiplatform, just Google her up), or try Fish 'n Chip or Chip'em. Fish 'n Chip is likely among the only other emulators that I think emulates almost everything correctly. Most of the rest just either glitches up something or doesn't do a particular part right... etc... well, not to say everyone should put their absolute best efforts into doing this right (because you would have understood how emulation works by the time you get something to output right on the screen), but at least, it's a first work, so make it right, ne? Oh yeah, and Chip'em, too. (is that the right name?) Chip'em has a really nice flickering filter. (inspiration for me to work on my own flickering filter) I'll post up a documentation for Chip-8 at some point...
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 Last edited by runawayprisoner; January 7th, 2009 at 21:43.. |
|
|
|
|
|
|
#45 (permalink) |
|
Registered User
Join Date: Sep 2006
Location: surrey
Posts: 45
|
well I'm trying to run the PONG program. It runs, displays the paddles and the score but the "ball" jumps around. Scores aren't registering quite right either. just tried breakout and it isn't working quite right either. I did just realize what was causing it to be so slow. Redrawing the screen on every single opcode instead of just when it changes. it's faster now. I think the problem is with my drawing code.l |
|
|
|
|
|
#46 (permalink) | |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,198
|
Quote:
The scores are calculated using the BCD opcode. Now note that... this one has to be correctly implemented for Pong scores to work right. BCD should work like this: - Take value in decimal of register VX (0 to 255) - Split values into hundreds, tens, and units... (123 would become 1 for hundreds, 2 for tens, and 3 for units) - Store hundreds to memory at address I, store tens to memory at address I+1, store units to memory at address I+2. - I is NOT and should NOT be affected before, after, or during this. For collision flag, when a draw opcode is called, VF is set to 0, right away, regardless of its previous value. Then if the calling bit is 1, and if the bit at the position that bit is going to be written to is also 1, VF is set to 1, and will stay at 1 all the time. And you should have a region set aside for video memory, then... just write the video memory to the screen output 50 or 60 times a second regardless of its state, then you won't have to worry about it going slow anymore.
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 |
|
|
|
|
|
|
#47 (permalink) | |
|
Registered User
![]() ![]() ![]() ![]() Join Date: Jul 2006
Location: you know...
Posts: 506
|
Quote:
I believe that PONG uses the FONT scheme instead of BCD so checks your insctructions to font... FX29 I points to the 4 x 5 font sprite of hex char in VX Fx29 - LD F, Vx Set I = location of sprite for digit Vx. The value of I is set to the location for the hexadecimal sprite corresponding to the value of Vx. See section 2.4, Display, for more information on the Chip-8 hexadecimal font. Source See if you are correct with this too.
__________________
The Empyrean |
|
|
|
|
|
|
#48 (permalink) | |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,198
|
Quote:
![]() FX29 should be... LD I, F[VX] or... LDF VX Instead of... LD F, VX Because there is no F register, so if you put F in there in the disassembler along with LD, it looks really confusing. rather... LD I, F[VX] seems cleaner. Similarly, FX33 should be... LD [i], BCD[VX] or... LDM I, BCD[VX] or... BCD VX Instead of... LD B, VX And again, just because there is no B register. I know some of us have the habit of making a universal LD function that takes any value from a register and load it into another register... so if you use that convention for F and B, it'll return an error or do something else altogether.Be careful. (I realized this error from my Gameboy emu... ack...)
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 |
|
|
|
|
|
|
#49 (permalink) |
|
Registered User
![]() ![]() ![]() ![]() Join Date: Jul 2006
Location: you know...
Posts: 506
|
I'm having problems with my Schip8 "emulator". The Chip8 games runs fine and runs schip8 games too but in the schip the "screen" is presented with some strange cuts ... look the "pac man" and "ant" (the ant game doesn't show the "land" too...) ![]() The dragon2 seems to have some issues too... ![]() Then I thought this could be a Scroll error stuff and I made this test (below) but the results seems to be correct. Code:
Processor cpu = new Processor();
int initialAddress = 0x200;
Engine videoMock =new Engine(cpu);
Emulator.setVideo(videoMock);
Emulator.init();
cpu.dataRegister.V[1] = 0x0; //x
cpu.dataRegister.V[2] = 0x0; //y
cpu.addressRegisterI = 0x20A; //initial sprit 16x16
cpu.getMemory().writeAt(initialAddress++, (short)0x00); //setting schip mode
cpu.getMemory().writeAt(initialAddress++, (short)0xFF);
cpu.getMemory().writeAt(initialAddress++, (short)0xD1); //draw 1 2 16x16 from 0x20A
cpu.getMemory().writeAt(initialAddress++, (short)0x20);
cpu.getMemory().writeAt(initialAddress++, (short)0x00); //scroll down 1
cpu.getMemory().writeAt(initialAddress++, (short)0xC1);
cpu.getMemory().writeAt(initialAddress++, (short)0x00); //scroll 4 to rigth
cpu.getMemory().writeAt(initialAddress++, (short)0xFB);
cpu.getMemory().writeAt(initialAddress++, (short)0x00); //scroll 4 to left
cpu.getMemory().writeAt(initialAddress++, (short)0xFC);
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.getMemory().writeAt(initialAddress++, (short)0x80); //10000000
cpu.getMemory().writeAt(initialAddress++, (short)0xFF); //11111111
cpu.step(); //set high
cpu.step(); //false draw, just put the 1s and 0s on matrix
print(videoMock.getFrame()); // take a snapshot, 1
cpu.step(); //scroll down 1
print(videoMock.getFrame()); // take a snapshot, 2
cpu.step(); //scroll 4 or 2 for rigth
print(videoMock.getFrame()); // take a snapshot, 3
cpu.step(); //scroll 4 or 2 for left
print(videoMock.getFrame()); // take a snapshot, 4
Snapshot 1 (just draw) ======================================== ======================================= 1|0|0|0|0|0|0|0|1|1|1|1|1|1|1|1|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0| 1|0|0|0|0|0|0|0|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0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0| 0|0|0|0|0|0|0|0|0|0|0|0|0| Im my "loggin" system shows... [VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=31 [VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=32 [VideoEngine] ERROR: Pixel[1] --> it couldn't be happen' x=132,y=30 .... So I think it can be a error of my part make the boundary over 131 (0-132). You guys mark pixel on this coordinate? Best regards,
__________________
The Empyrean Last edited by dreampeppers99; January 8th, 2009 at 20:30.. Reason: additional information |
|
|
|
|
|
#50 (permalink) |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,198
|
Yes, of course we mark pixels beyond the screen. Why? You didn't know that? ![]() The screen is like this: 0----------127 | | 63----------- Well, figuratively. Anyway, the screen "scrolls" itself when something is out of bounds. Namely... x128 would become x0. x-1 would become x127. x129 would become x2, and so on... you get the idea. Same goes for y coordinates. The best game to test this out of bound problem would be tank. As for Ant not showing the land, watch out for your scroll functions. Again... they "seemingly" look right, but the right output should show the land in Ant. I got this error when I confused scrolling left for scrolling right and vice versa, so maybe... try switching your scroll functions. As for the strange cuts, watch out for your bounding in the drawing function. You might be bounding it a bit too tight. x up to 127 (x < 128) should be displayed. y up to 63 (y < 64) should also be displayed. Anything beyond that is scrolled to the other side. Since there is no -1 or any negative number for that matter, you just need to check for 128 and 64. Oh, and make sure your Chip-8 game has a single pixel equate to 4 pixels in the schip screen, too, since some Chip-8 developers have this bizarre idea that that is the case when you run Chip-8 games in Super Chip interpreter, and then... the scrolling functions do half-pixel scrolls and so on. Well, you get the reason why. To test this behavior, get the emutest rom from the Fish 'n' Chip website.
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 Last edited by runawayprisoner; January 8th, 2009 at 20:24.. |
|
|
|
|
|
#51 (permalink) | ||
|
Registered User
![]() ![]() ![]() ![]() Join Date: Jul 2006
Location: you know...
Posts: 506
|
Quote:
(but just changing the x=128 to x=138, seems to solve my problem) Quote:
Have you seen the MegaChip (MCHIP) documentation? Thanks very much
__________________
The Empyrean |
||
|
|
|
|
|
#52 (permalink) | ||
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,198
|
Quote:
Quote:
As for the MegaChip, I haven't seen anything much of it aside from MegaTwister and MegaBlinky. It seems to have a 256 x 128 framebuffer, and 256 colors support, though I really fail to see the point of having that many colors. Seems like we're going to have to deal with quite a bizarre drawing function next... most likely something with fixed sprite size, and the pallete (16 colors max for each sprite, maybe?) would be right in front of the sprite data. Dunno... just a guess. They made the tech demo look so different (and slow) that I'm having weird feelings about this.
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 |
||
|
|
|
|
|
#53 (permalink) | ||
|
Registered User
![]() ![]() ![]() ![]() Join Date: Jul 2006
Location: you know...
Posts: 506
|
Quote:
Quote:
For a while I'll release my chip8 schip8 implementation and source code too... I hope it can help anyone that are looking for info to chip8 schip8.... The language was Java and the render was Java2D (you can but it can be slow if you are a bad coder as I'm). So it is the Chip8 Emulator made with Java.The chip8 games running under JChip8BR ![]() The schip8 games running under JChip8BR ![]() Dissambler with two differents ways. ![]() You can see the memory values and address. ![]() You can debug step by step and see the registers values thus like the Screen. (pong is doing that here) ![]() You can config some values at runtime. ![]() * check the "just draw at .... " there if you are playing pong is better put 1 however if you are playing schip games you can "skip" more frames. The JChip8BR and source code too are attached. 2shared - download jchip8br.rar Some notes: * The drw insctruction can draw "outside" of 64x32 or 128x64. * The chip8/schip8 rom doesn't have header, you can just load it starting from address 0x200. * The initial state of this "machine" is: programCounter = 0x200; stackPointer = 0x00; delayTimerDT = 0x00; soundTimerST = 0x00; v[0-f] = 0x00; * All the instruction are 2Bytes size, you get it by bigEndian way. * If you are using java, did you know about the unsigned types... on java. Well the insctruction ADD V[X],VALUE give me a lot of pain. Tetris game sends to you add 0xFF + 0x0F = ??? If you were using short you will have 0x10E however the right is 0x0E: jchip8br.util.Util.readUnsignedByte((byte) ((byte) 0xFF + (byte) 0x0f)); * Keep in mind the importance of V[F] as a "flag". * For graphics is better keep the 0s and 1s in a array is easy to handle. * Scroll Down X (easily with array way). Code:
--timesToScroll;
int[][] newvram = new int[xboundary][yboundary];
for (int y = 0; y < yboundary; y++) {
for (int x = 0; x < xboundary; x++) {
if (y <= timesToScroll) {
newvram[x][y] = 0x0;
} else {
newvram[x][y] = vram[x][y - (timesToScroll + 1)];
}
}
}
vram = newvram;
Code:
public void scroll4PixelsToLeft() {
log.debug("scroll left " + pixelsToShift);
int[][] newvram = new int[xboundary][yboundary];
for (int y = 0; y < yboundary; y++) {
for (int x = 0; x < xboundary; x++) {
if (pixelsToShift == 4) {
if (x == 134 || x == 135 || x == 136 || x == 137) {
newvram[x][y] = 0x0;
} else {
newvram[x][y] = vram[x + 4][y];
}
} else {
if (x == 62 || x == 63) {
newvram[x][y] = 0x0;
} else {
newvram[x][y] = vram[x + 2][y];
}
}
}
}
vram = newvram;
}
public void scroll4PixelsToRigth() {
log.debug("scroll right " + pixelsToShift);
int[][] newvram = new int[xboundary][yboundary];
for (int y = 0; y < yboundary; y++) {
for (int x = 0; x < xboundary; x++) {
if (pixelsToShift == 4) {
if (x == 0 || x == 1 || x == 2 || x == 3) {
newvram[x][y] = 0x0;
} else {
newvram[x][y] = vram[x - 4][y];
}
} else {
if (x == 0 || x == 1) {
newvram[x][y] = 0x0;
} else {
newvram[x][y] = vram[x - 2][y];
}
}
}
}
vram = newvram;
}
V[F] = 0x1; * Thanks for runawayprisoner & all docs info provide by Internet. ps: the problem quoted by runawayprisoner still exists in schip8 games.
__________________
The Empyrean Last edited by dreampeppers99; January 9th, 2009 at 16:26.. |
||
|
|
|
|
|
#54 (permalink) |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,198
|
Nice... I think it's looking very good. I like the two-way disassembler. You may be able to write a complete IDE for Chip-8 and Super Chip from that.Oh, as for adding, I think you can try doing some logical bit operations, too: VF = ([VX] + value > 0xFF) ? 1 : 0; (sets carry flag) VX = ([VX] + value) & 0xFF (this means keep the maximum as 0xFF) I did a lot of logical bit operations in my interpreter.
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 |
|
|
|
|
|
#55 (permalink) | |
|
Registered User
![]() ![]() ![]() ![]() Join Date: Jul 2006
Location: you know...
Posts: 506
|
Quote:
Could you give me some tips about the opengl. I know how to use (jogl) however I thought there is a way to sent my Matrix[128][64] and opengl prints it (as framebuffer stuff)? Or even use QUADS (I guess it is more approprieted)? [in case of using QUADS the coordinates x and y is a pain for my noob knowlegemente] And you, what you use on graphics for your implementation?
__________________
The Empyrean |
|
|
|
|
|
|
#56 (permalink) |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,198
|
OpenGL... mm... no idea. I did try to take it up at some point, but I gave up ultimately. I'm using ActionScript 3.0 to code my emulator, so it's using the built-in graphics controller of the Flash platform.
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 |
|
|
|
|
|
#57 (permalink) | |
|
Registered User
![]() ![]() ![]() ![]() Join Date: Jul 2006
Location: you know...
Posts: 506
|
Quote:
__________________
The Empyrean |
|
|
|
|
|
|
#58 (permalink) |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,198
|
It was included in post #44 of this thread. Here is a link You might need AIR runtime if you haven't installed that already. AIR runtime is available for free on Adobe, and it's probably a 15MB download or so.
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 |
|
|
|
|
|
#59 (permalink) | |
|
Moderator
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2006
Location: Croatia
Posts: 4,191
|
Cool emu dreampeppers99. Quote:
__________________
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 |
|
|
|
|
|
|
#60 (permalink) | |
|
Mobile Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: Santa Cruz, CA
Posts: 6,198
|
Quote:
You will also see this in Pong when you move your paddle past the top and bottom of the screen. It's not really looping... but... more like the image wraps around to the other side of the screen, respectively. Talking about hacks, a flickering filter might or might NOT be a hack... as weird as that sounds. What I mean is... you can set it so that your screen does not update when the collision flag is set and all scrollings would still be updated to the screen. It actually works... and does its job very well. Makes me wonder if that's another use (undocumented) of the collision flag. Also among the undocumented features is that for subtraction, when the result is zero or lower, the flag is set. It's not a carry flag there, it's a carry and zero flag. Cowgod didn't state it so in his document, and neither did David Winter. (Oh my god! ) The most obvious bug for this is in Ant where you can't move if you don't jump! Since the flag is never set if the result is zero, your ant never moves forward when it's on the ground! Higher levels (when you jump, your level rises) help, but ground level doesn't let you move at all. A positive value means you fell into a pit so that one doesn't have the flag set (a.k.a. you can't move the ant if it falls into a pit).Weird enough, most Chip-8 authors found this out all by themselves (probably from reading others' codes or from debugging the game) so there was no need to document it in the first place, but still.
__________________
cChip interpreter WIP - current status: Release Candidate LRx Filter RC - current performance rating: 9/10 |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|