Source code di bawah ini penulis buat dengan memakai Borland Turbo Pascal 7 serta telah di coba.
Program ASCII_MEM;
Uses Crt;
Procedure Tulis (X,Y : Byte;Warna : Integer;txt : char);
{VGA textmode 80 * 25 memory space SEGB800:Offset 4000 Byte}
var OffKarakter,OffAttribut : Integer;
Begin
If X < 1 Then X := 1;
If Y < 1 Then Y := 1;
If X > 80 Then X := 80;
If Y > 25 Then Y := 25;
{Hilangkan - 162 Kalau ingin X dan Y mulai dari 0}
OffKarakter := ((Y * 160) + (X * 2)) - 162;
OffAttribut := (((Y * 160) + (X * 2))+1)-162;
Mem [SegB800:OffKarakter] := ord (txt);
Mem [SegB800:OffAttribut] := warna;
End;
Procedure Layar;
Var X,Y : Integer;
Begin
TextMode (C80); {Memastikan Text Mode 80 * 25}
TextBackground (Blue);
TextColor (White);
Clrscr;
GotoXY (12,2);
Write ('ASCII - AMERICAN STANDARD CODE for INFORMATION INTERCHANGE');
For X := 1 To 80 Do
Begin
Tulis (X,3,TextAttr,#205);
Tulis (X,24,TextAttr,#205);
End;
For Y := 3 To 24 Do
Begin
Tulis (1,Y,TextAttr,#186);
Tulis (80,Y,TextAttr,#186);
End;
{7 13 19 25 31 37 43 49 55 61 67 73}
X := 7;
While X < 74 Do
Begin
Tulis (X,3,TextAttr,#209);
Tulis (X,24,TextAttr,#207);
For Y := 4 To 23 Do
Tulis (X,Y,TextAttr,#179);
Inc (X,6);
End;
Tulis (1,3,TextAttr,#201);
Tulis (80,3,TextAttr,#187);
Tulis (1,24,TextAttr,#200);
Tulis (80,24,TextAttr,#188);
GotoXY (1,25);
Write ('Enter : Untuk Keluar');
End;
Procedure DoAscii;
Var X,Y,I : Integer;
Begin
X := 2;
I := 0;
While X < 75 Do
Begin
For Y := 4 To 23 Do
Begin
If I < 256 Then
Begin
GotoXY (X,Y);
Write (I:3);
Tulis (X+4,Y,TextAttr,Char (I));
Inc (I);
End;
End;
Inc (X,6);
End;
End;
Begin
Layar;
DoAscii;
readln;
end.
***** SEMOGA BERMANFAAT *****
Tidak ada komentar:
Posting Komentar