★ FAQ ★ SBL programming related As the default value
Viewpoint position (X = screen horizontal size / 2, Y = screen vertical size / 2, Z = 400)
Center point (X = screen horizontal size / 2, Y = screen vertical size / 2, Z = 0)
Is set to.
If this difference in the Z direction is set to 256, it will fit as the center.
please tell me in detail. For example, what is the setting value when the distance between the viewpoint and the reference point is 2.0 in the sprite function?
When it is tilted backward by rotating the X-axis, it disappears from the screen for a moment when it is perpendicular to the screen, and when it is tilted further, the back side becomes visible. Is that so?
This phenomenon occurs when the viewpoint is parallel to the center point of the surface of revolution. As a countermeasure, we recommend that you always check the angle between the viewpoint and the surface of revolution, and if they are parallel, process them on the software side.
This can happen because the 3rd bit of (0) is ignored if types 0, 3, 4, 8 to F are set or nothing is set in the function SCL_SetSpriteMode.
When I put a check routine in SPR_2SetChar and checked it, it seems that a NULL pointer is returned even though there is still memory that can be allocated by allocBlock.
Also, since it is nothing to change the library every time, if you can not secure sprites with SPR_2SetChar from the next version upgrade, please return it so that an error is returned.
static Vaddr allocBlock (Uint16 size) {
NullBlock * memblk = nullBlockTop;
NullBlock * prev = NULL;
NullBlock * second_best = NULL;
NullBlock * prev_second_best = NULL;
Vaddr p = (Vaddr) NULL;
while (memblk! = NULL) {
if (memblk-> size == size)
break;
if (memblk-> size> size) {
if ((second_best == NULL)
|| ((second_best! = NULL)
&& (memblk-> size <second_best-> size))) {
second_best = memblk;
prev_second_best = prev;
}
}
prev = memblk;
memblk = memblk-> next;
}
if (memblk == NULL) {
memblk = second_best;
prev = prev_second_best;
}
if (memblk! = NULL) {
Uint32 blocksize;
memblk-> size-= size;
blocksize = (Uint32) memblk-> size * 32;
p = (Vaddr) ((Uint32) memblk + blocksize-(Uint32) VRAM);
if ((memblk-> size == 0) && (prev! = NULL))
prev-> next = memblk-> next;
}
return p;
}
Uint16 color is equivalent to CMDCOLR (color control word) in the command table in the actual hardware-like operation of VDP1.
CMDCOLR (color control word) is also used to specify the priority with the scroll surface.
For more information,
Details → VDP2 Manual Chapter 9 “ Sprite Data ” As an example, in the case of sprite type 5, as you can see from Figure 9.1 of the VDP2 Manual, there are 3 priority bits (PR0 to PR2 in the figure), so there are 8 priorities. It is possible to specify a register'.
* Please note that you do not directly specify the priority value.
Processing is performed by setting the priority bit to.
The bit position depends on the sprite type used.
See Figure 9.1 in the VDP2 manual to see which bits are priority bits.
0100000100000000 = 0x4100 ||| ||| ||| +++ ---------- Specify palette 1 +++ -------------- Specify priority register 4
At the very beginning, you can get more than 512 colors, but once you register, you cannot get more than 256 colors.
As a workaround, when allocating a data area exceeding 256 colors, call the function as 256 colors at the end of allocating and manage it independently.
Normally, I think that it is a sprite that uses color data of 256 colors or more, so be sure to secure the color of the sprite last.
★ FAQ ★ SBL programming related