-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d1fab9
commit ff2bc0d
Showing
4 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
APP_NAME ?= main | ||
objects := $(patsubst %.S,%.o,$(wildcard *.S)) | ||
|
||
default: $(APP_NAME).rim | ||
|
||
%.o: %.S | ||
pdp1-elf-as $< -o $@ | ||
|
||
$(APP_NAME).bin: script.ld $(objects) | ||
pdp1-elf-ld -o $@ -T $^ | ||
|
||
%.rim: %.bin | ||
pdp1-elf-objcopy -O dec_rim $< $@ | ||
|
||
run: $(APP_NAME).rim | ||
pdp1 startup.pdp1 | ||
|
||
clean: | ||
rm -rf *.o *.bin *.rim | ||
|
||
.PHONY: default run clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* Simple asm program that prints out 'hello, world' on standard output */ | ||
|
||
.section .data | ||
i: | ||
.byte 0 | ||
ptr: | ||
.byte str | ||
len: | ||
.byte end - str | ||
str: | ||
/* TOOD: use .ascii-derived FIODEC directive here */ | ||
.byte 070 | ||
.byte 065 | ||
.byte 043 | ||
.byte 043 | ||
.byte 046 | ||
.byte 033 | ||
.byte 000 | ||
.byte 026 | ||
.byte 046 | ||
.byte 051 | ||
.byte 043 | ||
.byte 064 | ||
.byte 056 | ||
end: | ||
|
||
.section .text | ||
.global _start | ||
_start: | ||
/* load IO register with *ptr and print it */ | ||
lio.i ptr | ||
tyo | ||
|
||
/* ptr++, i++ */ | ||
idx ptr | ||
idx i | ||
|
||
/* if (i == len) goto _start */ | ||
lac i | ||
sas len | ||
jmp _start | ||
|
||
/* halt */ | ||
hlt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
OUTPUT_FORMAT("elf32-pdp1") | ||
ENTRY(_start) | ||
|
||
MEMORY | ||
{ | ||
ram (rwx) : ORIGIN = 0x0, LENGTH = 64K | ||
} | ||
|
||
SECTIONS | ||
{ | ||
.text : | ||
{ | ||
*(.text) | ||
} > ram | ||
|
||
.data 0x400 : | ||
{ | ||
*(.data) | ||
} > ram | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
att ptr main.rim | ||
boot ptr | ||
q |