1
0
mirror of https://github.com/PDP-10/its.git synced 2026-02-16 12:53:06 +00:00

Original GUEST2; VTCLK 6 file.

Timestamped 1982-01-03.
This commit is contained in:
Lars Brinkhoff
2018-09-28 10:37:03 +02:00
parent a84196168f
commit 8418cccfbc
2 changed files with 204 additions and 1 deletions

203
src/guest2/vtclk.6 Normal file
View File

@@ -0,0 +1,203 @@
; Pacific Time zone clock program
; Taken from VTCLK program (by EH)
;
;
TITLE Pacific Time Zone clock progrm for me (KJB)
;Define accumlators
A=1
B=2
C=3
D=4
E=5
F=6
G=7
H=10
I=11
J=12
K=13
L=14
M=15
N=16
P=17
;TTY channels
TTYO==1
TTYI==2
DEFINE SYSCAL OP,ARGS
.CALL [SETZ ? SIXBIT /OP/ ? ARGS ((SETZ))]
TERMIN
START: SYSCAL OPEN,[%CLBIT,,%TJDIS+.UIO
%CLIMM,,TTYO ; Open output channel
[SIXBIT /TTY/]]
.LOSE %LSFIL
.CALL [SETZ ? SIXBIT/OPEN/
[.UAI,,TTYI] ? [SIXBIT/TTY/] ((SETZ)) ]
.LOSE %LSFIL
move p,[-lpdl,,pdl]
MOVEI A,[ASCIZ/Multi-Time Zone clock program.
/]
PUSHJ P,ASCOUT
MOVEI A,[ASCIZ/0=Eastern 1=Central 2=Mountain 3=Pacific
/]
PUSHJ P,ASCOUT
MOVEI A,[ASCIZ/Which time zone are you in (0-3)?/]
PUSHJ P,ASCOUT
INPUT: .IOT TTYI,A
CAIGE A,"0
JUMPA INPUT
CAILE A,"3
JUMPA INPUT
IN1: SUBI A,48. ; convert to decimal from ASCII
MOVEM A,ZONE ; Time zone factor
.VALUE [ASCIZ /  :FORGET
:VK /] ;Proceed job, but allow it to print out. -Klotz
RE: .IOT TTYO,[^P] ; Save cursor pos
.IOT TTYO,["S]
MOVEI A,1 ; Set flag so later ESC j is skipped
MOVEM A,FLAG ; otherwise things get screwed up
move p,[-lpdl,,pdl]
SETZ B,
SETZ A,
SETZ C,
.IOT TTYO,[^P] ; Position
.IOT TTYO,["V] ; Cursor to
.IOT TTYO,[7+31.] ; Line 31
.IOT TTYO,[^P] ; Column 1
.IOT TTYO,["H] ;
.IOT TTYO,[7+1.] ;
MOVE B,ZONE
CAIN B,3
MOVEI A,[ASCIZ/Time (Pacific) =/]
CAIN B,2
MOVEI A,[ASCIZ/Time (Mount.) =/]
CAIN B,1
MOVEI A,[ASCIZ/Time (Central) =/]
CAIN B,0
MOVEI A,[ASCIZ/Time (Eastern) =/]
PUSHJ P,ASCOUT
MOVSI A,-1 ; Load A with -1,,0
MOVEM A,ONE ; Load it into ONE
CLOCK: SETZ A, ; Clear A
.RTIME A, ; Get the Time
MOVEM A,TIME ; Transfer it to TIME
SETZ C, ; Clear C
MOVSI D,-3 ; D=counter
MOVE B,[440600,,TIME] ; B=SIXBIT byte pointer
MOVEM B,TIMEP ; Set it up
; get the HH and do nesscary time zone computations
ILDB A,TIMEP
ADDI A,32.
SUBI A,48.
IMULI A,10. ;Tens of Hours
ILDB B,TIMEP
ADDI B,32.
SUBI B,48. ;Ones of Hours
MOVEM B,TRASH ;temp storage
ADD A,TRASH ; Now we have the HOURS in A
SUB A,ZONE ;Subtract to match your time zone
CAIGE A,0 ; Midnight or after ?
ADDI A,24. ;Negative,add 24 to restore;-1=23 O'clock
SETZ B,
CAILE A,12. ; time 0<=x<12 means AM
MOVEI B,1
MOVEM B,AMPM
SUBI A,12. ; Convert to 12 hour time
CAIGE A,0 ; x<=0 if time was 0-12
ADDI A,12. ; fix it
CAIN A,0
MOVEI A,12. ; Should be 12 instead of 0 o'clock
SETZ C,
CAMN C,FLAG ; During INIT,FLAG is set
.IOT TTYO,[^P]
.IOT TTYO,["S] ; save cursor pos
.IOT TTYO,[^P] ; Position
.IOT TTYO,["V] ; cursor to
.IOT TTYO,[7+31.] ; 31st line
.IOT TTYO,[^P] ; column 28
.IOT TTYO,["H]
.IOT TTYO,[7+18.]
;Hours is in A
PUSHJ P,DECOUT ; Print the hours
.IOT TTYO,[":]
LOOP: MOVSI C,-2 ; Print M M
LOOP1: ILDB A,TIMEP ; Get a byte (0-6bits)
ADDI A,32. ; Add 32 dec to make into 0-9
.IOT TTYO,A ; Print it (SIXBIT=bit 0-5)
AOBJN C,LOOP1 ; Bump counter
MOVE A,AMPM ; AMPM=1 if PM
.IOT TTYO,[" ]
JUMPE A,AM
.IOT TTYO,["p]
.IOT TTYO,["m]
JUMPA SLEEP
AM: .IOT TTYO,["a]
.IOT TTYO,["m]
SLEEP: .IOT TTYO,[^P]
.IOT TTYO,["R] ;Restore cursor pos.
MOVE A,FLAG
JUMPN A,LOADP ; If init skip sleep
MOVEI A,1200
.SLEEP A, ; Sleep for 40 secs
LOADP: SETZ A, ; Clear A
MOVEM A,FLAG ; Zero FLAG
ascout: hrli a,440700 ;If C=1, "#" => "", else => "s"
ascou1: ildb b,a
jumpe b,cpopj
cain b,"#
jrst [movei b,"s
caie c,1
.iot ttyo,b
jrst ascou1]
.iot ttyo,b
jrst ascou1
decout: move c,a ;leaves number in C.
decou1: idivi a,10.
hrlm b,(p)
cpopj: popj p,
blank: popj p,
WARN:
POPJ P,
nfstys: 0
nfjobs: 0
nidle1: 0
nidle5: 0
nidl10: 0
trash: 0 ;Place for the unused values from syscals.
pat: patch:
block 40
epatch: -1
lpdl=10
pdl: block lpdl
TIME: BLOCK 1 ; One word storage
TIMEP: 0 ; Pointer
ONE: 0 ; Store a -1,,0
FLAG: 0 ; Flag
ZONE: 0
AMPM: 0 ; AM/PM
CURSOR: 0
END START