#include "sgl.h" Uint16 mode; void slCurScrn( mode );
Uint16 screen - Substitute variable indicating the type of BG.
void - returns nothing.
Set the debug string display screen to NBG2.
slCurScrn ( scnNBG2 );
slPrintHex | slPrintFX | slPrint | slPrintMatrix |
slScrAutoDisp | slScrCycleSet | slScrDisp | VDP2_MPABN0 |
VDP2_MPABN1 | VDP2_MPABN2 | VDP2_MPABN3 | VDP2_MPABRA |
#include "sgl.h" Uint16 pal; void slCurColor( pal );
Uint16 pal - pallet number.
void - returns nothing.
Set palette number 2 (0x25f00006 in 16-bit mode, 0x25f0000c in 32-bit mode) to be the display color of the debug string.
void slCurColor ( 2 );
slPrintHex | slPrintFX | slPrint | slPrintMatrix |
slScrAutoDisp | slScrCycleSet | slScrDisp | PrintColor |
VDP2_MPABN0 | VDP2_MPABN1 | VDP2_MPABN2 | VDP2_MPABN3 |
VDP2_MPABRA |
#include "sgl.h" Uint32 val; void *addr_A; void slDispHex( val, addr_A );
Uint32 val - the value you want to display.
void *addr_A - VRAM address of VDP2 you want to display. (absolute address) Usually specified with slLocate .
void - returns nothing.
Displays 100 ("00000064") at the (10,20) cell position of the specified BG.
slDispHex ( 100, slLocate ( 10, 20 ) );
slPrintHex | slCurScrn | slCurColor | slLocate |
slPrintFX | slPrint | slPrintMatrix | PrintColor |
#include "sgl.h" Uint32 val; void *addr_A; void slPrintHex( val, addr_A );
Uint32 val - the value you want to display.
void *addr_A - VRAM address of VDP2 you want to display. (absolute address) Usually specified with slLocate .
void - returns nothing.
Displays 100 (" 64") at the (10,20) cell position of the specified BG.
void slPrintHex ( 100, slLocate ( 10, 20 ) );
slPrintHex | slCurScrn | slCurColor | slLocate |
slPrintFX | slPrint | slPrintMatrix | PrintColor |
#include "sgl.h" FIXED val; void addr_A; void slPrintFX( val, addr_A );
Uint32 val - the value you want to display.
void *addr_A - VRAM address of VDP2 you want to display. (absolute address) Usually specified with slLocate .
void - returns nothing.
Displays 10.32 at cell (10,20) of the specified BG.
slPrintFX ( toFIXED ( 10.32 ), slLocate ( 10, 20 ) );
slPrintHex | slCurScrn | slCurColor | slLocate |
slDispHex | slPrint | slPrintMatrix | PrintColor |
#include "sgl.h" MATRIX val; void addr_A; void slPrintMatrix( val, addr_A );
MATRIX val - A MATRIX type value indicating the matrix you want to display.
void *addr_A - VRAM address of VDP2 you want to display. (absolute address) Usually specified with slLocate .
void - returns nothing.
Displays a certain matrix at the (10,20) cell position of the specified BG.
MATRIX matrix = { { toFIXED ( 1.0 ), toFIXED ( 10.3 ), toFIXED ( 9.2 ) }, { toFIXED ( -10.3 ), toFIXED ( 1.0 ), toFIXED ( 7.5 ) }, { toFIXED ( -9.2 ), toFIXED ( -7.5 ), toFIXED ( 1.0 ) }, { toFIXED ( 1.0 ), toFIXED ( 1.0 ), toFIXED ( 1.0 ) } }; slPrintMatrix ( matrix, slLocate ( 10, 20 );
slPrintHex | slCurScrn | slCurColor | slLocate |
slPrintFX | slPrint | slDispHex | PrintColor |
#include "sgl.h" char *val; void addr_A; void slPrint( val, addr_A );
char *val - The string you want to display. However, the end of the string shall be '\0'.
void *addr_A - VRAM address of VDP2 you want to display. (absolute address) Usually specified with slLocate .
void - returns nothing.
Displays "That's SGL" at cell (10,20) of the specified BG.
slPrintFX ( "That's SGL", slLocate ( 10, 20 ) );
slPrintHex | slCurScrn | slCurColor | slLocate |
slPrintFX | slDispHex | slPrintMatrix | PrintColor |
#include "sgl.h" Uint32 val; Uint32 slHex2Dec( val );
Uint32 val - the value you want to convert.
Uint32 - Converted number in BCD format.
Convert 100(0x64) to 256(0x100).
ret = slHex2Dec ( 100 );
#include "sgl.h" #include "sl_macro.h" void tbl; void addr_A; void slExtendScroll( tbl, addr_A );
void *tbl - Command table for slExtendScroll . Defined by the "sl_macro.h" header.
void *addr_A - VDP2 VRAM (absolute) address where map data to be expanded is placed
void - returns nothing.
Function : Function End() End of compressed data LocateA0(adr) Addressing in VRAM A0 area LocateA1(adr) Addressing in VRAM A1 area LocateB0(adr) Addressing in VRAM B0 area LocateB1(adr) Addressing in VRAM B1 area Set(cnt) Set the specified number of data (actual data follows) Stock(cnt) Set data while setting in stock buffer (″) Same(cnt,chr) Set the same character continuously Inc(cnt,chr) Set while increasing the character number Inc2(cnt,chr) Set the character number in increments of 2. Dec(cnt,chr) Set while decreasing the character number Dec2(cnt,chr) Set the character number by decreasing it by 2. Vline(cnt,chr) Arrange the same characters vertically VlineMinus(cnt,chr) Arrange the same characters vertically (upwards) Skip(offset) Shift the display address by an offset (offset is 1 byte) Skip2(offset) Shift the display address by an offset (offset is 2 bytes) Copy(src,cnt) Copy the data that has already been set (copy source is address) RelCopy(src,cnt) Copy the data that has already been set (copy source is relative) Fill(cnt,chr) Set the same character continuously (pointer does not move) (uses CPU D.M.A.) Block(hcnt,vcnt) Specify the number of horizontal and vertical cells, and set the data that follows within them. (The pointer moves to the right side of the block) BlockInc(hcnt,vcnt,chr) Specify the number of horizontal and vertical cells, and fill them in while increasing the character number (the pointer moves to the right side of the block) BlockInc2(hcnt,vcnt,chr) Specify the number of horizontal and vertical cells, and fill them in while increasing the character number by 2 (the pointer moves to the right side of the block) One(chr) Set only one character. High(cnt,chr) Set the same character in the upper byte. The count sets the number including this cell, and this macro is followed by the LChar macro. BlockFill(hcnt,vcnt,chr) Specify the number of horizontal and vertical cells and fill them with the same character number (the pointer moves to the right side of the block). Add(cnt,chr,add) Set the character number by increasing it by the specified number. (The value to be added is signed 8 bits) BlockAdd(hcnt,vcnt,chr,add) Specify the number of horizontal and vertical cells, and set the character numbers within them by increasing them. (The pointer moves to the right side of the block.)(The value to be added is signed 8 bits) Loop(cnt) Repeat until the next Until() for the specified number of times. Until() However, they cannot be nested. Char1(c) Actual data for 1 cell Char2(c1,c2) Actual data for 2 cells ... : Char8(c1,c2,c3,c4,c5,c6,c7,c8) Actual data for 8 cells LChar1(c) Character data for High (lower byte only) LChar2(c1,c2) Lower byte data for 2 cells ... LChar8(c1,c2,c3,c4,c5,c6,c7,c8) Lower byte data for 8 cells
Expands the data of the specified table to the beginning of VRAM A1 (25e20000h) of VDP2.
#include "sgl.h" #include "sl_macro.h" #define SpaceCHR 0x0000 #define WhiteCHR 0x00fe Uint8 SceneMap_1[] = { Fill( Page, Space ), /* Fill one page with spaces */ Loop( 4 ), /* After this, repeat up to Until() 4 times */ BlockFill( 8, 8, WhiteCHR ), /* Fill 8x8 block with WhiteCHR */ Skip( 8 ), /* Move the pointer 8 cells from the next position in the block */ BlockFill( 8, 8, WhiteCHR ), Skip( 8 ), BlockFill( 8, 8, WhiteCHR ), Skip( 8 ), BlockFill( 8, 8, WhiteCHR ), Skip2( 7 * Line + 16 ), /* Use Skip2 because the pointer movement distance exceeds 1 byte */ BlockFill( 8, 8, WhiteCHR ), Skip( 8 ), BlockFill( 8, 8, WhiteCHR ), Skip( 8 ), BlockFill( 8, 8, WhiteCHR ), Skip( 8 ), BlockFill( 8, 8, WhiteCHR ), Skip2( 7 * Line ), Until(), End() }; void slExtendScroll ( ( void * )Scene_Map1, ( void * )( VDP2_VRAM_A1 ) );
#include "sgl.h" Uint16 pos_x; set_vbar( pos_x );
Uint16 x_pos - X position to display CPU load gauge (1/cell)
void - returns nothing.
Displays the CPU load at the 10th cell horizontally.
set_vbar ( 10 ); slSynch (); reset_vbar ( 10 );
slCurScrn | slCurColor | slLocate | reset_vbar |
slSynch | slInitSynch | PrintColor | VDP2_MPABN0 |
#include "sgl.h" Uint16 pos_x; reset_vbar( pos_x );
Uint16 x_pos - X position to clear CPU load gauge (1/cell)
void - returns nothing.
Combine this function with set_vbar and the video synchronization function slSynch to check the operating time of the master CPU.
while(-1){ slExecuteEvent (); /* Event processing */ reset_vbar ( 39 ); /* Erase vertical bar */ slSynch (); /* Waiting for video synchronization */ set_vbar ( 39 ); /* Display vertical bar */ } [Explanation] Screen display starts immediately after slSynch finishes, so set the vertical bar in VRAM here. When event processing is executed in slExecuteEvent and all events have finished, if this vertical bar is deleted from VRAM, the vertical bar will no longer be visible in subsequent displays from that point on, and the length of the vertical bar that was visible will be reduced by the CPU. This is the time it was in operation.
slCurScrn | slCurColor | slLocate | set_vbar |
slSynch | slInitSynch | PrintColor | VDP2_MPABN0 |
#include "sgl.h" Uint16 x_pos, y_pos; void *slLocate( x_pos, y_pos );
Uint16 x_pos - X coordinate cell position (1/cell) Uint16 y_pos - cell position in Y coordinate (1/cell)
void* - VDP2 VRAM address.
The debug string "This is Test." is placed in the position relative to cell (10,10) on the screen. It is displayed.
slPrint ( "This is Test.", slLocate ( 10, 10 ) );
slPrintHex | slPrintFX | slPrint | slPrintMatrix |
VDP2_MPABN0 | VDP2_MPABN1 | VDP2_MPABN2 | VDP2_MPABN3 |
VDP2_MPABRA |
#include "sgl.h" Uint16 pos_x, pos_y; Uint16 mode; void *slLocateNbg( pos_x, pos_y, mode ); void *slLocateNbg0( pos_x, pos_y ); void *slLocateNbg1( pos_x, pos_y ); void *slLocateNbg2( pos_x, pos_y ); void *slLocateNbg3( pos_x, pos_y );
Uint16 pos_x - X coordinate position (1/cell) Uint16 pos_y - Y coordinate position (1/cell) Uint16 mode - The type of BG surface you want to know.
void * - Pointer of type void indicating the (absolute) address of VDP2's VRAM.
Check the VRAM address at cell (10,5) of NBG1.
addr = slLocateNbg ( 10, 5, scnNBG1 ); addr = slLocateNbg1 ( 10, 5 );
slLocate | slLocatePage | VDP2_MPABN0 |
#include "sgl.h" Uint16 pos_x, pos_y; Uint16 page; void *slLocatePage( pos_x, pos_y, page )
Uint16 pos_x - X coordinate position (1/cell) Uint16 pos_y - Y coordinate position (1/cell) Uint16 page - The page number you want to know. The page number has a boundary of 2000h based on the beginning of VDP2's VRAM.
void * - Pointer of type void indicating the (absolute) address of VDP2's VRAM.
Get the display address of cell position (6,4) on page number 4.
slLocatePage ( 6, 4, 4 );
slLocate | slLocatePage |