]> Shamusworld >> Repos - rmac/commitdiff
Fix pack/unpack instructions
authorJames Jones <atari@theinnocuous.com>
Mon, 13 Jun 2022 03:54:39 +0000 (20:54 -0700)
committerShamus Hammons <jlhamm@acm.org>
Mon, 27 Jun 2022 16:52:29 +0000 (11:52 -0500)
The GPU-specific PACK and UNPACK instructions
share opcode 63. PACK is chosen by encoding '0'
in the source operand, and UNPACK is chosen by
encoding '1' in the source operand. RMAC had the
magic source operand values reversed.

riscasm.c

index e31c1043f78757583dc3c9f2efd0e9fb409d2cbc..c3bd88f19f1fd67408718a8579b8fd6c8c3ad696 100644 (file)
--- a/riscasm.c
+++ b/riscasm.c
@@ -128,8 +128,8 @@ static const struct opcoderecord roptbl[] = {
        { MR_NORMI,   RI_TWO,    56 },
        { MR_NOP,     RI_NONE,   57 },
        { MR_SAT24,   RI_ONE,    62 },
-       { MR_UNPACK,  RI_ONE,    63 + GPUONLY | (0 << 6) },
-       { MR_PACK,    RI_ONE,    63 + GPUONLY | (1 << 6) },
+       { MR_UNPACK,  RI_ONE,    63 + GPUONLY | (1 << 6) },
+       { MR_PACK,    RI_ONE,    63 + GPUONLY | (0 << 6) },
        { MR_ADDQMOD, RI_NUM_32, 63 + DSPONLY },
        { MR_MOVE,    RI_MOVE,   0 },
        { MR_LOAD,    RI_LOAD,   0 },