| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Code FAQ [6 /15 |
'>>> Page 6 of Code 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:
' Number of bytes
DATA 190
' Hexadecimal representation of machine code
DATA 55,8B,EC,8B,5E,0C,8B,17,0A,F6
'>>> Page 6 of Code FAQ ends here. Continued in next message.
* Brought to you by Greg's Little QBasic Auto-Poster *
--- Maximus 3.01
* Origin: The BandMaster, Vancouver, B.C., Canada (1:153/7715)SEEN-BY: 633/267 270 @PATH: 153/7715 140/1 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
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™.