Code:
//#include <lib/cstr.c> // string lib
//#include <lib/cmath.c> // math lib
//#include <lib/conlib.c> // console lib
//#include <lib/memory.c> // memory lib ( by borsty )
#include <lib/advconlib.c> // advanced console screen lib ( by borsty )
// Directly copied from cmath.c, as we only use this functions in here
floor( x ) int x; {
#asm
mov EDX,EBP;
add EDX,2;
mov EAX,#EDX;
fint EAX;
#endasm
}
main() {
// variables
int i, pos, x, y, ox, oy, state, used;
char* str; // string ( char array )
state=0;
str = "(C) Borsty.Org", 0;
// init screen [0][3072]
Scr_Init(0);
Scr_CursorEnable(0,1);
Scr_CursorPos(0,0);
Scr_SetActive(1);
Scr_EnableRT(0);
Scr_SetRTArea(1,1,28,16);
Scr_SetOverlays(1,1);
// Fading text
for(i=0;i<10;i++){
x = 999 + (i * 1000);
Scr_Print(1,str,8,8,x);
delay(100);
}
delay(2900);
for(i=9;i>=0;i--){
x = 999 + (i * 1000);
Scr_Print(1,str,8,8,x);
delay(100);
}
delay(400);
Scr_ClearScr();
// Loop
while(1){
used = Scr_GetUsedState();
if(used==1){
Scr_SetActive(0);
if(state==1){
state=0;
Scr_EnableRT(0);
} else {
state=1;
Scr_ClearScr();
Scr_EnableRT(1);
}
Scr_SetActive(1);
}
pos = Scr_GetPointerPos();
if(pos<526) { // 539 - string length
y = floor(pos/30);
x = pos-(y*30);
outport(0,x);
outport(1,y);
Scr_SetActive(0);
if (ox!=x || oy!=y) {
Scr_PutIcon(2,26,ox,oy,0);
Scr_Print(2,str,ox+1,oy,0);
}
Scr_PutIcon(2,26,x,y,8999);
Scr_Print(2,str,x+1,y,8888);
Scr_SetActive(1);
ox=x;
oy=y;
}
}
} Get the latest beta release of the ZC32 compiler
Bookmarks