Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Registers 'n Ports...Again

Reply to topic
Author Message
Chris
  • Guest
Reply with quote
Registers 'n Ports...Again
Post Posted: Sun Aug 22, 1999 7:56 pm
I just need a quick refresher on this stuff. When I'm emulating ports and registers should I keep and
use variables just as I would with emulating a CPU? For instance the joystick port. Here's a way
I was thinking of doing it:

Keep a variable called joy
If the user pressed Up Arrow, sending or adding 0111(high byte) or 7 * 16 to the joy variable.
If the emulator finds an op code like:

IN (0xDC) or
IN (0xC0)

Then to send the value contained in joy to the Z80 Accumulator. Is this good or bad?

Also, when I'm emulating the 8 VDP registers, reg(0 though 7), are all of them 8 bit? Is there any
special kind of port needed to access them?

Chris :o)
 
LSJMDM
  • Guest
Reply with quote
Post Posted: Mon Aug 23, 1999 11:52 am
Hello Chris:

I will try to solve yor problem the best i know.

Quote
> I just need a quick refresher on this stuff. When I'm emulating ports and registers should I keep and
> use variables just as I would with emulating a CPU? For instance the joystick port. Here's a way
> I was thinking of doing it:

Yes. In your code you must have a byte variable. When the user push the key, a handler set the right bit. When ç
the user releases the key, the hendlet unset the bit. Duirn emulation, if the Z80 claims to read the byte from
one port, you just return that byte. This is the way I emulate PADs on Calypso and Massage does it. Master
Gear actualizates the PADs once per frame, so it does not have a handler.

Quote
> Keep a variable called joy
> If the user pressed Up Arrow, sending or adding 0111(high byte) or 7 * 16 to the joy variable.
> If the emulator finds an op code like:

> IN (0xDC) or
> IN (0xC0)

> Then to send the value contained in joy to the Z80 Accumulator. Is this good or bad?

Yes. Absolutely right.

Quote
> Also, when I'm emulating the 8 VDP registers, reg(0 though 7), are all of them 8 bit? Is there any
> special kind of port needed to access them?

Yes. In my SMS VDP emulation (wich differs your VDP emulation A BIT) i have an array called byte vdp.reg[16]
(i have all the VDP variables in a struct). When the emulator wants to write to a register, uses the
WriteVDPR(byte r) function, which performs the write. The registers cannot be read anyway.

Saludos,
Jose Manuel
 
Chris
  • Guest
Reply with quote
Sweet!
Post Posted: Mon Aug 23, 1999 7:55 pm
I'm so proud of myself. All of my assumptions for emulating the joystick via keyboard were correct!
Thanks. And may I add that Calypso now runs on my P133! Full frameskip! I almost need to delay it!
Now, if we could only get digital sound instead of Adlib, then we'd be cooking with gas :o)

Keep up the excellent work,

Chris :o)
 
Chris
  • Guest
Reply with quote
Sweet!
Post Posted: Mon Aug 23, 1999 7:55 pm
I'm so proud of myself. All of my assumptions for emulating the joystick via keyboard were correct!
Thanks. And may I add that Calypso now runs on my P133! Full frameskip! I almost need to delay it!
Now, if we could only get digital sound instead of Adlib, then we'd be cooking with gas :o)

Keep up the excellent work,

Chris :o)
 
Reply to topic



Back to the top of this page

Back to SMS Power!