

           ͻ
            MBX-FILEFORMAT-INFORMATION AND TECHNICAL INFORMATION 
           Ķ
             THIS FILE WAS INCLUDED WITH THE MICROBASIC PACKAGE  
           ͼ


0. CONTENTS
===========
   0. Contents
   1. MicroBASIC Extension File Format
   2. Technical information about the compiler
   3. Limitations
   4. Error Messages
   5. Used Files
   6. MicroBASIC Extension Viewer (MBXINFO.EXE)
   7. Copyright


1. MICROBASIC EXTENSION FILE FORMAT
===================================
MBX files can be edited using the MBX Editor, which can be downloaded at the
MicroBASIC Website: http://www.blacklight.wxs.org

Ŀ
OffsetLength                        Description                           

Header:
Ŀ
000000000021"MicroBASIC Extension" + CHR$(26)                             
000021000003Version number (minimal: CHR$(2) + CHR$(4) + CHR$(0) = v2.40) 

Followed by identifiers. These identifiers are one byte long.
Ŀ
000000000001Identifier                                                  ID


Identifiers:
[ID#1]Ŀ
000000000001CHR$(1) = Specify Extension Name                            ID
000001000001Length of name, eg: CHR$(7)                                   
000002   ???Extension name, eg: Example                                   

[ID#2]Ŀ
000000000001CHR$(2) = Specify length of routine                         ID
000001000002Length of routine in id#3, eg: lo=length MOD 256  hi=length-lo
                                   CHR$(lo) + CHR$(hi)                    

[ID#3]Ŀ
000000000001CHR$(3) = Routine (system code, like in COM-files)          ID
000001   ???System code (length is specified with id#2)                   

[ID#4]Ŀ
000000000001CHR$(4) = Insert $-var. offset from MBX parameter (2 bytes) ID
            This id will let the compiler know that a variable offset of  
            a given text-parameter (end with $) must be inserted.Parameter

[ID#5]Ŀ
000000000001CHR$(5) = Insert 0-var. offset from MBX parameter (2 bytes) ID
            This id will let the compiler know that a variable offset of  
            a given text-parameter (ASCIIZ-end with CHR$(0)) must be      
            inserted. Parameter                                           

[ID#6]Ŀ
000000000001CHR$(6) = Insert var. offset from MBX parameter (2 bytes)   ID
            This id will let the compiler know that a variable offset of  
            a given text-parameter (nothing is added to the end) must be  
            inserted. Parameter                                           

[ID#7]Ŀ
000000000001CHR$(7) = Insert label-pointer (2 bytes)                    ID
            This id will let the compiler know that a label positioning   
            pointer must be inserted. Place this ID after a JMP-opcode.   
            Parameter                                                     

[ID#8]Ŀ
000000000001CHR$(8) = Insert value (1 byte) 0-255                       ID
            Value-parameter with a value from 0 to 255. Useful to insert  
            a MOV value. Parameter                                        

[ID#9]Ŀ
000000000001CHR$(9) = Insert value (2 bytes) 0-65535                    ID
            Value-parameter with a value from 0 to 65535. Useful to insert
            a MOV value. Parameter                                        

[ID#32]Ŀ
000000000001CHR$(32) = (Space) No function - NOOP                       ID

[ID#254]Ŀ
000000000001CHR$(254) = Used to include comments in MBX-file            ID
000001000001CHR$(len) = length of comment in bytes                        
000002   ???Comment (all ASCII-characters are valid)                      

[ID#255]Ŀ
000000000001CHR$(255) = End of MBX-file (this ID is not required)       ID



2. Technical information about the compiler
===========================================
Version 3.20

Programming environment : PowerBASIC 3.2
Used libraries          : None
Original EXE size       : 88535 bytes
EXE-compressor          : aPACK v0.99b (C) 1997-2000 by Joergen Ibsen (Jibz)
Compiling time          : 0.01 sec on AMD Athlon 800 MHz (128Mb RAM)


3. LIMITATIONS
==============
Number of source-lines  : max. 16000 lines
Number of data-blocks   : max. 16000 blocks
Number of labels        : max. 16000 labels
Compiled code-size      : max. 32750 bytes
Compiled data-size      : max. 32750 bytes

If you need these limitions to be bigger or smaller, e-mail me and I will
change these values in the source-code, recompile it and update the package.


4. ERROR MESSAGES
=================
The following error codes can be displayed during the compiling process:

 Ŀ
  Code  Message                     Code   Message                      
 ͵
   01 * NEXT without FOR             37 * Argument-count mismatch       
   02 * Syntax error                 38 * Array not defined             
   03 * RETURN without GOSUB         40 * Variable required             
   04 * Out of DATA                  50 * FIELD overflow                
   05 * Illegal function call        51   Internal error                
   06   Overflow                     52   Bad file name or number       
   07   Out of memory                53   File not found                
   08 * Label not defined            54 * Bad file mode                 
   09 * Subscript out of range       55 * File already open             
   10 * Duplicate definition         56 * FIELD statement active        
   11 * Division by zero             57   Device I/O error              
   12 * Illegal in direct mode       58   File already exists           
   13 * Type mismatch                59   Bad record length             
   14   Out of string space          61   Disk full                     
   16 * String formula too complex   62   Input past end of file        
   17   Cannot continue              63   Bad record number             
   18 * Function not defined         64   Bad file name                 
   19 * No RESUME                    67   Too many files                
   20 * RESUME without error         68   Device unavailable            
   24   Device timeout               69 * Communication-buffer overflow 
   25   Device fault                 70   Permission denied             
   26 * FOR without NEXT             71   Disk not ready                
   27   Out of paper                 72   Disk-media error              
   29 * WHILE without WEND           73 * Feature unavailable           
   30 * WEND without WHILE           74   Rename across disks           
   33 * Duplicate label              75   Path/File access error        
   35 * Subprogram not defined       76   Path not found                
 

The error-messages marked with an asterisk (*) mean that there's an error in
the compiler-program itself, the other error-messages are because of user
interaction errors, disk-errors, memory-errors or errors in the MBF-file.
So the marked messages are the result of bugs in the program for which the
author is responsible. Please inform me if you find one of these errors,
so I can fix the source-code so that it will work fine.

There are also an other type of error messages, but those are always about
the source-code. Most messages explain theirself, but for less experienced
users, I will explain some of them.

Jump too far away!    This occurs when your compiled file contains JMPS/JE/
                      JNE-instructions (some MBX's), but those can jump only
                      127 bytes max. They only need 2 bytes, but the
                      disadvantage of this will occur when you place
                      a label and a JumpIfEqual (IFKEY, IFANSI, some MBX
                      etc.) too far away from each other.
                      You can solve this problem by adding some extra lines
                      to your program. Simple place a label near the IF___
                      command, with just after that label a GOTO command.
                      The GOTO-command can jump 32k away, so that should be
                      enough. For example:

                      Ŀ
                       'You cannot jump to ExitProg right-away because it  
                       'is too far away.                                   
                       MBX_IF2DEC[gotoexit]                                
                       GOTO blabla                                         
                                                                           
                       gotoexit:                                           
                       GOTO ExitProg                                       
                                                                           
                       blabla:                                             
                       ... a lot of code (more than 127 bytes) ...         
                                                                           
                       ExitProg:                                           
                       PRINT "Hakkeeeuh op Impulz met Tom Harding!!"       
                       END                                                 
                      

                      If things are still not exactly clear to you, don't
                      hesitate to e-mail me. My address is at the bottom of
                      this documentation.


Invalid character '$' MicroBASIC's OUTPUT-command uses the standard DOS output
in x-command!         interrupt function (21h/09h). This function requires a
                      $-sign to identify the position where a text-string
                      ends. The compiler automatically adds a $-sign, but that
                      means that you cannot use this character in your OUTPUT
                      commands.
                      However there is a solution for this problem. If you
                      want to display the text "My budget is $1000" you can
                      do that as follows:

                      Ŀ
                       PRINT "My budget is ";  
                       CHAR "$"                
                       PRINT "1000"            
                      

                      because the CHAR function does allow you to use every
                      possible ascii-character (so that includes the $-sign).

                      Note: If you're a 'cracker':), you should be aware of
                            the fact that in the compiled version of the
                            above source-code, the exact string "My budget
                            is $1000" appears! However, that's only because
                            the two strings "My budget is $" and "1000$" are
                            placed near each other. The $-sign will be
                            displayed using an instruction which is in the
                            code-area of the executable.


5. USED FILES
=============
No temporary files are being written or read! The compiler uses absolutely
no files on your disk, except the source files (MBF, MBX) and the target
executable.


6. MICROBASIC EXTENSION VIEWER (MBXINFO.EXE)
============================================
With the included program MBXINFO.EXE it's possible to display comments and
other information which is included in a MBX-file. Just type MBXINFO followed
by the name of the MBX-file and it will display every byte in the MBX-file
explained (except for the routines). You will see descriptions, syntax info
and other comments.
MBXINFO.EXE is also released as freeware. It was written in PowerBASIC 3.2,
because of the filesize QuickBasic compiles it to. PowerBASIC creates much
smaller executables, which also can be better compressed.


7. COPYRIGHT
============
Homepage       :      http://www.blacklight.wxs.org
E-Mail         :      mbxtech.txt@blacklight.wxs.org

           -=[THIS PRODUCT WAS MADE IN GOIRLE (NB), HOLLAND!]=-

Copyright (C) 1995-2001 BlackLight. All rights reserved.
