Home
SGL Reference
Contents
1. Format Parameters Function Return Value Bool slResetDisableWait None This function disables system reset by pressing the reset button Execution results OK Successful NG Failed Remarks Execution of this function fails wnen the semaphore cannot be gotten because it is locked by another process This function waits for the termination of SMPC command execution If an interrupt back has been issued execution of this function fails Refer to HARDWARE MANUAL vol 1 SMPC slResetDisableWait 128 Bool System Management Function slResetEnable Reset enable no wait mode Format Parameters Function Return Value Bool slResetEnable None This function enables system reset by pressing the reset button Execution results OK Successful NG Failed Remarks Execution of this function fails when the semaphore cannot be gotten because it is locked by another process This function does not wait for the termination of SMPC command execution If an interrupt back has been issued this function is queued in the command cache Execution of this function fails if a command cache overflow occurs Refer to HARDWARE MANUAL vol 1 SMPC slResetEnable 129 Bool slResetEnableWait Reset enable wait mode System Management Function Format Parameters Function Return Value Bool slResetEnableWait None This function enables system reset by pressing the reset button
2. Format Parameters Function Return Value Bool slSequenceTempo Seqnm Tempo Uint8 Segqnm Sint16 Tempo Seqnm Sequence control number Tempo Tempo value This function changes the speed of the specified sound effect If the command buffer is full this function returns the FALSE value Remarks Specify a value ranging from 1 to 7 for the parameter Seqnm Specify a value ranging from 32768 to 32767 for the parameter Tempo Tempo is the tempo value relative to the standard tempo 0 at 4096 1000h the tempo is doubled and at 4096 the tempo is halved Refer to Chapter 14 Sound Library slSequenceTempo 165 Bool slSndEffect Switch sound effect by DSP Sound Function Format Parameters Function Return Value Remarks Refer to Bool slSndEffect Effect Uint8 Effect Effect Effect bank number This function switches the sound effect generated by the DSP If the command buffer is full this function returns the FALSE value Specify a value ranging from 1 to 15 for the parameter Effect slSndEffect 166 Bool Sound Function slSndMapChange Change current sound map Format Parameters Function Return Value Remarks Refer to void sISndMapChange Map Uint8 Map Map Map number This function changes the current sound map When this function terminates normally it returns the address of the command buffer where the parameters were set If there
3. This function performs a block transfer using the CPU s DMA function For the cnt parameter specify how many bytes are to be transferred When a transfer is made to a cache area this function initializes the cache None Remarks The function sIDMACopy terminates soon after DMA is initiated To wait until the transfer is completed use the function sIDMAWait If another DMA transfer has already been initiated the function sIDMACopy waits until the other transfer terminates before initiating a new DMA transfer Refer to Chapter 9 Controller Input sIDMACopy 180 void sIDMA Wait Wait until termination of DMA transfer Miscellaneous Function Format Parameters Function Return Value Remarks void sIDMAWait void None This function waits until a DMA transfer initiated by the function sIDMACopy terminates None The function sIDMACopy always uses the same channel and if a transfer is in progress the function waits until the first transfer terminates before initiating the new one As a result the user can execute consecutive DMA transfers without needing to be conscious of the completion of the transfers An example is shown below _ Consecutive execution of DMA transfers _ce siDMACopy srcO dst0 cnt0 first transfer request siDMACopy src1 dst1 cnt1 second transfer request execute after termination of first transfe siDMACopy src2 dst2 cnt2 third transfer reques
4. Scroll Function void slOverRA RBG screen overflow processing setting for rotation parameters A Format void sllOverRA mode Uint16 mode Parameters mode _ Uint16 type value corresponding to the screen overflow processing mode specification 0 Outside of the display area repeat image set in the display area 1 Outside of the display area repeat the specified character pattern 2 Outside of the display area leave entire area clear 3 Outside of the 512 vertical x 512 horizontal display area leave everything clear Function This function sets the screen overflow processing mode for the rotating scroll The screen overflow processing setting specifies how when the rotating scroll graphics go beyond the display area to process the portion that exceeds the display area This setting is made for the rotating scroll plane size register Return Value None Remarks When the rotating scroll is in bitmap format mode 1 cannot be set Refer to Chapter 8 Scrolls slOverRA 35 Scroll Function void slOverRB RBG screen overflow processing setting for rotation parameters B Format void slOverRB mode Uint16 mode Parameters mode _ Uint16 type value corresponding to the screen overflow processing mode specification 0 Outside of the display area repeat image set in the display area 1 Outside of the display area repeat the specified character pattern 2 Outside of the display area leave entire area clear 3 Out
5. l yp 1 l Z l Kattan d i l l SiPus een m slPop SIP sl E m slPo i i E Refer to Chapter 5 Matrices slPopMatrix 81 Matrix Function Bool slPushMatrix Temporary storage of matrix up to 20 matrices can be nested Format Bool slPopMatrix Parameters None Function This function advances the matrix buffer pointer copies the previous current matrix to the stack and makes that the new current matrix Return Value If pointer allocation failed the function returns the FALSE value Remarks Up to 20 matrices can be nested in the buffer If an attempt is made to nest more than 20 matrices in the matrix buffer the function returns the FALSE value The following diagram illustrates the stack model ec N TN PS 55 Gaias l l I I i l l l l i l i T Ex l IsIPush Tr I i m piTrance m isIPush m slPop I g a PT e o g IT 7 Ty l I Sainan a l f i f l We tae 78 l l f l i I l i l i i E LE B E l iSlPush aa M2 sIPop siPush m4 Trancef m3 slPop 1 i me ee Refer to Chapter 5 Matrices slPushMatrix 82 Matrix Function Bool slPushUnitMatrix Advance pointer and copy unit matrix to current matrix Format Bool slPushUnitMatrix Parameters None Function This function advances the matrix buffer pointer and then sets a unit matrix in the current matrix Return Value If pointer allocation failed the function returns the FA
6. slColRateBACK Background screen color calculation ratio setting Scroll Function Format void siIColRateBACK rate Parameters Uint16 rate rate Color calculation ratio 0x00 to 0x1f Function This function sets the color calculation ratio used for color calculations for the background screen Return Value Remarks None The range of calculation ratio values that can be set for the parameter is 0x00 to Oxf Each of these values represents a calculation ratio for example if rate OxOf is substituted the calculation ratio between the top image and the 2nd image is 16 16 For details on the relationship between the substitution value and the calculation ratio refer to the table on page 244 of the VDP2 User s Manual of the HARDWARE MANUAL vol 2 Refer to Chapter 8 Scrolls slColRateBACK 20 Scroll Function void slColRateLNCL Line color screen color calculation ratio setting Format void slColRateLNCL rate Uint16 rate Parameters rate Color calculation ratio Function This function sets the color calculation ratio used for color calculations for the line color screen Return Value None Remarks The range of calculation ratio values that can be set for the parameter is 0x00 to Oxif Each of these values represents a calculation ratio for example if rate OxOf is substituted the calculation ratio between the top image and the 2nd image is 16 16 For details on the relationship bet
7. void slDispSprite pos atrb Zrot FIXED pos SPR_ATTR atrb ANGLE Zrot pos XYZ XYZ coordinate values for sprite placement and scale value atrb Starting address of area where sprite characteristics are stored Zrot Z axis rotation angle This function displays a sprite specifying the position scale and rotation angle Just as in the function slPutPolygon sorting is performed according to the Z value The display of a sprite set by this function is completely unaffected by the current matrix None Remarks If a negative value is input for the scale calculate the scale according to the Z position multiply it by the complement of the scale anduse the result as the display scale For example if 2 0 is specified for the scale and the sprite is in a position Z position where it should be displayed at 0 5x the sprite is displayed at 1 0x The display of the sprite is not affected by the current matrix Refer to Chapter 9 Controller Input slDispSprite 65 void SpriteFunction slPutSprite Sprite display with perspective transformation effects Format Parameters Function Return Value Remarks void slPutSprite pos atrb Zrot FIXED pos SPR_ATTR atrb ANGLE Zrot pos XYZ XYZ coordinate values for sprite placement and scale value atrb Starting address of area where sprite characteristics are stored Zrot Z axis rotation angle This function calculates the position using th
8. SP Sequence control number bit7 0 Control OFF 1 Control ON Sequence Pan BIT6 0 MIDI PAN data 00h 7Fh S 00h Left lt gt 40h Center lt gt 7Fh Right MIDI PAN consists of 128 steps but because the SCSP PAN consists of 32 steps the two low order bits of MIDI PAN data are ignored 00h EOh CD DA level Left CD DA Level 8 steps 00h off 20h 40h 60h 80h AOh COh and EOh max C OOH EOh CD DA level Right 8 steps 00h off 20h 40h 60h 80h AOh COh and EOh max Continued on next page 175 Sound Function Continued from previous page Command Name Command Parameter Data Data CD DA Pan C P1 0 31 CD DA pan left 32 steps P2 0 31 CD DA pan right 32 steps P1 0 15 16 steps 0 is off P1 0 15 Effect bank number bit7 mono 1 stereo bit6 5 not use bit4 0 16bitPCM 1 8bitPCM bit3 0 0 7 PCM stream playback number P2 bit7 5 0 7 Direct sound Level 8 steps PCM start bit4 0 0 31 Direct sound Pan 32 steps ignored for Stereo P P3 P4 0000h FFFFh PCM stream buffer start address 16 high order bits of 20 bit data P5 P6 0000h FFFFh PCM stream buffer size number of samples for one channel P7 P8 0000h FFFFh Pitch word SCSP pitch register data Oct and FNS P9 bit7 3 0 15 Effect in select P9 Rch or MONO bit2 0 0 7 Effect send Level 8 steps bit7 3 0 15 Effect in select P10 Lch bit2 0 Effect send Level 8 steps SPC SPC 0 7 PCM stop p1 0 7 PCM stream playb
9. Screen top position slave Screen right position slave Screen bottom position slave Horizontal screen size slave Vertical screen size slave Horizontal screen size 2 slave Vertical screen size 2 slave Clipping calculation data horizontal master Clipping calculation data vertical master Clipping calculation data horizontal slave Clipping calculation data vertical slave Display limit Z position slave Window data set offset Number of display polygons DMA transfer end flag not used DMA table set flag Number of slPutPolygon sl Sprite calls Screen display limit shift count master Screen display limit shift count Slave Random number generator work area TV screen mode External signal enable Screen status VRAM size H counter V counter RAM control oDO 0D2 0D4 oD6 0D8 ODA oDC ODE OEO 0E2 0E4 OE6 0E8 OEA OEC OEE OFO OF2 OF4 OF6 OF8 OFA OFC OFE 100 102 104 106 108 10A 10C 10E 110 112 114 116 118 11A 11C 11E VDP2_CYCAOL VDP2_CYCAOU VDP2_CYCA1L VDP2_CYCA1U VDP2_CYCBOL VDP2_CYCBOU VDP2_CYCB1L VDP2_CYCB1U VDP2_BGON VDP2_MZCTL VDP2_SFSEL VDP2_SFCODE VDP2_CHCTLA VDP2_CHCTLB VDP2_BMPNA VDP2_BMPNB VDP2_PNCNO VDP2_PNCN1 VDP2_PNCN2 VDP2_PNCN3 VDP2_PNCR VDP2_PLSZ VDP2_MPOFN VDP2_MPOFR VDP2_MPABNO VDP2_MPCDNO VDP2_MPABN1 VDP2_MPCDN1 VDP2_MPABN2 VDP2_MPCDN2 VDP2_MPABN3 VDP2_MPCDN3 VDP2_MPABRA VDP2_MPCDRA VDP2
10. according to brightness 0 is low brightness No_Option No options used Note The values in the above table are defined in sl_def h provided with the system Note Restriction on texture specifications If a texture is not used on an object do not specify sprHflip or sprVflip SEGAJATURN SGL Reference Memory Map In the Sega Graphics Library a portion of memory is used by the system In general terms memory is used as shown in the illustration below This chapter provides more detailed information on how memory is used Fig Map of Entire Memory Area 25C00000 25E00000 26000000 VDP1 area 06000000 VDP2 area Work RAM area Cache address 1 General The SGL system uses 0x40000 bytes in the WORK RAM H area for sprite and scroll control In addition 264 bytes in VDP VRAM is used for gouraud shading when showing light source effects on textures A breakdown of this area and the default settings are shown below VRAM breakdown Default value MAX_POLYGON number of polygons that can be used 1800 MAX_VERTICES number of vertices that can be used 2500 MAX_TRANSFER number of transfer requests during 20 blanking MAX_NEST number of nested matrices 20 Fig 1 1 Breakdown of VDP1 VRAM and the Default Values When a model is specified by slPutPolygon that model is not processed if the total number of polygons or vertices including that model will exceed the respective maximum
11. pat Parameters pat Starting address of area where polygon data is stored Function This function draws the polygon model specified by the parameter The polygon model is affected by the parallel shift component and rotation component of the current matrix and is drawn on the screen using perspective transformations Return Value None Remarks The polygon data is defined as a PDATA structure A PDATA structure includes the polygon vertex list the number of vertices the face list the number of faces and the face attribute information For details refer to Structure Reference PDATA Structure and Chapter 2 Graphics in the Programmer s Tutorial _ Polygon data structure _ce PDATA lt Label name gt 4 point_PLANE1 lt vert ex list sizeof point_PLANE1 SIZEOF POINT number of vertices polygon_PLANE1 t a face list sizeof point_PLANE1 SIZEOF POLYGON 4 number of faces attribute_ PLANE1 face attribute list Note The PDATA structure is defined in sl_def h Refer to Chapter 2 Graphics slPutPolygon Graphics function void sl Window Various window settings Format void slWindow left top right bottom Zlimit centx centy Sint16 left Sint16 top Sint16 right Sint16 bottom Sint16 Zlimit Sint16 centx Sint16 centy Parameters left X coordinate of upper left corner of window screen coordinate system top Y coordinate of upper left corner of
12. 142 144 144 146 148 148 14A 14C 14C 14E 150 152 154 156 158 15A 15C 160 164 168 16C VDP2_MPABRB VDP2_MPCDRB VDP2_MPEFRB VDP2_MPGHRB VDP2_MPIJRB VDP2_MPKLRB VDP2_MPMNRB VDP2_MPOPRB VDP2_SCXNO VDP2_SCXINO VDP2_SCXDNO VDP2_SCYNO VDP2_SCYINO VDP2_SCDNO VDP2_ZMXNO VDP2_ZMXINO VDP2_ZMXDNO VDP2_ZMYNO VDP2_ZMXINO VDP2_ZMYDNO VDP2_SCXN1 VDP2_SCXIN1 VDP2_SCXDN1 VDP2_SCYN1 VDP2_SCYIN1 VDP2_SCYDN1 VDP2_ZMXN1 VDP2_ZMXIN1 VDP2_ZMXDN1 VDP2_ZMYN1 VDP2_ZMYIN1 VDP2_ZMXDN1 VDP2_SCXN2 VDP2_SCYN2 VDP2_SCXN3 VDP2_SCYN3 VDP2_ZMCTL VDP2_SCRCTL VDP2_VCSTA VDP2_LSTAO VDP2_LSTA1 VDP2_LCTA VDP2_BKTA FHS FHS WH Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 Uint16 XED Sint16 Uint16 XED Uint16 Uint16 a 6 6 BS ee Re ee ee ee ee ee ee Map Rotation parameters B plane A B Map Rotation parameters B plane C D Map Rotation parameters B plane E F Map Rotation parameters B plane G H Map Rotation parameters B plane I J Map Rotation parameters B plane K L Map Rotation parameters B plane M N Map Rotation parameters B plane O P Screen scroll value NBGO horizontal direction fixed point Screen scroll value NBGO horizontal direction integer portion Screen scroll value NBGO horizontal direction decimal portion Screen scroll value NBGO v
13. 149 Sound Function Bool sICDDAOff Stop CD D A output Format Bool sICDDAOff Parameters None Function This function stops CD D A output Return Value If the command buffer is full this function returns the FALSE value Remarks Refer to slICDDAOff 150 Bool slICDDAOn Start CD D A output Sound Function Format Parameters Function Return Value Remarks Refer to Bool sICDDAOn LLevel RLevel LPan RPan Uint8 LLevel Uint8 RLevel Sint8 LPan Sint8 RPan LLevel Volume value left RLevel Volume value right LPan Pan value left RPan Pan value right This function starts CD D A output If the command buffer is full this function returns the FALSE value Specify a value in the range from 0 to 127 for the parameters LLevel and RLevel The four low order bits are ignored however Specify a value in the range from 127 to 127 for the parameters LPan and RPan 127 left lt gt 0 center lt gt 127 right Note that the SCSP pans in 32 steps so the three low order Pan bits are ignored sICDDAOn 151 Bool sID SPOfft Stop DSP playback Sound Function Format Parameters Function Return Value Remarks Bool sIDSPOff None This function stops DSP playback If the command buffer is full this function returns the FALSE value Refer to Chapter 14 Sound Library sIDSPOff 152 Sound Function void slIn
14. Chapter 8 Scrolls slPageRbgO 38 Scroll Function void slPlaneNbg0 l 23 NBG plane size setting Format void sIPlaneNbg0O type void sIPlaneNbg1 type void sIPlaneNbg2 type void sIPlaneNbg3 type Unit16 type Parameters type Flag corresponding to the plane size specification Function This function sets the plane size for normal scrolls Refer to the table below for the substitution values for the parameter Return Value None Remarks When the reduction setting is set to 1 4x do not set the plane size as 2 x 2 This is due to the fact that the map size is different when the reduction setting is set to 1 4x The 1 x 1 and 2 x 1 settings can be used without any problems Plane size 1 horizontal x 1 vertical 2 horizontal x 1 vertical 2 horizontal x 2 vertical Note The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls sIPlaneNbg0 1 2 3 39 Scroll Function void slPlaneRA RBG plane size setting for rotation parameters A Format void sIPlaneRA type Uint16 type Parameters type Flag corresponding to the plane size specification Function This function sets the plane size for rotating scrolls using rotation parameters A Refer to the table below for the substitution values for the parameter Return Value None Remarks a Plane size Note The values in the above table are defined in sl_def h provided wit
15. Execution results OK Successful NG Failed Remarks Execution of this function fails wnen the semaphore cannot be gotten because it is locked by another process This function waits for the termination of SMPC command execution If an interrupt back has been issued execution of this function fails Refer to HARDWARE MANUAL vol 1 SMPC slResetEnableWait 130 System Management Function Void slSetLanguage Set SMPC memory language number Format void slSetLanguage lang Uint8 lang Parameters Language number Function This function sets the language number in the SMPC memory information Return Value None Remarks The SMPC memory information can also be referenced from the global variable Smpc_ Status To store the SMPC memory information in the SMPC memory use slSetSmpcMemory The following values can be used for the parameters SMPC_ENGLISH English SMPC_DEUTSCH German SMPC_FRANCAIS French SMPC_ESPANOL Spanish SMPC_ITALIANO Italian SMPC_JAPAN Japanese Refer to HARDWARE MANUAL vol 1 SMPC slSetLanguage 131 Bool System Management Function slSetSmpcMemory SMPC memory setting no wait mode Format Parameters Function Return Value Bool slSetSmpcMemory None This function sets the SMPC memory Execution results OK Successful NG Failed Remarks Execution of this function fails wnen the semaphore cannot be gotten because it is locked by another process This functi
16. Function void slLookAt Multiply line of sight matrix by current matrix Format void slLookAt camera target angz FIXED camera FIXED target ANGLE angz Parameters camera XYZ XYZ coordinates indicating camera position target XYZ XYZ coordinates indicating target position angz Camera angle Function This function multiplies current matrix and the matrix line of sight matrix for viewing the target from the specified camera position at the specified angle Return Value None Remarks When a line of sight parallel with the Y axis is selected vectors on the XZ plane become small the rotation around the Y axis cannot be determined and graphics may not be drawn properly therefore adjust the values so that the line of sight is not parallel with the Y axis when using this function The diagrams below illustrate the line of sight concept 0 Z x Angle Angle of twist versus the line of sight Projection surface Viewpoint TAA z VN is Line of sight eas Object b Image seen by camera a Conceptual model of camera Refer to Chapter 6 The Camera slLookAt 79 Matrix Function void slMultiMatrix Multiply specified matrix by current matrix Format void slMultiMatrix mtptr MATRIX mtptr Parameters mtptr Starting address of MATRIX type variable being multiplied output Function This function multiplies the specified matrix by the current matrix and makes the result the new
17. HARDWARE MANUAL vol 1 SMPC 15 PerAnalog Structure erPoint Pointing device STRUCTURE typedef struct Uint8 id Uint8 ext Uint16 data Uint16 push Uint16 pull Uint16 xe Uint16 y PerPoint Members id Peripheral ID ext Extended data size data Current button data push Depressed button data pull Unpressed button data x X coordinate y Y coordinate Description This structure is used to reference a pointing device Remarks Type cast the system variable Smpc_Peripheral and use this structure to reference a peripheral as a pointing device Refer to HARDWARE MANUAL vol 1 SMPC PerPoint 16 Structure erKeyB oard Keyboard device struct Uint8 id Uint8 ext Uint16 data Uint16 push Uint16 pull Uint8 cond Uint8 code PerKeyBoard Peripheral ID Extended data size Current button data Depressed button data Unpressed button data Status data Key code This structure is used to reference the keyboard device STRUCTURE typedef Members id ext data push pull cond code Description Remarks Type cast the system variable Smpc_ Peripheral and use this structure to reference a peripheral as a keyboard device Refer to HARDWARE MANUAL vol 1 S MPC PerKeyBoard 17 Variable Type ANGLE Angle data variable type Structure typedef Sint16 ANGLE Members Description Angle data notation variable type The range from 0 to 359 is expressed by 0x0000 t
18. Remarks Refer to sIDMAStatus 189 SEGAVATURN SGL Reference Structure Reference This section introduces structures variable types and macros that are unique to the SGL These are essential to programming with the SGL and the defined contents of each are also important Study this reference in addition to the Function Reference Structure ATTR Face attribute list Structure typedef struct Uint8 flag Uint8 sort Uint16 texno Uint16 atrb Uint16 colno Uint16 gstb Uint16 dir ATTIR Members flag Front back setting sort Sort setting texno Texture number atrb Attribute data colno Color number gstb Gouraud setting dir Texture reversal setting and type Description This structure defines the polygon face attribute list Remarks for details on the face attributes and how to use them refer to chapter 7 Polygon Face Attributes in the Programmer s Tutorials Refer to Chapter 2 Graphics ATTR Structure VENT Event management Structure Members Description Remarks typedef struct evnt WORK work struct event next struct event before void exad Uint8 user EVENT_SIZE sizeof WORK sizeof struct evnt 2 sizeof void EVENT work Work area pointer next Starting address of next event before Starting address of previous event exad Function execution address user Work area This structure defines the event management table Set the addres
19. Value Uint8 slCheckReset None This function gets the reset button status when system reset by the reset button is disabled SMPC reset button status Remarks The following values are returned for the return value SMPC_RES_OFF Reset button off initial value SMPC_RES_ON Reset button on Once the status goes to on it does not change until slClearReset is called Refer to HARDWARE MANUAL vol 1 SMPC slCheckReset 120 System Management Function Uint8 slGetLanguage Get SMPC memory language number Format Uint8 slGetLanguage Parameters None Function This function gets the language number from the SMPC memory information Return Value Language number Remarks The SMPC memory information can also be referenced from the global variable Smpc_ Status To get the newest SMPC status for the SMPC memory information use slGetStatus The following values are returned for the return value SMPC_ENGLISH English SMPC_DEUTSCH German SMPC_FRANCAIS French SMPC_ESPANOL Spanish SMPC_ITALIANO Italian SMPC_JAPAN Japanese Refer to HARDWARE MANUAL vol 1 SMPC slGetLanguage 121 Bool System Management Function slGetPeripheral Interrupt back get peripheral data only Format Parameters Function Return Value Bool slGetPeripheral None This function automatically gets the peripheral data and puts it into the global variable Smpc_Peripheral This function also automatically gets the
20. a a a a a Issue the sequence volume command before issuing the start command The sound fades in from Volume 0 to the specified sequence volume at the specified fade rate The fade in curve can be controlled as desired by using the sequence volume command twice or more WN Oo n a Mo 2 Se Fade out method Issue the sequence volume command with Volume 0 The sound fades out from the current sequence volume to Volume 0 at the specified fade rate The fade out curve can be controlled as desired by using the sequence volume command twice or more Note 1 Because commands such as MIDI direct control are closely affected by the relationship between the MIDI channel and tone and the usage of the DSP program and mixer work in close cooperation with the sound developer Note 2 Because a specialized DSP program is required in order to analyze each frequency band with the Volume Analyze function use the Effect Change command to download the DSP program before issuing the Volume Analyze command The DSP program is not needed in the case of the main volume In addition because the data is updated at 16msec intervals when executing Volume Analyze the volume data should be read at 16msec intervals or more Note 3 When stereo is specified at PCM start the first half of the data in the area specified by P3 P4 is processed as the right channel data and the second half is processed as the left channel data The PCM stream buffe
21. are displayed as spaces The integer portion and the decimal portion are both displayed as five digit decimal numbers If the value is negative a is displayed Return Value None Remarks Ex val 0x00108000 _ 16 5 val OxffedcO00 _ 19 25 Refer to Chapter 8 Scrolls slPrintFX 12 Text Display Function void sl PrintHex Hexadecimal screen display zeroes in high order digits are not displayed Format void sIPrintHex val dspadd Uint32 val void dspadd Parameters val Value to be displayed dspadd Text display address slLocate return value Function This function displays the specified variable as an eight digit hexadecimal number on the screen The function slPrintHex does not display zeroes in the high order digits Zeroes in high order digits are replaced with spaces Ex 1234 To display zeroes in the high order digits use the function slIDispHex Ex 00001234 Return Value None Remarks Refer to Chapter 8 Scrolls sIPrintHex 73 Text Display Function void slPrintMatrix Matrix screen display Format void slPrintMatrix mtrx dspadd MATRIX mtrx void dspadd Parameters mtrx MATRIX type variable to be displayed dspadd Text display address slLocate return value Function This function displays the specified matrix as a 4 row x 3 column matrix on the screen Return Value None Remarks Refer to Chapter 8 Scrolls sIPrintMatrix 74 Matrix Fun
22. as the parameter ABCD EFGH IJKL MNOP The matrix is set up for the pages in the 4 x 4 configuration shown above in the sequence A B C N O P sli6MapRA Scroll Function void slBackColSet Background screen single color setup Format void sIBack1ColSet colptr rgbptr void colptr Uint16 rgbptr Parameters colptr Starting address in VRAM where the background color is stored rgbptr Color data 5 bits for each of red green and blue Function This function sets up the background screen The background screen is the graphics screen that is displayed in the background in those areas where absolutely nothing else is displayed Return Value None Remarks Although the background screen color specification is made with the parameter rgbptr refer to the RGB mode color sample RGB_flag in the include file s _def h for the substitution values R e color sample define CD_Black 0 lt lt 10 0 lt lt 5 RGB_ define CD_DarkRed 0 lt lt 10 0 lt lt 5 RGB_ define CD_DarkGreen 0 lt lt 10 0 lt lt 5 RGB_ E define CD_Purple 0 lt lt 10 0 lt lt 5 RGB_Flag define CD_Margenta 0 lt lt 10 0 lt lt 5 RGB_Flag define CD_White 0 lt lt 10 0 lt lt 5 RGB_Flag Note The above values are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls slBack1ColSet Scroll Function void sIBitMapNbg0 l Bitmap m
23. buffer is full this function returns the FALSE value Remarks Specify a value from O to 127 for the parameter Volume and a value from 0 to 255 for the parameter Rate Rate specifies the interval for changing from the present volume to the specified volume When Rate is specified as 0 the volume changes immediately to the value specified by Volume Refer to Chapter 14 Sound Library sIBGMFade 144 Bool slB GMOff Stop BGM playback Sound Function Format Parameters Function Return Value Remarks Bool sIBGMOff None This function stops BGM playback If the command buffer is full this function returns the FALSE value Refer to Chapter 14 Sound Library sIBGMOff 145 Bool sIB GMOn Start BGM playback Sound Function Format Parameters Function Return Value Bool sIBGMOn Song Prio Volume Rate Uint 16 Song Uint 8 Prio Uint 8 Volume Uint 8 Rate Song Sound control number Prio Priority value Volume Volume value Rate Rate value This function starts BGM playback If the command buffer is full this function returns the FALSE value Remarks BGM always uses sound control number 0 Specify the parameter Prio with a value from 0 to 31 The larger the value the higher the priority Specify a value from O to 127 for the parameter Volume and a value from 0 to 255 for the parameter Rate Rate specifies the interval for changing from volume
24. current matrix Return Value None Remarks In the SGL matrices are stored in memory as 4 row x 3 column matrices However when performing mathematical operations on matrices such as with this function due to the fundamental concepts of matrix operations the matrices are expanded internally into 4 row x 4 column matrices as shown below when the operations are executed Expanded matrix column A01 A00 A02 d B01 BOO B02 dy _ A11 A10 A12 d _ B11 B10 B12 0 l A A21 A20 A22 0 B 821 B20 B22 a A31 A30 A32 l B31 B30 B32 1 ay bc a Matrices expanded into 4 row X 4 column matrices 1 COO C02 R 1 COO C02 C11 C10 C12 l 11 C10 C12 So aa al FC C20 C22 U 21 C20 C22 A B C c31 C30 C32 i PE 31 C30 C32 Convert to 4 row f 3 column matrix b Multiplication of expanded matrices and final result Refer to Chapter 5 Matrices slMultiMatrix 80 Matrix Function Bool s PopMatrix Calling a temporarily stored matrix Format Bool slPopMatrix Parameters None Function This function sends the matrix buffer pointer back one step Return Value If no matrices are nested the function returns the FALSE value Remarks The following diagram illustrates the stack model ol EE PSS ene eS ASR i777 1 i I l i I i 1 i I i I l ma DE iTre T e Te E ca A ions i a piTrance y2__ s Pus siTrance M2 sIPop M2 sIPo T 1 ae ot eed es tel eee lata l l l l l l i l i l i l I l l l f f ee EN O p I I
25. data widths are 16 bits and 8 bits respectively Refer to HARDWARE MANUAL vol 2 VDP2 slSpriteType 68 void s DispHex Text Display Function Hexadecimal screen display Format Parameters Function Return Value Remarks Refer to Chapter 8 Scrolls void sIDispHex val dspadd Uint32 val void dspadd val Value to be displayed dspadd Text display address slLocate return value This function displays the specified variable in eight hexadecimal digits The function sIDispHex displays zeroes in the high order digits Ex 00001234 If you do not wish to display zeroes in the high order digits use the function slPrintHex which will replace the zeroes with spaces ex 1234 None The text and numeric value display function group set and register thenormal scroll NBGO and the ASCII cells during system initialization and use these ASCII cells to display numeric values If for some reason this default data is overwritten text and numeric values will not be displayed properly sIDispHex 69 Text Display Function void slLocate Display position calculation parameters cell specification Format void slLocate xpos ypos Uint16 xpos Uint16 ypos Parameters xpos X coordinate of text display position range 0 to 63 cells ypos Y coordinate of text display position range 0 to 63 cells Function This function returns the address value for text display The parameters indica
26. incurring any obligation to you 11 2 94 002 SEGAATURN SGL Developer s Manual Reference Function Reference Structure Reference Appendix Memory Map SEGAJATURN SGL Reference Function Reference The Sega Saturn Graphics Library SGL is a C language function library assembled for software development support for the Sega Saturn system The SGL is ideal for the development of software that uses 3D graphics Because careful and rigorous consideration was given to the selection of the types of functions for the SGL the total number is not that large when used in combination however these functions are more than sufficient for the development of 3D games and similar software In fact the design concept behind the creation of the SGL was to permit fast and flexible software development through the use of combinations of simple modules We hope that you will find that the SGL opens up the exciting world of the Sega Saturn system Sega Enterprises Ltd Yu Suzuki void Graphics function slLight Light source setup Format Parameters Function Return Value void slLight light VECTOR light light Light source vector This function sets up the light source For the parameters substitute the vector value unit vector that indicates the direction of the light rays None Remarks The light source vector must be specified as a unit vector Assuming the size of the light source vector we
27. left corner of window Right X coordinate of lower right corner of window Bottom Y coordinate of lower right corner of window Function This function specifies the scroll window O area The rectangular window area is defined by specifying the upper left coordinates Left Top and the lower right coordinates Right Bottom Return Value None Remarks 0 0 left right top bottom Monitor 319 223 Note left top right and bottom indicate the XY coordinate values for the monitor Refer to HARDWARE MANUAL vol 2 VDP2 slScrWindow0 56 Scroll Function void slScrWindowModeNbg0 1 2 3 NBG window usage mode setting Format void slIScrWindowModeNbg0 mode void slIScrWindowModeNbg1 mode void slIScrWindowModeNbg2 mode void sIScrWindowModeNbg3 mode Uint16 mode Parameters mode Window usage mode flag Function This function sets the NBGO to 3 window usage mode Return Value None Remarks For the parameters substitute the values shown in the illustration below Multiple parameters can be specified simultaneously by linking each group of parameters with the or operator In the parameters shown below _IN displays the graphic element inside the window and _OUT displays the graphic element outside the window _e slScrWindowMode substitution values _ Window 0 Use_win0 Window 1 Use_win1 Sprite window Use_spw Window condition win_OR_ win_AND Disp
28. memory information in the SMPC memory use slSetSmpcMemory The following values can be used for the parameters SMPC_SOUND_STEREO Stereo SMPC_SOUND_MONO Monaural Refer to HARDWARE MANUAL vol 1 SMPC slSetSoundOutput Bool 134 System Management Function slSlaveOff Slave SH2 off no wait mode Format Parameters Function Return Value Bool slSlaveoff None This function turns the slave SH2 off Execution results OK Successful NG Failed Remarks Execution of this function fails wnen the semaphore cannot be gotten because it is locked by another process This function does not wait for the termination of SMPC command execution If an interrupt back has been issued this function is queued in the command cache Execution of this function fails if a command cache overflow occurs Refer to HARDWARE MANUAL vol 1 SMPC slSlaveOff Bool 135 System Management Function slSlaveOft W ait Slave SH2 off wait mode Format Parameters Function Return Value Bool slSlaveoffWait None This function turns the slave SH2 off Execution results OK Successful NG Failed Remarks Execution of this function fails wnen the semaphore cannot be gotten because it is locked by another process This function waits for the termination of SMPC command execution If an interrupt back has been issued execution of this function fails Refer to HARDWARE MANUAL vol 1 SMPC slSlaveOffWait Bool 1
29. need to call this function Refer to HARDWARE MANUAL vol 1 SMPC sllnitPeripheral 125 Bool System Management Function slIntB ackCancel Clear flags sets for interrupt back Format Parameters Function Return Value Bool sllntBackCancel None This function clears the settings that were made by calling slGetPeripheral and slGetStatus indicating that the SMPC status and peripheral data are to be gotten automatically Execution results OK Successful NG Failed Remarks Execution of this function fails wnen the semaphore cannot be gotten because it is locked by another process Refer to HARDWARE MANUAL vol 1 SMPC slIntBackCancel 126 Bool System Management Function slResetDisable Reset disable no wait mode Format Parameters Function Return Value Bool slResetDisable None This function disables system reset by pressing the reset button Execution results OK Successful NG Failed Remarks Execution of this function fails when the semaphore cannot be gotten because it is locked by another process This function does not wait for the termination of SMPC command execution If an interrupt back has been issued this function is queued in the command cache Execution of this function fails if a command cache overflow occurs Refer to HARDWARE MANUAL vol 1 SMPC slResetDisable 127 Bool slResetDisableWait Reset disable wait mode System Management Function
30. number of connected peripherals and puts the data into the global variables Per_Connect1 and Per_Connect2 Execution results OK Successful NG Failed Remarks Execution of this function fails when the semaphore cannot be gotten because it is locked by another process Because this function is called by sllnitSystem when the library is started up there is no particular need to call this function unless you are changing the settings The settings are reflected in the data starting from the second frame after the settings are made Execution of this function fails when the peripheral port input output setting is incorrect Refer to HARDWARE MANUAL vol 1 SMPC slGetPeripheral 122 Uint8 System Management Function slGetSoundOutput Get SMPC memory sound output mode Format Parameters Function Return Value Uint8 slGetSoundOutput None This function gets the sound output mode from the SMPC memory information Sound output mode Remarks The SMPC memory information can also be referenced from the global variable Smpc_ Status To get the newest SMPC status for the SMPC memory information use slGetStatus The following values are returned for the return value SMPC_SOUND_STEREO Stereo SMPC_SOUND_MONO Monaural Refer to HARDWARE MANUAL vol 1 SMPC slGetSoundOutput 123 System Management Function Bool slGetStatus Interrupt back get SMPC status and peripheral data Format Bool slGetSt
31. of display position A XB X coordinate of display position B YB Y coordinate of display position B XC X coordinate of display position C YC Y coordinate of display position C XD X coordinate of display position D YD Y coordinate of display position D GRDA Gouraud shading table DMMY Dummy data used to match up with size Description This data type is used to directly pass data to the VDP1 and is the data table used to display sprites Sprite picture data must be stored and registered in VRAM beforehand The same is true for texture data and scroll data For details refer to the textures in Polygon Face Attributes Remarks Textures and sprites used in the Sega Saturn system have very similar data structures but their display methods differ as follows Textures are applied to polygon faces and displayed Sprites are displayed independently Refer to Chapter 7 Polygon Face Attributes SPRITE Structure EXTURE Texture data STRUCTURE typedef struct Uint16 Hsize Uint16 Vsize Uint16 CGaadr Uint16 HVsize TEXTURE Members Hsize Horizontal size of texture Vsize Vertical size of texture CGadr CG address of texture 8 HVsize Horizontal size 8 vertical size for hardware HSIZE 8 lt lt 8 V SIZE Description This structure is the texture management table that is needed in order to use textures in the SGL Remarks For details refer to chapter 7 Polygon Face Attributes in the Programmer s Tutorial R
32. slave CPU initialization matrix buffer initialization scroll data initialization etc For details on the values initialized by the function sllnitSystem refer to the list of default values set by sllnitSystem at the end of the function reference 320 H 352 H 640 H 704 H As shown in the examples in the table at left the screen mode specification is defined as a macro in the 224 V TV 320x224 TV 352x224 TV 640x224 TV 704x224 form TV_horizontal x vertical pixels according to the z resolution of the screen mode 240 V TV_320x240 TV_352x240 TV 640x240 TV 704x240 448 V TV 320x448 TV 352x448 TV 640x448 TV 704x448 480 V TV 320x480 TV 352x480 TV 640x480 TV 704x480 Note The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls sllnitSystem 183 Miscellaneous Function void slIntFunction Register function to be executed during blanking Format void sllntFunction func void func Parameters func Starting address of function to be registered Function This function registers a function to be executed during blanking Return Value None Remarks The only functions that can be registered are void type with no parameters void lt function name gt void Refer to sllntFunction 184 Miscellaneous Function void slSynch Synchronization with event processing unit time Format void slSynch Parameters None
33. the system Refer to Chapter 8 Scrolls slLineColDisp 28 Scroll Function void slLineColTable Line color table setting Format void slLineColTable adr void adr Parameters adr Line color table address in VRAM Function This function sets the line color table address in VRAM in the register Return Value None Remarks For details on the line color screen refer to Hardware Manual vol 2 VDP2 User s Manual p 173 Refer to Chapter 8 Scrolls slLineColTable 29 Scroll Function void slLineScrollModeNbg0 1 Line scroll mode and vertical cell scroll mode setting Format void sLineScrollModeNbg0 mode void slLineScrollModeNbg1 mode Uint16 mode Parameters mode Line scroll mode flag Function This function sets the line scroll mode and vertical cell scroll mode for the scroll screen Return Value None Remarks _ Line scroll setting flags _ Line width lineSZ11 lineSZ2 lineSZ4 lineSZ8 Horizontal scaling lineZoom Vertical scrolling lineVScroll Horizontal scrolling lineHScroll Vertical cell scrolling VCellScroll Note The values in the above table are defined in sl_def h provided with the system Refer to HARDWARE MANUAL vol 2 VDP2 slLineScrollModeNbg0 1 30 Scroll Function void slLineScrollTable0 l Line scroll table address setting Format void slLineScrollTable0 adr void slLineScrollTable1 adr void adr Parame
34. 32 0xE100 Stack area 0x216C System variable area the GBR register always points here 0x400byte Fig 2 1 Work RAM H Memory Map System variables The system variables are shown below these variables can also be called from a C program 000 004 008 00C 00E 010 011 012 013 014 018 01A 01C 020 022 024 028 02C 030 034 038 03C 040 044 048 04C 058 064 068 06C 070 072 073 074 076 078 07A 07C 07E EventTop EventLast EventNow EventCount WorkCount MainMode SubMode SynchConst SynchCount UserFunction TransCount aah T ie T a o r A etl a gdm a lana oy Vier TransRequest mtptr MatrixCount IntCount MsPbufPtr SIPbufPtr SpritePtr MsSdataPtr SlSdataPtr ZbufPtr FormTbl SprbufBias ComRdPtr ComWrPtr MsLight SILight ColorOffset MsScreenDist SIScreenDist MsZlimit WindowNumber WinUseFlag TotalPolygons TotalVertices MsScreenLeft MsScreenTop MsScreenRight MsScreenBottom EVENT EVENT First registered event Last registered event Event being executed Number of events remaining Number of work areas remaining Main sequence mode Sub sequence mode Video sync count Video sync count User function to be executed during blanking Number of transfer entries during blanking Transfer request during blanking Current matrix pointer Matrix nest count Interrupt count Vertex coordinate calculation buffer poi
35. 36 System Management Function slSlaveOn Slave SH2 on no wait mode Format Parameters Function Return Value Bool slSlaveon None This function turns the slave SH2 on Execution results OK Successful NG Failed Remarks Execution of this function fails when the semaphore cannot be gotten because it is locked by another process This function does not wait for the termination of SMPC command execution If an interrupt back has been issued this function is queued in the command cache Execution of this function fails if a command cache overflow occurs Refer to HARDWARE MANUAL vol 1 SMPC slSlaveOn Bool 137 System Management Function slSlaveOnWait Slave SH2 on wait mode Format Parameters Function Return Value Bool slSlaveonWait None This function turns the slave SH2 on Execution results OK Successful NG Failed Remarks Execution of this function fails wnen the semaphore cannot be gotten because it is locked by another process This function waits for the termination of SMPC command execution If an interrupt back has been issued execution of this function fails Refer to HARDWARE MANUAL vol 1 SMPC slSlaveOnWait 138 Uint8 Peripheral Control Function slGetOptimize Get peripheral acquisition time optimization mode Format Parameters Function Return Value Uint8 slGetOptimize None This function gets the peripheral acquisition time opt
36. A of America Inc or any third party Software circuitry and other examples described herein are meant merely to indicate the character istics and performance of SEGA s products SEGA assumes no responsibility for any intellectual property claims or other problems that may result from applications based on the examples describe herein It is possible that this document may contain reference to or information about SEGA products development hardware software or services that are not provided in countries other than Japan Such references information must not be construed to mean that SEGA intends to provide such SEGA products or services in countries other than Japan Any reference of a SEGA licensed prod uct program in this document is not intended to state or simply that you can use only SEGA s licensed products programs Any functionally equivalent hardware software can be used instead SEGA will not be held responsible for any damage to the user that may result from accidents or any other reasons during operation of the user s equipment or programs according to this document NOTE A reader s comment correction form is provided with this document Please address comments to SEGA of America Inc Technical Translation and Publications Group att Document Administrator 150 Shoreline Drive Redwood City CA 94065 SEGA may use or distribute whatever information you supply in any way it believes appropriate without
37. EO K_MODE1 K_MODE2 K_MODE3 Line color K_LINECOL Unit of change K_DOT K_LINE Fix coefficients K_FIX Note If fix coefficients is specified as one of the parameters the coefficient table is assumed to beprepared beforehand and is not calculated in real time Refer to Chapter 8 Scrolls slKtableRA B 26 Scroll Function void slLine l ColSet Line single color setting matrix setting Format void slLine1ColSet adr col void adr Uint16 col Parameters adr Line color table address in VRAM col Color number Function This function sets the line color screen to a single color and sets that color Return Value None Remarks For details on the line color screen refer to Hardware Manual vol 2 VDP2 User s Manual p 172 Refer to Chapter 8 Scrolls slLine1ColSet 27 Scroll Function void slLineColDisp Line color screen enable setting Format void slLineColDisp flag Uint16 flag Parameters flag Screen specification Function This function sets the screen that is to be affected by the line color when it is the top image Multiple screen specification is possible using the or operator Return Value None Remarks The parameters that can be specified are shown in the table below Scroll screen to be registered NBGO NBG1 NBG2 NBG3 RBGO Substitution value NBGOON NBG1ON NBG2ON NBG30N RBGOON Note The values in the above table are defined in sl_def h provided with
38. Function This function waits until the event processing unit time is reached Return Value None Remarks Screen switching display etc is performed in the graphics processing units specified by the function sllnitSystem The graphics processing unit is displayed in terms of the number of V blanks 1 blank is 1 60 of a second if non interlaced and 1 30 of a second if double interlaced Refer to the function sllnitSystem for further details V BLANK V BLANK time p po l I l Data transfer i i Event processing l OoOo i Pn 4 Geni processing untume Refer to Chapter 8 Scrolls slSynch 185 Miscellaneous Function Bool slTransferEntry Data transfer request during blanking Format void slTranferEntry str dst size void str void dst Uint16 size Parameters str Starting address of transfer source dst Starting address of transfer destination size Data transfer amount bytes Function This function transfers data during V_BLANK For the parameter size specify how many bytes of data are to be transferred Return Value None Remarks In order to do a data transfer using the indirect mode of the DMA in the SCU the data transfer cannot be made over the same bus For details refer to the chapter on the SCU in the HARDWARE MANUAL vol 1 The diagram below is a conceptual model of the bus A Bus B Bus Data transfer cannot be performed over the same bus Note Transfers from work RA
39. General Notice This is a preliminary document and is subject to change without notice This document could include technical inaccuracies or typographical errors Changes are periodically made to the information herein these changes will be incorporated in official versions of the publication When using this document keep the following in mind 1 This document is confidential By accepting this document you acknowledge that you are bound by the terms set forth in the non disclosure and confidentiality agreement signed separately and in the possession of SEGA If you have not signed such a non disclosure agreement please contact SEGA immediately and return this document to SEGA This document may include technical inaccuracies or typographical errors Changes are periodi cally made to the information herein these changes will be incorporated in new versions of the document SEGA may make improvements and or changes in the product s and or the program s described in this document at any time No one is permitted to reproduce or duplicate in any form the whole or part of this document without SEGA s written permission Request for copies of this document and for technical information about SEGA products must be made to your authorized SEGA Technical Services representative No license is granted by implication or otherwise under any patents copyrights trademarks or other intellectual property rights of SEGA Enterprises Ltd SEG
40. In addition each time slPutSprite slDispSprite and slSetSprite are executed the number of polygons increases by one if the maximum limit is exceeded processing of that data is halted However if the specified Z position is outside of the display area that sprite is not counted 2 WORK RAM H Cache_address 06000000 06000800 06001000 06002000 06004000 06000000 060C549C 060C558C 060C578C 060C598C 060C5D8C 060D5B60 060E5934 O60EF574 O60EF994 O60FDA94 060FFC00 06100000 UserProgram amp Data SortList 549C TransList F0 Zbuffer 200 Zbuffer2 200 Zbuf_nest 400 Spritebuf FDD4 Spritebuf2 FDD4 Pbuffer 9040 CLOfstBuf 420 CommandBuf E100 StackArea 216C SystemWork 400 User area Table buffer for DMA transfers of sprite control data MAX_POLYGON 5 3 4BYTE 0x549C DMA control table for transfer requests during blanking MAX_TRANSFER 3 4BYTE OxFO Primary buffer for polygon sort for window 0 128 4 0x200 Primary buffer 2 polygon sort for window 1 128 4 0x200 Secondary buffer for polygon sort 256 4 0x400 Sprite control data buffer MAX_POSYGON 5 36 0xFDD4 Sprite control data buffer 2 MAX_POSYGON 5 36 0xFDD4 Vertex position buffer for polygon calculations MAX_VERTICES 16 0x9C40 Data table for colors generated due to light source effects 33 32 0x420 Command passing buffer from master to slave MAX_POLYGON
41. LSE value Remarks Up to 20 matrices can be nested in the buffer If an attempt is made to nest more than 20 matrices in the matrix buffer the function returns the FALSE value Refer to Chapter 5 Matrices slPushUnitMatrix 83 Matrix Function void sIRotAX Rotation around any axis that passes through origin alling a temporarily stored matrix Format void slRoaAX vctx vcty vctz anga FIXED vetx FIXED vety FIXED vetz ANGLE anga Parameters vctx X component of rotation axis vector vcty Y component of rotation axis vector vctz Z component of rotation axis vector anga Rotation angle Function This function adds rotation around any axis that passes through the origin The rotation axis vector that determines the axis of rotation must be specified by a unit vector The rotation matrix is expressed as shown below Return Value None Remarks The rotation matrix used for adding rotation around any vector is shown below NxNx 1 C b NxNy 1 C NzS NxNz 1 C NyS Rax NyNx 1 C NzS NyNy 1 C NyNz 1 C NxS NzNx 1 C NyS NzNy 1 C NxS NzNz 1 C C 0 0 0 0 0 0 Note Nx Ny and Nz are the X Y and Z components of the rotation axis vector S and C are the sine and cosine ofthe angle anga Refer to Chapter 4 Coordinate Transformation slIRotAx 84 Matrix Function void slIRotx Adding rotation around X axis to current matrix Format void slRotX angx ANGLEangx Parameters angx Angle of
42. M high to ork RAM low are not possible Data transfers from work RAM high to VDP1 are possible CPU Bus Refer to slTransferEntry void 186 Miscellaneous Function sIS etTrayCheck CD tray open check Format void slSetTrayCheck flag Uint8 flag Parameters flag ON or OFF Function This function specifies whether or not to perform a check in order to shift to the multiplayer screen when the CD tray is open Specify the flag as either ON or OFF When this function is called the status is cleared therefore if the tray is already open when the flag is set to ON the check will not be made until the next time the tray is opened Return Value None Remarks Refer to slSetTrayCheck void 187 Miscellaneous Function slChashePurge Cache purge Format Parameters Function Return Value Remarks Refer to Bool void shChashePurge None This function initializes the cache data in the CPU This function is used when the cache area is changed by a DMA transfer etc None slChashePurge 188 Miscellaneous Function sIDMA Status DMA transfer check Format void sIDMAStatus Parameters None Function This function checks whether or not a DMA transfer initiated by the sIDMACopy function or the sIDMAXCopy function is in progress or not and returns a flag If the transfer is in progress this function returns ON if not this function returns OFF Return Value None
43. ROLL Rotation parameters STRUCTURE typdef struct FIXED XST FIXED YST FIXED ZST FIXED DXST FIXED DYST FIXED DX FIXED DY FIXED MATA FIXED MATB FIXED MATC FIXED MATD FIXED MATE FIXED MATF Sint16 PX Sint16 PY Sint16 pZ Sint16 dummyo Sint16 CX Sint16 CY Sint16 CZ Sint 16 dummy1 FIXED MX FIXED MY FIXED KX FIXED KY Uint32 KAST Sint32 DKA ROTSCRLL Members XST Scroll screen start coordinate Xst YST Scroll screen start coordinate Yst ZST Scroll screen start coordinate Zst DXST Scroll screen vertical direction coordinate increment amount dXst DYST Scroll screen vertical direction coordinate increment amount dYst DX Scroll screen horizontal direction coordinate increment amount dX DY Scroll screen horizontal direction coordinate increment amount dY MATA Rotating matrix parameter A MATB Rotating matrix parameter B MATC Rotating matrix parameter C MATD Rotating matrix parameter D MATE Rotating matrix parameter E MATF Rotating matrix parameter F PX Viewpoint coordinate Px PY Viewpoint coordinate Py PZ Viewpoint coordinate Pz dummy0 Dummy area CX Center coordinate Px CY Center coordinate Py 6 Description CZ Center coordinate Pz dummy1 Dummy area MX Parallel movement amount Mx MY Parallel movement amount My KX Enlargement reduction coefficient kx KY Enlargement reduction coefficient ky KAST Coefficient table start address KAst DKAST Coeffici
44. Scroll settings When the system is initialized the scrolls are set up as follows Table Scroll Default Settings Setting Contents of setting Scroll screens displayed NBGO NBG1 RBGO Priority NBGO gt SPRO gt SPR1 gt RBGO gt NBG1 gt NBG2 gt NBG3 7 6 5 4 3 2 1 Both banks A and B partitioned Character data NBGO NBG1 25E60000 eee od RBGO 25E00000 8 x 8 dots on each screen Pattern name data NBGO 25E76000 and up NBG1 25E78000 and up RBGO 25E40000 and up rotation parameters A RBGO 25E50000 and up rotation parameters B Pattern name size NBGO 1 word 10 bits with reversal function for each cell eee NBG1 RBGO 1 words 12 bits with no reversal function 64 x 64 cells on each screen Black at 25E3FFFE R 0 G 0 B 0 25E3FF00 and up Mixture of palette and RGB format Mosaic color offset etc not used 2 List of substitution values for the ATTRIBUTE macro The ATTRIBUTE macro structure and a list of the macro substitution values that can be used in the SGL for each member in the ATTRIBUTE macro structure are shown below For details on the polygon face attribute settings made by the ATTRIBUTE macro and examples of actual usage refer to chapter 7 Polygon Face Attributes in the Programmer s Tutorial Fig 2 1 ATTRIBUTE Macro Structure _c ATTRIBUTE macro structure _ce ATTRIBUTE plane sort texture color gouraud mode dir option Note The ATTRIBUTE macro is defined in
45. Structure define C_RGB r g b b amp 0x1f lt lt 10 g amp 0x1f lt lt 5 r amp 0x1f Ox8000 Uint8r Uint8 g Uint8 b Members r Red g Green b Blue Description This macro specifies the RGB values used to represent color gradations The color gradation values can range from 0 to 1f for each of red green and blue Remarks This macro cannot be used to specify the transparent color Refer to Chapter 7 Polygon Face Attributes C_RGB 25 MACRO DEGtoANG Angle conversion macro Structure define DEGtoANG d ANGLE d 65536 0 360 0 float d Members d Angle to be converted DEG notation Description This macro converts a floating point angle value expressed in DEG notation to an ANGLE type value Remarks Refer to Chapter 1 Sega Graphics Library DEGtoANG 26 MACRO NORMAL Coordinate value conversion macro Structure define NORMAL x y z POStoFIXED x y z Members x X coordinate to be converted y Y coordinate to be converted Z Z coordinate to be converted Description This macro converts a normal vector XYZ coordinates expressed by floating point decimals into FIXED type variables Remarks Used together with the VERTICES macro this macro is used to make the POLYGON face list Refer to NORMAL 2T MACRO ICDEF Texture management table Structure define PICDEF texno cmode pcsrc Uint16 texno Uint16 cmde void pcsrc Uint16 texno Uint16 cmode void pcsrc Members
46. TER_Y Y Note left top right bottom CENTER_X and CENTER_Y refer to the X and Y screen coordinates Refer to Chapter 4 Coordinate Transformation slWindow Graphics function void slZdspLevel Display level specification Format void slZdspLevel level Uint16 level Parameters level Display level 1 Display from 1 2 2 Display from 1 4 3 Display from 1 8 Note For an explanation of the display level refer to the diagram shown below Function This function specifies how far in front of the projection surface to actually project the front boundary surface Return Value None Remarks The distance from the forward boundary surface to the rear boundary surface is the Zlimit The Zlimit is specified by the slWindow function During system initialization the display level is set to 1 2 Rear boundary surface Viewing volume Zlimit Distance between the forward boundary surface and the rear boundary when ScreenDist 1 2 surface Projection surface Display level Specifies the distance between the viewpoint and the forward boundary surface in terms of the number of times the distance to Forward boundary surface theprojection surface is divided Viewpoint Refer to Chapter 4 Coordinate Transformation slZdspLevel Scroll Function void slIMapRA RGB map setup using rotation parameters A Format void sliMapRA a void a Parameters a Starting address in VRAM of pat
47. T_DIS Acquisition time optimization disable Refer to HARDWARE MANUAL vol 1 SMPC slSetOptimize 141 Bool slSetPortMode l 2 Set port mode for peripheral port 1 2 Peripheral Control Function Format Parameters Function Return Value Bool slSetPortMode1 mode Bool slSetPortMode2 mode Uint8 mode mode Port mode of peripheral port These functions set the port mode of peripheral ports 1 and 2 Execution results OK Success NG Failure Remarks Execution of this function fails when the semaphore cannot be gotten because it is locked by another process The following values can be used for the parameter SMPC_PORT_15 15 byte mode initial value SMPC_PORT_255 255 byte mode SMPC_PORT_ZERO 0 byte mode Refer to HARDWARE MANUAL vol 1 SMPC slSetPortMode1 2 142 Bool sIB GMCont Restart temporarily paused BGM playback Sound Function Format Parameters Function Return Value Remarks Bool sIBGMCont None This function restarts playback of temporarily paused BGM If the command buffer is full this function returns the FALSE value Refer to Chapter 14 Sound Library sIBGMCont 143 Bool sIB GMFade Change BGM playback volume Sound Function Format Parameters Function Return Value Bool sIBGMFade Volume Rate Uint8 Volume Uint8 Rate Volume Volume value Rate Rate value This function gradually changes the BGM playback volume If the command
48. _MPEFRA VDP2_MPGHRA VDP2_MPIJRA VDP2_MPKLRA VDP2_MPMNRA VDP2_MPOPRA OS SoS SS SS SS VRAM cycle pattern bank AO TO to 3 VRAM cycle pattern bank AO T4 to 7 VRAM cycle pattern bank A1 TO to 3 VRAM cycle pattern bank A1 T4 to 7 VRAM cycle pattern bank BO TO to 3 VRAM cycle pattern bank BO T4 to 7 VRAM cycle pattern bank B1 TO to 3 VRAM cycle pattern bank B1 T4 to 7 Screen display enable Mosaic control Special function code select Special function code Character control NBGO NBG1 Character control NBG2 NBG3 RBGO Bit map palette number NBGO 1 Bit map palette number RBGO Pattern name control NBGO Pattern name control NBG1 Pattern name control NBG2 Pattern name control NBG3 Pattern name control RBGO Plane size Map offset NBGO to 3 Map offset rotation parameters A B Map NBGO plane A B Map NBGO plane C D Map NBG1 plane A B Map NBG1 plane C D Map NBG2 plane A B Map NBG2 plane C D Map NBG3 plane A B Map NBG3 plane C D Map Rotation parameters A plane A B Map Rotation parameters A plane C D Map Rotation parameters A plane E F Map Rotation parameters A plane G H Map Rotation parameters A plane I J Map Rotation parameters A plane K L Map Rotation parameters A plane M N Map Rotation parameters A plane O P 120 122 124 126 128 12A 12C 12E 130 130 132 134 134 136 138 138 13A 13C 13C 13E 140 140
49. able type Remarks FIXED vector XYZ FIXED vector 3 VECTOR vector The above three definitions all have the same meaning Refer to VECTOR 23 MACRO ATTRIBUTE Polygon attribute specification Structure define ATTRIBUTE plane sort texture color gourand mode dir option plane sort dir gt gt 16 amp 0x01c option _ texture mode dir gt gt 24 amp 0xcO color__ gourud dir amp 0x03f Uint8 plane Uint8 sort Uint16 texture Uint16 color Uint16 gouraud Uint 16 mode Uint 32 dir Uint16 option Members plane Front back attribute sort Z sort specification texture Texture number or No_Texture color C_RGB macro specified color color palette number or No _Palet gouraud Gouraud table or No_Gouraud mode Various mode specifications for the polygon dir Specification of texture display direction etc option Other settings for the polygon Description This macro sets the face attributes particularly the polygon front face concerning polygon drawing For details on the meaning of and substitution values for each parameter refer to chapter 7 Polygon Face Attributes in the Programmer s Tutorial Also refer to the list of ATTRIBUTE macro substitution values at the end of the Structure Reference Remarks When using texture the member color is sometimes used to specify the color bank number Refer to Chapter 7 Polygon Face Attributes ATTRIBUTE 24 MACRO C RGB RGB value specification
50. acement Monitor Monitor Rotating scroll map Rotating scroll map Rotating scroll map Note The positive direction on the Z axis for the scroll screen is towards the viewer Refer to Chapter 8 Scrolls slLookR 32 Scroll Function void slIMakeK table Coefficient table creation Format void sIMakeKtable adr void adr Parameters adr Coefficient table address in VRAM Function This function creates at the specified address in VRAM the coefficient table to be used for three dimensional rotation adr must be specified within the VDP2 RAM area Return Value None Remarks Refer to Chapter 8 Scrolls s MakeKtable 33 Scroll Function void sIMapNbg0 l 2 9 NBG map setting Format void sIMapNbgO a b c d void sIMapNbg1 a b c d void sIMapNbg2 a b c d void sIMapNbg3 a b c d void a b c C Parameters Starting address in VRAM of pattern name data table for plane a Starting address in VRAM of pattern name data table for plane b Starting address in VRAM of pattern name data table for plane c Starting address in VRAM of pattern name data table for plane d a0 0 Function This function sets up the normal scroll map For the parameters substitute the starting addresses in VRAM of the pattern name data tables to be registered in the map register and the map offset register Return Value None Remarks Refer to Chapter 8 Scrolls slMapNbg0 1 2 3 34
51. ack number for which playback is stopped P Mixer change SPC Mixer parameter change SPC P1 0 15 Tone bank number P2 0 127 Mixer number 0 17 Effect out select bit7 5 0 7 Effect return Level 8 steps bit4 0 0 31 Effect Pan 32 steps 0 5 Check item 0 DRAM 4Mbit read write 1 DRAM 8Mbit read write 2 SCSP MIDI 3 sound source output L R 4 sound source output L 5 sound source output R Hard check 0 7 PCM stream playback number 0 7 Direct sound Level 8 steps 0 31 Direct sound Pan 32 steps 0000h FFFFh pitch word 0 15 Effect in select P5 Rch or MONO 0 7 Effect send Level 8 steps 0 15 Effect in select P6 Lch 0 7 Effect send Level 8 steps 8B FF Nothing Command that acts on Sequence playback or that concerns Sequence playback Command that acts on PCM stream playback or that concerns PCM stream playback Command that acts on CD DA playback or that concerns CD DA playback PCM parameter change P 176 Sound Function MIDI direct control bit image Priority level 0 31 Sound priority ranking at sequence l iori tart Priority level MD s TE 5 CMD 0 7 MIDI command 8 F 8 F gt 0 7 l MIDI Ch MIDI D 1 KNo 0 7 Sound control number I ata MIDI Ch 0 31 I I l MIDI channel MIDI Data 2 MIDI Data 1 0 127 MIDI data byte 1 MIDI Data 2 0 127 MIDI data hvte 2 i me Fa a a se a a ny a R a a eh ce ee A G S es E OA me hah a a a D aa a as E ee i
52. ameter table size 60H used for the rotating scroll Return Value None Remarks When using the rotating scroll be sure to store the rotation parameter table in VRAM For details on the variable type ROTSCROLL refer to ROTSCROLL in the Structure Reference When setting the perspective using the function slPerspective execute this function first before executing slPerspective Refer to Chapter 8 Scrolls slRparalnitSet 44 Scroll Function void sIRparaMode Rotation parameter mode setting Format void sIRparaMode mode Uint16 mode Parameters mode Rotation parameter mode Function This function specifies the rotation parameter mode This function makes it possible to specify how rotation parameters A and B are used Return Value None Remarks Specify one of the following values for the rotation parameter mode RA Use only rotation parameters A RB Use only rotation parameters B K_CHANGE Change screens according to the coefficient data of rotation parameters A W_CHANGE Change screens according to the rotation parameter window Mode o Mode1 Mode2 Modes Substitution value RA RB K CHANGE W_CHANGE Note The values in the above table are defined in s _def h provided with the system Refer to Chapter 8 Scrolls slRparaMode 45 Scroll Function void slScrAutoDisp Scroll registration cycle pattern register setting Format Uint16 slScrAutoDisp ptr Uint32
53. ap 4 VDP2 VRAM Memory Map The VDP2 VRAM that begins at 0x25E00000 is divided as follows upon system initialization Cache_through_address AO RBGOCG 2048chars Character generator data for rotating scroll A1 RBGOKtable Coefficient data and rotation parameters for rotating scroll BO RBGOMap 32pages __ __ 32 er of pattern name data for rotating scro 25E68000 NBGO NBG1CG 512chars 7 character generator data for NBGO and NBG1 B1 en NBG1CG 896chars character generator data for NBG1 25E78000 nbgOmap 1page 1 page of pattern name data for NBGO 25E80000 NBG1Map 4pages ____ 4 pages of pattern name data for NBG1 Normal scroll data this area is shared by character generator data and pattern name data Fig 4 1 VDP2 VRAM Memory Map Settings at system initialization The character generator is in 256 color mode regardless of the scroll and the pattern name is always 1 word 1 cell NBGO is in 10 bit mode with a reverse flag for each cell while the other screens are in 12 bit mode in which reverse is specified or not for the entire screen The color RAM is in 16 bit 2048 color mode and no offset is used The background screen is in single color mode with the color data 0000 in 25E3FFFE 11
54. athematical Operation Function ANGLE slAtan Return angle of specified direction Format ANGLE slAtan tx ty FIXED tx fixed TY Parameters tx X component of vector in specified direction ty Y component of vector in specified direction Function This function returns the angle of the specified direction Return Value Returns the angle of the specified direction Remarks The diagram below illustrates the principles behind the angle calculation in the function slAtan Y CVAD mes wE x f B tan tyltx slAtan tx ty Refer to Chapter 11 Mathematical Operation Functions slAtan 98 void Mathematical Operation Function slCalcPoint Multiply current matrix with specified point and substitute Format Parameters Function Return Value Remarks void slCalcPoint x y z ans FIXED x y z FIXED ans x X component of transformation coordinate specification y Y component of transformation coordinate specification Zz Z component of transformation coordinate specification ans XYZ XYZ component substitution variable after matrix transformation This function multiplies the XYZ coordinate values specified as parameters with the current matrix and substitutes the result into the parameter ans XYZ None Refer to Chapter 11 Mathematical Operation Functions slCalcPoint 99 FIXED Mathematical Operation Function slCos Returns cosine value of specified angle Format Parameters Fu
55. atus Parameters None Function This function automatically gets the latest SMPC status and puts it into the global variable Smpc_Status This function also automatically gets the peripheral data and puts it into the global variable Smpc_Peripheral This function also automatically gets the number of connected peripherals and puts the data into the global variables Per_Connect1 and Per_Connect2 Return Value Execution results OK Successful NG Failed Remarks Execution of this function fails when the semaphore cannot be gotten because it is locked by another process This function is called once by sllnitSystem when the library is started up to get the SMPC status at startup Afterwards the mode is set so that slGetPeripheral is called so that only the peripheral data is gotten The settings are reflected in the data starting from the second frame after the settings are made Execution of this function fails when the peripheral port input output setting is incorrect Refer to HARDWARE MANUAL vol 1 SMPC slGetStatus 124 Void System Management Function slInitPeripheral System management and peripheral control initialization Format Parameters Function Return Value void sllnitPeripheral None This function initializes the system management and peripheral control library None Remarks Because this function is called by sllnitSystem during library startup there is no particular
56. buffer lacks sufficient space Remarks For details on PCM type structures refer to the Structure Reference PCM playback initiated by this function terminates when the data ends Refer to Chapter 14 Sound Library sIPCMOn 155 Bool Sound Function sIPCMParmChange Change PCM playback parameters Format Parameters Function Return Value Remarks Bool sIPCMParmChange Pdat PCM Pdat Pdat PCM type structure data This function changes the value of each parameter for PCM playback If the command buffer is full this function returns the FALSE value For details on PCM type structures refer to the Structure Reference Refer to Chapter 14 Sound Library sIPCMParmChange 156 Bool sIPCM Stat Check playback on specified PCM channel Sound Function Format Parameters Function Return Value Remarks Bool sIPCMStat Pdat PCM Pdat Pdat PCM type structure data This function checks to determine whether or not PCM playback is in progress on the specified channel This function returns 1 if playback is in progress and 0 if it is not Refer to Chapter 14 Sound Library sIPCMStat 157 Bool Sound Function slSequenceCont Restart generation of paused sound effect Format Parameters Function Return Value Remarks Bool slSequenceCont Seqnm Uint8 Seqnm Seqnm Sequence control number This function resumes generation of a paused sound effect If
57. creen Format void slScrMosaicOn screen Uint16 screen Parameters screen Flag for scroll on which mosaic processing is to be performed Function This function sets the scroll screen on which mosaic processing is to be performed Multiple scroll screens can be specified simultaneously by linking multiple parameters together with the or operator Return Value None Remarks For the parameter screen substitute the value from the table below corresponding to the scroll screen being specified ft Scroll screen being specified NBGO NBG1 NBG2 NBG3 RBGO Substitution value NBGOON NBG1ON NBG2ON NBG3ON RBGOON Note The values in the above table are defined in sl_def h provided with the system Refer to HARDWARE MANUAL vol 2 VDP2 slScrMosaicOn 52 Scroll Function void slScrMosSize Horizontal and vertical specification of mosaic processing size Format void sIScrMosSize Hsize Vsize Uint16 Hsize Uint16 Vsize Parameters Hsize Horizontal size for mosaic processing Vsize Vertical size for mosaic processing Function This function specifies the horizontal and vertical sizes in dots range 1 to 16 for mosaic processing In non interlaced mode specify 1 to 16 dots in both the vertical and horizontal directions In interlaced mode specify 2 to 32 dots in the vertical direction and 1 to 16 dots in the horizontal direction When mosaic processing is performed on the rotating scroll it is only
58. croll Function void slCharNbg0 i 23 NBG character control setup Format void slCharNbg0 col_type chara_size void slCharNbg1 col_type chara_size void sICharNbg2 col_type chara_size void sICharNbg3 col_type chara_size Uint16 col_type Uint16 chara_size Parameters col_type flag for the specification of the number of colors for the scroll chara_size flag for the character size specification Function This function sets the character size and the number of colors used on normal scrolls NBGO NBG1 NBG2 and NBG3 Refer to the table below for the substitution values for the parameters Return Value None Remarks When the color RAM mode is 0 or 2 the 2048 color specification becomes 1024 colors In addition the maximum number of colors that can be specified differs according to the scroll screen type Number of character colors Character size Palette format RGB format atette format o O Note 1 In color RAM mode 0 or 2 2048 colors becomes 1024 colors Note 2 The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls slCharNbg0 1 2 3 12 Scroll Function void slCharRbg0 RBG character control setup Format void sICharRbgO col_type chara_size Uint16 col_type Uint16 chara_size Parameters col_type flag for the specification of the number of colors for the scroll chara_size flag for the character size specification Function This f
59. ction Screen scroll value NBG2 vertical direction Screen scroll value NBG3 horizontal direction Screen scroll value NBG3 vertical direction Reduction enable Line and vertical cell scroll control Vertical cell scroll table address Line scroll table address for NBGO Line scroll table address for NBG1 Line color screen table address Background screen table address 170 172 174 176 178 17A 17C 180 182 184 186 188 18A 18C 18E 190 192 194 196 198 19C 1A0 1A2 1A4 1A6 1A8 1AA 1AC 1AE 1B0 1B2 1B4 1B6 1B8 1BA 1BC 1C0 102 104 1C6 1C8 1CA 1CC VDP2_RPMD VDP2_RPRCTL VDP2_KTCTL VDP2_KTAOF VDP2_OVPNRA VDP2_OVPNRB VDP2_RPTA VDP2_WPSX0 VDP2_WPSY0 VDP2_WPEX0 VDP2_WPEY0 VDP2_WPSX1 VDP2_WPSY1 VDP2_WPEX1 VDP2_WPEY1 VDP2_WCTLA VDP2_WCTLB VDP2_WCTLC VDP2_WCTLD VDP2_LWTAO VDP2_LWTA1 VDP2_SPCTL VDP2_SDCTL VDP2_CRAOFA VDP2_CRAOFB VDP2_LNCLEN VDP2_SFPRMD VDP2_CCCTL VDP2_SFCCMD VDP2_PRISA VDP2_PRISB VDP2_PRISC VDP2_PRISD VDP2_PRINA VDP2_PRINB VDP2_PRIR VDP2_CCRSA VDP2_CCRSB CCRSB_CCRSC VDP2_CCRSD VDP2_CCRNA VDP2_CCRNB VDP2_CCRR Rotation parameter mode Rotation parameter read control Coefficient table control Coefficient table address offset Screen overflow pattern name Screen overflow pattern name Rotation parameter table address Window position Hstart hae Window position Vstart oOo Window position Hs
60. ction void slGetMatrix Hexadecimal screen display Format void sI GetMatrix mtpr MATRIXmtpr Parameters mtptr Starting address of MATRIX type variable to be copied input Function This function copies the current matrix to the specified matrix Return Value None Remarks Example of usage MATRIXmat slGetMatrix mat slPrintMatrix mat slLocate 3 4 Refer to Chapter 5 Matrices slGetMatrix 75 Matrix Function void slInitMatrix Matrix variable and buffer initialization Format void sllnitMatrix Parameters None Function This function initializes the variables and buffers used in matrix operations and prepares the environment matrix unit matrix for the current matrix Return Value None Remarks Refer to Chapter 5 Matrices sllnitMatrix 76 Matrix Function void slInversMatrix Current matrix inversion transformation Format void sllnversMatrix Parameters None Function This function inverts the current matrix Return Value None Remarks Refer to sllnversMatrix TT Matrix Function void slLoadMatrix Copy specified matrix to current matrix Format void slloadMatrix mtptr MATRIX mtptr Parameters mtptr Starting address of the MATRIX type variable to be copied output Function This function copies the specified matrix to the current matrix Return Value None Remarks Refer to Chapter 5 Matrices slLoadMatrix 78 Matrix
61. d as the function to be executed by this event is registered When the event area is gotten successfully this function returns the starting address of the registered event area If there are no available event areas this function returns the NULL code Remarks Although the event area is allocated as 128 bytes the first 16 bytes are used by the system Refer to Chapter 10 Event Control slSetEvent 118 EVENT Event Management Function sl S etEventNext Add new event after specified event Format Parameters Function Return Value EVENT slSetEventNext evptr func EVENT evptr void func evptr Starting address of the event area immediately preceding the position where the new event is to be inserted func Pointer for function to be registered as an event This function gets an event area and inserts adds it to the event list The new event is registered in the event list so that it is executed next after the event specified as a parameter This function returns the starting address of the registered event area If there are no more event areas remaining the event is not registered and this function returns the NULL code Remarks Although the event area is allocated as 128 bytes the first 16 bytes are used by the system Refer to Chapter 10 Event Control slSetEventNext 119 Uint8 System Management Function slCheckReset Get SMPC reset button status Format Parameters Function Return
62. dding rotation around the Y axis Refer to Chapter 4 Coordinate Transformation slRotY 87 Matrix Function void slIRotY SC Adding Y axis rotation with sine and cosine specified Format void slRotYSC sn cs FIXED sn FIXED cs Parameters sn Angle of rotation versus Y axis after sine transformation cs Angle of rotation versus Y axis after cosine transformation Function This function specifies the sine and cosine and multiplies the values with the Y axis rotation matrix The rotation matrix is expressed as shown below Return Value None Remarks cs 0 0 sn Rysc 0 0 1 0 0 0 sn 0 0 cs 0 0 0 0 0 0 Note cs and sn are the parameter substitution values Refer to Chapter 4 Coordinate Transformation slIRotYSC 88 Matrix Function void slIRotZ Adding rotation around Z axis to current matrix Format void slRotZ angz ANGLEangz Parameters angz Angle of rotation around Z axis Function This function multiplies a Z axis rotation matrix with the current matrix The rotation matrix is expressed below Return Value None Remarks cosf sinf 0 0 Rz sinf cosf 0 0 0 0 0 0 1 0 0 0 0 0 0 0 a Rotation matrix for adding rotation around the Z axis Refer to Chapter 4 Coordinate Transformation slRotZ 89 Matrix Function void slRotZS C Adding Z axis rotation with sine and cosine specified Format void slIRotZSC sn cs FIXED sn FIXED cs Parameters sn Angle of rotation ver
63. declaration sITVOn Refer to Chapter 8 Scrolls sITVOff 59 Scroll Function void sITVOn Drawing start declaration Format void sITVOn Parameters None Function This function starts drawing in the scroll screen monitor Return Value None Remarks To stop drawing in the monitor execute the drawing end declaration sITVOff Refer to Chapter 8 Scrolls sITVOn 60 Scroll Function void slZoomModeNbg9 1 NBG expansion reduction mode determination Format void slZoomModeNbg0 mode void slZoomModeNbg1 mode Uint16 mode Parameters mode Flag corresponding to the zoom mode specification Function This function sets the expansion reduction mode in the reduction enable register for NBGO and NBG1 which are the only normal scrolls that permit expansion reduction Return Value None Remarks Depending on the reduction setting the range for expansion reduction changes as follows Reduction setting 1 1x 1 1x to 256x Reduction setting 1 2x 1 2x to 256x Reduction setting 1 4x 1 4x to 256x Reduction setting Substitution value ZOOM_1 ZOOM_HALF ZOOM_QUATER Note The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls slZoomModeNbg0 1 61 Scroll Function void slIZoomNbg0 l NBG expansion reduction Format void sIZoomNbg0 x y void slZoomNbg1 x y FIXED x FIXED y Parameters x Reciprocal of expansi
64. e above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls slColOffsetOn 14 Scroll Function void slColOffs etBUs Color offset select Format void slColOfsetBUse flag Uint16 flag Parameters flag Screen Function This function sets the screen that will be affected by the color offset set by the function slColOfsetB The or operator can be used to link together multiple parameters so that multiple screen can be set simultaneously Return Value None Remarks For the parameter substitute the value from the table shown below corresponding to the scroll screen to be registered Scroll screen being registered NBGO NBG1 NBG2 NBG3 RBGO BACK SPRITE Substitution value NBGOON NBG1ON NBG2ON NBG30N RBGOON BACKON SPRON Note The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls slColOffsetBUse 15 Scroll Function void slColOffs etA B Color offset setting Format void slColOfsetA r g b void slColOfsetB r g b Sint16 r Sint16 g Sint16 b Parameters r Red offset value signed 9 bits g Green offset value signed 9 bits b Blue offset value signed 9 bits Function These functions set the color offset values for red green and blue The function slColOfsetA sets the offset values used for color offsets A and the function slColOfsetB sets the offset values used for col
65. e angle data and the four low order bits are discarded rounding 7 down and 8 up with the result that the range 0x0000 to OxfffO is used for the angle data the precision of the operation results suffers slightly This treatment applies to all functions that use angle data Refer to Chapter 11 Mathematical Operation Functions slSin 107 Mathematical Operation Function Uint32 slSquart Calculate square root of unsigned integer value Format Uint32 slSqart sqrt Uint32 sqrt Parameters sqrt Unsigned integer value Function This function calculates the square root of an unsigned integer value Return Value This function returns the square root of an unsigned integer value Remarks BCD code notation for representing the values 0 to 9 using 4 bits Refer to Chapter 11 Mathematical Operation Functions slSquart 108 Mathematical Operation Function FIXED slSquartF X Calculate square root of unsigned fixed point decimal Format FIXED slSquartFX sqrtx FIXED sartfx Parameters sqrtfx Unsigned fixed point decimal Function This function calculates the square root of an unsigned fixed point decimal Return Value This function returns the square root of an unsigned fixed point decimal Remarks Because the calculation is performed as for integers the precision of the result is 8 bits for the integer portion and 8 bits for the decimal portion Refer to Chapter 11 Mathematical Operation Function
66. e current matrix and displays the sprite after applying scaling effects in accordance with perspective transformation As with the function slDispSprite scaling is performed according to the specified scale value If a negative value is specified the absolute value is used None Refer to Chapter 9 Controller Input slPutSprite 66 void SpriteFunction slSetSprite Sprite data setting Format Parameters Function Return Value void slSetSprite parms Zpos SPRITE parms FIXED Zpos parms Starting address of area where sprite data is stored Zpos Z coordinate position This function sets the spritecontrol command data to be transferred to the hardware in the transfer list This function is used to set altered sprites that cannot be created with the library functions or to set up a window that affects specific sprites only None Remarks For details on the effects of execution of the function slSetSprite refer to p 118 and beyond in HARDWARE MANUAL vol 2 VDP1 User s Manual Refer to Chapter 9 Controller Input slSetSprite 67 void SpriteFunction slSpriteType Sprite data type specification Format Parameters Function Return Value void slSpriteType type Uint16 type type Sprite type 0 to 15 This function specifies the sprite data type None Remarks Types 0 to 7 are for low resolution 320 or 352 and types 8 to 15 are for high resolution 640 or 704 the
67. efer to Chapter 7 P TEXTURE 10 Structure STRUCTURE typedef struct work struct work next Uint8 user WORK_SIZE sizeof struct work WORK Members next Pointer to next work area user Free area within the work area that the user can use Description This structure indicates a work area that can be used within an event The member user consists of the work size WORK_SIZE 64 bytes less the size of the member next 4 bytes for a total of 60 bytes For details refer to the Chapter 10 Event Control in the Programmer s Tutorial Remarks Refer to Chapter 10 Event Control WORK 11 Structure mpcDateTime RTC time year month date hour minute second month Day of the week and month This structure is used to reference the RTC time STRUCTURE typedef struct Uint16 Uint8 Uint8 Uint8 Uint8 Uint8 SmpcDateTime Members year Year date Date hour Hours minute Minutes second Seconds Description Remarks Use this structure when referencing the rtc member of the system variable Smpc_ Status Refer to HARDWARE MANUAL vol 1 SMPC SmpcDateTime 12 Structure Mpc Status SMPC status STRUCTURE typedef struct Uint8 cond SmpcDateTime month Uint8 ctg Uint8 area Uint16 system Uint32 smem SmpcStatus Members cond Status rtc RTC time ctg Cartridge code area Area code system System status smem SMPC memory data Desc
68. ent table vertical direction address increment DKAst DKA Coefficient table vertical direction address increment DKA Structure This structure defines the rotation parameter table Remarks The rotation parameter table is read for each line of the rotating scroll screen and the screen is displayed according to those values Used together with the NORMAL macro this macro is used to make the Refer to POLYGON face list ROTSCROLL Structure PR ATTR Sprite attributes table STRUCTURE typedef struct spratr Uint16 texno Uint16 atrb Uint16 colno Uint16 gstb Uint16 dir SPR_ATTR Members texno Texture number atrb Attribute data display mode colno Color number gstb Gouraud shading table dir Texture reversal Description This structure is the parameter table for sprite display Basically these parameters conform with the texture parameters Remarks Refer to the group of functions concerning sprite display Refer to SPR_ATTR Structure PRITE Sprite data STRUCTURE typedef struct Uint16 CTRL Uint16 LINK Uint16 PMOD Uint16 COLR Uint16 SRCA Uint16 SIZE Uint16 XA Uint16 YA Uint16 XB Uint16 YB Uint16 XC Uint16 YC Uint16 XD Uint16 YD Uint16 GRDA Uint16 DMMY SPRITE Members CTRL Control function LINK Link address PMOD Put mode COLR Color data SRCA CG address SIZE Character size XA X coordinate of display position A YA Y coordinate
69. ereo SYMBOL PCM16Bit and Level7 lt lt 5 are each passed to the sound driver as byte data while StreamBuf gt gt 4 StreamSize and Pitch are each passed as word data Supplement Refer to the slSoundRequest Instruction List on the following page Refer to Chapter 14 Sound Library slSoundRequest 174 Table 1 slSoundRequest Instruction List continued Function Reference Supplement Table 1 slSoundRequest Instruction List Reserved sid 00 00 hex Nothing o Sound Function Sequence control number Sequence Start 15 Sequence bank number Sequence song number S Priority level S Sequence Pause 7 Sequence control number a ee ae RE E S Sequence Volume Sequence control number For details refer to the Sequence Volume supplement on the fade in andi S 255 Fade Rate fade out methods Sequence control number Tempo Change dummy S 32767 gt 32768 Relative tempo value compared to reference tempo 0000h 1000h 4296 is double speed and 4296 is half speed Map Change 0 255 Area number of sound area map being switched SP MIDI direct control OOh FFh MIDI command word For details refer to S OOh FFh MIDI channel word supplement on the MIDI direct 0Oh 7Fh MIDI data 1 control bit image OOH 7Fh MIDI data 2 Volume analize start a eo start volume analysis C Volume analize stop is Nothing stop volume analysis Sound l Off Nothing stop all sequence slots
70. ertical direction fixed point Screen scroll value NBGO vertical direction integer portion Screen scroll value NBGO vertical direction decimal portion Coordinate increment step NBGO horizontal direction fixed point Coordinate increment step NBGO horizontal direction integer portion Coordinate increment step NBGO horizontal direction decimal portion Coordinate increment step NBGO vertical direction fixed point Coordinate increment step NBGO vertical direction integer portion ana a aan a Coordinate increment step NBGO vertical direction decimal portion Screen scroll value NBG1 horizontal direction fixed point Screen scroll value NBG1 horizontal direction integer portion Screen scroll value NBG1 horizontal direction decimal portion Screen scroll value NBG1 vertical direction fixed point Screen scroll value NBG1 vertical direction integer portion Screen scroll value NBG1 vertical direction decimal portion Coordinate increment step NBG1 horizontal direction fixed point Coordinate increment step NBG1 horizontal direction integer portion Coordinate increment step NBG1 horizontal direction decimal portion Coordinate increment step NBG1 vertical direction fixed point Coordinate increment step NBG1 vertical direction integer portion Coordinate increment step NBG1 vertical direction decimal portion Screen scroll value NBG2 horizontal dire
71. es and in the worst case the CPU may stop operating Refer to Chapter 10 Event Control slCloseEvent 111 Event Management Function void slExecuteEvent Event schedule management Format void slExecuteEvent Parameters None Function This function executes the events registered in the execution list in sequence starting from the top of the list Return Value None Remarks The function slExecuteEvent should be called once per frame Refer to Chapter 10 Event Control slExecuteEvent 112 Event Management Function EVENT slGetEvent Get area equal in size to event Format EVENT sIGetEvent Parameters None Function This function gets an area that is the same size as an event 128 bytes in the part of RAM that has been allocated for events and returns the pointer to that area Because this function only gets an area equal in size to an event from the event area this function does not register that area as an event Return Value Pointer to the RAM area that was gotten NULL is returned if no area was available There is a maximum limit of 64 events Remarks The RAM area gotten by slGetEvent must be released using the function slReturnEvent when the event using the area is closed If the area is not released the area will continue to exist unused in the event area Refer to Chapter 10 Event Control slGetEvent 113 WORK slGetWork Get new work Event Management Functi
72. eturn Value Remarks FIXED sIDivFX a b FIXED s FIXED b a A in B A divisor b B in B A dividend This function divides one fixed point decimal by another B A This function returns the result of B A This function does not perform an overflow check Refer to Chapter 11 Mathematical Operation Functions sIDivFX 102 Mathematical Operation Function Uint32 slHex2Dec Convert hexadecimal code to BCD code Format Uint32 slHex2Dec val Uint32 val Parameters val Hexadecimal code to be converted Function This function converts a hexadecimal code to a BCD code Return Value This function returns the converted BCD code Remarks BCD code notation for representing the values 0 to 9 using 4 bits Ex The decimal value 128 is represented in BCD notation as 0x128 _ Decimal BCD Hexadecimal Note Example of representations of a value using each form of notation Refer to Chapter 11 Mathematical Operation Functions slHex2Dec 103 Mathematical Operation Function FIXED slInnerPro duct Inner product of vectors Format FIXED sllnnerProduct vctl vct2 VECTOR vet 1 VECTOR vet2 Parameters vet1 VECTOR type variable for which the inner product is to be taken vet2 VECTOR type variable for which the inner product is to be taken Function This function finds the inner product of the specified vectors and returns the result Return Value This function returns the resu
73. h the system Refer to Chapter 8 Scrolls slIPlaneRA 40 Scroll Function void slPlaneRB RBG plane size setting for rotation parameters B Format void sIPlaneRB type Uint16 type Parameters type Uint16 type value corresponding to the plane size specification Function This function sets the plane size for rotating scrolls using rotation parameters B Refer to the table below for the substitution values for the parameter Return Value None Remarks a Plane size Note The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls sIPlaneRB 41 Scroll Function void s PriorityRbg0 RBG priority setting Format void slPriorityRbgO num Uint16 num Parameters num Graphics priority number 8 levels from 0 to 7 Function This function assigns a priority ranking to the rotating scroll Higher priority numbers represent a higher display priority so the smaller the priority number the farther back the associated scroll screen is displayed If the priority number assigned is 0 the scroll is regarded to be clear and is not displayed Return Value None Remarks If more than one scroll or polygon has been assigned the same priority number their respective priority is ranked as shown below _e Priority when priority numbers are equal _ SPRITE gt RBGO gt NBGO gt NBG1 gt NBG2 gt NBG3 High forefront of screen Low bac
74. hange 169 Sint8 sISndPCMNum Return available PCM channel number Sound Function Format Parameters Function Return Value Remarks Refer to Sint8 slSndPCMnUM Mode PCM playback mode This function returns the number of an available PCM channel If this function terminates normally it returns a value from 0 to 7 If there are no available PCM channels the function returns the value 1 Specify the logical sum of Stereo or Mono and _16Bit or _8Bit for the parameter Mode Although PCM permits playback of up to eight voices stereo playback requires two voices so that even if only four are being played in actuality eight voices may be in use slSndPCMNum 170 Uint8 Sound Function slSndS eqNum Return available sequence control number Format Parameters Function Return Value Remarks Refer to Uint8 slSndSeqNum None This function returns an available sequence control number If this function terminates normally it returns a value from 1 to 7 If there are no available sequence control numbers the function returns the value 0 slSndSeqNum 171 Bool Sound Function slISndVolume Set the main volume Format Parameters Function Return Value Bool slSndVolume Volume Uint8 Volume Volume Volume value This function sets the main volume If the command buffer is full this function returns the FALSE value Remarks Specify a value
75. he monitor moves to the right on the scroll map giving the appearance that the scroll is moving to the left Move position to right b Move to right slScrPosNbg0 1 12 3 54 Scroll Function void slScrTransparent Transparent enable display setting Format void slScrTransparent flag Uint16 flag Parameters flag Flag specifying the transparent display setting Function This function specifies the handling of the transparent color for each scroll The specification can be made for multiple scroll screens simultaneously by linking the parameters with the or operator Return Value None Remarks The parameters shown below can be specified for flag For scroll screens specified by the parameter the No O character is drawn according to the data for that character for scroll screens not specified by the parameter the No 0 character is drawn on the screen as a transparent character oes screen aa cer aes NBGO NBG NBG2 e REGO NBGOON NBG1ON NBG2ON NBG3ON RBGOON value Note The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls slScrTransparent 55 Scroll Function void slIScrWindow0 Scroll rectangular window Osetting Format void slScrWindow0 Left Top Right Bottom Uint16 Left Uint16 Top Uint16 Right Uint16 Bottom Parameters Left X coordinate of upper left corner of window Top Y coordinate of upper
76. he parameter is 0x00 to Ox1f Each of these values represents a calculation ratio for example if rate OxOf is substituted the calculation ratio between the top image and the 2nd image is 16 16 For details on the relationship between the substitution value and the calculation ratio refer to the table on page 244 of the VDP2 User s Manual of the HARDWARE MANUAL vol 2 Refer to Chapter 8 Scrolls slColRateRbg0O 23 Scroll Function void slCurRpara Current rotation parameter change Format void slCurRpara flag Uint16 flag Parameters flag Rotation parameter specification Function Specifies either rotation parameters A or B as the operative parameters Return Value None Remarks For the parameter substitute a value from the table below corresponding to the rotation parameters to be used oe Rotation parameters A Rotation parameters B Substitution value Note The actual values are defined in sLdef h Refer to Chapter 8 Scrolls slCurRpara 24 void Scroll Function s DispCenterR RBG rotation center coordinates setting Format Parameters Function FIXED x FIXED y xX X coordinate screen coordinate system of center of rotation for rotating scroll y Y coordinate screen coordinate system of center of rotation for rotating scroll This function sets the coordinates of the center of rotation for the rotating scroll These coordinates determine the position around which t
77. he rotating scroll rotates Return Value Remarks 0 0 E Y Placement coordinates Rotating scroll map Refer to Chapter 8 Scrolls None The rotating scroll display position is determined according to the placement of the monitor using the rotation center coordinates as a reference point in the placement coordinates on the scroll map Use the function slLookR to determine the placement coordinates of the rotating scroll For the relationship between rotation and placement refer to the following diagrams e i Rotation center coordinates D as Y E E Placement Monitor Rotation Monitor Rotating scroll map Rotating scroll map Note The positive direction on the Z axis for the scroll screen is towards the viewer slDispCenterR 25 Scroll Function void slkKtableRA B Coefficient table control settings Format void slKtableRA ktable_adr mode void slKtableRB ktable_adr mode void ktable_adr Uint16 mode Parameters ktable_adr Coefficient table address in VRAM mode Coefficient table control mode Function This function sets the coefficient table address in VRAM in a register and also specifies how the coefficient table is to be used and its configuration Return Value None Remarks The following parameters can be specified _ silKtableRA B substitution values _ce Table usage K_OFF K_ON Coefficient data size K_2WORD K_1WORD Coefficient mode K_MOD
78. ical Operation Function slAng2Dec Convert ANGLE type angle value into BCD type value Format Parameters Function Return Value Uint16 slAng2Dec ang ANGLE ang ang ANGLE type angle value This function converts an ANGLE type angle value into a BCD type value Angle data converted into a BCD TYPE VALUE Remarks LISTING 402 400 _ 0x0090 ang 0x1000 _ 0x0022 Refer to Chapter 11 Mathematical Operation Functions slAng2Dec 95 Mathematical Operation Function void slAng2FX Convert ANGLE type angle value into FIXED type value Format FIXED slang2FX ang angle amg Parameters ang ANGLE type angle value Function This function converts an ANGLE type angle value into a FIXED type value Return values Return Value Angle data converted into a FIXED type value Remarks Ex ang 0X4000 _ 0x005A0000 90 0 ang 0X1000 _ 0x0016800 22 5 Refer to Chapter 11 Mathematical Operation Functions slAng2FX 96 Uint16 Mathematical Operation Function slAng2Hex Convert ANGLE type angle value into hexadecimal value Format Parameters Function Return Value Uint16 slAng2Hex ang ANGLE ang ang ANGLE type angle value This function converts an ANGLE type angle value into a hexadecimal value Angle data converted into a hexadecimal value Remarks Ex ang 0X4000 _ 0x005A ang 0X1000 _ 0X0016 Refer to Chapter 11 Mathematical Operation Functions slAng2Hex 97 M
79. imization mode Peripheral acquisition time optimization mode Remarks The following values are returned for the return value SMPC_OPT_ENA Acquisition time optimization enable initial value SMPC_OPT_DIS Acquisition time optimization disable Refer to HARDWARE MANUAL vol 1 SMPC slGetOptimize 139 Uint8 slGetPortMode l ki Get port mode for peripheral port 1 2 Peripheral Control Function Format Parameters Function Return Value Uint8 slGetPortMode1 Uint8 slGetPortMode2 None These functions get the port mode of peripheral ports 1 and 2 Port mode of the peripheral port Remarks The following values are returned for the return value SMPC_PORT_15 15 byte mode initial value SMPC_PORT_255 255 byte mode SMPC_PORT_ZERO 0 byte mode Refer to HARDWARE MANUAL vol 1 SMPC slGetPortMode1 2 140 Bool Peripheral Control Function slSetOptimize Set peripheral acquisition time optimization mode Format Parameters Function Return Value Bool slSetOptimize mode Uint8 mode mode Peripheral acquisition time optimization mode This function sets the peripheral acquisition time optimization mode Execution results OK Success NG Failure Remarks Execution of this function fails when the semaphore cannot be gotten because it is locked by another process The following values can be used for the parameter SMPC_OPT_ENA Acquisition time optimization enable initial value SMPC_OP
80. itSound Set sound driver and initialize sound control CPU Format void slInitsound Dry Drvsz Map Mapsz Uint8 Dry Uint32 Drvsz Uint8 Map Uint382 Mapsz Parameters Drv Driver file address Drvsz Driver file size Map Map file address Mapsz Map file size Function This function sets the sound driver and initializes the sound control CPU MC68000 Return Value None Remarks Refer to Chapter 14 Sound Library sllnitSound 153 Bool sIPCMOff Stop playback from PCM sound source Sound Function Format Parameters Function Return Value Remarks Bool sIPCMOff Pdat PCM Pdat Pdat PCM type structure data This function stops PCM playback on the specified channel If the command buffer is full this function returns the FALSE value For details on PCM type structures refer to the Structure Reference Refer to Chapter 14 Sound Library sIPCMOff 154 Sint8 sIPCMOn Start playback from PCM sound source Sound Function Format Parameters Function Return Value Sint8 sIPCMOn Pdat Data Size PCM Pdat void Data Uint32 Size Pdat PCM type structure data Data PCM data table address Size PCM data table size This function plays back music sound effects from a PCM source This function returns a value ranging from O to 7 after normal termination 1 if the command buffer lacks sufficient space 2 if there is no PCM channel available and 3 if the PCM
81. kground of screen Note Polygons are included in sprites Refer to Chapter 8 Scrolls slPriorityRbgO 42 Scroll Function void s PriorityNbg0 l 25 NBG priority setting Format void slPriorityNbgO num void slPriorityNbg1 num void slPriorityNbg2 num void slPriorityNbg3 num Uint16 num Parameters num Graphics priority number 8 levels from 0 to 7 Function This function assigns a priority ranking to the normal scrolls NBGO NBG1 NBG2 and NBG3 Higher priority numbers represent a higher display priority so the smaller the priority number the farther back the associated scroll screen is displayed If the priority number assigned is 0 the scroll is regarded to be clear and is not displayed Return Value None Remarks If more than one scroll or polygon has been assigned the same priority number their respective priority is ranked as shown below _e Priority when priority numbers are equal SPRITE gt RBGO gt NBGO gt NBG1 gt NBG2 gt NBG3 High forefront of screen lt Y _Low background of screen Note Polygons are included in sprites Refer to Chapter 8 Scrolls slPriorityNbg0 1 2 3 43 Scroll Function void slRparaInitSet Rotation parameter table storage in VRAM Format void slRparalnitSet ptr ROTSCROLL ptr Parameters ptr Starting address in VRAM where the rotation parameter table is stored Function This function stores in VRAM the rotation par
82. lay area setting Win0 win0_IN win0_OUT Display area setting Win1 win1_IN wint_OUT Display area setting SpWin sow_IN spw_OUT Note The values in the above table are defined in sl_def h provided with the system Refer to HARDWARE MANUAL vol 2 VDP2 slScrWindowModeNBGO 1 2 3 57 Scroll Function void slShadowOn Shadow function setting Format void slShadowOn scrn Uint16 scn Parameters scrn Flag corresponding to the scroll screen for which the shadow function is set Function This function sets the scroll screen on which the shadow function is used Multiple scroll screens can be set simultaneously by linking multiple parameters together with the or operator Return Value None Remarks Refer to the table below for the scroll flags that are substituted for the parameter When setting multiple scroll screens use the or operator NBGO NBG1 NBG2 NBG3 RBGO BACK Substitution value _NBGOON NBG1ON NBG2ON NBG3ON RBGOON BACKON Note The values in the above table are defined in sl_def h provided with the system Refer to HARDWARE MANUAL vol 2 VDP2 slShadowOn fd Scroll screen being specified 58 Scroll Function void sITVOff Drawing end declaration Format void sITVOff Parameters None Function This function turns off scroll drawing processing in the monitor Return Value None Remarks To re initiate drawing in the monitor execute the drawing start
83. lt of the inner product operation Remarks The return value is calculated as shown below _ Inner product of vectors _ce A X1 Y1 Z21 B X2 Y2 Z2 X1 X2 Y1 Y2 Z1 Z2 Return Value Refer to Chapter 11 Mathematical Operation Functions sllnnerProduct 104 Mathematical Operation Function FIXED sIMulF X Multiplication operation A B Format FIXED sIMulFX a b FIXED a FIXED b Parameters a A in A B multiplier b B in A B multiplicand Function This function multiplies two fixed point decimals together Return Value This function returns the product of A and B Remarks Refer to Chapter 11 Multiplication Operation Functions sIMulFX 105 Mathematical Operation Function FIXED slRandom Random number generator Format FIXED slRandom Parameters None Function This function generates a random FIXED type value in a range from 0 to 1 Return Value A FIXED type value ranging from 0 0 to 1 0 Remarks Refer to slRandom 106 FIXED Mathematical Operation Function slSin Returns sine value of specified angle Format Parameters Function Return Value Remarks FIXED slSin angs ANGLE angs angs Specified angle This function gets the sine value for the specified angle from a Sin table The function returns the sine value for the specified angle Sine values are represented in the range Ox0000 to Oxffff However because 0x0008 is added to th
84. ly set multiple scrolls for display link the parameters with the or operator Return Value None Remarks The display setting determines which of the registered scrolls will actually undergo drawing processing Only those scroll screens for which the display setting is ON will actually be drawn on the monitor by the drawing start declaration Scrolls that were registered by using the function slAutoDisp have their display setting set to ON at the time of registration pf ee AEN ARA EAA EAA Substitution NBGOON NBGOOFF NBG1ON NBG10OFF NBG2ON NBG2OFF NBG30N NBG30FF RBGOON RBGOOFF value Note The values in the above table are defined in sl_def h provided with the system ON Draw scroll screen OFF Do not draw scroll screen Refer to Chapter 8 Scrolls slScrDisp 48 Scroll Function void slIScrLineWindow0 Line window tableO setup Format void slScrLineWindow0 adr void adr Parameters adr Line window data address in VRAM Function This function sets the address in VRAM of line window data table 0 Return Value None Remarks To enable a window set the high order bit to 1 To disable a window pass the NULL value Ex address 0x25e3f000 when constant is specified Use window slLineWindow0 void Ox25e3f O00 SPECIAL SYMBOL 0x80000000 Do not use window slLineWindow0 void NULL address 0x25e3f000 when constant is specified Use window Sint16 1ptr 1
85. n the direction of the Z axis This function multiplies the parallel movement matrix with the current matrix The parallel movement matrix is expressed as shown below None Remarks 1 0 0 0 0 0 TXyZ 0 0 1 0 0 0 0 0 0 0 1 0 tx ty tz Note tx ty and tz are the parameter substitution values Refer to Chapter 4 Coordinate Transformation slTranslate 92 void Matrix Function S lTransp O S eMatrix Current matrix transposition Format Parameters Function Return Value Remarks Refer to vioid slTransposeMatrix None This function replaces the current matrix with a transposed matrix Zero movement in parallel direction None A transposed matrix is expressed as shown below Moo M01 M02 Moo M10 M20 M10 M11 M12 M01 M11 M21 M20 M21 M22 M02 M12 M22 0 0 0 0 0 0 Conversion to transposed matrix 0 0 0 0 0 0 a Original matrix b Transposed matrix slTransposeMatrix 93 Matrix Function void slUnitMatrix Make specified matrix a unit matrix Format void ulUjnitMatrix mtptr MATRIXmitptr Parameters mtptr Starting address of MATRIX type variable to be converted to a unit matrix input Function This function converts the specified matrix into a unit matrix If CURRENT is specified for the parameter this function changes the current matrix into a unit matrix Return Value None Remarks Refer to Chapter 5 Matrices slUnitMatr 94 Uint16 Mathemat
86. nction Return Value Remarks FIXED slCos angc ANGLE ANGC angc Specified angle This function gets the cosine value for the specified angle from a Cos table The function returns the cosine value for the specified angle Cosine values are represented in the range 0x0000 to Oxffff However because 0x0008 is added to the angle data and the four low order bits are discarded rounding 7 down and 8 up with the result that the range 0x0000 to Oxfff0 is used for the angle data the precision of the operation results suffers slightly This treatment applies to all functions that use angle data Refer to Chapter 11 Mathematical Operation Functions slCos 100 Mathematical Operation Function Uint32 sl Dec2Hex Convert BCD code to hexadecimal code Format Uint32 sIDec2Hex val Uint32 val Parameters val BCD code to be converted Function This function converts a BCD code to a hexadecimal code Return Value This function returns the converted hexadecimal code Remarks BCD code notation for representing the values 0 to 9 using 4 bits Ex The decimal value 128 is represented in BCD notation as 0x128 __ Decimal BCD Hexadecimal Note Example of representations of a value using each form of notation Refer to Chapter 11 Mathematical Operation Functions sIDec2Hex 101 FIXED slIDivFX Division operation B A Mathematical Operation Function Format Parameters Function R
87. ndow_data Center_data nbg2_page_adr r ROTSCROLL ROTSCROLL Uint16 18 Uint16 10 Color offset enable Color offset select Color offset A red Color offset A green PAGE 9 Color offset A Color offset B Color offset B Color offset B blue red green blue Address of rotation parameters being used CG address for NBGO CG address for NBG1 CG address for NBG2 CG address for NBG3 Pattern name address for rotating scroll parameters A Pattern name address for rotating scroll parameters B Pattern name address for NBGO Pattern name address for NBG1 Pattern name address for NBG2 Pattern name address for NBG3 Pattern name address for rotating scroll parameters A Pattern name address for rotating scroll parameters B Rotation parameter set address Coefficient table set address Work area for slAutoDisp Rotation parameters A Rotation parameters B Window control data buffer for two Window center control data buffer for two 3 VDP1 VRAM Memory Map 10 Because the first and last parts of the VDP1 VRAM that begins at 0x25C00000 is used by the system those areas cannot be used by the user Cache_through_address 25000000 SpriteCommand E1C90 Sprite control command MAX_POLYGON 6 32 0xE1C0 25C0E1C0 Free forUser User Area 25C7FEF8 Gouraud shading table 25C80000 2 4 33 0x108 264 Fig 3 1 VDP1 VRAM Memory M
88. nter master Vertex coordinate calculation buffer pointer slave Sprite data transfer pointer Sprite data set pointer Master Sprite data set pointer Master Z buffer pointer Texture data table Sprite data buffer switching Command read pointer Command set pointer Light source vector master Light source vector master Color offset table pointer Screen position master Screen position slave Display limit Z position master Number of windows used Window use flag Total number of polygons Total number of vertices Screen left position master Screen top position master Screen right position master Screen bottom position master 080 082 084 086 088 08A 08C 08E 090 092 094 096 098 09A 09C 09E OAO 0A2 0A4 0A6 0A8 OAA OAC OAD OBO oco 0C2 004 0C6 0c8 OCA OCE MsScreenSizeX MsScreenSizeY MsScreenHalfx MsScreenHalfY SIScreenLeft SlScreenTop SIScreenRight SIScreenBottom SlScreenSizex SIScreenSizeyY SIScreenHalfX SIScreenHalfY MsClipXAdder MsClipY Adder SIClipXAdder SIClipY Adder SIZlimit WinPtr DispPolygons DMAEndFlag DMASetFlag PutCount MsZdpsftcnt SlZdpsftcnt Randwork VDP2_TVMD VDP2_EXTEN VDP2_TVSTAT VDP2_VRSIZE VDP2_HCNT VDP2_VCNT VDP2_RAMCTL Horizontal screen size master Vertical screen size master Horizontal screen size 2 master Vertical screen size 2 master Screen left position slave
89. o Oxffff Remarks Refer to Chapter 1 Sega Graphics Library ANGLE 18 Variable Type LX ED Fixed point decimal variable type Structure typedef Sint32 FIXED Members Description This variable type indicates fixed point decimal data FIXED type values are represented in the following manner High order 16 bits Integer portion Low order 16 bits Decimal portion Ex 16 5 gt 0x00108000 Remarks Refer to Chapter 1 Sega Graphics Library FIXED 19 Variable Type MATRIX Matrix variable type Structure typedef FIXED MATRIX 4 3 Members Description Matrix notation variable type Remarks FIXED matrix 4 3 MATRIX matrix The two definitions shown above have the same meaning Refer to Chapter 5 Matrices MATRIX 20 Variable Type POINT Vertex data type Structure typedef FIXED POINT xyz Members Description This variable type defines the vertex data used in polygons Remarks FIXED point xyz FIXED point 3 POINT point All three of the above definitions have the same meaning Refer to Chapter 2 Graphics POINT 21 Variable Type EXDAT Texture data variable type Structure typedef UINT16 TEXDAT Members Description This variable type is used to define the actual texture itself Remarks Refer to Chapter 7 Polygon Face Attributes TEXDAT 22 Variable Type VECTOR Vector variable type Structure TYPED FIXED VECTOR XYZ Members Description Vector data vari
90. ode setting Format void slBitMapNbg0 col_type bmsize void sIBitMapNbg1 col_type bmsize Uint16col_type Uint16bmsize Parameters col_type Color mode flag bmsize VRAM Bitmap size flag Function This function changes the screen to bitmap mode and sets the color mode and bitmap size Return Value None Remarks Refer to the tables below for the flags to be substituted for the parameters Note however the 16 77 million color specification can only be specified for NBGO Color mode flag Palette format RGB format 256 colors 2048 colors 32 768 colors 16 77 million colors Substitution value COL_TYPE_16 COL TYPE 256 COL_TYPE 2048 COL_TYPE_32768 COL_TYPE_1M Note In color RAM mode 0 or 2 2048 colors becomes 1024 colors Bitmap size 512 x 256 H x V 512 x 512 Hx V 1024 x 256 H x V 1024 x 512 Hx V Substitution value BM_512x256 BM_512x512 BM_1024x256 BM_1024x512 Note The values in the above table are defined in sl_def h provided with the system Refer to HARDWARE MANUAL vol 2 VDP2 slBitMapNbgo0 1 10 Scroll Function void sIB MPaletteNbg0 l Bitmap screen palette number setting NBG Format void sIBMPaletteNbg0 pal void sIBMPaletteNbg1 pal Uint16 pal Parameters pal Palette number 0 to 7 Function This function sets the palette number when displaying the bitmap screen in palette format Return Value None Remarks Refer to HARDWARE MANUAL vol 2 VDP2 sIBMPaletteRbg0O 1 11 S
91. on Format Parameters Function Return Value Remarks WORK siGetWork None This function gets a RAM area allocated for use as a work area and returns the pointer for that area This function returns the starting address for the new work area The NULL value is returned if the area could not be gotten due to maximum of 256 work areas Refer to Chapter 10 Event Control Refer to Chapter 10 Event Control slGetWork 114 Event Management Function void slInitEvent Event processing initialization Format void sllnitEvent Parameters None Function This function initializes the event and work management buffers After initialization 64 event areas and 256 work areas are allocated within memory Return Value None Remarks The event and work RAM itself is not initialized Initialize the RAM in the user program after getting these areas Refer to Chapter 10 Event Control sllnitEvent 115 Event Management Function void slReturnEvent Release area allocated by slGetEvent Format void slReturnEvent evptr EVENT evptr Parameters evptr Starting address of area to be released Function This function releases an area allocated by the slGetEvent function and returns it to the system Return Value None Remarks When an area registered as an event is released by using the slReturnEvent function the area is returned to the system but because the event list is not alte
92. on does not wait for the termination of SMPC command execution If an interrupt back has been issued this function is queued in the command cache Execution of this function fails if a command cache overflow occurs This function sets the contents of the global variable Smpc_Status in the SMPC memory Refer to HARDWARE MANUAL vol 1 SMPC slSetSmpcMemory 132 Bool System Management Function slSetSmpcMemory Wait SMPC memory setting wait mode Format Parameters Function Return Value Bool slSetSmpcMemoryWait None This function sets the SMPC memory Execution results OK Successful NG Failed Remarks Execution of this function fails when the semaphore cannot be gotten because it is locked by another process This function waits for the termination of SMPC command execution If an interrupt back has been issued execution of this function fails This function sets the contents of the global variable Smpc_Status in the SMPC memory Refer to HARDWARE MANUAL vol 1 SMPC slSetSmpcMemoryWait Void 133 System Management Function slSetSoundOutput Set SMPC memory sound output mode Format Parameters Function Return Value void slSetSoundOutput mode Uint8 mode mode Sound output mode This function sets the sound output mode in the SMPC memory information None Remarks The SMPC memory information can also be referenced from the global variable Smpc_Status To store the SMPC
93. on reduction ratio in direction of X axis for normal scroll y Reciprocal of expansion reduction ratio in direction of Y axis for normal scroll Function This function sets the expansion reduction ratio for NBGO and NBG1 the only normal scrolls that permit expansion reduction For the parameters substitute the reciprocals of the scale values in the direction of the X and Y axes respectively For example to enlarge the figure by 2 0x in the direction of the X axis substitute 1 2 for the parameter x Return Value None Remarks The range over which expansion reduction is possible differs according to the reduction setting for the scroll screen being expanded reduced The reduction setting is made by the function slZoomModeNbg0 1 For the expansion reduction range according to the reduction setting refer to the table below rer setting Expansion reduction range 1x to 256x 1 2x to 256x 1 4x to 256x Refer to Chapter 8 Scrolls slZoomNbg0 1 62 void Scroll Function slZoomR RBG expansion reduction Format Parameters Function Return Value Remarks Refer to Chapter 8 Scrolls void sIZoomR x y FIXED x FIXED y x Reciprocal of expansion reduction ratio in direction of X axis for normal scroll y Reciprocal of expansion reduction ratio in direction of Y axis for normal scroll This function sets the expansion reduction ratio for the rotating scroll and saves the setting in the curren
94. or offsets B Return Value None Remarks To set a negative value for an offset value substitute the complement of the absolute value of that number Color offset processing is executed after color operation processing Refer to Chapter 8 Scrolls slColOffsetA B 16 Scroll Function void slColorCalc Color calculation control setting Format void slColorCalc flag Uint16 flag Parameters flag Color calculation control parameter Function This function sets parameters for color calculations etc Return Value None Remarks For the parameters substitute the values in the table below according to the functions being used Refer to HARDWARE MANUAL vol 2 VDP2 User s Manual p 241 for details _ ColorCalc substitution values _ Calculation method CC_RATE CC_ADD Image for which calculation is specified CC_TOP CC_2ND Extended color operations CC_EXT Registered screen INBGOON NBG1ON NGB20ON NBG3ON RBGOON LNCLON SPRON Refer to Chapter 8 Scrolls slColorCalc 17 Scroll Function void slColorCalc On Color calculation control enable setting Format void slColorCalcOn flag Uint16 flag Parameters flag Specifies the screens on which color calculation is performed Function This function sets the screen that is affected by color calculation control The or operator can be used to link together multiple parameters so that multiple screens can be se
95. performed in the horizontal direction Return Value None Remarks Refer to HARDWARE MANUAL vol 2 VDP2 slScrMosSize 53 void slScrPosNbg0 l 23 NBG screen display position setting Scroll Function Format Parameters void slScrPosNbg2 x y void slScrPosNbg3 x y FIXED x FIXED y void slScrPosNbg1 x y x X coordinate scroll coordinate system for normal scroll placement Function y Y coordinate scroll coordinate system for normal scroll placement This function positions the respective normal scroll screens NBGO NBG1 NBG2 and NBG3 For the parameters specify the XY scroll coordinate values that indicate the display position Return Value Remarks Monitor Nomal scroll map a Initial state Refer to Chapter 8 Scrolls None The concept behind the display position specification for normal scroll screens is illustrated below The monitor is positioned on the scroll map The scroll display position is processed through the scroll screen coordinate system This coordinate system designates the upper left corner of each scroll or map as the origin The scroll display position is specified by indicating where in the coordinate system the monitor should be positioned The representative points the upper left corner of the monitor As a result if the scroll display position coordinates are moved in the positive direction along the X axis to the right t
96. ptr Parameters ptr Scroll flag for setting the cycle pattern Function This function registers in the system those scrolls for which the function settings have been completed This function automatically sets the VRAM access specification in the cycle pattern register for the scroll screen specified as the parameter and at the same time turns on the graphics setting for the registered scroll Refer to the table below for the scroll flags to be substituted for the parameter To register multiple scrolls use the or operator Return Value If scroll registration was successful the function returns a 0 OK If scroll registration failed the function returns a 1 NG Remarks If scroll registration was unsuccessful the function returns a 1 This indicates that the function settings and the number of screens in the scroll for which registration was attempted was outside of the range that could be registered In this event either decrease the number of screens to be registered switch the reduction setting from 1 4x to 1 2x or make whatever changes need to be made and then attempt registration again Execute this function only after completing all of the scroll function settings This function also supports high resoluting mode a Scroll screen to be registered NBGO NBG1 NBG2 NBG3 RBGO Substitution value NBGOON NBG1ON NBG2ON NBG3ON RBGOON Note The values in the above table are defined in sl_def h provided with
97. pts Sint16 0x25e3f000 slLine Window0 void 1pts 0x40000000 Do not use window slLine Window0 void NULL 1pts is Sint16 2 byte variable pointer Refer to HARDWARE MANUAL vol 2 VDP2 slScrLineWindow0 49 Scroll Function void slIScrMatConv Convert current matrix to scroll format matrix Format void slScrMatConv void Parameters None Function This function converts the current matrix into a scroll format matrix If this function is used the current matrix is overwritten Return Value None Remarks To save the current matrix execute the matrix function slPushMatrix before executing this function to rest the matrixs An example of how to save the current matrix is shown below _ Saving the current matrix _ce slPushMatrix save current matrix slRotX DegtoAng 90 change sides to bottom slScrMatConv matrix conversion slScrMatSet rotation parameter setting slpopMatrix execute current matrix Refer to HARDWARE MANUAL vol 2 VDP2 slScrMatConv 50 Scroll Function void sl S crMatS et Matrix setting Format void slScrMatSet Parameters None Function This function uses the current matrix to set the RBGO rotation parameters Return Value None Remarks Also supports high resolution mode Refer to Chapter 8 Scrolls slScrMatSet 51 Scroll Function void slScrMosaic On Mosaic processing specification s
98. r must be set so that it starts from an even address and is an even number of bytes in size The PCM stream buffer start address is specified by the high order 16 bits of 20 bit data so the four low order bits are always 0 The P7 P8 pitch word specifies the SCSP pitch register word octave F number as is For details on pitch refer to the SCSP manual Note 4 Because the sound CPU does not operate while the PCM stream playback data is being transferred from the host to sound memory operation is not guaranteed if music or sound effects are played simultaneously while data is transferred continuously for an extended period of time Either use DMA burst writes or conduct the DMA transfer in intervals Note 5 Because the PCM stream playback rate can place a high demand on data transfer capabilities in some cases not all eight voices will be played back guidelines are indicated for your reference in the item entitled Demands of data transfer 177 void Sound Function slWaitSound Wait for function execution by sound driver Format Parameters Function Return Value void slWaitSound Addr void Addr Addr Byte type address This function waits until the data in the specified address is 0 This function indicates that the sound driver executed a function None Remarks Example of usage slWaitSound slISndMapChange 0 Wait for current map to be switched Refer to Chapter 14 Sound Library slWaitSo
99. r specification using the C_RGB macro Color palette number or color bank number Do not use color palette when texture is in RGB mode gouraud Offset value for area where gouraud table is stored 8H Gouraud processing not used Note The values in the above table are defined in sl_def h provided with the system Table 2 1 List of ATTRIBUTE Macro Substitution Values 2 3 Contents No restrictions concerning window default Display inside window Window_Out Display outside window 2 Normal display default Mesh display Ecdis Disable EndCode Enable EndCode default Display transparent pixels default Do not display transparent pixels 16 color color bank mode default 16 color look up mode 5 64 color color bank mode 128 color color bank mode 256 color color bank mode 32 768 RGB mode Overwrite mode default Shadow mode Semi bright mode Semi transparent mode Gouraud shading mode Note The values in the above table are defined in sl_def h provided with the system Table 2 1 List of ATTRIBUTE Macro Substitution Values 3 3 Member macro cons S S sprPolygon Display polygon sprPolyLine Display polyline option UseLight Make light source calculations UseClip Do not display vertices outside of viewing area UsePalette Specify with UseLight when performing light source calcutations for a palette mode polygon In this case 8 colors are selected from the specified palette number
100. r the parameter Seqnm Refer to Chapter 14 Sound Library slSequenceOff 160 Uint8 Sound Function slSequenceOn Start generation of specified sound effect Format Parameters Function Return Value Uint8 SequenceOn Song Prio Volume Pan Uint16 Song Uint8 Prio Uint8 Volume Sint8 Pan Song Sound control number Prio Priority value Volume Volume value Pan Pan value This function starts generation of the specified sound effect When this function terminates normally it returns the sequence control number If the command buffer is full this function returns the FALSE value Remarks Specify a value from 0 to 31 for the parameter Prio The larger the value the higher the priority Specify a value from 0 to 127 for the parameter Volume Specify a value in the range from 127 to 127 for the parameter Pan 127 left lt gt 0 center lt gt 127 right Note that the SCSP pans in 32 steps so the three low order Pan bits are ignored Refer to Chapter 14 Sound Library slSequenceOn 161 Uint8 Sound Function slSequencePan Change direction of generation of specified sound effect Format Parameters Function Return Value Uint8 SequencePan SEqnm Pan Uint8 Seqnm Sint8 Pan Seqnm Sequence control number Pan Pan value This function changes the direction of generation of the specified sound effect If the command buffer is full this function retu
101. rameter into a FIXED type value Remarks Refer to Chapter 1 Sega Graphics Library toFIXED 31 MACRO VERTICES Polygon vertex variable string Structure define VERTICES vO v1 v2 v3 vO v1 v2 v3 Uint16 vO Uint16 v1 Uint16 v2 Uint16 v3 Members vO Vertex vO v1 Vertex v1 v2 Vertex v2 v3 Vertex v3 Description This macro specifies the polygon vertex numbers expressed as integers Remarks Used together with the NORMAL macro this macro is used to make the polygon face list Refer to Chapter 2 Graphics VERTICES 32 SEGAJATURN SGL Reference Appendix This appendix contains supplementary tables for the Function Reference and for the Structure Reference 1 Default settings when the function slinitSystem is executed In the SGL when the function slInitSystem is executed in addition to initializing various types of memory and system variables the following default settings are made When the system is initialized the default window is set up Table 1 1 Default Window Specs Parameter Setting e Function used to reset Window coordinates Sa O slWindow Top ak ee i Bottom ScreenYSize 1 specification Vanishing point CenterX ScreenXxSize 2 Perspective angle PersAngle a slPerspective Display level ZdspLevel slZdspLevel ScreenXSize Resolution in pixels in horizontal direction for screen mode ScreenYSize Resolution in pixels in vertical direction for screen mode 2
102. ranging from 0 to 127 for the parameter Volume The three low order bits are ignored however Refer to Chapter 14 Sound Library slSndVolume 172 Bool slSoundAIOff Stop playback of all sound sequences Sound Function Format Parameters Function Return Value Remarks Bool slSoundAllOff None This function stops playback of all sound sequences If the command buffer is full this function returns the FALSE value Refer to Chapter 14 Sound Library slSoundAllOff 173 Sint8 Sound Function slSoundReque St Set data to be passed directly to sound driver Format Parameters Function Return Value Sint8 slSoundRequest form const char form form indicates the size of the data that follows in the form of character string data However the initial data is regarded as the function code and is not included in the data string This function sets the data to be passed directly to the sound driver This function returns a 2 if there was an invalid character in the form character string and a 1 if an attempt was made to set word data starting from an odd address If the function terminates normally it returns a 0 Remarks Example of usage slSoundRequest bbwwwbb SND_PCM_START _Stereo SYMBOL PCM 16Bit Level7 lt lt 5 StreamBuf gt gt 4 StreamSize Pitch 0 0 In this case SND_PCM_START is the function code and is not included in the character string _St
103. re to exceed 1 an overflow would occur and the polygon surface color would not be displayed properly In addition if the scaling operation is being performed on the current matrix it is important to realize that the normal vector of the polygon is also affected and thus the brightness will change accordingly Refer to Chapter 3 Light Sources slLight Graphics function void S Ip Crsp ective Perspective transformation table setup Format void slPerspective pers ANGLE pers Parameters pers Perspective angle Range 10 to 160 unit DEG Function This function sets the constant for the distance to the screen which is used in perspective transformations The perspective angle parameter determines the angle corresponding to the width of the screen Because this function also sets the parameters for the rotating scroll execute slRpasalnitSet before calling this function when using the rotating scroll Return Value None Remarks The functions slWindow and slZdispLevel in combination with slPerspective completely determine the viewing volume The diagram below illustrates the concepts behind perspective transformation Forward boundary surface Rear boundary surface Projection surface Perspective angie 60 Y Viewing volume Clipping boundary Refer to Chapter 4 Coordinate Transformation slPerspective Graphics function void slPutP OLY ZONPoiygon model drawing Format void slPutPolygon pat PDATA
104. red and the function does not check to see if the area was an event area problems may arise with functions executed subsequently such as siGetEvent slSetEvent and slSetEventNext Always call the function slCloseEvent and release the event registration Refer to Chapter 10 Event Control slReturnEvent 116 void Event Management Function slReturnW ork Return work area to system Format Parameters Function Return Value Remarks void slReturnWork wkptr WORK wkptr wkptr Starting address of work area to be returned to system This function returns a RAM area used as a work area to the system This function returns the converted hexadecimal code Although the pointer returned to the system is registered again in the system buffer the system does not check to see if the pointer that was returned is already registered or not As a result it is essential to be aware that if the same pointer is returned several times problems can arise when slGetWork is executed later such as multiple events using the same work area Refer to Chapter 10 Event Control slReturnWork 117 EVENT Event Management Function sl S etEvent Event registration Format Parameters Function Return Value EVENT slSetEvent func void func func Pointer for function being registered as an event This function gets an event area and appends the event to the end of the event list The func specifie
105. ription This structure is used to reference the SMPC system status Remarks Use this structure when referencing the system variable Smpc_Status The member rtc can be referenced as the structure SmpcDateTime Special get and set functions are provided for the member smem Refer to HARDWARE MANUAL vol 1 SMPC SmpcStatus 13 Structure erDigital Digital device STRUCTURE typedef struct Uint8 id Uint8 ext Uint16 data Uint16 push Uint16 pull PerDigital Members id Peripheral ID ext Extended data size data Current button data push Depressed button data pull Unpressed button data Description This structure is used to reference digital devices Remarks Use this structure when referencing the system variable Smpc_Peripheral All devices can be handled as digital devices Refer to HARDWARE MANUAL vol 1 SMPC PerDigital 14 Structure STRUCTURE typedef struct Uint8 id Uint8 ext Uint16 data Uint16 push Uint16 pull Uint8 X3 Uint8 y Uint8 Zs PerAnalog Members id Peripheral ID ext Extended data size data Current button data push Depressed button data pull Unpressed button data x Absolute value of X axis data y Absolute value of Y axis data Zz Absolute value of Z axis data Description This structure is used to reference analog devices Remarks Type cast the system variable Smpc_Peripheral and use this structure to reference a peripheral as an analog device Refer to
106. rns the FALSE value Remarks Specify a value ranging from 1 to 7 for the parameter Seqnm Specify a value in the range from 127 to 127 for the parameter Pan 127 left lt gt 0 center lt gt 127 right Note that the SCSP pans in 32 steps so the three low order Pan bits are ignored Refer to Chapter 14 Sound Library slSequencePan 162 Sound Function Bool slSequenceReset Initialize parameters for specified sound effect Format Bool slSequenceReset Seqnm Uint8 Segqnm Parameters Seqnm Sequence control number Function This function initializes the volume tempo and pan settings for the specified sound effect Return Value If the command buffer is full this function returns the FALSE value Remarks Specify a value ranging from 1 to 7 for the parameter Seqnm Refer to Chapter 14 Sound Library slSequenceReset 163 Sound Function Bool slSequenceStat Check playback of specified sound effect Format Bool slSequenceStat Seqnm Uint8 Seqnm Parameters Seqnm Sequence control number Function This function checks to determine whether or not the specified sound effect is being played back Return Value This function returns 1 if the sound effect is being played back even if paused and 0 if the sound effect is stopped Remarks Refer to Chapter 14 Sound Library slSequenceStat 164 Bool Sound Function slSequenceTempo Change speed of specified sound effect
107. rotation around X axis Function This function multiplies an X axis rotation matrix with the current matrix The rotation matrix is expressed below Return Value None Remarks 1 0 0 0 0 0 Rx 0 0 cosf sinf 0 0 sinf cosf 0 0 0 0 0 0 a Rotation matrix for adding rotation around the X axis Refer to Chapter 4 Coordinate Transformation slRotX 85 Matrix Function void slIRotXSC Adding X axis rotation with sine and cosine specified Format void slIRotXSC sn cs FIXED sn FIXED cs Parameters sn Angle of rotation versus X axis after sine transformation cs Angle of rotation versus X axis after cosine transformation Function This function specifies the sine and cosine and multiplies the values with the X axis rotation matrix The rotation matrix is expressed as shown below Return Value None Remarks 1 0 0 0 0 0 Rxsc 0 0 cs sn 0 0 sn cs 0 0 0 0 0 0 Note cs and sn are the parameter substitution values Refer to Chapter 4 Coordinate Transformation slRotXSC 86 Matrix Function void slRotY Adding rotation around Y axis to current matrix Format void sIRotY angy ANGLEangy Parameters angy Angle of rotation around Y axis Function This function multiplies a Y axis rotation matrix with the current matrix The rotation matrix is expressed below Return Value None Remarks cosf 0 0 sinf Ry 0 0 1 0 0 0 sinf 0 0 cosf 0 0 0 0 0 0 a Rotation matrix for a
108. s slSquartFX 109 FIXED Mathematical Operation Function slTan Returns tangent value of specified angle Format Parameters Function Return Value Remarks FIXED slTan angt ANGLE ngt angt Specified angle This function gets the tangent value for the specified angle from a table The function returns the tangent value for the specified angle Tangent values are represented in the range 0x0000 to Oxffff However because 0x0008 is added to the angle data and the four low order bits are discarded rounding 7 down and 8 up with the result that the range Ox0000 to OxfffO is used for the angle data the precision of the operation results suffers slightly This treatment applies to all functions that use angle data Refer to Chapter 11 Mathematical Operation Functions slTan 110 Void Event Management Function slClo S eEvent Event decision Format Parameters Function Return Value void siCloseEvent evptr EVENT evptr evptr Starting address of area where event to be deleted is stored This function removes an event registered in the execution list from the list and releases its area If a work area was also allocated that area is also released None Remarks If an event that is not registered in the event list is specified list modification processing will be executed on the wrong event due to the incorrect list information with information being written to unpredictable address
109. s received from the library function slGetWork in the member work The default value is NULL EVENT_SIZE in the member user is 128 bytes As a result the user area is 112 bytes Refer to Chapter 10 Event Control EVENT Structure DATA Polygon model data Structure typedef struct POINT pntb1 Uint32 nbPoint POLYGON pltb1 Uint32 nbPolygon ATTR attb1 PDATA Members pntb1 Vertex list pointer nbPointNumber of vertices pltb1 Face list pointer nbPolygon Number of faces attb1 Attribute list pointer Description This structure defines the polygon model data Remarks Refer to Chapter 2 Graphics PDATA Structure ICTURE Texture registration table Stracture typedef struct Unit16 texno Unit16 cmode void pcsrc PICTURE Members texno Texture number cmode Color mode pcsrc Starting address of texture data to be registered Description This structure is the information table for transferring and registering texture data within VRAM Remarks Refer to the textures in the Polygon Face Attributes Refer to Chapter 7 Polygon Face Attributes PICTURE Structure POLYGON Polygon face list STRUCTURE typedef struct VECTOR norm Uint16 Vertices 4 POLYGON Members norm Normal vector Vertices 4 Vertex number list Description This structure defines the polygon face list Remarks Refer to Chapter 2 Graphics POLYGON Structure ROT S C
110. side of the 512 vertical x 512 horizontal display area leave everything clear Function This function sets the screen overflow processing mode for the rotating scroll The screen overflow processing setting specifies how when the rotating scroll graphics go beyond the display area to process the portion that exceeds the display area This setting is made for the rotating scroll plane size register Return Value None Remarks When the rotating scroll is in bitmap format mode 1 cannot be set Refer to Chapter 8 Scrolls slOverRB 36 Scroll Function void s PageNbg0 i 23 NBG pattern name data registration Format void sIPageNbgO celadr coladr type void sIPageNbg1 celadr coladr type void sIPageNbg2 celadr coladr type void sIPageNbg3 celadr coladr type void celadr void coladr UlInt16 type Parameters celadr Starting address in VRAM of cell data stored in VRAM coladr Starting address in color RAM of color data used by cells type Flag corresponding to the pattern name data type specification Function This function sets up the normal scroll NBGO NBG1 NBG2 and NBG3 pa es For the parameters specify respectively to the starting address in VRAM of the character pattern data used on the scroll screen the starting address in color RAM for the color data used for the character patterns and a Uint16 type value corresponding to the pattern name data type specification Return Val
111. sl_def h The ATTRIBUTE macro includes the following members For the macro substitution values for each member refer to the list plane Specifies the front back attribute sort Determines the Z sort representative point texture Substitute either a texture number or No_ Texture color Substitute either a polygon face color specified by the C_RGB macro or No_Palet gouraud Specifies the starting address of the area where the gouraud table is stored If gouraud processing is not to be used substitute No Gouraud mode Specifies various modes for the polygon Multiple specification is possible by using the or operator to link the substitution values for each group dir Sets the texture reversal function etc option Sets other polygon options multiple specification is possible by using the or operator If no options are to be used substitute No Option Table 2 1 List of ATTRIBUTE Macro Substitution Values 1 3 Contents Singl_Plane Treats polygon as a single sided polygon Dual_Plane Treats polygon as a double sided polygon sort SORT_MIN Makes the point closest to the camera on the polygon the reference point SORT_CEN Makes the center point of the polygon the reference point SORT_MAX Makes the point farthest from the camera on the polygon the reference point Displays the polygon that was registered last in front texutre Texture number of the texture to be used No texture used color Colo
112. sus Z axis after sine transformation cs Angle of rotation versus Z axis after cosine transformation Function This function specifies the sine and cosine and multiplies the values with the Z axis rotation matrix The rotation matrix is expressed as shown below Return Value None Remarks cs sn 0 0 Rzsc sn cs 0 0 0 0 0 0 1 0 0 0 0 0 0 0 Note cs and sn are the parameter substitution values Refer to Chapter 4 Coordinate Transformation sIRotZSC 90 Matrix Function void sl S cale Current matrix scaling Format void slScale sx sy sz FIXED sx FIXED sy FIXED sz Parameters sx Enlargement reduction ratio in the direction of the X axis sy Enlargement reduction ratio in the direction of the Y axis sz Enlargement reduction ratio in the direction of the Z axis Function This function multiplies the enlargement reduction ratio matrix by the current matrix The enlargement reduction matrix is expressed below Return Value None Remarks SX 0 0 0 0 Rxyz 0 0 sy 0 0 0 0 0 0 SZ 0 0 0 0 0 0 Note sx sy and sz are parameter substitution values Refer to Chapter 4 Coordinate Transformation slScale 91 void Matrix Function slTranslate Current matrix movement Format Parameters Function Return Value void slTranslate tx ty tz FIXED tx FIXED ty FIXED tz tx Movement in the direction of the X axis ty Movement in the direction of the Y axis tz Movement i
113. t execute after termination of second transfe siDMAwait void wait for termination of third transfer Refer to Chapter 9 Controller Input sIDMAWait 181 Miscellaneous Function void slInitSynch Wait for V BLANK and synchronize event processing with screen Format void sllnitSynch Parameters None Function This function waits for V BLANK and synchronizes event processing with the screen Return Value None Remarks Also refer to the function slSynch Refer to HARDWARE MANUAL vol 2 VDP2 sllnitSynch 182 Miscellaneous Function void slInitSystem SGL system initialization Format void sllnitSystem tv_mode texadr cnt Uint16tv_mode TEXTURE texadr Uint16 cnt Parameters tv_mode Screen mode specification texadr Starting address of memory area where texture data is stored cnt Graphics processing unit specification Function This function initializes the SGL system For the parameters respectively substitute the define value indicating the screen mode the starting address of the memory area where the texture information table was stored and the number of V blanks indicating the graphics processing unit 1 V BLANK is 1 60 of a second if non interlaced and 1 30 of a second if double interlaced the graphics processing unit is a multiple of this value For the screen mode specification substitute the values shown below Return Value None Remarks Initialization includes
114. t rotation parameters For the parameters substitute the reciprocals of the scale values in the direction of the X and Y axes respectively For example to enlarge the figure by 2 0x in the direction of the X axis substitute 1 2 for the parameter x None Unlike with normal scrolls the enlargement reduction ratio can be set to any desired ratio for the rotating scroll slZoomR 63 Scroll Function void slZrotR RBG Z axis rotation Format void slZrotR angz ANGLE angz Parameters angz Rotation angle of rotating scroll versus Z axis Function This function rotates the rotating scroll versus the Z axis The Z axis the positive direction is towards the viewer is used as the rotation axis and rotation on the positive direction is towards the right clockwise Return Value None Remarks The coordinates specified by the function slIDispCenterR are the center of rotation for the rotating scroll The monitor rotates versus the scroll map 0 0 0 0 Z axis rotation 45 Monitor Z axis rotation 45 m p Monitor Rotation Display Monitor Rotating scroll rotation is achieved by rotating the monitor versus the scroll map Screen scroll map Refer to Chapter 8 Scrolls Rotation scroll map slZrotR 64 void SpriteFunction slDisp SPT tsprit display with specification of position scale and rotation angle Format Parameters Function Return Value
115. t simultaneously Return Value None Remarks For the parameters substitute the values in the table below according to the scroll screen being registered Scroll screen being registered NBGO NBG1 NBG1 NBG2 RBGO BACK SPRITE Substitution value NBGOON NBG1ON NBG2ON NBG30N RBGOON BACKON SPRON Note The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls slColorCalcOn 18 Scroll Function void slIIColLRAMMode Color RAM mode setting Format void siColIRAMMode mode Uint16 mode Parameters mode _ Uint16 type variable corresponding to the color RAM mode Substitute the following values defined in sl_def h for mode CRM16_ 1024 color RAM mode 0 CRM16_2048 color RAM mode 1 CRM32_1024 color RAM mode 2 Function This function determines the color RAM mode Always be sure to set the color RAM mode before storing color data in color RAM For the parameter substitute the value corresponding to the desired color RAM mode For details on each color RAM mode refer to the table below Return Value None Remarks The default color RAM mode is mode 1 The specifics of each mode are shown in the table below For details on color RAM mode refer to HARDWARE MANUAL vol 2 VDP2 User s Manual p 43 Note In color mode 0 color RAM is divided into two partitions each storing the same color data Refer to Chapter 8 Scrolls slColIRAMMode 19 void
116. te the XY coordinate position in cell units of the display on the screen One cell consists of 8 x 8 dots and a normal scroll screen consists of 64 x 64 cells Return Value Text display address value Remarks Example of how to use the function slLocate Uint16x y 2 slPrint ABC slLocate x y 0 Uint16x y 2 1 slPrint ABC slLocate 3 2 2 The grid in the diagram at left indicates individual cells One cell consists of 8 x 8 dots and the upper left corner is the origin 3 Refer to Chapter 8 Scrolls slLocate 70 Text Display Function void slPrint Character string screen display Format void slPrint string dspadd char string void dspadd Parameters string Text string to be displayed dspadd Text display address slLocate return value Function This function displays the character string specified as a parameter on the screen Return Value None Remarks Refer to Chapter 8 Scrolls slPrint 71 Text Display Function void slPrintFX Fixed point decimal screen display Format void slPrintFX val dspadd FIXED val void dspadd Parameters val FIXED type numeric value to be displayed dspadd Text display address slLocate return value Function This function displays the FIXED type value specified as a parameter on the screen Zeroes in the high order digits in the integer portion of the value and zeroes in the low order digits in the decimal portion of the value
117. tern name data table for rotation parameters A Function This function sets up the rotating scroll map using rotation parameters A For the parameter substitute the starting address in VRAM of the pattern name data table to be registered in the map register and the map offset register The data table uses 16 pages starting from the specified address Return Value None Remarks Refer to Chapter 8 Scrolls sl1MapRA Scroll Function void sllMapRB RGB map setup using rotation parameters B Format void sl1MapRB b void b Parameters b Starting address of in VRAM pattern name data table for rotation parameters B Function This function sets up the rotating scroll map using rotation parameters B For the parameter substitute the starting address in VRAM of the pattern name data table to be registered in the map register and the map offset register The data table uses 16 pages starting from the specified address Return Value None Remarks Refer to Chapter 8 Scrolls sl1MapRB void Scroll Function sl 6MapRA RBGO map setting using rotation parameters A Format Parameters Function Return Value Remarks Refer to Chapter 8 Scrolls void sl16MapRA map 16 Uint8 map 16 map 16 Map number for 16 pages This function sets up a rotating scroll map consisting of 16 pages using rotation parameters A None This function sets the map number for 16 pages for the matrix passed
118. ters adr Line scroll table address in VRAM Function This function sets the starting address for the line scroll table in VRAM where the line scroll data was set Return Value None Remarks Refer to HARDWARE MANUAL vol 2 VDP2 slLineScrollTable0 1 31 Scroll Function void slLookR RBG placement coordinate setting Format void sILookR x y FIXED x FIXED y Parameters x X coordinate scroll coordinate system for rotating scroll placement y Y coordinate scroll coordinate system for rotating scroll placement Function This function sets the placement coordinates for the rotating scroll screen The placement coordinates indicate a point on the scroll map The rotating scroll screen display position is determined by placing the monitor so that the rotation center coordinates overlay the placement coordinates For the parameters substitute the XY coordinate values corresponding to the scroll coordinate system Return Value None Remarks The rotating scroll display position is determined according to the placement of the monitor using the rotation center coordinates as a reference point in the placement coordinates on the scroll map Use the function sIDispCenterR to determine the rotation center coordinates of the rotating scroll For the relationship between rotation and placement refer to the following diagrams 0 0 0 0 px o J Rotation center Y coordinates Placement coordinates Pl
119. texno Texture number cmode Color mode COL_16 64 128 256 or 32K pcsrc Pointer for texture data defined by TEXDAT Description This macro creates the table of information used to set a texture in VRAM so that the texture can be handled within a program Remarks Refer to Chapter 7 Polygon Face Attributes PICDEF 28 MACRO O StoF LXED Coordinate value conversion macro Structure define POStoFIXED x y z toFIXED x toFIXED y toFIXED z Members x X coordinate to be converted y Y coordinate to be converted Z Z coordinate to be converted Description This macro converts the XYZ coordinate values to FIXED type variables Remarks Refer to Chapter 1 Sega Graphics Library POStoFIXED 29 MACRO EXDEF Texture registration table Structure define TEXDEF h v presize h v cgaddress presize 4 gt gt pal 8 h amp 0x1f8 lt lt 5 v Uint16h Uint16v Uint32 presize Members h Horizontal size of texture v Vertical size of texture presize Previously registered texture size vertical x horizontal Description This macro creates a table for getting texture information Remarks Reference macros define cgaddress 0x10000 define pal COL_32K Refer to Chapter 7 Polygon Face Attributes TEXDEF 30 MACRO toF XED Value conversion macro Structure define toFIXED a FIXED a 65536 0 Members a Value to be converted Description This macro converts the value supplied as the pa
120. the command buffer is full this function returns the FALSE value Specify a value ranging from 1 to 7 for the parameter Seqnm Refer to Chapter 14 Sound Library slSequenceCont 158 Bool Sound Function slSequenceFade Change volume of specified sound effect Format Parameters Function Return Value Bool slSequenceFade Seqnm Volume Rate Uint8 Seqnm Uint8 Volum Uint8 Rate Seqnm Sequence control number Volum Volume value Rate Rate value This function gradually changes the volume of the specified sound effect If the command buffer is full this function returns the FALSE value Remarks Specify a value ranging from 1 to 7 for the parameter Seqnm Specify a value from O to 127 for the parameter Volume and a value from 0 to 255 for the parameter Rate Rate specifies the interval for changing from the present volume to the specified volume When Rate is specified as 0 the volume changes immediately to the value specified by Volume Refer to Chapter 14 Sound Library slSequenceFade 159 Bool Sound Function slSequenceOff Stop generation of specified sound effect Format Parameters Function Return Value Remarks Bool slSequenceOff Seqnm Uint8 Segqnm Seqnm Sequence control number This function stops generation of the specified sound effect If the command buffer is full this function returns the FALSE value Specify a value ranging from 1 to 7 fo
121. the system Refer to Chapter 8 Scrolls slScrAutoDisp 46 void Scroll Function slScrCycleSet Cycle pattern setting Format Parameters Function Return Value Remarks void slScrCycleSet a b c d Uint32 a Uint32 b Uint32 c Uint32 d Bank A 0 cycle pattern Bank A 1 cycle pattern Bank B 0 cycle pattern Bank B 1 cycle pattern a0 0 This function sets the cycle pattern for each bank When each bank is partitioned cycle patterns can be set for a and b and for c and d If the banks are not partitioned cycle patterns can be set for a and c For details on the settings refer to pp 31 and beyond in the HARDWARE MANUAL vol 2 VDP2 User s Manual None If the function slScrAutoDisp is used slScrCycleSet can be used to automatically set the cycle pattern for displaying the scroll screen specified by slScrAutoDisp slScrCycleSet OxffAARAA 0x66554444__ O gt fFFFFAFF Ox0042FFA AO access setting Al access setting BO access setting B1 access setting Refer to HARDWARE MANUAL vol 2 VDP2 slScrCycleSet 47 Scroll Function void slScrDisp Display setting for scroll specified as parameter Format void slScrDisp mode Uint32 mode Parameters mode Display flag for scroll screen to be displayed Function This function makes the display setting for the scroll screen specified as the parameter Refer to the table below for the parameter substitution values To simultaneous
122. top Window position Vstop aS Window position Hstart ha Window position Vstart Window position Hstop Window position Vstop Window control Window control Window control Window control Line window table address Sprite control Shadow control Color RAM address offset NBGO to 3 Color RAM address offset RBGO sprite Line color screen enable Special priority mode Color calculation control Special color calculation mode Priority number Priority number Priority number Priority number Priority number Priority number Priority number Color calculation ratio sprite 0 1 Color calculation ratio Color calculation ratio sprite 4 5 sprite 2 3 Color calculation ratio sprite 6 7 NBGO 1 NBG2 3 RBGO line color screen background screen Color calculation ratio Color calculation ratio Color calculation ratio Geek i ee ene Cee eS ee eS Color calculation ratio 1CE 1D0 1D2 1D4 1D6 1D8 1DA 1DC 1DE 1E0 1E4 1E8 1EC 1FO 1F4 1F8 1FC 200 204 208 20C 210 214 218 21C 278 2E0 348 36C VDP2_CCRLB VDP2_CLOFEN VDP2_CLOFSL VDP2_COAR VDP2_COAG VDP2_COAB VDP2_COBR VDP2_COBG VDP2_ COBB ScrRotPtr nbgO_char_adr nbg1_char_adr nbg2_char_adr nbg3_char_adr ra_char_adr ro_char_adr nbgO_page_adr nbg1_page_adr nbg3_page_adr ra_page_adr b_page_adr rpara_vram_adr k_table_adr scr_work RotScrParA RotScrParB Wi
123. ue None Remarks For the parameter type specify a value from the following table corresponding to the pattern name data type Word length 1 word 2 words Note The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls slPageNbg0 1 2 3 37 Scroll Function void slPageRbg0 RBG pattern name data registration Format void sIPageRbgO celadr coladr type void celadr void coladr Uint16 type Parameters celadr Starting address in VRAM of cell data stored in VRAM coladr Starting address in color RAM of color data used by cells type Flag corresponding to the pattern name data type specification Function This function sets up the rotating scroll RBGO page For the parameters specify respectively the starting address in VRAM of the character pattern data used on the scroll screen the starting address in color RAM for the color data used for the character patterns and a Uint16 type value corresponding to the pattern name data type specification Return Value None Remarks For the parameter type specify a value from the following table corresponding to the pattern name data type Word length Character number bits Substitution value 1 word Low order 10 bits PNB_1WORD Low order 12 bits PNB_ 1WORDI CN_12BIT 2 words Low order 16 bits PNB_2WORD Note The values in the above table are defined in sl_def h provided with the system Refer to
124. unction sets the character size and the number of colors used on rotating scroll RBGO Refer to the table below for the substitution values for the parameters Return Value None Remarks When the color RAM mode is 0 or 2 the 2048 color specification becomes 1024 colors Number of character colors Character size Palette format RGB format 256 colors 2048 colors 32 768 colors 16 77 million colors Substitution value COL_TYPE_16 COL_TYPE_256 COL_TYPE_2048 COL_TYPE_32768 COL_TYPE_1M CHAR_SIZE_1x1 CHAR_SIZE_2x2 Note 1 In color RAM mode 0 or 2 2048 colors becomes 1024 colors Note 2 The values in the above table are defined in sl_def h provided with the system Refer to Chapter 8 Scrolls slCharRbgO 13 Scroll Function void slColOffs etOn Color offset enable setting Format void slColOfsetOn flag Uint16 flag Parameters flag Screen specification Function This function sets the screen that will be affected by the color offset set by the function slColOfsetA The or operator can be used to link together multiple parameters so that multiple screens can be set simultaneously Return Value None Remarks For the parameter substitute the value from the table shown below corresponding to the scroll screen to be registered Scroll screen being registered NBGO NBG1 NBG2 NBG3 RBGO BACK SPRITE Substitution value NBGOON NBG1ON NBG2ON NBG30N RBGOON BACKON SPRON Note The values in th
125. und 178 FIXED slCheckOnScreen Miscellaneous Function Determine whether specified coordinates are within viewing area Format Parameters Function Return Value Remarks Front boundary surface Refer to Viewpoint Di Display area R Z_pos FIXED slCheckOnScreen pos size FIXED pos FIXED size pos XYZ XYZ coordinate values of object position size Object size This function converts the specified object position through the current matrix tests whether or not an object of the specified size at that position would be displayed on the screen or not and returns the result When extending beyond the display area in the Z direction 1 FFFFFFFF When extending beyond the display area to the left right top or bottom 2 FFFFFFFE When contained within the screen Z_position The following diagrams illustrate the relationship between the display area and the return value irection of line of sight R 2 Zlimit Projection surface R 2 oS eS os Note R indicates the return value generated by the function siCheckOnScreen slCheckOnScreen 179 void sIDMACopy Block transfer using CPU DMA Miscellaneous Function Format Parameters Function Return Value void sIDMACopy src dst cnt void src void dst Uint32 cnt src Starting address of source memory area dst Starting address of destination memory area cnt Block transfer amount bytes
126. value O to the specified volume When Rate is specified as 0 the volume changes immediately to the value specified by Volume Refer to Chapter 14 Sound Library sIBGMOn 146 Bool sIB GMPause Pause BGM playback Sound Function Format Parameters Function Return Value Remarks Bool sIBGMPause None This function pauses BGM playback If the command buffer is full this function returns the FALSE value Refer to Chapter 14 Sound Library sIBGMPause 147 Bool sIB GM Stat BGM playback check Sound Function Format Parameters Function Return Value Remarks Bool sIBGMStat None This function checks to determine whether or not BGM is being played back This function returns 1 when playback is in progress even if paused and 0 if playback is stopped Refer to Chapter 14 Sound Library sIBGMStat 148 Bool Sound Function sIB GM Tempo Change BGM playback speed Format Parameters Function Return Value Bool sIBGMTempo Tempo Sint16 Tempo Tempo Tempo value This function changes the BGM playback speed If the command buffer is full this function returns the FALSE value Remarks Specify a value ranging from 32768 to 32767 for the parameter Tempo Tempo is the tempo value relative to the standard tempo 0 at 4096 1000h the tempo is doubled and at 4096 the tempo is halved Refer to Chapter 14 Sound Library sIBGMTempo
127. was no space available in the command buffer the function returns FALSE After sending the sound data set the work area transfer completed bit slSndMapChange 167 Bool Sound Function slSndMixChange Switch mixer corresponding to tone bank Format Parameters Function Return Value Remarks Refer to Bool slSndMixChange Tbank Mixno Uint8 Tbank Uint8 Mixno Tbank Tone bank number Mixno Mixer number This function switches the mixer corresponding to the tone bank If the command buffer is full this function returns the FALSE value Specify a value ranging from 0 to 15 for the parameter Tbank Specify a value ranging from 0 to 127 for the parameter Mixno slSndMixChange 168 Sound Function Bool s SndMixParmChange Change mixer parameters Format Bool slSndMixParmChange Effect Level Pan Uint8 Effect Uint8 Level Sint8 Pan Parameters Effect DSP effect output channel Level Effect return level Pan Effect pan Function This function changes the mixer parameters Return Value If the command buffer is full this function returns the FALSE value Remarks Specify a value ranging from 0 to 7 for the parameter Effect Specify a value ranging from 0 to 127 for the parameter Level Ignore the four low order bits Specify a value ranging from 127 to 127 for the parameter Pan Ignore the three low order bits Refer to Chapter 14 Sound Library slSndMixParmC
128. ween the substitution value and the calculation ratio refer to the table on page 244 of the VDP2 User s Manual of the HARDWARE MANUAL vol 2 Refer to Chapter 8 Scrolls slColRateLNCL 21 Scroll Function void slColRateNbg0O l Ao NBG color calculation ratio setting Format void slColRateNbg0 rate void slColRateNbg1 rate void slColRateNbg2 rate void slColRateNbg3 rate Uint16 rate Parameters rate Color calculation ratio Function This function sets the color calculation ratio used for color calculations for each screen Return Value None Remarks The range of calculation ratio values that can be set for the parameter is 0x00 to Ox1f Each of these values represents a calculation ratio for example if rate OxOf is substituted the calculation ratio between the top image and the 2nd image is 16 16 For details on the relationship between the substitution value and the calculation ratio refer to the table on page 244 of the VDP2 User s Manual of the HARDWARE MANUAL vol 2 Refer to Chapter 8 Scrolls slColRateNBG01 2 3 22 Scroll Function void slColRateRbg0 RBG color calculation ratio setting Format void sIColRateRbg0 rate Uint16 rate Parameters rate Color calculation ratio Function This function sets the color calculation ratio used for color calculations for the rotating scroll screen Return Value None Remarks The range of calculation ratio values that can be set for t
129. window screen coordinate system right X coordinate of lower right corner of window screen coordinate system bottom Y coordinate of lower right corner of window screen coordinate system Zlimit Distance to rear boundary surface of window centx X coordinate of vanishing point centy Y coordinate of vanishing point Function This function sets up windows that limits the display of sprites andpolygons Window is the name of a rectangular area set up on the screen two windows can be set up on the screen at one time Polygons and sprites can be set to be displayed or not displayed when they are inside or outside of a window For the parameters substitute the X and Y screen coordinates defining the area of the window the Z coordinate that indicates the distance to the rear boundary surface of the display and the X and Y screen coordinates of the vanishing point Return Value None Remarks Polygons and sprites are affected by windows that are set up before the polygon or sprite is drawn In the SGL a window that is the same size as the screen is set up as a default window if the function slWindow is not executed the drawing of polygons and sprites is affected by this default window Rear boundary surface forward boundary surface left right 0 0 o Projection surface Windouw boundary top 4 Ly top right bottom Viewpoint i X CENTER_X CNTER_Y Y ae Projection surface 319 223 CENTER_X CEN
Download Pdf Manuals
Related Search
Related Contents
Câmara PTZ MIC Série 500 Instrucciones de uso y montaje 7084026 TAFCO WINDOWS NU2-129V-I Instructions / Assembly 終 末 処 理 場 Manuel d`utilisation E51 User Manual - MH Duplication M2 User Guide - Artrend Holdings, Ltd AM_23577_BA_Eurotops_FRA_01 Copyright © All rights reserved.
Failed to retrieve file