This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View file

@ -0,0 +1,68 @@
#include <vga.h>
int Initialize (void)
{
if ( vga_init () == 0 )
return 1;
else
return 0;
}
void SetMode (int newmode)
{
vga_setmode (newmode);
}
int GetMode (void)
{
return vga_getcurrentmode ();
}
int MaxWidth (void)
{
return vga_getxdim ();
}
int MaxHeight (void)
{
return vga_getydim ();
}
void Clear (void)
{
vga_clear ();
}
void SetColour (int colour)
{
vga_setcolor (colour);
}
void SetEGAcolour (int colour)
{
vga_setegacolor (colour);
}
void SetRGB (int red, int green, int blue)
{
vga_setrgbcolor (red, green, blue);
}
void DrawLine (int x0, int y0, int dx, int dy)
{
vga_drawline (x0, y0, x0 + dx, y0 + dy);
}
void Plot (int x, int y)
{
vga_drawpixel (x, y);
}
int ThisColour (int x, int y)
{
return vga_getpixel (x, y);
}
void GetKey (char *ch)
{
*ch = vga_getkey ();
}

View file

@ -0,0 +1,32 @@
FOREIGN MODULE Vga;
TYPE EGAcolour = (black, blue, green, cyan, red, pink, brown, white,
GREY, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, WHITE);
PROCEDURE Initialize () : BOOLEAN;
PROCEDURE MaxWidth () : CARDINAL;
PROCEDURE MaxHeight () : CARDINAL;
PROCEDURE Clear;
PROCEDURE SetColour (colour : CARDINAL);
PROCEDURE SetEGAcolour (colour : CARDINAL);
PROCEDURE SetRGB (red, green, blue : CARDINAL);
PROCEDURE DrawLine (x0, y0, dx, dy : CARDINAL);
PROCEDURE Plot (x, y : CARDINAL);
PROCEDURE ThisColour (x, y : CARDINAL) : CARDINAL;
PROCEDURE SetMode (newmode : CARDINAL);
PROCEDURE GetMode () : CARDINAL;
PROCEDURE GetKey (VAR ch : CHAR);
END Vga.

View file

@ -0,0 +1,33 @@
MODULE svg01;
FROM InOut IMPORT Read, Write, WriteBf, WriteString;
IMPORT Vga;
VAR OldMode, x, y : CARDINAL;
ch : CHAR;
BEGIN
IF Vga.Initialize () = FALSE THEN
WriteString ('Could not start SVGAlib libraries. Aborting...');
WriteBf;
HALT
END;
OldMode := Vga.GetMode ();
Vga.SetMode (4);
Vga.SetColour (14);
Vga.Clear ();
Vga.SetColour (10);
FOR y := 125 TO 175 DO
FOR x := 100 TO 500 DO
Vga.Plot (x, y)
END
END;
LOOP
Read (ch);
IF ch = 'X' THEN EXIT END
END;
Vga.SetMode (OldMode);
Write (ch);
WriteBf;
END svg01.