标签:
一、在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
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
标签:
原文地址:http://my.oschina.net/u/2245781/blog/505415