Post by Tom Maneiro on Mar 11, 2010 22:32:12 GMT -5
I'm back to the coding!
Since ROM/RAM space is precious, and the Genesis is no RAM stash, i've decided to switch to tile maps for all of my upcoming projects. But right now, i'm having a ridiculous problem with DrawTiles and image maps:
This time i'm doing splash screens, and according with the great BEX docs, this line should do the trick:
drawtiles tslogo_map, 256, 1, 1, 38, 26
But instead, i get this corrupted crap:
However, if i use the old-fashioned loops...
reload tslogo_map for y = 0 to 25 for x = 0 to 37 readint z DrawTile z+256, x+1, y+1 next x next y
... it draws properly!
But it's too much code for me Also, after looking at the corrupted image, it looks like BEX is skipping a tile for each tile that it draws... It's me, my poor code, or yet another obscure BEX bug?
As far I tested, only the FAKE and MEMCOPY commands are broken. About the DRAWTILES, there is a conceptual error about this command: It uses 8-bit tilemaps, while Imagenesis give 16-bit tilemaps. So each value will read an extra 0, that's why the images seems corrupted. Here is user asm subroutine that SHOULD draw the Imagenesis's tilemaps.
where the adder works, for example, if your tiles starts at 256 in VRAM, and the tilemap starts at 0 (normal Imagenesis's map), put 256 in the adder and it will do the hard work for you. It was clear? This subroutine accepts whatever integer value, that means you can add directly to your tilemaps the number of pallete (+&2000, +&4000 and +&6000 for pallete 1,2 and 3, respectively), flip conditions (+$800 and +$1000 for horizontal and vertical flip, respectively) and priority (+$8000 for high priority).
P.S.: Devster, how the fuck can you pass an adress as an argument? If I put "a0 as Long", literally does nothing(well, it do something: random stuff), and "a0 as String" seems to destroy ALL the whole program.
EDIT: I forgot 3 things: 1) All the arguments needs to be, inclusive the adder. If you don't need it, put a zero. 2) It's dependant of the actual gfx plane defined with SETGFXPLANE, but isn't dependant of the pallete defined with INK, like all the commands to draw tiles(Feature that, I hope, should be removed in later versions) 3) TheElf and Alex Khan, I will answer you in the next 12 hours. I promess.
Last Edit: Mar 12, 2010 21:15:12 GMT -5 by Mairtrus
Post by TheMVRules on Mar 13, 2010 12:23:51 GMT -5
' By Tom Maneiro, modified by TheMVRules ' Usage: DrawTiles16 <address of map>, <vram tile offset>, <position x>, <position y>, <width>, <height>, <priority> ' Priority: 0=low, 1=high Declare sub DrawTiles16(map_adr as integer,tile_adr as integer,cur_x as integer,cur_y as integer,width as integer,height as integer,prio as integer) for y = 0 to width for x = 0 to height z=map_adr ctile=z+tile_adr+priority(prio) DrawTile ctile, x+cur_x, y+cur_y next next exit sub end sub
This is untested, but it should work. If it doesn't, I will change it. I am not on my BEX computer today. INK works on this one.
Last Edit: Mar 13, 2010 12:27:12 GMT -5 by TheMVRules