Skip to content

Commit

Permalink
65C832: Fix issue with length of 32 bit immediates.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeakohn committed Oct 5, 2024
1 parent f64cb9d commit 34f2555
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion asm/65816.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ int parse_instruction_65816(AsmContext *asm_context, char *instr)
{
if (asm_context->flags == 32)
{
// 65C832: An immediate with .l means read 32 bits.
size = 32;
}
else
Expand Down Expand Up @@ -900,7 +901,7 @@ int parse_instruction_65816(AsmContext *asm_context, char *instr)
{
if (size == 32)
{
bytes = 4;
bytes = 5;
}
else
{
Expand All @@ -926,6 +927,11 @@ int parse_instruction_65816(AsmContext *asm_context, char *instr)
add_bin8(asm_context, (num >> 16) & 0xff, IS_OPCODE);
}

if (bytes > 4)
{
add_bin8(asm_context, (num >> 24) & 0xff, IS_OPCODE);
}

return bytes;
}

2 changes: 1 addition & 1 deletion common/cpu_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ struct _cpu_list cpu_list[] =
#endif
#ifdef ENABLE_65816
{
"65832",
"65c832",
CPU_TYPE_65816,
ENDIAN_LITTLE,
1,
Expand Down

0 comments on commit 34f2555

Please sign in to comment.