Trailing-Edge - PDP-10 Archives - mit_emacs_170_teco_1220 - emacs/system.mid
There is 1 other file named system.mid in the archive. Click here to see a list.
; -*-MIDAS-*-

comment |
     This macro package is for use in programs which can assemble for more
than one operating system.  An assembly parameter exists for each possible
operating system; if it is nonzero then the assembly is for that operating
system.  Thus if "FOO" is the name of the parameter for an operating system,
then "IFN FOO" is a conditional which assembles iff the output is for that
system.  Corresponding parameters are defined to specify on which operating
system the assembly is taking place.  The currently defined parameter names
are "ITS" for the ITS, "10X" for Tenex, and "20X" for Tops-20.  In addition
"TNX" is defined to be 10X\20X since Tenex and Tops-20 are very much alike.
     To use this package set to 1 the operating system parameters for which
the program is willing to assemble and then .INSRT this package.  Do this
on pass 1 only.  For example,
if1 [
its==1				; can assemble for either ITS or Tops-20
20x==1				; (but not Tenex)
.insrt system
All undefined operating system switches will be set to zero (thus the
program need not know about all the systems defined in this package).
If more than one switch is nonzero then the user will be asked at assembly
time "System? ".  Entering a blank line will default to the system on
which the assembly is taking place.  Entering "?" will list the valid
responses.  Finally entering an operating systme name will select that
system.  Once the system is determined all the other operating system
switches will be set to zero.
     Finally the output format is selected on the basis of the target
system and the $$REL switch (which defaults to zero, i.e. non-relocatable).
If the target system is not the same as the assembly system then the
symbol definitions for the target system are .INSRT'd.

; Determine which system we're assembling on.
.its==:ife .osmidas-sixbit/its/,[1] .else [0]
.10x==:ife .osmidas-sixbit/tenex/,[1] .else [0]
.20x==:ife .osmidas-sixbit/twenex/,[1] .else [0]
.dec==:ife .osmidas-sixbit/dec/,[1] .else [0]

ifdef tnx, ifn tnx, 10x==1 ? 20x==1	; TNX==1 is like 10X==1 and 20X==1

; Program doesn't run on a system unless it explicitly says so.
ifndef its, its==0		; ITS
ifndef 10x, 10x==0		; Tenex
ifndef 20x, 20x==0		; Tops-20
ifndef dec, dec==0		; Tops-10
ife its\10x\20x\dec, .fatal	No operating system(s) specified

ifn its+10x+20x+dec-1,[
define	system			; need macro to use .TAG and .GO
.tag retry
	printx "System? "
	.ttymac -response
	  ifn its, ifse [response][ITS]     10x==0 ? 20x==0 ? dec==0 ? .stop
	  ifn 10x, ifse [response][Tenex]   its==0 ? 20x==0 ? dec==0 ? .stop
	  ifn 20x, ifse [response][Tops-20] its==0 ? 10x==0 ? dec==0 ? .stop
	  ifn 20x, ifse [response][Twenex]  its==0 ? 10x==0 ? dec==0 ? .stop
	  ifn dec, ifse [response][Tops-10] its==0 ? 10x==0 ? 20x==0 ? .stop
	  ifn dec, ifse [response][Bots-10] its==0 ? 10x==0 ? 20x==0 ? .stop
	  ifse [response][?]{
	    printx "One of the following:
	    ifn its, printx " ITS	"
	    ifn 10x, printx " Tenex	"
	    ifn 20x, printx " Twenex	"
	    ifn dec, printx " Tops-10	"
	    printx "
	    .go retry
	  ifb [response]{
	    ifn its&.its, 10x==0 ? 20x==0 ? dec==0 ? .stop
	    ifn 10x&.10x, its==0 ? 20x==0 ? dec==0 ? .stop
	    ifn 20x&.20x, its==0 ? 10x==0 ? dec==0 ? .stop
	    ifn dec&.dec, its==0 ? 10x==0 ? 20x==0 ? .stop
	  printx |"response" is not valid.  Type "?" for list.
	  .go retry
system				; ask which system to assemble for
expunge	system			; macro is no longer needed

tnx==10x\20x			; TNX iff either 10X or 20X

; Now that the operating system is determined, pick an output format.
ifndef $$rel, $$rel==:0		; default is not to use crufty linkers
ife $$rel,[
	ifn its, ife .its, sblk
	ife its, .decsav
ifn $$rel,[
	ifn its, relocatable
	ife its, .decrel

; Remove the multitude of output format pseudos now that we've picked one.
expunge	.decsav,.decrel,.dectwo,.sldr,1pass,relocatable,rim,rim10,sblk

ifn its, ife .its, .insrt itsdfs
ifn tnx,[
  ife .tnx,[
    ifn .its,[
	.insrt sys;tnxdfs
	.insrt sys;twxbts
    ife .its,[
	.insrt tnxdfs
	.insrt twxbts
ifn dec,[
  ife .dec, [
    ifn .its,[
	.insrt sys;decdfs
	.insrt sys;decbts
    ife .its,[
	.insrt decdfs
	.insrt decbts

; Page size definitions
ifn its, pg$log==:10.
ifn tnx, pg$log==:9.
ifn its\tnx,[