★ SGL User's Manual ★ PROGRAMMER'S STRUCT Figure 8-25 ASCII scroll image
ASCII scroll is composed of 128 cells and 256 colors in the system initialization state, and is set to use the normal scroll screen "NBG0". In addition, ASCII scroll data is stored in the following RAM areas.
Character data: 2000H from address 0x25e60000 Map data: 1000H from address 0x25e76000 Palette data: 20H from address 0x25f00000
![]() | If for some reason other scroll data is written in the above area, the ASCII scroll will be replaced with those data, and the scroll will be drawn in a different (incorrect) state from the default. |
Listing 8-7 sample_8_10_1: ASCII scrolling
/ * ------------------------------------------------ ---------------------- * /
/ * Ascii Scroll * /
/ * ------------------------------------------------ ---------------------- * /
#include "sgl.h"
#include "ss_scrol.h"
#define NBG1_CEL_ADR VDP2_VRAM_B1
#define NBG1_MAP_ADR (VDP2_VRAM_B1 + 0x18000)
#define NBG1_COL_ADR VDP2_COLRAM
#define BACK_COL_ADR (VDP2_VRAM_A1 + 0x1fffe)
void ss_main (void)
{
FIXED ascii_posx = SIPOSX, ascii_posy = SIPOSY;
slInitSystem (TV_320x224, NULL, 1);
slTVOff ();
slPrint ("Sample program 8.10.1", slLocate (9,2));
slColRAMMode (CRM16_1024);
slBack1ColSet ((void *) BACK_COL_ADR, 0);
slCharNbg1 (COL_TYPE_256, CHAR_SIZE_1x1);
slPageNbg1 ((void *) NBG1_CEL_ADR, 0, PNB_1WORD | CN_10BIT);
slPlaneNbg1 (PL_SIZE_1x1);
slMapNbg1 ((void *) NBG1_MAP_ADR, (void *) NBG1_MAP_ADR, (void *) NBG1_MAP_ADR, (void *) NBG1_MAP_ADR);
Map2VRAM (ascii_map, (void *) NBG1_MAP_ADR, 32, 4, 0, 0);
slScrAutoDisp (NBG0ON | NBG1ON);
slTVOn ();
while (1) {
slScrPosNbg1 (ascii_posx, ascii_posy);
ascii_posx + = POSX_UP;
slSynch ();
}
}

<Fig. 8-26 Transparent setting image model>
| Scroll surface that performs transparency processing | |||||
|---|---|---|---|---|---|
| NBG0 | NBG1 | NBG2 | NBG3 | RBG0 | |
| Price | NBG0ON | NBG1ON | NBG2ON | NBG3ON | RBG0ON |
The following sample program (Listing 8-8) actually uses the SGL library function "slScrTransparent" to realize scroll transparent color processing.
Listing 8-8 sample_8_10_2: Controlling transparent code
#include "sgl.h"
#include "ss_scrol.h"
#define NBG1_CEL_ADR VDP2_VRAM_B0
#define NBG1_MAP_ADR (VDP2_VRAM_B0 + 0x10000)
#define NBG1_COL_ADR (VDP2_COLRAM + 0x00200)
#define NBG2_CEL_ADR (VDP2_VRAM_B1 + 0x02000)
#define NBG2_MAP_ADR (VDP2_VRAM_B1 + 0x12000)
#define NBG2_COL_ADR (VDP2_COLRAM + 0x00400)
#define BACK_COL_ADR (VDP2_VRAM_A1 + 0x1fffe)
void ss_main (void)
{
Uint16 trns_flg = NBG1ON;
FIXED yama_posx = SIPOSX, yama_posy = SIPOSY;
FIXED am2_posx = SIPOSX, am2_posy = SIPOSY;
slInitSystem (TV_320x224, NULL, 1);
slTVOff ();
slPrint ("Sample program 8.10.2", slLocate (9,2));
slColRAMMode (CRM16_1024);
slBack1ColSet ((void *) BACK_COL_ADR, 0);
slCharNbg1 (COL_TYPE_256, CHAR_SIZE_1x1);
slPageNbg1 ((void *) NBG1_CEL_ADR, 0, PNB_1WORD | CN_10BIT);
slPlaneNbg1 (PL_SIZE_1x1);
slMapNbg1 ((void *) NBG1_MAP_ADR, (void *) NBG1_MAP_ADR, (void *) NBG1_MAP_ADR, (void *) NBG1_MAP_ADR);
Cel2VRAM (am2_cel, (void *) NBG1_CEL_ADR, 16000);
Map2VRAM (am2_map, (void *) NBG1_MAP_ADR, 32, 32, 1, 0);
Pal2CRAM (am2_pal, (void *) NBG1_COL_ADR, 256);
slCharNbg2 (COL_TYPE_256, CHAR_SIZE_1x1);
slPageNbg2 ((void *) NBG2_CEL_ADR, 0, PNB_1WORD | CN_12BIT);
slPlaneNbg2 (PL_SIZE_1x1);
slMapNbg2 ((void *) NBG2_MAP_ADR, (void *) NBG2_MAP_ADR, (void *) NBG2_MAP_ADR, (void *) NBG2_MAP_ADR);
Cel2VRAM (yama_cel, (void *) NBG2_CEL_ADR, 31808);
Map2VRAM (yama_map, (void *) NBG2_MAP_ADR, 32, 16, 2, 256);
Pal2CRAM (yama_pal, (void *) NBG2_COL_ADR, 256);
slScrPosNbg2 (yama_posx, yama_posy);
slScrPosNbg1 (am2_posx, am2_posy);
slScrTransparent (trns_flg);
slScrAutoDisp (NBG0ON | NBG1ON | NBG2ON);
slTVOn ();
while (1)
{
if (yama_posx> = (SX + SIPOSX))
{
if (trns_flg == NBG1ON)
trns_flg = 0;
else else
trns_flg = NBG1ON;
yama_posx = SIPOSX;
slScrTransparent (trns_flg);
}
slScrPosNbg2 (yama_posx, yama_posy);
yama_posx + = POSX_UP;
slScrPosNbg1 (am2_posx, am2_posy);
am2_posy + = POSY_UP;
slSynch ();
}
}

To perform color arithmetic processing, you need to take the following steps.
Substitute the values shown in the figure below for the parameters that correspond to the color calculation processing control to be used.
For details on the parameters, refer to "HARDWARE MANUAL vol.2: VDP2 User's Manual Chapter 12 Color Calculation".
Figure 8-27 Parameter assignment value (flag) of “slColorCalc”
● ColorCalc substitution value ● Calculation method: [CC_RATE | CC_ADD] | Calculation designated image: [CC_TOP | CC_2ND] | Extended color calculation: [CC_EXT] | Registration side: [NBG0ON | NBG1ON | NBG2ON | NBG3ON | RBG0ON | LNCLON | SPRON] |
Add by ratio: Color calculation (CC_RATE) by specifying the calculation ratio of TOP image and 2ND image Add as it is: Color calculation (CC_ADD) with a simple addition value of TOP image and 2ND image
| Scroll surface that performs color operations | |||||||
|---|---|---|---|---|---|---|---|
| NBG0 | NBG1 | NBG2 | NBG3 | RGB0 | LNCL | SPRITE | |
| Price | NBG0ON | NBG1ON | NBG2ON | NBG3ON | RBG0ON | LNCLON | SPRITEON |
However, if the addition method is adopted for the color calculation, the ratio specification has no meaning.

To use the line color screen, you need to take the following steps:
If you want to use a single color for the line color screen, use the function “slLine1ColSet”.
| Scroll surface to register | |||||
|---|---|---|---|---|---|
| NBG0 | NBG1 | NBG2 | NBG3 | RBG0 | |
| Price | NBG0ON | NBG1ON | NBG2ON | NBG3ON | RBG0ON |

| Scroll surface to register | |||||||
|---|---|---|---|---|---|---|---|
| NBG0 | NBG1 | NBG2 | NBG3 | RBG0 | BACK | SPRITE | |
| Price | NBG0ON | NBG1ON | NBG2ON | NBG3ON | RBG0ON | BACKON | SPRON |
★ SGL User's Manual ★ PROGRAMMER'S STRUCT