1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-11 02:28:54 +00:00

Update ProDOS, ProDOS-16, and GS/OS call handling

Added P16 parameter blocks.  Updated GS/OS calls with System 6.0
changes.  Added comments, renamed symbols.
This commit is contained in:
Andy McFadden 2020-07-04 18:42:41 -07:00
parent 8d291ba21e
commit 4782cae116
4 changed files with 383 additions and 233 deletions

View File

@ -34,6 +34,9 @@ using PluginCommon;
*/ */
namespace RuntimeData.Apple { namespace RuntimeData.Apple {
/// <summary>
/// Identify and format ProDOS-16 and GS/OS system calls.
/// </summary>
public class GSOS : MarshalByRefObject, IPlugin, IPlugin_SymbolList, IPlugin_InlineJsl { public class GSOS : MarshalByRefObject, IPlugin, IPlugin_SymbolList, IPlugin_InlineJsl {
private const string GSOS_FUNC_TAG = "AppleIIgs-GSOS-Functions"; // tag used in .sym65 file private const string GSOS_FUNC_TAG = "AppleIIgs-GSOS-Functions"; // tag used in .sym65 file
private bool VERBOSE = false; private bool VERBOSE = false;
@ -54,23 +57,144 @@ namespace RuntimeData.Apple {
private static Param PARAM_COUNT = new Param(DataType.NumericLE, DataSubType.Decimal, 2); private static Param PARAM_COUNT = new Param(DataType.NumericLE, DataSubType.Decimal, 2);
private static Param REF_NUM = new Param(DataType.NumericLE, DataSubType.Decimal, 2); private static Param REF_NUM = new Param(DataType.NumericLE, DataSubType.Decimal, 2);
private static Param DEV_NUM = new Param(DataType.NumericLE, DataSubType.Decimal, 2); private static Param DEV_NUM = new Param(DataType.NumericLE, DataSubType.Decimal, 2);
private static Param PATHNAME = new Param(DataType.NumericLE, DataSubType.Address, 4); private static Param STRING_PTR = new Param(DataType.NumericLE, DataSubType.Address, 4);
private static Param BUFFER = new Param(DataType.NumericLE, DataSubType.Address, 4); private static Param BUF_PTR = new Param(DataType.NumericLE, DataSubType.Address, 4);
private static Param PROC_POINTER = new Param(DataType.NumericLE, DataSubType.Address, 4); private static Param PROC_PTR = new Param(DataType.NumericLE, DataSubType.Address, 4);
private static Param ACCESS = new Param(DataType.NumericLE, DataSubType.Hex, 2); private static Param ACCESS = new Param(DataType.NumericLE, DataSubType.Hex, 2);
private static Param FILE_TYPE = new Param(DataType.NumericLE, DataSubType.Hex, 2); private static Param FILE_TYPE = new Param(DataType.NumericLE, DataSubType.Hex, 2);
private static Param AUX_TYPE = new Param(DataType.NumericLE, DataSubType.Hex, 4); private static Param AUX_TYPE = new Param(DataType.NumericLE, DataSubType.Hex, 4);
private static Param STORAGE_TYPE = new Param(DataType.NumericLE, DataSubType.Hex, 2); private static Param STORAGE_TYPE = new Param(DataType.NumericLE, DataSubType.Hex, 2);
private static Param FILE_OFFSET = new Param(DataType.NumericLE, DataSubType.Hex, 4); private static Param FILE_OFFSET = new Param(DataType.NumericLE, DataSubType.Hex, 4);
private static Param DATE_TIME = new Param(DataType.Dense, DataSubType.None, 8); private static Param DATE_TIME = new Param(DataType.Dense, DataSubType.None, 8);
private static Param OLD_DATE = new Param(DataType.NumericLE, DataSubType.Hex, 2);
private static Param OLD_TIME = new Param(DataType.NumericLE, DataSubType.Hex, 2);
private static Param MISC2 = new Param(DataType.NumericLE, DataSubType.Hex, 2); private static Param MISC2 = new Param(DataType.NumericLE, DataSubType.Hex, 2);
private static Param MISC4 = new Param(DataType.NumericLE, DataSubType.Hex, 4); private static Param MISC4 = new Param(DataType.NumericLE, DataSubType.Hex, 4);
private static Param RESULT2 = new Param(DataType.NumericLE, DataSubType.Hex, 2); private static Param RESULT2 = new Param(DataType.NumericLE, DataSubType.Hex, 2);
private static Param RESULT4 = new Param(DataType.NumericLE, DataSubType.Hex, 4); private static Param RESULT4 = new Param(DataType.NumericLE, DataSubType.Hex, 4);
private Dictionary<int, Param[]> ParamDescrs = new Dictionary<int, Param[]>() { private Dictionary<int, Param[]> ParamDescrs = new Dictionary<int, Param[]>() {
//
// "Class 0" ProDOS-16 calls.
//
{ 0x0031, // ALLOC_INTERRUPT
new Param[] { MISC2, BUF_PTR }
},
{ 0x0004, // CHANGE_PATH
new Param[] { STRING_PTR, STRING_PTR }
},
{ 0x000b, // CLEAR_BACKUP_BIT
new Param[] { STRING_PTR }
},
{ 0x0014, // CLOSE
new Param[] { REF_NUM }
},
{ 0x0001, // CREATE
new Param[] { STRING_PTR, ACCESS, FILE_TYPE, AUX_TYPE, STORAGE_TYPE,
OLD_DATE, OLD_TIME }
},
{ 0x0032, // DEALLOC_INTERRUPT
new Param[] { MISC2 }
},
{ 0x0002, // DESTROY
new Param[] { STRING_PTR }
},
{ 0x002c, // D_INFO
new Param[] { DEV_NUM, BUF_PTR }
},
{ 0x0025, // ERASE_DISK
new Param[] { STRING_PTR, STRING_PTR, MISC2 }
},
{ 0x000e, // EXPAND_PATH
new Param[] { STRING_PTR, BUF_PTR, MISC2 }
},
{ 0x0015, // FLUSH
new Param[] { REF_NUM }
},
{ 0x0024, // FORMAT
new Param[] { STRING_PTR, STRING_PTR, MISC2 }
},
{ 0x0028, // GET_BOOT_VOL
new Param[] { BUF_PTR }
},
{ 0x0020, // GET_DEV_NUM
new Param[] { STRING_PTR, DEV_NUM }
},
{ 0x001c, // GET_DIR_ENTRY
new Param[] { REF_NUM, MISC2, MISC2, MISC2, BUF_PTR, MISC2, FILE_TYPE,
FILE_OFFSET, MISC4, DATE_TIME, DATE_TIME, ACCESS, AUX_TYPE, MISC2 }
},
{ 0x0019, // GET_EOF
new Param[] { REF_NUM, FILE_OFFSET }
},
{ 0x0006, // GET_FILE_INFO
new Param[] { STRING_PTR, ACCESS, FILE_TYPE, AUX_TYPE, STORAGE_TYPE,
OLD_DATE, OLD_TIME, OLD_DATE, OLD_TIME, MISC4 }
},
{ 0x0021, // GET_LAST_DEV
new Param[] { DEV_NUM }
},
{ 0x001b, // GET_LEVEL
new Param[] { MISC2 }
},
{ 0x0027, // GET_NAME
new Param[] { BUF_PTR }
},
{ 0x000a, // GET_PREFIX
new Param[] { MISC2, BUF_PTR }
},
{ 0x002a, // GET_VERSION
new Param[] { MISC2 }
},
{ 0x0011, // NEWLINE
new Param[] { REF_NUM, MISC2, MISC2 }
},
{ 0x0010, // OPEN
new Param[] { REF_NUM, STRING_PTR, MISC4 }
},
{ 0x0029, // QUIT
new Param[] { STRING_PTR, MISC2 }
},
{ 0x0012, // READ
new Param[] { REF_NUM, BUF_PTR, MISC4, MISC4 }
},
{ 0x0022, // READ_BLOCK
new Param[] { DEV_NUM, BUF_PTR, MISC4 }
},
{ 0x0018, // SET_EOF
new Param[] { REF_NUM, FILE_OFFSET }
},
{ 0x0005, // SET_FILE_INFO
new Param[] { STRING_PTR, ACCESS, FILE_TYPE, AUX_TYPE, MISC2, OLD_DATE, OLD_TIME,
OLD_DATE, OLD_TIME }
},
{ 0x001a, // SET_LEVEL
new Param[] { MISC2 }
},
{ 0x0016, // SET_MARK
new Param[] { REF_NUM, FILE_OFFSET }
},
{ 0x0009, // SET_PREFIX
new Param[] { MISC2, STRING_PTR }
},
{ 0x0008, // VOLUME
new Param[] { STRING_PTR, BUF_PTR, MISC4, MISC4, MISC2 }
},
{ 0x0013, // WRITE
new Param[] { REF_NUM, BUF_PTR, MISC4, MISC4 }
},
{ 0x0023, // WRITE_BLOCK
new Param[] { DEV_NUM, BUF_PTR, MISC4 }
},
//
// "Class 1" GS/OS calls.
//
// Some changes were made in System 6.0. See "Programmer's Reference for
// System 6.0", by Mike Westerfield / Byteworks.
//
{ 0x2034, // AddNotifyProcGS { 0x2034, // AddNotifyProcGS
new Param[] { PARAM_COUNT, PROC_POINTER } new Param[] { PARAM_COUNT, PROC_PTR }
}, },
{ 0x201d, // BeginSessionGS { 0x201d, // BeginSessionGS
new Param[] { PARAM_COUNT } new Param[] { PARAM_COUNT }
@ -79,100 +203,100 @@ namespace RuntimeData.Apple {
new Param[] { PARAM_COUNT, RESULT2, MISC2, MISC4 } new Param[] { PARAM_COUNT, RESULT2, MISC2, MISC4 }
}, },
{ 0x2004, // ChangePathGS { 0x2004, // ChangePathGS
new Param[] { PARAM_COUNT, PATHNAME, PATHNAME } new Param[] { PARAM_COUNT, STRING_PTR, STRING_PTR, MISC2 }
}, },
{ 0x200b, // ClearBackupBitGS { 0x200b, // ClearBackupBitGS
new Param[] { PARAM_COUNT, PATHNAME } new Param[] { PARAM_COUNT, STRING_PTR }
}, },
{ 0x2014, // CloseGS { 0x2014, // CloseGS
new Param[] { PARAM_COUNT, REF_NUM } new Param[] { PARAM_COUNT, REF_NUM }
}, },
{ 0x2001, // CreateGS { 0x2001, // CreateGS
new Param[] { PARAM_COUNT, PATHNAME, ACCESS, FILE_TYPE, AUX_TYPE, new Param[] { PARAM_COUNT, STRING_PTR, ACCESS, FILE_TYPE, AUX_TYPE,
STORAGE_TYPE, FILE_OFFSET, FILE_OFFSET } STORAGE_TYPE, FILE_OFFSET, FILE_OFFSET }
}, },
{ 0x202e, // DControlGS (has a bunch of sub-calls) { 0x202e, // DControlGS (has a bunch of sub-calls)
new Param[] { PARAM_COUNT, DEV_NUM, MISC2, BUFFER, PARAM_COUNT, RESULT4 } new Param[] { PARAM_COUNT, DEV_NUM, MISC2, BUF_PTR, MISC2, RESULT4 }
}, },
{ 0x2035, // DelNotifyProcGS { 0x2035, // DelNotifyProcGS
new Param[] { PARAM_COUNT, PROC_POINTER } new Param[] { PARAM_COUNT, PROC_PTR }
}, },
{ 0x2002, // DestroyGS { 0x2002, // DestroyGS
new Param[] { PARAM_COUNT, PATHNAME } new Param[] { PARAM_COUNT, STRING_PTR }
}, },
{ 0x202c, // DInfoGS { 0x202c, // DInfoGS
new Param[] { PARAM_COUNT, DEV_NUM, PATHNAME, MISC2, MISC4, MISC2, MISC2, new Param[] { PARAM_COUNT, DEV_NUM, STRING_PTR, MISC2, MISC4, MISC2, MISC2,
MISC2, MISC2, MISC2, MISC2, BUFFER } MISC2, MISC2, MISC2, MISC2, BUF_PTR }
}, },
{ 0x202f, // DReadGS { 0x202f, // DReadGS
new Param[] { PARAM_COUNT, DEV_NUM, BUFFER, MISC4, MISC4, MISC2, MISC4 } new Param[] { PARAM_COUNT, DEV_NUM, BUF_PTR, MISC4, MISC4, MISC2, MISC4 }
}, },
{ 0x2036, // DRenameGS { 0x2036, // DRenameGS
new Param[] { PARAM_COUNT, DEV_NUM, PATHNAME } new Param[] { PARAM_COUNT, DEV_NUM, STRING_PTR }
}, },
{ 0x202d, // DStatus (has a bunch of sub-calls) { 0x202d, // DStatus (has a bunch of sub-calls)
new Param[] { PARAM_COUNT, DEV_NUM, MISC2, BUFFER, MISC4, MISC4 } new Param[] { PARAM_COUNT, DEV_NUM, MISC2, BUF_PTR, MISC4, MISC4 }
}, },
{ 0x2030, // DWriteGS { 0x2030, // DWriteGS
new Param[] { PARAM_COUNT, DEV_NUM, BUFFER, MISC4, MISC4, MISC2, MISC4 } new Param[] { PARAM_COUNT, DEV_NUM, BUF_PTR, MISC4, MISC4, MISC2, MISC4 }
}, },
{ 0x201e, // EndSessionGS { 0x201e, // EndSessionGS
new Param[] { PARAM_COUNT } new Param[] { PARAM_COUNT }
}, },
{ 0x2025, // EraseDiskGS { 0x2025, // EraseDiskGS
new Param[] { PARAM_COUNT, PATHNAME, PATHNAME, MISC2, MISC2 } new Param[] { PARAM_COUNT, STRING_PTR, STRING_PTR, MISC2, MISC2, MISC2, BUF_PTR }
}, },
{ 0x200e, // ExpandPathGS { 0x200e, // ExpandPathGS
new Param[] { PARAM_COUNT, PATHNAME, PATHNAME, MISC2 } new Param[] { PARAM_COUNT, STRING_PTR, STRING_PTR, MISC2 }
}, },
{ 0x2015, // FlushGS { 0x2015, // FlushGS
new Param[] { PARAM_COUNT, REF_NUM } new Param[] { PARAM_COUNT, REF_NUM }
}, },
{ 0x2024, // FormatGS { 0x2024, // FormatGS
new Param[] { PARAM_COUNT, PATHNAME, PATHNAME, MISC2, MISC2 } new Param[] { PARAM_COUNT, STRING_PTR, STRING_PTR, MISC2, MISC2, MISC2, BUF_PTR }
}, },
{ 0x2033, // FSTSpecific { 0x2033, // FSTSpecific
new Param[] { PARAM_COUNT, MISC2, MISC2 /*...*/ } new Param[] { PARAM_COUNT, MISC2, MISC2 /*...*/ }
}, },
{ 0x2028, // GetBootVolGS { 0x2028, // GetBootVolGS
new Param[] { PARAM_COUNT, BUFFER } new Param[] { PARAM_COUNT, BUF_PTR }
}, },
{ 0x2020, // GetDevNumberGS { 0x2020, // GetDevNumberGS
new Param[] { PARAM_COUNT, PATHNAME, DEV_NUM } new Param[] { PARAM_COUNT, STRING_PTR, DEV_NUM }
}, },
{ 0x201c, // GetDirEntryGS { 0x201c, // GetDirEntryGS
new Param[] { PARAM_COUNT, REF_NUM, MISC2, MISC2, MISC2, PATHNAME, MISC2, new Param[] { PARAM_COUNT, REF_NUM, MISC2, MISC2, MISC2, STRING_PTR, MISC2,
FILE_TYPE, FILE_OFFSET, MISC4, DATE_TIME, DATE_TIME, ACCESS, AUX_TYPE, MISC2, FILE_TYPE, FILE_OFFSET, MISC4, DATE_TIME, DATE_TIME, ACCESS, AUX_TYPE, MISC2,
BUFFER, FILE_OFFSET, MISC4 } BUF_PTR, FILE_OFFSET, MISC4 }
}, },
{ 0x2019, // GetEOFGS { 0x2019, // GetEOFGS
new Param[] { PARAM_COUNT, REF_NUM, FILE_OFFSET } new Param[] { PARAM_COUNT, REF_NUM, FILE_OFFSET }
}, },
{ 0x2006, // GetFileInfoGS { 0x2006, // GetFileInfoGS
new Param[] { PARAM_COUNT, PATHNAME, ACCESS, FILE_TYPE, AUX_TYPE, STORAGE_TYPE, new Param[] { PARAM_COUNT, STRING_PTR, ACCESS, FILE_TYPE, AUX_TYPE, STORAGE_TYPE,
DATE_TIME, DATE_TIME, BUFFER, FILE_OFFSET, MISC4, FILE_OFFSET, MISC4 } DATE_TIME, DATE_TIME, BUF_PTR, FILE_OFFSET, MISC4, FILE_OFFSET, MISC4 }
}, },
{ 0x202b, // GetFSTInfoGS { 0x202b, // GetFSTInfoGS
new Param[] { PARAM_COUNT, MISC2, MISC2, PATHNAME, MISC2, MISC2, MISC2, new Param[] { PARAM_COUNT, MISC2, MISC2, STRING_PTR, MISC2, MISC2, MISC2,
MISC4, MISC4} MISC4, MISC4}
}, },
{ 0x201b, // GetLevelGS { 0x201b, // GetLevelGS
new Param[] { PARAM_COUNT, MISC2 } new Param[] { PARAM_COUNT, MISC2, MISC2 }
}, },
{ 0x2017, // GetMarkGS { 0x2017, // GetMarkGS
new Param[] { PARAM_COUNT, REF_NUM, FILE_OFFSET } new Param[] { PARAM_COUNT, REF_NUM, FILE_OFFSET }
}, },
{ 0x2027, // GetNameGS { 0x2027, // GetNameGS
new Param[] { PARAM_COUNT, BUFFER } new Param[] { PARAM_COUNT, BUF_PTR, MISC2 }
}, },
{ 0x200a, // GetPrefixGS { 0x200a, // GetPrefixGS
new Param[] { PARAM_COUNT, MISC2, PATHNAME } new Param[] { PARAM_COUNT, MISC2, STRING_PTR }
}, },
{ 0x2039, // GetRefInfoGS { 0x2039, // GetRefInfoGS
new Param[] { PARAM_COUNT, REF_NUM, ACCESS, PATHNAME } new Param[] { PARAM_COUNT, REF_NUM, ACCESS, STRING_PTR, MISC2, MISC2 }
}, },
{ 0x2038, // GetRefNumGS { 0x2038, // GetRefNumGS
new Param[] { PARAM_COUNT, PATHNAME, REF_NUM, ACCESS, MISC2, MISC2, MISC2 } new Param[] { PARAM_COUNT, STRING_PTR, REF_NUM, ACCESS, MISC2, MISC2, MISC2 }
}, },
{ 0x2037, // GetStdRefNumGS { 0x2037, // GetStdRefNumGS
new Param[] { PARAM_COUNT, MISC2, REF_NUM } new Param[] { PARAM_COUNT, MISC2, REF_NUM }
@ -183,25 +307,28 @@ namespace RuntimeData.Apple {
{ 0x202a, // GetVersionGS { 0x202a, // GetVersionGS
new Param[] { PARAM_COUNT, MISC2 } new Param[] { PARAM_COUNT, MISC2 }
}, },
{ 0x2007, // JudgeNameGS
new Param[] { PARAM_COUNT, MISC2, MISC2, BUF_PTR, MISC2, STRING_PTR, MISC2 }
},
{ 0x2011, // NewLine { 0x2011, // NewLine
new Param[] { PARAM_COUNT, REF_NUM, MISC2, MISC2, BUFFER } new Param[] { PARAM_COUNT, REF_NUM, MISC2, MISC2, BUF_PTR }
}, },
{ 0x200d, // NullGS { 0x200d, // NullGS
new Param[] { PARAM_COUNT } new Param[] { PARAM_COUNT }
}, },
{ 0x2010, // OpenGS { 0x2010, // OpenGS
new Param[] { PARAM_COUNT, REF_NUM, PATHNAME, ACCESS, MISC2, ACCESS, FILE_TYPE, new Param[] { PARAM_COUNT, REF_NUM, STRING_PTR, ACCESS, MISC2, ACCESS, FILE_TYPE,
AUX_TYPE, STORAGE_TYPE, DATE_TIME, DATE_TIME, BUFFER, FILE_OFFSET, MISC4, AUX_TYPE, STORAGE_TYPE, DATE_TIME, DATE_TIME, BUF_PTR, FILE_OFFSET, MISC4,
FILE_OFFSET, MISC4 } FILE_OFFSET, MISC4 }
}, },
{ 0x2003, // OSShutdownGS { 0x2003, // OSShutdownGS
new Param[] { PARAM_COUNT, MISC2 } new Param[] { PARAM_COUNT, MISC2 }
}, },
{ 0x2029, // QuitGS { 0x2029, // QuitGS
new Param[] { PARAM_COUNT, PATHNAME, MISC2 } new Param[] { PARAM_COUNT, STRING_PTR, MISC2 }
}, },
{ 0x2012, // ReadGS { 0x2012, // ReadGS
new Param[] { PARAM_COUNT, REF_NUM, BUFFER, MISC4, MISC4, MISC2 } new Param[] { PARAM_COUNT, REF_NUM, BUF_PTR, MISC4, MISC4, MISC2 }
}, },
{ 0x2026, // ResetCacheGS { 0x2026, // ResetCacheGS
new Param[] { PARAM_COUNT } new Param[] { PARAM_COUNT }
@ -213,17 +340,20 @@ namespace RuntimeData.Apple {
new Param[] { PARAM_COUNT, REF_NUM, MISC2, FILE_OFFSET } new Param[] { PARAM_COUNT, REF_NUM, MISC2, FILE_OFFSET }
}, },
{ 0x2005, // SetFileInfoGS { 0x2005, // SetFileInfoGS
new Param[] { PARAM_COUNT, PATHNAME, ACCESS, FILE_TYPE, AUX_TYPE, MISC2, new Param[] { PARAM_COUNT, STRING_PTR, ACCESS, FILE_TYPE, AUX_TYPE, MISC2,
DATE_TIME, DATE_TIME, BUFFER, MISC4, MISC4, MISC4, MISC4 } DATE_TIME, DATE_TIME, BUF_PTR, MISC4, MISC4, MISC4, MISC4 }
}, },
{ 0x201a, // SetLevelGS { 0x201a, // SetLevelGS
new Param[] { PARAM_COUNT, MISC2 } new Param[] { PARAM_COUNT, MISC2, MISC2 }
}, },
{ 0x2016, // SetMarkGS { 0x2016, // SetMarkGS
new Param[] { PARAM_COUNT, REF_NUM, MISC2, FILE_OFFSET } new Param[] { PARAM_COUNT, REF_NUM, MISC2, FILE_OFFSET }
}, },
{ 0x2009, // SetPrefixGS { 0x2009, // SetPrefixGS
new Param[] { PARAM_COUNT, MISC2, PATHNAME } new Param[] { PARAM_COUNT, MISC2, STRING_PTR }
},
{ 0x203a, // SetStdRefNumGS
new Param[] { PARAM_COUNT, MISC2, REF_NUM }
}, },
{ 0x200c, // SetSysPrefsGS { 0x200c, // SetSysPrefsGS
new Param[] { PARAM_COUNT, MISC2 } new Param[] { PARAM_COUNT, MISC2 }
@ -232,10 +362,11 @@ namespace RuntimeData.Apple {
new Param[] { PARAM_COUNT, MISC2 } new Param[] { PARAM_COUNT, MISC2 }
}, },
{ 0x2008, // VolumeGS { 0x2008, // VolumeGS
new Param[] { PARAM_COUNT, PATHNAME, PATHNAME, MISC4, MISC4, MISC2, MISC2 } new Param[] { PARAM_COUNT, STRING_PTR, STRING_PTR, MISC4, MISC4, MISC2, MISC2,
MISC2, MISC2}
}, },
{ 0x2013, // WriteGS { 0x2013, // WriteGS
new Param[] { PARAM_COUNT, REF_NUM, BUFFER, MISC4, MISC4, MISC2 } new Param[] { PARAM_COUNT, REF_NUM, BUF_PTR, MISC4, MISC4, MISC2 }
}, },
// TODO: ProDOS 16 calls // TODO: ProDOS 16 calls
@ -302,13 +433,13 @@ namespace RuntimeData.Apple {
mAppRef.SetInlineDataFormat(offset + 6, 4, DataType.NumericLE, mAppRef.SetInlineDataFormat(offset + 6, 4, DataType.NumericLE,
DataSubType.Address, null); DataSubType.Address, null);
// Try to format parameter block.
FormatParameterBlock(offset, req, blockAddr); FormatParameterBlock(offset, req, blockAddr);
// Try to format parameter block. // Check for P16_QUIT or QuitGS call.
if (req == 0x2029) { // QuitGS call if (req == 0x0029 || req == 0x2029) {
noContinue = true; noContinue = true;
} }
} }
} }
@ -319,6 +450,10 @@ namespace RuntimeData.Apple {
/// All "class 1" GS/OS calls have a parameter block that begins with a parameter /// All "class 1" GS/OS calls have a parameter block that begins with a parameter
/// count. The count indicates how many parameters are provided after the pCount /// count. The count indicates how many parameters are provided after the pCount
/// field. This is a field count, not a byte count, and may be zero. /// field. This is a field count, not a byte count, and may be zero.
///
/// Sometimes different calls will overlap, e.g GET_FILE_INFO and SET_FILE_INFO. This
/// is generally only done when the parameters line up, so I'm not expecting things
/// to come out weird, but it's possible.
/// </remarks> /// </remarks>
private void FormatParameterBlock(int offset, int req, int blockAddr) { private void FormatParameterBlock(int offset, int req, int blockAddr) {
Param[] parms; Param[] parms;
@ -327,19 +462,25 @@ namespace RuntimeData.Apple {
return; return;
} }
// Confirm we can at least get the parameter count.
int blockOff = mAddrTrans.AddressToOffset(offset, blockAddr); int blockOff = mAddrTrans.AddressToOffset(offset, blockAddr);
if (!Util.IsInBounds(mFileData, blockOff, 2)) {
return;
}
int pCount = Util.GetWord(mFileData, blockOff, 2, false);
if (pCount >= parms.Length) {
// Might be uninitialized data. Whatever the case, it's not something we
// can deal with.
return;
}
int paramCount = pCount + 1; // add 1 for pCount itself int paramCount;
if (req < 0x0100) {
// ProDOS-16 parameter blocks are fixed-length.
paramCount = parms.Length;
} else {
// Confirm we can at least get the parameter count.
if (!Util.IsInBounds(mFileData, blockOff, 2)) {
return;
}
int pCount = Util.GetWord(mFileData, blockOff, 2, false);
if (pCount >= parms.Length) {
// Might be an uninitialized value. Just format the pCount.
pCount = 1;
}
paramCount = pCount + 1; // add 1 for pCount itself
}
// Compute parameter block length in bytes. // Compute parameter block length in bytes.
int blockLen = 0; int blockLen = 0;

View File

@ -1,167 +1,172 @@
; Copyright 2018 faddenSoft. All Rights Reserved. ; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0). ; See the LICENSE.txt file for distribution terms (Apache 2.0).
; ;
; Source: GS/OS Reference Manual and Orca/M 2.0 assembler manual. ; Sources:
; GS/OS Reference Manual
; Orca/M 2.0 assembler manual
; NiftyList data file
*SYNOPSIS GS/OS public addresses and constants. *SYNOPSIS GS/OS public addresses and constants.
gsos_inline_ent @ $e100a8 ;GS/OS inline call entry point gsos_inline_ent @ $e100a8 4 ;GS/OS inline call entry point
gsos_stack_ent @ $e100b0 ;GS/OS stack call entry point gsos_stack_ent @ $e100b0 4 ;GS/OS stack call entry point
*TAG AppleIIgs-GSOS-Functions *TAG AppleIIgs-GSOS-Functions
; Class 0 ProDOS 16 calls. ; Class 0 ProDOS 16 calls.
P16_ALLOC_INTERRUPT = $0031 P16_ALLOC_INTERRUPT = $0031 ;(Int#,@Code)
P16_CHANGE_PATH = $0004 P16_CHANGE_PATH = $0004 ;(@Path1,@Path2)
P16_CLEAR_BACKUP_BIT = $000B P16_CLEAR_BACKUP_BIT = $000B ;(@Path)
P16_CLOSE = $0014 P16_CLOSE = $0014 ;(Ref)
P16_CREATE = $0001 P16_CREATE = $0001 ;(@Path,Acc,Typ,Aux/4,StT,CrD,CrT)
P16_DEALLOC_INTERTUPT = $0032 P16_DEALLOC_INTERTUPT = $0032 ;(Int#)
P16_DESTROY = $0002 P16_DESTROY = $0002 ;(@Path)
P16_D_INFO = $002C P16_D_INFO = $002C ;(Dev#,@DevName)
P16_ERASE_DISK = $0025 P16_ERASE_DISK = $0025 ;(@DevName,@VolName,fsID)
P16_EXPAND_PATH = $000E P16_EXPAND_PATH = $000E ;(@PathIn,@PathOut,Flags)
P16_FLUSH = $0015 P16_FLUSH = $0015 ;(Ref)
P16_FORMAT = $0024 P16_FORMAT = $0024 ;(@DevName,@VolName,fsID)
P16_GET_BOOT_VOL = $0028 P16_GET_BOOT_VOL = $0028 ;(@Buff)
P16_GET_DEV_NUM = $0020 P16_GET_DEV_NUM = $0020 ;(@DevName,Dev#)
P16_GET_DIR_ENTRY = $001C P16_GET_DIR_ENTRY = $001C ;(Ref#,z,Bs,Dis,@Bf,dEnt/36)
P16_GET_EOF = $0019 P16_GET_EOF = $0019 ;(Ref,EOF/4)
P16_GET_FILE_INFO = $0006 P16_GET_FILE_INFO = $0006 ;(@P,a,t,xt/4,s,cDT,mDT,b/4)
P16_GET_LAST_DEV = $0021 P16_GET_LAST_DEV = $0021 ;(Dev#)
P16_GET_LEVEL = $001B P16_GET_LEVEL = $001B ;(Level)
P16_GET_MARK = $0017 P16_GET_MARK = $0017 ;(Ref,Pos/4)
P16_GET_NAME = $0027 P16_GET_NAME = $0027 ;(@Buff)
P16_GET_PREFIX = $000A P16_GET_PREFIX = $000A ;(Pfx#,@Buff)
P16_GET_VERSION = $002A P16_GET_VERSION = $002A ;(Version)
P16_NEWLINE = $0011 P16_NEWLINE = $0011 ;(Ref,Mask,Char)
P16_OPEN = $0010 P16_OPEN = $0010 ;(Ref,@Path,xxx/4)
P16_QUIT = $0029 P16_QUIT = $0029 ;(@Path,Flags)
P16_READ = $0012 P16_READ = $0012 ;(Ref,@Where,Count/4,xfCount/4)
P16_READ_BLOCK = $0022 P16_READ_BLOCK = $0022 ;(Dev#,@Where,Blk#/4)
P16_SET_EOF = $0018 P16_SET_EOF = $0018 ;(Ref,EOF/4)
P16_SET_FILE_INFO = $0005 P16_SET_FILE_INFO = $0005 ;(@P,a,t,xt/4,z,cD,cT,mD,mT)
P16_SET_LEVEL = $001A P16_SET_LEVEL = $001A ;(Level)
P16_SET_MARK = $0016 P16_SET_MARK = $0016 ;(Ref,Pos/4)
P16_SET_PREFIX = $0009 P16_SET_PREFIX = $0009 ;(Pfx#,@Prefix)
P16_VOLUME = $0008 P16_VOLUME = $0008 ;(@DevN,@VolN,Blks/4,FreeBlks/4,fsID)
P16_WRITE = $0013 P16_WRITE = $0013 ;(Ref,@Where,Count/4,xfCount/4)
P16_WRITE_BLOCK = $0023 P16_WRITE_BLOCK = $0023 ;(Dev#,@Where,Blk#/4)
; Class 1 GS/OS calls. Names match the macros defined in Orca/M's M16.GSOS ; Class 1 GS/OS calls. Names match the macros defined in Orca/M's M16.GSOS
; (i.e. they all end with "GS" except for FSTSpecific). ; (i.e. they all end with "GS" except for FSTSpecific).
AddNotifyProcGS = $2034 AddNotifyProcGS = $2034 ;(1:@proc)
BeginSessionGS = $201D BeginSessionGS = $201D ;(0:)
BindIntGS = $2031 BindIntGS = $2031 ;(3:IntNum,VecRefNum,@handler)
ChangePathGS = $2004 ChangePathGS = $2004 ;(2-3:@P1,@P2,TrustMeFlag)
ClearBackupBitGS = $200B ClearBackupBitGS = $200B ;(1:@P)
CloseGS = $2014 CloseGS = $2014 ;(1:ref)
CreateGS = $2001 CreateGS = $2001 ;(1-7:@P,Acc,Typ,Aux/4,Stg,EOF/4,rEOF/4)
DControlGS = $202E DControlGS = $202E ;(5:n,code,@ctlList,count/4,xfer/4)
DelNotifyProcGS = $2035 DelNotifyProcGS = $2035 ;(1:@proc)
DestroyGS = $2002 DestroyGS = $2002 ;(1:@P)
DInfoGS = $202C DInfoGS = $202C ;(2-10:n,@n,chr,B/4,sl,unit,ver,dTyp,@hd,@nx)
DReadGS = $202F DReadGS = $202F ;(6:n,@bf,count/4,blk/4,blkSz,xfer/4)
DRenameGS = $2036 DRenameGS = $2036 ;(2:n,@newName)
DStatusGS = $202D DStatusGS = $202D ;(5:n,statusReq,@statList,count/4,xfer/4)
DWriteGS = $2030 DWriteGS = $2030 ;(6:n,@bf,count/4,blk/4,blkSz,xfer/4)
EndSessionGS = $201E EndSessionGS = $201E ;(0:)
EraseDiskGS = $2025 EraseDiskGS = $2025 ;(1-6:@DevN,@VolN,gotFS,wantFS,flags,realVolName)
ExpandPathGS = $200E ExpandPathGS = $200E ;(2-3:@InPath,@OutPath,UpcaseFlg)
FlushGS = $2015 FlushGS = $2015 ;(1-2:ref,flags)
FormatGS = $2024 FormatGS = $2024 ;(1-6:@DevN,@VolN,gotFS,wantFS,flags,realVolName)
FSTSpecific = $2033 FSTSpecific = $2033 ;(2+...)
GetBootVolGS = $2028 GetBootVolGS = $2028 ;(1:@n)
GetDevNumberGS = $2020 GetDevNumberGS = $2020 ;(2:@DevN,devnum)
GetDirEntryGS = $201C GetDirEntryGS = $201C ;(5-17:rf,fl,bs,ds,@n,n,T,EOF/4,b/4,c/8,m/8,A,X/4,FS,@o,resEOF/4,resBk/4)
GetEOFGS = $2019 GetEOFGS = $2019 ;(2:ref,eof/4)
GetFileInfoGS = $2006 GetFileInfoGS = $2006 ;(2-12:@P,A,T,X/4,S,c/8,m/8,@Opt,EOF/4,B/4,rEOF/4,rB/4)
GetFSTInfoGS = $202B GetFSTInfoGS = $202B ;(2-7:n,fs,@n,ver,attr,bSz,mxV/4,mxF/4)
GetLevelGS = $201B GetLevelGS = $201B ;(1-2:level,levelMode)
GetMarkGS = $2017 GetMarkGS = $2017 ;(2:ref,pos/4)
GetNameGS = $2027 GetNameGS = $2027 ;(1:@n)
GetPrefixGS = $200A GetPrefixGS = $200A ;(2:pfxNum,@Pfx)
GetRefInfoGS = $2039 GetRefInfoGS = $2039 ;(2-5:ref,acc,@path,resNum,level)
GetRefNumGS = $2038 GetRefNumGS = $2038 ;(2-6:@path,ref,acc,res,case,disp)
GetStdRefNumGS = $2037 GetStdRefNumGS = $2037 ;(2:pfxNum,refNum)
GetSysPrefsGS = $200F GetSysPrefsGS = $200F ;(1:prefs)
GetVersionGS = $202A GetVersionGS = $202A ;(1:version)
NewLineGS = $2011 JudgeNameGS = $2007 ;(3-6:fileSysID,Descr,@Rules,MaxLen,@Path,Result)
NullGS = $200D NewLineGS = $2011 ;(4:ref,ANDmask,NumChars,@NLtable)
OpenGS = $2010 NullGS = $200D ;(0:)
OSShutdownGS = $2003 OpenGS = $2010 ;(2-15:ref,@P,Acc,fork,gotAcc,+GET_FILE_INFO)
QuitGS = $2029 OSShutdownGS = $2003 ;(1:Flags)
ReadGS = $2012 QuitGS = $2029 ;(0-2:@P,flags)
ResetCacheGS = $2026 ReadGS = $2012 ;(4-5:ref,@buff,count/4,xfer/4,cacheFlg)
SessionStatusGS = $201F ResetCacheGS = $2026 ;(0:)
SetEOFGS = $2018 SessionStatusGS = $201F ;(1:status)
SetFileInfoGS = $2005 SetEOFGS = $2018 ;(3:ref,base,displ/4)
SetLevelGS = $201A SetFileInfoGS = $2005 ;(2-12:@P,A,T,X/4,,c/8,m/8,@Opt,,,,)
SetMarkGS = $2016 SetLevelGS = $201A ;(1-2:level,levelMode)
SetPrefixGS = $2009 SetMarkGS = $2016 ;(3:ref,base,displ/4)
SetSysPrefsGS = $200C SetPrefixGS = $2009 ;(1-2:pfxNum,@Pfx)
UnbindIntGS = $2032 SetStdRefNum = $203a ;(2:pfxNum,refNum)
VolumeGS = $2008 SetSysPrefsGS = $200C ;(1:prefs)
WriteGS = $2013 UnbindIntGS = $2032 ;(1:IntNum)
VolumeGS = $2008 ;(2-8:@DevN,@vnOut,blks/4,free/4,fSys,BlkSz,char,devID)
WriteGS = $2013 ;(4-5:ref,@buff,count/4,xfer/4,cacheFlg)
; Orca shell calls. These are used just like GS/OS calls. See chapter 24 ; Shell calls. These are used just like GS/OS calls. See chapter 24
; in the Orca/M 2.0 manual and M16.Shell. ; in the Orca/M 2.0 manual and M16.Shell.
OSH_ChangeVector = $010C SH_ChangeVector = $010C
OSH_ConsoleOut = $011A SH_ConsoleOut = $011A
OSH_Direction = $010F SH_Direction = $010F
OSH_Error = $0105 SH_Error = $0105
OSH_Execute = $010D SH_Execute = $010D
OSH_ExpandDevices = $0114 SH_ExpandDevices = $0114
OSH_Export = $0116 SH_Export = $0116
OSH_FastFile = $010E SH_FastFile = $010E
OSH_GetCommand = $011D SH_GetCommand = $011D
OSH_GetIODevices = $011C SH_GetIODevices = $011C
OSH_GetLang = $0103 SH_GetLang = $0103
OSH_GetLInfo = $0101 SH_GetLInfo = $0101
OSH_InitWildcard = $0109 SH_InitWildcard = $0109
OSH_Keypress = $011E SH_Keypress = $011E
OSH_NextWildcard = $010A SH_NextWildcard = $010A
OSH_PopVariables = $0117 SH_PopVariables = $0117
OSH_PushVariables = $0118 SH_PushVariables = $0118
OSH_ReadIndexed = $0108 SH_ReadIndexed = $0108
OSH_ReadKey = $011f SH_ReadKey = $011f
OSH_ReadVariable = $010B SH_ReadVariable = $010B
OSH_Redirect = $0110 SH_Redirect = $0110
OSH_Set = $0106 SH_Set = $0106
OSH_SetIODevices = $011B SH_SetIODevices = $011B
OSH_SetLang = $0104 SH_SetLang = $0104
OSH_SetLInfo = $0102 SH_SetLInfo = $0102
OSH_SetStopFlag = $0119 SH_SetStopFlag = $0119
OSH_Stop = $0113 SH_Stop = $0113
OSH_UnsetVariable = $0115 SH_UnsetVariable = $0115
OSH_Version = $0107 SH_Version = $0107
OSH_ChangeVectorGS = $014C SH_ChangeVectorGS = $014C
OSH_ConsoleOutGS = $015A SH_ConsoleOutGS = $015A
OSH_DirectionGS = $014F SH_DirectionGS = $014F
OSH_ErrorGS = $0145 SH_ErrorGS = $0145
OSH_ExecuteGS = $014D SH_ExecuteGS = $014D
OSH_ExpandDevicesGS = $0154 SH_ExpandDevicesGS = $0154
OSH_ExportGS = $0156 SH_ExportGS = $0156
OSH_FastFileGS = $014E SH_FastFileGS = $014E
OSH_GetCommandGS = $015D SH_GetCommandGS = $015D
OSH_GetIODevicesGS = $015C SH_GetIODevicesGS = $015C
OSH_GetLangGS = $0143 SH_GetLangGS = $0143
OSH_GetLInfoGS = $0141 SH_GetLInfoGS = $0141
OSH_InitWildcardGS = $0149 SH_InitWildcardGS = $0149
OSH_KeypressGS = $015E SH_KeypressGS = $015E
OSH_NextWildcardGS = $014A SH_NextWildcardGS = $014A
OSH_PopVariablesGS = $0157 SH_PopVariablesGS = $0157
OSH_PushVariablesGS = $0158 SH_PushVariablesGS = $0158
OSH_ReadIndexedGS = $0148 SH_ReadIndexedGS = $0148
OSH_ReadKeyGS = $015f SH_ReadKeyGS = $015f
OSH_ReadVariableGS = $014B SH_ReadVariableGS = $014B
OSH_RedirectGS = $0150 SH_RedirectGS = $0150
OSH_SetGS = $0146 SH_SetGS = $0146
OSH_SetIODevicesGS = $015B SH_SetIODevicesGS = $015B
OSH_SetLangGS = $0144 SH_SetLangGS = $0144
OSH_SetLInfoGS = $0142 SH_SetLInfoGS = $0142
OSH_SetStopFlagGS = $0159 SH_SetStopFlagGS = $0159
OSH_StopGS = $0153 SH_StopGS = $0153
OSH_UnsetVariableGS = $0155 SH_UnsetVariableGS = $0155
OSH_VersionGS = $0147 SH_VersionGS = $0147

View File

@ -29,6 +29,9 @@ parm_block
*/ */
namespace RuntimeData.Apple { namespace RuntimeData.Apple {
/// <summary>
/// Identify and format ProDOS-8 system calls.
/// </summary>
public class ProDOS8 : MarshalByRefObject, IPlugin, IPlugin_SymbolList, IPlugin_InlineJsr { public class ProDOS8 : MarshalByRefObject, IPlugin, IPlugin_SymbolList, IPlugin_InlineJsr {
private const string P8_MLI_TAG = "ProDOS8-MLI-Functions"; // tag used in .sym65 file private const string P8_MLI_TAG = "ProDOS8-MLI-Functions"; // tag used in .sym65 file
private bool VERBOSE = false; private bool VERBOSE = false;

View File

@ -4,6 +4,7 @@
; Sources: ; Sources:
; Beneath Apple ProDOS ; Beneath Apple ProDOS
; ProDOS 8 Technical Reference Manual ; ProDOS 8 Technical Reference Manual
; NiftyList data file
*SYNOPSIS ProDOS 8 public addresses and constants. *SYNOPSIS ProDOS 8 public addresses and constants.
@ -13,34 +14,34 @@
; ;
*TAG ProDOS8-MLI-Functions *TAG ProDOS8-MLI-Functions
P8_ALLOC_INTERRUPT = $40 P8_ALLOC_INTERRUPT = $40 ;(2:IntNum/1,CodePtr)
P8_DEALLOC_INTERRUPT = $41 P8_DEALLOC_INTERRUPT = $41 ;(1:IntNum/1)
P8_QUIT = $65 P8_QUIT = $65 ;(4:Type/1,Path,zz/1,zz)
P8_READ_BLOCK = $80 P8_READ_BLOCK = $80 ;(3:Unit/1,Buff,BlkNum)
P8_WRITE_BLOCK = $81 P8_WRITE_BLOCK = $81 ;(3:Unit/1,Buff,BlkNum)
P8_GET_TIME = $82 P8_GET_TIME = $82 ;()
P8_CREATE = $C0 P8_CREATE = $C0 ;(7:pn,acc/1,type/1,aux,stt/1,cD,cT)
P8_DESTROY = $C1 P8_DESTROY = $C1 ;(1:pn)
P8_RENAME = $C2 P8_RENAME = $C2 ;(2:pn1,pn2)
P8_SET_FILE_INFO = $C3 P8_SET_FILE_INFO = $C3 ;(7:pn,a/1,t/1,aux,nul/3,mD,mT)
P8_GET_FILE_INFO = $C4 P8_GET_FILE_INFO = $C4 ;(10:pn,a/1,t/1,x,s/1,b,mDTcDT)
P8_ONLINE = $C5 P8_ONLINE = $C5 ;(2:UnitNum/1,Buff)
P8_SET_PREFIX = $C6 P8_SET_PREFIX = $C6 ;(1:pn)
P8_GET_PREFIX = $C7 P8_GET_PREFIX = $C7 ;(1:Buff)
P8_OPEN = $C8 P8_OPEN = $C8 ;(3:pn,ioBuff,Ref/1)
P8_NEWLINE = $C9 P8_NEWLINE = $C9 ;(3:Ref/1,Mask/1,Char/1)
P8_READ = $CA P8_READ = $CA ;(4:Ref/1,Where,reqCount,xfrCount)
P8_WRITE = $CB P8_WRITE = $CB ;(4:Ref/1,Where,reqCount,xfrCount)
P8_CLOSE = $CC P8_CLOSE = $CC ;(1:Ref/1)
P8_FLUSH = $CD P8_FLUSH = $CD ;(1:Ref/1)
P8_SET_MARK = $CE P8_SET_MARK = $CE ;(2:Ref/1,Position/3)
P8_GET_MARK = $CF P8_GET_MARK = $CF ;(2:Ref/1,Position/3)
P8_SET_EOF = $D0 P8_SET_EOF = $D0 ;(2:Ref/1,Position/3)
P8_GET_EOF = $D1 P8_GET_EOF = $D1 ;(2:Ref/1,Position/3)
P8_SET_BUF = $D2 P8_SET_BUF = $D2 ;(2:Ref/1,ioBuff)
P8_GET_BUF = $D3 P8_GET_BUF = $D3 ;(2:Ref/1,ioBuff)
*TAG *TAG