Move SetDispMask() to init()

This commit is contained in:
ABelliqueux 2021-07-22 10:40:41 +02:00
parent c46162d943
commit 7167b9c082
19 changed files with 316 additions and 200 deletions

View File

@ -53,32 +53,32 @@ short db = 0; // index of which buffer is used, values 0, 1
typedef struct
{
unsigned short v_count; // Y-axis (vertical scan counter)
unsigned short h_count; // H-axis (horizontal pixel clock value)
unsigned short v_count; // Y-axis (vertical scan counter)
unsigned short h_count; // H-axis (horizontal pixel clock value)
} Gun_Position;
// Structure for storing processed controller data
typedef struct
{
int xpos, ypos; // Stored position for sprite(s)
int xpos2, ypos2; // controlled by this controller.
int xpos, ypos; // Stored position for sprite(s)
int xpos2, ypos2; // controlled by this controller.
unsigned char status; // These 8 values are obtained
unsigned char type; // directly from the controller
unsigned char button1; // buffer we installed with InitPAD.
unsigned char button2;
unsigned char analog0;
unsigned char analog1;
unsigned char analog2;
unsigned char analog3;
unsigned char status; // These 8 values are obtained
unsigned char type; // directly from the controller
unsigned char button1; // buffer we installed with InitPAD.
unsigned char button2;
unsigned char analog0;
unsigned char analog1;
unsigned char analog2;
unsigned char analog3;
} Controller_Data;
// All-purpose controller data buffer
typedef struct
{
unsigned char pad[34]; // 8-bytes w/o Multi-Tap, 34-bytes w/Multi-Tap
unsigned char pad[34]; // 8-bytes w/o Multi-Tap, 34-bytes w/Multi-Tap
} Controller_Buffer;
Controller_Buffer controllers[2]; // Buffers for reading controllers
@ -101,7 +101,9 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 50, 50, 50);
setRGB0(&draw[1], 50, 50, 50);
@ -124,8 +126,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;
@ -137,19 +137,19 @@ void get_digital_direction( Controller_Data *c, int buttondata ) // get analog s
{
int i;
i = ~(buttondata);
i = ~(buttondata);
if( i & 0x80 )
c->xpos -= 1;
if( i & 0x20 )
c->xpos += 1;
if( i & 0x40 )
c->ypos += 1;
if( i & 0x10 )
c->ypos -= 1;
if( i & 0x80 )
c->xpos -= 1;
if( i & 0x20 )
c->xpos += 1;
if( i & 0x40 )
c->ypos += 1;
if( i & 0x10 )
c->ypos -= 1;
}
void read_controller( Controller_Data *c, unsigned char *buf, int port ) // get the raw values from controller
@ -393,22 +393,22 @@ int main(void)
FntPrint("Hello 2 pads!\n\n");
FntPrint( "Pad 1 : %02x\nButtons:%02x %02x, Stick:%02x %02x %02x %02x\n",
theControllers[0].type, // Controller type : 00 == none, 41 == standard, 73 == analog/dualshock, 12 == mouse, 23 == steering wheel, 63 == gun, 53 == analog joystick
theControllers[0].button1, //
theControllers[0].button2,
theControllers[0].analog0,
theControllers[0].analog1,
theControllers[0].analog2,
theControllers[0].analog3 );
theControllers[0].type, // Controller type : 00 == none, 41 == standard, 73 == analog/dualshock, 12 == mouse, 23 == steering wheel, 63 == gun, 53 == analog joystick
theControllers[0].button1, //
theControllers[0].button2,
theControllers[0].analog0,
theControllers[0].analog1,
theControllers[0].analog2,
theControllers[0].analog3 );
FntPrint( "Pad 2 : %02x\nButtons:%02x %02x, Stick:%02x %02x %02x %02x\n",
theControllers[1].type, // Controller type : 00 == none, 41 == standard, 73 == analog/dualshock, 12 == mouse, 23 == steering wheel, 63 == gun, 53 == analog joystick
theControllers[1].button1, //
theControllers[1].button2,
theControllers[1].analog0, // R3 horizontal
theControllers[1].analog1, // R3 vertical
theControllers[1].analog2, // L3 horizontal
theControllers[1].analog3 ); // L3 vertical
theControllers[1].type, // Controller type : 00 == none, 41 == standard, 73 == analog/dualshock, 12 == mouse, 23 == steering wheel, 63 == gun, 53 == analog joystick
theControllers[1].button1, //
theControllers[1].button2,
theControllers[1].analog0, // R3 horizontal
theControllers[1].analog1, // R3 vertical
theControllers[1].analog2, // L3 horizontal
theControllers[1].analog3 ); // L3 vertical
FntFlush(-1);
display();

View File

@ -67,6 +67,7 @@ void init(){
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 0, 128, 255);
setRGB0(&draw[1], 0, 128, 255);
draw[0].isbg = 1;
@ -82,7 +83,6 @@ void display(void){
VSync(0);
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;
nextpri = primbuff[db];

View File

@ -92,6 +92,8 @@ void init(){
disp[1].screen.y += 8;
}
SetDispMask(1);
setRGB0(&draw[0], 0, 0, 255);
setRGB0(&draw[1], 0, 0, 255);
@ -115,8 +117,6 @@ void display(void){
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;

View File

@ -83,7 +83,6 @@ void display(void)
// Flip DISP and DRAW env
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
//~ SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
// Flip db index
db = !db;

View File

@ -95,6 +95,7 @@ void init(){
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1);
// Set light env
// Set far color
SetFarColor( BGc.r, BGc.g, BGc.b );
@ -119,7 +120,6 @@ void display(void){
VSync(0);
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;
nextpri = primbuff[db];

View File

@ -127,6 +127,8 @@ void initGraph(void)
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 50, 50, 50);
setRGB0(&draw[1], 50, 50, 50);
@ -149,8 +151,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
db = !db;
}

View File

@ -51,6 +51,7 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 50, 50, 50);
setRGB0(&draw[1], 50, 50, 50);
@ -74,8 +75,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;

View File

@ -88,7 +88,7 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 50, 50, 50);
setRGB0(&draw[1], 50, 50, 50);
@ -111,8 +111,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;

View File

@ -107,7 +107,8 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 128, 128, 128);
setRGB0(&draw[1], 128, 128, 128);
@ -130,8 +131,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;

View File

@ -64,10 +64,10 @@ void init(void)
ResetGraph(0);
// Initialize and setup the GTE : Not needed ?
InitGeom();
SetGeomOffset(CENTERX,CENTERY);
SetGeomScreen(CENTERX);
SetGeomOffset(CENTERX,CENTERY);
SetGeomScreen(CENTERX);
PadInit(0);
@ -83,7 +83,8 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], BgColor->r, BgColor->g, BgColor->b);
setRGB0(&draw[1], BgColor->r, BgColor->g, BgColor->b);
@ -106,8 +107,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;

View File

@ -108,7 +108,7 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 128, 128, 128);
setRGB0(&draw[1], 128, 128, 128);
@ -131,8 +131,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;

View File

@ -108,7 +108,8 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 128, 128, 128);
setRGB0(&draw[1], 128, 128, 128);
@ -131,8 +132,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;

View File

@ -58,8 +58,7 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1);
SetDispMask(1);
// Set background color
setRGB0(&draw[0], 50, 50, 50);
setRGB0(&draw[1], 50, 50, 50);
@ -80,7 +79,6 @@ void display(void)
// Flip DISP and DRAW env
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
//~ SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
// Flip db index
db = !db;

View File

@ -0,0 +1,226 @@
// Hello poly ! Inline / DMPSX version
//
// Ref : /psyq/DOCS/Devrefs/Inlinref.pdf, p.18
// https://psx-spx.consoledev.net/geometrytransformationenginegte/
// PSX / Z+
// screen /
//coordinate +-----X+
//system / |
// eye | Y+
//
// Credits, thanks : Nicolas Noble, Sickle, Lameguy64 @ psxdev discord : https://discord.com/invite/N2mmwp
// https://discord.com/channels/642647820683444236/663664210525290507/834831466100949002
#include <sys/types.h>
#include <stdio.h>
#include <libetc.h>
#include <libgte.h>
#include <libgpu.h>
// OldWorld PsyQ has a inline_c.h file for inline GTE functions. We have to use the one at https://github.com/grumpycoders/pcsx-redux/blob/07f9b02d1dbb68f57a9f5b9773041813c55a4913/src/mips/psyq/include/inline_n.h
// because the real GTE commands are needed in nugget : https://psx-spx.consoledev.net/geometrytransformationenginegte/#gte-coordinate-calculation-commands
#include <inline_n.h>
//~ #include <gtemac.h> // gtemac contains macro versions of the libgte functions, worth checking out to see the operations order.
#define VMODE 0 // Video Mode : 0 : NTSC, 1: PAL
#define SCREENXRES 320 // Screen width
#define SCREENYRES 240 + (VMODE << 4) // Screen height : If VMODE is 0 = 240, if VMODE is 1 = 256
#define CENTERX ( SCREENXRES >> 1 ) // Center of screen on x
#define CENTERY ( SCREENYRES >> 1 ) // Center of screen on y
#define MARGINX 0 // margins for text display
#define MARGINY 32
#define FONTSIZE 8 * 7 // Text Field Height
#define OTLEN 10 // Ordering Table Length
DISPENV disp[2]; // Double buffered DISPENV and DRAWENV
DRAWENV draw[2];
u_long ot[2][OTLEN]; // double ordering table of length 8 * 32 = 256 bits / 32 bytes
char primbuff[2][32768] = {1}; // double primitive buffer of length 32768 * 8 = 262.144 bits / 32,768 Kbytes
char *nextpri = primbuff[0]; // pointer to the next primitive in primbuff. Initially, points to the first bit of primbuff[0]
short db = 0; // index of which buffer is used, values 0, 1
short subdiv = 1;
void init(void)
{
ResetGraph(0);
// Initialize and setup the GTE
InitGeom();
//~ SetGeomOffset(CENTERX,CENTERY);
gte_SetGeomOffset(CENTERX,CENTERY);
gte_SetGeomScreen(CENTERX);
// Set display environment
SetDefDispEnv(&disp[0], 0, 0, SCREENXRES, SCREENYRES);
SetDefDispEnv(&disp[1], 0, SCREENYRES, SCREENXRES, SCREENYRES);
// Set draw environment
SetDefDrawEnv(&draw[0], 0, SCREENYRES, SCREENXRES, SCREENYRES);
SetDefDrawEnv(&draw[1], 0, 0, SCREENXRES, SCREENYRES);
// If PAL, use 320x256, hence 256 - 240 = 16 / 2 = 8 px vertical offset
if (VMODE)
{
SetVideoMode(MODE_PAL);
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1);
// Set background color
setRGB0(&draw[0], 50, 50, 50);
setRGB0(&draw[1], 50, 50, 50);
draw[0].isbg = 1;
draw[1].isbg = 1;
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
FntLoad(960, 0);
FntOpen(MARGINX, SCREENYRES - MARGINY - FONTSIZE, SCREENXRES - MARGINX * 2, FONTSIZE, 0, 280 );
}
void display(void)
{
// Wait for drawing
DrawSync(0);
// Wait for vsync
VSync(0);
// Flip DISP and DRAW env
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
DrawOTag(ot[db] + OTLEN - 1);
// Flip db index
db = !db;
// Get next primitive in buffer
nextpri = primbuff[db];
}
int main(void)
{
long p, flag, OTz;
SVECTOR rotVector = {0};
SVECTOR rotVector4 = {0}; // Initialize rotation vector {x, y, z}
VECTOR transVector = {0, 0, CENTERX, 0}; // Initialize translation vector {x, y, z}
SVECTOR vertPos[4] = { // 0 ______ 1
{ -64, -32, 0, 0 }, // Vert 1 | |
{ 32, -32, 0, 0 }, // Vert 2 | _______|
{ -32, 48, 0, 0 }, // 2 3
{ 22, 50, 0, 0 }
}; // Vert 3
MATRIX workMatrix = {0};
POLY_F4 * poly = {0}; // pointer to a POLY_F4
POLY_F4 * poly4 = {0}; // pointer to a POLY_F4
POLY_F4 * polySub[4] = {0}; // pointer to a POLY_F4
init();
while (1)
{
// Set Ordering table
ClearOTagR(ot[db], OTLEN);
rotVector.vz += 4;
// Find rotation matrix from vector, store in
RotMatrix_gte(&rotVector, &workMatrix);
// Ditto for translation
TransMatrix(&workMatrix, &transVector);
// Set the matrices we just found
gte_SetRotMatrix(&workMatrix);
gte_SetTransMatrix(&workMatrix);
poly4 = (POLY_F4 *)nextpri;
nextpri += sizeof(POLY_F4); // increment nextpri address with size of a POLY_F3 struct
polySub[0] = (POLY_F4 *)nextpri;
nextpri += sizeof(POLY_F4);
polySub[1] = (POLY_F4 *)nextpri;
nextpri += sizeof(POLY_F4);
polySub[2] = (POLY_F4 *)nextpri;
nextpri += sizeof(POLY_F4);
polySub[3] = (POLY_F4 *)nextpri;
polySub[0]->x0 = poly4->x0;
polySub[0]->y0 = poly4->y0;
polySub[0]->x1 = (poly4->x0 + poly4->x1) >> 1;
polySub[0]->y1 = (poly4->y0 + poly4->y1) >> 1;
polySub[0]->x2 = (poly4->x0 + poly4->x2) >> 1;
polySub[0]->y2 = (poly4->y0 + poly4->y2) >> 1;
polySub[0]->x3 = (poly4->x0 + poly4->x3) >> 1;
polySub[0]->y3 = (poly4->y0 + poly4->y3) >> 1;
polySub[1]->x0 = polySub[0]->x1;
polySub[1]->y0 = polySub[0]->y1;
polySub[1]->x1 = poly4->x1;
polySub[1]->y1 = poly4->y1;
polySub[1]->x2 = polySub[0]->x3;
polySub[1]->y2 = polySub[0]->y3;
polySub[1]->x3 = (poly4->x1 + poly4->x3) >> 1;
polySub[1]->y3 = (poly4->y1 + poly4->y3) >> 1;
polySub[2]->x0 = polySub[0]->x2;
polySub[2]->y0 = polySub[0]->y2;
polySub[2]->x1 = polySub[0]->x3;
polySub[2]->y1 = polySub[0]->y3;
polySub[2]->x2 = poly4->x2;
polySub[2]->y2 = poly4->y2;
polySub[2]->x3 = (poly4->x2 + poly4->x3) >> 1;
polySub[2]->y3 = (poly4->y2 + poly4->y3) >> 1;
polySub[3]->x0 = polySub[0]->x3;
polySub[3]->y0 = polySub[0]->y3;
polySub[3]->x1 = polySub[1]->x3;
polySub[3]->y1 = polySub[1]->y3;
polySub[3]->x2 = polySub[2]->x3;
polySub[3]->y2 = polySub[2]->y3;
polySub[3]->x3 = poly4->x3;
polySub[3]->y3 = poly4->y3;
// Draw a Quad
// Transform 3 first vertices
gte_ldv3(&vertPos[0], &vertPos[1], &vertPos[2]);
gte_rtpt();
gte_stsxy3_f4(poly4);
// Transform remaining vertex
gte_ldv0(&vertPos[3]);
gte_rtps();
// SXY3 is set with gte_stsxy() or gte_stsxy2() ¯\_(ツ)_/¯
gte_stsxy(&poly4->x3);
// Get p, flag and OTz
gte_stdp(&p);
gte_stflg(&flag);
gte_stszotz(&OTz);
if ( subdiv == 0){
setPolyF4(poly4);
setRGB0(poly4, 0, 255, 255);
addPrim(ot[db], poly4);
} else {
setPolyF4(polySub[0]);
setRGB0(polySub[0], 255, 0, 255);
addPrim(ot[db], polySub[0]);
setPolyF4(polySub[1]);
setRGB0(polySub[1], 128, 0, 255);
addPrim(ot[db], polySub[1]);
setPolyF4(polySub[2]);
setRGB0(polySub[2], 0, 128, 255);
addPrim(ot[db], polySub[2]);
setPolyF4(polySub[3]);
setRGB0(polySub[3], 100, 255, 0);
addPrim(ot[db], polySub[3]);
}
// Display text
FntPrint("Hello poly subdiv !\n");
FntFlush(-1);
display();
}
return 0;
}

View File

@ -11,209 +11,111 @@
// Based on : ../psyq/psx/sample/serial/SIO
//
// sio echo back
// 1.00 Jan.28.1997 shino
// 1.00 Jan.28.1997 shino
#include <sys/types.h>
#include <libgte.h>
#include <libgpu.h>
#include <libetc.h>
#include <stdio.h>
// Needed for SIO operations
#include <libsio.h>
// Needed for manipulating strings
#include <string.h>
// Display stuff (see hello_tile for the basics)
#define VMODE 0
#define SCREENXRES 320
#define SCREENYRES 240
#define CENTERX SCREENXRES/2
#define CENTERY SCREENYRES/2
#define OTLEN 2048 // Maximum number of OT entries
#define PRIMBUFFLEN 32768 // Maximum number of POLY_GT3 primitives
// Display and draw environments, double buffered
DISPENV disp[2];
DRAWENV draw[2];
u_long ot[2][OTLEN]; // Ordering table (contains addresses to primitives)
char primbuff[2][PRIMBUFFLEN] = {0}; // Primitive list // That's our prim buffer
char * nextpri = primbuff[0]; // Primitive counter
short db = 0; // Current buffer counter
// SIO
#define MAX_CHARS 64
u_char SIO = 1; // Is SIO enabled ?
u_char SIOinit = 0; // Is SIO initialized ?
// Prototypes
void init(void);
void display(void);
void init(){
// Reset the GPU before doing anything and the controller
ResetGraph(0);
// Set the display and draw environments
SetDefDispEnv(&disp[0], 0, 0 , SCREENXRES, SCREENYRES);
SetDefDispEnv(&disp[1], 0, SCREENYRES, SCREENXRES, SCREENYRES);
SetDefDrawEnv(&draw[0], 0, SCREENYRES, SCREENXRES, SCREENYRES);
SetDefDrawEnv(&draw[1], 0, 0, SCREENXRES, SCREENYRES);
// If in PAL mode, add vertical offset
if (VMODE)
{
SetVideoMode(MODE_PAL);
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
setRGB0(&draw[0], 0, 0, 255);
setRGB0(&draw[1], 0, 0, 255);
draw[0].isbg = 1;
draw[1].isbg = 1;
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
// Init font system
FntLoad(960, 0);
FntOpen(16, 16, 196, 64, 0, 256);
}
void display(void){
DrawSync(0);
VSync(0);
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
db = !db;
setRGB0(&draw[0], 0, 0, 255);
setRGB0(&draw[1], 0, 0, 255);
draw[0].isbg = 1;
draw[1].isbg = 1;
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
// Init font system
FntLoad(960, 0);
FntOpen(16, 16, 196, 64, 0, 256);
}
void display(void){
DrawSync(0);
VSync(0);
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
db = !db;
}
int main() {
init();
// Main loop
while (1) {
// Buffer for the RX data of size MAX_CHARS
static char buffer[ MAX_CHARS ] = {0};
// If SIO flag is set, initialize and get data
if( SIO ){
// Is SIO is not initialized, dot it
if( ! SIOinit ){
ResetCallback();
// Load SIO driver at 115200bps
AddSIO(115200);
ResetGraph(0);
// Use _sio_control to clear driver status error-related bits
// See psyq's libref47.pdf, p.1125 for the commands and status tables
_sio_control(2,1,0);
SIOinit = 1;
}
// Limit input buffer to MAX_CHARS chars, making it a rolling buffer
if( strlen(buffer) > MAX_CHARS ){
// If that limit is reached, remove first char in string
memmove(buffer, buffer + 1, strlen(buffer));
}
// Check if sio driver is able to write communications data
// If so, this means reading is not occuring
if( _sio_control(0,0,0) & SR_RXRDY ){ // SR_RXRDY == 0x2
// Read byte
char c = _sio_control(0,4,0);
// Add to buffer
strncat(buffer, &c, 1);
}
}
// END SIO FUN
FntPrint("Hello Serial!\n\n");
if( buffer ){
FntPrint("%s", buffer);
}
FntFlush(-1);
display();
}
return 0;
}

View File

@ -84,7 +84,9 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 50, 50, 50);
setRGB0(&draw[1], 50, 50, 50);
@ -108,8 +110,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
DrawOTag(ot[db] + OTLEN - 1);
db = !db;

View File

@ -46,7 +46,9 @@ void init(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 50, 50, 50);
setRGB0(&draw[1], 50, 50, 50);
@ -68,9 +70,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
// We're using a reverse OT, so we want to display the last item first. See PsyQ's LibRef47.pdf, p.277
DrawOTag(ot[db] + OTLEN - 1);
// Uncomment the following line to use a regular oredered OT. Uncomment l.100 accordingly

View File

@ -114,7 +114,9 @@ void initGraph(void)
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 50, 50, 50);
setRGB0(&draw[1], 50, 50, 50);
@ -137,8 +139,6 @@ void display(void)
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
SetDispMask(1);
db = !db;
}

View File

@ -40,7 +40,9 @@ void init(void)
disp[0].screen.y += 8; // add offset : 240 + 8 + 8 = 256
disp[1].screen.y += 8;
}
SetDispMask(1); // Display on screen
setRGB0(&draw[0], 50, 50, 50); // set color for first draw area
setRGB0(&draw[1], 50, 50, 50); // set color for second draw area
@ -63,8 +65,6 @@ void display(void)
PutDispEnv(&disp[db]); // set alternate disp and draw environnments
PutDrawEnv(&draw[db]);
SetDispMask(1); // Display on screen
db = !db; // flip db value (0 or 1)
}