Jump to content

Photo

Which sector numbers are correct?


4 replies to this topic

#1 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 838 posts
  • Location:The Great White North

Posted Wed Jun 20, 2018 6:57 PM

I built a CATALOG utility and make a crude TI float->16bit int conversion routine.

I thought I was correct because my numbers agreed with a BASIC program that shows the directory.

However I notice in TI99 Dir V6.3a that the sector sizes are 1 less than the other two programs.

 

So which one is correct?

100 REM  CATALOG DISK PROGRAM 
110 PRINT "Input DSKx. :";
120 INPUT DSK$
130 OPEN #1:DSK$,INPUT ,INTERNAL,RELATIVE
140 FOR I=0 TO 127
150 IF EOF(1)<>0 THEN 190
160 INPUT #1:N$,X,Y,Z
170 PRINT N$,X;Y;Z
180 NEXT I
190 CLOSE #1
200 END

Attached Files


Edited by TheBF, Wed Jun 20, 2018 6:59 PM.


#2 Lee Stewart OFFLINE  

Lee Stewart

    River Patroller

  • 3,853 posts
  • Location:Silver Run, Maryland

Posted Wed Jun 20, 2018 9:52 PM

When you OPEN the catalog “file”, the DSR for the TI disk controller (and others) generates records for it in the manner expected by your program.  What may not be generally known is that the DSR increments the sector size found in each file’s File Descriptor Record (FDR) by 1 before reporting it.  This means that the reported sector size includes the FDR sector.  TI99Dir reports only the size of the body of the file, found in its FDR, without including the sector occupied by its FDR.  I am sure there are compelling arguments for each scenario, but I am with the TI DSR because the FDR is, indeed, a part of the disk real estate occupied by the file.

 

...lee



#3 TheBF OFFLINE  

TheBF

    Dragonstomper

  • Topic Starter
  • 838 posts
  • Location:The Great White North

Posted Wed Jun 20, 2018 10:14 PM

When you OPEN the catalog “file”, the DSR for the TI disk controller (and others) generates records for it in the manner expected by your program.  What may not be generally known is that the DSR increments the sector size found in each file’s File Descriptor Record (FDR) by 1 before reporting it.  This means that the reported sector size includes the FDR sector.  TI99Dir reports only the size of the body of the file, found in its FDR, without including the sector occupied by its FDR.  I am sure there are compelling arguments for each scenario, but I am with the TI DSR because the FDR is, indeed, a part of the disk real estate occupied by the file.

 

...lee

 

 

Always amazes me; your omniscience on matters 99.

 

Thanks Lee.



#4 FarmerPotato OFFLINE  

FarmerPotato

    Chopper Commander

  • 183 posts
  • Location:Austin, TX

Posted Thu Jun 21, 2018 12:39 PM

Here's a utility I threw together to read .DSK files - it compiles under Cygwin and probably plenty of other environments.

 

I needed it to quickly catalog disks that I was scanning with Kryoflux, and also used it to dump out some files or read FORTH screens.

 

https://github.com/o.../master/tidir.c

$ ./tidir.exe mati00053.dsk
File size is 92160
DSK.00053       Free= 160 Used= 200   9S,40T,1S,1D
FDR Name       Size Type        P Sector(Offset)
--- ---------- ---- ----------- - --------------
  2 BOOT         21 Dis/Var  80    223001  22(13)
  3 BOOTBJ        6 Dis/Fix  80    364000  36(4)
  4 DRIVER       98 Dis/Var  80    3b0006  3b(60)
  5 UTILEQU       3 Dis/Var  80    9c1000  9c(1)
  6 UTILRAM       4 Dis/Var  80    9e2000  9e(2)
  7 UTILROM      48 Dis/Var  80    a1e002  a1(2e) 


$ ./tidir.exe mati00053.dsk DRIVER > driver.txt
$ more.driver.txt       
       TITL 'FORTH DRIVER WITH UTIL'
       IDT  'FORTH'
************************************************************
TEMP0  EQU  0
TEMP1  EQU  1
 

$ ./tidir.exe mati00053.dsk DRIVER > driver.txt


Edited by FarmerPotato, Thu Jun 21, 2018 12:41 PM.


#5 TheBF OFFLINE  

TheBF

    Dragonstomper

  • Topic Starter
  • 838 posts
  • Location:The Great White North

Posted Thu Jun 21, 2018 6:22 PM

Here's a utility I threw together to read .DSK files - it compiles under Cygwin and probably plenty of other environments.

 

I needed it to quickly catalog disks that I was scanning with Kryoflux, and also used it to dump out some files or read FORTH screens.

 

https://github.com/o.../master/tidir.c

$ ./tidir.exe mati00053.dsk
File size is 92160
DSK.00053       Free= 160 Used= 200   9S,40T,1S,1D
FDR Name       Size Type        P Sector(Offset)
--- ---------- ---- ----------- - --------------
  2 BOOT         21 Dis/Var  80    223001  22(13)
  3 BOOTBJ        6 Dis/Fix  80    364000  36(4)
  4 DRIVER       98 Dis/Var  80    3b0006  3b(60)
  5 UTILEQU       3 Dis/Var  80    9c1000  9c(1)
  6 UTILRAM       4 Dis/Var  80    9e2000  9e(2)
  7 UTILROM      48 Dis/Var  80    a1e002  a1(2e) 


$ ./tidir.exe mati00053.dsk DRIVER > driver.txt
$ more.driver.txt       
       TITL 'FORTH DRIVER WITH UTIL'
       IDT  'FORTH'
************************************************************
TEMP0  EQU  0
TEMP1  EQU  1
 

$ ./tidir.exe mati00053.dsk DRIVER > driver.txt

 

This is far more comprehensive than my little CAT program.  I will have to take a look inside the directory data structure.

For what it's worth here is CAT written using my ANS/iSO Forth File Library.

I am just so happy to have the ability to see the disk from the TI console whenever I need to.  :) 

\ INCLUDE DSK1.TOOLS.F   \ for debugging
 INCLUDE DSK1.ANSFILES.F
 INCLUDE DSK1.CASE.F

\ print unsigned int, right justified
: U.R  ( u n --) >R 0 <# #S #> ( adr len) R> OVER - SPACES TYPE ;

\ string helpers
: $.       ( $addr -- ) COUNT TYPE ;
: NEXT$    ( addr len -- addr len ) + COUNT ;

\ print string left justified '
: $.LEFT  ( $ width -- ) OVER C@ - >R $.  R> SPACES ;

HEX
\ crude 3 DIGIT BCD to int convertor. Limited to 999
: F>INT   ( addr len -- addr len n)
          OVER C@  ( -- mantissa)
          CASE
            0 OF  0                    ENDOF
           40 OF  OVER 1+ C@           ENDOF
           41 OF  OVER 1+ C@ 64 * >R
                  OVER 2+ C@  R> +     ENDOF
           ( default)  -1  \ bad # indicator
           ENDCASE ;
DECIMAL
: DIR.TYPE  ( addr -- )
          F>INT
          CASE
             1 OF ." Txt/Fix"  ENDOF
             2 OF ." Txt/Var"  ENDOF
             3 OF ." Bin/Fix"  ENDOF
             4 OF ." Bin/Var"  ENDOF
             5 OF ." Program"  ENDOF
             ." ????"
          ENDCASE ;

: DIR.REC ( addr -- )
          DUP  11 $.LEFT SPACE COUNT ( addr len)
          NEXT$ DIR.TYPE
          NEXT$ F>INT 7 U.R
          NEXT$ F>INT 7 U.R
          2DROP  ;

: PAGEBRK ( -- )
          LINES @ L/SCR 2- MOD 0=  \ bottom of page?
          IF  
            CR ." Press any key..." KEY DROP  
          THEN ;

: CAT  ( <DSK?.> )   \  needs the '.' ONLY shows file name
          BASE @ >R  DECIMAL
          BL PARSE-WORD
          RELATIVE 256 FIXED  R/O BIN OPEN-FILE ?FILERR
          >R                        \ store file handle

          PAD 80 R@ READ-LINE ?FILERR 2DROP
          CR PAD $.  6 SPACES ." -type-  -sect- -b/rec-"

          LINES OFF
          BEGIN
             PAD 80 R@ READ-LINE ?FILERR ( len flag) NIP
          WHILE
             PAD CR DIR.REC
             1 LINES +!
             PAGEBRK
             ?TERMINAL
             IF BEGIN PAUSE ?TERMINAL 0= UNTIL
                R> CLOSE-FILE
                CR ." *BREAK*" ABORT
             THEN
          REPEAT
          R> CLOSE-FILE  ?FILERR
          CR LINES @ . ." files" CR
          R> BASE ! ;







0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users