S-C Macro Assembler 3.0 -- ASM2/X.PRINT.SYMBOLS

1000 *SAVE X.PRINT.SYMBOLS
1010 *--------------------------------
1020 *      PRINT SYMBOL TABLE IN ALPHABETICAL ORDER
1030 *--------------------------------
1040 SYMBOLS
1050 STPRNT LDY #2       SKIP OVER .TF PSEUDO-SYMBOLS
1060 .1     STY PNTR
1070        LDA HSHTBL,Y
1080        STA STPNTR
1090        LDA HSHTBL+1,Y
1100        BEQ .5
1110        STA STPNTR+1
1120 *---PRINT VALUE AND DASH---------
1130 .2     LDY #2       POINT AT VALUE
1140 .25    >SYM LDA,STPNTR
1150        STA SYM.VALUE-2,Y   SAVE FOR LOCAL OFFSETS
1160        INY
1170        CPY #6
1180        BCC .25
1190        LDY #3
1200 .26    LDA SYM.VALUE,Y
1210        BNE .27      ...NON-ZERO BYTE
1220        JSR SPC
1230        JSR SPC
1240        DEY
1250        BNE .26      ...UNTIL LAST BYTE
1260 .27    LDA SYM.VALUE,Y
1270        JSR MON.PHEX
1280        DEY
1290        BPL .27      ...INCLUDE LAST BYTE
1300        JSR P.DASH
1310        JSR SPC
1320 *---PRINT NAME-------------------
1330        LDY #6
1340        >SYM LDA,STPNTR    GET NAME LENGTH
1350        PHA          SAVE AGAIN FOR LOCAL LABELS FLAG
1360        AND #$3F     ISOLATE LENGTH
1370        TAX
1380 .3     INY
1390        >SYM LDA,STPNTR
1400        JSR CHO
1410        DEX
1420        BNE .3
1430 *---CHECK FOR LOCAL LABELS-------
1440        PLA          GET LENGTH AND FLAGS
1450        BMI .6       LOCAL LABELS
1460 *---NEXT LABEL-------------------
1470 .4     JSR CRLF.WITH.PAGING
1480        LDY #1       POINT AT POINTER
1490        >SYM LDA,STPNTR
1500        PHA
1510        DEY
1520        >SYM LDA,STPNTR
1530        STA STPNTR
1540        PLA
1550        STA STPNTR+1
1560        BNE .2       NEXT SYMBOL IN THIS CHAIN, IF ANY
1570 .5     LDY PNTR
1580        INY
1590        INY
1600        CPY #54      # BYTES IN HASH POINTER TABLE
1610        BNE .1
1620        RTS
1630 *---PRINT LOCAL LABELS-----------
1640 .6     AND #$3F     POINT AT FIRST LOCAL LABEL
1650        CLC
1660        ADC #7
1670        TAY
1680        LDA #1       FORCE CRLF BEFORE 1ST LABEL
1690        STA EMIT.COLUMN
1700 .7     >SYM LDA,STPNTR
1710        BEQ .4       END OF LOCALS
1720        AND #$7F     ISOLATE NAME
1730        PHA          SAVE NAME OF SYMBOL
1740        STY YSAVE    SAVE POINTER
1750        DEC EMIT.COLUMN
1760        BNE .9       ...UNLESS NEED A NEW LINE
1770        JSR CRLF.WITH.PAGING  CLOBBERS Y-REG IF FORMFEED
1780        LDY #8
1790 .81    JSR SPC
1800        DEY
1810        BNE .81
1820        LDY #7       ...SEVEN PER LINE
1830        LDA SYM.VALUE+2
1840        BEQ .82
1850        LDY #5       ...FIVE PER LINE
1860 .82    STY EMIT.COLUMN
1870 .9     JSR SPC
1880        JSR SPC
1890        LDA #CHR.PERIOD
1900        JSR CHO
1910        PLA          GET NAME
1920        STA CURRENT.LINE.NUMBER
1930        LDA #0
1940        STA CURRENT.LINE.NUMBER+1
1950        LDX #1       ONLY TWO DIGITS
1960        LDA #$40     PRINT ONLY, DO NOT STORE IN WBUF
1970        JSR CONVERT.LINE.NUMBER
1980        LDA #'='     EQUAL SIGN
1990        JSR CHO
2000        LDY YSAVE    GET VALUE OF SYMBOL
2010        INY
2020        >SYM LDA,STPNTR
2030        CLC
2040        ADC SYM.VALUE
2050        PHA
2060        LDA SYM.VALUE+1
2070        ADC #0
2080        PHA
2090        LDA SYM.VALUE+2
2100        ADC #0
2110        BEQ .10      PRINT ONLY TWO BYTES
2120        JSR MON.PHEX
2130 .10    PLA
2140        JSR MON.PHEX
2150        PLA
2160        JSR MON.PHEX
2170        INY
2180        BNE .7       ...ALWAYS
2190 *--------------------------------