home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / PERFORM / CURSOR.PAS < prev    next >
Pascal/Delphi Source File  |  1993-01-13  |  1KB  |  74 lines

  1. {$IFDEF VER70}
  2. {$A+,B-,D-,E-,F-,G+,I-,L-,N-,O-,P-,Q-,R-,S+,T-,V-,X+}
  3. {$ELSE}
  4. {$A+,B-,D-,E-,F-,G+,I-,L-,N-,O-,R-,S+,V-,X+}
  5. {$ENDIF}
  6. {$M 16384,0,655360}
  7. uses Crt,Dos;
  8.  
  9. var TimerTick: Word absolute $0040:$006C;
  10.     StartTick: Word;
  11.     Reps: LongInt;
  12.  
  13.  
  14.     Const BiosInt = $10;
  15.  
  16.     procedure SetCursor(X,Y: Byte);
  17.     var Regs: Registers;
  18.     begin
  19.       with Regs do
  20.       begin
  21.         AH := $02;
  22.         BH := 0;
  23.         DL := X;
  24.         DH := Y
  25.       end;
  26.       Intr(BiosInt,Regs)
  27.     end {SetCursor};
  28.  
  29.     procedure SetCursorBASM(X,Y: Byte); Assembler;
  30.     ASM
  31.          mov   AH,$02
  32.          xor   BH,BH
  33.          mov   DL,X
  34.          mov   DH,Y
  35.          int   BIOSINT
  36.     end {SetCursorBASM};
  37.  
  38.  
  39.     var X,Y: Array[1..10240] of Byte;
  40.  
  41.  
  42.  
  43. begin
  44.   ClrScr;
  45.   RandSeed := 0;
  46.   for Reps:=1 to 10240 do
  47.   begin
  48.     X[Reps] := Random(80);
  49.     Y[Reps] := Random(25)
  50.   end;
  51.  
  52.   Reps := 0;
  53.   StartTick := TimerTick;
  54.   while StartTick = TimerTick do {wait for end of TimerTick};
  55.   StartTick := TimerTick;
  56.   repeat
  57.     SetCursor(X[Reps],Y[Reps]);
  58.     Inc(Reps)
  59.   until StartTick <> TimerTick;
  60.   GotoXY(1,1);
  61.   writeln(' SetCursor: ',Reps);
  62.  
  63.   Reps := 0;
  64.   StartTick := TimerTick;
  65.   while StartTick = TimerTick do {wait for end of TimerTick};
  66.   StartTick := TimerTick;
  67.   repeat
  68.     SetCursorBASM(X[Reps],Y[Reps]);
  69.     Inc(Reps)
  70.   until StartTick <> TimerTick;
  71.   GotoXY(1,2);
  72.   writeln(' SetCursorBASM: ',Reps);
  73. end.
  74.