PC: SVDL implementation
Previus Credits Index Next

When a SVDL program is compiled, a SVX file is produced. SVX contain the bytecode that one SVDL interpreter can use for execute the SVDL program. Think a today JAVA: there's the JAVA language that are compiled for producing class file; then a Java Virtual Machine interpret the code in the class file. Else, a group of class can be packed together in a JAR file. In my case the SVX file are packed in SVDL library, so an antivirus can be updated given the new library of SVDL compiled code.

Bytecode specification

Header of SVDL compiled file:

    12h       SVDL
    15h       version 1.00
    03h
    0Bh
This format is called 4 bytes header and was used in many my file formats (SVDL, COMP, C64 file), here the meanings:
bit      8   7   6  5  4  3  2  1

        X0  X1  X2  1  0  0  1  0    (S)
        X3  X4  Y0  1  0  1  0  1    (V)
        Y1  Y2  Y3  0  0  0  1  1    (D)
        Y4  Y5  Y6  0  1  0  1  1    (L)
        \________/  \___________/
            |             |
            |             |
            |             Ascii compact code:
            |              5bit-sign(letter-'A')
            |
      X0 X1 X2 X3 X4 =  principal version number

      0  0  0  0  0  =  1
      1  1  1  1  1  =  32

      Y0 Y1 Y2 Y3 Y4 Y5 Y6 = secondary version number

      0  0  0  0  0  0  0  = 0
      1  1  0  0  1  0  0  = 99
      1  1  1  1  1  1  1  =127 not used from 100 to this
IF instruction

IF oper1 comp oper2

1° instruction byte:

  bit   8 7 6 5      4 3 2 1
        1 x _ _      _ x x x
          |            | | |
          |            0 0 0 :  (0)  not used
          0 : '+'      0 0 1 :  (1)  '='
          1 : '-'      0 1 0 :  (2)  '>'
                       0 1 1 :  (3)  '>='
                       1 0 0 :  (4)  '<'
                       1 0 1 :  (5)  '<='
                       1 1 0 :  (6)  '<>'
                       1 1 1 :  (7)  not used

2° instruction byte:

  bit   8 7 6 5      4 3 2 1
        x x x x      x x x x
        | | | |      | | | |
        0 0 0 0      0 0 0 0 : (0)  byte variable                    (X#)
        0 0 0 1      0 0 0 1 : (1)  word variable                    (X%)
        0 0 1 0      0 0 1 0 : (2)  low of word variable             (|X%)
        0 0 1 1      0 0 1 1 : (3)  high of word variable            (@X%)
        unused       0 1 0 0 : (4)  byte number (not 0)              (xx)
        unused       0 1 0 1 : (5)  word number (not 0)              (xxxx)
        unused       0 1 1 0 : (6)  char                             ('x')
        unused       0 1 1 1 : (7)  string of 2 bytes                ('xx')
        unused       1 0 0 0 : (8)  string greater of 2 bytes        ('...')
        1 0 0 1      unused  : (9)  disk read                        ([xx])
        1 0 1 0      unused  : (A)  disk long read                   ([xx+])
        unused       1 0 1 1 : (B)  number 0
        1 1 0 0      unused  : (C)  disk read from the end           ([_xx])
        1 1 0 1      unused  : (D)  disk read from variable          ([X])
        1 1 1 0      unused  : (E)  disk long read from variable     ([X+])
        1 1 1 1      unused  : (F)  disk read from end with variable ([_X])

3° instruction byte:

                       bit   8 7 6 5      4 3 2 1
                             x x x x      x x x x
                             | | | |      | | | |
   disk read         :   disk seek number
   variable          :   ascii code of variable letter
   disk read variable:   code b/w/ident

eventual other bytes:
 number 0:                     nothing
 byte variable:                4°=ascii code of the variable letter
 word variable:                4°=ascii code of the variable letter
 char:                         4°=char ascii code
 2 chars:                      4°=second char
                               5°=first char
 string:                       4°=string length
                               5°=..n..255°=other chars
 byte number:                  4°=number
 word number:                  4°=low of number
                               5°=high of number
Assignment

1° instruction byte:

  bit   8 7 6 5      4 3 2 1
        0 x _ x      x x x x
          |
          |
          |
          |
          0 sintax 1
          1 sintax 2

 sintax1:

  bit         5      4 3 2 1
              _      x x x x
                     | | | |
                     0 0 0 0 : (0) ADC
                     0 0 0 1 : (1) ADD
                     0 0 1 0 : (2) AND
                     0 0 1 1 : (3) DIV
                     0 1 0 0 : (4) IDIV
                     0 1 0 1 : (5) IMUL
                     0 1 1 0 : (6) MUL
                     0 1 1 1 : (7) OR
                     1 0 0 0 : (8) ROL
                     1 0 0 1 : (9) ROR
                     1 0 1 0 : (A) SAR
                     1 0 1 1 : (B) SBB
                     1 1 0 0 : (C) SHL/SAL
                     1 1 0 1 : (D) SHR
                     1 1 1 0 : (E) SUB
                     1 1 1 1 : (F) XOR

 sintax2:

  bit         5      4 3 2 1
              x      x x x x
              |      | | | |
              0      0 0 0 0 : (0)  byte variable                    (X#)
              0      0 0 0 1 : (1)  word variable                    (X%)
              0      0 0 1 0 : (2)  low of word variable             (|X%)
              0      0 0 1 1 : (3)  high of word variable            (@X%)
              0      0 1 0 0 : (4)  byte number (not 0)              (xx)
              0      0 1 0 1 : (5)  word number (not 0)              (xxxx)
              0      0 1 1 0 : (6)  char                             ('x')
              0      0 1 1 1 : (7)  string of 2 chars                ('xx')
              0      1 0 0 0 : (8)  string with more of 2 chars      ('...')
              0      1 0 0 1 : (9)  disk read                        ([xx])
              0      1 0 1 0 : (A)  disk long read                   ([xx+])
              0      1 0 1 1 : (B)  numer 0
              0      1 1 0 0 : (C)  disk read from the end           ([_xx])
              0      1 1 0 1 : (D)  disk read from variable          ([X])
              0      1 1 1 0 : (E)  disk long read from variable     ([X+])
              0      1 1 1 1 : (F)  disk read from end with variable ([_X])
                       ...
                     unused
                       ...
              1      0 1 1 1 : (17) ATTR
              1      1 0 0 0 : (18) DATE
              1      1 0 0 1 : (19) DEC
              1      1 0 1 0 : (1A) DIML
              1      1 0 1 1 : (1B) DIMH
              1      1 1 0 0 : (1C) INC
              1      1 1 0 1 : (1D) NEG
              1      1 1 1 0 : (1E) NOT
              1      1 1 1 1 : (1F) TIME

2° instruction byte:

   var1:               bit   8 7 6 5      4 3 2 1
                             x x x x      x x x x
                             | | | |      | | | |
   byte:              ascii code of the variable letter
   word:              ascii code of the variable letter plus 26
   low_word:          ascii code of the variable letter plus -65
   hi_word:           ascii code of the variable letter plus -39

other bytes:

sintax1:

3° instruction byte:

   var2:        see var1 of 2° instruction byte

4° instruction byte:

   var3:        see above

sintax2:
  like in the other bytes of IF instruction
 
Top
Pc Logo
PC Pc Logo Tognon Stefano programs