'>>> Page 5 of CODE0498.FAQ begins here.
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:
IF OutReg.Bx = 10 THEN [...]
A note: QB also offers the CALL INTERRUPTX function, which
does the exact same thing as CALL INTERRUPT, but it allows you
to use two extra registers, DS and ES. Everything is exactly
the same as CALL INTERRUPT except that you add an "X" on the
end.
So, this is all great you say, but how do I figure out which
INTERRUPT will do what? Good question. You can't, on your
own. It's a severe understatement to say that poking around
with INTERRUPTs is pretty dangerous if you don't know what
you're tapping into. You're going to need to keep your eyes
open for a list of INTERRUPTs, and there are a lot of them --
INTs, that is. The best list out there is Ralf Brown's
Interrupt List, which should be on any program-oriented BBS in
your area. Check out the No-Code FAQ for more information on
where to find it (or do a web search for it).
5) CAN I USE INTERRUPTS WITH QBASIC?
Thanks to Hans Lunsing, yes! This routine uses QBasic's CALL
ABSOLUTE feature to run the appropriate machine code so that if
you're stuck with QBasic, you too can enjoy the power of
INTERRUPTs:
[begin]
' InterruptX
' Interrupt procedure for QBASIC
' By Hans Lunsing
' Edited to fit FidoNet QB Code FAQ by Dave Shea
' --------------------------------------------------------------
DEFINT A-Z
' Register type for use with InterruptX
TYPE RegTypeX
Ax AS INTEGER
BX AS INTEGER
CX AS INTEGER
DX AS INTEGER
BP AS INTEGER
SI AS INTEGER
DI AS INTEGER
Flags AS INTEGER
DS AS INTEGER
ES AS INTEGER
END TYPE
CONST FALSE = 0, TRUE = NOT FALSE
DECLARE SUB InterruptX (IntNo%, Inreg AS RegTypeX, OutReg AS_
RegTypeX)
'---------------------------------------------------------------
' The machine code of the interrupt procedure for InterruptX
'---------------------------------------------------------------
InterruptXASM:
'>>> Page 5 of CODE0498.FAQ ends here. Continued on next page.
___
* SLMR 2.0 * Veni Vedi Velcro: I came, I saw, I stuck around.
--- Maximus/2 3.01
---------------
* Origin: The I.O. Board - 4GB -XX- V34+ (1:2255/10)
|