C
Program C de umplere a ecranului text prin acces direct la memoria ecran// Program C de umplere a ecranului text prin acces direct la memoria ecran #include <dos.h> #include <conio.h> struct scrcar far *ecran; int lin,col; int culoare=BLUE,fundal=LIGHTGRAY; void main(void) getch(); Program Acces_direct_ecran_grafic320_200; Uses crt; Const maxl=200-1; maxc=320-1; mijl=maxc div 2; Type Matrice=array[0..maxl,0..maxc] of byte; var scr:Matrice absolute $A000:0; i,j,k,l,c,x:integer; ok:char; BEGIN asm mov ah,0 mov al,13h int 10h; end; randomize;x:=random(maxc); for k:=1 to 2 do for i:=0 to maxl do for j:=0 to mijl do scr[i,j+k*mijl]:=random(maxc) ; k:=0; repeat repeat for i:=0 to maxl do for j:=0 to mijl do begin l:=i;c:=j+k*mijl; if (scr[(l-1)mod maxl,c]<scr[l,c])and (scr[l,(c-1)mod mijl]<scr[l,c]) then scr[i,j+((k+1)mod 2)*mijl]:=(scr[(l-1)mod maxl,c]+scr[l,(c-1)mod mijl]+ x)div 3-1 else if (scr[l,(c+1)mod mijl]>scr[l,c])and (scr[(l+1)mod maxl,c]>scr[l,c]) then scr[i,j+((k+1)mod 2)*mijl]:=(scr[(l+1)mod maxl,c]+scr[l,(c+1)mod mijl]+ x) div 3+1 else scr[i,j+((k+1)mod 2)*mijl]:=scr[l,c]+1; end; k:=(k+1) mod 2; until keypressed; ok:=readkey;x:=random(maxc); if ok<>#27 then ok:=readkey; until ok=#27; asm mov ax,0 int 10h end; END.
|