S-C DisAssembler

1000 *SAVE D.DISPLAYS
1010 *---------------------------------
1020 DISPLAY.PC
1030        JSR CHECK.KEYBOARD.FOR.ABORT
1040        LDX #H.ADDR
1050        BCC SHOW.HEX.INFO
1060        JMP QUIT
1070 *--------------------------------
1080 SHOW.HEX.INFO
1090        LDA HEXTBL,X
1100        JSR IO.HTAB
1110        LDA HEXTBL+1,X
1120        TAX
1130        LDA 1,X
1140        JSR MON.PRBYTE
1150        LDA 0,X
1160        JMP MON.PRBYTE
1170 *--------------------------------
1180 HEXTBL
1190 H.ADDR .EQ *-HEXTBL
1200        .DA #14,#PC
1210 H.XREF .EQ *-HEXTBL
1220        .DA #20,#SPTR
1230 H.LBLS .EQ *-HEXTBL
1240        .DA #26,#LABELS
1250 *---------------------------------
1260 ERROR  LDA #0
1270 MLI.ERROR
1280        STA ERROR.A   SAVE MLI ERROR #
1290        STY ERROR.Y   SAVE MY ERROR #
1300        LDY #QSTARS     "*** ERROR:  "
1310        JSR QT.OUT
1320        LDY ERROR.Y
1330        JSR QT.OUT
1340        LDA ERROR.A
1350        BEQ .2
1360        JSR MON.PRBYTE
1370        LDA #")"
1380        JSR MON.COUT
1390 .2     JSR MON.CROUT
1400        JSR CONVERT.LINE.NUMBER
1410        LDA #" "
1420        LDY #0
1430 .1     ORA #$80
1440        JSR MON.COUT
1450        INY
1460        LDA CMDBUF-1,Y
1470        BNE .1
1480        JSR MON.CROUT
1490        JMP QUIT
1500 *--------------------------------
1510 *      RETURN .CC. AND .NE. IF NO KEYPRESS
1520 *      RETURN .CS. AND .EQ. IF  TYPED
1530 *      RETURN .CS. AND .NE. IF ANY OTHER KEY
1540 *--------------------------------
1550 CHECK.KEYBOARD.FOR.ABORT
1560        CLC
1570        LDA $C000
1580        BPL .1
1590        STA $C010
1600        CMP #$8D
1610        SEC
1620 .1     RTS
1630 *---------------------------------
1640 *      CONVERT LINE NUMBER
1650 *      (CURRENT.LINE.NUMBER) = NUMBER TO USE
1660 *---------------------------------
1670 CONVERT.LINE.NUMBER
1680        LDX #3       CONVERT 4 DIGITS
1690        LDA CURRENT.LINE.NUMBER
1700        CMP #10000
1710        LDA CURRENT.LINE.NUMBER+1
1720        SBC /10000
1730        BCC .2       4 DIGITS WILL DO IT
1740        INX          5 DIGITS
1750 .2     LDY #$B0     SET DIGIT TO ASCII ZERO
1760 .3     SEC          SUBTRACT CURRENT DIVISOR
1770        LDA CURRENT.LINE.NUMBER
1780        SBC PLNTBL,X
1790        PHA          SAVE BYTE ON STACK
1800        LDA CURRENT.LINE.NUMBER+1
1810        SBC PLNTBH,X
1820        BCC .4       LESS THAN DIVISOR
1830        STA CURRENT.LINE.NUMBER+1
1840        PLA          GET LOW BYTE OFF STACK
1850        STA CURRENT.LINE.NUMBER
1860        INY          INCREMENT DIGIT
1870        BNE .3       ...ALWAYS
1880 .4     PLA          DISCARD BYTE FROM STACK
1890        TYA          GET DIGIT
1900        JSR MON.COUT PRINT CHARACTER
1910        DEX          NEXT DIGIT
1920        BPL .2
1930        RTS          RETURN
1940 *---------------------------------
1950 PLNTBL .DA #1
1960        .DA #10
1970        .DA #100
1980        .DA #1000
1990        .DA #10000
2000 PLNTBH .DA /1
2010        .DA /10
2020        .DA /100
2030        .DA /1000
2040        .DA /10000
2050 *--------------------------------
2060 *   Y = MESSAGE NUMBER
2070 *--------------------------------
2080 QT.OUT
2090        TXA
2100        PHA
2110        LDX #0
2120        CLC
2130 *---Search for message #---------
2140 .2     JSR GET.NEXT.NYBBLE
2150        BNE .4
2160 .3     JSR GET.NEXT.NYBBLE
2170        BEQ .3
2180        BNE .2
2190 .4     EOR #$0F
2200        BNE .2
2210        DEY
2220        BNE .2
2230 *---Print the message------------
2240 .5     JSR GET.NEXT.NYBBLE
2250        TAY
2260        LDA FIRST.TABLE,Y
2270        BNE .6       ...FREQUENT CHAR
2280        JSR GET.NEXT.NYBBLE
2290        TAY
2300        LDA SECOND.TABLE,Y
2310        BNE .6       ...TWO NYBBLE CHAR
2320        JSR GET.NEXT.NYBBLE
2330        TAY
2340        LDA THIRD.TABLE,Y
2350 .6     BPL .7       ...END OF MESSAGE
2360        PHP
2370        JSR MON.COUT
2380        PLP
2390        BMI .5       ...NEXT CHAR, ALWAYS
2400 .7     PLA          ...YES
2410        TAX
2420        RTS
2430 *--------------------------------
2440 GET.NEXT.NYBBLE
2450        LDA MESSAGES,X
2460        BCS .1       2ND NYBBLE
2470        LSR          1ST NYBBLE
2480        LSR
2490        LSR
2500        LSR
2510        SEC
2520        RTS
2530 .1     INX
2540        AND #$0F
2550        CLC
2560        RTS
2570 *--------------------------------
2580 FIRST.TABLE  .HS 00
2590              .AS -/LEMON BIDSTRAP/
2600              .HS 7F
2610 SECOND.TABLE .HS 00
2620              .AS -/FYX(VW-CHUG*$/
2630              .HS 878D
2640 THIRD.TABLE  .AS -/.JKQZ:........./
2650 *--------------------------------
2660 MESSAGES
2670        .AC 0
2680        .AC 1/LEMON BIDSTRAP%/
2690        .AC 2/FYX(VW-CHUG*$!#/
2700        .AC 3/JKQZ:........../
2710 *--------------------------------
2720        .MA QT
2730 QN.    .SE QN.+1
2740 ]1 .EQ QN.
2750        .AC /]2/
2760        .EM
2770 QN.    .SE 0
2780 *--------------------------------
2790    .AC "%"      ELIMINATE QT# 0
2800    >QT Q.TITLE,"S-C DISASSEMBLER#%"
2810    >QT Q.PASS,"#PASS %"
2820    >QT Q.COLON,"MISSING COLON%"
2830    >QT QSTARS,"#***!! ERROR:  %"
2840    >QT Q.BEYOND,"POSITION BEYOND END OF FILE%"
2850    >QT Q.NOTCMD,"NOT A VALID COMMAND%"
2860    >QT Q.RANGE,"HEX RANGE BACKWARD%"
2870    >QT Q.BADHEX,"MISSING HEX VALUE%"
2880    >QT Q.OVERFLOW,"HEX VALUE TOO LARGE%"
2890    >QT Q.OUTOFDATA,"READ PROBLEM ($%"
2900    >QT Q.CREATE,"CREATE PROBLEM ($%"
2910    >QT Q.OPEN,"OPEN PROBLEM ($%"
2920    >QT Q.FILTYP,"OUTPUT FILE WRONG FILE TYPE%"
2930    >QT Q.WRITE,"WRITE PROBLEM ($%"
2940    >QT Q.CMDFUL,"SCRIPT LINE TOO LONG%"
2950    >QT Q.DBLDEF,"EXTRA DEFINITION FOR SAME VALUE%"
2960    >QT Q.MEMFUL,"MEMORY FULL%"
2970    >QT Q.COMMA,"MISSING COMMA%"
2980    >QT Q.BADPATH,"BAD PATHNAME%"
2990    .AC "%"      FLUSH LAST BYTE
3000 *--------------------------------
3010        .DO 0
3020 MON.COUT .EQ $FDED
3030 MON.CROUT .EQ $FD8E
3040 T
3050        LDA #1
3060        STA 0
3070 .1     LDA 0
3080        JSR $FDDA
3090        LDY 0
3100        JSR QT.OUT
3110        JSR $FD8E
3120        INC 0
3130        LDA 0
3140        CMP #QN.+1
3150        BCC .1
3160        RTS
3170        .FIN