home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / games / caddy24.zip / CADDY.PAS < prev   
Pascal/Delphi Source File  |  1988-05-27  |  7KB  |  180 lines

  1. {$M 17000,0,0}
  2. program caddy; {release 2.4 by Michael Taylor}
  3. uses Crt, Dos;
  4.  
  5. const
  6.    F1: boolean = false;
  7.    SPACEHIT: boolean = false;
  8.    F1KEY = $3B;
  9.    SPACEKEY = $39;
  10.  
  11. var
  12.    ScreenBuf: array[1..16384] of byte;
  13.    OldInt9: pointer;
  14.    Window: boolean;
  15.    ProgName: string[12];
  16.    CmdParm: string[40];
  17.    count: byte;
  18.  
  19. procedure GolfHelpProc(flags,CS,IP,AX,BX,CX,DX,SI,DI,DS,ES,BP:word);
  20. Interrupt;
  21. var
  22.    counter: word;
  23.    MemPtr: integer;
  24.  
  25. begin
  26.  
  27. Inline(
  28.                          {; *** getkey.asm - get key pressed}
  29.   $FB/                   {      sti                 ; allow int}
  30.   $9C/                   {      pushf}
  31.   $C6/$06/>F1/$00/       {      mov byte ptr [>F1],+$00        ;set F1 to false}
  32.   $C6/$06/>SPACEHIT/$00/ {      mov byte ptr [>SPACEHIT],+$00  ;set SPACEHIT to false}
  33.   $E4/$60/               {      in      al,$60                 ;read keyboard port}
  34.   $3C/<F1KEY/            {      cmp     al,<F1KEY              ;compare to F1}
  35.   $75/$08/               {      jne     schk                   ;jump if false}
  36.   $C6/$06/>F1/$01/       {      mov byte ptr [>F1],+$01        ;set F1 to true}
  37.   $E9/$09/$00/           {      jmp     next}
  38.   $3C/<SPACEKEY/         {schk: cmp     al,<SPACEKEY           ;check for space key}
  39.   $75/$05/               {      jne     next}
  40.   $C6/$06/>SPACEHIT/$01/ {      mov byte ptr [>SPACEHIT],+$01  ;set to true if space hit}
  41.   $90);                  {next: nop}
  42.  
  43.    if (F1) and (Window = false) then
  44.    begin
  45.            Window := true;
  46.            MemPtr:= $0000;
  47.            for counter := 1 to 16384 do
  48.            begin
  49.                ScreenBuf[counter] := Mem[$B800:MemPtr];
  50.                MemPtr := MemPtr + 1;
  51.            end {for};
  52.            GotoXY(6,1);
  53.            write('Online Caddy by Michael Taylor ');
  54.            GotoXY(6,2);
  55.            write('                               ');
  56.            GotoXY(6,3);
  57.            write('         Full   Short   Dotted ');
  58.            GotoXY(6,4);
  59.            write('                               ');
  60.            GotoXY(6,5);
  61.            write('Driver   270     250     143   ');
  62.            GotoXY(6,6);
  63.            write('3 Wood   252     229     131   ');
  64.            GotoXY(6,7);
  65.            write('4 Wood   238     216     116   ');
  66.            GotoXY(6,8);
  67.            write('2 Iron   224     207     109   ');
  68.            GotoXY(6,9);
  69.            write('3 Iron   214     197     105   ');
  70.            GotoXY(6,10);
  71.            write('4 Iron   199     185      96   ');
  72.            GotoXY(6,11);
  73.            write('5 Iron   188     172      91   ');
  74.            GotoXY(6,12);
  75.            write('6 Iron   173     158      82   ');
  76.            GotoXY(6,13);
  77.            write('7 Iron   162     148      74   ');
  78.            GotoXY(6,14);
  79.            write('8 Iron   148     136      69   ');
  80.            GotoXY(6,15);
  81.            write('9 Iron   137     125      56   ');
  82.            GotoXY(6,16);
  83.            write('P Wedge  121     111      50   ');
  84.            GotoXY(6,17);
  85.            write('                               ');
  86.            GotoXY(6,18);
  87.            write('Press SpaceBar to continue     ');
  88.  
  89.            Inline(
  90.            $E4/$61/ {Get: IN AL,$61             ;Read Kbd Controller Port}
  91.            $88/$C4/ { MOV          AH,AL}
  92.            $0C/$80/ { OR           AL,$80           ;Set reset bit}
  93.            $E6/$61/ { OUT          $61,AL           ;  send back to control}
  94.            $86/$C4/ { XCHG         AH,AL            ;Get back control value}
  95.            $E6/$61/ { OUT          $61,AL           ;  and send it back}
  96.            $9D/     { POPF                          ;restore flags}
  97.            $FA/     { CLI                           ;No interrupts}
  98.            $B0/$20/ { MOV          AL,+$20          ;Send EOI to the}
  99.            $E6/$20) { OUT         $20,AL            ; interrupt controller}
  100.    end
  101.    else
  102.    if Window then
  103.    begin
  104.        if SPACEHIT then
  105.        begin
  106.             Window := false;
  107.             MemPtr := $0000;
  108.             for counter := 1 to 16384 do
  109.             begin
  110.                 Mem[$B800: MemPtr] := ScreenBuf[counter];
  111.                 MemPtr := MemPtr + 1;
  112.             end {for};
  113.        end {if};
  114.  
  115.        Inline(
  116.        $E4/$61/ {Get: IN AL,$61             ;Read Kbd Controller Port}
  117.        $88/$C4/ { MOV          AH,AL}
  118.        $0C/$80/ { OR           AL,$80           ;Set reset bit}
  119.        $E6/$61/ { OUT          $61,AL           ;  send back to control}
  120.        $86/$C4/ { XCHG         AH,AL            ;Get back control value}
  121.        $E6/$61/ { OUT          $61,AL           ;  and send it back}
  122.        $9D/           {    POPF                     ;restore flags}
  123.        $FA/           {    CLI                      ;No interrupts}
  124.        $B0/$20/ { MOV          AL,+$20          ;Send EOI to the}
  125.        $E6/$20) { OUT         $20,AL           ; interrupt controller}
  126.    end
  127.    else
  128.  
  129.    Inline(
  130.    $9D/                  {     POPF}
  131.    $A1/>OLDINT9+2/       {     MOV     AX,[>OLDINT9+2]}
  132.    $8B/$1E/>OLDINT9/     {     MOV       BX,[>OLDINT9]}
  133.    $87/$5E/$0E/          {     XCHG    BX,[BP+$0E]}
  134.    $87/$46/$10/          {     XCHG    AX,[BP+$10]}
  135.    $89/$EC/              {     MOV     SP,BP}
  136.    $5D/                  {     POP     BP}
  137.    $07/                  {     POP     ES}
  138.    $1F/                  {     POP     DS}
  139.    $5F/                  {     POP     DI}
  140.    $5E/                  {     POP     SI}
  141.    $5A/                  {     POP     DX}
  142.    $59/                  {     POP     CX}
  143.    $CB);                 {     RETF}
  144.  
  145. end {procedure};
  146.  
  147. Begin
  148.      {check for alternate exe file}
  149.      if ParamCount > 0 then
  150.      begin
  151.           ProgName := ParamStr(1);
  152.           if  (pos('.com',ProgName) = 0)
  153.           and (pos('.COM',ProgName) = 0)
  154.           then
  155.                ProgName := ProgName + '.exe';
  156.      end
  157.      else
  158.           ProgName := 'golf.exe';
  159.  
  160.      {check for command line parameters}
  161.      CmdParm := '';
  162.      if ParamCount > 1 then
  163.           for count := 2 to ParamCount do
  164.                CmdParm := CmdParm + ' ' + ParamStr(count);
  165.  
  166.      {display message}
  167.      DirectVideo := false;
  168.      GetIntVec(9, OldInt9);
  169.      SetIntVec(9, @GolfHelpProc);
  170.      writeln('  Online Caddy');
  171.      writeln('     ver 2.4   ');
  172.      writeln('       by      ');
  173.      writeln(' Michael Taylor');
  174.      writeln(' ');
  175.      writeln('During Golf Game, press F1 to activate Caddy');
  176.      Window := false;
  177.      Exec(ProgName,CmdParm);
  178.      SetIntVec(9, OldInt9);
  179. End.
  180.