Here is some example code written in Basic to convert R-Type sprites from uncompressed 64K type 1 SNA to BMP format :[[file:R_extractspr.x]]
Example :
[[File:Spr_40.png]]
(Violet chars are marked as #36 so they are ignored)
[[User:Fano|Fano]] 16:47, 21 November 2009 (UTC)
==Level graphics==
Let's continue for 2K10 !
Game screen is composed of 8*5 blocks of 4*4 chars (8*8 pixies).Blocks are stored in memory in the same way as sprites except char pixies are always presents.
Per char :
*BYTE : flags, defines color, bit 7 defines if char is solid.
*BYTE*8 : 1bit graphics
There are 16 chars so 144 bytes per block.
Levels are composed of columns of 5 blocks.The first column of the level is located at #C4B1 (byte).The column number 0 is located at (#C4BC)
A column address (word) can be computed like this : (column*5) + (#C4BC)
Each byte of the column is a block number :
* bit 7 -> set if verticaly reversed
* bit 6 -> set if horizontaly reversed
* bits 0->5 block index
Using block index , it is possible to compute address (word) with this simple formula :
(#C4BC)-((index+1)*144)
Routine at #167B solves block index in A and return block address in HL.
Code located at #5C4F draws the first screen of the level before scrolling.It uses the sprite code (#8D08,#8D70,#8DDE,#8E34) to put the level graphics on screen.
Current column is located at #7A84 and there is a copy of (#C4BC) at #C4AE.When game passes a checkpoint , it saves the current column at #C4AE so when player dies, game restarts at #C4AE.
Code located at #8A7F feeds scrolling , update attribute array , draw blocks on right side of the screen.There are 4 routines to feed scroll according to reverse flags.
* #1E4C - x=N y=N
* #1E83 - x=R y=N
* #1EC3 - x=N y=R
* #1640 - x=R y=R
[[User:Fano|Fano]] 20:23, 6 January 2010 (UTC)