Skip to content

Instantly share code, notes, and snippets.

@shirriff
Created December 7, 2017 20:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shirriff/b74680bc4825fcfc8ecd026471e57aa6 to your computer and use it in GitHub Desktop.
Save shirriff/b74680bc4825fcfc8ecd026471e57aa6 to your computer and use it in GitHub Desktop.
IBM 1401 assembly code to print a Christmas card
job card.s
ctl 6641
org 087
X1 dcw 000 * Index 1, pointer to text
dc 00
org 333
start sw 1
sbr x1, buf+80
rloop r * Read cards into page buffer
bce rhs, 1, -
mcw 80, 0&x1 * Copy card image to page buffer
bce write, 1, $ * Stop reading when $ card reached, start printing
sbr x1, 132&x1 * Advance x1
b rloop * Read next card
rhs cs 1
sw 1
mcw 80, 66&x1 * Move card image to right half of page buffer
sbr x1, 132&x1
b rloop
write sbr x1, buf * Print buffer
sw 201
wloop mcw 132&x1, 332 * Load card into 201 to 332
bce done, 201, $
w
sbr x1, 132&x1
b wloop * Loop
done cc 1 * eject page
h * Halt: print again if start pushed
b write
buf equ 1000
end start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment