HomeForumsWhat's newResources 
 
 
Code Blah!
mrkotfw - Jan 19, 2003
   mrkotfw Jan 19, 2003 
any good? dunno

-------------------

Code:
  
#include "sgl.h" #include "sl_def.h" #include "sega_per.h" void ss_main() { /* --- pre$define ------------------------------------- */ extern PDATA PD_CUBE; #define NBG1_CEL_ADR (VDP2_VRAM_B1+0x02000) #define NBG1_MAP_ADR (VDP2_VRAM_B1+0x12000) #define NBG1_COL_ADR (VDP2_COLRAM+0x00200) #define BACK_COL_ADR (VDP2_VRAM_A1+0x1fffe) char * CD_PREMADE_ERROR1 = "SEGA SATURN GAMEPAD NOT PRESENT"; char * CD_PREMADE_ERROR2 = "SEGA SATURN GAMEPAD NOT SUITABLE"; char * CD_PREMADE_MSG3 = "SEGA SATURN MEMORY FULL"; char * CD_PREMADE_MSG4 = "SEGA SATURN MEMORY CREATED"; static ANGLE ang[XYZ]; static FIXED fix[XYZ]; /* --- pre$define ------------------------------------- */ if (!Per_Connect1 || !Per_Connect2) { slInitSystem(TV_320x224, NULL, 1); slColRAMMode(CRM16_1024); slBack1ColSet((void *)BACK_COL_ADR,0); slBack1ColSet(CD_DarkBlue,0x8000); slLocate(5,5); printf ("%s",CD_PREMADE_ERROR1); slPrint ("---",slLocate(6,5)); slLocate(7,5) printf ("%s",,CD_PREMADE_ERROR2); } else { slInitSystem(TV_320x224, NULL, 1); slColRAMMode(CRM16_1024); slBack1ColSet((void *)BACK_COL_ADR,0); slBack1ColSet(CD_DarkBlue,0x8000); slIntBackCancel(); ang[X] = ang[Y] = ang[Z] = DEGtoANG(0.0); fix[X] = toFIXED(0.0); fix[Y] = toFIXED(0.0); fix[Z] = toFIXED(170.0); while(-1) { slPushMatrix(); { slTranslate(fix[X],fix[Y],fix[Z]); slRotX(ang[X]); slRotY(ang[Y]); slRotZ(ang[Z]); while (1) { ang[X] += DEGtoANG(3.0); if (ang[X] == DEGtoANG(3.0)) { slColRAMMode(CRM16_1024); slBack1ColSet((void *)BACK_COL_ADR,0); slBack1ColSet(CD_DarkBlue,0x8000); } } slPutPolygon(&PD_CUBE); } slPopMatrix(); slSynch(); } } }

   TakaIsSilly Jan 19, 2003 
Code:
  
slLocate(5,5); printf ("%s",CD_PREMADE_ERROR1); slPrint ("---",slLocate(6,5)); slLocate(7,5) printf ("%s",,CD_PREMADE_ERROR2);

This is not Saturn code. slLocate is a mathematical macro that gives a memory position for a given tile, not the "setcursor" equivalent in the stdlib. And altough printf compiles correctly if you include stdin.h included, it will crash the console as well.

this :

Code:
  
slPrint (CD_PREMADE_ERROR1,slLocate(5,5)); slPrint ("---",slLocate(6,5)); slPrint (CD_PREMADE_ERROR2,slLocate(7,5));

is the correct code... if you want to use parsing printf style, use an sprintf, and print the resulting string with slPrint.

Code:
  
slIntBackCancel();

What does this do? Disable interrupts?

Apart from this, the code should compile... It should er, draw a cube spinning on the X axis, on dark blue BG?

   antime Jan 19, 2003 
This won't work, unless you missed a few rows while copying the sample:

Code:
  
while(-1) { slPushMatrix(); { slTranslate(fix[X],fix[Y],fix[Z]); slRotX(ang[X]); slRotY(ang[Y]); slRotZ(ang[Z]); while (1) { ang[X] += DEGtoANG(3.0); if (ang[X] == DEGtoANG(3.0)) { slColRAMMode(CRM16_1024); slBack1ColSet((void *)BACK_COL_ADR,0); slBack1ColSet(CD_DarkBlue,0x8000); } } slPutPolygon(&PD_CUBE); } slPopMatrix(); slSynch(); }

Notice that the loop where you're increasing the angle is an infinite one (while(1)) and that there's no break-statement. I have some stylistic comments too, but let's get the program working first.