From f78c65e3ccd44a3b81d2d883a2dfdb6f12d6f969 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Sun, 4 Dec 2016 22:25:49 +0100 Subject: [PATCH] Build NWATCH. --- Makefile | 2 +- README.md | 1 + build/build.tcl | 3 + src/eak/macros.36 | 117 ++++++++++++++++++++++++++ src/sysen1/nwatch.38 | 196 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 318 insertions(+), 1 deletion(-) create mode 100755 src/eak/macros.36 create mode 100755 src/sysen1/nwatch.38 diff --git a/Makefile b/Makefile index 50c460d8..a225b889 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ EMULATOR ?= simh -SRC = system syseng sysen1 sysen2 sysnet kshack dragon channa midas _teco_ emacs emacs1 rms klh syshst sra mrc ksc cstacy gren bawden emacs1 _mail_ l lisp liblsp libdoc comlap lspsrc nilcom rwk inquir acount gz +SRC = system syseng sysen1 sysen2 sysnet kshack dragon channa midas _teco_ emacs emacs1 rms klh syshst sra mrc ksc eak cstacy gren bawden _mail_ l lisp liblsp libdoc comlap lspsrc nilcom rwk inquir acount gz DOC = info _info_ sysdoc kshack _teco_ emacs emacs1 MINSYS = _ sys sys3 device sysbin inquir diff --git a/README.md b/README.md index df34591e..b179b2dc 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ from scratch. - JOBS, list jobs by category - HSNDEV, HSNAME device - PR, print out various system documentation + - NWATCH, small watch display. 6. A brand new host table is built from the host table source and installed into SYSBIN; HOSTS3 > using H3MAKE. diff --git a/build/build.tcl b/build/build.tcl index 0e6848f2..976a01ad 100644 --- a/build/build.tcl +++ b/build/build.tcl @@ -315,6 +315,9 @@ expect ":KILL" respond "*" ":midas sys3;ts ddtdoc_syseng;ddtdoc\r" expect ":KILL" +respond "*" ":midas sys1;ts nwatch_sysen1;nwatch\r" +expect ":KILL" + respond "*" ":midas channa;atsign taraka_syseng; dragon\r" expect ":KILL" respond "*" ":link sys; atsign dragon,channa; atsign taraka\r" diff --git a/src/eak/macros.36 b/src/eak/macros.36 new file mode 100755 index 00000000..954c4d27 --- /dev/null +++ b/src/eak/macros.36 @@ -0,0 +1,117 @@ +; MACROS - MIDAS macros for ITS + + +IF2 .INEOF ; only assemble on pass 1 + +define tellversion +if1 [ +.tyo6 .ifnm1 +printx " " +.tyo6 .ifnm2 +printx " Included in this assembly +"] +termin + +tellversion + + +SUBTTL Definitions + +; Macro to define registers +define register name +if1 [ +name=:.reg. +.reg.==.reg.+1 +] +termin + +.reg.==0 + + +; Register definitions +register F ; program flags +register P ; pdl ptr +register T ; temporaries +register T1 ; (not saved by uuos) +register T2 +register A ; A-E saved by subrs +register B +register C +register D +register E + +; Define acs for .I and .F +A0==:T +A1==:T1 +A2==:T2 + +TT==:T1 ; for using other MACRO packages + +; Common byte-pointer LH's +$opcod==:331100 ; Instruction op-code +$acfld==:270400 ; Instruction AC field + + +; .BREAK 12, codes (as defined by DDT) +..rcmd==:5 ; read command line +..scmd==:400005 ; set command line +..rrnd==:14 ; read ..URANDM +..srnd==:400014 ; set ..URANDM + + +EQUALS BEGIN,.BEGIN ; BEGIN looks better than .BEGIN +EQUALS VAR,.SCALAR ; Use VAR for vectors and scalars + + +; Macro to print on tty during assembly +define inform a,b,c,d,e,f,g +printx á!b!c!d!e!f!g +Š termin + + +; Macro to define bit names for use with ac F. +define flag x +if1 [ +ife %f.&777777, .ERR Too many flags declared +%f!x==%f. +.c"%f.==%f._1 +] +termin + +%f.==1 ; for defining flags in RH of F +%f==525252 ; for DDT's bit typeout mode + + +; Macro to define channel no.s +define channel name +if1 [ +name==:.chnl. +.chnl.==.chnl.+1 +] +termin + +.chnl.==1 + + +; Macro to produce string constant +define string &x& +440700,,[ascii x] ? .length x termin + + +; Macro to simulate KL10's ADJSP instruction +define adjsp sp,amt +ifl amt, sub sp,[-amt,,-amt] +.else [ add sp,[amt,,amt] + jumpl sp,.+2 + .suset [.sipirq,,[%pipdl]] + ] +termin + + +; Macro to output string constants +define sout ch,ctrl,&s& + move t1,[440700,,[ascii s]] + movei t2,.length s + $call siot,[ch,t1,t2][][ctrl] + .lose %lssys +termin diff --git a/src/sysen1/nwatch.38 b/src/sysen1/nwatch.38 new file mode 100755 index 00000000..1bb189d3 --- /dev/null +++ b/src/sysen1/nwatch.38 @@ -0,0 +1,196 @@ +; NWATCH - Watch for non-TVs -*-MIDAS-*- +versio==.fnam2 + +title Digital watch + + +.insrt syseng;$call macro +.insrt eak;macros > +bp=d +cc=e + +tyoc==1 + + +lpdl==10 +lcmdbuf==10 + +var stime ; sleep time, i.e. time between updates +var oline ; output line no. +var linel ; terminal line length +var pagel ; terminal page length +var pdl(lpdl) ; stack +var cmdbuf(lcmdbuf) ; command buffer +var obuf(4) ; output buffer + +flag ovr ; set if TTY can't overprint +flag mil ; use 24 hour (military) time +flag pact ; use the paacific time zone +flag secs ; include seconds in display + +nwatch: move p,[-lpdl,,pdl-1] ; set up stack + .suset [.roption,,f] + trz f,%fovr+%fmil+%fsecs ; init flags + movei t,5*30. ; init sleep time to 5 seconds + movem t,stime ; ... + setzm oline ; use top line for output + .open tyoc,[.uio,,'tty] + .lose %lsfil + $call cnsget,[#tyoc][pagel,linel,t,t,a] + .lose %lssys ; too bad + tlne a,%toovr ; copy %TOOVR into %FOVR + tro f,%fovr + aos linel ; include continuation column in linel + tlnn f,optcmd ; superior have a command line for us? + jrst cmd3 + move t,[cmdbuf,,cmdbuf+1] ; clear command buffer + setzm cmdbuf + blt t,cmdbuf+lcmdbuf-1 + .break 12,[5,,cmdbuf] ; read command from superior + move a,[440700,,cmdbuf] ; b.p. to command buffer + movei b,0 + ldb t,[350700,,cmdbuf] ; get first char of JCL + caie t,"? ; requesting doc? + jrst cmd1 + sout #tyoc,,"NWATCH command line options: + No. of seconds between updates (5 sec default) +/B Display on bottom line of screen +/M Use 24 hour time +/S Display seconds +/P Convert time to pacific time zone +" + jrst quit +cmd1: ildb t,a ; take no. of seconds to sleep from + cail t,"0 ; command line and convert to binary + caile t,"9 + jrst cmd2 + imuli b,10. ; multiply previous crap by 10 + addi b,-"0(t) ; add in this digit + jrst cmd1 +cmd2: imuli b,30. ; convert to 30ths + skipe b ; don't allow a zero sleep time + movem b,stime ; store sleep time + caia ; character already in T, skip ILDB +cmd2a: ildb t,a ; get next character + caie t,^M ; CR or ^C? + cain t,^C + jrst cmd3 + caie t,"/ ; terminator a slash? + jrst cmd2a + ildb t,a ; get character after slash + cail t,"a ; lowercase letter? + caile t,"z + caia + subi t,40 ; convert to uppercase + cain t,"M ; /M? + tro f,%fmil ; /M, use 24 hour time + move b,pagel ; get bottom line no. + cain t,"B ; /B? + movem b,oline ; /B, make output line the bottom line + cain t,"S ; /S? + tro f,%fsecs ; /S, include seconds in output + cain t,"P ; /P? + tro f,%fpact ; /P, use pacific time zone + jrst cmd2a +cmd3: tlne f,optddt + .value [asciz ":FORGET "] ; start running + +update: move bp,[440700,,obuf] ; buffer ptr + movei cc,0 ; character count + move a,[440700,,[asciz "SV"]] + pushj p,ascout ; buf ^PV for setting vertical position + move t,oline ; get output line no. + addi t,8 ; add 8 for ITS + idpb t,bp ; store vertical position + aos cc ; ... + move a,[440700,,[asciz "H"]] + pushj p,ascout ; buf ^PH for setting horizontal position + move t,linel ; get horizontal position + subi t,5 ; subtract no. of chars in time + trne f,%fsecs ; seconds too? + subi t,3 ; need three more chars + addi t,8 ; add 8 for ITS + idpb t,bp ; move there + aos cc + trnn f,%fovr ; can TTY overprint? + jrst l1 ; no, don't need to erase to end of line + move a,[440700,,[asciz "L"]] ; output an erase to end of line + pushj p,ascout +l1: $call rqdate,,a ; get date + .lose %lssys + movei a,(a) ; time is low 18 bits + idivi a,60.*2 ; convert from half seconds to minutes + push p,b ; now minutes in a, half seconds in b + idivi a,60. ; convert to hours and minutes + trnn f,%fpact ; pacific time zone? + jrst l1.5 + subi a,3 ; we're 3 hours behind + jumpge a,l1.5 ; no wrap to worry about + addi a,24. ; correct to the previous day +l1.5: trne f,%fmil ; 24 hour time? + jrst l2 + cail a,12. ; convert from 24 hour to 12 hour time + subi a,12. + cain a,0 ; in 12-hour mode the first hour after midnight + addi a,12. ; is called 12 o'clock too. +l2: pushj p,deczs ; put out hours + movei t,": + idpb t,bp ; put in ":" + aos cc + move a,b + pushj p,decout ; put out minutes + pop p,a ; restore half seconds + trnn f,%fsecs ; seconds? + jrst l3 + movei t,": + idpb t,bp ; put in ":" + aos cc + lsh a,-1 ; convert to seconds + pushj p,decout +l3: move a,[440700,,[asciz "R"]] + pushj p,ascout + move bp,[440700,,obuf] + $call siot,[#tyoc,bp,cc],#%tjdis+%tjctn + .lose %lsfil +; $call finish,#tyoc +; .lose %lsfil + move t,stime + .sleep t, ; sleep peacefully + jrst update + +ascout: ildb t,a + jumpe t,cpopj + idpb t,bp + aos cc + jrst ascout +cpopj: popj p, + + +deczs: push p,b + idivi a,10. + addi a,"0 + cain a,"0 + movei a,40 + jrst dec1 + +decout: push p,b + idivi a,10. + addi a,"0 +dec1: idpb a,bp + aos cc + addi b,"0 + idpb b,bp + aos cc + pop p,b + popj p, + + +quit: .break 16,140000 + .value + + +constants +variables + + +end nwatch