From b006a8853e84df62a90c7d973e1ab878283fe06e Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 15 Jun 2026 14:32:42 +0100 Subject: [PATCH] Minimize mos65816 Instruction and Operand --- core/rexcode/mos65816/instructions.odin | 6 +++--- core/rexcode/mos65816/operands.odin | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/rexcode/mos65816/instructions.odin b/core/rexcode/mos65816/instructions.odin index d510631fa..d833ba9c9 100644 --- a/core/rexcode/mos65816/instructions.odin +++ b/core/rexcode/mos65816/instructions.odin @@ -11,14 +11,14 @@ Instruction_Flags :: bit_field u8 { } Instruction :: struct #packed { - ops: [2]Operand `fmt:"v,operand_count"`, // 32 bytes (only MVN/MVP use 2; rest use 0 or 1) + ops: [2]Operand `fmt:"v,operand_count"`, // 20 bytes (only MVN/MVP use 2; rest use 0 or 1) mnemonic: Mnemonic, // 2 operand_count: u8, // 1 flags: Instruction_Flags, // 1 length: u8, // 1 - _: [3]u8, // 3 + _: [7]u8, // 3 } -#assert(size_of(Instruction) == 40) +#assert(size_of(Instruction) == 32) @(require_results) inst_none :: #force_inline proc "contextless" (m: Mnemonic) -> Instruction { diff --git a/core/rexcode/mos65816/operands.odin b/core/rexcode/mos65816/operands.odin index 5469c6492..aeb4ed798 100644 --- a/core/rexcode/mos65816/operands.odin +++ b/core/rexcode/mos65816/operands.odin @@ -90,9 +90,8 @@ Operand :: struct #packed { }, kind: Operand_Kind, size: u8, - _: [6]u8, } -#assert(size_of(Operand) == 16) +#assert(size_of(Operand) == 10) @(require_results) op_reg :: #force_inline proc "contextless" (r: Register) -> Operand { return Operand{reg = r, kind = .REGISTER, size = 1} } @(require_results) op_imm8 :: #force_inline proc "contextless" (v: i64) -> Operand { return Operand{immediate = v, kind = .IMMEDIATE, size = 1} }