       ;
       ;	*******************************************
       ;	*               C'MON Lite                *
       ;	* An assembler, disassembler, and monitor *
       ;	*        for the VIC-20 computer          *
       ;	*       (c) 2001 by Aleksi Eeben          *
       ;	*******************************************
       ;
       ; Ported to PAL-1/KIM-1 by Dave Hassler, 2022,
       ; with permission of the author. Source code reconstructed from 
       ; original binary file and comments by DHH (some 'labels' from AE).
       ;
       ; Uses Zero Page $20-22, $E7-EE. Uses bottom of stack for input buffer.
       ;

* = $0C00

0C00  20 69 0E   JSR $0E69	; store registers upon entry
0C03  A9 0C      LDA #$0C
0C05  85 EE      STA $EE
0C07  A0 00      LDY #$00
0C09  84 ED      STY $ED
0C0B  F0 13      BEQ $0C20
0C0D  20 11 0F   JSR $0F11        ; get a key for a CMD [KIM-1 routine]
0C10  C9 2E      CMP #$2E        ; is it a '.'?
0C12  F0 F9      BEQ $0C0D        ; yes, go get another char 
0C14  C9 58      CMP #$58        ; is it 'X'?
0C16  F0 27      BEQ $0C3F        ; yes, goto $163f
0C18  20 26 0C   JSR $0C26        ; neither, goto a CMP routine
0C1B  A9 01      LDA #$01
0C1D  69 00      ADC #$00
0C1F  A8         TAY
0C20  20 FF 0F   JSR $0FFF        ; get an address
0C23  4C 0D 0C   JMP $0C0D        ; end of 'get a char' loop, start agn
0C26  A0 07      LDY #$07        ; compare with CMD table in bottom of
0C28  D9 17 10   CMP $1017,Y        ; data table. LDY was #$09; changed to
0C2B  F0 05      BEQ $0C32        ; eliminate CBM Save and Load options.
0C2D  88         DEY
0C2E  10 F8      BPL $0C28
0C30  38         SEC
0C31  60         RTS
0C32  B9 21 10   LDA $1021,Y        ; is this the CMD jump table? YES!
0C35  85 EB      STA $EB
0C37  B9 2B 10   LDA $102B,Y
0C3A  85 EC      STA $EC
0C3C  6C EB 00   JMP ($00EB) ;
					; EXIT ROUTINE
0C3F  A9 00      LDA #$00        ; clear input buffer routine - needed for VIC-20
0C41  A0 58      LDY #$58
0C43  99 00 01   STA $0100,Y        ; store 0 in last cell of buffer
0C46  88         DEY
0C47  10 FA      BPL $0C43        ; and repeat until buffer full of 0
0C49  00         BRK        	; just break
                		; was RTS TO CBM BASIC (was started w/ SYS)

                 ;====================
           	 ; START OF [A]SSEMBLER
                 ;====================
0C4A  20 BF 0F   JSR $0FBF
0C4D  B0 43      BCS $0C92
0C4F  20 54 0F   JSR $0F54
0C52  90 06      BCC $0C5A
0C54  20 61 0F   JSR $0F61
0C57  20 A0 0F   JSR $0FA0
0C5A  A0 00      LDY #$00
0C5C  20 11 0F   JSR $0F11        ; get char
0C5F  C9 0D      CMP #$0D        ; is it CR?
0C61  D0 05      BNE $0C68        ; no? Go store it in the buffer
0C63  18         CLC
0C64  60         RTS
0C65  20 11 0F   JSR $0F11
0C68  99 00 01   STA $0100,Y
0C6B  C8         INY
0C6C  C9 0D      CMP #$0D        ; is AC (from buffer) a CR?(???) 
0C6E  D0 F5      BNE $0C65        ; if not, get another char 
0C70  A0 00      LDY #$00        ; if yes, reset Y
0C72  AD 00 01   LDA $0100        ; then compare the instruction, 
0C75  D9 FA 11   CMP $11FA,Y        ; looking for 0
0C78  D0 10      BNE $0C8A
0C7A  AD 01 01   LDA $0101
0C7D  D9 FB 11   CMP $11FB,Y
0C80  D0 08      BNE $0C8A	; I did not get around to trying to figure
0C82  AD 02 01   LDA $0102	; out the assembler any farther, once I got
0C85  D9 FC 11   CMP $11FC,Y	; it working properly -- DHH
0C88  F0 09      BEQ $0C93	
0C8A  C8         INY		
0C8B  C8         INY
0C8C  C8         INY		
0C8D  C0 AB      CPY #$AB
0C8F  D0 E1      BNE $0C72
0C91  38         SEC
0C92  60         RTS
0C93  84 E7      STY $E7
0C95  A0 0B      LDY #$0B
0C97  A2 00      LDX #$00
0C99  98         TYA
0C9A  48         PHA
0C9B  B9 D5 12   LDA $12D5,Y
0C9E  A8         TAY
0C9F  B9 FD 12   LDA $12FD,Y
0CA2  C9 30      CMP #$30
0CA4  F0 0D      BEQ $0CB3
0CA6  DD 03 01   CMP $0103,X
0CA9  D0 11      BNE $0CBC
0CAB  C9 0D      CMP #$0D
0CAD  F0 14      BEQ $0CC3
0CAF  C8         INY
0CB0  E8         INX
0CB1  D0 EC      BNE $0C9F
0CB3  BD 03 01   LDA $0103,X
0CB6  C9 30      CMP #$30
0CB8  B0 F5      BCS $0CAF
0CBA  90 00      BCC $0CBC
0CBC  68         PLA
0CBD  A8         TAY
0CBE  88         DEY
0CBF  10 D6      BPL $0C97
0CC1  30 CE      BMI $0C91
0CC3  68         PLA
0CC4  85 E8      STA $E8
0CC6  A0 00      LDY #$00
0CC8  B9 CC 10   LDA $10CC,Y
0CCB  C5 E7      CMP $E7
0CCD  D0 11      BNE $0CE0
0CCF  B9 63 11   LDA $1163,Y
0CD2  C5 E8      CMP $E8
0CD4  F0 11      BEQ $0CE7
0CD6  C9 04      CMP #$04
0CD8  D0 06      BNE $0CE0
0CDA  A5 E8      LDA $E8
0CDC  C9 09      CMP #$09
0CDE  F0 07      BEQ $0CE7
0CE0  C8         INY
0CE1  C0 97      CPY #$97
0CE3  D0 E3      BNE $0CC8
0CE5  F0 AA      BEQ $0C91
0CE7  A2 00      LDX #$00
0CE9  B9 35 10   LDA $1035,Y
0CEC  81 ED      STA ($ED,X)
0CEE  B9 63 11   LDA $1163,Y
0CF1  A8         TAY
0CF2  B9 A5 12   LDA $12A5,Y
0CF5  C0 00      CPY #$00
0CF7  F0 2A      BEQ $0D23
0CF9  85 E7      STA $E7
0CFB  A2 00      LDX #$00
0CFD  A9 24      LDA #$24
0CFF  E8         INX
0D00  DD 02 01   CMP $0102,X
0D03  D0 FA      BNE $0CFF
0D05  C0 09      CPY #$09
0D07  F0 20      BEQ $0D29
0D09  A5 E7      LDA $E7
0D0B  C9 02      CMP #$02
0D0D  F0 09      BEQ $0D18
0D0F  20 69 0D   JSR $0D69
0D12  B0 72      BCS $0D86
0D14  A0 02      LDY #$02
0D16  91 ED      STA ($ED),Y
0D18  20 69 0D   JSR $0D69
0D1B  B0 69      BCS $0D86
0D1D  A0 01      LDY #$01
0D1F  91 ED      STA ($ED),Y
0D21  A5 E7      LDA $E7
0D23  20 6F 0F   JSR $0F6F
0D26  4C 54 0C   JMP $0C54
0D29  20 69 0D   JSR $0D69
0D2C  B0 58      BCS $0D86
0D2E  85 EA      STA $EA
0D30  20 69 0D   JSR $0D69
0D33  B0 51      BCS $0D86
0D35  38         SEC
0D36  E5 ED      SBC $ED
0D38  85 E9      STA $E9
0D3A  A5 EA      LDA $EA
0D3C  E5 EE      SBC $EE
0D3E  85 EA      STA $EA
0D40  10 14      BPL $0D56
0D42  A9 81      LDA #$81
0D44  C5 E9      CMP $E9
0D46  B0 1A      BCS $0D62
0D48  A9 FF      LDA #$FF
0D4A  C5 EA      CMP $EA
0D4C  D0 14      BNE $0D62
0D4E  A6 E9      LDX $E9
0D50  CA         DEX
0D51  CA         DEX
0D52  8A         TXA
0D53  4C 1D 0D   JMP $0D1D
0D56  A9 81      LDA #$81
0D58  C5 E9      CMP $E9
0D5A  90 06      BCC $0D62
0D5C  A9 00      LDA #$00
0D5E  C5 EA      CMP $EA
0D60  F0 EC      BEQ $0D4E
0D62  A9 21      LDA #$21
0D64  20 1A 0F   JSR $0F1A
0D67  38         SEC
0D68  60         RTS
0D69  BD 03 01   LDA $0103,X
0D6C  E8         INX
0D6D  20 F0 0F   JSR $0FF0
0D70  B0 14      BCS $0D86
0D72  2A         ROL A
0D73  2A         ROL A
0D74  2A         ROL A
0D75  2A         ROL A
0D76  29 F0      AND #$F0
0D78  85 EB      STA $EB
0D7A  BD 03 01   LDA $0103,X
0D7D  E8         INX
0D7E  20 F0 0F   JSR $0FF0
0D81  B0 03      BCS $0D86
0D83  05 EB      ORA $EB
0D85  18         CLC
0D86  60         RTS
                 ;=======================
           	 ; START OF [D]ISASSEMBLER
                 ;=======================
0D87  20 BF 0F   JSR $0FBF        ; set up address to print (?)
0D8A  A9 10      LDA #$10        ; 16 lines 
0D8C  85 EA      STA $EA
0D8E  20 61 0F   JSR $0F61        ; print current 'line'/PC
0D91  20 A0 0F   JSR $0FA0        ; print SPC
0D94  A0 02      LDY #$02
0D96  B1 ED      LDA ($ED),Y        ; OPERAND
0D98  85 E8      STA $E8
0D9A  88         DEY
0D9B  B1 ED      LDA ($ED),Y
0D9D  85 E7      STA $E7
0D9F  88         DEY
0DA0  B1 ED      LDA ($ED),Y
0DA2  D9 35 10   CMP $1035,Y        ; SEEK OP CODE
0DA5  F0 0A      BEQ $0DB1        ; BEQ to OPCODEFOUND when found 
0DA7  C8         INY
0DA8  C0 97      CPY #$97
0DAA  D0 F6      BNE $0DA2
0DAC  A9 00      LDA #$00
0DAE  AA         TAX
0DAF  F0 06      BEQ $0DB7        ; if 0 then goto DISOUT 
0DB1  BE CC 10   LDX $10CC,Y        ; OPCODEFOUND
0DB4  B9 63 11   LDA $1163,Y
0DB7  85 E9      STA $E9        ; DISOUT
0DB9  A0 03      LDY #$03
0DBB  BD FA 11   LDA $11FA,X        ; OPOUTLP
0DBE  20 1A 0F   JSR $0F1A        ; to CHROUT
0DC1  E8         INX
0DC2  88         DEY
0DC3  D0 F6      BNE $0DBB        ; >00, loop up
0DC5  A4 E9      LDY $E9
0DC7  F0 2A      BEQ $0DF3        ; if no operand, out
0DC9  20 A0 0F   JSR $0FA0        ; print SPC
0DCC  B9 BD 12   LDA $12BD,Y        ; load 'PREFIXES' 
0DCF  A8         TAY
0DD0  20 FF 0F   JSR $0FFF        ; goto 'PrintMsg' routine 
0DD3  A4 E9      LDY $E9
0DD5  B9 B1 12   LDA $12B1,Y        ; load 'OperTypes' 
0DD8  F0 2A      BEQ $0E04        ; if 00, goto OPRELATIVE
0DDA  30 05      BMI $0DE1        ; GOTO OPNOT16 
0DDC  A5 E8      LDA $E8
0DDE  20 A6 0F   JSR $0FA6        ; Print postfix, if any 
0DE1  A5 E7      LDA $E7
0DE3  20 A6 0F   JSR $0FA6
0DE6  A4 E9      LDY $E9
0DE8  B9 C9 12   LDA $12C9,Y        ; load 'Postfixes' 
0DEB  F0 06      BEQ $0DF3
0DED  A8         TAY
0DEE  20 FF 0F   JSR $0FFF        ; 'PrintMsg' 
0DF1  A4 E9      LDY $E9
0DF3  B9 A5 12   LDA $12A5,Y        ; get instr size in bytes 
0DF6  20 6F 0F   JSR $0F6F        ; adv 'current addr'
0DF9  EA         NOP        	; was JSR $FFE1 - scan the VIC-20 STOP key 
0DFA  EA         NOP        	; was BEQ $1802 
0DFB  EA         NOP
0DFC  EA         NOP
0DFD  EA         NOP
0DFE  C6 EA      DEC $EA
0E00  D0 8C      BNE $0D8E
0E02  18         CLC
0E03  60         RTS
0E04  85 E8      STA $E8        ; OPRELATIVE
0E06  A5 E7      LDA $E7
0E08  10 02      BPL $0E0C
0E0A  C6 E8      DEC $E8
0E0C  18         CLC
0E0D  69 02      ADC #$02
0E0F  90 02      BCC $0E13
0E11  E6 E8      INC $E8
0E13  18         CLC
0E14  65 ED      ADC $ED
0E16  85 E7      STA $E7
0E18  A5 EE      LDA $EE
0E1A  65 E8      ADC $E8
0E1C  85 E8      STA $E8
0E1E  4C DC 0D   JMP $0DDC        ; jump to RELENTRY
                 ;=====================
           	 ; START OF ASCI[I] DUMP 
                 ;=====================
0E21  20 BF 0F   JSR $0FBF
0E24  A9 10      LDA #$10        ; # lines to print, was #$08
0E26  85 EA      STA $EA
0E28  20 61 0F   JSR $0F61
0E2B  A2 10      LDX #$10        ; ASCII char per line
0E2D  20 79 0F   JSR $0F79
0E30  C6 EA      DEC $EA
0E32  D0 F4      BNE $0E28
0E34  18         CLC
0E35  60         RTS
                 ;===================
            	 ; START OF [M]EMORY DUMP 
                 ;===================
0E36  20 BF 0F   JSR $0FBF
0E39  A9 10      LDA #$10        ; # of lines in the dump (was $#04)
0E3B  85 EA      STA $EA         ; was so low to accommodate VIC-20's
0E3D  20 61 0F   JSR $0F61       ; 23x22 char video.
0E40  A0 00      LDY #$00
0E42  20 A0 0F   JSR $0FA0
0E45  98         TYA
0E46  48         PHA
0E47  B1 ED      LDA ($ED),Y
0E49  20 A6 0F   JSR $0FA6
0E4C  68         PLA
0E4D  A8         TAY
0E4E  C8         INY
0E4F  C0 10      CPY #$10        ; bytes per line (was #$04) 
0E51  D0 EF      BNE $0E42
0E53  A2 10      LDX #$10        ; # ASCII char to tack on (was #$04) 
0E55  20 79 0F   JSR $0F79
0E58  C6 EA      DEC $EA         ; both of the above should be #$08
0E5A  D0 E1      BNE $0E3D       ; for a 40-col screen, $06 for 32 col. 
0E5C  18         CLC
0E5D  60         RTS
                 ;===================
            	 ; START OF [G]O CMD 
                 ;===================
0E5E  20 BF 0F   JSR $0FBF        ; get addr
0E61  B0 69      BCS $0ECC        ; RTS if not valid
0E63  20 9C 0F   JSR $0F9C        ; print a RET
0E66  20 7D 0E   JSR $0E7D        ; JMP around to go 'there'
0E69  08         PHP        	  ; store registers top of buffer
0E6A  8D 57 01   STA $0157
0E6D  8E 56 01   STX $0156
0E70  8C 55 01   STY $0155
0E73  BA         TSX
0E74  8E 54 01   STX $0154
0E77  68         PLA
0E78  8D 53 01   STA $0153
0E7B  18         CLC
0E7C  60         RTS
0E7D  6C ED 00   JMP ($00ED)        ; go 'there' 
                 ;============================
            	 ; START OF [R]EGISTER PRINT 
                 ;============================
0E80  A0 0C      LDY #$0C
0E82  20 FF 0F   JSR $0FFF        ; PrintMsg / header
0E85  A9 04      LDA #$04
0E87  85 E7      STA $E7
0E89  A4 E7      LDY $E7
0E8B  B9 53 01   LDA $0153,Y
0E8E  20 A6 0F   JSR $0FA6
0E91  20 A0 0F   JSR $0FA0
0E94  C6 E7      DEC $E7
0E96  D0 F1      BNE $0E89
0E98  AD 53 01   LDA $0153
0E9B  85 E8      STA $E8
0E9D  A9 08      LDA #$08
0E9F  85 E7      STA $E7
0EA1  A9 00      LDA #$00
0EA3  26 E8      ROL $E8
0EA5  69 30      ADC #$30
0EA7  20 1A 0F   JSR $0F1A
0EAA  C6 E7      DEC $E7
0EAC  D0 F3      BNE $0EA1
0EAE  18         CLC
0EAF  60         RTS
                 ;======================
           	 ; START OF [W]RITE BYTES 
                 ;======================
0EB0  20 BF 0F   JSR $0FBF
0EB3  B0 17      BCS $0ECC
0EB5  A9 00      LDA #$00
0EB7  85 EC      STA $EC
0EB9  20 54 0F   JSR $0F54
0EBC  B0 0D      BCS $0ECB
0EBE  20 D4 0F   JSR $0FD4
0EC1  B0 09      BCS $0ECC
0EC3  A4 EC      LDY $EC
0EC5  91 ED      STA ($ED),Y
0EC7  E6 EC      INC $EC
0EC9  D0 EE      BNE $0EB9
0ECB  18         CLC
0ECC  60         RTS
                 ;===================
            	 ; START OF CBM SAVE - NOT USED FOR PAL-1
                 ;===================(will never get called anyway)
;
0ECD  20 0A 19   JSR $190A        ; goto filename input
0ED0  B0 1C      BCS $0EEE        ; if not valid, out
0ED2  20 42 19   JSR $1942
0ED5  B0 17      BCS $0EEE
0ED7  A0 00      LDY #$00
0ED9  20 31 19   JSR $1931        ; goto set log dev for file xfr routine
0EDC  A9 F7      LDA #$F7
0EDE  A6 FD      LDX $FD
0EE0  A4 FE      LDY $FE
0EE2  20 D8 FF   JSR $FFD8        ; SAVE RAM to device 
0EE5  A5 F7      LDA $F7
0EE7  85 FD      STA $FD
0EE9  A5 F8      LDA $F8
0EEB  85 FE      STA $FE
0EED  18         CLC
0EEE  60         RTS
                 ;===================
            	 ; START OF CBM LOAD - NOT USED FOR PAL-1
                 ;===================
                 ;(will never get called anyway)
;
0EEF  20 0A 19   JSR $190A        ; goto filename input
0EF2  B0 15      BCS $0F09        ; if not valid, out (DUMMY BRANCH)
0EF4  20 BF 19   JSR $19BF
0EF7  A0 00      LDY #$00
0EF9  90 01      BCC $0EFC	; (DUMMY BRANCH)
0EFB  C8         INY
0EFC  20 31 19   JSR $1931        ; goto set log dev for file xfr routine
0EFF  A9 00      LDA #$00
0F01  A6 FD      LDX $FD        ; LOAD start address: x,y
0F03  A4 FE      LDY $FE
0F05  20 D5 FF   JSR $FFD5        ; LOAD RAM from device 
0F08  18         CLC
0F09  60         RTS
;
            ; CBM filename entry and test routine
;
            ; REMOVED in favor of PAL/KIM character in/out routines
            ; 20 54 19 JSR $0F54	; get a char, test for a space
            ; B0 1F BCS $0F2E		; no, out
            ; 20 CF FF JSR $0F11	; get a char 
            ; C9 22 CMP #$22		; is it a ' " '?
            ; D0 19       BNE $0F2F	; no, set carry flag and return
            ; A0 00       LDY #$00
            ; 20 CF FF    JSR $0F11	; get a char
            ; C9 0D       CMP #$0D	; is it CR?
            ; F0 10       BEQ $0F2F	; yes, set carry flag and return
            ; C9 22       CMP #$22	; is it a ' " '?
            ; F0 8 BEQ $0F2B		;
            ; 99 0 1 STA $0100,Y 	; input the filename to buffer (seems so)? 
            ; C8 INY
            ; C0 10 CPY #$10 
            ; D0 ED BNE $0F18 
            ; 84 F9 STY $F9 
            ; 18 CLC
            ; 60 RTS
            ; 38 SEC
            ; 60 RTS
;
            ; START OF PAL-1/KIM-1 CHAR I/O
;
0F0A  85 20        STOREM    STA $20        ; STORE THE REGISTERS
0F0C  86 21      		STX $21
0F0E  84 22      		STY $22
0F10  60         		RTS
0F11  20 0A 0F     GETKEY    JSR $0F0A
0F14  20 5A 1E   		JSR $1E5A        ; CALL GETCH
0F17  4C 2D 0F   		JMP $0F2D
0F1A  20 0A 0F     CHROUT    JSR $0F0A
0F1D  C9 0D      		CMP #$0D
0F1F  D0 05      		BNE $0F26	; if it's CR, add LF
0F21  20 A0 1E   		JSR $1EA0
0F24  A9 0A      		LDA #$0A
0F26  29 7F        OUTPUT    AND #$7F      ; STRIP HIGH BIT (NEEDED FOR PORTED S/W)
0F28  20 A0 1E   		JSR $1EA0   ; CALL OUTCH
0F2B  A5 20        RESTOR    LDA $20        ; RESTORE THE REGISTERS
0F2D  A6 21        XYBACK    LDX $21
0F2F  A4 22      		LDY $22
0F31  60         		RTS
;
            ; BELOW WILL NEVER GET CALLED, SO LEFT TO KEEP
            ; DATA ADDRESSES WHERE THEY'RE SUPPOSED TO BE - DHH
0F32  EA         NOP
0F33  A6 BA      LDX $BA
0F35  20 BA FF   JSR $FFBA        ; set logical device for file xfr
0F38  A5 F9      LDA $F9
0F3A  A2 00      LDX #$00
0F3C  A0 02      LDY #$02
0F3E  20 BD FF   JSR $FFBD        ; set filename from buffer at $0200
0F41  60         RTS
                 ;=========================================
            	 ; END CBM STORAGE I/O (and PAL-1 char routines)
		 ; START UTILITY ROUTINES
                 ;=========================================
;
            		; GET AN ADDR
0F42  20 BF 0F   JSR $0FBF        ; get part of addr
0F45  B0 0C      BCS $0F53        ; bad? out.
0F47  85 E7      STA $E7        ; store it
0F49  A5 EE      LDA $EE
0F4B  85 E8      STA $E8
0F4D  20 BF 0F   JSR $0FBF        ; get other part addr
0F50  B0 01      BCS $0F53
0F52  18         CLC
0F53  60         RTS
            		; IS THERE A SPC?
0F54  20 11 0F   JSR $0F11        ; get char
0F57  29 7F      AND #$7F        ; strip high bit
0F59  C9 20      CMP #$20        ; is it a space?
0F5B  D0 02      BNE $0F5F        ; no, set carry and back 
0F5D  18         CLC        ; yes, clear carry and back
0F5E  60         RTS
0F5F  38         SEC
0F60  60         RTS
            		; PRINT THE CURRENT ADDR
0F61  20 9C 0F   JSR $0F9C
0F64  A5 EE      LDA $EE
0F66  20 A6 0F   JSR $0FA6
0F69  A5 ED      LDA $ED
0F6B  20 A6 0F   JSR $0FA6
0F6E  60         RTS
            		; ADD AC TO CURRENT ADDR
0F6F  18         CLC
0F70  65 ED      ADC $ED
0F72  85 ED      STA $ED
0F74  90 02      BCC $0F78
0F76  E6 EE      INC $EE
0F78  60         RTS
            		; ASCII Out Routine
0F79  20 A0 0F   JSR $0FA0        ; to SpaceOut
0F7C  A0 00      LDY #$00
0F7E  B1 ED      LDA ($ED),Y
0F80  EA         NOP        	; was CMP #$A0: for CBM PETSCII (??)
0F81  EA         NOP        	; was BCS $0F8C
0F82  EA         NOP
0F83  EA         NOP
0F84  C9 80      CMP #$80
0F86  B0 10      BCS $0F98
0F88  C9 20      CMP #$20
0F8A  90 0C      BCC $0F98
0F8C  20 1A 0F   JSR $0F1A        ; to ASCII CHROUT
0F8F  C8         INY
0F90  CA         DEX
0F91  D0 EB      BNE $0F7E
0F93  98         TYA
0F94  20 6F 0F   JSR $0F6F
0F97  60         RTS

0F98  A9 2E      LDA #$2E        ; BAD ASCII: print a dot 
0F9A  D0 F0      BNE $0F8C
0F9C  A9 0D      LDA #$0D        ; ReturnOut: print a CR
0F9E  D0 02      BNE $0FA2
0FA0  A9 20      LDA #$20        ; SpaceOut: print a SPC
0FA2  20 1A 0F   JSR $0F1A        ; to CHROUT
0FA5  60         RTS
            		; PRINT AC IN HEX 
0FA6  AA         TAX
0FA7  6A         ROR A
0FA8  6A         ROR A
0FA9  6A         ROR A
0FAA  6A         ROR A
0FAB  29 0F      AND #$0F
0FAD  A8         TAY
0FAE  B9 4B 13   LDA $134B,Y
0FB1  20 1A 0F   JSR $0F1A
0FB4  8A         TXA
0FB5  29 0F      AND #$0F
0FB7  A8         TAY
0FB8  B9 4B 13   LDA $134B,Y
0FBB  20 1A 0F   JSR $0F1A
0FBE  60         RTS
            		; GET NEW 'CURRENT' ADDR 
0FBF  20 54 0F   JSR $0F54        ; got to get a char, test for SPC
0FC2  B0 0F      BCS $0FD3        ; if not SPC, return
0FC4  20 D4 0F   JSR $0FD4        ; search for hex digit(?) 
0FC7  B0 0A      BCS $0FD3        ; if not found, return
0FC9  85 EE      STA $EE        ; store the hex for later JMP/JSR
0FCB  20 D4 0F   JSR $0FD4
0FCE  B0 03      BCS $0FD3
0FD0  85 ED      STA $ED
0FD2  18         CLC
0FD3  60         RTS
            		; GET A BYTE VALUE FROM USER
0FD4  20 11 0F   JSR $0F11        ; get a char
0FD7  20 F0 0F   JSR $0FF0        ; compare it with ...something 
0FDA  B0 13      BCS $0FEF
0FDC  2A         ROL A
0FDD  2A         ROL A
0FDE  2A         ROL A
0FDF  2A         ROL A
0FE0  29 F0      AND #$F0
0FE2  85 EB      STA $EB
0FE4  20 11 0F   JSR $0F11
0FE7  20 F0 0F   JSR $0FF0
0FEA  B0 03      BCS $0FEF
0FEC  05 EB      ORA $EB
0FEE  18         CLC
0FEF  60         RTS
            		; CONVERT ASCII NYB TO BINARY
0FF0  A0 0F      LDY #$0F        ; look for AC 16 times 
0FF2  D9 4B 13   CMP $134B,Y        ; in top of data table 
0FF5  F0 05      BEQ $0FFC        ; if it is, txfr the Y index to AC, CLC, RTS 
0FF7  88         DEY
0FF8  10 F8      BPL $0FF2
0FFA  38         SEC        	; can't find AC, set carry, ret
0FFB  60         RTS
0FFC  98         TYA
0FFD  18         CLC
0FFE  60         RTS
            		; PRINTMSG ROUTINE
0FFF  B9 E1 12   LDA $12E1,Y        ; getting an addr for A MESSAGE
1002  85 EB      STA $EB        ; put it in temp loc.
1004  B9 EF 12   LDA $12EF,Y
1007  85 EC      STA $EC 	;
1009  A0 00      LDY #$00
100B  B1 EB      LDA ($EB),Y
100D  F0 06      BEQ $1015        ; if it's 00, CLC and Return
100F  20 1A 0F   JSR $0F1A        ; otherwise, print char in AC
1012  C8         INY        	; increm Y and go agn UNTIL 0 
1013  D0 F6      BNE $100B
1015  18         CLC
1016  60         RTS

; START OF DATA TABLES

1017: 0D
1018: 41 4D 49 57 47 44 52 53		; CDM list
1020: 4C 34 4A 36 21 B0 5E 87		; CMD jump table
1028: 80 CD EF 18 0C 0E 0E 0E		; 6502 op codes, MNEs, lengths
1030: 0E 0D 0E 0E 0E 69 65 75
1038: 6D 7D 79 61 71 29 25 35
1040: 2D 3D 39 21 31 0A 06 16
1048: 0E 1E 90 B0 F0 24 2C 30
1050: D0 10 00 50 70 18 D8 58
1058: B8 C9 C5 D5 CD DD D9 C1
1060: D1 E0 E4 EC C0 C4 CC C6
1068: D6 CE DE CA 88 49 45 55
1070: 4D 5D 59 41 51 E6 F6 EE
1078: FE E8 C8 4C 6C 20 A9 A5
1080: B5 AD BD B9 A1 B1 A2 A6
1088: B6 AE BE A0 A4 B4 AC BC
1090: 4A 46 56 4E 5E EA 09 05
1098: 15 0D 1D 19 01 11 48 08
10A0: 68 28 2A 26 36 2E 3E 6A
10A8: 66 76 6E 7E 4D 60 E9 E5
10B0: F5 ED FD F9 E1 F1 38 F8
10B8: 78 85 95 8D 9D 99 81 91
10C0: 86 96 8E 84 94 8C AA A8
10C8: BA 8A 9A 98 03 03 03 03
10D0: 03 03 03 03 06 06 06 06
10D8: 06 06 06 06 09 09 09 09
10E0: 09 0C 0F 12 15 15 18 1B
10E8: 1E 21 24 27 2A 2D 30 33
10F0: 36 36 36 36 36 36 36 36
10F8: 39 39 39 3C 3C 3C 3F 3F
1100: 3F 3F 42 45 48 48 48 48
1108: 48 48 48 48 4B 4B 4B 4B
1110: 4E 51 54 54 57 5A 5A 5A
1118: 5A 5A 5A 5A 5A 5D 5D 5D
1120: 5D 5D 60 60 60 60 60 63
1128: 63 63 63 63 66 69 69 69
1130: 69 69 69 69 69 6C 6F 72
1138: 75 78 78 78 78 78 7B 7B
1140: 7B 7B 7B 7E 81 84 84 84
1148: 84 84 84 84 84 87 8A 8D
1150: 90 90 90 90 90 90 90 93
1158: 93 93 96 96 96 99 9C 9F
1160: A2 A5 A8 01 02 03 04 05
1168: 06 07 08 01 02 03 04 05
1170: 06 07 08 00 02 03 04 05
1178: 09 09 09 02 04 09 09 09
1180: 00 09 09 00 00 00 00 01
1188: 02 03 04 05 06 07 08 01
1190: 02 04 01 02 04 02 03 04
1198: 05 00 00 01 02 03 04 05
11A0: 06 07 08 02 03 04 05 00
11A8: 00 04 0A 04 01 02 03 04
11B0: 05 06 07 08 01 02 0B 04
11B8: 06 01 02 03 04 05 00 02
11C0: 03 04 05 00 01 02 03 04
11C8: 05 06 07 08 00 00 00 00
11D0: 00 02 03 04 05 00 02 03
11D8: 04 05 00 00 01 02 03 04
11E0: 05 06 07 08 00 00 00 02
11E8: 03 04 05 06 07 08 02 0B
11F0: 04 02 03 04 00 00 00 00
11F8: 00 00 3F 3F 3F 41 44 43
1200: 41 4E 44 41 53 4C 42 43
1208: 43 42 43 53 42 45 51 42
1210: 49 54 42 4D 49 42 4E 45
1218: 42 50 4C 42 52 4B 42 56
1220: 43 42 56 53 43 4C 43 43
1228: 4C 44 43 4C 49 43 4C 56
1230: 43 4D 50 43 50 58 43 50
1238: 59 44 45 43 44 45 58 44
1240: 45 59 45 4F 52 49 4E 43
1248: 49 4E 58 49 4E 59 4A 4D
1250: 50 4A 53 52 4C 44 41 4C
1258: 44 58 4C 44 59 4C 53 52
1260: 4E 4F 50 4F 52 41 50 48
1268: 41 50 48 50 50 4C 41 50
1270: 4C 50 52 4F 4C 52 4F 52
1278: 52 54 49 52 54 53 53 42
1280: 43 53 45 43 53 45 44 53
1288: 45 49 53 54 41 53 54 58
1290: 53 54 59 54 41 58 54 41
1298: 59 54 53 58 54 58 41 54
12A0: 58 53 54 59 41 01 02 02		; addr sizes $12A6
12A8: 02 03 03 03 02 02 02 03
12B0: 02 80 80 80 80 01 01 01		; operator types $12B1
12B8: 80 80 00 01 80 00 04 05		; prefixes $12BD
12C0: 05 05 05 05 06 06 05 06
12C8: 05 00 00 00 07 00 07 08		; postfixes $12C9
12D0: 09 0A 00 0B 08 00 01 07		; ASM mask pointers $12D6
12D8: 0C 13 1A 23 2C 35 13 3E		; Messages links (addr & 255), including
12E0: 47 87 5C 5B 87 5F 60 62		; Welcome, error, prefix, postfix
12E8: 65 6D 68 6C 6A 70 87 13		; register print header
12F0: 13 13 13 13 13 13 13 13
12F8: 13 13 13 13 13 0D 20 23		; ASM masks	$12FD
1300: 24 30 30 0D 20 24 30 30
1308: 0D 20 24 30 30 2C 58 0D
1310: 20 24 30 30 30 30 0D 20
1318: 24 30 30 30 30 2C 58 0D
1320: 20 24 30 30 30 30 2C 59
1328: 0D 20 28 24 30 30 2C 58
1330: 29 0D 20 28 24 30 30 29
1338: 2C 59 0D 20 28 24 30 30
1340: 30 30 29 0D 20 24 30 30
1348: 2C 59 0D 30 31 32 33 34		; OK char test string $134A
1350: 35 36 37 38 39 41 42 43
1358: 44 45 46 3F 0D 2E 00 23		; ?, ., and pre/post chars
1360: 24 00 28 24 00 2C 58 00
1368: 2C 58 29 00 29 2C 59 00
1370: 0D 41 43 20 58 52 20 59		; Print registers header
1378: 52 20 53 50 20 4E 56 2D
1380: 42 44 49 5A 43 0D 00 0D		; Welcome msg & CMDs $1387
1388: 43 27 4D 4F 4E 20 4C 69
1390: 74 65 20 66 6F 72 20 56
1398: 49 43 2D 32 30 20 62 79
13A0: 20 41 6C 65 6B 73 69 20
13A8: 45 65 62 65 6E 0D 28 50
13B0: 41 4C 2D 31 20 70 6F 72
13B8: 74 20 62 79 20 44 61 76
13C0: 65 20 48 61 73 73 6C 65
13C8: 72 29 0D 43 4D 44 73 3A
13D0: 20 41 20 44 20 47 20 49
13D8: 20 4D 20 52 20 57 20 58
13E0: 0D 2E 00