' roc Relative OpCOde
'
' a minimalist programming language based on Pentium opcodes
' 13:30 13 March 2008
'
'

    O2 opcode compiler. Version 0.0  12 Mar 2008
    Usage: O2 filename
    Instruction set:
     ------------------------------------------------------------------------
       INSTRUCTION SET
     ------------------------------------------------------------------------
     all instructions are case sensitive (lowercase)  except for hexadecimal
     all words are delimited by white space or comment mark
       '        comment to end of line
       [..]     string literal (the square brackets are nestable)
       .label   forward labels (only the first 2 letters are significant)
       :        make entry in jump table
       $        make space (value in hexadecimal)
       $$        make space & align to nearest 4 bytes
       2 digits  0-9 a-f hexadecimal byte 
       3 digits  0-7 octal byte 
       g         short forward relative jump (but not into an inner block)
       gl        long forward relative jump  (ditto)
       (         start of block
       )         end of block
       x         short jump exit from block
       xl        long jump exit from block
       r         short jump repeat from start of block
       rl        long jump repeat from start of block
       h         hexadecimal numbers: 
       hw            word:   2 byte integer
       hl            long:   4 byte integer
       n         decimal numbers:
       nb            byte    1 byte
       nw            word:   2 byte integer
       nl            long:   4 byte integer
       nq            quad:   8 byte integer
       ns            single: 4 byte floating point
       nd            double: 8 byte floating point
     
     ------------------------------------------------------------------------


'------------------------------------------------------------------------------
' RULES
'------------------------------------------------------------------------------


'
'
' comments are preceded by ' and apply for the rest of the line.
'
' A label if shown by a dot followed by one or more letters
'
' A colon is used to indicate a location to be used in the prefixed jump table
'
' Each jump table entry is 8 bytes and contains a direct long jump instruction. (e9)
'
' If no table entries are specified,there will be no table and execution starts at the beginning.. 
'
' Absolute addresses are not supported. The code is intended to be fully relocatable
'
'
'
' Only forward jumps are possible using g or gl (for long jumps) 
'
' round brackets define a block x or xl causes a jump to beyond the end of the current block
'
' sets of brackets are nestable
'
' r or rl (long) causes instructions to be executed from the beginning of the  current block again.
'
' round brackets also define the scope of a label. label in more inner scopes are invisible
'
' This means you cant jump into an inner block.
'
' Which means you can put blocks of code together without name conflicts between inner and outer labels.
'


