I've had to come at this from an odd direction since the C -> PDP-1 Cross Compiler comes with no printf libraries and generates machine code using GASM (which employs ".ascii" that was not around in the PDP-1 design days). Just to get info out of the PDP-1 using the built-in char sets, I wrote a small C program that would just output Lower Case and Upper Case character tables. Here's a screenshot of the C-program output:
I crafting 6-bit integers and rotate through them for each available character, though, internally I'm also ORing in a 7th bit to indicate from which table the character will output from. The extra 7th bit indicates if the character should be preceded by a lower-case switcher (072) or upper-case switcher (074) character. The putc() code that outputs a character is:
void
pdp1_putc(int c) {
asm volatile ("lio %0" : : "r"(c) : "$io");
asm volatile ("tyo");
}
The odd little box at the bottom of the TTY screen output was crafted using two of the carriage-control characters in the Upper Character Set ('|' (056) and '_' (040)), and the "overbar" character (056) from the Lower Character Set. Those three characters do not advance the printing location when output to the emulated teletype. The C code uses a
#define TTY33
to accommodate the teletype carriage control. I leave TTY33 undefined when using simh to run the PDP1 code on a normal Pi terminal.
The actual need for this kind of putc() code was a stepping stone on the way to be able to output real ASCII strings in a C program e.g.
puts("Hello World!\n");
as well as printing numbers in base 2, 8, 10, and 16 so I could at least develop C debugging output. If it's of any use here are the current C functions that seem to work pretty well on both simh and the distributed PiDP-1 simulator.
main() looking like this:
void
main(void) {
pdp1_ascii_puts("\nHello World!\n");
for(int i=0 ; i < 20 ; i++) {
pdp1_puti(i, TEN_BASE);
pdp1_ascii_puts(") = ");
pdp1_puti(i, OCTAL_BASE);
pdp1_ascii_puts(" = ");
pdp1_puti(i, TWO_BASE);
pdp1_ascii_puts(" = ");
pdp1_puti(i, HEX_BASE);
pdp1_ascii_puts("\n");
}
}
results in this output:
No idea if this is of any use/interest.