★ FAQ ★ SGL programming relatedUse extern declarations for SGL system variables, not just PauseFlag.
there is.
This is described in SL_DEF.H. You can use this function or these macros to set the percentage of sprite color operations.
Is there a way to give priority arbitrarily when displaying at the same coordinates using slPutSprite?
in short,
slDispSprite (...); slSynch (); OtherProc (); ← It should be displayed at this point, but slSynch (); OtherProc (); ← It actually looks like it is displayed here
The phenomenon that occurs. How are you?
This is because VDP1 has a double frame buffer, so what the user writes to the command buffer is written to the back frame buffer at the next frame.
Therefore, the contents of the back buffer are displayed in the next frame after writing to the command buffer.
in short,
slDispSprite (...); slSynch (); ← At this time, the contents of the command are reflected in the back frame buffer. OtherProc (); slSynch (); ← At this point, the contents of the back frame buffer are overlaid with the VDP2 video. OtherProc (); ← Displayed here.
It will be the flow.
In other words, the contents of FormTbl cannot be changed within 1 unit processing under normal usage.
There are two possible ways to avoid this:
ComRdPtr, ComWrPtr
Refer to the contents of these two system variables.
When these two system variables are the same as the data referenced when the slave is processing slPutPolygon etc., the slave is not processing SGL.
However, since the slave CPU is always looking at the cache area, the address to be compared must also be in the cache. That is, system variables
ComWrPtr, ComRdPtr
Instead of looking at
ComWrPtr + 0x20000000
ComRdPtr + 0x20000000
Must see.
These registers point to the addresses where the slave is reading and writing commands, and if these values are the same, the slave can be considered to be in a standby state, so first of all, these two registers Compare the values and wait for the same value.
Next, execute slCashePurge from the slave side to purge the cache. Use slSlaveFunction for this.
for example,
slInitStstem (TV_320x224, TEXTURE_TBL, 1)
If FormTbl is specified as in, later changes,
TEXTURE_TBL [i] .Hsize = ....
TEXTURE_TBL [i] .Vsize = ....
TEXTURE_TBL [i] .CGadr = ....
TEXTURE_TBL [i] .HVsize = ....
It is a way to change it like this. If you use this method, you don't need to know the state of the slave, but you need to have enough space for the TEXTURE structure array (that is, MAX of the display sprite) when you first pass it to slInitSystem. I have.
* Depending on the character data transfer timing, the displayed character may be garbled. This is probably because when VDP1 transfers the character data to the framebuffer, the VRAM data is being rewritten by the character data transfer (even though it is still in use).
To avoid such a situation, transfer character data or lookup table data glow data in the function specified by slIntFunction, or wait for the drawing of VDP1 to finish before transferring.
To know the end of drawing of VDP1, you can judge by looking at the transfer end status register of VDP1 (see VDP1 User's Manual 4.6 Transfer end status register).
In addition to sprite and scroll priorities, you can also set shadows and color calculations between them.
This type of sprite is called a sprite type in VDP2.
The sprite type can be given to each sprite unit when VDP1 is set. In SGL, this setting can be done when setting the color palette.
Here is an example.
First, select the sprite type you want to use.
The default is sprite type 3. To change it, call the slSpriteType () function with the sprite type as an argument.
next
#define PrioNo0 (0 << 12) #define PrioNo1 (1 << 12) #define PrioNo2 (2 << 12) #define PrioNo3 (3 << 12) #define PrioNo4 (4 << 12) #define PrioNo5 (5 << 12) #define PrioNo6 (6 << 12) #define PrioNo7 (7 << 12)
Is defined.
・ For polygons
ATTRIBUTE (Single_Plane, SORT_CEN, tex1, PrioNo4 | 0x0010 , No_Gouraud, ..Here, the priority number of the polygon is set to 4. In other words, the priority number 0 to 7 can be set by taking OR for the palette number.
・ For slPutSprite and slDispSprite *
SPR_ATTRIBUTE (0, SprType6 | 0x0000 , No_Gouraud, CL256Bnk, sprNofilp);
This also specifies that sprite type 6 should be used when specifying the palette.
In either case, specify it in the colno member of the ATTR and SPR_ATTR structures.
・ For slSetSprite
SPRITE spr;
spr.CTRL = FUNC_Sprite;
spr.PMOD = MSBOn | WindowIn | MESHoff | ECenb;
spr.COLR = PrioNo2 | 0x0020;
::
::
And so on, specify the priority number (2 in this case) along with the palette in the color control word of the VDP1 command table. Also, the priority setting for each sprite type is slPriority or slPrioritySpr? Use a function. (slPrioritySpr? Is a macro.)
As an example
slPriority (scnSPR6, 5);
Or
slPrioritySpr6 (5);
will do.
Is the scroll side slPriorityNBG? And use functions such as slPriorityRBG0.
This is a Sega Saturn specification, so there is nothing you can do about it, but to avoid the dots shifting, you can either change the display position according to the rotation in the program, or when designing the sprite design, the dots will be rotated. Please respond by drawing a figure that takes into consideration the deviation in advance.
This is because the display size is displayed 1 dot larger than the display size specified by the hardware. If you want to avoid this, specify 0.99999 for the scale. This value is defined in SL_DEF.H by a macro called ORIGINAL.
★ FAQ ★ SGL programming related