Line input routine

42 views
Skip to first unread message

Mike Katz

unread,
Sep 17, 2025, 7:34:06 PMSep 17
to PiDP-8
I'm rewriting a readable text paper tape punch program and I need PAL-8 routine that will input a line of text and return on carriage return.

The following features would be nice (for teletype, glass TTY or VT-100:
  • Convert lower case to upper case
  • Accept backspace and rubout
  • Accept linefeed to display the line
  • Accept control/X or ESC to delete the entry and start over again.
  • Puts out a prompt
  • Either null terminates the end of the string or stores the length of the string somewhere
  • Maximum line length of 60 to 80 characters.
  • Ring the bell when the buffer is full.

I could write this myself but I'm trying to save some time.

If you know of a package or routine like this, please let me know.

Thanks,

     Mike


Steve Tockey

unread,
Sep 18, 2025, 3:07:50 PMSep 18
to PiDP-8

Mike,
More questions need to be answered to see if anything is available or how easy it might be to write a new one:

1) Is this intended to be a completely stand-alone program (e.g., read in using BIN Loader)? Or, is it intended to be a program that runs in the OS/8 environment? The reason this is important in that some of the functionality you are looking for is already built into the OS/8 TTY: device handler but that can only be used if the program is running in the OS/8 environment.

2) If stand-alone, i.e., outside of the OS/8 environment, does it matter if it's running with interrupts on or not? I know for a fact that I have written this kind of code in the past but it was in an interrupts on-based application. OS/8 does not itself play well with interrupts on.

3) The string that gets returned should be unpacked? i.e., one 8-bit character per memory word in the buffer? In many PDP-8 applications, to save memory, characters get compressed to 6 bits then packed two in one 12-bit word. OS/8, by the way, packs three 8-bit characters into two 12-bit words.

4) Behavior on a Teletype could be very different than on a VT-100 regarding backspace and rubout. Whereas the VT-100 can erase the last character and move the cursor left, the "standard" PDP-8 behavior on a Teletype is to print a slash on the first rubout/delete followed by the character deleted for each rubout/delete press followed by another slash when the next character is no longer a rubout/delete. For example, if the user typed the sequence ABCEF<rubout><rubout>DEF it would get printed on the Teletype as:

ABCEF/FE/DEF

5) The "standard" in PDP-8 land is to use Control/U to erase everything, not Control/X

6) It is generally good practice to separate input from output in a situation like this (AKA high cohesion & loose coupling / Single Responsibility in the SOLID sense). I mean, printing a prompt should not be a responsibility of this function because it limits its applicability. You should have a separate output routine that prints stuff. Call the output routine that prints the prompt, then call this routine to get the input.

Finally, how soon is this needed?


Cheers,

-- steve


ggrinton

unread,
Oct 5, 2025, 5:21:44 AM (14 days ago) Oct 5
to PiDP-8
Although it is nearly 50 years since I wrote serious PDP8 code, I decided to treat this as an exercise to check on my memory (and neuron count). The "solution" by perplexity.ai, posted in a separate thread, looked like an interesting place to start, but as anyone else who gave it more than a cursory glance would have seen, it had many problems, both in terms of syntax and logic. However, after a bit of trial and error, and much reference to a few manuals to bone up on OS/8 - used only for development, not for providing system routine support - I managed to get a fully functional version which I believe meets all of the requirements of the OP.  My experience was back in the paper tape only days, so doing 'raw' I/O was my usual approach. Nevertheless, the comments by Steve Tockey point to some significant and desirable modifications to the original requirement.

Thanks for the challenge.
Geoffrey.

Reply all
Reply to author
Forward
0 new messages