
9.  ᪠  Hercules
-----------------------------------------------------------------
     
      ࠧ  ⭮  ᪮   Hercules.
     ᯮ짮   ७  ᪠,
ᠭ .
     
       ⠪ ।⠢      짮⥫
VGA, ᪮  設⢮    VGA  뢮 ஬
䨪 Hercules     ᪮   ०   IBM   7.   楤
MODEPSEUDOHERCULES 뫠  ࠧࠡ⠭    VGA  -०
Hercules.
     
9.1  楤  ஬ ᪨ ०
-----------------------------------------------------------------
     
      ਢ ⨭ ணࠬ  ⨢樨 ஬
᪮ -०  ࠧ襭 720*349 ᥫ:
     
Procedure ModePseudoHercules
{ 室  Turbo Pascal Graph.tpu }
{ 室 䠩 ᪮ 䥩 Borland Herc.bgi }
{ 砥 ० Hercules  ७  VGA }
procedure MODE(ModeHexNumber:integer);
  var Regs : Registers;   { ⠭ -० }
      GraphMode, GraphDriver : integer;
     
begin
 with Regs do begin      { ⮢ AL,AH  뢠 }
   AL := ModeHexNumber;  { ६  -० }
   AH := $00;            { 㭪: ⠭ -० }
 end;
 Intr($10,Regs);         { 맮 뢠 HEX 10 }
end;
Procedure ModeHercules;  { 樠 䨪 }
 var GraphMode, GraphDriver : integer;
begin
 GraphDriver := HercMono; GraphMode := HercMonoHi;
 Initgraph(GraphDriver,GraphMode,'');
end;
begin                    {  ⥫ 楤 }
  Mode($7);              { 祭 ० IBM 7 }
  ModeHercules;          {  ஬ 䨪 Hercules }
end;                     {  楤 }
     
                                            
9.1.1  ஬ ᪨ ० Hercules   樠
-----------------------------------------------------------------
     
     Turbo Pascal  ॡ  ⮤  ணࠬ஢  
ࠡ   ஬  ᪨ ० ᪨  IBM 
 Hercules.  稭  ⮨    ⮬,    ᫨    ⥪饩
४ਨ  䥩᭠ ணࠬ  ७ .BGI,  
⠭⭠ ணࠬ  ᪠   PUTPIXEL   㯭      直
࠭祭. ஬   ⮣,   䨪     樠஢
।⢮ 㪠   uses  ணࠬ  
GRAPH.TPU.
     
     ᪨ ०    䠪᪨   ⨢      
ணࠬ     ணࠬ.  騩  ⨭  ⭮  
楤 MODEHERCULES:
     
Procedure ModeHercules;
  var GraphMode, GraphDriver : integer;
begin
  GraphDriver := HercMono; GraphMode := HercMonoHi;
  Initgraph(GraphDriver,GrapMode,'');
end;
     
      楤  ந      ணࠬ.  맮
⮩ 楤       ணࠬ    "MODEHERCULES'
 㯭묨   ᪨   ,        
-०.
     
      㭪  ⮩ ணࠬ 믮  ᪠
INITGRAPH(...).   ਭ  ⢥  ࠬ஢  ⨯
᪮ ,  ᪨ ०   㯠 
䠩 ᪮ 䥩  (᫨  ᫥  室    
⥪饩 ४ਨ).
     
      砥 ஬  Hercules   ᪮ ०
 ଠ  ।    ॢࠬ  HERCMONO   
HERCMONOHI.  ᫮  ᪠ १ࢨ஢.
     
      ॢ    ண 㯠 
㣨 ० IBM (MDA, CGA, EGA, MCGA  VGA).
     
      ⠪  㡥,    㯥  室  䠩
᪮ 䥩  Borland  ( ७ .BGI).   砥
 Hercules  䠩 HERC.BGI.       室  
⥪饩 ४ਨ,    ணࠬ     
ᮮ⢥饩 ४ਨ.
     
     ᫨ 㦭  .BGI-䠩  㯥,  ணࠬ   ᪮
樠樨       믮.   ⮬ 砥 
ᮮ饭 Turbo Pascal:  "Graphic not initialized. Use initgraph"
("䨪  樠஢. ᯮ initgraph").
     
     ᫥ ⮣,      GRAPH.TPU 㪠   "uses
graph;"     ᯮ짮        ⠭    -०
"INITGRAPH(, , )", ᪨ 
᪠  㯭  ᯮ짮.
     
9.1.2  䨪 ணࠬ VGA   Hercules
-----------------------------------------------------------------
     
        짮⥫    ६      VGA,  
梥⭮  .  ,    짮⥫  
ࠡ  ஬ ० ᮪ ࠧ襭 Hercules.
     
      䨣  筮    짮⥫
ᯮ짮 ணࠬ ᯥ祭  梥 ० VGA
 EGA.       ,   ணࠬ஢
 VGA ᯮ  窨 ७ 짮⥫ ஬ ,
   ᮢᥬ ⠪.
     
     ⮩ ਥ    ஢    ७
 Turbo Pascal ..,  ⮡    ࠡ    ஬
⮩ Hercules.
     
     ᥫ, 뢮  ஬묨  ᪨  ⠬,  
  .    砥,    ⨭  誠  
⮭   砥 ⨦,   ࠡ  梥.
     
     ,     ஢  誠    ⮭  
ᯮ짮   訢  ࠦ  ࠧ   蠡
客.
     
      砥,          ந    蠡
客   楤  ᮢ   ᥫ,      ꥤ
᪮쪮 ᥫ  ..,  ⮡    ।﫨   ஢
 ࠭.
     
     ᪮ ।  㯭 ஢ 祪  ⭮
᭨ ࠧ襭   ࠭,           ࠨ
蠡 客 אַ  楤 ᮢ ᥫ.
     
      ᫥饩  楤  न   x/y         梥
ਭ    祭   ⨯  integer.  ⨬  祭
न  ᪮ ० Hercules:   0  720  x   0
 348  y.
     
      梥⮢  ⨬    0    255.   梥 
ࠡ뢠 楤ன.  訥  梥⮢    
⭮  ࠦ묨 梥⮬ 0 ().  訬 ᪮॥
㤥 ᢮ 1 ().
     
     ࠬ  0  16    241    255  ᥣ  ᢠ
   梥, ᮮ⢥⢥.
     
        ࠦ 楤 PLOT(Hercules).  ⥫
ଠ .   ⨭  ᪥.
     
9.1.3   Hercules
-----------------------------------------------------------------
     
     楤 PLOT()      ⮭     蠡
"客", ,    筮,    ᯮ짮 ࠧ
⭮ 祪.
     
        ࠧ祭  ⮭,    ᬠਢ
 ࠧ  "梥"  મ.
     
     뢥    ⮭ ᫥⥫쭮   㣮, 
稬 祭    ,         ᭮
⥫ ᪨ 楤.        㤥  256
梥⮢ ० VGA 19,     稬 ⥫ ਧ  
襭 ࠧ襭   720*348   ஬   ०.   
襭 ࠧ襭 筮  ⢨ 梥⮢.
     
     ਢ  ⪠ 樮 ணࠬ DEMOHERC
뢮  ࠭  ⢥ "" ࠧ 蠡 客
( ⮭).
             
Program DEMOHERC;
uses crt,dos,graph,Hercules;
var GraphMode, GraphDriver : integer
Procedure ShowPalette;  { 뢮   ࠭ }
var x,y,Color:integer;  { । ६ }
 begin                  { 窨   ⥭ ண }
  outtextxy(1,20,': ஬
    䨪 Hercules/० IBM 7');
  for Y := 100 to 200 do begin  { ᮢ ப, ᢥ- }
    for X := 0 to 720 do begin
      Color:=X div 2;
      if Color>255 then Color:=Color-256;
       plot(X,Y,Color);         { 뢮  ࠭ }
    end;
  end;
 end;
begin
GraphDriver := HercMono;  GraphMode := HercMonoHi;
InitGraph(GraphDriver, GraphMode,'');
ShowPalette;
end.
     
      ਢ  ணࠬ      ,  㦨
 ஡ ᬮ७.  -,       
横,     ணࠬ  ࠡ뢠     720  348
ᥫ ࠭.
     
     ᪮ 梥      ࠧ       ࠭    
ਧ⠫,   ५    祭ﬨ  x.    
ᮧ ᫥⥫쭮 ⨪ ,    
।⠢ ⤥  梥.  稢  楤  ணࠬ,
 ᬮ ᯮ짮  SHOWPALETTE  뢮    ࠭
⥪饩 .
     
      ࠢ    ࠭,  稭  樨 512  ,  
७  梥, ⮡    ࠭.
     
9.1.4  ᢮  뢠 梥⮢ ᥫ  
       楤 "PEEK(Hercules)"
-----------------------------------------------------------------
     
      ᪮쪮    ⥫    ,        ᬮ
ᯮ짮     ⮭.  騥  뫨 ᮧ
ᯥ樠쭮  ஬ ० Hercules.
     
      ᮧ   PLOT    ᯮ짮  ⠭⭮
 ᪠ PUTPIXEL.      뢮
 ࠭:  梥⮬ 0 ()  1 ().
     
     ⢥  GETPIXEL ᯮ   뢠
 梥  ᥫ    न⠬ x,y   祭
祭  ६.
     
procedure PEEK(x,y:integer; var OldColor:integer);
        { 頥  梥 }
begin   { ᥫ  ᪮ ० }
  OldColor := GetPixel(x,y);
end;
     
     楤 PEEK  㦥 㭪,   ⠭⭠ 
᪠ GETPIXEL.  ।  梥    믮 饭
ᯮᮡ.
     
        PEEK()  㤥  ᯮ짮      প
ᮢ⨬  㣨 ﬨ.
     
     ,   ,     楤 PEEK 
 饩  ⨢  楤  PLOT.  
客, ᮧ騥  ⮭,    ⮫쪮  ⥩
࠭. 뢠 ⤥쭮 ᥫ   祭 0   1,
 䠪᪨ 祣  ᪠   "梥"  .
     
         ᯮᮡ   ⥬        訬  
뢠 ଠ樨  梥  ᥫ    楫  ।
࠭ ଠ樨.
     
9.1.5  楤 BLOCK(Hercules)
-----------------------------------------------------------------
     
     , ᮧ 楤    ஬  䨪  PLOT  
PEEK,   ᬮ  ᮢ  ࠭ 䨣.
     
     ਬ஬   㦨  ਢ    楤  BLOCK,
      ࠭   襭   אַ㣮쭨.   
ਭ ࠭ न,    ⠭⭠ 
᪠ BAR.  稥  ⮨  ⮬,   BLOCK ஬ ⮣
ਭ  梥    ⮭.
     
      楤  ஥  ᯮ짮 楤 PLOT,
 ᯮ   ⠭      PUTPIXEL.    室
न ஢      ⠬,  ᫨ ᯮ 
୮ 浪.   ⥬      אַ㣮쭮    
믮    横:
     
procedure BLOCK(x1,y1,x2,y2:integer;Color:integer);
  var xk,yk,Save:integer; {  梥⭮ (襭) אַ㣮쭨 }
begin                     {  室 祭  ⠬ }
 if x2<x1 then begin Save:=x1; x1:=x2; x2:=Save; end;
 if y2<y1 then begin Save:=y1; y1:=y2; y2:=Save; end;
 for xk:=x1 to x2 do begin
  for yk:=y1 to y2 do begin
    if (xk<720) and (xk>-1) and (yk<349) and (yk>-1) then
     Plot(xk,yk,Color);   { ᮢ 窨 }
    end;
end; end;
     
         横     ਧ⠫  ,    ன
ࠢ न⠬ y ( ⥬,  ᪮쪮 ࠧ   ),
 אַ㣮쭨        㤥   襭.      ਢ
樮 ணࠬ,  ன ᯮ ⮢ 
HERCULES.TPU (ᬠਢ ).
     
program DEMO_BLOCK_HERCULES;
uses crt,dos,graph,Hercules;   {  Hercules 易⥫ }
var x,y : integer;
    ch  : char;
begin
 randomize;
 ModeHercules;
 outtextxy(1,20,' Block(x1,y1,x2,y2,Color:Integer);');
 outtextxy(1,28,'  ...    ⮭    ');
 Zerokey;
 repeat
    x:=random(random(720))+1;y:=random(174)+60;
    Block(x,y,x+x div 10,y+x div 10,random(265));
 until keypressed;
 closegraph;
 restorecrtmode;
end.
     

9.1.6  楤 CIRCLE/DISK(Hercules)
-----------------------------------------------------------------
     
     楤 CIRCLE     DISC  (.    ⨭    ᪥)
ᯮ   ᮢ  襭  㣮    ᮢ   
஬ ᪮    ०.      ⠪   ஥   
ᬮ७  楤.   室  MODEHERCULES,
 ᪨  ०,     PLOT,  ᯮ㥬 
ᮢ.
     
      砥,   楤  ⠪  祭 
 ணࠬ,  ᯮ  .   ⨢ 砥
CIRCLE  DISK  ࠡ.
     
     CIRCLE  DISK ਭ  न  x/y  業ࠫ쭮  窨
, 祭  ࠤ    x      y,    ⠪  梥.
⥫ 祭 ࠤ ⠭ ࠢ묨 0, ⠪ 
 ॠ쭮  䨪  㦭   ࠧ஬   窨 
।.
     
     ⨭ CIRCLE        DISK        楤ࠬ    
ᮮ⢥騬       VGA19.TPU,     
   ⠭. ⨭ 樮 ணࠬ DEMOCIRCLE
/ DISK / FRAME(HERCULES) .  ᪥.
     
9.1.7  ᮢ   ࠬ  ஬ ᪮ ०
-----------------------------------------------------------------
     
     ⨭     楤          楤ࠬ     
ᮮ⢥騬        VGA19.TPU,    
   ⠭.
     
      ⠪ ᯮ  楤 PLOT  Hercules. 
ਢ 樮   ணࠬ,  ᯮ  楤
LINE  FRAME  ᪮ ० Hercules:
     
program DEMO_FRAME_HERCULES;
uses crt,dos,graph,Hercules;   {  Hercules 易⥫ }
var x,y,z : integer;
    ch  : char;
    sta : string;
begin
 randomize;
 HerculesMode;
 for x:=-5 to 75 do
   frame(50+x*4,50+x*4,670-x*4,298-x*4,x +160);
 Zerokey;
 ch:=readkey;
 closegraph;
 restorecrtmode;
end.
                              
     
9.2  樠஢ ᪨   Hercules
-----------------------------------------------------------------
     
      ࠧ 뢠 ⥫ ,  騥
 楤, ᬮ७  .  ⭮, 
ᯮ짮 楤  BLOCK,  LINE    DISK.       
楤   ᮢ  ,       梥⮬ 
஬   ⮭.   ⮣, ⮡ ਤ ꥪ
嬥 ,  室 ᮧ 蠡 , 騥
   ⮭.
     
      㥬    LINE,  ᮧ      
FEATHER.   ⠪ ᮧ  襣 ७  
Hercules 饭  楤  ᮢ         
HORIZONTAL. ஢     ᮢ    ᭮
㤥 COLUMN,    DISK  㤥  ஢        
BALL(Hercules).
     
           ᮧ         ⥫    ਠ樨
MIXHORIZONTAL, MIXBALL   MIXCOLUMN.  ᫥  ⠪  室  
⮢  ७  Hercules,     ⠪ , 
뫨  VGA19.TPU.   易  ⥬,    ᬥ訢  ࠧ
蠡       ஬   ०       ⮫
⫨ 䥪.
     
     ⨭ 楤    ᮮ⢥騬  楤ࠬ  
 VGA19.TPU.    뫠  ⥫   ⨭  ஡
ᠭ, ਢ  ᮮ⢥饬 ࠧ .
     
9.2.1  " ⮭ "
-----------------------------------------------------------------
     
      ॡ           ࠧ묨  梥⠬
""  ஬  ०    ᯮᮡ    ᠬ
.     ஢   砥
ந쭮 ᯮ         蠡    
饥     १         ⠪   㤥
ந,             䥪    嬥୮
ࠦ.
     
        १⮬ ࠡ 楤 PLOT. 
 ᠬ 楤,  ன ந室 ᮧ ࠧ 
⮭ 蠡  客.   楤 ࠧࠡ뢠  ⠪
⮬, ⮡ ᮧ  ண  ⮭ .
 ࠧ,    ࠭    梥⮢   㤥
ࠢ,  ஢  १ ᪠窮 મ.    ᪥
   ᬮ  ⨭  ⥫  樮
ணࠬ.
     
     ० 祬      ७    Hercules
 ஢   ०   VGA   19   ,     㦭  
   .
     
     襩   訢   ࠭    
⮭  蠡 ,  ० 祬 㯠  ᮢ
⨭  । .   ⨢  砥  ⠫  㭪
      䫨饣 䮭 梥.
 梥 ᪨ ०   ᤥ    CLRSCR
 ࠭ 梥 䮭.
     
      ⠭⭠    CLRSCR   砥  祭
室, ᪮      㭪樨  ஬  ᪮
० DOS-ᮢ⨬.  楤,  BLOCK,   
믮 㭪権 த ⪨  ࠭.    横  
ணࠬ ᫨誮   ⮣.
     
              ⥫쭠  ணࠬ  
⪨ ࠭      ࠭  ࠫ  
梥⮬   .    ᥣ    ⪨  ࠭  
 祭 -०  樠  䨪.  ⥬
࠭  横 ணࠬ   ⮭  .
     
Program GreyBackground;
 uses crt,dos,graph;
 var X,Y,Z,Color:integer;
     ch         : Char;
Procedure ModeHercules;
 var GraphMode, GraphDriver:integer;
 begin
   GraphDriver:=HercMono; GraphMode:=HercMonoHi;
   Initgraph(GraphDriver,GraphMode,'');
 end;
begin
ModeHercules; directvideo:=false;
outtextxy(20,25,'ਬ:  䮭');
for x:=0 to 10000 do
  PutPixel(Random(721),Random(80),1);
for x:=0 to 10000 do
  PutPixel(Random(721),Random(268)+80,1);
for x:=0 to 10000 do
  PutPixel(Random(Random(722)),Random(349),1);
  repeat
  for x:=0 to 30000 do
    PutPixel(Random(Random(Random(723))),Random(349),0);
  until keypressed;
  outtextxy(20,25,'ਬ:  䮭');
  ch:=readkey; closegraph; restorecrtmode;
end.
     
9.3  ஢ ० VGA 19  ० Hercules
-----------------------------------------------------------------
     
      ࠧ稥    楤ࠬ    㫥  Hercules  
㫥 VGA19  ⮨    楤   PLOT.   ஬   ⮣,   
ᯮ짮  ணࠬ  ࠧ -०  뢠 
ࠧ  ࠧ ࠭. ஬ ᪨ ࠭ 
 720  ப    ਧ⠫    349 ப  ⨪.  
⨢ 砥 㭪樨  ⠭⭮   GRAPH.TPU  
뫮  ᯮ짮  - ८।.
     
     楤   ᣫ    ᬥ襭  梥⮢  ० 19 
 Hercules    祭,  ᪮    ᮢ⨬   
⭮ ᯥ祭.
     
         ⠪    ᯮ짮  -⥪.
楤 MINIPRINT,  MINITEXTXY  GLASPRINT 뫨  ஢
 ࠡ   ।.   ⮬    ᪠
VGA19.PAS/VGA19.TPU ॢ⨫               ᪠
HERCULES.PAS/HERCULES.TPU.      ⨭     ⮣    
⠢  ᪥  ணࠬ.
