 NAM TSC DEBUG PACKAGE
 OPT PAG
*
* TSC DEBUG PACKAGE
*
* COPYRIGHT (C) 1978 BY
* TECHNICAL SYSTEMS CONSULTANTS. INC.
* BOX 2574
* W. LAFAYETTE, INDIANA 47906
*

* BREAKPOINT TABLE

 ORG $3C00

BPTAB RMB 256
STRTPC RMB 512
ENDPC EQU *
SMTAB RMB 32
EXTAB RMB 32
WPTAB RMB 32
MTAB RMB 32
MSGTB RMB 32
USER EQU *

* TEMP STORAGE

 ORG $4000

LINBUF RMB 80
BUFPNT FDB 0
CRSAVE FDB 0
INDEX FDB 0
DATPNT FDB 0
XSAVE FDB 0
OUTNUM FCB 0
TEMP FCB 0
TEMP1 FCB 1
VALUE FDB 0
POINT FDB 0
POINT2 FDB 0
FIRST FDB 0
LAST FDB 0
CNTR FCB 0
LSTTRM FCB 0
RTBF FCB 0
RTAD FDB 0
RTDAT FCB 0,0,0
MOD FCB 0
OPND FCB 0,0,0
END FDB 0
COUNT FDB 0
MAXC FDB 0
NMIC FDB 0
NMIC2 FDB 0
IRQC FDB 0
IRQC2 FDB 0
MAXSP FDB 0
TSP FDB 0
STPCNT FDB 0
SIMCNT FDB 0
WAITF FCB 0
PAUSF FCB 0
DELAY FCB 0
CC FCB 0
AR FCB 0
BR FCB 0
XR FDB 0
SP FDB 0
PC FDB 0
SSP FDB 0
OLDPC FDB 0
NESTC FCB 0
OPCNT FCB 0
MODE FCB 0
PRON FCB 0
TRCF FCB 0
FLAGA FDB 0
FLAGB FCB 0
VFLG FCB 0
EAFL FCB 0
NOBKF FCB 0
CFLG FCB 0
NSTRP FCB 0
XFRT FCB 0
STATES FDB 0,0
ITRF FCB 0
BPPOS FDB 0
BPEND FDB 0
BPCODE FCB 0
BTYP FCB 0
BPAD FDB 0
NXTBP FDB 0
NXTMSG FDB 0
INCOD FCB 0
EQUALS FCB 0
RELADR FDB 0
MARKRG FDB 0
LASTJ FDB 0
NXTPC FDB 0
OPPNT FDB 0
OPPNT2 FDB 0
SMEND FDB 0
EXEND FDB 0
WPEND FDB 0
MEND FDB 0
TABE FDB 0
EADR FDB 0
POPTAB FDB 0
OP FDB 0
 FCB 0
OPJMP FDB 0
 FCB 0
BXOP FDB 0
 FCB 0
BXOP2 FDB 0
 FCB 0

*
* SYSTEM EQUATES
*

BELL EQU $07 BELL CHARACTER (^G)
CR EQU $0D CARRIAGE RETURN
LF EQU $0A LINE FEED
SPC EQU $20 SPACE
STACK EQU $3FFF

*
* FLEX EQUATES
*

DOSBUF EQU $AC14 FLEX BUFFER POINTER
DOCMND EQU $AD4B CALL FLEX COMMAND HANDLER
FMSCLS EQU $B403 CLOSE ALL

 ORG $4100

*
* SYSTEM ENTRY
*

COLDS JMP COLD
WARMST JMP WARM

* SYSTEM CONSTANTS AND JUMP VECTORS

GETCHR JMP $E1AC
PUTCHR JMP $E1D1
WARMS JMP $E0D0
ACIA FDB $8004
BSP FCB $08
DEL FCB $18
BSE FCB $08
ESC FCB $1B
SWIV FDB $FFFA
IRQV FDB $FFF8
NMIV FDB $FFFC
INV EQU GETCHR+1
OUTV EQU PUTCHR+1
MONV EQU WARMS+1

*
* COLD START ENTRY
*

COLD LDS #STACK
 LDX #FIRST POINT TO TEMPS
COLD2 CLR 0,X CLEAR STORAGE
 INX
 CPX #EADR END OF AREA?
 BNE COLD2
 LDX #TRCRET SET TEMP CODE
 STX OPJMP+1
 LDAA #$7E SET JUMP
 STAA OPJMP
 STAA BXOP2
 LDX #PBRA SET CON BRA
 STX BXOP2+1
 LDAA #$39 SET RETURN
 STAA BXOP+2
 LDAA #1 SET REL BRA
 STAA BXOP+1
 LDX #OPTAB SET TABLE
 STX POPTAB
 STX OPPNT
 STX OPPNT2
 LDX #AUXTAB SET POINTER
 STX OPPNT2
 LDX #$A07F SET INTIAL STACK
 STX SP
 STX MAXSP
 LDX #BPTAB
 STX BPEND
 LDX #STRTPC SET UP TABLES
 STX NXTPC
 LDX #MSGTB SET TABLE
 STX NXTMSG
 BSR CLRPR CLEAR PR TABLES
 INC MODE SET MODE TO 1
 JMP WARM

*
* CLEAR PROTECTION TABLES
*

CLRPR LDX #EXTAB SET ALL EMPTY
 STX EXEND
 LDX #SMTAB
 STX SMEND
 LDX #WPTAB
 STX WPEND
 LDX #MTAB
 STX MEND
 RTS

*
* WARM START ENTRY
*

WARM EQU *

* EXECUTIVE STARTS HERE

EXEC LDS #STACK SETUP STACK
 CLR PAUSF CLEAR PAUSE
 LDAA #1 SET NO BREAK
 STAA NOBKF
 LDAA TRCF SET TRACE
 STAA PRON
 LDX #PRMPT POINT TO PROMPT
 JSR PSTRNG OUTPUT IT
 JSR INBUF GET INPUT LINE
EXEC3 JSR SKPSPC SKIP SPACES
 CMPA #CR LONE CARRIAGE RET?
 BEQ EXEC
 JSR CLASS CLASSIFY CHAR
 BCS ILIN ERROR?
 LDX #COMTBL POINT TO TABLE
 BSR LKNAM LOOK FOR NAME
 BNE ILIN ERROR?
EXEC6 LDX 1,X GET COM ADDRESS
 JMP 0,X JUMP TO IT

*
* REPORT ILLEGAL INPUT
*

ILIN LDX #WHATST POINT TO STRING
ILIN2 JSR PSTRNG OUTPUT IT
ILIN4 BRA EXEC RESTART

*
* REPORT SYNTAX ERROR
*

SYNER LDX #SYNST POINT TO STRING
 BRA ILIN2

*
* LOOK FOR NAME IN TABLE
*

LKNAM STX INDEX SAVE POINTER
LKNAM2 LDX BUFPNT SET POINTER
LKNAM3 LDAA 0,X GET A CHARACTER
 JSR CLASS CLASSIFY IT
 BCS LKNAM9 TERM?
 CMPA #$5F CHECK IF UPPER CASE
 BLS LKNAM4 IT IS
 SUBA #$20 MAKE UPPER
LKNAM4 STX DATPNT SAVE INDEX
 LDX INDEX RESTORE POINTER
 CMPA 0,X CHECK CHARACTER
 BNE LKNAM6
 INX BUMP THE POINTER
 STX INDEX SAVE INDEX
 TST 0,X CHECK IF END
 BNE LKNAM5
LKNA41 LDX DATPNT POINT TO NAME
 INX BUMP TO NEXT
 LDAA 0,X GET CHARACTER
 JSR CLASS CLASSIFY IT
 BCC LKNA45 TERM?
 CMPA #CR IS IT RETURN?
 BEQ LKNA42
 INX BUMP TO NEXT
LKNA42 STX BUFPNT SAVE NEW POSITION
 LDX INDEX POINT TO TABLE
 CLRA SHOW FOUND
 RTS RETURN
LKNA45 LDX INDEX RESET POINTER
 BRA LKNAM7 CONTINUE
LKNAM5 LDX DATPNT RESET POINTER
 INX BUMP THE POINTER
 BRA LKNAM3
LKNAM6 INX BUMP POINTER
LKNAM7 TST 0,X END OF WORD?
 BNE LKNAM6 REPEAT
 INX BUMP PAST ADDRESS
 INX
 INX
 TST 0,X END OF TABLE?
 BNE LKNAM REPEAT IF NOT
 CPX #0 SET NE BIT
LKNAM8 RTS RETURN
LKNAM9 DEX SAVE POINTER
 STX DATPNT
LKNA95 LDX INDEX POINT TO TABLE
 TST 0,X END OF LIST?
 BEQ LKNA41
 INX BUMP TO NEXT
 STX INDEX
 BRA LKNA95 REPEAT

*
* INPUT LINE INTO BUFFER
*

INBUF LDX #LINBUF POINT TO BUFFER
 STX BUFPNT SET POINTER
INBUF2 JSR GETCHR GO GET A CHARACTER
 CMPA DEL IS IT DELETE?
 BEQ INBUF5
 CMPA BSP IS IT BACKSPACE?
 BEQ INBUF6
 CMPA #CR IS IT CARRIAGE RET?
 BEQ INBUF4
 CMPA #$1F IS IT CONTROL?
 BLS INBUF2 IGNORE IF SO
INBUF3 CPX #LINBUF+79
 BEQ INBUF2
INBUF4 STAA 0,X PUT CHAR IN BUFFER
 INX BUMP THE POINTER
 CMPA #CR IS IT RETURN?
 BNE INBUF2 REPEAT IF NOT
 RTS RETURN
INBUF5 LDX #DELST POINT TO STRING
 BSR PSTRNG OUTPUT IT
 BRA INBUF
INBUF6 CPX #LINBUF FRONT OF BUFFER?
 BEQ INBUF5
 DEX DEC THE POINTER
 LDAA BSE GET ECHO CHAR
 CMPA #8 IS IT ^H ?
 BNE INBU65
 LDAA #SPC SETUP SPACE
 JSR PUTCHR OUTPUT IT
 LDAA BSE GET CHAR
INBU65 JSR PUTCHR OUTPUT IT
 BRA INBUF2 REPEAT

*
* PRINT STRING AT X
*

PSTRNG BSR PCRLF OUTPUT CR & LF
PDATA1 LDAA 0,X GET A CHARACTER
 CMPA #4 IS IT TERM?
 BEQ PDATA2
 JSR PUTCHR GO PUT CHAR.
 INX BUMP THE POINTER
 BRA PDATA1 REPEAT IT
PDATA2 RTS

*
* PCRLF ROUTINE
*

PCRLF STX CRSAVE SAVE X
 TST PAUSF PAUSE?
 BNE WAITR
 LDX ACIA POINT TO ACIA
 LDAA 0,X GET STATUS
 RORA CHARACTER?
 BCC PCRLF2
 LDAA 1,X GET CHARACTER
 ANDA #$7F MASK PARITY
 CMPA ESC IS IT ESCAPE?
 BEQ WAITR
PCRLF2 LDX #CRLFST POINT TO STRING
 BSR PDATA1 PRINT IT
 LDX CRSAVE RESTORE X
 RTS RETURN

*
* WAIT FOR RESPONSE
*

WAITR LDX ACIA POINT TO ACIA
 CLR PAUSF CLEAR FLAG
WAITR1 LDAA 0,X GET STATUS
 RORA CHARACTER?
 BCC WAITR1
 LDAA 1,X GET CHARACTER
 ANDA #$7F MASK PARITY
 CMPA ESC IS IT ESCAPE?
 BEQ PCRLF2
 CMPA #$3 IS IT ^C?
 BEQ WAITR2
 CMPA #CR IS IT CR?
 BNE WAITR1
WAITR2 JMP EXEC RETURN TO EXEC

*
* OUTPUT DECIMAL NUMBER AT X
*

OUTDEC CLR OUTNUM CLEAR FLAG
 STAB TEMP1 SET SUP FLAG
OUTDE2 LDAA #4 SET COUNTER
 STAA TEMP SAVE IT
 LDAA 0,X GET MSB
 LDAB 1,X GET LSB
 LDX #CONTBL POINT TO CONSTANTS
OUTDE4 BSR OUTDIG OUTPUT DIGIT
 INX BUMP TO NEXT CONST.
 INX
 DEC TEMP DEC THE COUNT
 BNE OUTDE4
 TBA GET LS DIGIT
 BRA OUTHR

*
* OUTPUT DECIMAL DIGIT
*

OUTDIG CLR COUNT CLEAR COUNTER
OUTDI2 CMPA 0,X CHECK MSB
 BLO OUTDI5
 BHI OUTDI4
 CMPB 1,X COMPARE LSB
 BLO OUTDI5
OUTDI4 SUBB 1,X SUB LSB
 SBCA 0,X SUB MSB
 INC COUNT BUMP COUNTER
 BRA OUTDI2 REPEAT
OUTDI5 PSHA SAVE A
 LDAA COUNT GET TOTAL
 BNE OUTDI6 IS IT ZERO?
 TST OUTNUM SUPPRESS ZEROS?
 BNE OUTDI6 NUMBER YET?
 TST TEMP1 NULL OR SPACE?
 BEQ OUTDI8
 LDAA #SPC SETUP SPACE
 BSR OUTHR2 OUTPUT IT
 BRA OUTDI8
OUTDI6 INC OUTNUM SHOW NUMBER
 BSR OUTHR OUTPUT DIGIT
OUTDI8 PULA RESTORE A
 RTS RETURN

*
* OUTPUT FOUR HEX DIGITS AT X
*

OUTADR BSR OUTHEX OUT 2 DIGITS
 INX BUMP POINTER

*
* OUTPUT HEX DIGIT AT X
*

OUTHEX LDAA 0,X GET MSB
 BSR OUTHL OUTPUT IT
 LDAA 0,X DO LSB
 BRA OUTHR OUTPUT IT

OUTHL LSRA GET MSB TO LSB
 LSRA
 LSRA
 LSRA

OUTHR ANDA #$F MASK OFF MSB
 ADDA #$30 ADD IN BIAS
 CMPA #'9 OVER NUMBERS
 BLS OUTHR2
 ADDA #7 FINISH BIAS
OUTHR2 JMP PUTCHR OUTPUT IT

*
* CLASSIFY CHARACTER
*

CLASS CMPA #'0 IS IT 0?
 BLO CLASS2 REPORT
 CMPA #'9 COMPARE TO 9
 BLS CLASS4 IS IT NUMBER?
 CMPA #'A COMPARE TO A
 BLO CLASS2 REPORT
 CMPA #'Z COMPARE TO Z
 BLS CLASS4 IS IT LETTER?
 CMPA #'A+$20 CHECK FOR LOWER
 BLO CLASS2 REPORT
 CMPA #'Z+$20 UPPER LIMIT
 BLS CLASS4
CLASS2 SEC SET FOR NOT
 STAA LSTTRM
 RTS RETURN
CLASS4 CLC SHOW ALPHANUMBEIC
 RTS RETURN

*
* GET NEXT CHARACTER FROM BUFFER
*

NXTCH STX INDEX SAVE INDEX
NXTCH2 LDX BUFPNT GET POINTER
NXTCH3 LDAA 0,X GET THE CHARACTER
 CMPA #CR IS IT RETURN?
 BEQ NXTCH4
 INX BUMP THE POINTER
 STX BUFPNT SAVE NEW POSITION
 CMPA #SPC CHECK FOR SPACE
 BNE NXTCH4
 CMPA 0,X NEXT CHAR SPACE?
 BEQ NXTCH3 SKIP IF SO
NXTCH4 LDX INDEX RESTORE INDEX
 BRA CLASS GO CLASSIFY

*
* SKIP ALL SPACES
*

SKPSPC STX CRSAVE SAVE INDEX
 LDX BUFPNT GET POINTER
SKPSP2 LDAA 0,X GET CHARACTER
 CMPA #SPC IS IT SPACE?
 BNE SKPSP4
 INX BUMP TO NEXT
 BRA SKPSP2 REPEAT
SKPSP4 STX BUFPNT SET POINTER
 LDX CRSAVE RESTORE INDEX
 RTS

*
* PREVIEW NEXT CHARACTER
*

PRVW STX CRSAVE SAVE X
 LDX BUFPNT POINT TO CHARACTER
 LDAA 0,X GET CHARACTER
 LDX CRSAVE RESET X
 RTS RETURN

*
* WORK IN HEX VALUE
*

WRKHX PSHB SAVE IND
 LDAB #4 SET UP COUNT
WRKHX4 ASL VALUE+1 SHIFT OVER 4
 ROL VALUE
 DECB DEC THE COUNT
 BNE WRKHX4 LOOP TIL DONE
 PULB RESTORE IND
 ADDA VALUE+1
 STAA VALUE+1 SET NEW DIGIT
 INCB SET INDICATOR
 RTS

*
* GET HEX VALUE FROM BUFFER
*

GETHEX CLRB CLEAR INDICATOR
 STAB VALUE CLEAR WORK SPACE
 STAB VALUE+1
GETHE2 JSR NXTCH GET CHARACTER
 BCS GETHE8 GRPAHICS?
 BSR TSTHEX TEST FOR HEX
 BCS GETHE6 ERROR?
 BSR WRKHX
 BRA GETHE2
GETHE6 JSR NXTCH GET CHARACTER
 BCC GETHE6 WAIT FOR TERM
 RTS ERROR RETURN
GETHE8 LDX VALUE GET VALUE
 CLC CLEAR ERRORS
 RTS RETURN

*
* TEST FOR HEX DIGIT
*

TSTHEX CMPA #$60 IS IT LOWER?
 BLS TSTHE1
 SUBA #$20 MAKE UPPER
TSTHE1 SUBA #'G REMOVE BIAS
 BPL TSTHE4
 ADDA #6 CHECK RANGE
 BPL TSTHE2 ERROR?
 ADDA #7 ADD BACK IN
 BPL TSTHE4 ERROR?
TSTHE2 ADDA #10 FINAL BIAS
 BMI TSTHE4 ERROR?
TSTHE3 CLC CLEAR ERRORS
 RTS RETURN
TSTHE4 SEC SET ERROR
 RTS RETURN

*
* INPUT DECIMAL NUMBER
*

INDEC CLR VALUE CLEAR WORK
 CLR VALUE+1
 CLRB CLEAR COUNTER
INDEC2 JSR NXTCH GET CHARACTER
 BCS GETHE8 TERM?
 CMPA #'9 CHECK FOR NUMBER
 BHI GETHE6
 ANDA #$F MASK NUMBER
 PSHB SAVE COUNT
 PSHA SAVE NUMBER
 LDAA VALUE GET VALUE
 LDAB VALUE+1
 ASLB DO TIMES 6
 ROLA
 ASLB
 ROLA
 ASLB
 ROLA
 ASL VALUE+1 TIMES 2
 ROL VALUE
 ADDB VALUE+1 ADD IN NEW
 ADCA VALUE
 STAB VALUE+1 SAVE NEW
 PULB GET NUMBER
 ADDB VALUE+1
 ADCA #0
 STAB VALUE+1 SAVE RESULT
 STAA VALUE
 PULB GET COUNT
 INCB BUMP COUNT
 BRA INDEC2 REPEAT

*
* ADD B TO X
*

ADDBX STX CRSAVE PUT INDEX
 ADDB CRSAVE+1 ADD IN B
 STAB CRSAVE+1 SAVE NEW
 BCC ADDBX2
 INC CRSAVE BUMP MSB
ADDBX2 LDX CRSAVE GET NEW VALUE
 RTS RETURN

*
* GO SIMULATE PROGRAM
*

GO JSR TSTTRM CHECK TERM
 BNE SIMUL0 ERROR?
 BRA SIMUL2 GO TO IT!

*
* JUMP TO ADDRESS
*

JUMP JSR TSTTRM CHECK FOR TERM
 BEQ SIMUL0 ERROR?
 BRA SIMU15 GO TO IT!

*
* LOOK FOR BREAKPOINT
*

LKBP LDX #BPTAB POINT TO TABLE
LKBP3 CPX BPEND END OF TABLE?
 BEQ LKBP6
 CMPA 0,X CHECK ADDRESS
 BNE LKBP4
 CMPB 1,X
 BNE LKBP4 MATCH?
 RTS RETURN - FOUND!
LKBP4 INX BUMP NEXT ENTRY
 INX
 INX
 INX
 INX
 INX
 INX
 INX
 BRA LKBP3 REPEAT
LKBP6 LDAA #1 SET NO FIND
 RTS RETURN

*
* OPERATOR HALT
*

OHALT LDX #OPHST POINT TO STRING
 JMP SIMUL7 GO REPORT

*
* SIMULATE PROGRAM
*

SIMUL JSR TSTTRM CHECK TERM
 BNE SIMUL1 ERROR?
SIMUL0 JMP SYNER REPORT ERROR
SIMUL1 LDX #0 CLEAR REGISTERS
 STX STATES
 STX STATES+2
 CLR WAITF
 CLR NESTC SET NEST = 0
SIMU15 JSR GETHEX GET ADDRESS
 BCS SIMUL0 ERROR?
 STX PC SET PC
SIMUL2 LDX PC GET PC
 STX OLDPC
 CPX END FINISHED?
 BNE SIMUL3
 JMP STOP DO STOP
SIMUL3 LDX ACIA POINT TO PORT
 LDAA 0,X GET STATUS
 RORA
 BCC SIMUL5 CHARACTER TYPED?
 LDAA 1,X GET CHARACTER
 ANDA #$7F MASK PARITY
 CMPA #$3 IS IT ^C? ****
 BEQ OHALT
 CMPA ESC IS IT ESCAPE
 BNE SIMU35
 STAA PAUSF SET FLAG
 BRA SIMUL5
SIMU35 CMPA #$13 IS IT ^S? ****
 BNE SIMUL4
 LDAA DELAY GET DELAY
 CMPA #$FF IS IT SLOWEST?
 BEQ SIMUL5
 INC DELAY SLOW DOWN
 BRA SIMUL5
SIMUL4 CMPA #$6 IS IT ^F?
 BNE SIMU45
 LDAA DELAY GET DELAY
 BEQ SIMUL5 FASTEST?
 DEC DELAY SPEED UP
 BRA SIMUL5
SIMU45 CMPA #$E IS IT ^N?
 BNE SIMU48
 LDX #1 SET COUNT TO 1
 STX NMIC2
 BRA SIMUL5
SIMU48 CMPA #$9 IS IT ^I?
 BNE SIMUL5
 LDX #1 SET COUNT TO 1
 STX IRQC2
SIMUL5 TST NOBKF DO BP?
 BNE SIMUL6
 LDAA PC GET PC
 LDAB PC+1
 JSR LKBP CHECK BREAKPOINT
 BNE SIMUL6
 JMP PRBP DO BREAKPOINT
SIMUL6 LDAA DELAY GET DELAY
 BEQ SIMU65 IS THERE ANY?
SIMU61 LDX #$0180 SET COUNTER
SIMU62 DEX DEC THE COUNT
 BNE SIMU62 DELAY HERE
 DECA FINISHED?
 BNE SIMU61 REPEAT
SIMU65 JSR TRCOL
 LDX PC ADJUST PC
 STX OLDPC
 JSR PRREG
 LDX SIMCNT GET COUNT
 BEQ SIMU67
 DEX DEC BY ONE
 STX SIMCNT SAVE NEW
 BEQ EXIT FINISHED?
SIMU67 TST CFLG COUNT ENABLED?
 BNE SIMU69
SIMU68 JMP SIMUL2 REPEAT
SIMU69 LDX COUNT
 DEX DEC COUNT
 STX COUNT
 BNE SIMU68
 LDX MAXC GET VALUE
 STX COUNT RESET COUNT
 LDX #CTST POINT TO STRING
SIMUL7 JSR PSTRNG PRINT IT
 LDX #PC
 JSR OUTADR PRINT ADDRESS
EXIT JMP EXEC
STOP LDX #STPST POINT TO STRING
 BRA SIMUL7

*
* IO CHECK
*

DOIOI LDAA PRON TEST IF TRACE ON
 BEQ DOIO
 CMPA NESTC CHECK NEST
 BLS DOIO
 LDX #INPST POINT TO STRING
 BRA DOIOO2
DOIOO LDAA PRON TRACE ON?
 BEQ DOIO
 CMPA NESTC CHECK NEST
 BLS DOIO
 LDX #OUTST POINT TO STRING
DOIOO2 JSR PDATA1 PRINT STRING
 LDX PC GET PC
DOIO STX OP+1 SAVE AS JUMP ADDR
 LDAA #$BD SETUP JSR ****
 STAA OP
 JSR TRCOL5 GO DO IT
 LDAA #$39 SETUP RTS ****
 STAA OP
 LDAB #1
 STAB OPCNT
 JMP PSUBR DO RETURN
DOMON LDX #HMONS POINT TO STRING
 BRA SIMUL7 REPORT XFR

*
* TRACE ONE LINE
*

TRCOL LDAA #$01 NOP CODE
 STAA OP+1
 STAA OP+2
 CLR EAFL CLEAR FLAG
 LDX PC
 CPX INV
 BEQ DOIOI
 CPX OUTV
 BEQ DOIOO
 CPX MONV MONITOR REFERENCE?
 BEQ DOMON
 LDX SMEND SET UP POINTERS
 STX TABE
 LDX #SMTAB
 LDAA PC GET PC
 LDAB PC+1
 JSR CHECK CHECK SIM PROT
 TPA
 LDX PC RESET PC
 TAP
 BEQ DOIO DO IN REAL TIME
 LDAA 0,X GET OPCODE
 STAA OP
 JSR FNDOP FIND OPCODE
TRCOL1 TST MODE CHECK MODE
 BNE TRCO11
 JMP TRCO15
TRCO11 LDAA INCOD GET CODE
 BEQ TRCHK2 ILLEGAL?
 ANDA #$F MASK BITS
 CMPA #7 IS IT RTS
 BNE TRCHK
 TST NESTC CHECK NEST
 BNE TRCHK
 JMP NSTER REPORT NEST ERROR
TRCHK TST XFRT XFT TRAP ON?
 BEQ TRCHK4
 TST NOBKF NO BREAK?
 BNE TRCHK4
 CMPA #3 IS IT BRA?
 BEQ TRCHK1
 CMPA #5 IS IT JMP?
 BNE TRCHK4
TRCHK1 JMP XFRTRP REPORT XFR TRAP
TRCHK2 JMP ILOPTR REPORT ILL OPCODE
TRCHK4 CMPA #4 IS IT BSR?
 BEQ TRCHK5
 CMPA #6 IS IT JSR?
 BNE TRCHK6
TRCHK5 LDAA NSTRP CHECK NEST TRAP
 BEQ TRCHK6
 DECA DEC THE COUNT
 CMPA NESTC CHECK CURRENT NEST
 BHI TRCHK6
 JMP TRNEST REPORT TRAP
TRCHK6 LDAA 3,X GET CODE
 ANDA #$F MASK STATE COUNT
 ADDA STATES+3 ADD IN STATES
 DAA
 STAA STATES+3
 BCC TRCHK7
 LDAA #1 SET UP A ONE
 ADDA STATES+2
 DAA
 STAA STATES+2
 BCC TRCHK7
 LDAA #1
 ADDA STATES+1
 DAA
 STAA STATES+1
 BCC TRCHK7
 LDAA #1
 ADDA STATES
 DAA
 STAA STATES
TRCHK7 TST ITRF ITRAP ON?
 BEQ TRCO12
 LDAA OP GET OPCODE
 CMPA #$3B CHECK TYPE
 BLO TRCO12
 CMPA #$3F
 BHI TRCO12
 LDX #ITRST POINT TO STRING
 JMP SIMUL7 REPORT TRAP
TRCO12 JSR PRCH CHECK PROTECTION
 LDAA OP GET OPCODE
 CMPA #$37 CHECK FOR PSH OR PUL ****
 BHI TRC125
 CMPA #$32
 BLO TRC125
 CMPA #$33 IS IT PUL?
 BHI TRCSP1
 LDAB #1 SET OFFSET
 BRA TRCSP2
TRCSP1 CMPA #$36 IS IT PSH?
 BLO TRC125
 LDAB #-1 SET OFFSET
TRCSP2 JSR CHKSP CHECK SP
TRC125 LDAA PC GET PC
 LDAB PC+1
 LDX NXTPC POINT TO TABLE
 STAA 0,X MAKE ENTRY
 STAB 1,X
 INX BUMP TO NEXT
 INX
 CPX #ENDPC END OF TABLE?
 BNE TRCO13
 LDX #STRTPC RESET POINTER
TRCO13 STX NXTPC SAVE POSITION
 LDX NMIC2 CHECK INTERRUPTS
 BEQ TRCO14
 DEX
 STX NMIC2 NMI?
 BNE TRCO14
 JMP PNMI GO DO NMI
TRCO14 LDX IRQC2 CHECK IRQ
 BEQ TRCO15
 DEX
 STX IRQC2
 BNE TRCO15
 JMP PIRQ DO IRQ
TRCO15 TST WAITF WAITING FOR INT?
 BEQ TRCOL2
 RTS RETURN
TRCOL2 LDX PC GET PC
 INX BUMP TO NEXT
 CLR NOBKF
 LDAB OPCNT GET COUNT
 CMPB #2 CHECK OP LENGTH
 BLO OP1LNG
 BHI OP3LNG
OP2LNG LDAA 0,X
 STAA OP+1
 BRA TRCOL3
OP3LNG LDAA 0,X
 STAA OP+1
 INX
 LDAA 0,X
 STAA OP+2
TRCOL3 INX BUMP PC
OP1LNG STX PC SAVE NEW VALUE
 LDAB OP
 LDAA INCOD GET CODE
 ANDA #$F GET TYPE
 CMPA #3 IS IT REGULAR?
 BLO TRCOL5

*
* CHECK FOR BRANCH INSTRUCTIONS
*

 BNE TRCOL4 BRANCH TYPE?
 DEX SET XFR ADDR
 DEX
 STX LASTJ
 CMPB #$20 IS IT BRA?
 BEQ PBRA

*
* PROCESS CONDITIONAL BRANCH
*

PBXX LDAA OP GET TYPE
 STAA BXOP SAVE IT
 LDAA CC
 TAP
 JMP BXOP DO CON BRANCH

*
* PROCESS BRA
*

PBRA CLRB
 LDAA OP+1 CALCULATE ADDRESS
 ADDA PC+1
 ADCB PC
 STAA PC+1
 STAB PC
 TST OP+1
 BPL PBRA4
 DEC PC
PBRA4 RTS RETURN

*
* CONTINUE TRACE PROCESSING
*

TRCOL4 LDX #FUNTAB POINT TO TABLE
 SUBA #4 REMOVE BIAS
 BEQ TRC047
TRC045 INX BUMP TO NEXT
 INX
 DECA DEC THE OFFSET
 BNE TRC045
TRC047 LDX 0,X GET JUMP VECTOR
 JMP 0,X JUMP TO IT

*
* HANDLE ALL INSTRUCTIONS EXCEPT BRA, BXX, JMP
* JSR AND RTS
*


TRCOL5 STS SSP SAVE STACK

*
* CHECK PSH, PUL
*

 CMPB #$30 CHECK PSH,PUL
 BLO TRCOL6 NO
 CMPB #$37
 BHI TRCOL6 NO

*
* HANDLE SINGLE STEP OF PSH, PUL
* (CONDITION CODES AREN'T AFFECTED BY PSH,PUL)
*

 LDX #PSHRET SET RETURN ADDR
 STX OPJMP+1
 LDS SP GET USER REGS
 LDX XR
 LDAB BR
 LDAA AR
 JMP OP EXECUTE IT

*
* PSH, PUL INSTRUCTION RETURN
*

PSHRET STAA AR SAVE REGS
 STAB BR
 BRA STKRT1 HANDLE REMAINING REGS

*
* CHECK FOR LDS, STS
*

TRCOL6 TBA GET OPCODE IN A
 ANDB #$F REMOVE UPPER NIBBLE
 CMPB #$E CHECK IT
 BEQ TRCOL7 COULD BE
 CMPB #$F
 BNE TRCOL8 NO
TRCOL7 ANDA #$F0 REMOVE LOWER NIBBLE
 CMPA #$80 CHECK IT
 BLO TRCOL8 NO
 CMPA #$B0
 BHI TRCOL8 MO

*
* HANDLE LDS,STS
* (ACC A NOT AFFECTED BY LDS,STS)
*

 LDX #STKRET SET RETURN ADDR
 STX OPJMP+1
 LDS SP GET USER REGS
 LDX XR
 LDAA CC GET CONDITION CODE
 TAP SET IT
 JMP OP HANDLE IT

*
* LDS, STS INSTRUCTION RETURN
*

STKRET TPA SAVE CC
 STAA CC
STKRT1 STX XR SAVE REMAINDER
 STS SP
 LDS SSP RESTORE STACK
 RTS

*
* HANDLE REMAINING INSTRUCTIONS
* (SP NOT AFFECTED BY OPERATION)
*

TRCOL8 LDX #TRCRET SET RETURN ADDR
 STX OPJMP+1
 LDX XR GET X REG
 LDAB BR GET B REG
 LDAA AR GET A
 PSHA
 LDAA CC GET C CODES
 TAP
 PULA
 JMP OP DO OPCODE

*
* REMAINING INSTRUCTIONS RETURN
*

TRCRET PSHA
 TPA
 STAA CC SAVE CC
 PULA
 STAA AR SAVE A
 STAB BR SAVE B
 STX XR SAVE X
 RTS RETURN

*
* PROCESS BSR
*

PBSR LDAB #-2 SET OFFSET
 JSR CHKSP CHECK SP CHECK STACK PROT
 LDX PC FIX LAST XFR
 DEX
 DEX
 STX LASTJ SET ADDRESS
 BSR PSUBC

*
* PROCESS SUBROUTINE CALL
*

PSUBC STS SSP SAVE STACK
 LDS SP
 LDAA PC+1 PUSH ADDRESS
 PSHA
 LDAA PC
 PSHA
 STS SP SAVE STACK
 LDS SSP
 INC NESTC SET NEST COUNT
PSUBC2 RTS

*
* PROCESS JSR
*

PJSR PSHB SAVE OPCODE
 LDAB #-2 SET OFFSET
 JSR CHKSP CHECK SP
 PULB RESTORE B
 CMPB #$AD IS IT INDEXED? ****
 BEQ PJSRX
 BSR PSUBC DO CALL

*
* PROCESS JMP
*

PJMP CMPB #$6E IS IT INDEXED? ****
 BEQ PJMPX
 LDX PC GET PC
 DEX
 DEX
 DEX
 STX LASTJ SET LAST XFR
 LDX OP+1
 STX PC
 RTS RETURN

*
* PROCESS INDEXED JSR
*

PJSRX BSR PSUBC

PJMPX LDX PC GET PC
 DEX FIX POS
 DEX
 STX LASTJ SET LAST XFR
 LDX XR
 STX PC
 JMP PBRA

*
* PROCESS RTS INSTRUCTION
*

PSUBR LDAB #2 SET OFFSET
 JSR CHKSP CHECK SP
 LDX PC SET LAST XFR
 DEX
 STX LASTJ SAVE ADDRESS
 STS SSP
 LDS SP
 PULA RESET PC
 STAA PC
 PULA
 STAA PC+1
 STS SP SAVE STACK
 LDS SSP
 DEC NESTC FIX NEST COUNT
 RTS

*
* PUSH REGISTERS ON STACK
*

PONS ASR WAITF TEST WAIT STATUS
 BCS PONS2
 LDAB #-7 SET OFFSET
 JSR CHKSP CHECK SP
 STS SSP SAVE STACK
 LDS SP GET MACHINES
 LDAA PC+1 PUSH PC
 PSHA
 LDAA PC
 PSHA
 LDAA XR+1 PUSH X
 PSHA
 LDAA XR
 PSHA
 LDAA AR PUSH A
 PSHA
 LDAA BR PUSH B
 PSHA
 LDAA CC PUSH CC
 PSHA
 STS SP SAVE STACK
 LDS SSP RESTORE
PONS2 RTS RETURN

*
* SET INTERRUPT MASK
*

SEIM LDAA #$10 SET MASK
 ORAA CC OR IT IN
 STAA CC SAVE NEW
 RTS RETURN

*
* PROCESS SWI INSTRUCTION
*

PSWI BSR PONS PUSH ALL
 BSR SEIM SET MASK
 LDX SWIV GET VECTOR
 LDX 0,X GET INDIRECT
PSWI2 STX PC SET IN PC
PSWI4 RTS RETURN

*
* PROCESS IRQ
*

PIRQ LDX IRQC RESET COUNTER
 STX IRQC2
 LDAA #$10 TEST MASK
 BITA CC
 BEQ PIRQ1
 JMP TRCO15 GO DO NEXT
PIRQ1 BSR PONS ALL ON STACK
PIRQ2 BSR SEIM SET MASK
 LDX IRQV GET VECTOR
PIRQ4 LDX 0,X GET INDIRECT
 STX PC SET NEW PC
 RTS RETURN

*
* PROCESS NMI
*

PNMI LDX NMIC RESET COUNT
 STX NMIC2
 BSR PONS ALL ON STACK
PNMI2 BSR SEIM SET MASK
 LDX NMIV GET VECTOR
 BRA PIRQ4

*
* PROCESS WAI INSTRUCTION
*

PWAI BSR PONS PUSH ALL
PWAI2 LDAA #1 SET WAIT FLAG
 STAA WAITF
 RTS RETURN

*
* PROCESS RTI INSTRUCTION
*

PRTI LDAB #7 SET OFFSET
 JSR CHKSP CHECK SP
 STS SSP SAVE STACK
 LDS SP GET MACHINE STACK
 PULA PULL CC
 STAA CC
 PULA PULL B
 STAA BR
 PULA PULL A
 STAA AR
 PULA PULL X
 STAA XR
 PULA
 STAA XR+1
 PULA PULL PC
 STAA PC
 PULA
 STAA PC+1
 STS SP SAVE STACK
 LDS SSP RESTORE
 RTS

ILOPTR LDX #ILOPST POINT TO STRING
 JMP SIMUL7 GO PRINT IT

*
* FIND OPCODE IN TABLE
*

FNDOP CLRB
 STAA OPPNT2+1 SET POINTER 2
 ASLA CALCULATE POSITION
 ROLB
 ASLA
 ROLB
 ADDA POPTAB+1 SET POSITION
 ADCB POPTAB
 STAA OPPNT+1 SAVE POSITION
 STAB OPPNT
 LDX OPPNT2 GET POINTER
 LDAA 0,X GET CODE
 STAA INCOD SAVE CODE
 LDX OPPNT GET POINTER
 CLRB
 LDAA 3,X GET CODE BYTE
 ANDA #$30 MASK LENGTH
 BEQ FNDOP4
 CMPA #$30 IS IT 3?
 BEQ FNDOP2
 CMPA #$20 IS IT 2?
 BEQ FNDOP3
 BRA FNDOP4
FNDOP2 INCB SET LENGTH COUNT
FNDOP3 INCB
FNDOP4 INCB
FNDOP5 STAB OPCNT SAVE COUNT
FNDOP6 RTS RETURN

*
* DUMP REGISTERS COMMAND
*

DREG LDX PC UPDATE OLD PC
 STX OLDPC
 BSR PRREG2 PRINT REGS
 JMP EXEC RETURN TO EXEC

*
* PRINT REGISTERS
*

PRREG LDAA PRON CHECK TRACE ON
 BEQ FNDOP6
 CMPA NESTC CHECK NEST LEVEL
 BLS FNDOP6
PRREG2 JSR PCRLF PRINT CR & LF
 LDX #CCST PRINT C CODES
 BSR PRRE22
 LDX #CC
 JSR OUTHEX
 LDX #AST PRINT A
 BSR PRRE22
 LDX #AR
 JSR OUTHEX
 LDX #BST PRINT B
 BSR PRRE22
 LDX #BR
 JSR OUTHEX
 LDX #XST PRINT X
 BSR PRRE22
 LDX #XR
 JSR OUTADR
 LDX #SPST PRINT SP
 BSR PRRE22
 LDX #SP
 JSR OUTADR
 BRA PRRE25
PRRE22 JMP PDATA1 PRINT STRING
PRRE25 LDX #PCST PRINT PC
 BSR PRRE22
 LDX #PC
 JSR OUTADR
 LDX #NST PRINT N
 BSR PRRE22
 LDX #NESTC
 JSR OUTHEX
 TST VFLG PRINT INDIRECTION?
 BEQ PRREG3
 LDX #XVST POINT TO STRING
 BSR PRRE22 PRINT IT
 LDX XR GET ADDRESS
 JSR OUTHEX PRINT CONTENTS
PRREG3 TST FLAGB CHECK FLAG OPT
 BEQ PRREG4
 LDX #FMST POINT TO STRING
 BSR PRRE22 PRINT IT
 LDX FLAGA POINT TO MEMORY
 JSR OUTADR PRINT IT
PRREG4 BSR OUTSP
 BSR OUTSP
 JMP DISO

*
* OUTPUT SPACES
*

OUT2SP BSR OUTSP OUTPUT SPACE
OUTSP LDAA #SPC
 JMP PUTCHR

*
* PROCESS BREAKPOINT
*

PRBP STX BPPOS SAVE BP POSITION
 TST 2,X CHECK COUNT
 BPL PRBP2 FORWARDS?
 TST 3,X COUNT LEFT?
 BNE PRBP1
 LDAA 2,X GET MSB OF COUNT
 ANDA #$7F MASK DIR BIT
 BNE PRBP1 IS IT ZERO?
 JSR RMVBP REMOVE BREAK POINT
 BRA PRBP3
PRBP1 LDAA 3,X GET COUNT
 SUBA #1 DEC BY 1
 STAA 3,X
 BCC PRBP4
 DEC 2,X FIX MSB OF COUNT
 BRA PRBP4
PRBP2 LDX 2,X GET COUNT
 BEQ PRBP4
 LDX BPPOS RESTORE POSITION
 LDAA 3,X GET COUNT
 SUBA #1 DEC BY 1
 STAA 3,X
 BCC PRBP3
 DEC 2,X FIX MSB
PRBP3 JMP SIMUL6 RETURN TO SIM
PRBP4 LDX BPPOS RESET POINTER
 LDAA 4,X GET CONDITIONAL
 TAB
 BEQ PRB57 NO CONDITION?
 CLR EQUALS
 ANDA #$3 MASK EQUALITY
 CMPA #2 IS IT !=
 BNE PRB45
 COM EQUALS SET FOR NOT-EQUAL
PRB45 TSTB CHECK MEM REF
 BPL PRB46
 LDX 5,X GET ADDRESS
 TST 0,X CHECK IF ZERO
 BRA PRB495
PRB46 LDX #RGTAB POINT TO TABLE
 ASRB ADJUST REG SPEC
 ASRB
 ASRB
 ASRB
 PSHB SAVE REG SPEC
 DECB
 BEQ PRB475
PRB47 INX FIND IN TABLE
 INX
 DECB DEC THE COUNT
 BNE PRB47
PRB475 LDX 0,X GET REG POSITION
 PULB RESTORE REG SPEC
 CMPB #4 SINGLE BYTE REG?
 BHI PRB48
 CLRA CLEAR MSB
 LDAB 0,X GET VALUE
 BRA PRB49
PRB48 LDAA 0,X GET 2 BYTE VALUE
 LDAB 1,X
PRB49 LDX BPPOS RESET POINTER
 CMPA 5,X COMPARE VALUES
 BNE PRB55
 CMPB 6,X
PRB495 BNE PRB55
 TST EQUALS TEST EQUALITY
 BEQ PRB57
PRBP5 JMP SIMUL6 NO COMPARE
PRB55 TST EQUALS TEST EQUALITY
 BEQ PRBP5
PRB57 LDX BPPOS POINT TO BP
 LDAA 7,X GET ACTION CODE
 STAA BPCODE SAVE IT
 BITA #$2 PRINT REGISTERS?
 BEQ PRBP6
 JSR PRREG2 PRINT REGISTERS
PRBP6 LDAA BPCODE GET CODE
 BITA #$4 TRACE ON?
 BEQ PRB62
 LDAB #$FF SET COUNT
 STAB TRCF
 STAB PRON SET TRACE ON
PRB62 BITA #$8 TRACE OFF?
 BEQ PRB65
 CLR PRON TRACE OFF
 CLR TRCF
PRB65 BITA #$10 RESET STATE COUNTER?
 BEQ PRB68
 LDX #0 SET UP ZERO
 STX STATES SET STATES
 STX STATES+2
 LDX BPPOS RESET POINTER
PRB68 BITA #$20 HISTOGRAM?
 BEQ PRBP7
 LDX BPPOS RESET POSITION
 INC 6,X BUMP COUNTER
 BNE PRBP7 CARRY?
 INC 5,X
PRBP7 BITA #$40 MESSAGE?
 BNE PRB75
 BITA #$80 JUMP TYPE?
 BEQ PRBP9
 LDX 5,X GET TRANSFER ADDRESS
 STX PC SET NEW PC
 JMP SIMUL2 GO TRACE
PRB75 LDX 5,X GET MSG ADDRESS
 JSR PSTRNG PRINT MESSAGE
PRBP9 LDAA BPCODE GET CODE
 BITA #$1 CHECK FOR HALT
 BEQ PRBP5
 JMP EXEC RETURN TO EXEC

*
* DISASSEMBLE ONE LINE
*

DISO LDX OLDPC GET PC
 LDAA 0,X GET OPCODE
 JSR FNDOP FIND OPERAND
DISO1 LDX #OLDPC POINT TO PC
 JSR OUTADR PRINT IT
 JSR OUTSP PRINT SPACE
 LDX OPPNT GET POINTER
 LDAB #3 SET COUNT
DISO2 LDAA 0,X GET CHARACTER
 JSR PUTCHR OUTPUT IT
 INX BUMP TO NEXT
 DECB
 BNE DISO2
 JSR OUTSP PRINT SPACE
 LDAB INCOD GET CODE
 TBA
 ANDA #$F MASK CODE
 BEQ DISO4
 CMPA #1 CHECK FOR A OR B
 BEQ DISO3
 CMPA #2 CHECK FOR B
 BNE DISO4
 LDAA #'B SETUP 'B'
 BRA DISO35
DISO3 LDAA #'A SETUP 'A'
DISO35 JSR PUTCHR PRINT IT
 BRA DISO45
DISO4 JSR OUTSP PRINT SPACE
DISO45 JSR OUTSP
 TBA
 ANDA #$70 CHECK ADDRESS MODE
 BEQ PERR
 CMPA #$10 IMMEDIATE?
 BNE DISO5
 LDAA #'# OUTPUT '#'
 JSR PUTCHR
DISO47 LDX OLDPC GET PC
 INX
 LDAA #'$ OUTPUT '$'
 JSR PUTCHR
 LDAB OPCNT GET OP LENGTH
 CMPB #2 IS IT 2?
 BEQ PBYTE
PADR JSR OUTADR PRINT ADDRESS
PADR2 BRA DISO7
PERR LDX OLDPC POINT TO BYTE
PBYTE JSR OUTHEX PRINT BYTE
 BRA DISO7
DISO5 CMPA #$20 DIRECT?
 BEQ DISO47
DISO55 CMPA #$30 INDEXED?
 BNE DISO6
 LDX OLDPC GET PC
 LDAA 1,X GET OFFSET
 STAA VALUE+1
 CLRB CLEAR FLAG
 STAB VALUE SET TO ZERO
 LDX #VALUE POINT TO IT
 JSR OUTDEC PRINT OFFSET
 LDX #IXST POINT TO STRING
 JSR PDATA1 PRINT IT
 BRA DISO7
DISO6 CMPA #$40 EXTENDED?
 BEQ DISO47
 CMPA #$60
 BNE DISO7
 LDX OLDPC GET PC
 CLRB
 LDAA 1,X GET OFFSET
 PSHA SAVE IT
 INX BUMP TO NEW PC
 INX
 STX RELADR SAVE ADDRESS
 ADDA RELADR+1 ADD IN OFFSET
 ADCB RELADR
 STAA RELADR+1 SAVE RESULT
 STAB RELADR
 PULA GET OFFSET
 TSTA IS IT PLUS?
 BPL DISO67
 DEC RELADR ADJUST ADR
DISO67 LDAA #'$ PRINT '$'
 JSR PUTCHR
 LDX #RELADR POINT TO ADDRESS
 BRA PADR PRINT IT
DISO7 LDAB OPCNT GET LENGTH
 LDX OLDPC
DISO8 INX BUMP PC
 DECB DEC THE COUNT
 BNE DISO8
 STX OLDPC FIX PC
 RTS RETURN

*
* CHECK PROTECTION TABLES
*

PRCH LDAA PC GET PC
 LDAB PC+1
 LDX EXEND SET TAB END
 STX TABE
 LDX #EXTAB POINT TO EX TABLE
 BSR CHECK GO CHECK ENTRY
 BNE PRCH2 FOUND?
 LDX #EXPST POINT TO STRING
 BRA PRCH3
PRCH2 LDAA PC GET PC
 BSR MPR CHECK MEM PROT
 BNE PRCH4 FOUND?
 LDX #MMP1ST POINT TO STRING
PRCH3 JSR PSTRNG PRINT IT
 LDX #PC POINT TO PC
 JSR OUTADR PRINT ADDRESS
 JMP EXEC RETURN TO EXEC
PRCH4 JSR CEA FIND E. A.
 BCS CHECK6 FOUND?
 LDAA EADR GET ADDRESS
 LDAB EADR+1
 TST INCOD WRITE CODE?
 BPL PRCH5
 LDX WPEND SET TABLE END
 STX TABE
 LDX #WPTAB POINT TO WP TABLE
 BSR CHECK GO CHECK ENTRY
 BNE PRCH5 FOUND?
 LDX #WPST POINT TO STRING
 BRA PRCH3
PRCH5 LDAA EADR GET ADDRESS
 BSR MPR CHECK MEM PROT
 BNE CHECK6 FOUND?
 LDX #MMP2ST POINT TO STRING
 BRA PRCH3

*
* CHECK MEMORY PROTECT TABLE
*

MPR LDX MEND SET END
 STX TABE
 LDX #MTAB POINT TO TABLE

*
* CHECK FOR ADDRESS IN PR TABLE
*

CHECK CPX TABE END OF TABLE?
 BEQ CHECK5
 CMPA 0,X CHECK 1ST ENTRY
 BLO CHECK4
 BHI CHECK2
 CMPB 1,X
 BLO CHECK4
 BEQ CHECK3
CHECK2 CMPA 2,X CHECK 2ND ENTRY
 BHI CHECK4
 BLO CHECK3
 CMPB 3,X
 BHI CHECK4
CHECK3 CLRA SHOW FOUND
 RTS RETURN
CHECK4 INX MOVE TO NEXT
 INX
 INX
 INX
 BRA CHECK REPEAT
CHECK5 LDAA #1 SHOW NO FIND
CHECK6 RTS RETURN

*
* CALCULATE EFFECTIVE ADDRESS
*

CEA LDAA INCOD GET CODE
 ANDA #$70 MASK BITS
 CMPA #$10 CHECK TYPES
 BLS CEA6
 CMPA #$50
 BHS CEA6
 CLR EADR ZERO E. A. AREA
 CLR EADR+1
 STAA EAFL SET FLAG
 LDX PC GET PC
 CMPA #$40 EXTENDED?
 BEQ CEA2
 CMPA #$20 DIRECT?
 BEQ CEA3
 LDAA 1,X INDEXED
 LDX XR GET INDEX REG
 STX EADR SAVE VALUE
 ADDA EADR+1 ADD IN OFFSET
 STAA EADR+1 SAVE RESULT
 BCC CEA5
 INC EADR
 BRA CEA5
CEA2 LDAA 1,X GET EXT ADDRESS
 LDAB 2,X
 BRA CEA4
CEA3 CLRA CLEAR FOR DIRECT
 LDAB 1,X GET ADDRESS
CEA4 STAA EADR SET ADDRESS
 STAB EADR+1
CEA5 CLC SHOW ADDRESS
 RTS RETURN
CEA6 SEC SHOW NO ADDRESS
 RTS

*
* SET SINGLE STEP MODE
*

SSM JSR PCRLF PRINT CR & LF
 LDX #1 SET DEFAULT
 STX STPCNT
 JSR TSTTRM CHECK TERM
 BEQ SSM1
 JSR INDEC GET COUNT
 BCS EQVAL2 ERROR?
 STX STPCNT SET COUNT
SSM1 LDX STPCNT RESET COUNTER
 STX SIMCNT
SSM15 JSR TRCOL TRACE ONE LINE
 LDX PC RESET PC
 STX OLDPC
 LDX SIMCNT GET COUNTER
 DEX DEC BY 1
 STX SIMCNT SAVE NEW
 BNE SSM15
 JSR PRREG2 PRINT REGS
SSM3 JSR GETCHR GET CHARACTER
 CMPA #CR IS IT CR?
 BEQ SSM2
 CMPA #SPC IS IT SPACE?
 BNE SSM3
 STAA NOBKF SET NO BREAK
 BRA SSM1
SSM2 JMP EXEC RETURN TO EXEC

*
* CHECK EQUALS VALUE
*

EQVAL BSR TSTEQ TEST FOR EQUALS
 BNE EQVAL2 ERROR?
 JSR INDEC GET COUNT
 BCS EQVAL2 ERROR?
 RTS
EQVAL2 JMP SYNER REPORT ERROR

*
* CHECK HEX EQUALS VALUE
*

HEQVAL BSR TSTEQ CHECK FOR EQUALS
 BNE EQVAL2 ERROR?
 JSR GETHEX GET HEX VALUE
 BCS EQVAL2 ERROR?
 RTS RETURN

*
* SET INSTRUCTION COUNT TRAP
*

INST BSR EQVAL TEST VALUE
 CLR CFLG CLEAR FLAG
 STX COUNT SAVE COUNT
 STX MAXC SET VALUE
 BEQ INST2 IS IT ZERO?
 INC CFLG SET MODE
INST2 BRA SSM2 RETURN

*
* SET NEST TRAP
*

NEST BSR EQVAL TEST VALUE
 LDAA VALUE+1 GET VALUE
 STAA NSTRP SAVE COUNT
 BRA INST2

*
* TEST FOR EQUALS
*

TSTEQ LDAA LSTTRM CHECK TERM
 CMPA #'= IS IT EQUALS?
 RTS

*
* TEST TERMINATOR
*

TSTTRM LDAA LSTTRM GET TERM
 CMPA #CR IS IT CR?
 RTS RETURN

*
* TEST FOR ON OR OFF
*

TSTON BSR TSTEQ TEST FOR EQUALS
 BNE EQVAL2 ERROR?
 JSR NXTCH GET CHARACTER
 ANDA #$5F MAKE UPPER
 CMPA #'O IS IT 'O'?
 BNE EQVAL2 ERROR?
 JSR NXTCH GET CHARACTER
 ANDA #$5F
 CMPA #'N IS IT 'N'?
 RTS RETURN

*
* PRINT TRAIL REGISTER
*

TRAIL LDX #TRST POINT TO STRING
 JSR PSTRNG PRINT IT
 LDX #LASTJ GET VALUE
 JSR OUTADR PRINT IT
 BRA INST2 RETURN

*
* PRINT PAST EXECUTION INSTRUCTIONS
*

PAST JSR PCRLF PRINT CR & LF
 CLR CNTR CLEAR COUNT
 JSR TSTTRM TEST TERM
 BEQ PAST2
 JSR INDEC INPUT COUNT
 BCS PAST6
 LDAA VALUE+1 GET VALUE
 STAA CNTR SET COUNT
PAST2 LDX NXTPC GET POSITION
PAST25 CPX #STRTPC TABLE BEGINNING?
 BNE PAST3
 LDX #ENDPC RESET POINTER
PAST3 DEX MOVE BACK ONE INST
 DEX
 DEC CNTR DEC THE COUNT
 BNE PAST25
PAST4 STX POINT2 SAVE POSITION
 LDX 0,X GET ADDRESS
 STX OLDPC SET PC
 JSR PCRLF PRINT CR & LF
 JSR DISO DISASSEMBLE
 LDX POINT2 GET POINTER
 INX MOVE TO NEXT
 INX
 CPX #ENDPC END OF TABLE?
 BNE PAST5
 LDX #STRTPC RESET POINTER
PAST5 CPX NXTPC FINISHED?
 BNE PAST4 REPEAT
 JSR PCRLF PRINT CR & LF
 JMP EXEC RETURN
PAST6 JMP SYNER REPORT ERROR

*
* GET ADDRESS RANGE
*

GETRNG JSR GETHEX GET ADDRESS
 BCS PROT3 ERROR?
 STX FIRST SAVE VALUE
 STX LAST
 JSR PRVW CHECK CHARACTER
 JSR TSTHEX IS IT HEX?
 BCS GETRN2
 JSR GETHEX GET NEXT ADDRESS
 BCS PROT3
 STX LAST SAVE VALUE
GETRN2 RTS RETURN

*
* SET PROTECTION FIELDS
*

PROT BSR GETRNG GET ADDRESSES
PROT2 JSR NXTCH GET CHARACTER
 ANDA #$5F MAKE UPPER C
 CMPA #'X IS IT EX?
 BEQ PROT4
 CMPA #'W IS IT WP?
 BEQ PROT5
 CMPA #'M IS IT MEM?
 BEQ PROT6
 CMPA #'S IS IT SIM P?
 BEQ PROT35
PROT3 JMP SYNER REPORT ERROR
PROT35 LDX SMEND GET END POINTER
 CPX #EXTAB FULL?
 BEQ PROT8
 BSR SETV SET VALUES
 STX SMEND SAVE END
 BRA PROT7
PROT4 LDX EXEND GET END POINTER
 CPX #WPTAB FULL?
 BEQ PROT8
 BSR SETV SET VALUES
 STX EXEND SAVE END
 BRA PROT7
PROT5 LDX WPEND GET END P
 CPX #MTAB FULL?
 BEQ PROT8
 BSR SETV SET VALUES
 STX WPEND
 BRA PROT7
PROT6 LDX MEND GET END P
 CPX #MSGTB FULL?
 BEQ PROT8
 BSR SETV SET VALUES
 STX MEND SAVE END
PROT7 JSR NXTCH GET NEXT CHAR
 JSR TSTTRM IS IT TERM?
 BNE PROT REPEAT?
 BRA CMOD35
PROT8 LDX #TBLOV POINT TO STRING
 JMP ILIN2 GO PRINT IT

*
* SET VALUES
*

SETV LDAA FIRST GET FIRST
 LDAB FIRST+1
 BSR STRIT GO STORE
 LDAA LAST GET LAST
 LDAB LAST+1

*
* STORE VALUES
*

STRIT STAA 0,X SAVE CHARACTER
 STAB 1,X
 INX BUMP POINTER
 INX
 RTS RETURN

*
* SET MODE
*

CMODE JSR EQVAL GET VALUE
 LDAA VALUE+1 GET VALUE
 CMPA #1 CHECK RANGE
 BHI CMODE4
CMODE3 STAA MODE SET MODE
CMOD35 JMP EXEC RETURN
CMODE4 JMP SYNER REPORT ERROR

*
* PRINT PROTECTION BOUNDS
*

BOUNDS JSR TSTTRM TEST TERM CHAR
 BNE BOUND2
 JSR PCRLF PRINT CR & LF
 BSR BOUNDX PRINT X TAB
 JSR PCRLF DO CR & LF
 BSR BOUNDW PRINT W TAB
 JSR PCRLF CR & LF
 BSR BOUNDM PRINT M TAB
 JSR PCRLF
 BSR BOUNS PRINT S TAB
 BRA BOUND8
BOUND2 JSR PCRLF PRINT CR & LF
 JSR NXTCH GET NEXT CHARACTER
 ANDA #$5F MASK TO UPPER
 CMPA #'S IS IT SIM P?
 BEQ BOUN35
 CMPA #'X IS IT EX?
 BEQ BOUND4
 CMPA #'W IS IT WP?
 BEQ BOUND5
 CMPA #'M IS IT MEM P?
 BEQ BOUND6
BOUND3 JMP SYNER REPORT ERROR
BOUN35 BSR BOUNS PRINT S
 BRA BOUND7
BOUND4 BSR BOUNDX PRINT X
 BRA BOUND7
BOUND5 BSR BOUNDW PRINT W
 BRA BOUND7
BOUND6 BSR BOUNDM PRINT M
BOUND7 JSR TSTTRM TEST TERM
 BNE BOUND2 REPEAT?
BOUND8 JSR PCRLF PRINT CR & LF
 JMP EXEC RETURN
BOUNS LDX #SMPST POINT TO STRING
 BSR PBPRT
 LDX SMEND SET END POINT
 STX TABE
 LDX #SMTAB POINT TO TABLE
 BRA PRTB PRINT TABLE
BOUNDX LDX #XPST POINT TO STRING
 BSR PBPRT
 LDX EXEND SET END POINTER
 STX TABE
 LDX #EXTAB POINT TO TABLE
 BRA PRTB PRINT TABLE
BOUNDW LDX #WPRST POINT TO STRING
 BSR PBPRT
 LDX WPEND SET END P
 STX TABE
 LDX #WPTAB POINT TO TABLE
 BRA PRTB PRINT TABLE
BOUNDM LDX #MPST POINT TO STRING
 BSR PBPRT
 LDX MEND SET END
 STX TABE
 LDX #MTAB POINT TO TABLE

*
* PRINT PROT TABLE
*

PRTB JSR PCRLF PRINT CR & LF
PRTB1 CPX TABE END OF TABLE?
 BEQ PRTB2
 JSR PCRLF PRINT CR & LF
 JSR OUT2SP
 JSR OUTADR PRINT ADDRESS
 INX BUMP POINTER
 LDAA #'- OUTPUT '-'
 JSR PUTCHR
 JSR OUTADR PRINT ADDRESS
 INX BUMP TO NEXT
 BRA PRTB1 REPEAT
PRTB2 JMP NXTCH GET NEXT CHAR

*
* PRINT PROTECTION STRING
*

PBPRT JSR PSTRNG PRINT STRING
 LDX #PRTSTR PRINT TO PROT
 JMP PDATA1 PRINT IT

*
* TRAP ON NEST COUNT
*

TRNEST LDX #NSTST POINT TO STRING
 BRA NSTER2 REPORT ERROR

*
* SET TRANSFER TRAP
*

STXFR JSR TSTON TEST ON/OFF
 BEQ STXFR2
 CLR XFRT TURN OFF
 BRA RTRN1 RETURN
STXFR2 LDAA #1 TURN ON
 STAA XFRT SET FLAG
 BRA RTRN1

*
* REPORT XFR TRAP
*

XFRTRP LDX #XFRST POINT TO STRING
 BRA NSTER2 REPORT

*
* REPORT NEST ERROR
*

NSTER LDX #NERST POINT TO STRING
NSTER2 JMP SIMUL7 GO REPORT

*
* PRINT RETURN ADDRESS
*

RTRN JSR TSTTRM TEST TERM
 BNE RTRN4 ERROR?
 TST NESTC CHECK NEST COUNT
 BEQ RTRN2
 LDX #RTADS POINT TO STRING
 JSR PSTRNG
 LDX SP GET SP
 INX BACK ONTO STACK
 LDAA 1,X GET ADDRESS
 LDAB 0,X
 STAA VALUE+1 SAVE ADDRESS
 STAB VALUE
 LDX #VALUE POINT TO IT
 JSR OUTADR PRINT ADDRESS
RTRN1 JMP EXEC RETURN
RTRN2 LDX #NORTS POINT TO STRING
 JSR PSTRNG PRINT IT
 BRA RTRN1
RTRN4 JMP SYNER REPORT ERROR

*
* DO DISASSEMBLY
*

DIS JSR TSTTRM CHECK TERM
 BEQ RTRN4 ERROR?
 JSR GETRNG GET ADDRESSES
 JSR PCRLF PRINT CR & LF
 LDX FIRST GET START ADDR
 STX OLDPC SAVE START
DIS2 JSR PCRLF PRINT CR & LF
 JSR DISO DO ONE LINE
 LDAA OLDPC GET NEXT POINTER
 LDAB OLDPC+1
 CMPA LAST FINISHED?
 BHI DIS4
 BLO DIS2
 CMPB LAST+1
 BLS DIS2
DIS4 LDX PC RESET POINTERS
 STX OLDPC
 JSR PCRLF
DIS6 BRA RTRN1 RETURN TO EXEC

*
* SET TRACE MODE AND LEVEL
*

STRAC JSR EQVAL GET VALUE
 LDAA VALUE+1
 STAA TRCF SAVE IN FLAG
 BRA DIS6 RETURN

*
* SET STOP ADDDRESS
*

SSTOP JSR TSTEQ TEST FOR EQUALS
 BNE SSTOP2 ERROR?
 JSR GETHEX GET ADDRESS
 BCS SSTOP2 ERROR?
 STX END SAVE ADDRESS
 BRA DIS6 RETURN
SSTOP2 BRA RTRN4 REPORT ERROR

*
* EXAMINE AND CHANGE MEMORY
*

XMEM JSR TSTTRM CHECK TERM
 BEQ XMEM2
 JSR GETHEX GET ADDRESS
 BCS SSTOP2 ERROR?
 BRA XMEM3
XMEM2 LDX PC GET DEFAULT ADDR
XMEM3 STX POINT2 SAVE POINTER
 JSR PCRLF PRINT CR & LF
XMEM35 LDX #POINT2 POINT TO ADDRESS
 JSR OUTADR PRINT IT
 JSR OUTSP PRINT SPACE
 LDX POINT2 POINT TO DATA
 JSR OUTHEX PRINT IT
 JSR OUTSP PRINT SPACE
 LDX POINT2 GET ADDRESS
 CLR VALUE CLEAR OUT NUMBER
 CLR VALUE+1
 JSR GETCHR GET CHARACTER
 CMPA #CR IS IT CR?
 BEQ DIS6
 CMPA #LF IS IT LF?
 BEQ XMEM5
XMEM37 CMPA #SPC IS IT SPACE?
 BEQ XMEM38
 JSR TSTHEX IS IT HEX?
 BCS XMEM4
 JSR WRKHX WORK IN VALUE
 JSR GETCHR GET NEW CHARACTER
 BRA XMEM37
XMEM38 LDX POINT2 GET ADDRESS
 LDAA VALUE+1 GET VALUE
 STAA 0,X PUT IN DATA
 NOP DELAY
 CMPA 0,X CHECK MEMORY
 BEQ XMEM4
 JMP ILIN REPORT ERROR
XMEM4 INX BUMP TO NEXT
 BRA XMEM3 REPEAT
XMEM5 DEX MOVE BACK ONE
 LDAA #CR OUTPUT CR
 JSR PUTCHR
 STX POINT2 SAVE POSITION
 BRA XMEM35

*
* SET REGISTERS
*

SET JSR TSTTRM CHECK TERM
 BEQ SET6 ERROR?
SET2 BSR FNDREG FIND REGISTER
 BCS SET6 ERROR?
 CMPA #1 CHECK SIZE
 BNE SET4
 JSR HEQVAL GET HEX VALUE
 LDX POINT2 GET POINTER
 LDX 2,X POINT TO REG
 LDAA VALUE+1 GET VALUE
 STAA 0,X SET REGISTER
 BRA SET5
SET4 JSR HEQVAL GET HEX VALUE
 LDX POINT2 GET POINTER
 LDX 2,X POINT TO REG
 LDAA VALUE GET VALUE
 LDAB VALUE+1
 STAA 0,X SET REGISTER
 STAB 1,X
 CPX #SP IS IT SP?
 BNE SET5
 STAA MAXSP SET MAX DEPTH
 STAB MAXSP+1
SET5 JSR TSTTRM ANY MORE?
 BNE SET2
 JMP EXEC RETURN
SET6 JMP SYNER REPORT ERROR

*
* FIND REGISTER IN MEMORY
*

FNDREG JSR NXTCH GET NEXT CHAR
 BCS SET6 ERROR?
 PSHA SAVE IT
 JSR NXTCH GET NEXT
 PULA
 BCC SET6 ERROR?
FNDRE1 ANDA #$5F MAKE UPPER
 LDX #RGT POINT TO TABLE
 LDAB #1 SET COUNT
FNDRE2 TST 0,X END OF TAB?
 BEQ FNDRE6
 CMPA 0,X COMPARE NAMES
 BEQ FNDRE4 MATCH?
 INX MOVE TO NEXT
 INX
 INX
 INX
 INCB BUMP COUNT
 BRA FNDRE2 REPEAT
FNDRE4 LDAA 1,X GET SIZE
 STX POINT2 SAVE POSITION
 CLC SHOW FOUND
 RTS RETRUN
FNDRE6 SEC SHOW ERROR
 RTS RETURN

*
* SET BREAK POINT
*

BRK CLR BTYP CLEAR TYPE
 JSR TSTTRM CHECK TERM
 BEQ BRK3 ERROR?
 CMPA #'@ CHECK FOR '@'
 BNE BRK2
 LDAA #3 SET DEFAULT TYPE
 STAA BTYP
 BRA BRK4
BRK2 JSR NXTCH GET CHARACTER
 CMPA #'@ IS IT '@'?
 BEQ BRK4
 JSR FNDTP FIND TYPE
 BCS BRK3 ERROR?
 LDAA 1,X GET TYPE
 ORAA BTYP MASK IN NEW
 STAA BTYP SAVE NEW
 BRA BRK2 REPEAT
BRK25 LDX BPPOS GET BP POS
 JSR RMVBP REMOVE BP
BRK3 JMP SYNER REPORT ERROR
BRK4 JSR GETHEX GET ADDRESS
 BCS BRK3
 STX BPAD SAVE ADDRESS
 LDAA BPAD GET ADDRESS
 LDAB BPAD+1
 JSR LKBP LOOK FOR BREAKPOINT
 STX BPPOS SAVE POSITION
 CPX #STRTPC OVERFLOW?
 BNE BRK5
BRK42 LDX #BOVST POINT TO STRING
 JSR PSTRNG PRINT IT
 LDX BPPOS GET POS
 JSR RMVBP REMOVE IT
BRK45 JMP EXEC RETURN
BRK5 LDAB #8 SET COUNTER
BRK55 CLR 0,X CLEAR OUT BP
 INX
 DECB DEC THE COUNT
 BNE BRK55
 LDX BPPOS GET POSITION
 LDAA BPAD GET ADDRESS
 LDAB BPAD+1
 STAA 0,X PUT IN ADDRESS
 STAB 1,X
 LDAA BTYP GET TYPE
 STAA 7,X PUT IN
 JSR TSTTRM CHECK TERM
 BEQ BRK7
 JSR NXTCH GET CHARACTER
 CMPA #'> CHECK COUNTERS
 BEQ BRK6
 CMPA #'<
 BEQ BRK58
 LDX BUFPNT RESET POINTER
 DEX
 STX BUFPNT
 BRA BRK7
BRK58 LDX BPPOS GET POSITION
 LDAA #$80 SET BEFORE COUNT
 STAA 2,X
BRK6 JSR INDEC GET COUNT
 BCS BRK25 ERROR?
 LDX BPPOS GET POSITION
 LDAA VALUE GET VALUE
 BMI BRK25 COUNT TOO BIG?
 LDAB VALUE+1
 STAB 3,X SAVE COUNT
 ORAA 2,X
 STAA 2,X
BRK7 LDX BPEND POINT TO BP
 CPX BPPOS CHECK IF NEW
 BNE BRK72
 LDAB #8
 JSR ADDBX CALCULATE END
 STX BPEND SAVE END
BRK72 LDAA BTYP GET TYP
 BITA #$20 IS IT HIST?
 BNE DOHB
 BITA #$40 IS IT MESSAGE?
 BNE DOMB
 BITA #$80 IS IT JUMP?
 BNE DOJB
 JMP BEXP PROCESS EXP

*
* SETUP HISTOGRAM COUNT
*

DOHB JSR TSTTRM CHECK TERM
 BEQ DOHB2
DOHB1 JMP BRK25 REPORT ERROR
DOHB2 JMP EXEC RETURN

*
* SETUP MESSAGE
*

DOMB LDX NXTMSG CHECK FULL
 CPX #USER
 BNE DOMB1
 JMP BRK42
DOMB1 LDAA NXTMSG GET POINTER
 LDAB NXTMSG+1
 LDX BPPOS POINT TO BP
 STAA 5,X SAVE POINTER
 STAB 6,X
 LDX NXTMSG POINT TO SPACE
DOMB2 JSR NXTCH GET NEXT CHAR
 CMPA #CR IS IT CR?
 BEQ DOMB4
 STAA 0,X SAVE CHARACTER
 INX
 CPX #USER TABLE FULL?
 BNE DOMB2
 JMP BRK42
DOMB4 LDAA #4 SETUP TERM
 STAA 0,X
 INX FIX POINTER
 STX NXTMSG MARK END
 BRA DOHB2 RETURN

*
* SETUP JUMP BP
*

DOJB JSR GETHEX GET ADDRESS
 BCS DOHB1 ERROR?
 LDAA VALUE GET VALUE
 LDAB VALUE+1
 LDX BPPOS POINT TO BP
 STAA 5,X SAVE ADDRESS
 STAB 6,X
 BRA DOHB2 RETURN

*
* SET CONDITIONAL STATUS
*

SETCN LDX BPPOS POINT TO BP
 LDAB #1
 LDAA LSTTRM GET TERM
 CMPA #'! NOT EQUALS?
 BNE SETCN2
 INCB SET IND
 JSR NXTCH GET NEXT CHAR
SETCN2 CMPA #'= IS IT '='?
 BNE SETCN4 ERROR?
 RTS RETURN
SETCN4 JMP BRK25 REPORT ERROR

*
* PROCESS BP EXPRESSION
*

BEXP JSR TSTTRM CHECK TERM
 BEQ DOHB2
 JSR NXTCH GET CHARACTER
 ANDA #$5F MAKE UPPER
 CMPA #'I IS IT 'I'?
 BNE SETCN4 ERROR?
 JSR NXTCH GET NEXT
 ANDA #$5F MAKE UPPER
 CMPA #'F IS IT 'F'?
 BNE SETCN4
 JSR SKPSPC SKIP SPACES
 JSR NXTCH GET CHARACTER
 BCC BEXP2 LETTER?
 CMPA #'$ IS IT '$'?
 BNE SETCN4 ERROR?
 JSR GETHEX GET ADDRESS
 BCS SETCN4
 JSR SETCN SET CONDITION
 ORAB #$80 SET ADDR TYPE
 STAB 4,X SAVE IN BP
 BRA BEXP4
BEXP2 JSR FNDRE1 FIND REGISTER
BEXP3 BCS SETCN4 ERROR?
 ASLB FIX SPEC
 ASLB
 ASLB
 ASLB
 STAB OPCNT SAVE VALUE
 JSR NXTCH GET CHARACTER
 JSR SETCN GET CONDITIONAL
 ORAB OPCNT
 STAB 4,X SAVE IN BP
 JSR GETHEX GET VALUE
 BCS BEXP3 ERROR?
BEXP4 LDAA VALUE GET VALUE
 LDAB VALUE+1
 LDX BPPOS POINT TO BP
 STAA 5,X SAVE VALUE
 STAB 6,X
 BRA HIST7 RETURN

*
* REMOVE BREAKPOINT FROM TABLE
*

RMVBP CPX BPEND END OF LIST?
 BEQ RMVBP4
RMVBP1 CPX BPEND END OF TABLE?
 BEQ RMVBP2
 LDAA 8,X GET CHARACTER
 STAA 0,X MOVE IT DOWN
 INX BUMP TO NEXT
 BRA RMVBP1 REPEAT
RMVBP2 LDAA BPEND+1 GET END POINT
 SUBA #8 DEC BY 8
 STAA BPEND+1 SAVE NEW
 BCC RMVBP4
 DEC BPEND ADJUST MSB
RMVBP4 RTS RETURN

*
* FIND BP TYPE IN TABLE
*

FNDTP LDX #TYPTB POINT TO TABLE
FNDTP2 TST 0,X END OF TABLE?
 BEQ FNDTP6
 CMPA 0,X CHECK CHARACTER
 BEQ FNDTP4 MATCH?
 INX MOVE TO NEXT
 INX
 BRA FNDTP2
FNDTP4 CLC SHOW MATCH
 RTS RETURN
FNDTP6 SEC SHOW ERROR
 RTS RETURN

*
* PRINT HISTOGRAMS
*

HIST BSR SETFL SET UP POINTERS
HIST2 JSR NXTRB GET BP POS
 BNE HIST6 FINISHED?
 LDAA 7,X GET TYPE
 ANDA #$20 IS IT HIST?
 BEQ HIST2
 BSR PBPAD PRINT ADDRESS
 CLRB CLEAR FLAG
 JSR OUTDEC OUTPUT COUNT
 BRA HIST2 REPEAT
HIST6 JSR PCRLF PRINT CR & LF
HIST7 JMP EXEC RETURN

*
* SETUP FIRST & LAST POINTERS
*

SETFL JSR PCRLF PRINT CR & LF
 LDX #0 SET FIRST
 STX FIRST
 DEX SET LAST
 STX LAST
 JSR TSTTRM CHECK TERM
 BEQ SETFL2
 JSR GETRNG GET RANGE
SETFL2 LDX #BPTAB-8
 STX NXTBP SET POINTER
 RTS RETURN

*
* PRINT BP ADDRESS
*

PBPAD JSR PCRLF PRINT CR  LF
 JSR OUTSP PRINT SPACE
 JSR OUTADR PRINT ADDRESS
 LDX #DSHST POINT TO STRING
 JSR PDATA1 PRINT IT
 LDX NXTBP POINT TO BP
 INX BUMP TO INFO
 INX
 INX
 INX
 INX
 RTS RETURN

*
* RETURN NEXT BP IN RANGE
*

NXTRB LDX NXTBP POINT TO BP
 LDAB #8 ADD IN 8
 JSR ADDBX
NXTRB2 STX NXTBP SAVE NEW POS
 CPX BPEND END OF LIST?
 BEQ NXTRB4
 LDAA 0,X GET ADDRESS
 LDAB 1,X
 BSR INRNG CHECK RANGE
 BNE NXTRB REPEAT
 LDX NXTBP POINT TO BP
 CLRA SHOW MATCH
 RTS RETURN
NXTRB4 LDAA #1 SHOW ERROR
 RTS RETURN

*
* ADDRESS IN RANGE CHECK
*

INRNG LDX #FIRST POINT TO LIST
 BSR DCMP COMPARE IT
 BLO NXTRB4
 LDX #LAST POINT TO LAST
 BSR DCMP COMPARE
 BHI NXTRB4
 CLRA SHOW MATCH
 RTS RETURN

*
* DO 16 BIT COMPARE
*

DCMP CMPA 0,X CHECK MSB
 BNE DCMP2
 CMPB 1,X COMPARE LSB
DCMP2 RTS RETURN

*
* PRINT BREAK POINTS
*

PBP JSR SETFL SET RANGES
PBP2 BSR NXTRB GET BREAKPOINT
 BNE PBP6 FINISHED?
 JSR PBPAD PRINT ADDRESS
 LDAB 2,X GET TYPE
 LDX #TYPTB POINT TO TABLE
 LDAA #8 SET COUNTER
 STAA CNTR
PBP3 RORB CHECK BIT BY BIT
 BCC PBP4
 LDAA 0,X GET CHARACTER
 JSR PUTCHR PRINT IT
PBP4 INX MOVE TO NEXT ENTRY
 INX
 DEC CNTR DEC THE COUNT
 BNE PBP3 REPEAT
 BRA PBP2
PBP6 JMP HIST6 RETURN

*
* CLEAR BREAKPOINTS
*

CLB JSR SETFL SET RANGE
CLB2 BSR NXTRB GET BP ADDRESS
 BNE CLB4 FINISHED?
 JSR RMVBP REMOVE BP
 LDAA NXTBP+1 GET POINTER
 SUBA #8 DEC BY8
 STAA NXTBP+1 SAVE RESULT
 BCC CLB2
 DEC NXTBP ADJUST MSB
 BRA CLB2 REPEAT
CLB4 JMP EXEC RETURN

*
* CLEAR HISTOGRAM COUNTERS
*

CLH JSR SETFL SET RANGE
CLH2 JSR NXTRB GET BREAKPOINT
 BNE CLB4 FINISHED?
 CLR 5,X CLEAR COUNTER
 CLR 6,X
 BRA CLH2 REPEAT

*
* DO COUNTED SIMULATION
*

TCSIM LDAA #$FF SET TRACE ON
 STAA PRON
 BRA CSIM2

CSIM CLR PRON TURN TRACE OFF
CSIM2 LDX #1 SET DEFAULT COUNT
 STX SIMCNT
 JSR TSTTRM TEST TERM
 BEQ CSIM4
 JSR INDEC GET COUNT
 BCS CSIM6 ERROR?
 STX SIMCNT SET COUNT
CSIM4 JMP SIMUL2 GO SIMULATE
CSIM6 JMP SYNER REPORT ERROR

*
* PRINT STATES COUNTER
*

PSTAT LDX #STST POINT TO STRING
 JSR PSTRNG PRINT IT
 LDX #STATES POINT TO COUNTER
 JSR OUTADR PRINT IT
 INX
 JSR OUTADR
PSTAT4 BRA CLB4 RETURN

*
* SET DELAY
*

SDELY JSR EQVAL CHECK VALUE
 LDAA VALUE+1 GET VALUE
 STAA DELAY SET DELAY
 BRA PSTAT4

*
* SET INDIRECTION MODE
*

SIND JSR TSTON TEST ON/OFF
 BNE SIND2
 LDAA #$FF SET TO ON
 STAA VFLG
 BRA PSTAT4 RETURN
SIND2 CLR VFLG CLEAR MODE
 BRA PSTAT4

*
* SET INTERRPT STATUS
*

SIRQ JSR EQVAL GET VALUE
 STX IRQC SET COUNTERS
 STX IRQC2
 BRA PSTAT4

SNMI JSR EQVAL GET VALUE
 STX NMIC SET COUNTERS
 STX NMIC2
 BRA PSTAT4

*
* HEX CALCULATOR
*

CALC CLR BTYP CLEAR MODE
 LDX #CLCP POINT TO PROMPT
 JSR PSTRNG PRINT IT
 JSR INBUF GET INPUT LINE
 JSR PRVW CHECK FOR CR
 CMPA #CR
 BEQ CALC9
 BSR CNUM GET FIRST NUMBER
 STX FIRST SAVE IT
 JSR TSTTRM END OF LINE?
 BEQ CALC8
 CMPA #'+ IS IT ADD?
 BEQ CALC5
 CMPA #'- IS IT SUBTRACT?
 BNE CNUM6
 STAA BTYP SET MODE
CALC5 BSR CNUM GET SECOND
 STX LAST SAVE IT
 LDAA FIRST GET NUMBER
 LDAB FIRST+1
 TST BTYP ADD?
 BNE CALC6
 ADDB LAST+1 ADD NUMBERS
 ADCA LAST
 BRA CALC7
CALC6 SUBB LAST+1 SUBTRACT NUMBERS
 SBCA LAST
CALC7 STAA FIRST SAVE RESULT
 STAB FIRST+1
CALC8 JSR PCRLF PRINT CR & LF
 LDAA #'$ OUTPUT '$'
 JSR PUTCHR
 LDX #FIRST POINT TO NUMBER
 JSR OUTADR PRINT HEX
 JSR OUT2SP PRINT SPACES
 DEX ADJUST POINTER
 CLRB SET FLAG
 JSR OUTDEC PRINT DECIMAL
 BRA CALC REPEAT
CALC9 BRA DOASM4 RETURN

*
* GET NUMBER FOR CALC
*

CNUM JSR PRVW CHECK CHARACTER
 CMPA #'$ IS IT '$'?
 BNE CNUM2
 JSR NXTCH EAT CHARACTER
 JSR GETHEX INPUT HEX
 BCS CNUM6 ERROR?
 BRA CNUM4
CNUM2 JSR INDEC GET DECIMAL
CNUM4 RTS RETURN
CNUM6 BRA DOASM6 REPORT ERROR

*
* PRINT STACK CONTENTS
*

PSTK JSR INDEC GET COUNT
 BCS CNUM6 ERROR?
 LDAA VALUE+1 GET NUMBER
 BNE PSTK0
 LDAA #6 SET DEFAULT
PSTK0 LDX SP GET S POINTER
PSTK1 INX BUMP POINTER
 DECA DEC THE COUNT
 BNE PSTK1
PSTK2 CPX SP FINSIHED?
 BEQ CALC9
 JSR PCRLF PRINT CR * LF
 JSR OUTSP PRINT SPACE
 JSR OUTHEX PRINT CONTENTS
 DEX DEC POINTER
 BRA PSTK2 REPEAT

*
* DO LINE ASSEMBLY
*

DOASM JSR GETHEX GET ADDRESS
 BCS DOASM6 ERROR?
 STX POINT SAVE POINTER
DOASM2 JSR PCRLF PRINT CR & LF
 JSR OUTSP PRINT SPACE
 LDX #POINT POINT TO ADDRESS
 JSR OUTADR PRINT IT
 JSR OUTSP PRINT SPACE
 JSR INBUF GET LINE
 JSR SKPSPC SKIP SPACES
 CMPA #CR IS IT NULL?
 BEQ DOASM4
 BSR ASML ASMBL LINE
 BRA DOASM2 REPEAT
DOASM4 JMP EXEC RETURN
DOASM6 JMP SYNER REPORT ERROR

*
* DO ASSEMBLY
*

ASML LDAA #$50 SET DEFAULT INHER
 STAA BTYP
 CLR MOD CLEAR MODE
 LDX #OPND POINT TO STORAGE
 JSR NXTCH GET MNEMONIC
 ANDA #$5F MAKE UPPER
 STAA 0,X SAVE IN MEMORY
 JSR NXTCH
 ANDA #$5F
 STAA 1,X
 JSR NXTCH
 ANDA #$5F MAKE UPPER
 STAA 2,X
 JSR PRVW CHECK CHARACTER
 CMPA #CR IS IT CR?
 BEQ ASML7
 JSR CLASS CLASSIFY CHAR
 BCS ASML4
 ANDA #$5F MAKE UPPER CASE
 CMPA #'A IS IT 'A'?
 BNE ASML3
 INC MOD SET MOD
 BRA ASML35
ASML3 CMPA #'B IS IT 'B'
 BNE ASML4
 INC MOD
 INC MOD SET MOD
ASML35 JSR NXTCH GET CHARACTER
ASML4 JSR SKPSPC SKIP SPACES
 CMPA #CR END OF LINE?
 BEQ ASML7
 JSR PRVW CHECK CHARACTER
 CMPA #'# IS IT '#'?
 BEQ ASML6
 JSR CNUM GET NUMBER
 LDAA LSTTRM CHECK TERM
 CMPA #', IS IT COMMA
 BNE ASML5 IF SO, INDEXED
 JSR NXTCH GET CHARACTER
 CMPA #'X IS IT X? **** HASN'T CONVERTED TO U/C
 BNE DOASM6 ERROR
 LDAA #$30 SET TYPE
 BRA ASML65
ASML5 LDAA #$40 SET EXTENDED
 BRA ASML65
ASML6 JSR NXTCH EAT '#'
 JSR PRVW CHECK NEXT
 CMPA #'' IS IT "'"?
 BEQ ASML8
 JSR CNUM GET NUMBER
ASML63 LDAA #$10 SET IMMEDIATE
ASML65 STAA BTYP SAVE TYPE
ASML7 JSR FNDMN FIND CODE
 LDX POINT GET POINTER
 STAA 0,X STUFF OPCODE
 CMPB #$10
 BEQ ASML77
 CMPB #$30
 BNE ASML75
 INX BUMP POINTER
 LDAA VALUE GET NUMBER
 STAA 0,X
ASML75 INX BUMP POINTER
 LDAA VALUE+1 GET LSB
 STAA 0,X
ASML77 INX BUMP ONE MORE
 STX POINT SAVE POS
 RTS RETURN
ASML8 JSR NXTCH EAT "'"
 JSR NXTCH GET ASCII CHAR
 CLR VALUE
 STAA VALUE+1 SAVE VALUE
 BRA ASML63

*
* FIND MNEMONIC
*

FNDMN LDX #OPTAB SET POINTER
 CLR CNTR
FNDMN1 STX OPPNT SAVE POS
 LDAA OPND GET CHARACTERS
 LDAB OPND+1
 CMPA 0,X COMPARE TO TABLE
 BNE FNDMN2
 CMPB 1,X
 BNE FNDMN2
 PSHA SAVE CHAR
 LDAA OPND+2 GET 3RD CHAR
 CMPA 2,X COMPARE
 PULA RESTORE
 BEQ FNDMN4
FNDMN2 INX MOVE TO NEXT ENTRY
 INX
 INX
 INX
 INC CNTR
 BNE FNDMN1 FINSIHED?
 JMP SYNER REPORT ERROR
FNDMN4 LDAB CNTR GET OPCODE
 LDX #OPTAB+1024 ****
 JSR ADDBX ADD TO POINTER
 STX OPPNT2 SAVE POS
 LDAB 0,X GET CODE
 ANDB #$F MASK BITS
 BEQ FNDM45
 CMPB #2 MODIFIER?
 BHI FNDM45
 CMPB MOD CHECK MODIFIER
 BEQ FNDMN5
FNDM42 LDX OPPNT SET POINTER
 BRA FNDMN2 REPEAT
FNDM45 TST MOD CHECK MODIFIER
 BNE FNDM42
FNDMN5 CMPB #7 CHECK TYPE
 BHS FNDMN6
 CMPB #3
 BEQ FNDMN7 RELATIVE TYPE?
 CMPB #4
 BEQ FNDMN7
 LDAB 0,X GET CODE
 ANDB #$70 GET ADDRESS TYPE
 CMPB BTYP COMPARE
 BNE FNDM42
FNDMN6 LDX OPPNT GET POINTER
 LDAB 3,X GET COUNTS
 ANDB #$30 GET BYTE COUNT
 LDAA CNTR GET OPCODE
 RTS RETURN
FNDMN7 LDX POINT GET ADDRESS
 INX BUMP BY 2
 INX
 STX POINT2 SAVE NEW ADDR
 LDAA VALUE GET REL ADDRESS
 LDAB VALUE+1
 SUBB POINT2+1 SUBTRACT VALUES
 SBCA POINT2
 STAA VALUE SAVE RESULT
 STAB VALUE+1
 BRA FNDMN6 FINISH UP

*
* SET I TRAP
*

ITRAP JSR TSTON CHECK ON/OFF
 BNE ITRAP2
 LDAA #$FF SET ON
 STAA ITRF
 BRA ITRAP4
ITRAP2 CLR ITRF TURN OFF
ITRAP4 JMP EXEC RETURN

*
* CLEAR PROTECTION TABLES
*

CLP JSR TSTTRM CHECK TERM
 BNE CLP2
 JSR CLRPR CLEAR ALL TABLES
CLP1 JMP EXEC RETURN
CLP2 JSR NXTCH GET CHARACTER
 ANDA #$5F MAKE UPPER CASE
 CMPA #'S IS IT S?
 BEQ CLP4
 CMPA #'X IS IT X?
 BEQ CLP5
 CMPA #'W IS IT W?
 BEQ CLP6
 CMPA #'M IS IT M?
 BEQ CLP7
 JMP SYNER REPORT ERROR
CLP4 LDX #SMTAB POINT TO SIM TAB
 STX SMEND SET END
 BRA CLP8
CLP5 LDX #EXTAB POINT TO EX TAB
 STX EXEND SET END
 BRA CLP8
CLP6 LDX #WPTAB POINT TO WP TAB
 STX WPEND SET END
 BRA CLP8
CLP7 LDX #MTAB POINT TO MEM TAB
 STX MEND
CLP8 JSR NXTCH GET CHARACTER
 CMPA #CR IS IT TERM?
 BEQ CLP1
 BRA CLP2 REPEAT

*
* DUMP MEMORY IN HEX AND ASCII
*

DUMP JSR GETHEX GET ADDRESS
 BCS DUMP6
DUMP1 JSR PCRLF PRINT CR & LF
 LDX VALUE GET ADDRESS
 LDAA #16 SET COUNT
 STAA CNTR
DUMP2 LDAB #16 SET COUNTER
 STX POINT SAVE POSITION
 LDX #POINT
 JSR OUTADR PRINT ADDRESS
 JSR OUTSP PRINT SPACE
 LDX POINT RESET POINTER
DUMP25 PSHB SAVE COUNT
 JSR OUTHEX
 JSR OUTSP PRINT DATA & SPACE
 INX BUMP TO NEXT
 PULB RESET COUNT
 DECB DEC THE COUNT
 BNE DUMP25
 LDX POINT RESET POINTER
 LDAB #16 RESET COUNT
DUMP27 LDAA 0,X GET CHARACTER
 ANDA #$7F MASK PARITY
 CMPA #$1F CONTROL?
 BHI DUMP28
 LDAA #'_ SET UP '_'
DUMP28 JSR PUTCHR OUTPUT CHARACTER
 INX BUMP TO NEXT
 DECB DEC THE COUNT
 BNE DUMP27
 JSR PCRLF PRINT CR & LF
 DEC CNTR DEC THE COUNT
 BNE DUMP2
 INC VALUE BUMP ADDRESS
DUMP5 JSR GETCHR GET REPONSE
 CMPA #CR IS IT RETURN?
 BEQ DUMP6
 ANDA #$5F MAKE UPPER CASE
 CMPA #'F IS IT 'F'?
 BEQ DUMP1
 CMPA #'B IS IT 'B'?
 BNE DUMP5
 DEC VALUE DEC THE ADDRESS
 DEC VALUE
 BRA DUMP1
DUMP6 JMP EXEC RETURN TO EXEC

*
* DO DOS COMMAND
*

DODOS LDX DOSBUF SAVE DOS MPOINTER
 STX POINT2
 LDX BUFPNT
 STX DOSBUF SET DOS POINTER
 JSR DOCMND GO DO COMMND
 LDX POINT2 RESET POINTER
 STX DOSBUF
 JSR FMSCLS CLOSE ALL
 BRA DUMP6

*
* FIND STRING IN MEMORY
*

FIND JSR GETRNG GET RANGE
 LDX FIRST SET START POS
 STX POINT2
 LDX #LINBUF POINT TO BUFFER
 STX DATPNT
 JSR PRVW CHECK NEXT CHAR
 CMPA #'" IS IT '"'?
 BNE FIND3
 JSR NXTCH USE THE CHAR
FIND2 JSR NXTCH GET CHARACTER
 CMPA #CR IS IT CR?
 BEQ FIND4
 STAA 0,X SAVE CHARACTER
 INX BUMP POINTER
 BRA FIND2
FIND3 JSR GETHEX GET HEX VALUE
 LDX DATPNT
 TSTB ANY HEX?
 BEQ FIND4
 LDAA VALUE+1 GET VALUE
 STAA 0,X SAVE CHAR
 INX
 STX DATPNT SAVE POSITION
 BRA FIND3 REPEAT
FIND4 STX DATPNT MARK END
FIND5 LDX #LINBUF POINT TO BUFFER
FIND6 STX POINT SAVE POSITION
 LDAA 0,X GET CHARACTER
 LDX FIRST
 CPX LAST FINISHED?
 BEQ FIND8
 CMPA 0,X COMPARE CHARACTERS
 BNE FIND7
 INX BUMP TO NEXT
 STX FIRST
 LDX POINT
 INX BUMP TO NEXT HERE TOO
 CPX DATPNT END?
 BNE FIND6
 LDX #POINT2 FOUND IT!
 JSR PCRLF PRINT CR & LF
 JSR OUTADR PRINT ADDRESS
 LDX FIRST
 STX POINT2
 BRA FIND5 REPEAT
FIND7 LDX POINT2 RESET POINTER
 INX
 STX FIRST
 STX POINT2
 BRA FIND5 REPEAT
FIND8 JMP EXEC GO TO EXEC

*
* FILL MEMORY
*

FILL JSR GETRNG GET RANGE
 JSR GETHEX GET FILL CHAR
 LDAA VALUE+1
 LDX FIRST POINT TO START
FILL2 STAA 0,X STORE CHAR
 CPX LAST FINISHED?
 BEQ FIND8
 INX BUMP TO NEXT
 BRA FILL2 REPEAT

*
* SET REAL TIME BREAKPOINT
*

RT JSR TSTTRM CHECK TERM
 BNE RT2
 TST RTBF IS ONE SET?
 BEQ RTB4
 BRA RTB2
RT2 JSR GETHEX GET ADDRESS
 BCS RTB6
 LDAA 0,X GET BYTES
 STAA RTDAT SAVE IN TEMPS
 LDAA 1,X
 LDAB 2,X
 STAA RTDAT+1
 STAB RTDAT+2
 LDAA #$7E SET UP 'JUMP' ****
 STAA 0,X
 NOP DELAY
 CMPA 0,X CHECK MEMORY
 BNE RT4
 STAA OP SET OP TOO
 LDX #RTB SET POINTER
 STX POINT2
 LDX VALUE RESET X
 LDAA POINT2 SET ADDRESS
 STAA 1,X
 LDAA POINT2+1
 STAA 2,X
 INC RTBF SET FLAG
 STX RTAD SAVE ADDRESS
 LDX PC GET PC
 STX OP+1 SET IN OP
 JMP TRCOL5 GO EXECUTE
RT4 JMP ILIN REPORT ERROR

*
* PROCESS REAL TIME BREAKPOINT
*

RTB PSHA SAVE A
 TPA GET STATUS
 STAA CC
 PULA RESTORE A
 STAA AR SAVE ALL REGISTERS
 STAB BR
 STX XR
 STS SP
 LDS SSP RESET STACK POINTER
 LDX RTAD GET ADDRESS
 STX PC SAVEAS NEW PC
 STX OLDPC
 JSR PRREG2 PRINT REGISTERS
RTB2 LDX RTAD GET ADDRESS
 LDAA RTDAT RESET INSTRUCTIONS
 STAA 0,X
 LDAA RTDAT+1
 STAA 1,X
 LDAA RTDAT+2
 STAA 2,X
 CLR RTBF CLEAR FLAG
RTB4 JMP EXEC RETURN TO EXEC
RTB6 JMP SYNER REPORT ERROR

*
* CHECK SP PROTECTION
*

CHKSP TST MODE CHECK MODE
 BEQ CHKSP4
 CLRA
 TSTB OFFSET NEGATIVE?
 BPL CHKSP1
 COMA SIGN EXTEND
CHKSP1 ADDB SP+1 ADD TO SP
 ADCA SP
 STAB TSP+1 SAVE RESULT
 STAA TSP
 CMPA MAXSP CHECK IF MAX SP
 BHI CHKSP3
 BLO CHKSP2
 CMPB MAXSP+1 CHECK LSB
 BHS CHKSP3
CHKSP2 STAA MAXSP SAVE NEW MAX
 STAB MAXSP+1
CHKSP3 JSR MPR CHECK PROTECTION
 BNE CHKSP4
 LDX OLDPC RESET PC
 STX PC
 LDX #MSPST POINT TO STRING
 JMP PRCH3 PRINT IT
CHKSP4 RTS RETURN

*
* PRINT STACK DEPTH
*

DEPTH JSR PCRLF PRINT CR & LF
 LDX #MAXSP POINT TO MAX
 JSR OUTADR PRINT IT
 BRA FLAG5

*
* SET FLAG LOCATION
*

FLAG CLR FLAGB
 JSR TSTTRM CHECK TERM
 BEQ FLAG5
 JSR HEQVAL GET ADDRESS
 STX FLAGA SAVE ADDRESS
 INC FLAGB SET FLAG BYTE
FLAG5 JMP EXEC RETURN

*
* PRINT SINGLE DECIMAL
*

SINDEC STAA VALUE+1 SAVE VALUE
 CLR VALUE
 CLRB CLEAR FLAG
 LDX #VALUE POINT TO VALUE
 JMP OUTDEC PRINT NUMBER

*
* PRINT MACHINE CONFIGURATION
*

MACH JSR PCRLF PRINT CR & LF
 LDX #XMM POINT TO M STR
 BSR MACH2 PRINT IT
 LDAA MODE GET MODE
 BSR SINDEC PRINT IT
 LDX #XMT PRINT TRACE VALUE
 BSR MACH2
 LDAA TRCF
 BSR SINDEC
 LDX #NST PRINT NEST VALUE
 BSR MACH2
 LDAA NSTRP
 BSR SINDEC
 LDX #XVST PRINT INSTRUCTION COUNT
 BSR MACH2
 LDX #MAXC
 CLRB
 JSR OUTDEC
 BRA MACH4
MACH2 JMP PDATA1 PRINT STRING
MACH4 LDX #SPST PRINT STOP ADDRESS
 BSR MACH2
 LDX #END
 JSR OUTADR
 LDX #XMIT PRINT I TRAP STATE
 BSR MACH2
 LDAA ITRF
 BSR PRONF PRINT ON/OFF
 LDX #XMXT PRINT XFR TRAP STATE
 BSR MACH2
 LDAA XFRT
 BSR PRONF PRINT ON/OFF
 LDX #XMIRQ PRINT IRQ COUNT
 BSR MACH2
 LDX #IRQC
 CLRB
 JSR OUTDEC
 LDX #XMNMI PRINT NMI COUNT
 BSR MACH2
 LDX #NMIC
 CLRB
 JSR OUTDEC
MACH6 BRA FLAG5 RETURN TO EXEC

*
* PRINT ON OR OFF STATUS
*

PRONF BEQ PRONF2
 LDX #XONST PRINT ON
 BRA MACH2
PRONF2 LDX #XOFST PRINT OFF
 BRA MACH2

*
* CLEAR MESSAGE TABLE
*

CLM LDX #MSGTB POINT TO TABLE
 STX NXTMSG SAVE POINTER
 BRA MACH6

* COMMAND TABLE

COMTBL EQU *
 FCC 'ASM'
 FCB 0
 FDB DOASM
 FCC 'B'
 FCB 0
 FDB BRK
 FCC 'BOUNDS'
 FCB 0
 FDB BOUNDS
 FCC 'BP'
 FCB 0
 FDB PBP
 FCC 'CALC'
 FCB 0
 FDB CALC
 FCC 'CLB'
 FCB 0
 FDB CLB
 FCC 'CLH'
 FCB 0
 FDB CLH
 FCC 'CLM'
 FCB 0
 FDB CLM
 FCC 'CLP'
 FCB 0
 FDB CLP
 FCC 'DIS'
 FCB 0
 FDB DIS
 FCC 'DEPTH'
 FCB 0
 FDB DEPTH
 FCC 'DELAY'
 FCB 0
 FDB SDELY
 FCC 'DUMP'
 FCB 0
 FDB DUMP
 FCC 'EXIT'
 FCB 0
 FDB WARMS
 FCC 'FIND'
 FCB 0
 FDB FIND
 FCC 'FILL'
 FCB 0
 FDB FILL
 FCC 'FLAG'
 FCB 0
 FDB FLAG
 FCC 'GO'
 FCB 0
 FDB GO
 FCC 'HIST'
 FCB 0
 FDB HIST
 FCC 'IND'
 FCB 0
 FDB SIND
 FCC 'INST'
 FCB 0
 FDB INST
 FCC 'IRQ'
 FCB 0
 FDB SIRQ
 FCC 'ITRAP'
 FCB 0
 FDB ITRAP
 FCC 'JUMP'
 FCB 0
 FDB JUMP
 FCC 'MEM'
 FCB 0
 FDB XMEM
 FCC 'MACH'
 FCB 0
 FDB MACH
 FCC 'MODE'
 FCB 0
 FDB CMODE
 FCC 'NEST'
 FCB 0
 FDB NEST
 FCC 'NMI'
 FCB 0
 FDB SNMI
 FCC 'PROT'
 FCB 0
 FDB PROT
 FCC 'PAST'
 FCB 0
 FDB PAST
 FCC 'REG'
 FCB 0
 FDB DREG
 FCC 'RESET'
 FCB 0
 FDB COLD
 FCC 'RET'
 FCB 0
 FDB RTRN
 FCC 'RT'
 FCB 0
 FDB RT
 FCC 'SET'
 FCB 0
 FDB SET
 FCC 'SIM'
 FCB 0
 FDB CSIM
 FCC 'START'
 FCB 0
 FDB SIMUL
 FCC 'STACK'
 FCB 0
 FDB PSTK
 FCC 'STATES'
 FCB 0
 FDB PSTAT
 FCC 'STEP'
 FCB 0
 FDB SSM
 FCC 'STOP'
 FCB 0
 FDB SSTOP
 FCC 'TRACE'
 FCB 0
 FDB STRAC
 FCC 'TRAIL'
 FCB 0
 FDB TRAIL
 FCC 'TSIM'
 FCB 0
 FDB TCSIM
 FCC 'X'
 FCB 0
 FDB DODOS
 FCC 'XFR'
 FCB 0
 FDB STXFR
 FCB 0 END OF TABLE

* DECIMAL CONSTANT TABLE

CONTBL FDB  10000 CONSTANTS
 FDB 1000
 FDB 100
 FDB 10

* FUNCTION TABLE

FUNTAB FDB PBSR
 FDB PJMP
 FDB PJSR
 FDB PSUBR
 FDB PRTI
 FDB PSWI
 FDB PWAI

* REGISTER POINTER TABLE

RGTAB FDB AR
 FDB BR
 FDB CC
 FDB NESTC
 FDB SP
 FDB XR
 FDB PC

*
* REGISTER TABLE
*

RGT FCB 'A,1
 FDB AR
 FCB 'B,1
 FDB BR
 FCB 'C,1
 FDB CC
 FCB 'N,1
 FDB NESTC
 FCB 'S,2
 FDB SP
 FCB 'X,2
 FDB XR
 FCB 'P,2
 FDB PC
 FCB 0

*
* TYPE TABLE
*

TYPTB FCB 'S,1,'R,2,'T,4,'U,8
 FCB 'Z,$10,'H,$20,'M,$40,'J,$80
 FCB 0

* STRINGS

PRMPT FCC '**'
 FCB 4
CLCP FCC ' ='
 FCB 4
WHATST FCC 'WHAT?'
 FCB 4
CCST FCC 'C='
 FCB 4
AST FCC ' A='
 FCB 4
BST FCC ' B='
 FCB 4
XST FCC ' X='
 FCB 4
SPST FCC ' S='
 FCB 4
PCST FCC ' P='
 FCB 4
NST FCC ' N='
 FCB 4
XVST FCC ' I='
 FCB 4
FMST FCC ' F='
 FCB 4
XMM FCC 'M='
 FCB 4
XMT FCC ' T='
 FCB 4
XMIT FCC ' IT='
 FCB 4
XMXT FCC ' XT='
 FCB 4
XMIRQ FCC ' IRQ='
 FCB 4
XMNMI FCC ' NMI='
 FCB 4
XONST FCC 'ON'
 FCB 4
XOFST FCC 'OFF'
 FCB 4
INPST FCC ' IN '
 FCB 4
OUTST FCC ' OUT '
 FCB 4
IXST FCC ',X'
 FCB 4
DELST FCC '??'
 FCB 4
CRLFST FDB $D0A,0,4
STST FCC 'STATES = '
 FCB 4
STPST FCC '"STOP" AT '
 FCB 4
CTST FCC 'IC TIMEOUT AT '
 FCB 4
ILOPST FCC 'ILLEGAL OPCODE AT '
 FCB 4
ITRST FCC 'I TRAP AT '
 FCB 4
TRST FCC 'LAST XFR FROM '
 FCB 4
SYNST FCC 'SYNTAX ERROR'
 FCB 4
EXPST FCC 'EP TRAP AT '
 FCB 4
WPST FCC 'WP TRAP AT '
 FCB 4
MMP1ST FCC 'EX - MP TRAP AT '
 FCB 4
MMP2ST FCC 'REF - MP TRAP AT '
 FCB 4
MSPST FCC 'SP TRAP AT '
 FCB 4
TBLOV FCC 'TABLE OVERFLOW'
 FCB 4
WPRST FCC 'WRITE'
 FCB 4
XPST FCC 'EXECUTE'
 FCB 4
MPST FCC 'MEMORY'
 FCB 4
SMPST FCC 'SIMULATE'
 FCB 4
PRTSTR FCC ' PROTECTION'
 FCB 4
NSTST FCC 'NC TRAP AT '
 FCB 4
NERST FCC 'RTS IN LEVEL 0 AT '
 FCB 4
RTADS FCC 'RETURN = '
 FCB 4
NORTS FCC 'NEST LEVEL IS 0'
 FCB 4
XFRST FCC 'XFR TRAP AT '
 FCB 4
BOVST FCC 'OVERFLOW'
 FCB 4
HMONS FCC 'MON XFR AT '
 FCB 4
OPHST FCC 'OP HALT AT '
 FCB 4
DSHST FCC ' - '
 FCB 4

*
* MNEMONIC AND INFO TABLE
*

 ORG $5B00

OPTAB FCC '***'
 FCB 00
 FCC 'NOP'
 FCB $12
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'TAP'
 FCB $12
 FCC 'TPA'
 FCB $12
 FCC 'INX'
 FCB $14
 FCC 'DEX'
 FCB $14
 FCC 'CLV'
 FCB $12
 FCC 'SEV'
 FCB $12
 FCC 'CLC'
 FCB $12
 FCC 'SEC'
 FCB $12
 FCC 'CLI'
 FCB $12
 FCC 'SEI'
 FCB $12
 FCC 'SBA' $10
 FCB $12
 FCC 'CBA'
 FCB $12
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'TAB'
 FCB $12
 FCC 'TBA'
 FCB $12
 FCC '***'
 FCB 00
 FCC 'DAA'
 FCB $12
 FCC '***'
 FCB 00
 FCC 'ABA'
 FCB $12
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'BRA' $20
 FCB $24
 FCC '***'
 FCB 00
 FCC 'BHI'
 FCB $24
 FCC 'BLS'
 FCB $24
 FCC 'BCC'
 FCB $24
 FCC 'BCS'
 FCB $24
 FCC 'BNE'
 FCB $24
 FCC 'BEQ'
 FCB $24
 FCC 'BVC'
 FCB $24
 FCC 'BVS'
 FCB $24
 FCC 'BPL'
 FCB $24
 FCC 'BMI'
 FCB $24
 FCC 'BGE'
 FCB $24
 FCC 'BLT'
 FCB $24
 FCC 'BGT'
 FCB $24
 FCC 'BLE'
 FCB $24
 FCC 'TSX' $30
 FCB $14
 FCC 'INS'
 FCB $14
 FCC 'PUL'
 FCB $14
 FCC 'PUL'
 FCB $14
 FCC 'DES'
 FCB $14
 FCC 'TXS'
 FCB $14
 FCC 'PSH'
 FCB $14
 FCC 'PSH'
 FCB $14
 FCC '***'
 FCB 00
 FCC 'RTS'
 FCB $15
 FCC '***'
 FCB 00
 FCC 'RTI'
 FCB $1A
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'WAI'
 FCB $19
 FCC 'SWI'
 FCB $1C
 FCC 'NEG' $40
 FCB $12
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'COM'
 FCB $12
 FCC 'LSR'
 FCB $12
 FCC '***'
 FCB 00
 FCC 'ROR'
 FCB $12
 FCC 'ASR'
 FCB $12
 FCC 'ASL'
 FCB $12
 FCC 'ROL'
 FCB $12
 FCC 'DEC'
 FCB $12
 FCC '***'
 FCB 00
 FCC 'INC'
 FCB $12
 FCC 'TST'
 FCB $12
 FCC '***'
 FCB 00
 FCC 'CLR'
 FCB $12
 FCC 'NEG' $50
 FCB $12
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'COM'
 FCB $12
 FCC 'LSR'
 FCB $12
 FCC '***'
 FCB 00
 FCC 'ROR'
 FCB $12
 FCC 'ASR'
 FCB $12
 FCC 'ASL'
 FCB $12
 FCC 'ROL'
 FCB $12
 FCC 'DEC'
 FCB $12
 FCC '***'
 FCB 00
 FCC 'INC'
 FCB $12
 FCC 'TST'
 FCB $12
 FCC '***'
 FCB 00
 FCC 'CLR'
 FCB $12
 FCC 'NEG' $60
 FCB $27
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'COM'
 FCB $27
 FCC 'LSR'
 FCB $27
 FCC '***'
 FCB 00
 FCC 'ROR'
 FCB $27
 FCC 'ASR'
 FCB $27
 FCC 'ASL'
 FCB $27
 FCC 'ROL'
 FCB $27
 FCC 'DEC'
 FCB $27
 FCC '***'
 FCB 00
 FCC 'INC'
 FCB $27
 FCC 'TST'
 FCB $27
 FCC 'JMP'
 FCB $24
 FCC 'CLR'
 FCB $27
 FCC 'NEG' $70
 FCB $36
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'COM'
 FCB $36
 FCC 'LSR'
 FCB $36
 FCC '***'
 FCB 00
 FCC 'ROR'
 FCB $36
 FCC 'ASR'
 FCB $36
 FCC 'ASL'
 FCB $36
 FCC 'ROL'
 FCB $36
 FCC 'DEC'
 FCB $36
 FCC '***'
 FCB 00
 FCC 'INC'
 FCB $36
 FCC 'TST'
 FCB $36
 FCC 'JMP'
 FCB $33
 FCC 'CLR'
 FCB $36
 FCC 'SUB' $80
 FCB $22
 FCC 'CMP'
 FCB $22
 FCC 'SBC'
 FCB $22
 FCC '***'
 FCB 00
 FCC 'AND'
 FCB $22
 FCC 'BIT'
 FCB $22
 FCC 'LDA'
 FCB $22
 FCC '***'
 FCB 00
 FCC 'EOR'
 FCB $22
 FCC 'ADC'
 FCB $22
 FCC 'ORA'
 FCB $22
 FCC 'ADD'
 FCB $22
 FCC 'CPX'
 FCB $33
 FCC 'BSR'
 FCB $28
 FCC 'LDS'
 FCB $33
 FCC '***'
 FCB 00
 FCC 'SUB' $90
 FCB $23
 FCC 'CMP'
 FCB $23
 FCC 'SBC'
 FCB $23
 FCC '***'
 FCB 00
 FCC 'AND'
 FCB $23
 FCC 'BIT'
 FCB $23
 FCC 'LDA'
 FCB $23
 FCC 'STA'
 FCB $24
 FCC 'EOR'
 FCB $23
 FCC 'ADC'
 FCB $23
 FCC 'ORA'
 FCB $23
 FCC 'ADD'
 FCB $23
 FCC 'CPX'
 FCB $24
 FCC '***'
 FCB 00
 FCC 'LDS'
 FCB $24
 FCC 'STS'
 FCB $25
 FCC 'SUB' $A0
 FCB $25
 FCC 'CMP'
 FCB $25
 FCC 'SBC'
 FCB $25
 FCC '***'
 FCB 00
 FCC 'AND'
 FCB $25
 FCC 'BIT'
 FCB $25
 FCC 'LDA'
 FCB $25
 FCC 'STA'
 FCB $26
 FCC 'EOR'
 FCB $25
 FCC 'ADC'
 FCB $25
 FCC 'ORA'
 FCB $25
 FCC 'ADD'
 FCB $25
 FCC 'CPX'
 FCB $26
 FCC 'JSR'
 FCB $28
 FCC 'LDS'
 FCB $26
 FCC 'STS'
 FCB $27
 FCC 'SUB' $B0
 FCB $34
 FCC 'CMP'
 FCB $34
 FCC 'SBC'
 FCB $34
 FCC '***'
 FCB 00
 FCC 'AND'
 FCB $34
 FCC 'BIT'
 FCB $34
 FCC 'LDA'
 FCB $34
 FCC 'STA'
 FCB $35
 FCC 'EOR'
 FCB $34
 FCC 'ADC'
 FCB $34
 FCC 'ORA'
 FCB $34
 FCC 'ADD'
 FCB $34
 FCC 'CPX'
 FCB $35
 FCC 'JSR'
 FCB $39
 FCC 'LDS'
 FCB $35
 FCC 'STS'
 FCB $36
 FCC 'SUB' $C0
 FCB $22
 FCC 'CMP'
 FCB $22
 FCC 'SBC'
 FCB $22
 FCC '***'
 FCB 00
 FCC 'AND'
 FCB $22
 FCC 'BIT'
 FCB $22
 FCC 'LDA'
 FCB $22
 FCC '***'
 FCB 00
 FCC 'EOR'
 FCB $22
 FCC 'ADC'
 FCB $22
 FCC 'ORA'
 FCB $22
 FCC 'ADD'
 FCB $22
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'LDX'
 FCB $33
 FCC '***'
 FCB 00
 FCC 'SUB' $D0
 FCB $23
 FCC 'CMP'
 FCB $23
 FCC 'SBC'
 FCB $23
 FCC '***'
 FCB 00
 FCC 'AND'
 FCB $23
 FCC 'BIT'
 FCB $23
 FCC 'LDA'
 FCB $23
 FCC 'STA'
 FCB $24
 FCC 'EOR'
 FCB $23
 FCC 'ADC'
 FCB $23
 FCC 'ORA'
 FCB $23
 FCC 'ADD'
 FCB $23
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'LDX'
 FCB $24
 FCC 'STX'
 FCB $25
 FCC 'SUB' $E0
 FCB $25
 FCC 'CMP'
 FCB $25
 FCC 'SBC'
 FCB $25
 FCC '***'
 FCB 00
 FCC 'AND'
 FCB $25
 FCC 'BIT'
 FCB $25
 FCC 'LDA'
 FCB $25
 FCC 'STA'
 FCB $26
 FCC 'EOR'
 FCB $25
 FCC 'ADC'
 FCB $25
 FCC 'ORA'
 FCB $25
 FCC 'ADD'
 FCB $25
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'LDX'
 FCB $26
 FCC 'STX'
 FCB $27
 FCC 'SUB' $F0
 FCB $34
 FCC 'CMP'
 FCB $34
 FCC 'SBC'
 FCB $34
 FCC '***'
 FCB 00
 FCC 'AND'
 FCB $34
 FCC 'BIT'
 FCB $34
 FCC 'LDA'
 FCB $34
 FCC 'STA'
 FCB $35
 FCC 'EOR'
 FCB $34
 FCC 'ADC'
 FCB $34
 FCC 'ORA'
 FCB $34
 FCC 'ADD'
 FCB $34
 FCC '***'
 FCB 00
 FCC '***'
 FCB 00
 FCC 'LDX'
 FCB $35
 FCC 'STX'
 FCB $36

* SECONDARY INFO TABLE

AUXTAB FCB $00 $00
 FCB $50
 FCB $00
 FCB $00
 FCB $00
 FCB $00
 FCB $50
 FCB $50
 FCB $50
 FCB $50
 FCB $50
 FCB $50
 FCB $50
 FCB $50
 FCB $50
 FCB $50
 FCB $50 $10
 FCB $50
 FCB $00
 FCB $00
 FCB $00
 FCB $00
 FCB $50
 FCB $50
 FCB $00
 FCB $50
 FCB $00
 FCB $50
 FCB $00
 FCB $00
 FCB $00
 FCB $00
 FCB $63 $20
 FCB $00
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $63
 FCB $50 $30
 FCB $50
 FCB $51
 FCB $52
 FCB $50
 FCB $50
 FCB $D1
 FCB $D2
 FCB $00
 FCB $57
 FCB $00
 FCB $58
 FCB $00
 FCB $00
 FCB $5A
 FCB $59
 FCB $51 $40
 FCB $00
 FCB $00
 FCB $51
 FCB $51
 FCB $00
 FCB $51
 FCB $51
 FCB $51
 FCB $51
 FCB $51
 FCB $00
 FCB $51
 FCB $51
 FCB $00
 FCB $51
 FCB $52 $50
 FCB $00
 FCB $00
 FCB $52
 FCB $52
 FCB $00
 FCB $52
 FCB $52
 FCB $52
 FCB $52
 FCB $52
 FCB $00
 FCB $52
 FCB $52
 FCB $00
 FCB $52
 FCB $B0 $60
 FCB $00
 FCB $00
 FCB $B0
 FCB $B0
 FCB $00
 FCB $B0
 FCB $B0
 FCB $B0
 FCB $B0
 FCB $B0
 FCB $00
 FCB $B0
 FCB $30
 FCB $35
 FCB $B0
 FCB $C0 $70
 FCB $00
 FCB $00
 FCB $C0
 FCB $C0
 FCB $00
 FCB $C0
 FCB $C0
 FCB $C0
 FCB $C0
 FCB $C0
 FCB $00
 FCB $C0
 FCB $40
 FCB $45
 FCB $C0
 FCB $11 $80
 FCB $11
 FCB $11
 FCB $00
 FCB $11
 FCB $11
 FCB $11
 FCB $00
 FCB $11
 FCB $11
 FCB $11
 FCB $11
 FCB $10
 FCB $64
 FCB $10
 FCB $00
 FCB $21 $90
 FCB $21
 FCB $21
 FCB $00
 FCB $21
 FCB $21
 FCB $21
 FCB $A1
 FCB $21
 FCB $21
 FCB $21
 FCB $21
 FCB $20
 FCB $00
 FCB $20
 FCB $A0
 FCB $31 $A0
 FCB $31
 FCB $31
 FCB $00
 FCB $31
 FCB $31
 FCB $31
 FCB $B1
 FCB $31
 FCB $31
 FCB $31
 FCB $31
 FCB $30
 FCB $36
 FCB $30
 FCB $B0
 FCB $41 $B0
 FCB $41
 FCB $41
 FCB $00
 FCB $41
 FCB $41
 FCB $41
 FCB $C1
 FCB $41
 FCB $41
 FCB $41
 FCB $41
 FCB $40
 FCB $46
 FCB $40
 FCB $C0
 FCB $12 $C0
 FCB $12
 FCB $12
 FCB $00
 FCB $12
 FCB $12
 FCB $12
 FCB $00
 FCB $12
 FCB $12
 FCB $12
 FCB $12
 FCB $00
 FCB $00
 FCB $10
 FCB $00
 FCB $22 $D0
 FCB $22
 FCB $22
 FCB $00
 FCB $22
 FCB $22
 FCB $22
 FCB $A2
 FCB $22
 FCB $22
 FCB $22
 FCB $22
 FCB $00
 FCB $00
 FCB $20
 FCB $A0
 FCB $32 $E0
 FCB $32
 FCB $32
 FCB $00
 FCB $32
 FCB $32
 FCB $32
 FCB $B2
 FCB $32
 FCB $32
 FCB $32
 FCB $32
 FCB $00
 FCB $00
 FCB $30
 FCB $B0
 FCB $42 $F0
 FCB $42
 FCB $42
 FCB $00
 FCB $42
 FCB $42
 FCB $42
 FCB $C2
 FCB $42
 FCB $42
 FCB $42
 FCB $42
 FCB $00
 FCB $00
 FCB $40
 FCB $C0

 END COLDS

