QB.BI: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 15: Line 15:
' QB.BI - Assembly Support Include File
' QB.BI - Assembly Support Include File
'
'
' Copyright <C> 1987 Microsoft Corporation
' Copyright (C) 1987 Microsoft Corporation
'
'
' Purpose:
' Purpose:
Line 57: Line 57:
' Generate a software interrupt, loading all but the segment registers
' Generate a software interrupt, loading all but the segment registers
'
'
{{Cl|DECLARE}} {{Cl|SUB}} {{Cl|INTERRUPT}} (intnum {{Cl|AS}} {{Cl|INTEGER}}, inreg {{Cl|AS}} RegType, outreg {{Cl|AS}} RegType)
{{Text|DECLARE|#87cefa}} {{Cl|SUB}} {{Cl|INTERRUPT}} (intnum {{Cl|AS}} {{Cl|INTEGER}}, inreg {{Cl|AS}} RegType, outreg {{Cl|AS}} RegType)
'
'
' Generate a software interrupt, loading all registers
' Generate a software interrupt, loading all registers
'
'
{{Cl|DECLARE}} {{Cl|SUB}} {{Cl|INTERRUPTX}} (intnum {{Cl|AS}} {{Cl|INTEGER}}, inreg {{Cl|AS}} RegTypeX, outreg {{Cl|AS}} RegTypeX)
{{Text|DECLARE|#87cefa}} {{Cl|SUB}} {{Cl|INTERRUPTX}} (intnum {{Cl|AS}} {{Cl|INTEGER}}, inreg {{Cl|AS}} RegTypeX, outreg {{Cl|AS}} RegTypeX)
'
'
' Call a routine at an absolute address.
' Call a routine at an absolute address.
Line 67: Line 67:
'      be added to this declare statement before the parameter given.
'      be added to this declare statement before the parameter given.
'
'
{{Cl|DECLARE}} {{Cl|SUB}} {{Cl|CALL ABSOLUTE|ABSOLUTE}} (address {{Cl|AS}} {{Cl|INTEGER}})
{{Text|DECLARE|#87cefa}} {{Cl|SUB}} {{Cl|CALL ABSOLUTE|ABSOLUTE}} (address {{Cl|AS}} {{Cl|INTEGER}})
'
'
' Generate a software interrupt, loading all but the segment registers
' Generate a software interrupt, loading all but the segment registers
'      (old version)
'      (old version)
'
'
{{Cl|DECLARE}} {{Cl|SUB}} {{text|INT86OLD|#87cefa}} (intnum AS {{Cl|INTEGER}}, inarray(1) {{Cl|AS}} {{Cl|INTEGER}}, outarray(1) {{Cl|AS}} {{Cl|INTEGER}})
{{Text|DECLARE|#87cefa}} {{Cl|SUB}} {{Text|INT86OLD|#87cefa}} (intnum AS {{Cl|INTEGER}}, inarray(1) {{Cl|AS}} {{Cl|INTEGER}}, outarray(1) {{Cl|AS}} {{Cl|INTEGER}})
'
'
' Gemerate a software interrupt, loading all the registers
' Gemerate a software interrupt, loading all the registers
'      (old version)
'      (old version)
'
'
{{Cl|DECLARE}} {{Cl|SUB}} {{text|INT86XOLD|#87cefa}} (intnum {{Cl|AS}} {{Cl|INTEGER}}, inarray(1) {{Cl|AS}} {{Cl|INTEGER}}, outarray(1) {{Cl|AS}} {{Cl|INTEGER}}) '' ''
{{Text|DECLARE|#87cefa}} {{Cl|SUB}} {{Text|INT86XOLD|#87cefa}} (intnum {{Cl|AS}} {{Cl|INTEGER}}, inarray(1) {{Cl|AS}} {{Cl|INTEGER}}, outarray(1) {{Cl|AS}} {{Cl|INTEGER}})
 
{{CodeEnd}}
{{CodeEnd}}


Line 97: Line 96:
   ds {{Cl|AS}} {{Cl|INTEGER}}
   ds {{Cl|AS}} {{Cl|INTEGER}}
   es {{Cl|AS}} {{Cl|INTEGER}}
   es {{Cl|AS}} {{Cl|INTEGER}}
{{Cl|END TYPE}} '' ''
{{Cl|END TYPE}}
 
{{CodeEnd}}
{{CodeEnd}}
: ''Explanation:'' DECLARE statements in QB4.5 and PDS(7.1) are not required because the Library MUST be included with [[INTERRUPT]], [[INTERRUPTX]] and [[CALL ABSOLUTE|ABSOLUTE]] or a "Subprogram not defined" [[ERROR Codes|error]] will occur.  
: ''Explanation:'' DECLARE statements in QB4.5 and PDS(7.1) are not required because the Library MUST be included with [[INTERRUPT]], [[INTERRUPTX]] and [[CALL ABSOLUTE|ABSOLUTE]] or a "Subprogram not defined" [[ERROR Codes|error]] will occur.
 




{{PageSeeAlso}}
{{PageSeeAlso}}
* [[$INCLUDE]], [[INTERRUPT]], [[INTERRUPTX]]
* [[$INCLUDE]], [[INTERRUPT]], [[INTERRUPTX]]




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 22:44, 11 February 2023

The QB.BI file can be used for INTERRUPT or INTERRUPTX routines by $INCLUDEing the file in a program. It is useful for the TYPE and SUB declarations.


Description

  • Create your own BI files to $INCLUDE to hold your own TYPE definitions. Use notepad and save as All Files as filename.BI
  • In QBasic the BI library or support file MUST be included in a program package or download!
  • QB64 programs do not require any INCLUDED files once the BAS file is compiled!


Examples

The QB.BI file contents:

'**************************************************************************
' QB.BI - Assembly Support Include File
'
' Copyright (C) 1987 Microsoft Corporation
'
' Purpose:
'      This include file defines the types and gives the DECLARE
'       statements for the assembly language routines CALL ABSOLUTE,
'       INTERRUPT, INTERRUPTX, INT86OLD, and INT86XOLD.
'
'***************************************************************************
'
' Define the TYPE needed for INTERRUPT
'
TYPE RegType
   ax    AS INTEGER
   bx    AS INTEGER
   cx    AS INTEGER
   dx    AS INTEGER
   bp    AS INTEGER
   si    AS INTEGER
   di    AS INTEGER
   flags AS INTEGER
END TYPE
'
' Define the TYPE needed for 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
'
' DECLARE statements for the 5 supported routines
' -----------------------------------------
'
' Generate a software interrupt, loading all but the segment registers
'
DECLARE SUB INTERRUPT (intnum AS INTEGER, inreg AS RegType, outreg AS RegType)
'
' Generate a software interrupt, loading all registers
'
DECLARE SUB INTERRUPTX (intnum AS INTEGER, inreg AS RegTypeX, outreg AS RegTypeX)
'
' Call a routine at an absolute address.
' NOTE: If the routine called takes parameters, then they will have to
'       be added to this declare statement before the parameter given.
'
DECLARE SUB ABSOLUTE (address AS INTEGER)
'
' Generate a software interrupt, loading all but the segment registers
'       (old version)
'
DECLARE SUB INT86OLD (intnum AS INTEGER, inarray(1) AS INTEGER, outarray(1) AS INTEGER)
'
' Gemerate a software interrupt, loading all the registers
'       (old version)
'
DECLARE SUB INT86XOLD (intnum AS INTEGER, inarray(1) AS INTEGER, outarray(1) AS INTEGER)


Ethan Winer's compact "RegType.BI" file for INTERRUPT or INTERRUPTX:

TYPE RegType
   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
Explanation: DECLARE statements in QB4.5 and PDS(7.1) are not required because the Library MUST be included with INTERRUPT, INTERRUPTX and ABSOLUTE or a "Subprogram not defined" error will occur.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage