一、在simh下運行RT-11SJ
1:安裝simh:Win下直接安裝,Linux下make後在BIN目錄找到pdp11並cp到搜索路徑目錄下
2:到http://simh.trailing-edge.com/software.html 下載RT-11 V4 for the PDP-11 的鏡像磁盤文件rt11swre.tar.Z並解壓,在Disks目錄下可得到鏡像文件rtv4_rk.dsk
或者在Linux公社資源站下載:
------------------------------------------分割線------------------------------------------
免費下載地址在 http://linux.linuxidc.com/
用戶名與密碼都是www.linuxidc.com
具體下載目錄在 /2015年資料/12月/13日/RT-11SJ 環境下運行PDP-11匯編MACRO-11/
下載方法見 http://www.linuxidc.com/Linux/2013-07/87684.htm
------------------------------------------分割線------------------------------------------
3:建立運行目錄rt11swre,把rtv4_rk.dsk移到該目錄
4:建立simh啟動文件boot.ini如下:rt11swre$ cat boot.ini
set cpu 256k
att rk0 rtv4_rk.dsk
boot rk0
5:啟動pdp11
$ pdp11 boot.ini
PDP-11 simulator V3.9-0
Disabling CR
RT-11SJ V04.00C
.D 56=5015
.TYPE V4USER.TXT
Welcome to RT-11 Version 4. RT-11 V04 provides new hardware support
and some major enhancements over Version 3B.
Please use the HELP command; it describes the new options in many
of the utilities.
If you are using a terminal that requires fill characters,
modify location 56 with a Deposit command before proceeding with
system installation. LA36 DECwriter II and VT52 DECscope terminals
do NOT require such modification.
.D 56=0
.
.號為 RT-11操作系統的命令提示符(類似dos下的c:\>或unix下的$)
二、在RT-11環境下輸入HELLO.MAC源程序
編輯程序EDIT我不會用,這裡用COPY命令(類似在unix用cat命令創建文件的方法):
.COPY TT: HELLO.MAC
Files copied:
^.TITLE HELLO WORLD
.MCALL .TTYOUT,.EXIT
HELLO:: MOV #MSG,R1 ;STARTING ADDRESS OF STRING
1$: MOVB (R1)+,R0 ;FETCH NEXT CHARACTER
BEQ DONE ;IF ZERO, EXIT LOOP
.TTYOUT ;OTHERWISE PRINT IT
BR 1$ ;REPEAT LOOP
DONE: .EXIT
MSG: .ASCIZ /HELLO, WORLD!/
.END HELLO
^ZTT: to DK:HELLO.MAC
注意最後一行(必須另起一行、不能在.END HELLO後面)只需輸入ctrl+Z文件便會保存到磁盤
.DIR *.MAC
HELLO .MAC 1
1 Files, 1 Blocks
2496 Free blocks
三、匯編
.MACRO HELLO
ERRORS DETECTED: 0
四、連接並運行
.LINK HELLO
.R HELLO
HELLO, WORLD!
更簡單的HELLOWORLD:
; MACRO-11 EXAMPLE.
.MCALL .EXIT, .PRINT
START:
.PRINT #MES
.EXIT
MES: .ASCIZ /HELLO !!!/
.END START
還有一個版本:
.MCALL .REGDEF,.TTYOUT,.EXIT
.REGDEF
HELLO:
MOV #MSG,R1
MOVB (R1),R0
LOOP: .TTYOUT
MOVB (R1)+,R0
BNE LOOP
.EXIT
MSG: .ASCIZ /HELLO, WORLD!/
.END HELLO