Jump to content
IGNORED

Bored, so I did this. Part 2


sup8pdct

Recommended Posts

I am still bored waiting for my broken right elbow to heal so I have been working on this DosXE format program to pass the time. Have included the source code. Dosxe can support high speed I/O but found it a bit hit and miss with what hardware I have here. Cannot get it to work at all with ape (dos version) but can with SIO2USB with speed byte $A. Speed byte of $9 (returned from sio2usb) however doesn’t work.

 

This formatter was done mainly for ATR images on whatever hardware/emulator you are using. Have tested it on images sizes from 30K to 16meg, including MIO ramdisks. DosXE must be written to disk for changes to be made permanent.

 

If the format program looks familiar, you would be right. It started life as SDX formatter and has been modified a lot to suit DosXE. It must be run from DosXE due to the fact that drive type table contained within dos needs to be added to or modified.

 

Instructions.

 

Attatch disk you want formatted to D2. The formatter can use disk 1 to 8 but dosxe can only use 2 disks as shipped from Atari. Run Setup.com if you want more drives available.

 

Run the format program and select disk number.

 

Program will ask for a name if size doesn’t match what is in drive type table.

 

Program will ask for one to be written over and ask to select one if there is no spare drive type. Use arrow keys-return to select. If one is spare, it will be placed in automatically.

 

Select mode for HS or std. Warning, HS may not work. Don’t select HS if disk is on a parallel bus device

 

Build directory.

 

Exit to dos and write dosxe to the newly formatted disk so changes are made permanent.

 

 

 

James

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Below is updated tech document for dos XE.

 

Orignal and 2nd version contained errors.

 

DOS XE file system format

 

===================

 

 

 

General:

 

-------

 

 

 

* physical sector sizes: 128 and 256 bytes.

 

* max. fs capacity: 65535 clusters (15,62 MB)

 

* max. file length: 366,21 KB (or 7,81 MB?)

 

* max. number of files per disk: 65536

 

* directory structure: hierarchical

 

* max. number of files per directory: 1280

 

* filename: 8+3

 

* method of mapping files: file maps

 

* method of sector allocation: bitmap

 

 

 

Allocation unit:

 

---------------

 

 

 

The allocation unit (or logical sector) is a 256-byte "cluster", or two physical sectors in single and medium density, one in double density. Mapping physical sectors into clusters takes into account the sector 0, even if it does not physically exist. So, in double density sectr 0 is cluster 0, sector 1 - cluster 1 and so on. In single and medium density cluster 0 consists of sectors 0 and 1, cluster 1 - sectors 2 and 3, cluster 2 - sectors 4 and 5 and so on.

 

 

 

Boot sectors:

 

------------

 

The first three sectors contain DOS XE bootloader. Apart from that bytes $09-$0F of the sector (not cluster) 1 contain the DOS configuration information, and bytes $10-$2F - disk information.

 

$09 - number of files possible to open at a time. Default 3, max. 7.

 

$0A - A bitmap of active drives: bits 7 6 5 4 3 2 1 0 correspond to drives 1 2 3 4 5 6 7 8.

 

A bit set to 1 means that the corresponding drive is active.

 

$0B - meaning unknown, value $00

 

$0C-$0D Buffers base address

 

$0E-$0F Date code when dos was written to disk. Same format as used for file date code

 

$10-$15 - an ASCII string, up to 6 characters, padded with zeros, if shorter, symbolizing the density (or disk type):

 

Drive types known to DosXE as shipped by atari

 

- AT810 - single density

 

- AT1050 - medium density

 

- SSDD - single sided double density

 

- XF551 - double sided double density

 

- 130RAM - 130XE ramdisk

 

 

 

$16 - meaning unknown. Value always 1. Could be number of 256 byte blocks used for buffer?.

 

setting this number high reduces amount of free memory.

 

 

 

$17 - meaning unknown. could be number of clusters assigned to each VTOC bit. value always $01

 

Setting this to $02 halves the size of vtoc but writing files errors out.

 

 

 

 

 

$18-$19 - total number of clusters on the disk +1

 

if value is $ffff, do not add 1

 

 

 

$1A-$1B - initial number of free clusters on the disk

 

 

 

$1C - First byte of vtoc bitmap. used during vtoc building after format.

 

Works for disk sizes up to $1FB0 sectors. Larger sizes requires custom format program.

 

 

 

$1D - sector number of the first cluster of the main directory.

 

 

 

$1E-$1F - Address of sio routine in dosxe to use for sector I/O. Lo,Hi

 

$D5D Use os rom sio. PBI devices also use this entry.

 

$FE5 High speed sio routine. Uses $24 or $25 for audio freq

 

$DF32 Sio entry for 128 byte sector disks sector I/O. Uses rom sio only

 

$13F7 Entry for Ramdisk sector I/O only

 

 

 

$20-$21 - Address of sio routine in dosxe to use for all commands except sector I/O. Lo,Hi

 

$D5D entry for all disks

 

$1445 Entry for ramdisk only

 

 

 

$22 - SIO command "Read sector", "R" for standard, "R"+$80 for XF551 fast mode.

 

 

 

$23 - SIO command "Write sector", "W" for standard etc. Can also be "P"

 

 

 

$24 - Pokey's AUDF3/4 value to generate the command baud rate, $00 = unused,

 

$28 for XF551 fast mode.

 

 

 

$25 - Pokey's AUDF3/4 value to generate the data baud rate, $00 = unused,

 

$10 for XF551 fast mode.

 

 

 

$26 - SIO command "Format disk" for this disk type, $21 for standard interleave,

 

$21+$80 for turbo interleave for XF551.

 

If the disk does noot need formatting (ramdisks etc.), $00.

 

$22 for AT1050 drive type

 

 

 

$27 - Format timeout value.

 

 

 

$28-$2f - first 8 bytes of the PERCOM block defining the disk parameters (number of tracks, sectors per track, sector size etc.)

 

 

 

VTOC:

 

----

 

 

 

The VTOC is held in the cluster 4 (sector 4 in DD, sectors 8-9 in SD and ED) and extends for as many sectors as required. In the first 10 bytes there is disk information as follows:

 

 

 

$00 - Same as $16 above in drive type table

 

 

 

$01 - Same as $17 above in drive type table

 

 

 

$02-$03 - Total number of clusters on disk plus 1. Copied from $18,$19 above in drive type table

 

 

 

$04-$05 - Number of currently free clusters. Copied from $1A,$1B above when 1st formatted

 

 

 

$06-$07 - number of files and directories on the disk (= volume sequential number), intially $0000

 

 

 

$08-$09 - volume random number. 2 different numbers for each disk formatted.

 

 

 

The further part of the VTOC, from byte $0A onwards, is occupied by the bitmap. If a bit is set to 1, it means that the corresponding cluster is free, or it is in use otherwise. Bit 7 of each byte is assigned to a cluster of a lower number, and the subsequent bits of the byte correspond to subsequent clusters. The cluster 0 has no corresponding bit in the bitmap, the bit 7 of the first byte in the bitmap (byte $0a of VTOC) corresponds to cluster 1, bit 6 - to cluster 2, bit 5 - to cluster 3 etc.

 

 

 

Initially the first free cluster of the disk is cluster 6, and the first byte of the bitmap has a value of 000111 (clusters 1-5 in use, 6-8 free). Dosxe format routine copies this byte from $1C above.

 

 

 

Dos XE cannot properly setup the VTOC above 8112 ($1FB0) sectors. This number = 4 full sectors of VTOC map, making the 1st VTOC byte = 0. If above this number of sectors, the 2nd byte of the VTOC will be set to a value of not= $FF. DosXE format routine cannot handle this.

 

 

 

Directories:

 

-----------

 

 

 

The main directory begins right after the VTOC, and initially occupies only one cluster. Its number is indicated by the byte $1d of the bootsector.

 

 

 

A single direcotry entry consists of 49 bytes:

 

 

 

$00 - status byte:

 

 

 

- bit 7 = 1, file deleted

 

- bit 6 = 1, file in use. In closed files bit 7 and 6 always have opposite values.

 

- bit 5 - unused

 

- bit 4 - unused

 

- bit 3 - unused

 

- bit 2 = 1, the file is open for write. Bits 7 and 6 are simultaneously set to 1.

 

- bit 1 = 1, file protected

 

- bit 0 = 1, subdirectory

 

 

 

$01-$08 - file name padded with spaces, if necessary

 

 

 

$09-$0b - file name extension padded with spaces

 

 

 

$0c-$0d - number of data clusters occupied by the file. $0000 for a dir.

 

 

 

$0e - number of data bytes in the last cluster of the file. $00 for a dir.

 

 

 

$0f-$10 - global file number (volume sequential number at the time when the file or dir was created, plus 1).

 

 

 

$11-$12 - volume random number (same as in VTOC)

 

 

 

$13-$14 - dir: number of the first cluster of the directory data

 

file: number of the first cluster of the file map

 

 

 

$15-$2a - dir: 22 zeros

 

file: 11 numbers of subsequent cluster of the file map

 

($0000 - unassigned)

 

 

 

$2b-$2c - file creation date:

 

 

 

- bits 0-4 day of month

 

- bits 5-8 month ($01 = January etc.)

 

- bits 9-15 year-1900

 

 

 

$2d-$2e - file modification date (same format as above)

 

 

 

$2f-$30 - unknown bytes (always zeroed)

 

 

 

Every newly created file gets status $c4. After the file is closed, bits 7 and 2 of this value are zeroed.

 

 

 

Directory data clusters

 

-----------------------

 

 

 

Each cluster of the directory always contains a integer number of directory entries, maximum 5. If the directory has more entries, the 6th entry is stored to a next cluster of the directory etc.

 

 

 

Bytes $f5-$f7 are unused, and the last 8 bytes ($f8-$ff) contain information about the directory:

 

 

 

$f8-$f9 - number of the next cluster of the directory ($0000 - last one)

 

 

 

$fa-$fb - global file number ($0000 - main directory)

 

 

 

$fc-$fd - volume random number (same as in VTOC)

 

 

 

$fe - directory chain cluster number (starting from $00)

 

 

 

$ff - cluster type ($ff = directory)

 

 

 

Files:

 

-----

 

 

 

The file map

 

 

 

The file map consists of clusters indicated by the bytes $13-$2a of the directory entry. The first 250 bytes of the map's cluster contain up to 125 numbers of data clusters allocated for the file. The last six bytes contains additional information:

 

 

 

$fa-$fb - global file number

 

 

 

$fc-$fd - volume random number (same as in VTOC)

 

 

 

$fe - map's cluster number in the current file (starting from $00)

 

 

 

$ff - cluster type ($80 - file map)

 

 

 

The directory entry provides 24 bytes for the list of the map clusters. Because the cluster number is 16-bit, the file map may extend to max. 12 clusters. 12 clusters * 125 data entries * 250 bytes (see below) results in the maximum file extent of 1500 clusters, or 375000 bytes (366.2 KB). If there isn't any other method of linking longer files, this is the ultimate file length limit in this file system.

 

 

 

Data clusters

 

 

 

Each data cluster contains up to 250 bytes of data. The last six bytes contain additional information:

 

 

 

$fa-$fb - global file number

 

 

 

$fc-$fd - volume random number (same as in VTOC)

 

 

 

$fe-$ff - the number of the data cluster in the current file (starting from $0000)

 

 

 

The maximum "number if data cluster" is 32767. The higher byte is always a positive value and thus forms the cluster type mark (<= $7f = data cluster).

 

 

 

Drive types.

 

------------

 

There is a maximum of 8 drive types that dosXE can handle. They are contained within dosXE itself at address starting at $D800, extending for 256 bytes. Drive types must be added to this table and dos written to disk for changes to be made permanent. Each drive type table is copied to the boot sector $10-$2F during boot sector writing after disk has been formatted to match that particular disk. If a disk has a dosxe formatted disk where the drive type is not contained in the table, an error occurs.

 

 

 

DOS_XE.zip

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

While experementing with DosXE, I found I made a rather bad mistake. Stupid thing is, I was right 1st time round but thought when memlo was raised by 8K using a 16meg drive, That Cannot Be Right..... Turns out, it was right. Dosxe Buffers the entire VTOC which requires Ram above what dos already uses.

It is a very high price to pay to have a 16meg disk. With 2 16meg drives, 16K of ram is used above what dos uses. I now don't think DosXE is very usefull now that I have discovered this. I have fixed my format program to make proper working images. It can still format or build images from 10K to 16meg, single or double density.

To use, setup new image to be formatted or built as disk 2. run format program. select unit 2 and follow prompts. exit then write dosxe to disk 2 (do not copy) to save changes made to dos xe by the format program perminate. re write to disk 1 as well if you wish.

 

James

 

 

Drive type table

 

$16 - Number of VTOC clusters on disk. DosXE buffers the entire VTOC which raises memlo.

 

 

dos_xe.zip

Link to comment
Share on other sites

  • 2 years later...
  • 9 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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