TIP: Click on subject to list as thread! ANSI
echo: quik_bas
to: ALL
from: ROBERT KOHL
date: 1998-05-13 21:37:00
subject: CodeFAQ Part 4 of 11

------------------- CodeFAQ Part 4 of 11 ------------------------
   delay = whatever
   t! = INT(TIMER)
   DO
      IF t!  INT(TIMER) THEN
         t! = INT(TIMER)
         count = count + 1
         PRINT count
      END IF
   LOOP UNTIL count = delay
   This routine doesn't care what the reading of TIMER is, only
   that it has changed.  A roll-over at midnight is just as valid
   a change as an increase of one second.  If you want 1/10's of a
   second, you'll need to alter accordingly.  Since TIMER ticks at
   18.2 times a second, the smallest interval will be 0.0549450549
   sec.
[end quote]
   If you're looking for something else, Chad Beck suggests the
   following:
[quote]
   Here's a delay routine[...]:  it's small, it doesn't use
   floating point values, it has an 18th of a second accuracy,
   and it accounts perfectly for midnight.  Num18ths is the number
   of 18ths of a second that you want to delay for.  [In other
   words, Num18ths is the number of seconds you want in the delay,
   times 18 -- or, more accurately, 18.2.]
   DEFINT A-Z
   DEF SEG = 0
   FOR Delay = 1 to Num18ths
      Timr = PEEK(&H46C) 'Read BIOS timer tick count
      DO
      LOOP WHILE Timr = PEEK(&H46C)
   NEXT
[end quote]
4) WHAT ARE INTERRUPTS, AND HOW DO I USE THEM?
   INTERRUPTs are built-in general purpose functions that can be
   accessed by a programmer of most every language.  They can
   really give you some nice results.  Essentially, they add many
   useful functions to the Basic language.  One note here: they
   MUST be done in QuickBasic, as QBasic doesn't have the CALL
   INTERRUPT option.  Also, you *must* load QB with the /L switch.
   The first step is to include the QuickBasic include file at the
   beginning of your program:
   '$INCLUDE: 'qb.bi'
   This includes the TYPE definitions required to use the
   INTERRUPTs.  The next statement to enter, when you want to use
   an INTERRUPT, is:
   DIM InReg AS RegType, OutReg AS RegType
   You can call InReg and OutReg anything you want, but it's a
   good idea to make sure you know which is "in" and which is
   "out."  You can now assign values to the AX, BX, CX, DX, BP,
   SI, DI, and Flags "registers" now defined in InReg and
   OutReg.  InReg has registers that go into the INTERRUPT;
   from the elements in InRegs, the INTERRUPT reads what it's
   supposed to do.  OutReg has the registers that the INTERRUPT
   passes any output to.  To assign values to the registers, do it
   just like a normal variable:
   InReg.ax = &H4F02   'stands for 4F02, base-16 (HEX)
   InReg.bx = &H101    'stands for 101, base-16 (HEX)
   Once you have the appropriate values in the registers, you are
   ready to call the INTERRUPT.
   CALL INTERRUPT(IntNumber, InReg, OutReg)
   IntNumber is the number of the INTERRUPT you want to call.  For
   example, 10h (10, base-16 or HEX) is the screen INTERRUPT, so
   you'd call it like this:
   CALL INTERRUPT(&H10, InReg, OutReg)
   Any values that the INTERRUPT is supposed to return will be
   stored in the OutReg, and can be checked like you would any
   other variable:
----------- CodeFAQ ends Part 4 of 11 --------------------------
Robert (Bob) Kohl  Rio Rancho, New Mexico
Home Page:  http://www.geocities.com/SiliconValley/Way/7854
            http://members.tripod.com/~Bob_Kohl/index.html
Internet: bobakohl@abq.com  bobakohl1@juno.com  barbarianh@aol.com
--- Blue Wave/DOS v2.30
(1:301/45)
---------------
* Origin: * Binary illusions BBS * Albuquerque, NM * 505.897.8282 *

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.