diff --git a/AssemblerWarnings.Groups.cs b/AssemblerWarnings.Groups.cs index 404d25e..717c62f 100644 --- a/AssemblerWarnings.Groups.cs +++ b/AssemblerWarnings.Groups.cs @@ -382,11 +382,11 @@ public partial class AssemblerWarnings { new Opcode(0x06, 0x72), new[] { 1 } }, // FSYS_GMT reg, adr { new Opcode(0x06, 0x74), new[] { 1 } }, // FSYS_GAT reg, adr { new Opcode(0x06, 0x80), new[] { 0 } }, // FSYS_SCT adr, reg - { new Opcode(0x06, 0x82), new[] { 0 } }, // FSYS_SCT adr, lit + { new Opcode(0x06, 0x81), new[] { 0 } }, // FSYS_SCT adr, lit { new Opcode(0x06, 0x84), new[] { 0 } }, // FSYS_SMT adr, reg - { new Opcode(0x06, 0x86), new[] { 0 } }, // FSYS_SMT adr, lit + { new Opcode(0x06, 0x85), new[] { 0 } }, // FSYS_SMT adr, lit { new Opcode(0x06, 0x88), new[] { 0 } }, // FSYS_SAT adr, reg - { new Opcode(0x06, 0x8A), new[] { 0 } }, // FSYS_SAT adr, lit + { new Opcode(0x06, 0x89), new[] { 0 } }, // FSYS_SAT adr, lit { new Opcode(0x07, 0x22), new[] { 0 } }, // TERM_SCY adr { new Opcode(0x07, 0x26), new[] { 0 } }, // TERM_SCX adr @@ -452,11 +452,11 @@ public partial class AssemblerWarnings { new Opcode(0x06, 0x71), new[] { 1 } }, { new Opcode(0x06, 0x73), new[] { 1 } }, { new Opcode(0x06, 0x75), new[] { 1 } }, - { new Opcode(0x06, 0x81), new[] { 0 } }, + { new Opcode(0x06, 0x82), new[] { 0 } }, { new Opcode(0x06, 0x83), new[] { 0 } }, - { new Opcode(0x06, 0x85), new[] { 0 } }, + { new Opcode(0x06, 0x86), new[] { 0 } }, { new Opcode(0x06, 0x87), new[] { 0 } }, - { new Opcode(0x06, 0x89), new[] { 0 } }, + { new Opcode(0x06, 0x8A), new[] { 0 } }, { new Opcode(0x06, 0x8B), new[] { 0 } }, { new Opcode(0x00, 0x86), new[] { 0 } }, @@ -741,11 +741,11 @@ public partial class AssemblerWarnings new Opcode(0x04, 0x32), // ASMX_CAL lit - new Opcode(0x06, 0x82), // FSYS_SCT adr, lit + new Opcode(0x06, 0x81), // FSYS_SCT adr, lit new Opcode(0x06, 0x83), // FSYS_SCT ptr, lit - new Opcode(0x06, 0x86), // FSYS_SMT adr, lit + new Opcode(0x06, 0x85), // FSYS_SMT adr, lit new Opcode(0x06, 0x87), // FSYS_SMT ptr, lit - new Opcode(0x06, 0x8A), // FSYS_SAT adr, lit + new Opcode(0x06, 0x89), // FSYS_SAT adr, lit new Opcode(0x06, 0x8B), // FSYS_SAT ptr, lit }; /// @@ -764,11 +764,11 @@ public partial class AssemblerWarnings new Opcode(0x01, 0x61), // SIGN_WFN lit new Opcode(0x01, 0x65), // SIGN_WFB lit - new Opcode(0x06, 0x82), // FSYS_SCT adr, lit + new Opcode(0x06, 0x81), // FSYS_SCT adr, lit new Opcode(0x06, 0x83), // FSYS_SCT ptr, lit - new Opcode(0x06, 0x86), // FSYS_SMT adr, lit + new Opcode(0x06, 0x85), // FSYS_SMT adr, lit new Opcode(0x06, 0x87), // FSYS_SMT ptr, lit - new Opcode(0x06, 0x8A), // FSYS_SAT adr, lit + new Opcode(0x06, 0x89), // FSYS_SAT adr, lit new Opcode(0x06, 0x8B), // FSYS_SAT ptr, lit }; /// diff --git a/Data.cs b/Data.cs index 40fdae0..dbc9400 100644 --- a/Data.cs +++ b/Data.cs @@ -791,20 +791,20 @@ public static class Data // FSYS_SCT (Set Creation Time of File or Directory) { ("FSYS_SCT", new OperandType[2] { OperandType.Address, OperandType.Register }), new Opcode(0x06, 0x80) }, - { ("FSYS_SCT", new OperandType[2] { OperandType.Pointer, OperandType.Register }), new Opcode(0x06, 0x81) }, - { ("FSYS_SCT", new OperandType[2] { OperandType.Address, OperandType.Literal }), new Opcode(0x06, 0x82) }, + { ("FSYS_SCT", new OperandType[2] { OperandType.Address, OperandType.Literal }), new Opcode(0x06, 0x81) }, + { ("FSYS_SCT", new OperandType[2] { OperandType.Pointer, OperandType.Register }), new Opcode(0x06, 0x82) }, { ("FSYS_SCT", new OperandType[2] { OperandType.Pointer, OperandType.Literal }), new Opcode(0x06, 0x83) }, // FSYS_SMT (Set Modification Time of File or Directory) { ("FSYS_SMT", new OperandType[2] { OperandType.Address, OperandType.Register }), new Opcode(0x06, 0x84) }, - { ("FSYS_SMT", new OperandType[2] { OperandType.Pointer, OperandType.Register }), new Opcode(0x06, 0x85) }, - { ("FSYS_SMT", new OperandType[2] { OperandType.Address, OperandType.Literal }), new Opcode(0x06, 0x86) }, + { ("FSYS_SMT", new OperandType[2] { OperandType.Address, OperandType.Literal }), new Opcode(0x06, 0x85) }, + { ("FSYS_SMT", new OperandType[2] { OperandType.Pointer, OperandType.Register }), new Opcode(0x06, 0x86) }, { ("FSYS_SMT", new OperandType[2] { OperandType.Pointer, OperandType.Literal }), new Opcode(0x06, 0x87) }, // FSYS_SAT (Set Access Time of File or Directory) { ("FSYS_SAT", new OperandType[2] { OperandType.Address, OperandType.Register }), new Opcode(0x06, 0x88) }, - { ("FSYS_SAT", new OperandType[2] { OperandType.Pointer, OperandType.Register }), new Opcode(0x06, 0x89) }, - { ("FSYS_SAT", new OperandType[2] { OperandType.Address, OperandType.Literal }), new Opcode(0x06, 0x8A) }, + { ("FSYS_SAT", new OperandType[2] { OperandType.Address, OperandType.Literal }), new Opcode(0x06, 0x89) }, + { ("FSYS_SAT", new OperandType[2] { OperandType.Pointer, OperandType.Register }), new Opcode(0x06, 0x8A) }, { ("FSYS_SAT", new OperandType[2] { OperandType.Pointer, OperandType.Literal }), new Opcode(0x06, 0x8B) }, #endif diff --git a/Processor.cs b/Processor.cs index bce720e..14aac0f 100644 --- a/Processor.cs +++ b/Processor.cs @@ -3785,16 +3785,16 @@ is not (ulong)StatusFlags.Sign and not (ulong)StatusFlags.Overflow) DateTime.UnixEpoch.AddSeconds((long)ReadMemoryRegister(operandStart + 8))); Registers[(int)Register.rpo] += 9; break; - case 0x1: // FSYS_SCT ptr, reg - File.SetCreationTimeUtc(ReadMemoryRegisterPointedString(operandStart, out byteCount), - DateTime.UnixEpoch.AddSeconds((long)ReadMemoryRegister(operandStart + byteCount))); - Registers[(int)Register.rpo] += byteCount + 1; - break; - case 0x2: // FSYS_SCT adr, lit + case 0x1: // FSYS_SCT adr, lit File.SetCreationTimeUtc(ReadMemoryPointedString(operandStart), DateTime.UnixEpoch.AddSeconds((long)ReadMemoryQWord(operandStart + 8))); Registers[(int)Register.rpo] += 16; break; + case 0x2: // FSYS_SCT ptr, reg + File.SetCreationTimeUtc(ReadMemoryRegisterPointedString(operandStart, out byteCount), + DateTime.UnixEpoch.AddSeconds((long)ReadMemoryRegister(operandStart + byteCount))); + Registers[(int)Register.rpo] += byteCount + 1; + break; case 0x3: // FSYS_SCT ptr, lit File.SetCreationTimeUtc(ReadMemoryRegisterPointedString(operandStart, out byteCount), DateTime.UnixEpoch.AddSeconds((long)ReadMemoryQWord(operandStart + byteCount))); @@ -3805,16 +3805,16 @@ is not (ulong)StatusFlags.Sign and not (ulong)StatusFlags.Overflow) DateTime.UnixEpoch.AddSeconds((long)ReadMemoryRegister(operandStart + 8))); Registers[(int)Register.rpo] += 9; break; - case 0x5: // FSYS_SMT ptr, reg - File.SetLastWriteTimeUtc(ReadMemoryRegisterPointedString(operandStart, out byteCount), - DateTime.UnixEpoch.AddSeconds((long)ReadMemoryRegister(operandStart + byteCount))); - Registers[(int)Register.rpo] += byteCount + 1; - break; - case 0x6: // FSYS_SMT adr, lit + case 0x5: // FSYS_SMT adr, lit File.SetLastWriteTimeUtc(ReadMemoryPointedString(operandStart), DateTime.UnixEpoch.AddSeconds((long)ReadMemoryQWord(operandStart + 8))); Registers[(int)Register.rpo] += 16; break; + case 0x6: // FSYS_SMT ptr, reg + File.SetLastWriteTimeUtc(ReadMemoryRegisterPointedString(operandStart, out byteCount), + DateTime.UnixEpoch.AddSeconds((long)ReadMemoryRegister(operandStart + byteCount))); + Registers[(int)Register.rpo] += byteCount + 1; + break; case 0x7: // FSYS_SMT ptr, lit File.SetLastWriteTimeUtc(ReadMemoryRegisterPointedString(operandStart, out byteCount), DateTime.UnixEpoch.AddSeconds((long)ReadMemoryQWord(operandStart + byteCount))); @@ -3825,16 +3825,16 @@ is not (ulong)StatusFlags.Sign and not (ulong)StatusFlags.Overflow) DateTime.UnixEpoch.AddSeconds((long)ReadMemoryRegister(operandStart + 8))); Registers[(int)Register.rpo] += 9; break; - case 0x9: // FSYS_SAT ptr, reg - File.SetLastAccessTimeUtc(ReadMemoryRegisterPointedString(operandStart, out byteCount), - DateTime.UnixEpoch.AddSeconds((long)ReadMemoryRegister(operandStart + byteCount))); - Registers[(int)Register.rpo] += byteCount + 1; - break; - case 0xA: // FSYS_SAT adr, lit + case 0x9: // FSYS_SAT adr, lit File.SetLastAccessTimeUtc(ReadMemoryPointedString(operandStart), DateTime.UnixEpoch.AddSeconds((long)ReadMemoryQWord(operandStart + 8))); Registers[(int)Register.rpo] += 16; break; + case 0xA: // FSYS_SAT ptr, reg + File.SetLastAccessTimeUtc(ReadMemoryRegisterPointedString(operandStart, out byteCount), + DateTime.UnixEpoch.AddSeconds((long)ReadMemoryRegister(operandStart + byteCount))); + Registers[(int)Register.rpo] += byteCount + 1; + break; case 0xB: // FSYS_SAT ptr, lit File.SetLastAccessTimeUtc(ReadMemoryRegisterPointedString(operandStart, out byteCount), DateTime.UnixEpoch.AddSeconds((long)ReadMemoryQWord(operandStart + byteCount))); diff --git a/Test/ProcessorTests/FullOpcodeTest.FileSystem.cs b/Test/ProcessorTests/FullOpcodeTest.FileSystem.cs index db2e7ad..06bb63d 100644 --- a/Test/ProcessorTests/FullOpcodeTest.FileSystem.cs +++ b/Test/ProcessorTests/FullOpcodeTest.FileSystem.cs @@ -963,7 +963,7 @@ public void FSYS_SCT_Pointer_Register() Processor testProcessor = new(2046); testProcessor.Registers[(int)Register.rg7] = (ulong)randomTimestamp; testProcessor.Registers[(int)Register.rg8] = 0x140; - testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x81, (int)Register.rg8, (int)Register.rg7 }); + testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x82, (int)Register.rg8, (int)Register.rg7 }); testProcessor.WriteMemoryString(0x140, "copyfile"); _ = testProcessor.Execute(false); Assert.AreEqual(randomTimestamp, (int)(File.GetCreationTimeUtc("copyfile") - DateTime.UnixEpoch).TotalSeconds, "Instruction did not produce correct result"); @@ -982,7 +982,7 @@ public void FSYS_SCT_Address_Literal() int randomTimestamp = rng.Next(int.MinValue, int.MaxValue); Processor testProcessor = new(2046); - testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x82, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); + testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x81, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); testProcessor.WriteMemoryQWord(11, (ulong)randomTimestamp); testProcessor.WriteMemoryString(0x140, "copyfile"); _ = testProcessor.Execute(false); @@ -1035,7 +1035,7 @@ public void FSYS_SMT_Pointer_Register() Processor testProcessor = new(2046); testProcessor.Registers[(int)Register.rg7] = (ulong)randomTimestamp; testProcessor.Registers[(int)Register.rg8] = 0x140; - testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x85, (int)Register.rg8, (int)Register.rg7 }); + testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x86, (int)Register.rg8, (int)Register.rg7 }); testProcessor.WriteMemoryString(0x140, "copyfile"); _ = testProcessor.Execute(false); Assert.AreEqual(randomTimestamp, (int)(File.GetLastWriteTimeUtc("copyfile") - DateTime.UnixEpoch).TotalSeconds, "Instruction did not produce correct result"); @@ -1049,7 +1049,7 @@ public void FSYS_SMT_Address_Literal() int randomTimestamp = rng.Next(int.MinValue, int.MaxValue); Processor testProcessor = new(2046); - testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x86, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); + testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x85, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); testProcessor.WriteMemoryQWord(11, (ulong)randomTimestamp); testProcessor.WriteMemoryString(0x140, "copyfile"); _ = testProcessor.Execute(false); @@ -1097,7 +1097,7 @@ public void FSYS_SAT_Pointer_Register() Processor testProcessor = new(2046); testProcessor.Registers[(int)Register.rg7] = (ulong)randomTimestamp; testProcessor.Registers[(int)Register.rg8] = 0x140; - testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x89, (int)Register.rg8, (int)Register.rg7 }); + testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x8A, (int)Register.rg8, (int)Register.rg7 }); testProcessor.WriteMemoryString(0x140, "copyfile"); _ = testProcessor.Execute(false); Assert.AreEqual(randomTimestamp, (int)(File.GetLastAccessTimeUtc("copyfile") - DateTime.UnixEpoch).TotalSeconds, "Instruction did not produce correct result"); @@ -1111,7 +1111,7 @@ public void FSYS_SAT_Address_Literal() int randomTimestamp = rng.Next(int.MinValue, int.MaxValue); Processor testProcessor = new(2046); - testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x8A, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); + testProcessor.LoadProgram(new byte[] { 0xFF, 0x06, 0x89, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); testProcessor.WriteMemoryQWord(11, (ulong)randomTimestamp); testProcessor.WriteMemoryString(0x140, "copyfile"); _ = testProcessor.Execute(false);