TileSet internal data

SGDK only sub forum

Moderator: Stef

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: TileSet internal data

Post by Chilly Willy » Sun Jan 22, 2023 6:09 pm

The HV counters are at 0xC00008.
5.) HV Counter
The HV counter returns the vertical and horizontal position of the television's raster beam.
Reading the HV counter will return the following data:
VC7 VC6 VC5 VC4 VC3 VC2 VC1 VC0 (D15-D08)
HC8 HC7 HC6 HC5 HC4 HC3 HC2 HC1 (D07-D00)
VCx = Vertical position in lines.
HCx = Horizontal position in pixels.
According to the manual, VC0 is replaced with VC8 when in interlace mode 2.
For 8-bit reads, the even byte (e.g. C00008h) returns the V counter, and the odd byte (e.g. C00009h)
returns the H counter.
The V counter counts up from 00h to EAh, then it jumps back to E5h and continues counting up to
FFh. This allows it to cover the entire 262 line display.
The H counter counts up from 00h to E9h, then it jumps back to 93h and continues counting up to
FFh. This allows it to cover an entire 342 pixel line.
The H counter description is based upon known information about the SMS VDP's H counter. The
SMS has a 256x192 display, and each line consists of 342 pixels. (that includes blanking, retrace, etc.)
The description *could* be accurate for the Genesis' 32-cell display mode. This is not the case for the
40-cell display, where I would assume the H counter jumps back farther at a later point in the count-up.

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Sun Jan 22, 2023 6:25 pm

Great thanks, will try !

There a test without, hard to sync tried multiple things with map update... And tested just on/off each frame, but maybe I may just go with gameplay on/off later, will see.

https://youtu.be/O34y6uDcK0I

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Mon Jan 23, 2023 5:42 pm

Thanks it works, and no need bothering with counting back since just need parity : *(u8*)0xC00008) & 1

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Mon Jan 23, 2023 7:38 pm


bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Tue May 16, 2023 7:57 pm

Ok i have not enough free time but I started to work on the road graph : https://youtu.be/jUYF_CTGJ5I
Will add basic things like "stop" & "stop lights", but not sure where to go, could be cool to experiment this anyway.

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Thu May 18, 2023 3:04 pm

Just made an unity exporter, since i dont use "usual" 2/1 isometric, and spritessheets i found doesnt suit well.
https://youtu.be/Hpt6u3kYgaY
Next will be vehicles collisions :)

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Thu May 18, 2023 3:10 pm

oh and i will export multiple colors using the animation key, to got a car paint, but not sure what the game will be about.

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Sat May 20, 2023 6:05 pm

Today I got transparency working without bugs using 0XC00008, using vscroll in hinterrupt, and filling a single line when needed, but it was damn slow (the interrupt was just applying vscroll depending of the counter), so I switched to just baking transparent tiles and uploading transparent/not transparent when switching between floor & roof : https://www.youtube.com/watch?v=qXNJM_frTGs

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Sat May 20, 2023 6:29 pm

Oh and I passed the pipe to Highlight & Shadows, would like to have day/night cycle with car headlight & car shadows, not sure about priorities of sprites, i read those docs :
https://segaretro.org/Sega_Mega_Drive/S ... _highlight
https://segaretro.org/Sega_Mega_Drive/Priority

The first one states : "If sprite with a shadow/highlight pixel occludes another sprite, the plane will be visible through that pixel (with shadow/highlight applied)."

How Im supposed to sort sprites ?

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Sun May 21, 2023 3:09 pm

oh didnt saw this: SPR_setDepth

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Thu Aug 10, 2023 5:16 pm

Added highlight & shadows, only sega makes it possible ;)
https://www.youtube.com/watch?v=D1FWgczm1us

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Tue Nov 14, 2023 8:56 pm

I just created a youtube channel for the prototype of my game : https://www.youtube.com/channel/UCgMiIG ... GwoTG3WFHw
Will take my time though ;)

AmateurSegaDev
Interested
Posts: 24
Joined: Sun Feb 27, 2022 3:27 am

Re: TileSet internal data

Post by AmateurSegaDev » Tue Dec 19, 2023 4:06 am

That's very neat. Can't think of any experience quite like that currently on the system.

bioloid
Very interested
Posts: 169
Joined: Fri May 18, 2012 8:22 pm

Re: TileSet internal data

Post by bioloid » Sun Dec 31, 2023 5:42 pm

Thanks! Yes no gta like on megadrive, but surely some open world out there.
I just put a test rom here : kstorm.org/rom.bin (no sound)
I will open a thread on Demos when I'll achieve to pack all things together.
Happy new year!

Post Reply