slInitSystem also secures and initializes the work area used by other SGL functions.
If you use SGL functions, be sure to execute this function first. If you execute other SGL functions before executing slInitSystem, the operation cannot be guaranteed.
Left | : 0 |
Top | : 0 |
Right | : ScreenXSize - 1 |
Bottom | : ScreenYSize - 1 |
Zlimit | : 0x7fff |
CenterX | : ScreenXSize / 2 |
CenterY | : ScreenYSize / 2 |
PersAngle | : 90゜ |
ZdspLevel | : 1 |
Displayed scroll surface : NBG0, NBG1, RBG0 Scroll priority : NBG0 NBG1 NBG2 NBG3 RBG0 : 7 3 2 1 4 Sprite 0 : SPR0 (Polygon) Priority : 6 Other sprites : SPR1~SPR7 : 5 Number of scroll colors : 256 color mode on each side Color RAM mode : 1 (2048 out of 32768 colors) VRAM division : Both banks A and B are divided Character data : NBG0, NBG1 from 25E60000 : RBG0 from 25E00000 Character size : 8x8 dots on each side Pattern name data : NBG0 From 25E76000 : NBG1 From 257E7800 : RBG0 PA From 25E40000 : RBG0 PB From 25E50000 Pattern name size : NBG0 10-bit pattern name with inversion per word cell : NBG1 and RBG0 12-bit pattern name with no inversion per word cell Plain size : 64x64 cells on each side Back screen color : Black on 25E3FFFE (R=0,G=0,B=0) Rotation parameters : From 25E3FF00 Sprite data : Mixing palette and RGB format Special effect function : Do not use mosaic, color offset, etc. Sprite type : scnSPR3 ASCII character set : 0x25e00000(For RBG), 0x25e60000(For NBG)
slDynamicFrame
will be in charge.
Also, if the base interval number does not change, such as from 1 to -1, there is no need to reset SynchConst.
/* Switch from 1 int fixed to 2 int base undefined mode */ extern Uint8 SynchConst; /* unsigned int instead of signed int */ /* ^^^^^^ ^^^^^^^^ */ slInitSystem( TV_320x224, NULL, 1 ); : : /* Set indefinite interval mode-2 */ slDynamicFrame( ON ); SynchConst = 2; /* not -2 */ slSynch();
/* Change from 1 int indefinite interval to 1 int fixed interval */ slInitSystem( TV_320x224, NULL, -1 ); : : /* Set fixed interval mode 1 */ slDynamicFrame( OFF ); /* No need to change SynchConst */ slSynch();
Then, just before running slSynch, look at the system variable SynchCount. If SynchCount is a negative number, you can tell that processing is slow.
When I changed the parameter "Count" (frame switching count) to a negative number, it went out of control.
This phenomenon occurs when the executable file is placed in LowRam.
SGL does not consider placing programs in LowRAM because the transfer speed of LowRAM is slow and the SCU is outside of LowRAM's control.
When entering a sprite or polygon into the buffer, the clipping due to the Z limit and near limit is compared using the upper 16 bits of the Z value, and then primary sorting is performed using the upper 8 bits of the integer part.
Furthermore, for polygons and sprites of the same degree, secondary sorting is performed using the lower 8 bits of the integer part.
Therefore, it is never used for decimal parts.
Also, the SPR_ATTRIBUTE argument contains information about the number of colors from the beginning of the color RAM, so the boundaries per color will differ between 24-bit color and 15-bit color. Therefore, it is different from address offset.
For example, in 24-bit mode, the 256th color is an offset of 400h, but in 15-bit mode, it is 200h. For slPageNbg, the values given are 0x400 and 0x200, respectively, but for SPR_ATTRIBUTE, both are 256 (0x100).
Set the maximum number of possible processes in the third argument of slInitSystem.
However, since it only supports indeterminate mode, it is necessary to set it as a negative number.
When CPU processing is finished (just before calling slSynch and slInitSynch), set the system variable SynchCount to the number of frames previously set in slInitSystem.
In this case, please note the following checks when changing this value.
Disable interrupts.
Check that it is not during the VBlank period. To check, check the V counter register at bit 3 of the VDP2 screen status (address 25F80004).
If it is not the VBlank period, perform the above change process. If it is during the VBlank period, after performing the process c.), perform the processes a.) to c.) again.
Cancel interrupt.