Sonic and Sega Retro Message Board: How I access to the sprite attribute table?(Genesis) - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Loading News Feed...
 

How I access to the sprite attribute table?(Genesis)

#1 User is offline RamiroR 

Posted 07 September 2008 - 12:00 AM

  • Posts: 347
  • Joined: 11-May 08
  • Gender:Male
  • Location:Argentina :)
  • Wiki edits:9
HI everyone,
I'm trying to develop a game, (I don't know of what yet) and I wrote some lines for loading palettes color, and also some tiles.
but now, I'm totaly LOST, how I do to build a sprite, put it on the screen, and control it position?

sorry if I'm doing something that I shouldn't. but I'm new and I'm a bit lost:P

edit: I think that the Sprite Attribute Table is at f800, but I can't access there, how I do it?
This post has been edited by RamiroR: 07 September 2008 - 11:03 PM

#2 User is offline Mad Echidna 

Posted 07 September 2008 - 12:05 AM

  • Gone
  • Posts: 5203
  • Joined: 13-January 03
  • Gender:Male
  • Wiki edits:4
Wow, that's like, the most open ended question in history.

Why don't you look through the Sonic 1 dissasemblies and see if you can draw some imspiration from there?

#3 User is offline RamiroR 

Posted 07 September 2008 - 12:15 AM

  • Posts: 347
  • Joined: 11-May 08
  • Gender:Male
  • Location:Argentina :)
  • Wiki edits:9
yes I tried but.. I read and read and read and read, and I sleep at the chair.lol
well. but really, I saw it... and nothing:S, I still without know about that:(

#4 User is offline muteKi 

Posted 07 September 2008 - 12:17 AM

  • HRC: Have Retro Controllers
  • Posts: 7094
  • Joined: 03-March 05
  • Gender:Male
  • Wiki edits:91
If you're using a split disassembly for S1 or S2, pretty much all of the art data is in separate files, often compressed. You may need to use The Sega Data Compressor or a similar program to decompress the data. It can then be edited in programs like SonMapEd and the like.

In terms of editing where objects are placed in a level, one of the best programs for doing so is SonEd 2, again recommended if you're using a split disassembly because it can easily edit the data related to level layout and placement.


I'm not going to go too far into detail here since it's probably best to at least look at some of the program documentation first.


EDIT: Well, this of course only applies if you're going to work with the Sonic engine as such. Otherwise disregard.
This post has been edited by muteKi: 07 September 2008 - 12:18 AM

#5 User is offline RamiroR 

Posted 07 September 2008 - 12:32 AM

  • Posts: 347
  • Joined: 11-May 08
  • Gender:Male
  • Location:Argentina :)
  • Wiki edits:9
but that's not my problem xD, I have the palletes and tiles in the memory already, but, I don't know how to make it appear at the screen :)

EDIT: there's not way to go it completly on AMS?:S
This post has been edited by RamiroR: 07 September 2008 - 12:40 AM

#6 User is offline shobiz 

Posted 07 September 2008 - 01:04 AM

  • Posts: 863
  • Joined: 27-March 05
  • Gender:Male
  • Location:Karachi, Pakistan
  • Wiki edits:4,411
You'll probably want to check out genvdp.txt, it has a lot of useful information on how the Mega Drive VDP works.

#7 User is offline RamiroR 

Posted 07 September 2008 - 10:52 AM

  • Posts: 347
  • Joined: 11-May 08
  • Gender:Male
  • Location:Argentina :)
  • Wiki edits:9
thanks you so much, I find about the sprites =P, and I have to read it again..

EDIT:
----------------------------------------------------------------------------
15.) Sprites
----------------------------------------------------------------------------

The Genesis can display a total of eighty 32x32 15-color sprites.
There are of course various restrictions on the display capacity, based
on current configuration of the VDP.

Sprite Attribute Table
----------------------

All sprite data is stored in a region of VRAM called sprite attribute table.
The table is 640 bytes in size. Each 8-byte entry has the following format:

Index + 0 : ------yy yyyyyyyy
Index + 2 : ----hhvv
Index + 3 : -lllllll
Index + 4 : pccvhnnn nnnnnnnn
Index + 6 : ------xx xxxxxxxx

y = Vertical coordinate of sprite
h = Horizontal size in cells (00b=1 cell, 11b=4 cells)
v = Vertical size in cells (00b=1 cell, 11b=4 cells)
l = Link field
p = Priority
c = Color palette
v = Vertical flip
h = Horizontal flip
n = Sprite pattern start index
x = Horizontal coordinate of sprite

I do not understand that, I mean. it hasn't any example :S
why index?, all the yyyyyyyyyy and all the xxxxxxxxxx, are in binary or what?:S

EDIT: problems HERE
This post has been edited by RamiroR: 08 September 2008 - 12:12 AM

#8 User is offline RamiroR 

Posted 07 September 2008 - 08:30 PM

  • Posts: 347
  • Joined: 11-May 08
  • Gender:Male
  • Location:Argentina :)
  • Wiki edits:9
now I have another problem :), I need to access to $f800 in vram memory but I can't.. it load the adress as 3800 and not as f800, why?:S

EDIT: SOLVED.
This post has been edited by RamiroR: 08 September 2008 - 12:00 AM

#9 User is offline Sik 

Posted 08 September 2008 - 07:30 AM

  • Sik is pronounced as "seek", not as "sick".
  • Posts: 6719
  • Joined: 17-March 06
  • Gender:Male
  • Project:being an asshole =P
  • Wiki edits:11
First of all, to everybody who says "look at a disassembly": it's easier to just explain the damn thing rather than looking into a disassembly (where the code is huge and a total mess and the game may not be doing something nice to deal with).

Don't mind about the index too much. The easiest way is to just give consecutive indices: 0, 1, 2, etc. OK, now, the sprite table is made of consecutive entries. Each entry is a sprite. Each entry contains the following data:
  • 16-bit: Y coordinate (add 128 to this)
  • 8-bit: Size (bits 0 and 1 set horizontal size, bits 2 and 3 set vertical size)
  • 8-bit: Index of next sprite (or 0 if last sprite)
  • 16-bit: First tile of the sprite (flipping applies to the entire sprite, not to every tile)
  • 16-bit: X coordinate (add 128 to this)
There. The sizes are 00 for 1 tile, 01 for 2 tiles, 10 for 3 tiles and 11 for 4 tiles. Remember that the third field points to the next sprite, so e.g. if you have 5 sprites, you'll have 1-2-3-4-0. Also, it's important to know how tiles are read for tiles:
00 04 08 12
01 05 09 13
02 06 10 14
03 07 11 15


And remember to add 128 to the coordinates (so if you have e.g. coordinates 10,20, store it as 130,140). If you're still confused (and I guess probably you are, that wasn't a very good explanation), PM me =]

#10 User is offline TmEE 

Posted 08 September 2008 - 09:13 AM

  • Watermelons are good stuff
  • Posts: 1486
  • Joined: 06-January 08
  • Gender:Male
  • Location:Estonia, Rapla City
  • Project:Mélodie, Radical Rat, Cannon Cat, SMStrk
  • Wiki edits:11
Sik explained it like things are... it can't go any simpler

#11 User is offline RamiroR 

Posted 08 September 2008 - 09:26 AM

  • Posts: 347
  • Joined: 11-May 08
  • Gender:Male
  • Location:Argentina :)
  • Wiki edits:9
mm I still without understand the "First tile of the sprite (flipping applies to the entire sprite, not to every tile)" , what I have to put there? the adress of the begining of the patterns in the vram?

thanks for explaining anyway :D

Quote

First of all, to everybody who says "look at a disassembly": it's easier to just explain the damn thing rather than looking into a disassembly (where the code is huge and a total mess and the game may not be doing something nice to deal with).


Amen!:P

EDIT: it's like this?
		dc.l	$00000000
		dc.l	$00000300; Y position
		dc.l	$00004444  
		dc.l	$00000002 
		dc.l	$11144000 
		dc.l	$42000000; I think that I need to put the adress in there
		dc.l	$00000000 
		dc.l	$00000300; X position

is something wrong?

now I'm feeling a bit stupid.. I think..
This post has been edited by RamiroR: 08 September 2008 - 09:36 AM

#12 User is offline TmEE 

Posted 08 September 2008 - 10:40 AM

  • Watermelons are good stuff
  • Posts: 1486
  • Joined: 06-January 08
  • Gender:Male
  • Location:Estonia, Rapla City
  • Project:Mélodie, Radical Rat, Cannon Cat, SMStrk
  • Wiki edits:11
DC.W YourYposHere
DC.B SizeAttributes
DC.B TheLinkingThing
DC.W PriorityPaletteFlippingStartTile
DC.W YourXposHere

#13 User is offline RamiroR 

Posted 08 September 2008 - 11:02 AM

  • Posts: 347
  • Joined: 11-May 08
  • Gender:Male
  • Location:Argentina :)
  • Wiki edits:9
now I understandd !!

thankss to you two! :D

#14 User is offline Sik 

Posted 08 September 2008 - 11:48 AM

  • Sik is pronounced as "seek", not as "sick".
  • Posts: 6719
  • Joined: 17-March 06
  • Gender:Male
  • Project:being an asshole =P
  • Wiki edits:11

View PostRamiroR, on Sep 8 2008, 12:26 PM, said:

mm I still without understand the "First tile of the sprite (flipping applies to the entire sprite, not to every tile)" , what I have to put there? the adress of the begining of the patterns in the vram?

Consecutive tiles are used for the sprite. So you basically specify what's the first of them. FXs can be defined here too (flipping, palette, priority). If you know how to specify tiles in the tilemaps, you know how to do it. And there goes the flipping thing: it flips the entire sprite, not every tile individually. So if you set it to for example flip horizontally, it'll flip the entire sprite, not every single tile individually.

Is it clear now? Oh, by the way, the first tile is the tile index in VRAM, not the address of its graphics in the ROM =P

#15 User is offline RamiroR 

Posted 08 September 2008 - 10:37 PM

  • Posts: 347
  • Joined: 11-May 08
  • Gender:Male
  • Location:Argentina :)
  • Wiki edits:9
I'm starting to understand.. I will edit this post if not.
I don't want to threat you like teachers.. so I can't want too much.. so. since now, I will try to understand it by my way, if I can't, I will try again, if I try again and I don't understand, I will edit this post :P

I don't know if I wrote this correctly(english isn't my native language)

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users