Skip to content

Commit 95c5d9d

Browse files
committed
Fixed disassembly of loc, nixint1, pollsel1 and getrnd
1 parent 890efaf commit 95c5d9d

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

disasm2.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ static char *group6[] = {
7474
"setse1", "setse2", "setse3", "setse4"};
7575

7676
static char immd6[] = {
77-
5, 5, 0, 1, 4, 1, 5, 5,
77+
1, 5, 0, 1, 4, 1, 5, 5,
7878
0, 0, 0, 0, 0, 0, 1, 1,
79-
6, 6, 6, 1, 1, 1, 1, 1,
80-
6, 6, 0, 6, 1, 1, 0, 0,
79+
6, 6, 6, 6, 6, 1, 1, 1,
80+
6, 6, 0, 7, 1, 1, 0, 1,
8181
1, 1, 1, 1};
8282

8383
static char *group7[] = {
@@ -111,7 +111,6 @@ static char immd8[] = {
111111
0, 0, 0, 0, 0, 0, 0, 0,
112112
0, 0, 6, 6, 0, 0, 0, 0};
113113

114-
115114
static char *group9[] = {
116115
"jmp", "call", "calla", "callb", "calld", "calld", "calld", "calld",
117116
"loc", "loc", "loc", "loc", "augs", "augs", "augs", "augs",
@@ -136,7 +135,7 @@ static char *group9[] = {
136135
#define OP_TWOPTR1 16
137136
#define OP_TWOPTR2 17
138137

139-
char *GetOpname2(unsigned int instr, int *pczi, int *pformat, int *perrflag)
138+
char *GetOpname2(unsigned int instr, int *pczi, int *pformat, int *perrflag, int hubmode)
140139
{
141140
int opcode = (instr >> 21) & 0x7f;
142141
static char name[100];
@@ -241,6 +240,13 @@ char *GetOpname2(unsigned int instr, int *pczi, int *pformat, int *perrflag)
241240
strcpy(name, group6[sfield]);
242241
if (((instr >> 18) & ~immd6[sfield]) & 7)
243242
*perrflag = OPCODE_BAD_BITS;
243+
if (sfield == 27 && ((instr >> 18) & 1)) // getrnd
244+
{
245+
if ((instr >> 9) & 0x1ff)
246+
*perrflag = OPCODE_BAD_BITS;
247+
else
248+
*pformat = OP_NOPARMS;
249+
}
244250
}
245251
else if (sfield == 0x24)
246252
{
@@ -250,9 +256,17 @@ char *GetOpname2(unsigned int instr, int *pczi, int *pformat, int *perrflag)
250256
else
251257
strcpy(name, group7[dfield]);
252258
if (dfield <= 0x1e)
259+
{
253260
*pczi = 6;
261+
if ((instr >> 18) & 1)
262+
*perrflag = OPCODE_BAD_BITS;
263+
}
254264
else
265+
{
255266
*pczi = 0;
267+
if ((instr >> 18) & 7)
268+
*perrflag = OPCODE_BAD_BITS;
269+
}
256270
}
257271
else if (sfield == 0x2d && lflag)
258272
{
@@ -314,7 +328,11 @@ char *GetOpname2(unsigned int instr, int *pczi, int *pformat, int *perrflag)
314328
if (opcode >= 0x78)
315329
*pformat = OP_AUGPARMS;
316330
else if (opcode >= 0x70)
331+
{
317332
*pformat = OP_LOCPARMS;
333+
if (!hubmode && (instr & 0x00100000) && (instr & 3))
334+
*perrflag = OPCODE_BAD_BITS;
335+
}
318336
else
319337
*pformat = OP_BIGJMP;
320338
*pczi = 0;
@@ -469,7 +487,7 @@ void Disassemble2(int32_t instruct, int32_t pc, char *outstr, int *perrflag)
469487
}
470488
}
471489

472-
strcpy(opstr, GetOpname2(instruct, &czi_mask, &format, perrflag));
490+
strcpy(opstr, GetOpname2(instruct, &czi_mask, &format, perrflag, hubmode));
473491
//if (errflag == OPCODE_BAD_BITS) strcpy(opstr, "invalid");
474492

475493
czi &= czi_mask;

spinsim.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
' Author: Dave Hein
3-
' Version 0.98
3+
' Version 0.98+
44
' Copyright (c) 2010 - 2018
55
' See end of file for terms of use.
66
'******************************************************************************/
@@ -99,7 +99,7 @@ void spinsim_exit(int32_t exitcode)
9999

100100
void usage(void)
101101
{
102-
fprintf(stderr, "Spinsim Version 0.98\n");
102+
fprintf(stderr, "Spinsim Version 0.98+\n");
103103
fprintf(stderr, "usage: spinsim [options] file\n");
104104
fprintf(stderr, "The options are as follows:\n");
105105
fprintf(stderr, " -v# Set verbosity level\n");

0 commit comments

Comments
 (0)