vbdpss.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Article Q27287
                                                 Contents  Index  Back
─────────────────────────────────────────────────────────────────────────────
                           Knowledge Base Contents  Knowledge Base Index
 
 How to Assign High & Low Registers for CALL INTERRUPT, INT86 - Q27287
 
 When you invoke MS-DOS and ROM BIOS interrupts from Visual Basic for
 MS-DOS, you pass full-word (two-byte) register variables such as AX,
 instead of the half registers AH (high byte of AX) and AL (low byte
 of AX). This article describes how to assign or read half registers
 before or after calling the interrupt routines.
 
 More Information:
 
 You can use any of the following methods to assign values to high and
 low half-registers and load them into the full-word (two-byte)
 registers:
 
 1. The simplest method is to combine the hexadecimal values of the
    high and low registers into one hexadecimal constant:
 
    AX = &H0941             ' Where AH=&H09, AL=&H41
    BX = &H0002             ' Where BH=&H00, BL=&H02
    CX = &H07D0             ' Where CH=&H07, CL=&HD0
 
 2. The following is a more flexible method, letting you assign
    variables to the high and low registers with a formula:
 
    AX%, BX%, CX%, or DX% = (high% * 256) + low%
 
    In this case, "high%" and "low%" contain the decimal values that
    you want to assign to the high and low half-registers (where high%
    can be a value from 0 to 127). For example:
 
    high% = 9                   ' 9 = &H09
    low% = 65                   ' 65 = &H41
    AX% = (high% * 256) + low%    ' AX = 2369 = &H0941
 
    You will get an integer "Overflow" error if high% is 128 or larger.
    Use method 3 below if you need high% between 128 and 255.
 
 3. If you need the high byte (AH, BH, CH, or DH) to be a value from
    1 to 255, then you can POKE the value as follows:
 
    high% = 255
    low% = 65
    AX% = low%            ' Assigns low byte into AX%
    POKE VARPTR(AX%)+1,high%   ' Pokes the high byte into AX%
 
 Note that the following is a quick way to convert a decimal number to
 hexadecimal using the Immediate window in the VBDOS.EXE environment:
 
 PRINT HEX$(number)
 
 (To open the Immediate window select Immediate from the Window menu.
 Pressing F6 in the VBDOS.EXE environment lets you switch between
 windows. Pressing F4 toggles between viewing the editor and viewing
 the output screen.)
 
 The following formulas return the contents of the half registers,
 which are stored in the two bytes of a full register, such as AX,
 returned from an interrupt routine:
 
 AL% = AX% MOD 256 ' MOD operator returns integer remainder of division
 PRINT "The AL register contains &H"; HEX$(AL%)
 
 AH% = AX% \256  ' Integer division by 256 removes the lower byte.
 PRINT "The AH register contains &H"; HEX$(AH%)