home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG099.ARC
/
HIRES1.DOC
< prev
next >
Wrap
Text File
|
1979-12-31
|
9KB
|
298 lines
TURBO HIRES2
By Simon Carter
Man∙ oµ yo⌡ ou⌠ therσ ma∙ havσ beeε disappointeΣ b∙ Turbo'≤ lacδ oµ áHires▓ ì
graphic≤ ároutines« ╔ was¼ anΣ no≈ therσ i≤ ß probleφ n∩ more« á Ove≥ áthσ ì
nex⌠ ácouplσ áoµ months¼ ╔ wil∞ bσ presentinτ routine≤ át∩ áutilisσ áHires▓ ì
graphic≤ oε Premiuφ Bees.
First, some declarations for use by the program.
type
Operation = (ResDot,SetDot,InvDot);
Script = String[255];
FileSpec = String[80];
var
PCGRAM : Byte absolute $F800;
HIRES2 procedure.
Thi≤ áprocedurσ set≤ u≡ thσ 654╡ iε 64x1╢ mode¼ allocate≤ thσ bank≤ iε áthσ ì
attributσ RAM¼ clear≤ thσ PCG≤ iε al∞ bank≤ anΣ fill≤ thσ screeε witΦ thesσ ì
blanδ PCG≤ read∙ fo≥ use.
Procedure HIRES2;
Procedure Set64_16;
Begin
Inline ($21/*+36/ { LD HL,DATA }
$C5/ { PUSH BC }
$E5/ { PUSH HL }
6/$10/ { LD B,16 }
$78/ { LOOP LD A,B }
$3D/ { DEC A }
$D3/$0C/ { OUT (0C),A }
$7E/ { LD A,(HL) }
$D3/$0D/ { OUT (0D),A }
$2B/ { DEC HL }
$10/$F6/ { DJNZ LOOP }
6/$4B/ { LD B,75 }
$E1/ { POP HL }
$C1/ { POP BC }
$C9/ { RET }
$6B/ { DB $6B }
$40/ { DB $40 }
$51/ { DB $51 }
$37/ { DB $37 }
$12/ { DB $12 }
9/ { DB 9 }
$10/ { DB 16 }
$11/ { DB 17 }
$48/ { DB $48 }
$0F/ { DB 15 }è $2F/ { DB $2F }
$0F/ { DB 15 }
0/ { DB 0 }
0/ { DB 0 }
0/ { DB 0 }
0); { DATA DB 0 }
End;
Begin
ClrScr;
Set64_16;
Port[28] := 144;
for Bank := 0 to 7 do
for Character := 0 to 127 do
Mem[$F000 + (Bank * 128) + Character] := Bank;
for Bank := 7 downto 0 do
begin
Port[28] := 128 + Bank;
FillChar(PCGRAM,2048,0);
end;
for Bank := 0 to 7 do
for Character := 0 to 127 do
Mem[$F000 + (Bank * 128) + Character] := Character + 128;
End;
DOT procedure
Thi≤ áprocedurσ set≤ ß do⌠ withiε ╪ range≤ 0..51▒ anΣ ┘ range≤ 0..255¼ áanΣ ì
accordinτ át∩ thσ valuσ oµ F¼ i⌠ wil∞ reset¼ se⌠ o≥ inver⌠ pixe∞ a⌠ á(X,Y)« ì
Ou⌠ oµ rangσ value≤ arσ ignored.
To call it use the following statement :
DOT(X, ( in [0..511] )
Y, ( in [0..255] )
F); ( in [ResDot, SetDot, InvDot] )
eg. DOT(0,0,InvDot);
Procedure Dot(X,Y : Integer; F : Operation);
var
PCG, Bit, Line : Byte;
Change : Integer;
Begin
if ((X<0) or (X>511) or (Y<0) or (Y>255)) then Exit;
PCG := Mem[$F3C0 - (Y Div 16) * 64 + X Div 8];
Bit := 1 Shl (7 - (X Mod 8));
Line := 15 - Y Mod 16;
Port[28] := 135 - Y Div 32;
Change := PCG * 16 + $F000 + Line;
Case F ofè ResDot : Mem[Change] := Mem[Change] and not Bit;
SetDot : Mem[Change] := Mem[Change] or Bit;
InvDot : Mem[Change] := Mem[Change] xor Bit;
end;
Port[28] := 128;
End;
PLOT procedure
Thi≤ áprocedurσ plot≤ ß linσ usinτ thσ do⌠ routinσ above« T∩ cal∞ ái⌠ áusσ ì
thσ followinτ statemen⌠ :
PLOT(X0, ( in [0..511] )
Y0, ( in [0..255] )
X1, ( in [0..511] )
Y1, ( in [0..255] )
F); ( in [ResDot, SetDot, InvDot] )
eg. PLOT(0,0,511,255,SetDot);
Procedure Plot(X0,Y0,X1,Y1 : Integer; F : Operation);
Var
Length, I : Integer;
X,Y,X_Increment,Y_Increment : Real;
Begin
Length := Abs(X1 - X0);
if Abs(Y1 - Y0) > Length then Length := Abs(Y1 - Y0);
if Length = 0 then Dot(X0,Y0,F)
else
begin
X_Increment := (X1 - X0) / Length;
Y_Increment := (Y1 - Y0) / Length;
X := X0 + 0.5; Y := Y0 + 0.5;
for I := 1 to Length do
begin
Dot(trunc(X),trunc(Y),F);
X := X + X_Increment;
Y := Y + Y_Increment;
end;
end;
End;
PLOTBOX procedure
Thi≤ áprocedurσ plot≤ ß box¼ giveε thσ Bottoφ X¼ Bottoφ Y¼ To≡ ╪ anΣ To≡ á┘ ì
c∩-ordinates« ╞ specifie≤ whicΦ typσ oµ linσ i≤ t∩ bσ plotted« (Seσ above)
Procedure PlotBox(BottomX,BottomY,TopX,TopY : Integer;
F : Operation);
Begin
Plot(BottomX,BottomY,BottomX,TopY,F);
Plot(BottomX,TopY,TopX,TopY,F);è Plot(TopX,TopY,TopX,BottomY,F);
Plot(TopX,BottomY,BottomX,BottomY,F);
End;
NORMAL procedure
Thi≤ procedurσ put≤ thσ 654╡ bacδ iε 80x2┤ mode¼ reset≤ thσ banδ allocatioε ì
iε attributσ RA═ anΣ invert≤ thσ PCG≤ iε al∞ banks«
Procedure Normal;
Procedure Set80_24;
Begin
Inline ($21/*+36/ { LD HL,DATA }
$C5/ { PUSH BC }
$E5/ { PUSH HL }
6/$10/ { LD B,16 }
$78/ { LOOP LD A,B }
$3D/ { DEC A }
$D3/$0C/ { OUT (0C),A }
$7E/ { LD A,(HL) }
$D3/$0D/ { OUT (0D),A }
$2B/ { DEC HL }
$10/$F6/ { DJNZ LOOP }
6/$4B/ { LD B,75 }
$E1/ { POP HL }
$C1/ { POP BC }
$C9/ { RET }
$6B/ { DB $6B }
$50/ { DB $50 }
$58/ { DB $58 }
$37/ { DB $37 }
$1B/ { DB $1B }
5/ { DB 5 }
$18/ { DB $18 }
$19/ { DB $19 }
$48/ { DB $48 }
10/ { DB 10 }
$2A/ { DB $2A }
10/ { DB 10 }
$20/ { DB $20 }
0/ { DB 0 }
0/ { DB 0 }
0); { DATA DB 0 }
End;
Procedure Inverse;
Begin
Inline($3E/1/ { LD A,1 }
$D3/$0B/ { OUT (11),A }
$11/$F800/ { LD DE,0F800H }
$21/$F000/ { LD HL,0F000H }
1/$800/ { LD BC,00800H }
$7E/ { LOOP LD A,(HL) }è $2F/ { CPL }
$12/ { LD (DE),A }
$13/ { INC DE }
$23/ { INC HL }
$0B/ { DEC BC }
$79/ { LD A,C }
$B0/ { OR B }
$20/$F6/ { JR NZ,LOOP }
$AF/ { XOR A }
$D3/$0B); { OUT (11),A }
End;
var
Count : Byte;
Screen : Integer;
Begin
ClrScr;
Set80_24;
Port[28] := 144;
for Screen := 0 to 1919 do
Mem[$F000 + Screen] := 0;
for Count := 135 downto 128 do
begin
Port[28] := Count;
Inverse;
end;
End;
Here is a short demo of the above routines...
BEGIN
Hires2;
PlotBox(0,0,511,255,SetDot);
Plot(0,0,511,255,SetDot);
Plot(0,255,511,0,SetDot);
repeat
Dot(Random(511),Random(255),InvDot)
until KeyPressed;
Normal;
END.
Nex⌠ ámontΦ á╔ áwil∞ ápresen⌠ áß Machinσ Codσ áversioε áoµ áDo⌠ áanΣ áPlot¼ ì
increasinτ áthei≥ áspeeΣ ádramatically« á(╔ actuall∙ áhavσ átimeΣ áthσ átw∩ ì
differen⌠ routines¼ thσ olΣ tooδ 4▒ seconds¼ thσ ne≈ tooδ 12!)
No time to type them in?
èSend $5, a stamped, self - addressed envelope and 5.25" disk to
Simon Carter,
14 Canterbury Rd,
Heathmont, 3135.
anΣ ╔ wil∞ fil∞ you≥ disδ witΦ Hires▓ routine≤ anΣ anythinτ elsσ tha⌠á come≤ ì
t∩ mind....