|
|
|||||||
| Home | Register | Downloads | FAQ | Members List | Calendar | Arcade | Mark Forums Read |
» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging
![]() |
|
|
Thread Tools | Display Modes |
|
|
#361 |
|
Emu Author
![]() ![]() ![]() ![]() Join Date: Dec 2004
Location: North Carolina
Posts: 599
|
i am still working on my chip8 emu that i recoded. rebuilding the input system, which is nearly done. than color change system is next. i had to write code to translate scan codes from the windows forms scancodes into directinput scancodes since there is no easy and direct way to do it -_-. also, if anyone has any info on the chip8 or superchip games that are considered hybrid games or use system calls, please post. |
|
|
|
| Advertisement | [Remove Advertisement] | ||
|
|
|
#362 |
|
Linux's worst nightmare..
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2004
Location: USA
Posts: 1,505
|
the chip16 spec doesnt seem to be finalized though...
__________________
OS: WinXP Professional Service Pack 3 CPU: Intel pentium 4 3.0GHz Video: Nvidia Geforce 8400GS Sound: ASUS Xonar DS 7.1 Channels 24-bit 192KHz PCI Interface Audio Card Memory: 512 MB HD: [C:] 140.36/449.09 GB Connection: Marvell Yukon 88E8053 PCI-E Gigabit Ethernet Controller |
|
|
|
|
|
#363 |
|
Emu Author
![]() ![]() ![]() ![]() Join Date: Dec 2004
Location: North Carolina
Posts: 599
|
so? does not hurt to start implementing it into a fully functional emulator as its being worked on.
|
|
|
|
|
|
#364 |
|
Code it the hard way :P
![]() ![]() ![]() ![]() ![]() Join Date: Jul 2008
Posts: 1,267
|
I might start working on a small implementations of it, like the basic parts, like memory class, and the registers, etc.
|
|
|
|
|
|
#365 |
|
Linux's worst nightmare..
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2004
Location: USA
Posts: 1,505
|
with my chip8 emulator i'm having issues with collision... I was just gonna let it go but its bugging me :/ pong and pong 2 works fine but with other games i have issues with collision here is my drawing code Code:
/*Draw an 8 bit line of pixels. ch represents the line to be drawn*/
public void drawpline(char ch,int x,int y,char flag,char vid[][]){
int mask = 1<<7;
int i=0;
for(i=0; i<8; i++){
//System.out.println("x with offset is" + (x+i));
if(x+i<64 && y<32){
/*there are 2 cases either vid at the current location is 'X' or 'O'*/
if(vid[y][x+i]=='X'){
/*if the bit is 1 at the line to draw */
if((mask&ch) !=0){
/*collision has occured*/
flag= 1;
vid[y][x+i]='O';
}
/*current pixel is X and current bit in ch is 0*/
/*exclusive or with 0 has no effect*/
else{
}
}
/*if current pixel is 0 set bit according to vid*/
else{
if((mask&ch) != 0){
vid[y][x+i]= 'X';
}
else{
vid[y][x+i]= 'O';
}
}
mask>>=1;
}
}
}
/*Draw pixel on the screen at location*/
public void drawpixel(char ch,int x,int y,int limit,char flag,char vid[][]){
/*collision flag starts at 0*/
flag=0;
int i=0;
for(i=0; i<limit; i++){
drawpline(mem[address+i],x,y+i,flag,vid);
}
}
__________________
OS: WinXP Professional Service Pack 3 CPU: Intel pentium 4 3.0GHz Video: Nvidia Geforce 8400GS Sound: ASUS Xonar DS 7.1 Channels 24-bit 192KHz PCI Interface Audio Card Memory: 512 MB HD: [C:] 140.36/449.09 GB Connection: Marvell Yukon 88E8053 PCI-E Gigabit Ethernet Controller Last edited by Bill_gates; October 25th, 2010 at 01:30.. |
|
|
|
|
|
#366 |
|
Emu Author
![]() ![]() ![]() ![]() Join Date: Dec 2004
Location: North Carolina
Posts: 599
|
it already seems like you got math errors in your code somewhere if you can not use the normal array sizes for the vid ram, as it should only be 32x64 so i would suggest fixing whatever is causing that problem. umm why are you adding x and i? that is most likely your vidram size problem. you read in a byte than you access the individual bits to determine the colors of the 8 pixels in the byte.
|
|
|
|
|
|
#367 |
|
ライチュウ|タオ
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: USA
Posts: 3,956
|
I'm trying to come up with a way to eliminate having a switch case for CHIP8 by using a function array. Does anyone have a recommended way of doing this? Or am I still sort of stuck using a bunch of ifs/switches to determine which opcode to call(since chip8 opcodes aren't all nice and neat like real CPUs)? My goal is to be able to do something like(pseudo code): Code:
void Execute()
{
GetNextOpcode();
opcodes[opcode]();
}
__________________
Last edited by Dax; October 24th, 2010 at 12:31.. |
|
|
|
|
|
#368 | ||
|
Linux's worst nightmare..
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2004
Location: USA
Posts: 1,505
|
Quote:
(btw the i is there to loop through all 8 bits in the char) Quote:
For example: Lets say you had 4 functions, funa funb func and fund (lets also say these functions dont take arguements and dont return anything) all youd need to do is: Code:
/*create an array of function pointers that take no args and dont return*/
void (*fun_ptr_arr[])(void) = {funa, funb, func,fund};
/*then to call func simply use:*/
fun_ptr_arr[2]();
__________________
OS: WinXP Professional Service Pack 3 CPU: Intel pentium 4 3.0GHz Video: Nvidia Geforce 8400GS Sound: ASUS Xonar DS 7.1 Channels 24-bit 192KHz PCI Interface Audio Card Memory: 512 MB HD: [C:] 140.36/449.09 GB Connection: Marvell Yukon 88E8053 PCI-E Gigabit Ethernet Controller Last edited by Bill_gates; October 25th, 2010 at 01:50.. |
||
|
|
|
|
|
#369 |
|
ライチュウ|タオ
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2006
Location: USA
Posts: 3,956
|
Err..I know how to make a function array. I was just curious if anyone had come up with a way to utilize it for CHIP8 without having need for extra processing elsewhere due to how funky CHIP8's opcodes are. The best I came up with was a switch case elsewhere that returns an integer in the array of functions to call. But that still has a switch case, which I wanted to avoid. :/
__________________
|
|
|
|
|
|
#370 |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
|
why do you want to avoid switch tables? it is possible to use function tables for the chip-8 opcodes; but to avoid having a 65536 element table you have to use nested-function tables. switch tables are faster though.
__________________
"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein check out my blog ![]() |
|
|
|
|
|
#371 | |
|
Registered User
Join Date: Sep 2010
Location: Sweden
Posts: 9
|
Quote:
if comparing: ADD V0, 4 and: ADD V0, V1 will both be using VF as an overflow flag (setting VF=1 when the sum is >0xff) or just one of them? According to: CHIP-8 - Wikipedia, the free encyclopedia only the second ADD V0, V1 does that. |
|
|
|
|
|
|
#372 |
|
Emu Author
![]() ![]() ![]() ![]() Join Date: Dec 2004
Location: North Carolina
Posts: 599
|
i believe technically both should, i should check if mine does or not. to get the full documentation i suggest you use multiple sources.
|
|
|
|
|
|
#373 | ||
|
Code it the hard way :P
![]() ![]() ![]() ![]() ![]() Join Date: Jul 2008
Posts: 1,267
|
Quote:
Quote:
|
||
|
|
|
|
|
#374 | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
|
Quote:
in cases where a switch statement is optimized good by the compiler it should be faster than a hash-table. a hash-table still has the problems of an array function table; its advantage is however you can save space if you don't use all the entries (2^(sizeof(instruction)*8)). saving space is good because it helps the cpu cache. in cases where you can use a small function table (<=256) to handle the opcodes, it should be faster than a hash table. the reasoning is that hash tables rely on a hashing function, and have to handle collisions. an array doesn't have to worry about that and is guaranteed constant time complexity. but we have shown in another thread that a switch table is faster than a function table in the above case. so in that case it makes sense that: switch table > function table > hash table. in the case however where you have to nest function tables, like in the chip8, the function tables have more overhead, so this isn't the way to go. (or you can make a 2^16 element function table which probably wouldn't be good cache-wise). hash-tables essentially are arrays internally, the difference is the array isn't accessed directly by the index, but instead by the hash value computed by a hashing function. so if a hash table ends up being faster than a function array, the reason is its smaller size. in the case of chip8 with an odd instruction structure, you need to have nested if/switch cases if you decide to do it with a switch table. if you decide to do use a hashing table with all possible instruction combinations as the keys, then it is possible its faster than using the switch case if the compiler has trouble optimizing the switch table. its something that needs to be bench-marked though (and depends on compiler optimizations so programming language and compiler matter), i wouldn't say it objectively is faster.
__________________
"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein check out my blog ![]() |
|
|
|
|
|
|
#375 |
|
Emu Author
![]() ![]() ![]() ![]() Join Date: Dec 2004
Location: North Carolina
Posts: 599
|
i wont have it up tonight due to my laptop being turned off but 1.0 of chip-8 advanced revolution is in a releasable state. it is missing some major features that i want included but i am releasing it now so people can take a look at it and find bugs and to simply break it in any odd way they can lol. the good news is one of my major features is in a partially working state. i have a function in a newer version that has managed to scan and pull out a list of controls for certain games but due to certain games not being aligned correctly, it is making the task a big more complex than i wanted so it may be a little while before the function is complete, but once complete, i will be working on a game database to auto assign default keys for certain games and allow reassignment for games so users can have an easier time playing the various games for the various chip-8 systems i intend to support. anyone who would like a detailed explanation as to the way my scanner works, feel free to ask. o and for anyone who has made any graphical enhancements to any emu or to chip-8 specifically, if you could explain to me how to do enhancements like that, i would greatly appreciate it. also, would appreciate any info on how to do a flicker free mode too. |
|
|
|
|
|
#376 |
|
Linux's worst nightmare..
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2004
Location: USA
Posts: 1,505
|
I've finally cleaned my code up enough to warrant a release. I'll put it up on google code along with screen shots and such tomorrow. I scrapped the ridiculousness I posted earlier and made a much more efficient and easier to follow drawing routine. I figured out how to use pictures and random colors for the pixels but those are hardly graphical enhancements :P i'll put up some screens of that tomorrow as well :P
__________________
OS: WinXP Professional Service Pack 3 CPU: Intel pentium 4 3.0GHz Video: Nvidia Geforce 8400GS Sound: ASUS Xonar DS 7.1 Channels 24-bit 192KHz PCI Interface Audio Card Memory: 512 MB HD: [C:] 140.36/449.09 GB Connection: Marvell Yukon 88E8053 PCI-E Gigabit Ethernet Controller |
|
|
|
|
|
#377 | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
|
Quote:
well essentially there's different algorithms for pixel scaling: Pixel art scaling algorithms - Wikipedia, the free encyclopedia i've implemented scale2x, scale3x, eagle2x and eagle3x before. all of the ones i mentioned have the algorithm listed in the wikipedia page, except eagle3x which i guessed how it worked. i don't know how 2xSAI works since i havn't been able to find an explanation of the algorithm anywhere. there's some code available for it, but its messy and hard to read. hqnx is the most complex as far as pixel scaling algorithms go. essentially its a 5000+ line switch statement which interpolates values according to what the author thought looked good. i also haven't implemented that one since there doesn't seem to be any description of the reasoning behind it, and the code is of course a mess. but anyways, the way they all work is they double, triple, or quadruple the resolution of the output buffer, and the actual pixels that get written to this bigger-buffer are based on the individual pixels in the input-buffer, and the pixels surrounding them. if you know the actual algorithm for the pixel scalers, then implementing them is pretty simple; but if you don't know the algorithm then you have to read other people's code, which is usually implemented very messy. as for flicker free mode, you can implement it different ways. R.A.P's version probably uses some more complex logic; but all mine does is not draw the screen when there's a sprite-hit. so all you have to do is keep a flag for when you have a sprite hit, and then don't draw if its true. it will have problems in some games, but i didn't want to waste time coding a better solution when i could spend that time working on something else. edit: oh and pixel scaling algorithms aren't going to work good for a chip8 emulator since theres just 2 colors. it works good for 8-bit/16-bit consoles though because their sprites are composed of different colored pixels.
__________________
"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein check out my blog ![]() |
|
|
|
|
|
|
#378 | |
|
Code it the hard way :P
![]() ![]() ![]() ![]() ![]() Join Date: Jul 2008
Posts: 1,267
|
Quote:
draw whole frame, only way I can see how you might do it. @cotton: Hashtables are good for huge lookups, since its faster to compute the hash and lookup than doing a lot of compares of 1000 items. switch-case is fine in chip8 but I hate nested code mess. My C# code uses reflection to find all the opcode handling methods based on their attribute and then adds it to the dictionary before the program runs. |
|
|
|
|
|
|
#379 |
|
Linux's worst nightmare..
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2004
Location: USA
Posts: 1,505
|
Some screens and a release
__________________
OS: WinXP Professional Service Pack 3 CPU: Intel pentium 4 3.0GHz Video: Nvidia Geforce 8400GS Sound: ASUS Xonar DS 7.1 Channels 24-bit 192KHz PCI Interface Audio Card Memory: 512 MB HD: [C:] 140.36/449.09 GB Connection: Marvell Yukon 88E8053 PCI-E Gigabit Ethernet Controller |
|
|
|
|
|
#380 |
|
Emu Author
![]() ![]() ![]() ![]() Join Date: Dec 2004
Location: North Carolina
Posts: 599
|
here is my rewrite of my chip-8 emulator. let me know how it runs and of any bugs you spot. mind you i am still working on some of the major features.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|