--- /dev/null
+MIT/X Consortium License
+
+© 2020 Aaron Taylor <ataylor at subgeniuskitty dot com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
--- /dev/null
+#############################################################
+# (c) 2020 Aaron Taylor <ataylor at subgeniuskitty dot com> #
+# See LICENSE.txt file for copyright and license details. #
+#############################################################
+
+
+####################################################################################################
+# GNU Executables & Flags
+
+CC = pdp11-aout-gcc
+LD = pdp11-aout-ld
+AS = pdp11-aout-as
+OC = pdp11-aout-objcopy
+OD = pdp11-aout-objdump
+
+CC_FLAGS = -c -Wall -Wno-unused-function -O0 -ffreestanding -fomit-frame-pointer -fno-builtin-alloca -std=c99
+LD_FLAGS = -T pdp11.ld --entry _start
+AS_FLAGS =
+OC_FLAGS = --only-section=.text --output-target binary
+
+
+####################################################################################################
+# Misc Configuration
+
+# Physical serial port connected to a PDP-11 for transfering program into memory.
+SERIAL_PORT = /dev/cuau0
+
+# Commands for converting raw binary into SIMH or real PDP compatible formats.
+SIM_LOAD = bin2load
+PDP_LOAD = bin2pdp
+
+# Commands for running the SIMH PDP-11 simulation.
+SIMH_CMD = pdp11
+SIMH_CFG = simh.conf
+
+# List of all source files in PDP-11 library.
+PDPLIB_SRC != ls pdp11/*.c
+
+
+####################################################################################################
+# Targets
+
+all: aout
+
+aout:
+ $(AS) $(AS_FLAGS) -o init.o init.s
+ $(CC) $(CC_FLAGS) -o pdp11.o $(PDPLIB_SRC)
+
+ ##############################################
+ # Insert your program's build commands here. #
+ $(CC) $(CC_FLAGS) -o hello.o hello.c
+ ##############################################
+
+ $(LD) $(LD_FLAGS) init.o pdp11.o hello.o -o program.out
+
+clean:
+ @rm -rf *.o *.out *.pdp11 *.bin *.core
+
+sim: aout
+ $(OC) $(OC_FLAGS) program.out program.bin
+ $(SIM_LOAD) -i program.bin -o program.pdp11 -a 01000
+ $(SIMH_CMD) $(SIMH_CFG)
+
+pdp: aout
+ $(OC) $(OC_FLAGS) program.out program.bin
+ $(PDP_LOAD) -i program.bin -o $(SERIAL_PORT)
+
+examine: aout
+ @$(OD) -d program.out
--- /dev/null
+/* (c) 2020 Aaron Taylor <ataylor at subgeniuskitty dot com> */
+/* See LICENSE.txt file for copyright and license details. */
+
+#include "pdp11/pdp11.h"
+
+void
+hello(void)
+{
+ wait(01000);
+ putch('H');
+ putch('e');
+ putch('l');
+ putch('l');
+ putch('o');
+ putch(',');
+ putch(' ');
+ putch('W');
+ putch('o');
+ putch('r');
+ putch('l');
+ putch('d');
+ putch('!');
+ putch('\n');
+}
--- /dev/null
+# (c) 2020 Aaron Taylor <ataylor at subgeniuskitty dot com>
+# See LICENSE.txt file for copyright and license details.
+
+.globl _start
+
+_start:
+ mov $01000,sp
+ jsr pc,_hello
+ halt
--- /dev/null
+OUTPUT_FORMAT("a.out-pdp11")
+ENTRY(start)
+phys = 00001000;
+SECTIONS
+{
+ .text phys : AT(phys) {
+ code = .;
+ *(.text)
+ *(.rodata)
+ . = ALIGN(0100);
+ }
+ .data : AT(phys + (data - code))
+ {
+ data = .;
+ *(.data)
+ . = ALIGN(0100);
+ }
+ .bss : AT(phys + (bss - code))
+ {
+ bss = .;
+ *(.bss)
+ . = ALIGN(0100);
+ }
+ end = .;
+}
--- /dev/null
+/* (c) 2020 Aaron Taylor <ataylor at subgeniuskitty dot com> */
+/* See LICENSE.txt file for copyright and license details. */
+
+#include <stdint.h>
+
+/*
+ * Polled console I/O
+ */
+
+#define RCSR (*((volatile uint16_t *)0177560))
+#define RBUF (*((volatile uint16_t *)0177562))
+#define XCSR (*((volatile uint16_t *)0177564))
+#define XBUF (*((volatile uint16_t *)0177566))
+
+void
+putch(uint16_t c)
+{
+ while((XCSR && 0200) == 0) continue;
+ XBUF = c;
+}
+
+uint16_t
+getch(void)
+{
+ while((RCSR && 0200) == 0) continue;
+ return RBUF;
+}
+
+/*
+ * Busy-loop
+ */
+
+void
+wait(uint16_t count)
+{
+ while (count--) continue;
+}
--- /dev/null
+/* (c) 2020 Aaron Taylor <ataylor at subgeniuskitty dot com> */
+/* See LICENSE.txt file for copyright and license details. */
+
+#ifndef SGK_PDP11_H
+#define SGK_PDP11_H
+
+#include <stdint.h>
+
+void putch(uint16_t);
+uint16_t getch(void);
+void wait(uint16_t);
+
+#endif /* SGK_PDP11_H */
--- /dev/null
+set cpu 11/73
+set cpu 4M
+
+; Optional line printer
+; att lpt printer.txt
+
+; Eight terminal lines accessible via telnet to port 1170.
+; set dci en
+; set dci lines=8
+; att dci 1170
+
+load program.pdp11
+go 1000