}\r
\r
\r
-/*-----------XXXX-------------*/\r
+/*-----------XXXX-------------*/
+
+/////////////////////////////////////////////////////////////////////////////\r
+// //\r
+// WaitRetrace() - This waits until you are in a Verticle Retrace. //\r
+// //\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+void WaitRetrace() {\r
+\r
+// register char qy;\r
+\r
+ in.h.dx = 0x03DA;\r
+ in.h.al = in.h.dx;\r
+ \r
+ in.h.al &= 0x08;\r
+ int86(0x10, &in, &out);\r
+\r
+\r
+ /*l1: asm {\r
+ in al,0x03DA;\r
+ and al,0x08;\r
+ jnz l2;\r
+ }*/\r
+}
+
+/////////////////////////////////////////////////////////////////////////////\r
+// //\r
+// MoveTo() - This moves to position X*4 on a chain 4 screen. //\r
+// Note: As soon as I find documentation, this function //\r
+// will be better documented. - Snowman //\r
+// //\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+void MoveTo (word X, word Y) {\r
+\r
+// word O = Y*SIZE*2+X;
+ word O = Y*widthBytes*2+X;\r
+\r
+ asm {\r
+ mov bx, [O]\r
+ mov ah, bh\r
+ mov al, 0x0C\r
+\r
+ mov dx, 0x3D4\r
+ out dx, ax\r
+\r
+ mov ah, bl\r
+ mov al, 0x0D\r
+ mov dx, 0x3D4\r
+ out dx, ax\r
+ }
+
+;-----------------------------------------------------------\r
+;\r
+; MXPN.ASM - Panning function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+;WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxPan\r
+\r
+EXTRN mxWaitDisplay : FAR\r
+EXTRN mxStartAddress : FAR\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Moves the screen.\r
+;\r
+; Input:\r
+; X, Y = new X, Y coordinates of view screen\r
+; Output:\r
+; none\r
+;\r
+mxPan PROC FAR\r
+ ARG Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+\r
+ mov ax, [Y]\r
+ mul [mx_BytesPerLine]\r
+ mov dx, [X]\r
+ shr dx, 1\r
+ shr dx, 1\r
+ add ax, dx\r
+ push ax ; Push the start address\r
+ call mxWaitDisplay\r
+ call mxStartAddress\r
+\r
+ mov dx, 03DAh ; Set the pixel pan register\r
+ in al, dx\r
+ mov dx, 03C0h\r
+ mov al, 33h\r
+ out dx, al\r
+ mov al, BYTE PTR [X]\r
+ and al, 3\r
+ shl al, 1\r
+ out dx, al\r
+\r
+ xor ax, ax\r
+ .leave ARG_SIZE\r
+mxPan ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
+
+\r
+}
+
+//Procedure Play;\r
+void Play()\r
+{\r
+ int loop1,loop2;\r
+ int xpos,ypos,xdir,ydir;\r
+ //int ch;\r
+// for(loop1=1;loop1<=62;loop1++)\r
+ //Pal ((char)loop1,(char)loop1,(char)0,(char)(62-loop1)); // { This sets up the pallette for the pic }\r
+\r
+ moveto(0,0,Size); // { This moves the view to the top left hand corner }\r
+\r
+/* for(loop1=0;loop1<=3;loop1++)\r
+ for(loop2=0;loop2<=5;loop2++)\r
+ Putpic (loop1*160,loop2*66); // { This places the picture all over the\r
+ // chain-4 screen }\r
+ getch();\r
+ ch=0x0;*/\r
+// xpos=rand (78)+1;\r
+// ypos=rand (198)+1; // { Random start positions for the view }
+ xpos=0;
+ ypos=0;\r
+ xdir=1;\r
+ ydir=1;\r
+// while(1)\r
+// {\r
+ WaitRetrace(); // { Take this out and watch the screen go crazy! }\r
+ moveto (xpos,ypos,Size);\r
+ xpos=xpos+xdir;\r
+ ypos=ypos+ydir;\r
+ if( (xpos>79) || (xpos<1))xdir=-xdir;\r
+ if( (ypos>199) || (ypos<1))ydir=-ydir; // { Hit a boundry, change\r
+ // direction! }\r
+// if(_bios_keybrd(_KEYBRD_READY))ch=getch();\r
+// if(ch==0x71)break; // 'q'\r
+// if(ch==0x1b)break; // 'ESC'\r
+// }\r
+}
+\r
/*tile*/\r
//king_crimson's code\r
void putColorBox_X(int x, int y, int w, int h, byte color) {\r
getch();\r
\r
while(!kbhit()){ // conditions of screen saver\r
- hScroll(1);\r
- scrolly(1);\r
- delay(100);\r
+// hScroll(1);\r
+// scrolly(1);\r
+// delay(100);
+ Play();\r
}\r
//++++0000\r
setvideo(0);\r