# HG changeset patch # User boisy # Date 1135091890 0 # Node ID e5ad0755bf40335d97b9e39500a2c318f6413768 # Parent 8ae0268695b7567af60c691643689dbe485c62ae Added HawkSoft's CDF to standard.bl files Robert Gault's dirsort added to standard commands diff -r 8ae0268695b7 -r e5ad0755bf40 level1/cmds/dirsort.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/level1/cmds/dirsort.asm Tue Dec 20 15:18:10 2005 +0000 @@ -0,0 +1,364 @@ +****************************************************************** +* dirsort - Directory sorting utility +* +* This is an asm version of a Basic09 directory sort +* that was published in a Coco newsletter. +* Original and ml routine by Robert Gault, Nov. 2005 +* +* The program uses a version of Shellsort published +* in a May 1983, BYTE article by Terry Barron and +* George Diehr (both at University of Washington) +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------- +* 1 2005/12/19 Robert Gault +* Very fast and fairly simple + + NAM dirsort +* This ensures the assembler knows predefined OS-9 terms + IFP1 + USE defsfile + ENDC + +TyLg SET Prgrm+Objct program object code +* Re-entrant means multiple users possible +AtRev SET ReEnt+Rev re-entrant, revision 1 +Rev SET 1 + +* Create module header, needed by all OS-9 modules + MOD Eom,Name,TyLg,AtRev,Start,Size +* Data area +DPptr RMB 2 pointer to our direct page +dirsize RMB 2 size of the directory less 64 bytes +count RMB 2 number of directory entries +entryI RMB 2 pointer to nameI +entryJ RMB 2 pointer to nameJ +entryID RMB 2 pointer to name(I+D) +Tx RMB 32 buffer for transfer +i RMB 2 index +j RMB 2 index +NminusD RMB 2 holds last value of FOR I/NEXT loop +path RMB 1 value for path to the directory +D RMB 2 shellsort constant + RMB 40 +stack EQU . +Size EQU . This initial data space will be increased as OS-9 +* assigns space in pages of 256 bytes. Initially the stack will +* not be here. +buffer EQU . This will be the start of the data array in memory +* to be requested from OS-9 as needed. + +Name EQU * + FCS /dirsort/ + FCB 1 edition number +* Ego stroking :) identifier + FCC /Written by Robert Gault, 2005/ + +* Default directory name, dot, or current directory +default FCB C$PERD,C$CR + +* Solutions for N,2^INT(LN(N)) -1 +* We don't need general logs just specifc values so +* they were pre-calculated +Dtable FDB 2,0 + FDB 7,1 + FDB 20,3 + FDB 54,7 + FDB 148,15 +* If your directory has more entries than several hundred, you +* need to learn how to organize your disk/drive. + FDB 403,31 + FDB 1096,63 +* This next will exceed normal memory limits but is needed +* for values up to about 2000. We could just put $FFFF/32= +* 2047 but there are size checks in the code. + FDB 2980,127 +DTEnd EQU * + +Start EQU * + stu entry(j) + bcc s10 + ldd (n-D) + ldd 0 + lda