VDP register questions regarding the Sonic 1 disassembly

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
User avatar
BigEvilCorporation
Very interested
Posts: 202
Joined: Sat Sep 08, 2012 10:41 am
Contact:

VDP register questions regarding the Sonic 1 disassembly

Post by BigEvilCorporation » Wed Sep 17, 2014 12:11 pm

Hi all!

I'm trying to replicate the VDP setup and clear screen process in the Sonic 1 disassembly from SonicRetro.org, and this issue is bugging me.

There's two sets of VDP registers, one for initial setup (clearing CRAM, displaying checksum error) and one for the game itself:

Code: Select all

VDPSetupArray:	dc.w $8004, $8134, $8230, $8328	; XREF: VDPSetupGame
		dc.w $8407, $857C, $8600, $8700
		dc.w $8800, $8900, $8A00, $8B00
		dc.w $8C81, $8D3F, $8E00, $8F02
		dc.w $9001, $9100, $9200
That second register value, 0x34, doesn't include the "display enable" bit:
$01 - Mode Set Register No. 2
-----------------------------

d7 - TMS9918 / Genesis display select
d6 - DISP (Display Enable)
d5 - IE0 (Vertical Interrupt Enable)
d4 - M1 (DMA Enable)
d3 - M2 (PAL / NTSC)
d2 - SMS / Genesis display select
d1 - 0 (No effect)
d0 - 0 (See notes)
(from: http://cgfm2.emuviews.com/txt/genvdp.txt)

...and at no point can I find this bit being set manually in code. None of my own test apps work without this bit set, how does this ROM enable the display?
A blog of my Megadrive programming adventures: http://www.bigevilcorporation.co.uk

User avatar
MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Wed Sep 17, 2014 4:49 pm

Hello Matt,

I generally take a disassembly then search for all the VDP Register writes.

Using UMDK what I can do is to run Sonic 1 with Trace-Logging enabled, convert the Log then look for all the VDP Register actions. Then find the Register responsible for what ever facet I am interested in and keeping in mind that I am looking either for a VDP 1-Word or a VDP 2-Word action between Regs and CRAM,VRAM, VSRAM and SAT actions (your case just regs so look for 0x80+reg values).

If you are having issues I can fire up UMDK and get you a log but am hoping this should set you in the right direction.

Another option is to consider Exodus to get your answer here.

The main issue with a straight up Disassembly is that you may not be able to infer what the execution order of code is so it is best to get a UMDK Trace-Log or something similar: even using a Disassembly for all the 0x80+n "value for screen enable/etc" search as 1W and 2W actions and then simply asking MESS or some other Emulator to break on a certain address that that operation executes on.

Yes, 0x81 for you here or 0x81+"value for the register set to etc+'enable screen' bit" as 1W or doubled up for 2W.

Yes, Sonic 1 as I recall (correct me if I am wrong here...) has a 'cold-boot' and 'warm-boot' initialisation so as such ensure that you are looking at the correct init data.
UMDK Fanboy

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests