Skip to content

Commit

Permalink
pdd2 disk image and sector access
Browse files Browse the repository at this point in the history
  • Loading branch information
bkw777 committed Jul 12, 2022
1 parent cfe7f82 commit f089dd1
Show file tree
Hide file tree
Showing 8 changed files with 338 additions and 183 deletions.
8 changes: 4 additions & 4 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
dlplus:
Stephen Hurd Initial versions 1.0-1.3
John R. Hogerhuis Enhancements including WP-2 support
Brian K. White Bootstrap function and loaders library
Brian K. White Bootstrap function and loader collection
main cmd scanner, serial tty handling
FDC-mode disk image sector access support
magic files for UR-II
Gabriele Gorla Support for TS-DOS subdirectories
magic files for UR-II ts-dos & sardine
pdd1 & pdd2 disk image sector access
Gabriele Gorla TS-DOS subdirectories

TPDD Clients & loaders:
Kurt McCullum TS-DOS loaders
Expand Down
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
20220712
Add sector access commands and disk image support for pdd1 & pdd2
Magic ts-dos & sardine files for UR-II

20220530
Replace main cmd parser. Improve tty efficiency.

Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ CLIENT_DOCS := \

DOCS := dl.do README.txt README.md LICENSE $(CLIENT_DOCS)
SOURCES := dl.c dir_list.c
HEADERS := dir_list.h constants.h

ifeq ($(OS),Darwin)
#DEFAULT_CLIENT_TTY := cu.*
Expand All @@ -75,7 +76,7 @@ endif
.PHONY: all
all: $(APP_NAME)

$(APP_NAME): $(SOURCES)
$(APP_NAME): $(SOURCES) $(HEADERS)
$(CC) $(CFLAGS) $(DEFINES) $(SOURCES) $(LDLIBS) -o $(@)

install: $(APP_NAME) $(CLIENT_LOADERS) $(LIB_OTHER) $(DOCS)
Expand Down
40 changes: 25 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,6 @@ $ unzip REXCPMV21_b19.ZIP
$ dl -vb ./rxcini.DO ;dl -vu
```

## trivia
The "ROOT " and "PARENT" labels are not hard coded in TS-DOS. You can set them to other things. Sadly, this does not extend as far as being able to use ".." for "PARENT". TS-DOS thinks it's an invalid filename (even though it DISPLAYS it in the file list just fine. If it would just go ahead and send the command to "open" it, it would work.) However, plenty of other things that are all better than "ROOT " and "PARENT" do work.
```
$ ROOT_LABEL=/ PARENT_LABEL=^ dl
$ ROOT_LABEL='-root-' PARENT_LABEL='-back-' dl
$ ROOT_LABEL='0:' PARENT_LABEL='^:' dl
or you can confuse someone...
$ ROOT_LABEL='C:\' PARENT_LABEL='UP:' dl
```
## UR-II
Ultimate ROM II ([docs](http://www.club100.org/library/libdoc.html)) ([roms](https://bitchin100.com/wiki/index.php?title=REXsharp#Option_ROM_Images_for_Download)) has a feature where it can load a RAM version of TS-DOS from disk on-the-fly.
This allows you to keep the TS-DOS executable on the disk instead of in ram, and it is loaded and then discarded on-demand by selecting the TS-DOS menu entry from inside UR2.
Expand All @@ -124,16 +115,26 @@ Failing that, then it looks in the root share dir. Failing that, finally it gets

[More details](ref/ur2.txt)

## FDC-mode sector access - disk images
## sector access - disk images
For a TPDD1 disk image
```
$ dl -vi tpdd1_disk_image.pdd1
$ dl -v -m 1 -i disk_image.pdd1
```

For a TPDD2 disk image
```
Support for raw disk image files that allow use of FDC-mode sector access commands on a virtual disk image file.
Limitations: Only TPDD1 disks, only sector access. You can't access the files on a disk as files, just as raw sectors, and TPDD2 disks and TPDD2 sector/cache commands aren't supported.
$ dl -v -m 2 -i disk_image.pdd2
```

Support for disk image files that allow use of raw sector access commands on a virtual disk image file.
Limitations: Only supports sector access to the disk image. You can't "mount" the disk image and access the files on a disk as files, just as raw sectors.

Working examples: Sardine_American_English.pdd1, Disk_Power_KC-85.pdd1
Useful working examples: Sardine_American_English.pdd1, Disk_Power_KC-85.pdd1

Those examples are both TPDD1, but both TPDD1 and TPDD2 are supported. Merely there are no known database application disks like Sardine on TPDD2 media to make a good TPDD2 example. You can load up the image of the TPDD2 Utility Disk included with pdd.sh just to see that it works, but that isn't useful for anything.

Example, using Sardine with a Model 100 with [Ultimate ROM II rom](http://www.club100.org/library/librom.html) (or [REX](http://bitchin100.com/wiki/index.php?title=Rex) with UR-II loaded):

Example, using Sardine with a Model 100 with [Ultimate ROM II rom](http://www.club100.org/library/librom.html) (or [REX](http://bitchin100.com/wiki/index.php?title=Rex) with UR-II loaded):
First, run dl with the following commandline arguments to force TPDD1 emulation, disable TS-DOS directory support, and load the Sardine American English dictionary disk:
```
$ dl -vue -m 1 -i Sardine_American_English.pdd1
Expand All @@ -153,6 +154,15 @@ Disk image files may be created 2 ways:

Disk image format [disk_image_files.txt](ref/disk_image_files.txt)

## trivia
The "ROOT " and "PARENT" labels are not hard coded in TS-DOS. You can set them to other things. Sadly, this does not extend as far as being able to use ".." for "PARENT", but many other things work. The ROOT label allows almost anything, the PARENT label is only limited by what TS-DOS thinks is a valid filename. Here are a few examples that do work.
```
$ ROOT_LABEL=/ PARENT_LABEL=^ dl
$ ROOT_LABEL='-root-' PARENT_LABEL='-back-' dl
$ ROOT_LABEL='0:' PARENT_LABEL='^:' dl
or you can confuse someone...
$ ROOT_LABEL='C:\' PARENT_LABEL='UP:' dl
```
## OS Compatibility
Tested on Linux, Macos, FreeBSD

Expand Down
40 changes: 25 additions & 15 deletions constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define RET_PDD2_UNK23 0x14 // TPDD2 unknown function - "TS-DOS mystery" TS-DOS uses to detect TPDD2
#define RET_CONDITION 0x15 // TPDD2
#define RET_CACHE_STD 0x38 // TPDD2 shared return format for: cache_load cache_write cond_list
#define RET_READ_CACHE 0x39 // TPDD2
#define RET_CACHE_READ 0x39 // TPDD2
#define RET_PDD2_UNK11 0x3A // TPDD2 unknown function
#define RET_PDD2_UNK33 0x3A // TPDD2 same as UNK11

Expand Down Expand Up @@ -137,20 +137,39 @@
#define PDD2_COND_POWER 0x01 // bit 0 : low power
#define PDD2_COND_NONE 0x00 // no conditions

// fixed lengths
// lengths & addresses
#define PDD1_TRACKS 40
#define PDD1_SECTORS 2
#define PDD2_TRACKS 80
#define PDD2_SECTORS 2
#define TPDD_DATA_MAX 0x80
#define TPDD_DATA_MAX 260 // largest packet is cache_read can be 256+3
#define REQ_RW_DATA_MAX 128 // largest chunk size in req_read() req_write()
#define LEN_RET_STD 0x01
#define LEN_RET_DME 0x0B
#define LEN_RET_DIRENT 0x1C
#define TPDD_FILENAME_LEN 24
#define LOCAL_FILENAME_MAX 256
#define PDD1_SECTOR_ID_LEN 13
#define PDD1_ID_HDR_LEN 1
#define PDD1_SECTOR_DATA_LEN 1280
#define SECTOR_DATA_LEN 1280
#define PDD1_SECTOR_LSC_LEN 1
#define PDD1_SECTOR_ID_LEN 12
#define PDD1_SECTOR_META_LEN (PDD1_SECTOR_LSC_LEN+PDD1_SECTOR_ID_LEN)
#define PDD2_SECTOR_META_LEN 4
#define SMT_OFFSET 1240
#define PDD1_SMT 0x80
#define PDD2_SMT 0xC0
#define PDD2_META_ADDR 32772
#define PDD2_CACHE_READ_MAX 252
#define PDD2_CACHE_WRITE_MAX 127

// flags
#define FE_FLAGS_NONE 0x00
#define FE_FLAGS_DIR 0x01
#define NO_RET 0
#define ALLOW_RET 1
#define CACHE_LOAD 0
#define CACHE_UNLOAD 2
#define CACHE_AREA_DATA 0
#define CACHE_AREA_META 1

// KC-85 platform BASIC interpreter EOL & EOF bytes for bootstrap()
#define BASIC_EOL 0x0D
Expand All @@ -160,14 +179,5 @@
#define OPR_CMD_SYNC 0x5A
#define FDC_CMD_EOL 0x0D

#define FE_FLAGS_NONE 0x00
#define FE_FLAGS_DIR 0x01
#define RD 0
#define WR 1
#define RW 2


#define NO_RET 0
#define ALLOW_RET 1

#endif // PDD_CONSTANTS_H
10 changes: 5 additions & 5 deletions dir_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static FILE_ENTRY *tblp = 0;
static FILE_ENTRY * current_record (void);

int file_list_init () {
tblp = malloc (sizeof (FILE_ENTRY) * FEQ );
tblp = malloc(sizeof (FILE_ENTRY) * FEQ );
if (!tblp) return -1;
allocated = FEQ;
ndx = 0;
Expand All @@ -45,7 +45,7 @@ int file_list_cleanup() {
allocated = 0;
ndx = 0;
cur = 0;
if (tblp) free (tblp);
if (tblp) free(tblp);
tblp = NULL;
return 0;
}
Expand All @@ -58,15 +58,15 @@ int add_file (FILE_ENTRY *fe) {
/** allocate FEQ more records if out of space */
if (ndx >= allocated) {
/** resize the array */
tblp = realloc (tblp, (allocated + FEQ) * sizeof (FILE_ENTRY) );
tblp = realloc(tblp, (allocated + FEQ) * sizeof (FILE_ENTRY) );
if (!tblp) return -1;
allocated += FEQ;
}

/** reference the entry */
if (!tblp) return -1;

memcpy (tblp+ndx, fe, sizeof(FILE_ENTRY));
memcpy(tblp+ndx, fe, sizeof(FILE_ENTRY));
/** adjust cur to address this record, ndx to next avail */
cur = ndx;
ndx++;
Expand Down Expand Up @@ -96,7 +96,7 @@ FILE_ENTRY * get_next_file (void) {
FILE_ENTRY * get_prev_file (void) {
if (cur==0) return NULL;
cur--;
return current_record ();
return current_record();
}

static FILE_ENTRY * current_record (void) {
Expand Down
Loading

0 comments on commit f089dd1

Please sign in to comment.