Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ xen/qa7/syn/ip/**
#q[ak]7.ip_user_files/**
#q[ak]7.runs/**
#q[ak]7.src/**
*.bin
*.hex
*.mem
*.mif
13 changes: 13 additions & 0 deletions docker/1801bm1.gpg.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----

mDMEaK3+KhYJKwYBBAHaRw8BAQdAlb3WUnwU6PMkpx9fottfzhq/EcJ1+scevz5g
ngm58RC0JzE4MDFibTEgYXB0IGtlZXBlciA8a2VlcGVyQDE4MDFibTEuY29tPoiT
BBMWCgA7FiEEVZFkoBR03NSQ4jfUjkoohuWp6/QFAmit/ioCGwMFCwkIBwICIgIG
FQoJCAsCBBYCAwECHgcCF4AACgkQjkoohuWp6/QrBQD/Ws0rmbICdEgeeOOkxiu5
cbU+N8YX1gs8daZN67x6R/kA/jm7gQHFK9yzj8+IksWGsoOL2ZQUAfZ4mDnqkrwI
wZEFuDgEaK3+KhIKKwYBBAGXVQEFAQEHQFAVsfc+Wp6kTr5LxFHWGlIeO8xh5SRM
W7AUuZgqO3tAAwEIB4h4BBgWCgAgFiEEVZFkoBR03NSQ4jfUjkoohuWp6/QFAmit
/ioCGwwACgkQjkoohuWp6/SocwEAir0oEEBa0ghI2pLyF581Un8pl//4wU7SJXnV
18/rB/8BAI52nWGAHIXApNOk9aMLh4vNPENbjYwWO438XhyQl8QJ
=qzaO
-----END PGP PUBLIC KEY BLOCK-----
1 change: 1 addition & 0 deletions docker/1801bm1.list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deb https://1801bm1.com/ubuntu bionic main
5 changes: 5 additions & 0 deletions docker/1801bm1.sources
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Types: deb
URIs: https://1801bm1.com/ubuntu
Suites: noble
Components: main
Signed-By: /usr/share/keyrings/1801bm1.gpg.asc
88 changes: 88 additions & 0 deletions docker/Dockerfile.ubuntu-bionic
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
FROM ubuntu:18.04 as builder
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV RT11=/usr/local/share/rt11
RUN apt-get -q update
RUN apt-get -yq install \
cmake gcc g++ git make jq curl unzip xz-utils \
libpcre3-dev libedit-dev libpng-dev libpcap-dev \
libsdl2-dev libsdl2-ttf-dev libvdeplug-dev
RUN apt-get -y dist-upgrade
RUN git clone https://github.com/nzeemin/ukncbtl-utils.git /usr/local/src/ukncbtl-utils
RUN cd /usr/local/src/ukncbtl-utils; \
make -C rt11dsk V=1 all && install -m 755 rt11dsk/rt11dsk /usr/local/bin/
#
WORKDIR /usr/local/src/
# https://gunkies.org/wiki/Installing_RT-11_5.3_on_SIMH
## Get and build SIMH 4.0
#RUN curl -LO -s https://github.com/simh/simh/archive/refs/heads/master.zip && \
# unzip -x master.zip && ls -l
#RUN cd simh-master && make pdp11 && install -m 755 BIN/pdp11 /usr/local/bin/
## Build macro11 tool
#RUN cd /usr/local/src && git clone https://github.com/simh/simtools.git && \
# cd simtools/crossassemblers/macro11 && make
# Build dectape tool
ADD xen/tools/unix/dectape.c /usr/local/src/
RUN gcc -o /usr/local/bin/dectape /usr/local/src/dectape.c
# Get and build bin2load
RUN cd /usr/local/src && \
git clone https://github.com/jguillaumes/retroutils.git && \
cd retroutils/bin2load && \
make bin2load
# Runtime/worker container
FROM ubuntu:18.04 as worker
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV PATH=$PATH:/modelsim/linux:/work/xen/tools/unix
ENV RT11=/usr/local/share/rt11
# Update APT repo metadata
RUN apt-get -y update
# Install tools and runtime libs for SIMH
RUN apt-get -yq install \
ca-certificates \
iverilog git make vim jq curl dos2unix srecord \
libsdl2-2.0-0 \
libsdl2-ttf-2.0-0 \
libpcre3 \
libedit2 \
libpng16-16 \
libpcap0.8 \
libvdeplug2 \
>/dev/null
# Enable i386 architecture
RUN dpkg --add-architecture i386 && apt-get -y update
# Install 32-bit libc and other useful tools
RUN apt-get -yq install libc6:i386 gcc-multilib g++-multilib \
libxft2:i386 libxext6:i386 libncurses5:i386
COPY --from=builder /usr/local/bin/* /usr/local/bin/
# COPY --from=builder /usr/local/src/simh-master/BIN/pdp11 /usr/local/bin/
# COPY --from=builder /usr/local/src/simtools/crossassemblers/macro11/macro11 /usr/local/bin/
COPY --from=builder /usr/local/src/retroutils/bin2load/bin2load /usr/local/bin/
# Install binutils and gcc from https://1801bm1.com/ubuntu APT repo
ADD docker/1801bm1.list /etc/apt/sources.list.d/
ADD docker/1801bm1.gpg.asc /etc/apt/trusted.gpg.d/1801bm1.gpg.asc
RUN apt-get -y update
RUN apt-get -yq install gcc-14-pdp11-cross binutils-pdp11-cross simh
# Make RT-11 stuff
RUN mkdir -p /usr/local/share/rt11/Disks
WORKDIR $RT11
# 1. Get an empty RL02 disk image where your installation will live.
RUN curl -LO -s http://www.dbit.com/pub/pdp11/empty/rl02.dsk.gz && \
gunzip rl02.dsk.gz && \
mv rl02.dsk Disks/empty-rl02.dsk
# 2. Get the Mentec software kit distributed as RL02 image
RUN curl -LO -s http://simh.trailing-edge.com/kits/rtv53swre.tar.Z
RUN zcat rtv53swre.tar.Z |tar -xvf - && rm rtv53swre.tar.Z
ADD xen/rt11/STARTF.COM .
ADD xen/rt11/HALT.MAC .
ADD xen/rt11/HALT.SAV .
ADD xen/rt11/initial.ini .
ADD xen/rt11/boot.ini .
ADD xen/rt11/pdp11-aout.ld .
ADD xen/tools/unix/init_rt11os_image.sh .
ADD xen/tools/unix/comp_mac2sav.sh /usr/local/bin/
ADD xen/tools/unix/obj2bin.pl /usr/local/bin/
RUN ./init_rt11os_image.sh
# Optional: Clean up to reduce image size
RUN apt-get -y clean all ; rm -rf /var/cache/apt/ /var/lib/apt/lists/*
WORKDIR /work
86 changes: 86 additions & 0 deletions docker/Dockerfile.ubuntu-noble
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
FROM ubuntu:24.04 as builder
LABEL org.opencontainers.image.authors="yshestakov@gmail.com"
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV RT11=/usr/local/share/rt11
RUN apt-get -q update >/dev/null
RUN apt-get -yq install \
cmake gcc g++ git make jq curl unzip xz-utils \
libpcre3-dev libedit-dev libpng-dev libpcap-dev \
libsdl2-dev libsdl2-ttf-dev libvdeplug-dev \
>/dev/null
RUN apt-get -y dist-upgrade
RUN git clone https://github.com/nzeemin/ukncbtl-utils.git /usr/local/src/ukncbtl-utils
RUN cd /usr/local/src/ukncbtl-utils; \
make -C rt11dsk V=1 all && install -m 755 rt11dsk/rt11dsk /usr/local/bin/
#
WORKDIR /usr/local/src/
# https://gunkies.org/wiki/Installing_RT-11_5.3_on_SIMH
## Get and build SIMH 4.0
#RUN curl -LO -s https://github.com/simh/simh/archive/refs/heads/master.zip && \
# unzip -x master.zip && ls -l
#RUN cd simh-master && make pdp11 && install -m 755 BIN/pdp11 /usr/local/bin/
## Build macro11 tool
#RUN cd /usr/local/src && git clone https://github.com/simh/simtools.git && \
# cd simtools/crossassemblers/macro11 && make
# Build dectape tool
ADD xen/tools/unix/dectape.c /usr/local/src/
RUN gcc -o /usr/local/bin/dectape /usr/local/src/dectape.c
# Get and build bin2load
RUN cd /usr/local/src && \
git clone https://github.com/jguillaumes/retroutils.git && \
cd retroutils/bin2load && \
make bin2load
# Runtime/worker container
FROM ubuntu:24.04 as worker
LABEL org.opencontainers.image.authors="yshestakov@gmail.com"
ENV PATH=$PATH:/work/xen/tools/unix
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG=C.UTF-8
ENV RT11=/usr/local/share/rt11
RUN apt-get -y update >/dev/null
# Install tools and runtime libs for SIMH
RUN apt-get -yq install \
ca-certificates \
iverilog git make vim jq curl dos2unix srecord \
libsdl2-2.0-0 \
libsdl2-ttf-2.0-0 \
libpcre3 \
libedit2 \
libpng16-16t64 \
libpcap0.8t64 \
libvdeplug2t64 \
> /dev/null
# Install binutils and gcc from https://1801bm1.com/ubuntu APT repo
ADD docker/1801bm1.sources /etc/apt/sources.list.d/
ADD docker/1801bm1.gpg.asc /usr/share/keyrings/1801bm1.gpg.asc
RUN apt-get -y update
RUN apt-get -yq install gcc-14-pdp11-cross binutils-pdp11-cross simh

COPY --from=builder /usr/local/bin/* /usr/local/bin/
# COPY --from=builder /usr/local/src/simh-master/BIN/pdp11 /usr/local/bin/
# COPY --from=builder /usr/local/src/simtools/crossassemblers/macro11/macro11 /usr/local/bin/
# COPY --from=builder /tmp/binutils /
COPY --from=builder /usr/local/src/retroutils/bin2load/bin2load /usr/local/bin/
RUN mkdir -p /usr/local/share/rt11/Disks
WORKDIR $RT11
# 1. Get an empty RL02 disk image where your installation will live.
RUN curl -LO -s http://www.dbit.com/pub/pdp11/empty/rl02.dsk.gz && \
gunzip rl02.dsk.gz && \
mv rl02.dsk Disks/empty-rl02.dsk
# 2. Get the Mentec software kit distributed as RL02 image
RUN curl -LO -s http://simh.trailing-edge.com/kits/rtv53swre.tar.Z
RUN zcat rtv53swre.tar.Z |tar -xvf - && rm rtv53swre.tar.Z
ADD xen/rt11/STARTF.COM .
ADD xen/rt11/HALT.MAC .
ADD xen/rt11/HALT.SAV .
ADD xen/rt11/initial.ini .
ADD xen/rt11/boot.ini .
ADD xen/rt11/pdp11-aout.ld .
ADD xen/tools/unix/init_rt11os_image.sh .
ADD xen/tools/unix/comp_mac2sav.sh /usr/local/bin/
ADD xen/tools/unix/obj2bin.pl /usr/local/bin/
RUN ./init_rt11os_image.sh
# Optional: Clean up to reduce image size
RUN apt-get -y clean all ; rm -rf /var/cache/apt/ /var/lib/apt/lists/*
WORKDIR /work
83 changes: 83 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Development env in Docker
The goal of creating such Docker container is to enable automated build and
tests running as part of CI workflow.

# What is added to the container

* SIMH 4.0-pre with `EXPECT/SEND` commands added, only `pdp11` binary
* `rt11dsk` tool by Zeemen to copy in/out files into RL02 disks
* `dectape` tool by by Bob Frazier to copy in/out files using "DEC tape" aka `MT0` device in RT-11
* RT-11 v5.3 (free for hobby use in SIMH), installed OS in the `rt11os.dsk` image
* Icarus Verilog to run test benches (Ubuntu 24.04 based image).
* a few 32-bit runtime libraries to run ModelSim 10.1d from Quartus 13 (externally mounted to the container)
* GCC 4.3.0 for pdp11-aout target (C compiler only)
* bintuils 2.45: pdp11-aout-{as, ld, ar, objcopy, objdump}
* `pdp11-aout.ld` script to produce executable by RT-11 by GNU binutils
* `bin2load` tool (converts BIN to LDA format)

# Docker image build flow

1. Create intermedita `builder` image to compile SIMH, `dectape` and `rt11dsk` from sources
2. Create final `worker` image, copy binaries from the `builder` image
3. Download Mentec software kit (RT11 V5.3) distributed as RL02 image
4. Automated installation of RT11 according to the
[Installing RT-11 5.3 on SIMH](https://gunkies.org/wiki/Installing_RT-11_5.3_on_SIMH) document
5. Copying a few helper scripts into the image including `comp_mac2sav.sh`

The process is scripted into `docker/build_image.sh` script and it used Podman tool.
It should work with `docker` tool as well:

```sh
docker build -t quay.io/yshestakov/cpu11-tools-noble:latest -f docker/Dockerfile.ubuntu-noble ./
```

Resulting Docker image could be fetched from
[Quay.io/yshestakov/cp11-tools](https://quay.io/repository/yshestakov/cpu11-tools?tab=tags&tag=latest)

# Usage

How to run the container and get interfactive shell (`docker` could be used instead of `podman`):

```
podman run --rm -ti \
-v $(pwd):/work \
quay.io/yshestakov/cpu11-tools-noble:latest \
/bin/bash $@
```


## Compile `test.mac` for T11 as an example


```sh
docker/run_noble.sh -c 'cd t11/tst; comp_mac2sav.sh test.mac'
```

Resulting files will be stored in `t11/tst/out` relative to root of checked out `cpu11.git` repo

## Run Icarus Verilog for T11

```sh
cd ~/work/cpu11/t11/hdl/syn/sim/de0
~/work/cpu11/docker/run_noble.sh -c 'cd /work/t11/hdl/syn/sim/de0; ./run_iverilog.sh'
```

Need to note that `~/work/cpu11` is the directory where `cpu11.git` is checked out


## Run external ModelSim for T11

The goal is to change dir to the proper directory with `run.do` script for particular CPU11 model
and run it usinv `vsim` command in command-line mode:

```sh
~/work/cpu11/docker/run_bionic.sh -c 'cd /work/t11/hdl/syn/sim/de0; vsim -c -onfinish exit -do "run.do" < /dev/null'
```

Need to note about how ModelSim is mounted to the container.
the `run_bionic.sh` script check for `MODELSIM_DIR` directory where actual ModelSim is installed on the host.
By default it uses `/tank/modelsim-q13/13.0sp1/modelsim_ase` if not defined.

In the container `$MODELSIM_DIR` is mounted as a volume into `/modelsim` directory.
Also it is assumed `/modelsim/linux` contains ModelSim binaries including `vsim`

4 changes: 4 additions & 0 deletions docker/build_image_bionic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname $0)/..
IMG=quay.io/yshestakov/cpu11-tools-bionic:latest
podman build -t $IMG -f docker/Dockerfile.ubuntu-bionic . $@
4 changes: 4 additions & 0 deletions docker/build_image_noble.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
cd $(dirname $0)/..
IMG=quay.io/yshestakov/cpu11-tools-noble:latest
podman build -t $IMG -f docker/Dockerfile.ubuntu-noble . $@
12 changes: 12 additions & 0 deletions docker/run_bionic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
ROOT=$(realpath $(dirname $0)/..)
WD=$(realpath $(pwd))
IMG=quay.io/yshestakov/cpu11-tools-bionic:latest
MODELSIM_DIR="${MODELSIM_DIR:-/tank/modelsim-q13/13.0sp1/modelsim_ase}"
podman run --rm -ti \
-v "$ROOT:/work" \
-v "$MODELSIM_DIR:/modelsim" \
-e "EXT_ROOT=$ROOT" \
-e "WD=$WD" \
$IMG \
/bin/bash "$@"
9 changes: 9 additions & 0 deletions docker/run_noble.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
ROOT=$(realpath $(dirname $0)/..)
WD=$(realpath $(pwd))
podman run --rm -ti \
-v "$ROOT:/work" \
-e "EXT_ROOT=$ROOT" \
-e "WD=$WD" \
quay.io/yshestakov/cpu11-tools-noble:latest \
/bin/bash "$@"
14 changes: 14 additions & 0 deletions t11/hdl/syn/sim/de0/iverilog.cf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# +timescale+1ns/100ps
+incdir+../../tbe
#vlog -vlog01compat -work work +incdir+../../tbe {../../tbe/config.v}
../../tbe/config.v
#vlog -vlog01compat -work work +incdir+../../tbe {../../tbe/de0_tb1.v}
../../tbe/de0_tb1.v
#vlog -vlog01compat -work work +incdir+../../tbe {../../../wbc/rtl/t11_plm.v}
../../../wbc/rtl/t11_plm.v
#vlog -vlog01compat -work work +incdir+../../tbe {../../rtl/t11.v}
../../rtl/t11.v
# top module:
#-s tb_t11
# output file
#-o tb_t11.vvp
3 changes: 3 additions & 0 deletions t11/hdl/syn/sim/de0/run_iverilog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash -ex
iverilog -c iverilog.cf -o tb_t11.vvp -s tb_t11
vvp -n -v ./tb_t11.vvp
12 changes: 12 additions & 0 deletions xen/rt11/HALT.MAC
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.TITLE HALT-ME
.MCALL .TTYOUT,.EXIT
PROG:: 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: HALT
.EXIT

MSG: .ASCIZ /HALT SYSTEM /
.END PROG
Binary file added xen/rt11/HALT.SAV
Binary file not shown.
1 change: 1 addition & 0 deletions xen/rt11/STARTF.COM
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set error none
14 changes: 14 additions & 0 deletions xen/rt11/boot.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set cpu 11/23+ 256K noidle
set throttle 10%
set console wru=035
set tto 8b
attach LPT lpt.txt
set rl0 writeenabled
set rl0 rl02
attach rl0 -n rt11os.dsk
set rl1 writeenabled
set rl1 rl02
attach rl1 -n work.dsk
; set rl1 badblock
boot rl0
exit
25 changes: 25 additions & 0 deletions xen/rt11/initial.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
set cpu 11/23+ 256K noidle
set throttle 10%
set console wru=035
set tto 8b
attach LPT lpt.txt
set rl0 writeenabled
set rl0 rl02
attach rl0 -n distribution.dsk
set rl1 writeenabled
set rl1 rl02
attach rl1 -n distribution-backup.dsk
; set rl1 badblock
;--
EXPECT "key when ready to continue." SEND "\r"; GO
EXPECT "Type YES or NO and press" SEND "YES\r"; GO
EXPECT "key when ready to continue." SEND "\r"; GO
EXPECT "Type in the date" SEND "01-JAN-91\r"; GO
EXPECT "key when you have mounted the disk" SEND "\r"; GO
EXPECT "key when you have removed the disk." SEND "\r"; DETACH rl1; GO
EXPECT "key when you have mounted the disk" SEND "\r"; ATTACH rl1 -n rt11os.dsk ; GO
EXPECT "Your working system disk will now be bootstrapped." SLEEP 1; SEND "\r"; GO
EXPECT "V5NOTE.TXT can be TYPED or PRINTED." DETACH rl0; ATTACH rl0 -n empty.dsk; SEND "INIT/NOQUERY DL0:\r" ; SEND "DIR DL0:\r"; SLEEP 1; GO
EXPECT "0 Files, 0 Blocks" ; ECHO [Going-to-Exit-Soon]; EXIT; GO
BOOT rl0
EXIT
Loading