        
                   Quick reference of the DOS32 services.

                                                 Written by Adam Seychell

---------------------------------------------------------------------------
NAME:           "Allocate_Memory"

DESCRIPTION:    Allocate a memory block

EXPECTS:        EDX = Number of bytes to try and allocate
                      (NOTE:  BITS 0..11 ARE IGNORED )
           
RETURNS:        EAX = number of bytes that where actually allocated
                EDX = offset address in your program segment
                Carry flag is set if could not allocate as
                much memory as was requested.




---------------------------------------------------------------------------
NAME:           "GetDMAregion"

DESCRIPTION:    Allocates a 16KB contiguous memory block that does not cross
                a 64KB boundary and is in the lower 16MB    

EXPECTS:        Nothing

RETURNS:        If successful CF is clear and
                EBX = physical address of the 16KB DMA region
                  ( always less than 0FFC000h )
                EDX  = offset address in your program segment
                of the DMA region
     






---------------------------------------------------------------------------
NAME:           "GetIntVector"

DESCRIPTION:    Get the protected mode interrupt vector

EXPECTS:       BL = Interrupt number

RETURNS:       EDX = offset
               CX  = selector









--------------------------------------------------------------------------
NAME:          "SetIntVector"

DESCRIPTION:    Set the protected mode interrupt vector

EXPECTS:       EDX = offset address in you program segment
               BL  = Interrupt number

RETURNS:        nothing






--------------------------------------------------------------------------
NAME:           "GetIRQVector"

DESCRIPTION:    Get the hardware interrupt vector

EXPECTS:       BL = IRQ number  

RETURNS:       EDX = offset
               CX  = selector




--------------------------------------------------------------------------
NAME:           "SetIRQVector"

DESCRIPTION:    Set the hardware interrupt vector  

EXPECTS:       EDX = offset address in you code segment
               BL  = IRQ number

RETURNS:       NOTHING




--------------------------------------------------------------------------
MACRO NAME:      DOSINT  <interrupt number>

DESCRIPTION:    Invokes a interrupt in V86 mode.



--------------------------------------------------------------------------
MACRO NAME:         DOSCALL  <seg:offset>     

                or  DOSCALL  <seg>,<offset>

DESCRIPTION:    Invokes a far call in V86 mode.
                        



--------------------------------------------------------------------------
         Supported 32 bit DOS file I/O services


 Function AH=                 description

     0Eh            Set new default Drive
     19h            get current disk
     39h            Make Directory
     3Ah            Remove Directory
     3Bh            Change Directory
     3Ch            Create File
     3Dh            Open File
     3Eh            Close File
     3Fh            Read File Handel
     40h            Write File Handel
     41h            Delete File
     42h            Seek File
     43h            File Attributes
     47h            Get Directory
     4Bh            Load and Execute
     4Ch            Terminate Program      
     4Eh            Find First
     4Fh            Find Next
     56h            Rename file
     5Ah            Create Temporary file
     5Bh            Create New File


NOTES     Functions 3Fh and 40h will accept ECX as the number of
          bytes to transfer and return EAX with the acctual bytes transfered.
          The File seek service ( AH=42) uses EDX as the seeking position and
          returns the EAX with the new seeked postion.
           
























---------------------------------------------------------------------------
                    DOS32 MEMORY LOCATIONS

    Variable name             size             Description.


     CODE32_sel              :word           Selector for code segment       
     DATA32_sel              :word           Selector for data segment
     Zero_sel                :word           Selector for a segment that has
                                               a zero base address

     PIC1_Base               :byte           Base interrupt number for IRQ 0
     PIC2_Base               :byte           Base interrupt number for IRQ 8


                                               { REAL MODE segment values }
     PSP_segment             :word            PSP ( Program Segment Prefix )
     Environment_segment     :word            Environment segemnt


                                        { These contain 32bit near pointers }
     Environment_addr        :dword        offset of Environment
     PSP_addr                :dword        offset of the PSP                
     _0b8000h                :dword        offset to physical address 0B8000h
     _0a0000h                :dword        offset to physical address 0A0000h
     Zero_addr               :dword        offset to physical address 000000b


     CODE32_addr             :dword        Linear address of "CODE32"


     Real_GS                 :dword        V86 mode segment register values
     Real_FS                 :dword
     Real_DS                 :dword
     Real_ES                 :dword
     Real_SS                 :dword
     Real_SP                 :dword






                           End of DOS32 services 














                         THE LIBRARY QUICK REFERENCE


----------------------------RANDOM.ASM-------------------------------------
NAME:          "Random"

DESCRIPTION:   Generates a random number

EXPECTS:       CL with number of bits in the random number.

RETURNS:       EAX contains the random number




-----------------------------SQRT.ASM--------------------------------------
NAME:          "sqrt"

DESCRIPTION:   Calculates the square root

EXPECTS:       EAX value to square root.

RETURNS:       EAX contains the result






-----------------------------DMA.ASM-----------------------------------------
NAME:          "DMA_setup"

DESCRIPTION:   Programs a channel of the 8237 DMA controller

EXPECTS:       AL = Mode Register   ( bits 0..1 are ignored )
               AH = Channel Number    0..7
               EBX = Physical base Address  
               ECX = Number of bytes to transfer

RETURNS:       Nothing



--------------------------GUS.ASM--------------------------------------------

NAME:           "Ultrasound_Detect"

DESCRIPTION:    Detect the presents of the Ultrasound

EXPECTS:       NOTHING

RETURNS:  If successful then
           CF = 0
           DX = Base port address of the Ultrasound ( 210h, 220h,...,or 260h)
           EDI = RAM installed on the card ( 256KB, 512KB,768KB or 1MB )
           All of the Ultrasound port address variables are initialised
           ( see below for the list of these external variables )
           

-----------------------------GUS.ASM-----------------------------------------
NAME:           "Ultrasound_Reset"

DESCRIPTION:    Fully reset and initialise the Ultrasound

EXPECTS:       CL = PlayBack DMA channel  ( DMA must be either 1,3,5,6 or 7 )
               CH = Record DMA channel  
               BL = GF1 interrupt number (IRQ must be 2,3,5,7,11,12  or 15 )
               BH = MIDI IRQ number  
               
RETURNS:       CF=1 if not detected or a bad DMA or IRQ setting


--------------------------- GUS.ASM---------------------------------------
NAME:           "Ultrasound_Init"

DESCRIPTION:    Initialise the Ultrasound 32 voices

EXPECTS:        Nothing

RETURNS:        CF=1 if card not detected


---------------------------GUS.ASM---------------------------------------
NAME:           "GetUltraConfig"

DESCRIPTION:    Get parameters form the "ULTRASND=" environment variable     

EXPECTS:  Nothing
              
RETURNS:  If variable was found with valid parameters then CF=0 and 
          BL = GF1 interrupt number
          BH = MIDI IRQ number   ( 2,3,5,7,11,12 or 15 )
          CL = PlayBack DMA channel  
          CH = Record DMA channel  ( 1,3,5,6 or 7 )
          DX = Port Address    ( 210h, 220h, 230h, 240h, 250h or 260h )
          
          If Unsuccessful then CF=1.


----------------------------GUS.ASM--------------------------------------
                 The Ultrasound Port Addresses
These are valid only after one of the Ultrasound functions ( except for
GetULtraConfig ) have been successfully called.

                                             port number   ( x = 1..6 )
       GF1_Voice_Select      :word              3x2h
       GF1_REG_Select        :word              3x3h
       GF1_Data_Low          :word              3x4h
       GF1_Data_High         :word              3x5h
       GF1_IRQ_status        :word              2x6h
       GF1_DRAM              :word              3x7h
       GF1_TIMER_Ctrl        :word              2x8h
       GF1_TIMER_Data        :word              2x9h
       Midi_Data             :word              3x1h
       Midi_control          :word              3x0h
       IRQDMA_Ctrl           :word              2xBh
       Mix_control           :word              2x0h







--------------------------------TEXT.ASM------------------------------------
NAME:           "Print_Char"

DESCRIPTION:   Prints the character on the screen at the current cursor 
               also updates the cursor and scrolls screen if necessary.

EXPECTS:       AL character to be printed
                              
RETURNS:       Nothing


---------------------------TEXT.ASM  ( variables )---------------------------
               VARIABLE NAME             SIZE

               GlobalTextColor         :dword
 This contains the current color used by the Print_Char routine ( above ).
NOTE: the character's attribute byte will not be written if the colour value
is above 0ffh.


               Cursor_X                :byte
               Cursor_Y                :byte
 These contain the current cursor location used by the Print_Char routine


--------------------------------TEXT.ASM------------------------------------
NAME:           "String"

DESCRIPTION:   Prints a string pointed which is terminated by a '$'

EXPECTS:       DS:EDX pointing to the string
                              


--------------------------------TEXT.ASM------------------------------------
NAME:           "Print_BinDword", "Print_BinWord" and "Print_BinByte"

DESCRIPTION:    Prints the binary value of EAX, AX and AL respectively


--------------------------------TEXT.ASM------------------------------------
NAME:           "Print_HexDword", "Print_HexWord" and "Print_HexByte"

DESCRIPTION:    Prints the hexadecimal value of EAX, AX and AL respectively


--------------------------------TEXT.ASM------------------------------------
NAME:           "Print_DecDword", "Print_DecWord" and "Print_DecByte"

DESCRIPTION:    Prints the decimal value of EAX, AX and AL respectively




----------------------------MACROS.386---------------------------------------

          Macro Name               Paramaters

          OpenFile            <Handle>,'<path\file>'
          CreateFile          <Handle>,'<path\file>'
          CloseFile           <Handle>
          BlockRead           <Handle>,<32bit offset>,<bytes to read> 
          BlockWrite          <Handle>,<32bit offset>,<bytes to write> 
          Seek                <Handle>,<32bit seek position>
          Writeln             '<string>' [, color]
          Write               '<string>' [, color]
          Hex_Dword           <32bit Value> [, color]
          Hex_Word            <16bit Value> [, color]
          Hex_Byte            <8bit Value> [, color]
          Dec_Dword           <32bit Value> [, color]
          Dec_Word            <16bit Value> [, color]
          Dec_Byte            <8bit Value> [, color]
          Bin_Dword           <32bit Value> [, color]
          Bin_Word            <16bit Value> [, color]
          Bin_Byte            <8bit Value> [, color]








