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 - A little confused about GFX

Reply to topic
Author Message
Jason Starr
  • Guest
Reply with quote
A little confused about GFX
Post Posted: Sat Feb 05, 2000 4:12 am
Ok people... at the moment I have hangon to the title screen loop where it waits for user input. I wanna make the title screen display so I guess this is where i start my GFX emulation. I was just wondering if any of you guys could help me out a little as I am still relatively new to coding and emulation and its hard to go from the docs to actual source code. Any help on stuff like scanlines, vblank , etc would be appreciated. Thanks again.

-Jason Starr-
 
Nyef
  • Guest
Reply with quote
Post Posted: Mon Feb 07, 2000 8:12 pm
Quote
> Ok people... at the moment I have hangon to the title screen loop where it waits for user input. I wanna make the title screen display so I guess this is where i start my GFX emulation. I was just wondering if any of you guys could help me out a little as I am still relatively new to coding and emulation and its hard to go from the docs to actual source code. Any help on stuff like scanlines, vblank , etc would be appreciated. Thanks again.

Well, when I start adding graphics to a new emulator, I start by laying out the system timing.

The first thing is to create a function that is called every scanline (227.5 cycles on the SMS by my count, but take that with a grain of salt). If you are using Marat's Z80 core, setting IPeriod to 228 will call Loop6502 at the correct times (adjust for whatever core you're actually using).

Next, I add all the I/O emulation code. VDP status reads, memory writes, register setting. status and registers will usually be stubs, but the memory access should be functional.

Continuing on, add a variable for the scanline (this value can get as high as 263 in some implementations, so make it at least 16 bits). Increment this by 1 every time through your scanline function, resetting it to 0 when it reaches 263.

Now, when the scanline counter is less than 192, you want to draw a scanline (don't worry about accuracy, just do something silly like displaying your pattern table. You can always fix it later). When it is 192, you want to set the VBlank bit in the status register, and probably copy your graphics buffer to the display screen and check for user input.

Don't forget about interrupts, and remember, this post consists almost entirely of lies and misleading information designed to lead you to enlightenment. ^_^

Quote
> -Jason Starr-

--Nyef
 
Reply to topic



Back to the top of this page

Back to SMS Power!