Adding getAddress method to FileEntry.

This commit is contained in:
Rob Greene 2022-03-05 17:59:12 -06:00
parent 3396e285d2
commit 0842f1f31f
9 changed files with 61 additions and 0 deletions

View File

@ -131,6 +131,11 @@ public interface FileEntry {
*/
public abstract void setAddress(int address);
/**
* Get the address that this file loads at.
*/
public abstract int getAddress();
/**
* Indicates that this filetype can be compiled.
* Compile is a somewhat arbitrary term, as the code may be

View File

@ -476,6 +476,14 @@ public class CpmFileEntry implements FileEntry {
public void setAddress(int address) {
// not applicable
}
/**
* Get the address that this file loads at.
*/
public int getAddress() {
return 0; // Not applicable
}
/**
* Indicates that this filetype can be compiled.

View File

@ -285,6 +285,7 @@ public class DosFileEntry implements FileEntry {
list.add(numberFormat.format(getSectorsUsed()));
list.add(isDeleted() ? textBundle.get("Deleted") : ""); //$NON-NLS-1$//$NON-NLS-2$
list.add("T" + getTrack() + " S" + getSector()); //$NON-NLS-1$ //$NON-NLS-2$
list.add("A=$" + AppleUtil.getFormattedWord(getAddress()));
break;
default: // FILE_DISPLAY_STANDARD
list.add(getFilename());
@ -496,6 +497,17 @@ public class DosFileEntry implements FileEntry {
}
}
/**
* Get the address that this file loads at.
*/
public int getAddress() {
if (needsAddress()) {
byte[] rawData = disk.getFileData(this);
return AppleUtil.getWordValue(rawData, 0);
}
return 0;
}
/**
* Indicates that this filetype can be compiled.
*/

View File

@ -376,6 +376,8 @@ public class DosFormatDisk extends FormattedDisk {
FileColumnHeader.ALIGN_CENTER, "deleted"));
list.add(new FileColumnHeader(textBundle.get("DosFormatDisk.TrackAndSectorList"), 7,
FileColumnHeader.ALIGN_CENTER, "trackAndSectorList"));
list.add(new FileColumnHeader(textBundle.get("DosFormatDisk.FileAddress"), 7,
FileColumnHeader.ALIGN_RIGHT, "address"));
break;
default: // FILE_DISPLAY_STANDARD
list.addAll(super.getFileColumnHeaders(displayMode));

View File

@ -334,6 +334,13 @@ public class GutenbergFileEntry implements FileEntry {
public void setAddress(int address) {
}
/**
* Get the address that this file loads at.
*/
public int getAddress() {
return 0; // Does not apply.
}
/**
* Indicates that this filetype can be compiled.
*/

View File

@ -245,6 +245,14 @@ public class NakedosFileEntry implements FileEntry {
*/
public void setAddress(int address) {
}
/**
* Get the address that this file loads at.
*/
public int getAddress() {
return 0; // Does not apply.
}
/**
* Indicates that this filetype can be compiled.

View File

@ -511,6 +511,13 @@ public class PascalFileEntry implements FileEntry {
// Does not apply.
}
/**
* Get the address that this file loads at.
*/
public int getAddress() {
return 0; // Does not apply.
}
/**
* Indicates that this filetype can be compiled.
*/

View File

@ -612,6 +612,17 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
writeFileEntry(fileEntry);
}
/**
* Get the address that this file loads at.
*/
public int getAddress() {
if (needsAddress()) {
return getAuxiliaryType();
}
return 0;
}
/**
* Indicates that this filetype can be compiled.
*/

View File

@ -154,6 +154,7 @@ DosFormatDisk.SectorsOnDisk=Sectors On Disk
DosFormatDisk.Type=Type
DosFormatDisk.SizeInSectors=Size (sectors)
DosFormatDisk.TrackAndSectorList=Track/Sector List
DosFormatDisk.FileAddress=Address
DosFormatDisk.InvalidFileEntryError=Must have a DOS 3.3 file entry\!
DosFormatDisk.NotEnoughSectorsError=This file requires {0} sectors but there are only {1} sectors available on the disk.
DosFormatDisk.InvalidTrackAndSectorCombinationError=Invalid track ({0}), sector ({1}) combination.