What's new

CHIP8 DrawSprite

refraction

PCSX2 Coder
Kevin19 said:
That is exactly the way i work by

Gathering all the information on the system myself and then i start putting it all together

So what systems have you emulated yet If you do not mind i ask


just chip8 :D but im a very novice programmer, i would even say some of it was fluke mixed with my eye for spotting problems.

I intend on stepping up to Gameboy or NES next tho.
 
OP
K

Kevin19

New member
I am sorry for quoting you I always delete the quote at first when i start typing the message
But this time I hurried so much to respond that i forgot to remove it

Next time I will just use the quick reply

And about the novice programmer

I do not think that even one of the greatest minds even the best programmer could grasp that easily the concept of emulating a machine
It takes time and determination

starting to sound like a cheesy line from a bad movie

You seem to have posted over 160 posts
You cannot be that novice

Anyway i have gathered and still am gathering information on the 6502
I have emulated about %5 of the instructions

So if you or anybody is looking for any kind of information

I can post links
 

refraction

PCSX2 Coder
ive not been posting here long but ive been programming in C++ longer than i have been a member here :) but im still to grasp the basics of SDL (or any other graphics engine), Windows Programming like menus etc and some structuring methods like using classes.

When it comes to thinks like opcodes etc, i am fine with that :)

as for 6502 which was nes yes? i have enough links for that, but thanks anyway :)
 
OP
K

Kevin19

New member
In my opinion it is a waste of time to use and study 32-bit products
But of course it is easier and more functional to deal with it
 

refraction

PCSX2 Coder
indeed, i prefer my job to be easy and more understandable than asm, tho i intend on using slices of asm where i can for optimisation reasons
 
OP
K

Kevin19

New member
Optimization
You actually bumped into something that requires this kind of approach

The only Optimization that i used and I do not think it should even be called that
Is mod 13 on my chip8 emu to draw the pixels onto screen
and direct pointer to the screen buffer
 

zenogais

New member
Kevin19 said:
In my opinion it is a waste of time to use and study 32-bit products
But of course it is easier and more functional to deal with it

I don't see why this is a waste of time, as the majority of systems around nowadays are 32-bit systems.

Also, as for inline assembly in your C/C++ code, chances are you would never need it. Most compilers nowadays generate equal or better assembly language than your handcoded assembly "optimizations".
 
OP
K

Kevin19

New member
Yes I think it is a waste of time

And the majority Who cares about the majority Yes the majority is composed of people who dedicated their life to the learning of MFC Directx opengl etc..

But they are missing out on the real thing The thing that their 32 bit systems were made of

Going back to their roots

Maybe this is a crazy talk

But there are so many things to learn about your system that People just cannot see it with all the modern systems and tools that come out To make their life easier

and "optimizations" I do not know If you noticed it But i actually disagreed on this issue that you can hardly get any optimization especially when emulating 8 bit systems

But then again what do i know
I am just using logic
 
OP
K

Kevin19

New member
assuming that you people already have been through this part

How did you exactly handle the MMC the bank switching

I Got a few approaches in mind But i think they are too much complicated to be applicable

Except for one
Which is handling it through another array But i do not think that would do it
It is too cumbersome
 

smcd

Active member
Kevin19 is one of those people who won't listen to you even if you know what you're saying, you've not discovered this, yet? :p
 
OP
K

Kevin19

New member
I have read about 20 articles on the 6502

There is a lot of things that could be spared but after all it is kind of primitive

anyway according to my knowledge from the documents i have read
I would like to know if my formulas are correct Because i am going to duplicate them and change the values so they will fit to the other instructions

But i would still like to post them here to compare and see if everything is done right Because i sometimes get the feeling that something here is wrong

void ADCImmediate(char Immediate)
{
A=A+Immediate+Carry;
if((A+Immediate+Carry)==0)Zero=1;
if((A&0x80)==0x80)Negative=1;
if((A+Immediate+Carry)>127||(A+Immediate+Carry)<-128)Overflow=1;
if((A+Immediate+Carry)>=255)Carry=1;
}

void ADCZpg(char Zpg)
{
A=A+Memory[Zpg]+Carry;
if((A+Memory[Zpg]+Carry)==0)Zero=1;
if((A&0x80)==0x80)Negative=1;
if((A+Memory[Zpg]+Carry)>127||(A+Memory[Zpg]+Carry)<-128)Overflow=1;
if((A+Memory[Zpg]+Carry)>=255)Carry=1;
}

void ADCZpgX(char Zpg)
{
A=A+Memory[(Zpg^XIndex)]+Carry;
if((A+Memory[(Zpg^XIndex)]+Carry)==0)Zero=1;
if((A&0x80)==0x80)Negative=1;
if((A+Memory[(Zpg^XIndex)]+Carry)>127||(A+Memory[(Zpg^XIndex)]+Carry)<-128)Overflow=1;
if((A+Memory[(Zpg^XIndex)]+Carry)>=255)Carry=1;
}

void ADCAbsolute(int Absolute)
{
A=A+Memory[Absolute]+Carry;
if((A+Memory[Absolute]+Carry)==0)Zero=1;
if((A&0x80)==0x80)Negative=1;
if((A+Memory[Absolute]+Carry)>127||(A+Memory[Absolute]+Carry)<-128)Overflow=1;
if((A+Memory[Absolute]+Carry)>=255)Carry=1;
}

void ADCAbsoluteX(int Absolute)
{
A=A+Memory[(Absolute+XIndex)]+Carry;
if((A+Memory[(Absolute+XIndex)]+Carry)==0)Zero=1;
if((A&0x80)==0x80)Negative=1;
if((A+Memory[(Absolute+XIndex)]+Carry)>127||(A+Memory[(Absolute+XIndex)]+Carry)<-128)Overflow=1;
if((A+Memory[(Absolute+XIndex)]+Carry)>=255)Carry=1;
}

void ADCAbsoluteY(int Absolute)
{
A=A+Memory[(Absolute+YIndex)]+Carry;
if((A+Memory[(Absolute+YIndex)]+Carry)==0)Zero=1;
if((A&0x80)==0x80)Negative=1;
if((A+Memory[(Absolute+YIndex)]+Carry)>127||(A+Memory[(Absolute+YIndex)]+Carry)<-128)Overflow=1;
if((A+Memory[(Absolute+YIndex)]+Carry)>=255)Carry=1;
}

void ADCIndirectZpg(char Indirect)
{
int TempValue=((Memory[Indirect+1]<<8)+Memory[Indirect]);
A=A+Memory[TempValue]+Carry;
if((A+Memory[TempValue]+Carry)==0)Zero=1;
if((A&0x80)==0x80)Negative=1;
if((A+Memory[TempValue]+Carry)>127||(A+Memory[TempValue]+Carry)<-128)Overflow=1;
if((A+Memory[TempValue]+Carry)>=255)Carry=1;
}

void ADCIndirectZpgY(char Indirect)
{
int TempValue=((Memory[Indirect+1]<<8)+Memory[Indirect])+YIndex;
A=A+Memory[TempValue]+Carry;
if((A+Memory[TempValue]+Carry)==0)Zero=1;
if((A&0x80)==0x80)Negative=1;
if((A+Memory[TempValue]+Carry)>127||(A+Memory[TempValue]+Carry)<-128)Overflow=1;
if((A+Memory[TempValue]+Carry)>=255)Carry=1;
}

void ADCIndirectZpgX(char Indirect)
{
int TempValue=(((Memory[Indirect])+XIndex)+(Memory[Indirect+1]<<8));
A=A+Memory[TempValue]+Carry;
if((A+Memory[TempValue]+Carry)==0)Zero=1;
if((A&0x80)==0x80)Negative=1;
if((A+Memory[TempValue]+Carry)>127||(A+Memory[TempValue]+Carry)<-128)Overflow=1;
if((A+Memory[TempValue]+Carry)>=255)Carry=1;
}
 

Doomulation

?????????????????????????
Kevin19 said:
Yes I think it is a waste of time

And the majority Who cares about the majority Yes the majority is composed of people who dedicated their life to the learning of MFC Directx opengl etc..

But they are missing out on the real thing The thing that their 32 bit systems were made of

Going back to their roots

Maybe this is a crazy talk

But there are so many things to learn about your system that People just cannot see it with all the modern systems and tools that come out To make their life easier

and "optimizations" I do not know If you noticed it But i actually disagreed on this issue that you can hardly get any optimization especially when emulating 8 bit systems

But then again what do i know
I am just using logic
Actually, the C/C++ language and MFC is good things, as opposed to assembly. In C++, you can utilize classes, which can handle themselves. You can overload operators, and such. Classes, polymorphy, virtual functions... very handy things. Can't be done in assembly. You have do all the hard work of coding it. What would you rather do - code a 100 lines or code or 10?

Remember the general thumb rule of applications: the applications are supposed to "hide" their function for the user. The user knows how to use the application, but not how it works. Maybe you could say the same about the programming. You know how to use the C/C++ code, but you do not know what assembly is generated out of it.

Assembly is a major waste of time except in some situations where the compiler cannot do very good code.
 
OP
K

Kevin19

New member
Yes
as you can see most of the code i am doing in C
But assembly gives you pretty much the background

if you want to work on an emulator otherwise it would be pretty difficult to start without something to strenghten your knowledge and understanding

That is why I believe that it would be more beneficial and productive if people first started with ASSEMBLY and then moved on to a high programming language

AND about the MFC I like doing things from zero
Or it is just sloth to read one of the books i got here on MFC
and start a whole chapter with windows programming

So tell me is there any progress with your GB emulator

Because i am looking for someone to compare my code with

I really need to know if my functions are correct or could have been done differently before i proceed

Because i am going to use the same formulas on all the other instructions
 

Doomulation

?????????????????????????
Hehe, good reply glvertex :evil: that's exactly the point I'm trying to make!
As of now, the GB emulator I'm co-working on is under heavy development (read: it still has much to do before even concidering a release).
It runs only a few demos, very crippled. No speed control, no interrupt control, no sound emulation...
basically, it only draws the scanlines and has the ops done (probably with lots of bugs too).
 
OP
K

Kevin19

New member
HAHAHA
Read what and here
I only asked for a little observation

Because i foresee a long time before i get any result displayed on the screen

It is going to be one hardass job to get anything running or drawn under dos
 

zenogais

New member
Actually, I spent a long while learning assembly langauge before I ever started on my first emulator. Assembly language is an excellent tool for the aspiring emu author, because it teaches you how the low-level hardware works and how it communicates. I'm just saying I wouldn't use it to code an emulator.
 
OP
K

Kevin19

New member
I am not sure what you people are getting at

But it is madness to even think of assembling such complexity as an emulator in assembly

And i have never attempted such thing before you get anything in your head

But yes like zenogais it is the best basis if you are working on an emulator or anything that requires knowledge of the system itself It is even a necessity

in my opinion
 

Doomulation

?????????????????????????
Now, if I translate this,

glVertex3f said:
"Why use a horse and buggy on the interstate when we have cars" - glVertex3f

...we'll get this:
"Why use assembly when you can use C/C++?"
OR
"Why use pure win32 api programming when you can use MFC?"

We will simply write out program without knowing how the inner working of the code we use works :icecream:
Although knowing how the hardware communicates is a good thing... but it doesn't require asm.
 

Top