.TITLE HERTZ .IDENT /112283/ ;************************************************************************ ; ; Program to modify the system clock to run at either 50 or 60 Hertz. ; ; Syntax: HTZ 50. ; HTZ 60. ; ; Dept: DPG ; Date: 22-NOV-83 ; Author: Peter V. DeVita ; ; Modified ; -------- ; ; ;************************************************************************ .ENABL LC .NLIST BEX .NLIST ME .MCALL EXIT$S,QIOW$S,DIR$,EXST$S,GMCR$,SWSTK$ .PAGE .SBTTL Local Macros .MACRO MSG NUM,MESSAGE MSG'NUM: .ASCII <15><12>"MESSAGE"<15><12> MSGL'NUM=.-MSG'NUM .EVEN .ENDM .MACRO PRINT MSGNUM QIOW$S #IO.WVB,#5,#1,,,,<#MSG'MSGNUM,#MSGL'MSGNUM> MOV #4,EXST .ENDM .PAGE .SBTTL MAIN - Code Section ;+ ; This is the main program control loop. ; ;- START: CALL GETCMD ; Get MCR command line CALL PARCMD ; Parse the command line for clock speed CALL SETHRZ ; Go set the proper Hertz CALLR EXIT ; Exit .PAGE .SBTTL GETCMD -- Get MCR Command. ;+ ; ; Get the MCR command line typed. ; ; INPUT ; None. ; ; OUTPUT ; MCRBUF = Start of Typed MCR command or command prompted for. ;- GETCMD: TST MCRFLG ; First time through ? BNE 4$ ; BR if no DIR$ #MCRDPB ; Get MCR command line MOV $DSW,R1 ; Char counter BLT 2$ ; Failed TSTB MCRBUF ; Character in buffer ? BNE 3$ ; BR if yes 4$: QIOW$S #IO.RPR,#5,#1,,#IOSB,,<#MCRBUF,#6,,#HTZPMT,#PMTSIZ,#44> CMPB $DSW,#IS.SUC ; Success ? BEQ 1$ ; BR if yes 2$: PRINT 2 ; Read failed CALLR EXIT ; 1$: INC MCRFLG ; Say we had to prompt for command line 3$: RETURN .SBTTL PARCMD -- Parse Command. ;+ ; ; Parse the MCR command line for Hertz value. ; ; INPUT ; MCRBUF = MCR command line. ; ; OUTPUT ; NEWHTZ = New value (in octal) to set Hertz to. ; ;- PARCMD: MOV #MCRBUF,R0 ; Input buffer BEQ 2$ ; If = then end of line CALL $CDTB ; Convert ASCII decimal to binary CMPB #'.,R2 ; Conversion complete ? BEQ 3$ ; BR if yes PRINT 1 ; Syntax error TST MCRFLG ; Prompt mode ? BEQ 4$ ; BR if no MOV #1,EXST ; Reset exit status CALLR START ; Try again 4$: CALL EXIT ; Exit 3$: MOVB R1,NEWHTZ ; Save the octal Hertz number 2$: RETURN .SBTTL SETHRZ -- Set the new Hertz value. ;+ ; ; Set the new Hertz value. ; ; INPUT ; NEWHTZ = New value to set Hertz to ; ; OUTPUT ; ; The number of ticks per second the system thinks the system ; clock is generating will be reset to the NEWHTZ value. ; Either 50. or 60. tps. ; ;- SETHRZ: CMP #50.,NEWHTZ ; 50 ticks per second ? BEQ 1$ ; If = OK CMP #60.,NEWHTZ ; 60 ticks per second ? BEQ 1$ ; If = OK PRINT 3 ; Invalid setting CALLR EXIT ; Exit 1$: MOV NEWHTZ,$TKPS ; Reset the system ticks per second RETURN EXIT: EXST$S EXST ; Exit status .PAGE .SBTTL Local Variables. NEWHTZ: .WORD 0 ; New Hertz setting EXST: .WORD 1 ; Initial exit status = SUCCESS .EVEN MCRDPB: GMCR$ MCRBUF= MCRDPB+G.MCRB+4 ; Ptr to number after UCB IOSB: .BLKW 2 .SBTTL Task error messages. MSG 1, MSG 2, MSG 3, .EVEN MCRFLG: .WORD 0 ; MCR command received flag. HTZPMT: .ASCII <15>/HTZ> / ; HTZ prompt string. PMTSIZ=.-HTZPMT ; HTZ prompt size. .EVEN .END START