;**************************************************************************** ;* * ;* UltraStat 3.x * ;* Main Module * ;* * ;**************************************************************************** ;Copyright (C) 1988, 1989 UltraSoft Corporation. All Rights Reserved. ; ;Written by: David Pallmann ; ;All edit history for USTAT is in USYM.M68. ; ;NOTE: Requires AMOS/L 1.3B or later ASMMSG "== UltraStat 3.x (MAIN) ==" AUTOEXTERN ;--- Include files SEARCH SYS SEARCH SYSSYM SEARCH TRM COPY DSKINF.CPY COPY USYM/L ;--- Program header - contains version number and program attribute flags ; ; -1 - user must be logged in to run USTAT ; PV$RSM - program reads from system memory ; PV$WSM - program writes to system memory ; PH$REE - program is reentrant (may be loaded into SYSTEM memory) ; PH$REU - program is reusable (may be LOADed into user memory) PHDR -1,PV$RSM!PV$WSM,PH$REE!PH$REU ;--- Allocate variable memory in user partition, point register A5 (or "MEM") ; to module. Throughout program, all references to variables are offset ; by the MEM register, as in "FLAGS(MEM)". GETIMP MEMSIZ,MEM ;--- Save command line address for processing later MOV A2,CMDADR(MEM) ;--- Check operating system version to determine what we do and don't have ; to update. If we are running AMOS/L < 1.3B, USTAT can't run. The ; F$32 bit is set in the FLAGS(MEM) longword if we are running AMOS/32. CHECK.VER: BIT #SY$M20,SYSTEM ; is this an AM-2000? JNE 10$ ; yes - is AMOS/32 - has new fields BIT #SY$M30,SYSTEM ; is this an AM-3000? [105] JNE 10$ ; yes - is AMOS/32 - has new fields [105] LEA A2,TEMP(MEM) ; get AMOS VCVT 2,OT$MEM ; version number CLRB @A2 ; as an ASCII string LEA A2,TEMP(MEM) ; point to start of version number CMMB (A2)+,#'1 ; 1xxx? BNE 10$ ; no - must be 2.0 or later [104] CMMB (A2)+,#'. ; 1.xx? BNE 20$ ; no - don't know what to do CMMB (A2)+,#'3 ; 1.3x? BLO 14$ ; no - older BHI 10$ ; yes - has new fields CMPB @A2,#'B ; 1.3B or later? BHIS 10$ ; yes - has new fields 14$: TTYI ; complain about OS level ASCII "?USTAT requires AMOS/32, or AMOS/L 1.3B or later" BYTE 15,0 EVEN EXIT 10$: OR #F$32,FLAGS(MEM) 20$: DEFAULT.TERMINAL: BIT #F$32,FLAGS(MEM) ; do we support TRMCHR? BNE CHECK.TERMINAL ; yes MOVB #22.,LAST.ROW(MEM) ; no - have to simulate it MOVB #78.,ARROW.COL(MEM) MOV #TD$CID!TD$LID!TD$DIM!TD$EOL!TD$EOS!TD$RVA!TD$UND!TD$132,TERM.FLAGS(MEM) MOVW #24.,TERM.FLAGS+TC.ROW(MEM) MOVW #80.,TERM.FLAGS+TC.COL(MEM) JMP INITIALIZE ;--- Check terminal attributes CHECK.TERMINAL: TRMCHR TERM.FLAGS(MEM),0 ;[129] MOVB #22.,LAST.ROW(MEM) MOVW TERM.FLAGS+TC.ROW(MEM),D7 ; [120] SUBW #2,D7 ; [120] MOVB D7,LAST.ROW(MEM) ; [120] MOVB #78.,ARROW.COL(MEM) BIT #TD$STS,TERM.FLAGS(MEM) BEQ 10$ INCB LAST.ROW(MEM) 10$: CMPW TERM.FLAGS+TC.COL(MEM),#132. BNE 20$ OR #F$WIDE,FLAGS(MEM) MOVB #130.,ARROW.COL(MEM) 20$: BIT #TD$PHR,TERM.FLAGS(MEM) BEQ 30$ OR #F$AM70,FLAGS(MEM) 30$: BIT #TD$CLR,TERM.FLAGS(MEM) BEQ 40$ OR #F$COLOR,FLAGS(MEM) 40$: ;--- Set single character mode on terminal and disable echoplex SINGLE: TRMRST D0 ; read terminal status bits ORW #T$DAT!T$ECS!T$XLT,D0 ; set data mode, no-echo [105] TRMWST D0 ; update terminal status ;--- Process USTAT command line [109] ;--- force remainder of command line into terminal input buffer [109] ;--- interpret caret character (e.g. ^A) as control character. [109] PROCESS.CMDLIN: ; [109] SAVE A0-A5,D0-D5 ; save registers [109] MOV CMDADR(MEM),A2 ; point to command line [109] JOBIDX ; point to own JCB [109] MOV JOBTRM(A6),A5 ; point to user's terminal [109] BYP ; bypass leading space [109] 10$: LIN ; end of line? [109] BEQ 30$ ; yes - done [109] MOVB (A2)+,D1 ; get char [109] CMPB D1,#'^ ; caret? [109] BNE 20$ ; no [109] LIN ; end of line? [109] BEQ 30$ ; yes - done [109] MOVB (A2)+,D1 ; get character [109] SUBB #'@,D1 ; make into control character [109] 20$: AND #377,D1 ; we just want the byte [109] TRMICP ; insert char into input buffer [109] BR 10$ ; loop till entire cmdlin done [109] 30$: REST A0-A5,D0-D5 ; restore registers [109] ;--- Initialize flags and storage INITIALIZE: OR #F$HEADER!F$ERSATZ,FLAGS(MEM) ; default to header on MOV #3,DELAY(MEM) ; delay time of 3/5ths of a sec INIT DISK(MEM) ;-- set address of cache buffer (if found) SET.CACHE: SRCH CACHE.BUF,A0 BNE 10$ MOV A0,HD.TBL+HD.CAD(MEM) 10$: ;--- set user flag if any job user names are non-blank SET.NAME.FLAG: BIT #F$32,FLAGS(MEM) ; /32 data structures? BEQ 90$ ; no MOV JOBTBL,A0 10$: MOV (A0)+,D6 BEQ 10$ BMI 90$ MOV D6,A1 TSTB JOBUSN(A1) BEQ 10$ OR #F$USER,FLAGS(MEM) 90$: ;;--- get override delay time from command line, if present ; ;COMMAND.LINE: ; BYP ; NUM ; BNE 10$ ; GTDEC ; CMP D1,#0 ; BLO 10$ ; CMP D1,#9. ; BHI 10$ ; MOV D1,DELAY(MEM) ;10$: ;--- Force screen attributes so we can set flags FORCE: HI ; force high intensity OR #F$ON!F$HIGH,FLAGS(MEM) ; flag cursor on, high int, text mode CUROFF ; turn off the cursor JMP HEADER ;--- drop cursor to bottom of screen and exit FINISH:: BIT #TD$STS,TERM.FLAGS(MEM) BEQ CLEAR.LINE24 CLEAR.STATUS.LINE: STSLIN TYPESP TTYL SPACES ENDLIN CLEAR.LINE24: CLR D0 ; [120] MOVB LAST.ROW(MEM),D0 ; [120] INCB D0 ; [120] CURSOR D0,#1 ; [120] ;[120] CURSOR #24.,#1 CLREOS FIX.TERMINAL: HI CON EXIT SHORT.HELP:: ASCIZ " J=JOBS T=TERMINALS D=DEVICES 0-9=SPEED H=HELP ESC=QUIT " OPR.HELP:: ASCIZ " A=ATTACH D=DETACH F=FORCE K=KILL O=EXIT OPR MODE H=HELP ESC=QUIT " EVEN CACHE.BUF: RAD50 /CACHE / RAD50 /BUF/ EVEN SPACES:: ASCIZ / / EVEN END .