home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / PASCAL / VGAINTRO / CYLINDER.PAS < prev    next >
Pascal/Delphi Source File  |  1993-12-01  |  8KB  |  332 lines

  1. Program Cylinder_Scroll;
  2.  
  3.   Const CGA_CharSet_Seg = $0F000;
  4.         CGA_CharSet_Ofs = $0FA6E;
  5.         VGA_Segment = $A000;
  6.         
  7.         ScrollYPos = 80;
  8.         Radius = 30;
  9.         NumSlices = 90;
  10.         AngleInc = 2*Pi / NumSlices;
  11.  
  12.         Spacing = 4;
  13.  
  14.         PW = 'Esselete';
  15.  
  16.         NumXCoords = 300 Div Spacing;
  17.         CharColor = 1;
  18.  
  19.  
  20. DispStr : Array[1..149] Of Byte =
  21. (101,147,147,133,140,133,148,133,101,147,191,180,173,169,185,183,101,181,
  22. 204,133,178,183,185,169,101,193,188,170,192,191,183,173,138,147,147,133,
  23. 140,133,148,133,101,147,147,147,154,147,183,170,147,199,184,183,188,180,
  24. 189,179,153,148,147,167,174,184,148,141,120,163,164,142,140,152,164,158,
  25. 114,163,164,153,160,147,162,147,101,147,147,133,140,133,198,186,147,193,
  26. 188,179,179,133,195,179,101,200,198,183,140,150,168,147,121,147,183,186,
  27. 173,177,160,133,126,169,163,149,151,133,195,179,145,204,147,133,140,133,
  28. 148,133,152,204,198,180,188,159,148,171,151,184,183,133,186,174,185,185,
  29. 159,182,187,170,140 );
  30.  
  31. NumDispChars = 149;
  32.         CharLength      = 8;
  33.         NumChars        = 256;
  34.  
  35.  
  36.   Type  OneChar =Array[1..CharLength] Of Byte;
  37.  
  38.  
  39.   Var   ScreenPath : Array[1..8*80] Of Word;
  40.         CurrentLine,
  41.         CurrentArrayLoc  : Integer;
  42.         DispChars   : Array[1..NumDispChars*64] Of Byte;
  43.         CharSet : Array[1..NumChars] Of OneChar;
  44.         Password : String;
  45.  
  46.         KeyHit : Boolean;
  47.         Int9Vec : LongInt;
  48.  
  49.  
  50.   Procedure VideoMode ( Mode : Byte );
  51.  
  52.     Begin { VideoMode }
  53.       Asm
  54.         Mov  AH,00
  55.         Mov  AL,Mode
  56.         Int  10h
  57.       End;
  58.     End;  { VideoMode }
  59.  
  60.  
  61.   Procedure GetChars;
  62.  
  63.     Var NumCounter,
  64.         ByteCounter,
  65.         MemCounter   :Integer;
  66.  
  67.     Begin { GetChars }
  68.       MemCounter:=0;
  69.       For NumCounter:=1 To NumChars Do
  70.         For ByteCounter:=1 To CharLength Do
  71.           Begin
  72.             CharSet[NumCounter][ByteCounter]:=Mem[CGA_CharSet_Seg:CGA_CharSet_Ofs+MemCounter];
  73.             Inc(MemCounter);
  74.           End;
  75.     End;  { GetChars }
  76.  
  77.  
  78.   Procedure SetColor ( Color, Red, Green, Blue : Byte );
  79.  
  80.     Begin { SetColor }
  81.       Port[$3C8] := Color;
  82.       Port[$3C9] := Red;
  83.       Port[$3C9] := Green;
  84.       Port[$3C9] := Blue;
  85.     End;  { SetColor }
  86.  
  87.  
  88.   Procedure BuildPath;
  89.  
  90.     Var YCount,
  91.         XCount,
  92.         ArrayPtr  : Integer;
  93.         CurrAngle : Real;
  94.  
  95.     Begin { BuildPath }
  96.       CurrAngle := Pi;
  97.       ArrayPtr := 1;
  98.       For XCount := 1 To NumXCoords Do
  99.         Begin
  100.           For YCount := 1 To 8 Do
  101.             Begin
  102.               ScreenPath[ArrayPtr] := (ScrollYPos + Round(Radius*Sin(CurrAngle)))*320
  103.                                       + (XCount-1)*Spacing + 1;
  104.               CurrAngle := CurrAngle + AngleInc;
  105.               Inc(ArrayPtr);
  106.             End;
  107.           CurrAngle := CurrAngle - 7*AngleInc;
  108.         End;
  109.     End;  { BuildPath }
  110.  
  111.  
  112.   Procedure BuildCharArray;
  113.  
  114.     Var ShearYCnt,
  115.         ShearXCnt,
  116.         Count,
  117.         ArrayPtr   : Integer;
  118.         TempByte   : Byte;
  119.  
  120.     Begin { BuildCharArray }
  121.       ArrayPtr := 1;
  122.       For Count := 1 To NumDispChars Do
  123.         Begin
  124.           TempByte := DispStr[Count] - Ord(Password[((Count-1) Mod Length(Password))+1]);
  125.           For ShearXCnt := 1 To 8 Do
  126.             For ShearYCnt := 1 To 8 Do
  127.               Begin
  128.                 If Mem[CGA_CharSet_Seg:CGA_CharSet_Ofs+TempByte*8+ShearYCnt-1] And ($80 Shr (ShearXCnt-1)) = 0
  129.                   Then DispChars[ArrayPtr] := 0
  130.                   Else DispChars[ArrayPtr] := CharColor;
  131.                 Inc(ArrayPtr);
  132.               End;
  133.         End;
  134.     End;  { BuildCharArray }
  135.  
  136.  
  137.   Procedure Cycle;
  138.  
  139.     Label Wait,Retr,Loop1,Loop2,Continue1,Continue2,Continue3,Continue4,
  140.           Continue5;
  141.  
  142.     Begin { Cycle }
  143.       Asm
  144.           MOV   AX,VGA_Segment
  145.           MOV   ES,AX
  146.           MOV   DI,(ScrollYPos-Radius)*320
  147.           MOV   CX,160*Radius*2+320
  148.  
  149.           MOV   DX,3DAh
  150. Wait:     IN    AL,DX
  151.           TEST  AL,08h
  152.           JZ    Wait
  153. Retr:     IN    AL,DX
  154.           TEST  AL,08h
  155.           JNZ   Retr
  156.  
  157.           XOR   AX,AX
  158.           REP   STOSW
  159.  
  160.           MOV   BX,CurrentLine
  161.           MOV   CL,3
  162.           SHL   BX,CL
  163.           MOV   DX,BX
  164.  
  165.           MOV   AX,NumXCoords
  166. Loop1:
  167.           MOV   CX,8
  168. Loop2:
  169.           CMP   Byte Ptr DispChars[BX],0
  170.           JE    Continue2
  171.  
  172.           PUSH  BX
  173.           {Put Dot}
  174.           SUB   BX,DX
  175.           SHL   BX,1
  176.           MOV   DI,Word Ptr ScreenPath[BX]
  177. {          PUSH  DX
  178.           MOV   DX,CurrentArrayLoc
  179.           SHL   DX,1
  180.           SHL   DX,1
  181.           SUB   DI,DX
  182.           CMP   DI,NumXCoords*Spacing+ScrollYPos*160
  183.           JLE   Continue1
  184.  
  185.           ADD   DI,NumXCoords*Spacing
  186. Continue1:
  187.           POP   DX }
  188.           MOV   Byte Ptr ES:[DI],CharColor
  189.           POP   BX
  190.  
  191. Continue2:
  192.           INC   BX
  193.           CMP   BX,(NumDispChars-1)*8*8
  194.           JNG   Continue3
  195.           XOR   BX,BX
  196.           XOR   DX,DX
  197. Continue3:
  198.           LOOP  Loop2
  199.  
  200.           DEC   AX
  201.           JNZ   Loop1
  202.  
  203.           INC   CurrentLine
  204.           CMP   CurrentLine,(NumDispChars-1)*8
  205.           JNG   Continue4
  206.           MOV   CurrentLine,0
  207.  
  208. Continue4:
  209.           INC   CurrentArrayLoc
  210.           CMP   CurrentArrayLoc,73
  211.           JNG   Continue5
  212.           MOV   CurrentArrayLoc,0
  213.  
  214. Continue5:
  215.  
  216.       End;
  217.  
  218.     End;  { Cycle }
  219.  
  220.  
  221.   Procedure SetInt9 ( I9Seg,I9Ofs : Word );
  222.  
  223.     Begin { SetInt9 }
  224.       Asm
  225.         PUSH    DS
  226.  
  227.         MOV     AH,35h
  228.         MOV     AL,09h
  229.         INT     21h
  230.         MOV     Word Ptr Int9Vec,BX
  231.         MOV     Word Ptr Int9Vec[2],ES
  232.  
  233.         MOV     AX,I9Seg
  234.         MOV     DS,AX
  235.         MOV     DX,I9Ofs
  236.         MOV     AH,25h
  237.         MOV     AL,09h
  238.         INT     21h
  239.  
  240.         POP     DS
  241.       End;
  242.     End;  { SetInt9 }
  243.  
  244.  
  245.   Procedure DisInt9;
  246.  
  247.     Begin { DisInt9 }
  248.       Asm
  249.         PUSH    DS
  250.         MOV     DX,Word Ptr Int9Vec
  251.         MOV     AX,Word Ptr Int9Vec[2]
  252.         MOV     DS,AX
  253.         MOV     AH,25h
  254.         MOV     AL,09h
  255.         INT     21h
  256.         POP     DS
  257.       End;
  258.     End;  { DisInt9 }
  259.  
  260.  
  261.   Procedure Int9;
  262.  
  263.   Interrupt;
  264.  
  265.     Begin { Int9 }
  266.       Asm
  267.         PUSHF
  268.         CALL    Int9Vec
  269.         INC     KeyHit
  270.       End;
  271.     End;  { Int9 }
  272.  
  273.  
  274.   Procedure DrawString ( XPos,YPos,Size : Integer; Color : Byte; Str : String );
  275.  
  276.     Var TempPos,
  277.         MemPos   : Word;
  278.         XSize,
  279.         YSize,
  280.         Count,
  281.         XCount,
  282.         YCount : Integer;
  283.         Letter : OneChar;
  284.  
  285.     Begin
  286.       MemPos := (YPos-1)*320+(XPos-1);
  287.       For Count := 1 To Length(Str) Do
  288.         Begin
  289.           Letter := CharSet[Ord(Str[Count])+1];
  290.           For YCount := 1 To 8 Do
  291.             For XCount := 1 To 8 Do
  292.               If Letter[YCount] And ($80 Shr (XCount-1)) <> 0
  293.                 Then Begin
  294.                   TempPos := MemPos+(YCount-1)*320*Size+(Count-1)*8*Size+(XCount-1)*Size;
  295.                   For XSize := 1 To Size Do
  296.                     For YSize := 1 To Size Do
  297.                       Mem[VGA_Segment:TempPos+(XSize-1)+(YSize-1)*320] := Color;
  298.                 End;
  299.         End;
  300.     End;
  301.  
  302.  
  303.   Var   Count,
  304.         XCount : Integer;
  305.         CurrAngle : Real;
  306.  
  307.   Begin { Cylinder_Scroll }
  308.  
  309.     SetInt9 (Seg(Int9),Ofs(Int9));
  310.     KeyHit := False;
  311.  
  312.     Password := PW;
  313.     VideoMode($13);
  314.     GetChars;
  315.     SetColor(CharColor,63,63,63);
  316.     SetColor(4,63,0,0);
  317.     SetColor(5,63,63,63);
  318.     BuildCharArray;
  319.     BuildPath;
  320.     DrawString(64,150,1,4,'Loader by Fred Nietzche');
  321.     DrawString(16,160,1,5,'Call CenterPoint! BBS (301) 309-0144');
  322.     CurrentLine := 0;
  323.     CurrentArrayLoc := 0;
  324.     Repeat
  325.       Cycle;
  326.     Until KeyHit;
  327.     VideoMode($3);
  328.  
  329.     DisInt9;
  330.  
  331.   End.  { Cylinder_Scroll }
  332.