PDA

View Full Version : emucoding



GuestX
December 27th, 2002, 19:07
iīm trying to code a GB-Emu for fun but i donīt now how to
"Declare" this in the opcodes
Like:
LDI (HL), A
iīm trying
with
Public Const LDI As Long = 0
..
...
The NES is easier to understand....

GuestX
December 27th, 2002, 19:08
of course in visual basic

Cyberman
December 27th, 2002, 21:08
I strongly urg you to grab MAME source code and look at the Z80 CPU emulator they have in it.. unless you wish to completely make your own. However I suggest you also grab the Z80 Users Manual (http://www.zilog.com/docs/z80/um0080.pdf) for quick reference.
The Z80 opcodes are not the same length some are 1 byte some are 2 bytes some are 3 bytes some are 4 bytes in length. I'm not sure how you intend on interpreting the opcodes in memory I'm not going to ask either ;)

Cyb

Cyberman
December 27th, 2002, 21:11
You might want to look at this page as well Zilog Z80 product literature (http://www.zilog.com/products/familydocs.asp?BusinessLineID=274).

Cyb

GuestX
December 28th, 2002, 11:56
Thnx Cyberman, is the Gameboy emulateable with the Z80 processor. i currently added GB opcodes:
[code]
Public Const LDI As Long = 0
Public Const HL As Long = 1
Public Const A As Long = 2
Select Case xxxxx
case LDI, HL, A

i cant write LDI (HL), A

GuestX
December 28th, 2002, 11:57
Originally posted by SculleatR
Thnx Cyberman, is the Gameboy emulateable with the Z80 processor. i currently added GB opcodes:


Public Const LDI As Long = 0
Public Const HL As Long = 1
Public Const A As Long = 2
Select Case xxxxx
case LDI, HL, A

i cant write LDI (HL), A
:blush:

GuestX
December 28th, 2002, 12:06
Originally posted by SculleatR
Thnx Cyberman, is the Gameboy emulateable with the Z80 processor. i currently added GB opcodes:
[code]
Public Const LDI As Long = 0
Public Const HL As Long = 1
Public Const A As Long = 2
Select Case xxxxx
case LDI, HL, A

i cant write LDI (HL), A

but ofcourse i added all (i think) opcodes

GuestX
December 28th, 2002, 12:48
Z80 users manual is very good. Have to read it.

GuestX
December 28th, 2002, 13:34
but the 6502 processor is featured than the Z80, right ?
and the NES is emulated with very fast graphics in Visual Basic,
look at basicNES (NES emu in VB). Than GB must be emulateable
or Z80 in VB.

GuestX
December 28th, 2002, 13:44
NES emus coded in VB that i saw:
basicNES
Vertendo
Liss NES
MarioNES
all written in Visual Basic

GuestX
December 28th, 2002, 16:04
Originally posted by Cyberman
I strongly urg you to grab MAME source code and look at the Z80 CPU emulator they have in it..


where ?
Iīll search emuunlim, ..., ...

Doomulation
December 28th, 2002, 18:28
Don't post so many posts in a row. Generally, more than 3 or 2 posts in a row is concidered "spam". There is an edit button. Use it!

Cyberman
December 28th, 2002, 20:15
As far as I know the Game Boy uses the Z80 not the 6502 for it's processor. This is because the 6502 didn't have a low power core when they made the GB. The Z80 is a classic CISC toy so it's not too bad :)

As for MAME (http://www.mame.net) try that URL :P :)

:linux:

Oh.. as Doom suggested try to make your messages in a complete thought. IE think before you instantly reply too a message. This isn't IM and thousands of people are reading it probably going "What the heck is he talking about?"

Cyb

GuestX
December 29th, 2002, 14:42
i know, 6502 = NES

aprentice
December 29th, 2002, 15:37
Originally posted by SculleatR
Thnx Cyberman, is the Gameboy emulateable with the Z80 processor. i currently added GB opcodes:
[code]
Public Const LDI As Long = 0
Public Const HL As Long = 1
Public Const A As Long = 2
Select Case xxxxx
case LDI, HL, A

i cant write LDI (HL), A

First of all, you dont declare every opcode. You read the opcode first then run a switch statement.

opcode = ReadByte(from_rom)
switch(opcode)
case 0x1 etc...

I would say more, but I think you'd be better off getting some more experience in programming.

ScottJC
December 29th, 2002, 15:49
Visual Basic is nice, but its not exactly the best thing to develop an emulator in, in fact i'd say its the worst thing, its more for people who want to develop quick applications, not games/emulators;

But: Delphi does that better than Visual Basic does, alot better in fact, but thats still not much good for emulators or games, except you can use assembler in delphi i suppose! lol :)
(its faster than vb, and yer executables don't need those damn runtime librarys!)

ultimately it comes down to c/c++, because of its speed, etc, i'd like to figure out how the heck the gui stuff works, whenever i look at it, it just looks like golbledegook to me, i can do c++, just this gui stuff eludes me at the moment

but then again, why am I to preach? you can do it in whatever language you like, ^_^

GuestX
December 29th, 2002, 16:59
Originally posted by aprentice
First of all, you dont declare every opcode. You read the opcode first then run a switch statement.

opcode = ReadByte(from_rom)
switch(opcode)
case 0x1 etc...

I would say more, but I think you'd be better off getting some more experience in programming.

thnx apri, forgetted totaly switch, iīm a idi :blush:

" but I think you'd be better off getting some more experience in programming. "

youīre right...

Doomulation
December 30th, 2002, 00:50
Note though that delphis exes are damn big :(
But i suppose that he could try vb first to gain some programming experience...

GuestX
December 30th, 2002, 10:47
Fixed. Found very good info :phone:
iīm working now :)
---------------------------------------------------------------------- my current opcode code, Like:


If xxx = 10 Then ' RLC (HL)
regHL = rlc(regHL)
opcodes = 8

similar to my code...
this is a way of my opcodes.....

I'll emulate the sound with DirectX7, because Gameboy
is wav, or ?

GuestX
January 4th, 2003, 14:37
well, i have stopped work on GBemu because Visual
Basic is TO slow for Emulation.

Doomulation
January 4th, 2003, 18:12
Yes, you saw that at last. You need a really good computer for emulation in vb. Try to learn c++ first, then do an emulator.

GuestX
January 4th, 2003, 18:19
hey Doomultion,
how about Delphi ?
Because i wanted to learn it, it's Powerful :)

What's Faster ?:

Borland Delphi 3.0
Borland C++ Builder 1.0

GuestX
January 4th, 2003, 22:06
because I'm going to buy beginner books:
"Delphi for Kids" <------- includes Borland Delphi 3.0 Prof.
New: 25€
"C++ For Kids" <------- includes Borland C++ builder 1.0
New: 25€ Used: 10€

i don't wich is better to learn

mesman00
January 4th, 2003, 23:59
don't buy a "for kids" book, it might NOT include much. i suggest a SAMS teach yourself c++ in 24 days type deal, even though it will take a fell of alot longer than 24 days, its a good resource.

GuestX
January 5th, 2003, 00:43
thnx,
but i think i'm going to get a Kids book, i have readed a lot
of thinks like that.

But whats faster ?
delphi 3.0 or
c++ builder 1.0

Cyberman
January 5th, 2003, 03:36
Delphi3? Ack... BCB 1.0?
You can't make serious applications with those anymore.

Delphi 4 or BCB 4.0 maybe.. but it requires a lot of bug swatting!

Cyb

GuestX
January 5th, 2003, 09:57
I think i am going for Delphi, because i hate GUIs in C++

Delphi 3.0 Professional is still Faster than VB7 Or ???
I Don't think VB7 is a lot faster than VB6.

VB = Just BASIC,

i think Delphi 3.0 is alot faster than VB7, VB dosen't have
a real compiler, and Delphi has a Compiler, and with
Delphi you can port with CLX to Linux.

-----------------------------------------------------------------------
New post: (i would not post in a row, i have 2 points from the
last row):


I have readed more...Now: the Delphi version in the book
can be updated to Delphi 7 !!. I must download just the
update. I think i buy it.

GuestX
January 5th, 2003, 17:46
Originally posted by Cyberman
Delphi3? Ack... BCB 1.0?
You can't make serious applications with those anymore.

Delphi 4 or BCB 4.0 maybe.. but it requires a lot of bug swatting!

Cyb

well, i am Downloading currently Delphi 6.0 & 7.0 Enterprise :D
if one download dosenīt work. i hope to get Delphi 7.0
enterprise.

Doomulation
January 6th, 2003, 01:11
I'd still go for c++ :baaa:
But delphi works fine as well.

GuestX
January 6th, 2003, 11:25
For C++ i Canīt find beginner tutorials.

And Delphi 's Syntax is easier.

Nemu64 0.7A (i think) was coded in Delphi
before Lemmy started to port the code to C.
With Delphi you can make plugins for emus
like pj64 too.

Cyberman
January 7th, 2003, 04:34
Originally posted by SculleatR
For C++ i Canīt find beginner tutorials.

And Delphi 's Syntax is easier.

Nemu64 0.7A (i think) was coded in Delphi
before Lemmy started to port the code to C.
With Delphi you can make plugins for emus
like pj64 too.
Delphi is just object pascal.. however BCB's VCL is written in delphi. Kind of a chicken and egg thing I guess. :)

Cyb

Doomulation
January 7th, 2003, 13:11
I don't find c++ syntax very hard. The faulty in the language lies within the complexity of the code you must make.
Btw, just wondering, what is more powerful & better in speed? C++ or delphi?

GuestX
January 7th, 2003, 14:16
If you can help me i will learn C++.

GuestX
January 7th, 2003, 14:16
Or better, i learn C++, then i musen't change the language again.

Doomulation
January 7th, 2003, 14:41
Of course, i can learn you, and many others as well. What you first would need is to understand the basics of the language (pointers, references, etc)--it's a must know! It'll probably teach you the syntax as well. Then get some example source and study it. Learn it!

Then start making your own apps. Still have questions, ask them and we will hear you.

GuestX
January 7th, 2003, 14:52
thanks a lot.
do you have some links for beginners ?


P.S: new smilie: ";" :D

BTM
January 7th, 2003, 14:59
Originally posted by Doomulation
Of course, i can learn you

Can u realy LEARN him ?? :saint:

Falcon4ever
January 7th, 2003, 15:01
Originally posted by BTM
Can u realy LEARN him ?? :saint:

n00bs must help n00bs

:happy: :P

GuestX
January 7th, 2003, 15:05
Originally posted by BTM
Can u realy LEARN him ?? :saint:

some very little things i understand in C++ and
i think Doom can learn me.

BTM
January 7th, 2003, 15:12
Wrong : one teaches another , one learns by himself :]

GuestX
January 7th, 2003, 15:20
i'm looking totime for tutorials etc...

Trotterwatch
January 7th, 2003, 15:54
I'd be interested in some basic C++ advice as well. I've heard it's better to understand the concepts etc rather than the language at first as it then makes everything fall into place more quickly.

GuestX
January 7th, 2003, 17:55
I have downloaded "Teach Yourself C++ in 21 days Second
Edition". In the chapter: Who should read this book and
there is says you don't need any experience with c++
to start this book but i have a little VB experience.

Cyberman
January 7th, 2003, 23:40
My Advice on C++
Go through the book and follow the examples.. you learn by doing.
C++ (the original by Strousap) has under gone many metaphorasis since it's creation in the mid 80's.

First C++ is OOP your data no longer just STORES information .. it is part of the program.

Second Objects comunicate, IE they talk to each other and pass information and messages.

Third READ THE BOOK. Don't start programing stuff and learn bad habits.. READ THE BOOK. THEN do things. NEVER the other way around. When you get to the point where they say "now you try something to do this" you've likely learned enough to do some actual programing.

C++ is just a tool it's not GOD!

Like any tool it's only as good as the person weilding it. So learn to use the tool first them you can build something.

Cyb

GuestX
January 8th, 2003, 15:12
i've tried yesterday some C++, but the Sh!it is
hard to understand for a beginner. I Don't
know... C++...Delphi...
Delphi is Powerful too. And Its easier and
books are easier to find. (where i live)

Hell :geek:

GuestX
January 8th, 2003, 15:51
i still have two books from the town-bibliothek:
"Now I Learn Delphi"
"Delphi 3 Learning"

there are more like Delphi 6 Learning but i haven't found
it there (but it was not taken by someone)

tooie
January 9th, 2003, 00:17
c++ is not hard .. but really to do any programming language you have to do the psudeo code of what you are trying to do .. write out the psuedu code .. put here if needed.

Once you have fully working code .. it is easy to replace it with delphi or c++

But you have to understand exactly what you are trying to do first .. otherwise you can have an extremly hard time.

ScottJC
January 9th, 2003, 03:47
Who needs delphi 3 when you've got delphi 7!

I made this in it: who cares

GuestX
January 9th, 2003, 13:48
today i getted Delphi 6.0 fullversion. :phone:

Doomulation
January 9th, 2003, 14:59
Well, SculleatR, if you DO need help with c++, you must tell us what you don't understand. I know i'm not SO good at it, but i have some experience and can do stuff.

Anyway, good luck with delphi then.

GuestX
January 9th, 2003, 16:15
thnx, i wanna start it this evening.

I have getted today a Magazin wich was 3-4€.
the magazin includes 9 software fullversions:
Delphi 6.0
Kylix (i donīt know wich version)
IE6
FineReader (i donīt know wich version)

and some others (hehe)
cool magazin. ^_^