S-C DisAssembler

1000 SAVE D.QSORT
1010 *--------------------------------
1020 SORT.SYMBOLS
1030        >SET LPTR,SYMBOL.TABLE
1040        >MOV SPTR,UPTR
1050        JSR DECREMENT.UPPER.PNTR
1060 QUICK.SORT
1070        JSR COMPARE.PNTRS
1080        BCS .8
1090        LDA LPTR
1100        PHA
1110        LDA LPTR+1
1120        PHA
1130        LDA UPTR
1140        PHA
1150        LDA UPTR+1
1160        PHA
1170 .1     JSR COMPARE.ENTRIES
1180        BEQ .5
1190        BCS .3
1200 .2     JSR INCREMENT.LOWER.PNTR
1210        JSR COMPARE.PNTRS
1220        BCC .1
1230        BCS .7       ...ALWAYS
1240 *--------------------------------
1250 .3     JSR SWAP.ENTRIES
1260        JMP .5
1270 *--------------------------------
1280 .4     JSR COMPARE.ENTRIES
1290        BEQ .2
1300        BCS .6
1310 .5     JSR DECREMENT.UPPER.PNTR
1320        JSR COMPARE.PNTRS
1330        BCC .4
1340        BCS .7       ...ALWAYS
1350 *--------------------------------
1360 .6     JSR SWAP.ENTRIES
1370        JMP .2
1380 *--------------------------------
1390 .7     PLA
1400        STA UPTR+1
1410        PLA
1420        STA UPTR
1430        LDA LPTR
1440        PHA
1450        LDA LPTR+1
1460        PHA
1470        JSR QUICK.SORT
1480        PLA
1490        STA UPTR+1
1500        PLA
1510        STA UPTR
1520        JSR DECREMENT.UPPER.PNTR
1530        PLA
1540        STA LPTR+1
1550        PLA
1560        STA LPTR
1570        JSR QUICK.SORT
1580 .8     RTS
1590 *--------------------------------
1600 COMPARE.PNTRS
1610        LDY #1
1620 .1     LDA LPTR,Y
1630        CMP UPTR,Y
1640        BNE .2
1650        DEY
1660        BPL .1
1670        INY          SET .EQ. STATUS
1680 .2     RTS
1690 *--------------------------------
1700 COMPARE.ENTRIES
1710        LDY #3
1720 .1     LDA (LPTR),Y
1730        CMP (UPTR),Y
1740        BNE .2
1750        DEY
1760        BPL .1
1770        INY          SET .EQ STATUS
1780 .2     RTS
1790 *--------------------------------
1800 INCREMENT.LOWER.PNTR
1810        CLC
1820        LDA LPTR
1830        ADC #4
1840        STA LPTR
1850        BCC .1
1860        INC LPTR+1
1870 .1     RTS
1880 *--------------------------------
1890 DECREMENT.UPPER.PNTR
1900        LDA UPTR
1910        SEC
1920        SBC #4
1930        STA UPTR
1940        BCS .1
1950        DEC UPTR+1
1960 .1     RTS
1970 *--------------------------------
1980 SWAP.ENTRIES
1990        LDY #3
2000 .1     LDA (LPTR),Y
2010        TAX
2020        LDA (UPTR),Y
2030        STA (LPTR),Y
2040        TXA
2050        STA (UPTR),Y
2060        DEY
2070        BPL .1
2080        RTS
2090 *--------------------------------