Screen protection under DOS

xiaoxiao2021-03-06  64

#include "dos.h" #include "conoe.h" #include "stdlib.h" #include "math.h" #include "time.h"

#define max 30 # Define firstpage 5 # define lastpage 6 # define z 3 # define delay_time 3000

INT ActivePage = 0; struct {int x, y; int DX, Dy; int color; int active;} dot [max]; struct {int x, y; int color;} Bigchar;

void tSetVisualPage (char page); void tClrScr (unsigned char color); void tPutCh (int x, int y, int color, unsigned char ch); void tBigChar (int x, int y, int z, int color); void tSetActivePage (int page); void Tinit (int FX, int fy); void Tmove (int FX, INT fy, int fr); void tprotectscr ();

Main () {tprotectscr ();

Void tprotectscr () {INT I, PAGE, FX, FY, FR, CYCLE = 1, Fire, Permit = 1; BigChar.x = 10; Bigchar.co = 6; Bigchar.Color = Random (14) 1; Page = FirstPage; tsetvisualpage (firstpage); randomize (); while (cycle) {if (BigChar.x> 80) {Bigchar.y = (Bigchar.y> 12)? 0: Bigchar.y 1; Bigchar.color = Random (15) 1;} Bigchar.x = (Bigchar.x> 80)? - (32 z * 3): Bigchar.x 1; fx = random (79); fy = random (24); fr = Random (20); Tinit (fx, fy); fire = (Random (10)> 4)? 1: 0; permit = (Random (10)> 5)? 1: 0; for (i = 0; i <10; i ) {tsetactivepage (page: Lastpage); tclrscr (Black); if (permit) {tbigchar (Bigchar.x, Bigchar.y, Z, Bigchar.color); IF (FX, FX, FY, FR); Else {IF (Fire) TMOVE (FX, FY, FR); TBigchar (Bigchar.x, Bigchar.y, Z, Bigchar.Color);} TsetVisualPage (PAGE) ; If (kbhit ()) {cycle = 0; Break;} delay (delay_time);} / * for end * /} / * while end * / tsetvisualpage (0); Printf ("/ NProtect Screen Normal Shut Off." ); void Tmove (int FX, INT fy, int fr) {INT I, PI Ece; for (i = 0; i fr) DOT [i] .active = 0; IF (DOT [i] .active! = 0) {TPUTCH (DOT [I] .x, DOT [i] .y, DOT [i] .color, 220); DOT [i] .x = DOT [i] .dx; dot [i] .y = dot [i] .dy;}}}

Void Tinit (int fx, int fy) {INT i; for (i = 0; i

Void TsetActivePage (INT Page) {IF (Page <0 || Page> 7) Return; ActivePage = Page;}

Void Tbigchar (int X, int y, int Z, int color) {Int i, n, j, oldy; static unsigned char chardot [4] [12] = {{0, 0, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0xc, 6, 0xc6, 0xc6, 0x7c}, {0,0,0x10,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0 x66,0xfE}, {0,0,0xfc, 0x66,0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0x18, 0x18, 0X18, 0X18, 0X18, 0X18, 0X18, 0X18, 0X18, 0X3C}}; Oldy = Y; for (n = 0; n <4; n , x = (z 8)) for (i = 0, y = Oldy; i <12; i , y ) for (j = 0; j <8; j ) IF ((Chardot) [N] [i] >> (7-J)) & 1) TPUTCH (x J, Y, Color, 219);} void TPUTCH (INT X, INT Y, INT Color, unsigned char ch) {Unsigned Char Far * BUF; if (x> 79 || x <0 || y <0 || y> 24) return; buf = (unsigned char far *) 0xB8000000 0x1000 * ActivePage; * (BUF Y * 160 x * 2) = (unsigned char) CH; * (BUF Y * 160 x * 2 1) = (unsigned char) color;}

Void TclrsCr (unsigned char color) {unsigned char far * buf; int i; buf = (unsigned char far *) 0xB8000000 0x1000 * ActivePage; for (i = 0; i <4000; i = 2) {* (buf I) = 32; * (BUF i 1) = (unsigned char) color << 4;}}

Void TsetVisualPage (char page) {union regs r; r.h.ah = 5; r.h.al = page; int86 (0x10, & r, & r);}

转载请注明原文地址:https://www.9cbs.com/read-88700.html

New Post(0)