mirror of
				https://github.com/davidgiven/fluxengine.git
				synced 2025-10-24 11:11:02 -07:00 
			
		
		
		
	Fix the broken AppleDOS double-sided disks. Allow access to side 1 on AppleDOS
volumes.
This commit is contained in:
		| @@ -46,9 +46,9 @@ fluxengine ls appleii140 --appledos -f image.flux | ||||
| In addition, some third-party systems use 80-track double sides drives, with | ||||
| the same underlying disk format. These are supported with the `appleii640` | ||||
| profile. The complication here is that the AppleDOS filesystem only supports up | ||||
| to 50 tracks, so it needs tweaking to support larger disks. FluxEngine doesn't | ||||
| understand these tweaks yet but they only become important when writing to | ||||
| disks, which isn't supported yet. | ||||
| to 50 tracks, so it needs tweaking to support larger disks. It treats the | ||||
| second side of the disk as a completely different volume. To access these | ||||
| files, use `--appledos --side1`. | ||||
|  | ||||
| [^1]: CP/M disks use the ProDOS translation for the first three tracks and a | ||||
|     different translation for all the tracks thereafter. | ||||
|   | ||||
| @@ -103,7 +103,7 @@ public: | ||||
|         ByteWriter bw(bytes); | ||||
|         while (tstrack) | ||||
|         { | ||||
|             Bytes ts = getLogicalSector(tstrack * 16 + tssector); | ||||
|             Bytes ts = getAppleSector(tstrack * 16 + tssector); | ||||
|             ByteReader br(ts); | ||||
|             br.seek(0x0c); | ||||
|  | ||||
| @@ -114,7 +114,7 @@ public: | ||||
|                 if (!track) | ||||
|                     goto done; | ||||
|  | ||||
|                 bw += getLogicalSector(track * 16 + sector); | ||||
|                 bw += getAppleSector(track * 16 + sector); | ||||
|             } | ||||
|  | ||||
|             tstrack = ts[1]; | ||||
| @@ -128,7 +128,7 @@ public: | ||||
| private: | ||||
|     void mount() | ||||
|     { | ||||
|         _vtoc = getLogicalSector(VTOC_BLOCK); | ||||
|         _vtoc = getAppleSector(VTOC_BLOCK); | ||||
|         if ((_vtoc[0x27] != 122) || (_vtoc[0x36] != 0) || (_vtoc[0x37] != 1)) | ||||
|             throw BadFilesystemException(); | ||||
|  | ||||
| @@ -137,7 +137,7 @@ private: | ||||
|         int sector = _vtoc[2]; | ||||
|         while (track) | ||||
|         { | ||||
|             Bytes dir = getLogicalSector(track * 16 + sector); | ||||
|             Bytes dir = getAppleSector(track * 16 + sector); | ||||
|             ByteReader br(dir); | ||||
|             br.seek(0x0b); | ||||
|  | ||||
| @@ -162,6 +162,12 @@ private: | ||||
|         throw FileNotFoundException(); | ||||
|     } | ||||
|  | ||||
|     Bytes getAppleSector(uint32_t number, uint32_t count = 1) | ||||
|     { | ||||
|         return getLogicalSector( | ||||
|             number + _config.filesystem_offset_sectors(), count); | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     const AppledosProto& _config; | ||||
|     Bytes _vtoc; | ||||
|   | ||||
| @@ -59,7 +59,12 @@ message CbmfsProto | ||||
|  | ||||
| message ProdosProto {} | ||||
|  | ||||
| message AppledosProto {} | ||||
| message AppledosProto { | ||||
| 	optional uint32 filesystem_offset_sectors = 1 [ | ||||
| 		default = 0, | ||||
| 		(help) = "offset the entire offset up the disk this many sectors" | ||||
| 	]; | ||||
| } | ||||
|  | ||||
| message Smaky6FsProto {} | ||||
|  | ||||
|   | ||||
| @@ -24,17 +24,19 @@ layout { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| decoder { | ||||
| 	apple2 { | ||||
| 		side_one_track_offset: 80 | ||||
| 	} | ||||
| } | ||||
|  | ||||
| encoder { | ||||
| 	apple2 { | ||||
| 		side_one_track_offset: 80 | ||||
| 	} | ||||
| } | ||||
|  | ||||
| tpi: 96 | ||||
|  | ||||
| option { | ||||
| 	name: "side1" | ||||
| 	comment: "reads the volume on side 1 of a disk" | ||||
| 	message: "accessing volume on side 1" | ||||
|  | ||||
| 	config { | ||||
| 		filesystem { | ||||
| 			appledos { | ||||
| 				filesystem_offset_sectors: 0x500 | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user