#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 (see below).
Uint16 size-Character size (see below).
void --Nothing is returned.
Set the character size of each scroll surface and the number of colors used for scrolling.
Parameter description.
type:
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 : Character size in 1x1 cell.
CHAR_SIZE_2x2 : Character size in 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 * coldaddr;
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 * coldaddr --VRAM start address of color data.
Uint16 type --Pattern name data (described later).
void --Nothing is returned.
Set the page for each scroll surface.
For celaddr, either the offset from the beginning of VDP2 (25E00000H) or the absolute address can be used. (Only the lower 20 bits are valid.)
The coladdr can be either an offset from the beginning of the color RAM (25F00000H) or an absolute address. (Only the lower 12 bits are valid.)
The following parameters are entered in type.
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 --Plain size (described later)
void --Nothing is returned.
Sets the plane size of each scroll plane.
The following parameters are entered in type.
PL_SIZE_1x1 : Horizontal 1 x Vertical 1
PL_SIZE_2x1 : Horizontal 2 x Vertical 1
PL_SIZE_2x2 : Horizontal 2 x Vertical 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 over processing mode (described later)
void --Nothing is returned.
Set the screen over processing mode for each rotating scroll surface.
Specify the following values for type.
0: Outside the area, the image set in the display area is repeated.
1: The specified character pattern is repeated outside the area.
2: Everything outside the area is transparent.
3: Everything outside the area of 512 vertical x 512 horizontal is transparent.
slOverRA sets the coefficient table A, and slOverRB sets the coefficient table B.
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 --VRAM start address of plane A pattern name data table.
void * map_b --VRAM start address of plane B pattern name data table.
void * map_c --VRAM start address of plane C pattern name data table.
void * map_d --VRAM start address of plane D pattern name data table.
void --Nothing is returned.
Make map settings for each normal scroll plane.
The configuration of the plane is as follows.
(0,0)
┌─┬─┐
│ A │ B │
├─┼─┤
│ C │ D │
└─┴─┘
For map_a, map_b, map_c, and map_d, you can specify the offset from the beginning of VDP2 (25E00000H) or the 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 --Rotation parameter pattern name Data table start address in VRAM
void --Nothing is returned.
Set up a rotation scroll map that uses each rotation parameter.
sl1MapRA ((void *) (0x25e20000));
#include "sgl.h"
Uint16 pname;
void slOverPatRA (pname);
void slOverPatRB (pname);
Uint16 pname-Pattern name for unmapped characters in rotary scrolling.
void --Nothing is returned.
Set the pattern name of the unmapped character of the rotary scroll.
/ * Pattern name data 2 For Word. * /
slOverRA (1);
slOverPatRA (2 << 30 | 0 << 28 | 4 << 16 | 0x240);
/ * ^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^ * /
/ * Upside down ↑ No special function ↑ ↑ Palette No4 ↑ Character 240H * /
The pattern name data specified by this function is valid only when mode 1 is set by the slOverRA function. If any other settings have been made, the pattern name data set by this function will be invalid.
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 below).
void --Nothing is returned.
Set 16 pages of rotary scroll map.
Set the map number for 16 pages in the array passed as an argument.
For the page number, enter the one counted in 0x800 units from the beginning of VRAM)
ABCD
EFGH
IJKL
MNOP
Set the above 4x4 pages in the array in the order of ABC ... NOP.
#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);
It is often the case that the page number table passed to the sl16MapRA function is not working properly because it does not match the actual VRAM.
In the sl16MapRA function and sl16MapRB function, it is assumed that the page numbers in the table are serial numbers counted from the beginning of VRAM.
Multiply the 0th element of the table by 0x800 and register the value as an address.
for example,
#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)
If the VRAM-B0 bank has a pattern name, the table must have values such as 128,132,136 ...
(It seems that there are many cases where data such as 0,4,8 ... is set)
#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);
If you set it by the above method, you can set it correctly.
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 --Address on VRAM to set ASCII
void --Nothing is returned.
Sets the default ASCII character (for 256 color mode, 128 cells) to the specified address.
Specify addr_A with an absolute address.
slScrAscSet ((void *) 0x25e00000);
There is no problem if you specify a direct value in the argument,
slScrAscSet (symb); <-(A)
* ( Uint32 *) (symb) = 0x20000000; <-(B)
If you specify a symbol like, and you want to use that symbol later,
The operation of (B) may not be performed correctly. (Depending on the optimization level of the compiler, etc.) When using this function, avoid such usage as much as possible.
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 --The address of the original data.
void * dst_A --Forwarding address.
Uint32 cel --Number of characters to expand.
Uint8 pal --The base palette number of the character to expand.
void --Nothing is returned.
Expands ASCII character data, where one pixel is compressed to 1 (4) bits, into character data for scrolling 256-color mode.
Each pixel has a palette number of 0 or 1.
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 --The address of the original data.
void * dst_A --Forwarding address.
Uint32 cel --Number of characters to expand.
Uint8 pal --The base palette number of the character to expand.
Sint32 skip --how many bytes to skip after expanding one cell for skip.
void --Nothing is returned.
Expands ASCII character data with 1 pixel compressed to 1 bit into character data for scrolling 16-color mode. Each pixel has a palette number of 0 or 1.
For skip, specify CG_Size / 2 when using a function dedicated to 256-color mode such as slPrint in 16-color mode.
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 []
ASCII character data that SGL has as default character data, expanded by the above setASC_1to8 function.
The number of characters is 128.
slScrAscSet | setASC_1to8 | setASC_1to4 | slPrint |
slPrintFX | slPrintHex | slDispHex |