1
0
mirror of https://github.com/PDP-10/its.git synced 2026-04-17 16:53:08 +00:00
Files
PDP-10.its/src/spcwar/setmac.12
Lars Brinkhoff 4d32246eea Spacewar! game.
Build for both standalone and timesharing.
2018-02-19 08:21:59 -08:00

92 lines
2.9 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
SUBTTL Set Flag and Set Value Macros
;SETFLAG NAME,QUERY,DEFAULT=<ON-or-OFF>
; Function:
; This macro sets the value of an assembly parameter which must be ON (=1) or OFF (=0).
; A default value may be supplied if desired. The user is queried for a value. If
; he/she uses a CR, the default will be used; otherwise, he/she must answer with YES (Y)
; or NO (N).
; Inputs:
; NAME: The flag to be defined. It must be undefined before this macro is used.
; QUERY: A message used to prompt the user. It should be enclosed in quotes.
; DEFAULT (Optional):
; If supplied, it is the default value of the flag and must be ON or OFF.
DEFINE SETFLAG NAME,*QUERY,*+DEFAULT
.TAG RETRY
PRINTC QUERY
IFSN [DEFAULT][] PRINTC " (DEFAULT)"
PRINTC ": "
.TTYMAC %%RPLY
IFSE [%%RPLY][] .STOP
IFSE [%%RPLY][YES] NAME==1 ? .STOP
IFSE [%%RPLY][Y] NAME==1 ? .STOP
IFSE [%%RPLY][NO] NAME==0 ? .STOP
IFSE [%%RPLY][N] NAME==0 ? .STOP
PRINTC "Please answer YES (Y) or NO (N) -- " ? .GO RETRY
TERMIN
IFDEF NAME, .STOP
IFSE [DEFAULT][] PRINTC "Please answer YES (Y) or NO (N) -- " ? .GO RETRY
IFSE [DEFAULT][ON] NAME==1
IFSE [DEFAULT][OFF] NAME==0
TERMIN
;----------------------------------------------------------------------------------------------
;SETVALUE NAME,QUERY,LOW=<exp>,HIGH=<exp>,DEFAULT=<exp>
; Function:
; This macro set the value of an assembly parameter which may take on an arbitrary value
; within certain (optional) limits. In addition, a default value may be given. The user
; is queried for a value. If he/she replies with an empty line, the default value is
; used. If an expression is given, it is used provided that it is within the supplied
; limits.
; Inputs:
; NAME: The assembly parameter to be defined. It must be undefined before invocation.
; QUERY: A prompting message which should be enclosed in quotes.
; LOW (optional):
; HIGH (optional):
; If used, both LOW and HIGH must be supplied. They specify the range of legal
; values for the parameter.
; DEFAULT (optional):
; The default value of the parameter if desired.
; NOTE:
; This macro interprets all inputs and parameters (LOW, HIGH, and DEFAULT) in base ten.
DEFINE SETVALUE NAME,*QUERY,*+LOW,HIGH,DEFAULT
RADIX 10.
.TAG RETRY
%%RTRY==0
PRINTC QUERY
IFSN [LOW][] PRINTC " (LOW - HIGH)"
IFSN [DEFAULT][] PRINTC " (DEFAULT)"
PRINTC ": "
.TTYMAC %%RPLY
IFSE [%%RPLY][] .STOP
IFL .TYPE %%RPLY, NAME==%%RPLY ? .STOP
IFDEF %%RPLY, NAME==%%RPLY ? .STOP
PRINTC "Undefined value; please retry -- " ? %%RTRY==1
TERMIN
IFN %%RTRY, .GO RETRY
IFNDEF NAME,{
IFSN [DEFAULT][] NAME==DEFAULT
.ELSE PRINTC "A value must be supplied -- " ? %%RTRY==1
}
.ELSE,{
IFSN [LOW][][
IFL NAME-LOW, PRINTC "Value is too small; please retry -- " ? %%RTRY==1
IFG NAME-HIGH, PRINTC "Value is too large; please retry -- " ? %%RTRY==1
]
}
IFN %%RTRY, .GO RETRY
RADIX 8.
TERMIN