[mod.computers.68k] 68000 Monitor

mwm@VIOLET.BERKELEY.EDU.UUCP (02/20/87)

Warning: Mailbox overflow in progress....

	<mike

------- Forwarded Message

Date: Wed, 18 Feb 87 22:20:41 pst
From: ames!uwvax!seismo!iscuva!jimc@cad.berkeley.edu
Message-Id: <8702190620.AA12856@iscuva.ISCS.COM>
To: uwvax!VIOLET.BERKELEY.EDU!mwm
Subject: 68000 Monitor
Cc: uwvax!XEROX.COM!thieret.WBST128

You expressed interest in a 68000 system monitor.  Here is one I wrote for my
CompuPro 68000.  It isn't very pretty, but it does work.  Its most interesting
characteristic is that it will work without ANY memory working.  It may thus
be used to bring up a system that much easier.  I hope you can make some use
of it.  (P.S. this is only part of the original ROM, so there may be a few
undefined symbols.  This part is the non-disk non-BIOS part though).

+----------------+
! II      CCCCCC !  Jim Cathey
! II  SSSSCC     !  ISC Systems Corp.
! II      CC     !  Spokane, WA
! IISSSS  CC     !  UUCP: ihnp4!tektronix!reed!iscuva!jimc
! II      CCCCCC !  (509)927-5757
+----------------+
			"With excitement like this, who is needing enemas?"

#! /bin/sh
# Subject: 
# Keywords: 
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	bootp0.s
#	bootp2.s
# This archive created: Wed Feb 18 22:14:34 1987
export PATH; PATH=/bin:$PATH
echo shar: extracting "'bootp0.s'" '(17099 characters)'
if test -f 'bootp0.s'
then
	echo shar: will not over-write existing file "'bootp0.s'"
else
sed 's/^	X//' > 'bootp0.s' << \SHAR_EOF
	X*****************************************************************
	X*								*
	X*	Boot Prom for CPU-68K and 64K RAM,			*
	X*	Morrow HDCDMA hard disk controler,			*
	X*	DISK1 floppy disk controller,				*
	X*       INTERFACER 4 as primary console,			*
	X*	MicroAngelo as secondary console.			*
	X*								*
	X*****************************************************************
	X
	X
	X*****************************************************************
	X*								*
	X* File wide .equates.						*
	X*								*
	X*****************************************************************
	X
	Xfalse	.equ	0		; Logical false
	Xtruee	.equ	-1		; Logical true
	Xtest	.equ	false		; True for non-ROM testing,
	X*				; causes ROM required goodies
	X*				; to disappear, and includes
	X*				; a call to set sup mode.
	Xiobase	.equ	$ff0000		; Address of I/O ports
	Xfdport	.equ	$c0		; Base of Disk1, for stopping boot.
	Xser	.equ	3		; Port in Disk1 for above purpose.
	Xinitsr	.equ	$2700		; init status--no interrupts
	X
	Xdatasiz	.equ	4*1024		; Reserved RAM for char BIOS data.
	X
	X*****************************************************************
	X*								*
	X* Boot Loader code begins here.					*
	X*								*
	X* Global flags are kept in D7 as follows:			*
	X*	(Initially set from S1 switches on INTER IV,		*
	X*	 Bit = 1 if true)					*
	X*								*
	X*	S1.10 (Bit  0) - 19,200 baud Console port, else 9600.	*
	X*	S1.9  (Bit  1) - Use MicroAngelo as console.		*
	X*	S1.8  (Bit  2) - Auto Floppy boot.			*
	X*	S1.7  (Bit  3) - Auto Hard disk boot.			*
	X*								*
	X*	Bit  7 - RAM is good.  If bad code blocks routines	*
	X*			       that need RAM.			*
	X*								*
	X*	Register usage -- RAM-less portions:			*
	X*	A7 - Stack pointer (unused as such)			*
	X*		points to End of RAM.				*
	X*	A6 - 1st return address for psuedo-subroutines.		*
	X*	A5 - 2nd return address for psuedo-subroutines.		*
	X*	A4 - Points to dynamic data storage area.		*
	X*	A3 - Last used address for addressing defaults.		*
	X*								*
	X*	Register usage -- RAM portions:				*
	X*								*
	X*								*
	X*								*
	X*****************************************************************
	X
	X	ifne test
	X	move #62,d0		; Set SUPERVISOR state -- for testing only!!!
	X	trap #2
	X	endc
	X	ifeq test
	X	.dc.l $10000		; Initial stack pointer
	X	.dc.l entry		; Initial PC
	Xentry:	clr.b iobase+fdport+ser	; Clear DISK1 boot logic just in case,
	X*				; also resets CPU boot logic.
	X	endc
	X
	X	.globl rom
	X	.xdef exceptn
	Xrom:	move #initsr,sr		; set no interrupts.
	X	move.l #exceptn,$7c	; Point NMI to appropriate routine.
	X	move.l #exceptn,$24	; Point TRACE to appropriate routine.
	X
	X	move.l #iobase,a3
	X	move.b #4,$17(a3)	; Select user 4
	X	move.b $10(a3),d7	; & read dipswitch.
	X
	X	move.b #5,$17(a3)	; Init Aux 2
	X	move.b #$4E,$12(a3)	; Async, x16, 1 stp 8 data no par.
	X	move.b #$76,$12(a3)	; 300 baud.
	X	move.b #$37,$13(a3)	; Rx & Tx on, DTR & RTS, no brk, reset.
	X
	X	move.b #6,$17(a3)	; Init Aux 1
	X	move.b #$4E,$12(a3)	; Async, x16, 1 stp 8 data no par.
	X	move.b #$7E,$12(a3)	; 9600 baud.
	X	move.b #$37,$13(a3)	; Rx & Tx on, DTR & RTS, no brk, reset.
	X
	X	move.b #7,$17(a3)	; Init Console
	X	move.b #$4E,$12(a3)	; Async, x16, 1 stp 8 data no par.
	X	btst #0,d7		; Which baud rate?
	X	bne npoint2
	X	move.b #$7E,$12(a3)	; 9600 baud.
	X	bra rom1
	Xnpoint2	move.b #$7F,$12(a3)	; 19200 baud.
	Xrom1	move.b #$37,$13(a3)	; Rx & Tx on, DTR & RTS, no brk, reset.
	X
	X	move.b #1,$ff00f1	; Reset MicroAngelo.
	X	move.b #0,$ff00f1
	X
	X	clr.l a3		; Default address for dump et al.
	X	lea.l rom2,a6		; Figure out mem size and set stack
	X	bra msize		; at top (if any).
	Xrom2	btst #7,d7
	X	beq rom3
	X	move.b #0,contflg(a4)	; If we have RAM then continuation
	X	lea.l regusp(a4),a0	; isn't possible.  (Ain't anyhow).
	X	move.w #regsav-regusp-1,d0	; Clear saved reg bank.
	Xregclr	clr.b (a0)+
	X	dbra d0,regclr
	X	clr.w (a0)+		; Wipe last two.
	X	clr.l (a0)
	X
	Xrom3	lea.l signon,a1		; Say hello to the world...
	X	btst #1,d7
	X	beq rom4
	X	lea.l mamsg,a1
	Xrom4	lea.l prompt,a6
	X	bra pstr
	X
	X	.xdef go,dump,cont,dotrace
	X	.xdef fboot,hboot
	X	.globl prompt
	X
	Xprompt	lea.l promptst,a1	; Print prompt.
	X	lea.l prompt2,a6
	X	bra pstr
	Xprompt2	btst #7,d7		; RAM needed for auto boots.
	X	beq prompt3
	X	btst #2,d7		; Auto Floppy boot?
	X	bne fboot
	X	btst #3,d7		; Auto Hard boot?
	X	bne hboot
	Xprompt3	lea.l prompt4,a5
	X	bra konin		; Get command.
	Xprompt4	cmpi.b #'?',d0		; Help?
	X	beq help
	X	bclr #5,d0		; Else mask case.
	X	cmpi.b #'@',d0		; Check range, @..Z allowed.
	X	blo prompt2
	X	cmpi.b #'Z',d0
	X	bhi prompt2
	X	lea.l qisa,a5		; Echo command letter.
	X	bra konout
	Xqisa	cmp.b #'A',d0		; Alternate console?
	X	bne qisat
	X	bchg #1,d7
	X	bra prompt
	Xqisat	cmp.b #'@',d0		; Mem set?
	X	bne qist
	X	bra at
	Xqist	cmp.b #'M',d0		; Mem Test (size)?
	X	bne qisr
	X	bra mtest
	Xqisr	cmp.b #'R',d0		; Read Scope loop?
	X	bne qisw
	X	bra reads
	Xqisw	cmp.b #'W',d0		; Write Scope loop?
	X	bne qisinp
	X	bra writs
	Xqisinp	cmpi.b #'I',d0		; Input from port?
	X	bne qisout
	X	bra input
	Xqisout	cmpi.b #'O',d0		; Output to port?
	X	bne qisg
	X	bra output
	Xqisg	btst #7,d7		; RAM commands follow from here,
	X	beq mberr		; so make sure there is some.
	X	cmp.b #'G',d0		; Go?
	X	bne qiscon
	X	bra go
	Xqiscon	cmp.b #'C',d0		; Breakpoint continue?
	X	bne qistr
	X	bra cont
	Xqistr	cmp.b #'T',d0		; Trace?
	X	bne qish
	X	bra dotrace
	Xqish	cmpi.b #'H',d0		; Hard disk boot?
	X	bne qisd
	X	bra hboot
	Xqisd	cmpi.b #'F',d0		; Floppy disk boot?
	X	bne qisdu
	X	bra fboot
	Xqisdu	cmpi.b #'D',d0		; Dump memory?
	X	bne iserr
	X	bra dump
	Xiserr	lea.l errmsg,a1		; Else an error, go round again.
	X	lea.l prompt,a6
	X	bra pstr
	X
	Xmberr	lea.l mbmsg,a1
	X	bra help2
	Xhelp	lea.l helpmsg,a1
	Xhelp2	lea.l prompt,a6
	X	bra pstr
	X
	X*****************************************************************
	X*								*
	X*	Start of Commands					*
	X*								*
	X*****************************************************************
	X
	X
	X***************************************************************
	X
	Xat	lea.l at1,a6		; RAM-less set memory command.
	X	bra atol		; Get address in d1
	Xat1	move.l d1,a0		; and a0.
	X	move.b d0,d3		; save terminating character.
	X	tst d2			; No start specified, use default.
	X	bne atloop
	X	movea.l a3,a0
	Xatloop	lea.l at2,a6
	X	bra crlf
	Xat2	move.l a0,d1
	X	lea.l atword,a6
	X	bra paddr		; print address.
	Xatword	cmp.b #'W',d3		; was it a WORD modify?
	X	bne atlong
	X	move.l a0,d0		; make sure an even address.
	X	btst #0,d0
	X	bnz oddaddr
	X	move (a0),d1
	X	lea.l atwd1,a6
	X	bra pword
	Xatwd1	lea.l atwd2,a6		; Get input word.
	X	bra atol
	Xatwd2	tst d2
	X	beq atwd3
	X	move d1,(a0)+		; Stash it and loop.
	X	bra atloop
	Xatwd3	cmp.b #$0a,d0		; Check for other commands.
	X	bne atwd4
	X	subq.l #2,a0		; Was a backup, do so and goto loop.
	X	bra atloop
	Xatwd4	cmp.b #'.',d0		; Quit?
	X	beq atend
	X	cmp.b #$0d,d0		; NOP
	X	bne atend
	X	addq.l #2,a0		; Increment addr and loop.
	X	bra atloop
	Xatlong	cmp.b #'L',d3		; was it a LONG modify?
	X	bne atbyte
	X	move.l a0,d0		; make sure an even address.
	X	btst #0,d0
	X	bnz oddaddr
	X	move.l (a0),d1
	X	lea.l atlng1,a6
	X	bra plong		; Print contents.
	Xatlng1	lea.l atlng2,a6		; Get input long.
	X	bra atol
	Xatlng2	tst d2
	X	beq atlng3
	X	move.l d1,(a0)+		; Stash it and loop.
	X	bra atloop
	Xatlng3	cmp.b #$0a,d0		; Check for other commands.
	X	bne atlng4
	X	subq.l #4,a0		; Was a backup, do so and goto loop.
	X	bra atloop
	Xatlng4	cmp.b #'.',d0		; Quit?
	X	beq atend
	X	cmp.b #$0d,d0		; NOP
	X	bne atend
	X	addq.l #4,a0		; Increment addr and loop.
	X	bra atloop
	Xatbyte	move.b (a0),d1
	X	lea.l atbyt1,a6
	X	bra pbyte
	Xatbyt1	lea.l atbyt2,a6		; Get input byte.
	X	bra atol
	Xatbyt2	tst d2
	X	beq atbyt3
	X	move.b d1,(a0)+		; Stash it and loop.
	X	bra atloop
	Xatbyt3	cmp.b #$0a,d0		; Check for other commands.
	X	bne atbyt4
	X	subq.l #1,a0		; Was a backup, do so and goto loop.
	X	bra atloop
	Xatbyt4	cmp.b #'.',d0		; Quit?
	X	beq atend
	X	cmp.b #$0d,d0		; NOP
	X	bne atend
	X	addq.l #1,a0		; Increment addr and loop.
	X	bra atloop
	Xatend	movea.l a0,a3		; Save last addr for default.
	X	bra prompt
	X
	Xoddaddr	lea.l oddmsg,a1
	X	lea.l prompt,a6
	X	bra pstr
	X
	X
	X***************************************************************
	X
	Xinput	lea.l input1,a6		; RAM-less port read command.
	X	bra atol
	Xinput1	and.l #$ff,d1		; Mask to I/O address range.
	X	add.l #iobase,d1	; Map to I/O space
	X	move.l d1,a0		; got address.
	X	move.b d0,d3		; Save terminating character.
	X	tst d2			; No start specified, use default.
	X	bne inloop
	X	movea.l a3,a0
	Xinloop	lea.l input2,a6
	X	bra crlf
	Xinput2	move a0,d1
	X	lea.l inword,a6
	X	bra pbyte		; print port address.
	Xinword	cmp.b #'W',d3		; was it a WORD read?
	X	bne inbyte
	X	move a0,d0		; make sure an even address.
	X	btst #0,d0
	X	bnz oddaddr
	X	move (a0),d1
	X	lea.l inwd1,a6
	X	bra pword
	Xinwd1	lea.l inwd2,a6		; Get input "word".
	X	bra atol
	Xinwd2	cmp.b #$0d,d0		; Loop?
	X	beq inloop
	X	bra prompt
	Xinbyte	move.b (a0),d1
	X	lea.l inwd1,a6
	X	bra pbyte
	X
	X
	X***************************************************************
	X
	Xoutput	lea.l output1,a6	; RAM-less port write command.
	X	bra atol
	Xoutput1	and.l #$ff,d1		; Mask to I/O port range.
	X	add.l #iobase,d1	; Map to I/O port space.
	X	move.l d1,a0		; got address.
	X	move.b d0,d3		; Save terminating character.
	X	tst d2			; No start specified, use default.
	X	bne outloop
	X	movea.l a3,a0
	Xoutloop	lea.l output2,a6
	X	bra crlf
	Xoutput2	move a0,d1
	X	lea.l outword,a6
	X	bra pbyte		; print port address.
	Xoutword	cmp.b #'W',d3		; was it a WORD modify?
	X	bne outbyte
	X	move a0,d0		; make sure an even address.
	X	btst #0,d0
	X	bnz oddaddr
	X	move (a0),d1
	X	lea.l outwd1,a6
	X	bra pword
	Xoutwd1	lea.l outwd2,a6		; Get input word.
	X	bra atol
	Xoutwd2	tst d2			; Nothing? default or done.
	X	beq outwd4
	X	move d1,d4		; Save for default.
	Xoutwd3	move d1,(a0)		; Stash it and loop.
	X	bra outloop
	Xoutwd4	cmp.b #$0d,d0		; Default?
	X	bne prompt		; No, quit.
	X	move d4,d1		; Restore default.
	X	lea.l outwd5,a6		; print it.
	X	bra pword
	Xoutwd5	move d4,d1		; (restore)
	X	bra outwd3		; and poke it.
	X
	Xoutbyte	move.b (a0),d1
	X	lea.l outbyt1,a6
	X	bra pbyte
	Xoutbyt1	lea.l outbyt2,a6	; Get input byte.
	X	bra atol
	Xoutbyt2	tst d2			; Nothing? default or done.
	X	beq outbyt4
	X	move.b d1,d4		; Save for default.
	Xoutbyt3	move.b d1,(a0)		; Stash it and loop.
	X	bra outloop
	Xoutbyt4	cmp.b #$0d,d0		; Default?
	X	bne prompt		; No, quit.
	X	move.b d4,d1		; Restore default.
	X	lea.l outbyt5,a6	; print it.
	X	bra pbyte
	Xoutbyt5	move.b d4,d1		; (restore)
	X	bra outbyt3		; and poke it.
	X
	X
	X***************************************************************
	X
	Xmtest	lea.l mtest2,a6		; Monitor Mem size command.
	X	bra msize
	Xmtest2	lea.l mtest3,a6		; (Assumes RAM comes in 512 increments)
	X	bra crlf
	Xmtest3	lea.l prompt,a6
	X	move.l a7,d1
	X	bra paddr		; print end-of-mem
	X
	X
	X***************************************************************
	X
	Xreads	lea.l read2,a6		; Monitor Read Scope loop
	X	bra atol
	Xread2	tst d2
	X	beq prompt
	X	move.l d1,a0
	X	move.b d0,d3		; save terminator
	X	lea.l read3,a6
	X	bra crlf
	Xread3	lea.l read4,a6
	X	bra paddr
	Xread4	cmp.b #'W',d3
	X	beq readw
	X	lea.l readb1,a5
	Xreadb	tst.b (a0)		; four times so recognizable
	X	tst.b (a0)		; on the bus.
	X	tst.b (a0)
	X	tst.b (a0)
	X	bra konstat
	Xreadb1	beq readb
	X	bra prompt
	X
	Xreadw	lea.l readw2,a5
	Xreadw1	tst.w (a0)		; four times so recognizable
	X	tst.w (a0)		; on the bus.
	X	tst.w (a0)
	X	tst.w (a0)
	X	bra konstat
	Xreadw2	beq readw1
	X	bra prompt
	X
	X
	X***************************************************************
	X
	Xwrits	lea.l writ2,a6		; Monitor Write Scope loop
	X	bra atol
	Xwrit2	tst d2
	X	beq prompt
	X	move.l d1,a0
	X	move.b d0,d3		; save terminator
	X	lea.l writ3,a6
	X	bra crlf
	Xwrit3	lea.l writ4,a6
	X	bra paddr
	Xwrit4	clr.w d0		; for writing
	X	cmp.b #'W',d3
	X	beq writw
	X	lea.l writb1,a5
	Xwritb	move.b d0,(a0)		; four times so recognizable
	X	move.b d0,(a0)		; on the bus.
	X	move.b d0,(a0)
	X	move.b d0,(a0)
	X	bra konstat
	Xwritb1	beq writb
	X	bra prompt
	X
	Xwritw	lea.l writw2,a5
	Xwritw1	move.w d0,(a0)		; four times so recognizable
	X	move.w d0,(a0)		; on the bus.
	X	move.w d0,(a0)
	X	move.w d0,(a0)
	X	bra konstat
	Xwritw2	beq writw1
	X	bra prompt
	X
	X
	Xmsize	move.l #0,a7		; Find memory size in 512 byte increments.
	X	clr d0			; 0 pages...
	X	bclr #7,d7		; mark memory as bad until further notice
	Xmsloop	move.b (a7),d1		; get test loc
	X	move.b d1,d2
	X	not.b d2
	X	move.b d2,(a7)		; stuff complement of orig value.
	X	move.b (a7),d2
	X	move.b d1,(a7)		; restore original value.
	X	not.b d2
	X	cmp.b d1,d2		; All bits work?
	X	bne msend
	X	adda.l #512,a7		; Bump to next page
	X	inc d0			; and increment count.
	X	bra msloop
	Xmsend	cmp #128,d0		; Mark RAM good if at least 64k.
	X	blt msng		; Leave stack at end+1 of RAM.
	X	bset #7,d7
	Xmsng	movea.l a7,a4		; pointer to Data area.
	X	suba.l #datasiz,a4
	X	move.l a7,dataend(a4)	; End of RAM pointer in Data block.
	X	move.l #'BIOS',marker(a4)	; Put in Fence.
	X	move.l a4,4		; Stash pointer at RESET PC vector.
	X	move.w ilins,0		; Put an ILLEGAL at RESET SSP vector.
	X	jmp (a6)
	X	.globl ilins
	Xilins	illegal
	X	
	X*****************************************************************
	X*								*
	X*	Miscellaneous Support routines				*
	X*								*
	X*****************************************************************
	X
	X	.globl pstr
	Xpstr:	move.b (a1)+,d0		; Print string -> A1. Stop on NULL
	X	beq pstr2
	X	lea.l pstr,a5		; Konout uses a5 for ret addr
	X	bra konout
	Xpstr2	jmp (a6)
	X
	Xcrlf	lea.l crlf1,a5		; Print CR-LF pair.
	X	move.b #10,d0
	X	bra konout
	Xcrlf1	lea.l crlf2,a5
	X	move.b #13,d0
	X	bra konout
	Xcrlf2	jmp (a6)
	X
	Xkonout	btst #1,d7
	X	bnz mkonout
	X	move.b #7,iobase+$17	; Select User 7 on INTERFACER IV
	Xkonout1	btst #0,iobase+$11
	X	beq konout1
	X	move.b d0,iobase+$10
	Xkonret	jmp (a5)
	Xmkonout	btst #0,iobase+$f1
	X	bnz mkonout
	X	move.b d0,iobase+$f0
	X	jmp (a5)
	X
	Xkonin	move.b #7,iobase+$17	; Select User 7 on INTERFACER IV
	Xkonin1	btst #1,iobase+$11
	X	beq konin1
	X	move.b iobase+$10,d0
	X	jmp (a5)
	X
	Xkonstat	move.b #7,iobase+$17	; Select User 7 on INTERFACER IV
	X	btst #1,iobase+$11	; returns Z if nothing there.
	X	jmp (a5)
	X
	Xpbyte	move.l #$20018,d0	; 2 nybbles, 24 bit shift first.
	X	bra pdigits
	Xpword	move.l #$40010,d0	; 4 nybbles, 16 bit shift first.
	X	bra pdigits
	Xpaddr	move.l #$60008,d0	; 6 nybbles, 8 bit shift first.
	X	bra pdigits
	Xplong	move.l #$80000,d0	; 8 nybbles, no shift first.
	Xpdigits	rol.l d0,d1		; do shift.
	X	bra pdigent
	Xpdiglop	swap d0			; save nybble count.
	X	rol.l #4,d1		; Print variable in d1.
	X	lea.l pdigent,a5
	X	bra ntoa
	Xpdigent	swap d0			; get nybble count.
	X	dbra d0,pdiglop
	X	move.b #' ',d0
	X	lea.l pdigend,a5
	X	bra konout
	Xpdigend	jmp (a6)
	X
	Xntoa	move.b d1,d0		; nybble in d0 to ascii, then output
	X	and #$f,d0
	X	cmp #$a,d0
	X	blt htoa2
	X	add.b #'A'-'9'-1,d0
	Xhtoa2	add.b #'0',d0
	X	bra konout
	X
	Xatol	clr.l d1		; ascii to long, stops on invalid hex char.
	X	clr d2			; returns long in d1, terminator char in d0,
	Xatol1	lea.l atol2,a5		; d2=1 if any chars entered before terminator.
	X	bra konin
	Xatol2	cmp.b #$40,d0
	X	blo atol3
	X	and #$5F,d0		; mask to upper case.
	Xatol3	cmpi.b #'0',d0		; check range (0..9,A..F).
	X	blo atolend
	X	cmpi.b #'F',d0
	X	bhi atolend
	X	cmpi.b #'9',d0
	X	bls atol4
	X	cmpi.b #'A',d0
	X	bhs atol4
	X	bra atolend
	Xatol4	moveq #1,d2		; Valid characters entered, flag it.
	X	lea.l atol5,a5		; Echo the valid char.
	X	bra konout
	Xatol5	sub.b #'0',d0
	X	cmp.b #$9,d0
	X	bls atol6
	X	sub.b #'A'-'9'-1,d0
	Xatol6	ext d0			; to long.
	X	ext.l d0
	X	asl.l #4,d1		; tack it onto d1.
	X	add.l d0,d1
	X	bra atol1
	Xatolend	jmp (a6)
	X
	X	.data
	Xmamsg	.dc.b $80,$E8,$BA,1,$83,10	; Inits MicroAngelo
	X	ifne test
	Xsignon	.dc.b 12,'CPU-68K Monitor version TEST',10,13,0
	X	endc
	X	ifeq test
	Xsignon	.dc.b 12,'CPU-68K Monitor version 2.0',10,13,0
	X	endc
	X
	Xpromptst .dc.b 10,13,':',0
	Xerrmsg	.dc.b ' Unknown command, use "?" for help.',0
	Xmbmsg	.dc.b 10,13,' Function unavailable without memory!',0
	X	.globl oddmsg
	Xoddmsg	.dc.b ' Invalid (odd) memory address!',0
	X
	Xhelpmsg	.dc.b '?',10,13
	X	.dc.b '               ---  RAM-less Commands ---',10,13
	X	.dc.b '    @ - Set Memory (B,W,L)     R - Read Scope loop (B,W)',10,13
	X	.dc.b '    M - Test Memory Size       W - Write Scope loop (B,W)',10,13  
	X	.dc.b '    I - Input from port (B,W)  O - Output to port (B,W)',10,13
	X	.dc.b '    A - Alternate console',10,13
	X	.dc.b 10,13
	X	.dc.b '                   --- RAM Commands ---',10,13
	X	.dc.b '    D - Dump memory (B,W,L)    G - Go to address',10,13
	X	.dc.b '    T - Trace                  C - Continue execution',10,13
	X	.dc.b '    F - Floppy disk boot       H - Hard disk boot',10,13
	X	.dc.b 10,13
	X	.dc.b " The RAM-less commands don't require RAM to function,",10,13
	X	.dc.b ' the RAM commands must have RAM to function.',10,13
	X	.dc.b ' RAM is tested upon reset and with the "M" command.',10,13
	X	.dc.b ' All commands that take an address and can operate on',10,13
	X	.dc.b ' words or longs use a "W" or "L" as an address',10,13
	X	.dc.b ' terminator to change to that mode.',10,13
	X	.dc.b 0
	X
	X*				; Dynamic Data storage area.
	X	offset 0
	Xmarker	ds.l 1			; If corrupt, data area may be too.
	Xdataend	ds.l 1			; Points to end of this block.
	X
	Xconovec	ds.w 1			; Console out physical device vector
	Xconivec ds.w 1			; Console in physical device vector
	Xax1ovec ds.w 1			; Aux 1 out pdv
	Xax1ivec ds.w 1			; Aux 1 in pdv
	Xax2ovec ds.w 1			; Aux 2 out pdv
	Xax2ivec ds.w 1			; Aux 2 in pdv
	Xlstovec	ds.w 1			; List out pdv
	X
	Xoldrd7	ds.b 1			; Saved D7 for flags.
	Xcontflg	ds.b 1			; Continuation allowed flag.
	Xregusp	ds.l 1			; Register save storage.
	Xregd0	ds.l 1
	Xregd1	ds.l 1
	Xregd2	ds.l 1
	Xregd3	ds.l 1
	Xregd4	ds.l 1
	Xregd5	ds.l 1
	Xregd6	ds.l 1
	Xregd7	ds.l 1
	Xrega0	ds.l 1
	Xrega1	ds.l 1
	Xrega2	ds.l 1
	Xrega3	ds.l 1
	Xrega4	ds.l 1
	Xrega5	ds.l 1
	Xrega6	ds.l 1
	Xrega7	ds.l 1
	Xregsav	ds.b 0
	Xregsr	ds.w 1
	Xregpc	ds.l 1
	Xregfmt	ds.w 1
	Xregsav2	ds.b 0
	X
	Xouttab	ds.l 32			; Pointers to output handlers & A6 data areas
	Xoutstab	ds.l 32			; Pointers for output status
	Xintab	ds.l 32			; Pointers for input
	Xinstab	ds.l 32			; Pointers for input status
	X
	X	.end
SHAR_EOF
if test 17099 -ne "`wc -c < 'bootp0.s'`"
then
	echo shar: error transmitting "'bootp0.s'" '(should have been 17099 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'bootp2.s'" '(11414 characters)'
if test -f 'bootp2.s'
then
	echo shar: will not over-write existing file "'bootp2.s'"
else
sed 's/^	X//' > 'bootp2.s' << \SHAR_EOF
	Xiobase	.equ $ff0000
	Xxsize	.equ 8			; Exception stack size, 6=68K 8=68010
	X
	X*****************************************************************
	X*								*
	X*	RAM commands						*
	X*								*
	X*****************************************************************
	X
	X	.globl dump
	X	.xdef prompt
	Xdump	bsr atol		; Dump command, get address & flag.
	X	move.l d1,a0		; Save address.
	X	move d0,d3		; Save terminator.
	X	tst d2
	X	bne defstrt		; No address, use 1+last dumped.
	X	movea.l a3,a0
	Xdefstrt	move.l a0,a1		; Default end address.
	X	adda #127,a1
	X	cmp.b #',',d3		; Is the end addr to be specified?
	X	bne defend		; No, use default end.
	X	move.b #',',d0
	X	bsr konout		; Print a comma.
	X	bsr atol		; Grab ending value (in d1 till later).
	X	move.l d1,a1		; The end address.
	X	move d0,d3		; Save new terminator.
	X	tst d2
	X	beq prompt		; No terminating address, abort.
	Xdefend	cmp.l a1,a0		; Check to make sure the range is good.
	X	bhi dumperr		; No good, say so.
	X	move.l a0,a2		; Make a0 anchor for ASCII dump.
	Xdlnlop	move #15,d4		; 16 bytes across the screen.
	X	bsr crlf
	X	move.l a0,d1		; print address.
	X	bsr paddrsp
	Xdvllop	cmp.b #'W',d3		; print appropriate value.
	X	bne dqisl
	X	move.l a2,d1		; check for odd address.
	X	btst #0,d1
	X	bne modderr
	X	move (a2)+,d1
	X	bsr pwordsp
	X	subq #1,d4		; if word knock off 1 for term count.
	X	bra ddidval
	Xdqisl	cmp.b #'L',d3
	X	bne disbyt
	X	move.l a2,d1		; check for odd address.
	X	btst #0,d1
	X	bne modderr
	X	move.l (a2)+,d1
	X	bsr plongsp
	X	subq #3,d4		; if long knock off 3 for term count.
	X	bra ddidval
	Xdisbyt	move.b (a2)+,d1
	X	bsr pbytesp
	Xddidval	dbra d4,dvllop		; If more to go on the line then do them.
	X	move.b #' ',d0
	X	bsr konout		; Two more spaces to separate.
	X	bsr konout
	X	move #15,d4		; Do 16 ASCII chars from the same place.
	Xdascilp	move.b (a0)+,d0
	X	and #$7F,d0		; Mask off high bit.
	X	cmp #$7f,d0		; Don't print deletes or
	X	beq isnasci		; control chars.
	X	cmp #$20,d0
	X	bge isascii
	Xisnasci	move.b #'.',d0
	Xisascii	bsr konout
	X	cmp #8,d4		; If in the middle
	X	bne isntmid
	X	move.b #' ',d0		; Then break it with a space.
	X	bsr konout
	Xisntmid	dbra d4,dascilp
	X	bsr konstat
	X	bne ddone
	X	cmpa.l a1,a2		; Are we done dumping?
	X	bhi ddone
	X	bra dlnlop		; else do another line.
	Xddone	movea.l a2,a3		; Save for non-specified dump.
	X	bra prompt
	X
	Xdumperr	lea.l dumpmsg,a1	; Error message if end > start.
	X	bsr pstr
	X	bra prompt
	X
	X
	X	.globl go
	X	.xdef lioinit,pioinit
	Xgo	bsr atol			; Go command, get address & flag.
	X	move.l d1,a0			; Ready to go.
	X	cmp.b #$D,d0			; Make sure ended addr with CR.
	X	bne prompt
	X	tst d2
	X	beq prompt			; No address given, quit.
	X	btst #0,d1			; Check for odd address.
	X	bne modderr
	X	move.b d7,oldrd7(a4)		; Save D7 for later.
	X	bsr lioinit			; Set up I/O structures
	X	bsr pioinit			; in case prog uses them.
	X	bsr crlf
	X	bsr paddr			; Print address
	X	bsr crlf
	X	pea.l prompt			; A return address.
	X	jmp (a0)			; and do it!
	X
	X	.xdef oddmsg
	Xmodderr	lea.l oddmsg,a1			; Error message if Odd address.
	X	bsr pstr
	X	bra prompt
	X
	X	.globl exceptn
	X	.xdef rom,ilins
	Xexceptn	move #$2700,sr			; No interrupts allowed.
	X	move.l a0,0			; Do a total save on Exception.
	X	movea.l 4,a0			; Point into Data block.
	X	cmp.b #'B',(a0)			; Check for real Data area.
	X	bne rom				; Cold start if no area or
	X	cmp.b #'I',1(a0)		; if fence is broken.
	X	bne rom
	X	cmp.b #'O',2(a0)
	X	bne rom
	X	cmp.b #'S',3(a0)
	X	bne rom
	X	lea.l regsav(a0),a0
	X	movem.l d0-d7/a0-a7,-(a0)	; Save interrupted general regs.
	X	move usp,a1
	X	move.l a1,-(a0)
	X	movea.l 4,a4
	X	move.l 0,rega0(a4)		; Fix A0 in saved regs.
	X	movea.l dataend(a4),a7		; Get a real stack now.
	X
	X	lea.l regsav2(a4),a0
	X	movea.l rega7(a4),a1		; Grab exception frame.
	X	move.w 6(a1),-(a0)		; Save old Format/Offset word.
	X	move.l 2(a1),-(a0)		; Save interrupted PC.
	X	move.w 0(a1),-(a0)		; Save interrupted SR.
	X	lea.l xsize(a1),a1		; Fix A7 to before EXCPTN pushed stuff.
	X	move.l a1,rega7(a4)
	X	move.w ilins,0			; Repair illegal inst at 0.
	X
	X*	Setup remainder of the normal registers.
	X	move.b oldrd7(a4),d7		; Pick up D7 flags.
	X	move.l regpc(a4),a3		; Default address is saved PC.
	X	move.b #-1,contflg(a4)		; Assume prog is continuable.
	X	
	X* Reset console device here.
	X
	X*	Test top of old stack at PC to make sure it
	X*	was in RAM before printing PC address.
	X
	X	lea.l intmsg,a1			; First print 'Interrupted' message.
	X	bsr pstr
	X
	X	move.w regfmt(a4),d1		; Which exception was it?
	X	andi.w #$fff,d1			; Get Vector offset.
	X	cmp.w #$7C,d1			; NMI?
	X	beq abort
	X	cmp.w #$24,d1			; TRACE?
	X	beq trace
	X	bsr pstr			; Not either, use vector number.
	X	bsr pbyte
	X	bra dmpregs
	X
	Xtrace	lea.l trcmsg,a1			; Acknowledge the TRACE's receipt.
	X	bsr pstr
	X	bra dmpregs
	X
	Xabort	lea.l nmimsg,a1			; Acknowledge the NMI's receipt.
	X	bsr pstr
	Xdmpregs	lea.l int2msg,a1
	X	bsr pstr
	X	move.l rega7(a4),a0
	X	move.l -xsize-2(a0),d0		; Alignment will ALWAYS be good.
	X	move.l d0,d1			; Test PC loc in stack for RAM.
	X	not.l d1			; Print it if in RAM, else we
	X	move.l d1,-xsize-2(a0)		; are most likely lost.
	X	cmp.l -xsize-2(a0),d1
	X	beq goodpc
	X	move.b #0,contflg(a4)		; Not continuable then.
	X	lea.l nopcmsg,a1		; Bad stack, address is unknown.
	X	bsr pstr
	X	lea.l sspmsg,a1
	X	bra showssp
	X
	Xgoodpc	move.l d0,-xsize-2(a0)		; Fix old PC in 'stack'.
	X	bsr pstr			; Display interrupted PC.
	X	move.l regpc(a4),d1
	X	bsr plong
	Xshowssp	bsr pstr			; Note, assumes A1 points to next
	X	move.l rega7(a4),d1		; message in line!
	X	bsr plong
	X	bsr pstr
	X	move.l regusp(a4),d1
	X	bsr plong
	X	bsr pstr
	X
	X	tst.b contflg(a4)		; If PC was bad, so will be SR.
	X	beq badsr
	X	move.w -xsize(a0),d0		; Test SR.
	X	move.w d0,d1
	X	not.w d1
	X	move.w d1,-xsize(a0)
	X	cmp.w -xsize(a0),d1
	X	beq goodsr
	Xbadsr	move.b #0,contflg(a4)		; Not continuable then.
	X	lea.l nopcmsg,a1		; Bad stack, status is unknown.
	X	bsr pstr
	X	bra nocry
	X
	Xgoodsr	move.w d0,-xsize(a0)		; Fix old SR in 'stack'.
	X	bsr pstr
	X	move.w regsr(a4),d1
	X	bsr pword
	X	bsr pstr
	X
	X	move.w regsr(a4),d2		; ASCII flag messages here.
	X	btst #15,d2
	X	beq notrc
	X	lea.l trcmsg,a1
	X	bsr pstr
	X	bsr pstr
	Xnotrc	btst #13,d2
	X	beq nosup
	X	lea.l supmsg,a1
	X	bsr pstr
	Xnosup	lea.l imskmsg,a1
	X	bsr pstr
	X	move.w d2,d1
	X	lsr #8,d1
	X	and.w #7,d1
	X	bsr ntoa
	X	bsr pspace
	X	btst #4,d2
	X	beq nox
	X	lea.l xmsg,a1
	X	bsr pstr
	Xnox	btst #3,d2
	X	beq noneg
	X	lea.l negmsg,a1
	X	bsr pstr
	Xnoneg	btst #2,d2
	X	beq nozer
	X	lea.l zermsg,a1
	X	bsr pstr
	Xnozer	btst #1,d2
	X	beq noovfl
	X	lea.l ovflmsg,a1
	X	bsr pstr
	Xnoovfl	btst #0,d2
	X	beq nocry
	X	lea.l crymsg,a1
	X	bsr pstr
	X
	Xnocry	lea.l regmsg,a1
	X	bsr pstr			; Dump 8 data registers.
	X	lea.l regd0(a4),a0
	X	move.w #7,d2
	Xregdlop	move.l (a0)+,d1
	X	bsr plongsp
	X	cmp.w #4,d2
	X	bne nodspc
	X	bsr pspace
	Xnodspc	dbra d2,regdlop
	X
	X	bsr pstr			; Dump 8 address registers.
	X	move.w #7,d2
	Xregalop	move.l (a0)+,d1
	X	bsr plongsp
	X	cmp.w #4,d2
	X	bne noaspc
	X	bsr pspace
	Xnoaspc	dbra d2,regalop
	X	bsr pstr
	X	bra prompt			; and goto prompt.
	X
	X	.globl cont
	Xcont	tst.b contflg(a4)		; Continuation allowed?
	X	bne docont
	X	lea.l contmsg,a1
	X	bsr pstr
	X	bra prompt
	Xdocont	bclr #7,regsr(a4)		; Clear TRACE in saved regs.
	Xrestore	move.b d7,oldrd7(a4)		; Save D7 flags for re-entry.
	X	bsr crlf
	X	move.l rega7(a4),a7		; Build exception frame.
	X	move.w regfmt(a4),-(sp)		; Short exception word.
	X	move.l regpc(a4),-(sp)		; PC.
	X	move.w regsr(a4),-(sp)		; SR.
	X	move.l a7,0			; Save SP at 0.
	X	lea.l regusp(a4),a7		; Restore all other registers.
	X	move.l (sp)+,a0
	X	move a0,usp
	X	movem.l (sp)+,d0-d7/a0-a6
	X	move.l 0,a7			; Get proper SSP back.
	X	move.w ilins,0			; Fix illegal at 0.
	X	rte
	X
	X	.globl dotrace
	Xdotrace	tst.b contflg(a4)		; Tracing allowed?
	X	beq notrace
	X	bset #7,regsr(a4)		; Set TRACE in saved regs.
	X	move.l #exceptn,$24		; Reset trace vector.
	X	bra restore
	X
	Xnotrace	lea.l tracmsg,a1
	X	bsr pstr
	X	bra prompt
	X
	X*****************************************************************
	X*								*
	X*	Miscellaneous Support routines				*
	X*								*
	X*****************************************************************
	X
	Xpstr	move.b (a1)+,d0		; Print string -> A1. Stop on NULL
	X	beq pstr2
	X	bsr konout
	X	bra pstr
	Xpstr2	rts
	X
	Xcrlf	move.b #10,d0
	X	bsr konout
	X	move.b #13,d0
	X	bsr konout
	Xcrlf2	rts
	X
	Xkonout	btst #1,d7
	X	bnz mkonout
	X	move.b #7,iobase+$17	; Select User 7 on INTERFACER IV
	Xkonout1	btst #0,iobase+$11
	X	beq konout1
	X	move.b d0,iobase+$10
	Xkonret	rts
	Xmkonout	btst #0,iobase+$f1
	X	bnz mkonout
	X	move.b d0,iobase+$f0
	X	rts
	X
	Xkonin	move.b #7,iobase+$17	; Select User 7 on INTERFACER IV
	Xkonin1	btst #1,iobase+$11
	X	beq konin1
	X	move.b iobase+$10,d0
	X	rts
	X
	Xkonstat	move.b #7,iobase+$17	; Select User 7 on INTERFACER IV
	X	btst #1,iobase+$11	; returns Z if nothing there.
	X	rts
	X
	Xpbytesp	bsr pbyte		; Same as below but with trailing space.
	X	bra pspace
	Xpwordsp	bsr pword
	X	bra pspace
	Xpaddrsp	bsr paddr
	X	bra pspace
	Xplongsp	bsr plong
	Xpspace	move.b #' ',d0
	X	bra konout
	X
	Xpbyte	move.l #$20018,d0	; 2 nybbles, 24 bit shift first.
	X	bra pdigits
	Xpword	move.l #$40010,d0	; 4 nybbles, 16 bit shift first.
	X	bra pdigits
	Xpaddr	move.l #$60008,d0	; 6 nybbles, 8 bit shift first.
	X	bra pdigits
	Xplong	move.l #$80000,d0	; 8 nybbles, no shift first.
	Xpdigits	rol.l d0,d1		; do shift.
	X	bra pdigent
	Xpdiglop	swap d0			; save nybble count.
	X	rol.l #4,d1		; Print variable in d1.
	X	bsr ntoa
	Xpdigent	swap d0			; get nybble count.
	X	dbra d0,pdiglop
	X	rts
	X
	Xntoa	move.b d1,d0		; nybble in d0 to ASCII, then output
	X	and #$f,d0
	X	cmp #$a,d0
	X	blt htoa2
	X	add.b #'A'-'9'-1,d0
	Xhtoa2	add.b #'0',d0
	X	bra konout
	X
	Xatol	clr.l d1		; ASCII to long, stops on invalid hex char.
	X	clr d2			; Returns long in d1, terminator char in d0,
	Xatol1	bsr konin		; d2=1 if any chars entered before terminator.
	X	cmp.b #$40,d0
	X	blo atol2
	X	and #$5F,d0		; Mask to upper case.
	Xatol2	cmpi.b #'0',d0		; Check range (0..9,A..F).
	X	blo atolend
	X	cmpi.b #'F',d0
	X	bhi atolend
	X	cmpi.b #'9',d0
	X	bls atol3
	X	cmpi.b #'A',d0
	X	bhs atol3
	X	bra atolend
	Xatol3	moveq #1,d2		; Valid characters entered, flag it.
	X	bsr konout		; Echo the valid char.
	X	sub.b #'0',d0
	X	cmp.b #$9,d0
	X	bls atol4
	X	sub.b #'A'-'9'-1,d0
	Xatol4	ext d0			; to long.
	X	ext.l d0
	X	asl.l #4,d1		; tack it onto d1.
	X	add.l d0,d1
	X	bra atol1
	Xatolend	rts
	X
	X	.data
	Xdumpmsg	.dc.b 10,13,'  Ending address > starting address.',0
	Xcontmsg .dc.b 10,13,'Cannot continue.',0
	Xtracmsg	.dc.b 10,13,'Cannot trace.',0
	X
	Xintmsg	.dc.b 10,13,'Program Interrupted (',0
	X	.dc.b '$',0
	Xnmimsg	.dc.b 'NMI',0
	Xint2msg	.dc.b ')  -----  PC = ',0
	X	.dc.b '$',0
	Xsspmsg	.dc.b 10,13,'SSP = $',0
	X	.dc.b '  USP = $',0
	X	.dc.b '  SR = ',0
	X	.dc.b '$',0
	X	.dc.b ': ',0
	Xnopcmsg	.dc.b 'UNKNOWN',0
	X
	Xtrcmsg	.dc.b 'TRACE',0
	X	.dc.b ' ',0
	Xsupmsg	.dc.b 'SUP ',0
	Ximskmsg	.dc.b 'IMASK=',0
	Xxmsg	.dc.b 'X ',0
	Xnegmsg	.dc.b 'NEG ',0
	Xzermsg	.dc.b 'ZERO ',0
	Xovflmsg	.dc.b 'OVR ',0
	Xcrymsg	.dc.b 'CARRY ',0
	Xregmsg	.dc.b 10,13,'D0-7 ',0
	X	.dc.b 10,13,'A0-7 ',0
	X	.dc.b 10,13,0
	X
	X*				; Dynamic Data storage area.
	X	offset 0
	Xmarker	ds.l 1			; If corrupt, data area may be too.
	Xdataend	ds.l 1			; Points to end of this block.
	X
	Xconovec	ds.w 1			; Console out physical device vector
	Xconivec ds.w 1			; Console in physical device vector
	Xax1ovec ds.w 1			; Aux 1 out pdv
	Xax1ivec ds.w 1			; Aux 1 in pdv
	Xax2ovec ds.w 1			; Aux 2 out pdv
	Xax2ivec ds.w 1			; Aux 2 in pdv
	Xlstovec	ds.w 1			; List out pdv
	X
	Xoldrd7	ds.b 1			; Saved D7 for flags.
	Xcontflg	ds.b 1			; Continuation allowed flag.
	Xregusp	ds.l 1			; Register save storage.
	Xregd0	ds.l 1
	Xregd1	ds.l 1
	Xregd2	ds.l 1
	Xregd3	ds.l 1
	Xregd4	ds.l 1
	Xregd5	ds.l 1
	Xregd6	ds.l 1
	Xregd7	ds.l 1
	Xrega0	ds.l 1
	Xrega1	ds.l 1
	Xrega2	ds.l 1
	Xrega3	ds.l 1
	Xrega4	ds.l 1
	Xrega5	ds.l 1
	Xrega6	ds.l 1
	Xrega7	ds.l 1
	Xregsav	ds.b 0
	Xregsr	ds.w 1
	Xregpc	ds.l 1
	Xregfmt	ds.w 1
	Xregsav2	ds.b 0
	X
	Xouttab	ds.l 32			; Pointers to output handlers & A6 data areas
	Xoutstab	ds.l 32			; Pointers for output status
	Xintab	ds.l 32			; Pointers for input
	Xinstab	ds.l 32			; Pointers for input status
	X
	X	end
SHAR_EOF
if test 11414 -ne "`wc -c < 'bootp2.s'`"
then
	echo shar: error transmitting "'bootp2.s'" '(should have been 11414 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0

------- End of Forwarded Message