Interpreting  Autodesk’s compiled Lispfiles (FAS-File)

 

 

 

FAS-BytecodeStreams

 

2.Stream (ResourceStream)

      Load Strings into localmemory of stream 2 (=current stream)

First element(= element 0) is an List of all Functions in this stream (contain begin, end offset of a function)

 

      Load Strings into localmemory of stream 1 (Arg0 – is always FuncStream)

First element(= element 0) is an List of all Functions in this stream (contain begin, end offset of a function)

 

      Load Functionnames

      ------

      Mainfunction

 

1.Stream (FunctionStream)

      Functions 1..n (which are called by the Mainfunction

 

 

Stuctures

 

 

      Stack

 

      (SETVAR “UCSFOLLOW” 0)

 

     offset Cmd   params               describtion

00735 9     4D                   push var "UCSFOLLOW"

00738 32    0                    push 0

00740 35    2 77 3               SETVAR 2 Params are above... DebugFlags

00745 A                          pop dummy (decrease stack) <-Deletes return value of setvar

 

Note that parameter are not pushed in reverse order (like in Assembler)

 

 

      Localmemory of stream

      Contain all vars of a stream

                  Lokale Variablen sind (ST)

                  Externe globale Variablen sind (*ERROR* OLDERR S)

                  Zu verknüpfende Funktionsaufrufe (/= MODER PRINC STRCAT)

                  Nicht verknüpfte Funktionsaufrufe (AI_UNDO_OFF)

 

 

 

Interpreting

 

IF

 

( if testexpr thenexpr [elseexpr])

 

(print if (= 1 3)   "YES!!"  "no."      ) )

 

 

00173 32    1             push  [eval]

00182 67    8             If ([eval]==0)[Far] Jump to 195

00187 9     10            push var "YES!!"                             1

00190 57    3             jump [far] over 3 bytes to 198               1

00195 9     F             push var "no."                               2

00198 35    1 E 3         PRINT 1 Params are above...                  2

00203 A                   pop dummy (decrease stack)                   1

While              Evaluates a test expression, and if it is not nil, evaluates other expressions,
                        repeats this process until the test expression evaluates to nil

(while testexpr [expr...])

Arguments       testexpr           The expression containing the test condition.
                        expr                One or more expressions to be evaluated until testexpr is nil.
                        Return Values The most recent value of the last expr.

 

00092 1                   Push <nil>                                   1

 

00093 3     6             Push [eval]                                  2

00103 67    17            If ([eval]==0)[Far] Jump to 131  1

00108 A                   pop dummy (decrease stack)                   0

 

00109 ...                 [while-block]                          1

 

00126 57    FFFFFFDA      jump [far] over -38 bytes to 93              1

00131 A                   pop dummy (decrease stack)

 

 

repeat      Evaluates each expression a specified number of times,
and returns the value of the last expression

(repeat int [expr...])

Arguments       int        An integer. Must be a positive number.
expr     One or more atoms or expressions.
Return Values The value of the last expression or atom evaluated.
                                   If expr is not supplied, repeat returns nil.

(repeat 4

  (print "Vier gewinnt!")

)

 

Init FuncArg[0] with 4

00183 32    4             push  04                                     1

00185 5D    0             FuncArg[0] = 4                               0

 

returnvalue of repeat

00188 1                   Push <nil>                                   1

 

test if FuncArg[0] <= 0

00189 5C    0             Push FuncArg[0]                              2

00192 32    0             push  00                                     3

00194 4B                  push is (0 <= FuncArg[0])                    2

 

00195 67    15            If (is (0 <= FuncArg[0])[Far] Jump to 221    1

00200 A                   pop dummy (decrease stack)                   0

 

(FuncArg[0])--

00201 5C    0             Push FuncArg[0]                              1

00204 50                  dec FuncArg[0]                               1

00205 5D    0             FuncArg[0] = (FuncArg[0])--                  0

 

repeat body

00208 9     2             push var "Vier gewinnt!"                     1

00211 35    1 5 3         PRINT 1 Params are above...                  1

 

00216 57    FFFFFFE0      jump [far] over -32 bytes to 189             1

00221 A                   pop dummy (decrease stack)                   0

 

cond

 

foreach

 

(foreach n '(a b c) (print n))

 

Assign list to FuncArg[0]

00170 9     4             push var "<list( A,B,C)>"                    1

00173 5D    0             FuncArg[0] = <list( A,B,C)>                  0

 

Init N with <nil>                        

00176 9     3             push var "N"                                 1

00179 1                   Push <nil>                                   2

00180 18    3             Init (N=<nil>                                0

 

Init Return value of foreach

00183 1                   Push <nil>                                   1

 

Condition - Test if we reach the end of list

00184 5C    0             Push FuncArg[0]                              2

00187 67    1C            If (FuncArg[0]==0)[Far] jump to 220          1

00192 A                   pop dummy (decrease stack)                   0

 

Load current list element into N

00193 5C    0             Push FuncArg[0]                              1

00196 28                  push list element from (FuncArg[0])          1

00197 6     3             setq N list element from (FuncArg[0])        0

 

Move FuncArg[0] to next list element

00200 5C    0             Push FuncArg[0]                              1

00203 29                  push next list element from (FuncArg[0])     1

00204 5D    0             FuncArg[0] = next list element from (FuncArg[0

 

Foreach body (Display N)

00207 3     3             Push value of [N]                            1

00210 35    1 2 3         PRINT 1 Params are above...                  1

 

jump back to foreach Condition

00215 57    FFFFFFDC      jump [far] over -36 bytes to 184             1

 

foreach finish

00220 19    1             clear 1 arg                                  1

00223 A                   pop dummy (decrease stack)

                 0