1
0
mirror of https://github.com/PDP-10/its.git synced 2026-02-04 15:53:01 +00:00

VTTIME - display running time on a terminal.

This commit is contained in:
Lars Brinkhoff
2018-06-12 08:06:10 +02:00
parent 79d0540360
commit e930befbe2
5 changed files with 471 additions and 1 deletions

417
src/rvb/vttime.8 Normal file
View File

@@ -0,0 +1,417 @@
title vttime
;;; author RVB@ML
;;; based on an idea of frd
colon==":
t=1
tt=2
c=3
time=4
vert=5
horiz=6
timkpr=7
if1 nextpg==0
if2 nextpg==<patchb+patchl+1023.>_<-10.> ;first free page
pgmapd=12 ;pointer to mapped pages
jclp=13 ;jcl line ildb pointer
outcnt=14 ;characters in output buffer
outp=15 ;output buffer pointer
p=17
ttyo=10
pdll==50
patchl==100 ;patch space
jcll==50 ;200. characters
outl==300 ;siot buffer
hour==3600.
hours==hour
delay: 10.*30.
siot==1 ;use siot's
;siot==0 ;iot
page==1 ;page map time
;page==0 ;don't
.ilose=.lose 1000
.iolose=.lose 1400
;;; iot a character, or put it into an output buffer to be siot'ed
;;;later
define stash channel,ac
ife siot, .iot channel,ac
.else [idpb ac,outp
aos outcnt]
termin
;;; output a control P then the character.
define cntlp channel,char
movei c,20
stash channel,c
movei c,"char
stash channel,c
termin
;;; output the character
define iotchr channel,char
movei c,"char
stash channel,c
termin
;;; output a digit iff the digit is not a leading zero.
;;;c must be set up to detect whether any non zero digit has been seen.
;;;It becomes non blank when a non zero digit is seen.
define zspdig channel,ac
cain ac,0
caie c,"
movei c,(ac)"0
stash channel,c
termin
;;; essentially print a number by recursively dividing and saving
;;;the remainder until the quotient becomes zero. Except this macro is
;;;recursive itself and produces a straight line program. Then too,
;;;this macro is given a list of numbers to divide the "ac" by. Thus
;;;rather than always dividing by 10., you can divide by other numbers
;;;as well. This is useful in dealing with printing out the time. And
;;;lastly, where the "numbers to divide by" (the "divlst") includes non
;;;numbers then they are assumed to be characters that are output as
;;;long as zero suppress has stopped
define outpno ac,divlst
irp car,cdr,[divlst]
ifl .type car,[
ifsn [cdr][][
idivi ac,car
push p,ac+1
outpno ac,[cdr]
pop p,ac
zspdig ttyo,ac
]
.else [
idivi ac,car
movei c,"
caie ac,
movei c,(ac)"0
stash ttyo,c
zspdig ttyo,ac+1
] ]
.else [
outpno ac,[cdr]
movei ac,car
cain c,"
movei ac,"
stash ttyo,ac
]
.istop
termin
termin
go: move p,[-pdll,,pdlb-1]
move jclp,jclptr
move outp,outptr
.suset [.rxjname,,t]
setom rt.onp ;on
setzm et.onp ;off
camn t,[sixbit /ettime/]
setom et.onp ;on
.open ttyo,[4001,,'tty ? 0 ? 0]
.iolose
.call [setz
'cnsget
1000,,ttyo
2000,,vert
2000,,horiz
2000,,t ;tctyp
2000,,t ;ttycom
402000,,t ;ttyopt
]
.iolose
movei vert,-1(vert) ;zero origin addressing
setzm clr
tlne t,%toovr ;can console correctly overprint?
setom clr ; then clear eol before type out.
.break 12,[5,,jclb]
skipe jclb
pushj p,jclprs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; find page in ITS containing TIME
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
move t,fndtim
.eval t,
.ilose
movem t,timloc ;system clock word
movei tt,(t)
ash t,-10. ;page in system
movem t,timpag
trz tt,776000 ;word offset
hrrm tt,timdsp ;timdsp indexes off of pgmapd
move tt,[-2,,nextpg] ;two pages
.call [setz ? sixbit /corblk/
movei %cbred
movei %jself
move tt
movei 400000
setz t]
.ilose
movei pgmapd,nextpg*1024. ;addresability
reinit: .value [asciz/:job
/]
ifn page,move time,@timdsp
.else .rdtime time,
movem time,oldtim ;initialize elapsed time
loop: ifn siot,[ move outp,outptr
setz outcnt,]
cntlp ttyo,S
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; elapsed time
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
et.st: skipn et.onp
jrst rt.st
movei t,-7(horiz) ;seven characters to be printed
movei tt,-1(vert) ;one line up
skipn rt.onp ;only elapsed time
aos tt
pushj p,ttspos
move t,oldtim ;initial count
ifn page,move time,@timdsp ;latest time
.else .rdtime time,
subb time,t ;elapsed time
ifn page,idivi t,2 ;1/2 second units
.else idivi t,30. ;1/30 second units
idivi t,6. ;to minutes * 10.
period==".
;;; outpno t,[10.,period,10.,6.,colon,10.]
idivi t,10. ;tenth's of mins
push p,tt
outpno t,[10.,6.,colon,10.]
iotchr ttyo,. ;force a . out and not zero suppress
pop p,t
zspdig ttyo,t
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; time of day
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
rt.st: skipn rt.onp
jrst finish
movei t,-11.(horiz) ;eleven characters out
movei tt,(vert)
pushj p,ttspos
ifn page,[
move t,@timdsp ;use # of 1/2 seconds since midnight
idivi t,2 ; timer
setzm rt.pm
cail t,12.*hours
setom rt.pm
caige t,13.*hours
jrst rt.am
subi t,12.*hours
jrst rt.oñ¨®NX;.Aÿœä n^C"B$ ÷&M$ ,EeZ}..üh®N[}=$ó^ŽÅ<>ùrÌmû{KñrÆÅËóý<>ûùc×#"W!Qø`ÑEÙ;y$ b+\NM;9(M;9+ÿ¯<¤
HZ.D;,T\[mTóŸžn™;#"A];<îDó¦<C3B3>¬«ó<C2AB>].<2E>C"Ay=MTó—EÎ""#!!;;}LTóÎ<>;9#"Ax;-DóÍÍû{C"Ay=mTó—EÎ#"B,<;9y$ k|móž„ l,h w!x8xl^ L Fd,NM'M.#!!õ®N}]l;#"A}8HM÷nU<6E>Û{{C!!=LTó¦<C3B3>¬«îl ".xl\^([|,|=#!!(9 Dó¦<C3B3>¬«òÛ& !x9ùÝîY([n$Xy ÷ž<E28093>÷/M,côPž<50>ýM-¹+ LðH—n=LzhmZ=LC!!=LTó¦<C3B3>¬«îmlñ€—mÛý̬9;YdY<[aQøJ<0E>ýM-¹+ Lñƒ!#"B:N.ÿ¢N[}=Qøh®Nû×A=[D ýcVæ­l !lL Fñ€•Í9+HL^ûz
ì{xzaQøJ<0E>ýM-¹+ L&&L '6,NLùƒNX;#!!=Mdó¦<C3B3>¬« -lñ€—f+õÊNX;#!!($ó¦<C3B3>¬« L ñ€—lÛó¯=ó.<1C>;YhL^[c"AQû—EÍý÷£¡-»}Y(M÷n¾KòÛF†
ùƒ<>óNÜ«£ôP<C3B4>­ýû.”<0E> c!.û¢ì<C2A2>9ýÐ<C3BD>-™ó e<>;:nøh¡-»}Y:$  j#"A}<mó§O-ëc"A;D k-]|C!!;;}L](kF
j!QB<} zO;kaQøO=í[ó*Ž‹] N#"A;}mùN<>;kC!!:\\nD] LM9c"AQû<51>].<2E>ó“¡-»ÿ¶]$ -î|Z/%ôh¡-»ÿ¶]$ó¢ÅÙ<]
!QB<.=óR<05>|î~üh¡-»ÿ¶T
ý÷§ îf lÿ<1E>%ùû<0E>…÷öèÑA;;}Y-ó^Œ{] îQøJìl;ób ny=Htz> -= n=÷ýÝîÙ:(O÷zäÿ¯Nhy.OH}.L{]!QøJí-û|y!QøN®N}ñ_
="W!QC"CQNnnaÿ~Ý­ûHd [}îz;Y4ó~dY8;M÷nT {ó~=dÿ¯N½ðh®N\'!:;} =HO÷zËdôh¡-»}Y:$ k\QB<zmH Nû¢î
£ôP<EFBFBD>­ýû.” kX#!!<}.=ñN<>;kc!!:;} =HO;k!Qøh¡¡C"YZ-m<zA{]ó§O-ëC"AQZ9[Dz;}KüNÝîÙ(}.N }.NC!!ôJìl;ób ny=Htz> -= n=÷ýÝîÙ:(O÷zäÿ¯Nhy.OH}.L{]!QøH•Í;ÿfþl·#"C!.=<lWøNÝîÙõEŒ™;>!QøJîm™÷/"B-.ûŸD
›ÿ¡Y>=!+X{î~y(O;k!!+X\LZ -  "AQøh¡¡]|î~ýМmÝóg<0E>óÎõ‰ôP<C3B4>­ýû.” ,
Eôh¡.}ó=ó§<C3B3>å<EFBFBD>ðh¡,{û¦Îó§<C3B3>啸h¡-»ÿ¶]$ &
!QB<} zO÷zÎŽƒ"B<m=÷†ä {B"'=÷2 \{{ T[|MfÏ$}Y<NûNîŽc"B<î~óRƒôPœmÝóg<0E>;k AôK¼m™÷$›ý]íƒ"B<î~óRƒôPÑAƒ"ZXmN\nAÿ/OD "M,{.B:; LHkî,{!|xx-d;îDó6žN}dóŸ ,y#"B,<÷Nä kH!ý=
ý÷fD 
Ý;8Y.$|H  c"A\\nDóV=<3D><><"Ax:;D k -!õÝé¤98;N4ó.ì„ÿ2 Œ=#"A|î$ !!8x:-dóÄEã"B(î.\}î,ÿgO."C"Ax:; kLQB( <:;$ kN!QB(N.ÿ¢
L{X9õÞÞ®}Y$ (]-/$
9HDñz|¬ƒ"B:N.ÿ¢
L{];%6c"C!-ûÍλ.B8l;eDL"'<]:; Dów]¬Y<C"Añ<-;(eDN#"A\\nDóV=Œ›#"A;=;îó¢Æ&CôPœ,™óJ…‹-L
5ôh¡-;ó&$ kóV=Ž"B:N.ÿ¢
L{];!Qøh­L{'!÷W]®( î,ÿg<mÃôP<C3B4>-½÷f” l AQøNÝîÙ÷j…™ó.Ì/#"B8l8#"AQZX{<ÿs¡-;ó&$ kX{".|l<÷r<0E>;ób $ h<dÿ.]Äóz Œ»;:.D;C!!8x:-dkD".hî~ó¦<C3B3>íÃ"B(î.\}î,ÿg<mÃ"B8l;HeF-#"A|î$ !!8x:,TkEt"B$î\\}îûÌL9"C!-X{ñÐ<C3B1>-™HeMX{QøN<-;Hk,C"B$ x:8!QøN<-;Hk(øH—l[ÿ¦„ »ó;LDY8-Dó¦<C3B3>¬£"B(î.\} >y=mTó—EÍû\dy=mTó/EÍû\\\}îûÎl{W#"AQøN<-;ù5„]"B$ x:8!QøN<-;ù5„UðH—m]÷ŸDY8;M;9#!!õ®N}ñ¾l½ó~Ô] [{Nñúl½óÖÔ ½ [{NhN.ÿ¢
L{óž=Ë£"C"Ax:;D kY!QB(l8#"Ax:;D kQ!õÞ®®}; óž\„;9!QB(N.ÿ¢ ny=[$] [mnñôy÷¦ý¤= [mnhî.\}î,ÿg<m×#"C!-ûÌL9ñÐ<C3B1>­ýû*
î½óËf<EFBFBD>ñƒv x.<z:+h,÷" L{|M÷~çD w7#!!;;}L](}.LÿwE†-õpÑA+Xx;îD|y.OHh=>Z.Dñ=-ýñzä;}Y--tñú
î½dÿ/ODÿ¯LmÝòèÑA+Z;{î~ÿ(ÑA+ûNþ„;eLc"B-.\} _óOA¡C"Na÷¦Œ®yõ4 Û9|d ÷Ty÷¢
ŠU1(,d ,#!.] [mnB,ôK½l¹<M~ûn;9!Qû/EÍû\B&ôH—my÷/ »ól¹ñM-¹#"XmNNB,".{.^ÿ¢ m™÷$ »ÿb L¹ûÿž<E28093>;Yc"AQY[YM;.B.>=;~LTñÎ<E2809A>;;yYAõßM-»yYHîý
›ÿ<1E>;ÿr<0E>(5
4óŸžn™;#"NM;9nøK{8< Eôh¡¡]óNÞ 9nB,Qû¦<C3BB>­xnB&"".n ÷>T
?.}ó.Ô
ùùM-¹ôh­í™;'!,"!ÿ6þD÷fy÷"<0E>;9#"AQû—EÎ.B,Q[[{mgB<z/ Z=v,H c"AQ\ 'B8[î|ÿZ "AQûV=Žó“¡&<26>ñƒv XmLøh­L{ó¡,[xzdîX{Qøh­î½G!-î Å<E2809A>ý÷¦!¡[}=G!8[l=ýþ®ðh¡¡[=.,÷c¡,{ÿw>Œ;]c!.=m NB,Q\= =ñМMxzh ÷¦=
ƒôPÑA9÷vD ûc"@ovut
rt.am: caig t,hour
addi t,12.*hours
rt.out: outpno t,[10.,6.,colon,10.,6.,colon,10.]
]
.else [ .rtime time, ;use 6 bit time from system
jumpl time,quittr
setzm rt.pm
move c,time
caml c,noon
setom rt.pm
camge c,[sixbit /13 /] ;accept 00:00:00 to 12:59:59
jrst rt.am
sub time,noon
tlze time,7000 ;carry propagate
add time,[200,,0] ;add 2 more for bcd arithmetic
tlo time,2000 ;put back sixbit "0"
tlne time,770000 ;no leading zero
tlo time,200000
jrst rt.out
rt.am: tlzn c,575700 ;202000 .ie. zero oclock
tlo time,212200 ;12:00:00rt.am
tlnn time,170000 ;1-9 rt.am
tlz time,200000 ;flush leading zero
rt.out: move timkpr,[440600,,time]
movei tt,3
rt.dig: ildb c,timkpr
movei c,40(c)
stash ttyo,c
ildb c,timkpr
movei c,40(c)
stash ttyo,c
sojle tt,rt.ppm
iotchr ttyo,:
jrst rt.dig
quittr: movei t,-4(horiz)
movei tt,(vert)
pushj p,ttspos
move outp,[440700,,[ascii/fail/]]
movei outcnt,4
.call [setz ? sixbit /siot/ ? movei ttyo ? outp ? setz outcnt]
.iolose
jrst exit
]
;;; common to both kinds of real time clock output
rt.ppm: iotchr ttyo,[ ]
movei c,"p
skipn 0,rt.pm
movei c,"a
stash ttyo,c
iotchr ttyo,m
finish: cntlp ttyo,R
ifn siot,[ move outp,outptr
.call [setz ? sixbit /siot/ ? movei ttyo ? outp ? setz outcnt]
.iolose]
pause: move t,delay
.sleep t,
jrst loop
exit: .close ttyo,
.break 16,140000
ttspos: cntlp ttyo,H
movei t,10(t)
stash ttyo,t
cntlp ttyo,V
movei tt,10(tt)
stash ttyo,tt
skipn clr ;if console normally overprints
popj p,
cntlp ttyo,L ;clear to eol
popj p,
jclprs: setz t,
jcllup: ildb c,jclp ;scan till first non space
cain c," ; should be a number or a /
jrst jcllup
cain c,15 ;^M means end of data
popj p,
cain c,"/
jrst jcltyp
cail c,"0
caile c,"9
jrst jclbad ;must be a number if not /'ed
jrst jclnum+3
jclnum: cail c,"0 ;build number
caile c,"9
jrst jcldly
imuli t,12
addi t,-60(c)
ildb c,jclp
jrst jclnum
jcldly: jumpe t,jclscn
imuli t,30.
movem t,delay
caia
jclscn: ildb c,jclp ;scan till a / is seen to delimit an
cain c," ; option
jrst jclscn
cain c,15
popj p,
caie c,"/
jrst jclbad
jcltyp: ildb c,jclp
cain c,"b
caia
cain c,"B ;both elapsed and real time
jrst [setom rt.onp ? setom et.onp ? jrst jclscn]
cain c,"t
caia
cain c,"T ;just real time
jrst [setom rt.onp ? setzm et.onp ? jrst jclscn]
cain c,"e
caia
cain c,"E ;just elapsed time
jrst [setzm rt.onp ? setom et.onp ? jrst jclscn]
jclbad: move outp,[440700,,[ascii/Bad Jcl option: /]]
movei outcnt,15.
.call [setz ? sixbit /siot/ ? movei ttyo ? outp ? setz outcnt]
.iolose
.iot ttyo,c
jrst exit
; these 3 flags are set TRUE if -1
rt.onp: 0 ;keep normal time