Clear the Screen (CLR)

36 views
Skip to first unread message

Steven Mason

unread,
Mar 31, 2026, 8:22:20 PMMar 31
to PiDP-8
I know this is probably frivolous but I hate when the screen is filled with clutter and I did not know how to clear the screen on the PIDP-8I so I had AI create this code to clear the screen and return to the . prompt. I named the binary file CLR.BN. I'm sure it is not elegant code, but it seems to work.....

/ CLEAR SCREEN AND RETURN TO OS/8
/ FOR PDP-8 / PIDP-8I

*200                / STARTING ADDRESS

START,  TLS             / INITIALIZE TTY OUTPUT FLAG
        CLA             / CLEAR ACCUMULATOR
        TAD (LIST)      / LOAD ADDRESS OF THE STRING
        DCA POINTER     / STORE IN POINTER

NEXT,   TAD I POINTER   / GET NEXT CHARACTER
        SNA             / IS IT ZERO? (END OF STRING)
        JMP DONE        / IF YES, WE ARE FINISHED
        JMS PRINT       / IF NO, PRINT IT
        ISZ POINTER     / INCREMENT POINTER
        JMP NEXT        / LOOP

DONE,   JMP I (7600)    / JUMP TO OS/8 SYSTEM ENTRY POINT

/ SUBROUTINE TO PRINT A CHARACTER
PRINT,  0
        TSF             / WAIT FOR TTY FLAG
        JMP .-1
        TLS             / SEND CHARACTER
        CLA             / CLEAR AC
        JMP I PRINT     / RETURN

/ DATA
POINTER, 0
LIST,   033             / ESC
        133             / [
        062             / 2
        112             / J
        033             / ESC
        133             / [
        110             / H
        000             / NULL TERMINATOR

$START                  / END OF SOURCE / SET STARTING ADDRESS

Helium Phoenix

unread,
Apr 2, 2026, 1:12:29 PMApr 2
to PiDP-8
"Clearing the screen" is terminal specific, it depends on what kind of terminal (or terminal emulator) you are using to connect to the PDP-8 with.
ESC[2J is the ANSI escape code for "clearing" the screen but actually scrolls a screens-worth of lines in the command prompt window.
For other terminals/terminal-emulators, this will vary greatly.
Reply all
Reply to author
Forward
0 new messages