Jump to content
retroclouds

Reading disk catalog in assembly language

Recommended Posts

Is there an example available on how to read the floppy disk catalog in assembly language?
 
Did you look in the ea manual?

Sent from my LM-G820 using Tapatalk

Share this post


Link to post
Share on other sites
25 minutes ago, arcadeshopper said:

Did you look in the ea manual?

 

The E/A manual is pretty useless on that count. It suggests using the Disk Manager cartridge to get a disk catalog.

 

...lee

  • Like 1
  • Haha 2

Share this post


Link to post
Share on other sites
1 hour ago, retroclouds said:

Is there an example available on how to read the floppy disk catalog in assembly language?

 

The disk catalog is a pseudo-file created by the DSR when you attempt to open a file with a null name, such as "DSK1." The file should be opened for input and relative access as IF38. There are exactly 128 records with 38 bytes/record, each composed of 1 string and 3 floating point (FP) numbers. Each field has a one-byte count (even the FP fields!). The string field is padded on the right with spaces, so, I believe, the string length is always 10. In any case, the field is always 11 bytes. The FP fields each have a length byte of 8 followed by the 8-byte FP number, so are 9-byte fields. 

 

The disk information is contained in record 0 and the remaining records contain information about each of the 127 possible files on the disk. Actual files are first in the (alphabetical?) list with the remaining, non-existent files as null strings (or, at least, names with 10 spaces) and zeroed FP fields.

 

Record 0 fields:

  1. Disk name (counted string in an 11-byte field)
  2. Record type (0 for this record)
  3. Total number of AUs (sectors) on the disk
  4. Free AUs (sectors) on disk

 

Records 1 – 127 fields:

  1. Filename (counted string in an 11-byte field)
  2. File type (negative if protected)
    • (1) Display/Fixed
    • (2) Display/Variable
    • (3) Internal/Fixed
    • (4) Internal/Variable
    • (5) Memory image (last field will be 0)
  3. AUs (sectors)/file
  4. Bytes/record

The above is from Functional Specification for the TI/99 Disk Peripheral. I think WHTech has it. I can post it if you need.

 

...lee

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
11 hours ago, Lee Stewart said:

 

The disk catalog is a pseudo-file created by the DSR when you attempt to open a file with a null name, such as "DSK1." The file should be opened for input and relative access as IF38. There are exactly 128 records with 38 bytes/record, each composed of 1 string and 3 floating point (FP) numbers. Each field has a one-byte count (even the FP fields!). The string field is padded on the right with spaces, so, I believe, the string length is always 10. In any case, the field is always 11 bytes. The FP fields each have a length byte of 8 followed by the 8-byte FP number, so are 9-byte fields. 

 

The disk information is contained in record 0 and the remaining records contain information about each of the 127 possible files on the disk. Actual files are first in the (alphabetical?) list with the remaining, non-existent files as null strings (or, at least, names with 10 spaces) and zeroed FP fields.

 

Record 0 fields:

  1. Disk name (counted string in an 11-byte field)
  2. Record type (0 for this record)
  3. Total number of AUs (sectors) on the disk
  4. Free AUs (sectors) on disk

 

Records 1 – 127 fields:

  1. Filename (counted string in an 11-byte field)
  2. File type (negative if protected)
    • (1) Display/Fixed
    • (2) Display/Variable
    • (3) Internal/Fixed
    • (4) Internal/Variable
    • (5) Memory image (last field will be 0)
  3. AUs (sectors)/file
  4. Bytes/record

The above is from Functional Specification for the TI/99 Disk Peripheral. I think WHTech has it. I can post it if you need.

 

...lee

 

Thanks Lee! That is some great information, it is much appreciated!

The Functional Spec. is available in the DevRes Thread so should be able  to grab it there. Making the catalog available as a pseudo-file is a cool idea must say.

  • Like 1

Share this post


Link to post
Share on other sites
14 hours ago, GDMike said:

I'm glad to see this as I'm heading in a direction that's gonna require some if this info. 

Thanks so much Lee

 

No prob. 

 

Just so you know, you will need to decode the FP numbers in the last three fields of each record. If you need an explanation of FP representation on the TI-99/4A,“Appendix L” of my fbForth 2.0: A File-Based Cartridge Implementation of TI Forth gives one. A fair number of folks here can also help with converting FP to integer, which is what you will need to do with those FP numbers.

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites

I used this code for my catalog program. Since GDMike can read Forth, he can convert this to ALC if it helps.  

It's not a complete conversion, just enough to deal the the magnitudes used in the catalog.

 

Addr len is the string info from the field you want to convert. ie: get the field into a CPU ram buffer somewhere and go to town.

: 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 ;

 

  • Like 3

Share this post


Link to post
Share on other sites
3 hours ago, TheBF said:

I used this code for my catalog program. Since GDMike can read Forth, he can convert this to ALC if it helps.  

It's not a complete conversion, just enough to deal the the magnitudes used in the catalog.

 

Addr len is the string info from the field you want to convert. ie: get the field into a CPU ram buffer somewhere and go to town.

: 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 ;

 

 

Very nice, except that you are not dealing with negative numbers, which can happen and would indicate a protected file.

 

Also, I am pretty sure there can be as many as 32767 records (admittedly small ones if really that many) in a file, which hex representation would be >4203 >1B43 >0000 >0000.

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites

I understand some of what that says, but so far I've done very little CASE activity. So thank you for giving me credit anyway, but some of the general words I'm familiar with, yes.

Share this post


Link to post
Share on other sites
\ if the first byte is "0" return 0 
   0 OF  0                    ENDOF  

\ if first byte is >40, fetch next char, that's the int value 
  40 OF  OVER 1+ [email protected]           ENDOF  

\ if first byte is >41, 
  41 OF  OVER 1+ [email protected] 64 * >R  \ fetch 1st byte, mult by 100, save this value
         OVER 2+ [email protected]  R> +    \ fetch 2nd byte, add it to the saved  value 
 
  

Here is a little explanation of this (over) simplified float to integer conversion.

Share this post


Link to post
Share on other sites

Looking for a venting area.. and I stopped here...I just learned a tough lesson.. using the CORRECT "compare" word in assy. 

I was debugging a problem for three days because for an erroneous R0 cursor location. And come to find out I used a "CI" instead of a "C". It was definitely a problem creator, not a resolver..ahh..I feel better that I found it and learned an important lesson.

  • Like 2

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...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...