From 1aa0e17df7c325a41de8cf8a57f52ed853f08bf3 Mon Sep 17 00:00:00 2001 From: "John Wilbert M. Villamor" Date: Fri, 24 Apr 2020 19:01:28 +0800 Subject: Refined toolchain instructions, organized examples, added automatic retry for CdRead(), added FIOCSCAN ioctl in psxsio TTY driver, added tty and console examples. --- examples/demos/n00bdemo/disp.c | 72 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 examples/demos/n00bdemo/disp.c (limited to 'examples/demos/n00bdemo/disp.c') diff --git a/examples/demos/n00bdemo/disp.c b/examples/demos/n00bdemo/disp.c new file mode 100644 index 0000000..d798ee9 --- /dev/null +++ b/examples/demos/n00bdemo/disp.c @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include "smd.h" +#include "disp.h" + +DISPENV disp; +DRAWENV draw; + +char pribuff[2][131072]; +unsigned int ot[2][OT_LEN]; +char *nextpri; +int db = 0; + +MATRIX mtx; + + +void initDisplay() { + + ResetGraph( 3 ); + + if( GetVideoMode() == MODE_NTSC ) { + SetDefDispEnv( &disp, 0, 0, 640, 480 ); + SetDefDrawEnv( &draw, 0, 0, 640, 480 ); + scSetClipRect( 0, 0, 640, 480 ); + printf("NTSC System.\n"); + } else { + SetDefDispEnv( &disp, 0, 0, 640, 512 ); + SetDefDrawEnv( &draw, 0, 0, 640, 512 ); + scSetClipRect( 0, 0, 640, 512 ); + disp.screen.y = 20; + disp.screen.h = 256; + printf("PAL System.\n"); + } + + disp.isinter = 1; + draw.isbg = 1; + + PutDispEnv( &disp ); + PutDrawEnv( &draw ); + + ClearOTagR( ot[0], OT_LEN ); + ClearOTagR( ot[1], OT_LEN ); + nextpri = pribuff[0]; + + InitGeom(); + gte_SetGeomScreen( 320 ); + + if( GetVideoMode() == MODE_NTSC ) { + gte_SetGeomOffset( 320, 240 ); + } else { + gte_SetGeomOffset( 320, 256 ); + } + +} + +void display() { + + DrawSync(0); + VSync(0); + + PutDrawEnv( &draw ); + DrawOTag( ot[db]+OT_LEN-1 ); + + db ^= 1; + ClearOTagR( ot[db], OT_LEN ); + nextpri = pribuff[db]; + + SetDispMask( 1 ); + +} \ No newline at end of file -- cgit v1.2.3