# HG changeset patch # User tlindner # Date 1417996938 28800 # Node ID dfc91123494513bca3923f06759a92287aad79f0 # Parent 0f1a7fcddb005f23485cda15b783760dbfb49890 Added dash command to sdir to list mounted images diff -r 0f1a7fcddb00 -r dfc911234945 3rdparty/utils/tlindner/sdir.asm --- a/3rdparty/utils/tlindner/sdir.asm Sun Nov 30 21:43:53 2014 -0800 +++ b/3rdparty/utils/tlindner/sdir.asm Sun Dec 07 16:02:18 2014 -0800 @@ -122,47 +122,50 @@ * The start of the program is here. * main program start + lbsr SkipSpcs * create path string in buffer area - cmpd #256-3 - lbhi parameterToLongError - decb chew CR in parameter area - pshs u,x,d + ldd ,x load first two parameter characters + cmpd #$2d0d test ascii: hyphen, return + lbeq displayMountedInfo + cmpa #$0d + beq noParameters +copyParameterArea + pshs u,x leax basepath,pc ldd ,x++ copy 'L:' std ,u++ - puls d - cmpd #$0 - bne copyParameterArea -* use '*.*' if user suplied no parameter - ldd ,x++ copy '*.*' and null - std ,u++ - ldd ,x++ + puls x + ldb #2 +cpa1 lda ,x+ + cmpa #$0d + beq cpa2 + sta ,u+ + addb #1 + lbcs parameterToLongError + bra cpa1 +cpa2 clra + sta ,u + puls u + bra printHeader +noParameters + leax basepath,pc + ldd ,x++ copy 'L:' std ,u++ - puls x,u - ldd #$5 Length of buffer - bra printHeader -copyParameterArea - puls x - pshs d -cpaLoop lda ,x+ - sta ,u+ - decb - beq cpaDone - bra cpaLoop -cpaDone clra put null at end of parameter string - sta ,u+ - puls d - addd #3 - puls u - leas 0,y clobber parameter area, put stack at top, giving us as much RAM as possible + ldd ,x++ copy '*.' + std ,u++ + ldd ,x++ copy '*' and Null + std ,u++ + leau -6,u + ldd #5 printHeader - pshs d + leas ,y clobber parameter area, put stack at top, giving us as much RAM as possible + pshs d save path character count lda #1 Output path (stdout) ldy #headerL leax header,pc header in x os9 I$Write * print path - puls y + puls y restore character count leax buffer,u buffer in x os9 I$Write ldy #2 length of buffer @@ -320,63 +323,8 @@ * print size pfSize -* start with a space - lda #$20 space character -* store U offset in 11,u - clrb - stb 11,u - sta b,u - incb - stb 11,u - - lda 12,u - beq ps1 -* Very large number: load offset 12 and 13, shift right 4 bits, print decimal as mega bytes - ldb 13,u - lsra - rorb - lsra - rorb - lsra - rorb - lsra - rorb - bsr L09BA write ascii value of D to buffer - lda #'M - bra psUnit -ps1 lda 13,u - beq ps2 -* Kind of large number: load offsets 13 and 14, shift right 2 bits, print decimal as kilo bytes - ldb 14,u - lsra - rorb - lsra - rorb - bsr L09BA write ascii value of D to buffer - lda #'K - bra psUnit -ps2 ldd 14,u -* number: load offsetprint 14 and 15, print decimal as bytes - bsr L09BA write ascii value of D to buffer - lda #'B - bra psUnit -* print unit to buffer -psUnit - ldb 11,u - sta b,u - lda #$20 - incb - sta b,u - incb - sta b,u - incb - sta b,u - - lda #1 - ldy #8 - leax ,u - os9 I$Write - + leax 12,u + bsr PrintFileSize * print carrage return and do next directory entry pfCR dec ,s @@ -402,6 +350,80 @@ andcc #^IntMasks unmask interrupts ExitNow os9 F$Exit +********************************************************************* +* PrintFileSize +********************************************************************* +* ENTRY: +* X = Address of 4 byte file size +* String buffer at -11,x +* String buffer index at -12,x +* +* EXIT: +* +PrintFileSize + pshs u + leau ,x +* start with a space + lda #$20 space character +* store U offset in -11,u + ldb #-11 + stb -12,u + sta b,u + incb + stb -12,u + lda ,u + beq ps1 +* Very large number: load offset 0 and 1, shift right 4 bits, print decimal as mega bytes + ldb 1,u + lsra + rorb + lsra + rorb + lsra + rorb + lsra + rorb + bsr L09BA write ascii value of D to buffer + lda #'M + bra psUnit +ps1 lda 1,u + beq ps2 +* Kind of large number: load offsets 1 and 2, shift right 2 bits, print decimal as kilo bytes + ldb 2,u + lsra + rorb + lsra + rorb + bsr L09BA write ascii value of D to buffer + lda #'K + bra psUnit +ps2 ldd 2,u +* number: load offsetprint 14 and 15, print decimal as bytes + bsr L09BA write ascii value of D to buffer + lda #'B + bra psUnit +* print unit to buffer +psUnit + ldb -12,u + sta b,u + lda #$20 + incb + sta b,u + incb + sta b,u + incb + sta b,u + incb + sta b,u + incb + sta b,u + lda #1 + ldy #8 + leax -11,u + os9 I$Write + puls u + rts + * Stolen from BASIC09 * Convert # in D to ASCII version (decimal) L09BA pshs y,x,d Preserve End of data mem ptr,?,Data mem size @@ -419,20 +441,18 @@ beq L09E6 If finished table, skip ahead cmpd #$3000 Just went through once? beq L09C1 Yes, reset X & do again -* lbsr L1373 Go save A @ [InfoTitle,pcr + ldy #InfoTitleL + lbsr PrintString + + ldb 1,s + bmi PrintEmptySlot0 + + leax ,u + lbsr PrintFilenameAndExtension + + leax 11,u + lbsr PrintMountedAttributes + + leax 28,u + lbsr PrintFileSize + + bra DoSlot1 + +PrintEmptySlot0 + leax >EmptyTitle,pcr + ldy #EmptyTitleL + lbsr PrintString + +DoSlot1 + leax >S1Title,pcr + ldy #S1TitleL + lbsr PrintString + + ldb ,s + bmi PrintEmptySlot1 + + leax 32+0,u + lbsr PrintFilenameAndExtension + + leax 32+11,u + lbsr PrintMountedAttributes + + leax 32+28,u + lbsr PrintFileSize + + bra MountedDone +PrintEmptySlot1 + leax >EmptyTitle,pcr + ldy #EmptyTitleL + lbsr PrintString +MountedDone + leas 2,s + lbra ExitOK + + emod eom equ * end diff -r 0f1a7fcddb00 -r dfc911234945 3rdparty/utils/tlindner/sdrive.asm --- a/3rdparty/utils/tlindner/sdrive.asm Sun Nov 30 21:43:53 2014 -0800 +++ b/3rdparty/utils/tlindner/sdrive.asm Sun Dec 07 16:02:18 2014 -0800 @@ -17,7 +17,7 @@ endc * Here are some tweakable options -DOHELP set 1 1 = include help info +DOHELP set 0 1 = include help info STACKSZ set 32 estimated stack size in bytes PARMSZ set 256 estimated parameter size in bytes