Search
lxdream.org :: lxdream/src/sh4/sh4dasm.c
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4dasm.c
changeset 561:533f6b478071
prev496:5c5c98f3bdd5
next569:a1c49e1e8776
author nkeynes
date Tue Jan 01 05:08:38 2008 +0000 (12 years ago)
branchlxdream-mmu
permissions -rw-r--r--
last change Enable Id keyword on all source files
file annotate diff log raw
nkeynes@30
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@30
     3
 * 
nkeynes@30
     4
 * SH4 CPU definition and disassembly functions
nkeynes@30
     5
 *
nkeynes@30
     6
 * Copyright (c) 2005 Nathan Keynes.
nkeynes@30
     7
 *
nkeynes@30
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@30
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@30
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@30
    11
 * (at your option) any later version.
nkeynes@30
    12
 *
nkeynes@30
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@30
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@30
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@30
    16
 * GNU General Public License for more details.
nkeynes@30
    17
 */
nkeynes@30
    18
nkeynes@1
    19
#include "sh4core.h"
nkeynes@1
    20
#include "sh4dasm.h"
nkeynes@1
    21
#include "mem.h"
nkeynes@1
    22
nkeynes@1
    23
#define UNIMP(ir) snprintf( buf, len, "???     " )
nkeynes@1
    24
nkeynes@9
    25
nkeynes@11
    26
const struct reg_desc_struct sh4_reg_map[] = 
nkeynes@9
    27
  { {"R0", REG_INT, &sh4r.r[0]}, {"R1", REG_INT, &sh4r.r[1]},
nkeynes@9
    28
    {"R2", REG_INT, &sh4r.r[2]}, {"R3", REG_INT, &sh4r.r[3]},
nkeynes@9
    29
    {"R4", REG_INT, &sh4r.r[4]}, {"R5", REG_INT, &sh4r.r[5]},
nkeynes@9
    30
    {"R6", REG_INT, &sh4r.r[6]}, {"R7", REG_INT, &sh4r.r[7]},
nkeynes@9
    31
    {"R8", REG_INT, &sh4r.r[8]}, {"R9", REG_INT, &sh4r.r[9]},
nkeynes@9
    32
    {"R10",REG_INT, &sh4r.r[10]}, {"R11",REG_INT, &sh4r.r[11]},
nkeynes@9
    33
    {"R12",REG_INT, &sh4r.r[12]}, {"R13",REG_INT, &sh4r.r[13]},
nkeynes@9
    34
    {"R14",REG_INT, &sh4r.r[14]}, {"R15",REG_INT, &sh4r.r[15]},
nkeynes@9
    35
    {"SR", REG_INT, &sh4r.sr}, {"GBR", REG_INT, &sh4r.gbr},
nkeynes@9
    36
    {"SSR",REG_INT, &sh4r.ssr}, {"SPC", REG_INT, &sh4r.spc},
nkeynes@9
    37
    {"SGR",REG_INT, &sh4r.sgr}, {"DBR", REG_INT, &sh4r.dbr},
nkeynes@9
    38
    {"VBR",REG_INT, &sh4r.vbr},
nkeynes@9
    39
    {"PC", REG_INT, &sh4r.pc}, {"PR", REG_INT, &sh4r.pr},
nkeynes@9
    40
    {"MACL",REG_INT, &sh4r.mac},{"MACH",REG_INT, ((uint32_t *)&sh4r.mac)+1},
nkeynes@9
    41
    {"FPUL", REG_INT, &sh4r.fpul}, {"FPSCR", REG_INT, &sh4r.fpscr},
nkeynes@9
    42
    {NULL, 0, NULL} };
nkeynes@9
    43
nkeynes@10
    44
nkeynes@14
    45
const struct cpu_desc_struct sh4_cpu_desc = 
nkeynes@43
    46
    { "SH4", sh4_disasm_instruction, sh4_execute_instruction, mem_has_page, 
nkeynes@43
    47
      sh4_set_breakpoint, sh4_clear_breakpoint, sh4_get_breakpoint, 2,
nkeynes@14
    48
      (char *)&sh4r, sizeof(sh4r), sh4_reg_map,
nkeynes@302
    49
      &sh4r.pc };
nkeynes@9
    50
nkeynes@11
    51
uint32_t sh4_disasm_instruction( uint32_t pc, char *buf, int len, char *opcode )
nkeynes@1
    52
{
nkeynes@10
    53
    uint16_t ir = sh4_read_word(pc);
nkeynes@359
    54
nkeynes@359
    55
#define UNDEF(ir) snprintf( buf, len, "????    " );
nkeynes@1
    56
#define RN(ir) ((ir&0x0F00)>>8)
nkeynes@1
    57
#define RN_BANK(ir) ((ir&0x0070)>>4)
nkeynes@1
    58
#define RM(ir) ((ir&0x00F0)>>4)
nkeynes@1
    59
#define DISP4(ir) (ir&0x000F) /* 4-bit displacements are *not* sign extended */
nkeynes@1
    60
#define DISP8(ir) (ir&0x00FF)
nkeynes@1
    61
#define PCDISP8(ir) SIGNEXT8(ir&0x00FF)
nkeynes@1
    62
#define UIMM8(ir) (ir&0x00FF)
nkeynes@1
    63
#define IMM8(ir) SIGNEXT8(ir&0x00FF)
nkeynes@1
    64
#define DISP12(ir) SIGNEXT12(ir&0x0FFF)
nkeynes@1
    65
#define FVN(ir) ((ir&0x0C00)>>10)
nkeynes@1
    66
#define FVM(ir) ((ir&0x0300)>>8)
nkeynes@1
    67
nkeynes@11
    68
    sprintf( opcode, "%02X %02X", ir&0xFF, ir>>8 );
nkeynes@11
    69
nkeynes@359
    70
        switch( (ir&0xF000) >> 12 ) {
nkeynes@359
    71
            case 0x0:
nkeynes@359
    72
                switch( ir&0xF ) {
nkeynes@359
    73
                    case 0x2:
nkeynes@359
    74
                        switch( (ir&0x80) >> 7 ) {
nkeynes@359
    75
                            case 0x0:
nkeynes@359
    76
                                switch( (ir&0x70) >> 4 ) {
nkeynes@359
    77
                                    case 0x0:
nkeynes@359
    78
                                        { /* STC SR, Rn */
nkeynes@359
    79
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
    80
                                        snprintf( buf, len, "STC     SR, R%d", Rn );
nkeynes@359
    81
                                        }
nkeynes@359
    82
                                        break;
nkeynes@359
    83
                                    case 0x1:
nkeynes@359
    84
                                        { /* STC GBR, Rn */
nkeynes@359
    85
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
    86
                                        snprintf( buf, len, "STC     GBR, R%d", Rn );
nkeynes@359
    87
                                        }
nkeynes@359
    88
                                        break;
nkeynes@359
    89
                                    case 0x2:
nkeynes@359
    90
                                        { /* STC VBR, Rn */
nkeynes@359
    91
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
    92
                                        snprintf( buf, len, "STC     VBR, R%d", Rn );
nkeynes@359
    93
                                        }
nkeynes@359
    94
                                        break;
nkeynes@359
    95
                                    case 0x3:
nkeynes@359
    96
                                        { /* STC SSR, Rn */
nkeynes@359
    97
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
    98
                                        snprintf( buf, len, "STC     SSR, R%d", Rn );
nkeynes@359
    99
                                        }
nkeynes@359
   100
                                        break;
nkeynes@359
   101
                                    case 0x4:
nkeynes@359
   102
                                        { /* STC SPC, Rn */
nkeynes@359
   103
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   104
                                        snprintf( buf, len, "STC     SPC, R%d", Rn );
nkeynes@359
   105
                                        }
nkeynes@359
   106
                                        break;
nkeynes@359
   107
                                    default:
nkeynes@359
   108
                                        UNDEF();
nkeynes@359
   109
                                        break;
nkeynes@359
   110
                                }
nkeynes@359
   111
                                break;
nkeynes@359
   112
                            case 0x1:
nkeynes@359
   113
                                { /* STC Rm_BANK, Rn */
nkeynes@359
   114
                                uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm_BANK = ((ir>>4)&0x7); 
nkeynes@359
   115
                                snprintf( buf, len, "STC     R%d_BANK, R%d", Rm_BANK, Rn );
nkeynes@359
   116
                                }
nkeynes@359
   117
                                break;
nkeynes@359
   118
                        }
nkeynes@359
   119
                        break;
nkeynes@359
   120
                    case 0x3:
nkeynes@359
   121
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   122
                            case 0x0:
nkeynes@359
   123
                                { /* BSRF Rn */
nkeynes@359
   124
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   125
                                snprintf( buf, len, "BSRF    R%d", Rn );
nkeynes@359
   126
                                }
nkeynes@359
   127
                                break;
nkeynes@359
   128
                            case 0x2:
nkeynes@359
   129
                                { /* BRAF Rn */
nkeynes@359
   130
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   131
                                snprintf( buf, len, "BRAF    R%d", Rn );
nkeynes@359
   132
                                }
nkeynes@359
   133
                                break;
nkeynes@359
   134
                            case 0x8:
nkeynes@359
   135
                                { /* PREF @Rn */
nkeynes@359
   136
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   137
                                snprintf( buf, len, "PREF    R%d", Rn );
nkeynes@359
   138
                                }
nkeynes@359
   139
                                break;
nkeynes@359
   140
                            case 0x9:
nkeynes@359
   141
                                { /* OCBI @Rn */
nkeynes@359
   142
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   143
                                snprintf( buf, len, "OCBI    @R%d", Rn );
nkeynes@359
   144
                                }
nkeynes@359
   145
                                break;
nkeynes@359
   146
                            case 0xA:
nkeynes@359
   147
                                { /* OCBP @Rn */
nkeynes@359
   148
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   149
                                snprintf( buf, len, "OCBP    @R%d", Rn );
nkeynes@359
   150
                                }
nkeynes@359
   151
                                break;
nkeynes@359
   152
                            case 0xB:
nkeynes@359
   153
                                { /* OCBWB @Rn */
nkeynes@359
   154
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   155
                                snprintf( buf, len, "OCBWB   @R%d", Rn );
nkeynes@359
   156
                                }
nkeynes@359
   157
                                break;
nkeynes@359
   158
                            case 0xC:
nkeynes@359
   159
                                { /* MOVCA.L R0, @Rn */
nkeynes@359
   160
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   161
                                snprintf( buf, len, "MOVCA.L R0, @R%d", Rn );
nkeynes@359
   162
                                }
nkeynes@359
   163
                                break;
nkeynes@359
   164
                            default:
nkeynes@359
   165
                                UNDEF();
nkeynes@359
   166
                                break;
nkeynes@359
   167
                        }
nkeynes@359
   168
                        break;
nkeynes@359
   169
                    case 0x4:
nkeynes@359
   170
                        { /* MOV.B Rm, @(R0, Rn) */
nkeynes@359
   171
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   172
                        snprintf( buf, len, "MOV.B   R%d, @(R0, R%d)", Rm, Rn );
nkeynes@359
   173
                        }
nkeynes@359
   174
                        break;
nkeynes@359
   175
                    case 0x5:
nkeynes@359
   176
                        { /* MOV.W Rm, @(R0, Rn) */
nkeynes@359
   177
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   178
                        snprintf( buf, len, "MOV.W   R%d, @(R0, R%d)", Rm, Rn );
nkeynes@359
   179
                        }
nkeynes@359
   180
                        break;
nkeynes@359
   181
                    case 0x6:
nkeynes@359
   182
                        { /* MOV.L Rm, @(R0, Rn) */
nkeynes@359
   183
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   184
                        snprintf( buf, len, "MOV.L   R%d, @(R0, R%d)", Rm, Rn );
nkeynes@359
   185
                        }
nkeynes@359
   186
                        break;
nkeynes@359
   187
                    case 0x7:
nkeynes@359
   188
                        { /* MUL.L Rm, Rn */
nkeynes@359
   189
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   190
                        snprintf( buf, len, "MUL.L   R%d, R%d", Rm, Rn );
nkeynes@359
   191
                        }
nkeynes@359
   192
                        break;
nkeynes@359
   193
                    case 0x8:
nkeynes@359
   194
                        switch( (ir&0xFF0) >> 4 ) {
nkeynes@359
   195
                            case 0x0:
nkeynes@359
   196
                                { /* CLRT */
nkeynes@359
   197
                                snprintf( buf, len, "CLRT    " );
nkeynes@359
   198
                                }
nkeynes@359
   199
                                break;
nkeynes@359
   200
                            case 0x1:
nkeynes@359
   201
                                { /* SETT */
nkeynes@359
   202
                                snprintf( buf, len, "SETT    " );
nkeynes@359
   203
                                }
nkeynes@359
   204
                                break;
nkeynes@359
   205
                            case 0x2:
nkeynes@359
   206
                                { /* CLRMAC */
nkeynes@359
   207
                                snprintf( buf, len, "CLRMAC  " );
nkeynes@359
   208
                                }
nkeynes@359
   209
                                break;
nkeynes@359
   210
                            case 0x3:
nkeynes@359
   211
                                { /* LDTLB */
nkeynes@359
   212
                                snprintf( buf, len, "LDTLB   " );
nkeynes@359
   213
                                }
nkeynes@359
   214
                                break;
nkeynes@359
   215
                            case 0x4:
nkeynes@359
   216
                                { /* CLRS */
nkeynes@359
   217
                                snprintf( buf, len, "CLRS    " );
nkeynes@359
   218
                                }
nkeynes@359
   219
                                break;
nkeynes@359
   220
                            case 0x5:
nkeynes@359
   221
                                { /* SETS */
nkeynes@359
   222
                                snprintf( buf, len, "SETS    " );
nkeynes@359
   223
                                }
nkeynes@359
   224
                                break;
nkeynes@359
   225
                            default:
nkeynes@359
   226
                                UNDEF();
nkeynes@359
   227
                                break;
nkeynes@359
   228
                        }
nkeynes@359
   229
                        break;
nkeynes@359
   230
                    case 0x9:
nkeynes@359
   231
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   232
                            case 0x0:
nkeynes@359
   233
                                { /* NOP */
nkeynes@359
   234
                                snprintf( buf, len, "NOP     " );
nkeynes@359
   235
                                }
nkeynes@359
   236
                                break;
nkeynes@359
   237
                            case 0x1:
nkeynes@359
   238
                                { /* DIV0U */
nkeynes@359
   239
                                snprintf( buf, len, "DIV0U   " );
nkeynes@359
   240
                                }
nkeynes@359
   241
                                break;
nkeynes@359
   242
                            case 0x2:
nkeynes@359
   243
                                { /* MOVT Rn */
nkeynes@359
   244
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   245
                                snprintf( buf, len, "MOVT    R%d", Rn );
nkeynes@359
   246
                                }
nkeynes@359
   247
                                break;
nkeynes@359
   248
                            default:
nkeynes@359
   249
                                UNDEF();
nkeynes@359
   250
                                break;
nkeynes@359
   251
                        }
nkeynes@359
   252
                        break;
nkeynes@359
   253
                    case 0xA:
nkeynes@359
   254
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   255
                            case 0x0:
nkeynes@359
   256
                                { /* STS MACH, Rn */
nkeynes@359
   257
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   258
                                snprintf( buf, len, "STS     MACH, R%d", Rn );
nkeynes@359
   259
                                }
nkeynes@359
   260
                                break;
nkeynes@359
   261
                            case 0x1:
nkeynes@359
   262
                                { /* STS MACL, Rn */
nkeynes@359
   263
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   264
                                snprintf( buf, len, "STS     MACL, R%d", Rn );
nkeynes@359
   265
                                }
nkeynes@359
   266
                                break;
nkeynes@359
   267
                            case 0x2:
nkeynes@359
   268
                                { /* STS PR, Rn */
nkeynes@359
   269
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   270
                                snprintf( buf, len, "STS     PR, R%d", Rn );
nkeynes@359
   271
                                }
nkeynes@359
   272
                                break;
nkeynes@359
   273
                            case 0x3:
nkeynes@359
   274
                                { /* STC SGR, Rn */
nkeynes@359
   275
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   276
                                snprintf( buf, len, "STC     SGR, R%d", Rn );
nkeynes@359
   277
                                }
nkeynes@359
   278
                                break;
nkeynes@359
   279
                            case 0x5:
nkeynes@359
   280
                                { /* STS FPUL, Rn */
nkeynes@359
   281
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   282
                                snprintf( buf, len, "STS     FPUL, R%d", Rn );
nkeynes@359
   283
                                }
nkeynes@359
   284
                                break;
nkeynes@359
   285
                            case 0x6:
nkeynes@359
   286
                                { /* STS FPSCR, Rn */
nkeynes@359
   287
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   288
                                snprintf( buf, len, "STS     FPSCR, R%d", Rn );
nkeynes@359
   289
                                }
nkeynes@359
   290
                                break;
nkeynes@359
   291
                            case 0xF:
nkeynes@359
   292
                                { /* STC DBR, Rn */
nkeynes@359
   293
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   294
                                snprintf( buf, len, "STC     DBR, R%d", Rn );
nkeynes@359
   295
                                }
nkeynes@359
   296
                                break;
nkeynes@359
   297
                            default:
nkeynes@359
   298
                                UNDEF();
nkeynes@359
   299
                                break;
nkeynes@359
   300
                        }
nkeynes@359
   301
                        break;
nkeynes@359
   302
                    case 0xB:
nkeynes@359
   303
                        switch( (ir&0xFF0) >> 4 ) {
nkeynes@359
   304
                            case 0x0:
nkeynes@359
   305
                                { /* RTS */
nkeynes@359
   306
                                snprintf( buf, len, "RTS     " );
nkeynes@359
   307
                                }
nkeynes@359
   308
                                break;
nkeynes@359
   309
                            case 0x1:
nkeynes@359
   310
                                { /* SLEEP */
nkeynes@359
   311
                                snprintf( buf, len, "SLEEP   " );
nkeynes@359
   312
                                }
nkeynes@359
   313
                                break;
nkeynes@359
   314
                            case 0x2:
nkeynes@359
   315
                                { /* RTE */
nkeynes@359
   316
                                snprintf( buf, len, "RTE     " );
nkeynes@359
   317
                                }
nkeynes@359
   318
                                break;
nkeynes@359
   319
                            default:
nkeynes@359
   320
                                UNDEF();
nkeynes@359
   321
                                break;
nkeynes@359
   322
                        }
nkeynes@359
   323
                        break;
nkeynes@359
   324
                    case 0xC:
nkeynes@359
   325
                        { /* MOV.B @(R0, Rm), Rn */
nkeynes@359
   326
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   327
                        snprintf( buf, len, "MOV.B   @(R0, R%d), R%d", Rm, Rn );
nkeynes@359
   328
                        }
nkeynes@359
   329
                        break;
nkeynes@359
   330
                    case 0xD:
nkeynes@359
   331
                        { /* MOV.W @(R0, Rm), Rn */
nkeynes@359
   332
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   333
                        snprintf( buf, len, "MOV.W   @(R0, R%d), R%d", Rm, Rn );
nkeynes@359
   334
                        }
nkeynes@359
   335
                        break;
nkeynes@359
   336
                    case 0xE:
nkeynes@359
   337
                        { /* MOV.L @(R0, Rm), Rn */
nkeynes@359
   338
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   339
                        snprintf( buf, len, "MOV.L   @(R0, R%d), R%d", Rm, Rn );
nkeynes@359
   340
                        }
nkeynes@359
   341
                        break;
nkeynes@359
   342
                    case 0xF:
nkeynes@359
   343
                        { /* MAC.L @Rm+, @Rn+ */
nkeynes@359
   344
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   345
                        snprintf( buf, len, "MAC.L   @R%d+, @R%d+", Rm, Rn );
nkeynes@359
   346
                        }
nkeynes@359
   347
                        break;
nkeynes@359
   348
                    default:
nkeynes@359
   349
                        UNDEF();
nkeynes@359
   350
                        break;
nkeynes@359
   351
                }
nkeynes@359
   352
                break;
nkeynes@359
   353
            case 0x1:
nkeynes@359
   354
                { /* MOV.L Rm, @(disp, Rn) */
nkeynes@359
   355
                uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); uint32_t disp = (ir&0xF)<<2; 
nkeynes@359
   356
                snprintf( buf, len, "MOV.L   R%d, @(%d, R%d)", Rm, disp, Rn );
nkeynes@359
   357
                }
nkeynes@359
   358
                break;
nkeynes@359
   359
            case 0x2:
nkeynes@359
   360
                switch( ir&0xF ) {
nkeynes@359
   361
                    case 0x0:
nkeynes@359
   362
                        { /* MOV.B Rm, @Rn */
nkeynes@359
   363
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   364
                        snprintf( buf, len, "MOV.B   R%d, @R%d", Rm, Rn );
nkeynes@359
   365
                        }
nkeynes@359
   366
                        break;
nkeynes@359
   367
                    case 0x1:
nkeynes@359
   368
                        { /* MOV.W Rm, @Rn */
nkeynes@359
   369
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   370
                        snprintf( buf, len, "MOV.W   R%d, @R%d", Rm, Rn );
nkeynes@359
   371
                        }
nkeynes@359
   372
                        break;
nkeynes@359
   373
                    case 0x2:
nkeynes@359
   374
                        { /* MOV.L Rm, @Rn */
nkeynes@359
   375
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   376
                        snprintf( buf, len, "MOV.L   R%d, @R%d", Rm, Rn );
nkeynes@359
   377
                        }
nkeynes@359
   378
                        break;
nkeynes@359
   379
                    case 0x4:
nkeynes@359
   380
                        { /* MOV.B Rm, @-Rn */
nkeynes@359
   381
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   382
                        snprintf( buf, len, "MOV.B   R%d, @-R%d", Rm, Rn );
nkeynes@359
   383
                        }
nkeynes@359
   384
                        break;
nkeynes@359
   385
                    case 0x5:
nkeynes@359
   386
                        { /* MOV.W Rm, @-Rn */
nkeynes@359
   387
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   388
                        snprintf( buf, len, "MOV.W   R%d, @-R%d", Rm, Rn );
nkeynes@359
   389
                        }
nkeynes@359
   390
                        break;
nkeynes@359
   391
                    case 0x6:
nkeynes@359
   392
                        { /* MOV.L Rm, @-Rn */
nkeynes@359
   393
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   394
                        snprintf( buf, len, "MOV.L   R%d, @-R%d", Rm, Rn );
nkeynes@359
   395
                        }
nkeynes@359
   396
                        break;
nkeynes@359
   397
                    case 0x7:
nkeynes@359
   398
                        { /* DIV0S Rm, Rn */
nkeynes@359
   399
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   400
                        snprintf( buf, len, "DIV0S   R%d, R%d", Rm, Rn );
nkeynes@359
   401
                        }
nkeynes@359
   402
                        break;
nkeynes@359
   403
                    case 0x8:
nkeynes@359
   404
                        { /* TST Rm, Rn */
nkeynes@359
   405
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   406
                        snprintf( buf, len, "TST     R%d, R%d", Rm, Rn );
nkeynes@359
   407
                        }
nkeynes@359
   408
                        break;
nkeynes@359
   409
                    case 0x9:
nkeynes@359
   410
                        { /* AND Rm, Rn */
nkeynes@359
   411
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   412
                        snprintf( buf, len, "AND     R%d, R%d", Rm, Rn );
nkeynes@359
   413
                        }
nkeynes@359
   414
                        break;
nkeynes@359
   415
                    case 0xA:
nkeynes@359
   416
                        { /* XOR Rm, Rn */
nkeynes@359
   417
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   418
                        snprintf( buf, len, "XOR     R%d, R%d", Rm, Rn );
nkeynes@359
   419
                        }
nkeynes@359
   420
                        break;
nkeynes@359
   421
                    case 0xB:
nkeynes@359
   422
                        { /* OR Rm, Rn */
nkeynes@359
   423
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   424
                        snprintf( buf, len, "OR      R%d, R%d", Rm, Rn );
nkeynes@359
   425
                        }
nkeynes@359
   426
                        break;
nkeynes@359
   427
                    case 0xC:
nkeynes@359
   428
                        { /* CMP/STR Rm, Rn */
nkeynes@359
   429
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   430
                        snprintf( buf, len, "CMP/STR R%d, R%d", Rm, Rn );
nkeynes@359
   431
                        }
nkeynes@359
   432
                        break;
nkeynes@359
   433
                    case 0xD:
nkeynes@359
   434
                        { /* XTRCT Rm, Rn */
nkeynes@359
   435
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   436
                        snprintf( buf, len, "XTRCT   R%d, R%d", Rm, Rn );
nkeynes@359
   437
                        }
nkeynes@359
   438
                        break;
nkeynes@359
   439
                    case 0xE:
nkeynes@359
   440
                        { /* MULU.W Rm, Rn */
nkeynes@359
   441
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   442
                        snprintf( buf, len, "MULU.W  R%d, R%d", Rm, Rn );
nkeynes@359
   443
                        }
nkeynes@359
   444
                        break;
nkeynes@359
   445
                    case 0xF:
nkeynes@359
   446
                        { /* MULS.W Rm, Rn */
nkeynes@359
   447
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   448
                        snprintf( buf, len, "MULS.W  R%d, R%d", Rm, Rn );
nkeynes@359
   449
                        }
nkeynes@359
   450
                        break;
nkeynes@359
   451
                    default:
nkeynes@359
   452
                        UNDEF();
nkeynes@359
   453
                        break;
nkeynes@359
   454
                }
nkeynes@359
   455
                break;
nkeynes@359
   456
            case 0x3:
nkeynes@359
   457
                switch( ir&0xF ) {
nkeynes@359
   458
                    case 0x0:
nkeynes@359
   459
                        { /* CMP/EQ Rm, Rn */
nkeynes@359
   460
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   461
                        snprintf( buf, len, "CMP/EQ  R%d, R%d", Rm, Rn );
nkeynes@359
   462
                        }
nkeynes@359
   463
                        break;
nkeynes@359
   464
                    case 0x2:
nkeynes@359
   465
                        { /* CMP/HS Rm, Rn */
nkeynes@359
   466
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   467
                        snprintf( buf, len, "CMP/HS  R%d, R%d", Rm, Rn );
nkeynes@359
   468
                        }
nkeynes@359
   469
                        break;
nkeynes@359
   470
                    case 0x3:
nkeynes@359
   471
                        { /* CMP/GE Rm, Rn */
nkeynes@359
   472
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   473
                        snprintf( buf, len, "CMP/GE  R%d, R%d", Rm, Rn );
nkeynes@359
   474
                        }
nkeynes@359
   475
                        break;
nkeynes@359
   476
                    case 0x4:
nkeynes@359
   477
                        { /* DIV1 Rm, Rn */
nkeynes@359
   478
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   479
                        snprintf( buf, len, "DIV1    R%d, R%d", Rm, Rn );
nkeynes@359
   480
                        }
nkeynes@359
   481
                        break;
nkeynes@359
   482
                    case 0x5:
nkeynes@359
   483
                        { /* DMULU.L Rm, Rn */
nkeynes@359
   484
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   485
                        snprintf( buf, len, "DMULU.L R%d, R%d", Rm, Rn );
nkeynes@359
   486
                        }
nkeynes@359
   487
                        break;
nkeynes@359
   488
                    case 0x6:
nkeynes@359
   489
                        { /* CMP/HI Rm, Rn */
nkeynes@359
   490
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   491
                        snprintf( buf, len, "CMP/HI  R%d, R%d", Rm, Rn );
nkeynes@359
   492
                        }
nkeynes@359
   493
                        break;
nkeynes@359
   494
                    case 0x7:
nkeynes@359
   495
                        { /* CMP/GT Rm, Rn */
nkeynes@359
   496
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   497
                        snprintf( buf, len, "CMP/GT  R%d, R%d", Rm, Rn );
nkeynes@359
   498
                        }
nkeynes@359
   499
                        break;
nkeynes@359
   500
                    case 0x8:
nkeynes@359
   501
                        { /* SUB Rm, Rn */
nkeynes@359
   502
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   503
                        snprintf( buf, len, "SUB     R%d, R%d", Rm, Rn );
nkeynes@359
   504
                        }
nkeynes@359
   505
                        break;
nkeynes@359
   506
                    case 0xA:
nkeynes@359
   507
                        { /* SUBC Rm, Rn */
nkeynes@359
   508
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   509
                        snprintf( buf, len, "SUBC    R%d, R%d", Rm, Rn );
nkeynes@359
   510
                        }
nkeynes@359
   511
                        break;
nkeynes@359
   512
                    case 0xB:
nkeynes@359
   513
                        { /* SUBV Rm, Rn */
nkeynes@359
   514
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   515
                        snprintf( buf, len, "SUBV    R%d, R%d", Rm, Rn );
nkeynes@359
   516
                        }
nkeynes@359
   517
                        break;
nkeynes@359
   518
                    case 0xC:
nkeynes@359
   519
                        { /* ADD Rm, Rn */
nkeynes@359
   520
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   521
                        snprintf( buf, len, "ADD     R%d, R%d", Rm, Rn );
nkeynes@359
   522
                        }
nkeynes@359
   523
                        break;
nkeynes@359
   524
                    case 0xD:
nkeynes@359
   525
                        { /* DMULS.L Rm, Rn */
nkeynes@359
   526
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   527
                        snprintf( buf, len, "DMULS.L R%d, R%d", Rm, Rn );
nkeynes@359
   528
                        }
nkeynes@359
   529
                        break;
nkeynes@359
   530
                    case 0xE:
nkeynes@359
   531
                        { /* ADDC Rm, Rn */
nkeynes@359
   532
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   533
                        snprintf( buf, len, "ADDC    R%d, R%d", Rm, Rn );
nkeynes@359
   534
                        }
nkeynes@359
   535
                        break;
nkeynes@359
   536
                    case 0xF:
nkeynes@359
   537
                        { /* ADDV Rm, Rn */
nkeynes@359
   538
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   539
                        snprintf( buf, len, "ADDV    R%d, R%d", Rm, Rn );
nkeynes@359
   540
                        }
nkeynes@359
   541
                        break;
nkeynes@359
   542
                    default:
nkeynes@359
   543
                        UNDEF();
nkeynes@359
   544
                        break;
nkeynes@359
   545
                }
nkeynes@359
   546
                break;
nkeynes@359
   547
            case 0x4:
nkeynes@359
   548
                switch( ir&0xF ) {
nkeynes@359
   549
                    case 0x0:
nkeynes@359
   550
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   551
                            case 0x0:
nkeynes@359
   552
                                { /* SHLL Rn */
nkeynes@359
   553
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   554
                                snprintf( buf, len, "SHLL    R%d", Rn );
nkeynes@359
   555
                                }
nkeynes@359
   556
                                break;
nkeynes@359
   557
                            case 0x1:
nkeynes@359
   558
                                { /* DT Rn */
nkeynes@359
   559
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   560
                                snprintf( buf, len, "DT      R%d", Rn );
nkeynes@359
   561
                                }
nkeynes@359
   562
                                break;
nkeynes@359
   563
                            case 0x2:
nkeynes@359
   564
                                { /* SHAL Rn */
nkeynes@359
   565
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   566
                                snprintf( buf, len, "SHAL    R%d", Rn );
nkeynes@359
   567
                                }
nkeynes@359
   568
                                break;
nkeynes@359
   569
                            default:
nkeynes@359
   570
                                UNDEF();
nkeynes@359
   571
                                break;
nkeynes@359
   572
                        }
nkeynes@359
   573
                        break;
nkeynes@359
   574
                    case 0x1:
nkeynes@359
   575
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   576
                            case 0x0:
nkeynes@359
   577
                                { /* SHLR Rn */
nkeynes@359
   578
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   579
                                snprintf( buf, len, "SHLR    R%d", Rn );
nkeynes@359
   580
                                }
nkeynes@359
   581
                                break;
nkeynes@359
   582
                            case 0x1:
nkeynes@359
   583
                                { /* CMP/PZ Rn */
nkeynes@359
   584
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   585
                                snprintf( buf, len, "CMP/PZ  R%d", Rn );
nkeynes@359
   586
                                }
nkeynes@359
   587
                                break;
nkeynes@359
   588
                            case 0x2:
nkeynes@359
   589
                                { /* SHAR Rn */
nkeynes@359
   590
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   591
                                snprintf( buf, len, "SHAR    R%d", Rn );
nkeynes@359
   592
                                }
nkeynes@359
   593
                                break;
nkeynes@359
   594
                            default:
nkeynes@359
   595
                                UNDEF();
nkeynes@359
   596
                                break;
nkeynes@359
   597
                        }
nkeynes@359
   598
                        break;
nkeynes@359
   599
                    case 0x2:
nkeynes@359
   600
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   601
                            case 0x0:
nkeynes@359
   602
                                { /* STS.L MACH, @-Rn */
nkeynes@359
   603
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   604
                                snprintf( buf, len, "STS.L   MACH, @-R%d", Rn );
nkeynes@359
   605
                                }
nkeynes@359
   606
                                break;
nkeynes@359
   607
                            case 0x1:
nkeynes@359
   608
                                { /* STS.L MACL, @-Rn */
nkeynes@359
   609
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   610
                                snprintf( buf, len, "STS.L   MACL, @-R%d", Rn );
nkeynes@359
   611
                                }
nkeynes@359
   612
                                break;
nkeynes@359
   613
                            case 0x2:
nkeynes@359
   614
                                { /* STS.L PR, @-Rn */
nkeynes@359
   615
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   616
                                snprintf( buf, len, "STS.L   PR, @-R%d", Rn );
nkeynes@359
   617
                                }
nkeynes@359
   618
                                break;
nkeynes@359
   619
                            case 0x3:
nkeynes@359
   620
                                { /* STC.L SGR, @-Rn */
nkeynes@359
   621
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   622
                                snprintf( buf, len, "STC.L   SGR, @-R%d", Rn );
nkeynes@359
   623
                                }
nkeynes@359
   624
                                break;
nkeynes@359
   625
                            case 0x5:
nkeynes@359
   626
                                { /* STS.L FPUL, @-Rn */
nkeynes@359
   627
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   628
                                snprintf( buf, len, "STS.L   FPUL, @-R%d", Rn );
nkeynes@359
   629
                                }
nkeynes@359
   630
                                break;
nkeynes@359
   631
                            case 0x6:
nkeynes@359
   632
                                { /* STS.L FPSCR, @-Rn */
nkeynes@359
   633
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   634
                                snprintf( buf, len, "STS.L   FPSCR, @-R%d", Rn );
nkeynes@359
   635
                                }
nkeynes@359
   636
                                break;
nkeynes@359
   637
                            case 0xF:
nkeynes@359
   638
                                { /* STC.L DBR, @-Rn */
nkeynes@359
   639
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   640
                                snprintf( buf, len, "STC.L    DBR, @-R%d", Rn );
nkeynes@359
   641
                                }
nkeynes@359
   642
                                break;
nkeynes@359
   643
                            default:
nkeynes@359
   644
                                UNDEF();
nkeynes@359
   645
                                break;
nkeynes@359
   646
                        }
nkeynes@359
   647
                        break;
nkeynes@359
   648
                    case 0x3:
nkeynes@359
   649
                        switch( (ir&0x80) >> 7 ) {
nkeynes@359
   650
                            case 0x0:
nkeynes@359
   651
                                switch( (ir&0x70) >> 4 ) {
nkeynes@359
   652
                                    case 0x0:
nkeynes@359
   653
                                        { /* STC.L SR, @-Rn */
nkeynes@359
   654
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   655
                                        snprintf( buf, len, "STC.L   SR, @-R%d", Rn );
nkeynes@359
   656
                                        }
nkeynes@359
   657
                                        break;
nkeynes@359
   658
                                    case 0x1:
nkeynes@359
   659
                                        { /* STC.L GBR, @-Rn */
nkeynes@359
   660
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   661
                                        snprintf( buf, len, "STC.L   GBR, @-R%d", Rn );
nkeynes@359
   662
                                        }
nkeynes@359
   663
                                        break;
nkeynes@359
   664
                                    case 0x2:
nkeynes@359
   665
                                        { /* STC.L VBR, @-Rn */
nkeynes@359
   666
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   667
                                        snprintf( buf, len, "STC.L   VBR, @-R%d", Rn );
nkeynes@359
   668
                                        }
nkeynes@359
   669
                                        break;
nkeynes@359
   670
                                    case 0x3:
nkeynes@359
   671
                                        { /* STC.L SSR, @-Rn */
nkeynes@359
   672
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   673
                                        snprintf( buf, len, "STC.L   SSR, @-R%d", Rn );
nkeynes@359
   674
                                        }
nkeynes@359
   675
                                        break;
nkeynes@359
   676
                                    case 0x4:
nkeynes@359
   677
                                        { /* STC.L SPC, @-Rn */
nkeynes@359
   678
                                        uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   679
                                        snprintf( buf, len, "STC.L   SPC, @-R%d", Rn );
nkeynes@359
   680
                                        }
nkeynes@359
   681
                                        break;
nkeynes@359
   682
                                    default:
nkeynes@359
   683
                                        UNDEF();
nkeynes@359
   684
                                        break;
nkeynes@359
   685
                                }
nkeynes@359
   686
                                break;
nkeynes@359
   687
                            case 0x1:
nkeynes@359
   688
                                { /* STC.L Rm_BANK, @-Rn */
nkeynes@359
   689
                                uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm_BANK = ((ir>>4)&0x7); 
nkeynes@359
   690
                                snprintf( buf, len, "STC.L   @-R%d_BANK, @-R%d", Rm_BANK, Rn );
nkeynes@359
   691
                                }
nkeynes@359
   692
                                break;
nkeynes@359
   693
                        }
nkeynes@359
   694
                        break;
nkeynes@359
   695
                    case 0x4:
nkeynes@359
   696
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   697
                            case 0x0:
nkeynes@359
   698
                                { /* ROTL Rn */
nkeynes@359
   699
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   700
                                snprintf( buf, len, "ROTL    R%d", Rn );
nkeynes@359
   701
                                }
nkeynes@359
   702
                                break;
nkeynes@359
   703
                            case 0x2:
nkeynes@359
   704
                                { /* ROTCL Rn */
nkeynes@359
   705
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   706
                                snprintf( buf, len, "ROTCL   R%d", Rn );
nkeynes@359
   707
                                }
nkeynes@359
   708
                                break;
nkeynes@359
   709
                            default:
nkeynes@359
   710
                                UNDEF();
nkeynes@359
   711
                                break;
nkeynes@359
   712
                        }
nkeynes@359
   713
                        break;
nkeynes@359
   714
                    case 0x5:
nkeynes@359
   715
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   716
                            case 0x0:
nkeynes@359
   717
                                { /* ROTR Rn */
nkeynes@359
   718
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   719
                                snprintf( buf, len, "ROTR    R%d", Rn );
nkeynes@359
   720
                                }
nkeynes@359
   721
                                break;
nkeynes@359
   722
                            case 0x1:
nkeynes@359
   723
                                { /* CMP/PL Rn */
nkeynes@359
   724
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   725
                                snprintf( buf, len, "CMP/PL  R%d", Rn );
nkeynes@359
   726
                                }
nkeynes@359
   727
                                break;
nkeynes@359
   728
                            case 0x2:
nkeynes@359
   729
                                { /* ROTCR Rn */
nkeynes@359
   730
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   731
                                snprintf( buf, len, "ROTCR   R%d", Rn );
nkeynes@359
   732
                                }
nkeynes@359
   733
                                break;
nkeynes@359
   734
                            default:
nkeynes@359
   735
                                UNDEF();
nkeynes@359
   736
                                break;
nkeynes@359
   737
                        }
nkeynes@359
   738
                        break;
nkeynes@359
   739
                    case 0x6:
nkeynes@359
   740
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   741
                            case 0x0:
nkeynes@359
   742
                                { /* LDS.L @Rm+, MACH */
nkeynes@359
   743
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   744
                                snprintf( buf, len, "LDS.L   @R%d+, MACH", Rm );
nkeynes@359
   745
                                }
nkeynes@359
   746
                                break;
nkeynes@359
   747
                            case 0x1:
nkeynes@359
   748
                                { /* LDS.L @Rm+, MACL */
nkeynes@359
   749
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   750
                                snprintf( buf, len, "LDS.L   @R%d+, MACL", Rm );
nkeynes@359
   751
                                }
nkeynes@359
   752
                                break;
nkeynes@359
   753
                            case 0x2:
nkeynes@359
   754
                                { /* LDS.L @Rm+, PR */
nkeynes@359
   755
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   756
                                snprintf( buf, len, "LDS.L   @R%d+, PR", Rm );
nkeynes@359
   757
                                }
nkeynes@359
   758
                                break;
nkeynes@359
   759
                            case 0x3:
nkeynes@359
   760
                                { /* LDC.L @Rm+, SGR */
nkeynes@359
   761
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   762
                                snprintf( buf, len, "LDC.L   @R%d+, SGR", Rm );
nkeynes@359
   763
                                }
nkeynes@359
   764
                                break;
nkeynes@359
   765
                            case 0x5:
nkeynes@359
   766
                                { /* LDS.L @Rm+, FPUL */
nkeynes@359
   767
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   768
                                snprintf( buf, len, "LDS.L   @R%d+, FPUL", Rm );
nkeynes@359
   769
                                }
nkeynes@359
   770
                                break;
nkeynes@359
   771
                            case 0x6:
nkeynes@359
   772
                                { /* LDS.L @Rm+, FPSCR */
nkeynes@359
   773
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   774
                                snprintf( buf, len, "LDS.L   @R%d+, FPSCR", Rm );
nkeynes@359
   775
                                }
nkeynes@359
   776
                                break;
nkeynes@359
   777
                            case 0xF:
nkeynes@359
   778
                                { /* LDC.L @Rm+, DBR */
nkeynes@359
   779
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   780
                                snprintf( buf, len, "LDC.L   @R%d+, DBR", Rm );
nkeynes@359
   781
                                }
nkeynes@359
   782
                                break;
nkeynes@359
   783
                            default:
nkeynes@359
   784
                                UNDEF();
nkeynes@359
   785
                                break;
nkeynes@359
   786
                        }
nkeynes@359
   787
                        break;
nkeynes@359
   788
                    case 0x7:
nkeynes@359
   789
                        switch( (ir&0x80) >> 7 ) {
nkeynes@359
   790
                            case 0x0:
nkeynes@359
   791
                                switch( (ir&0x70) >> 4 ) {
nkeynes@359
   792
                                    case 0x0:
nkeynes@359
   793
                                        { /* LDC.L @Rm+, SR */
nkeynes@359
   794
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   795
                                        snprintf( buf, len, "LDC.L   @R%d+, SR", Rm );
nkeynes@359
   796
                                        }
nkeynes@359
   797
                                        break;
nkeynes@359
   798
                                    case 0x1:
nkeynes@359
   799
                                        { /* LDC.L @Rm+, GBR */
nkeynes@359
   800
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   801
                                        snprintf( buf, len, "LDC.L   @R%d+, GBR", Rm );
nkeynes@359
   802
                                        }
nkeynes@359
   803
                                        break;
nkeynes@359
   804
                                    case 0x2:
nkeynes@359
   805
                                        { /* LDC.L @Rm+, VBR */
nkeynes@359
   806
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   807
                                        snprintf( buf, len, "LDC.L   @R%d+, VBR", Rm );
nkeynes@359
   808
                                        }
nkeynes@359
   809
                                        break;
nkeynes@359
   810
                                    case 0x3:
nkeynes@359
   811
                                        { /* LDC.L @Rm+, SSR */
nkeynes@359
   812
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   813
                                        snprintf( buf, len, "LDC.L   @R%d+, SSR", Rm );
nkeynes@359
   814
                                        }
nkeynes@359
   815
                                        break;
nkeynes@359
   816
                                    case 0x4:
nkeynes@359
   817
                                        { /* LDC.L @Rm+, SPC */
nkeynes@359
   818
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   819
                                        snprintf( buf, len, "LDC.L   @R%d+, SPC", Rm );
nkeynes@359
   820
                                        }
nkeynes@359
   821
                                        break;
nkeynes@359
   822
                                    default:
nkeynes@359
   823
                                        UNDEF();
nkeynes@359
   824
                                        break;
nkeynes@359
   825
                                }
nkeynes@359
   826
                                break;
nkeynes@359
   827
                            case 0x1:
nkeynes@359
   828
                                { /* LDC.L @Rm+, Rn_BANK */
nkeynes@359
   829
                                uint32_t Rm = ((ir>>8)&0xF); uint32_t Rn_BANK = ((ir>>4)&0x7); 
nkeynes@359
   830
                                snprintf( buf, len, "LDC.L   @R%d+, @R%d+_BANK", Rm, Rn_BANK );
nkeynes@359
   831
                                }
nkeynes@359
   832
                                break;
nkeynes@359
   833
                        }
nkeynes@359
   834
                        break;
nkeynes@359
   835
                    case 0x8:
nkeynes@359
   836
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   837
                            case 0x0:
nkeynes@359
   838
                                { /* SHLL2 Rn */
nkeynes@359
   839
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   840
                                snprintf( buf, len, "SHLL2   R%d", Rn );
nkeynes@359
   841
                                }
nkeynes@359
   842
                                break;
nkeynes@359
   843
                            case 0x1:
nkeynes@359
   844
                                { /* SHLL8 Rn */
nkeynes@359
   845
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   846
                                snprintf( buf, len, "SHLL8   R%d", Rn );
nkeynes@359
   847
                                }
nkeynes@359
   848
                                break;
nkeynes@359
   849
                            case 0x2:
nkeynes@359
   850
                                { /* SHLL16 Rn */
nkeynes@359
   851
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   852
                                snprintf( buf, len, "SHLL16  R%d", Rn );
nkeynes@359
   853
                                }
nkeynes@359
   854
                                break;
nkeynes@359
   855
                            default:
nkeynes@359
   856
                                UNDEF();
nkeynes@359
   857
                                break;
nkeynes@359
   858
                        }
nkeynes@359
   859
                        break;
nkeynes@359
   860
                    case 0x9:
nkeynes@359
   861
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   862
                            case 0x0:
nkeynes@359
   863
                                { /* SHLR2 Rn */
nkeynes@359
   864
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   865
                                snprintf( buf, len, "SHLR2   R%d", Rn );
nkeynes@359
   866
                                }
nkeynes@359
   867
                                break;
nkeynes@359
   868
                            case 0x1:
nkeynes@359
   869
                                { /* SHLR8 Rn */
nkeynes@359
   870
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   871
                                snprintf( buf, len, "SHLR8   R%d", Rn );
nkeynes@359
   872
                                }
nkeynes@359
   873
                                break;
nkeynes@359
   874
                            case 0x2:
nkeynes@359
   875
                                { /* SHLR16 Rn */
nkeynes@359
   876
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   877
                                snprintf( buf, len, "SHLR16  R%d", Rn );
nkeynes@359
   878
                                }
nkeynes@359
   879
                                break;
nkeynes@359
   880
                            default:
nkeynes@359
   881
                                UNDEF();
nkeynes@359
   882
                                break;
nkeynes@359
   883
                        }
nkeynes@359
   884
                        break;
nkeynes@359
   885
                    case 0xA:
nkeynes@359
   886
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   887
                            case 0x0:
nkeynes@359
   888
                                { /* LDS Rm, MACH */
nkeynes@359
   889
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   890
                                snprintf( buf, len, "LDS     R%d, MACH", Rm );
nkeynes@359
   891
                                }
nkeynes@359
   892
                                break;
nkeynes@359
   893
                            case 0x1:
nkeynes@359
   894
                                { /* LDS Rm, MACL */
nkeynes@359
   895
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   896
                                snprintf( buf, len, "LDS     R%d, MACL", Rm );
nkeynes@359
   897
                                }
nkeynes@359
   898
                                break;
nkeynes@359
   899
                            case 0x2:
nkeynes@359
   900
                                { /* LDS Rm, PR */
nkeynes@359
   901
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   902
                                snprintf( buf, len, "LDS     R%d, PR", Rm );
nkeynes@359
   903
                                }
nkeynes@359
   904
                                break;
nkeynes@359
   905
                            case 0x3:
nkeynes@359
   906
                                { /* LDC Rm, SGR */
nkeynes@359
   907
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   908
                                snprintf( buf, len, "LDC     R%d, SGR", Rm );
nkeynes@359
   909
                                }
nkeynes@359
   910
                                break;
nkeynes@359
   911
                            case 0x5:
nkeynes@359
   912
                                { /* LDS Rm, FPUL */
nkeynes@359
   913
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   914
                                snprintf( buf, len, "LDS     R%d, FPUL", Rm );
nkeynes@359
   915
                                }
nkeynes@359
   916
                                break;
nkeynes@359
   917
                            case 0x6:
nkeynes@359
   918
                                { /* LDS Rm, FPSCR */
nkeynes@359
   919
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   920
                                snprintf( buf, len, "LDS     R%d, FPSCR", Rm );
nkeynes@359
   921
                                }
nkeynes@359
   922
                                break;
nkeynes@359
   923
                            case 0xF:
nkeynes@359
   924
                                { /* LDC Rm, DBR */
nkeynes@359
   925
                                uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   926
                                snprintf( buf, len, "LDC     R%d, DBR", Rm );
nkeynes@359
   927
                                }
nkeynes@359
   928
                                break;
nkeynes@359
   929
                            default:
nkeynes@359
   930
                                UNDEF();
nkeynes@359
   931
                                break;
nkeynes@359
   932
                        }
nkeynes@359
   933
                        break;
nkeynes@359
   934
                    case 0xB:
nkeynes@359
   935
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
   936
                            case 0x0:
nkeynes@359
   937
                                { /* JSR @Rn */
nkeynes@359
   938
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   939
                                snprintf( buf, len, "JSR     @R%d", Rn );
nkeynes@359
   940
                                }
nkeynes@359
   941
                                break;
nkeynes@359
   942
                            case 0x1:
nkeynes@359
   943
                                { /* TAS.B @Rn */
nkeynes@359
   944
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   945
                                snprintf( buf, len, "TAS.B   R%d", Rn );
nkeynes@359
   946
                                }
nkeynes@359
   947
                                break;
nkeynes@359
   948
                            case 0x2:
nkeynes@359
   949
                                { /* JMP @Rn */
nkeynes@359
   950
                                uint32_t Rn = ((ir>>8)&0xF); 
nkeynes@359
   951
                                snprintf( buf, len, "JMP     @R%d", Rn );
nkeynes@359
   952
                                }
nkeynes@359
   953
                                break;
nkeynes@359
   954
                            default:
nkeynes@359
   955
                                UNDEF();
nkeynes@359
   956
                                break;
nkeynes@359
   957
                        }
nkeynes@359
   958
                        break;
nkeynes@359
   959
                    case 0xC:
nkeynes@359
   960
                        { /* SHAD Rm, Rn */
nkeynes@359
   961
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   962
                        snprintf( buf, len, "SHAD    R%d, R%d", Rm, Rn );
nkeynes@359
   963
                        }
nkeynes@359
   964
                        break;
nkeynes@359
   965
                    case 0xD:
nkeynes@359
   966
                        { /* SHLD Rm, Rn */
nkeynes@359
   967
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
   968
                        snprintf( buf, len, "SHLD    R%d, R%d", Rm, Rn );
nkeynes@359
   969
                        }
nkeynes@359
   970
                        break;
nkeynes@359
   971
                    case 0xE:
nkeynes@359
   972
                        switch( (ir&0x80) >> 7 ) {
nkeynes@359
   973
                            case 0x0:
nkeynes@359
   974
                                switch( (ir&0x70) >> 4 ) {
nkeynes@359
   975
                                    case 0x0:
nkeynes@359
   976
                                        { /* LDC Rm, SR */
nkeynes@359
   977
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   978
                                        snprintf( buf, len, "LDC     R%d, SR", Rm );
nkeynes@359
   979
                                        }
nkeynes@359
   980
                                        break;
nkeynes@359
   981
                                    case 0x1:
nkeynes@359
   982
                                        { /* LDC Rm, GBR */
nkeynes@359
   983
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   984
                                        snprintf( buf, len, "LDC     R%d, GBR", Rm );
nkeynes@359
   985
                                        }
nkeynes@359
   986
                                        break;
nkeynes@359
   987
                                    case 0x2:
nkeynes@359
   988
                                        { /* LDC Rm, VBR */
nkeynes@359
   989
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   990
                                        snprintf( buf, len, "LDC     R%d, VBR", Rm );
nkeynes@359
   991
                                        }
nkeynes@359
   992
                                        break;
nkeynes@359
   993
                                    case 0x3:
nkeynes@359
   994
                                        { /* LDC Rm, SSR */
nkeynes@359
   995
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
   996
                                        snprintf( buf, len, "LDC     R%d, SSR", Rm );
nkeynes@359
   997
                                        }
nkeynes@359
   998
                                        break;
nkeynes@359
   999
                                    case 0x4:
nkeynes@359
  1000
                                        { /* LDC Rm, SPC */
nkeynes@359
  1001
                                        uint32_t Rm = ((ir>>8)&0xF); 
nkeynes@359
  1002
                                        snprintf( buf, len, "LDC     R%d, SPC", Rm );
nkeynes@359
  1003
                                        }
nkeynes@359
  1004
                                        break;
nkeynes@359
  1005
                                    default:
nkeynes@359
  1006
                                        UNDEF();
nkeynes@359
  1007
                                        break;
nkeynes@359
  1008
                                }
nkeynes@359
  1009
                                break;
nkeynes@359
  1010
                            case 0x1:
nkeynes@359
  1011
                                { /* LDC Rm, Rn_BANK */
nkeynes@359
  1012
                                uint32_t Rm = ((ir>>8)&0xF); uint32_t Rn_BANK = ((ir>>4)&0x7); 
nkeynes@359
  1013
                                snprintf( buf, len, "LDC     R%d, R%d_BANK", Rm, Rn_BANK );
nkeynes@359
  1014
                                }
nkeynes@359
  1015
                                break;
nkeynes@359
  1016
                        }
nkeynes@359
  1017
                        break;
nkeynes@359
  1018
                    case 0xF:
nkeynes@359
  1019
                        { /* MAC.W @Rm+, @Rn+ */
nkeynes@359
  1020
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1021
                        snprintf( buf, len, "MAC.W   @R%d+, @R%d+", Rm, Rn );
nkeynes@359
  1022
                        }
nkeynes@359
  1023
                        break;
nkeynes@359
  1024
                }
nkeynes@359
  1025
                break;
nkeynes@359
  1026
            case 0x5:
nkeynes@359
  1027
                { /* MOV.L @(disp, Rm), Rn */
nkeynes@359
  1028
                uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); uint32_t disp = (ir&0xF)<<2; 
nkeynes@496
  1029
                snprintf( buf, len, "MOV.L   @(%d, R%d), R%d", disp, Rm, Rn );
nkeynes@359
  1030
                }
nkeynes@359
  1031
                break;
nkeynes@359
  1032
            case 0x6:
nkeynes@359
  1033
                switch( ir&0xF ) {
nkeynes@359
  1034
                    case 0x0:
nkeynes@359
  1035
                        { /* MOV.B @Rm, Rn */
nkeynes@359
  1036
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1037
                        snprintf( buf, len, "MOV.B   @R%d, R%d", Rm, Rn );
nkeynes@359
  1038
                        }
nkeynes@359
  1039
                        break;
nkeynes@359
  1040
                    case 0x1:
nkeynes@359
  1041
                        { /* MOV.W @Rm, Rn */
nkeynes@359
  1042
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1043
                        snprintf( buf, len, "MOV.W   @R%d, R%d", Rm, Rn );
nkeynes@359
  1044
                        }
nkeynes@359
  1045
                        break;
nkeynes@359
  1046
                    case 0x2:
nkeynes@359
  1047
                        { /* MOV.L @Rm, Rn */
nkeynes@359
  1048
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1049
                        snprintf( buf, len, "MOV.L   @R%d, R%d", Rm, Rn );
nkeynes@359
  1050
                        }
nkeynes@359
  1051
                        break;
nkeynes@359
  1052
                    case 0x3:
nkeynes@359
  1053
                        { /* MOV Rm, Rn */
nkeynes@359
  1054
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1055
                        snprintf( buf, len, "MOV     R%d, R%d", Rm, Rn );
nkeynes@359
  1056
                        }
nkeynes@359
  1057
                        break;
nkeynes@359
  1058
                    case 0x4:
nkeynes@359
  1059
                        { /* MOV.B @Rm+, Rn */
nkeynes@359
  1060
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1061
                        snprintf( buf, len, "MOV.B   @R%d+, R%d", Rm, Rn );
nkeynes@359
  1062
                        }
nkeynes@359
  1063
                        break;
nkeynes@359
  1064
                    case 0x5:
nkeynes@359
  1065
                        { /* MOV.W @Rm+, Rn */
nkeynes@359
  1066
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1067
                        snprintf( buf, len, "MOV.W   @R%d+, R%d", Rm, Rn );
nkeynes@359
  1068
                        }
nkeynes@359
  1069
                        break;
nkeynes@359
  1070
                    case 0x6:
nkeynes@359
  1071
                        { /* MOV.L @Rm+, Rn */
nkeynes@359
  1072
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1073
                        snprintf( buf, len, "MOV.L   @R%d+, R%d", Rm, Rn );
nkeynes@359
  1074
                        }
nkeynes@359
  1075
                        break;
nkeynes@359
  1076
                    case 0x7:
nkeynes@359
  1077
                        { /* NOT Rm, Rn */
nkeynes@359
  1078
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1079
                        snprintf( buf, len, "NOT     R%d, R%d", Rm, Rn );
nkeynes@359
  1080
                        }
nkeynes@359
  1081
                        break;
nkeynes@359
  1082
                    case 0x8:
nkeynes@359
  1083
                        { /* SWAP.B Rm, Rn */
nkeynes@359
  1084
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1085
                        snprintf( buf, len, "SWAP.B  R%d, R%d", Rm, Rn );
nkeynes@359
  1086
                        }
nkeynes@359
  1087
                        break;
nkeynes@359
  1088
                    case 0x9:
nkeynes@359
  1089
                        { /* SWAP.W Rm, Rn */
nkeynes@359
  1090
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1091
                        snprintf( buf, len, "SWAP.W  R%d, R%d", Rm, Rn );
nkeynes@359
  1092
                        }
nkeynes@359
  1093
                        break;
nkeynes@359
  1094
                    case 0xA:
nkeynes@359
  1095
                        { /* NEGC Rm, Rn */
nkeynes@359
  1096
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1097
                        snprintf( buf, len, "NEGC    R%d, R%d", Rm, Rn );
nkeynes@359
  1098
                        }
nkeynes@359
  1099
                        break;
nkeynes@359
  1100
                    case 0xB:
nkeynes@359
  1101
                        { /* NEG Rm, Rn */
nkeynes@359
  1102
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1103
                        snprintf( buf, len, "NEG     R%d, R%d", Rm, Rn );
nkeynes@359
  1104
                        }
nkeynes@359
  1105
                        break;
nkeynes@359
  1106
                    case 0xC:
nkeynes@359
  1107
                        { /* EXTU.B Rm, Rn */
nkeynes@359
  1108
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1109
                        snprintf( buf, len, "EXTU.B  R%d, R%d", Rm, Rn );
nkeynes@359
  1110
                        }
nkeynes@359
  1111
                        break;
nkeynes@359
  1112
                    case 0xD:
nkeynes@359
  1113
                        { /* EXTU.W Rm, Rn */
nkeynes@359
  1114
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1115
                        snprintf( buf, len, "EXTU.W  R%d, R%d", Rm, Rn );
nkeynes@359
  1116
                        }
nkeynes@359
  1117
                        break;
nkeynes@359
  1118
                    case 0xE:
nkeynes@359
  1119
                        { /* EXTS.B Rm, Rn */
nkeynes@359
  1120
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1121
                        snprintf( buf, len, "EXTS.B  R%d, R%d", Rm, Rn );
nkeynes@359
  1122
                        }
nkeynes@359
  1123
                        break;
nkeynes@359
  1124
                    case 0xF:
nkeynes@359
  1125
                        { /* EXTS.W Rm, Rn */
nkeynes@359
  1126
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1127
                        snprintf( buf, len, "EXTS.W  R%d, R%d", Rm, Rn );
nkeynes@359
  1128
                        }
nkeynes@359
  1129
                        break;
nkeynes@359
  1130
                }
nkeynes@359
  1131
                break;
nkeynes@359
  1132
            case 0x7:
nkeynes@359
  1133
                { /* ADD #imm, Rn */
nkeynes@359
  1134
                uint32_t Rn = ((ir>>8)&0xF); int32_t imm = SIGNEXT8(ir&0xFF); 
nkeynes@359
  1135
                snprintf( buf, len, "ADD     #%d, R%d", imm, Rn );
nkeynes@359
  1136
                }
nkeynes@359
  1137
                break;
nkeynes@359
  1138
            case 0x8:
nkeynes@359
  1139
                switch( (ir&0xF00) >> 8 ) {
nkeynes@359
  1140
                    case 0x0:
nkeynes@359
  1141
                        { /* MOV.B R0, @(disp, Rn) */
nkeynes@359
  1142
                        uint32_t Rn = ((ir>>4)&0xF); uint32_t disp = (ir&0xF); 
nkeynes@359
  1143
                        snprintf( buf, len, "MOV.B   R0, @(%d, R%d)", disp, Rn );
nkeynes@359
  1144
                        }
nkeynes@359
  1145
                        break;
nkeynes@359
  1146
                    case 0x1:
nkeynes@359
  1147
                        { /* MOV.W R0, @(disp, Rn) */
nkeynes@359
  1148
                        uint32_t Rn = ((ir>>4)&0xF); uint32_t disp = (ir&0xF)<<1; 
nkeynes@430
  1149
                        snprintf( buf, len, "MOV.W   R0, @(%d, R%d)", disp, Rn );
nkeynes@359
  1150
                        }
nkeynes@359
  1151
                        break;
nkeynes@359
  1152
                    case 0x4:
nkeynes@359
  1153
                        { /* MOV.B @(disp, Rm), R0 */
nkeynes@359
  1154
                        uint32_t Rm = ((ir>>4)&0xF); uint32_t disp = (ir&0xF); 
nkeynes@359
  1155
                        snprintf( buf, len, "MOV.B   @(%d, R%d), R0", disp, Rm );
nkeynes@359
  1156
                        }
nkeynes@359
  1157
                        break;
nkeynes@359
  1158
                    case 0x5:
nkeynes@359
  1159
                        { /* MOV.W @(disp, Rm), R0 */
nkeynes@359
  1160
                        uint32_t Rm = ((ir>>4)&0xF); uint32_t disp = (ir&0xF)<<1; 
nkeynes@359
  1161
                        snprintf( buf, len, "MOV.W   @(%d, R%d), R0", disp, Rm );
nkeynes@359
  1162
                        }
nkeynes@359
  1163
                        break;
nkeynes@359
  1164
                    case 0x8:
nkeynes@359
  1165
                        { /* CMP/EQ #imm, R0 */
nkeynes@359
  1166
                        int32_t imm = SIGNEXT8(ir&0xFF); 
nkeynes@359
  1167
                        snprintf( buf, len, "CMP/EQ  #%d, R0", imm );
nkeynes@359
  1168
                        }
nkeynes@359
  1169
                        break;
nkeynes@359
  1170
                    case 0x9:
nkeynes@359
  1171
                        { /* BT disp */
nkeynes@359
  1172
                        int32_t disp = SIGNEXT8(ir&0xFF)<<1; 
nkeynes@359
  1173
                        snprintf( buf, len, "BT      $%xh", disp+pc+4 );
nkeynes@359
  1174
                        }
nkeynes@359
  1175
                        break;
nkeynes@359
  1176
                    case 0xB:
nkeynes@359
  1177
                        { /* BF disp */
nkeynes@359
  1178
                        int32_t disp = SIGNEXT8(ir&0xFF)<<1; 
nkeynes@359
  1179
                        snprintf( buf, len, "BF      $%xh", disp+pc+4 );
nkeynes@359
  1180
                        }
nkeynes@359
  1181
                        break;
nkeynes@359
  1182
                    case 0xD:
nkeynes@359
  1183
                        { /* BT/S disp */
nkeynes@359
  1184
                        int32_t disp = SIGNEXT8(ir&0xFF)<<1; 
nkeynes@359
  1185
                        snprintf( buf, len, "BT/S    $%xh", disp+pc+4 );
nkeynes@359
  1186
                        }
nkeynes@359
  1187
                        break;
nkeynes@359
  1188
                    case 0xF:
nkeynes@359
  1189
                        { /* BF/S disp */
nkeynes@359
  1190
                        int32_t disp = SIGNEXT8(ir&0xFF)<<1; 
nkeynes@359
  1191
                        snprintf( buf, len, "BF/S    $%xh", disp+pc+4 );
nkeynes@359
  1192
                        }
nkeynes@359
  1193
                        break;
nkeynes@359
  1194
                    default:
nkeynes@359
  1195
                        UNDEF();
nkeynes@359
  1196
                        break;
nkeynes@359
  1197
                }
nkeynes@359
  1198
                break;
nkeynes@359
  1199
            case 0x9:
nkeynes@359
  1200
                { /* MOV.W @(disp, PC), Rn */
nkeynes@359
  1201
                uint32_t Rn = ((ir>>8)&0xF); uint32_t disp = (ir&0xFF)<<1; 
nkeynes@359
  1202
                snprintf( buf, len, "MOV.W   @($%xh), R%d ; <- #%08x", disp + pc + 4, Rn, sh4_read_word(disp+pc+4) );
nkeynes@359
  1203
                }
nkeynes@359
  1204
                break;
nkeynes@359
  1205
            case 0xA:
nkeynes@359
  1206
                { /* BRA disp */
nkeynes@359
  1207
                int32_t disp = SIGNEXT12(ir&0xFFF)<<1; 
nkeynes@359
  1208
                snprintf( buf, len, "BRA     $%xh", disp+pc+4 );
nkeynes@359
  1209
                }
nkeynes@359
  1210
                break;
nkeynes@359
  1211
            case 0xB:
nkeynes@359
  1212
                { /* BSR disp */
nkeynes@359
  1213
                int32_t disp = SIGNEXT12(ir&0xFFF)<<1; 
nkeynes@359
  1214
                snprintf( buf, len, "BSR     $%xh", disp+pc+4 );
nkeynes@359
  1215
                }
nkeynes@359
  1216
                break;
nkeynes@359
  1217
            case 0xC:
nkeynes@359
  1218
                switch( (ir&0xF00) >> 8 ) {
nkeynes@359
  1219
                    case 0x0:
nkeynes@359
  1220
                        { /* MOV.B R0, @(disp, GBR) */
nkeynes@359
  1221
                        uint32_t disp = (ir&0xFF); 
nkeynes@359
  1222
                        snprintf( buf, len, "MOV.B   R0, @(%d, GBR)", disp );
nkeynes@359
  1223
                        }
nkeynes@359
  1224
                        break;
nkeynes@359
  1225
                    case 0x1:
nkeynes@359
  1226
                        { /* MOV.W R0, @(disp, GBR) */
nkeynes@359
  1227
                        uint32_t disp = (ir&0xFF)<<1; 
nkeynes@359
  1228
                        snprintf( buf, len, "MOV.W   R0, @(%d, GBR)", disp);
nkeynes@359
  1229
                        }
nkeynes@359
  1230
                        break;
nkeynes@359
  1231
                    case 0x2:
nkeynes@359
  1232
                        { /* MOV.L R0, @(disp, GBR) */
nkeynes@359
  1233
                        uint32_t disp = (ir&0xFF)<<2; 
nkeynes@359
  1234
                        snprintf( buf, len, "MOV.L   R0, @(%d, GBR)", disp );
nkeynes@359
  1235
                        }
nkeynes@359
  1236
                        break;
nkeynes@359
  1237
                    case 0x3:
nkeynes@359
  1238
                        { /* TRAPA #imm */
nkeynes@359
  1239
                        uint32_t imm = (ir&0xFF); 
nkeynes@359
  1240
                        snprintf( buf, len, "TRAPA   #%d", imm );
nkeynes@359
  1241
                        }
nkeynes@359
  1242
                        break;
nkeynes@359
  1243
                    case 0x4:
nkeynes@359
  1244
                        { /* MOV.B @(disp, GBR), R0 */
nkeynes@359
  1245
                        uint32_t disp = (ir&0xFF); 
nkeynes@359
  1246
                        snprintf( buf, len, "MOV.B   @(%d, GBR), R0", disp );
nkeynes@359
  1247
                        }
nkeynes@359
  1248
                        break;
nkeynes@359
  1249
                    case 0x5:
nkeynes@359
  1250
                        { /* MOV.W @(disp, GBR), R0 */
nkeynes@359
  1251
                        uint32_t disp = (ir&0xFF)<<1; 
nkeynes@359
  1252
                        snprintf( buf, len, "MOV.W   @(%d, GBR), R0", disp );
nkeynes@359
  1253
                        }
nkeynes@359
  1254
                        break;
nkeynes@359
  1255
                    case 0x6:
nkeynes@359
  1256
                        { /* MOV.L @(disp, GBR), R0 */
nkeynes@359
  1257
                        uint32_t disp = (ir&0xFF)<<2; 
nkeynes@359
  1258
                        snprintf( buf, len, "MOV.L   @(%d, GBR), R0",disp );
nkeynes@359
  1259
                        }
nkeynes@359
  1260
                        break;
nkeynes@359
  1261
                    case 0x7:
nkeynes@359
  1262
                        { /* MOVA @(disp, PC), R0 */
nkeynes@359
  1263
                        uint32_t disp = (ir&0xFF)<<2; 
nkeynes@359
  1264
                        snprintf( buf, len, "MOVA    @($%xh), R0", disp + (pc&0xFFFFFFFC) + 4 );
nkeynes@359
  1265
                        }
nkeynes@359
  1266
                        break;
nkeynes@359
  1267
                    case 0x8:
nkeynes@359
  1268
                        { /* TST #imm, R0 */
nkeynes@359
  1269
                        uint32_t imm = (ir&0xFF); 
nkeynes@359
  1270
                        snprintf( buf, len, "TST     #%d, R0", imm );
nkeynes@359
  1271
                        }
nkeynes@359
  1272
                        break;
nkeynes@359
  1273
                    case 0x9:
nkeynes@359
  1274
                        { /* AND #imm, R0 */
nkeynes@359
  1275
                        uint32_t imm = (ir&0xFF); 
nkeynes@359
  1276
                        snprintf( buf, len, "ADD     #%d, R0", imm );
nkeynes@359
  1277
                        }
nkeynes@359
  1278
                        break;
nkeynes@359
  1279
                    case 0xA:
nkeynes@359
  1280
                        { /* XOR #imm, R0 */
nkeynes@359
  1281
                        uint32_t imm = (ir&0xFF); 
nkeynes@359
  1282
                        snprintf( buf, len, "XOR     #%d, R0", imm );
nkeynes@359
  1283
                        }
nkeynes@359
  1284
                        break;
nkeynes@359
  1285
                    case 0xB:
nkeynes@359
  1286
                        { /* OR #imm, R0 */
nkeynes@359
  1287
                        uint32_t imm = (ir&0xFF); 
nkeynes@359
  1288
                        snprintf( buf, len, "OR      #%d, R0", imm );
nkeynes@359
  1289
                        }
nkeynes@359
  1290
                        break;
nkeynes@359
  1291
                    case 0xC:
nkeynes@359
  1292
                        { /* TST.B #imm, @(R0, GBR) */
nkeynes@359
  1293
                        uint32_t imm = (ir&0xFF); 
nkeynes@359
  1294
                        snprintf( buf, len, "TST.B   #%d, @(R0, GBR)", imm );
nkeynes@359
  1295
                        }
nkeynes@359
  1296
                        break;
nkeynes@359
  1297
                    case 0xD:
nkeynes@359
  1298
                        { /* AND.B #imm, @(R0, GBR) */
nkeynes@359
  1299
                        uint32_t imm = (ir&0xFF); 
nkeynes@359
  1300
                        snprintf( buf, len, "AND.B   #%d, @(R0, GBR)", imm );
nkeynes@359
  1301
                        }
nkeynes@359
  1302
                        break;
nkeynes@359
  1303
                    case 0xE:
nkeynes@359
  1304
                        { /* XOR.B #imm, @(R0, GBR) */
nkeynes@359
  1305
                        uint32_t imm = (ir&0xFF); 
nkeynes@359
  1306
                        snprintf( buf, len, "XOR.B   #%d, @(R0, GBR)", imm );
nkeynes@359
  1307
                        }
nkeynes@359
  1308
                        break;
nkeynes@359
  1309
                    case 0xF:
nkeynes@359
  1310
                        { /* OR.B #imm, @(R0, GBR) */
nkeynes@359
  1311
                        uint32_t imm = (ir&0xFF); 
nkeynes@359
  1312
                        snprintf( buf, len, "OR.B    #%d, @(R0, GBR)", imm );
nkeynes@359
  1313
                        }
nkeynes@359
  1314
                        break;
nkeynes@359
  1315
                }
nkeynes@359
  1316
                break;
nkeynes@359
  1317
            case 0xD:
nkeynes@359
  1318
                { /* MOV.L @(disp, PC), Rn */
nkeynes@359
  1319
                uint32_t Rn = ((ir>>8)&0xF); uint32_t disp = (ir&0xFF)<<2; 
nkeynes@359
  1320
                snprintf( buf, len, "MOV.L   @($%xh), R%d ; <- #%08x", disp + (pc & 0xFFFFFFFC) + 4, Rn, sh4_read_long(disp+(pc&0xFFFFFFFC)+4) );
nkeynes@359
  1321
                }
nkeynes@359
  1322
                break;
nkeynes@359
  1323
            case 0xE:
nkeynes@359
  1324
                { /* MOV #imm, Rn */
nkeynes@359
  1325
                uint32_t Rn = ((ir>>8)&0xF); int32_t imm = SIGNEXT8(ir&0xFF); 
nkeynes@359
  1326
                snprintf( buf, len, "MOV     #%d, R%d", imm, Rn );
nkeynes@359
  1327
                }
nkeynes@359
  1328
                break;
nkeynes@359
  1329
            case 0xF:
nkeynes@359
  1330
                switch( ir&0xF ) {
nkeynes@359
  1331
                    case 0x0:
nkeynes@359
  1332
                        { /* FADD FRm, FRn */
nkeynes@359
  1333
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@359
  1334
                        snprintf( buf, len, "FADD    FR%d, FR%d", FRm, FRn );
nkeynes@359
  1335
                        }
nkeynes@359
  1336
                        break;
nkeynes@359
  1337
                    case 0x1:
nkeynes@359
  1338
                        { /* FSUB FRm, FRn */
nkeynes@359
  1339
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@430
  1340
                        snprintf( buf, len, "FSUB    FR%d, FR%d", FRm, FRn );
nkeynes@359
  1341
                        }
nkeynes@359
  1342
                        break;
nkeynes@359
  1343
                    case 0x2:
nkeynes@359
  1344
                        { /* FMUL FRm, FRn */
nkeynes@359
  1345
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@430
  1346
                        snprintf( buf, len, "FMUL    FR%d, FR%d", FRm, FRn );
nkeynes@359
  1347
                        }
nkeynes@359
  1348
                        break;
nkeynes@359
  1349
                    case 0x3:
nkeynes@359
  1350
                        { /* FDIV FRm, FRn */
nkeynes@359
  1351
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@359
  1352
                        snprintf( buf, len, "FDIV    FR%d, FR%d", FRm, FRn );
nkeynes@359
  1353
                        }
nkeynes@359
  1354
                        break;
nkeynes@359
  1355
                    case 0x4:
nkeynes@359
  1356
                        { /* FCMP/EQ FRm, FRn */
nkeynes@359
  1357
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@359
  1358
                        snprintf( buf, len, "FCMP/EQ FR%d, FR%d", FRm, FRn );
nkeynes@359
  1359
                        }
nkeynes@359
  1360
                        break;
nkeynes@359
  1361
                    case 0x5:
nkeynes@359
  1362
                        { /* FCMP/GT FRm, FRn */
nkeynes@359
  1363
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@359
  1364
                        snprintf( buf, len, "FCMP/QT FR%d, FR%d", FRm, FRn );
nkeynes@359
  1365
                        }
nkeynes@359
  1366
                        break;
nkeynes@359
  1367
                    case 0x6:
nkeynes@359
  1368
                        { /* FMOV @(R0, Rm), FRn */
nkeynes@359
  1369
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1370
                        snprintf( buf, len, "FMOV    @(R0, R%d), FR%d", Rm, FRn );
nkeynes@359
  1371
                        }
nkeynes@359
  1372
                        break;
nkeynes@359
  1373
                    case 0x7:
nkeynes@359
  1374
                        { /* FMOV FRm, @(R0, Rn) */
nkeynes@359
  1375
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@359
  1376
                        snprintf( buf, len, "FMOV    FR%d, @(R0, R%d)", FRm, Rn );
nkeynes@359
  1377
                        }
nkeynes@359
  1378
                        break;
nkeynes@359
  1379
                    case 0x8:
nkeynes@359
  1380
                        { /* FMOV @Rm, FRn */
nkeynes@359
  1381
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1382
                        snprintf( buf, len, "FMOV    @R%d, FR%d", Rm, FRn );
nkeynes@359
  1383
                        }
nkeynes@359
  1384
                        break;
nkeynes@359
  1385
                    case 0x9:
nkeynes@359
  1386
                        { /* FMOV @Rm+, FRn */
nkeynes@359
  1387
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t Rm = ((ir>>4)&0xF); 
nkeynes@359
  1388
                        snprintf( buf, len, "FMOV    @R%d+, FR%d", Rm, FRn );
nkeynes@359
  1389
                        }
nkeynes@359
  1390
                        break;
nkeynes@359
  1391
                    case 0xA:
nkeynes@359
  1392
                        { /* FMOV FRm, @Rn */
nkeynes@359
  1393
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@359
  1394
                        snprintf( buf, len, "FMOV    FR%d, @R%d", FRm, Rn );
nkeynes@359
  1395
                        }
nkeynes@359
  1396
                        break;
nkeynes@359
  1397
                    case 0xB:
nkeynes@359
  1398
                        { /* FMOV FRm, @-Rn */
nkeynes@359
  1399
                        uint32_t Rn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@359
  1400
                        snprintf( buf, len, "FMOV    FR%d, @-R%d", FRm, Rn );
nkeynes@359
  1401
                        }
nkeynes@359
  1402
                        break;
nkeynes@359
  1403
                    case 0xC:
nkeynes@359
  1404
                        { /* FMOV FRm, FRn */
nkeynes@359
  1405
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@359
  1406
                        snprintf( buf, len, "FMOV    FR%d, FR%d", FRm, FRn );
nkeynes@359
  1407
                        }
nkeynes@359
  1408
                        break;
nkeynes@359
  1409
                    case 0xD:
nkeynes@359
  1410
                        switch( (ir&0xF0) >> 4 ) {
nkeynes@359
  1411
                            case 0x0:
nkeynes@359
  1412
                                { /* FSTS FPUL, FRn */
nkeynes@359
  1413
                                uint32_t FRn = ((ir>>8)&0xF); 
nkeynes@359
  1414
                                snprintf( buf, len, "FSTS    FPUL, FR%d", FRn );
nkeynes@359
  1415
                                }
nkeynes@359
  1416
                                break;
nkeynes@359
  1417
                            case 0x1:
nkeynes@359
  1418
                                { /* FLDS FRm, FPUL */
nkeynes@359
  1419
                                uint32_t FRm = ((ir>>8)&0xF); 
nkeynes@359
  1420
                                snprintf( buf, len, "FLDS    FR%d, FPUL", FRm );
nkeynes@359
  1421
                                }
nkeynes@359
  1422
                                break;
nkeynes@359
  1423
                            case 0x2:
nkeynes@359
  1424
                                { /* FLOAT FPUL, FRn */
nkeynes@359
  1425
                                uint32_t FRn = ((ir>>8)&0xF); 
nkeynes@359
  1426
                                snprintf( buf, len, "FLOAT   FPUL, FR%d", FRn );
nkeynes@359
  1427
                                }
nkeynes@359
  1428
                                break;
nkeynes@359
  1429
                            case 0x3:
nkeynes@359
  1430
                                { /* FTRC FRm, FPUL */
nkeynes@359
  1431
                                uint32_t FRm = ((ir>>8)&0xF); 
nkeynes@359
  1432
                                snprintf( buf, len, "FTRC    FR%d, FPUL", FRm );
nkeynes@359
  1433
                                }
nkeynes@359
  1434
                                break;
nkeynes@359
  1435
                            case 0x4:
nkeynes@359
  1436
                                { /* FNEG FRn */
nkeynes@359
  1437
                                uint32_t FRn = ((ir>>8)&0xF); 
nkeynes@359
  1438
                                snprintf( buf, len, "FNEG    FR%d", FRn );
nkeynes@359
  1439
                                }
nkeynes@359
  1440
                                break;
nkeynes@359
  1441
                            case 0x5:
nkeynes@359
  1442
                                { /* FABS FRn */
nkeynes@359
  1443
                                uint32_t FRn = ((ir>>8)&0xF); 
nkeynes@359
  1444
                                snprintf( buf, len, "FABS    FR%d", FRn );
nkeynes@359
  1445
                                }
nkeynes@359
  1446
                                break;
nkeynes@359
  1447
                            case 0x6:
nkeynes@359
  1448
                                { /* FSQRT FRn */
nkeynes@359
  1449
                                uint32_t FRn = ((ir>>8)&0xF); 
nkeynes@359
  1450
                                snprintf( buf, len, "FSQRT   FR%d", FRn );
nkeynes@359
  1451
                                }
nkeynes@359
  1452
                                break;
nkeynes@359
  1453
                            case 0x7:
nkeynes@359
  1454
                                { /* FSRRA FRn */
nkeynes@359
  1455
                                uint32_t FRn = ((ir>>8)&0xF); 
nkeynes@359
  1456
                                snprintf( buf, len, "FSRRA   FR%d", FRn );
nkeynes@359
  1457
                                }
nkeynes@359
  1458
                                break;
nkeynes@359
  1459
                            case 0x8:
nkeynes@359
  1460
                                { /* FLDI0 FRn */
nkeynes@359
  1461
                                uint32_t FRn = ((ir>>8)&0xF); 
nkeynes@359
  1462
                                snprintf( buf, len, "FLDI0   FR%d", FRn );
nkeynes@359
  1463
                                }
nkeynes@359
  1464
                                break;
nkeynes@359
  1465
                            case 0x9:
nkeynes@359
  1466
                                { /* FLDI1 FRn */
nkeynes@359
  1467
                                uint32_t FRn = ((ir>>8)&0xF); 
nkeynes@359
  1468
                                snprintf( buf, len, "FLDI1   FR%d", FRn );
nkeynes@359
  1469
                                }
nkeynes@359
  1470
                                break;
nkeynes@359
  1471
                            case 0xA:
nkeynes@359
  1472
                                { /* FCNVSD FPUL, FRn */
nkeynes@359
  1473
                                uint32_t FRn = ((ir>>8)&0xF); 
nkeynes@359
  1474
                                snprintf( buf, len, "FCNVSD  FPUL, FR%d", FRn );
nkeynes@359
  1475
                                }
nkeynes@359
  1476
                                break;
nkeynes@359
  1477
                            case 0xB:
nkeynes@359
  1478
                                { /* FCNVDS FRm, FPUL */
nkeynes@359
  1479
                                uint32_t FRm = ((ir>>8)&0xF); 
nkeynes@359
  1480
                                snprintf( buf, len, "FCNVDS  FR%d, FPUL", FRm );
nkeynes@359
  1481
                                }
nkeynes@359
  1482
                                break;
nkeynes@359
  1483
                            case 0xE:
nkeynes@359
  1484
                                { /* FIPR FVm, FVn */
nkeynes@359
  1485
                                uint32_t FVn = ((ir>>10)&0x3); uint32_t FVm = ((ir>>8)&0x3); 
nkeynes@359
  1486
                                snprintf( buf, len, "FIPR    FV%d, FV%d", FVm, FVn );
nkeynes@359
  1487
                                }
nkeynes@359
  1488
                                break;
nkeynes@359
  1489
                            case 0xF:
nkeynes@359
  1490
                                switch( (ir&0x100) >> 8 ) {
nkeynes@359
  1491
                                    case 0x0:
nkeynes@359
  1492
                                        { /* FSCA FPUL, FRn */
nkeynes@359
  1493
                                        uint32_t FRn = ((ir>>9)&0x7)<<1; 
nkeynes@359
  1494
                                        snprintf( buf, len, "FSCA    FPUL, FR%d", FRn );
nkeynes@359
  1495
                                        }
nkeynes@359
  1496
                                        break;
nkeynes@359
  1497
                                    case 0x1:
nkeynes@359
  1498
                                        switch( (ir&0x200) >> 9 ) {
nkeynes@359
  1499
                                            case 0x0:
nkeynes@359
  1500
                                                { /* FTRV XMTRX, FVn */
nkeynes@359
  1501
                                                uint32_t FVn = ((ir>>10)&0x3); 
nkeynes@359
  1502
                                                snprintf( buf, len, "FTRV    XMTRX, FV%d", FVn );
nkeynes@359
  1503
                                                }
nkeynes@359
  1504
                                                break;
nkeynes@359
  1505
                                            case 0x1:
nkeynes@359
  1506
                                                switch( (ir&0xC00) >> 10 ) {
nkeynes@359
  1507
                                                    case 0x0:
nkeynes@359
  1508
                                                        { /* FSCHG */
nkeynes@359
  1509
                                                        snprintf( buf, len, "FSCHG   " );
nkeynes@359
  1510
                                                        }
nkeynes@359
  1511
                                                        break;
nkeynes@359
  1512
                                                    case 0x2:
nkeynes@359
  1513
                                                        { /* FRCHG */
nkeynes@359
  1514
                                                        snprintf( buf, len, "FRCHG   " );
nkeynes@359
  1515
                                                        }
nkeynes@359
  1516
                                                        break;
nkeynes@359
  1517
                                                    case 0x3:
nkeynes@359
  1518
                                                        { /* UNDEF */
nkeynes@359
  1519
                                                        snprintf( buf, len, "UNDEF   " );
nkeynes@359
  1520
                                                        }
nkeynes@359
  1521
                                                        break;
nkeynes@359
  1522
                                                    default:
nkeynes@359
  1523
                                                        UNDEF();
nkeynes@359
  1524
                                                        break;
nkeynes@359
  1525
                                                }
nkeynes@359
  1526
                                                break;
nkeynes@359
  1527
                                        }
nkeynes@359
  1528
                                        break;
nkeynes@359
  1529
                                }
nkeynes@359
  1530
                                break;
nkeynes@359
  1531
                            default:
nkeynes@359
  1532
                                UNDEF();
nkeynes@359
  1533
                                break;
nkeynes@359
  1534
                        }
nkeynes@359
  1535
                        break;
nkeynes@359
  1536
                    case 0xE:
nkeynes@359
  1537
                        { /* FMAC FR0, FRm, FRn */
nkeynes@359
  1538
                        uint32_t FRn = ((ir>>8)&0xF); uint32_t FRm = ((ir>>4)&0xF); 
nkeynes@359
  1539
                        snprintf( buf, len, "FMAC    FR0, FR%d, FR%d", FRm, FRn );
nkeynes@359
  1540
                        }
nkeynes@359
  1541
                        break;
nkeynes@359
  1542
                    default:
nkeynes@359
  1543
                        UNDEF();
nkeynes@359
  1544
                        break;
nkeynes@359
  1545
                }
nkeynes@359
  1546
                break;
nkeynes@359
  1547
        }
nkeynes@359
  1548
nkeynes@1
  1549
    return pc+2;
nkeynes@1
  1550
}
nkeynes@1
  1551
nkeynes@1
  1552
nkeynes@54
  1553
void sh4_disasm_region( const gchar *filename, int from, int to )
nkeynes@1
  1554
{
nkeynes@1
  1555
    int pc;
nkeynes@1
  1556
    char buf[80];
nkeynes@11
  1557
    char opcode[16];
nkeynes@54
  1558
    FILE *f;
nkeynes@1
  1559
    
nkeynes@54
  1560
    f = fopen( filename, "w" );
nkeynes@1
  1561
    for( pc = from; pc < to; pc+=2 ) {
nkeynes@1
  1562
        buf[0] = '\0';
nkeynes@1
  1563
        sh4_disasm_instruction( pc,
nkeynes@11
  1564
                                buf, sizeof(buf), opcode );
nkeynes@54
  1565
        fprintf( f, "  %08x:  %s  %s\n", pc, opcode, buf );
nkeynes@1
  1566
    }
nkeynes@54
  1567
    fclose(f);
nkeynes@1
  1568
}
.