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 / HIRES3.DOC < prev    next >
Text File  |  1979-12-31  |  6KB  |  238 lines

  1.                                TURBO HIRES2
  2.  
  3.                               By Simon Carter
  4.  
  5.  
  6. Wσ wil∞ concentratσ oε graphiπ `toolsº no≈ tha⌠ wσ havσ basiπ function≤ ou⌠ ì
  7. oµ thσ way«  Thσ firs⌠ i≤ Text.
  8.  
  9. TEXT procedure
  10.   Wheε ß RO═ characte≥ i≤ encountereΣ iε othe≥ graphic≤ routines¼ it≤ ádatß ì
  11. i≤ ácopieΣ int∩ PC╟ RA═ anΣ theε plotteΣ through«  Thσ Tex⌠ procedurσ áwil∞ ì
  12. masδ RO═ character≤ ont∩ thσ screeε a≤ thougΦ the∙ haΣ beeε plotteΣ áthere¼ ì
  13. s∩ átha⌠ thσ plo⌠ routinσ doe≤ no⌠ havσ t∩ checδ fo≥ them«  T∩ cal∞ i⌠ áusσ ì
  14. thσ followinτ statemen⌠ ║  
  15.               Text(CursX,    ( in [1..64] )
  16.                    CursY,    ( in [1..16] )
  17.                    Writing,  ( a string of any length )
  18.                    F);       ( in [ResDot, SetDot, InvDot] )
  19.  
  20.   eg Text(23,8,'Hopefully centered!',SetDot);
  21.  
  22. N┬ Thσ routinσ use≤ ß 1╢ bytσ storagσ areß a⌠ 300░ hex¼ thi≤ ma∙ havσ t∩ bσ ì
  23. changeΣ t∩ sui⌠ you≥ needs.
  24.  
  25.  
  26. Procedure Text(CursX,CursY : Byte; Writing : Script; F : Operation);
  27.  
  28. var
  29.   PCG, Temp, ASCII : Integer;
  30.   Loop, MaskData, Mask : Byte;
  31.  
  32. Begin
  33.   for Loop := 1 to Length(Writing) do
  34.   begin
  35.     ASCII := Ord(Writing[Loop]);
  36.     Inline($3E/$01/          {       LD      A,1          }
  37.            $D3/$0B/          {       OUT     (0BH),A      }
  38.            $2A/ASCII/        {       LD      HL,ASCII     }
  39.            $11/0/$F0/        {       LD      DE,$F000     }
  40.            $29/              {       ADD     HL,HL        }
  41.            $29/              {       ADD     HL,HL        }
  42.            $29/              {       ADD     HL,HL        }
  43.            $29/              {       ADD     HL,HL        }
  44.            $19/              {       ADD     HL,DE        }
  45.            $11/0/$30/        {       LD      DE,$3000     }
  46.            6/$10/            {       LD      B,16         }
  47.            $7E/              {READ   LD      A,(HL)       }
  48.            $12/              {       LD      (DE),A       }
  49.            $13/              {       INC     DE           }
  50.            $23/              {       INC     HL           }
  51.            $10/$FA/          {       DJNZ    READ         }
  52.            $AF/              {       XOR     A            }
  53.            $D3/$0B);         {       OUT     (0BH),A      }
  54.  
  55.     if ((CursX>0) and (CursX<65) and (CursY>0) and (CursY<17)) then
  56.     begin
  57.       PCG := Mem[$EFBF + CursX +  CursY * 64];
  58.       Port[28] := 128 + ((CursY - 1) div 2);
  59.       for MaskData := 0 to 15 doè        begin
  60.         Temp := $F000 + PCG * 16 + MaskData;
  61.         Mask := Mem[$3000 + MaskData];
  62.           case F of
  63.             ResDot : Mem[Temp] := Mem[Temp] And not Mask;
  64.             SetDot : Mem[Temp] := Mem[Temp] Or Mask;
  65.             InvDot : Mem[Temp] := Mem[Temp] Xor Mask;
  66.           end;
  67.         end;
  68.       Port[28] := 128;
  69.     end;
  70.     CursX := CursX + 1;
  71.     if CursX > 64 then
  72.       begin
  73.         CursX := 1;
  74.         CursY := CursY + 1;
  75.       end;
  76.   end;
  77. End;
  78.  
  79.  
  80.  
  81. POINT function
  82.   Thσ áPoin⌠ functioε return≤ 25╡ iµ onσ o≥ eithe≥ c∩-ordinate≤ arσ ou⌠ áoµ ì
  83. range¼ áß ▒ iµ thσ pixe∞ i≤ se⌠ anΣ ß ░ iµ i⌠ i≤ not«  T∩ cal∞ i⌠ áusσ áthσ ì
  84. followinτ statemen⌠ :
  85.   Variable := Point(12,   ( in [0..511] )
  86.                     45);  ( in [0..255] )
  87.  
  88.  
  89. Function Point(X, Y : Integer) : Byte;
  90.  
  91. var
  92.   PCG : Byte;
  93.  
  94. Begin
  95.   If not((X>=0) and (X<512) and (Y>=0) and (Y<256)) then Point := 255
  96.   else
  97.     begin
  98.       PCG := Mem[$F3C0 + X Div 8 - (Y Div 16) * 64];
  99.       Port[28] := 135 - (Y Div 32);
  100.       if Odd(Mem[PCG * 16 + $F00F - (Y Mod 16)] Shr (7 - X Mod 8)) then
  101.         Point := 1
  102.       else
  103.         Point := 0;
  104.       Port[28] := 128
  105.     end
  106. End;
  107.  
  108.  
  109.  
  110. CIRCLE procedure
  111.   Thi≤ áprocedurσ produce≤ aε elipsσ centereΣ a⌠ XCentre,YCentrσ oµ áradiu≤ ì
  112. XRadius,YRadius«  T∩ producσ ß circle¼ multipl∙ thσ ╪ valuσ b∙ 1.6
  113.  
  114.  
  115. Procedure Circle(XCentre,YCentre,XRadius,YRadius : Integer;
  116.                  F : Operation);
  117. èvar
  118.   X, Y, A, B : Integer;
  119.   H : Byte;
  120.   Rotate : Real;
  121.  
  122. Begin
  123.   for H := 0 to 40 do
  124.     begin
  125.     Rotate := 0.15707962 * H;
  126.     X := XCentre + Round(XRadius*Cos(Rotate));
  127.     Y := YCentre + Round(YRadius*Sin(Rotate));
  128.     if H = 0 then begin A := X; B := Y; end;
  129.     Plot(A,B,X,Y,F);
  130.     A := X; B := Y;
  131.     end;
  132. End;
  133.  
  134.  
  135.  
  136. ARC procedure
  137.   WitΦ thi≤ procedurσ yo⌡ caε plo⌠ Arc≤ centereΣ a⌠ XCentre¼ YCentrσ witΦ ß ì
  138. radiu≤ oµ XRadius,YRadius¼ froφ anglσ Star⌠ t∩ anglσ Finish¼ wherσ 
  139.                90 degrees
  140.                     ^
  141.     180 degrees  <--|--> 0 degrees
  142.                     V
  143.               270 degrees
  144. Arc≤ startinτ a⌠ 27░ througΦ 9░  wil∞ bσ plotteΣ froφ 270..36░ anΣ theε froφ  ì
  145. 0..9░ NO╘  froφ 270..180..9░  iσ al∞  arc≤ arσ  plotteΣ anticlockwise« 
  146.  
  147.  
  148.  
  149. Procedure Arc(XCentre,YCentre,XRadius,YRadius,Start,Finish : Integer;
  150.                  F : Operation);
  151.  
  152. Procedure PlotArc(XCentre,YCentre,XRadius,YRadius,Start,Finish : Integer;
  153.                      F : Operation);
  154.  
  155. const
  156.   Radians = 57.295779;
  157.  
  158. var
  159.   X, Y, XStore, YStore : Integer;
  160.   Loop : Real;
  161.  
  162. Begin
  163.   Loop := Start / Radians;
  164.   While Loop <= Finish / Radians do
  165.     begin
  166.     X := Round(XRadius * Cos(Loop)) + XCentre;
  167.     Y := Round(YRadius * Sin(Loop)) + YCentre;
  168.     if Loop = Start / Radians then begin XStore := X; YStore := Y; end;
  169.     Plot(XStore,YStore,X,Y,F);
  170.     XStore := X; YStore := Y;
  171.     Loop := Loop + 0.15707962;
  172.     end;
  173. End;
  174.  
  175. Beginè  if Start > Finish then
  176.     begin
  177.     PlotArc(XCentre,YCentre,XRadius,YRadius,Start,360,F);
  178.     Start := 0;
  179.     end;
  180.   PlotArc(XCentre,YCentre,XRadius,YRadius,Start,Finish,F);
  181. End;
  182.  
  183.  
  184. That'≤ áal∞ áfo≥ áthi≤ ámonth« á Nex⌠ átime¼ áscreensave¼ áloaΣ áanΣ áádum≡ ì
  185. procedures¼ a≤ wel∞ a≤ aε experimenta∞ Fil∞ routine.
  186.  
  187.  
  188. No time to type them in?
  189.  
  190. Send $5, a stamped, self - addressed envelope and 5.25" disk to    
  191.               Simon Carter,
  192.             14 Canterbury Rd,
  193.             Heathmont, 3135.
  194. anΣ ╔ wil∞ fil∞ you≥ disδ witΦ Hires▓ routine≤ anΣ anythinτ elsσ tha⌠ come≤ ì
  195. t∩ mind....
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233. è               90 degrees
  234.                     ^
  235.     180 degrees  <--|--> 0 degrees
  236.                     V
  237.               270 degrees
  238.