Knuth: MMIX彙編

MMIX 官方主頁:Knuth: MMIX。有關 MMIX 的資料和軟件均可以在上面找到。html

1、wget http://mmix.cs.hm.edu/src/mmix-20131017.tgzbash

得到源碼code

2、解壓後make生成mmix mmixalhtm

3、拷貝到系統搜索路徑(如/usr/bin /usr/local/bin等)get

4、例子源碼

~$ cat hello.mms table

argv   IS    $1
       LOC   #100
Main   LDOU  $255,argv,0
       TRAP  0,Fputs,StdOut
       GETA  $255,String
       TRAP  0,Fputs,StdOut
       TRAP  0,Halt,0
String BYTE  ", world",#a,0

~$ mmixal -l hello.mml hello.mmsclass

~$ ls hello*
hello.mml  hello.mmo  hello.mms軟件

~$ mmix hello搜索

hello, world

~$  hd hello.mmo

00000000  98 09 01 01 57 44 6f 49  98 02 01 00 98 06 00 03  |....WDoI........|
00000010  68 65 6c 6c 6f 2e 6d 6d  73 00 00 00 98 07 00 03  |hello.mms.......|
00000020  8f ff 01 00 00 00 07 01  f4 ff 00 00 00 00 07 01  |................|
00000030  00 00 00 00 98 04 00 03  2c 20 77 6f 98 07 00 08  |........, wo....|
00000040  72 6c 64 0a 98 07 00 08  00 00 00 00 98 0a 00 ff  |rld.............|
00000050  00 00 00 00 00 00 01 00  98 0b 00 00 20 3a 50 50  |............ :PP|
00000060  10 40 40 20 4d 20 61 20  69 02 6e 01 00 81 20 53  |.@@ M a i.n... S|
00000070  20 74 10 10 20 72 20 69  20 6e 02 67 01 14 83 40  | t.. r i n.g...@|
00000080  20 61 20 72 20 67 0f 76  01 82 00 00 98 0c 00 0c  | a r g.v........|
00000090

~$ cat hello.mml

($001)             argv   IS    $1
                          LOC   #100
 ...100: 8fff0100  Main   LDOU  $255,argv,0
 ...104: 00000701         TRAP  0,Fputs,StdOut
 ...108: f4ffxxxx         GETA  $255,String
 ...10c: 00000701         TRAP  0,Fputs,StdOut
 ...110: 00000000         TRAP  0,Halt,0
 ...114: 2c20776f  String BYTE  ", world",#a,0
 ...118: 726c640a
 ...11c: 00      
                   

Symbol table:
 Main = #0000000000000100 (1)
 String = #0000000000000114 (3)
 argv = $001 (2)
相關文章
相關標籤/搜索