#include "sgl.h"
Uint16 type;
Uint16 size;
void slCharNbg0( type, size );
void slCharNbg1( type, size );
void slCharNbg2( type, size );
void slCharNbg3( type, size );
void slCharRbg0( type, size );
Uint16 type - Number of character colors (described later).
Uint16 size - Character size (described later).
void - returns nothing.
COL_TYPE_16 : Palette format 16 colors
COL_TYPE_256 : Palette format 256 colors
COL_TYPE_2048 : Palette format 2048 colors
COL_TYPE_32768 : RGB format 32768 colors
COL_TYPE_1M : RGB format 16.77 million colors size:
CHAR_SIZE_1x1 : Set character size to 1x1 cell.
CHAR_SIZE_2x2 : Set character size to 2x2 cells.
Set NBG1 to 256 color palette format and character size to 1x1 cell.
slCharNbg1 ( COL_TYPE_256 , CHAR_SIZE_1x1 );
#include "sgl.h"
void *celaddr;
void *coladdr;
Uint16 type;
void slPageNbg0( celaddr, coladdr, type );
void slPageNbg1( celaddr, coladdr, type );
void slPageNbg2( celaddr, coladdr, type );
void slPageNbg3( celaddr, coladdr, type );
void slPageRbg0( celaddr, coladdr, type );
void *celaddr - VRAM start address of cell data.
void *coladdr - VRAM start address of color data.
Uint16 type - Pattern name data (described later).
void - returns nothing.
PNB_1WORD : 1 word, lower 10 bits
PNB_1WORD | CN_12BIT : 1 word, lower 12 bits
PNB_2WORD : 2 words, lower 16 bits
slPageNbg1 ( ( void * )0x20000, 0, PNB_1WORD | CN_10BIT );
#include "sgl.h"
Uint16 type;
void slPlaneNbg0( type );
void slPlaneNbg1( type );
void slPlaneNbg2( type );
void slPlaneNbg3( type );
void slPlaneRA( type );
void slPlaneRB( type );
Uint16 type - Plane size (described later)
void - returns nothing.
PL_SIZE_1x1 : Width 1 x Height 1
PL_SIZE_2x1 : Width 2 x Height 1
PL_SIZE_2x2 : Width 2 x Height 2
slPlaneNBG0( PL_SIZE_2x2 );
slCharNbg0 | slCharNbg1 | slCharNbg2 | slCharRbg0 |
slPageNbg0 | slPageNbg1 | slPageNbg2 | slPageNbg3 |
slPageRbg0 | slMapNbg0 | slMapNbg1 | slMapNbg2 |
slMapNbg3 | sl1MapRA | sl1MapRB | slOverPatRA |
sl16MapRB | VDP2_PLSZ |
#include "sgl.h"
Uint16 type;
void slOverRA( type );
void slOverRB( type );
Uint16 type - Screen overflow processing mode (described later)
void - returns nothing.
slOverRA ( 3 );
slCharRbg0 | slPageRbg0 | slPlaneRA | slPlaneRB |
sl1MapRA | sl1MapRB | slOverPatRA | sl16MapRB |
VDP2_PLSZ |
#include "sgl.h"
void *map_a, *map_b, *map_c, *map_d;
void slMapNbg0( map_a, map_b, map_c, map_d );
void slMapNbg1( map_a, map_b, map_c, map_d );
void slMapNbg2( map_a, map_b, map_c, map_d );
void slMapNbg3( map_a, map_b, map_c, map_d );
void *map_a - Start address in VRAM of the pattern name data table of plane A.
void *map_b - Start address in VRAM of the pattern name data table of plane B.
void *map_c - Start address in VRAM of the pattern name data table of plane C.
void *map_d - Start address in VRAM of the pattern name data table of plane D.
void - returns nothing.
(0,0)
┌─┬─┐
│A│B│
├─┼─┤
│C│D│
└─┴─┘
For map_a, map_b, map_c, and map_d, you can specify an offset from the beginning of VDP2 (25E00000H) or an absolute address. (Only the lower 20 bits are valid.)
slMapNbg0 ( ( void * )0x50000, ( void * )0x25e50000, ( void * )0x50000,
( void * )0x50000 );
#include "sgl.h"
void *addr_A;
void sl1MapRA( addr_A );
void sl1MapRB( addr_A );
void *addr_A - Start address on VRAM of pattern name data table of rotation parameters
void - returns nothing.
sl1MapRA ( ( void * )( 0x25e20000 ) );
#include "sgl.h"
Uint16 pname;
void slOverPatRA( pname );
void slOverPatRB( pname );
Uint16 pname - Pattern name of off-map character for rotating scroll.
void - returns nothing.
/* For pattern name data 2 Word. */
slOverRA ( 1 );
slOverPatRA( 2 << 30 | 0 << 28 | 4 << 16 | 0x240 );
/* ^^^^^^^ ^^^^^^^ ^^^^^^^ ^^^^^ */
/* Vertical↑ No special↑ ↑Palette ↑Character */
/* flip function No.4 ↑240H */
slCharRbg0 | slPageRbg0 | slPlaneRA | slPlaneRB |
sl1MapRA | sl1MapRB | sl16MapRA | sl16MapRB |
VDP2_OVPNRA | VDP2_OVPNRB |
#include "sgl.h"
Uint8 map[ 16 ];
void sl16MapRA( map );
void sl16MapRB( map );
Uint8 map[ 16 ] - Map number for 16 pages (details will be explained later).
void - returns nothing.
#define MAPOFFSET (RBG0_MAP_ADR-VDP_VRAM_A0)/0x800
#define DD 4+MAPOFFSET
Uint8 map[16] = {
0*DD, 1*DD, 2*DD, 3*DD,
4*DD, 5*DD, 6*DD, 7*DD,
8*DD, 9*DD,10*DD,11*DD,
12*DD,13*DD,14*DD,15*DD,
};
#undef DD
sl16MapRA (map);
#define RBG0_CEL_ADR (VDP2_VRAM_A0)
#define RBG0_MAP_ADR (VDP2_VRAM_B0)
#define RBG0_COL_ADR (VDP2_COLRAM)
#define RBG0_KTB_ADR (VDP2_VRAM_A1)
#define RBG0_PRA_ADR (VDP2_VRAM_A1+ 0x1fe00)
As in the example above, if the VRAM-B0 bank has a pattern name, the table must be populated with values such as 128,132,136... #define MAPOFFSET (RBG0_MAP_ADR-VDP_VRAM_A0)/0x800
#define DD 4+MAPOFFSET
Uint8 map[16] = {
0*DD, 1*DD, 2*DD, 3*DD,
4*DD, 5*DD, 6*DD, 7*DD,
8*DD, 9*DD,10*DD,11*DD,
12*DD,13*DD,14*DD,15*DD,
};
#undef DD
sl16MapRA (map);
You can set it correctly by using the method described above.slCharRbg0 | slPageRbg0 | slPlaneRA | slPlaneRB |
slOverPatRA | sl1MapRA | sl1MapRB | VDP2_CHCTLB |
VDP2_PNCR | VDP2_MPABRB |
#include "sgl.h"
void *addr_A;
void slScrAscSet( addr_A );
void *addr_A - VRAM address to set ASCII
void - returns nothing.
slScrAscSet ( ( void * )0x25e00000 );
setASC_1to8 | setASC_1to4 | SGL_ASCII_CG | slPrint |
slPrintFX | slPrintHex | slDispHex |
#include "sgl.h"
Uint8 *src;
void *dst;
Uint32 cel;
Uint8 pal;
void setASC_1to8( src, dst ,cell ,pal );
Uint8 *src_A - Address of original data.
void *dst_A - Destination address.
Uint32 cel - Number of characters to expand.
Uint8 pal - Base palette number of the character to expand.
void - returns nothing.
Uint8 src[] = {
:
}
setASC_1to8 ( src, ( void * )0x25e20000, sizeof( src ), 2 );
slScrAscSet | setASC_1to4 | SGL_ASCII_CG | slPrint |
slPrintFX | slPrintHex | slDispHex |
#include "sgl.h"
Uint8 *src;
void *dst;
Uint32 cel;
Uint8 pal;
Sint32 skip;
void setASC_1to4( src, dst, cel, pal, skip );
Uint8 *src_A - Address of original data.
void *dst_A - Destination address.
Uint32 cel - Number of characters to expand.
Uint8 pal - Base palette number of the character to expand.
Sint32 skip - For skip, how many bytes to skip after expanding one cell.
void - returns nothing.
Uint8 src[] = {
:
}
setASC_1to4 ( src, ( void * )0x25e20000, sizeof( src ),
2, sizeof( src ) / 2 );
slScrAscSet | setASC_1to8 | SGL_ASCII_CG | slPrint |
slPrintFX | slPrintHex | slDispHex |
#include "sgl.h"
Uint8 SGL_ASCII_CG[]
slScrAscSet | setASC_1to8 | setASC_1to4 | slPrint |
slPrintFX | slPrintHex | slDispHex |