From 1971b47786e4cad6278b3abfb6984b49693b5294 Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Fri, 26 Jul 2024 04:08:19 -0700 Subject: [PATCH 01/10] adds pow square --- src/instructions.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/instructions.rs b/src/instructions.rs index b82826a..87dbda2 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -489,6 +489,8 @@ instructions! { 0x160 = SpliceTextChar, 0x161 = RgbEx, // Used when the color space for rgb() cannot be found to be COLORSPACE_RGB at compile-time 0x162 = Rgb2Num, // This is technically a replacement for the original Rgb2Num which is somewhere else + // 0x163 .. 0x172 + 0x173 = PowSquare, // Optimization whenever ** 2 is used. 0x1337 = AuxtoolsDebugBreak, 0x1338 = AuxtoolsDebugBreakNop, From 2f285481f923f57a10066c627a21e3537bc05ed9 Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Fri, 26 Jul 2024 05:02:44 -0700 Subject: [PATCH 02/10] nan and inf instructions --- src/instructions.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/instructions.rs b/src/instructions.rs index 87dbda2..3ce52e9 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -489,7 +489,10 @@ instructions! { 0x160 = SpliceTextChar, 0x161 = RgbEx, // Used when the color space for rgb() cannot be found to be COLORSPACE_RGB at compile-time 0x162 = Rgb2Num, // This is technically a replacement for the original Rgb2Num which is somewhere else - // 0x163 .. 0x172 + // 0x163 .. 0x16B + 0x16C = NumIsNaN, + 0x16D = NumIsInf, + // 0x16F .. 0x172 0x173 = PowSquare, // Optimization whenever ** 2 is used. 0x1337 = AuxtoolsDebugBreak, From 7c97920ca17a6e5adbd103a7805591addcb5f7cb Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Fri, 24 Jan 2025 18:02:38 -0800 Subject: [PATCH 03/10] new access modifier and other instructions --- src/access_modifiers.rs | 4 +++- src/instructions.rs | 17 +++++++++++++---- src/operands.rs | 10 ++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/access_modifiers.rs b/src/access_modifiers.rs index e97f3f4..af903f9 100644 --- a/src/access_modifiers.rs +++ b/src/access_modifiers.rs @@ -45,8 +45,10 @@ access_modifiers! { // UnkFFEA = 0xFFEA, // UnkFFEB = 0xFFEB, // UnkFFEC = 0xFFEC, + // UnkFFED = 0xFFED, + PtrRef = 0xFFEF, } pub fn is_access_modifier(value: u32) -> bool { - value >= 0xFFCD && value <= 0xFFEC + value >= 0xFFCD && value <= 0xFFEF } diff --git a/src/instructions.rs b/src/instructions.rs index 3ce52e9..46f4ee2 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -489,11 +489,20 @@ instructions! { 0x160 = SpliceTextChar, 0x161 = RgbEx, // Used when the color space for rgb() cannot be found to be COLORSPACE_RGB at compile-time 0x162 = Rgb2Num, // This is technically a replacement for the original Rgb2Num which is somewhere else - // 0x163 .. 0x16B - 0x16C = NumIsNaN, - 0x16D = NumIsInf, - // 0x16F .. 0x172 + // 0x163 .. 0x168 + 0x169 = Ceil, + 0x16A = Trunc, + 0x16B = Fract, + 0x16C = IsNaN, + 0x16D = IsInf, + 0x16E = TrimText, + // 0x16F .. 0x171 + 0x172 = NoiseHash, 0x173 = PowSquare, // Optimization whenever ** 2 is used. + // 0x174 + 0x175 = GetStepsTo, + // 0x176 .. 0x177 + 0x178 = RefCount, 0x1337 = AuxtoolsDebugBreak, 0x1338 = AuxtoolsDebugBreakNop, diff --git a/src/operands.rs b/src/operands.rs index a75db28..28ba9b2 100644 --- a/src/operands.rs +++ b/src/operands.rs @@ -700,6 +700,7 @@ pub enum Variable { DynamicVerb(DMString), StaticProc(Proc), DynamicProc(DMString), + PtrRef(Box), //RuntimeProcField(Box, Vec, DMString), } @@ -789,6 +790,10 @@ impl Operand for Variable { asm.emit(access_modifiers::StaticVerb); proc.assemble(asm)?; } + Variable::PtrRef(var) => { + asm.emit(access_modifiers::PtrRef); + var.assemble(asm)?; + } } Ok(()) @@ -845,6 +850,7 @@ impl Operand for Variable { access_modifiers::DynamicVerb => Variable::DynamicVerb(DMString::disassemble(dism)?), access_modifiers::StaticProc => Variable::StaticProc(Proc::disassemble(dism)?), access_modifiers::StaticVerb => Variable::StaticVerb(Proc::disassemble(dism)?), + access_modifiers::PtrRef => Variable::PtrRef(Box::new(Variable::disassemble(dism)?)), other => { return Err(DisassembleError::UnknownAccessModifier { @@ -924,6 +930,10 @@ impl Operand for Variable { proc.serialize(f)?; write!(f, ")") } + Variable::PtrRef(var) => { + write!(f, "&")?; + var.serialize(f) + } } } } From a231d6537e8ab04342e8a4dad406605169fd5dcc Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Fri, 24 Jan 2025 18:21:29 -0800 Subject: [PATCH 04/10] instruction gambit --- src/instructions.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/instructions.rs b/src/instructions.rs index 46f4ee2..1e81ba4 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -496,12 +496,15 @@ instructions! { 0x16C = IsNaN, 0x16D = IsInf, 0x16E = TrimText, - // 0x16F .. 0x171 + 0x16F = FTime, + 0x170 = BlockXYZ, + // 0x171 0x172 = NoiseHash, - 0x173 = PowSquare, // Optimization whenever ** 2 is used. - // 0x174 + 0x173 = PowSquare, // Optimization whenever x ** 2 or x ** x is used. + 0x174 = PowNegativeOne, // Optimization whenever x ** -1 is used. 0x175 = GetStepsTo, - // 0x176 .. 0x177 + 0x176 = FloatMod, + 0x177 = AugFloatMod(var: Variable), 0x178 = RefCount, 0x1337 = AuxtoolsDebugBreak, From f340a6622e25fa67bf3bf280be894fb0cd51dc96 Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Fri, 24 Jan 2025 18:28:38 -0800 Subject: [PATCH 05/10] json flag instructions --- src/instructions.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/instructions.rs b/src/instructions.rs index 1e81ba4..2a7dc49 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -489,7 +489,9 @@ instructions! { 0x160 = SpliceTextChar, 0x161 = RgbEx, // Used when the color space for rgb() cannot be found to be COLORSPACE_RGB at compile-time 0x162 = Rgb2Num, // This is technically a replacement for the original Rgb2Num which is somewhere else - // 0x163 .. 0x168 + // 0x163 .. 0x165 + 0x167 = JsonEncodeFlags, + 0x168 = JsonDecodeFlags, 0x169 = Ceil, 0x16A = Trunc, 0x16B = Fract, From a3b211c686b1313e643675feee357c5b823b00e3 Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Fri, 24 Jan 2025 19:03:03 -0800 Subject: [PATCH 06/10] add missile --- src/instructions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/instructions.rs b/src/instructions.rs index 2a7dc49..3ed64c5 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -121,7 +121,7 @@ instructions! { 0x08 = OutputFtp, 0x09 = OutputRun, // 0x0A - // 0x0B + 0x0B = Missile, 0x0C = Del, 0x0D = Test, 0x0E = Not, From 33726cdddfda5d04b5588b06a3c488b225e4fa8a Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Fri, 24 Jan 2025 20:49:46 -0800 Subject: [PATCH 07/10] pointer dereferencing --- src/access_modifiers.rs | 2 +- src/operands.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/access_modifiers.rs b/src/access_modifiers.rs index af903f9..1922493 100644 --- a/src/access_modifiers.rs +++ b/src/access_modifiers.rs @@ -16,7 +16,7 @@ access_modifiers! { // UnkFFD2 = 0xFFD2, // UnkFFD3 = 0xFFD3, // UnkFFD4 = 0xFFD4, - // UnkFFD5 = 0xFFD5, + PtrDeref = 0xFFD5, // UnkFFD6 = 0xFFD6, // UnkFFD7 = 0xFFD7, Cache = 0xFFD8, diff --git a/src/operands.rs b/src/operands.rs index 28ba9b2..12855de 100644 --- a/src/operands.rs +++ b/src/operands.rs @@ -701,6 +701,7 @@ pub enum Variable { StaticProc(Proc), DynamicProc(DMString), PtrRef(Box), + PtrDeref(Box), //RuntimeProcField(Box, Vec, DMString), } @@ -794,6 +795,10 @@ impl Operand for Variable { asm.emit(access_modifiers::PtrRef); var.assemble(asm)?; } + Variable::PtrDeref(var) => { + asm.emit(access_modifiers::PtrDeref); + var.assemble(asm)?; + } } Ok(()) @@ -934,6 +939,10 @@ impl Operand for Variable { write!(f, "&")?; var.serialize(f) } + Variable::PtrDeref(var) => { + write!(f, "*")?; + var.serialize(f) + } } } } From 605c6af9bdf90a5ee6620baef9afe4019e7882dc Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Fri, 24 Jan 2025 21:19:55 -0800 Subject: [PATCH 08/10] forgot to add this --- src/operands.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/operands.rs b/src/operands.rs index 12855de..84635b1 100644 --- a/src/operands.rs +++ b/src/operands.rs @@ -856,6 +856,9 @@ impl Operand for Variable { access_modifiers::StaticProc => Variable::StaticProc(Proc::disassemble(dism)?), access_modifiers::StaticVerb => Variable::StaticVerb(Proc::disassemble(dism)?), access_modifiers::PtrRef => Variable::PtrRef(Box::new(Variable::disassemble(dism)?)), + access_modifiers::PtrDeref => { + Variable::PtrDeref(Box::new(Variable::disassemble(dism)?)) + } other => { return Err(DisassembleError::UnknownAccessModifier { From 4f8d91802f5c136f473a67f57a8899fbcd8cfd88 Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Sun, 26 Jan 2025 01:24:32 -0800 Subject: [PATCH 09/10] more instructions --- src/instructions.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/instructions.rs b/src/instructions.rs index 3ed64c5..80bd91e 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -484,12 +484,15 @@ instructions! { 0x15B = PushCacheKey, 0x15C = PopCacheKey, 0x15D = Time2TextTZ(arg_count: u32), - // 0x15E + 0x15E = MakeGenerator, 0x15F = SpliceText, 0x160 = SpliceTextChar, 0x161 = RgbEx, // Used when the color space for rgb() cannot be found to be COLORSPACE_RGB at compile-time 0x162 = Rgb2Num, // This is technically a replacement for the original Rgb2Num which is somewhere else - // 0x163 .. 0x165 + // 0x163 + 0x164 = Gradient, + // 0x165 + // 0x166 0x167 = JsonEncodeFlags, 0x168 = JsonDecodeFlags, 0x169 = Ceil, From 455635975d68c4210a3beed1ef03ee873d745502 Mon Sep 17 00:00:00 2001 From: checkraisefold Date: Sun, 26 Jan 2025 01:41:28 -0800 Subject: [PATCH 10/10] load_resource --- src/instructions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/instructions.rs b/src/instructions.rs index 80bd91e..375576c 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -491,7 +491,7 @@ instructions! { 0x162 = Rgb2Num, // This is technically a replacement for the original Rgb2Num which is somewhere else // 0x163 0x164 = Gradient, - // 0x165 + 0x165 = LoadResource, // 0x166 0x167 = JsonEncodeFlags, 0x168 = JsonDecodeFlags,