Skip to content

Instantly share code, notes, and snippets.

@jblang
Created August 31, 2017 23:44
Show Gist options
  • Save jblang/0f213f2f4177bd49e2abad5876272023 to your computer and use it in GitHub Desktop.
Save jblang/0f213f2f4177bd49e2abad5876272023 to your computer and use it in GitHub Desktop.
Hello World for the PDP-1
hello
/ above: title line - was punched in human readable letters on paper tape
/ below: location specifier - told assembler what address to assemble to
100/
lup, lac i ptr / load ac from address stored in pointer
cli / clear io register
lu2, rcl 6s / rotate combined ac + io reg 6 bits to the left
/ left 6 bits in ac move into right 6 bits of io reg
tyo / type out character in 6 right-most bits of io reg
sza / skip next instr if accumulator is zero
jmp lu2 / otherwise do next character in current word
idx ptr / increment pointer to next word in message
sas end / skip next instr if pointer passes the end of message
jmp lup / otherwise do next word in message
hlt / halt machine
ptr, msg / pointer to current word in message
msg, text "hello, world" / 3 6-bit fiodec chars packed into each 18-bit word
end, . / sentinel for end of message
start 100 / tells assembler where program starts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment