QB.BI: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "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. The contents follow: * 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 INCLUD...")
 
No edit summary
Line 1: Line 1:
The '''QB.BI''' file can be used for [[INTERRUPT]] or [[INTERRUPTX]] routines by [[$INCLUDE]]ing the file in a program. It is useful for the [[TYPE]] and [[SUB]] declarations. The contents follow:
The '''QB.BI''' file can be used for [[INTERRUPT]] or [[INTERRUPTX]] routines by [[$INCLUDE]]ing the file in a program. It is useful for the [[TYPE]] and [[SUB]] declarations.




{{PageDescription}}
* Create your own BI files to [[$INCLUDE]] to hold your own [[TYPE]] definitions. Use notepad and save as All Files as ''filename.BI''
* 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!
* 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!
* '''QB64''' programs do not require any INCLUDED files once the BAS file is compiled!




{{PageExamples}}
:''The QB.BI file contents:''
:''The QB.BI file contents:''
{{TextStart}}
{{CodeStart}}


'**************************************************************************
'**************************************************************************
Line 24: Line 26:
' Define the [[TYPE]] needed for [[INTERRUPT]]
' Define the [[TYPE]] needed for [[INTERRUPT]]
'
'
TYPE RegType
{{Cl|TYPE}} RegType
   ax AS INTEGER
   ax   {{Cl|AS}} {{Cl|INTEGER}}
   bx AS INTEGER
   bx   {{Cl|AS}} {{Cl|INTEGER}}
   cx AS INTEGER
   cx   {{Cl|AS}} {{Cl|INTEGER}}
   dx AS INTEGER
   dx   {{Cl|AS}} {{Cl|INTEGER}}
   bp AS INTEGER
   bp   {{Cl|AS}} {{Cl|INTEGER}}
   si AS INTEGER
   si   {{Cl|AS}} {{Cl|INTEGER}}
   di AS INTEGER
   di   {{Cl|AS}} {{Cl|INTEGER}}
   flags AS INTEGER
   flags {{Cl|AS}} {{Cl|INTEGER}}
END TYPE
{{Cl|END TYPE}}
'
'
' Define the [[TYPE]] needed for [[INTERRUPTX]]
' Define the [[TYPE]] needed for [[INTERRUPTX]]
'
'
TYPE RegTypeX
{{Cl|TYPE}} RegTypeX
   ax AS INTEGER
   ax   {{Cl|AS}} {{Cl|INTEGER}}
   bx AS INTEGER
   bx   {{Cl|AS}} {{Cl|INTEGER}}
   cx AS INTEGER
   cx   {{Cl|AS}} {{Cl|INTEGER}}
   dx AS INTEGER
   dx   {{Cl|AS}} {{Cl|INTEGER}}
   bp AS INTEGER
   bp   {{Cl|AS}} {{Cl|INTEGER}}
   si AS INTEGER
   si   {{Cl|AS}} {{Cl|INTEGER}}
   di AS INTEGER
   di   {{Cl|AS}} {{Cl|INTEGER}}
   flags AS INTEGER
   flags {{Cl|AS}} {{Cl|INTEGER}}
   ds AS INTEGER
   ds   {{Cl|AS}} {{Cl|INTEGER}}
   es AS INTEGER
   es   {{Cl|AS}} {{Cl|INTEGER}}
END TYPE
{{Cl|END TYPE}}
'
'
' [[DECLARE]] statements for the 5 supported routines
' DECLARE statements for the 5 supported routines
' -----------------------------------------
' -----------------------------------------
'
'
' Generate a software interrupt, loading all but the segment registers
' Generate a software interrupt, loading all but the segment registers
'
'
DECLARE SUB [[INTERRUPT]] (intnum AS [[INTEGER]], inreg AS RegType, outreg AS RegType)
{{Cl|DECLARE}} {{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
'
'
DECLARE SUB [[INTERRUPTX]] (intnum AS [[INTEGER]], inreg AS RegTypeX, outreg AS RegTypeX)
{{Cl|DECLARE}} {{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 65: Line 67:
'      be added to this declare statement before the parameter given.
'      be added to this declare statement before the parameter given.
'
'
DECLARE SUB [[ABSOLUTE]] (address AS [[INTEGER]])
{{Cl|DECLARE}} {{Cl|SUB}} {{Cl|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)
'
'
DECLARE SUB INT86OLD (intnum AS INTEGER, inarray(1) AS INTEGER, outarray(1) AS INTEGER)
{{Cl|DECLARE}} {{Cl|SUB}} {{Cl|INT86OLD}} (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)
'
'
DECLARE SUB INT86XOLD (intnum AS INTEGER, inarray(1) AS INTEGER, outarray(1) AS INTEGER) '' ''
{{Cl|DECLARE}} {{Cl|SUB}} {{Cl|INT86XOLD}} (intnum {{Cl|AS}} {{Cl|INTEGER}}, inarray(1) {{Cl|AS}} {{Cl|INTEGER}}, outarray(1) {{Cl|AS}} {{Cl|INTEGER}}) '' ''


{{TextEnd}}
{{CodeEnd}}




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


{{TextStart}}
{{CodeStart}}


TYPE RegType
{{Cl|TYPE}} RegType
   ax AS INTEGER
   ax {{Cl|AS}} {{Cl|INTEGER}}
   bx AS INTEGER
   bx {{Cl|AS}} {{Cl|INTEGER}}
   cx AS INTEGER
   cx {{Cl|AS}} {{Cl|INTEGER}}
   dx AS INTEGER
   dx {{Cl|AS}} {{Cl|INTEGER}}
   bp AS INTEGER
   bp {{Cl|AS}} {{Cl|INTEGER}}
   si AS INTEGER
   si {{Cl|AS}} {{Cl|INTEGER}}
   di AS INTEGER
   di {{Cl|AS}} {{Cl|INTEGER}}
   flags AS INTEGER
   flags {{Cl|AS}} {{Cl|INTEGER}}
   ds AS INTEGER
   ds {{Cl|AS}} {{Cl|INTEGER}}
   es AS INTEGER
   es {{Cl|AS}} {{Cl|INTEGER}}
END TYPE '' ''
{{Cl|END TYPE}} '' ''


{{TextEnd}}
{{CodeEnd}}
: ''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 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 [[ABSOLUTE]] or a "Subprogram not defined" [[ERROR Codes|error]] will occur.  






''See also:''
{{PageSeeAlso}}
 
* [[$INCLUDE]], [[INTERRUPT]], [[INTERRUPTX]]
* [[$INCLUDE]], [[INTERRUPT]], [[INTERRUPTX]]



Revision as of 20:43, 22 April 2022

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 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
Report a broken link