Jump to content
Sign in to follow this  
TheBF

Which sector numbers are correct?

Recommended Posts

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

post-50750-0-81704600-1529542478.jpg

post-50750-0-82866100-1529542487.jpg

post-50750-0-94047000-1529542500.jpg

Edited by TheBF

Share this post


Link to post
Share on other sites

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

  • Like 3

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

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/olsone/forti/blob/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
  • Like 1

Share this post


Link to post
Share on other sites

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/olsone/forti/blob/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 [email protected] - >R $.  R> SPACES ;

HEX
\ crude 3 DIGIT BCD to int convertor. Limited to 999
: F>INT   ( addr len -- addr len n)
          OVER [email protected]  ( -- mantissa)
          CASE
            0 OF  0                    ENDOF
           40 OF  OVER 1+ [email protected]           ENDOF
           41 OF  OVER 1+ [email protected] 64 * >R
                  OVER 2+ [email protected]  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 [email protected] READ-LINE ?FILERR 2DROP
          CR PAD $.  6 SPACES ." -type-  -sect- -b/rec-"

          LINES OFF
          BEGIN
             PAD 80 [email protected] 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 ! ;


  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...