Interrupts

 BBS: Inland Empire Archive
Date: 06-12-92 (06:12)             Number: 199
From: PHIL HODGES                  Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Interrupts                     Conf: (2) Quik_Bas
   In order to further myself as a programmer (and to prove to myself
that you don't have to know C to use complicated DOS features), I went
out and purchased a book called "MS-DOS Functions" by Ray Duncan.  This
book covers each system service accessed via interrupts 20H through 2FH
along with a list of the params or args the service requires, the
results it returns, etc.  It's really a great book.  Thing is, I'm not
sure if I fully understand still how to use them.  Looking at the online
example for CALL INTERRUPT helped a little (but WHY did they use
INT86OLD ???).  Still, I'm not totally clear on this.

   Here's why I'm so confused.  This is an example (don't remember where
I got it) of how to check DOS version:

'$INCLUDE: 'QB.BI'
DIM Regs AS RegType
Regs.ax = &H3000
CALL INTERRUPT(&H21, Regs, Regs)
MajorVersion = Regs.ax MOD 256
MinorVersion = Regs.ax \ 256
PRINT USING "Current DOS version #!##"; MajorVersion; "."; MinorVersion

  The book says that 21H function 30H gets the DOS version number.  From
the above example I can conclude that the H is 00, therefore &H3000 is
function 30H.  Seems easy enough to understand.
  What I _don't_ understand is how the above code works. The book lists
the returns as:
  AL = major version number
  AH = minor version number
  BH = original equipment manufacturers serial number
  BL:CX =24-bit user serial number (optional, OEM dependent)

  Anyone know enough about this to help me out a little? The book is
really good...on the back it says "Whether you're a casual programmer or
a professional assembly-language or C programmer..."  Hehe..CASUAL?
This book is for moderately advanced programmers at minimum.  So...
any help?

  {a little later}

  Well, this message is getting rather lengthy...I think I have a better
grasp on it now!  After a little tinkering, I figured out how to
successfully use Int 21H, function 09H (display string...didn't want to
start with something dangerous!)....

___---------------------------------------------------
'TESTING INTERRUPTS (AGAIN)
'$INCLUDE: 'QB.BI'

DEFINT A-Z
DIM SHARED InRegs AS RegTypeX, OutRegs AS RegTypeX

CLS
Strng$ = "This is ONLY a test!$"   '$ necessary to terminate string

 InRegs.ds = VARSEG(Strng$) ' Load DS:DX with
 InRegs.dx = SADD(Strng$)   ' address of Strng$
 InRegs.ax = &H900

 CALL INTERRUPTX(&H21, InRegs, OutRegs)
___---------------------------------------------------

 Et voila!  Now onto others...still, any help?

___
 X SLMR 2.1a X Stack Overflow...WAY too much syrup!

--- Maximus 2.00
 * Origin: The Gamorian Vortex Project (1:105/601)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET