Not logged in

Artifact ae6971d3ccaae3f1ec6a19450313890822b70013

File user/marc/introspection.rx part of check-in [b8a7486210] - Simple box diagram memory viewer for Retro 11 (experimental) by marc on 2011-01-18 17:39:26. [annotate]


( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
( Copyright [c] 2010, Charles Childers                         )
( Copyright [c] 2011, Marc Simpson                             )
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
( Abstracted from 'autopsy' [and our Retro 10 decompiler]      )
( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )

chain: introspection'
{{
  ( Helpers to make the code easier to read ~~~~~~~~~~~~~~~~~~ )
  : case
    [ over = ] dip swap
    [ do rot drop -1 -1 ] [ drop 0 ] if 0; pop 2drop ;

---reveal---

  ( Opcode table ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ )
  : instr?    (  n-f  )
     0 [ "nop"    0 ] case     1 [ "lit"   -1 ] case
     2 [ "dup"    0 ] case     3 [ "drop"   0 ] case
     4 [ "swap"   0 ] case     5 [ "push"   0 ] case
     6 [ "pop"    0 ] case     7 [ "loop"  -1 ] case
     8 [ "jump"  -1 ] case     9 [ ";"      0 ] case
    10 [ ">jump" -1 ] case    11 [ "<jump" -1 ] case
    12 [ "!jump" -1 ] case    13 [ "=jump" -1 ] case
    14 [ "@"      0 ] case    15 [ "!"      0 ] case
    16 [ "+"      0 ] case    17 [ "-"      0 ] case
    18 [ "*"      0 ] case    19 [ "/mod"   0 ] case
    20 [ "and"    0 ] case    21 [ "or"     0 ] case
    22 [ "xor"    0 ] case    23 [ "<<"     0 ] case
    24 [ ">>"     0 ] case    25 [ "0;"     0 ] case
    26 [ "1+"     0 ] case    27 [ "1-"     0 ] case
    28 [ "in"     0 ] case    29 [ "out"    0 ] case
    30 [ "wait"   0 ] case
    0 ;
}}
;chain

global with introspection'