 #
 # Data space definitions
 #
 	.globl	_evars
	.set	_evars,0x1000
#ifdef RAM
	.set	modad, 0x8000	# mod table address
	.set	datasp,0x8010	# start of MON16 data space
	.set	codesp,0x180000	# start of MON16 code space
	.set	vstart,0x8800	# start of interrupt table
#else

	.set	modad, 0x0	# mod table address
	.set	datasp,0x10	# start of MON16 data space
	.set	codesp,0x800000	# start of MON16 code space
	.set	vstart,0x400	# start of interrupt table
#endif
	.set	is_size, 0x400  # interrupt stack size (in bytes)
	.set	mon_stack_size,0x200 #mon stack size
 #
 #     m o n i t o r    i n t e r r u p t s    &   t r a p s.
 #
 #
	.globl	reset
	.globl	msgent
	.globl	erent
	.globl	getput
	.globl	sprinta
	.globl	srdlin
	.globl 	printa
	.globl	rdlin
	.globl	hxtobn
	.globl	bntohx
	.globl	mainlp
	.globl 	hexan
	.globl 	mnexit
	.globl	bptrt
	.globl	trcrt
	.globl	nmirt
	.globl	abtrt
	.globl	nvirt
	.globl 	fpurt
	.globl	illrt
	.globl	dvzrt
	.globl	flgrt
	.globl	undrt
	.globl	svcrt
	.globl	_Einit, _Eread, _Ewrite, _Eload

	.globl	_printflag
	.set	_printflag, 0x150000
 #
 #
 #       terminal record
 #
	.set    inlen,64	# length of input buffer
	.set	inbuf,0		# input bufer
	.set	inlm,inbuf+inlen# pointer to last character read
	.set	outb,inbuf      # output buffer (same as input )
	.set	outlm,inlm      # pointer to last byte in outb to be printed
	.set	trmrlg,inlm+4   # terminal record length
 #
 #     global constants
 #
	.set	stalon, 0       # stand alone indicator
	.set	transp, 1       # transparent mode
	.set	true, 1	 	# define logical true
	.set	false, 0	# define logical false
	.set	trma, 0	 	# terminal a
	.set	trmb, 1	 	# terminal b
	.set	nswbpt, 14       # number of software break-points
	.set	psr_u, 8	# u bit in psr
	.set	psr_t, 1	# t bit in psr
	.set	psr_s, 9	# s bit in psr
	.set	psr_p, 10       # p bit in psr
	.set	psrs, 0x200     # psr s number
	.set	psrt, 2	 	# psr t number
	.set	bpr_be, 29      # be bit in bpr reg of mmu
	.set	bpr_ftch, 29	# break point on fetch bit of mmu bpr reg
	.set	bpr_r, 28	# break point on read
	.set	msr_nt, 25      # nt bit in msr
	.set	msr_ft,23	# ft bit in msr
	.set	bptc, 0xf2      # bpt instruction
	.set	rxpc,0x32	# rxp instruction
	.set	puti,1		# put indication for get_put procedure
	.set	cfgn,20		# cfg number in get_put procedure
 #
 #
 #
	.set	handb,0		# hand_shaking bit of opmod word
	.set	handlf,1	# on hand_shaking cr echo is lf
	.set	echob,2		# echo bit
	.set	echolf,3	# flag for echo to cr by cr lf
 #
 #
 #
 #     ascii characters
 #
 #
	.set	cntra, 0x1      # cntr/a
	.set	cntrt, 0x14     # cntr/t
	.set	cr, 0x0d	# return
	.set	lf, 0x0a	# line feed
	.set	dot, 0x2e       # dot
	.set	comma, 0x2c     # comma character
	.set	space, 0x20     # space character
 #
 # ***************************************************************
 #        global variables   (sb relative)
 # *************************************************************** 
 #

    .dsect	globals,	0

opmod:		.blkb		# operation mode variable
ophnd:		.blkb		# operation mode hand_shaking
mon_usr:	.blkb		# monitor/user time flag
pndf:		.blkb		# pending interrpts flag
dtrm:		.blkd		# pointer to defult terminal buffer
ndtrm:		.blkb		# num of defult terminal
svcpf:		.blkb		# svc flag for read/write for movus
errtyp:		.blkb		# entry type
com_num:	.blkb		# save command number
scrch1:		.blkd		# scratch 1
scrch2:		.blkd		# scratch 2
strtadr:	.blkd		# save raddress
endadr:		.blkd		# save end interrupt routine address
serea:		.blkd		
svfp:		.blkd		# save fp
svus:		.blkd		# save us
svis:		.blkd		# save is
svpc:		.blkd		# save pc
svmod:		.blkd		# save mod
svpsr:		.blkd		# save psr
svr7:		.blkd	7	# save r
svr0:		.blkd		# save r0
tmppsr:		.blkd		
heapp:		.blkd		# heap pointer
heape:		.blkd		# heap end
heaps:		.blkd		# heap begin
config:		.blkb		# configuration byte
mcrwf:		.blkb		# mcr written flag
mnfp:		.blkd		# save monitor fp
mnsp:		.blkd		# save monitor sp
mnsph:		.blkd		# monitor high sp
mnspr:		.blkw	 	# monitor psr
brkar:		.blkd	nswbpt	# soft-bpr array
stepflg:	.blkb		# step flag
ackflg:		.blkb		# acknowledge flag
cxpflg:		.blkb		# cxp command counter
ins:		.blkb	nswbpt	# array of brpr instruction save
monusr1:	.blkb		# temp save of mon_user flag
stpcnt:		.blkd		# step counter
actbrk:		.blkd		# # of current break
oldpc:		.blkd	2	# save old pc,us,is,mod in cxp command
endpc:		.blkd		# pc of inserted bpt on stack
endpc1:		.blkd		# pc of begin when cxp also
cntrlb:		.blkb		# cntrl/b starts every command     
cntrll:		.blkb		# cntrl/l start fast load message
cntrls:		.blkb		# cntrl/s hold screen
cntrlq:		.blkb		# cntrl/q resume screen
		.align 4 
stptype:	.blkd		# step type (step while,step until etc)
stuadd:		.blkd		# stu command variable address
stpmsk:         .blkd           # step until/while mask
stpup:          .blkd           # upper bound in step while/until
stplow:         .blkd           # lower bound of step while/until


rstint:		.blkd		# save reset value of intbase
jmpram:		.blkd	3	# working space for code build in run time
fpubuf:		.blkd	4	# working buffer for getput fpu lregs 
 #use_dip:	.blkb		# new boards flag ->  use dip switches insted
				# of jumpers.
 #
term1:		.blkd	137	# terminal 1 record
term2:		.blkd	137	# terminal 2 record
sresp:		.blkd		# $$$ response saved for retransmission
force_serial:	.blkb		# force serial link use on Ethernet mode
use_dip:	.blkd		# new boards flag ->  use dip switches insted
				# of jumpers.
		.align	4
stacks:		.blkb	is_size # allocate intterupt stack space
svrsp:		.blkd		
		.blkb	mon_stack_size	# allocate monitor stack space
stackl:		.blkd
		.align	16
intsp:		.blkd	32	# interrupt table space
 #
 #
 #
 #
 #
	.set	cnfmmu,2	# mmu bit in configuration
	.set	mont,0	  	# flag monitor time
	.set	usert,1	 	# flag user time
	.set	pndmod,2	# flag to delay interrupts
 #
 #
 #       ED board hardware constants
 #
	.set	IOBASE	,0xf40000
	.set	HPC	,IOBASE + 0x000
	.set	UART	,IOBASE + 0x020
	.set	UART1  	,0xc003f8
	.set	CENT	,IOBASE + 0x040
	.set	STATUS	,IOBASE + 0x060
	.set	BPUCTL	,IOBASE + 0x080
	.set	BPUMSK	,IOBASE + 0x0A0
	.set	BPUCNT	,IOBASE + 0x0C0
	.set	CTLL	,IOBASE + 0x0E0
	.set	DMACD	,IOBASE + 0x100
	.set	DMACT	,IOBASE + 0x120
	.set	DMALO	,IOBASE + 0x140
	.set	DMAHI	,IOBASE + 0x160
	.set	switchp ,IOBASE + 0x100	    # DIP switch on new boards
	
 #
 #	Control latch (CTLL) Bit definitions
 #
 #	All CTTL bits are cleared by hardware reset to the ASSERTED
 #	state.  Writing to 1 to a bit location DE-ASSERTs that function
 #
	.set	DRAM_ML	,b'000001
	.set	SHADOW	,b'000010
	.set	DS5	,b'000100
	.set	DS4	,b'001000
	.set	DS3	,b'010000
	.set	DS2	,b'100000

	.set	prombase,codesp		#Beginning of EPROM
	.set	demo_entry, 0x820000	# entry point for user application
					# second bank 512 Kbit eprom installed
 #
 #	CG821 DRAM Controller programming words
 #
 #		Revised 2/16/89 to have R3,R2 = 00 for 0 wait state
 #
	.set	M256K0W	,0x4F501C	#256K Sticks, 0 wait RAM
	.set	M256K1W	,0x4F50BC	#256K Sticks, 1 wait RAM
	.set	M1M0W	,0x37501C	#1M Sticks, 0 wait RAM
	.set	M1M1W	,0x3750BC	#1M Sticks, 1 wait RAM
	.set	CG821	,M1M0W
 #
 #	16550a uart definitions
 #
	.set	RBR	,0 * 2		#receiver buffer register
	.set	THR	,0 * 2		#transmitter holding register
	.set	IER	,1 * 2		#interrupt enable register
	.set	IIR	,2 * 2		#interrupt ident register
	.set	FCR	,2 * 2		#fifo control register
	.set	LCR	,3 * 2		#line control register
	.set	MCR	,4 * 2		#MODEM control register
	.set	LSR	,5 * 2		#line status register
	.set	MSR	,6 * 2		#MODEM status register
	.set	DLL	,0 * 2		#Divisor latch (LS)
	.set	DLM	,1 * 2		#Divisor latch (MS)

	.set	THRE	,5		#Transmitter holding register empty
	.set	RDA	,0		#Received data available



 #
 #  i c u   r e g.
 #
	.set	icuadr,0xfffe00		# icu register  0 address
	.set	icu16,icuadr+16*2	# icu reg 16
	.set	icu22,icuadr+22*2	# icu reg 22
	.set	icu24,icuadr+24*2	# icu reg 24
	.set	icu28,icuadr+28*2	# icu reg 28
	.set	sw_mmu,0x20		# mmu exists bit on=mmu off=no mmu
	.set	sw_fpu,0x10		# fpu exists bit on=fpu off=no fpu


