Atomizer, aka «Studio2D». Graphic raster editor. AGI is my own «Atomizer Generated Image» file format.
{$A+,B+,D+,E-,F-,G+,I+,L+,N+,O-,P-,Q-,R-,S+,T-,V+,X+,Y+}
{$M 16384,0,300000}
Program Graphics_Editor;
Uses
Crt, Graph, Dos, Globals, General, Mouse, Service, Buttons, Menus;
Function GetHighestCap(Table: Pointer; Modes: Word; Size: Integer): Integer;
near; assembler;
asm
XOR AX,AX
LES DI, Table
@@1:
MOV SI, Modes
ADD SI, Size
ADD SI, Size
MOV BX, ES:[DI]
CMP BX, 0FFFFH
JE @@4
INC DI
INC DI
MOV CX,Size
@@2:
CMP BX,[SI]
JZ @@3
DEC SI
DEC SI
LOOP @@2
@@3:
CMP AX,CX
JA @@1
MOV AX,CX
JMP @@1
@@4:
end;
function DetectVesa16: Integer; far; assembler;
var
VesaInfo: array[0..255] of Byte;
asm
MOV AX,SS
MOV ES,AX
LEA DI,VesaInfo
MOV AX,4F00H
INT 10H
CMP AX,004FH
MOV AX,grError
JNZ @@Exit
CMP ES:[DI].VgaInfoBlock.VESASignature.Word[0], 'EV'
JNZ @@Exit
CMP ES:[DI].VgaInfoBlock.VESASignature.Word[2], 'AS'
JNZ @@Exit
LES DI,ES:[DI].VgaInfoBlock.VideoModePtr
PUSH ES
PUSH DI
MOV AX, OFFSET Vesa16Modes
PUSH AX
MOV AX,3
PUSH AX
CALL GetHighestCap
@@Exit:
end;
Procedure SVGAinitialize;
Var
PathToDriver : String; {Stores the DOS path to *.BGI & *.CHR}
begin
PathToDriver := '';
VESA16 := InstallUserDriver( 'VESA', @DetectVesa16 );
GD := IBM8514;
GM := IBM8514Hi;
GD := Detect; {Use autodetection}
InitGraph( GD, GM, PathToDriver );
end; {SVGA initialize }
{- Main ---------------------------------------------------------------------}
Var
ReadX : Byte;
ReadY : Byte;
PutX : Integer;
PutY : Integer;
Sprite : array [ 0..100, 0..100 ] of Byte;
Begin
ClrScr;
Write( 'Type AGI file name: ' );
ReadLn( FileName );
SVGAinitialize; { *** Init video *** }
SetGraphMode( 2 );{ *** Set graphics mode by 800x600 pixels, 8 bit color *** }
setcolor(15);
outtextxy(10,10,inttostr(getmaxX));
outtextxy(10,30,inttostr(getmaxy));
Assign( F, FileName + '.agi' );
{-$I}
Reset( F, 1 );
BlockRead( F, VERSION_NUMBER, 1 );
BlockRead( F, iSizeX, 1 );
BlockRead( F, iSizeY, 1 );
for ReadY := 0 to iSizeY - 1 do
for ReadX := 0 to iSizeX - 1 do
BlockRead( F, Sprite[ ReadX, ReadY ], 1 );
Close( F );
PutX := 0;
PutY := 440;
repeat
if KeyPressed then
begin
Key := ReadKey;
if Key = #27 then Halt;
end;
for CntX := 0 to 19 do
for ReadY := 0 to iSizeY - 1 do
for ReadX := 0 to iSizeX - 1 do
PutPixel( PutX + CntX * iSizeX + ReadX, PutY + ReadY, Sprite[ ReadX, ReadY ] );
ReadKey;
End.{ Written by Sergeant Skeleton at 26.03.99 }