home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / f / labldisk.lbr / LABLDISK.AZM / LABLDISK.ASM
Encoding:
Assembly Source File  |  1993-10-26  |  15.8 KB  |  520 lines

  1. ;
  2. ;        DISC LABELING PROGRAM..............
  3. ;
  4. ;+======================================================================+
  5. ;|                                                                      |
  6. ;|TITLE: LABLDISK.ASM - Print Sorted Disk Directory on Label            |
  7. ;|                                                                      |
  8. ;|DATE:  02/16/83       VERSION:  2.0         LANGUAGE:  ASM-80         |
  9. ;|SQUEEZED NAME: LABLDISK.AQM         LIBRARY NAME: none                |
  10. ;|RELATED FILES: none                                                   |
  11. ;|                                                                      |
  12. ;|SYSTEM: Standard CP/M-80, minimum 24k                                 |
  13. ;|                                                                      |
  14. ;|PURPOSE: To print an alphabetically sorted disk directory on a label  |
  15. ;|          using the condensed font of your printer for the main       |
  16. ;|          directory and an enlarged font to print the first entry     |
  17. ;|          in the directory as a title on the label.                   |
  18. ;|                                                                      |
  19. ;|SUMMARIZE REVISION: Made printer and label characteristics modular    |
  20. ;|                     at front of program.  Deleted  'SETUP' function  |
  21. ;|                     key printout.  Added optional title capability.  |
  22. ;|                                                                      |
  23. ;|SUBMITTED BY: Melissa Gray [leave messages on RBBS (415)965-4097]     |
  24. ;|ORIGINAL AUTHOR: unknown (derived from FMAP (Catalog) program)        |
  25. ;|OTHER CONTRIBUTORS: Dennis McFerran (called it DSCLABEL.ASM)          |
  26. ;|                     (There's also another new version of DSCLABEL    |
  27. ;|                      with the 'SETUP' printout changed to an option) |
  28. ;|                                                                      |
  29. ;|REFERENCE: FMAP program                                               |
  30. ;|                                                                      |
  31. ;|DOCUMENTATION:  Fairly extensive setup documentation in front of the  |
  32. ;|                source, though not entirely clear.  User documentation|
  33. ;|                is limited and source documentation is fairly good.   |
  34. ;|                                                                      |
  35. ;|PROGRAM USAGE:  Would be very useful to anyone needing this           |
  36. ;|                capability.  Fairly easy to install, although it      |
  37. ;|                requires edits for printers other than the NEC-8023   |
  38. ;|                and label sizes other than 5"x3" to be cut to 5"x2"   |
  39. ;|                                                                      |
  40. ;|RATING: ***  (needs to be able to read label size parameters on-line) |
  41. ;|                                                                      |
  42. ;+======================================================================+
  43. ;
  44. ;
  45. ; 6/29/82---THIS PROGRAM, WHICH WAS ADAPTED FROM
  46. ;           THE FMAP(CATALOG) PROGRAM, WILL LIST
  47. ;           YOUR FILE DIRECTORY ON A LABEL SIZED
  48. ;           OUTPUT AND THEN LIST THE SPECIAL FUNCTION
  49. ;        KEY INSTRUCTIONS THAT HAVE BEEN ADDED TO
  50. ;        YOUR DISC VIA THE 'SETUP' PROGRAM.  I AM
  51. ;        USING AN EPSON MX-100.  I THINK THAT THE
  52. ;           COMMANDS, WILL WORK ON AN MX-80 BUT I'M NOT       
  53. ;           SURE.  TRY IT AND LET ME KNOW.  IT WOULD                
  54. ;           HAVE TO BE MODIFIED FOR OTHER PRINTERS.
  55. ;
  56. ;*******************************************************************
  57. ;
  58. ;    THIS IS MY ABOUT MY FIRST USABLE(?) ASSEMBLY LANGUAGE EFFORT.
  59. ;    I WOULD APPRECIATE ANY COMMENTS OR SUGGESTIONS:
  60. ;               DENNIS MC FERRAN
  61. ;        1038 POLK LANE
  62. ;          SAN JOSE, CA  95117
  63. ;        (408-296-6021)
  64. ;********************************************************************
  65. ;
  66. ;    TO USE--------
  67. ;    1)  PLACE DISC WITH THIS PROGRAM ON IT IN ONE DRIVE
  68. ;    2)  TURN ON YOUR PRINTER AND HAVE LABELS IN TO PRINT
  69. ;    3)  PLACE DISC THAT YOU WOULD LIKE TO LABEL IN OTHER DRIVE
  70. ;           (YOU MAY ALSO LABEL THE DISC CONTAINING THIS PROGRAM)
  71. ;       4)  RESET THE DRIVE WITH THE DISC TO BE LABELLED (^C)
  72. ;       5)  RUN LABLDISK (e.g,: B> A:LABLDISK) [Optionally you may
  73. ;           specify a filename using conventional wildcards (e.g.:
  74. ;           B> A:LABLDISK *.COM).  For this option, the title in
  75. ;           its current form is generally inappropriate.
  76. ;    6)  REPEAT AS MANY TIMES AS YOU'D LIKE FROM STEP 3
  77. ;
  78. TRUE    EQU    0FFH
  79. FALSE    EQU    0
  80. ;
  81. ;
  82. ;*********EQUATES TO SET FOR YOUR SYSTEM********************************
  83. ;
  84. DOTITLE EQU    TRUE    ;Set TRUE if you supply TITLED parameters for
  85. ;                        your printer below
  86. NEC8023    EQU    TRUE    ;Set TRUE if your printer is the NEC PC-8023A-C
  87. EPMX100    EQU    FALSE    ;Set TRUE if your printer is the EPSON MX-100
  88. ;
  89. LBLLNG    EQU    16    ;Set value to the number of lines your label can
  90. ;             hold based on the line spacing you select below
  91. ;             and the length of your label in inches
  92. LBLSPC    EQU    10    ;Set value to the number of lines between labels
  93. ;             on your sheet, based on your line spacing 
  94. LENCOL    EQU    82    ;Set value to # of usable columns across label,
  95. ;             based on width (in inches) of label times
  96. ;             characters per inch(CPI) of your condensed font.
  97. LBLWID    SET    (LENCOL+SPCSIZ)/(12+SPCSIZ)    
  98. ;             Sets value to the number of 12 character file
  99. ;             names and SPACES (see below) that can be
  100. ;             printed across the width of your label.
  101. MAXFIL    EQU    255    ;Set value to the maximum number of disk files
  102. ;             that may be encountered on one of the disks
  103. ;             you will be labelling
  104. ;
  105. ;
  106. ;*********EQUATE TABLE - BDOS***********************
  107. ;                           *
  108. RDCHR    EQU    1    ;READ CHAR FROM CONSOLE    *
  109. WRCHR    EQU    5    ;WRITE CHR TO PRINTER      *
  110. PSTRING    EQU    9    ;PRINT CONSOLE BUFF       *    
  111. CONST    EQU    11    ;CHECK CONS STAT       *
  112. FSRCHF    EQU    17    ;   "    "           *
  113. FSRCHN    EQU    18    ;   "    "           *
  114. FCB    EQU    5CH     ;FILE CONTROL BLOCK        *
  115. BDOS    EQU    5    ;                   *
  116. ;                           *
  117. ESC    EQU    1BH    ;<ESCAPE> CODE             *
  118. CR    EQU    0DH    ;CARRIAGE RETURN       *    
  119. LF    EQU    0AH    ;LINE FEED               *
  120. ;***************************************************
  121. ;
  122. ;
  123.     ORG    100H
  124.     JMP    START        ;Bypass User changeable data
  125. ;
  126. ;***********************************************************************
  127. ;
  128. ;  BUILD THE FOLLOWING TABLES FOR YOUR PRINTER IF IT'S NOT HERE
  129. ;
  130. ;    TITLED is the table used to set your line spacing (usually 6
  131. ;           lines per inch) and your large print font (usually
  132. ;              10 CPI) and your enlarged print mode for printing the
  133. ;              the first directory (in alphabetical order) as the
  134. ;              title on your label.  This parameter is not required
  135. ;              if DOTITLE is set to FALSE above.
  136. ;
  137. ;    SETPRT is the table used to set your line spacing (usually to 9
  138. ;           lines per inch) and your small print font (usually
  139. ;           Condensed). It may include any other printer characteristics
  140. ;           you'd like.  It must end with an '$'.
  141. ;
  142. ;    RESET is the table used to return your printer to its normal
  143. ;          line spacing (usually 6 lines per inch) and print font
  144. ;          (usually 10 CPI).  It may also include any other printer 
  145. ;          characteristics you'd like.  It must also end with an "$".
  146. ;
  147. ;
  148. TITLED    EQU    $
  149.         IF    NEC8023
  150.     DB    ESC,'B'            ;Set line spacing to 1/8"
  151.     DB    ESC,'N'            ;Set font to Normal (10 CPI)
  152.     DB    0EH            ;Set Enlarged character command
  153.     DB    ESC,'!'            ;Set Enhanced print mode on
  154.     ENDIF
  155. ; Insert new printer definitions here (with IF/ENDIF)
  156.         DB    '$'            ;End of TITLED table
  157. ;
  158. SETPRT    EQU    $
  159.     IF    NEC8023
  160.     DB    CR,ESC,'T',31H,37H    ;Set line spacing to 17/144"
  161.     DB    ESC,'Q'            ;Set font to Condensed (17 CPI)
  162.     DB    0FH            ;Clear Enlarged character command
  163.     DB    ESC,'!'            ;Set Enhanced print mode on
  164.     ENDIF
  165.     IF    EPMX100
  166.     DB    CR,ESC,'A',8        ;Set line spacing to 8/72"
  167.     DB    0FH            ;Set font to Condensed
  168.     ENDIF
  169. ; Insert new definitions here (with IF/ENDIF)
  170.     DB    '$'            ;End of SETPRT table 
  171. ;
  172. RESET    EQU    $
  173.     IF    NEC8023
  174.     DB    ESC,'A'            ;Set line spacing to 1/6"
  175.     DB    ESC,'N'            ;Set font to Normal (10 CPI)
  176.     DB    ESC,'"'            ;Set enhanced print mode off
  177.     ENDIF
  178. ;
  179.     IF    EPMX100
  180.     DB    ESC,'A',12        ;Set line spacing to 12/72"
  181.     DB    12H            ;Set font to Normal
  182.     ENDIF
  183. ; Insert new definitions here (with IF/ENDIF)
  184.     DB    '$'            ;End of RESET table 
  185. ;
  186. ;***THE FOLLOWING TABLE DEFINES THE DIVIDER PRINTED BETWEEN FILE NAMES
  187. ;   ACROSS THE LABEL AND CAN BE ADJUSTED AS REQUIRED.  Note:  It is not
  188. ;   printed after the last filename on the line.
  189. ;
  190. SPACES    DB    ' | '            ;This table must end in an '$'
  191. SPCSIZ    EQU    $-SPACES        ;# of characters between fields
  192. ;                     (filenames) on label
  193.     DB    '$'            ;End of SPACES table 
  194. ;
  195. ;***********************************************************************
  196. ;
  197. ;
  198. START    EQU    $
  199.     LXI    H,0         ;SAVE THE OLD STACK
  200.     DAD    SP        ;H=STACK
  201.     SHLD    STACK        ;SAVE IT
  202.     LXI    SP,STACK    ;GET NEW STACK
  203. ; FCB SPECIFIED ?
  204.     LXI    H,FCB+1
  205.     MOV    A,M
  206.     CPI    ' '
  207.     JNZ    GOTFCB        ;YES - SEE IF IT IS IN DIRECTORY
  208. ;NO FCB - MAKE FCB = ALL = '?'
  209.     MVI    B,11        ;FN+FT COUNT
  210. QLOOP    EQU    $
  211.     MVI    M,'?'        ;STORE '?' IN FCB
  212.     INX    H
  213.     DCR      B
  214.     JNZ    QLOOP
  215. ;LOOK UP THE FCB IN THE DIRECTORY
  216. GOTFCB    EQU    $
  217.     MVI    A,LBLLNG    ;Initialize # of lines remaining on
  218.     STA    LCOUNT        ;   label to full count
  219.     MVI    C,FSRCHF     ;GET 'SEARCH FIRST' FNC
  220.     LXI    D,FCB
  221.     CALL    BDOS        ;READ FIRST
  222.     INR    A        ;WERE THERE ANY ?
  223.     STA    TEMP        ;SAVE
  224.     JNZ    PRTSET        ;GOT SOME - SET UP PRINTER
  225.     LXI    D,NONMSG
  226.     JMP    ERRXIT
  227. NONMSG    EQU    $
  228.     DB    '++FILE NOT FOUND',CR,'$'
  229. ;SET UP PRINTER COMMANDS
  230. PRTSET    EQU    $
  231.     IF    DOTITLE
  232.     LXI    H,TITLED
  233.     MVI    A,TRUE
  234.     ENDIF
  235.     IF    NOT DOTITLE
  236.     LXI    H,SETPRT
  237.     MVI    A,FALSE
  238.     ENDIF
  239.     STA    TTLSWC
  240.     CALL    WRPRNT
  241.     LDA    TEMP        ;RELOAD EXTENT
  242. ;POINT TO DIRECTORY ENTRY 
  243. SOME    EQU    $
  244.     DCR    A        ;UNDO PREV 'INR A'
  245.     ANI    3        ;MAKE MODULUS 4
  246.     ADD    A        ;MULTIPLY...
  247.     ADD    A        ;..BY 32 BECAUSE
  248.     ADD    A        ;..EACH DIRECTORY
  249.     ADD    A        ;..ENTRY IS 32
  250.     ADD    A        ;..BYTES LONG
  251.     LXI    H,81H        ;POINT TO BUFFER (SKIP TO FN/FT)
  252.     ADD    L        ;POINT TO ENTRY
  253.     MOV    L,A        ;SAVE (CAN'T CARRY TO H)
  254.     LDA    COUNT        ;Is there room in table for entry ?
  255.     CPI    MAXFIL
  256.     JZ    NOTALL        ;No - cannot list all files - alarm
  257. ;MOVE ENTRY TO TABLE
  258.     XCHG            ;ENTRY TO DE
  259.     LHLD    NEXTT        ;NEXT TABLE ENTRY TO HL
  260.     MVI    B,31        ;ENTRY LENGTH
  261. TMOVE    EQU    $
  262.     LDAX    D        ;GET ENTRY CHAR
  263.     MOV    M,A        ;STORE IN TABLE
  264.     INX    D
  265.     INX    H
  266.     DCR    B        ;MORE?
  267.     JNZ    TMOVE
  268.     SHLD    NEXTT        ;SAVE UPDATED TABLE ADDR
  269.     LDA    COUNT        ;GET PREV COUNT
  270.     INR    A
  271.     STA    COUNT
  272. ;READ MORE DIRECTORY ENTRIES        
  273.     MVI    C,FSRCHN     ;SEARCH NEXT
  274.     LXI    D,FCB
  275.     CALL    BDOS        ;READ DIR ENTRY
  276.     INR    A        ;CHECK FOR END (0FFH)
  277.     JNZ    SOME        ;MORE 
  278. ;SORT AND PRINT
  279.     LDA    COUNT        ;INIT THE ORDER TABLE
  280.     STA    SCOUNT        ;SAVE AS # TO SORT
  281.     LXI    H,ORDER
  282.     LXI    D,TABLE
  283.     LXI    B,31        ;ENTRY LENGTH
  284. BLDORD    EQU    $    
  285.     MOV    M,E        ;SAVE LO ORD ADDR
  286.     INX    H
  287.     MOV    M,D        ;SAVE HI ORD ADDR
  288.     INX    H
  289.     XCHG            ;TABLE ADDR TO HL
  290.     DAD    B        ;POINT TO NEXT ENTRY
  291.     XCHG
  292.     DCR    A        ;MORE?
  293.     JNZ    BLDORD        ;..YES
  294. SORT    XRA    A        ;GET A ZERO
  295.     STA    SWITCH        ;SHOW NONE SWITCHED
  296.     LDA    SCOUNT        ;GET COUNT
  297.     DCR    A        ;USE 1 LESS
  298.     STA    TEMP        ;SAVE # TO COMPARE
  299.     STA    SCOUNT        ;SAVE HIGHEST ENTRY
  300.     JZ    DONE        ;EXIT IF NO MORE
  301.     LXI    H,ORDER     ;POINT TO ORDER TABLE
  302. SORTLP    CALL    COMPR        ;COMPARE 2 ENTRIES
  303.     CM    SWAP        ;SWAP IF NOT IN ORDER
  304.     INX    H        ;BUMP ORDER
  305.     INX    H        ;..TABLE POINTER
  306.     LDA    TEMP        ;GET COUNT
  307.     DCR    A
  308.     STA    TEMP
  309.     JNZ    SORTLP        ;CONTINUE
  310. ;ONE PASS OF SORT DONE
  311.     LDA    SWITCH        ;ANY SWAPS DONE?
  312.     ORA    A
  313.     JNZ    SORT
  314. ;
  315. ;SORT IS ALL DONE - PRINT ENTRIES
  316. DONE    LXI    D,ORDER        ;D/E point to 1st entry in ORDER
  317.     PUSH    D        ;Save DE
  318.     MVI    A,LBLWID    ;Initialize count of file names per
  319.     STA    WCOUNT        ;   line
  320. ;PRINT AN ENTRY
  321. PRINT    EQU    $
  322.     MVI    C,CONST        ;CK STATUS OF KB
  323.     CALL    BDOS        ;ANY KEY PRESSED?
  324.     DCR    A
  325.     JZ    ABORT        ;YES, ABORT
  326.     POP    D        ;Restore DE
  327.     LDAX    D        ;No - get memory byte addressed by DE
  328.     MOV    L,A        ;   and put in L
  329.     INX    D        ;Move to next location in ORDER
  330.     LDAX    D        ;Get memory byte addressed by DE
  331.     MOV    H,A        ;   and put in L
  332.     INX    D        ;Move to next location in ORDER
  333.     PUSH    D        ;   and save DE
  334.     MVI    B,8        ;FILE NAME LENGTH
  335.     CALL    TYPEIT        ;TYPE FILENAME
  336.     MVI    E,'.'
  337.     CALL    TYPE  
  338.     MVI    B,3        ;GET THE FILETYPE
  339.     CALL    TYPEIT
  340. ;
  341.     LDA     COUNT        ;Decrement count of file names to print
  342.     DCR    A
  343.     STA    COUNT
  344.     JZ       EXIT        ;All done - Exit
  345. ;
  346.     LDA    TTLSWC        ;Put only Title on its line in 
  347.     CPI    FALSE
  348.     JZ    TTLDONE
  349.     MVI    A,FALSE
  350.     STA    TTLSWC
  351.     LXI    H,SETPRT    ; enlarged font - then switch to
  352.     CALL    WRPRNT        ; condensed font
  353.     MVI    B,1
  354.     CALL    CRLF        ;Double-space between title & directory
  355.     JMP    NXTLIN        ;Start rest of directory on next line
  356. ;
  357. TTLDONE    LDA    WCOUNT        ;Decrement # of entries left on this
  358.     DCR    A        ;  line for filenames
  359.     STA    WCOUNT
  360.     JZ    NXTLIN        ;No more room on line - go to next line
  361.     ENDIF
  362. ;
  363.     LXI    H,SPACES    ;Room for another filename
  364.       CALL    WRPRNT        ;   Put in divider between names
  365.     JMP    PRINT
  366. ;
  367. NXTLIN    EQU    $
  368.     MVI    B,1        ;Set request for one CR/LF
  369.     CALL    CRLF        ;Output CR/LF and test for end of label
  370.     JMP    PRINT        ;Go to print next file name
  371. ;
  372. ;
  373. ;TYPE CHAR IN E    
  374. TYPE    PUSH    B
  375.     PUSH    D
  376.     PUSH    H
  377.     MVI    C,WRCHR
  378.     CALL    BDOS
  379.     POP    H
  380.     POP     D
  381.     POP    B
  382.     RET
  383. ;
  384. ;
  385. ; PRINT STRING SPECIFIED BY HL
  386. WRPRNT    MVI    A,'$'
  387.     CMP    M
  388.     RZ 
  389.     MOV    E,M
  390.     CALL    TYPE
  391.     INX    H
  392.     JMP    WRPRNT
  393. ;
  394. ;
  395. ; TYPE STRING WHOSE LENGTH IS IN B AND ADDR IN HL
  396. TYPEIT    EQU    $
  397.     MOV    A,M        ;Get rid of any tag bits in name
  398.     ANI    07Fh        ; for print out
  399.     MOV    E,A
  400.     CALL    TYPE
  401.     INX    H
  402.     DCR    B
  403.     JNZ    TYPEIT
  404.     RET
  405. ;
  406. ;
  407. ; OUTPUT SPECIFIED # OF CR/LF's TO PRINTER AND CHECK FOR END OF LABEL.
  408. ;        AT END OF LABEL, FEED TO NEXT LABEL.
  409. CRLF    EQU    $
  410.     LDA    LCOUNT        ;Get count of lines remaining on label
  411.     SUB    B        ; Less # of LF's requested
  412.     STA    LCOUNT        ; and save as # of lines remaining
  413.     MVI    A,LBLWID    ;Initialize # of file names across label
  414.     STA    WCOUNT
  415.     MVI    E,CR        ;Get CR character in E
  416.     CALL    TYPE        ; and output it
  417.     MVI    E,LF        ;Get LF character in E
  418.     MOV    A,B        ;Check # of requested LF's for zero
  419.     CPI    0
  420.     JZ    NXTLBL        ;If so, feed to next label
  421. LFLOOP    EQU    $
  422.     CALL    TYPE        ;Output LF
  423.     DCR    B        ;Decrement count of LF's to perform
  424.     JNZ    LFLOOP        ;Loop till none left
  425. ;
  426. NXTLBL    LDA    LCOUNT        ;Check for end of Label
  427.     CPI    0
  428.     RNZ            ;More lines left - Return
  429.     MVI    A,LBLLNG    ;Initialize # of lines per label
  430.     STA    LCOUNT
  431.     MVI    B,LBLSPC    ;Set count to specified # of lines
  432.     JMP    LFLOOP        ;between labels and do LF's to next labl
  433. ;
  434. ;
  435. ;ERROR EXIT
  436. ;
  437. OVRFLMS    EQU    $
  438.     DB    '++ TOO MANY FILES FOR PROGRAM TABLE',CR,LF,'$'
  439. NOTALL    EQU    $
  440.     LXI    D,OVRFLMS
  441. ERRXIT    MVI    C,PSTRING    ;SET UP TO PRINT STRING TO CONSOLE
  442.     JMP    CALLB        ;PRINT MSG, EXIT
  443. ;
  444. ;ABORT - READ CHAR ENTERED
  445. ABORT    MVI    C,RDCHR
  446. CALLB    CALL    BDOS        ;DELETE THE CHAR
  447. ;
  448. ;EXIT - ALL DONE
  449. EXIT    EQU    $
  450.     LDA    LCOUNT
  451.     CPI    LBLLNG        ;Are we at top of a label ?
  452.     JZ    FINAL        ;Yes - no need to go to top of label
  453.     MOV    B,A        ;No - Get remaining lines on label in B
  454.     CALL    CRLF        ;Go to top of next label
  455. FINAL    EQU    $
  456.     LXI    H,RESET        ;Reset printer to Normal mode
  457.     CALL    WRPRNT
  458.     LHLD    STACK        ;GET OLD STACK
  459.     SPHL            ;MOVE TO STACK
  460.     RET            ;..AND RETURN
  461.  
  462. ;COMPARE ROUTINE FOR SORT
  463.  
  464. COMPR    PUSH    H    ;SAVE TABLE ADDR
  465.     MOV    E,M    ;LOAD LO
  466.     INX    H
  467.     MOV    D,M    ;LOAD HI
  468.     INX    H
  469.     MOV    C,M
  470.     INX    H
  471.     MOV    B,M
  472. ;BC, DE NOW POINT TO ENTRIES TO BE COMPARED
  473.     XCHG
  474. CMPLP    EQU    $
  475.     MOV    A,M        ;Get rid of any tag bit in name
  476.     ANI    07FH        ; before comparing names for sort
  477.     MOV    M,A
  478.     LDAX    B
  479.     ANI    07FH
  480.     CMP    M
  481.     INX    H
  482.     INX    B
  483.     JZ    CMPLP
  484.     POP    H
  485.     RET        ;COND CODE TELLS ALL
  486. ;SWAP ENTRIES IN THE ORDER TABLE
  487. SWAP    MVI    A,1
  488.     STA    SWITCH    ;SHOW A SWAP WAS MADE
  489.     MOV    C,M
  490.     INX    H
  491.     PUSH    H    ;SAVE TABLE ADDR+1
  492.     MOV    B,M
  493.     INX    H
  494.     MOV    E,M
  495.     MOV    M,C
  496.     INX    H
  497.     MOV    D,M
  498.     MOV    M,B
  499.     POP    H
  500.     MOV    M,D
  501.     DCX    H    ;BACK POINTER TO CORRECT LOC'N
  502.     MOV    M,E
  503.     RET
  504. ;
  505. ;
  506. ;
  507.     DS    40        ;STACK AREA
  508. STACK    DS    2        ;SAVE OLD STACK HERE
  509. NEXTT    DW    TABLE        ;NEXT TABLE ENTRY
  510. COUNT    DB    0        ;ENTRY COUNT
  511. SCOUNT    DB    0        ;# TO SORT
  512. WCOUNT    DB    0        ;# OF FILENAME SPACES LEFT ACROSS LINE
  513. LCOUNT    DB    0        ;# of Lines remaining on this Label
  514. SWITCH    DB    0        ;SWAP SWITCH FOR SORT
  515. TTLSWC    DB    0        ;Switch for Title font
  516. TEMP    DS    1
  517. ORDER    DS    2*MAXFIL    ;ORDER TABLE
  518. TABLE    EQU    $        ;READ ENTRIES IN HERE
  519.     END    100H
  520.