diff --git a/Makefile.gc b/Makefile.gc index 17f0c48..1d3ea75 100644 --- a/Makefile.gc +++ b/Makefile.gc @@ -17,10 +17,10 @@ include $(DEVKITPPC)/gamecube_rules #--------------------------------------------------------------------------------- TARGET := genplus_cube BUILD := build_cube -SOURCES := source source/m68k source/z80 source/sound source/cart_hw \ - source/cart_hw/svp source/ngc source/ngc/gui source/sound/SRC source/ntsc -INCLUDES := source source/m68k source/z80 source/sound source/cart_hw \ - source/cart_hw/svp source/ngc source/ngc/gui source/sound/SRC source/ntsc +SOURCES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc \ + source/cart_hw source/cart_hw/svp source/ngc source/ngc/gui source/ngc/fileio +INCLUDES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc \ + source/cart_hw source/cart_hw/svp source/ngc source/ngc/gui source/ngc/fileio #--------------------------------------------------------------------------------- # options for code generation diff --git a/Makefile.wii b/Makefile.wii index 1190cfd..01a9390 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -17,10 +17,10 @@ include $(DEVKITPPC)/wii_rules #--------------------------------------------------------------------------------- TARGET := genplus_wii BUILD := build_wii -SOURCES := source source/m68k source/z80 source/sound source/cart_hw\ - source/cart_hw/svp source/ngc source/ngc/gui source/sound/SRC source/ntsc -INCLUDES := source source/m68k source/z80 source/sound source/cart_hw\ - source/cart_hw/svp source/ngc source/ngc/gui source/sound/SRC source/ntsc +SOURCES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc \ + source/cart_hw source/cart_hw/svp source/ngc source/ngc/gui source/ngc/fileio +INCLUDES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc \ + source/cart_hw source/cart_hw/svp source/ngc source/ngc/gui source/ngc/fileio #--------------------------------------------------------------------------------- # options for code generation diff --git a/source/cart_hw/cart_hw.c b/source/cart_hw/cart_hw.c index 3a59101..84bd24c 100644 --- a/source/cart_hw/cart_hw.c +++ b/source/cart_hw/cart_hw.c @@ -43,71 +43,71 @@ void special_regs_w(uint32 address, uint32 data); /* Cart database entry */ typedef struct { - uint16 chk_1; /* header checksum */ - uint16 chk_2; /* real checksum */ - uint8 bank_start; /* first mapped bank in $400000-$7fffff region */ - uint8 bank_end; /* last mapped bank in $400000-$7fffff region */ - T_CART_HW cart_hw; /* hardware description */ + uint16 chk_1; /* header checksum */ + uint16 chk_2; /* real checksum */ + uint8 bank_start; /* first mapped bank in $400000-$7fffff region */ + uint8 bank_end; /* last mapped bank in $400000-$7fffff region */ + T_CART_HW cart_hw; /* hardware description */ } T_CART_ENTRY; /* Games that need extra hardware emulation: - - copy protection device - - custom ROM banking device + - copy protection device + - custom ROM banking device */ T_CART_ENTRY rom_database[CART_CNT] = { /* Game no Kanzume Otokuyou */ - {0x0000,0xf9d1,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,seganet_mapper_w,0,0}}, + {0x0000,0xf9d1,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,seganet_mapper_w,0,0}}, /* RADICA (Volume 1) (not byteswapped) */ - {0x0000,0x2326,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,1,radica_mapper_r,0,0,0}}, + {0x0000,0x2326,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,1,radica_mapper_r,0,0,0}}, /* RADICA (Volume 2) */ - {0x4f10,0x0836,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,1,radica_mapper_r,0,0,0}}, + {0x4f10,0x0836,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,1,radica_mapper_r,0,0,0}}, /* RADICA (Volume 1) */ - {0xf424,0x9f82,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,1,radica_mapper_r,0,0,0}}, + {0xf424,0x9f82,0,0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,1,radica_mapper_r,0,0,0}}, /* Funny World & Balloon Boy */ - {0x0000,0x06ab,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},1,1,0,0,0,realtec_mapper_w}}, + {0x0000,0x06ab,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},1,1,0,0,0,realtec_mapper_w}}, /* Whac-a-Critter */ - {0xffff,0xf863,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},1,1,0,0,0,realtec_mapper_w}}, + {0xffff,0xf863,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},1,1,0,0,0,realtec_mapper_w}}, /* Earth Defense */ - {0xffff,0x44fb,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},1,1,0,0,0,realtec_mapper_w}}, + {0xffff,0x44fb,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},1,1,0,0,0,realtec_mapper_w}}, /* Super Mario 2 1998 */ - {0xffff,0x0474,0,0,{{0x0a,0,0,0},{0xffffff,0,0,0},{0xa13000,0,0,0},0,0,default_regs_r,0,0,0}}, + {0xffff,0x0474,0,0,{{0x0a,0,0,0},{0xffffff,0,0,0},{0xa13000,0,0,0},0,0,default_regs_r,0,0,0}}, /* Super Mario 2 1998 */ - {0x2020,0xb4eb,0,0,{{0x1c,0,0,0},{0xffffff,0,0,0},{0xa13000,0,0,0},0,0,default_regs_r,0,0,0}}, + {0x2020,0xb4eb,0,0,{{0x1c,0,0,0},{0xffffff,0,0,0},{0xa13000,0,0,0},0,0,default_regs_r,0,0,0}}, /* Supper Bubble Bobble */ - {0x0000,0x16cd,0x40,0x40,{{0x55,0x0f,0,0},{0xffffff,0xffffff,0,0},{0x400000,0x400002,0,0},0,0,0,0,default_regs_r,0}}, + {0x0000,0x16cd,0x40,0x40,{{0x55,0x0f,0,0},{0xffffff,0xffffff,0,0},{0x400000,0x400002,0,0},0,0,0,0,default_regs_r,0}}, /* Mahjong Lover */ - {0x0000,0x7037,0x40,0x40,{{0x90,0xd3,0,0},{0xffffff,0xffffff,0,0},{0x400000,0x401000,0,0},0,0,0,0,default_regs_r,0}}, + {0x0000,0x7037,0x40,0x40,{{0x90,0xd3,0,0},{0xffffff,0xffffff,0,0},{0x400000,0x401000,0,0},0,0,0,0,default_regs_r,0}}, /* Lion King 2 */ - {0xffff,0x1d9b,0x40,0x40,{{0,0,0,0},{0xfffffd,0xfffffd,0,0},{0x400000,0x400004,0,0},0,0,0,0,default_regs_r,default_regs_w}}, + {0xffff,0x1d9b,0x40,0x40,{{0,0,0,0},{0xfffffd,0xfffffd,0,0},{0x400000,0x400004,0,0},0,0,0,0,default_regs_r,default_regs_w}}, /* Squirell King */ - {0x0000,0x8ec8,0x40,0x40,{{0,0,0,0},{0xfffffd,0xfffffd,0,0},{0x400000,0x400004,0,0},0,0,0,0,default_regs_r,default_regs_w}}, + {0x0000,0x8ec8,0x40,0x40,{{0,0,0,0},{0xfffffd,0xfffffd,0,0},{0x400000,0x400004,0,0},0,0,0,0,default_regs_r,default_regs_w}}, /* Rockman X3 */ - {0x0000,0x9d0e,0x40,0x40,{{0x0c,0x88,0,0},{0xffffff,0xffffff,0,0},{0xa13000,0x400004,0,0},0,0,default_regs_r,0,default_regs_r,0}}, + {0x0000,0x9d0e,0x40,0x40,{{0x0c,0x88,0,0},{0xffffff,0xffffff,0,0},{0xa13000,0x400004,0,0},0,0,default_regs_r,0,default_regs_r,0}}, /* A Bug's Life */ - {0x7f7f,0x2aad,0,0,{{0x28,0x1f,0x01,0},{0xffffff,0xffffff,0xffffff,0},{0xa13000,0xa13002,0xa1303e,0},0,0,default_regs_r,0,0,0}}, + {0x7f7f,0x2aad,0,0,{{0x28,0x1f,0x01,0},{0xffffff,0xffffff,0xffffff,0},{0xa13000,0xa13002,0xa1303e,0},0,0,default_regs_r,0,0,0}}, /* King of Fighter 99 */ - {0x0000,0x21e,0,0,{{0x00,0x01,0x1f,0},{0xffffff,0xffffff,0xffffff,0},{0xa13000,0xa13002,0xa1303e,0},0,0,default_regs_r,0,0,0}}, + {0x0000,0x21e,0,0,{{0x00,0x01,0x1f,0},{0xffffff,0xffffff,0xffffff,0},{0xa13000,0xa13002,0xa1303e,0},0,0,default_regs_r,0,0,0}}, /* Pocket Monster */ - {0xd6fc,0x1eb1,0,0,{{0x00,0x01,0x1f,0},{0xffffff,0xffffff,0xffffff,0},{0xa13000,0xa13002,0xa1303e,0},0,0,default_regs_r,0,0,0}}, + {0xd6fc,0x1eb1,0,0,{{0x00,0x01,0x1f,0},{0xffffff,0xffffff,0xffffff,0},{0xa13000,0xa13002,0xa1303e,0},0,0,default_regs_r,0,0,0}}, /* Lion King 3 */ - {0x0000,0x507c,0x60,0x7f,{{0,0,0,0},{0xf0000e,0xf0000e,0xf0000e,0},{0x600000,0x600002,0x600004,0},0,1,0,0,default_regs_r,special_regs_w}}, + {0x0000,0x507c,0x60,0x7f,{{0,0,0,0},{0xf0000e,0xf0000e,0xf0000e,0},{0x600000,0x600002,0x600004,0},0,1,0,0,default_regs_r,special_regs_w}}, /* Super King Kong 99 */ - {0x0000,0x7d6e,0x60,0x7f,{{0,0,0,0},{0xf0000e,0xf0000e,0xf0000e,0},{0x600000,0x600002,0x600004,0},0,1,0,0,default_regs_r,special_regs_w}}, + {0x0000,0x7d6e,0x60,0x7f,{{0,0,0,0},{0xf0000e,0xf0000e,0xf0000e,0},{0x600000,0x600002,0x600004,0},0,1,0,0,default_regs_r,special_regs_w}}, /* Pokemon Stadium */ - {0x0000,0x843c,0x70,0x7f,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,1,0,0,0,special_regs_w}}, + {0x0000,0x843c,0x70,0x7f,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,1,0,0,0,special_regs_w}}, /* Elf Wor */ - {0x0080,0x3dba,0x40,0x40,{{0x55,0x0f,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,0,0,default_regs_r,0}}, + {0x0080,0x3dba,0x40,0x40,{{0x55,0x0f,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,0,0,default_regs_r,0}}, /* Huan Le Tao Qi Shu - Smart Mouse */ - {0x0000,0x1a28,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,0,0,default_regs_r,0}}, + {0x0000,0x1a28,0x40,0x40,{{0x55,0x0f,0xaa,0xf0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,0,0,default_regs_r,0}}, /* Ya-Se Chuanshuo */ - {0xffff,0xd472,0x40,0x40,{{0x63,0x98,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,0,0,default_regs_r,0}}, + {0xffff,0xd472,0x40,0x40,{{0x63,0x98,0xc9,0x18},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,0,0,default_regs_r,0}}, /* Soul Blade */ - {0x0000,0x0c5b,0x40,0x40,{{0x00,0x98,0xc9,0xF0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,0,0,default_regs_r,0}}, + {0x0000,0x0c5b,0x40,0x40,{{0x00,0x98,0xc9,0xF0},{0xffffff,0xffffff,0xffffff,0xffffff},{0x400000,0x400002,0x400004,0x400006},0,0,0,0,default_regs_r,0}}, /* King of Fighter 98 */ - {0x0000,0xd0a0,0x48,0x4f,{{0xaa,0xa0,0xf0,0xa0},{0xfc0000,0xffffff,0xffffff,0xffffff},{0x480000,0x4c82c0,0x4cdda0,0x4f8820},0,0,0,0,default_regs_r,0}}, + {0x0000,0xd0a0,0x48,0x4f,{{0xaa,0xa0,0xf0,0xa0},{0xfc0000,0xffffff,0xffffff,0xffffff},{0x480000,0x4c82c0,0x4cdda0,0x4f8820},0,0,0,0,default_regs_r,0}}, /* Lian Huan Pao - Barver Battle Saga */ - {0x30b9,0x1c2a,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,0,default_regs_r,0}} + {0x30b9,0x1c2a,0x40,0x40,{{0,0,0,0},{0,0,0,0},{0,0,0,0},0,0,0,0,default_regs_r,0}} }; @@ -118,7 +118,7 @@ int old_system[2] = {-1,-1}; uint8 mem_chunk[0x10000]; /************************************************************ - Cart Hardware initialization + Cart Hardware initialization *************************************************************/ /* hardware that need to be reseted on power on */ @@ -132,34 +132,34 @@ void cart_hw_reset() for (i=0x00; i<0x40; i++) m68k_memory_map[i].base = cart_rom + (i<<16); } - - /* Realtec mapper */ - if (cart_hw.realtec & 1) - { - /* enable BOOTROM */ + + /* Realtec mapper */ + if (cart_hw.realtec & 1) + { + /* enable BOOTROM */ for (i=0; i<0x40; i++) m68k_memory_map[i].base = mem_chunk; for (i=0; i<8; i++) memcpy(mem_chunk + i*0x2000, cart_rom + 0x7e000, 0x2000); - cart_hw.realtec |= 2; - } - + cart_hw.realtec |= 2; + } + /* save default cartridge slot mapping */ default_rom = m68k_memory_map[0].base; - /* SVP chip */ - if (svp) svp_reset(); + /* SVP chip */ + if (svp) svp_reset(); } /* cart hardware detection */ void cart_hw_init() { - int i; - - /********************************************** - DEFAULT CARTRIDGE MAPPING - ***********************************************/ - for (i=0; i<0x40; i++) - { - /* cartridge ROM */ + int i; + + /********************************************** + DEFAULT CARTRIDGE MAPPING + ***********************************************/ + for (i=0; i<0x40; i++) + { + /* cartridge ROM */ m68k_memory_map[i].base = cart_rom + (i<<16); m68k_memory_map[i].read8 = NULL; m68k_memory_map[i].read16 = NULL; @@ -167,33 +167,33 @@ void cart_hw_init() m68k_memory_map[i].write16 = m68k_unused_16_w; zbank_memory_map[i].read = NULL; zbank_memory_map[i].write = zbank_unused_w; - } + } - for (i=0x40; i<0x80; i++) - { - /* unused area */ + for (i=0x40; i<0x80; i++) + { + /* unused area */ m68k_memory_map[i].read8 = m68k_read_bus_8; m68k_memory_map[i].read16 = m68k_read_bus_16; m68k_memory_map[i].write8 = m68k_unused_8_w; m68k_memory_map[i].write16 = m68k_unused_16_w; zbank_memory_map[i].read = zbank_unused_r; zbank_memory_map[i].write = zbank_unused_w; - } - + } + /* restore previous setting */ if (old_system[0] != -1) input.system[0] = old_system[0]; if (old_system[1] != -1) input.system[1] = old_system[1]; - /********************************************** - EXTERNAL RAM - ***********************************************/ - sram_init(); - eeprom_init(); - if (sram.on) - { - if (sram.custom) - { - /* serial EEPROM */ + /********************************************** + EXTERNAL RAM + ***********************************************/ + sram_init(); + eeprom_init(); + if (sram.on) + { + if (sram.custom) + { + /* serial EEPROM */ m68k_memory_map[eeprom.type.sda_out_adr >> 16].read8 = eeprom_read_byte; m68k_memory_map[eeprom.type.sda_out_adr >> 16].read16 = eeprom_read_word; m68k_memory_map[eeprom.type.sda_in_adr >> 16].read8 = eeprom_read_byte; @@ -203,10 +203,10 @@ void cart_hw_init() zbank_memory_map[eeprom.type.sda_out_adr >> 16].read = eeprom_read_byte; zbank_memory_map[eeprom.type.sda_in_adr >> 16].read = eeprom_read_byte; zbank_memory_map[eeprom.type.scl_adr >> 16].write = eeprom_write_byte; - } - else - { - /* Static RAM (64k max.) */ + } + else + { + /* Static RAM (64k max.) */ m68k_memory_map[sram.start >> 16].base = sram.sram; m68k_memory_map[sram.start >> 16].read8 = NULL; m68k_memory_map[sram.start >> 16].read16 = NULL; @@ -214,16 +214,16 @@ void cart_hw_init() m68k_memory_map[sram.start >> 16].write16 = NULL; zbank_memory_map[sram.start >> 16].read = NULL; zbank_memory_map[sram.start >> 16].write = NULL; - } - } + } + } - /********************************************** - SVP CHIP - ***********************************************/ - svp = NULL; - if (strstr(rominfo.international,"Virtua Racing") != NULL) - { - svp_init(); + /********************************************** + SVP CHIP + ***********************************************/ + svp = NULL; + if (strstr(rominfo.international,"Virtua Racing") != NULL) + { + svp_init(); m68k_memory_map[0x30].base = svp->dram; m68k_memory_map[0x30].read16 = NULL; @@ -235,30 +235,30 @@ void cart_hw_init() m68k_memory_map[0x39].read16 = svp_read_cell_1; m68k_memory_map[0x3a].read16 = svp_read_cell_2; - } + } /* default GUN settings */ input.x_offset = 0x00; input.y_offset = 0x00; - /********************************************** - SEGA MENACER - ***********************************************/ + /********************************************** + SEGA MENACER + ***********************************************/ if (strstr(rominfo.international,"MENACER") != NULL) - { - /* save current setting */ + { + /* save current setting */ if (old_system[0] == -1) old_system[0] = input.system[0]; if (old_system[1] == -1) old_system[1] = input.system[1]; - + input.system[0] = NO_SYSTEM; input.system[1] = SYSTEM_MENACER; input.x_offset = 0x52; input.y_offset = 0x00; - } - else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL) + } + else if (strstr(rominfo.international,"T2 ; THE ARCADE GAME") != NULL) { - /* save current setting */ + /* save current setting */ if (old_system[0] == -1) old_system[0] = input.system[0]; if (old_system[1] == -1) old_system[1] = input.system[1]; @@ -266,10 +266,10 @@ void cart_hw_init() input.system[1] = SYSTEM_MENACER; input.x_offset = 0x84; input.y_offset = 0x08; - } - else if (strstr(rominfo.international,"BODY COUNT") != NULL) + } + else if (strstr(rominfo.international,"BODY COUNT") != NULL) { - /* save current setting */ + /* save current setting */ if (old_system[0] == -1) old_system[0] = input.system[0]; if (old_system[1] == -1) old_system[1] = input.system[1]; @@ -277,14 +277,14 @@ void cart_hw_init() input.system[1] = SYSTEM_MENACER; input.x_offset = 0x44; input.y_offset = 0x18; - } + } - /********************************************** - KONAMI JUSTIFIER - ***********************************************/ - if (strstr(rominfo.international,"LETHAL ENFORCERS II") != NULL) + /********************************************** + KONAMI JUSTIFIER + ***********************************************/ + if (strstr(rominfo.international,"LETHAL ENFORCERS II") != NULL) { - /* save current setting */ + /* save current setting */ if (old_system[0] == -1) old_system[0] = input.system[0]; if (old_system[1] == -1) old_system[1] = input.system[1]; @@ -292,10 +292,10 @@ void cart_hw_init() input.system[1] = SYSTEM_JUSTIFIER; input.x_offset = 0x18; input.y_offset = 0x00; - } - else if (strstr(rominfo.international,"LETHAL ENFORCERS") != NULL) + } + else if (strstr(rominfo.international,"LETHAL ENFORCERS") != NULL) { - /* save current setting */ + /* save current setting */ if (old_system[0] == -1) old_system[0] = input.system[0]; if (old_system[1] == -1) old_system[1] = input.system[1]; @@ -305,22 +305,22 @@ void cart_hw_init() input.y_offset = 0x00; } - /********************************************** - J-CART - ***********************************************/ - j_cart = 0; - if (((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x168b)) || /* Super Skidmarks, Micro Machines Military*/ - ((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x165e)) || /* Pete Sampras Tennis (1991), Micro Machines 96 */ - ((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0xcee0)) || /* Micro Machines Military (bad) */ - ((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x2c41)) || /* Micro Machines 96 (bad) */ - ((strstr(rominfo.product,"XXXXXXXX") != NULL) && (rominfo.checksum == 0xdf39)) || /* Sampras Tennis 96 */ - ((strstr(rominfo.product,"T-123456") != NULL) && (rominfo.checksum == 0x1eae)) || /* Sampras Tennis 96 */ - ((strstr(rominfo.product,"T-120066") != NULL) && (rominfo.checksum == 0x16a4)) || /* Pete Sampras Tennis (1994)*/ - (strstr(rominfo.product,"T-120096") != NULL)) /* Micro Machines 2 */ - { - if (genromsize <= 0x380000) /* just to be sure (checksum might not be enough) */ - { - j_cart = 1; + /********************************************** + J-CART + ***********************************************/ + j_cart = 0; + if (((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x168b)) || /* Super Skidmarks, Micro Machines Military*/ + ((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x165e)) || /* Pete Sampras Tennis (1991), Micro Machines 96 */ + ((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0xcee0)) || /* Micro Machines Military (bad) */ + ((strstr(rominfo.product,"00000000") != NULL) && (rominfo.checksum == 0x2c41)) || /* Micro Machines 96 (bad) */ + ((strstr(rominfo.product,"XXXXXXXX") != NULL) && (rominfo.checksum == 0xdf39)) || /* Sampras Tennis 96 */ + ((strstr(rominfo.product,"T-123456") != NULL) && (rominfo.checksum == 0x1eae)) || /* Sampras Tennis 96 */ + ((strstr(rominfo.product,"T-120066") != NULL) && (rominfo.checksum == 0x16a4)) || /* Pete Sampras Tennis (1994)*/ + (strstr(rominfo.product,"T-120096") != NULL)) /* Micro Machines 2 */ + { + if (genromsize <= 0x380000) /* just to be sure (checksum might not be enough) */ + { + j_cart = 1; m68k_memory_map[0x38].read16 = jcart_read; m68k_memory_map[0x38].write16 = jcart_write; m68k_memory_map[0x3f].read16 = jcart_read; @@ -333,47 +333,47 @@ void cart_hw_init() /* PORT B by default */ input.system[0] = SYSTEM_GAMEPAD; input.system[1] = SYSTEM_GAMEPAD; - } - } + } + } - /********************************************** - Mappers & HW registers - ***********************************************/ - memset(&cart_hw, 0, sizeof(cart_hw)); + /********************************************** + Mappers & HW registers + ***********************************************/ + memset(&cart_hw, 0, sizeof(cart_hw)); /* search for game into database */ - for (i=0; i < CART_CNT + 1; i++) - { - /* known cart found ! */ - if ((rominfo.checksum == rom_database[i].chk_1) && - (realchecksum == rom_database[i].chk_2)) - { - /* retrieve hardware information */ - memcpy(&cart_hw, &(rom_database[i].cart_hw), sizeof(cart_hw)); + for (i=0; i < CART_CNT + 1; i++) + { + /* known cart found ! */ + if ((rominfo.checksum == rom_database[i].chk_1) && + (realchecksum == rom_database[i].chk_2)) + { + /* retrieve hardware information */ + memcpy(&cart_hw, &(rom_database[i].cart_hw), sizeof(cart_hw)); - /* initialize memory handlers for $400000-$7fffff region */ - int j = rom_database[i].bank_start; - while (j <= rom_database[i].bank_end) - { - if (cart_hw.regs_r) + /* initialize memory handlers for $400000-$7fffff region */ + int j = rom_database[i].bank_start; + while (j <= rom_database[i].bank_end) + { + if (cart_hw.regs_r) { m68k_memory_map[j].read8 = cart_hw.regs_r; m68k_memory_map[j].read16 = cart_hw.regs_r; zbank_memory_map[j].read = cart_hw.regs_r; - } + } if (cart_hw.regs_w) { m68k_memory_map[j].write8 = cart_hw.regs_w; m68k_memory_map[j].write16 = cart_hw.regs_w; zbank_memory_map[j].write = cart_hw.regs_w; - } - j++; - } + } + j++; + } - /* leave loop */ - i = CART_CNT + 1; - } - } + /* leave loop */ + i = CART_CNT + 1; + } + } #if M68K_EMULATE_ADDRESS_ERROR /* default behavior */ @@ -403,26 +403,26 @@ void cart_hw_init() cart_hw.bankshift = 1; } - /* default write handler for !TIME signal */ - if (!cart_hw.time_w) cart_hw.time_w = default_time_w; + /* default write handler for !TIME signal */ + if (!cart_hw.time_w) cart_hw.time_w = default_time_w; } /************************************************************ - MAPPER handlers + MAPPER handlers *************************************************************/ /* - "official" ROM/RAM switch + "official" ROM/RAM switch */ static inline void sega_mapper_w(uint32 address, uint32 data) { - uint32 i,slot = (address >> 1) & 7; + uint32 i,slot = (address >> 1) & 7; uint8 *src; - - switch (slot) - { - case 0: - /* ROM/SRAM switch (Phantasy Star IV, Story of Thor/Beyond Oasis, Sonic 3 & Knuckles) */ + + switch (slot) + { + case 0: + /* ROM/SRAM switch (Phantasy Star IV, Story of Thor/Beyond Oasis, Sonic 3 & Knuckles) */ if (data & 1) { /* SRAM enabled */ @@ -448,38 +448,38 @@ static inline void sega_mapper_w(uint32 address, uint32 data) /* ROM enabled */ m68k_memory_map[0x20].base = cart_rom + 0x200000; } - break; - - default: - /* ROM Bankswitch (Super Street Fighter 2) - documented by Bart Trzynadlowski (http://www.trzy.org/files/ssf2.txt) - */ + break; + + default: + /* ROM Bankswitch (Super Street Fighter 2) + documented by Bart Trzynadlowski (http://www.trzy.org/files/ssf2.txt) + */ slot = slot << 3; /* 8 x 512k banks */ src = cart_rom + (data << 19); for (i=0; i<8; i++) m68k_memory_map[slot++].base = src + (i<<16); - break; - } + break; + } } /* - custom ROM Bankswitch used by pirate "Multi-in-1" carts + custom ROM Bankswitch used by pirate "Multi-in-1" carts */ static inline void multi_mapper_w(uint32 address, uint32 data) { - int i; + int i; cart_hw.bankshift = 1; - /* 64 x 64k banks */ + /* 64 x 64k banks */ for (i=0; i<64; i++) - { + { m68k_memory_map[i].base = &cart_rom[((address++) & 0x3f) << 16]; - } + } } /* - Special ROM Bankswitch used for copy protection - Used by unlicensed cartridges (Lion King III, Super King Kong 99) + Special ROM Bankswitch used for copy protection + Used by unlicensed cartridges (Lion King III, Super King Kong 99) */ void special_mapper_w(uint32 address, uint32 data) { @@ -490,60 +490,60 @@ void special_mapper_w(uint32 address, uint32 data) } /* - Realtec ROM Bankswitch (Earth Defend, Balloon Boy & Funny World, Whac-A-Critter) + Realtec ROM Bankswitch (Earth Defend, Balloon Boy & Funny World, Whac-A-Critter) */ void realtec_mapper_w(uint32 address, uint32 data) { int i; - uint32 base; + uint32 base; - /* 32 x 128k banks */ - switch (address) - { - case 0x404000: /* three lower bits of ROM base address */ - cart_hw.regs[0] = data & 7; - base = ((data & 7) | (cart_hw.regs[1] << 2)); + /* 32 x 128k banks */ + switch (address) + { + case 0x404000: /* three lower bits of ROM base address */ + cart_hw.regs[0] = data & 7; + base = ((data & 7) | (cart_hw.regs[1] << 2)); for (i=0; i<=cart_hw.regs[2]; i++) { m68k_memory_map[i*2].base = &cart_rom[((base + i)*2 & 0x3f) << 16]; m68k_memory_map[i*2+1].base = &cart_rom[(((base + i)*2 + 1) & 0x3f) << 16]; } - return; + return; - case 0x400000: /* two higher bits of ROM base address */ - cart_hw.regs[1] = data & 6; - base = cart_hw.regs[0] | ((data & 6) << 2); + case 0x400000: /* two higher bits of ROM base address */ + cart_hw.regs[1] = data & 6; + base = cart_hw.regs[0] | ((data & 6) << 2); for (i=0; i<=cart_hw.regs[2]; i++) { m68k_memory_map[i*2].base = &cart_rom[((base + i)*2 & 0x3f) << 16]; m68k_memory_map[i*2+1].base = &cart_rom[(((base + i)*2 + 1) & 0x3f) << 16]; } - return; + return; - case 0x402000: /* number of 128k blocks to map */ - cart_hw.regs[2] = data & 0x1f; - base = cart_hw.regs[0] | (cart_hw.regs[1] << 2); + case 0x402000: /* number of 128k blocks to map */ + cart_hw.regs[2] = data & 0x1f; + base = cart_hw.regs[0] | (cart_hw.regs[1] << 2); for (i=0; i<=(data & 0x1f); i++) { m68k_memory_map[i*2].base = &cart_rom[((base + i)*2 & 0x3f) << 16]; m68k_memory_map[i*2+1].base = &cart_rom[(((base + i)*2 + 1) & 0x3f) << 16]; } - return; + return; - } + } } /* Game no Kanzume Otokuyou ROM Mapper */ void seganet_mapper_w(uint32 address, uint32 data) { - if ((address & 0xff) == 0xf1) + if ((address & 0xff) == 0xf1) { - int i; + int i; if (data & 1) { /* ROM Write protected */ for (i=0; i<0x40; i++) - { + { m68k_memory_map[i].write8 = m68k_unused_8_w; m68k_memory_map[i].write16 = m68k_unused_16_w; zbank_memory_map[i].write = zbank_unused_w; @@ -557,99 +557,99 @@ void seganet_mapper_w(uint32 address, uint32 data) m68k_memory_map[i].write8 = NULL; m68k_memory_map[i].write16 = NULL; zbank_memory_map[i].write = NULL; - } + } } - } + } } /* - RADICA ROM Bankswitch (use !TIME) + RADICA ROM Bankswitch (use !TIME) */ uint32 radica_mapper_r(uint32 address) { - int i = 0; + int i = 0; address = (address >> 1); - /* 64 x 64k banks */ + /* 64 x 64k banks */ for (i = 0; i < 64; i++) { m68k_memory_map[i].base = &cart_rom[((address++)& 0x3f)<< 16]; - } - return 0xff; + } + return 0xff; } /************************************************************ - default !TIME signal handler + default !TIME signal handler *************************************************************/ /* default ROM bankswitch */ void default_time_w(uint32 address, uint32 data) { - if ((address & 0xf1) == 0xf1) sega_mapper_w(address, data); - else if (address < 0xa13040) multi_mapper_w(address, data); + if ((address & 0xf1) == 0xf1) sega_mapper_w(address, data); + else if (address < 0xa13040) multi_mapper_w(address, data); } /************************************************************ - Internal register handlers + Internal register handlers *************************************************************/ uint32 default_regs_r(uint32 address) { - int i; - for (i=0; i<4; i++) - { - if ((address & cart_hw.mask[i]) == cart_hw.addr[i]) - return cart_hw.regs[i]; - } + int i; + for (i=0; i<4; i++) + { + if ((address & cart_hw.mask[i]) == cart_hw.addr[i]) + return cart_hw.regs[i]; + } - /* unused */ - return 0xffff; + /* unused */ + return 0xffff; } void default_regs_w(uint32 address, uint32 data) { - int i; - for (i=0; i<4; i++) - { - if ((address & cart_hw.mask[i]) == cart_hw.addr[i]) - { - cart_hw.regs[i] = data; - } - } + int i; + for (i=0; i<4; i++) + { + if ((address & cart_hw.mask[i]) == cart_hw.addr[i]) + { + cart_hw.regs[i] = data; + } + } } /* special register behaviour (Lion King III, Super Donkey Kong 99) */ void special_regs_w(uint32 address, uint32 data) { - /* ROM bankswitch */ - if ((address >> 16) > 0x6f) - { - special_mapper_w(address, data); - return; - } + /* ROM bankswitch */ + if ((address >> 16) > 0x6f) + { + special_mapper_w(address, data); + return; + } - /* write regs */ - default_regs_w(address, data); + /* write regs */ + default_regs_w(address, data); - /* bitswapping (documented by Haze) */ - uint32 temp = cart_hw.regs[0]; - switch (cart_hw.regs[1]) - { - case 1: - cart_hw.regs[2] = (temp >> 1); - return; + /* bitswapping (documented by Haze) */ + uint32 temp = cart_hw.regs[0]; + switch (cart_hw.regs[1]) + { + case 1: + cart_hw.regs[2] = (temp >> 1); + return; - case 2: - cart_hw.regs[2] = ((temp >> 4) | ((temp & 0x0F) << 4)); - return; + case 2: + cart_hw.regs[2] = ((temp >> 4) | ((temp & 0x0F) << 4)); + return; - default: - cart_hw.regs[2] = (((temp >> 7) & 0x01) | ((temp >> 5) & 0x02) | - ((temp >> 3) & 0x04) | ((temp >> 1) & 0x08) | - ((temp << 1) & 0x10) | ((temp << 3) & 0x20) | - ((temp << 5) & 0x40) | ((temp << 7) & 0x80)); - return; - } + default: + cart_hw.regs[2] = (((temp >> 7) & 0x01) | ((temp >> 5) & 0x02) | + ((temp >> 3) & 0x04) | ((temp >> 1) & 0x08) | + ((temp << 1) & 0x10) | ((temp << 3) & 0x20) | + ((temp << 5) & 0x40) | ((temp << 7) & 0x80)); + return; + } } diff --git a/source/cart_hw/cart_hw.h b/source/cart_hw/cart_hw.h index 000a9b9..15be59d 100644 --- a/source/cart_hw/cart_hw.h +++ b/source/cart_hw/cart_hw.h @@ -30,15 +30,15 @@ /* Hardware description */ typedef struct { - uint8 regs[4]; /* internal registers (R/W) */ - uint32 mask[4]; /* registers address mask */ - uint32 addr[4]; /* registers address */ - uint32 realtec; /* bit 0: realtec mapper detected, bit 1: bootrom enabled */ - uint32 bankshift; /* cartridge with bankshift mecanism */ - unsigned int (*time_r)(unsigned int address); /* !TIME signal ($a130xx) read handler */ - void (*time_w)(unsigned int address, unsigned int data); /* !TIME signal ($a130xx) write handler */ - unsigned int (*regs_r)(unsigned int address); /* cart hardware region ($400000-$7fffff) read handler */ - void (*regs_w)(unsigned int address, unsigned int data); /* cart hardware region ($400000-$7fffff) write handler */ + uint8 regs[4]; /* internal registers (R/W) */ + uint32 mask[4]; /* registers address mask */ + uint32 addr[4]; /* registers address */ + uint32 realtec; /* bit 0: realtec mapper detected, bit 1: bootrom enabled */ + uint32 bankshift; /* cartridge with bankshift mecanism */ + unsigned int (*time_r)(unsigned int address); /* !TIME signal ($a130xx) read handler */ + void (*time_w)(unsigned int address, unsigned int data); /* !TIME signal ($a130xx) write handler */ + unsigned int (*regs_r)(unsigned int address); /* cart hardware region ($400000-$7fffff) read handler */ + void (*regs_w)(unsigned int address, unsigned int data); /* cart hardware region ($400000-$7fffff) write handler */ } T_CART_HW; /* global variables */ diff --git a/source/cart_hw/eeprom.c b/source/cart_hw/eeprom.c index c3a3651..bcfa342 100644 --- a/source/cart_hw/eeprom.c +++ b/source/cart_hw/eeprom.c @@ -23,53 +23,53 @@ typedef struct { - char game_id[14]; - uint16 chk; - T_EEPROM_TYPE type; + char game_id[14]; + uint16 chk; + T_EEPROM_TYPE type; } T_GAME_ENTRY; T_GAME_ENTRY database[24] = { - /* ACCLAIM mappers */ - /* 24C02 (old mapper) */ - {{"T-081326" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200001, 0, 1, 1}}, /* NBA Jam (UE) */ - {{"T-81033" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200001, 0, 1, 1}}, /* NBA Jam (J) */ + /* ACCLAIM mappers */ + /* 24C02 (old mapper) */ + {{"T-081326" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200001, 0, 1, 1}}, /* NBA Jam (UE) */ + {{"T-81033" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200001, 0, 1, 1}}, /* NBA Jam (J) */ - /* 24C02 */ - {{"T-81406" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NBA Jam TE */ - {{"T-081276" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NFL Quarterback Club */ - /* 24C16 */ - {{"T-081586" }, 0, {8, 0x7FF, 0x7FF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NFL Quarterback Club '96 */ - /* 24C65 */ - {{"T-81576" }, 0, {16, 0x1FFF, 0x1FFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* College Slam */ - {{"T-81476" }, 0, {16, 0x1FFF, 0x1FFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* Frank Thomas Big Hurt Baseball */ - - /* EA mapper (24C01 only) */ - {{"T-50396" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* NHLPA Hockey 93 (UE) */ - {{"T-50176" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* Rings of Power */ - - /* SEGA mapper (24C01 only) */ - {{"T-12046" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Megaman - The Wily Wars */ - {{"T-12053" }, 0xEA80, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Rockman Mega World (J) [A] */ - {{"MK-1215" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Evander 'Real Deal' Holyfield's Boxing */ - {{"MK-1228" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (U) */ - {{"G-5538" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (J) */ - {{"PR-1993" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (E) */ - {{"G-4060" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Wonderboy in Monster World */ - {{"00001211-00"}, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Sports Talk Baseball */ - - /* CODEMASTERS mapper */ - /* 24C01 */ - {{"T-120106"}, 0, {7, 0x7F, 0x7F, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Brian Lara Cricket */ - /* 24C08 */ - {{"T-120096" }, 0, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines 2 - Turbo Tournament (E) */ - {{"00000000-00"}, 0x168B, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Military */ - {{"00000000-00"}, 0xCEE0, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Military (Bad)*/ - /* 24C16 */ - {{"00000000-00"}, 0x165E, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Turbo Tournament 96 */ - {{"00000000-00"}, 0x2C41, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Turbo Tournament 96 (Bad)*/ - /* 24C65 */ - {{"T-120146-50"}, 0, {16, 0x1FFF, 0x1FFF, 0x300000, 0x380001, 0x300000, 0, 7, 1}} /* Brian Lara Cricket 96, Shane Warne Cricket */ + /* 24C02 */ + {{"T-81406" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NBA Jam TE */ + {{"T-081276" }, 0, {8, 0xFF, 0xFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NFL Quarterback Club */ + /* 24C16 */ + {{"T-081586" }, 0, {8, 0x7FF, 0x7FF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* NFL Quarterback Club '96 */ + /* 24C65 */ + {{"T-81576" }, 0, {16, 0x1FFF, 0x1FFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* College Slam */ + {{"T-81476" }, 0, {16, 0x1FFF, 0x1FFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* Frank Thomas Big Hurt Baseball */ + + /* EA mapper (24C01 only) */ + {{"T-50396" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* NHLPA Hockey 93 (UE) */ + {{"T-50176" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* Rings of Power */ + + /* SEGA mapper (24C01 only) */ + {{"T-12046" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Megaman - The Wily Wars */ + {{"T-12053" }, 0xEA80, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Rockman Mega World (J) [A] */ + {{"MK-1215" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Evander 'Real Deal' Holyfield's Boxing */ + {{"MK-1228" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (U) */ + {{"G-5538" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (J) */ + {{"PR-1993" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Greatest Heavyweights of the Ring (E) */ + {{"G-4060" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Wonderboy in Monster World */ + {{"00001211-00"}, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Sports Talk Baseball */ + + /* CODEMASTERS mapper */ + /* 24C01 */ + {{"T-120106"}, 0, {7, 0x7F, 0x7F, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Brian Lara Cricket */ + /* 24C08 */ + {{"T-120096" }, 0, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines 2 - Turbo Tournament (E) */ + {{"00000000-00"}, 0x168B, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Military */ + {{"00000000-00"}, 0xCEE0, {8, 0x3FF, 0x3FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Military (Bad)*/ + /* 24C16 */ + {{"00000000-00"}, 0x165E, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Turbo Tournament 96 */ + {{"00000000-00"}, 0x2C41, {8, 0x7FF, 0x7FF, 0x300000, 0x380001, 0x300000, 0, 7, 1}}, /* Micro Machines Turbo Tournament 96 (Bad)*/ + /* 24C65 */ + {{"T-120146-50"}, 0, {16, 0x1FFF, 0x1FFF, 0x300000, 0x380001, 0x300000, 0, 7, 1}} /* Brian Lara Cricket 96, Shane Warne Cricket */ }; @@ -77,85 +77,85 @@ T_EEPROM eeprom; void eeprom_init() { - uint8 i = 0; - - /* initialize eeprom */ - memset(&eeprom, 0, sizeof(T_EEPROM)); - eeprom.sda = eeprom.old_sda = 1; - eeprom.scl = eeprom.old_scl = 1; - eeprom.state = STAND_BY; + uint8 i = 0; - sram.custom = 0; - - /* look into game database */ - while ((i<24) && (!sram.custom)) - { - if (strstr(rominfo.product,database[i].game_id) != NULL) - { - /* additional check (Micro Machines, Rockman Mega World) */ - if ((database[i].chk == 0) || (database[i].chk == rominfo.checksum)) - { - sram.custom = 1; - sram.on = 1; - sram.write = 1; - memcpy(&eeprom.type, &database[i].type, sizeof(T_EEPROM_TYPE)); - } - } - i++; - } + /* initialize eeprom */ + memset(&eeprom, 0, sizeof(T_EEPROM)); + eeprom.sda = eeprom.old_sda = 1; + eeprom.scl = eeprom.old_scl = 1; + eeprom.state = STAND_BY; - /* Game not found in database but header seems to indicate it uses EEPROM */ + sram.custom = 0; + + /* look into game database */ + while ((i<24) && (!sram.custom)) + { + if (strstr(rominfo.product,database[i].game_id) != NULL) + { + /* additional check (Micro Machines, Rockman Mega World) */ + if ((database[i].chk == 0) || (database[i].chk == rominfo.checksum)) + { + sram.custom = 1; + sram.on = 1; + sram.write = 1; + memcpy(&eeprom.type, &database[i].type, sizeof(T_EEPROM_TYPE)); + } + } + i++; + } + + /* Game not found in database but header seems to indicate it uses EEPROM */ if (!sram.custom) - { + { if ((sram.end - sram.start) < 2) - { - sram.custom = 1; - sram.on = 1; - sram.write = 1; - - /* set SEGA mapper as default */ - memcpy(&eeprom.type, &database[9].type, sizeof(T_EEPROM_TYPE)); - } -} + { + sram.custom = 1; + sram.on = 1; + sram.write = 1; + + /* set SEGA mapper as default */ + memcpy(&eeprom.type, &database[9].type, sizeof(T_EEPROM_TYPE)); + } + } } static inline void Detect_START() { - if (eeprom.old_scl && eeprom.scl) - { - if (eeprom.old_sda && !eeprom.sda) - { - eeprom.cycles = 0; - eeprom.slave_mask = 0; - if (eeprom.type.address_bits == 7) - { - eeprom.word_address = 0; - eeprom.state = GET_WORD_ADR_7BITS; - } - else eeprom.state = GET_SLAVE_ADR; - } - } + if (eeprom.old_scl && eeprom.scl) + { + if (eeprom.old_sda && !eeprom.sda) + { + eeprom.cycles = 0; + eeprom.slave_mask = 0; + if (eeprom.type.address_bits == 7) + { + eeprom.word_address = 0; + eeprom.state = GET_WORD_ADR_7BITS; + } + else eeprom.state = GET_SLAVE_ADR; + } + } } static inline void Detect_STOP() { - if (eeprom.old_scl && eeprom.scl) - { - if (!eeprom.old_sda && eeprom.sda) - { - eeprom.state = STAND_BY; - } - } + if (eeprom.old_scl && eeprom.scl) + { + if (!eeprom.old_sda && eeprom.sda) + { + eeprom.state = STAND_BY; + } + } } void eeprom_write(uint32 address, uint32 value, uint32 word_access) { - /* decode SCL and SDA value */ + /* decode SCL and SDA value */ if (word_access) { /* 16-bits access */ - if (eeprom.type.sda_in_adr == address) eeprom.sda = (value >> (8 + eeprom.type.sda_in_bit)) & 1; /* MSB */ - else if (eeprom.type.sda_in_adr == (address | 1)) eeprom.sda = (value >> eeprom.type.sda_in_bit) & 1; /* LSB */ + if (eeprom.type.sda_in_adr == address) eeprom.sda = (value >> (8 + eeprom.type.sda_in_bit)) & 1; /* MSB */ + else if (eeprom.type.sda_in_adr == (address | 1)) eeprom.sda = (value >> eeprom.type.sda_in_bit) & 1; /* LSB */ else eeprom.sda = eeprom.old_sda; if (eeprom.type.scl_adr == address) eeprom.scl = (value >> (8 + eeprom.type.scl_bit)) & 1; /* MSB */ @@ -170,284 +170,282 @@ void eeprom_write(uint32 address, uint32 value, uint32 word_access) if (eeprom.type.scl_adr == address) eeprom.scl = (value >> eeprom.type.scl_bit) & 1; else eeprom.scl = eeprom.old_scl; } - - /* EEPROM current state */ - switch (eeprom.state) - { - /* Standby Mode */ - case STAND_BY: - Detect_START(); - Detect_STOP(); - break; + + /* EEPROM current state */ + switch (eeprom.state) + { + /* Standby Mode */ + case STAND_BY: + Detect_START(); + Detect_STOP(); + break; + + /* Suspended Mode */ + case WAIT_STOP: + Detect_STOP(); + break; + + /* Get Word Address 7 bits: MODE-1 only (24C01) + * and R/W bit + */ + case GET_WORD_ADR_7BITS: + Detect_START(); + Detect_STOP(); + + /* look for SCL LOW to HIGH transition */ + if (!eeprom.old_scl && eeprom.scl) + { + if (eeprom.cycles == 0) eeprom.cycles ++; + } - /* Suspended Mode */ - case WAIT_STOP: - Detect_STOP(); - break; - - - /* Get Word Address 7 bits: MODE-1 only (24C01) - * and R/W bit - */ - case GET_WORD_ADR_7BITS: - Detect_START(); - Detect_STOP(); - - /* look for SCL LOW to HIGH transition */ - if (!eeprom.old_scl && eeprom.scl) - { - if (eeprom.cycles == 0) eeprom.cycles ++; - } - - - /* look for SCL HIGH to LOW transition */ - if (eeprom.old_scl && !eeprom.scl && (eeprom.cycles > 0)) - { - if (eeprom.cycles < 8) + /* look for SCL HIGH to LOW transition */ + if (eeprom.old_scl && !eeprom.scl && (eeprom.cycles > 0)) + { + if (eeprom.cycles < 8) { eeprom.word_address |= (eeprom.old_sda << (7 - eeprom.cycles)); - } + } else if (eeprom.cycles == 8) { eeprom.rw = eeprom.old_sda; - } - else - { /* ACK CYCLE */ - eeprom.cycles = 0; - eeprom.word_address &= eeprom.type.size_mask; - eeprom.state = eeprom.rw ? READ_DATA : WRITE_DATA; - } + } + else + { /* ACK CYCLE */ + eeprom.cycles = 0; + eeprom.word_address &= eeprom.type.size_mask; + eeprom.state = eeprom.rw ? READ_DATA : WRITE_DATA; + } - eeprom.cycles ++; - } - break; + eeprom.cycles ++; + } + break; - /* Get Slave Address (3bits) : MODE-2 & MODE-3 only (24C01 - 24C512) (0-3bits, depending on the array size) - * or/and Word Address MSB: MODE-2 only (24C04 - 24C16) (0-3bits, depending on the array size) - * and R/W bit - */ - case GET_SLAVE_ADR: + /* Get Slave Address (3bits) : MODE-2 & MODE-3 only (24C01 - 24C512) (0-3bits, depending on the array size) + * or/and Word Address MSB: MODE-2 only (24C04 - 24C16) (0-3bits, depending on the array size) + * and R/W bit + */ + case GET_SLAVE_ADR: - Detect_START(); - Detect_STOP(); + Detect_START(); + Detect_STOP(); - /* look for SCL LOW to HIGH transition */ - if (!eeprom.old_scl && eeprom.scl) - { - if (eeprom.cycles == 0) eeprom.cycles ++; - } + /* look for SCL LOW to HIGH transition */ + if (!eeprom.old_scl && eeprom.scl) + { + if (eeprom.cycles == 0) eeprom.cycles ++; + } - /* look for SCL HIGH to LOW transition */ - if (eeprom.old_scl && !eeprom.scl && (eeprom.cycles > 0)) - { - if ((eeprom.cycles > 4) && (eeprom.cycles <8)) - { - if ((eeprom.type.address_bits == 16) || - (eeprom.type.size_mask < (1 << (15 - eeprom.cycles)))) - { - /* this is a SLAVE ADDRESS bit */ - eeprom.slave_mask |= (eeprom.old_sda << (7 - eeprom.cycles)); - } - else - { - /* this is a WORD ADDRESS high bit */ - if (eeprom.old_sda) eeprom.word_address |= (1 << (15 - eeprom.cycles)); - else eeprom.word_address &= ~(1 << (15 - eeprom.cycles)); - } - } - else if (eeprom.cycles == 8) eeprom.rw = eeprom.old_sda; - else if (eeprom.cycles > 8) - { - /* ACK CYCLE */ - eeprom.cycles = 0; - if (eeprom.type.address_bits == 16) - { - /* two ADDRESS bytes */ - eeprom.state = eeprom.rw ? READ_DATA : GET_WORD_ADR_HIGH; - eeprom.slave_mask <<= 16; - } - else - { - /* one ADDRESS byte */ - eeprom.state = eeprom.rw ? READ_DATA : GET_WORD_ADR_LOW; - eeprom.slave_mask <<= 8; - } - } + /* look for SCL HIGH to LOW transition */ + if (eeprom.old_scl && !eeprom.scl && (eeprom.cycles > 0)) + { + if ((eeprom.cycles > 4) && (eeprom.cycles <8)) + { + if ((eeprom.type.address_bits == 16) || + (eeprom.type.size_mask < (1 << (15 - eeprom.cycles)))) + { + /* this is a SLAVE ADDRESS bit */ + eeprom.slave_mask |= (eeprom.old_sda << (7 - eeprom.cycles)); + } + else + { + /* this is a WORD ADDRESS high bit */ + if (eeprom.old_sda) eeprom.word_address |= (1 << (15 - eeprom.cycles)); + else eeprom.word_address &= ~(1 << (15 - eeprom.cycles)); + } + } + else if (eeprom.cycles == 8) eeprom.rw = eeprom.old_sda; + else if (eeprom.cycles > 8) + { + /* ACK CYCLE */ + eeprom.cycles = 0; + if (eeprom.type.address_bits == 16) + { + /* two ADDRESS bytes */ + eeprom.state = eeprom.rw ? READ_DATA : GET_WORD_ADR_HIGH; + eeprom.slave_mask <<= 16; + } + else + { + /* one ADDRESS byte */ + eeprom.state = eeprom.rw ? READ_DATA : GET_WORD_ADR_LOW; + eeprom.slave_mask <<= 8; + } + } - eeprom.cycles ++; - } - break; + eeprom.cycles ++; + } + break; - /* Get Word Address MSB (4-8bits depending on the array size) - * MODE-3 only (24C32 - 24C512) - */ - case GET_WORD_ADR_HIGH: + /* Get Word Address MSB (4-8bits depending on the array size) + * MODE-3 only (24C32 - 24C512) + */ + case GET_WORD_ADR_HIGH: - Detect_START(); - Detect_STOP(); + Detect_START(); + Detect_STOP(); - /* look for SCL HIGH to LOW transition */ - if (eeprom.old_scl && !eeprom.scl) - { - if (eeprom.cycles < 9) - { - if ((eeprom.type.size_mask + 1) < (1 << (17 - eeprom.cycles))) - { - /* ignored bit: slave mask should be right-shifted by one */ - eeprom.slave_mask >>= 1; - } - else - { - /* this is a WORD ADDRESS high bit */ - if (eeprom.old_sda) eeprom.word_address |= (1 << (16 - eeprom.cycles)); - else eeprom.word_address &= ~(1 << (16 - eeprom.cycles)); - } + /* look for SCL HIGH to LOW transition */ + if (eeprom.old_scl && !eeprom.scl) + { + if (eeprom.cycles < 9) + { + if ((eeprom.type.size_mask + 1) < (1 << (17 - eeprom.cycles))) + { + /* ignored bit: slave mask should be right-shifted by one */ + eeprom.slave_mask >>= 1; + } + else + { + /* this is a WORD ADDRESS high bit */ + if (eeprom.old_sda) eeprom.word_address |= (1 << (16 - eeprom.cycles)); + else eeprom.word_address &= ~(1 << (16 - eeprom.cycles)); + } - eeprom.cycles ++; - } - else - { - /* ACK CYCLE */ - eeprom.cycles = 1; - eeprom.state = GET_WORD_ADR_LOW; - } - } - break; + eeprom.cycles ++; + } + else + { + /* ACK CYCLE */ + eeprom.cycles = 1; + eeprom.state = GET_WORD_ADR_LOW; + } + } + break; - /* Get Word Address LSB: 7bits (24C01) or 8bits (24C02-24C512) - * MODE-2 and MODE-3 only (24C01 - 24C512) - */ - case GET_WORD_ADR_LOW: + /* Get Word Address LSB: 7bits (24C01) or 8bits (24C02-24C512) + * MODE-2 and MODE-3 only (24C01 - 24C512) + */ + case GET_WORD_ADR_LOW: - Detect_START(); - Detect_STOP(); + Detect_START(); + Detect_STOP(); - /* look for SCL HIGH to LOW transition */ - if (eeprom.old_scl && !eeprom.scl) - { - if (eeprom.cycles < 9) - { - if ((eeprom.type.size_mask + 1) < (1 << (9 - eeprom.cycles))) - { - /* ignored bit (X24C01): slave mask should be right-shifted by one */ - eeprom.slave_mask >>= 1; - } - else - { - /* this is a WORD ADDRESS high bit */ - if (eeprom.old_sda) eeprom.word_address |= (1 << (8 - eeprom.cycles)); - else eeprom.word_address &= ~(1 << (8 - eeprom.cycles)); - } + /* look for SCL HIGH to LOW transition */ + if (eeprom.old_scl && !eeprom.scl) + { + if (eeprom.cycles < 9) + { + if ((eeprom.type.size_mask + 1) < (1 << (9 - eeprom.cycles))) + { + /* ignored bit (X24C01): slave mask should be right-shifted by one */ + eeprom.slave_mask >>= 1; + } + else + { + /* this is a WORD ADDRESS high bit */ + if (eeprom.old_sda) eeprom.word_address |= (1 << (8 - eeprom.cycles)); + else eeprom.word_address &= ~(1 << (8 - eeprom.cycles)); + } - eeprom.cycles ++; - } - else - { - /* ACK CYCLE */ - eeprom.cycles = 1; - eeprom.word_address &= eeprom.type.size_mask; - eeprom.state = WRITE_DATA; - } - } - break; + eeprom.cycles ++; + } + else + { + /* ACK CYCLE */ + eeprom.cycles = 1; + eeprom.word_address &= eeprom.type.size_mask; + eeprom.state = WRITE_DATA; + } + } + break; - /* - * Read Cycle - */ - case READ_DATA: + /* + * Read Cycle + */ + case READ_DATA: - Detect_START(); - Detect_STOP(); + Detect_START(); + Detect_STOP(); - /* look for SCL HIGH to LOW transition */ - if (eeprom.old_scl && !eeprom.scl) - { - if (eeprom.cycles < 9) eeprom.cycles ++; - else - { - eeprom.cycles = 1; + /* look for SCL HIGH to LOW transition */ + if (eeprom.old_scl && !eeprom.scl) + { + if (eeprom.cycles < 9) eeprom.cycles ++; + else + { + eeprom.cycles = 1; - /* ACK not received */ - if (eeprom.old_sda) eeprom.state = WAIT_STOP; - } - } - break; + /* ACK not received */ + if (eeprom.old_sda) eeprom.state = WAIT_STOP; + } + } + break; - /* - * Write Cycle - */ - case WRITE_DATA: + /* + * Write Cycle + */ + case WRITE_DATA: - Detect_START(); - Detect_STOP(); + Detect_START(); + Detect_STOP(); - /* look for SCL HIGH to LOW transition */ - if (eeprom.old_scl && !eeprom.scl) - { - if (eeprom.cycles < 9) - { - /* Write DATA bits (max 64kBytes) */ - uint16 sram_address = (eeprom.slave_mask | eeprom.word_address) & 0xFFFF; - if (eeprom.old_sda) sram.sram[sram_address] |= (1 << (8 - eeprom.cycles)); - else sram.sram[sram_address] &= ~(1 << (8 - eeprom.cycles)); + /* look for SCL HIGH to LOW transition */ + if (eeprom.old_scl && !eeprom.scl) + { + if (eeprom.cycles < 9) + { + /* Write DATA bits (max 64kBytes) */ + uint16 sram_address = (eeprom.slave_mask | eeprom.word_address) & 0xFFFF; + if (eeprom.old_sda) sram.sram[sram_address] |= (1 << (8 - eeprom.cycles)); + else sram.sram[sram_address] &= ~(1 << (8 - eeprom.cycles)); - if (eeprom.cycles == 8) - { - /* WORD ADDRESS is incremented (roll up at maximum pagesize) */ - eeprom.word_address = (eeprom.word_address & (0xFFFF - eeprom.type.pagewrite_mask)) | - ((eeprom.word_address + 1) & eeprom.type.pagewrite_mask); - } + if (eeprom.cycles == 8) + { + /* WORD ADDRESS is incremented (roll up at maximum pagesize) */ + eeprom.word_address = (eeprom.word_address & (0xFFFF - eeprom.type.pagewrite_mask)) | + ((eeprom.word_address + 1) & eeprom.type.pagewrite_mask); + } - eeprom.cycles ++; - } - else eeprom.cycles = 1; /* ACK cycle */ - } - break; - } + eeprom.cycles ++; + } + else eeprom.cycles = 1; /* ACK cycle */ + } + break; + } - eeprom.old_scl = eeprom.scl; - eeprom.old_sda = eeprom.sda; + eeprom.old_scl = eeprom.scl; + eeprom.old_sda = eeprom.sda; } uint32 eeprom_read(uint32 address, uint32 word_access) { - uint8 sda_out = eeprom.sda; + uint8 sda_out = eeprom.sda; - /* EEPROM state */ - switch (eeprom.state) - { - case READ_DATA: - if (eeprom.cycles < 9) - { - /* Return DATA bits (max 64kBytes) */ - uint16 sram_address = (eeprom.slave_mask | eeprom.word_address) & 0xffff; - sda_out = (sram.sram[sram_address] >> (8 - eeprom.cycles)) & 1; + /* EEPROM state */ + switch (eeprom.state) + { + case READ_DATA: + if (eeprom.cycles < 9) + { + /* Return DATA bits (max 64kBytes) */ + uint16 sram_address = (eeprom.slave_mask | eeprom.word_address) & 0xffff; + sda_out = (sram.sram[sram_address] >> (8 - eeprom.cycles)) & 1; - if (eeprom.cycles == 8) - { - /* WORD ADDRESS is incremented (roll up at maximum array size) */ - eeprom.word_address ++; - eeprom.word_address &= eeprom.type.size_mask; - } - } - break; + if (eeprom.cycles == 8) + { + /* WORD ADDRESS is incremented (roll up at maximum array size) */ + eeprom.word_address ++; + eeprom.word_address &= eeprom.type.size_mask; + } + } + break; - case GET_WORD_ADR_7BITS: - case GET_SLAVE_ADR: - case GET_WORD_ADR_HIGH: - case GET_WORD_ADR_LOW: - case WRITE_DATA: - if (eeprom.cycles == 9) sda_out = 0; - break; + case GET_WORD_ADR_7BITS: + case GET_SLAVE_ADR: + case GET_WORD_ADR_HIGH: + case GET_WORD_ADR_LOW: + case WRITE_DATA: + if (eeprom.cycles == 9) sda_out = 0; + break; - default: - break; - } + default: + break; + } /* memory access */ if (word_access) diff --git a/source/cart_hw/eeprom.h b/source/cart_hw/eeprom.h index 4e0329f..8a61405 100644 --- a/source/cart_hw/eeprom.h +++ b/source/cart_hw/eeprom.h @@ -24,14 +24,14 @@ typedef enum { - STAND_BY = 0, - WAIT_STOP, - GET_SLAVE_ADR, - GET_WORD_ADR_7BITS, - GET_WORD_ADR_HIGH, - GET_WORD_ADR_LOW, - WRITE_DATA, - READ_DATA, + STAND_BY = 0, + WAIT_STOP, + GET_SLAVE_ADR, + GET_WORD_ADR_7BITS, + GET_WORD_ADR_HIGH, + GET_WORD_ADR_LOW, + WRITE_DATA, + READ_DATA, } T_EEPROM_STATE; @@ -53,31 +53,31 @@ typedef enum typedef struct { - uint8 address_bits; /* number of bits needed to address memory: 7, 8 or 16 */ - uint16 size_mask; /* depends on the max size of the memory (in bytes) */ - uint16 pagewrite_mask; /* depends on the maximal number of bytes that can be written in a single write cycle */ - uint32 sda_in_adr; /* 68000 memory address mapped to SDA_IN */ - uint32 sda_out_adr; /* 68000 memory address mapped to SDA_OUT */ - uint32 scl_adr; /* 68000 memory address mapped to SCL */ - uint8 sda_in_bit; /* bit offset for SDA_IN */ - uint8 sda_out_bit; /* bit offset for SDA_OUT */ - uint8 scl_bit; /* bit offset for SCL */ + uint8 address_bits; /* number of bits needed to address memory: 7, 8 or 16 */ + uint16 size_mask; /* depends on the max size of the memory (in bytes) */ + uint16 pagewrite_mask; /* depends on the maximal number of bytes that can be written in a single write cycle */ + uint32 sda_in_adr; /* 68000 memory address mapped to SDA_IN */ + uint32 sda_out_adr; /* 68000 memory address mapped to SDA_OUT */ + uint32 scl_adr; /* 68000 memory address mapped to SCL */ + uint8 sda_in_bit; /* bit offset for SDA_IN */ + uint8 sda_out_bit; /* bit offset for SDA_OUT */ + uint8 scl_bit; /* bit offset for SCL */ } T_EEPROM_TYPE; typedef struct { - uint8 sda; /* current /SDA line state */ - uint8 scl; /* current /SCL line state */ - uint8 old_sda; /* previous /SDA line state */ - uint8 old_scl; /* previous /SCL line state */ - uint8 cycles; /* current operation cycle number (0-9) */ - uint8 rw; /* operation type (1:READ, 0:WRITE) */ - uint16 slave_mask; /* device address (shifted by the memory address width)*/ - uint16 word_address; /* memory address */ - T_EEPROM_STATE state; /* current operation state */ - T_EEPROM_TYPE type; /* EEPROM characteristics for this game */ + uint8 sda; /* current /SDA line state */ + uint8 scl; /* current /SCL line state */ + uint8 old_sda; /* previous /SDA line state */ + uint8 old_scl; /* previous /SCL line state */ + uint8 cycles; /* current operation cycle number (0-9) */ + uint8 rw; /* operation type (1:READ, 0:WRITE) */ + uint16 slave_mask; /* device address (shifted by the memory address width)*/ + uint16 word_address; /* memory address */ + T_EEPROM_STATE state; /* current operation state */ + T_EEPROM_TYPE type; /* EEPROM characteristics for this game */ } T_EEPROM; diff --git a/source/cart_hw/sram.c b/source/cart_hw/sram.c index 7579c97..7b11a15 100644 --- a/source/cart_hw/sram.c +++ b/source/cart_hw/sram.c @@ -29,9 +29,9 @@ T_SRAM sram; * * The SRAM definition is held at offset 0x1b0 of the ROM header. * - * 1B0h: dc.b 'RA', %1x1yz000, %00100000 - * 1B4h: dc.l RAM start address - * 1B8h: dc.l RAM end address + * 1B0h: dc.b 'RA', %1x1yz000, %00100000 + * 1B4h: dc.l RAM start address + * 1B8h: dc.l RAM end address * x 1 for BACKUP and 0 If not BACKUP * yz 10 if even address only * 11 if odd address only @@ -48,51 +48,51 @@ void sram_init() if ((cart_rom[0x1b0] == 0x52) && (cart_rom[0x1b1] == 0x41)) { /* retrieve informations from headezr */ - sram.detected = 1; + sram.detected = 1; sram.start = READ_WORD_LONG(cart_rom, 0x1b4); sram.end = READ_WORD_LONG(cart_rom, 0x1b8); - /* fixe some bad header informations */ - if ((sram.start > sram.end) || ((sram.end - sram.start) >= 0x10000)) - sram.end = sram.start + 0xffff; - sram.start &= 0xfffffffe; + /* fixe some bad header informations */ + if ((sram.start > sram.end) || ((sram.end - sram.start) >= 0x10000)) + sram.end = sram.start + 0xffff; + sram.start &= 0xfffffffe; sram.end |= 1; } else { - /* default SRAM region */ - sram.start = 0x200000; + /* default SRAM region */ + sram.start = 0x200000; sram.end = 0x20ffff; } /* set SRAM ON by default when ROM is not mapped */ if (genromsize <= sram.start) { - sram.on = 1; - sram.write = 1; + sram.on = 1; + sram.write = 1; } /* Some games with bad header or specific configuration */ if (strstr(rominfo.product,"T-113016") != NULL) { - /* Pugsy (try accessing unmapped area for copy protection) */ - sram.on = 0; - sram.write = 0; + /* Pugsy (try accessing unmapped area for copy protection) */ + sram.on = 0; + sram.write = 0; } else if ((strstr(rominfo.product,"T-26013") != NULL) && (rominfo.checksum == 0xa837)) { - /* Psy-O-Blade (bad header) */ - sram.on = 1; - sram.write = 1; - sram.start = 0x200001; - sram.end = 0x203fff; + /* Psy-O-Blade (bad header) */ + sram.on = 1; + sram.write = 1; + sram.start = 0x200001; + sram.end = 0x203fff; } else if (((realchecksum == 0xaeaa) || (realchecksum == 0x8dba)) && (rominfo.checksum == 0x8104)) { - /* Xin Qigai Wangzi, aka Beggar Prince (no header, use uncommon area) */ - sram.on = 1; - sram.write = 1; - sram.start = 0x400000; - sram.end = 0x40ffff; + /* Xin Qigai Wangzi, aka Beggar Prince (no header, use uncommon area) */ + sram.on = 1; + sram.write = 1; + sram.start = 0x400000; + sram.end = 0x40ffff; } } diff --git a/source/cart_hw/svp/imageformat.txt b/source/cart_hw/svp/imageformat.txt index b1929cb..2d453b3 100644 --- a/source/cart_hw/svp/imageformat.txt +++ b/source/cart_hw/svp/imageformat.txt @@ -2,13 +2,14 @@ vscroll: 1 (0); 209 (26) - alternates every 4 frames vram range for patterns: 0000-999f (low scr 0000-395f,72e0-999f; high 3980-999f) name table address: c000 -seen DMAs (in order): [300002-3026c3]->[0020-26e1] len 4961 - [3026c2-303943]->[26e0-3961] len 2369 - [303942-306003]->[72e0-99a1] len 4961 - --- - [306002-3086c3]->[3980-6041] len 4961 - [3086c2-309943]->[6040-72c1] len 2369 - [309942-30c003]->[72e0-99a2] len 4961 +seen DMAs (in order): + [300002-3026c3]->[0020-26e1] len 4961 + [3026c2-303943]->[26e0-3961] len 2369 + [303942-306003]->[72e0-99a1] len 4961 + --- + [306002-3086c3]->[3980-6041] len 4961 + [3086c2-309943]->[6040-72c1] len 2369 + [309942-30c003]->[72e0-99a2] len 4961 tile arrangement: 000: 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 diff --git a/source/cart_hw/svp/ssp16.c b/source/cart_hw/svp/ssp16.c index 117734e..a31eec3 100644 --- a/source/cart_hw/svp/ssp16.c +++ b/source/cart_hw/svp/ssp16.c @@ -199,17 +199,17 @@ #define rX ssp->gr[SSP_X].h #define rY ssp->gr[SSP_Y].h #define rA ssp->gr[SSP_A].h -#define rST ssp->gr[SSP_ST].h // 4 +#define rST ssp->gr[SSP_ST].h // 4 #define rSTACK ssp->gr[SSP_STACK].h #define rPC ssp->gr[SSP_PC].h #define rP ssp->gr[SSP_P] -#define rPM0 ssp->gr[SSP_PM0].h // 8 +#define rPM0 ssp->gr[SSP_PM0].h // 8 #define rPM1 ssp->gr[SSP_PM1].h #define rPM2 ssp->gr[SSP_PM2].h #define rXST ssp->gr[SSP_XST].h -#define rPM4 ssp->gr[SSP_PM4].h // 12 +#define rPM4 ssp->gr[SSP_PM4].h // 12 // 13 -#define rPMC ssp->gr[SSP_PMC] // will keep addr in .h, mode in .l +#define rPMC ssp->gr[SSP_PMC] // will keep addr in .h, mode in .l #define rAL ssp->gr[SSP_A].l #define rA32 ssp->gr[SSP_A].v @@ -223,9 +223,9 @@ #define REG_READ(r) (((r) <= 4) ? ssp->gr[r].h : read_handlers[r]()) #define REG_WRITE(r,d) { \ - int r1 = r; \ - if (r1 >= 4) write_handlers[r1](d); \ - else if (r1 > 0) ssp->gr[r1].h = d; \ + int r1 = r; \ + if (r1 >= 4) write_handlers[r1](d); \ + else if (r1 > 0) ssp->gr[r1].h = d; \ } // flags @@ -236,105 +236,105 @@ // update ZN according to 32bit ACC. #define UPD_ACC_ZN \ - rST &= ~(SSP_FLAG_Z|SSP_FLAG_N); \ - if (!rA32) rST |= SSP_FLAG_Z; \ - else rST |= (rA32>>16)&SSP_FLAG_N; + rST &= ~(SSP_FLAG_Z|SSP_FLAG_N); \ + if (!rA32) rST |= SSP_FLAG_Z; \ + else rST |= (rA32>>16)&SSP_FLAG_N; // it seems SVP code never checks for L and OV, so we leave them out. // rST |= (t>>4)&SSP_FLAG_L; #define UPD_LZVN \ - rST &= ~(SSP_FLAG_L|SSP_FLAG_Z|SSP_FLAG_V|SSP_FLAG_N); \ - if (!rA32) rST |= SSP_FLAG_Z; \ - else rST |= (rA32>>16)&SSP_FLAG_N; + rST &= ~(SSP_FLAG_L|SSP_FLAG_Z|SSP_FLAG_V|SSP_FLAG_N); \ + if (!rA32) rST |= SSP_FLAG_Z; \ + else rST |= (rA32>>16)&SSP_FLAG_N; // standard cond processing. // again, only Z and N is checked, as SVP doesn't seem to use any other conds. #define COND_CHECK \ - switch (op&0xf0) { \ - case 0x00: cond = 1; break; /* always true */ \ - case 0x50: cond = !((rST ^ (op<<5)) & SSP_FLAG_Z); break; /* Z matches f(?) bit */ \ - case 0x70: cond = !((rST ^ (op<<7)) & SSP_FLAG_N); break; /* N matches f(?) bit */ \ - default:elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: unimplemented cond @ %04x", GET_PPC_OFFS()); break; \ - } + switch (op&0xf0) { \ + case 0x00: cond = 1; break; /* always true */ \ + case 0x50: cond = !((rST ^ (op<<5)) & SSP_FLAG_Z); break; /* Z matches f(?) bit */ \ + case 0x70: cond = !((rST ^ (op<<7)) & SSP_FLAG_N); break; /* N matches f(?) bit */ \ + default:elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: unimplemented cond @ %04x", GET_PPC_OFFS()); break; \ + } // ops with accumulator. // how is low word really affected by these? // nearly sure 'ld A' doesn't affect flags #define OP_LDA(x) \ - rA = x + rA = x #define OP_LDA32(x) \ - rA32 = x + rA32 = x #define OP_SUBA(x) { \ - rA32 -= (x) << 16; \ - UPD_LZVN \ + rA32 -= (x) << 16; \ + UPD_LZVN \ } #define OP_SUBA32(x) { \ - rA32 -= (x); \ - UPD_LZVN \ + rA32 -= (x); \ + UPD_LZVN \ } #define OP_CMPA(x) { \ - u32 t = rA32 - ((x) << 16); \ - rST &= ~(SSP_FLAG_L|SSP_FLAG_Z|SSP_FLAG_V|SSP_FLAG_N); \ - if (!t) rST |= SSP_FLAG_Z; \ - else rST |= (t>>16)&SSP_FLAG_N; \ + u32 t = rA32 - ((x) << 16); \ + rST &= ~(SSP_FLAG_L|SSP_FLAG_Z|SSP_FLAG_V|SSP_FLAG_N); \ + if (!t) rST |= SSP_FLAG_Z; \ + else rST |= (t>>16)&SSP_FLAG_N; \ } #define OP_CMPA32(x) { \ - u32 t = rA32 - (x); \ - rST &= ~(SSP_FLAG_L|SSP_FLAG_Z|SSP_FLAG_V|SSP_FLAG_N); \ - if (!t) rST |= SSP_FLAG_Z; \ - else rST |= (t>>16)&SSP_FLAG_N; \ + u32 t = rA32 - (x); \ + rST &= ~(SSP_FLAG_L|SSP_FLAG_Z|SSP_FLAG_V|SSP_FLAG_N); \ + if (!t) rST |= SSP_FLAG_Z; \ + else rST |= (t>>16)&SSP_FLAG_N; \ } #define OP_ADDA(x) { \ - rA32 += (x) << 16; \ - UPD_LZVN \ + rA32 += (x) << 16; \ + UPD_LZVN \ } #define OP_ADDA32(x) { \ - rA32 += (x); \ - UPD_LZVN \ + rA32 += (x); \ + UPD_LZVN \ } #define OP_ANDA(x) \ - rA32 &= (x) << 16; \ - UPD_ACC_ZN + rA32 &= (x) << 16; \ + UPD_ACC_ZN #define OP_ANDA32(x) \ - rA32 &= (x); \ - UPD_ACC_ZN + rA32 &= (x); \ + UPD_ACC_ZN #define OP_ORA(x) \ - rA32 |= (x) << 16; \ - UPD_ACC_ZN + rA32 |= (x) << 16; \ + UPD_ACC_ZN #define OP_ORA32(x) \ - rA32 |= (x); \ - UPD_ACC_ZN + rA32 |= (x); \ + UPD_ACC_ZN #define OP_EORA(x) \ - rA32 ^= (x) << 16; \ - UPD_ACC_ZN + rA32 ^= (x) << 16; \ + UPD_ACC_ZN #define OP_EORA32(x) \ - rA32 ^= (x); \ - UPD_ACC_ZN + rA32 ^= (x); \ + UPD_ACC_ZN #define OP_CHECK32(OP) { \ - if ((op & 0x0f) == SSP_P) { /* A <- P */ \ - read_P(); /* update P */ \ - OP(rP.v); \ - break; \ - } \ - if ((op & 0x0f) == SSP_A) { /* A <- A */ \ - OP(rA32); \ - break; \ - } \ + if ((op & 0x0f) == SSP_P) { /* A <- P */ \ + read_P(); /* update P */ \ + OP(rP.v); \ + break; \ + } \ + if ((op & 0x0f) == SSP_A) { /* A <- A */ \ + OP(rA32); \ + break; \ + } \ } @@ -354,437 +354,437 @@ static int last_iram = 0; static u32 read_unknown(void) { #ifdef LOG_SVP - elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: unknown read @ %04x", GET_PPC_OFFS()); + elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: unknown read @ %04x", GET_PPC_OFFS()); #endif - return 0; + return 0; } static void write_unknown(u32 d) { #ifdef LOG_SVP - elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: unknown write @ %04x", GET_PPC_OFFS()); + elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: unknown write @ %04x", GET_PPC_OFFS()); #endif } // 4 static void write_ST(u32 d) { - //if ((rST ^ d) & 0x0007) elprintf(EL_SVP, "ssp RPL %i -> %i @ %04x", rST&7, d&7, GET_PPC_OFFS()); + //if ((rST ^ d) & 0x0007) elprintf(EL_SVP, "ssp RPL %i -> %i @ %04x", rST&7, d&7, GET_PPC_OFFS()); #ifdef LOG_SVP - if ((rST ^ d) & 0x0f98) elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME ST %04x -> %04x @ %04x", rST, d, GET_PPC_OFFS()); + if ((rST ^ d) & 0x0f98) elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME ST %04x -> %04x @ %04x", rST, d, GET_PPC_OFFS()); #endif - rST = d; + rST = d; } // 5 static u32 read_STACK(void) { - --rSTACK; - if ((short)rSTACK < 0) { - rSTACK = 5; + --rSTACK; + if ((short)rSTACK < 0) { + rSTACK = 5; #ifdef LOG_SVP - elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: stack underflow! (%i) @ %04x", rSTACK, GET_PPC_OFFS()); + elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: stack underflow! (%i) @ %04x", rSTACK, GET_PPC_OFFS()); #endif - } - return ssp->stack[rSTACK]; + } + return ssp->stack[rSTACK]; } static void write_STACK(u32 d) { - if (rSTACK >= 6) { + if (rSTACK >= 6) { #ifdef LOG_SVP - elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: stack overflow! (%i) @ %04x", rSTACK, GET_PPC_OFFS()); + elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: stack overflow! (%i) @ %04x", rSTACK, GET_PPC_OFFS()); #endif - rSTACK = 0; - } - ssp->stack[rSTACK++] = d; + rSTACK = 0; + } + ssp->stack[rSTACK++] = d; } // 6 static u32 read_PC(void) { - //g_cycles--; - return GET_PC(); + //g_cycles--; + return GET_PC(); } static void write_PC(u32 d) { - SET_PC(d); - g_cycles--; + SET_PC(d); + g_cycles--; } // 7 static u32 read_P(void) { - int m1 = (signed short)rX; - int m2 = (signed short)rY; - rP.v = (m1 * m2 * 2); - return rP.h; + int m1 = (signed short)rX; + int m2 = (signed short)rY; + rP.v = (m1 * m2 * 2); + return rP.h; } // ----------------------------------------------------- static int get_inc(int mode) { - int inc = (mode >> 11) & 7; - if (inc != 0) { - if (inc != 7) inc--; - //inc = (1<<16) << inc; // 0 1 2 4 8 16 32 128 - inc = 1 << inc; // 0 1 2 4 8 16 32 128 - if (mode & 0x8000) inc = -inc; // decrement mode - } - return inc; + int inc = (mode >> 11) & 7; + if (inc != 0) { + if (inc != 7) inc--; + //inc = (1<<16) << inc; // 0 1 2 4 8 16 32 128 + inc = 1 << inc; // 0 1 2 4 8 16 32 128 + if (mode & 0x8000) inc = -inc; // decrement mode + } + return inc; } #define overwite_write(dst, d) \ { \ - if (d & 0xf000) { dst &= ~0xf000; dst |= d & 0xf000; } \ - if (d & 0x0f00) { dst &= ~0x0f00; dst |= d & 0x0f00; } \ - if (d & 0x00f0) { dst &= ~0x00f0; dst |= d & 0x00f0; } \ - if (d & 0x000f) { dst &= ~0x000f; dst |= d & 0x000f; } \ + if (d & 0xf000) { dst &= ~0xf000; dst |= d & 0xf000; } \ + if (d & 0x0f00) { dst &= ~0x0f00; dst |= d & 0x0f00; } \ + if (d & 0x00f0) { dst &= ~0x00f0; dst |= d & 0x00f0; } \ + if (d & 0x000f) { dst &= ~0x000f; dst |= d & 0x000f; } \ } static u32 pm_io(int reg, int write, u32 d) { - if (ssp->emu_status & SSP_PMC_SET) - { - // this MUST be blind r or w - if ((*(PC-1) & 0xff0f) && (*(PC-1) & 0xfff0)) { + if (ssp->emu_status & SSP_PMC_SET) + { + // this MUST be blind r or w + if ((*(PC-1) & 0xff0f) && (*(PC-1) & 0xfff0)) { #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: tried to set PM%i (%c) with non-blind i/o %08x @ %04x", - reg, write ? 'w' : 'r', rPMC.v, GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: tried to set PM%i (%c) with non-blind i/o %08x @ %04x", + reg, write ? 'w' : 'r', rPMC.v, GET_PPC_OFFS()); #endif - ssp->emu_status &= ~SSP_PMC_SET; - return 0; - } + ssp->emu_status &= ~SSP_PMC_SET; + return 0; + } #ifdef LOG_SVP - elprintf(EL_SVP, "PM%i (%c) set to %08x @ %04x", reg, write ? 'w' : 'r', rPMC.v, GET_PPC_OFFS()); + elprintf(EL_SVP, "PM%i (%c) set to %08x @ %04x", reg, write ? 'w' : 'r', rPMC.v, GET_PPC_OFFS()); #endif - ssp->pmac_read[write ? reg + 6 : reg] = rPMC.v; - ssp->emu_status &= ~SSP_PMC_SET; + ssp->pmac_read[write ? reg + 6 : reg] = rPMC.v; + ssp->emu_status &= ~SSP_PMC_SET; #ifdef LOG_SVP - if ((rPMC.v & 0x7f) == 0x1c && (rPMC.v & 0x7fff0000) == 0) { - elprintf(EL_SVP, "ssp IRAM copy from %06x", (ssp->RAM1[0]-1)<<1); + if ((rPMC.v & 0x7f) == 0x1c && (rPMC.v & 0x7fff0000) == 0) { + elprintf(EL_SVP, "ssp IRAM copy from %06x", (ssp->RAM1[0]-1)<<1); #ifdef USE_DEBUGGER - last_iram = (ssp->RAM1[0]-1)<<1; + last_iram = (ssp->RAM1[0]-1)<<1; #endif - } + } #endif - return 0; - } + return 0; + } - // just in case - if (ssp->emu_status & SSP_PMC_HAVE_ADDR) { + // just in case + if (ssp->emu_status & SSP_PMC_HAVE_ADDR) { #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: PM%i (%c) with only addr set @ %04x", - reg, write ? 'w' : 'r', GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: PM%i (%c) with only addr set @ %04x", + reg, write ? 'w' : 'r', GET_PPC_OFFS()); #endif - ssp->emu_status &= ~SSP_PMC_HAVE_ADDR; - } + ssp->emu_status &= ~SSP_PMC_HAVE_ADDR; + } - if (reg == 4 || (rST & 0x60)) - { + if (reg == 4 || (rST & 0x60)) + { #ifdef LOG_SVP - #define CADDR ((((mode<<16)&0x7f0000)|addr)<<1) + #define CADDR ((((mode<<16)&0x7f0000)|addr)<<1) #endif - unsigned short *dram = (unsigned short *)svp->dram; - if (write) - { - /*int mode = ssp->pmac_write[reg]&0xffff; - int addr = ssp->pmac_write[reg]>>16;*/ - int addr = ssp->pmac_write[reg]&0xffff; - int mode = ssp->pmac_write[reg]>>16; + unsigned short *dram = (unsigned short *)svp->dram; + if (write) + { + /*int mode = ssp->pmac_write[reg]&0xffff; + int addr = ssp->pmac_write[reg]>>16;*/ + int addr = ssp->pmac_write[reg]&0xffff; + int mode = ssp->pmac_write[reg]>>16; #ifdef LOG_SVP - if ((mode & 0xb800) == 0xb800) - elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: mode %04x", mode); + if ((mode & 0xb800) == 0xb800) + elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: mode %04x", mode); #endif - if ((mode & 0x43ff) == 0x0018) // DRAM - { - int inc = get_inc(mode); + if ((mode & 0x43ff) == 0x0018) // DRAM + { + int inc = get_inc(mode); #ifdef LOG_SVP - elprintf(EL_SVP, "ssp PM%i DRAM w [%06x] %04x (inc %i, ovrw %i)", - reg, CADDR, d, inc >> 16, (mode>>10)&1); + elprintf(EL_SVP, "ssp PM%i DRAM w [%06x] %04x (inc %i, ovrw %i)", + reg, CADDR, d, inc >> 16, (mode>>10)&1); #endif - if (mode & 0x0400) { - overwite_write(dram[addr], d); - } else dram[addr] = d; - ssp->pmac_write[reg] += inc; - } - else if ((mode & 0xfbff) == 0x4018) // DRAM, cell inc - { + if (mode & 0x0400) { + overwite_write(dram[addr], d); + } else dram[addr] = d; + ssp->pmac_write[reg] += inc; + } + else if ((mode & 0xfbff) == 0x4018) // DRAM, cell inc + { #ifdef LOG_SVP - elprintf(EL_SVP, "ssp PM%i DRAM w [%06x] %04x (cell inc, ovrw %i) @ %04x", - reg, CADDR, d, (mode>>10)&1, GET_PPC_OFFS()); + elprintf(EL_SVP, "ssp PM%i DRAM w [%06x] %04x (cell inc, ovrw %i) @ %04x", + reg, CADDR, d, (mode>>10)&1, GET_PPC_OFFS()); #endif - if (mode & 0x0400) { - overwite_write(dram[addr], d); - } else dram[addr] = d; - //ssp->pmac_write[reg] += (addr&1) ? (31<<16) : (1<<16); - ssp->pmac_write[reg] += (addr&1) ? 31 : 1; - } - else if ((mode & 0x47ff) == 0x001c) // IRAM - { - int inc = get_inc(mode); + if (mode & 0x0400) { + overwite_write(dram[addr], d); + } else dram[addr] = d; + //ssp->pmac_write[reg] += (addr&1) ? (31<<16) : (1<<16); + ssp->pmac_write[reg] += (addr&1) ? 31 : 1; + } + else if ((mode & 0x47ff) == 0x001c) // IRAM + { + int inc = get_inc(mode); #ifdef LOG_SVP - if ((addr&0xfc00) != 0x8000) - elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: invalid IRAM addr: %04x", addr<<1); - elprintf(EL_SVP, "ssp IRAM w [%06x] %04x (inc %i)", (addr<<1)&0x7ff, d, inc >> 16); + if ((addr&0xfc00) != 0x8000) + elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: invalid IRAM addr: %04x", addr<<1); + elprintf(EL_SVP, "ssp IRAM w [%06x] %04x (inc %i)", (addr<<1)&0x7ff, d, inc >> 16); #endif - ((unsigned short *)svp->iram_rom)[addr&0x3ff] = d; - ssp->pmac_write[reg] += inc; - } + ((unsigned short *)svp->iram_rom)[addr&0x3ff] = d; + ssp->pmac_write[reg] += inc; + } #ifdef LOG_SVP - else - { - elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: PM%i unhandled write mode %04x, [%06x] %04x @ %04x", - reg, mode, CADDR, d, GET_PPC_OFFS()); - } + else + { + elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: PM%i unhandled write mode %04x, [%06x] %04x @ %04x", + reg, mode, CADDR, d, GET_PPC_OFFS()); + } #endif - } - else - { - /*int mode = ssp->pmac_read[reg]&0xffff; - int addr = ssp->pmac_read[reg]>>16;*/ - int addr = ssp->pmac_read[reg]&0xffff; - int mode = ssp->pmac_read[reg]>>16; + } + else + { + /*int mode = ssp->pmac_read[reg]&0xffff; + int addr = ssp->pmac_read[reg]>>16;*/ + int addr = ssp->pmac_read[reg]&0xffff; + int mode = ssp->pmac_read[reg]>>16; - if ((mode & 0xfff0) == 0x0800) // ROM, inc 1, verified to be correct - { + if ((mode & 0xfff0) == 0x0800) // ROM, inc 1, verified to be correct + { #ifdef LOG_SVP - elprintf(EL_SVP, "ssp ROM r [%06x] %04x", CADDR, - ((unsigned short *)cart_rom)[addr|((mode&0xf)<<16)]); + elprintf(EL_SVP, "ssp ROM r [%06x] %04x", CADDR, + ((unsigned short *)cart_rom)[addr|((mode&0xf)<<16)]); #endif - /*if ((signed int)ssp->pmac_read[reg] >> 16 == -1) ssp->pmac_read[reg]++; - ssp->pmac_read[reg] += 1<<16;*/ - if ((signed int)(ssp->pmac_read[reg] & 0xffff) == -1) ssp->pmac_read[reg] += 1<<16; - ssp->pmac_read[reg] ++; - - d = ((unsigned short *)cart_rom)[addr|((mode&0xf)<<16)]; - } - else if ((mode & 0x47ff) == 0x0018) // DRAM - { - int inc = get_inc(mode); + /*if ((signed int)ssp->pmac_read[reg] >> 16 == -1) ssp->pmac_read[reg]++; + ssp->pmac_read[reg] += 1<<16;*/ + if ((signed int)(ssp->pmac_read[reg] & 0xffff) == -1) ssp->pmac_read[reg] += 1<<16; + ssp->pmac_read[reg] ++; + + d = ((unsigned short *)cart_rom)[addr|((mode&0xf)<<16)]; + } + else if ((mode & 0x47ff) == 0x0018) // DRAM + { + int inc = get_inc(mode); #ifdef LOG_SVP - elprintf(EL_SVP, "ssp PM%i DRAM r [%06x] %04x (inc %i)", reg, CADDR, dram[addr], inc >> 16); + elprintf(EL_SVP, "ssp PM%i DRAM r [%06x] %04x (inc %i)", reg, CADDR, dram[addr], inc >> 16); #endif - d = dram[addr]; - ssp->pmac_read[reg] += inc; - } - else - { + d = dram[addr]; + ssp->pmac_read[reg] += inc; + } + else + { #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: PM%i unhandled read mode %04x, [%06x] @ %04x", - reg, mode, CADDR, GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: PM%i unhandled read mode %04x, [%06x] @ %04x", + reg, mode, CADDR, GET_PPC_OFFS()); #endif - d = 0; - } - } + d = 0; + } + } - // PMC value corresponds to last PMR accessed (not sure). - rPMC.v = ssp->pmac_read[write ? reg + 6 : reg]; + // PMC value corresponds to last PMR accessed (not sure). + rPMC.v = ssp->pmac_read[write ? reg + 6 : reg]; - return d; - } + return d; + } - return (u32)-1; + return (u32)-1; } // 8 static u32 read_PM0(void) { - u32 d = pm_io(0, 0, 0); - if (d != (u32)-1) return d; + u32 d = pm_io(0, 0, 0); + if (d != (u32)-1) return d; #ifdef LOG_SVP - elprintf(EL_SVP, "PM0 raw r %04x @ %04x", rPM0, GET_PPC_OFFS()); + elprintf(EL_SVP, "PM0 raw r %04x @ %04x", rPM0, GET_PPC_OFFS()); #endif - d = rPM0; - if (!(d & 2) && (GET_PPC_OFFS() == 0x800 || GET_PPC_OFFS() == 0x1851E)) { - ssp->emu_status |= SSP_WAIT_PM0; + d = rPM0; + if (!(d & 2) && (GET_PPC_OFFS() == 0x800 || GET_PPC_OFFS() == 0x1851E)) { + ssp->emu_status |= SSP_WAIT_PM0; #ifdef LOG_SVP - elprintf(EL_SVP, "det TIGHT loop: PM0"); + elprintf(EL_SVP, "det TIGHT loop: PM0"); #endif - } - rPM0 &= ~2; // ? - return d; + } + rPM0 &= ~2; // ? + return d; } static void write_PM0(u32 d) { - u32 r = pm_io(0, 1, d); - if (r != (u32)-1) return; + u32 r = pm_io(0, 1, d); + if (r != (u32)-1) return; #ifdef LOG_SVP - elprintf(EL_SVP, "PM0 raw w %04x @ %04x", d, GET_PPC_OFFS()); + elprintf(EL_SVP, "PM0 raw w %04x @ %04x", d, GET_PPC_OFFS()); #endif - rPM0 = d; + rPM0 = d; } // 9 static u32 read_PM1(void) { - u32 d = pm_io(1, 0, 0); - if (d != (u32)-1) return d; - // can be removed? + u32 d = pm_io(1, 0, 0); + if (d != (u32)-1) return d; + // can be removed? #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "PM1 raw r %04x @ %04x", rPM1, GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "PM1 raw r %04x @ %04x", rPM1, GET_PPC_OFFS()); #endif - return rPM1; + return rPM1; } static void write_PM1(u32 d) { - u32 r = pm_io(1, 1, d); - if (r != (u32)-1) return; - // can be removed? + u32 r = pm_io(1, 1, d); + if (r != (u32)-1) return; + // can be removed? #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "PM1 raw w %04x @ %04x", d, GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "PM1 raw w %04x @ %04x", d, GET_PPC_OFFS()); #endif - rPM1 = d; + rPM1 = d; } // 10 static u32 read_PM2(void) { - u32 d = pm_io(2, 0, 0); - if (d != (u32)-1) return d; - // can be removed? + u32 d = pm_io(2, 0, 0); + if (d != (u32)-1) return d; + // can be removed? #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "PM2 raw r %04x @ %04x", rPM2, GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "PM2 raw r %04x @ %04x", rPM2, GET_PPC_OFFS()); #endif - return rPM2; + return rPM2; } static void write_PM2(u32 d) { - u32 r = pm_io(2, 1, d); - if (r != (u32)-1) return; - // can be removed? + u32 r = pm_io(2, 1, d); + if (r != (u32)-1) return; + // can be removed? #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "PM2 raw w %04x @ %04x", d, GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "PM2 raw w %04x @ %04x", d, GET_PPC_OFFS()); #endif - rPM2 = d; + rPM2 = d; } // 11 static u32 read_XST(void) { - // can be removed? - u32 d = pm_io(3, 0, 0); - if (d != (u32)-1) return d; + // can be removed? + u32 d = pm_io(3, 0, 0); + if (d != (u32)-1) return d; #ifdef LOG_SVP - elprintf(EL_SVP, "XST raw r %04x @ %04x", rXST, GET_PPC_OFFS()); + elprintf(EL_SVP, "XST raw r %04x @ %04x", rXST, GET_PPC_OFFS()); #endif - return rXST; + return rXST; } static void write_XST(u32 d) { - // can be removed? - u32 r = pm_io(3, 1, d); - if (r != (u32)-1) return; + // can be removed? + u32 r = pm_io(3, 1, d); + if (r != (u32)-1) return; #ifdef LOG_SVP - elprintf(EL_SVP, "XST raw w %04x @ %04x", d, GET_PPC_OFFS()); + elprintf(EL_SVP, "XST raw w %04x @ %04x", d, GET_PPC_OFFS()); #endif - rPM0 |= 1; - rXST = d; + rPM0 |= 1; + rXST = d; } // 12 static u32 read_PM4(void) { - u32 d = pm_io(4, 0, 0); - if (d == 0) { - switch (GET_PPC_OFFS()) { - case 0x0854: - ssp->emu_status |= SSP_WAIT_30FE08; + u32 d = pm_io(4, 0, 0); + if (d == 0) { + switch (GET_PPC_OFFS()) { + case 0x0854: + ssp->emu_status |= SSP_WAIT_30FE08; #ifdef LOG_SVP - elprintf(EL_SVP, "det TIGHT loop: [30fe08]"); + elprintf(EL_SVP, "det TIGHT loop: [30fe08]"); #endif - break; - case 0x4f12: - ssp->emu_status |= SSP_WAIT_30FE06; + break; + case 0x4f12: + ssp->emu_status |= SSP_WAIT_30FE06; #ifdef LOG_SVP - elprintf(EL_SVP, "det TIGHT loop: [30fe06]"); + elprintf(EL_SVP, "det TIGHT loop: [30fe06]"); #endif - break; - } - } - if (d != (u32)-1) return d; - // can be removed? + break; + } + } + if (d != (u32)-1) return d; + // can be removed? #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "PM4 raw r %04x @ %04x", rPM4, GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "PM4 raw r %04x @ %04x", rPM4, GET_PPC_OFFS()); #endif - return rPM4; + return rPM4; } static void write_PM4(u32 d) { - u32 r = pm_io(4, 1, d); - if (r != (u32)-1) return; - // can be removed? + u32 r = pm_io(4, 1, d); + if (r != (u32)-1) return; + // can be removed? #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "PM4 raw w %04x @ %04x", d, GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "PM4 raw w %04x @ %04x", d, GET_PPC_OFFS()); #endif - rPM4 = d; + rPM4 = d; } // 14 static u32 read_PMC(void) { #ifdef LOG_SVP - elprintf(EL_SVP, "PMC r a %04x (st %c) @ %04x", rPMC.h, - (ssp->emu_status & SSP_PMC_HAVE_ADDR) ? 'm' : 'a', GET_PPC_OFFS()); + elprintf(EL_SVP, "PMC r a %04x (st %c) @ %04x", rPMC.h, + (ssp->emu_status & SSP_PMC_HAVE_ADDR) ? 'm' : 'a', GET_PPC_OFFS()); #endif - if (ssp->emu_status & SSP_PMC_HAVE_ADDR) { - //if (ssp->emu_status & SSP_PMC_SET) - // elprintf(EL_ANOMALY|EL_SVP, "prev PMC not used @ %04x", GET_PPC_OFFS()); - ssp->emu_status |= SSP_PMC_SET; - ssp->emu_status &= ~SSP_PMC_HAVE_ADDR; - //return ((rPMC.h << 4) & 0xfff0) | ((rPMC.h >> 4) & 0xf); - return ((rPMC.l << 4) & 0xfff0) | ((rPMC.l >> 4) & 0xf); - } else { - ssp->emu_status |= SSP_PMC_HAVE_ADDR; - //return rPMC.h; - return rPMC.l; - } + if (ssp->emu_status & SSP_PMC_HAVE_ADDR) { + //if (ssp->emu_status & SSP_PMC_SET) + // elprintf(EL_ANOMALY|EL_SVP, "prev PMC not used @ %04x", GET_PPC_OFFS()); + ssp->emu_status |= SSP_PMC_SET; + ssp->emu_status &= ~SSP_PMC_HAVE_ADDR; + //return ((rPMC.h << 4) & 0xfff0) | ((rPMC.h >> 4) & 0xf); + return ((rPMC.l << 4) & 0xfff0) | ((rPMC.l >> 4) & 0xf); + } else { + ssp->emu_status |= SSP_PMC_HAVE_ADDR; + //return rPMC.h; + return rPMC.l; + } } static void write_PMC(u32 d) { - if (ssp->emu_status & SSP_PMC_HAVE_ADDR) { - //if (ssp->emu_status & SSP_PMC_SET) - // elprintf(EL_ANOMALY|EL_SVP, "prev PMC not used @ %04x", GET_PPC_OFFS()); - ssp->emu_status |= SSP_PMC_SET; - ssp->emu_status &= ~SSP_PMC_HAVE_ADDR; - //rPMC.l = d; - rPMC.h = d; + if (ssp->emu_status & SSP_PMC_HAVE_ADDR) { + //if (ssp->emu_status & SSP_PMC_SET) + // elprintf(EL_ANOMALY|EL_SVP, "prev PMC not used @ %04x", GET_PPC_OFFS()); + ssp->emu_status |= SSP_PMC_SET; + ssp->emu_status &= ~SSP_PMC_HAVE_ADDR; + //rPMC.l = d; + rPMC.h = d; #ifdef LOG_SVP - elprintf(EL_SVP, "PMC w m %04x @ %04x", rPMC.l, GET_PPC_OFFS()); + elprintf(EL_SVP, "PMC w m %04x @ %04x", rPMC.l, GET_PPC_OFFS()); #endif - } else { - ssp->emu_status |= SSP_PMC_HAVE_ADDR; - //rPMC.h = d; - rPMC.l = d; + } else { + ssp->emu_status |= SSP_PMC_HAVE_ADDR; + //rPMC.h = d; + rPMC.l = d; #ifdef LOG_SVP - elprintf(EL_SVP, "PMC w a %04x @ %04x", rPMC.h, GET_PPC_OFFS()); + elprintf(EL_SVP, "PMC w a %04x @ %04x", rPMC.h, GET_PPC_OFFS()); #endif - } + } } // 15 static u32 read_AL(void) { - if (*(PC-1) == 0x000f) { + if (*(PC-1) == 0x000f) { #ifdef LOG_SVP - elprintf(EL_SVP, "ssp dummy PM assign %08x @ %04x", rPMC.v, GET_PPC_OFFS()); + elprintf(EL_SVP, "ssp dummy PM assign %08x @ %04x", rPMC.v, GET_PPC_OFFS()); #endif - ssp->emu_status &= ~(SSP_PMC_SET|SSP_PMC_HAVE_ADDR); // ? - } - return rAL; + ssp->emu_status &= ~(SSP_PMC_SET|SSP_PMC_HAVE_ADDR); // ? + } + return rAL; } static void write_AL(u32 d) { - rAL = d; + rAL = d; } @@ -793,37 +793,37 @@ typedef void (*write_func_t)(u32 d); static read_func_t read_handlers[16] = { - read_unknown, read_unknown, read_unknown, read_unknown, // -, X, Y, A - read_unknown, // 4 ST - read_STACK, - read_PC, - read_P, - read_PM0, // 8 - read_PM1, - read_PM2, - read_XST, - read_PM4, // 12 - read_unknown, // 13 gr13 - read_PMC, - read_AL + read_unknown, read_unknown, read_unknown, read_unknown, // -, X, Y, A + read_unknown, // 4 ST + read_STACK, + read_PC, + read_P, + read_PM0, // 8 + read_PM1, + read_PM2, + read_XST, + read_PM4, // 12 + read_unknown, // 13 gr13 + read_PMC, + read_AL }; static write_func_t write_handlers[16] = { - write_unknown, write_unknown, write_unknown, write_unknown, // -, X, Y, A -// write_unknown, // 4 ST - write_ST, // 4 ST (debug hook) - write_STACK, - write_PC, - write_unknown, // 7 P - write_PM0, // 8 - write_PM1, - write_PM2, - write_XST, - write_PM4, // 12 - write_unknown, // 13 gr13 - write_PMC, - write_AL + write_unknown, write_unknown, write_unknown, write_unknown, // -, X, Y, A +// write_unknown, // 4 ST + write_ST, // 4 ST (debug hook) + write_STACK, + write_PC, + write_unknown, // 7 P + write_PM0, // 8 + write_PM1, + write_PM2, + write_XST, + write_PM4, // 12 + write_unknown, // 13 gr13 + write_PMC, + write_AL }; // ----------------------------------------------------- @@ -834,138 +834,138 @@ static write_func_t write_handlers[16] = static u32 ptr1_read_(int ri, int isj2, int modi3) { - //int t = (op&3) | ((op>>6)&4) | ((op<<1)&0x18); - u32 mask, add = 0, t = ri | isj2 | modi3; - unsigned char *rp = NULL; - switch (t) - { - // mod=0 (00) - case 0x00: - case 0x01: - case 0x02: return ssp->RAM0[ssp->r0[t&3]]; - case 0x03: return ssp->RAM0[0]; - case 0x04: - case 0x05: - case 0x06: return ssp->RAM1[ssp->r1[t&3]]; - case 0x07: return ssp->RAM1[0]; - // mod=1 (01), "+!" - case 0x08: - case 0x09: - case 0x0a: return ssp->RAM0[ssp->r0[t&3]++]; - case 0x0b: return ssp->RAM0[1]; - case 0x0c: - case 0x0d: - case 0x0e: return ssp->RAM1[ssp->r1[t&3]++]; - case 0x0f: return ssp->RAM1[1]; - // mod=2 (10), "-" - case 0x10: - case 0x11: - case 0x12: rp = &ssp->r0[t&3]; t = ssp->RAM0[*rp]; - if (!(rST&7)) { (*rp)--; return t; } - add = -1; goto modulo; - case 0x13: return ssp->RAM0[2]; - case 0x14: - case 0x15: - case 0x16: rp = &ssp->r1[t&3]; t = ssp->RAM1[*rp]; - if (!(rST&7)) { (*rp)--; return t; } - add = -1; goto modulo; - case 0x17: return ssp->RAM1[2]; - // mod=3 (11), "+" - case 0x18: - case 0x19: - case 0x1a: rp = &ssp->r0[t&3]; t = ssp->RAM0[*rp]; - if (!(rST&7)) { (*rp)++; return t; } - add = 1; goto modulo; - case 0x1b: return ssp->RAM0[3]; - case 0x1c: - case 0x1d: - case 0x1e: rp = &ssp->r1[t&3]; t = ssp->RAM1[*rp]; - if (!(rST&7)) { (*rp)++; return t; } - add = 1; goto modulo; - case 0x1f: return ssp->RAM1[3]; - } + //int t = (op&3) | ((op>>6)&4) | ((op<<1)&0x18); + u32 mask, add = 0, t = ri | isj2 | modi3; + unsigned char *rp = NULL; + switch (t) + { + // mod=0 (00) + case 0x00: + case 0x01: + case 0x02: return ssp->RAM0[ssp->r0[t&3]]; + case 0x03: return ssp->RAM0[0]; + case 0x04: + case 0x05: + case 0x06: return ssp->RAM1[ssp->r1[t&3]]; + case 0x07: return ssp->RAM1[0]; + // mod=1 (01), "+!" + case 0x08: + case 0x09: + case 0x0a: return ssp->RAM0[ssp->r0[t&3]++]; + case 0x0b: return ssp->RAM0[1]; + case 0x0c: + case 0x0d: + case 0x0e: return ssp->RAM1[ssp->r1[t&3]++]; + case 0x0f: return ssp->RAM1[1]; + // mod=2 (10), "-" + case 0x10: + case 0x11: + case 0x12: rp = &ssp->r0[t&3]; t = ssp->RAM0[*rp]; + if (!(rST&7)) { (*rp)--; return t; } + add = -1; goto modulo; + case 0x13: return ssp->RAM0[2]; + case 0x14: + case 0x15: + case 0x16: rp = &ssp->r1[t&3]; t = ssp->RAM1[*rp]; + if (!(rST&7)) { (*rp)--; return t; } + add = -1; goto modulo; + case 0x17: return ssp->RAM1[2]; + // mod=3 (11), "+" + case 0x18: + case 0x19: + case 0x1a: rp = &ssp->r0[t&3]; t = ssp->RAM0[*rp]; + if (!(rST&7)) { (*rp)++; return t; } + add = 1; goto modulo; + case 0x1b: return ssp->RAM0[3]; + case 0x1c: + case 0x1d: + case 0x1e: rp = &ssp->r1[t&3]; t = ssp->RAM1[*rp]; + if (!(rST&7)) { (*rp)++; return t; } + add = 1; goto modulo; + case 0x1f: return ssp->RAM1[3]; + } - return 0; + return 0; modulo: - mask = (1 << (rST&7)) - 1; - *rp = (*rp & ~mask) | ((*rp + add) & mask); - return t; + mask = (1 << (rST&7)) - 1; + *rp = (*rp & ~mask) | ((*rp + add) & mask); + return t; } static void ptr1_write(int op, u32 d) { - int t = (op&3) | ((op>>6)&4) | ((op<<1)&0x18); - switch (t) - { - // mod=0 (00) - case 0x00: - case 0x01: - case 0x02: ssp->RAM0[ssp->r0[t&3]] = d; return; - case 0x03: ssp->RAM0[0] = d; return; - case 0x04: - case 0x05: - case 0x06: ssp->RAM1[ssp->r1[t&3]] = d; return; - case 0x07: ssp->RAM1[0] = d; return; - // mod=1 (01), "+!" - // mod=3, "+" - case 0x08: - case 0x18: - case 0x09: - case 0x19: - case 0x0a: - case 0x1a: ssp->RAM0[ssp->r0[t&3]++] = d; return; - case 0x0b: ssp->RAM0[1] = d; return; - case 0x0c: - case 0x1c: - case 0x0d: - case 0x1d: - case 0x0e: - case 0x1e: ssp->RAM1[ssp->r1[t&3]++] = d; return; - case 0x0f: ssp->RAM1[1] = d; return; - // mod=2 (10), "-" - case 0x10: - case 0x11: - case 0x12: ssp->RAM0[ssp->r0[t&3]--] = d; return; - case 0x13: ssp->RAM0[2] = d; return; - case 0x14: - case 0x15: - case 0x16: ssp->RAM1[ssp->r1[t&3]--] = d; return; - case 0x17: ssp->RAM1[2] = d; return; - // mod=3 (11) - case 0x1b: ssp->RAM0[3] = d; return; - case 0x1f: ssp->RAM1[3] = d; return; - } + int t = (op&3) | ((op>>6)&4) | ((op<<1)&0x18); + switch (t) + { + // mod=0 (00) + case 0x00: + case 0x01: + case 0x02: ssp->RAM0[ssp->r0[t&3]] = d; return; + case 0x03: ssp->RAM0[0] = d; return; + case 0x04: + case 0x05: + case 0x06: ssp->RAM1[ssp->r1[t&3]] = d; return; + case 0x07: ssp->RAM1[0] = d; return; + // mod=1 (01), "+!" + // mod=3, "+" + case 0x08: + case 0x18: + case 0x09: + case 0x19: + case 0x0a: + case 0x1a: ssp->RAM0[ssp->r0[t&3]++] = d; return; + case 0x0b: ssp->RAM0[1] = d; return; + case 0x0c: + case 0x1c: + case 0x0d: + case 0x1d: + case 0x0e: + case 0x1e: ssp->RAM1[ssp->r1[t&3]++] = d; return; + case 0x0f: ssp->RAM1[1] = d; return; + // mod=2 (10), "-" + case 0x10: + case 0x11: + case 0x12: ssp->RAM0[ssp->r0[t&3]--] = d; return; + case 0x13: ssp->RAM0[2] = d; return; + case 0x14: + case 0x15: + case 0x16: ssp->RAM1[ssp->r1[t&3]--] = d; return; + case 0x17: ssp->RAM1[2] = d; return; + // mod=3 (11) + case 0x1b: ssp->RAM0[3] = d; return; + case 0x1f: ssp->RAM1[3] = d; return; + } } static u32 ptr2_read(int op) { - int mv = 0, t = (op&3) | ((op>>6)&4) | ((op<<1)&0x18); - switch (t) - { - // mod=0 (00) - case 0x00: - case 0x01: - case 0x02: mv = ssp->RAM0[ssp->r0[t&3]]++; break; - case 0x03: mv = ssp->RAM0[0]++; break; - case 0x04: - case 0x05: - case 0x06: mv = ssp->RAM1[ssp->r1[t&3]]++; break; - case 0x07: mv = ssp->RAM1[0]++; break; - // mod=1 (01) - case 0x0b: mv = ssp->RAM0[1]++; break; - case 0x0f: mv = ssp->RAM1[1]++; break; - // mod=2 (10) - case 0x13: mv = ssp->RAM0[2]++; break; - case 0x17: mv = ssp->RAM1[2]++; break; - // mod=3 (11) - case 0x1b: mv = ssp->RAM0[3]++; break; - case 0x1f: mv = ssp->RAM1[3]++; break; - default: elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: invalid mod in ((rX))? @ %04x", GET_PPC_OFFS()); - return 0; - } + int mv = 0, t = (op&3) | ((op>>6)&4) | ((op<<1)&0x18); + switch (t) + { + // mod=0 (00) + case 0x00: + case 0x01: + case 0x02: mv = ssp->RAM0[ssp->r0[t&3]]++; break; + case 0x03: mv = ssp->RAM0[0]++; break; + case 0x04: + case 0x05: + case 0x06: mv = ssp->RAM1[ssp->r1[t&3]]++; break; + case 0x07: mv = ssp->RAM1[0]++; break; + // mod=1 (01) + case 0x0b: mv = ssp->RAM0[1]++; break; + case 0x0f: mv = ssp->RAM1[1]++; break; + // mod=2 (10) + case 0x13: mv = ssp->RAM0[2]++; break; + case 0x17: mv = ssp->RAM1[2]++; break; + // mod=3 (11) + case 0x1b: mv = ssp->RAM0[3]++; break; + case 0x1f: mv = ssp->RAM1[3]++; break; + default: elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: invalid mod in ((rX))? @ %04x", GET_PPC_OFFS()); + return 0; + } - return ((unsigned short *)svp->iram_rom)[mv]; + return ((unsigned short *)svp->iram_rom)[mv]; } @@ -973,358 +973,358 @@ static u32 ptr2_read(int op) void ssp1601_reset(ssp1601_t *l_ssp) { - ssp = l_ssp; - ssp->emu_status = 0; - ssp->gr[SSP_GR0].v = 0xffff0000; - rPC = 0x400; - rSTACK = 0; // ? using ascending stack - rST = 0; + ssp = l_ssp; + ssp->emu_status = 0; + ssp->gr[SSP_GR0].v = 0xffff0000; + rPC = 0x400; + rSTACK = 0; // ? using ascending stack + rST = 0; } #ifdef USE_DEBUGGER static void debug_dump(void) { - printf("GR0: %04x X: %04x Y: %04x A: %08x\n", ssp->gr[SSP_GR0].h, rX, rY, ssp->gr[SSP_A].v); - printf("PC: %04x (%04x) P: %08x\n", GET_PC(), GET_PC() << 1, ssp->gr[SSP_P].v); - printf("PM0: %04x PM1: %04x PM2: %04x\n", rPM0, rPM1, rPM2); - printf("XST: %04x PM4: %04x PMC: %08x\n", rXST, rPM4, ssp->gr[SSP_PMC].v); - printf(" ST: %04x %c%c%c%c, GP0_0 %i, GP0_1 %i\n", rST, rST&SSP_FLAG_N?'N':'n', rST&SSP_FLAG_V?'V':'v', - rST&SSP_FLAG_Z?'Z':'z', rST&SSP_FLAG_L?'L':'l', (rST>>5)&1, (rST>>6)&1); - printf("STACK: %i %04x %04x %04x %04x %04x %04x\n", rSTACK, ssp->stack[0], ssp->stack[1], - ssp->stack[2], ssp->stack[3], ssp->stack[4], ssp->stack[5]); - printf("r0-r2: %02x %02x %02x r4-r6: %02x %02x %02x\n", rIJ[0], rIJ[1], rIJ[2], rIJ[4], rIJ[5], rIJ[6]); - elprintf(EL_SVP, "cycles: %i, emu_status: %x", g_cycles, ssp->emu_status); + printf("GR0: %04x X: %04x Y: %04x A: %08x\n", ssp->gr[SSP_GR0].h, rX, rY, ssp->gr[SSP_A].v); + printf("PC: %04x (%04x) P: %08x\n", GET_PC(), GET_PC() << 1, ssp->gr[SSP_P].v); + printf("PM0: %04x PM1: %04x PM2: %04x\n", rPM0, rPM1, rPM2); + printf("XST: %04x PM4: %04x PMC: %08x\n", rXST, rPM4, ssp->gr[SSP_PMC].v); + printf(" ST: %04x %c%c%c%c, GP0_0 %i, GP0_1 %i\n", rST, rST&SSP_FLAG_N?'N':'n', rST&SSP_FLAG_V?'V':'v', + rST&SSP_FLAG_Z?'Z':'z', rST&SSP_FLAG_L?'L':'l', (rST>>5)&1, (rST>>6)&1); + printf("STACK: %i %04x %04x %04x %04x %04x %04x\n", rSTACK, ssp->stack[0], ssp->stack[1], + ssp->stack[2], ssp->stack[3], ssp->stack[4], ssp->stack[5]); + printf("r0-r2: %02x %02x %02x r4-r6: %02x %02x %02x\n", rIJ[0], rIJ[1], rIJ[2], rIJ[4], rIJ[5], rIJ[6]); + elprintf(EL_SVP, "cycles: %i, emu_status: %x", g_cycles, ssp->emu_status); } static void debug_dump_mem(void) { - int h, i; - printf("RAM0\n"); - for (h = 0; h < 32; h++) - { - if (h == 16) printf("RAM1\n"); - printf("%03x:", h*16); - for (i = 0; i < 16; i++) - printf(" %04x", ssp->RAM[h*16+i]); - printf("\n"); - } + int h, i; + printf("RAM0\n"); + for (h = 0; h < 32; h++) + { + if (h == 16) printf("RAM1\n"); + printf("%03x:", h*16); + for (i = 0; i < 16; i++) + printf(" %04x", ssp->RAM[h*16+i]); + printf("\n"); + } } static void debug_dump2file(const char *fname, void *mem, int len) { - FILE *f = fopen(fname, "wb"); - unsigned short *p = mem; - int i; - if (f) { - for (i = 0; i < len/2; i++) p[i] = (p[i]<<8) | (p[i]>>8); - fwrite(mem, 1, len, f); - fclose(f); - for (i = 0; i < len/2; i++) p[i] = (p[i]<<8) | (p[i]>>8); - printf("dumped to %s\n", fname); - } - else - printf("dump failed\n"); + FILE *f = fopen(fname, "wb"); + unsigned short *p = mem; + int i; + if (f) { + for (i = 0; i < len/2; i++) p[i] = (p[i]<<8) | (p[i]>>8); + fwrite(mem, 1, len, f); + fclose(f); + for (i = 0; i < len/2; i++) p[i] = (p[i]<<8) | (p[i]>>8); + printf("dumped to %s\n", fname); + } + else + printf("dump failed\n"); } static int bpts[10] = { 0, }; static void debug(unsigned int pc, unsigned int op) { - static char buffo[64] = {0,}; - char buff[64] = {0,}; - int i; + static char buffo[64] = {0,}; + char buff[64] = {0,}; + int i; - if (running) { - for (i = 0; i < 10; i++) - if (pc != 0 && bpts[i] == pc) { - printf("breakpoint %i\n", i); - running = 0; - break; - } - } - if (running) return; + if (running) { + for (i = 0; i < 10; i++) + if (pc != 0 && bpts[i] == pc) { + printf("breakpoint %i\n", i); + running = 0; + break; + } + } + if (running) return; - printf("%04x (%02x) @ %04x\n", op, op >> 9, pc<<1); + printf("%04x (%02x) @ %04x\n", op, op >> 9, pc<<1); - while (1) - { - printf("dbg> "); - fflush(stdout); - fgets(buff, sizeof(buff), stdin); - if (buff[0] == '\n') strcpy(buff, buffo); - else strcpy(buffo, buff); + while (1) + { + printf("dbg> "); + fflush(stdout); + fgets(buff, sizeof(buff), stdin); + if (buff[0] == '\n') strcpy(buff, buffo); + else strcpy(buffo, buff); - switch (buff[0]) { - case 0: exit(0); - case 'c': - case 'r': running = 1; return; - case 's': - case 'n': return; - case 'x': debug_dump(); break; - case 'm': debug_dump_mem(); break; - case 'b': { - char *baddr = buff + 2; - i = 0; - if (buff[3] == ' ') { i = buff[2] - '0'; baddr = buff + 4; } - bpts[i] = strtol(baddr, NULL, 16) >> 1; - printf("breakpoint %i set @ %04x\n", i, bpts[i]<<1); - break; - } - case 'd': - sprintf(buff, "iramrom_%04x.bin", last_iram); - debug_dump2file(buff, svp->iram_rom, sizeof(svp->iram_rom)); - debug_dump2file("dram.bin", svp->dram, sizeof(svp->dram)); - break; - default: printf("unknown command\n"); break; - } - } + switch (buff[0]) { + case 0: exit(0); + case 'c': + case 'r': running = 1; return; + case 's': + case 'n': return; + case 'x': debug_dump(); break; + case 'm': debug_dump_mem(); break; + case 'b': { + char *baddr = buff + 2; + i = 0; + if (buff[3] == ' ') { i = buff[2] - '0'; baddr = buff + 4; } + bpts[i] = strtol(baddr, NULL, 16) >> 1; + printf("breakpoint %i set @ %04x\n", i, bpts[i]<<1); + break; + } + case 'd': + sprintf(buff, "iramrom_%04x.bin", last_iram); + debug_dump2file(buff, svp->iram_rom, sizeof(svp->iram_rom)); + debug_dump2file("dram.bin", svp->dram, sizeof(svp->dram)); + break; + default: printf("unknown command\n"); break; + } + } } #endif // USE_DEBUGGER void ssp1601_run(int cycles) { - SET_PC(rPC); - g_cycles = cycles; + SET_PC(rPC); + g_cycles = cycles; - while (g_cycles > 0 && !(ssp->emu_status & SSP_WAIT_MASK)) - { - int op; - u32 tmpv; + while (g_cycles > 0 && !(ssp->emu_status & SSP_WAIT_MASK)) + { + int op; + u32 tmpv; - op = *PC++; + op = *PC++; #ifdef USE_DEBUGGER - debug(GET_PC()-1, op); + debug(GET_PC()-1, op); #endif - switch (op >> 9) - { - // ld d, s - case 0x00: - if (op == 0) break; // nop - if (op == ((SSP_A<<4)|SSP_P)) { // A <- P - // not sure. MAME claims that only hi word is transfered. - read_P(); // update P - rA32 = rP.v; - } - else - { - tmpv = REG_READ(op & 0x0f); - REG_WRITE((op & 0xf0) >> 4, tmpv); - } - break; + switch (op >> 9) + { + // ld d, s + case 0x00: + if (op == 0) break; // nop + if (op == ((SSP_A<<4)|SSP_P)) { // A <- P + // not sure. MAME claims that only hi word is transfered. + read_P(); // update P + rA32 = rP.v; + } + else + { + tmpv = REG_READ(op & 0x0f); + REG_WRITE((op & 0xf0) >> 4, tmpv); + } + break; - // ld d, (ri) - case 0x01: tmpv = ptr1_read(op); REG_WRITE((op & 0xf0) >> 4, tmpv); break; + // ld d, (ri) + case 0x01: tmpv = ptr1_read(op); REG_WRITE((op & 0xf0) >> 4, tmpv); break; - // ld (ri), s - case 0x02: tmpv = REG_READ((op & 0xf0) >> 4); ptr1_write(op, tmpv); break; + // ld (ri), s + case 0x02: tmpv = REG_READ((op & 0xf0) >> 4); ptr1_write(op, tmpv); break; - // ldi d, imm - case 0x04: tmpv = *PC++; REG_WRITE((op & 0xf0) >> 4, tmpv); break; + // ldi d, imm + case 0x04: tmpv = *PC++; REG_WRITE((op & 0xf0) >> 4, tmpv); break; - // ld d, ((ri)) - case 0x05: tmpv = ptr2_read(op); REG_WRITE((op & 0xf0) >> 4, tmpv); break; + // ld d, ((ri)) + case 0x05: tmpv = ptr2_read(op); REG_WRITE((op & 0xf0) >> 4, tmpv); break; - // ldi (ri), imm - case 0x06: tmpv = *PC++; ptr1_write(op, tmpv); break; + // ldi (ri), imm + case 0x06: tmpv = *PC++; ptr1_write(op, tmpv); break; - // ld adr, a - case 0x07: ssp->RAM[op & 0x1ff] = rA; break; + // ld adr, a + case 0x07: ssp->RAM[op & 0x1ff] = rA; break; - // ld d, ri - case 0x09: tmpv = rIJ[(op&3)|((op>>6)&4)]; REG_WRITE((op & 0xf0) >> 4, tmpv); break; + // ld d, ri + case 0x09: tmpv = rIJ[(op&3)|((op>>6)&4)]; REG_WRITE((op & 0xf0) >> 4, tmpv); break; - // ld ri, s - case 0x0a: rIJ[(op&3)|((op>>6)&4)] = REG_READ((op & 0xf0) >> 4); break; + // ld ri, s + case 0x0a: rIJ[(op&3)|((op>>6)&4)] = REG_READ((op & 0xf0) >> 4); break; - // ldi ri, simm - case 0x0c: - case 0x0d: - case 0x0e: - case 0x0f: rIJ[(op>>8)&7] = op; break; + // ldi ri, simm + case 0x0c: + case 0x0d: + case 0x0e: + case 0x0f: rIJ[(op>>8)&7] = op; break; - // call cond, addr - case 0x24: { - int cond = 0; - COND_CHECK - if (cond) { int new_PC = *PC++; write_STACK(GET_PC()); write_PC(new_PC); } - else PC++; - break; - } + // call cond, addr + case 0x24: { + int cond = 0; + COND_CHECK + if (cond) { int new_PC = *PC++; write_STACK(GET_PC()); write_PC(new_PC); } + else PC++; + break; + } - // ld d, (a) - case 0x25: tmpv = ((unsigned short *)svp->iram_rom)[rA]; REG_WRITE((op & 0xf0) >> 4, tmpv); break; + // ld d, (a) + case 0x25: tmpv = ((unsigned short *)svp->iram_rom)[rA]; REG_WRITE((op & 0xf0) >> 4, tmpv); break; - // bra cond, addr - case 0x26: { - int cond = 0; - COND_CHECK - if (cond) { int new_PC = *PC++; write_PC(new_PC); } - else PC++; - break; - } + // bra cond, addr + case 0x26: { + int cond = 0; + COND_CHECK + if (cond) { int new_PC = *PC++; write_PC(new_PC); } + else PC++; + break; + } - // mod cond, op - case 0x48: { - int cond = 0; - COND_CHECK - if (cond) { - switch (op & 7) { - case 2: rA32 = (signed int)rA32 >> 1; break; // shr (arithmetic) - case 3: rA32 <<= 1; break; // shl - case 6: rA32 = -(signed int)rA32; break; // neg - case 7: if ((int)rA32 < 0) rA32 = -(signed int)rA32; break; // abs - default: + // mod cond, op + case 0x48: { + int cond = 0; + COND_CHECK + if (cond) { + switch (op & 7) { + case 2: rA32 = (signed int)rA32 >> 1; break; // shr (arithmetic) + case 3: rA32 <<= 1; break; // shl + case 6: rA32 = -(signed int)rA32; break; // neg + case 7: if ((int)rA32 < 0) rA32 = -(signed int)rA32; break; // abs + default: #ifdef LOG_SVP - elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: unhandled mod %i @ %04x", - op&7, GET_PPC_OFFS()); + elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: unhandled mod %i @ %04x", + op&7, GET_PPC_OFFS()); #endif - break; - } - UPD_ACC_ZN // ? - } - break; - } + break; + } + UPD_ACC_ZN // ? + } + break; + } - // mpys? - case 0x1b: + // mpys? + case 0x1b: #ifdef LOG_SVP - if (!(op&0x100)) elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: no b bit @ %04x", GET_PPC_OFFS()); + if (!(op&0x100)) elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: no b bit @ %04x", GET_PPC_OFFS()); #endif - read_P(); // update P - rA32 -= rP.v; // maybe only upper word? - UPD_ACC_ZN // there checking flags after this - rX = ptr1_read_(op&3, 0, (op<<1)&0x18); // ri (maybe rj?) - rY = ptr1_read_((op>>4)&3, 4, (op>>3)&0x18); // rj - break; + read_P(); // update P + rA32 -= rP.v; // maybe only upper word? + UPD_ACC_ZN // there checking flags after this + rX = ptr1_read_(op&3, 0, (op<<1)&0x18); // ri (maybe rj?) + rY = ptr1_read_((op>>4)&3, 4, (op>>3)&0x18); // rj + break; - // mpya (rj), (ri), b - case 0x4b: + // mpya (rj), (ri), b + case 0x4b: #ifdef LOG_SVP - if (!(op&0x100)) elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: no b bit @ %04x", GET_PPC_OFFS()); + if (!(op&0x100)) elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: no b bit @ %04x", GET_PPC_OFFS()); #endif - read_P(); // update P - rA32 += rP.v; // confirmed to be 32bit - UPD_ACC_ZN // ? - rX = ptr1_read_(op&3, 0, (op<<1)&0x18); // ri (maybe rj?) - rY = ptr1_read_((op>>4)&3, 4, (op>>3)&0x18); // rj - break; + read_P(); // update P + rA32 += rP.v; // confirmed to be 32bit + UPD_ACC_ZN // ? + rX = ptr1_read_(op&3, 0, (op<<1)&0x18); // ri (maybe rj?) + rY = ptr1_read_((op>>4)&3, 4, (op>>3)&0x18); // rj + break; - // mld (rj), (ri), b - case 0x5b: + // mld (rj), (ri), b + case 0x5b: #ifdef LOG_SVP - if (!(op&0x100)) elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: no b bit @ %04x", GET_PPC_OFFS()); + if (!(op&0x100)) elprintf(EL_SVP|EL_ANOMALY, "ssp FIXME: no b bit @ %04x", GET_PPC_OFFS()); #endif - rA32 = 0; - rST &= 0x0fff; // ? - rX = ptr1_read_(op&3, 0, (op<<1)&0x18); // ri (maybe rj?) - rY = ptr1_read_((op>>4)&3, 4, (op>>3)&0x18); // rj - break; + rA32 = 0; + rST &= 0x0fff; // ? + rX = ptr1_read_(op&3, 0, (op<<1)&0x18); // ri (maybe rj?) + rY = ptr1_read_((op>>4)&3, 4, (op>>3)&0x18); // rj + break; - // OP a, s - case 0x10: OP_CHECK32(OP_SUBA32); tmpv = REG_READ(op & 0x0f); OP_SUBA(tmpv); break; - case 0x30: OP_CHECK32(OP_CMPA32); tmpv = REG_READ(op & 0x0f); OP_CMPA(tmpv); break; - case 0x40: OP_CHECK32(OP_ADDA32); tmpv = REG_READ(op & 0x0f); OP_ADDA(tmpv); break; - case 0x50: OP_CHECK32(OP_ANDA32); tmpv = REG_READ(op & 0x0f); OP_ANDA(tmpv); break; - case 0x60: OP_CHECK32(OP_ORA32 ); tmpv = REG_READ(op & 0x0f); OP_ORA (tmpv); break; - case 0x70: OP_CHECK32(OP_EORA32); tmpv = REG_READ(op & 0x0f); OP_EORA(tmpv); break; + // OP a, s + case 0x10: OP_CHECK32(OP_SUBA32); tmpv = REG_READ(op & 0x0f); OP_SUBA(tmpv); break; + case 0x30: OP_CHECK32(OP_CMPA32); tmpv = REG_READ(op & 0x0f); OP_CMPA(tmpv); break; + case 0x40: OP_CHECK32(OP_ADDA32); tmpv = REG_READ(op & 0x0f); OP_ADDA(tmpv); break; + case 0x50: OP_CHECK32(OP_ANDA32); tmpv = REG_READ(op & 0x0f); OP_ANDA(tmpv); break; + case 0x60: OP_CHECK32(OP_ORA32 ); tmpv = REG_READ(op & 0x0f); OP_ORA (tmpv); break; + case 0x70: OP_CHECK32(OP_EORA32); tmpv = REG_READ(op & 0x0f); OP_EORA(tmpv); break; - // OP a, (ri) - case 0x11: tmpv = ptr1_read(op); OP_SUBA(tmpv); break; - case 0x31: tmpv = ptr1_read(op); OP_CMPA(tmpv); break; - case 0x41: tmpv = ptr1_read(op); OP_ADDA(tmpv); break; - case 0x51: tmpv = ptr1_read(op); OP_ANDA(tmpv); break; - case 0x61: tmpv = ptr1_read(op); OP_ORA (tmpv); break; - case 0x71: tmpv = ptr1_read(op); OP_EORA(tmpv); break; + // OP a, (ri) + case 0x11: tmpv = ptr1_read(op); OP_SUBA(tmpv); break; + case 0x31: tmpv = ptr1_read(op); OP_CMPA(tmpv); break; + case 0x41: tmpv = ptr1_read(op); OP_ADDA(tmpv); break; + case 0x51: tmpv = ptr1_read(op); OP_ANDA(tmpv); break; + case 0x61: tmpv = ptr1_read(op); OP_ORA (tmpv); break; + case 0x71: tmpv = ptr1_read(op); OP_EORA(tmpv); break; - // OP a, adr - case 0x03: tmpv = ssp->RAM[op & 0x1ff]; OP_LDA (tmpv); break; - case 0x13: tmpv = ssp->RAM[op & 0x1ff]; OP_SUBA(tmpv); break; - case 0x33: tmpv = ssp->RAM[op & 0x1ff]; OP_CMPA(tmpv); break; - case 0x43: tmpv = ssp->RAM[op & 0x1ff]; OP_ADDA(tmpv); break; - case 0x53: tmpv = ssp->RAM[op & 0x1ff]; OP_ANDA(tmpv); break; - case 0x63: tmpv = ssp->RAM[op & 0x1ff]; OP_ORA (tmpv); break; - case 0x73: tmpv = ssp->RAM[op & 0x1ff]; OP_EORA(tmpv); break; + // OP a, adr + case 0x03: tmpv = ssp->RAM[op & 0x1ff]; OP_LDA (tmpv); break; + case 0x13: tmpv = ssp->RAM[op & 0x1ff]; OP_SUBA(tmpv); break; + case 0x33: tmpv = ssp->RAM[op & 0x1ff]; OP_CMPA(tmpv); break; + case 0x43: tmpv = ssp->RAM[op & 0x1ff]; OP_ADDA(tmpv); break; + case 0x53: tmpv = ssp->RAM[op & 0x1ff]; OP_ANDA(tmpv); break; + case 0x63: tmpv = ssp->RAM[op & 0x1ff]; OP_ORA (tmpv); break; + case 0x73: tmpv = ssp->RAM[op & 0x1ff]; OP_EORA(tmpv); break; - // OP a, imm - case 0x14: tmpv = *PC++; OP_SUBA(tmpv); break; - case 0x34: tmpv = *PC++; OP_CMPA(tmpv); break; - case 0x44: tmpv = *PC++; OP_ADDA(tmpv); break; - case 0x54: tmpv = *PC++; OP_ANDA(tmpv); break; - case 0x64: tmpv = *PC++; OP_ORA (tmpv); break; - case 0x74: tmpv = *PC++; OP_EORA(tmpv); break; + // OP a, imm + case 0x14: tmpv = *PC++; OP_SUBA(tmpv); break; + case 0x34: tmpv = *PC++; OP_CMPA(tmpv); break; + case 0x44: tmpv = *PC++; OP_ADDA(tmpv); break; + case 0x54: tmpv = *PC++; OP_ANDA(tmpv); break; + case 0x64: tmpv = *PC++; OP_ORA (tmpv); break; + case 0x74: tmpv = *PC++; OP_EORA(tmpv); break; - // OP a, ((ri)) - case 0x15: tmpv = ptr2_read(op); OP_SUBA(tmpv); break; - case 0x35: tmpv = ptr2_read(op); OP_CMPA(tmpv); break; - case 0x45: tmpv = ptr2_read(op); OP_ADDA(tmpv); break; - case 0x55: tmpv = ptr2_read(op); OP_ANDA(tmpv); break; - case 0x65: tmpv = ptr2_read(op); OP_ORA (tmpv); break; - case 0x75: tmpv = ptr2_read(op); OP_EORA(tmpv); break; + // OP a, ((ri)) + case 0x15: tmpv = ptr2_read(op); OP_SUBA(tmpv); break; + case 0x35: tmpv = ptr2_read(op); OP_CMPA(tmpv); break; + case 0x45: tmpv = ptr2_read(op); OP_ADDA(tmpv); break; + case 0x55: tmpv = ptr2_read(op); OP_ANDA(tmpv); break; + case 0x65: tmpv = ptr2_read(op); OP_ORA (tmpv); break; + case 0x75: tmpv = ptr2_read(op); OP_EORA(tmpv); break; - // OP a, ri - case 0x19: tmpv = rIJ[IJind]; OP_SUBA(tmpv); break; - case 0x39: tmpv = rIJ[IJind]; OP_CMPA(tmpv); break; - case 0x49: tmpv = rIJ[IJind]; OP_ADDA(tmpv); break; - case 0x59: tmpv = rIJ[IJind]; OP_ANDA(tmpv); break; - case 0x69: tmpv = rIJ[IJind]; OP_ORA (tmpv); break; - case 0x79: tmpv = rIJ[IJind]; OP_EORA(tmpv); break; + // OP a, ri + case 0x19: tmpv = rIJ[IJind]; OP_SUBA(tmpv); break; + case 0x39: tmpv = rIJ[IJind]; OP_CMPA(tmpv); break; + case 0x49: tmpv = rIJ[IJind]; OP_ADDA(tmpv); break; + case 0x59: tmpv = rIJ[IJind]; OP_ANDA(tmpv); break; + case 0x69: tmpv = rIJ[IJind]; OP_ORA (tmpv); break; + case 0x79: tmpv = rIJ[IJind]; OP_EORA(tmpv); break; - // OP simm - case 0x1c: - OP_SUBA(op & 0xff); + // OP simm + case 0x1c: + OP_SUBA(op & 0xff); #ifdef LOG_SVP - if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); + if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); #endif - break; - case 0x3c: - OP_CMPA(op & 0xff); + break; + case 0x3c: + OP_CMPA(op & 0xff); #ifdef LOG_SVP - if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); + if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); #endif - break; - case 0x4c: - OP_ADDA(op & 0xff); + break; + case 0x4c: + OP_ADDA(op & 0xff); #ifdef LOG_SVP - if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); + if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); #endif - break; - // MAME code only does LSB of top word, but this looks wrong to me. - case 0x5c: - OP_ANDA(op & 0xff); + break; + // MAME code only does LSB of top word, but this looks wrong to me. + case 0x5c: + OP_ANDA(op & 0xff); #ifdef LOG_SVP - if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); + if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); #endif - break; - case 0x6c: - OP_ORA (op & 0xff); + break; + case 0x6c: + OP_ORA (op & 0xff); #ifdef LOG_SVP - if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); + if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); #endif - break; - case 0x7c: - OP_EORA(op & 0xff); + break; + case 0x7c: + OP_EORA(op & 0xff); #ifdef LOG_SVP - if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); + if (op&0x100) elprintf(EL_SVP|EL_ANOMALY, "FIXME: simm with upper bit set"); #endif - break; + break; - default: + default: #ifdef LOG_SVP - elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME unhandled op %04x @ %04x", op, GET_PPC_OFFS()); + elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME unhandled op %04x @ %04x", op, GET_PPC_OFFS()); #endif - break; - } - g_cycles--; - } + break; + } + g_cycles--; + } - read_P(); // update P - rPC = GET_PC(); + read_P(); // update P + rPC = GET_PC(); #ifdef LOG_SVP - if (ssp->gr[SSP_GR0].v != 0xffff0000) - elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: REG 0 corruption! %08x", ssp->gr[SSP_GR0].v); + if (ssp->gr[SSP_GR0].v != 0xffff0000) + elprintf(EL_ANOMALY|EL_SVP, "ssp FIXME: REG 0 corruption! %08x", ssp->gr[SSP_GR0].v); #endif } diff --git a/source/cart_hw/svp/ssp16.h b/source/cart_hw/svp/ssp16.h index 5c201cc..16513db 100644 --- a/source/cart_hw/svp/ssp16.h +++ b/source/cart_hw/svp/ssp16.h @@ -23,56 +23,56 @@ /* register names */ enum { - SSP_GR0, SSP_X, SSP_Y, SSP_A, - SSP_ST, SSP_STACK, SSP_PC, SSP_P, - SSP_PM0, SSP_PM1, SSP_PM2, SSP_XST, - SSP_PM4, SSP_gr13, SSP_PMC, SSP_AL + SSP_GR0, SSP_X, SSP_Y, SSP_A, + SSP_ST, SSP_STACK, SSP_PC, SSP_P, + SSP_PM0, SSP_PM1, SSP_PM2, SSP_XST, + SSP_PM4, SSP_gr13, SSP_PMC, SSP_AL }; typedef union { - unsigned int v; - struct { + unsigned int v; + struct { #ifdef LSB_FIRST - unsigned short l; - unsigned short h; + unsigned short l; + unsigned short h; #else - unsigned short h; - unsigned short l; + unsigned short h; + unsigned short l; #endif - }; + }; } ssp_reg_t; typedef struct { - union { - unsigned short RAM[256*2]; // 2 internal RAM banks - struct { - unsigned short RAM0[256]; - unsigned short RAM1[256]; - }; - }; - ssp_reg_t gr[16]; // general registers - union { - unsigned char r[8]; // BANK pointers - struct { - unsigned char r0[4]; - unsigned char r1[4]; - }; - }; - unsigned short stack[6]; - unsigned int pmac_read[6]; // read modes/addrs for PM0-PM5 - unsigned int pmac_write[6]; // write ... - // - #define SSP_PMC_HAVE_ADDR 0x0001 // address written to PMAC, waiting for mode - #define SSP_PMC_SET 0x0002 // PMAC is set - #define SSP_HANG 0x1000 // 68000 hangs SVP - #define SSP_WAIT_PM0 0x2000 // bit1 in PM0 - #define SSP_WAIT_30FE06 0x4000 // ssp tight loops on 30FE08 to become non-zero - #define SSP_WAIT_30FE08 0x8000 // same for 30FE06 - #define SSP_WAIT_MASK 0xf000 - unsigned int emu_status; - unsigned int pad[30]; + union { + unsigned short RAM[256*2]; // 2 internal RAM banks + struct { + unsigned short RAM0[256]; + unsigned short RAM1[256]; + }; + }; + ssp_reg_t gr[16]; // general registers + union { + unsigned char r[8]; // BANK pointers + struct { + unsigned char r0[4]; + unsigned char r1[4]; + }; + }; + unsigned short stack[6]; + unsigned int pmac_read[6]; // read modes/addrs for PM0-PM5 + unsigned int pmac_write[6]; // write ... + + #define SSP_PMC_HAVE_ADDR 0x0001 // address written to PMAC, waiting for mode + #define SSP_PMC_SET 0x0002 // PMAC is set + #define SSP_HANG 0x1000 // 68000 hangs SVP + #define SSP_WAIT_PM0 0x2000 // bit1 in PM0 + #define SSP_WAIT_30FE06 0x4000 // ssp tight loops on 30FE08 to become non-zero + #define SSP_WAIT_30FE08 0x8000 // same for 30FE06 + #define SSP_WAIT_MASK 0xf000 + unsigned int emu_status; + unsigned int pad[30]; } ssp1601_t; diff --git a/source/cart_hw/svp/svp.c b/source/cart_hw/svp/svp.c index 4e9f19c..3c05f69 100644 --- a/source/cart_hw/svp/svp.c +++ b/source/cart_hw/svp/svp.c @@ -15,14 +15,14 @@ uint16 SVP_cycles = 850; void svp_init(void) { - svp = (void *) ((char *)cart_rom + 0x200000); - memset(svp, 0, sizeof(*svp)); + svp = (void *) ((char *)cart_rom + 0x200000); + memset(svp, 0, sizeof(*svp)); } void svp_reset(void) { - memcpy(svp->iram_rom + 0x800, cart_rom + 0x800, 0x20000 - 0x800); - ssp1601_reset(&svp->ssp1601); + memcpy(svp->iram_rom + 0x800, cart_rom + 0x800, 0x20000 - 0x800); + ssp1601_reset(&svp->ssp1601); } void svp_write_dram(uint32 address, uint32 data) diff --git a/source/cart_hw/svp/svp.h b/source/cart_hw/svp/svp.h index af02d17..ac0fea7 100644 --- a/source/cart_hw/svp/svp.h +++ b/source/cart_hw/svp/svp.h @@ -16,9 +16,9 @@ #include "ssp16.h" typedef struct { - unsigned char iram_rom[0x20000]; // IRAM (0-0x7ff) and program ROM (0x800-0x1ffff) - unsigned char dram[0x20000]; - ssp1601_t ssp1601; + unsigned char iram_rom[0x20000]; // IRAM (0-0x7ff) and program ROM (0x800-0x1ffff) + unsigned char dram[0x20000]; + ssp1601_t ssp1601; } svp_t; extern svp_t *svp; diff --git a/source/gen_input.c b/source/gen_input.c index 633cf21..73c207b 100644 --- a/source/gen_input.c +++ b/source/gen_input.c @@ -31,33 +31,33 @@ t_input input; *****************************************************************************/ /* H counter values for a 256-pixel wide display (342 pixel max.) */ uint8 hc_256[171] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, - 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, - 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF }; /* H counter values for a 320-pixel wide display (442 pixels max.) */ uint8 hc_320[210] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, - 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, @@ -77,7 +77,7 @@ static inline void lightgun_update(int num) /* HL enabled ? */ if (io_reg[5] & 0x80) { - /* External Interrupt ? */ + /* External Interrupt ? */ if (reg[11] & 0x08) {irq_status &= 0xff; irq_status |= 0x12;} /* HVC Latch: @@ -86,11 +86,8 @@ static inline void lightgun_update(int num) H-Counter range is approx. 292 pixel clocks */ hc_latch = 0x100; - if (reg[12] & 1) - hc_latch |= hc_320[((input.analog[num][0] * 290) / (2 * 320) + input.x_offset) % 210]; - else - hc_latch |= hc_256[(input.analog[num][0] / 2 + input.x_offset)%171]; - + if (reg[12] & 1) hc_latch |= hc_320[((input.analog[num][0] * 290) / (2 * 320) + input.x_offset) % 210]; + else hc_latch |= hc_256[(input.analog[num][0] / 2 + input.x_offset)%171]; } } } diff --git a/source/m68k/m68k.h b/source/m68k/m68k.h index 7e74480..87aa6eb 100644 --- a/source/m68k/m68k.h +++ b/source/m68k/m68k.h @@ -69,59 +69,59 @@ /* CPU types for use in m68k_set_cpu_type() */ enum { - M68K_CPU_TYPE_INVALID, - M68K_CPU_TYPE_68000, - M68K_CPU_TYPE_68008, - M68K_CPU_TYPE_68010, - M68K_CPU_TYPE_68EC020, - M68K_CPU_TYPE_68020, - M68K_CPU_TYPE_68030, /* Supported by disassembler ONLY */ - M68K_CPU_TYPE_68040 /* Supported by disassembler ONLY */ + M68K_CPU_TYPE_INVALID, + M68K_CPU_TYPE_68000, + M68K_CPU_TYPE_68008, + M68K_CPU_TYPE_68010, + M68K_CPU_TYPE_68EC020, + M68K_CPU_TYPE_68020, + M68K_CPU_TYPE_68030, /* Supported by disassembler ONLY */ + M68K_CPU_TYPE_68040 /* Supported by disassembler ONLY */ }; /* Registers used by m68k_get_reg() and m68k_set_reg() */ typedef enum { - /* Real registers */ - M68K_REG_D0, /* Data registers */ - M68K_REG_D1, - M68K_REG_D2, - M68K_REG_D3, - M68K_REG_D4, - M68K_REG_D5, - M68K_REG_D6, - M68K_REG_D7, - M68K_REG_A0, /* Address registers */ - M68K_REG_A1, - M68K_REG_A2, - M68K_REG_A3, - M68K_REG_A4, - M68K_REG_A5, - M68K_REG_A6, - M68K_REG_A7, - M68K_REG_PC, /* Program Counter */ - M68K_REG_SR, /* Status Register */ - M68K_REG_SP, /* The current Stack Pointer (located in A7) */ - M68K_REG_USP, /* User Stack Pointer */ - M68K_REG_ISP, /* Interrupt Stack Pointer */ - M68K_REG_MSP, /* Master Stack Pointer */ - M68K_REG_SFC, /* Source Function Code */ - M68K_REG_DFC, /* Destination Function Code */ - M68K_REG_VBR, /* Vector Base Register */ - M68K_REG_CACR, /* Cache Control Register */ - M68K_REG_CAAR, /* Cache Address Register */ + /* Real registers */ + M68K_REG_D0, /* Data registers */ + M68K_REG_D1, + M68K_REG_D2, + M68K_REG_D3, + M68K_REG_D4, + M68K_REG_D5, + M68K_REG_D6, + M68K_REG_D7, + M68K_REG_A0, /* Address registers */ + M68K_REG_A1, + M68K_REG_A2, + M68K_REG_A3, + M68K_REG_A4, + M68K_REG_A5, + M68K_REG_A6, + M68K_REG_A7, + M68K_REG_PC, /* Program Counter */ + M68K_REG_SR, /* Status Register */ + M68K_REG_SP, /* The current Stack Pointer (located in A7) */ + M68K_REG_USP, /* User Stack Pointer */ + M68K_REG_ISP, /* Interrupt Stack Pointer */ + M68K_REG_MSP, /* Master Stack Pointer */ + M68K_REG_SFC, /* Source Function Code */ + M68K_REG_DFC, /* Destination Function Code */ + M68K_REG_VBR, /* Vector Base Register */ + M68K_REG_CACR, /* Cache Control Register */ + M68K_REG_CAAR, /* Cache Address Register */ - /* Assumed registers */ - /* These are cheat registers which emulate the 1-longword prefetch + /* Assumed registers */ + /* These are cheat registers which emulate the 1-longword prefetch * present in the 68000 and 68010. */ - M68K_REG_PREF_ADDR, /* Last prefetch address */ - M68K_REG_PREF_DATA, /* Last prefetch data */ + M68K_REG_PREF_ADDR, /* Last prefetch address */ + M68K_REG_PREF_DATA, /* Last prefetch data */ - /* Convenience registers */ - M68K_REG_PPC, /* Previous value in the program counter */ - M68K_REG_IR, /* Instruction register */ - M68K_REG_CPU_TYPE /* Type of CPU being run */ + /* Convenience registers */ + M68K_REG_PPC, /* Previous value in the program counter */ + M68K_REG_IR, /* Instruction register */ + M68K_REG_CPU_TYPE /* Type of CPU being run */ } m68k_register_t; /* ======================================================================== */ @@ -180,7 +180,7 @@ _m68k_memory_map m68k_memory_map[256]; /* Read data immediately following the PC */ #define m68k_read_immediate_16(address) *(uint16 *)(m68k_memory_map[((address)>>16)&0xff].base + ((address) & 0xffff)) -#define m68k_read_immediate_32(address) (m68k_read_immediate_16(address) << 16) | (m68k_read_immediate_16(address+2)) +#define m68k_read_immediate_32(address) (m68k_read_immediate_16(address) << 16) | (m68k_read_immediate_16(address+2)) /* Read data relative to the PC */ #define m68k_read_pcrelative_8(address) READ_BYTE(m68k_memory_map[((address)>>16)&0xff].base, (address) & 0xffff) diff --git a/source/m68k/m68kcpu.c b/source/m68k/m68kcpu.c index 65224e2..d2101af 100644 --- a/source/m68k/m68kcpu.c +++ b/source/m68k/m68kcpu.c @@ -51,23 +51,23 @@ uint m68ki_address_space; #ifdef M68K_LOG_ENABLE const char *const m68ki_cpu_names[] = { - "Invalid CPU", - "M68000", - "M68008", - "Invalid CPU", - "M68010", - "Invalid CPU", - "Invalid CPU", - "Invalid CPU", - "M68EC020", - "Invalid CPU", - "Invalid CPU", - "Invalid CPU", - "Invalid CPU", - "Invalid CPU", - "Invalid CPU", - "Invalid CPU", - "M68020" + "Invalid CPU", + "M68000", + "M68008", + "Invalid CPU", + "M68010", + "Invalid CPU", + "Invalid CPU", + "Invalid CPU", + "M68EC020", + "Invalid CPU", + "Invalid CPU", + "Invalid CPU", + "Invalid CPU", + "Invalid CPU", + "Invalid CPU", + "Invalid CPU", + "M68020" }; #endif /* M68K_LOG_ENABLE */ @@ -85,37 +85,37 @@ uint m68ki_aerr_fc; /* Used by shift & rotate instructions */ const uint8 m68ki_shift_8_table[65] = { - 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff + 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff }; const uint16 m68ki_shift_16_table[65] = { - 0x0000, 0x8000, 0xc000, 0xe000, 0xf000, 0xf800, 0xfc00, 0xfe00, 0xff00, - 0xff80, 0xffc0, 0xffe0, 0xfff0, 0xfff8, 0xfffc, 0xfffe, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff + 0x0000, 0x8000, 0xc000, 0xe000, 0xf000, 0xf800, 0xfc00, 0xfe00, 0xff00, + 0xff80, 0xffc0, 0xffe0, 0xfff0, 0xfff8, 0xfffc, 0xfffe, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, + 0xffff, 0xffff }; const uint m68ki_shift_32_table[65] = { - 0x00000000, 0x80000000, 0xc0000000, 0xe0000000, 0xf0000000, 0xf8000000, - 0xfc000000, 0xfe000000, 0xff000000, 0xff800000, 0xffc00000, 0xffe00000, - 0xfff00000, 0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000, 0xffff8000, - 0xffffc000, 0xffffe000, 0xfffff000, 0xfffff800, 0xfffffc00, 0xfffffe00, - 0xffffff00, 0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0, 0xfffffff8, - 0xfffffffc, 0xfffffffe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, - 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff + 0x00000000, 0x80000000, 0xc0000000, 0xe0000000, 0xf0000000, 0xf8000000, + 0xfc000000, 0xfe000000, 0xff000000, 0xff800000, 0xffc00000, 0xffe00000, + 0xfff00000, 0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000, 0xffff8000, + 0xffffc000, 0xffffe000, 0xfffff000, 0xfffff800, 0xfffffc00, 0xfffffe00, + 0xffffff00, 0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0, 0xfffffff8, + 0xfffffffc, 0xfffffffe, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, + 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; @@ -124,318 +124,318 @@ const uint m68ki_shift_32_table[65] = */ const uint8 m68ki_exception_cycle_table[4][256] = { - { /* 000 */ - 4, /* 0: Reset - Initial Stack Pointer */ - 4, /* 1: Reset - Initial Program Counter */ - 50, /* 2: Bus Error (unemulated) */ - 50, /* 3: Address Error (unemulated) */ - 34, /* 4: Illegal Instruction */ - 38, /* 5: Divide by Zero -- ASG: changed from 42 */ - 40, /* 6: CHK -- ASG: chanaged from 44 */ - 34, /* 7: TRAPV */ - 34, /* 8: Privilege Violation */ - 34, /* 9: Trace */ - 4, /* 10: 1010 */ - 4, /* 11: 1111 */ - 4, /* 12: RESERVED */ - 4, /* 13: Coprocessor Protocol Violation (unemulated) */ - 4, /* 14: Format Error */ - 44, /* 15: Uninitialized Interrupt */ - 4, /* 16: RESERVED */ - 4, /* 17: RESERVED */ - 4, /* 18: RESERVED */ - 4, /* 19: RESERVED */ - 4, /* 20: RESERVED */ - 4, /* 21: RESERVED */ - 4, /* 22: RESERVED */ - 4, /* 23: RESERVED */ - 44, /* 24: Spurious Interrupt */ - 44, /* 25: Level 1 Interrupt Autovector */ - 44, /* 26: Level 2 Interrupt Autovector */ - 44, /* 27: Level 3 Interrupt Autovector */ - 44, /* 28: Level 4 Interrupt Autovector */ - 44, /* 29: Level 5 Interrupt Autovector */ - 44, /* 30: Level 6 Interrupt Autovector */ - 44, /* 31: Level 7 Interrupt Autovector */ - 34, /* 32: TRAP #0 -- ASG: chanaged from 38 */ - 34, /* 33: TRAP #1 */ - 34, /* 34: TRAP #2 */ - 34, /* 35: TRAP #3 */ - 34, /* 36: TRAP #4 */ - 34, /* 37: TRAP #5 */ - 34, /* 38: TRAP #6 */ - 34, /* 39: TRAP #7 */ - 34, /* 40: TRAP #8 */ - 34, /* 41: TRAP #9 */ - 34, /* 42: TRAP #10 */ - 34, /* 43: TRAP #11 */ - 34, /* 44: TRAP #12 */ - 34, /* 45: TRAP #13 */ - 34, /* 46: TRAP #14 */ - 34, /* 47: TRAP #15 */ - 4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */ - 4, /* 49: FP Inexact Result (unemulated) */ - 4, /* 50: FP Divide by Zero (unemulated) */ - 4, /* 51: FP Underflow (unemulated) */ - 4, /* 52: FP Operand Error (unemulated) */ - 4, /* 53: FP Overflow (unemulated) */ - 4, /* 54: FP Signaling NAN (unemulated) */ - 4, /* 55: FP Unimplemented Data Type (unemulated) */ - 4, /* 56: MMU Configuration Error (unemulated) */ - 4, /* 57: MMU Illegal Operation Error (unemulated) */ - 4, /* 58: MMU Access Level Violation Error (unemulated) */ - 4, /* 59: RESERVED */ - 4, /* 60: RESERVED */ - 4, /* 61: RESERVED */ - 4, /* 62: RESERVED */ - 4, /* 63: RESERVED */ - /* 64-255: User Defined */ - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 - }, - { /* 010 */ - 4, /* 0: Reset - Initial Stack Pointer */ - 4, /* 1: Reset - Initial Program Counter */ - 126, /* 2: Bus Error (unemulated) */ - 126, /* 3: Address Error (unemulated) */ - 38, /* 4: Illegal Instruction */ - 44, /* 5: Divide by Zero */ - 44, /* 6: CHK */ - 34, /* 7: TRAPV */ - 38, /* 8: Privilege Violation */ - 38, /* 9: Trace */ - 4, /* 10: 1010 */ - 4, /* 11: 1111 */ - 4, /* 12: RESERVED */ - 4, /* 13: Coprocessor Protocol Violation (unemulated) */ - 4, /* 14: Format Error */ - 44, /* 15: Uninitialized Interrupt */ - 4, /* 16: RESERVED */ - 4, /* 17: RESERVED */ - 4, /* 18: RESERVED */ - 4, /* 19: RESERVED */ - 4, /* 20: RESERVED */ - 4, /* 21: RESERVED */ - 4, /* 22: RESERVED */ - 4, /* 23: RESERVED */ - 46, /* 24: Spurious Interrupt */ - 46, /* 25: Level 1 Interrupt Autovector */ - 46, /* 26: Level 2 Interrupt Autovector */ - 46, /* 27: Level 3 Interrupt Autovector */ - 46, /* 28: Level 4 Interrupt Autovector */ - 46, /* 29: Level 5 Interrupt Autovector */ - 46, /* 30: Level 6 Interrupt Autovector */ - 46, /* 31: Level 7 Interrupt Autovector */ - 38, /* 32: TRAP #0 */ - 38, /* 33: TRAP #1 */ - 38, /* 34: TRAP #2 */ - 38, /* 35: TRAP #3 */ - 38, /* 36: TRAP #4 */ - 38, /* 37: TRAP #5 */ - 38, /* 38: TRAP #6 */ - 38, /* 39: TRAP #7 */ - 38, /* 40: TRAP #8 */ - 38, /* 41: TRAP #9 */ - 38, /* 42: TRAP #10 */ - 38, /* 43: TRAP #11 */ - 38, /* 44: TRAP #12 */ - 38, /* 45: TRAP #13 */ - 38, /* 46: TRAP #14 */ - 38, /* 47: TRAP #15 */ - 4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */ - 4, /* 49: FP Inexact Result (unemulated) */ - 4, /* 50: FP Divide by Zero (unemulated) */ - 4, /* 51: FP Underflow (unemulated) */ - 4, /* 52: FP Operand Error (unemulated) */ - 4, /* 53: FP Overflow (unemulated) */ - 4, /* 54: FP Signaling NAN (unemulated) */ - 4, /* 55: FP Unimplemented Data Type (unemulated) */ - 4, /* 56: MMU Configuration Error (unemulated) */ - 4, /* 57: MMU Illegal Operation Error (unemulated) */ - 4, /* 58: MMU Access Level Violation Error (unemulated) */ - 4, /* 59: RESERVED */ - 4, /* 60: RESERVED */ - 4, /* 61: RESERVED */ - 4, /* 62: RESERVED */ - 4, /* 63: RESERVED */ - /* 64-255: User Defined */ - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 - }, - { /* 020 */ - 4, /* 0: Reset - Initial Stack Pointer */ - 4, /* 1: Reset - Initial Program Counter */ - 50, /* 2: Bus Error (unemulated) */ - 50, /* 3: Address Error (unemulated) */ - 20, /* 4: Illegal Instruction */ - 38, /* 5: Divide by Zero */ - 40, /* 6: CHK */ - 20, /* 7: TRAPV */ - 34, /* 8: Privilege Violation */ - 25, /* 9: Trace */ - 20, /* 10: 1010 */ - 20, /* 11: 1111 */ - 4, /* 12: RESERVED */ - 4, /* 13: Coprocessor Protocol Violation (unemulated) */ - 4, /* 14: Format Error */ - 30, /* 15: Uninitialized Interrupt */ - 4, /* 16: RESERVED */ - 4, /* 17: RESERVED */ - 4, /* 18: RESERVED */ - 4, /* 19: RESERVED */ - 4, /* 20: RESERVED */ - 4, /* 21: RESERVED */ - 4, /* 22: RESERVED */ - 4, /* 23: RESERVED */ - 30, /* 24: Spurious Interrupt */ - 30, /* 25: Level 1 Interrupt Autovector */ - 30, /* 26: Level 2 Interrupt Autovector */ - 30, /* 27: Level 3 Interrupt Autovector */ - 30, /* 28: Level 4 Interrupt Autovector */ - 30, /* 29: Level 5 Interrupt Autovector */ - 30, /* 30: Level 6 Interrupt Autovector */ - 30, /* 31: Level 7 Interrupt Autovector */ - 20, /* 32: TRAP #0 */ - 20, /* 33: TRAP #1 */ - 20, /* 34: TRAP #2 */ - 20, /* 35: TRAP #3 */ - 20, /* 36: TRAP #4 */ - 20, /* 37: TRAP #5 */ - 20, /* 38: TRAP #6 */ - 20, /* 39: TRAP #7 */ - 20, /* 40: TRAP #8 */ - 20, /* 41: TRAP #9 */ - 20, /* 42: TRAP #10 */ - 20, /* 43: TRAP #11 */ - 20, /* 44: TRAP #12 */ - 20, /* 45: TRAP #13 */ - 20, /* 46: TRAP #14 */ - 20, /* 47: TRAP #15 */ - 4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */ - 4, /* 49: FP Inexact Result (unemulated) */ - 4, /* 50: FP Divide by Zero (unemulated) */ - 4, /* 51: FP Underflow (unemulated) */ - 4, /* 52: FP Operand Error (unemulated) */ - 4, /* 53: FP Overflow (unemulated) */ - 4, /* 54: FP Signaling NAN (unemulated) */ - 4, /* 55: FP Unimplemented Data Type (unemulated) */ - 4, /* 56: MMU Configuration Error (unemulated) */ - 4, /* 57: MMU Illegal Operation Error (unemulated) */ - 4, /* 58: MMU Access Level Violation Error (unemulated) */ - 4, /* 59: RESERVED */ - 4, /* 60: RESERVED */ - 4, /* 61: RESERVED */ - 4, /* 62: RESERVED */ - 4, /* 63: RESERVED */ - /* 64-255: User Defined */ - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 - }, - { /* 040 */ // TODO: these values are not correct - 4, /* 0: Reset - Initial Stack Pointer */ - 4, /* 1: Reset - Initial Program Counter */ - 50, /* 2: Bus Error (unemulated) */ - 50, /* 3: Address Error (unemulated) */ - 20, /* 4: Illegal Instruction */ - 38, /* 5: Divide by Zero */ - 40, /* 6: CHK */ - 20, /* 7: TRAPV */ - 34, /* 8: Privilege Violation */ - 25, /* 9: Trace */ - 20, /* 10: 1010 */ - 20, /* 11: 1111 */ - 4, /* 12: RESERVED */ - 4, /* 13: Coprocessor Protocol Violation (unemulated) */ - 4, /* 14: Format Error */ - 30, /* 15: Uninitialized Interrupt */ - 4, /* 16: RESERVED */ - 4, /* 17: RESERVED */ - 4, /* 18: RESERVED */ - 4, /* 19: RESERVED */ - 4, /* 20: RESERVED */ - 4, /* 21: RESERVED */ - 4, /* 22: RESERVED */ - 4, /* 23: RESERVED */ - 30, /* 24: Spurious Interrupt */ - 30, /* 25: Level 1 Interrupt Autovector */ - 30, /* 26: Level 2 Interrupt Autovector */ - 30, /* 27: Level 3 Interrupt Autovector */ - 30, /* 28: Level 4 Interrupt Autovector */ - 30, /* 29: Level 5 Interrupt Autovector */ - 30, /* 30: Level 6 Interrupt Autovector */ - 30, /* 31: Level 7 Interrupt Autovector */ - 20, /* 32: TRAP #0 */ - 20, /* 33: TRAP #1 */ - 20, /* 34: TRAP #2 */ - 20, /* 35: TRAP #3 */ - 20, /* 36: TRAP #4 */ - 20, /* 37: TRAP #5 */ - 20, /* 38: TRAP #6 */ - 20, /* 39: TRAP #7 */ - 20, /* 40: TRAP #8 */ - 20, /* 41: TRAP #9 */ - 20, /* 42: TRAP #10 */ - 20, /* 43: TRAP #11 */ - 20, /* 44: TRAP #12 */ - 20, /* 45: TRAP #13 */ - 20, /* 46: TRAP #14 */ - 20, /* 47: TRAP #15 */ - 4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */ - 4, /* 49: FP Inexact Result (unemulated) */ - 4, /* 50: FP Divide by Zero (unemulated) */ - 4, /* 51: FP Underflow (unemulated) */ - 4, /* 52: FP Operand Error (unemulated) */ - 4, /* 53: FP Overflow (unemulated) */ - 4, /* 54: FP Signaling NAN (unemulated) */ - 4, /* 55: FP Unimplemented Data Type (unemulated) */ - 4, /* 56: MMU Configuration Error (unemulated) */ - 4, /* 57: MMU Illegal Operation Error (unemulated) */ - 4, /* 58: MMU Access Level Violation Error (unemulated) */ - 4, /* 59: RESERVED */ - 4, /* 60: RESERVED */ - 4, /* 61: RESERVED */ - 4, /* 62: RESERVED */ - 4, /* 63: RESERVED */ - /* 64-255: User Defined */ - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 - } + { /* 000 */ + 4, /* 0: Reset - Initial Stack Pointer */ + 4, /* 1: Reset - Initial Program Counter */ + 50, /* 2: Bus Error (unemulated) */ + 50, /* 3: Address Error (unemulated) */ + 34, /* 4: Illegal Instruction */ + 38, /* 5: Divide by Zero -- ASG: changed from 42 */ + 40, /* 6: CHK -- ASG: chanaged from 44 */ + 34, /* 7: TRAPV */ + 34, /* 8: Privilege Violation */ + 34, /* 9: Trace */ + 4, /* 10: 1010 */ + 4, /* 11: 1111 */ + 4, /* 12: RESERVED */ + 4, /* 13: Coprocessor Protocol Violation (unemulated) */ + 4, /* 14: Format Error */ + 44, /* 15: Uninitialized Interrupt */ + 4, /* 16: RESERVED */ + 4, /* 17: RESERVED */ + 4, /* 18: RESERVED */ + 4, /* 19: RESERVED */ + 4, /* 20: RESERVED */ + 4, /* 21: RESERVED */ + 4, /* 22: RESERVED */ + 4, /* 23: RESERVED */ + 44, /* 24: Spurious Interrupt */ + 44, /* 25: Level 1 Interrupt Autovector */ + 44, /* 26: Level 2 Interrupt Autovector */ + 44, /* 27: Level 3 Interrupt Autovector */ + 44, /* 28: Level 4 Interrupt Autovector */ + 44, /* 29: Level 5 Interrupt Autovector */ + 44, /* 30: Level 6 Interrupt Autovector */ + 44, /* 31: Level 7 Interrupt Autovector */ + 34, /* 32: TRAP #0 -- ASG: chanaged from 38 */ + 34, /* 33: TRAP #1 */ + 34, /* 34: TRAP #2 */ + 34, /* 35: TRAP #3 */ + 34, /* 36: TRAP #4 */ + 34, /* 37: TRAP #5 */ + 34, /* 38: TRAP #6 */ + 34, /* 39: TRAP #7 */ + 34, /* 40: TRAP #8 */ + 34, /* 41: TRAP #9 */ + 34, /* 42: TRAP #10 */ + 34, /* 43: TRAP #11 */ + 34, /* 44: TRAP #12 */ + 34, /* 45: TRAP #13 */ + 34, /* 46: TRAP #14 */ + 34, /* 47: TRAP #15 */ + 4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */ + 4, /* 49: FP Inexact Result (unemulated) */ + 4, /* 50: FP Divide by Zero (unemulated) */ + 4, /* 51: FP Underflow (unemulated) */ + 4, /* 52: FP Operand Error (unemulated) */ + 4, /* 53: FP Overflow (unemulated) */ + 4, /* 54: FP Signaling NAN (unemulated) */ + 4, /* 55: FP Unimplemented Data Type (unemulated) */ + 4, /* 56: MMU Configuration Error (unemulated) */ + 4, /* 57: MMU Illegal Operation Error (unemulated) */ + 4, /* 58: MMU Access Level Violation Error (unemulated) */ + 4, /* 59: RESERVED */ + 4, /* 60: RESERVED */ + 4, /* 61: RESERVED */ + 4, /* 62: RESERVED */ + 4, /* 63: RESERVED */ + /* 64-255: User Defined */ + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 + }, + { /* 010 */ + 4, /* 0: Reset - Initial Stack Pointer */ + 4, /* 1: Reset - Initial Program Counter */ + 126, /* 2: Bus Error (unemulated) */ + 126, /* 3: Address Error (unemulated) */ + 38, /* 4: Illegal Instruction */ + 44, /* 5: Divide by Zero */ + 44, /* 6: CHK */ + 34, /* 7: TRAPV */ + 38, /* 8: Privilege Violation */ + 38, /* 9: Trace */ + 4, /* 10: 1010 */ + 4, /* 11: 1111 */ + 4, /* 12: RESERVED */ + 4, /* 13: Coprocessor Protocol Violation (unemulated) */ + 4, /* 14: Format Error */ + 44, /* 15: Uninitialized Interrupt */ + 4, /* 16: RESERVED */ + 4, /* 17: RESERVED */ + 4, /* 18: RESERVED */ + 4, /* 19: RESERVED */ + 4, /* 20: RESERVED */ + 4, /* 21: RESERVED */ + 4, /* 22: RESERVED */ + 4, /* 23: RESERVED */ + 46, /* 24: Spurious Interrupt */ + 46, /* 25: Level 1 Interrupt Autovector */ + 46, /* 26: Level 2 Interrupt Autovector */ + 46, /* 27: Level 3 Interrupt Autovector */ + 46, /* 28: Level 4 Interrupt Autovector */ + 46, /* 29: Level 5 Interrupt Autovector */ + 46, /* 30: Level 6 Interrupt Autovector */ + 46, /* 31: Level 7 Interrupt Autovector */ + 38, /* 32: TRAP #0 */ + 38, /* 33: TRAP #1 */ + 38, /* 34: TRAP #2 */ + 38, /* 35: TRAP #3 */ + 38, /* 36: TRAP #4 */ + 38, /* 37: TRAP #5 */ + 38, /* 38: TRAP #6 */ + 38, /* 39: TRAP #7 */ + 38, /* 40: TRAP #8 */ + 38, /* 41: TRAP #9 */ + 38, /* 42: TRAP #10 */ + 38, /* 43: TRAP #11 */ + 38, /* 44: TRAP #12 */ + 38, /* 45: TRAP #13 */ + 38, /* 46: TRAP #14 */ + 38, /* 47: TRAP #15 */ + 4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */ + 4, /* 49: FP Inexact Result (unemulated) */ + 4, /* 50: FP Divide by Zero (unemulated) */ + 4, /* 51: FP Underflow (unemulated) */ + 4, /* 52: FP Operand Error (unemulated) */ + 4, /* 53: FP Overflow (unemulated) */ + 4, /* 54: FP Signaling NAN (unemulated) */ + 4, /* 55: FP Unimplemented Data Type (unemulated) */ + 4, /* 56: MMU Configuration Error (unemulated) */ + 4, /* 57: MMU Illegal Operation Error (unemulated) */ + 4, /* 58: MMU Access Level Violation Error (unemulated) */ + 4, /* 59: RESERVED */ + 4, /* 60: RESERVED */ + 4, /* 61: RESERVED */ + 4, /* 62: RESERVED */ + 4, /* 63: RESERVED */ + /* 64-255: User Defined */ + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 + }, + { /* 020 */ + 4, /* 0: Reset - Initial Stack Pointer */ + 4, /* 1: Reset - Initial Program Counter */ + 50, /* 2: Bus Error (unemulated) */ + 50, /* 3: Address Error (unemulated) */ + 20, /* 4: Illegal Instruction */ + 38, /* 5: Divide by Zero */ + 40, /* 6: CHK */ + 20, /* 7: TRAPV */ + 34, /* 8: Privilege Violation */ + 25, /* 9: Trace */ + 20, /* 10: 1010 */ + 20, /* 11: 1111 */ + 4, /* 12: RESERVED */ + 4, /* 13: Coprocessor Protocol Violation (unemulated) */ + 4, /* 14: Format Error */ + 30, /* 15: Uninitialized Interrupt */ + 4, /* 16: RESERVED */ + 4, /* 17: RESERVED */ + 4, /* 18: RESERVED */ + 4, /* 19: RESERVED */ + 4, /* 20: RESERVED */ + 4, /* 21: RESERVED */ + 4, /* 22: RESERVED */ + 4, /* 23: RESERVED */ + 30, /* 24: Spurious Interrupt */ + 30, /* 25: Level 1 Interrupt Autovector */ + 30, /* 26: Level 2 Interrupt Autovector */ + 30, /* 27: Level 3 Interrupt Autovector */ + 30, /* 28: Level 4 Interrupt Autovector */ + 30, /* 29: Level 5 Interrupt Autovector */ + 30, /* 30: Level 6 Interrupt Autovector */ + 30, /* 31: Level 7 Interrupt Autovector */ + 20, /* 32: TRAP #0 */ + 20, /* 33: TRAP #1 */ + 20, /* 34: TRAP #2 */ + 20, /* 35: TRAP #3 */ + 20, /* 36: TRAP #4 */ + 20, /* 37: TRAP #5 */ + 20, /* 38: TRAP #6 */ + 20, /* 39: TRAP #7 */ + 20, /* 40: TRAP #8 */ + 20, /* 41: TRAP #9 */ + 20, /* 42: TRAP #10 */ + 20, /* 43: TRAP #11 */ + 20, /* 44: TRAP #12 */ + 20, /* 45: TRAP #13 */ + 20, /* 46: TRAP #14 */ + 20, /* 47: TRAP #15 */ + 4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */ + 4, /* 49: FP Inexact Result (unemulated) */ + 4, /* 50: FP Divide by Zero (unemulated) */ + 4, /* 51: FP Underflow (unemulated) */ + 4, /* 52: FP Operand Error (unemulated) */ + 4, /* 53: FP Overflow (unemulated) */ + 4, /* 54: FP Signaling NAN (unemulated) */ + 4, /* 55: FP Unimplemented Data Type (unemulated) */ + 4, /* 56: MMU Configuration Error (unemulated) */ + 4, /* 57: MMU Illegal Operation Error (unemulated) */ + 4, /* 58: MMU Access Level Violation Error (unemulated) */ + 4, /* 59: RESERVED */ + 4, /* 60: RESERVED */ + 4, /* 61: RESERVED */ + 4, /* 62: RESERVED */ + 4, /* 63: RESERVED */ + /* 64-255: User Defined */ + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 + }, + { /* 040 */ // TODO: these values are not correct + 4, /* 0: Reset - Initial Stack Pointer */ + 4, /* 1: Reset - Initial Program Counter */ + 50, /* 2: Bus Error (unemulated) */ + 50, /* 3: Address Error (unemulated) */ + 20, /* 4: Illegal Instruction */ + 38, /* 5: Divide by Zero */ + 40, /* 6: CHK */ + 20, /* 7: TRAPV */ + 34, /* 8: Privilege Violation */ + 25, /* 9: Trace */ + 20, /* 10: 1010 */ + 20, /* 11: 1111 */ + 4, /* 12: RESERVED */ + 4, /* 13: Coprocessor Protocol Violation (unemulated) */ + 4, /* 14: Format Error */ + 30, /* 15: Uninitialized Interrupt */ + 4, /* 16: RESERVED */ + 4, /* 17: RESERVED */ + 4, /* 18: RESERVED */ + 4, /* 19: RESERVED */ + 4, /* 20: RESERVED */ + 4, /* 21: RESERVED */ + 4, /* 22: RESERVED */ + 4, /* 23: RESERVED */ + 30, /* 24: Spurious Interrupt */ + 30, /* 25: Level 1 Interrupt Autovector */ + 30, /* 26: Level 2 Interrupt Autovector */ + 30, /* 27: Level 3 Interrupt Autovector */ + 30, /* 28: Level 4 Interrupt Autovector */ + 30, /* 29: Level 5 Interrupt Autovector */ + 30, /* 30: Level 6 Interrupt Autovector */ + 30, /* 31: Level 7 Interrupt Autovector */ + 20, /* 32: TRAP #0 */ + 20, /* 33: TRAP #1 */ + 20, /* 34: TRAP #2 */ + 20, /* 35: TRAP #3 */ + 20, /* 36: TRAP #4 */ + 20, /* 37: TRAP #5 */ + 20, /* 38: TRAP #6 */ + 20, /* 39: TRAP #7 */ + 20, /* 40: TRAP #8 */ + 20, /* 41: TRAP #9 */ + 20, /* 42: TRAP #10 */ + 20, /* 43: TRAP #11 */ + 20, /* 44: TRAP #12 */ + 20, /* 45: TRAP #13 */ + 20, /* 46: TRAP #14 */ + 20, /* 47: TRAP #15 */ + 4, /* 48: FP Branch or Set on Unknown Condition (unemulated) */ + 4, /* 49: FP Inexact Result (unemulated) */ + 4, /* 50: FP Divide by Zero (unemulated) */ + 4, /* 51: FP Underflow (unemulated) */ + 4, /* 52: FP Operand Error (unemulated) */ + 4, /* 53: FP Overflow (unemulated) */ + 4, /* 54: FP Signaling NAN (unemulated) */ + 4, /* 55: FP Unimplemented Data Type (unemulated) */ + 4, /* 56: MMU Configuration Error (unemulated) */ + 4, /* 57: MMU Illegal Operation Error (unemulated) */ + 4, /* 58: MMU Access Level Violation Error (unemulated) */ + 4, /* 59: RESERVED */ + 4, /* 60: RESERVED */ + 4, /* 61: RESERVED */ + 4, /* 62: RESERVED */ + 4, /* 63: RESERVED */ + /* 64-255: User Defined */ + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4 + } }; const uint8 m68ki_ea_idx_cycle_table[64] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, /* ..01.000 no memory indirect, base NULL */ - 5, /* ..01..01 memory indirect, base NULL, outer NULL */ - 7, /* ..01..10 memory indirect, base NULL, outer 16 */ - 7, /* ..01..11 memory indirect, base NULL, outer 32 */ - 0, 5, 7, 7, 0, 5, 7, 7, 0, 5, 7, 7, - 2, /* ..10.000 no memory indirect, base 16 */ - 7, /* ..10..01 memory indirect, base 16, outer NULL */ - 9, /* ..10..10 memory indirect, base 16, outer 16 */ - 9, /* ..10..11 memory indirect, base 16, outer 32 */ - 0, 7, 9, 9, 0, 7, 9, 9, 0, 7, 9, 9, - 6, /* ..11.000 no memory indirect, base 32 */ - 11, /* ..11..01 memory indirect, base 32, outer NULL */ - 13, /* ..11..10 memory indirect, base 32, outer 16 */ - 13, /* ..11..11 memory indirect, base 32, outer 32 */ - 0, 11, 13, 13, 0, 11, 13, 13, 0, 11, 13, 13 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, /* ..01.000 no memory indirect, base NULL */ + 5, /* ..01..01 memory indirect, base NULL, outer NULL */ + 7, /* ..01..10 memory indirect, base NULL, outer 16 */ + 7, /* ..01..11 memory indirect, base NULL, outer 32 */ + 0, 5, 7, 7, 0, 5, 7, 7, 0, 5, 7, 7, + 2, /* ..10.000 no memory indirect, base 16 */ + 7, /* ..10..01 memory indirect, base 16, outer NULL */ + 9, /* ..10..10 memory indirect, base 16, outer 16 */ + 9, /* ..10..11 memory indirect, base 16, outer 32 */ + 0, 7, 9, 9, 0, 7, 9, 9, 0, 7, 9, 9, + 6, /* ..11.000 no memory indirect, base 32 */ + 11, /* ..11..01 memory indirect, base 32, outer NULL */ + 13, /* ..11..10 memory indirect, base 32, outer 16 */ + 13, /* ..11..11 memory indirect, base 32, outer 32 */ + 0, 11, 13, 13, 0, 11, 13, 13, 0, 11, 13, 13 }; @@ -452,16 +452,16 @@ const uint8 m68ki_ea_idx_cycle_table[64] = static int default_int_ack_callback_data; static int default_int_ack_callback(int int_level) { - default_int_ack_callback_data = int_level; - CPU_INT_LEVEL = 0; - return M68K_INT_ACK_AUTOVECTOR; + default_int_ack_callback_data = int_level; + CPU_INT_LEVEL = 0; + return M68K_INT_ACK_AUTOVECTOR; } /* Breakpoint acknowledge */ static unsigned int default_bkpt_ack_callback_data; static void default_bkpt_ack_callback(unsigned int data) { - default_bkpt_ack_callback_data = data; + default_bkpt_ack_callback_data = data; } /* Called when a reset instruction is executed */ @@ -482,21 +482,21 @@ static void default_rte_instr_callback(void) /* Called when a tas instruction is executed */ static int default_tas_instr_callback(void) { - return 1; // allow writeback + return 1; // allow writeback } /* Called when the program counter changed by a large value */ static unsigned int default_pc_changed_callback_data; static void default_pc_changed_callback(unsigned int new_pc) { - default_pc_changed_callback_data = new_pc; + default_pc_changed_callback_data = new_pc; } /* Called every time there's bus activity (read/write to/from memory */ static unsigned int default_set_fc_callback_data; static void default_set_fc_callback(unsigned int new_fc) { - default_set_fc_callback_data = new_fc; + default_set_fc_callback_data = new_fc; } /* Called every instruction cycle prior to execution */ @@ -506,9 +506,9 @@ static void default_instr_hook_callback(unsigned int pc) #if M68K_EMULATE_ADDRESS_ERROR - #include - jmp_buf m68ki_aerr_trap; - int emulate_address_error = 0; + #include + jmp_buf m68ki_aerr_trap; + int emulate_address_error = 0; #endif /* M68K_EMULATE_ADDRESS_ERROR */ @@ -519,326 +519,326 @@ static void default_instr_hook_callback(unsigned int pc) /* Access the internals of the CPU */ unsigned int m68k_get_reg(void* context, m68k_register_t regnum) { - m68ki_cpu_core* cpu = context != NULL ?(m68ki_cpu_core*)context : &m68ki_cpu; + m68ki_cpu_core* cpu = context != NULL ?(m68ki_cpu_core*)context : &m68ki_cpu; - switch(regnum) - { - case M68K_REG_D0: return cpu->dar[0]; - case M68K_REG_D1: return cpu->dar[1]; - case M68K_REG_D2: return cpu->dar[2]; - case M68K_REG_D3: return cpu->dar[3]; - case M68K_REG_D4: return cpu->dar[4]; - case M68K_REG_D5: return cpu->dar[5]; - case M68K_REG_D6: return cpu->dar[6]; - case M68K_REG_D7: return cpu->dar[7]; - case M68K_REG_A0: return cpu->dar[8]; - case M68K_REG_A1: return cpu->dar[9]; - case M68K_REG_A2: return cpu->dar[10]; - case M68K_REG_A3: return cpu->dar[11]; - case M68K_REG_A4: return cpu->dar[12]; - case M68K_REG_A5: return cpu->dar[13]; - case M68K_REG_A6: return cpu->dar[14]; - case M68K_REG_A7: return cpu->dar[15]; - case M68K_REG_PC: return MASK_OUT_ABOVE_32(cpu->pc); - case M68K_REG_SR: return cpu->t1_flag | - cpu->t0_flag | - (cpu->s_flag << 11) | - (cpu->m_flag << 11) | - cpu->int_mask | - ((cpu->x_flag & XFLAG_SET) >> 4) | - ((cpu->n_flag & NFLAG_SET) >> 4) | - ((!cpu->not_z_flag) << 2) | - ((cpu->v_flag & VFLAG_SET) >> 6) | - ((cpu->c_flag & CFLAG_SET) >> 8); - case M68K_REG_SP: return cpu->dar[15]; - case M68K_REG_USP: return cpu->s_flag ? cpu->sp[0] : cpu->dar[15]; - case M68K_REG_ISP: return cpu->s_flag && !cpu->m_flag ? cpu->dar[15] : cpu->sp[4]; - case M68K_REG_MSP: return cpu->s_flag && cpu->m_flag ? cpu->dar[15] : cpu->sp[6]; - case M68K_REG_SFC: return cpu->sfc; - case M68K_REG_DFC: return cpu->dfc; - case M68K_REG_VBR: return cpu->vbr; - case M68K_REG_CACR: return cpu->cacr; - case M68K_REG_CAAR: return cpu->caar; - case M68K_REG_PREF_ADDR: return cpu->pref_addr; - case M68K_REG_PREF_DATA: return cpu->pref_data; - case M68K_REG_PPC: return MASK_OUT_ABOVE_32(cpu->ppc); - case M68K_REG_IR: return cpu->ir; - case M68K_REG_CPU_TYPE: - switch(cpu->cpu_type) - { - case CPU_TYPE_000: return (unsigned int)M68K_CPU_TYPE_68000; - case CPU_TYPE_008: return (unsigned int)M68K_CPU_TYPE_68008; - case CPU_TYPE_010: return (unsigned int)M68K_CPU_TYPE_68010; - case CPU_TYPE_EC020: return (unsigned int)M68K_CPU_TYPE_68EC020; - case CPU_TYPE_020: return (unsigned int)M68K_CPU_TYPE_68020; - case CPU_TYPE_040: return (unsigned int)M68K_CPU_TYPE_68040; - } - return M68K_CPU_TYPE_INVALID; - default: return 0; - } - return 0; + switch(regnum) + { + case M68K_REG_D0: return cpu->dar[0]; + case M68K_REG_D1: return cpu->dar[1]; + case M68K_REG_D2: return cpu->dar[2]; + case M68K_REG_D3: return cpu->dar[3]; + case M68K_REG_D4: return cpu->dar[4]; + case M68K_REG_D5: return cpu->dar[5]; + case M68K_REG_D6: return cpu->dar[6]; + case M68K_REG_D7: return cpu->dar[7]; + case M68K_REG_A0: return cpu->dar[8]; + case M68K_REG_A1: return cpu->dar[9]; + case M68K_REG_A2: return cpu->dar[10]; + case M68K_REG_A3: return cpu->dar[11]; + case M68K_REG_A4: return cpu->dar[12]; + case M68K_REG_A5: return cpu->dar[13]; + case M68K_REG_A6: return cpu->dar[14]; + case M68K_REG_A7: return cpu->dar[15]; + case M68K_REG_PC: return MASK_OUT_ABOVE_32(cpu->pc); + case M68K_REG_SR: return cpu->t1_flag | + cpu->t0_flag | + (cpu->s_flag << 11) | + (cpu->m_flag << 11) | + cpu->int_mask | + ((cpu->x_flag & XFLAG_SET) >> 4) | + ((cpu->n_flag & NFLAG_SET) >> 4) | + ((!cpu->not_z_flag) << 2) | + ((cpu->v_flag & VFLAG_SET) >> 6) | + ((cpu->c_flag & CFLAG_SET) >> 8); + case M68K_REG_SP: return cpu->dar[15]; + case M68K_REG_USP: return cpu->s_flag ? cpu->sp[0] : cpu->dar[15]; + case M68K_REG_ISP: return cpu->s_flag && !cpu->m_flag ? cpu->dar[15] : cpu->sp[4]; + case M68K_REG_MSP: return cpu->s_flag && cpu->m_flag ? cpu->dar[15] : cpu->sp[6]; + case M68K_REG_SFC: return cpu->sfc; + case M68K_REG_DFC: return cpu->dfc; + case M68K_REG_VBR: return cpu->vbr; + case M68K_REG_CACR: return cpu->cacr; + case M68K_REG_CAAR: return cpu->caar; + case M68K_REG_PREF_ADDR: return cpu->pref_addr; + case M68K_REG_PREF_DATA: return cpu->pref_data; + case M68K_REG_PPC: return MASK_OUT_ABOVE_32(cpu->ppc); + case M68K_REG_IR: return cpu->ir; + case M68K_REG_CPU_TYPE: + switch(cpu->cpu_type) + { + case CPU_TYPE_000: return (unsigned int)M68K_CPU_TYPE_68000; + case CPU_TYPE_008: return (unsigned int)M68K_CPU_TYPE_68008; + case CPU_TYPE_010: return (unsigned int)M68K_CPU_TYPE_68010; + case CPU_TYPE_EC020: return (unsigned int)M68K_CPU_TYPE_68EC020; + case CPU_TYPE_020: return (unsigned int)M68K_CPU_TYPE_68020; + case CPU_TYPE_040: return (unsigned int)M68K_CPU_TYPE_68040; + } + return M68K_CPU_TYPE_INVALID; + default: return 0; + } + return 0; } void m68k_set_reg(m68k_register_t regnum, unsigned int value) { - switch(regnum) - { - case M68K_REG_D0: REG_D[0] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_D1: REG_D[1] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_D2: REG_D[2] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_D3: REG_D[3] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_D4: REG_D[4] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_D5: REG_D[5] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_D6: REG_D[6] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_D7: REG_D[7] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_A0: REG_A[0] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_A1: REG_A[1] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_A2: REG_A[2] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_A3: REG_A[3] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_A4: REG_A[4] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_A5: REG_A[5] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_A6: REG_A[6] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_A7: REG_A[7] = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_PC: m68ki_jump(MASK_OUT_ABOVE_32(value)); return; - case M68K_REG_SR: m68ki_set_sr(value); return; - case M68K_REG_SP: REG_SP = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_USP: if(FLAG_S) - REG_USP = MASK_OUT_ABOVE_32(value); - else - REG_SP = MASK_OUT_ABOVE_32(value); - return; - case M68K_REG_ISP: if(FLAG_S && !FLAG_M) - REG_SP = MASK_OUT_ABOVE_32(value); - else - REG_ISP = MASK_OUT_ABOVE_32(value); - return; - case M68K_REG_MSP: if(FLAG_S && FLAG_M) - REG_SP = MASK_OUT_ABOVE_32(value); - else - REG_MSP = MASK_OUT_ABOVE_32(value); - return; - case M68K_REG_VBR: REG_VBR = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_SFC: REG_SFC = value & 7; return; - case M68K_REG_DFC: REG_DFC = value & 7; return; - case M68K_REG_CACR: REG_CACR = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_CAAR: REG_CAAR = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_PPC: REG_PPC = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_IR: REG_IR = MASK_OUT_ABOVE_16(value); return; - case M68K_REG_PREF_ADDR: CPU_PREF_ADDR = MASK_OUT_ABOVE_32(value); return; - case M68K_REG_CPU_TYPE: m68k_set_cpu_type(value); return; - default: return; - } + switch(regnum) + { + case M68K_REG_D0: REG_D[0] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_D1: REG_D[1] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_D2: REG_D[2] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_D3: REG_D[3] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_D4: REG_D[4] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_D5: REG_D[5] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_D6: REG_D[6] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_D7: REG_D[7] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_A0: REG_A[0] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_A1: REG_A[1] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_A2: REG_A[2] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_A3: REG_A[3] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_A4: REG_A[4] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_A5: REG_A[5] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_A6: REG_A[6] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_A7: REG_A[7] = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_PC: m68ki_jump(MASK_OUT_ABOVE_32(value)); return; + case M68K_REG_SR: m68ki_set_sr(value); return; + case M68K_REG_SP: REG_SP = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_USP: if(FLAG_S) + REG_USP = MASK_OUT_ABOVE_32(value); + else + REG_SP = MASK_OUT_ABOVE_32(value); + return; + case M68K_REG_ISP: if(FLAG_S && !FLAG_M) + REG_SP = MASK_OUT_ABOVE_32(value); + else + REG_ISP = MASK_OUT_ABOVE_32(value); + return; + case M68K_REG_MSP: if(FLAG_S && FLAG_M) + REG_SP = MASK_OUT_ABOVE_32(value); + else + REG_MSP = MASK_OUT_ABOVE_32(value); + return; + case M68K_REG_VBR: REG_VBR = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_SFC: REG_SFC = value & 7; return; + case M68K_REG_DFC: REG_DFC = value & 7; return; + case M68K_REG_CACR: REG_CACR = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_CAAR: REG_CAAR = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_PPC: REG_PPC = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_IR: REG_IR = MASK_OUT_ABOVE_16(value); return; + case M68K_REG_PREF_ADDR: CPU_PREF_ADDR = MASK_OUT_ABOVE_32(value); return; + case M68K_REG_CPU_TYPE: m68k_set_cpu_type(value); return; + default: return; + } } /* Set the callbacks */ void m68k_set_int_ack_callback(int (*callback)(int int_level)) { - CALLBACK_INT_ACK = callback ? callback : default_int_ack_callback; + CALLBACK_INT_ACK = callback ? callback : default_int_ack_callback; } void m68k_set_bkpt_ack_callback(void (*callback)(unsigned int data)) { - CALLBACK_BKPT_ACK = callback ? callback : default_bkpt_ack_callback; + CALLBACK_BKPT_ACK = callback ? callback : default_bkpt_ack_callback; } void m68k_set_reset_instr_callback(void (*callback)(void)) { - CALLBACK_RESET_INSTR = callback ? callback : default_reset_instr_callback; + CALLBACK_RESET_INSTR = callback ? callback : default_reset_instr_callback; } void m68k_set_cmpild_instr_callback(void (*callback)(unsigned int, int)) { - CALLBACK_CMPILD_INSTR = callback ? callback : default_cmpild_instr_callback; + CALLBACK_CMPILD_INSTR = callback ? callback : default_cmpild_instr_callback; } void m68k_set_rte_instr_callback(void (*callback)(void)) { - CALLBACK_RTE_INSTR = callback ? callback : default_rte_instr_callback; + CALLBACK_RTE_INSTR = callback ? callback : default_rte_instr_callback; } void m68k_set_tas_instr_callback(int (*callback)(void)) { - CALLBACK_TAS_INSTR = callback ? callback : default_tas_instr_callback; + CALLBACK_TAS_INSTR = callback ? callback : default_tas_instr_callback; } void m68k_set_pc_changed_callback(void (*callback)(unsigned int new_pc)) { - CALLBACK_PC_CHANGED = callback ? callback : default_pc_changed_callback; + CALLBACK_PC_CHANGED = callback ? callback : default_pc_changed_callback; } void m68k_set_fc_callback(void (*callback)(unsigned int new_fc)) { - CALLBACK_SET_FC = callback ? callback : default_set_fc_callback; + CALLBACK_SET_FC = callback ? callback : default_set_fc_callback; } void m68k_set_instr_hook_callback(void (*callback)(unsigned int pc)) { - CALLBACK_INSTR_HOOK = callback ? callback : default_instr_hook_callback; + CALLBACK_INSTR_HOOK = callback ? callback : default_instr_hook_callback; } #include /* Set the CPU type. */ void m68k_set_cpu_type(unsigned int cpu_type) { - switch(cpu_type) - { - case M68K_CPU_TYPE_68000: - CPU_TYPE = CPU_TYPE_000; - CPU_ADDRESS_MASK = 0x00ffffff; - CPU_SR_MASK = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ - CYC_INSTRUCTION = m68ki_cycles[0]; - CYC_EXCEPTION = m68ki_exception_cycle_table[0]; - CYC_BCC_NOTAKE_B = -2; - CYC_BCC_NOTAKE_W = 2; - CYC_DBCC_F_NOEXP = -2; - CYC_DBCC_F_EXP = 2; - CYC_SCC_R_TRUE = 2; - CYC_MOVEM_W = 2; - CYC_MOVEM_L = 3; - CYC_SHIFT = 1; - CYC_RESET = 132; - return; - case M68K_CPU_TYPE_68008: - CPU_TYPE = CPU_TYPE_008; - CPU_ADDRESS_MASK = 0x003fffff; - CPU_SR_MASK = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ - CYC_INSTRUCTION = m68ki_cycles[0]; - CYC_EXCEPTION = m68ki_exception_cycle_table[0]; - CYC_BCC_NOTAKE_B = -2; - CYC_BCC_NOTAKE_W = 2; - CYC_DBCC_F_NOEXP = -2; - CYC_DBCC_F_EXP = 2; - CYC_SCC_R_TRUE = 2; - CYC_MOVEM_W = 2; - CYC_MOVEM_L = 3; - CYC_SHIFT = 1; - CYC_RESET = 132; - return; - case M68K_CPU_TYPE_68010: - CPU_TYPE = CPU_TYPE_010; - CPU_ADDRESS_MASK = 0x00ffffff; - CPU_SR_MASK = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ - CYC_INSTRUCTION = m68ki_cycles[1]; - CYC_EXCEPTION = m68ki_exception_cycle_table[1]; - CYC_BCC_NOTAKE_B = -4; - CYC_BCC_NOTAKE_W = 0; - CYC_DBCC_F_NOEXP = 0; - CYC_DBCC_F_EXP = 6; - CYC_SCC_R_TRUE = 0; - CYC_MOVEM_W = 2; - CYC_MOVEM_L = 3; - CYC_SHIFT = 1; - CYC_RESET = 130; - return; - case M68K_CPU_TYPE_68EC020: - CPU_TYPE = CPU_TYPE_EC020; - CPU_ADDRESS_MASK = 0x00ffffff; - CPU_SR_MASK = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ - CYC_INSTRUCTION = m68ki_cycles[2]; - CYC_EXCEPTION = m68ki_exception_cycle_table[2]; - CYC_BCC_NOTAKE_B = -2; - CYC_BCC_NOTAKE_W = 0; - CYC_DBCC_F_NOEXP = 0; - CYC_DBCC_F_EXP = 4; - CYC_SCC_R_TRUE = 0; - CYC_MOVEM_W = 2; - CYC_MOVEM_L = 2; - CYC_SHIFT = 0; - CYC_RESET = 518; - return; - case M68K_CPU_TYPE_68020: - CPU_TYPE = CPU_TYPE_020; - CPU_ADDRESS_MASK = 0xffffffff; - CPU_SR_MASK = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ - CYC_INSTRUCTION = m68ki_cycles[2]; - CYC_EXCEPTION = m68ki_exception_cycle_table[2]; - CYC_BCC_NOTAKE_B = -2; - CYC_BCC_NOTAKE_W = 0; - CYC_DBCC_F_NOEXP = 0; - CYC_DBCC_F_EXP = 4; - CYC_SCC_R_TRUE = 0; - CYC_MOVEM_W = 2; - CYC_MOVEM_L = 2; - CYC_SHIFT = 0; - CYC_RESET = 518; - return; - case M68K_CPU_TYPE_68040: // TODO: these values are not correct - CPU_TYPE = CPU_TYPE_040; - CPU_ADDRESS_MASK = 0xffffffff; - CPU_SR_MASK = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ - CYC_INSTRUCTION = m68ki_cycles[2]; - CYC_EXCEPTION = m68ki_exception_cycle_table[2]; - CYC_BCC_NOTAKE_B = -2; - CYC_BCC_NOTAKE_W = 0; - CYC_DBCC_F_NOEXP = 0; - CYC_DBCC_F_EXP = 4; - CYC_SCC_R_TRUE = 0; - CYC_MOVEM_W = 2; - CYC_MOVEM_L = 2; - CYC_SHIFT = 0; - CYC_RESET = 518; - return; - } + switch(cpu_type) + { + case M68K_CPU_TYPE_68000: + CPU_TYPE = CPU_TYPE_000; + CPU_ADDRESS_MASK = 0x00ffffff; + CPU_SR_MASK = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ + CYC_INSTRUCTION = m68ki_cycles[0]; + CYC_EXCEPTION = m68ki_exception_cycle_table[0]; + CYC_BCC_NOTAKE_B = -2; + CYC_BCC_NOTAKE_W = 2; + CYC_DBCC_F_NOEXP = -2; + CYC_DBCC_F_EXP = 2; + CYC_SCC_R_TRUE = 2; + CYC_MOVEM_W = 2; + CYC_MOVEM_L = 3; + CYC_SHIFT = 1; + CYC_RESET = 132; + return; + case M68K_CPU_TYPE_68008: + CPU_TYPE = CPU_TYPE_008; + CPU_ADDRESS_MASK = 0x003fffff; + CPU_SR_MASK = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ + CYC_INSTRUCTION = m68ki_cycles[0]; + CYC_EXCEPTION = m68ki_exception_cycle_table[0]; + CYC_BCC_NOTAKE_B = -2; + CYC_BCC_NOTAKE_W = 2; + CYC_DBCC_F_NOEXP = -2; + CYC_DBCC_F_EXP = 2; + CYC_SCC_R_TRUE = 2; + CYC_MOVEM_W = 2; + CYC_MOVEM_L = 3; + CYC_SHIFT = 1; + CYC_RESET = 132; + return; + case M68K_CPU_TYPE_68010: + CPU_TYPE = CPU_TYPE_010; + CPU_ADDRESS_MASK = 0x00ffffff; + CPU_SR_MASK = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ + CYC_INSTRUCTION = m68ki_cycles[1]; + CYC_EXCEPTION = m68ki_exception_cycle_table[1]; + CYC_BCC_NOTAKE_B = -4; + CYC_BCC_NOTAKE_W = 0; + CYC_DBCC_F_NOEXP = 0; + CYC_DBCC_F_EXP = 6; + CYC_SCC_R_TRUE = 0; + CYC_MOVEM_W = 2; + CYC_MOVEM_L = 3; + CYC_SHIFT = 1; + CYC_RESET = 130; + return; + case M68K_CPU_TYPE_68EC020: + CPU_TYPE = CPU_TYPE_EC020; + CPU_ADDRESS_MASK = 0x00ffffff; + CPU_SR_MASK = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ + CYC_INSTRUCTION = m68ki_cycles[2]; + CYC_EXCEPTION = m68ki_exception_cycle_table[2]; + CYC_BCC_NOTAKE_B = -2; + CYC_BCC_NOTAKE_W = 0; + CYC_DBCC_F_NOEXP = 0; + CYC_DBCC_F_EXP = 4; + CYC_SCC_R_TRUE = 0; + CYC_MOVEM_W = 2; + CYC_MOVEM_L = 2; + CYC_SHIFT = 0; + CYC_RESET = 518; + return; + case M68K_CPU_TYPE_68020: + CPU_TYPE = CPU_TYPE_020; + CPU_ADDRESS_MASK = 0xffffffff; + CPU_SR_MASK = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ + CYC_INSTRUCTION = m68ki_cycles[2]; + CYC_EXCEPTION = m68ki_exception_cycle_table[2]; + CYC_BCC_NOTAKE_B = -2; + CYC_BCC_NOTAKE_W = 0; + CYC_DBCC_F_NOEXP = 0; + CYC_DBCC_F_EXP = 4; + CYC_SCC_R_TRUE = 0; + CYC_MOVEM_W = 2; + CYC_MOVEM_L = 2; + CYC_SHIFT = 0; + CYC_RESET = 518; + return; + case M68K_CPU_TYPE_68040: // TODO: these values are not correct + CPU_TYPE = CPU_TYPE_040; + CPU_ADDRESS_MASK = 0xffffffff; + CPU_SR_MASK = 0xf71f; /* T1 T0 S M -- I2 I1 I0 -- -- -- X N Z V C */ + CYC_INSTRUCTION = m68ki_cycles[2]; + CYC_EXCEPTION = m68ki_exception_cycle_table[2]; + CYC_BCC_NOTAKE_B = -2; + CYC_BCC_NOTAKE_W = 0; + CYC_DBCC_F_NOEXP = 0; + CYC_DBCC_F_EXP = 4; + CYC_SCC_R_TRUE = 0; + CYC_MOVEM_W = 2; + CYC_MOVEM_L = 2; + CYC_SHIFT = 0; + CYC_RESET = 518; + return; + } } /* Execute some instructions until we use up num_cycles clock cycles */ /* ASG: removed per-instruction interrupt checks */ INLINE int m68k_execute(int num_cycles) { - /* Make sure we're not stopped */ - if(!CPU_STOPPED) - { - /* Set our pool of clock cycles available */ - SET_CYCLES(num_cycles); - m68ki_initial_cycles = num_cycles; + /* Make sure we're not stopped */ + if(!CPU_STOPPED) + { + /* Set our pool of clock cycles available */ + SET_CYCLES(num_cycles); + m68ki_initial_cycles = num_cycles; - /* ASG: update cycles */ - USE_CYCLES(CPU_INT_CYCLES); - CPU_INT_CYCLES = 0; + /* ASG: update cycles */ + USE_CYCLES(CPU_INT_CYCLES); + CPU_INT_CYCLES = 0; - /* Return point if we had an address error */ - m68ki_set_address_error_trap(); /* auto-disable (see m68kcpu.h) */ + /* Return point if we had an address error */ + m68ki_set_address_error_trap(); /* auto-disable (see m68kcpu.h) */ - /* Main loop. Keep going until we run out of clock cycles */ - do - { - /* Set tracing accodring to T1. (T0 is done inside instruction) */ - m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */ + /* Main loop. Keep going until we run out of clock cycles */ + do + { + /* Set tracing accodring to T1. (T0 is done inside instruction) */ + m68ki_trace_t1(); /* auto-disable (see m68kcpu.h) */ - /* Set the address space for reads */ - m68ki_use_data_space(); /* auto-disable (see m68kcpu.h) */ + /* Set the address space for reads */ + m68ki_use_data_space(); /* auto-disable (see m68kcpu.h) */ - /* Call external hook to peek at CPU */ - m68ki_instr_hook(REG_PC); /* auto-disable (see m68kcpu.h) */ + /* Call external hook to peek at CPU */ + m68ki_instr_hook(REG_PC); /* auto-disable (see m68kcpu.h) */ - /* Record previous program counter */ - REG_PPC = REG_PC; + /* Record previous program counter */ + REG_PPC = REG_PC; - /* Read an instruction and call its handler */ - REG_IR = m68ki_read_imm_16(); - m68ki_instruction_jump_table[REG_IR](); - USE_CYCLES(CYC_INSTRUCTION[REG_IR]); + /* Read an instruction and call its handler */ + REG_IR = m68ki_read_imm_16(); + m68ki_instruction_jump_table[REG_IR](); + USE_CYCLES(CYC_INSTRUCTION[REG_IR]); - /* Trace m68k_exception, if necessary */ - m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */ - } while(GET_CYCLES() > 0); + /* Trace m68k_exception, if necessary */ + m68ki_exception_if_trace(); /* auto-disable (see m68kcpu.h) */ + } while(GET_CYCLES() > 0); - /* set previous PC to current PC for the next entry into the loop */ - REG_PPC = REG_PC; + /* set previous PC to current PC for the next entry into the loop */ + REG_PPC = REG_PC; - /* ASG: update cycles */ - USE_CYCLES(CPU_INT_CYCLES); - CPU_INT_CYCLES = 0; + /* ASG: update cycles */ + USE_CYCLES(CPU_INT_CYCLES); + CPU_INT_CYCLES = 0; - /* return how many clocks we used */ - return m68ki_initial_cycles - GET_CYCLES(); - } + /* return how many clocks we used */ + return m68ki_initial_cycles - GET_CYCLES(); + } - /* We get here if the CPU is stopped or halted */ - SET_CYCLES(0); - CPU_INT_CYCLES = 0; + /* We get here if the CPU is stopped or halted */ + SET_CYCLES(0); + CPU_INT_CYCLES = 0; - return num_cycles; + return num_cycles; } /* ASG: rewrote so that the int_level is a mask of the IPL0/IPL1/IPL2 bits */ @@ -847,15 +847,15 @@ INLINE int m68k_execute(int num_cycles) */ INLINE void m68k_set_irq(unsigned int int_level) { - uint old_level = CPU_INT_LEVEL; - CPU_INT_LEVEL = int_level << 8; + uint old_level = CPU_INT_LEVEL; + CPU_INT_LEVEL = int_level << 8; - /* A transition from < 7 to 7 always interrupts (NMI) */ - /* Note: Level 7 can also level trigger like a normal IRQ */ - if(old_level != 0x0700 && CPU_INT_LEVEL == 0x0700) - m68ki_exception_interrupt(7); /* Edge triggered level 7 (NMI) */ - else - m68ki_check_interrupts(); /* Level triggered (IRQ) */ + /* A transition from < 7 to 7 always interrupts (NMI) */ + /* Note: Level 7 can also level trigger like a normal IRQ */ + if(old_level != 0x0700 && CPU_INT_LEVEL == 0x0700) + m68ki_exception_interrupt(7); /* Edge triggered level 7 (NMI) */ + else + m68ki_check_interrupts(); /* Level triggered (IRQ) */ } extern uint16 irq_status; @@ -864,10 +864,10 @@ extern uint32 count_m68k; void m68k_run (int cyc) { int temp; - while (count_m68k < cyc) - { - /* check interrupt updates */ - if (irq_status & 0x10) + while (count_m68k < cyc) + { + /* check interrupt updates */ + if (irq_status & 0x10) { irq_status &= ~0x10; @@ -881,96 +881,96 @@ void m68k_run (int cyc) m68k_set_irq(temp); } - /* execute a single instruction */ - count_m68k += m68k_execute(1); - } + /* execute a single instruction */ + count_m68k += m68k_execute(1); + } } int m68k_cycles_run(void) { - return m68ki_initial_cycles - GET_CYCLES(); + return m68ki_initial_cycles - GET_CYCLES(); } int m68k_cycles_remaining(void) { - return GET_CYCLES(); + return GET_CYCLES(); } /* Change the timeslice */ void m68k_modify_timeslice(int cycles) { - m68ki_initial_cycles += cycles; - ADD_CYCLES(cycles); + m68ki_initial_cycles += cycles; + ADD_CYCLES(cycles); } void m68k_end_timeslice(void) { - m68ki_initial_cycles = GET_CYCLES(); - SET_CYCLES(0); + m68ki_initial_cycles = GET_CYCLES(); + SET_CYCLES(0); } void m68k_init(void) { - static uint emulation_initialized = 0; + static uint emulation_initialized = 0; - /* The first call to this function initializes the opcode handler jump table */ - if(!emulation_initialized) - { - m68ki_build_opcode_table(); - emulation_initialized = 1; - } + /* The first call to this function initializes the opcode handler jump table */ + if(!emulation_initialized) + { + m68ki_build_opcode_table(); + emulation_initialized = 1; + } - m68k_set_int_ack_callback(NULL); - m68k_set_bkpt_ack_callback(NULL); - m68k_set_reset_instr_callback(NULL); - m68k_set_cmpild_instr_callback(NULL); - m68k_set_rte_instr_callback(NULL); - m68k_set_tas_instr_callback(NULL); - m68k_set_pc_changed_callback(NULL); - m68k_set_fc_callback(NULL); - m68k_set_instr_hook_callback(NULL); + m68k_set_int_ack_callback(NULL); + m68k_set_bkpt_ack_callback(NULL); + m68k_set_reset_instr_callback(NULL); + m68k_set_cmpild_instr_callback(NULL); + m68k_set_rte_instr_callback(NULL); + m68k_set_tas_instr_callback(NULL); + m68k_set_pc_changed_callback(NULL); + m68k_set_fc_callback(NULL); + m68k_set_instr_hook_callback(NULL); } /* Pulse the RESET line on the CPU */ void m68k_pulse_reset(void) { - /* Clear all stop levels and eat up all remaining cycles */ - CPU_STOPPED = 0; - SET_CYCLES(0); + /* Clear all stop levels and eat up all remaining cycles */ + CPU_STOPPED = 0; + SET_CYCLES(0); - CPU_RUN_MODE = RUN_MODE_BERR_AERR_RESET; + CPU_RUN_MODE = RUN_MODE_BERR_AERR_RESET; - /* Turn off tracing */ - FLAG_T1 = FLAG_T0 = 0; - m68ki_clear_trace(); - /* Interrupt mask to level 7 */ - FLAG_INT_MASK = 0x0700; - CPU_INT_LEVEL = 0; - /* Reset VBR */ - REG_VBR = 0; - /* Go to supervisor mode */ - m68ki_set_sm_flag(SFLAG_SET | MFLAG_CLEAR); + /* Turn off tracing */ + FLAG_T1 = FLAG_T0 = 0; + m68ki_clear_trace(); + /* Interrupt mask to level 7 */ + FLAG_INT_MASK = 0x0700; + CPU_INT_LEVEL = 0; + /* Reset VBR */ + REG_VBR = 0; + /* Go to supervisor mode */ + m68ki_set_sm_flag(SFLAG_SET | MFLAG_CLEAR); - /* Invalidate the prefetch queue */ + /* Invalidate the prefetch queue */ #if M68K_EMULATE_PREFETCH - /* Set to arbitrary number since our first fetch is from 0 */ - CPU_PREF_ADDR = 0x1000; + /* Set to arbitrary number since our first fetch is from 0 */ + CPU_PREF_ADDR = 0x1000; #endif /* M68K_EMULATE_PREFETCH */ - /* Read the initial stack pointer and program counter */ - m68ki_jump(0); - REG_SP = m68ki_read_imm_32(); - REG_PC = m68ki_read_imm_32(); - m68ki_jump(REG_PC); + /* Read the initial stack pointer and program counter */ + m68ki_jump(0); + REG_SP = m68ki_read_imm_32(); + REG_PC = m68ki_read_imm_32(); + m68ki_jump(REG_PC); - CPU_RUN_MODE = RUN_MODE_NORMAL; + CPU_RUN_MODE = RUN_MODE_NORMAL; } /* Pulse the HALT line on the CPU */ void m68k_pulse_halt(void) { - CPU_STOPPED |= STOP_LEVEL_HALT; + CPU_STOPPED |= STOP_LEVEL_HALT; } @@ -978,18 +978,18 @@ void m68k_pulse_halt(void) /* This is to allow for multiple CPUs */ unsigned int m68k_context_size() { - return sizeof(m68ki_cpu_core); + return sizeof(m68ki_cpu_core); } unsigned int m68k_get_context(void* dst) { - if(dst) *(m68ki_cpu_core*)dst = m68ki_cpu; - return sizeof(m68ki_cpu_core); + if(dst) *(m68ki_cpu_core*)dst = m68ki_cpu; + return sizeof(m68ki_cpu_core); } void m68k_set_context(void* src) { - if(src) m68ki_cpu = *(m68ki_cpu_core*)src; + if(src) m68ki_cpu = *(m68ki_cpu_core*)src; } @@ -1001,49 +1001,49 @@ void m68k_set_context(void* src) #if M68K_COMPILE_FOR_MAME == OPT_ON static struct { - uint16 sr; - uint8 stopped; - uint8 halted; + uint16 sr; + uint8 stopped; + uint8 halted; } m68k_substate; static void m68k_prepare_substate(void) { - m68k_substate.sr = m68ki_get_sr(); - m68k_substate.stopped = (CPU_STOPPED & STOP_LEVEL_STOP) != 0; - m68k_substate.halted = (CPU_STOPPED & STOP_LEVEL_HALT) != 0; + m68k_substate.sr = m68ki_get_sr(); + m68k_substate.stopped = (CPU_STOPPED & STOP_LEVEL_STOP) != 0; + m68k_substate.halted = (CPU_STOPPED & STOP_LEVEL_HALT) != 0; } static void m68k_post_load(void) { - m68ki_set_sr_noint_nosp(m68k_substate.sr); - CPU_STOPPED = m68k_substate.stopped ? STOP_LEVEL_STOP : 0 - | m68k_substate.halted ? STOP_LEVEL_HALT : 0; - m68ki_jump(REG_PC); + m68ki_set_sr_noint_nosp(m68k_substate.sr); + CPU_STOPPED = m68k_substate.stopped ? STOP_LEVEL_STOP : 0 + | m68k_substate.halted ? STOP_LEVEL_HALT : 0; + m68ki_jump(REG_PC); } void m68k_state_register(const char *type, int index) { - /* Note, D covers A because the dar array is common, REG_A=REG_D+8 */ - state_save_register_item_array(type, index, REG_D); - state_save_register_item(type, index, REG_PPC); - state_save_register_item(type, index, REG_PC); - state_save_register_item(type, index, REG_USP); - state_save_register_item(type, index, REG_ISP); - state_save_register_item(type, index, REG_MSP); - state_save_register_item(type, index, REG_VBR); - state_save_register_item(type, index, REG_SFC); - state_save_register_item(type, index, REG_DFC); - state_save_register_item(type, index, REG_CACR); - state_save_register_item(type, index, REG_CAAR); - state_save_register_item(type, index, m68k_substate.sr); - state_save_register_item(type, index, CPU_INT_LEVEL); - state_save_register_item(type, index, CPU_INT_CYCLES); - state_save_register_item(type, index, m68k_substate.stopped); - state_save_register_item(type, index, m68k_substate.halted); - state_save_register_item(type, index, CPU_PREF_ADDR); - state_save_register_item(type, index, CPU_PREF_DATA); - state_save_register_func_presave(m68k_prepare_substate); - state_save_register_func_postload(m68k_post_load); + /* Note, D covers A because the dar array is common, REG_A=REG_D+8 */ + state_save_register_item_array(type, index, REG_D); + state_save_register_item(type, index, REG_PPC); + state_save_register_item(type, index, REG_PC); + state_save_register_item(type, index, REG_USP); + state_save_register_item(type, index, REG_ISP); + state_save_register_item(type, index, REG_MSP); + state_save_register_item(type, index, REG_VBR); + state_save_register_item(type, index, REG_SFC); + state_save_register_item(type, index, REG_DFC); + state_save_register_item(type, index, REG_CACR); + state_save_register_item(type, index, REG_CAAR); + state_save_register_item(type, index, m68k_substate.sr); + state_save_register_item(type, index, CPU_INT_LEVEL); + state_save_register_item(type, index, CPU_INT_CYCLES); + state_save_register_item(type, index, m68k_substate.stopped); + state_save_register_item(type, index, m68k_substate.halted); + state_save_register_item(type, index, CPU_PREF_ADDR); + state_save_register_item(type, index, CPU_PREF_DATA); + state_save_register_func_presave(m68k_prepare_substate); + state_save_register_func_postload(m68k_post_load); } #endif /* M68K_COMPILE_FOR_MAME */ diff --git a/source/m68k/m68kcpu.h b/source/m68k/m68kcpu.h index a446c71..569bc64 100644 --- a/source/m68k/m68kcpu.h +++ b/source/m68k/m68kcpu.h @@ -39,9 +39,9 @@ /* Check for > 32bit sizes */ #if UINT_MAX > 0xffffffff - #define M68K_INT_GT_32_BIT 1 + #define M68K_INT_GT_32_BIT 1 #else - #define M68K_INT_GT_32_BIT 0 + #define M68K_INT_GT_32_BIT 0 #endif /* Data types used in this emulation core */ @@ -56,12 +56,12 @@ #undef sint #undef uint -#define sint8 signed char /* ASG: changed from char to signed char */ +#define sint8 signed char /* ASG: changed from char to signed char */ #define sint16 signed short -#define sint32 signed int /* AWJ: changed from long to int */ +#define sint32 signed int /* AWJ: changed from long to int */ #define uint8 unsigned char #define uint16 unsigned short -#define uint32 unsigned int /* AWJ: changed from long to int */ +#define uint32 unsigned int /* AWJ: changed from long to int */ /* signed and unsigned int must be at least 32 bits wide */ #define sint signed int @@ -80,46 +80,46 @@ /* Allow for architectures that don't have 8-bit sizes */ #if UCHAR_MAX == 0xff - #define MAKE_INT_8(A) (sint8)(A) + #define MAKE_INT_8(A) (sint8)(A) #else - #undef sint8 - #define sint8 signed int - #undef uint8 - #define uint8 unsigned int - INLINE sint MAKE_INT_8(uint value) - { - return (value & 0x80) ? value | ~0xff : value & 0xff; - } + #undef sint8 + #define sint8 signed int + #undef uint8 + #define uint8 unsigned int + INLINE sint MAKE_INT_8(uint value) + { + return (value & 0x80) ? value | ~0xff : value & 0xff; + } #endif /* UCHAR_MAX == 0xff */ /* Allow for architectures that don't have 16-bit sizes */ #if USHRT_MAX == 0xffff - #define MAKE_INT_16(A) (sint16)(A) + #define MAKE_INT_16(A) (sint16)(A) #else - #undef sint16 - #define sint16 signed int - #undef uint16 - #define uint16 unsigned int - INLINE sint MAKE_INT_16(uint value) - { - return (value & 0x8000) ? value | ~0xffff : value & 0xffff; - } + #undef sint16 + #define sint16 signed int + #undef uint16 + #define uint16 unsigned int + INLINE sint MAKE_INT_16(uint value) + { + return (value & 0x8000) ? value | ~0xffff : value & 0xffff; + } #endif /* USHRT_MAX == 0xffff */ /* Allow for architectures that don't have 32-bit sizes */ #if UINT_MAX == 0xffffffff - #define MAKE_INT_32(A) (sint32)(A) + #define MAKE_INT_32(A) (sint32)(A) #else - #undef sint32 - #define sint32 signed int - #undef uint32 - #define uint32 unsigned int - INLINE sint MAKE_INT_32(uint value) - { - return (value & 0x80000000) ? value | ~0xffffffff : value & 0xffffffff; - } + #undef sint32 + #define sint32 signed int + #undef uint32 + #define uint32 unsigned int + INLINE sint MAKE_INT_32(uint value) + { + return (value & 0x80000000) ? value | ~0xffffffff : value & 0xffffffff; + } #endif /* UINT_MAX == 0xffffffff */ @@ -243,11 +243,11 @@ /* No need to mask if we are 32 bit */ #if M68K_INT_GT_32_BIT || M68K_USE_64_BIT - #define MASK_OUT_ABOVE_32(A) ((A) & 0xffffffff) - #define MASK_OUT_BELOW_32(A) ((A) & ~0xffffffff) + #define MASK_OUT_ABOVE_32(A) ((A) & 0xffffffff) + #define MASK_OUT_BELOW_32(A) ((A) & ~0xffffffff) #else - #define MASK_OUT_ABOVE_32(A) (A) - #define MASK_OUT_BELOW_32(A) 0 + #define MASK_OUT_ABOVE_32(A) (A) + #define MASK_OUT_BELOW_32(A) 0 #endif /* M68K_INT_GT_32_BIT || M68K_USE_64_BIT */ /* Simulate address lines of 68k family */ @@ -260,22 +260,22 @@ /* Some > 32-bit optimizations */ #if M68K_INT_GT_32_BIT - /* Shift left and right */ - #define LSR_32(A, C) ((A) >> (C)) - #define LSL_32(A, C) ((A) << (C)) + /* Shift left and right */ + #define LSR_32(A, C) ((A) >> (C)) + #define LSL_32(A, C) ((A) << (C)) #else - /* We have to do this because the morons at ANSI decided that shifts + /* We have to do this because the morons at ANSI decided that shifts * by >= data size are undefined. */ - #define LSR_32(A, C) ((C) < 32 ? (A) >> (C) : 0) - #define LSL_32(A, C) ((C) < 32 ? (A) << (C) : 0) + #define LSR_32(A, C) ((C) < 32 ? (A) >> (C) : 0) + #define LSL_32(A, C) ((C) < 32 ? (A) << (C) : 0) #endif /* M68K_INT_GT_32_BIT */ #if M68K_USE_64_BIT - #define LSL_32_64(A, C) ((A) << (C)) - #define LSR_32_64(A, C) ((A) >> (C)) - #define ROL_33_64(A, C) (LSL_32_64(A, C) | LSR_32_64(A, 33-(C))) - #define ROR_33_64(A, C) (LSR_32_64(A, C) | LSL_32_64(A, 33-(C))) + #define LSL_32_64(A, C) ((A) << (C)) + #define LSR_32_64(A, C) ((A) >> (C)) + #define ROL_33_64(A, C) (LSL_32_64(A, C) | LSR_32_64(A, 33-(C))) + #define ROR_33_64(A, C) (LSR_32_64(A, C) | LSL_32_64(A, 33-(C))) #endif /* M68K_USE_64_BIT */ #define ROL_8(A, C) MASK_OUT_ABOVE_8(LSL(A, C) | LSR(A, 8-(C))) @@ -302,7 +302,7 @@ #define REG_DA m68ki_cpu.dar /* easy access to data and address regs */ #define REG_D m68ki_cpu.dar #define REG_A (m68ki_cpu.dar+8) -#define REG_PPC m68ki_cpu.ppc +#define REG_PPC m68ki_cpu.ppc #define REG_PC m68ki_cpu.pc #define REG_SP_BASE m68ki_cpu.sp #define REG_USP m68ki_cpu.sp[0] @@ -373,49 +373,49 @@ /* Disable certain comparisons if we're not using all CPU types */ #if M68K_EMULATE_040 - #define CPU_TYPE_IS_040_PLUS(A) ((A) & CPU_TYPE_040) - #define CPU_TYPE_IS_040_LESS(A) 1 + #define CPU_TYPE_IS_040_PLUS(A) ((A) & CPU_TYPE_040) + #define CPU_TYPE_IS_040_LESS(A) 1 #else - #define CPU_TYPE_IS_040_PLUS(A) 0 - #define CPU_TYPE_IS_040_LESS(A) 1 + #define CPU_TYPE_IS_040_PLUS(A) 0 + #define CPU_TYPE_IS_040_LESS(A) 1 #endif #if M68K_EMULATE_020 - #define CPU_TYPE_IS_020_PLUS(A) ((A) & (CPU_TYPE_020 | CPU_TYPE_040)) - #define CPU_TYPE_IS_020_LESS(A) 1 + #define CPU_TYPE_IS_020_PLUS(A) ((A) & (CPU_TYPE_020 | CPU_TYPE_040)) + #define CPU_TYPE_IS_020_LESS(A) 1 #else - #define CPU_TYPE_IS_020_PLUS(A) 0 - #define CPU_TYPE_IS_020_LESS(A) 1 + #define CPU_TYPE_IS_020_PLUS(A) 0 + #define CPU_TYPE_IS_020_LESS(A) 1 #endif #if M68K_EMULATE_EC020 - #define CPU_TYPE_IS_EC020_PLUS(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)) - #define CPU_TYPE_IS_EC020_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020)) + #define CPU_TYPE_IS_EC020_PLUS(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)) + #define CPU_TYPE_IS_EC020_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020)) #else - #define CPU_TYPE_IS_EC020_PLUS(A) CPU_TYPE_IS_020_PLUS(A) - #define CPU_TYPE_IS_EC020_LESS(A) CPU_TYPE_IS_020_LESS(A) + #define CPU_TYPE_IS_EC020_PLUS(A) CPU_TYPE_IS_020_PLUS(A) + #define CPU_TYPE_IS_EC020_LESS(A) CPU_TYPE_IS_020_LESS(A) #endif #if M68K_EMULATE_010 - #define CPU_TYPE_IS_010(A) ((A) == CPU_TYPE_010) - #define CPU_TYPE_IS_010_PLUS(A) ((A) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)) - #define CPU_TYPE_IS_010_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010)) + #define CPU_TYPE_IS_010(A) ((A) == CPU_TYPE_010) + #define CPU_TYPE_IS_010_PLUS(A) ((A) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_040)) + #define CPU_TYPE_IS_010_LESS(A) ((A) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010)) #else - #define CPU_TYPE_IS_010(A) 0 - #define CPU_TYPE_IS_010_PLUS(A) CPU_TYPE_IS_EC020_PLUS(A) - #define CPU_TYPE_IS_010_LESS(A) CPU_TYPE_IS_EC020_LESS(A) + #define CPU_TYPE_IS_010(A) 0 + #define CPU_TYPE_IS_010_PLUS(A) CPU_TYPE_IS_EC020_PLUS(A) + #define CPU_TYPE_IS_010_LESS(A) CPU_TYPE_IS_EC020_LESS(A) #endif #if M68K_EMULATE_020 || M68K_EMULATE_EC020 - #define CPU_TYPE_IS_020_VARIANT(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020)) + #define CPU_TYPE_IS_020_VARIANT(A) ((A) & (CPU_TYPE_EC020 | CPU_TYPE_020)) #else - #define CPU_TYPE_IS_020_VARIANT(A) 0 + #define CPU_TYPE_IS_020_VARIANT(A) 0 #endif #if M68K_EMULATE_040 || M68K_EMULATE_020 || M68K_EMULATE_EC020 || M68K_EMULATE_010 - #define CPU_TYPE_IS_000(A) ((A) == CPU_TYPE_000 || (A) == CPU_TYPE_008) + #define CPU_TYPE_IS_000(A) ((A) == CPU_TYPE_000 || (A) == CPU_TYPE_008) #else - #define CPU_TYPE_IS_000(A) 1 + #define CPU_TYPE_IS_000(A) 1 #endif @@ -431,178 +431,178 @@ /* Enable or disable callback functions */ #if M68K_EMULATE_INT_ACK - #if M68K_EMULATE_INT_ACK == OPT_SPECIFY_HANDLER - #define m68ki_int_ack(A) M68K_INT_ACK_CALLBACK(A) - #else - #define m68ki_int_ack(A) CALLBACK_INT_ACK(A) - #endif + #if M68K_EMULATE_INT_ACK == OPT_SPECIFY_HANDLER + #define m68ki_int_ack(A) M68K_INT_ACK_CALLBACK(A) + #else + #define m68ki_int_ack(A) CALLBACK_INT_ACK(A) + #endif #else - /* Default action is to used autovector mode, which is most common */ - #define m68ki_int_ack(A) M68K_INT_ACK_AUTOVECTOR + /* Default action is to used autovector mode, which is most common */ + #define m68ki_int_ack(A) M68K_INT_ACK_AUTOVECTOR #endif /* M68K_EMULATE_INT_ACK */ #if M68K_EMULATE_BKPT_ACK - #if M68K_EMULATE_BKPT_ACK == OPT_SPECIFY_HANDLER - #define m68ki_bkpt_ack(A) M68K_BKPT_ACK_CALLBACK(A) - #else - #define m68ki_bkpt_ack(A) CALLBACK_BKPT_ACK(A) - #endif + #if M68K_EMULATE_BKPT_ACK == OPT_SPECIFY_HANDLER + #define m68ki_bkpt_ack(A) M68K_BKPT_ACK_CALLBACK(A) + #else + #define m68ki_bkpt_ack(A) CALLBACK_BKPT_ACK(A) + #endif #else - #define m68ki_bkpt_ack(A) + #define m68ki_bkpt_ack(A) #endif /* M68K_EMULATE_BKPT_ACK */ #if M68K_EMULATE_RESET - #if M68K_EMULATE_RESET == OPT_SPECIFY_HANDLER - #define m68ki_output_reset() M68K_RESET_CALLBACK() - #else - #define m68ki_output_reset() CALLBACK_RESET_INSTR() - #endif + #if M68K_EMULATE_RESET == OPT_SPECIFY_HANDLER + #define m68ki_output_reset() M68K_RESET_CALLBACK() + #else + #define m68ki_output_reset() CALLBACK_RESET_INSTR() + #endif #else - #define m68ki_output_reset() + #define m68ki_output_reset() #endif /* M68K_EMULATE_RESET */ #if M68K_CMPILD_HAS_CALLBACK - #if M68K_CMPILD_HAS_CALLBACK == OPT_SPECIFY_HANDLER - #define m68ki_cmpild_callback(v,r) M68K_CMPILD_CALLBACK(v,r) - #else - #define m68ki_cmpild_callback(v,r) CALLBACK_CMPILD_INSTR(v,r) - #endif + #if M68K_CMPILD_HAS_CALLBACK == OPT_SPECIFY_HANDLER + #define m68ki_cmpild_callback(v,r) M68K_CMPILD_CALLBACK(v,r) + #else + #define m68ki_cmpild_callback(v,r) CALLBACK_CMPILD_INSTR(v,r) + #endif #else - #define m68ki_cmpild_callback(v,r) + #define m68ki_cmpild_callback(v,r) #endif /* M68K_CMPILD_HAS_CALLBACK */ #if M68K_RTE_HAS_CALLBACK - #if M68K_RTE_HAS_CALLBACK == OPT_SPECIFY_HANDLER - #define m68ki_rte_callback() M68K_RTE_CALLBACK() - #else - #define m68ki_rte_callback() CALLBACK_RTE_INSTR() - #endif + #if M68K_RTE_HAS_CALLBACK == OPT_SPECIFY_HANDLER + #define m68ki_rte_callback() M68K_RTE_CALLBACK() + #else + #define m68ki_rte_callback() CALLBACK_RTE_INSTR() + #endif #else - #define m68ki_rte_callback() + #define m68ki_rte_callback() #endif /* M68K_RTE_HAS_CALLBACK */ #if M68K_TAS_HAS_CALLBACK - #if M68K_TAS_HAS_CALLBACK == OPT_SPECIFY_HANDLER - #define m68ki_tas_callback() M68K_TAS_CALLBACK() - #else - #define m68ki_tas_callback() CALLBACK_TAS_INSTR() - #endif + #if M68K_TAS_HAS_CALLBACK == OPT_SPECIFY_HANDLER + #define m68ki_tas_callback() M68K_TAS_CALLBACK() + #else + #define m68ki_tas_callback() CALLBACK_TAS_INSTR() + #endif #else - #define m68ki_tas_callback() 0 + #define m68ki_tas_callback() 0 #endif /* M68K_TAS_HAS_CALLBACK */ #if M68K_INSTRUCTION_HOOK - #if M68K_INSTRUCTION_HOOK == OPT_SPECIFY_HANDLER - #define m68ki_instr_hook(pc) M68K_INSTRUCTION_CALLBACK(pc) - #else - #define m68ki_instr_hook(pc) CALLBACK_INSTR_HOOK(pc) - #endif + #if M68K_INSTRUCTION_HOOK == OPT_SPECIFY_HANDLER + #define m68ki_instr_hook(pc) M68K_INSTRUCTION_CALLBACK(pc) + #else + #define m68ki_instr_hook(pc) CALLBACK_INSTR_HOOK(pc) + #endif #else - #define m68ki_instr_hook(pc) + #define m68ki_instr_hook(pc) #endif /* M68K_INSTRUCTION_HOOK */ #if M68K_MONITOR_PC - #if M68K_MONITOR_PC == OPT_SPECIFY_HANDLER - #define m68ki_pc_changed(A) M68K_SET_PC_CALLBACK(ADDRESS_68K(A)) - #else - #define m68ki_pc_changed(A) CALLBACK_PC_CHANGED(ADDRESS_68K(A)) - #endif + #if M68K_MONITOR_PC == OPT_SPECIFY_HANDLER + #define m68ki_pc_changed(A) M68K_SET_PC_CALLBACK(ADDRESS_68K(A)) + #else + #define m68ki_pc_changed(A) CALLBACK_PC_CHANGED(ADDRESS_68K(A)) + #endif #else - #define m68ki_pc_changed(A) + #define m68ki_pc_changed(A) #endif /* M68K_MONITOR_PC */ /* Enable or disable function code emulation */ #if M68K_EMULATE_FC - #if M68K_EMULATE_FC == OPT_SPECIFY_HANDLER - #define m68ki_set_fc(A) M68K_SET_FC_CALLBACK(A) - #else - #define m68ki_set_fc(A) CALLBACK_SET_FC(A) - #endif - #define m68ki_use_data_space() m68ki_address_space = FUNCTION_CODE_USER_DATA - #define m68ki_use_program_space() m68ki_address_space = FUNCTION_CODE_USER_PROGRAM - #define m68ki_get_address_space() m68ki_address_space + #if M68K_EMULATE_FC == OPT_SPECIFY_HANDLER + #define m68ki_set_fc(A) M68K_SET_FC_CALLBACK(A) + #else + #define m68ki_set_fc(A) CALLBACK_SET_FC(A) + #endif + #define m68ki_use_data_space() m68ki_address_space = FUNCTION_CODE_USER_DATA + #define m68ki_use_program_space() m68ki_address_space = FUNCTION_CODE_USER_PROGRAM + #define m68ki_get_address_space() m68ki_address_space #else - #define m68ki_set_fc(A) - #define m68ki_use_data_space() - #define m68ki_use_program_space() - #define m68ki_get_address_space() FUNCTION_CODE_USER_DATA + #define m68ki_set_fc(A) + #define m68ki_use_data_space() + #define m68ki_use_program_space() + #define m68ki_get_address_space() FUNCTION_CODE_USER_DATA #endif /* M68K_EMULATE_FC */ /* Enable or disable trace emulation */ #if M68K_EMULATE_TRACE - /* Initiates trace checking before each instruction (t1) */ - #define m68ki_trace_t1() m68ki_tracing = FLAG_T1 - /* adds t0 to trace checking if we encounter change of flow */ - #define m68ki_trace_t0() m68ki_tracing |= FLAG_T0 - /* Clear all tracing */ - #define m68ki_clear_trace() m68ki_tracing = 0 - /* Cause a trace exception if we are tracing */ - #define m68ki_exception_if_trace() if(m68ki_tracing) m68ki_exception_trace() + /* Initiates trace checking before each instruction (t1) */ + #define m68ki_trace_t1() m68ki_tracing = FLAG_T1 + /* adds t0 to trace checking if we encounter change of flow */ + #define m68ki_trace_t0() m68ki_tracing |= FLAG_T0 + /* Clear all tracing */ + #define m68ki_clear_trace() m68ki_tracing = 0 + /* Cause a trace exception if we are tracing */ + #define m68ki_exception_if_trace() if(m68ki_tracing) m68ki_exception_trace() #else - #define m68ki_trace_t1() - #define m68ki_trace_t0() - #define m68ki_clear_trace() - #define m68ki_exception_if_trace() + #define m68ki_trace_t1() + #define m68ki_trace_t0() + #define m68ki_clear_trace() + #define m68ki_exception_if_trace() #endif /* M68K_EMULATE_TRACE */ /* Address error */ #if M68K_EMULATE_ADDRESS_ERROR - #include - extern jmp_buf m68ki_aerr_trap; - extern int emulate_address_error; + #include + extern jmp_buf m68ki_aerr_trap; + extern int emulate_address_error; - #define m68ki_set_address_error_trap() \ - if(setjmp(m68ki_aerr_trap) != 0) \ - { \ - m68ki_exception_address_error(); \ - if(CPU_STOPPED) \ - { \ - SET_CYCLES(0); \ - CPU_INT_CYCLES = 0; \ - return m68ki_initial_cycles; \ - } \ - } + #define m68ki_set_address_error_trap() \ + if(setjmp(m68ki_aerr_trap) != 0) \ + { \ + m68ki_exception_address_error(); \ + if(CPU_STOPPED) \ + { \ + SET_CYCLES(0); \ + CPU_INT_CYCLES = 0; \ + return m68ki_initial_cycles; \ + } \ + } - #define m68ki_check_address_error(ADDR, WRITE_MODE, FC) \ - if(((ADDR)&1) && emulate_address_error)\ - { \ - m68ki_aerr_address = ADDR; \ - m68ki_aerr_write_mode = WRITE_MODE; \ - m68ki_aerr_fc = FC; \ - longjmp(m68ki_aerr_trap, 1); \ - } + #define m68ki_check_address_error(ADDR, WRITE_MODE, FC) \ + if(((ADDR)&1) && emulate_address_error)\ + { \ + m68ki_aerr_address = ADDR; \ + m68ki_aerr_write_mode = WRITE_MODE; \ + m68ki_aerr_fc = FC; \ + longjmp(m68ki_aerr_trap, 1); \ + } - #define m68ki_check_address_error_010_less(ADDR, WRITE_MODE, FC) \ - if (CPU_TYPE_IS_010_LESS(CPU_TYPE)) \ - { \ - m68ki_check_address_error(ADDR, WRITE_MODE, FC) \ - } + #define m68ki_check_address_error_010_less(ADDR, WRITE_MODE, FC) \ + if (CPU_TYPE_IS_010_LESS(CPU_TYPE)) \ + { \ + m68ki_check_address_error(ADDR, WRITE_MODE, FC) \ + } #else - #define m68ki_set_address_error_trap() - #define m68ki_check_address_error(ADDR, WRITE_MODE, FC) - #define m68ki_check_address_error_010_less(ADDR, WRITE_MODE, FC) + #define m68ki_set_address_error_trap() + #define m68ki_check_address_error(ADDR, WRITE_MODE, FC) + #define m68ki_check_address_error_010_less(ADDR, WRITE_MODE, FC) #endif /* M68K_ADDRESS_ERROR */ /* Logging */ #if M68K_LOG_ENABLE - #include - extern FILE* M68K_LOG_FILEHANDLE - extern const char *const m68ki_cpu_names[]; + #include + extern FILE* M68K_LOG_FILEHANDLE + extern const char *const m68ki_cpu_names[]; - #define M68K_DO_LOG(A) if(M68K_LOG_FILEHANDLE) fprintf A - #if M68K_LOG_1010_1111 - #define M68K_DO_LOG_EMU(A) if(M68K_LOG_FILEHANDLE) fprintf A - #else - #define M68K_DO_LOG_EMU(A) - #endif + #define M68K_DO_LOG(A) if(M68K_LOG_FILEHANDLE) fprintf A + #if M68K_LOG_1010_1111 + #define M68K_DO_LOG_EMU(A) if(M68K_LOG_FILEHANDLE) fprintf A + #else + #define M68K_DO_LOG_EMU(A) + #endif #else - #define M68K_DO_LOG(A) - #define M68K_DO_LOG_EMU(A) + #define M68K_DO_LOG(A) + #define M68K_DO_LOG_EMU(A) #endif @@ -685,11 +685,11 @@ #define CFLAG_16(A) ((A)>>8) #if M68K_INT_GT_32_BIT - #define CFLAG_ADD_32(S, D, R) ((R)>>24) - #define CFLAG_SUB_32(S, D, R) ((R)>>24) + #define CFLAG_ADD_32(S, D, R) ((R)>>24) + #define CFLAG_SUB_32(S, D, R) ((R)>>24) #else - #define CFLAG_ADD_32(S, D, R) (((S & D) | (~R & (S | D)))>>23) - #define CFLAG_SUB_32(S, D, R) (((S & R) | (~D & (S | R)))>>23) + #define CFLAG_ADD_32(S, D, R) (((S & D) | (~R & (S | D)))>>23) + #define CFLAG_SUB_32(S, D, R) (((S & R) | (~D & (S | R)))>>23) #endif /* M68K_INT_GT_32_BIT */ #define VFLAG_ADD_8(S, D, R) ((S^R) & (D^R)) @@ -774,18 +774,18 @@ /* Get the condition code register */ #define m68ki_get_ccr() ((COND_XS() >> 4) | \ - (COND_MI() >> 4) | \ - (COND_EQ() << 2) | \ - (COND_VS() >> 6) | \ - (COND_CS() >> 8)) + (COND_MI() >> 4) | \ + (COND_EQ() << 2) | \ + (COND_VS() >> 6) | \ + (COND_CS() >> 8)) /* Get the status register */ #define m68ki_get_sr() ( FLAG_T1 | \ - FLAG_T0 | \ - (FLAG_S << 11) | \ - (FLAG_M << 11) | \ - FLAG_INT_MASK | \ - m68ki_get_ccr()) + FLAG_T0 | \ + (FLAG_S << 11) | \ + (FLAG_M << 11) | \ + FLAG_INT_MASK | \ + m68ki_get_ccr()) @@ -826,14 +826,14 @@ #define m68ki_read_pcrel_32(A) m68k_read_pcrelative_32(A) /* Read from the program space */ -#define m68ki_read_program_8(A) m68ki_read_8_fc(A, FLAG_S | FUNCTION_CODE_USER_PROGRAM) -#define m68ki_read_program_16(A) m68ki_read_16_fc(A, FLAG_S | FUNCTION_CODE_USER_PROGRAM) -#define m68ki_read_program_32(A) m68ki_read_32_fc(A, FLAG_S | FUNCTION_CODE_USER_PROGRAM) +#define m68ki_read_program_8(A) m68ki_read_8_fc(A, FLAG_S | FUNCTION_CODE_USER_PROGRAM) +#define m68ki_read_program_16(A) m68ki_read_16_fc(A, FLAG_S | FUNCTION_CODE_USER_PROGRAM) +#define m68ki_read_program_32(A) m68ki_read_32_fc(A, FLAG_S | FUNCTION_CODE_USER_PROGRAM) /* Read from the data space */ -#define m68ki_read_data_8(A) m68ki_read_8_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA) -#define m68ki_read_data_16(A) m68ki_read_16_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA) -#define m68ki_read_data_32(A) m68ki_read_32_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA) +#define m68ki_read_data_8(A) m68ki_read_8_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA) +#define m68ki_read_data_16(A) m68ki_read_16_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA) +#define m68ki_read_data_32(A) m68ki_read_32_fc(A, FLAG_S | FUNCTION_CODE_USER_DATA) @@ -843,70 +843,70 @@ typedef union { - uint64 i; - double f; + uint64 i; + double f; } fp_reg; typedef struct { - uint cpu_type; /* CPU Type: 68000, 68008, 68010, 68EC020, or 68020 */ - uint dar[16]; /* Data and Address Registers */ - uint ppc; /* Previous program counter */ - uint pc; /* Program Counter */ - uint sp[7]; /* User, Interrupt, and Master Stack Pointers */ - uint vbr; /* Vector Base Register (m68010+) */ - uint sfc; /* Source Function Code Register (m68010+) */ - uint dfc; /* Destination Function Code Register (m68010+) */ - uint cacr; /* Cache Control Register (m68020, unemulated) */ - uint caar; /* Cache Address Register (m68020, unemulated) */ - uint ir; /* Instruction Register */ + uint cpu_type; /* CPU Type: 68000, 68008, 68010, 68EC020, or 68020 */ + uint dar[16]; /* Data and Address Registers */ + uint ppc; /* Previous program counter */ + uint pc; /* Program Counter */ + uint sp[7]; /* User, Interrupt, and Master Stack Pointers */ + uint vbr; /* Vector Base Register (m68010+) */ + uint sfc; /* Source Function Code Register (m68010+) */ + uint dfc; /* Destination Function Code Register (m68010+) */ + uint cacr; /* Cache Control Register (m68020, unemulated) */ + uint caar; /* Cache Address Register (m68020, unemulated) */ + uint ir; /* Instruction Register */ fp_reg fpr[8]; /* FPU Data Register (m68040) */ - uint fpiar; /* FPU Instruction Address Register (m68040) */ - uint fpsr; /* FPU Status Register (m68040) */ - uint fpcr; /* FPU Control Register (m68040) */ - uint t1_flag; /* Trace 1 */ - uint t0_flag; /* Trace 0 */ - uint s_flag; /* Supervisor */ - uint m_flag; /* Master/Interrupt state */ - uint x_flag; /* Extend */ - uint n_flag; /* Negative */ - uint not_z_flag; /* Zero, inverted for speedups */ - uint v_flag; /* Overflow */ - uint c_flag; /* Carry */ - uint int_mask; /* I0-I2 */ - uint int_level; /* State of interrupt pins IPL0-IPL2 -- ASG: changed from ints_pending */ - uint int_cycles; /* ASG: extra cycles from generated interrupts */ - uint stopped; /* Stopped state */ - uint pref_addr; /* Last prefetch address */ - uint pref_data; /* Data in the prefetch queue */ - uint address_mask; /* Available address pins */ - uint sr_mask; /* Implemented status register bits */ - uint instr_mode; /* Stores whether we are in instruction mode or group 0/1 exception mode */ - uint run_mode; /* Stores whether we are processing a reset, bus error, address error, or something else */ + uint fpiar; /* FPU Instruction Address Register (m68040) */ + uint fpsr; /* FPU Status Register (m68040) */ + uint fpcr; /* FPU Control Register (m68040) */ + uint t1_flag; /* Trace 1 */ + uint t0_flag; /* Trace 0 */ + uint s_flag; /* Supervisor */ + uint m_flag; /* Master/Interrupt state */ + uint x_flag; /* Extend */ + uint n_flag; /* Negative */ + uint not_z_flag; /* Zero, inverted for speedups */ + uint v_flag; /* Overflow */ + uint c_flag; /* Carry */ + uint int_mask; /* I0-I2 */ + uint int_level; /* State of interrupt pins IPL0-IPL2 -- ASG: changed from ints_pending */ + uint int_cycles; /* ASG: extra cycles from generated interrupts */ + uint stopped; /* Stopped state */ + uint pref_addr; /* Last prefetch address */ + uint pref_data; /* Data in the prefetch queue */ + uint address_mask; /* Available address pins */ + uint sr_mask; /* Implemented status register bits */ + uint instr_mode; /* Stores whether we are in instruction mode or group 0/1 exception mode */ + uint run_mode; /* Stores whether we are processing a reset, bus error, address error, or something else */ - /* Clocks required for instructions / exceptions */ - uint cyc_bcc_notake_b; - uint cyc_bcc_notake_w; - uint cyc_dbcc_f_noexp; - uint cyc_dbcc_f_exp; - uint cyc_scc_r_true; - uint cyc_movem_w; - uint cyc_movem_l; - uint cyc_shift; - uint cyc_reset; - const uint8* cyc_instruction; - const uint8* cyc_exception; + /* Clocks required for instructions / exceptions */ + uint cyc_bcc_notake_b; + uint cyc_bcc_notake_w; + uint cyc_dbcc_f_noexp; + uint cyc_dbcc_f_exp; + uint cyc_scc_r_true; + uint cyc_movem_w; + uint cyc_movem_l; + uint cyc_shift; + uint cyc_reset; + const uint8* cyc_instruction; + const uint8* cyc_exception; - /* Callbacks to host */ - int (*int_ack_callback)(int int_line); /* Interrupt Acknowledge */ - void (*bkpt_ack_callback)(unsigned int data); /* Breakpoint Acknowledge */ - void (*reset_instr_callback)(void); /* Called when a RESET instruction is encountered */ - void (*cmpild_instr_callback)(unsigned int, int); /* Called when a CMPI.L #v, Dn instruction is encountered */ - void (*rte_instr_callback)(void); /* Called when a RTE instruction is encountered */ - int (*tas_instr_callback)(void); /* Called when a TAS instruction is encountered, allows / disallows writeback */ - void (*pc_changed_callback)(unsigned int new_pc); /* Called when the PC changes by a large amount */ - void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */ - void (*instr_hook_callback)(unsigned int pc); /* Called every instruction cycle prior to execution */ + /* Callbacks to host */ + int (*int_ack_callback)(int int_line); /* Interrupt Acknowledge */ + void (*bkpt_ack_callback)(unsigned int data); /* Breakpoint Acknowledge */ + void (*reset_instr_callback)(void); /* Called when a RESET instruction is encountered */ + void (*cmpild_instr_callback)(unsigned int, int); /* Called when a CMPI.L #v, Dn instruction is encountered */ + void (*rte_instr_callback)(void); /* Called when a RTE instruction is encountered */ + int (*tas_instr_callback)(void); /* Called when a TAS instruction is encountered, allows / disallows writeback */ + void (*pc_changed_callback)(unsigned int new_pc); /* Called when the PC changes by a large amount */ + void (*set_fc_callback)(unsigned int new_fc); /* Called when the CPU function code changes */ + void (*instr_hook_callback)(unsigned int pc); /* Called every instruction cycle prior to execution */ } m68ki_cpu_core; @@ -1057,49 +1057,49 @@ char* m68ki_disassemble_quick(unsigned int pc, unsigned int cpu_type); */ INLINE uint m68ki_read_imm_16(void) { - m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ - m68ki_check_address_error(REG_PC, MODE_READ, FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ + m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ + m68ki_check_address_error(REG_PC, MODE_READ, FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ #if M68K_EMULATE_PREFETCH - if(MASK_OUT_BELOW_2(REG_PC) != CPU_PREF_ADDR) - { - CPU_PREF_ADDR = MASK_OUT_BELOW_2(REG_PC); - CPU_PREF_DATA = m68k_read_immediate_32(ADDRESS_68K(CPU_PREF_ADDR)); - } - REG_PC += 2; - return MASK_OUT_ABOVE_16(CPU_PREF_DATA >> ((2-((REG_PC-2)&2))<<3)); + if(MASK_OUT_BELOW_2(REG_PC) != CPU_PREF_ADDR) + { + CPU_PREF_ADDR = MASK_OUT_BELOW_2(REG_PC); + CPU_PREF_DATA = m68k_read_immediate_32(ADDRESS_68K(CPU_PREF_ADDR)); + } + REG_PC += 2; + return MASK_OUT_ABOVE_16(CPU_PREF_DATA >> ((2-((REG_PC-2)&2))<<3)); #else - REG_PC += 2; - return m68k_read_immediate_16(ADDRESS_68K(REG_PC-2)); + REG_PC += 2; + return m68k_read_immediate_16(ADDRESS_68K(REG_PC-2)); #endif /* M68K_EMULATE_PREFETCH */ } INLINE uint m68ki_read_imm_32(void) { #if M68K_EMULATE_PREFETCH - uint temp_val; + uint temp_val; - m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ - m68ki_check_address_error(REG_PC, MODE_READ, FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ - if(MASK_OUT_BELOW_2(REG_PC) != CPU_PREF_ADDR) - { - CPU_PREF_ADDR = MASK_OUT_BELOW_2(REG_PC); - CPU_PREF_DATA = m68k_read_immediate_32(ADDRESS_68K(CPU_PREF_ADDR)); - } - temp_val = CPU_PREF_DATA; - REG_PC += 2; - if(MASK_OUT_BELOW_2(REG_PC) != CPU_PREF_ADDR) - { - CPU_PREF_ADDR = MASK_OUT_BELOW_2(REG_PC); - CPU_PREF_DATA = m68k_read_immediate_32(ADDRESS_68K(CPU_PREF_ADDR)); - temp_val = MASK_OUT_ABOVE_32((temp_val << 16) | (CPU_PREF_DATA >> 16)); - } - REG_PC += 2; + m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ + m68ki_check_address_error(REG_PC, MODE_READ, FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ + if(MASK_OUT_BELOW_2(REG_PC) != CPU_PREF_ADDR) + { + CPU_PREF_ADDR = MASK_OUT_BELOW_2(REG_PC); + CPU_PREF_DATA = m68k_read_immediate_32(ADDRESS_68K(CPU_PREF_ADDR)); + } + temp_val = CPU_PREF_DATA; + REG_PC += 2; + if(MASK_OUT_BELOW_2(REG_PC) != CPU_PREF_ADDR) + { + CPU_PREF_ADDR = MASK_OUT_BELOW_2(REG_PC); + CPU_PREF_DATA = m68k_read_immediate_32(ADDRESS_68K(CPU_PREF_ADDR)); + temp_val = MASK_OUT_ABOVE_32((temp_val << 16) | (CPU_PREF_DATA >> 16)); + } + REG_PC += 2; - return temp_val; + return temp_val; #else - m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ - m68ki_check_address_error(REG_PC, MODE_READ, FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ - REG_PC += 4; - return m68k_read_immediate_32(ADDRESS_68K(REG_PC-4)); + m68ki_set_fc(FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ + m68ki_check_address_error(REG_PC, MODE_READ, FLAG_S | FUNCTION_CODE_USER_PROGRAM); /* auto-disable (see m68kcpu.h) */ + REG_PC += 4; + return m68k_read_immediate_32(ADDRESS_68K(REG_PC-4)); #endif /* M68K_EMULATE_PREFETCH */ } @@ -1115,7 +1115,7 @@ INLINE uint m68ki_read_imm_32(void) */ INLINE uint m68ki_read_8_fc(uint address, uint fc) { - m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ + m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ _m68k_memory_map *temp = &m68k_memory_map[((address)>>16)&0xff]; @@ -1124,8 +1124,8 @@ INLINE uint m68ki_read_8_fc(uint address, uint fc) } INLINE uint m68ki_read_16_fc(uint address, uint fc) { - m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ - m68ki_check_address_error_010_less(address, MODE_READ, fc); /* auto-disable (see m68kcpu.h) */ + m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ + m68ki_check_address_error_010_less(address, MODE_READ, fc); /* auto-disable (see m68kcpu.h) */ _m68k_memory_map *temp = &m68k_memory_map[((address)>>16)&0xff]; if (temp->read16) return (*temp->read16)(address); @@ -1133,8 +1133,8 @@ INLINE uint m68ki_read_16_fc(uint address, uint fc) } INLINE uint m68ki_read_32_fc(uint address, uint fc) { - m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ - m68ki_check_address_error_010_less(address, MODE_READ, fc); /* auto-disable (see m68kcpu.h) */ + m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ + m68ki_check_address_error_010_less(address, MODE_READ, fc); /* auto-disable (see m68kcpu.h) */ _m68k_memory_map *temp = &m68k_memory_map[((address)>>16)&0xff]; if (temp->read16) return ((*temp->read16)(address) << 16) | ((*temp->read16)(address + 2)); @@ -1143,23 +1143,23 @@ INLINE uint m68ki_read_32_fc(uint address, uint fc) INLINE void m68ki_write_8_fc(uint address, uint fc, uint value) { - m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ + m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ _m68k_memory_map *temp = &m68k_memory_map[((address)>>16)&0xff]; if (temp->write8) (*temp->write8)(address,value); else WRITE_BYTE(temp->base, (address) & 0xffff, value); } INLINE void m68ki_write_16_fc(uint address, uint fc, uint value) { - m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ - m68ki_check_address_error_010_less(address, MODE_WRITE, fc); /* auto-disable (see m68kcpu.h) */ + m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ + m68ki_check_address_error_010_less(address, MODE_WRITE, fc); /* auto-disable (see m68kcpu.h) */ _m68k_memory_map *temp = &m68k_memory_map[((address)>>16)&0xff]; if (temp->write16) (*temp->write16)(address,value); else *(uint16 *)(temp->base + ((address) & 0xffff)) = value; } INLINE void m68ki_write_32_fc(uint address, uint fc, uint value) { - m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ - m68ki_check_address_error_010_less(address, MODE_WRITE, fc); /* auto-disable (see m68kcpu.h) */ + m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ + m68ki_check_address_error_010_less(address, MODE_WRITE, fc); /* auto-disable (see m68kcpu.h) */ _m68k_memory_map *temp = &m68k_memory_map[((address)>>16)&0xff]; if (temp->write16) { @@ -1177,9 +1177,9 @@ INLINE void m68ki_write_32_fc(uint address, uint fc, uint value) #if M68K_SIMULATE_PD_WRITES INLINE void m68ki_write_32_pd_fc(uint address, uint fc, uint value) { - m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ - m68ki_check_address_error_010_less(address, MODE_WRITE, fc); /* auto-disable (see m68kcpu.h) */ - m68k_write_memory_32_pd(ADDRESS_68K(address), value); + m68ki_set_fc(fc); /* auto-disable (see m68kcpu.h) */ + m68ki_check_address_error_010_less(address, MODE_WRITE, fc); /* auto-disable (see m68kcpu.h) */ + m68k_write_memory_32_pd(ADDRESS_68K(address), value); } #endif @@ -1191,16 +1191,16 @@ INLINE void m68ki_write_32_pd_fc(uint address, uint fc, uint value) */ INLINE uint m68ki_get_ea_pcdi(void) { - uint old_pc = REG_PC; - m68ki_use_program_space(); /* auto-disable */ - return old_pc + MAKE_INT_16(m68ki_read_imm_16()); + uint old_pc = REG_PC; + m68ki_use_program_space(); /* auto-disable */ + return old_pc + MAKE_INT_16(m68ki_read_imm_16()); } INLINE uint m68ki_get_ea_pcix(void) { - m68ki_use_program_space(); /* auto-disable */ - return m68ki_get_ea_ix(REG_PC); + m68ki_use_program_space(); /* auto-disable */ + return m68ki_get_ea_ix(REG_PC); } /* Indexed addressing modes are encoded as follows: @@ -1247,73 +1247,73 @@ INLINE uint m68ki_get_ea_pcix(void) */ INLINE uint m68ki_get_ea_ix(uint An) { - /* An = base register */ - uint extension = m68ki_read_imm_16(); - uint Xn = 0; /* Index register */ - uint bd = 0; /* Base Displacement */ - uint od = 0; /* Outer Displacement */ + /* An = base register */ + uint extension = m68ki_read_imm_16(); + uint Xn = 0; /* Index register */ + uint bd = 0; /* Base Displacement */ + uint od = 0; /* Outer Displacement */ - if(CPU_TYPE_IS_010_LESS(CPU_TYPE)) - { - /* Calculate index */ - Xn = REG_DA[extension>>12]; /* Xn */ - if(!BIT_B(extension)) /* W/L */ - Xn = MAKE_INT_16(Xn); + if(CPU_TYPE_IS_010_LESS(CPU_TYPE)) + { + /* Calculate index */ + Xn = REG_DA[extension>>12]; /* Xn */ + if(!BIT_B(extension)) /* W/L */ + Xn = MAKE_INT_16(Xn); - /* Add base register and displacement and return */ - return An + Xn + MAKE_INT_8(extension); - } + /* Add base register and displacement and return */ + return An + Xn + MAKE_INT_8(extension); + } - /* Brief extension format */ - if(!BIT_8(extension)) - { - /* Calculate index */ - Xn = REG_DA[extension>>12]; /* Xn */ - if(!BIT_B(extension)) /* W/L */ - Xn = MAKE_INT_16(Xn); - /* Add scale if proper CPU type */ - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - Xn <<= (extension>>9) & 3; /* SCALE */ + /* Brief extension format */ + if(!BIT_8(extension)) + { + /* Calculate index */ + Xn = REG_DA[extension>>12]; /* Xn */ + if(!BIT_B(extension)) /* W/L */ + Xn = MAKE_INT_16(Xn); + /* Add scale if proper CPU type */ + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + Xn <<= (extension>>9) & 3; /* SCALE */ - /* Add base register and displacement and return */ - return An + Xn + MAKE_INT_8(extension); - } + /* Add base register and displacement and return */ + return An + Xn + MAKE_INT_8(extension); + } - /* Full extension format */ + /* Full extension format */ - USE_CYCLES(m68ki_ea_idx_cycle_table[extension&0x3f]); + USE_CYCLES(m68ki_ea_idx_cycle_table[extension&0x3f]); - /* Check if base register is present */ - if(BIT_7(extension)) /* BS */ - An = 0; /* An */ + /* Check if base register is present */ + if(BIT_7(extension)) /* BS */ + An = 0; /* An */ - /* Check if index is present */ - if(!BIT_6(extension)) /* IS */ - { - Xn = REG_DA[extension>>12]; /* Xn */ - if(!BIT_B(extension)) /* W/L */ - Xn = MAKE_INT_16(Xn); - Xn <<= (extension>>9) & 3; /* SCALE */ - } + /* Check if index is present */ + if(!BIT_6(extension)) /* IS */ + { + Xn = REG_DA[extension>>12]; /* Xn */ + if(!BIT_B(extension)) /* W/L */ + Xn = MAKE_INT_16(Xn); + Xn <<= (extension>>9) & 3; /* SCALE */ + } - /* Check if base displacement is present */ - if(BIT_5(extension)) /* BD SIZE */ - bd = BIT_4(extension) ? m68ki_read_imm_32() : MAKE_INT_16(m68ki_read_imm_16()); + /* Check if base displacement is present */ + if(BIT_5(extension)) /* BD SIZE */ + bd = BIT_4(extension) ? m68ki_read_imm_32() : MAKE_INT_16(m68ki_read_imm_16()); - /* If no indirect action, we are done */ - if(!(extension&7)) /* No Memory Indirect */ - return An + bd + Xn; + /* If no indirect action, we are done */ + if(!(extension&7)) /* No Memory Indirect */ + return An + bd + Xn; - /* Check if outer displacement is present */ - if(BIT_1(extension)) /* I/IS: od */ - od = BIT_0(extension) ? m68ki_read_imm_32() : MAKE_INT_16(m68ki_read_imm_16()); + /* Check if outer displacement is present */ + if(BIT_1(extension)) /* I/IS: od */ + od = BIT_0(extension) ? m68ki_read_imm_32() : MAKE_INT_16(m68ki_read_imm_16()); - /* Postindex */ - if(BIT_2(extension)) /* I/IS: 0 = preindex, 1 = postindex */ - return m68ki_read_32(An + bd) + Xn + od; + /* Postindex */ + if(BIT_2(extension)) /* I/IS: 0 = preindex, 1 = postindex */ + return m68ki_read_32(An + bd) + Xn + od; - /* Preindex */ - return m68ki_read_32(An + bd + Xn) + od; + /* Preindex */ + return m68ki_read_32(An + bd + Xn) + od; } @@ -1373,26 +1373,26 @@ INLINE uint OPER_PCIX_32(void) {uint ea = EA_PCIX_32(); return m68ki_read_pcre /* Push/pull data from the stack */ INLINE void m68ki_push_16(uint value) { - REG_SP = MASK_OUT_ABOVE_32(REG_SP - 2); - m68ki_write_16(REG_SP, value); + REG_SP = MASK_OUT_ABOVE_32(REG_SP - 2); + m68ki_write_16(REG_SP, value); } INLINE void m68ki_push_32(uint value) { - REG_SP = MASK_OUT_ABOVE_32(REG_SP - 4); - m68ki_write_32(REG_SP, value); + REG_SP = MASK_OUT_ABOVE_32(REG_SP - 4); + m68ki_write_32(REG_SP, value); } INLINE uint m68ki_pull_16(void) { - REG_SP = MASK_OUT_ABOVE_32(REG_SP + 2); - return m68ki_read_16(REG_SP-2); + REG_SP = MASK_OUT_ABOVE_32(REG_SP + 2); + return m68ki_read_16(REG_SP-2); } INLINE uint m68ki_pull_32(void) { - REG_SP = MASK_OUT_ABOVE_32(REG_SP + 4); - return m68ki_read_32(REG_SP-4); + REG_SP = MASK_OUT_ABOVE_32(REG_SP + 4); + return m68ki_read_32(REG_SP-4); } @@ -1401,22 +1401,22 @@ INLINE uint m68ki_pull_32(void) */ INLINE void m68ki_fake_push_16(void) { - REG_SP = MASK_OUT_ABOVE_32(REG_SP - 2); + REG_SP = MASK_OUT_ABOVE_32(REG_SP - 2); } INLINE void m68ki_fake_push_32(void) { - REG_SP = MASK_OUT_ABOVE_32(REG_SP - 4); + REG_SP = MASK_OUT_ABOVE_32(REG_SP - 4); } INLINE void m68ki_fake_pull_16(void) { - REG_SP = MASK_OUT_ABOVE_32(REG_SP + 2); + REG_SP = MASK_OUT_ABOVE_32(REG_SP + 2); } INLINE void m68ki_fake_pull_32(void) { - REG_SP = MASK_OUT_ABOVE_32(REG_SP + 4); + REG_SP = MASK_OUT_ABOVE_32(REG_SP + 4); } @@ -1428,15 +1428,15 @@ INLINE void m68ki_fake_pull_32(void) */ INLINE void m68ki_jump(uint new_pc) { - REG_PC = new_pc; - m68ki_pc_changed(REG_PC); + REG_PC = new_pc; + m68ki_pc_changed(REG_PC); } INLINE void m68ki_jump_vector(uint vector) { - REG_PC = (vector<<2) + REG_VBR; - REG_PC = m68ki_read_data_32(REG_PC); - m68ki_pc_changed(REG_PC); + REG_PC = (vector<<2) + REG_VBR; + REG_PC = m68ki_read_data_32(REG_PC); + m68ki_pc_changed(REG_PC); } @@ -1447,18 +1447,18 @@ INLINE void m68ki_jump_vector(uint vector) */ INLINE void m68ki_branch_8(uint offset) { - REG_PC += MAKE_INT_8(offset); + REG_PC += MAKE_INT_8(offset); } INLINE void m68ki_branch_16(uint offset) { - REG_PC += MAKE_INT_16(offset); + REG_PC += MAKE_INT_16(offset); } INLINE void m68ki_branch_32(uint offset) { - REG_PC += offset; - m68ki_pc_changed(REG_PC); + REG_PC += offset; + m68ki_pc_changed(REG_PC); } @@ -1470,12 +1470,12 @@ INLINE void m68ki_branch_32(uint offset) */ INLINE void m68ki_set_s_flag(uint value) { - /* Backup the old stack pointer */ - REG_SP_BASE[FLAG_S | ((FLAG_S>>1) & FLAG_M)] = REG_SP; - /* Set the S flag */ - FLAG_S = value; - /* Set the new stack pointer */ - REG_SP = REG_SP_BASE[FLAG_S | ((FLAG_S>>1) & FLAG_M)]; + /* Backup the old stack pointer */ + REG_SP_BASE[FLAG_S | ((FLAG_S>>1) & FLAG_M)] = REG_SP; + /* Set the S flag */ + FLAG_S = value; + /* Set the new stack pointer */ + REG_SP = REG_SP_BASE[FLAG_S | ((FLAG_S>>1) & FLAG_M)]; } /* Set the S and M flags and change the active stack pointer. @@ -1483,46 +1483,46 @@ INLINE void m68ki_set_s_flag(uint value) */ INLINE void m68ki_set_sm_flag(uint value) { - /* Backup the old stack pointer */ - REG_SP_BASE[FLAG_S | ((FLAG_S>>1) & FLAG_M)] = REG_SP; - /* Set the S and M flags */ - FLAG_S = value & SFLAG_SET; - FLAG_M = value & MFLAG_SET; - /* Set the new stack pointer */ - REG_SP = REG_SP_BASE[FLAG_S | ((FLAG_S>>1) & FLAG_M)]; + /* Backup the old stack pointer */ + REG_SP_BASE[FLAG_S | ((FLAG_S>>1) & FLAG_M)] = REG_SP; + /* Set the S and M flags */ + FLAG_S = value & SFLAG_SET; + FLAG_M = value & MFLAG_SET; + /* Set the new stack pointer */ + REG_SP = REG_SP_BASE[FLAG_S | ((FLAG_S>>1) & FLAG_M)]; } /* Set the S and M flags. Don't touch the stack pointer. */ INLINE void m68ki_set_sm_flag_nosp(uint value) { - /* Set the S and M flags */ - FLAG_S = value & SFLAG_SET; - FLAG_M = value & MFLAG_SET; + /* Set the S and M flags */ + FLAG_S = value & SFLAG_SET; + FLAG_M = value & MFLAG_SET; } /* Set the condition code register */ INLINE void m68ki_set_ccr(uint value) { - FLAG_X = BIT_4(value) << 4; - FLAG_N = BIT_3(value) << 4; - FLAG_Z = !BIT_2(value); - FLAG_V = BIT_1(value) << 6; - FLAG_C = BIT_0(value) << 8; + FLAG_X = BIT_4(value) << 4; + FLAG_N = BIT_3(value) << 4; + FLAG_Z = !BIT_2(value); + FLAG_V = BIT_1(value) << 6; + FLAG_C = BIT_0(value) << 8; } /* Set the status register but don't check for interrupts */ INLINE void m68ki_set_sr_noint(uint value) { - /* Mask out the "unimplemented" bits */ - value &= CPU_SR_MASK; + /* Mask out the "unimplemented" bits */ + value &= CPU_SR_MASK; - /* Now set the status register */ - FLAG_T1 = BIT_F(value); - FLAG_T0 = BIT_E(value); - FLAG_INT_MASK = value & 0x0700; - m68ki_set_ccr(value); - m68ki_set_sm_flag((value >> 11) & 6); + /* Now set the status register */ + FLAG_T1 = BIT_F(value); + FLAG_T0 = BIT_E(value); + FLAG_INT_MASK = value & 0x0700; + m68ki_set_ccr(value); + m68ki_set_sm_flag((value >> 11) & 6); } /* Set the status register but don't check for interrupts nor @@ -1530,22 +1530,22 @@ INLINE void m68ki_set_sr_noint(uint value) */ INLINE void m68ki_set_sr_noint_nosp(uint value) { - /* Mask out the "unimplemented" bits */ - value &= CPU_SR_MASK; + /* Mask out the "unimplemented" bits */ + value &= CPU_SR_MASK; - /* Now set the status register */ - FLAG_T1 = BIT_F(value); - FLAG_T0 = BIT_E(value); - FLAG_INT_MASK = value & 0x0700; - m68ki_set_ccr(value); - m68ki_set_sm_flag_nosp((value >> 11) & 6); + /* Now set the status register */ + FLAG_T1 = BIT_F(value); + FLAG_T0 = BIT_E(value); + FLAG_INT_MASK = value & 0x0700; + m68ki_set_ccr(value); + m68ki_set_sm_flag_nosp((value >> 11) & 6); } /* Set the status register and check for interrupts */ INLINE void m68ki_set_sr(uint value) { - m68ki_set_sr_noint(value); - m68ki_check_interrupts(); + m68ki_set_sr_noint(value); + m68ki_check_interrupts(); } @@ -1554,23 +1554,23 @@ INLINE void m68ki_set_sr(uint value) /* Initiate exception processing */ INLINE uint m68ki_init_exception(void) { - /* Save the old status register */ - uint sr = m68ki_get_sr(); + /* Save the old status register */ + uint sr = m68ki_get_sr(); - /* Turn off trace flag, clear pending traces */ - FLAG_T1 = FLAG_T0 = 0; - m68ki_clear_trace(); - /* Enter supervisor mode */ - m68ki_set_s_flag(SFLAG_SET); + /* Turn off trace flag, clear pending traces */ + FLAG_T1 = FLAG_T0 = 0; + m68ki_clear_trace(); + /* Enter supervisor mode */ + m68ki_set_s_flag(SFLAG_SET); - return sr; + return sr; } /* 3 word stack frame (68000 only) */ INLINE void m68ki_stack_frame_3word(uint pc, uint sr) { - m68ki_push_32(pc); - m68ki_push_16(sr); + m68ki_push_32(pc); + m68ki_push_16(sr); } /* Format 0 stack frame. @@ -1578,15 +1578,15 @@ INLINE void m68ki_stack_frame_3word(uint pc, uint sr) */ INLINE void m68ki_stack_frame_0000(uint pc, uint sr, uint vector) { - /* Stack a 3-word frame if we are 68000 */ - if(CPU_TYPE == CPU_TYPE_000 || CPU_TYPE == CPU_TYPE_008) - { - m68ki_stack_frame_3word(pc, sr); - return; - } - m68ki_push_16(vector<<2); - m68ki_push_32(pc); - m68ki_push_16(sr); + /* Stack a 3-word frame if we are 68000 */ + if(CPU_TYPE == CPU_TYPE_000 || CPU_TYPE == CPU_TYPE_008) + { + m68ki_stack_frame_3word(pc, sr); + return; + } + m68ki_push_16(vector<<2); + m68ki_push_32(pc); + m68ki_push_16(sr); } /* Format 1 stack frame (68020). @@ -1594,9 +1594,9 @@ INLINE void m68ki_stack_frame_0000(uint pc, uint sr, uint vector) */ INLINE void m68ki_stack_frame_0001(uint pc, uint sr, uint vector) { - m68ki_push_16(0x1000 | (vector<<2)); - m68ki_push_32(pc); - m68ki_push_16(sr); + m68ki_push_16(0x1000 | (vector<<2)); + m68ki_push_32(pc); + m68ki_push_16(sr); } /* Format 2 stack frame. @@ -1604,10 +1604,10 @@ INLINE void m68ki_stack_frame_0001(uint pc, uint sr, uint vector) */ INLINE void m68ki_stack_frame_0010(uint sr, uint vector) { - m68ki_push_32(REG_PPC); - m68ki_push_16(0x2000 | (vector<<2)); - m68ki_push_32(REG_PC); - m68ki_push_16(sr); + m68ki_push_32(REG_PPC); + m68ki_push_16(0x2000 | (vector<<2)); + m68ki_push_32(REG_PC); + m68ki_push_16(sr); } @@ -1615,16 +1615,16 @@ INLINE void m68ki_stack_frame_0010(uint sr, uint vector) */ INLINE void m68ki_stack_frame_buserr(uint sr) { - m68ki_push_32(REG_PC); - m68ki_push_16(sr); - m68ki_push_16(REG_IR); - m68ki_push_32(m68ki_aerr_address); /* access address */ - /* 0 0 0 0 0 0 0 0 0 0 0 R/W I/N FC + m68ki_push_32(REG_PC); + m68ki_push_16(sr); + m68ki_push_16(REG_IR); + m68ki_push_32(m68ki_aerr_address); /* access address */ + /* 0 0 0 0 0 0 0 0 0 0 0 R/W I/N FC * R/W 0 = write, 1 = read * I/N 0 = instruction, 1 = not * FC 3-bit function code */ - m68ki_push_16(m68ki_aerr_write_mode | CPU_INSTR_MODE | m68ki_aerr_fc); + m68ki_push_16(m68ki_aerr_write_mode | CPU_INSTR_MODE | m68ki_aerr_fc); } /* Format 8 stack frame (68010). @@ -1632,51 +1632,51 @@ INLINE void m68ki_stack_frame_buserr(uint sr) */ void m68ki_stack_frame_1000(uint pc, uint sr, uint vector) { - /* VERSION + /* VERSION * NUMBER * INTERNAL INFORMATION, 16 WORDS */ - m68ki_fake_push_32(); - m68ki_fake_push_32(); - m68ki_fake_push_32(); - m68ki_fake_push_32(); - m68ki_fake_push_32(); - m68ki_fake_push_32(); - m68ki_fake_push_32(); - m68ki_fake_push_32(); + m68ki_fake_push_32(); + m68ki_fake_push_32(); + m68ki_fake_push_32(); + m68ki_fake_push_32(); + m68ki_fake_push_32(); + m68ki_fake_push_32(); + m68ki_fake_push_32(); + m68ki_fake_push_32(); - /* INSTRUCTION INPUT BUFFER */ - m68ki_push_16(0); + /* INSTRUCTION INPUT BUFFER */ + m68ki_push_16(0); - /* UNUSED, RESERVED (not written) */ - m68ki_fake_push_16(); + /* UNUSED, RESERVED (not written) */ + m68ki_fake_push_16(); - /* DATA INPUT BUFFER */ - m68ki_push_16(0); + /* DATA INPUT BUFFER */ + m68ki_push_16(0); - /* UNUSED, RESERVED (not written) */ - m68ki_fake_push_16(); + /* UNUSED, RESERVED (not written) */ + m68ki_fake_push_16(); - /* DATA OUTPUT BUFFER */ - m68ki_push_16(0); + /* DATA OUTPUT BUFFER */ + m68ki_push_16(0); - /* UNUSED, RESERVED (not written) */ - m68ki_fake_push_16(); + /* UNUSED, RESERVED (not written) */ + m68ki_fake_push_16(); - /* FAULT ADDRESS */ - m68ki_push_32(0); + /* FAULT ADDRESS */ + m68ki_push_32(0); - /* SPECIAL STATUS WORD */ - m68ki_push_16(0); + /* SPECIAL STATUS WORD */ + m68ki_push_16(0); - /* 1000, VECTOR OFFSET */ - m68ki_push_16(0x8000 | (vector<<2)); + /* 1000, VECTOR OFFSET */ + m68ki_push_16(0x8000 | (vector<<2)); - /* PROGRAM COUNTER */ - m68ki_push_32(pc); + /* PROGRAM COUNTER */ + m68ki_push_32(pc); - /* STATUS REGISTER */ - m68ki_push_16(sr); + /* STATUS REGISTER */ + m68ki_push_16(sr); } /* Format A stack frame (short bus fault). @@ -1686,44 +1686,44 @@ void m68ki_stack_frame_1000(uint pc, uint sr, uint vector) */ void m68ki_stack_frame_1010(uint sr, uint vector, uint pc) { - /* INTERNAL REGISTER */ - m68ki_push_16(0); + /* INTERNAL REGISTER */ + m68ki_push_16(0); - /* INTERNAL REGISTER */ - m68ki_push_16(0); + /* INTERNAL REGISTER */ + m68ki_push_16(0); - /* DATA OUTPUT BUFFER (2 words) */ - m68ki_push_32(0); + /* DATA OUTPUT BUFFER (2 words) */ + m68ki_push_32(0); - /* INTERNAL REGISTER */ - m68ki_push_16(0); + /* INTERNAL REGISTER */ + m68ki_push_16(0); - /* INTERNAL REGISTER */ - m68ki_push_16(0); + /* INTERNAL REGISTER */ + m68ki_push_16(0); - /* DATA CYCLE FAULT ADDRESS (2 words) */ - m68ki_push_32(0); + /* DATA CYCLE FAULT ADDRESS (2 words) */ + m68ki_push_32(0); - /* INSTRUCTION PIPE STAGE B */ - m68ki_push_16(0); + /* INSTRUCTION PIPE STAGE B */ + m68ki_push_16(0); - /* INSTRUCTION PIPE STAGE C */ - m68ki_push_16(0); + /* INSTRUCTION PIPE STAGE C */ + m68ki_push_16(0); - /* SPECIAL STATUS REGISTER */ - m68ki_push_16(0); + /* SPECIAL STATUS REGISTER */ + m68ki_push_16(0); - /* INTERNAL REGISTER */ - m68ki_push_16(0); + /* INTERNAL REGISTER */ + m68ki_push_16(0); - /* 1010, VECTOR OFFSET */ - m68ki_push_16(0xa000 | (vector<<2)); + /* 1010, VECTOR OFFSET */ + m68ki_push_16(0xa000 | (vector<<2)); - /* PROGRAM COUNTER */ - m68ki_push_32(pc); + /* PROGRAM COUNTER */ + m68ki_push_32(pc); - /* STATUS REGISTER */ - m68ki_push_16(sr); + /* STATUS REGISTER */ + m68ki_push_16(sr); } /* Format B stack frame (long bus fault). @@ -1733,69 +1733,69 @@ void m68ki_stack_frame_1010(uint sr, uint vector, uint pc) */ void m68ki_stack_frame_1011(uint sr, uint vector, uint pc) { - /* INTERNAL REGISTERS (18 words) */ - m68ki_push_32(0); - m68ki_push_32(0); - m68ki_push_32(0); - m68ki_push_32(0); - m68ki_push_32(0); - m68ki_push_32(0); - m68ki_push_32(0); - m68ki_push_32(0); - m68ki_push_32(0); + /* INTERNAL REGISTERS (18 words) */ + m68ki_push_32(0); + m68ki_push_32(0); + m68ki_push_32(0); + m68ki_push_32(0); + m68ki_push_32(0); + m68ki_push_32(0); + m68ki_push_32(0); + m68ki_push_32(0); + m68ki_push_32(0); - /* VERSION# (4 bits), INTERNAL INFORMATION */ - m68ki_push_16(0); + /* VERSION# (4 bits), INTERNAL INFORMATION */ + m68ki_push_16(0); - /* INTERNAL REGISTERS (3 words) */ - m68ki_push_32(0); - m68ki_push_16(0); + /* INTERNAL REGISTERS (3 words) */ + m68ki_push_32(0); + m68ki_push_16(0); - /* DATA INTPUT BUFFER (2 words) */ - m68ki_push_32(0); + /* DATA INTPUT BUFFER (2 words) */ + m68ki_push_32(0); - /* INTERNAL REGISTERS (2 words) */ - m68ki_push_32(0); + /* INTERNAL REGISTERS (2 words) */ + m68ki_push_32(0); - /* STAGE B ADDRESS (2 words) */ - m68ki_push_32(0); + /* STAGE B ADDRESS (2 words) */ + m68ki_push_32(0); - /* INTERNAL REGISTER (4 words) */ - m68ki_push_32(0); - m68ki_push_32(0); + /* INTERNAL REGISTER (4 words) */ + m68ki_push_32(0); + m68ki_push_32(0); - /* DATA OUTPUT BUFFER (2 words) */ - m68ki_push_32(0); + /* DATA OUTPUT BUFFER (2 words) */ + m68ki_push_32(0); - /* INTERNAL REGISTER */ - m68ki_push_16(0); + /* INTERNAL REGISTER */ + m68ki_push_16(0); - /* INTERNAL REGISTER */ - m68ki_push_16(0); + /* INTERNAL REGISTER */ + m68ki_push_16(0); - /* DATA CYCLE FAULT ADDRESS (2 words) */ - m68ki_push_32(0); + /* DATA CYCLE FAULT ADDRESS (2 words) */ + m68ki_push_32(0); - /* INSTRUCTION PIPE STAGE B */ - m68ki_push_16(0); + /* INSTRUCTION PIPE STAGE B */ + m68ki_push_16(0); - /* INSTRUCTION PIPE STAGE C */ - m68ki_push_16(0); + /* INSTRUCTION PIPE STAGE C */ + m68ki_push_16(0); - /* SPECIAL STATUS REGISTER */ - m68ki_push_16(0); + /* SPECIAL STATUS REGISTER */ + m68ki_push_16(0); - /* INTERNAL REGISTER */ - m68ki_push_16(0); + /* INTERNAL REGISTER */ + m68ki_push_16(0); - /* 1011, VECTOR OFFSET */ - m68ki_push_16(0xb000 | (vector<<2)); + /* 1011, VECTOR OFFSET */ + m68ki_push_16(0xb000 | (vector<<2)); - /* PROGRAM COUNTER */ - m68ki_push_32(pc); + /* PROGRAM COUNTER */ + m68ki_push_32(pc); - /* STATUS REGISTER */ - m68ki_push_16(sr); + /* STATUS REGISTER */ + m68ki_push_16(sr); } @@ -1804,245 +1804,245 @@ void m68ki_stack_frame_1011(uint sr, uint vector, uint pc) */ INLINE void m68ki_exception_trap(uint vector) { - uint sr = m68ki_init_exception(); + uint sr = m68ki_init_exception(); - if(CPU_TYPE_IS_010_LESS(CPU_TYPE)) - m68ki_stack_frame_0000(REG_PC, sr, vector); - else - m68ki_stack_frame_0010(sr, vector); + if(CPU_TYPE_IS_010_LESS(CPU_TYPE)) + m68ki_stack_frame_0000(REG_PC, sr, vector); + else + m68ki_stack_frame_0010(sr, vector); - m68ki_jump_vector(vector); + m68ki_jump_vector(vector); - /* Use up some clock cycles */ - USE_CYCLES(CYC_EXCEPTION[vector]); + /* Use up some clock cycles */ + USE_CYCLES(CYC_EXCEPTION[vector]); } /* Trap#n stacks a 0 frame but behaves like group2 otherwise */ INLINE void m68ki_exception_trapN(uint vector) { - uint sr = m68ki_init_exception(); - m68ki_stack_frame_0000(REG_PC, sr, vector); - m68ki_jump_vector(vector); + uint sr = m68ki_init_exception(); + m68ki_stack_frame_0000(REG_PC, sr, vector); + m68ki_jump_vector(vector); - /* Use up some clock cycles */ - USE_CYCLES(CYC_EXCEPTION[vector]); + /* Use up some clock cycles */ + USE_CYCLES(CYC_EXCEPTION[vector]); } /* Exception for trace mode */ INLINE void m68ki_exception_trace(void) { - uint sr = m68ki_init_exception(); + uint sr = m68ki_init_exception(); - if(CPU_TYPE_IS_010_LESS(CPU_TYPE)) - { - #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON - if(CPU_TYPE_IS_000(CPU_TYPE)) - { - CPU_INSTR_MODE = INSTRUCTION_NO; - } - #endif /* M68K_EMULATE_ADDRESS_ERROR */ - m68ki_stack_frame_0000(REG_PC, sr, EXCEPTION_TRACE); - } - else - m68ki_stack_frame_0010(sr, EXCEPTION_TRACE); + if(CPU_TYPE_IS_010_LESS(CPU_TYPE)) + { + #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON + if(CPU_TYPE_IS_000(CPU_TYPE)) + { + CPU_INSTR_MODE = INSTRUCTION_NO; + } + #endif /* M68K_EMULATE_ADDRESS_ERROR */ + m68ki_stack_frame_0000(REG_PC, sr, EXCEPTION_TRACE); + } + else + m68ki_stack_frame_0010(sr, EXCEPTION_TRACE); - m68ki_jump_vector(EXCEPTION_TRACE); + m68ki_jump_vector(EXCEPTION_TRACE); - /* Trace nullifies a STOP instruction */ - CPU_STOPPED &= ~STOP_LEVEL_STOP; + /* Trace nullifies a STOP instruction */ + CPU_STOPPED &= ~STOP_LEVEL_STOP; - /* Use up some clock cycles */ - USE_CYCLES(CYC_EXCEPTION[EXCEPTION_TRACE]); + /* Use up some clock cycles */ + USE_CYCLES(CYC_EXCEPTION[EXCEPTION_TRACE]); } /* Exception for privilege violation */ INLINE void m68ki_exception_privilege_violation(void) { - uint sr = m68ki_init_exception(); + uint sr = m68ki_init_exception(); - #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON - if(CPU_TYPE_IS_000(CPU_TYPE)) - { - CPU_INSTR_MODE = INSTRUCTION_NO; - } - #endif /* M68K_EMULATE_ADDRESS_ERROR */ + #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON + if(CPU_TYPE_IS_000(CPU_TYPE)) + { + CPU_INSTR_MODE = INSTRUCTION_NO; + } + #endif /* M68K_EMULATE_ADDRESS_ERROR */ - m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_PRIVILEGE_VIOLATION); - m68ki_jump_vector(EXCEPTION_PRIVILEGE_VIOLATION); + m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_PRIVILEGE_VIOLATION); + m68ki_jump_vector(EXCEPTION_PRIVILEGE_VIOLATION); - /* Use up some clock cycles and undo the instruction's cycles */ - USE_CYCLES(CYC_EXCEPTION[EXCEPTION_PRIVILEGE_VIOLATION] - CYC_INSTRUCTION[REG_IR]); + /* Use up some clock cycles and undo the instruction's cycles */ + USE_CYCLES(CYC_EXCEPTION[EXCEPTION_PRIVILEGE_VIOLATION] - CYC_INSTRUCTION[REG_IR]); } /* Exception for A-Line instructions */ INLINE void m68ki_exception_1010(void) { - uint sr; + uint sr; #if M68K_LOG_1010_1111 == OPT_ON - M68K_DO_LOG_EMU((M68K_LOG_FILEHANDLE "%s at %08x: called 1010 instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PPC), REG_IR, - m68ki_disassemble_quick(ADDRESS_68K(REG_PPC)))); + M68K_DO_LOG_EMU((M68K_LOG_FILEHANDLE "%s at %08x: called 1010 instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PPC), REG_IR, + m68ki_disassemble_quick(ADDRESS_68K(REG_PPC)))); #endif - sr = m68ki_init_exception(); - m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_1010); - m68ki_jump_vector(EXCEPTION_1010); + sr = m68ki_init_exception(); + m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_1010); + m68ki_jump_vector(EXCEPTION_1010); - /* Use up some clock cycles and undo the instruction's cycles */ - USE_CYCLES(CYC_EXCEPTION[EXCEPTION_1010] - CYC_INSTRUCTION[REG_IR]); + /* Use up some clock cycles and undo the instruction's cycles */ + USE_CYCLES(CYC_EXCEPTION[EXCEPTION_1010] - CYC_INSTRUCTION[REG_IR]); } /* Exception for F-Line instructions */ INLINE void m68ki_exception_1111(void) { - uint sr; + uint sr; #if M68K_LOG_1010_1111 == OPT_ON - M68K_DO_LOG_EMU((M68K_LOG_FILEHANDLE "%s at %08x: called 1111 instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PPC), REG_IR, - m68ki_disassemble_quick(ADDRESS_68K(REG_PPC)))); + M68K_DO_LOG_EMU((M68K_LOG_FILEHANDLE "%s at %08x: called 1111 instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PPC), REG_IR, + m68ki_disassemble_quick(ADDRESS_68K(REG_PPC)))); #endif - sr = m68ki_init_exception(); - m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_1111); - m68ki_jump_vector(EXCEPTION_1111); + sr = m68ki_init_exception(); + m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_1111); + m68ki_jump_vector(EXCEPTION_1111); - /* Use up some clock cycles and undo the instruction's cycles */ - USE_CYCLES(CYC_EXCEPTION[EXCEPTION_1111] - CYC_INSTRUCTION[REG_IR]); + /* Use up some clock cycles and undo the instruction's cycles */ + USE_CYCLES(CYC_EXCEPTION[EXCEPTION_1111] - CYC_INSTRUCTION[REG_IR]); } /* Exception for illegal instructions */ INLINE void m68ki_exception_illegal(void) { - uint sr; + uint sr; - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: illegal instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PPC), REG_IR, - m68ki_disassemble_quick(ADDRESS_68K(REG_PPC)))); + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: illegal instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PPC), REG_IR, + m68ki_disassemble_quick(ADDRESS_68K(REG_PPC)))); - sr = m68ki_init_exception(); + sr = m68ki_init_exception(); - #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON - if(CPU_TYPE_IS_000(CPU_TYPE)) - { - CPU_INSTR_MODE = INSTRUCTION_NO; - } - #endif /* M68K_EMULATE_ADDRESS_ERROR */ + #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON + if(CPU_TYPE_IS_000(CPU_TYPE)) + { + CPU_INSTR_MODE = INSTRUCTION_NO; + } + #endif /* M68K_EMULATE_ADDRESS_ERROR */ - m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_ILLEGAL_INSTRUCTION); - m68ki_jump_vector(EXCEPTION_ILLEGAL_INSTRUCTION); + m68ki_stack_frame_0000(REG_PPC, sr, EXCEPTION_ILLEGAL_INSTRUCTION); + m68ki_jump_vector(EXCEPTION_ILLEGAL_INSTRUCTION); - /* Use up some clock cycles and undo the instruction's cycles */ - USE_CYCLES(CYC_EXCEPTION[EXCEPTION_ILLEGAL_INSTRUCTION] - CYC_INSTRUCTION[REG_IR]); + /* Use up some clock cycles and undo the instruction's cycles */ + USE_CYCLES(CYC_EXCEPTION[EXCEPTION_ILLEGAL_INSTRUCTION] - CYC_INSTRUCTION[REG_IR]); } /* Exception for format errror in RTE */ INLINE void m68ki_exception_format_error(void) { - uint sr = m68ki_init_exception(); - m68ki_stack_frame_0000(REG_PC, sr, EXCEPTION_FORMAT_ERROR); - m68ki_jump_vector(EXCEPTION_FORMAT_ERROR); + uint sr = m68ki_init_exception(); + m68ki_stack_frame_0000(REG_PC, sr, EXCEPTION_FORMAT_ERROR); + m68ki_jump_vector(EXCEPTION_FORMAT_ERROR); - /* Use up some clock cycles and undo the instruction's cycles */ - USE_CYCLES(CYC_EXCEPTION[EXCEPTION_FORMAT_ERROR] - CYC_INSTRUCTION[REG_IR]); + /* Use up some clock cycles and undo the instruction's cycles */ + USE_CYCLES(CYC_EXCEPTION[EXCEPTION_FORMAT_ERROR] - CYC_INSTRUCTION[REG_IR]); } /* Exception for address error */ INLINE void m68ki_exception_address_error(void) { - uint sr = m68ki_init_exception(); + uint sr = m68ki_init_exception(); - /* If we were processing a bus error, address error, or reset, + /* If we were processing a bus error, address error, or reset, * this is a catastrophic failure. * Halt the CPU */ - if(CPU_RUN_MODE == RUN_MODE_BERR_AERR_RESET) - { - m68k_read_memory_8(0x00ffff01); - CPU_STOPPED = STOP_LEVEL_HALT; - return; - } - CPU_RUN_MODE = RUN_MODE_BERR_AERR_RESET; + if(CPU_RUN_MODE == RUN_MODE_BERR_AERR_RESET) + { + m68k_read_memory_8(0x00ffff01); + CPU_STOPPED = STOP_LEVEL_HALT; + return; + } + CPU_RUN_MODE = RUN_MODE_BERR_AERR_RESET; - /* Note: This is implemented for 68000 only! */ - m68ki_stack_frame_buserr(sr); + /* Note: This is implemented for 68000 only! */ + m68ki_stack_frame_buserr(sr); - m68ki_jump_vector(EXCEPTION_ADDRESS_ERROR); + m68ki_jump_vector(EXCEPTION_ADDRESS_ERROR); - /* Use up some clock cycles and undo the instruction's cycles */ - USE_CYCLES(CYC_EXCEPTION[EXCEPTION_ADDRESS_ERROR] - CYC_INSTRUCTION[REG_IR]); + /* Use up some clock cycles and undo the instruction's cycles */ + USE_CYCLES(CYC_EXCEPTION[EXCEPTION_ADDRESS_ERROR] - CYC_INSTRUCTION[REG_IR]); } /* Service an interrupt request and start exception processing */ void m68ki_exception_interrupt(uint int_level) { - uint vector; - uint sr; - uint new_pc; + uint vector; + uint sr; + uint new_pc; - #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON - if(CPU_TYPE_IS_000(CPU_TYPE)) - { - CPU_INSTR_MODE = INSTRUCTION_NO; - } - #endif /* M68K_EMULATE_ADDRESS_ERROR */ + #if M68K_EMULATE_ADDRESS_ERROR == OPT_ON + if(CPU_TYPE_IS_000(CPU_TYPE)) + { + CPU_INSTR_MODE = INSTRUCTION_NO; + } + #endif /* M68K_EMULATE_ADDRESS_ERROR */ - /* Turn off the stopped state */ - CPU_STOPPED &= ~STOP_LEVEL_STOP; + /* Turn off the stopped state */ + CPU_STOPPED &= ~STOP_LEVEL_STOP; - /* If we are halted, don't do anything */ - if(CPU_STOPPED) - return; + /* If we are halted, don't do anything */ + if(CPU_STOPPED) + return; - /* Acknowledge the interrupt */ - vector = m68ki_int_ack(int_level); + /* Acknowledge the interrupt */ + vector = m68ki_int_ack(int_level); - /* Get the interrupt vector */ - if(vector == M68K_INT_ACK_AUTOVECTOR) - /* Use the autovectors. This is the most commonly used implementation */ - vector = EXCEPTION_INTERRUPT_AUTOVECTOR+int_level; - else if(vector == M68K_INT_ACK_SPURIOUS) - /* Called if no devices respond to the interrupt acknowledge */ - vector = EXCEPTION_SPURIOUS_INTERRUPT; - else if(vector > 255) - { - M68K_DO_LOG_EMU((M68K_LOG_FILEHANDLE "%s at %08x: Interrupt acknowledge returned invalid vector $%x\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC), vector)); - return; - } + /* Get the interrupt vector */ + if(vector == M68K_INT_ACK_AUTOVECTOR) + /* Use the autovectors. This is the most commonly used implementation */ + vector = EXCEPTION_INTERRUPT_AUTOVECTOR+int_level; + else if(vector == M68K_INT_ACK_SPURIOUS) + /* Called if no devices respond to the interrupt acknowledge */ + vector = EXCEPTION_SPURIOUS_INTERRUPT; + else if(vector > 255) + { + M68K_DO_LOG_EMU((M68K_LOG_FILEHANDLE "%s at %08x: Interrupt acknowledge returned invalid vector $%x\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC), vector)); + return; + } - /* Start exception processing */ - sr = m68ki_init_exception(); + /* Start exception processing */ + sr = m68ki_init_exception(); - /* Set the interrupt mask to the level of the one being serviced */ - FLAG_INT_MASK = int_level<<8; + /* Set the interrupt mask to the level of the one being serviced */ + FLAG_INT_MASK = int_level<<8; - /* Get the new PC */ - new_pc = m68ki_read_data_32((vector<<2) + REG_VBR); + /* Get the new PC */ + new_pc = m68ki_read_data_32((vector<<2) + REG_VBR); - /* If vector is uninitialized, call the uninitialized interrupt vector */ - if(new_pc == 0) - new_pc = m68ki_read_data_32((EXCEPTION_UNINITIALIZED_INTERRUPT<<2) + REG_VBR); + /* If vector is uninitialized, call the uninitialized interrupt vector */ + if(new_pc == 0) + new_pc = m68ki_read_data_32((EXCEPTION_UNINITIALIZED_INTERRUPT<<2) + REG_VBR); - /* Generate a stack frame */ - m68ki_stack_frame_0000(REG_PC, sr, vector); - if(FLAG_M && CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* Create throwaway frame */ - m68ki_set_sm_flag(FLAG_S); /* clear M */ - sr |= 0x2000; /* Same as SR in master stack frame except S is forced high */ - m68ki_stack_frame_0001(REG_PC, sr, vector); - } + /* Generate a stack frame */ + m68ki_stack_frame_0000(REG_PC, sr, vector); + if(FLAG_M && CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* Create throwaway frame */ + m68ki_set_sm_flag(FLAG_S); /* clear M */ + sr |= 0x2000; /* Same as SR in master stack frame except S is forced high */ + m68ki_stack_frame_0001(REG_PC, sr, vector); + } - m68ki_jump(new_pc); + m68ki_jump(new_pc); - /* Defer cycle counting until later */ - CPU_INT_CYCLES += CYC_EXCEPTION[vector]; + /* Defer cycle counting until later */ + CPU_INT_CYCLES += CYC_EXCEPTION[vector]; //#if !M68K_EMULATE_INT_ACK - /* Automatically clear IRQ if we are not using an acknowledge scheme */ - CPU_INT_LEVEL = 0; + /* Automatically clear IRQ if we are not using an acknowledge scheme */ + CPU_INT_LEVEL = 0; //#endif /* M68K_EMULATE_INT_ACK */ } @@ -2050,8 +2050,8 @@ void m68ki_exception_interrupt(uint int_level) /* ASG: Check for interrupts */ INLINE void m68ki_check_interrupts(void) { - if(CPU_INT_LEVEL > FLAG_INT_MASK) - m68ki_exception_interrupt(CPU_INT_LEVEL>>8); + if(CPU_INT_LEVEL > FLAG_INT_MASK) + m68ki_exception_interrupt(CPU_INT_LEVEL>>8); } diff --git a/source/m68k/m68kops.c b/source/m68k/m68kops.c index 12a2d20..5d796bb 100644 --- a/source/m68k/m68kops.c +++ b/source/m68k/m68kops.c @@ -9,13300 +9,13300 @@ extern void m68040_fpu_op1(void); static void m68k_op_1010(void) { - m68ki_exception_1010(); + m68ki_exception_1010(); } static void m68k_op_1111(void) { - m68ki_exception_1111(); + m68ki_exception_1111(); } static void m68k_op_040fpu0_32(void) { - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - m68040_fpu_op0(); - return; - } - m68ki_exception_1111(); + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + m68040_fpu_op0(); + return; + } + m68ki_exception_1111(); } static void m68k_op_040fpu1_32(void) { - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - m68040_fpu_op1(); - return; - } - m68ki_exception_1111(); + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + m68040_fpu_op1(); + return; + } + m68ki_exception_1111(); } static void m68k_op_abcd_8_rr(void) { - uint* r_dst = &DX; - uint src = DY; - uint dst = *r_dst; - uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); + uint* r_dst = &DX; + uint src = DY; + uint dst = *r_dst; + uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); - FLAG_V = ~res; /* Undefined V behavior */ + FLAG_V = ~res; /* Undefined V behavior */ - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - FLAG_X = FLAG_C = (res > 0x99) << 8; - if(FLAG_C) - res -= 0xa0; + if(res > 9) + res += 6; + res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); + FLAG_X = FLAG_C = (res > 0x99) << 8; + if(FLAG_C) + res -= 0xa0; - FLAG_V &= res; /* Undefined V behavior part II */ - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; } static void m68k_op_abcd_8_mm_ax7(void) { - uint src = OPER_AY_PD_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); + uint src = OPER_AY_PD_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); - FLAG_V = ~res; /* Undefined V behavior */ + FLAG_V = ~res; /* Undefined V behavior */ - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - FLAG_X = FLAG_C = (res > 0x99) << 8; - if(FLAG_C) - res -= 0xa0; + if(res > 9) + res += 6; + res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); + FLAG_X = FLAG_C = (res > 0x99) << 8; + if(FLAG_C) + res -= 0xa0; - FLAG_V &= res; /* Undefined V behavior part II */ - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_abcd_8_mm_ay7(void) { - uint src = OPER_A7_PD_8(); - uint ea = EA_AX_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); + uint src = OPER_A7_PD_8(); + uint ea = EA_AX_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); - FLAG_V = ~res; /* Undefined V behavior */ + FLAG_V = ~res; /* Undefined V behavior */ - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - FLAG_X = FLAG_C = (res > 0x99) << 8; - if(FLAG_C) - res -= 0xa0; + if(res > 9) + res += 6; + res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); + FLAG_X = FLAG_C = (res > 0x99) << 8; + if(FLAG_C) + res -= 0xa0; - FLAG_V &= res; /* Undefined V behavior part II */ - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_abcd_8_mm_axy7(void) { - uint src = OPER_A7_PD_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); + uint src = OPER_A7_PD_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); - FLAG_V = ~res; /* Undefined V behavior */ + FLAG_V = ~res; /* Undefined V behavior */ - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - FLAG_X = FLAG_C = (res > 0x99) << 8; - if(FLAG_C) - res -= 0xa0; + if(res > 9) + res += 6; + res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); + FLAG_X = FLAG_C = (res > 0x99) << 8; + if(FLAG_C) + res -= 0xa0; - FLAG_V &= res; /* Undefined V behavior part II */ - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_abcd_8_mm(void) { - uint src = OPER_AY_PD_8(); - uint ea = EA_AX_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); + uint src = OPER_AY_PD_8(); + uint ea = EA_AX_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = LOW_NIBBLE(src) + LOW_NIBBLE(dst) + XFLAG_AS_1(); - FLAG_V = ~res; /* Undefined V behavior */ + FLAG_V = ~res; /* Undefined V behavior */ - if(res > 9) - res += 6; - res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); - FLAG_X = FLAG_C = (res > 0x99) << 8; - if(FLAG_C) - res -= 0xa0; + if(res > 9) + res += 6; + res += HIGH_NIBBLE(src) + HIGH_NIBBLE(dst); + FLAG_X = FLAG_C = (res > 0x99) << 8; + if(FLAG_C) + res -= 0xa0; - FLAG_V &= res; /* Undefined V behavior part II */ - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_add_8_er_d(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_8(DY); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_8(DY); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_ai(void) { - uint* r_dst = &DX; - uint src = OPER_AY_AI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_AI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_pi(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_PI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_pi7(void) { - uint* r_dst = &DX; - uint src = OPER_A7_PI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_A7_PI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_pd(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PD_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_PD_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_pd7(void) { - uint* r_dst = &DX; - uint src = OPER_A7_PD_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_A7_PD_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_di(void) { - uint* r_dst = &DX; - uint src = OPER_AY_DI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_DI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_ix(void) { - uint* r_dst = &DX; - uint src = OPER_AY_IX_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_IX_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_aw(void) { - uint* r_dst = &DX; - uint src = OPER_AW_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AW_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_al(void) { - uint* r_dst = &DX; - uint src = OPER_AL_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AL_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_pcdi(void) { - uint* r_dst = &DX; - uint src = OPER_PCDI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_PCDI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_pcix(void) { - uint* r_dst = &DX; - uint src = OPER_PCIX_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_PCIX_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_8_er_i(void) { - uint* r_dst = &DX; - uint src = OPER_I_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_I_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_d(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_16(DY); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_16(DY); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_a(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_16(AY); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_16(AY); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_ai(void) { - uint* r_dst = &DX; - uint src = OPER_AY_AI_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_AI_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_pi(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PI_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_PI_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_pd(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PD_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_PD_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_di(void) { - uint* r_dst = &DX; - uint src = OPER_AY_DI_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_DI_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_ix(void) { - uint* r_dst = &DX; - uint src = OPER_AY_IX_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_IX_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_aw(void) { - uint* r_dst = &DX; - uint src = OPER_AW_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AW_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_al(void) { - uint* r_dst = &DX; - uint src = OPER_AL_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AL_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_pcdi(void) { - uint* r_dst = &DX; - uint src = OPER_PCDI_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_PCDI_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_pcix(void) { - uint* r_dst = &DX; - uint src = OPER_PCIX_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_PCIX_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_16_er_i(void) { - uint* r_dst = &DX; - uint src = OPER_I_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_I_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_add_32_er_d(void) { - uint* r_dst = &DX; - uint src = DY; - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = DY; + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_a(void) { - uint* r_dst = &DX; - uint src = AY; - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = AY; + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_ai(void) { - uint* r_dst = &DX; - uint src = OPER_AY_AI_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_AI_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_pi(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PI_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_PI_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_pd(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PD_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_PD_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_di(void) { - uint* r_dst = &DX; - uint src = OPER_AY_DI_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_DI_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_ix(void) { - uint* r_dst = &DX; - uint src = OPER_AY_IX_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AY_IX_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_aw(void) { - uint* r_dst = &DX; - uint src = OPER_AW_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AW_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_al(void) { - uint* r_dst = &DX; - uint src = OPER_AL_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_AL_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_pcdi(void) { - uint* r_dst = &DX; - uint src = OPER_PCDI_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_PCDI_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_pcix(void) { - uint* r_dst = &DX; - uint src = OPER_PCIX_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_PCIX_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_32_er_i(void) { - uint* r_dst = &DX; - uint src = OPER_I_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DX; + uint src = OPER_I_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_add_8_re_ai(void) { - uint ea = EA_AY_AI_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint ea = EA_AY_AI_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_add_8_re_pi(void) { - uint ea = EA_AY_PI_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint ea = EA_AY_PI_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_add_8_re_pi7(void) { - uint ea = EA_A7_PI_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint ea = EA_A7_PI_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_add_8_re_pd(void) { - uint ea = EA_AY_PD_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint ea = EA_AY_PD_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_add_8_re_pd7(void) { - uint ea = EA_A7_PD_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint ea = EA_A7_PD_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_add_8_re_di(void) { - uint ea = EA_AY_DI_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint ea = EA_AY_DI_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_add_8_re_ix(void) { - uint ea = EA_AY_IX_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint ea = EA_AY_IX_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_add_8_re_aw(void) { - uint ea = EA_AW_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint ea = EA_AW_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_add_8_re_al(void) { - uint ea = EA_AL_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint ea = EA_AL_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_add_16_re_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint ea = EA_AY_AI_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_add_16_re_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint ea = EA_AY_PI_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_add_16_re_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint ea = EA_AY_PD_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_add_16_re_di(void) { - uint ea = EA_AY_DI_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint ea = EA_AY_DI_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_add_16_re_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint ea = EA_AY_IX_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_add_16_re_aw(void) { - uint ea = EA_AW_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint ea = EA_AW_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_add_16_re_al(void) { - uint ea = EA_AL_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint ea = EA_AL_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_add_32_re_ai(void) { - uint ea = EA_AY_AI_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint ea = EA_AY_AI_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_add_32_re_pi(void) { - uint ea = EA_AY_PI_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint ea = EA_AY_PI_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_add_32_re_pd(void) { - uint ea = EA_AY_PD_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint ea = EA_AY_PD_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_add_32_re_di(void) { - uint ea = EA_AY_DI_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint ea = EA_AY_DI_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_add_32_re_ix(void) { - uint ea = EA_AY_IX_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint ea = EA_AY_IX_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_add_32_re_aw(void) { - uint ea = EA_AW_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint ea = EA_AW_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_add_32_re_al(void) { - uint ea = EA_AL_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint ea = EA_AL_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_adda_16_d(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(*r_dst + MAKE_INT_16(DY)); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + MAKE_INT_16(DY)); } static void m68k_op_adda_16_a(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(*r_dst + MAKE_INT_16(AY)); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + MAKE_INT_16(AY)); } static void m68k_op_adda_16_ai(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_AI_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_AI_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_16_pi(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_PI_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_PI_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_16_pd(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_PD_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_PD_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_16_di(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_DI_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_DI_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_16_ix(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_IX_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_IX_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_16_aw(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AW_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AW_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_16_al(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AL_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AL_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_16_pcdi(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_PCDI_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_PCDI_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_16_pcix(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_PCIX_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_PCIX_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_16_i(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_I_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_I_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + src); } static void m68k_op_adda_32_d(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(*r_dst + DY); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + DY); } static void m68k_op_adda_32_a(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(*r_dst + AY); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + AY); } static void m68k_op_adda_32_ai(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_AY_AI_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_AY_AI_32() + *r_dst); } static void m68k_op_adda_32_pi(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_AY_PI_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_AY_PI_32() + *r_dst); } static void m68k_op_adda_32_pd(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_AY_PD_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_AY_PD_32() + *r_dst); } static void m68k_op_adda_32_di(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_AY_DI_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_AY_DI_32() + *r_dst); } static void m68k_op_adda_32_ix(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_AY_IX_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_AY_IX_32() + *r_dst); } static void m68k_op_adda_32_aw(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_AW_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_AW_32() + *r_dst); } static void m68k_op_adda_32_al(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_AL_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_AL_32() + *r_dst); } static void m68k_op_adda_32_pcdi(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_PCDI_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_PCDI_32() + *r_dst); } static void m68k_op_adda_32_pcix(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_PCIX_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_PCIX_32() + *r_dst); } static void m68k_op_adda_32_i(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(OPER_I_32() + *r_dst); + *r_dst = MASK_OUT_ABOVE_32(OPER_I_32() + *r_dst); } static void m68k_op_addi_8_d(void) { - uint* r_dst = &DY; - uint src = OPER_I_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DY; + uint src = OPER_I_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_addi_8_ai(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_AI_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = OPER_I_8(); + uint ea = EA_AY_AI_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addi_8_pi(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = OPER_I_8(); + uint ea = EA_AY_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addi_8_pi7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = OPER_I_8(); + uint ea = EA_A7_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addi_8_pd(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = OPER_I_8(); + uint ea = EA_AY_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addi_8_pd7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = OPER_I_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addi_8_di(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_DI_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = OPER_I_8(); + uint ea = EA_AY_DI_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addi_8_ix(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_IX_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = OPER_I_8(); + uint ea = EA_AY_IX_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addi_8_aw(void) { - uint src = OPER_I_8(); - uint ea = EA_AW_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = OPER_I_8(); + uint ea = EA_AW_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addi_8_al(void) { - uint src = OPER_I_8(); - uint ea = EA_AL_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = OPER_I_8(); + uint ea = EA_AL_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addi_16_d(void) { - uint* r_dst = &DY; - uint src = OPER_I_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DY; + uint src = OPER_I_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_addi_16_ai(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_AI_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = OPER_I_16(); + uint ea = EA_AY_AI_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addi_16_pi(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PI_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = OPER_I_16(); + uint ea = EA_AY_PI_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addi_16_pd(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PD_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = OPER_I_16(); + uint ea = EA_AY_PD_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addi_16_di(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_DI_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = OPER_I_16(); + uint ea = EA_AY_DI_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addi_16_ix(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_IX_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = OPER_I_16(); + uint ea = EA_AY_IX_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addi_16_aw(void) { - uint src = OPER_I_16(); - uint ea = EA_AW_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = OPER_I_16(); + uint ea = EA_AW_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addi_16_al(void) { - uint src = OPER_I_16(); - uint ea = EA_AL_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = OPER_I_16(); + uint ea = EA_AL_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addi_32_d(void) { - uint* r_dst = &DY; - uint src = OPER_I_32(); - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DY; + uint src = OPER_I_32(); + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_addi_32_ai(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_AI_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = OPER_I_32(); + uint ea = EA_AY_AI_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addi_32_pi(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PI_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = OPER_I_32(); + uint ea = EA_AY_PI_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addi_32_pd(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PD_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = OPER_I_32(); + uint ea = EA_AY_PD_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addi_32_di(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_DI_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = OPER_I_32(); + uint ea = EA_AY_DI_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addi_32_ix(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_IX_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = OPER_I_32(); + uint ea = EA_AY_IX_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addi_32_aw(void) { - uint src = OPER_I_32(); - uint ea = EA_AW_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = OPER_I_32(); + uint ea = EA_AW_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addi_32_al(void) { - uint src = OPER_I_32(); - uint ea = EA_AL_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = OPER_I_32(); + uint ea = EA_AL_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addq_8_d(void) { - uint* r_dst = &DY; - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst; + uint* r_dst = &DY; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_addq_8_ai(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_AI_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_AI_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addq_8_pi(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addq_8_pi7(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_A7_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_A7_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addq_8_pd(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addq_8_pd7(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addq_8_di(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_DI_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_DI_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addq_8_ix(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_IX_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_IX_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addq_8_aw(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AW_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AW_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addq_8_al(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AL_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AL_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst; - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_addq_16_d(void) { - uint* r_dst = &DY; - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst; + uint* r_dst = &DY; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_addq_16_a(void) { - uint* r_dst = &AY; + uint* r_dst = &AY; - *r_dst = MASK_OUT_ABOVE_32(*r_dst + (((REG_IR >> 9) - 1) & 7) + 1); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + (((REG_IR >> 9) - 1) & 7) + 1); } static void m68k_op_addq_16_ai(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_AI_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_AI_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addq_16_pi(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PI_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PI_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addq_16_pd(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PD_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PD_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addq_16_di(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_DI_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_DI_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addq_16_ix(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_IX_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_IX_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addq_16_aw(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AW_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AW_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addq_16_al(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AL_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AL_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst; - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_addq_32_d(void) { - uint* r_dst = &DY; - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint dst = *r_dst; - uint res = src + dst; + uint* r_dst = &DY; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint dst = *r_dst; + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_addq_32_a(void) { - uint* r_dst = &AY; + uint* r_dst = &AY; - *r_dst = MASK_OUT_ABOVE_32(*r_dst + (((REG_IR >> 9) - 1) & 7) + 1); + *r_dst = MASK_OUT_ABOVE_32(*r_dst + (((REG_IR >> 9) - 1) & 7) + 1); } static void m68k_op_addq_32_ai(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_AI_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_AI_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addq_32_pi(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PI_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PI_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addq_32_pd(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PD_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PD_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addq_32_di(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_DI_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_DI_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addq_32_ix(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_IX_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_IX_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addq_32_aw(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AW_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AW_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addq_32_al(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AL_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AL_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_addx_8_rr(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_8(DY); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = src + dst + XFLAG_AS_1(); + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_8(DY); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = src + dst + XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; } static void m68k_op_addx_16_rr(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_16(DY); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = src + dst + XFLAG_AS_1(); + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_16(DY); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = src + dst + XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; } static void m68k_op_addx_32_rr(void) { - uint* r_dst = &DX; - uint src = DY; - uint dst = *r_dst; - uint res = src + dst + XFLAG_AS_1(); + uint* r_dst = &DX; + uint src = DY; + uint dst = *r_dst; + uint res = src + dst + XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - *r_dst = res; + *r_dst = res; } static void m68k_op_addx_8_mm_ax7(void) { - uint src = OPER_AY_PD_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst + XFLAG_AS_1(); + uint src = OPER_AY_PD_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst + XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_addx_8_mm_ay7(void) { - uint src = OPER_A7_PD_8(); - uint ea = EA_AX_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst + XFLAG_AS_1(); + uint src = OPER_A7_PD_8(); + uint ea = EA_AX_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst + XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_addx_8_mm_axy7(void) { - uint src = OPER_A7_PD_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst + XFLAG_AS_1(); + uint src = OPER_A7_PD_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst + XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_addx_8_mm(void) { - uint src = OPER_AY_PD_8(); - uint ea = EA_AX_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = src + dst + XFLAG_AS_1(); + uint src = OPER_AY_PD_8(); + uint ea = EA_AX_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = src + dst + XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_V = VFLAG_ADD_8(src, dst, res); - FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_V = VFLAG_ADD_8(src, dst, res); + FLAG_X = FLAG_C = CFLAG_8(res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_addx_16_mm(void) { - uint src = OPER_AY_PD_16(); - uint ea = EA_AX_PD_16(); - uint dst = m68ki_read_16(ea); - uint res = src + dst + XFLAG_AS_1(); + uint src = OPER_AY_PD_16(); + uint ea = EA_AX_PD_16(); + uint dst = m68ki_read_16(ea); + uint res = src + dst + XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_V = VFLAG_ADD_16(src, dst, res); - FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_V = VFLAG_ADD_16(src, dst, res); + FLAG_X = FLAG_C = CFLAG_16(res); - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_addx_32_mm(void) { - uint src = OPER_AY_PD_32(); - uint ea = EA_AX_PD_32(); - uint dst = m68ki_read_32(ea); - uint res = src + dst + XFLAG_AS_1(); + uint src = OPER_AY_PD_32(); + uint ea = EA_AX_PD_32(); + uint dst = m68ki_read_32(ea); + uint res = src + dst + XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_ADD_32(src, dst, res); - FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_ADD_32(src, dst, res); + FLAG_X = FLAG_C = CFLAG_ADD_32(src, dst, res); - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_and_8_er_d(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (DY | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (DY | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_ai(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_AI_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_AI_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_pi(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_PI_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_PI_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_pi7(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_A7_PI_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_A7_PI_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_pd(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_PD_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_PD_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_pd7(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_A7_PD_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_A7_PD_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_di(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_DI_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_DI_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_ix(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_IX_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AY_IX_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_aw(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AW_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AW_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_al(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AL_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_AL_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_pcdi(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_PCDI_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_PCDI_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_pcix(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_PCIX_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_PCIX_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_er_i(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_I_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DX &= (OPER_I_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_d(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (DY | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (DY | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_ai(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_AI_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_AI_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_pi(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_PI_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_PI_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_pd(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_PD_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_PD_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_di(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_DI_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_DI_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_ix(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_IX_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AY_IX_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_aw(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AW_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AW_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_al(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AL_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_AL_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_pcdi(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_PCDI_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_PCDI_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_pcix(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_PCIX_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_PCIX_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_16_er_i(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_I_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DX &= (OPER_I_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_d(void) { - FLAG_Z = DX &= DY; + FLAG_Z = DX &= DY; - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_ai(void) { - FLAG_Z = DX &= OPER_AY_AI_32(); + FLAG_Z = DX &= OPER_AY_AI_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_pi(void) { - FLAG_Z = DX &= OPER_AY_PI_32(); + FLAG_Z = DX &= OPER_AY_PI_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_pd(void) { - FLAG_Z = DX &= OPER_AY_PD_32(); + FLAG_Z = DX &= OPER_AY_PD_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_di(void) { - FLAG_Z = DX &= OPER_AY_DI_32(); + FLAG_Z = DX &= OPER_AY_DI_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_ix(void) { - FLAG_Z = DX &= OPER_AY_IX_32(); + FLAG_Z = DX &= OPER_AY_IX_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_aw(void) { - FLAG_Z = DX &= OPER_AW_32(); + FLAG_Z = DX &= OPER_AW_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_al(void) { - FLAG_Z = DX &= OPER_AL_32(); + FLAG_Z = DX &= OPER_AL_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_pcdi(void) { - FLAG_Z = DX &= OPER_PCDI_32(); + FLAG_Z = DX &= OPER_PCDI_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_pcix(void) { - FLAG_Z = DX &= OPER_PCIX_32(); + FLAG_Z = DX &= OPER_PCIX_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_32_er_i(void) { - FLAG_Z = DX &= OPER_I_32(); + FLAG_Z = DX &= OPER_I_32(); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_and_8_re_ai(void) { - uint ea = EA_AY_AI_8(); - uint res = DX & m68ki_read_8(ea); + uint ea = EA_AY_AI_8(); + uint res = DX & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_and_8_re_pi(void) { - uint ea = EA_AY_PI_8(); - uint res = DX & m68ki_read_8(ea); + uint ea = EA_AY_PI_8(); + uint res = DX & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_and_8_re_pi7(void) { - uint ea = EA_A7_PI_8(); - uint res = DX & m68ki_read_8(ea); + uint ea = EA_A7_PI_8(); + uint res = DX & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_and_8_re_pd(void) { - uint ea = EA_AY_PD_8(); - uint res = DX & m68ki_read_8(ea); + uint ea = EA_AY_PD_8(); + uint res = DX & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_and_8_re_pd7(void) { - uint ea = EA_A7_PD_8(); - uint res = DX & m68ki_read_8(ea); + uint ea = EA_A7_PD_8(); + uint res = DX & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_and_8_re_di(void) { - uint ea = EA_AY_DI_8(); - uint res = DX & m68ki_read_8(ea); + uint ea = EA_AY_DI_8(); + uint res = DX & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_and_8_re_ix(void) { - uint ea = EA_AY_IX_8(); - uint res = DX & m68ki_read_8(ea); + uint ea = EA_AY_IX_8(); + uint res = DX & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_and_8_re_aw(void) { - uint ea = EA_AW_8(); - uint res = DX & m68ki_read_8(ea); + uint ea = EA_AW_8(); + uint res = DX & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_and_8_re_al(void) { - uint ea = EA_AL_8(); - uint res = DX & m68ki_read_8(ea); + uint ea = EA_AL_8(); + uint res = DX & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_and_16_re_ai(void) { - uint ea = EA_AY_AI_16(); - uint res = DX & m68ki_read_16(ea); + uint ea = EA_AY_AI_16(); + uint res = DX & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_and_16_re_pi(void) { - uint ea = EA_AY_PI_16(); - uint res = DX & m68ki_read_16(ea); + uint ea = EA_AY_PI_16(); + uint res = DX & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_and_16_re_pd(void) { - uint ea = EA_AY_PD_16(); - uint res = DX & m68ki_read_16(ea); + uint ea = EA_AY_PD_16(); + uint res = DX & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_and_16_re_di(void) { - uint ea = EA_AY_DI_16(); - uint res = DX & m68ki_read_16(ea); + uint ea = EA_AY_DI_16(); + uint res = DX & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_and_16_re_ix(void) { - uint ea = EA_AY_IX_16(); - uint res = DX & m68ki_read_16(ea); + uint ea = EA_AY_IX_16(); + uint res = DX & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_and_16_re_aw(void) { - uint ea = EA_AW_16(); - uint res = DX & m68ki_read_16(ea); + uint ea = EA_AW_16(); + uint res = DX & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_and_16_re_al(void) { - uint ea = EA_AL_16(); - uint res = DX & m68ki_read_16(ea); + uint ea = EA_AL_16(); + uint res = DX & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_and_32_re_ai(void) { - uint ea = EA_AY_AI_32(); - uint res = DX & m68ki_read_32(ea); + uint ea = EA_AY_AI_32(); + uint res = DX & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_and_32_re_pi(void) { - uint ea = EA_AY_PI_32(); - uint res = DX & m68ki_read_32(ea); + uint ea = EA_AY_PI_32(); + uint res = DX & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_and_32_re_pd(void) { - uint ea = EA_AY_PD_32(); - uint res = DX & m68ki_read_32(ea); + uint ea = EA_AY_PD_32(); + uint res = DX & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_and_32_re_di(void) { - uint ea = EA_AY_DI_32(); - uint res = DX & m68ki_read_32(ea); + uint ea = EA_AY_DI_32(); + uint res = DX & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_and_32_re_ix(void) { - uint ea = EA_AY_IX_32(); - uint res = DX & m68ki_read_32(ea); + uint ea = EA_AY_IX_32(); + uint res = DX & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_and_32_re_aw(void) { - uint ea = EA_AW_32(); - uint res = DX & m68ki_read_32(ea); + uint ea = EA_AW_32(); + uint res = DX & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_and_32_re_al(void) { - uint ea = EA_AL_32(); - uint res = DX & m68ki_read_32(ea); + uint ea = EA_AL_32(); + uint res = DX & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_andi_8_d(void) { - FLAG_Z = MASK_OUT_ABOVE_8(DY &= (OPER_I_8() | 0xffffff00)); + FLAG_Z = MASK_OUT_ABOVE_8(DY &= (OPER_I_8() | 0xffffff00)); - FLAG_N = NFLAG_8(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_andi_8_ai(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_AI_8(); - uint res = src & m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_AI_8(); + uint res = src & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_andi_8_pi(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PI_8(); - uint res = src & m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_PI_8(); + uint res = src & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_andi_8_pi7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PI_8(); - uint res = src & m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_A7_PI_8(); + uint res = src & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_andi_8_pd(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PD_8(); - uint res = src & m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_PD_8(); + uint res = src & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_andi_8_pd7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PD_8(); - uint res = src & m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_A7_PD_8(); + uint res = src & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_andi_8_di(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_DI_8(); - uint res = src & m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_DI_8(); + uint res = src & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_andi_8_ix(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_IX_8(); - uint res = src & m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_IX_8(); + uint res = src & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_andi_8_aw(void) { - uint src = OPER_I_8(); - uint ea = EA_AW_8(); - uint res = src & m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AW_8(); + uint res = src & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_andi_8_al(void) { - uint src = OPER_I_8(); - uint ea = EA_AL_8(); - uint res = src & m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AL_8(); + uint res = src & m68ki_read_8(ea); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_andi_16_d(void) { - FLAG_Z = MASK_OUT_ABOVE_16(DY &= (OPER_I_16() | 0xffff0000)); + FLAG_Z = MASK_OUT_ABOVE_16(DY &= (OPER_I_16() | 0xffff0000)); - FLAG_N = NFLAG_16(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_andi_16_ai(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_AI_16(); - uint res = src & m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_AI_16(); + uint res = src & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_andi_16_pi(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PI_16(); - uint res = src & m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_PI_16(); + uint res = src & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_andi_16_pd(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PD_16(); - uint res = src & m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_PD_16(); + uint res = src & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_andi_16_di(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_DI_16(); - uint res = src & m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_DI_16(); + uint res = src & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_andi_16_ix(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_IX_16(); - uint res = src & m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_IX_16(); + uint res = src & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_andi_16_aw(void) { - uint src = OPER_I_16(); - uint ea = EA_AW_16(); - uint res = src & m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AW_16(); + uint res = src & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_andi_16_al(void) { - uint src = OPER_I_16(); - uint ea = EA_AL_16(); - uint res = src & m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AL_16(); + uint res = src & m68ki_read_16(ea); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_andi_32_d(void) { - FLAG_Z = DY &= (OPER_I_32()); + FLAG_Z = DY &= (OPER_I_32()); - FLAG_N = NFLAG_32(FLAG_Z); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(FLAG_Z); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_andi_32_ai(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_AI_32(); - uint res = src & m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_AI_32(); + uint res = src & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_andi_32_pi(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PI_32(); - uint res = src & m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_PI_32(); + uint res = src & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_andi_32_pd(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PD_32(); - uint res = src & m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_PD_32(); + uint res = src & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_andi_32_di(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_DI_32(); - uint res = src & m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_DI_32(); + uint res = src & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_andi_32_ix(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_IX_32(); - uint res = src & m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_IX_32(); + uint res = src & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_andi_32_aw(void) { - uint src = OPER_I_32(); - uint ea = EA_AW_32(); - uint res = src & m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AW_32(); + uint res = src & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_andi_32_al(void) { - uint src = OPER_I_32(); - uint ea = EA_AL_32(); - uint res = src & m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AL_32(); + uint res = src & m68ki_read_32(ea); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_andi_16_toc(void) { - m68ki_set_ccr(m68ki_get_ccr() & OPER_I_16()); + m68ki_set_ccr(m68ki_get_ccr() & OPER_I_16()); } static void m68k_op_andi_16_tos(void) { - if(FLAG_S) - { - uint src = OPER_I_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(m68ki_get_sr() & src); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint src = OPER_I_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(m68ki_get_sr() & src); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_asr_8_s(void) { - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = src >> shift; + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = src >> shift; - if(shift != 0) - USE_CYCLES(shift<> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_16(*r_dst); - uint res = src >> shift; + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = src >> shift; - if(shift != 0) - USE_CYCLES(shift<> 9) - 1) & 7) + 1; - uint src = *r_dst; - uint res = src >> shift; + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = *r_dst; + uint res = src >> shift; - if(shift != 0) - USE_CYCLES(shift<> shift; + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = src >> shift; - if(shift != 0) - { - USE_CYCLES(shift<> shift; + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = src >> shift; - if(shift != 0) - { - USE_CYCLES(shift<> (shift - 1))<<8; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + FLAG_C = FLAG_X = (src >> (shift - 1))<<8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - if(GET_MSB_16(src)) - { - *r_dst |= 0xffff; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - return; - } + if(GET_MSB_16(src)) + { + *r_dst |= 0xffff; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + return; + } - *r_dst &= 0xffff0000; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - FLAG_N = NFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst &= 0xffff0000; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_16(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_asr_32_r(void) { - uint* r_dst = &DY; - uint shift = DX & 0x3f; - uint src = *r_dst; - uint res = src >> shift; + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = *r_dst; + uint res = src >> shift; - if(shift != 0) - { - USE_CYCLES(shift<> (shift - 1))<<8; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + FLAG_C = FLAG_X = (src >> (shift - 1))<<8; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - if(GET_MSB_32(src)) - { - *r_dst = 0xffffffff; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - return; - } + if(GET_MSB_32(src)) + { + *r_dst = 0xffffffff; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + return; + } - *r_dst = 0; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - FLAG_N = NFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst = 0; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_32(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_asr_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_AI_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - if(GET_MSB_16(src)) - res |= 0x8000; + if(GET_MSB_16(src)) + res |= 0x8000; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = FLAG_X = src << 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X = src << 8; } static void m68k_op_asr_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - if(GET_MSB_16(src)) - res |= 0x8000; + if(GET_MSB_16(src)) + res |= 0x8000; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = FLAG_X = src << 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X = src << 8; } static void m68k_op_asr_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - if(GET_MSB_16(src)) - res |= 0x8000; + if(GET_MSB_16(src)) + res |= 0x8000; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = FLAG_X = src << 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X = src << 8; } static void m68k_op_asr_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - if(GET_MSB_16(src)) - res |= 0x8000; + if(GET_MSB_16(src)) + res |= 0x8000; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = FLAG_X = src << 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X = src << 8; } static void m68k_op_asr_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - if(GET_MSB_16(src)) - res |= 0x8000; + if(GET_MSB_16(src)) + res |= 0x8000; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = FLAG_X = src << 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X = src << 8; } static void m68k_op_asr_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - if(GET_MSB_16(src)) - res |= 0x8000; + if(GET_MSB_16(src)) + res |= 0x8000; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = FLAG_X = src << 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X = src << 8; } static void m68k_op_asr_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - if(GET_MSB_16(src)) - res |= 0x8000; + if(GET_MSB_16(src)) + res |= 0x8000; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = FLAG_X = src << 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X = src << 8; } static void m68k_op_asl_8_s(void) { - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = MASK_OUT_ABOVE_8(src << shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = MASK_OUT_ABOVE_8(src << shift); - if(shift != 0) - USE_CYCLES(shift<> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_16(*r_dst); - uint res = MASK_OUT_ABOVE_16(src << shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = MASK_OUT_ABOVE_16(src << shift); - if(shift != 0) - USE_CYCLES(shift<> (8-shift); - src &= m68ki_shift_16_table[shift + 1]; - FLAG_V = (!(src == 0 || src == m68ki_shift_16_table[shift + 1]))<<7; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> (8-shift); + src &= m68ki_shift_16_table[shift + 1]; + FLAG_V = (!(src == 0 || src == m68ki_shift_16_table[shift + 1]))<<7; } static void m68k_op_asl_32_s(void) { - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = *r_dst; - uint res = MASK_OUT_ABOVE_32(src << shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = *r_dst; + uint res = MASK_OUT_ABOVE_32(src << shift); - if(shift != 0) - USE_CYCLES(shift<> (24-shift); - src &= m68ki_shift_32_table[shift + 1]; - FLAG_V = (!(src == 0 || src == m68ki_shift_32_table[shift + 1]))<<7; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> (24-shift); + src &= m68ki_shift_32_table[shift + 1]; + FLAG_V = (!(src == 0 || src == m68ki_shift_32_table[shift + 1]))<<7; } static void m68k_op_asl_8_r(void) { - uint* r_dst = &DY; - uint shift = DX & 0x3f; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = MASK_OUT_ABOVE_8(src << shift); + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = MASK_OUT_ABOVE_8(src << shift); - if(shift != 0) - { - USE_CYCLES(shift<> 8; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - src &= m68ki_shift_16_table[shift + 1]; - FLAG_V = (!(src == 0 || src == m68ki_shift_16_table[shift + 1]))<<7; - return; - } + if(shift < 16) + { + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + FLAG_X = FLAG_C = (src << shift) >> 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + src &= m68ki_shift_16_table[shift + 1]; + FLAG_V = (!(src == 0 || src == m68ki_shift_16_table[shift + 1]))<<7; + return; + } - *r_dst &= 0xffff0000; - FLAG_X = FLAG_C = ((shift == 16 ? src & 1 : 0))<<8; - FLAG_N = NFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; - FLAG_V = (!(src == 0))<<7; - return; - } + *r_dst &= 0xffff0000; + FLAG_X = FLAG_C = ((shift == 16 ? src & 1 : 0))<<8; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; + FLAG_V = (!(src == 0))<<7; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_16(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_asl_32_r(void) { - uint* r_dst = &DY; - uint shift = DX & 0x3f; - uint src = *r_dst; - uint res = MASK_OUT_ABOVE_32(src << shift); + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = *r_dst; + uint res = MASK_OUT_ABOVE_32(src << shift); - if(shift != 0) - { - USE_CYCLES(shift<> (32 - shift)) << 8; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - src &= m68ki_shift_32_table[shift + 1]; - FLAG_V = (!(src == 0 || src == m68ki_shift_32_table[shift + 1]))<<7; - return; - } + if(shift < 32) + { + *r_dst = res; + FLAG_X = FLAG_C = (src >> (32 - shift)) << 8; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + src &= m68ki_shift_32_table[shift + 1]; + FLAG_V = (!(src == 0 || src == m68ki_shift_32_table[shift + 1]))<<7; + return; + } - *r_dst = 0; - FLAG_X = FLAG_C = ((shift == 32 ? src & 1 : 0))<<8; - FLAG_N = NFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; - FLAG_V = (!(src == 0))<<7; - return; - } + *r_dst = 0; + FLAG_X = FLAG_C = ((shift == 32 ? src & 1 : 0))<<8; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; + FLAG_V = (!(src == 0))<<7; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_32(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_asl_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_AI_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - src &= 0xc000; - FLAG_V = (!(src == 0 || src == 0xc000))<<7; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + src &= 0xc000; + FLAG_V = (!(src == 0 || src == 0xc000))<<7; } static void m68k_op_asl_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - src &= 0xc000; - FLAG_V = (!(src == 0 || src == 0xc000))<<7; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + src &= 0xc000; + FLAG_V = (!(src == 0 || src == 0xc000))<<7; } static void m68k_op_asl_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - src &= 0xc000; - FLAG_V = (!(src == 0 || src == 0xc000))<<7; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + src &= 0xc000; + FLAG_V = (!(src == 0 || src == 0xc000))<<7; } static void m68k_op_asl_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - src &= 0xc000; - FLAG_V = (!(src == 0 || src == 0xc000))<<7; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + src &= 0xc000; + FLAG_V = (!(src == 0 || src == 0xc000))<<7; } static void m68k_op_asl_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - src &= 0xc000; - FLAG_V = (!(src == 0 || src == 0xc000))<<7; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + src &= 0xc000; + FLAG_V = (!(src == 0 || src == 0xc000))<<7; } static void m68k_op_asl_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - src &= 0xc000; - FLAG_V = (!(src == 0 || src == 0xc000))<<7; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + src &= 0xc000; + FLAG_V = (!(src == 0 || src == 0xc000))<<7; } static void m68k_op_asl_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - src &= 0xc000; - FLAG_V = (!(src == 0 || src == 0xc000))<<7; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + src &= 0xc000; + FLAG_V = (!(src == 0 || src == 0xc000))<<7; } static void m68k_op_bhi_8(void) { - if(COND_HI()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_HI()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bls_8(void) { - if(COND_LS()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_LS()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bcc_8(void) { - if(COND_CC()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_CC()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bcs_8(void) { - if(COND_CS()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_CS()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bne_8(void) { - if(COND_NE()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_NE()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_beq_8(void) { - if(COND_EQ()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_EQ()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bvc_8(void) { - if(COND_VC()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_VC()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bvs_8(void) { - if(COND_VS()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_VS()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bpl_8(void) { - if(COND_PL()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_PL()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bmi_8(void) { - if(COND_MI()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_MI()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bge_8(void) { - if(COND_GE()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_GE()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_blt_8(void) { - if(COND_LT()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_LT()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bgt_8(void) { - if(COND_GT()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_GT()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_ble_8(void) { - if(COND_LE()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); + if(COND_LE()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); } static void m68k_op_bhi_16(void) { - if(COND_HI()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_HI()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bls_16(void) { - if(COND_LS()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_LS()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bcc_16(void) { - if(COND_CC()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_CC()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bcs_16(void) { - if(COND_CS()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_CS()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bne_16(void) { - if(COND_NE()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_NE()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_beq_16(void) { - if(COND_EQ()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_EQ()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bvc_16(void) { - if(COND_VC()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_VC()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bvs_16(void) { - if(COND_VS()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_VS()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bpl_16(void) { - if(COND_PL()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_PL()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bmi_16(void) { - if(COND_MI()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_MI()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bge_16(void) { - if(COND_GE()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_GE()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_blt_16(void) { - if(COND_LT()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_LT()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bgt_16(void) { - if(COND_GT()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_GT()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_ble_16(void) { - if(COND_LE()) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_BCC_NOTAKE_W); + if(COND_LE()) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_BCC_NOTAKE_W); } static void m68k_op_bhi_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_HI()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_HI()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_HI()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_HI()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bls_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LS()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_LS()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LS()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_LS()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bcc_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_CC()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_CC()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_CC()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_CC()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bcs_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_CS()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_CS()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_CS()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_CS()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bne_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_NE()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_NE()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_NE()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_NE()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_beq_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_EQ()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_EQ()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_EQ()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_EQ()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bvc_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_VC()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_VC()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_VC()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_VC()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bvs_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_VS()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_VS()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_VS()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_VS()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bpl_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_PL()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_PL()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_PL()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_PL()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bmi_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_MI()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_MI()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_MI()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_MI()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bge_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_GE()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_GE()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_GE()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_GE()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_blt_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LT()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_LT()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LT()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_LT()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bgt_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_GT()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_GT()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_GT()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_GT()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_ble_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LE()) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - return; - } - REG_PC += 4; - return; - } - else - { - if(COND_LE()) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - return; - } - USE_CYCLES(CYC_BCC_NOTAKE_B); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LE()) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + return; + } + REG_PC += 4; + return; + } + else + { + if(COND_LE()) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + return; + } + USE_CYCLES(CYC_BCC_NOTAKE_B); + } } static void m68k_op_bchg_32_r_d(void) { - uint* r_dst = &DY; - uint mask = 1 << (DX & 0x1f); + uint* r_dst = &DY; + uint mask = 1 << (DX & 0x1f); - FLAG_Z = *r_dst & mask; - *r_dst ^= mask; + FLAG_Z = *r_dst & mask; + *r_dst ^= mask; } static void m68k_op_bchg_8_r_ai(void) { - uint ea = EA_AY_AI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_AI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_r_pi(void) { - uint ea = EA_AY_PI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_PI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_r_pi7(void) { - uint ea = EA_A7_PI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_A7_PI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_r_pd(void) { - uint ea = EA_AY_PD_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_PD_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_r_pd7(void) { - uint ea = EA_A7_PD_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_A7_PD_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_r_di(void) { - uint ea = EA_AY_DI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_DI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_r_ix(void) { - uint ea = EA_AY_IX_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_IX_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_r_aw(void) { - uint ea = EA_AW_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AW_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_r_al(void) { - uint ea = EA_AL_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AL_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_32_s_d(void) { - uint* r_dst = &DY; - uint mask = 1 << (OPER_I_8() & 0x1f); + uint* r_dst = &DY; + uint mask = 1 << (OPER_I_8() & 0x1f); - FLAG_Z = *r_dst & mask; - *r_dst ^= mask; + FLAG_Z = *r_dst & mask; + *r_dst ^= mask; } static void m68k_op_bchg_8_s_ai(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_AI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_AI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_s_pi(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_PI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_PI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_s_pi7(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_A7_PI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_A7_PI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_s_pd(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_PD_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_PD_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_s_pd7(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_A7_PD_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_A7_PD_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_s_di(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_DI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_DI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_s_ix(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_IX_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_IX_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_s_aw(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AW_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AW_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bchg_8_s_al(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AL_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AL_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src ^ mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src ^ mask); } static void m68k_op_bclr_32_r_d(void) { - uint* r_dst = &DY; - uint mask = 1 << (DX & 0x1f); + uint* r_dst = &DY; + uint mask = 1 << (DX & 0x1f); - FLAG_Z = *r_dst & mask; - *r_dst &= ~mask; + FLAG_Z = *r_dst & mask; + *r_dst &= ~mask; } static void m68k_op_bclr_8_r_ai(void) { - uint ea = EA_AY_AI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_AI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_r_pi(void) { - uint ea = EA_AY_PI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_PI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_r_pi7(void) { - uint ea = EA_A7_PI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_A7_PI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_r_pd(void) { - uint ea = EA_AY_PD_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_PD_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_r_pd7(void) { - uint ea = EA_A7_PD_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_A7_PD_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_r_di(void) { - uint ea = EA_AY_DI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_DI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_r_ix(void) { - uint ea = EA_AY_IX_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_IX_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_r_aw(void) { - uint ea = EA_AW_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AW_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_r_al(void) { - uint ea = EA_AL_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AL_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_32_s_d(void) { - uint* r_dst = &DY; - uint mask = 1 << (OPER_I_8() & 0x1f); + uint* r_dst = &DY; + uint mask = 1 << (OPER_I_8() & 0x1f); - FLAG_Z = *r_dst & mask; - *r_dst &= ~mask; + FLAG_Z = *r_dst & mask; + *r_dst &= ~mask; } static void m68k_op_bclr_8_s_ai(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_AI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_AI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_s_pi(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_PI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_PI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_s_pi7(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_A7_PI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_A7_PI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_s_pd(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_PD_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_PD_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_s_pd7(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_A7_PD_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_A7_PD_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_s_di(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_DI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_DI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_s_ix(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_IX_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_IX_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_s_aw(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AW_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AW_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bclr_8_s_al(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AL_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AL_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src & ~mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src & ~mask); } static void m68k_op_bfchg_32_d(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint offset = (word2>>6)&31; - uint width = word2; - uint* data = &DY; - uint64 mask; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint offset = (word2>>6)&31; + uint width = word2; + uint* data = &DY; + uint64 mask; - if(BIT_B(word2)) - offset = REG_D[offset&7]; - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = REG_D[offset&7]; + if(BIT_5(word2)) + width = REG_D[width&7]; - offset &= 31; - width = ((width-1) & 31) + 1; + offset &= 31; + width = ((width-1) & 31) + 1; - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); + mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask = ROR_32(mask, offset); - FLAG_N = NFLAG_32(*data<>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_AI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_AI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long ^ mask_long); + m68ki_write_32(ea, data_long ^ mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte ^ mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfchg_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_DI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_DI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long ^ mask_long); + m68ki_write_32(ea, data_long ^ mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte ^ mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfchg_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_IX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_IX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long ^ mask_long); + m68ki_write_32(ea, data_long ^ mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte ^ mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfchg_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AW_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AW_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long ^ mask_long); + m68ki_write_32(ea, data_long ^ mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte ^ mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfchg_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AL_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AL_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long ^ mask_long); + m68ki_write_32(ea, data_long ^ mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte ^ mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte ^ mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfclr_32_d(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint offset = (word2>>6)&31; - uint width = word2; - uint* data = &DY; - uint64 mask; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint offset = (word2>>6)&31; + uint width = word2; + uint* data = &DY; + uint64 mask; - if(BIT_B(word2)) - offset = REG_D[offset&7]; - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = REG_D[offset&7]; + if(BIT_5(word2)) + width = REG_D[width&7]; - offset &= 31; - width = ((width-1) & 31) + 1; + offset &= 31; + width = ((width-1) & 31) + 1; - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); + mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask = ROR_32(mask, offset); - FLAG_N = NFLAG_32(*data<>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_AI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_AI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long & ~mask_long); + m68ki_write_32(ea, data_long & ~mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte & ~mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfclr_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_DI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_DI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long & ~mask_long); + m68ki_write_32(ea, data_long & ~mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte & ~mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfclr_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_IX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_IX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long & ~mask_long); + m68ki_write_32(ea, data_long & ~mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte & ~mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfclr_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AW_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AW_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long & ~mask_long); + m68ki_write_32(ea, data_long & ~mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte & ~mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfclr_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AL_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AL_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long & ~mask_long); + m68ki_write_32(ea, data_long & ~mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte & ~mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte & ~mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfexts_32_d(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint offset = (word2>>6)&31; - uint width = word2; - uint64 data = DY; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint offset = (word2>>6)&31; + uint width = word2; + uint64 data = DY; - if(BIT_B(word2)) - offset = REG_D[offset&7]; - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = REG_D[offset&7]; + if(BIT_5(word2)) + width = REG_D[width&7]; - offset &= 31; - width = ((width-1) & 31) + 1; + offset &= 31; + width = ((width-1) & 31) + 1; - data = ROL_32(data, offset); - FLAG_N = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); + data = ROL_32(data, offset); + FLAG_N = NFLAG_32(data); + data = MAKE_INT_32(data) >> (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2>>12)&7] = data; + REG_D[(word2>>12)&7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfexts_32_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AY_AI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AY_AI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); + data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); + FLAG_N = NFLAG_32(data); + data = MAKE_INT_32(data) >> (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfexts_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AY_DI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AY_DI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); + data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); + FLAG_N = NFLAG_32(data); + data = MAKE_INT_32(data) >> (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfexts_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AY_IX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AY_IX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); + data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); + FLAG_N = NFLAG_32(data); + data = MAKE_INT_32(data) >> (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfexts_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AW_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AW_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); + data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); + FLAG_N = NFLAG_32(data); + data = MAKE_INT_32(data) >> (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfexts_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AL_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AL_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); + data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); + FLAG_N = NFLAG_32(data); + data = MAKE_INT_32(data) >> (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfexts_32_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_PCDI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_PCDI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); + data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); + FLAG_N = NFLAG_32(data); + data = MAKE_INT_32(data) >> (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfexts_32_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_PCIX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_PCIX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); + data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data = MAKE_INT_32(data) >> (32 - width); + FLAG_N = NFLAG_32(data); + data = MAKE_INT_32(data) >> (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfextu_32_d(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint offset = (word2>>6)&31; - uint width = word2; - uint64 data = DY; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint offset = (word2>>6)&31; + uint width = word2; + uint64 data = DY; - if(BIT_B(word2)) - offset = REG_D[offset&7]; - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = REG_D[offset&7]; + if(BIT_5(word2)) + width = REG_D[width&7]; - offset &= 31; - width = ((width-1) & 31) + 1; + offset &= 31; + width = ((width-1) & 31) + 1; - data = ROL_32(data, offset); - FLAG_N = NFLAG_32(data); - data >>= 32 - width; + data = ROL_32(data, offset); + FLAG_N = NFLAG_32(data); + data >>= 32 - width; - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2>>12)&7] = data; + REG_D[(word2>>12)&7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfextu_32_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AY_AI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AY_AI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfextu_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AY_DI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AY_DI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfextu_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AY_IX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AY_IX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfextu_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AW_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AW_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfextu_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_AL_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_AL_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfextu_32_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_PCDI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_PCDI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfextu_32_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint data; - uint ea = EA_PCIX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint data; + uint ea = EA_PCIX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << offset) >> 8; + if((offset+width) > 32) + data |= (m68ki_read_8(ea+4) << offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = data; + REG_D[(word2 >> 12) & 7] = data; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfffo_32_d(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint offset = (word2>>6)&31; - uint width = word2; - uint64 data = DY; - uint bit; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint offset = (word2>>6)&31; + uint width = word2; + uint64 data = DY; + uint bit; - if(BIT_B(word2)) - offset = REG_D[offset&7]; - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = REG_D[offset&7]; + if(BIT_5(word2)) + width = REG_D[width&7]; - offset &= 31; - width = ((width-1) & 31) + 1; + offset &= 31; + width = ((width-1) & 31) + 1; - data = ROL_32(data, offset); - FLAG_N = NFLAG_32(data); - data >>= 32 - width; + data = ROL_32(data, offset); + FLAG_N = NFLAG_32(data); + data >>= 32 - width; - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; + for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) + offset++; - REG_D[(word2>>12)&7] = offset; + REG_D[(word2>>12)&7] = offset; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfffo_32_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - sint local_offset; - uint width = word2; - uint data; - uint bit; - uint ea = EA_AY_AI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + sint local_offset; + uint width = word2; + uint data; + uint bit; + uint ea = EA_AY_AI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + local_offset = offset % 8; + if(local_offset < 0) + { + local_offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << local_offset) >> 8; + if((local_offset+width) > 32) + data |= (m68ki_read_8(ea+4) << local_offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; + for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) + offset++; - REG_D[(word2>>12)&7] = offset; + REG_D[(word2>>12)&7] = offset; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfffo_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - sint local_offset; - uint width = word2; - uint data; - uint bit; - uint ea = EA_AY_DI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + sint local_offset; + uint width = word2; + uint data; + uint bit; + uint ea = EA_AY_DI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + local_offset = offset % 8; + if(local_offset < 0) + { + local_offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << local_offset) >> 8; + if((local_offset+width) > 32) + data |= (m68ki_read_8(ea+4) << local_offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; + for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) + offset++; - REG_D[(word2>>12)&7] = offset; + REG_D[(word2>>12)&7] = offset; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfffo_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - sint local_offset; - uint width = word2; - uint data; - uint bit; - uint ea = EA_AY_IX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + sint local_offset; + uint width = word2; + uint data; + uint bit; + uint ea = EA_AY_IX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + local_offset = offset % 8; + if(local_offset < 0) + { + local_offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << local_offset) >> 8; + if((local_offset+width) > 32) + data |= (m68ki_read_8(ea+4) << local_offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; + for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) + offset++; - REG_D[(word2>>12)&7] = offset; + REG_D[(word2>>12)&7] = offset; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfffo_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - sint local_offset; - uint width = word2; - uint data; - uint bit; - uint ea = EA_AW_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + sint local_offset; + uint width = word2; + uint data; + uint bit; + uint ea = EA_AW_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + local_offset = offset % 8; + if(local_offset < 0) + { + local_offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << local_offset) >> 8; + if((local_offset+width) > 32) + data |= (m68ki_read_8(ea+4) << local_offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; + for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) + offset++; - REG_D[(word2>>12)&7] = offset; + REG_D[(word2>>12)&7] = offset; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfffo_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - sint local_offset; - uint width = word2; - uint data; - uint bit; - uint ea = EA_AL_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + sint local_offset; + uint width = word2; + uint data; + uint bit; + uint ea = EA_AL_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + local_offset = offset % 8; + if(local_offset < 0) + { + local_offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << local_offset) >> 8; + if((local_offset+width) > 32) + data |= (m68ki_read_8(ea+4) << local_offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; + for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) + offset++; - REG_D[(word2>>12)&7] = offset; + REG_D[(word2>>12)&7] = offset; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfffo_32_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - sint local_offset; - uint width = word2; - uint data; - uint bit; - uint ea = EA_PCDI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + sint local_offset; + uint width = word2; + uint data; + uint bit; + uint ea = EA_PCDI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + local_offset = offset % 8; + if(local_offset < 0) + { + local_offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << local_offset) >> 8; + if((local_offset+width) > 32) + data |= (m68ki_read_8(ea+4) << local_offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; + for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) + offset++; - REG_D[(word2>>12)&7] = offset; + REG_D[(word2>>12)&7] = offset; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfffo_32_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - sint local_offset; - uint width = word2; - uint data; - uint bit; - uint ea = EA_PCIX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + sint local_offset; + uint width = word2; + uint data; + uint bit; + uint ea = EA_PCIX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - local_offset = offset % 8; - if(local_offset < 0) - { - local_offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + local_offset = offset % 8; + if(local_offset < 0) + { + local_offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - data = m68ki_read_32(ea); - data = MASK_OUT_ABOVE_32(data< 32) - data |= (m68ki_read_8(ea+4) << local_offset) >> 8; + if((local_offset+width) > 32) + data |= (m68ki_read_8(ea+4) << local_offset) >> 8; - FLAG_N = NFLAG_32(data); - data >>= (32 - width); + FLAG_N = NFLAG_32(data); + data >>= (32 - width); - FLAG_Z = data; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = data; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) - offset++; + for(bit = 1<<(width-1);bit && !(data & bit);bit>>= 1) + offset++; - REG_D[(word2>>12)&7] = offset; + REG_D[(word2>>12)&7] = offset; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfins_32_d(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint offset = (word2>>6)&31; - uint width = word2; - uint* data = &DY; - uint64 mask; - uint64 insert = REG_D[(word2>>12)&7]; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint offset = (word2>>6)&31; + uint width = word2; + uint* data = &DY; + uint64 mask; + uint64 insert = REG_D[(word2>>12)&7]; - if(BIT_B(word2)) - offset = REG_D[offset&7]; - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = REG_D[offset&7]; + if(BIT_5(word2)) + width = REG_D[width&7]; - offset &= 31; - width = ((width-1) & 31) + 1; + offset &= 31; + width = ((width-1) & 31) + 1; - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); + mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask = ROR_32(mask, offset); - insert = MASK_OUT_ABOVE_32(insert << (32 - width)); - FLAG_N = NFLAG_32(insert); - FLAG_Z = insert; - insert = ROR_32(insert, offset); + insert = MASK_OUT_ABOVE_32(insert << (32 - width)); + FLAG_N = NFLAG_32(insert); + FLAG_Z = insert; + insert = ROR_32(insert, offset); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - *data &= ~mask; - *data |= insert; + *data &= ~mask; + *data |= insert; - return; - } - m68ki_exception_illegal(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfins_32_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint insert_base = REG_D[(word2>>12)&7]; - uint insert_long; - uint insert_byte; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_AI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint insert_base = REG_D[(word2>>12)&7]; + uint insert_long; + uint insert_byte; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_AI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - FLAG_N = NFLAG_32(insert_base); - FLAG_Z = insert_base; - insert_long = insert_base >> offset; + insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); + FLAG_N = NFLAG_32(insert_base); + FLAG_Z = insert_base; + insert_long = insert_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); + m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - insert_byte = MASK_OUT_ABOVE_8(insert_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + insert_byte = MASK_OUT_ABOVE_8(insert_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfins_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint insert_base = REG_D[(word2>>12)&7]; - uint insert_long; - uint insert_byte; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_DI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint insert_base = REG_D[(word2>>12)&7]; + uint insert_long; + uint insert_byte; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_DI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - FLAG_N = NFLAG_32(insert_base); - FLAG_Z = insert_base; - insert_long = insert_base >> offset; + insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); + FLAG_N = NFLAG_32(insert_base); + FLAG_Z = insert_base; + insert_long = insert_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); + m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - insert_byte = MASK_OUT_ABOVE_8(insert_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + insert_byte = MASK_OUT_ABOVE_8(insert_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfins_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint insert_base = REG_D[(word2>>12)&7]; - uint insert_long; - uint insert_byte; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_IX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint insert_base = REG_D[(word2>>12)&7]; + uint insert_long; + uint insert_byte; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_IX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - FLAG_N = NFLAG_32(insert_base); - FLAG_Z = insert_base; - insert_long = insert_base >> offset; + insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); + FLAG_N = NFLAG_32(insert_base); + FLAG_Z = insert_base; + insert_long = insert_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); + m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - insert_byte = MASK_OUT_ABOVE_8(insert_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + insert_byte = MASK_OUT_ABOVE_8(insert_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfins_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint insert_base = REG_D[(word2>>12)&7]; - uint insert_long; - uint insert_byte; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AW_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint insert_base = REG_D[(word2>>12)&7]; + uint insert_long; + uint insert_byte; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AW_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - FLAG_N = NFLAG_32(insert_base); - FLAG_Z = insert_base; - insert_long = insert_base >> offset; + insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); + FLAG_N = NFLAG_32(insert_base); + FLAG_Z = insert_base; + insert_long = insert_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); + m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - insert_byte = MASK_OUT_ABOVE_8(insert_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + insert_byte = MASK_OUT_ABOVE_8(insert_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfins_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint insert_base = REG_D[(word2>>12)&7]; - uint insert_long; - uint insert_byte; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AL_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint insert_base = REG_D[(word2>>12)&7]; + uint insert_long; + uint insert_byte; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AL_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); - FLAG_N = NFLAG_32(insert_base); - FLAG_Z = insert_base; - insert_long = insert_base >> offset; + insert_base = MASK_OUT_ABOVE_32(insert_base << (32 - width)); + FLAG_N = NFLAG_32(insert_base); + FLAG_Z = insert_base; + insert_long = insert_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); + m68ki_write_32(ea, (data_long & ~mask_long) | insert_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - insert_byte = MASK_OUT_ABOVE_8(insert_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + insert_byte = MASK_OUT_ABOVE_8(insert_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, (data_byte & ~mask_byte) | insert_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfset_32_d(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint offset = (word2>>6)&31; - uint width = word2; - uint* data = &DY; - uint64 mask; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint offset = (word2>>6)&31; + uint width = word2; + uint* data = &DY; + uint64 mask; - if(BIT_B(word2)) - offset = REG_D[offset&7]; - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = REG_D[offset&7]; + if(BIT_5(word2)) + width = REG_D[width&7]; - offset &= 31; - width = ((width-1) & 31) + 1; + offset &= 31; + width = ((width-1) & 31) + 1; - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); + mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask = ROR_32(mask, offset); - FLAG_N = NFLAG_32(*data<>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_AI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_AI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long | mask_long); + m68ki_write_32(ea, data_long | mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte | mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfset_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_DI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_DI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long | mask_long); + m68ki_write_32(ea, data_long | mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte | mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfset_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_IX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_IX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long | mask_long); + m68ki_write_32(ea, data_long | mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte | mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfset_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AW_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AW_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long | mask_long); + m68ki_write_32(ea, data_long | mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte | mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bfset_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AL_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AL_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = NFLAG_32(data_long << offset); - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = NFLAG_32(data_long << offset); + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - m68ki_write_32(ea, data_long | mask_long); + m68ki_write_32(ea, data_long | mask_long); - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - m68ki_write_8(ea+4, data_byte | mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + m68ki_write_8(ea+4, data_byte | mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bftst_32_d(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint offset = (word2>>6)&31; - uint width = word2; - uint* data = &DY; - uint64 mask; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint offset = (word2>>6)&31; + uint width = word2; + uint* data = &DY; + uint64 mask; - if(BIT_B(word2)) - offset = REG_D[offset&7]; - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = REG_D[offset&7]; + if(BIT_5(word2)) + width = REG_D[width&7]; - offset &= 31; - width = ((width-1) & 31) + 1; + offset &= 31; + width = ((width-1) & 31) + 1; - mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask = ROR_32(mask, offset); + mask = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask = ROR_32(mask, offset); - FLAG_N = NFLAG_32(*data<>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_AI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_AI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = ((data_long & (0x80000000 >> offset))<>24; - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = ((data_long & (0x80000000 >> offset))<>24; + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bftst_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_DI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_DI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = ((data_long & (0x80000000 >> offset))<>24; - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = ((data_long & (0x80000000 >> offset))<>24; + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bftst_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AY_IX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AY_IX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = ((data_long & (0x80000000 >> offset))<>24; - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = ((data_long & (0x80000000 >> offset))<>24; + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bftst_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AW_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AW_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = ((data_long & (0x80000000 >> offset))<>24; - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = ((data_long & (0x80000000 >> offset))<>24; + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bftst_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_AL_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_AL_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = ((data_long & (0x80000000 >> offset))<>24; - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = ((data_long & (0x80000000 >> offset))<>24; + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bftst_32_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_PCDI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_PCDI_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = ((data_long & (0x80000000 >> offset))<>24; - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = ((data_long & (0x80000000 >> offset))<>24; + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bftst_32_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - sint offset = (word2>>6)&31; - uint width = word2; - uint mask_base; - uint data_long; - uint mask_long; - uint data_byte = 0; - uint mask_byte = 0; - uint ea = EA_PCIX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + sint offset = (word2>>6)&31; + uint width = word2; + uint mask_base; + uint data_long; + uint mask_long; + uint data_byte = 0; + uint mask_byte = 0; + uint ea = EA_PCIX_8(); - if(BIT_B(word2)) - offset = MAKE_INT_32(REG_D[offset&7]); - if(BIT_5(word2)) - width = REG_D[width&7]; + if(BIT_B(word2)) + offset = MAKE_INT_32(REG_D[offset&7]); + if(BIT_5(word2)) + width = REG_D[width&7]; - /* Offset is signed so we have to use ugly math =( */ - ea += offset / 8; - offset %= 8; - if(offset < 0) - { - offset += 8; - ea--; - } - width = ((width-1) & 31) + 1; + /* Offset is signed so we have to use ugly math =( */ + ea += offset / 8; + offset %= 8; + if(offset < 0) + { + offset += 8; + ea--; + } + width = ((width-1) & 31) + 1; - mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); - mask_long = mask_base >> offset; + mask_base = MASK_OUT_ABOVE_32(0xffffffff << (32 - width)); + mask_long = mask_base >> offset; - data_long = m68ki_read_32(ea); - FLAG_N = ((data_long & (0x80000000 >> offset))<>24; - FLAG_Z = data_long & mask_long; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + data_long = m68ki_read_32(ea); + FLAG_N = ((data_long & (0x80000000 >> offset))<>24; + FLAG_Z = data_long & mask_long; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if((width + offset) > 32) - { - mask_byte = MASK_OUT_ABOVE_8(mask_base); - data_byte = m68ki_read_8(ea+4); - FLAG_Z |= (data_byte & mask_byte); - } - return; - } - m68ki_exception_illegal(); + if((width + offset) > 32) + { + mask_byte = MASK_OUT_ABOVE_8(mask_base); + data_byte = m68ki_read_8(ea+4); + FLAG_Z |= (data_byte & mask_byte); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_bkpt(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - m68ki_bkpt_ack(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE) ? REG_IR & 7 : 0); /* auto-disable (see m68kcpu.h) */ - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + m68ki_bkpt_ack(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE) ? REG_IR & 7 : 0); /* auto-disable (see m68kcpu.h) */ + } + m68ki_exception_illegal(); } static void m68k_op_bra_8(void) { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); } static void m68k_op_bra_16(void) { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); } static void m68k_op_bra_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint offset = OPER_I_32(); - REG_PC -= 4; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_32(offset); - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); - return; - } - else - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint offset = OPER_I_32(); + REG_PC -= 4; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_32(offset); + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); + return; + } + else + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); + } } static void m68k_op_bset_32_r_d(void) { - uint* r_dst = &DY; - uint mask = 1 << (DX & 0x1f); + uint* r_dst = &DY; + uint mask = 1 << (DX & 0x1f); - FLAG_Z = *r_dst & mask; - *r_dst |= mask; + FLAG_Z = *r_dst & mask; + *r_dst |= mask; } static void m68k_op_bset_8_r_ai(void) { - uint ea = EA_AY_AI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_AI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_r_pi(void) { - uint ea = EA_AY_PI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_PI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_r_pi7(void) { - uint ea = EA_A7_PI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_A7_PI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_r_pd(void) { - uint ea = EA_AY_PD_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_PD_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_r_pd7(void) { - uint ea = EA_A7_PD_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_A7_PD_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_r_di(void) { - uint ea = EA_AY_DI_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_DI_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_r_ix(void) { - uint ea = EA_AY_IX_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AY_IX_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_r_aw(void) { - uint ea = EA_AW_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AW_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_r_al(void) { - uint ea = EA_AL_8(); - uint src = m68ki_read_8(ea); - uint mask = 1 << (DX & 7); + uint ea = EA_AL_8(); + uint src = m68ki_read_8(ea); + uint mask = 1 << (DX & 7); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_32_s_d(void) { - uint* r_dst = &DY; - uint mask = 1 << (OPER_I_8() & 0x1f); + uint* r_dst = &DY; + uint mask = 1 << (OPER_I_8() & 0x1f); - FLAG_Z = *r_dst & mask; - *r_dst |= mask; + FLAG_Z = *r_dst & mask; + *r_dst |= mask; } static void m68k_op_bset_8_s_ai(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_AI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_AI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_s_pi(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_PI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_PI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_s_pi7(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_A7_PI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_A7_PI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_s_pd(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_PD_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_PD_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_s_pd7(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_A7_PD_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_A7_PD_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_s_di(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_DI_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_DI_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_s_ix(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AY_IX_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AY_IX_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_s_aw(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AW_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AW_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bset_8_s_al(void) { - uint mask = 1 << (OPER_I_8() & 7); - uint ea = EA_AL_8(); - uint src = m68ki_read_8(ea); + uint mask = 1 << (OPER_I_8() & 7); + uint ea = EA_AL_8(); + uint src = m68ki_read_8(ea); - FLAG_Z = src & mask; - m68ki_write_8(ea, src | mask); + FLAG_Z = src & mask; + m68ki_write_8(ea, src | mask); } static void m68k_op_bsr_8(void) { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); } static void m68k_op_bsr_16(void) { - uint offset = OPER_I_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - REG_PC -= 2; - m68ki_branch_16(offset); + uint offset = OPER_I_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + REG_PC -= 2; + m68ki_branch_16(offset); } static void m68k_op_bsr_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint offset = OPER_I_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - REG_PC -= 4; - m68ki_branch_32(offset); - return; - } - else - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); - } + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint offset = OPER_I_32(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + REG_PC -= 4; + m68ki_branch_32(offset); + return; + } + else + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + m68ki_branch_8(MASK_OUT_ABOVE_8(REG_IR)); + } } static void m68k_op_btst_32_r_d(void) { - FLAG_Z = DY & (1 << (DX & 0x1f)); + FLAG_Z = DY & (1 << (DX & 0x1f)); } static void m68k_op_btst_8_r_ai(void) { - FLAG_Z = OPER_AY_AI_8() & (1 << (DX & 7)); + FLAG_Z = OPER_AY_AI_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_pi(void) { - FLAG_Z = OPER_AY_PI_8() & (1 << (DX & 7)); + FLAG_Z = OPER_AY_PI_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_pi7(void) { - FLAG_Z = OPER_A7_PI_8() & (1 << (DX & 7)); + FLAG_Z = OPER_A7_PI_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_pd(void) { - FLAG_Z = OPER_AY_PD_8() & (1 << (DX & 7)); + FLAG_Z = OPER_AY_PD_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_pd7(void) { - FLAG_Z = OPER_A7_PD_8() & (1 << (DX & 7)); + FLAG_Z = OPER_A7_PD_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_di(void) { - FLAG_Z = OPER_AY_DI_8() & (1 << (DX & 7)); + FLAG_Z = OPER_AY_DI_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_ix(void) { - FLAG_Z = OPER_AY_IX_8() & (1 << (DX & 7)); + FLAG_Z = OPER_AY_IX_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_aw(void) { - FLAG_Z = OPER_AW_8() & (1 << (DX & 7)); + FLAG_Z = OPER_AW_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_al(void) { - FLAG_Z = OPER_AL_8() & (1 << (DX & 7)); + FLAG_Z = OPER_AL_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_pcdi(void) { - FLAG_Z = OPER_PCDI_8() & (1 << (DX & 7)); + FLAG_Z = OPER_PCDI_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_pcix(void) { - FLAG_Z = OPER_PCIX_8() & (1 << (DX & 7)); + FLAG_Z = OPER_PCIX_8() & (1 << (DX & 7)); } static void m68k_op_btst_8_r_i(void) { - FLAG_Z = OPER_I_8() & (1 << (DX & 7)); + FLAG_Z = OPER_I_8() & (1 << (DX & 7)); } static void m68k_op_btst_32_s_d(void) { - FLAG_Z = DY & (1 << (OPER_I_8() & 0x1f)); + FLAG_Z = DY & (1 << (OPER_I_8() & 0x1f)); } static void m68k_op_btst_8_s_ai(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_AY_AI_8() & (1 << bit); + FLAG_Z = OPER_AY_AI_8() & (1 << bit); } static void m68k_op_btst_8_s_pi(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_AY_PI_8() & (1 << bit); + FLAG_Z = OPER_AY_PI_8() & (1 << bit); } static void m68k_op_btst_8_s_pi7(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_A7_PI_8() & (1 << bit); + FLAG_Z = OPER_A7_PI_8() & (1 << bit); } static void m68k_op_btst_8_s_pd(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_AY_PD_8() & (1 << bit); + FLAG_Z = OPER_AY_PD_8() & (1 << bit); } static void m68k_op_btst_8_s_pd7(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_A7_PD_8() & (1 << bit); + FLAG_Z = OPER_A7_PD_8() & (1 << bit); } static void m68k_op_btst_8_s_di(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_AY_DI_8() & (1 << bit); + FLAG_Z = OPER_AY_DI_8() & (1 << bit); } static void m68k_op_btst_8_s_ix(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_AY_IX_8() & (1 << bit); + FLAG_Z = OPER_AY_IX_8() & (1 << bit); } static void m68k_op_btst_8_s_aw(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_AW_8() & (1 << bit); + FLAG_Z = OPER_AW_8() & (1 << bit); } static void m68k_op_btst_8_s_al(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_AL_8() & (1 << bit); + FLAG_Z = OPER_AL_8() & (1 << bit); } static void m68k_op_btst_8_s_pcdi(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_PCDI_8() & (1 << bit); + FLAG_Z = OPER_PCDI_8() & (1 << bit); } static void m68k_op_btst_8_s_pcix(void) { - uint bit = OPER_I_8() & 7; + uint bit = OPER_I_8() & 7; - FLAG_Z = OPER_PCIX_8() & (1 << bit); + FLAG_Z = OPER_PCIX_8() & (1 << bit); } static void m68k_op_callm_32_ai(void) { - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - { - uint ea = EA_AY_AI_32(); + /* note: watch out for pcrelative modes */ + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + { + uint ea = EA_AY_AI_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - REG_PC += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + REG_PC += 2; +(void)ea; /* just to avoid an 'unused variable' warning */ + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_illegal(); } static void m68k_op_callm_32_di(void) { - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - { - uint ea = EA_AY_DI_32(); + /* note: watch out for pcrelative modes */ + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + { + uint ea = EA_AY_DI_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - REG_PC += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + REG_PC += 2; +(void)ea; /* just to avoid an 'unused variable' warning */ + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_illegal(); } static void m68k_op_callm_32_ix(void) { - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - { - uint ea = EA_AY_IX_32(); + /* note: watch out for pcrelative modes */ + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + { + uint ea = EA_AY_IX_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - REG_PC += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + REG_PC += 2; +(void)ea; /* just to avoid an 'unused variable' warning */ + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_illegal(); } static void m68k_op_callm_32_aw(void) { - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - { - uint ea = EA_AW_32(); + /* note: watch out for pcrelative modes */ + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + { + uint ea = EA_AW_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - REG_PC += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + REG_PC += 2; +(void)ea; /* just to avoid an 'unused variable' warning */ + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_illegal(); } static void m68k_op_callm_32_al(void) { - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - { - uint ea = EA_AL_32(); + /* note: watch out for pcrelative modes */ + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + { + uint ea = EA_AL_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - REG_PC += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + REG_PC += 2; +(void)ea; /* just to avoid an 'unused variable' warning */ + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_illegal(); } static void m68k_op_callm_32_pcdi(void) { - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - { - uint ea = EA_PCDI_32(); + /* note: watch out for pcrelative modes */ + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + { + uint ea = EA_PCDI_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - REG_PC += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + REG_PC += 2; +(void)ea; /* just to avoid an 'unused variable' warning */ + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_illegal(); } static void m68k_op_callm_32_pcix(void) { - /* note: watch out for pcrelative modes */ - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - { - uint ea = EA_PCIX_32(); + /* note: watch out for pcrelative modes */ + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + { + uint ea = EA_PCIX_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - REG_PC += 2; -(void)ea; /* just to avoid an 'unused variable' warning */ - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + REG_PC += 2; +(void)ea; /* just to avoid an 'unused variable' warning */ + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_8_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_AI_8(); - uint dest = m68ki_read_8(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_8(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_AI_8(); + uint dest = m68ki_read_8(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_8(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(*compare, dest, res); - FLAG_C = CFLAG_8(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(*compare, dest, res); + FLAG_C = CFLAG_8(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_8(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_8_pi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PI_8(); - uint dest = m68ki_read_8(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_8(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PI_8(); + uint dest = m68ki_read_8(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_8(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(*compare, dest, res); - FLAG_C = CFLAG_8(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(*compare, dest, res); + FLAG_C = CFLAG_8(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_8(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_8_pi7(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_A7_PI_8(); - uint dest = m68ki_read_8(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_8(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_A7_PI_8(); + uint dest = m68ki_read_8(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_8(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(*compare, dest, res); - FLAG_C = CFLAG_8(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(*compare, dest, res); + FLAG_C = CFLAG_8(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_8(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_8_pd(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PD_8(); - uint dest = m68ki_read_8(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_8(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PD_8(); + uint dest = m68ki_read_8(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_8(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(*compare, dest, res); - FLAG_C = CFLAG_8(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(*compare, dest, res); + FLAG_C = CFLAG_8(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_8(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_8_pd7(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_A7_PD_8(); - uint dest = m68ki_read_8(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_8(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_A7_PD_8(); + uint dest = m68ki_read_8(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_8(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(*compare, dest, res); - FLAG_C = CFLAG_8(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(*compare, dest, res); + FLAG_C = CFLAG_8(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_8(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_8_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_DI_8(); - uint dest = m68ki_read_8(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_8(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_DI_8(); + uint dest = m68ki_read_8(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_8(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(*compare, dest, res); - FLAG_C = CFLAG_8(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(*compare, dest, res); + FLAG_C = CFLAG_8(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_8(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_8_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_IX_8(); - uint dest = m68ki_read_8(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_8(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_IX_8(); + uint dest = m68ki_read_8(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_8(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(*compare, dest, res); - FLAG_C = CFLAG_8(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(*compare, dest, res); + FLAG_C = CFLAG_8(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_8(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_8_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AW_8(); - uint dest = m68ki_read_8(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_8(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AW_8(); + uint dest = m68ki_read_8(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_8(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(*compare, dest, res); - FLAG_C = CFLAG_8(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(*compare, dest, res); + FLAG_C = CFLAG_8(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_8(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_8_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AL_8(); - uint dest = m68ki_read_8(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_8(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AL_8(); + uint dest = m68ki_read_8(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_8(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(*compare, dest, res); - FLAG_C = CFLAG_8(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(*compare, dest, res); + FLAG_C = CFLAG_8(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_8(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_8(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_16_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_AI_16(); - uint dest = m68ki_read_16(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_16(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_AI_16(); + uint dest = m68ki_read_16(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_16(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(*compare, dest, res); - FLAG_C = CFLAG_16(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(*compare, dest, res); + FLAG_C = CFLAG_16(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_16(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_16_pi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PI_16(); - uint dest = m68ki_read_16(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_16(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PI_16(); + uint dest = m68ki_read_16(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_16(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(*compare, dest, res); - FLAG_C = CFLAG_16(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(*compare, dest, res); + FLAG_C = CFLAG_16(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_16(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_16_pd(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PD_16(); - uint dest = m68ki_read_16(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_16(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PD_16(); + uint dest = m68ki_read_16(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_16(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(*compare, dest, res); - FLAG_C = CFLAG_16(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(*compare, dest, res); + FLAG_C = CFLAG_16(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_16(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_16_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_DI_16(); - uint dest = m68ki_read_16(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_16(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_DI_16(); + uint dest = m68ki_read_16(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_16(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(*compare, dest, res); - FLAG_C = CFLAG_16(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(*compare, dest, res); + FLAG_C = CFLAG_16(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_16(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_16_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_IX_16(); - uint dest = m68ki_read_16(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_16(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_IX_16(); + uint dest = m68ki_read_16(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_16(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(*compare, dest, res); - FLAG_C = CFLAG_16(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(*compare, dest, res); + FLAG_C = CFLAG_16(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_16(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_16_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AW_16(); - uint dest = m68ki_read_16(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_16(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AW_16(); + uint dest = m68ki_read_16(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_16(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(*compare, dest, res); - FLAG_C = CFLAG_16(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(*compare, dest, res); + FLAG_C = CFLAG_16(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_16(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_16_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AL_16(); - uint dest = m68ki_read_16(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - MASK_OUT_ABOVE_16(*compare); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AL_16(); + uint dest = m68ki_read_16(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - MASK_OUT_ABOVE_16(*compare); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(*compare, dest, res); - FLAG_C = CFLAG_16(res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(*compare, dest, res); + FLAG_C = CFLAG_16(res); - if(COND_NE()) - *compare = MASK_OUT_BELOW_16(*compare) | dest; - else - { - USE_CYCLES(3); - m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = MASK_OUT_BELOW_16(*compare) | dest; + else + { + USE_CYCLES(3); + m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_D[(word2 >> 6) & 7])); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_32_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_AI_32(); - uint dest = m68ki_read_32(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - *compare; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_AI_32(); + uint dest = m68ki_read_32(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - *compare; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(*compare, dest, res); - FLAG_C = CFLAG_SUB_32(*compare, dest, res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(*compare, dest, res); + FLAG_C = CFLAG_SUB_32(*compare, dest, res); - if(COND_NE()) - *compare = dest; - else - { - USE_CYCLES(3); - m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = dest; + else + { + USE_CYCLES(3); + m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_32_pi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PI_32(); - uint dest = m68ki_read_32(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - *compare; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PI_32(); + uint dest = m68ki_read_32(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - *compare; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(*compare, dest, res); - FLAG_C = CFLAG_SUB_32(*compare, dest, res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(*compare, dest, res); + FLAG_C = CFLAG_SUB_32(*compare, dest, res); - if(COND_NE()) - *compare = dest; - else - { - USE_CYCLES(3); - m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = dest; + else + { + USE_CYCLES(3); + m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_32_pd(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PD_32(); - uint dest = m68ki_read_32(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - *compare; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PD_32(); + uint dest = m68ki_read_32(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - *compare; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(*compare, dest, res); - FLAG_C = CFLAG_SUB_32(*compare, dest, res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(*compare, dest, res); + FLAG_C = CFLAG_SUB_32(*compare, dest, res); - if(COND_NE()) - *compare = dest; - else - { - USE_CYCLES(3); - m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = dest; + else + { + USE_CYCLES(3); + m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_DI_32(); - uint dest = m68ki_read_32(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - *compare; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_DI_32(); + uint dest = m68ki_read_32(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - *compare; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(*compare, dest, res); - FLAG_C = CFLAG_SUB_32(*compare, dest, res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(*compare, dest, res); + FLAG_C = CFLAG_SUB_32(*compare, dest, res); - if(COND_NE()) - *compare = dest; - else - { - USE_CYCLES(3); - m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = dest; + else + { + USE_CYCLES(3); + m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_IX_32(); - uint dest = m68ki_read_32(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - *compare; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_IX_32(); + uint dest = m68ki_read_32(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - *compare; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(*compare, dest, res); - FLAG_C = CFLAG_SUB_32(*compare, dest, res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(*compare, dest, res); + FLAG_C = CFLAG_SUB_32(*compare, dest, res); - if(COND_NE()) - *compare = dest; - else - { - USE_CYCLES(3); - m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = dest; + else + { + USE_CYCLES(3); + m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AW_32(); - uint dest = m68ki_read_32(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - *compare; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AW_32(); + uint dest = m68ki_read_32(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - *compare; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(*compare, dest, res); - FLAG_C = CFLAG_SUB_32(*compare, dest, res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(*compare, dest, res); + FLAG_C = CFLAG_SUB_32(*compare, dest, res); - if(COND_NE()) - *compare = dest; - else - { - USE_CYCLES(3); - m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = dest; + else + { + USE_CYCLES(3); + m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint ea = EA_AL_32(); - uint dest = m68ki_read_32(ea); - uint* compare = ®_D[word2 & 7]; - uint res = dest - *compare; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint ea = EA_AL_32(); + uint dest = m68ki_read_32(ea); + uint* compare = ®_D[word2 & 7]; + uint res = dest - *compare; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(*compare, dest, res); - FLAG_C = CFLAG_SUB_32(*compare, dest, res); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(*compare, dest, res); + FLAG_C = CFLAG_SUB_32(*compare, dest, res); - if(COND_NE()) - *compare = dest; - else - { - USE_CYCLES(3); - m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); - } - return; - } - m68ki_exception_illegal(); + if(COND_NE()) + *compare = dest; + else + { + USE_CYCLES(3); + m68ki_write_32(ea, REG_D[(word2 >> 6) & 7]); + } + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas2_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_32(); - uint* compare1 = ®_D[(word2 >> 16) & 7]; - uint ea1 = REG_DA[(word2 >> 28) & 15]; - uint dest1 = m68ki_read_16(ea1); - uint res1 = dest1 - MASK_OUT_ABOVE_16(*compare1); - uint* compare2 = ®_D[word2 & 7]; - uint ea2 = REG_DA[(word2 >> 12) & 15]; - uint dest2 = m68ki_read_16(ea2); - uint res2; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_32(); + uint* compare1 = ®_D[(word2 >> 16) & 7]; + uint ea1 = REG_DA[(word2 >> 28) & 15]; + uint dest1 = m68ki_read_16(ea1); + uint res1 = dest1 - MASK_OUT_ABOVE_16(*compare1); + uint* compare2 = ®_D[word2 & 7]; + uint ea2 = REG_DA[(word2 >> 12) & 15]; + uint dest2 = m68ki_read_16(ea2); + uint res2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_16(res1); - FLAG_Z = MASK_OUT_ABOVE_16(res1); - FLAG_V = VFLAG_SUB_16(*compare1, dest1, res1); - FLAG_C = CFLAG_16(res1); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_16(res1); + FLAG_Z = MASK_OUT_ABOVE_16(res1); + FLAG_V = VFLAG_SUB_16(*compare1, dest1, res1); + FLAG_C = CFLAG_16(res1); - if(COND_EQ()) - { - res2 = dest2 - MASK_OUT_ABOVE_16(*compare2); + if(COND_EQ()) + { + res2 = dest2 - MASK_OUT_ABOVE_16(*compare2); - FLAG_N = NFLAG_16(res2); - FLAG_Z = MASK_OUT_ABOVE_16(res2); - FLAG_V = VFLAG_SUB_16(*compare2, dest2, res2); - FLAG_C = CFLAG_16(res2); + FLAG_N = NFLAG_16(res2); + FLAG_Z = MASK_OUT_ABOVE_16(res2); + FLAG_V = VFLAG_SUB_16(*compare2, dest2, res2); + FLAG_C = CFLAG_16(res2); - if(COND_EQ()) - { - USE_CYCLES(3); - m68ki_write_16(ea1, REG_D[(word2 >> 22) & 7]); - m68ki_write_16(ea2, REG_D[(word2 >> 6) & 7]); - return; - } - } - *compare1 = BIT_1F(word2) ? MAKE_INT_16(dest1) : MASK_OUT_BELOW_16(*compare1) | dest1; - *compare2 = BIT_F(word2) ? MAKE_INT_16(dest2) : MASK_OUT_BELOW_16(*compare2) | dest2; - return; - } - m68ki_exception_illegal(); + if(COND_EQ()) + { + USE_CYCLES(3); + m68ki_write_16(ea1, REG_D[(word2 >> 22) & 7]); + m68ki_write_16(ea2, REG_D[(word2 >> 6) & 7]); + return; + } + } + *compare1 = BIT_1F(word2) ? MAKE_INT_16(dest1) : MASK_OUT_BELOW_16(*compare1) | dest1; + *compare2 = BIT_F(word2) ? MAKE_INT_16(dest2) : MASK_OUT_BELOW_16(*compare2) | dest2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_cas2_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_32(); - uint* compare1 = ®_D[(word2 >> 16) & 7]; - uint ea1 = REG_DA[(word2 >> 28) & 15]; - uint dest1 = m68ki_read_32(ea1); - uint res1 = dest1 - *compare1; - uint* compare2 = ®_D[word2 & 7]; - uint ea2 = REG_DA[(word2 >> 12) & 15]; - uint dest2 = m68ki_read_32(ea2); - uint res2; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_32(); + uint* compare1 = ®_D[(word2 >> 16) & 7]; + uint ea1 = REG_DA[(word2 >> 28) & 15]; + uint dest1 = m68ki_read_32(ea1); + uint res1 = dest1 - *compare1; + uint* compare2 = ®_D[word2 & 7]; + uint ea2 = REG_DA[(word2 >> 12) & 15]; + uint dest2 = m68ki_read_32(ea2); + uint res2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_32(res1); - FLAG_Z = MASK_OUT_ABOVE_32(res1); - FLAG_V = VFLAG_SUB_32(*compare1, dest1, res1); - FLAG_C = CFLAG_SUB_32(*compare1, dest1, res1); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + FLAG_N = NFLAG_32(res1); + FLAG_Z = MASK_OUT_ABOVE_32(res1); + FLAG_V = VFLAG_SUB_32(*compare1, dest1, res1); + FLAG_C = CFLAG_SUB_32(*compare1, dest1, res1); - if(COND_EQ()) - { - res2 = dest2 - *compare2; + if(COND_EQ()) + { + res2 = dest2 - *compare2; - FLAG_N = NFLAG_32(res2); - FLAG_Z = MASK_OUT_ABOVE_32(res2); - FLAG_V = VFLAG_SUB_32(*compare2, dest2, res2); - FLAG_C = CFLAG_SUB_32(*compare2, dest2, res2); + FLAG_N = NFLAG_32(res2); + FLAG_Z = MASK_OUT_ABOVE_32(res2); + FLAG_V = VFLAG_SUB_32(*compare2, dest2, res2); + FLAG_C = CFLAG_SUB_32(*compare2, dest2, res2); - if(COND_EQ()) - { - USE_CYCLES(3); - m68ki_write_32(ea1, REG_D[(word2 >> 22) & 7]); - m68ki_write_32(ea2, REG_D[(word2 >> 6) & 7]); - return; - } - } - *compare1 = dest1; - *compare2 = dest2; - return; - } - m68ki_exception_illegal(); + if(COND_EQ()) + { + USE_CYCLES(3); + m68ki_write_32(ea1, REG_D[(word2 >> 22) & 7]); + m68ki_write_32(ea2, REG_D[(word2 >> 6) & 7]); + return; + } + } + *compare1 = dest1; + *compare2 = dest2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_16_d(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(DY); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(DY); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_ai(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_AY_AI_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_AY_AI_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_pi(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_AY_PI_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_AY_PI_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_pd(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_AY_PD_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_AY_PD_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_di(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_AY_DI_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_AY_DI_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_ix(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_AY_IX_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_AY_IX_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_aw(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_AW_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_AW_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_al(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_AL_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_AL_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_pcdi(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_PCDI_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_PCDI_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_pcix(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_PCIX_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_PCIX_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_16_i(void) { - sint src = MAKE_INT_16(DX); - sint bound = MAKE_INT_16(OPER_I_16()); + sint src = MAKE_INT_16(DX); + sint bound = MAKE_INT_16(OPER_I_16()); - FLAG_Z = ZFLAG_16(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_16(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); } static void m68k_op_chk_32_d(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(DY); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(DY); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_AY_AI_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_AY_AI_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_pi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_AY_PI_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_AY_PI_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_pd(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_AY_PD_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_AY_PD_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_AY_DI_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_AY_DI_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_AY_IX_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_AY_IX_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_AW_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_AW_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_AL_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_AL_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_PCDI_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_PCDI_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_PCIX_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_PCIX_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk_32_i(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - sint src = MAKE_INT_32(DX); - sint bound = MAKE_INT_32(OPER_I_32()); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + sint src = MAKE_INT_32(DX); + sint bound = MAKE_INT_32(OPER_I_32()); - FLAG_Z = ZFLAG_32(src); /* Undocumented */ - FLAG_V = VFLAG_CLEAR; /* Undocumented */ - FLAG_C = CFLAG_CLEAR; /* Undocumented */ + FLAG_Z = ZFLAG_32(src); /* Undocumented */ + FLAG_V = VFLAG_CLEAR; /* Undocumented */ + FLAG_C = CFLAG_CLEAR; /* Undocumented */ - if(src >= 0 && src <= bound) - { - return; - } - FLAG_N = (src < 0)<<7; - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(src >= 0 && src <= bound) + { + return; + } + FLAG_N = (src < 0)<<7; + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_8_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xff; - uint ea = EA_PCDI_8(); - uint lower_bound = m68ki_read_pcrel_8(ea); - uint upper_bound = m68ki_read_pcrel_8(ea + 1); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xff; + uint ea = EA_PCDI_8(); + uint lower_bound = m68ki_read_pcrel_8(ea); + uint upper_bound = m68ki_read_pcrel_8(ea + 1); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); + else + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_8_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xff; - uint ea = EA_PCIX_8(); - uint lower_bound = m68ki_read_pcrel_8(ea); - uint upper_bound = m68ki_read_pcrel_8(ea + 1); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xff; + uint ea = EA_PCIX_8(); + uint lower_bound = m68ki_read_pcrel_8(ea); + uint upper_bound = m68ki_read_pcrel_8(ea + 1); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); + else + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_8_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xff; - uint ea = EA_AY_AI_8(); - uint lower_bound = m68ki_read_8(ea); - uint upper_bound = m68ki_read_8(ea + 1); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xff; + uint ea = EA_AY_AI_8(); + uint lower_bound = m68ki_read_8(ea); + uint upper_bound = m68ki_read_8(ea + 1); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); + else + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_8_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xff; - uint ea = EA_AY_DI_8(); - uint lower_bound = m68ki_read_8(ea); - uint upper_bound = m68ki_read_8(ea + 1); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xff; + uint ea = EA_AY_DI_8(); + uint lower_bound = m68ki_read_8(ea); + uint upper_bound = m68ki_read_8(ea + 1); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); + else + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_8_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xff; - uint ea = EA_AY_IX_8(); - uint lower_bound = m68ki_read_8(ea); - uint upper_bound = m68ki_read_8(ea + 1); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xff; + uint ea = EA_AY_IX_8(); + uint lower_bound = m68ki_read_8(ea); + uint upper_bound = m68ki_read_8(ea + 1); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); + else + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_8_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xff; - uint ea = EA_AW_8(); - uint lower_bound = m68ki_read_8(ea); - uint upper_bound = m68ki_read_8(ea + 1); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xff; + uint ea = EA_AW_8(); + uint lower_bound = m68ki_read_8(ea); + uint upper_bound = m68ki_read_8(ea + 1); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); + else + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_8_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xff; - uint ea = EA_AL_8(); - uint lower_bound = m68ki_read_8(ea); - uint upper_bound = m68ki_read_8(ea + 1); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xff; + uint ea = EA_AL_8(); + uint lower_bound = m68ki_read_8(ea); + uint upper_bound = m68ki_read_8(ea + 1); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); - else - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_8(compare) - MAKE_INT_8(lower_bound); + else + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_16_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; - uint ea = EA_PCDI_16(); - uint lower_bound = m68ki_read_pcrel_16(ea); - uint upper_bound = m68ki_read_pcrel_16(ea + 2); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; + uint ea = EA_PCDI_16(); + uint lower_bound = m68ki_read_pcrel_16(ea); + uint upper_bound = m68ki_read_pcrel_16(ea + 2); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); + else + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); + else + FLAG_C = upper_bound - compare; + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_16_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; - uint ea = EA_PCIX_16(); - uint lower_bound = m68ki_read_pcrel_16(ea); - uint upper_bound = m68ki_read_pcrel_16(ea + 2); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; + uint ea = EA_PCIX_16(); + uint lower_bound = m68ki_read_pcrel_16(ea); + uint upper_bound = m68ki_read_pcrel_16(ea + 2); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); + else + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); + else + FLAG_C = upper_bound - compare; + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_16_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; - uint ea = EA_AY_AI_16(); - uint lower_bound = m68ki_read_16(ea); - uint upper_bound = m68ki_read_16(ea + 2); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; + uint ea = EA_AY_AI_16(); + uint lower_bound = m68ki_read_16(ea); + uint upper_bound = m68ki_read_16(ea + 2); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - FLAG_C = compare - lower_bound; + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); + else + FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - FLAG_C = upper_bound - compare; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); + else + FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_16_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; - uint ea = EA_AY_DI_16(); - uint lower_bound = m68ki_read_16(ea); - uint upper_bound = m68ki_read_16(ea + 2); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; + uint ea = EA_AY_DI_16(); + uint lower_bound = m68ki_read_16(ea); + uint upper_bound = m68ki_read_16(ea + 2); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - FLAG_C = compare - lower_bound; + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); + else + FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - FLAG_C = upper_bound - compare; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); + else + FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_16_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; - uint ea = EA_AY_IX_16(); - uint lower_bound = m68ki_read_16(ea); - uint upper_bound = m68ki_read_16(ea + 2); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; + uint ea = EA_AY_IX_16(); + uint lower_bound = m68ki_read_16(ea); + uint upper_bound = m68ki_read_16(ea + 2); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - FLAG_C = compare - lower_bound; + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); + else + FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - FLAG_C = upper_bound - compare; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); + else + FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_16_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; - uint ea = EA_AW_16(); - uint lower_bound = m68ki_read_16(ea); - uint upper_bound = m68ki_read_16(ea + 2); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; + uint ea = EA_AW_16(); + uint lower_bound = m68ki_read_16(ea); + uint upper_bound = m68ki_read_16(ea + 2); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - FLAG_C = compare - lower_bound; + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); + else + FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - FLAG_C = upper_bound - compare; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); + else + FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_16_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; - uint ea = EA_AL_16(); - uint lower_bound = m68ki_read_16(ea); - uint upper_bound = m68ki_read_16(ea + 2); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]&0xffff; + uint ea = EA_AL_16(); + uint lower_bound = m68ki_read_16(ea); + uint upper_bound = m68ki_read_16(ea + 2); - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); - else - FLAG_C = compare - lower_bound; + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(compare) - MAKE_INT_16(lower_bound); + else + FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - if(!BIT_F(word2)) - FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); - else - FLAG_C = upper_bound - compare; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + if(!BIT_F(word2)) + FLAG_C = MAKE_INT_16(upper_bound) - MAKE_INT_16(compare); + else + FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_16(FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = CFLAG_16(FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_32_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]; - uint ea = EA_PCDI_32(); - uint lower_bound = m68ki_read_pcrel_32(ea); - uint upper_bound = m68ki_read_pcrel_32(ea + 4); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]; + uint ea = EA_PCDI_32(); + uint lower_bound = m68ki_read_pcrel_32(ea); + uint upper_bound = m68ki_read_pcrel_32(ea + 4); - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_32_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]; - uint ea = EA_PCIX_32(); - uint lower_bound = m68ki_read_pcrel_32(ea); - uint upper_bound = m68ki_read_pcrel_32(ea + 4); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]; + uint ea = EA_PCIX_32(); + uint lower_bound = m68ki_read_pcrel_32(ea); + uint upper_bound = m68ki_read_pcrel_32(ea + 4); - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_32_ai(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]; - uint ea = EA_AY_AI_32(); - uint lower_bound = m68ki_read_32(ea); - uint upper_bound = m68ki_read_32(ea + 4); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]; + uint ea = EA_AY_AI_32(); + uint lower_bound = m68ki_read_32(ea); + uint upper_bound = m68ki_read_32(ea + 4); - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_32_di(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]; - uint ea = EA_AY_DI_32(); - uint lower_bound = m68ki_read_32(ea); - uint upper_bound = m68ki_read_32(ea + 4); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]; + uint ea = EA_AY_DI_32(); + uint lower_bound = m68ki_read_32(ea); + uint upper_bound = m68ki_read_32(ea + 4); - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_32_ix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]; - uint ea = EA_AY_IX_32(); - uint lower_bound = m68ki_read_32(ea); - uint upper_bound = m68ki_read_32(ea + 4); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]; + uint ea = EA_AY_IX_32(); + uint lower_bound = m68ki_read_32(ea); + uint upper_bound = m68ki_read_32(ea + 4); - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_32_aw(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]; - uint ea = EA_AW_32(); - uint lower_bound = m68ki_read_32(ea); - uint upper_bound = m68ki_read_32(ea + 4); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]; + uint ea = EA_AW_32(); + uint lower_bound = m68ki_read_32(ea); + uint upper_bound = m68ki_read_32(ea + 4); - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_chk2cmp2_32_al(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint compare = REG_DA[(word2 >> 12) & 15]; - uint ea = EA_AL_32(); - uint lower_bound = m68ki_read_32(ea); - uint upper_bound = m68ki_read_32(ea + 4); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint compare = REG_DA[(word2 >> 12) & 15]; + uint ea = EA_AL_32(); + uint lower_bound = m68ki_read_32(ea); + uint upper_bound = m68ki_read_32(ea + 4); - FLAG_C = compare - lower_bound; - FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); - FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); - if(COND_CS()) - { - if(BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } + FLAG_C = compare - lower_bound; + FLAG_Z = !((upper_bound==compare) | (lower_bound==compare)); + FLAG_C = CFLAG_SUB_32(lower_bound, compare, FLAG_C); + if(COND_CS()) + { + if(BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } - FLAG_C = upper_bound - compare; - FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); - if(COND_CS() && BIT_B(word2)) - m68ki_exception_trap(EXCEPTION_CHK); - return; - } - m68ki_exception_illegal(); + FLAG_C = upper_bound - compare; + FLAG_C = CFLAG_SUB_32(compare, upper_bound, FLAG_C); + if(COND_CS() && BIT_B(word2)) + m68ki_exception_trap(EXCEPTION_CHK); + return; + } + m68ki_exception_illegal(); } static void m68k_op_clr_8_d(void) { - DY &= 0xffffff00; + DY &= 0xffffff00; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), 0); + m68ki_write_8(EA_AY_AI_8(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), 0); + m68ki_write_8(EA_AY_PI_8(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), 0); + m68ki_write_8(EA_A7_PI_8(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), 0); + m68ki_write_8(EA_AY_PD_8(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), 0); + m68ki_write_8(EA_A7_PD_8(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), 0); + m68ki_write_8(EA_AY_DI_8(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), 0); + m68ki_write_8(EA_AY_IX_8(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_8_aw(void) { - m68ki_write_8(EA_AW_8(), 0); + m68ki_write_8(EA_AW_8(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_8_al(void) { - m68ki_write_8(EA_AL_8(), 0); + m68ki_write_8(EA_AL_8(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_16_d(void) { - DY &= 0xffff0000; + DY &= 0xffff0000; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_16_ai(void) { - m68ki_write_16(EA_AY_AI_16(), 0); + m68ki_write_16(EA_AY_AI_16(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_16_pi(void) { - m68ki_write_16(EA_AY_PI_16(), 0); + m68ki_write_16(EA_AY_PI_16(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_16_pd(void) { - m68ki_write_16(EA_AY_PD_16(), 0); + m68ki_write_16(EA_AY_PD_16(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_16_di(void) { - m68ki_write_16(EA_AY_DI_16(), 0); + m68ki_write_16(EA_AY_DI_16(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_16_ix(void) { - m68ki_write_16(EA_AY_IX_16(), 0); + m68ki_write_16(EA_AY_IX_16(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_16_aw(void) { - m68ki_write_16(EA_AW_16(), 0); + m68ki_write_16(EA_AW_16(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_16_al(void) { - m68ki_write_16(EA_AL_16(), 0); + m68ki_write_16(EA_AL_16(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_32_d(void) { - DY = 0; + DY = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_32_ai(void) { - m68ki_write_32(EA_AY_AI_32(), 0); + m68ki_write_32(EA_AY_AI_32(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_32_pi(void) { - m68ki_write_32(EA_AY_PI_32(), 0); + m68ki_write_32(EA_AY_PI_32(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_32_pd(void) { - m68ki_write_32(EA_AY_PD_32(), 0); + m68ki_write_32(EA_AY_PD_32(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_32_di(void) { - m68ki_write_32(EA_AY_DI_32(), 0); + m68ki_write_32(EA_AY_DI_32(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_32_ix(void) { - m68ki_write_32(EA_AY_IX_32(), 0); + m68ki_write_32(EA_AY_IX_32(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_32_aw(void) { - m68ki_write_32(EA_AW_32(), 0); + m68ki_write_32(EA_AW_32(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_clr_32_al(void) { - m68ki_write_32(EA_AL_32(), 0); + m68ki_write_32(EA_AL_32(), 0); - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; } static void m68k_op_cmp_8_d(void) { - uint src = MASK_OUT_ABOVE_8(DY); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = MASK_OUT_ABOVE_8(DY); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_ai(void) { - uint src = OPER_AY_AI_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_AY_AI_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_pi(void) { - uint src = OPER_AY_PI_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_AY_PI_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_pi7(void) { - uint src = OPER_A7_PI_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_A7_PI_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_pd(void) { - uint src = OPER_AY_PD_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_AY_PD_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_pd7(void) { - uint src = OPER_A7_PD_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_A7_PD_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_di(void) { - uint src = OPER_AY_DI_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_AY_DI_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_ix(void) { - uint src = OPER_AY_IX_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_AY_IX_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_aw(void) { - uint src = OPER_AW_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_AW_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_al(void) { - uint src = OPER_AL_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_AL_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_pcdi(void) { - uint src = OPER_PCDI_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_PCDI_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_pcix(void) { - uint src = OPER_PCIX_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_PCIX_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_8_i(void) { - uint src = OPER_I_8(); - uint dst = MASK_OUT_ABOVE_8(DX); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = MASK_OUT_ABOVE_8(DX); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmp_16_d(void) { - uint src = MASK_OUT_ABOVE_16(DY); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = MASK_OUT_ABOVE_16(DY); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_a(void) { - uint src = MASK_OUT_ABOVE_16(AY); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = MASK_OUT_ABOVE_16(AY); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_ai(void) { - uint src = OPER_AY_AI_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_AY_AI_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_pi(void) { - uint src = OPER_AY_PI_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_AY_PI_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_pd(void) { - uint src = OPER_AY_PD_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_AY_PD_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_di(void) { - uint src = OPER_AY_DI_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_AY_DI_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_ix(void) { - uint src = OPER_AY_IX_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_AY_IX_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_aw(void) { - uint src = OPER_AW_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_AW_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_al(void) { - uint src = OPER_AL_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_AL_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_pcdi(void) { - uint src = OPER_PCDI_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_PCDI_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_pcix(void) { - uint src = OPER_PCIX_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_PCIX_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_16_i(void) { - uint src = OPER_I_16(); - uint dst = MASK_OUT_ABOVE_16(DX); - uint res = dst - src; + uint src = OPER_I_16(); + uint dst = MASK_OUT_ABOVE_16(DX); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmp_32_d(void) { - uint src = DY; - uint dst = DX; - uint res = dst - src; + uint src = DY; + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_a(void) { - uint src = AY; - uint dst = DX; - uint res = dst - src; + uint src = AY; + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_ai(void) { - uint src = OPER_AY_AI_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_AY_AI_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_pi(void) { - uint src = OPER_AY_PI_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_AY_PI_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_pd(void) { - uint src = OPER_AY_PD_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_AY_PD_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_di(void) { - uint src = OPER_AY_DI_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_AY_DI_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_ix(void) { - uint src = OPER_AY_IX_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_AY_IX_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_aw(void) { - uint src = OPER_AW_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_AW_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_al(void) { - uint src = OPER_AL_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_AL_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_pcdi(void) { - uint src = OPER_PCDI_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_PCDI_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_pcix(void) { - uint src = OPER_PCIX_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_PCIX_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmp_32_i(void) { - uint src = OPER_I_32(); - uint dst = DX; - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = DX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_d(void) { - uint src = MAKE_INT_16(DY); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(DY); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_a(void) { - uint src = MAKE_INT_16(AY); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(AY); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_ai(void) { - uint src = MAKE_INT_16(OPER_AY_AI_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_AY_AI_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_pi(void) { - uint src = MAKE_INT_16(OPER_AY_PI_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_AY_PI_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_pd(void) { - uint src = MAKE_INT_16(OPER_AY_PD_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_AY_PD_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_di(void) { - uint src = MAKE_INT_16(OPER_AY_DI_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_AY_DI_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_ix(void) { - uint src = MAKE_INT_16(OPER_AY_IX_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_AY_IX_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_aw(void) { - uint src = MAKE_INT_16(OPER_AW_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_AW_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_al(void) { - uint src = MAKE_INT_16(OPER_AL_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_AL_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_pcdi(void) { - uint src = MAKE_INT_16(OPER_PCDI_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_PCDI_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_pcix(void) { - uint src = MAKE_INT_16(OPER_PCIX_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_PCIX_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_16_i(void) { - uint src = MAKE_INT_16(OPER_I_16()); - uint dst = AX; - uint res = dst - src; + uint src = MAKE_INT_16(OPER_I_16()); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_d(void) { - uint src = DY; - uint dst = AX; - uint res = dst - src; + uint src = DY; + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_a(void) { - uint src = AY; - uint dst = AX; - uint res = dst - src; + uint src = AY; + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_ai(void) { - uint src = OPER_AY_AI_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_AY_AI_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_pi(void) { - uint src = OPER_AY_PI_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_AY_PI_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_pd(void) { - uint src = OPER_AY_PD_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_AY_PD_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_di(void) { - uint src = OPER_AY_DI_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_AY_DI_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_ix(void) { - uint src = OPER_AY_IX_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_AY_IX_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_aw(void) { - uint src = OPER_AW_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_AW_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_al(void) { - uint src = OPER_AL_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_AL_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_pcdi(void) { - uint src = OPER_PCDI_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_PCDI_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_pcix(void) { - uint src = OPER_PCIX_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_PCIX_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpa_32_i(void) { - uint src = OPER_I_32(); - uint dst = AX; - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = AX; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpi_8_d(void) { - uint src = OPER_I_8(); - uint dst = MASK_OUT_ABOVE_8(DY); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = MASK_OUT_ABOVE_8(DY); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_ai(void) { - uint src = OPER_I_8(); - uint dst = OPER_AY_AI_8(); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = OPER_AY_AI_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_pi(void) { - uint src = OPER_I_8(); - uint dst = OPER_AY_PI_8(); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = OPER_AY_PI_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_pi7(void) { - uint src = OPER_I_8(); - uint dst = OPER_A7_PI_8(); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = OPER_A7_PI_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_pd(void) { - uint src = OPER_I_8(); - uint dst = OPER_AY_PD_8(); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = OPER_AY_PD_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_pd7(void) { - uint src = OPER_I_8(); - uint dst = OPER_A7_PD_8(); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = OPER_A7_PD_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_di(void) { - uint src = OPER_I_8(); - uint dst = OPER_AY_DI_8(); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = OPER_AY_DI_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_ix(void) { - uint src = OPER_I_8(); - uint dst = OPER_AY_IX_8(); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = OPER_AY_IX_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_aw(void) { - uint src = OPER_I_8(); - uint dst = OPER_AW_8(); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = OPER_AW_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_al(void) { - uint src = OPER_I_8(); - uint dst = OPER_AL_8(); - uint res = dst - src; + uint src = OPER_I_8(); + uint dst = OPER_AL_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpi_8_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint src = OPER_I_8(); - uint dst = OPER_PCDI_8(); - uint res = dst - src; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint src = OPER_I_8(); + uint dst = OPER_PCDI_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); + return; + } + m68ki_exception_illegal(); } static void m68k_op_cmpi_8_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint src = OPER_I_8(); - uint dst = OPER_PCIX_8(); - uint res = dst - src; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint src = OPER_I_8(); + uint dst = OPER_PCIX_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); + return; + } + m68ki_exception_illegal(); } static void m68k_op_cmpi_16_d(void) { - uint src = OPER_I_16(); - uint dst = MASK_OUT_ABOVE_16(DY); - uint res = dst - src; + uint src = OPER_I_16(); + uint dst = MASK_OUT_ABOVE_16(DY); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmpi_16_ai(void) { - uint src = OPER_I_16(); - uint dst = OPER_AY_AI_16(); - uint res = dst - src; + uint src = OPER_I_16(); + uint dst = OPER_AY_AI_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmpi_16_pi(void) { - uint src = OPER_I_16(); - uint dst = OPER_AY_PI_16(); - uint res = dst - src; + uint src = OPER_I_16(); + uint dst = OPER_AY_PI_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmpi_16_pd(void) { - uint src = OPER_I_16(); - uint dst = OPER_AY_PD_16(); - uint res = dst - src; + uint src = OPER_I_16(); + uint dst = OPER_AY_PD_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmpi_16_di(void) { - uint src = OPER_I_16(); - uint dst = OPER_AY_DI_16(); - uint res = dst - src; + uint src = OPER_I_16(); + uint dst = OPER_AY_DI_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmpi_16_ix(void) { - uint src = OPER_I_16(); - uint dst = OPER_AY_IX_16(); - uint res = dst - src; + uint src = OPER_I_16(); + uint dst = OPER_AY_IX_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmpi_16_aw(void) { - uint src = OPER_I_16(); - uint dst = OPER_AW_16(); - uint res = dst - src; + uint src = OPER_I_16(); + uint dst = OPER_AW_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmpi_16_al(void) { - uint src = OPER_I_16(); - uint dst = OPER_AL_16(); - uint res = dst - src; + uint src = OPER_I_16(); + uint dst = OPER_AL_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmpi_16_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint src = OPER_I_16(); - uint dst = OPER_PCDI_16(); - uint res = dst - src; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint src = OPER_I_16(); + uint dst = OPER_PCDI_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); + return; + } + m68ki_exception_illegal(); } static void m68k_op_cmpi_16_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint src = OPER_I_16(); - uint dst = OPER_PCIX_16(); - uint res = dst - src; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint src = OPER_I_16(); + uint dst = OPER_PCIX_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); + return; + } + m68ki_exception_illegal(); } static void m68k_op_cmpi_32_d(void) { - uint src = OPER_I_32(); - uint dst = DY; - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = DY; + uint res = dst - src; - m68ki_cmpild_callback(src, REG_IR & 7); /* auto-disable (see m68kcpu.h) */ + m68ki_cmpild_callback(src, REG_IR & 7); /* auto-disable (see m68kcpu.h) */ - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpi_32_ai(void) { - uint src = OPER_I_32(); - uint dst = OPER_AY_AI_32(); - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = OPER_AY_AI_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpi_32_pi(void) { - uint src = OPER_I_32(); - uint dst = OPER_AY_PI_32(); - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = OPER_AY_PI_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpi_32_pd(void) { - uint src = OPER_I_32(); - uint dst = OPER_AY_PD_32(); - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = OPER_AY_PD_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpi_32_di(void) { - uint src = OPER_I_32(); - uint dst = OPER_AY_DI_32(); - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = OPER_AY_DI_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpi_32_ix(void) { - uint src = OPER_I_32(); - uint dst = OPER_AY_IX_32(); - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = OPER_AY_IX_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpi_32_aw(void) { - uint src = OPER_I_32(); - uint dst = OPER_AW_32(); - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = OPER_AW_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpi_32_al(void) { - uint src = OPER_I_32(); - uint dst = OPER_AL_32(); - uint res = dst - src; + uint src = OPER_I_32(); + uint dst = OPER_AL_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cmpi_32_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint src = OPER_I_32(); - uint dst = OPER_PCDI_32(); - uint res = dst - src; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint src = OPER_I_32(); + uint dst = OPER_PCDI_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); + return; + } + m68ki_exception_illegal(); } static void m68k_op_cmpi_32_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint src = OPER_I_32(); - uint dst = OPER_PCIX_32(); - uint res = dst - src; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint src = OPER_I_32(); + uint dst = OPER_PCIX_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); + return; + } + m68ki_exception_illegal(); } static void m68k_op_cmpm_8_ax7(void) { - uint src = OPER_AY_PI_8(); - uint dst = OPER_A7_PI_8(); - uint res = dst - src; + uint src = OPER_AY_PI_8(); + uint dst = OPER_A7_PI_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpm_8_ay7(void) { - uint src = OPER_A7_PI_8(); - uint dst = OPER_AX_PI_8(); - uint res = dst - src; + uint src = OPER_A7_PI_8(); + uint dst = OPER_AX_PI_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpm_8_axy7(void) { - uint src = OPER_A7_PI_8(); - uint dst = OPER_A7_PI_8(); - uint res = dst - src; + uint src = OPER_A7_PI_8(); + uint dst = OPER_A7_PI_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpm_8(void) { - uint src = OPER_AY_PI_8(); - uint dst = OPER_AX_PI_8(); - uint res = dst - src; + uint src = OPER_AY_PI_8(); + uint dst = OPER_AX_PI_8(); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_C = CFLAG_8(res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_C = CFLAG_8(res); } static void m68k_op_cmpm_16(void) { - uint src = OPER_AY_PI_16(); - uint dst = OPER_AX_PI_16(); - uint res = dst - src; + uint src = OPER_AY_PI_16(); + uint dst = OPER_AX_PI_16(); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_C = CFLAG_16(res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_C = CFLAG_16(res); } static void m68k_op_cmpm_32(void) { - uint src = OPER_AY_PI_32(); - uint dst = OPER_AX_PI_32(); - uint res = dst - src; + uint src = OPER_AY_PI_32(); + uint dst = OPER_AX_PI_32(); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_C = CFLAG_SUB_32(src, dst, res); } static void m68k_op_cpbcc_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_1111(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_1111(); } static void m68k_op_cpdbcc_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_1111(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_1111(); } static void m68k_op_cpgen_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_1111(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_1111(); } static void m68k_op_cpscc_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_1111(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_1111(); } static void m68k_op_cptrapcc_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_1111(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_1111(); } static void m68k_op_dbt_16(void) { - REG_PC += 2; + REG_PC += 2; } static void m68k_op_dbf_16(void) { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); } static void m68k_op_dbhi_16(void) { - if(COND_NOT_HI()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_HI()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbls_16(void) { - if(COND_NOT_LS()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_LS()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbcc_16(void) { - if(COND_NOT_CC()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_CC()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbcs_16(void) { - if(COND_NOT_CS()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_CS()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbne_16(void) { - if(COND_NOT_NE()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_NE()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbeq_16(void) { - if(COND_NOT_EQ()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_EQ()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbvc_16(void) { - if(COND_NOT_VC()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_VC()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbvs_16(void) { - if(COND_NOT_VS()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_VS()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbpl_16(void) { - if(COND_NOT_PL()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_PL()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbmi_16(void) { - if(COND_NOT_MI()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_MI()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbge_16(void) { - if(COND_NOT_GE()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_GE()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dblt_16(void) { - if(COND_NOT_LT()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_LT()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dbgt_16(void) { - if(COND_NOT_GT()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_GT()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_dble_16(void) { - if(COND_NOT_LE()) - { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(*r_dst - 1); + if(COND_NOT_LE()) + { + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(*r_dst - 1); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - if(res != 0xffff) - { - uint offset = OPER_I_16(); - REG_PC -= 2; - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_branch_16(offset); - USE_CYCLES(CYC_DBCC_F_NOEXP); - return; - } - REG_PC += 2; - USE_CYCLES(CYC_DBCC_F_EXP); - return; - } - REG_PC += 2; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + if(res != 0xffff) + { + uint offset = OPER_I_16(); + REG_PC -= 2; + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_branch_16(offset); + USE_CYCLES(CYC_DBCC_F_NOEXP); + return; + } + REG_PC += 2; + USE_CYCLES(CYC_DBCC_F_EXP); + return; + } + REG_PC += 2; } static void m68k_op_divs_16_d(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(DY); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(DY); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_ai(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_AY_AI_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_AY_AI_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_pi(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_AY_PI_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_AY_PI_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_pd(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_AY_PD_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_AY_PD_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_di(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_AY_DI_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_AY_DI_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_ix(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_AY_IX_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_AY_IX_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_aw(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_AW_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_AW_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_al(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_AL_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_AL_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_pcdi(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_PCDI_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_PCDI_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_pcix(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_PCIX_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_PCIX_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divs_16_i(void) { - uint* r_dst = &DX; - sint src = MAKE_INT_16(OPER_I_16()); - sint quotient; - sint remainder; + uint* r_dst = &DX; + sint src = MAKE_INT_16(OPER_I_16()); + sint quotient; + sint remainder; - if(src != 0) - { - if((uint32)*r_dst == 0x80000000 && src == -1) - { - FLAG_Z = 0; - FLAG_N = NFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = 0; - return; - } + if(src != 0) + { + if((uint32)*r_dst == 0x80000000 && src == -1) + { + FLAG_Z = 0; + FLAG_N = NFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = 0; + return; + } - quotient = MAKE_INT_32(*r_dst) / src; - remainder = MAKE_INT_32(*r_dst) % src; + quotient = MAKE_INT_32(*r_dst) / src; + remainder = MAKE_INT_32(*r_dst) % src; - if(quotient == MAKE_INT_16(quotient)) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient == MAKE_INT_16(quotient)) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_d(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_16(DY); + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_16(DY); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_ai(void) { - uint* r_dst = &DX; - uint src = OPER_AY_AI_16(); + uint* r_dst = &DX; + uint src = OPER_AY_AI_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_pi(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PI_16(); + uint* r_dst = &DX; + uint src = OPER_AY_PI_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_pd(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PD_16(); + uint* r_dst = &DX; + uint src = OPER_AY_PD_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_di(void) { - uint* r_dst = &DX; - uint src = OPER_AY_DI_16(); + uint* r_dst = &DX; + uint src = OPER_AY_DI_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_ix(void) { - uint* r_dst = &DX; - uint src = OPER_AY_IX_16(); + uint* r_dst = &DX; + uint src = OPER_AY_IX_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_aw(void) { - uint* r_dst = &DX; - uint src = OPER_AW_16(); + uint* r_dst = &DX; + uint src = OPER_AW_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_al(void) { - uint* r_dst = &DX; - uint src = OPER_AL_16(); + uint* r_dst = &DX; + uint src = OPER_AL_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_pcdi(void) { - uint* r_dst = &DX; - uint src = OPER_PCDI_16(); + uint* r_dst = &DX; + uint src = OPER_PCDI_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_pcix(void) { - uint* r_dst = &DX; - uint src = OPER_PCIX_16(); + uint* r_dst = &DX; + uint src = OPER_PCIX_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } static void m68k_op_divu_16_i(void) { - uint* r_dst = &DX; - uint src = OPER_I_16(); + uint* r_dst = &DX; + uint src = OPER_I_16(); - if(src != 0) - { - uint quotient = *r_dst / src; - uint remainder = *r_dst % src; + if(src != 0) + { + uint quotient = *r_dst / src; + uint remainder = *r_dst % src; - if(quotient < 0x10000) - { - FLAG_Z = quotient; - FLAG_N = NFLAG_16(quotient); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); - return; - } - FLAG_V = VFLAG_SET; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + if(quotient < 0x10000) + { + FLAG_Z = quotient; + FLAG_N = NFLAG_16(quotient); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst = MASK_OUT_ABOVE_32(MASK_OUT_ABOVE_16(quotient) | (remainder << 16)); + return; + } + FLAG_V = VFLAG_SET; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); } @@ -13310,208 +13310,208 @@ static void m68k_op_divl_32_d(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = DY; - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = DY; + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = DY; - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = DY; + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -13521,208 +13521,208 @@ static void m68k_op_divl_32_ai(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_AY_AI_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_AY_AI_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_AY_AI_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_AY_AI_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -13732,208 +13732,208 @@ static void m68k_op_divl_32_pi(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_AY_PI_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_AY_PI_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_AY_PI_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_AY_PI_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -13943,208 +13943,208 @@ static void m68k_op_divl_32_pd(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_AY_PD_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_AY_PD_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_AY_PD_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_AY_PD_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -14154,208 +14154,208 @@ static void m68k_op_divl_32_di(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_AY_DI_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_AY_DI_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_AY_DI_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_AY_DI_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -14365,208 +14365,208 @@ static void m68k_op_divl_32_ix(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_AY_IX_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_AY_IX_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_AY_IX_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_AY_IX_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -14576,208 +14576,208 @@ static void m68k_op_divl_32_aw(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_AW_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_AW_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_AW_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_AW_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -14787,208 +14787,208 @@ static void m68k_op_divl_32_al(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_AL_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_AL_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_AL_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_AL_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -14998,208 +14998,208 @@ static void m68k_op_divl_32_pcdi(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_PCDI_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_PCDI_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_PCDI_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_PCDI_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -15209,208 +15209,208 @@ static void m68k_op_divl_32_pcix(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_PCIX_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_PCIX_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_PCIX_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_PCIX_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -15420,208 +15420,208 @@ static void m68k_op_divl_32_i(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 divisor = OPER_I_32(); - uint64 dividend = 0; - uint64 quotient = 0; - uint64 remainder = 0; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 divisor = OPER_I_32(); + uint64 dividend = 0; + uint64 quotient = 0; + uint64 remainder = 0; - if(divisor != 0) - { - if(BIT_A(word2)) /* 64 bit */ - { - dividend = REG_D[word2 & 7]; - dividend <<= 32; - dividend |= REG_D[(word2 >> 12) & 7]; + if(divisor != 0) + { + if(BIT_A(word2)) /* 64 bit */ + { + dividend = REG_D[word2 & 7]; + dividend <<= 32; + dividend |= REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); - if((sint64)quotient != (sint64)((sint32)quotient)) - { - FLAG_V = VFLAG_SET; - return; - } - } - else /* unsigned */ - { - quotient = dividend / divisor; - if(quotient > 0xffffffff) - { - FLAG_V = VFLAG_SET; - return; - } - remainder = dividend % divisor; - } - } - else /* 32 bit */ - { - dividend = REG_D[(word2 >> 12) & 7]; - if(BIT_B(word2)) /* signed */ - { - quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); - remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); - } - else /* unsigned */ - { - quotient = dividend / divisor; - remainder = dividend % divisor; - } - } + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)dividend / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)dividend % (sint64)((sint32)divisor)); + if((sint64)quotient != (sint64)((sint32)quotient)) + { + FLAG_V = VFLAG_SET; + return; + } + } + else /* unsigned */ + { + quotient = dividend / divisor; + if(quotient > 0xffffffff) + { + FLAG_V = VFLAG_SET; + return; + } + remainder = dividend % divisor; + } + } + else /* 32 bit */ + { + dividend = REG_D[(word2 >> 12) & 7]; + if(BIT_B(word2)) /* signed */ + { + quotient = (uint64)((sint64)((sint32)dividend) / (sint64)((sint32)divisor)); + remainder = (uint64)((sint64)((sint32)dividend) % (sint64)((sint32)divisor)); + } + else /* unsigned */ + { + quotient = dividend / divisor; + remainder = dividend % divisor; + } + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint divisor = OPER_I_32(); - uint dividend_hi = REG_D[word2 & 7]; - uint dividend_lo = REG_D[(word2 >> 12) & 7]; - uint quotient = 0; - uint remainder = 0; - uint dividend_neg = 0; - uint divisor_neg = 0; - sint i; - uint overflow; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint divisor = OPER_I_32(); + uint dividend_hi = REG_D[word2 & 7]; + uint dividend_lo = REG_D[(word2 >> 12) & 7]; + uint quotient = 0; + uint remainder = 0; + uint dividend_neg = 0; + uint divisor_neg = 0; + sint i; + uint overflow; - if(divisor != 0) - { - /* quad / long : long quotient, long remainder */ - if(BIT_A(word2)) - { - if(BIT_B(word2)) /* signed */ - { - /* special case in signed divide */ - if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - REG_D[word2 & 7] = 0; - REG_D[(word2 >> 12) & 7] = 0x80000000; + if(divisor != 0) + { + /* quad / long : long quotient, long remainder */ + if(BIT_A(word2)) + { + if(BIT_B(word2)) /* signed */ + { + /* special case in signed divide */ + if(dividend_hi == 0 && dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + REG_D[word2 & 7] = 0; + REG_D[(word2 >> 12) & 7] = 0x80000000; - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - if(GET_MSB_32(dividend_hi)) - { - dividend_neg = 1; - dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); - dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); - } - if(GET_MSB_32(divisor)) - { - divisor_neg = 1; - divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + if(GET_MSB_32(dividend_hi)) + { + dividend_neg = 1; + dividend_hi = (uint)MASK_OUT_ABOVE_32((-(sint)dividend_hi) - (dividend_lo != 0)); + dividend_lo = (uint)MASK_OUT_ABOVE_32(-(sint)dividend_lo); + } + if(GET_MSB_32(divisor)) + { + divisor_neg = 1; + divisor = (uint)MASK_OUT_ABOVE_32(-(sint)divisor); - } - } + } + } - /* if the upper long is greater than the divisor, we're overflowing. */ - if(dividend_hi >= divisor) - { - FLAG_V = VFLAG_SET; - return; - } + /* if the upper long is greater than the divisor, we're overflowing. */ + if(dividend_hi >= divisor) + { + FLAG_V = VFLAG_SET; + return; + } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - remainder = (remainder << 1) + ((dividend_hi >> i) & 1); - if(remainder >= divisor) - { - remainder -= divisor; - quotient++; - } - } - for(i = 31; i >= 0; i--) - { - quotient <<= 1; - overflow = GET_MSB_32(remainder); - remainder = (remainder << 1) + ((dividend_lo >> i) & 1); - if(remainder >= divisor || overflow) - { - remainder -= divisor; - quotient++; - } - } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + remainder = (remainder << 1) + ((dividend_hi >> i) & 1); + if(remainder >= divisor) + { + remainder -= divisor; + quotient++; + } + } + for(i = 31; i >= 0; i--) + { + quotient <<= 1; + overflow = GET_MSB_32(remainder); + remainder = (remainder << 1) + ((dividend_lo >> i) & 1); + if(remainder >= divisor || overflow) + { + remainder -= divisor; + quotient++; + } + } - if(BIT_B(word2)) /* signed */ - { - if(quotient > 0x7fffffff) - { - FLAG_V = VFLAG_SET; - return; - } - if(dividend_neg) - { - remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } - if(divisor_neg) - quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); - } + if(BIT_B(word2)) /* signed */ + { + if(quotient > 0x7fffffff) + { + FLAG_V = VFLAG_SET; + return; + } + if(dividend_neg) + { + remainder = (uint)MASK_OUT_ABOVE_32(-(sint)remainder); + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } + if(divisor_neg) + quotient = (uint)MASK_OUT_ABOVE_32(-(sint)quotient); + } - REG_D[word2 & 7] = remainder; - REG_D[(word2 >> 12) & 7] = quotient; + REG_D[word2 & 7] = remainder; + REG_D[(word2 >> 12) & 7] = quotient; - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } - /* long / long: long quotient, maybe long remainder */ - if(BIT_B(word2)) /* signed */ - { - /* Special case in divide */ - if(dividend_lo == 0x80000000 && divisor == 0xffffffff) - { - FLAG_N = NFLAG_SET; - FLAG_Z = ZFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - REG_D[(word2 >> 12) & 7] = 0x80000000; - REG_D[word2 & 7] = 0; - return; - } - REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); - } - else - { - REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); - quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); - } + /* long / long: long quotient, maybe long remainder */ + if(BIT_B(word2)) /* signed */ + { + /* Special case in divide */ + if(dividend_lo == 0x80000000 && divisor == 0xffffffff) + { + FLAG_N = NFLAG_SET; + FLAG_Z = ZFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + REG_D[(word2 >> 12) & 7] = 0x80000000; + REG_D[word2 & 7] = 0; + return; + } + REG_D[word2 & 7] = MAKE_INT_32(dividend_lo) % MAKE_INT_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MAKE_INT_32(dividend_lo) / MAKE_INT_32(divisor); + } + else + { + REG_D[word2 & 7] = MASK_OUT_ABOVE_32(dividend_lo) % MASK_OUT_ABOVE_32(divisor); + quotient = REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(dividend_lo) / MASK_OUT_ABOVE_32(divisor); + } - FLAG_N = NFLAG_32(quotient); - FLAG_Z = quotient; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(quotient); + FLAG_Z = quotient; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_trap(EXCEPTION_ZERO_DIVIDE); + return; + } + m68ki_exception_illegal(); #endif } @@ -15629,8630 +15629,8630 @@ static void m68k_op_divl_32_i(void) static void m68k_op_eor_8_d(void) { - uint res = MASK_OUT_ABOVE_8(DY ^= MASK_OUT_ABOVE_8(DX)); + uint res = MASK_OUT_ABOVE_8(DY ^= MASK_OUT_ABOVE_8(DX)); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_8_ai(void) { - uint ea = EA_AY_AI_8(); - uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); + uint ea = EA_AY_AI_8(); + uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_8_pi(void) { - uint ea = EA_AY_PI_8(); - uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); + uint ea = EA_AY_PI_8(); + uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_8_pi7(void) { - uint ea = EA_A7_PI_8(); - uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); + uint ea = EA_A7_PI_8(); + uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_8_pd(void) { - uint ea = EA_AY_PD_8(); - uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); + uint ea = EA_AY_PD_8(); + uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_8_pd7(void) { - uint ea = EA_A7_PD_8(); - uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); + uint ea = EA_A7_PD_8(); + uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_8_di(void) { - uint ea = EA_AY_DI_8(); - uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); + uint ea = EA_AY_DI_8(); + uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_8_ix(void) { - uint ea = EA_AY_IX_8(); - uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); + uint ea = EA_AY_IX_8(); + uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_8_aw(void) { - uint ea = EA_AW_8(); - uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); + uint ea = EA_AW_8(); + uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_8_al(void) { - uint ea = EA_AL_8(); - uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); + uint ea = EA_AL_8(); + uint res = MASK_OUT_ABOVE_8(DX ^ m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_16_d(void) { - uint res = MASK_OUT_ABOVE_16(DY ^= MASK_OUT_ABOVE_16(DX)); + uint res = MASK_OUT_ABOVE_16(DY ^= MASK_OUT_ABOVE_16(DX)); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); + uint ea = EA_AY_AI_16(); + uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); + uint ea = EA_AY_PI_16(); + uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); + uint ea = EA_AY_PD_16(); + uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_16_di(void) { - uint ea = EA_AY_DI_16(); - uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); + uint ea = EA_AY_DI_16(); + uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); + uint ea = EA_AY_IX_16(); + uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_16_aw(void) { - uint ea = EA_AW_16(); - uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); + uint ea = EA_AW_16(); + uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_16_al(void) { - uint ea = EA_AL_16(); - uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); + uint ea = EA_AL_16(); + uint res = MASK_OUT_ABOVE_16(DX ^ m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_32_d(void) { - uint res = DY ^= DX; + uint res = DY ^= DX; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_32_ai(void) { - uint ea = EA_AY_AI_32(); - uint res = DX ^ m68ki_read_32(ea); + uint ea = EA_AY_AI_32(); + uint res = DX ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_32_pi(void) { - uint ea = EA_AY_PI_32(); - uint res = DX ^ m68ki_read_32(ea); + uint ea = EA_AY_PI_32(); + uint res = DX ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_32_pd(void) { - uint ea = EA_AY_PD_32(); - uint res = DX ^ m68ki_read_32(ea); + uint ea = EA_AY_PD_32(); + uint res = DX ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_32_di(void) { - uint ea = EA_AY_DI_32(); - uint res = DX ^ m68ki_read_32(ea); + uint ea = EA_AY_DI_32(); + uint res = DX ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_32_ix(void) { - uint ea = EA_AY_IX_32(); - uint res = DX ^ m68ki_read_32(ea); + uint ea = EA_AY_IX_32(); + uint res = DX ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_32_aw(void) { - uint ea = EA_AW_32(); - uint res = DX ^ m68ki_read_32(ea); + uint ea = EA_AW_32(); + uint res = DX ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eor_32_al(void) { - uint ea = EA_AL_32(); - uint res = DX ^ m68ki_read_32(ea); + uint ea = EA_AL_32(); + uint res = DX ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_d(void) { - uint res = MASK_OUT_ABOVE_8(DY ^= OPER_I_8()); + uint res = MASK_OUT_ABOVE_8(DY ^= OPER_I_8()); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_ai(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_AI_8(); - uint res = src ^ m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_AI_8(); + uint res = src ^ m68ki_read_8(ea); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_pi(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PI_8(); - uint res = src ^ m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_PI_8(); + uint res = src ^ m68ki_read_8(ea); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_pi7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PI_8(); - uint res = src ^ m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_A7_PI_8(); + uint res = src ^ m68ki_read_8(ea); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_pd(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PD_8(); - uint res = src ^ m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_PD_8(); + uint res = src ^ m68ki_read_8(ea); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_pd7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PD_8(); - uint res = src ^ m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_A7_PD_8(); + uint res = src ^ m68ki_read_8(ea); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_di(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_DI_8(); - uint res = src ^ m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_DI_8(); + uint res = src ^ m68ki_read_8(ea); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_ix(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_IX_8(); - uint res = src ^ m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AY_IX_8(); + uint res = src ^ m68ki_read_8(ea); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_aw(void) { - uint src = OPER_I_8(); - uint ea = EA_AW_8(); - uint res = src ^ m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AW_8(); + uint res = src ^ m68ki_read_8(ea); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_8_al(void) { - uint src = OPER_I_8(); - uint ea = EA_AL_8(); - uint res = src ^ m68ki_read_8(ea); + uint src = OPER_I_8(); + uint ea = EA_AL_8(); + uint res = src ^ m68ki_read_8(ea); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_16_d(void) { - uint res = MASK_OUT_ABOVE_16(DY ^= OPER_I_16()); + uint res = MASK_OUT_ABOVE_16(DY ^= OPER_I_16()); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_16_ai(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_AI_16(); - uint res = src ^ m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_AI_16(); + uint res = src ^ m68ki_read_16(ea); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_16_pi(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PI_16(); - uint res = src ^ m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_PI_16(); + uint res = src ^ m68ki_read_16(ea); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_16_pd(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PD_16(); - uint res = src ^ m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_PD_16(); + uint res = src ^ m68ki_read_16(ea); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_16_di(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_DI_16(); - uint res = src ^ m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_DI_16(); + uint res = src ^ m68ki_read_16(ea); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_16_ix(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_IX_16(); - uint res = src ^ m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AY_IX_16(); + uint res = src ^ m68ki_read_16(ea); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_16_aw(void) { - uint src = OPER_I_16(); - uint ea = EA_AW_16(); - uint res = src ^ m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AW_16(); + uint res = src ^ m68ki_read_16(ea); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_16_al(void) { - uint src = OPER_I_16(); - uint ea = EA_AL_16(); - uint res = src ^ m68ki_read_16(ea); + uint src = OPER_I_16(); + uint ea = EA_AL_16(); + uint res = src ^ m68ki_read_16(ea); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_32_d(void) { - uint res = DY ^= OPER_I_32(); + uint res = DY ^= OPER_I_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_32_ai(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_AI_32(); - uint res = src ^ m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_AI_32(); + uint res = src ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_32_pi(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PI_32(); - uint res = src ^ m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_PI_32(); + uint res = src ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_32_pd(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PD_32(); - uint res = src ^ m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_PD_32(); + uint res = src ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_32_di(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_DI_32(); - uint res = src ^ m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_DI_32(); + uint res = src ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_32_ix(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_IX_32(); - uint res = src ^ m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_IX_32(); + uint res = src ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_32_aw(void) { - uint src = OPER_I_32(); - uint ea = EA_AW_32(); - uint res = src ^ m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AW_32(); + uint res = src ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_32_al(void) { - uint src = OPER_I_32(); - uint ea = EA_AL_32(); - uint res = src ^ m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AL_32(); + uint res = src ^ m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_eori_16_toc(void) { - m68ki_set_ccr(m68ki_get_ccr() ^ OPER_I_16()); + m68ki_set_ccr(m68ki_get_ccr() ^ OPER_I_16()); } static void m68k_op_eori_16_tos(void) { - if(FLAG_S) - { - uint src = OPER_I_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(m68ki_get_sr() ^ src); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint src = OPER_I_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(m68ki_get_sr() ^ src); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_exg_32_dd(void) { - uint* reg_a = &DX; - uint* reg_b = &DY; - uint tmp = *reg_a; - *reg_a = *reg_b; - *reg_b = tmp; + uint* reg_a = &DX; + uint* reg_b = &DY; + uint tmp = *reg_a; + *reg_a = *reg_b; + *reg_b = tmp; } static void m68k_op_exg_32_aa(void) { - uint* reg_a = &AX; - uint* reg_b = &AY; - uint tmp = *reg_a; - *reg_a = *reg_b; - *reg_b = tmp; + uint* reg_a = &AX; + uint* reg_b = &AY; + uint tmp = *reg_a; + *reg_a = *reg_b; + *reg_b = tmp; } static void m68k_op_exg_32_da(void) { - uint* reg_a = &DX; - uint* reg_b = &AY; - uint tmp = *reg_a; - *reg_a = *reg_b; - *reg_b = tmp; + uint* reg_a = &DX; + uint* reg_b = &AY; + uint tmp = *reg_a; + *reg_a = *reg_b; + *reg_b = tmp; } static void m68k_op_ext_16(void) { - uint* r_dst = &DY; + uint* r_dst = &DY; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | MASK_OUT_ABOVE_8(*r_dst) | (GET_MSB_8(*r_dst) ? 0xff00 : 0); + *r_dst = MASK_OUT_BELOW_16(*r_dst) | MASK_OUT_ABOVE_8(*r_dst) | (GET_MSB_8(*r_dst) ? 0xff00 : 0); - FLAG_N = NFLAG_16(*r_dst); - FLAG_Z = MASK_OUT_ABOVE_16(*r_dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(*r_dst); + FLAG_Z = MASK_OUT_ABOVE_16(*r_dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_ext_32(void) { - uint* r_dst = &DY; + uint* r_dst = &DY; - *r_dst = MASK_OUT_ABOVE_16(*r_dst) | (GET_MSB_16(*r_dst) ? 0xffff0000 : 0); + *r_dst = MASK_OUT_ABOVE_16(*r_dst) | (GET_MSB_16(*r_dst) ? 0xffff0000 : 0); - FLAG_N = NFLAG_32(*r_dst); - FLAG_Z = *r_dst; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(*r_dst); + FLAG_Z = *r_dst; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_extb_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint* r_dst = &DY; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint* r_dst = &DY; - *r_dst = MASK_OUT_ABOVE_8(*r_dst) | (GET_MSB_8(*r_dst) ? 0xffffff00 : 0); + *r_dst = MASK_OUT_ABOVE_8(*r_dst) | (GET_MSB_8(*r_dst) ? 0xffffff00 : 0); - FLAG_N = NFLAG_32(*r_dst); - FLAG_Z = *r_dst; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(*r_dst); + FLAG_Z = *r_dst; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_illegal(void) { - m68ki_exception_illegal(); + m68ki_exception_illegal(); } static void m68k_op_jmp_32_ai(void) { - m68ki_jump(EA_AY_AI_32()); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); + m68ki_jump(EA_AY_AI_32()); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); } static void m68k_op_jmp_32_di(void) { - m68ki_jump(EA_AY_DI_32()); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); + m68ki_jump(EA_AY_DI_32()); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); } static void m68k_op_jmp_32_ix(void) { - m68ki_jump(EA_AY_IX_32()); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); + m68ki_jump(EA_AY_IX_32()); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); } static void m68k_op_jmp_32_aw(void) { - m68ki_jump(EA_AW_32()); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); + m68ki_jump(EA_AW_32()); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); } static void m68k_op_jmp_32_al(void) { - m68ki_jump(EA_AL_32()); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); + m68ki_jump(EA_AL_32()); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); } static void m68k_op_jmp_32_pcdi(void) { - m68ki_jump(EA_PCDI_32()); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); + m68ki_jump(EA_PCDI_32()); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); } static void m68k_op_jmp_32_pcix(void) { - m68ki_jump(EA_PCIX_32()); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(REG_PC == REG_PPC) - USE_ALL_CYCLES(); + m68ki_jump(EA_PCIX_32()); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(REG_PC == REG_PPC) + USE_ALL_CYCLES(); } static void m68k_op_jsr_32_ai(void) { - uint ea = EA_AY_AI_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - m68ki_jump(ea); + uint ea = EA_AY_AI_32(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + m68ki_jump(ea); } static void m68k_op_jsr_32_di(void) { - uint ea = EA_AY_DI_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - m68ki_jump(ea); + uint ea = EA_AY_DI_32(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + m68ki_jump(ea); } static void m68k_op_jsr_32_ix(void) { - uint ea = EA_AY_IX_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - m68ki_jump(ea); + uint ea = EA_AY_IX_32(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + m68ki_jump(ea); } static void m68k_op_jsr_32_aw(void) { - uint ea = EA_AW_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - m68ki_jump(ea); + uint ea = EA_AW_32(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + m68ki_jump(ea); } static void m68k_op_jsr_32_al(void) { - uint ea = EA_AL_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - m68ki_jump(ea); + uint ea = EA_AL_32(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + m68ki_jump(ea); } static void m68k_op_jsr_32_pcdi(void) { - uint ea = EA_PCDI_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - m68ki_jump(ea); + uint ea = EA_PCDI_32(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + m68ki_jump(ea); } static void m68k_op_jsr_32_pcix(void) { - uint ea = EA_PCIX_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_push_32(REG_PC); - m68ki_jump(ea); + uint ea = EA_PCIX_32(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_push_32(REG_PC); + m68ki_jump(ea); } static void m68k_op_lea_32_ai(void) { - AX = EA_AY_AI_32(); + AX = EA_AY_AI_32(); } static void m68k_op_lea_32_di(void) { - AX = EA_AY_DI_32(); + AX = EA_AY_DI_32(); } static void m68k_op_lea_32_ix(void) { - AX = EA_AY_IX_32(); + AX = EA_AY_IX_32(); } static void m68k_op_lea_32_aw(void) { - AX = EA_AW_32(); + AX = EA_AW_32(); } static void m68k_op_lea_32_al(void) { - AX = EA_AL_32(); + AX = EA_AL_32(); } static void m68k_op_lea_32_pcdi(void) { - AX = EA_PCDI_32(); + AX = EA_PCDI_32(); } static void m68k_op_lea_32_pcix(void) { - AX = EA_PCIX_32(); + AX = EA_PCIX_32(); } static void m68k_op_link_16_a7(void) { - REG_A[7] -= 4; - m68ki_write_32(REG_A[7], REG_A[7]); - REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + MAKE_INT_16(OPER_I_16())); + REG_A[7] -= 4; + m68ki_write_32(REG_A[7], REG_A[7]); + REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + MAKE_INT_16(OPER_I_16())); } static void m68k_op_link_16(void) { - uint* r_dst = &AY; + uint* r_dst = &AY; - m68ki_push_32(*r_dst); - *r_dst = REG_A[7]; - REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + MAKE_INT_16(OPER_I_16())); + m68ki_push_32(*r_dst); + *r_dst = REG_A[7]; + REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + MAKE_INT_16(OPER_I_16())); } static void m68k_op_link_32_a7(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - REG_A[7] -= 4; - m68ki_write_32(REG_A[7], REG_A[7]); - REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + OPER_I_32()); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + REG_A[7] -= 4; + m68ki_write_32(REG_A[7], REG_A[7]); + REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + OPER_I_32()); + return; + } + m68ki_exception_illegal(); } static void m68k_op_link_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint* r_dst = &AY; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint* r_dst = &AY; - m68ki_push_32(*r_dst); - *r_dst = REG_A[7]; - REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + OPER_I_32()); - return; - } - m68ki_exception_illegal(); + m68ki_push_32(*r_dst); + *r_dst = REG_A[7]; + REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + OPER_I_32()); + return; + } + m68ki_exception_illegal(); } static void m68k_op_lsr_8_s(void) { - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = src >> shift; + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = src >> shift; - if(shift != 0) - USE_CYCLES(shift<> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_16(*r_dst); - uint res = src >> shift; + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = src >> shift; - if(shift != 0) - USE_CYCLES(shift<> 9) - 1) & 7) + 1; - uint src = *r_dst; - uint res = src >> shift; + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = *r_dst; + uint res = src >> shift; - if(shift != 0) - USE_CYCLES(shift<> shift; + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = src >> shift; - if(shift != 0) - { - USE_CYCLES(shift<> shift; + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = src >> shift; - if(shift != 0) - { - USE_CYCLES(shift<> (shift - 1))<<8; - FLAG_N = NFLAG_CLEAR; - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + if(shift <= 16) + { + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + FLAG_C = FLAG_X = (src >> (shift - 1))<<8; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - *r_dst &= 0xffff0000; - FLAG_X = XFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst &= 0xffff0000; + FLAG_X = XFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_16(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsr_32_r(void) { - uint* r_dst = &DY; - uint shift = DX & 0x3f; - uint src = *r_dst; - uint res = src >> shift; + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = *r_dst; + uint res = src >> shift; - if(shift != 0) - { - USE_CYCLES(shift<> (shift - 1))<<8; - FLAG_N = NFLAG_CLEAR; - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + if(shift < 32) + { + *r_dst = res; + FLAG_C = FLAG_X = (src >> (shift - 1))<<8; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - *r_dst = 0; - FLAG_X = FLAG_C = (shift == 32 ? GET_MSB_32(src)>>23 : 0); - FLAG_N = NFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst = 0; + FLAG_X = FLAG_C = (shift == 32 ? GET_MSB_32(src)>>23 : 0); + FLAG_N = NFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_32(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsr_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_AI_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_CLEAR; - FLAG_Z = res; - FLAG_C = FLAG_X = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = res; + FLAG_C = FLAG_X = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsr_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_CLEAR; - FLAG_Z = res; - FLAG_C = FLAG_X = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = res; + FLAG_C = FLAG_X = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsr_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_CLEAR; - FLAG_Z = res; - FLAG_C = FLAG_X = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = res; + FLAG_C = FLAG_X = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsr_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_CLEAR; - FLAG_Z = res; - FLAG_C = FLAG_X = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = res; + FLAG_C = FLAG_X = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsr_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_CLEAR; - FLAG_Z = res; - FLAG_C = FLAG_X = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = res; + FLAG_C = FLAG_X = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsr_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_CLEAR; - FLAG_Z = res; - FLAG_C = FLAG_X = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = res; + FLAG_C = FLAG_X = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsr_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = src >> 1; + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = src >> 1; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_CLEAR; - FLAG_Z = res; - FLAG_C = FLAG_X = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = res; + FLAG_C = FLAG_X = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_8_s(void) { - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = MASK_OUT_ABOVE_8(src << shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = MASK_OUT_ABOVE_8(src << shift); - if(shift != 0) - USE_CYCLES(shift<> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_16(*r_dst); - uint res = MASK_OUT_ABOVE_16(src << shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = MASK_OUT_ABOVE_16(src << shift); - if(shift != 0) - USE_CYCLES(shift<> (8-shift); - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> (8-shift); + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_32_s(void) { - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = *r_dst; - uint res = MASK_OUT_ABOVE_32(src << shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = *r_dst; + uint res = MASK_OUT_ABOVE_32(src << shift); - if(shift != 0) - USE_CYCLES(shift<> (24-shift); - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> (24-shift); + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_8_r(void) { - uint* r_dst = &DY; - uint shift = DX & 0x3f; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = MASK_OUT_ABOVE_8(src << shift); + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = MASK_OUT_ABOVE_8(src << shift); - if(shift != 0) - { - USE_CYCLES(shift<> 8; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + if(shift <= 16) + { + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + FLAG_X = FLAG_C = (src << shift) >> 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - *r_dst &= 0xffff0000; - FLAG_X = XFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst &= 0xffff0000; + FLAG_X = XFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_16(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_32_r(void) { - uint* r_dst = &DY; - uint shift = DX & 0x3f; - uint src = *r_dst; - uint res = MASK_OUT_ABOVE_32(src << shift); + uint* r_dst = &DY; + uint shift = DX & 0x3f; + uint src = *r_dst; + uint res = MASK_OUT_ABOVE_32(src << shift); - if(shift != 0) - { - USE_CYCLES(shift<> (32 - shift)) << 8; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + if(shift < 32) + { + *r_dst = res; + FLAG_X = FLAG_C = (src >> (32 - shift)) << 8; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - *r_dst = 0; - FLAG_X = FLAG_C = ((shift == 32 ? src & 1 : 0))<<8; - FLAG_N = NFLAG_CLEAR; - FLAG_Z = ZFLAG_SET; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst = 0; + FLAG_X = FLAG_C = ((shift == 32 ? src & 1 : 0))<<8; + FLAG_N = NFLAG_CLEAR; + FLAG_Z = ZFLAG_SET; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_32(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_AI_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_lsl_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(src << 1); + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(src << 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_X = FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_X = FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_move_8_d_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_8(DY); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_ai(void) { - uint res = OPER_AY_AI_8(); - uint* r_dst = &DX; + uint res = OPER_AY_AI_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_pi(void) { - uint res = OPER_AY_PI_8(); - uint* r_dst = &DX; + uint res = OPER_AY_PI_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_pi7(void) { - uint res = OPER_A7_PI_8(); - uint* r_dst = &DX; + uint res = OPER_A7_PI_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_pd(void) { - uint res = OPER_AY_PD_8(); - uint* r_dst = &DX; + uint res = OPER_AY_PD_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_pd7(void) { - uint res = OPER_A7_PD_8(); - uint* r_dst = &DX; + uint res = OPER_A7_PD_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_di(void) { - uint res = OPER_AY_DI_8(); - uint* r_dst = &DX; + uint res = OPER_AY_DI_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_ix(void) { - uint res = OPER_AY_IX_8(); - uint* r_dst = &DX; + uint res = OPER_AY_IX_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_aw(void) { - uint res = OPER_AW_8(); - uint* r_dst = &DX; + uint res = OPER_AW_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_al(void) { - uint res = OPER_AL_8(); - uint* r_dst = &DX; + uint res = OPER_AL_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_pcdi(void) { - uint res = OPER_PCDI_8(); - uint* r_dst = &DX; + uint res = OPER_PCDI_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_pcix(void) { - uint res = OPER_PCIX_8(); - uint* r_dst = &DX; + uint res = OPER_PCIX_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_d_i(void) { - uint res = OPER_I_8(); - uint* r_dst = &DX; + uint res = OPER_I_8(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint ea = EA_AX_AI_8(); + uint res = MASK_OUT_ABOVE_8(DY); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_ai(void) { - uint res = OPER_AY_AI_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_AY_AI_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_pi(void) { - uint res = OPER_AY_PI_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_AY_PI_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_pi7(void) { - uint res = OPER_A7_PI_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_A7_PI_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_pd(void) { - uint res = OPER_AY_PD_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_AY_PD_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_pd7(void) { - uint res = OPER_A7_PD_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_A7_PD_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_di(void) { - uint res = OPER_AY_DI_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_AY_DI_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_ix(void) { - uint res = OPER_AY_IX_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_AY_IX_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_aw(void) { - uint res = OPER_AW_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_AW_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_al(void) { - uint res = OPER_AL_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_AL_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_pcdi(void) { - uint res = OPER_PCDI_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_PCDI_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_pcix(void) { - uint res = OPER_PCIX_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_PCIX_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ai_i(void) { - uint res = OPER_I_8(); - uint ea = EA_AX_AI_8(); + uint res = OPER_I_8(); + uint ea = EA_AX_AI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint ea = EA_A7_PI_8(); + uint res = MASK_OUT_ABOVE_8(DY); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint ea = EA_AX_PI_8(); + uint res = MASK_OUT_ABOVE_8(DY); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_ai(void) { - uint res = OPER_AY_AI_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_AY_AI_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_pi(void) { - uint res = OPER_AY_PI_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_AY_PI_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_pi7(void) { - uint res = OPER_A7_PI_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_A7_PI_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_pd(void) { - uint res = OPER_AY_PD_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_AY_PD_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_pd7(void) { - uint res = OPER_A7_PD_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_A7_PD_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_di(void) { - uint res = OPER_AY_DI_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_AY_DI_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_ix(void) { - uint res = OPER_AY_IX_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_AY_IX_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_aw(void) { - uint res = OPER_AW_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_AW_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_al(void) { - uint res = OPER_AL_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_AL_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_pcdi(void) { - uint res = OPER_PCDI_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_PCDI_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_pcix(void) { - uint res = OPER_PCIX_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_PCIX_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi7_i(void) { - uint res = OPER_I_8(); - uint ea = EA_A7_PI_8(); + uint res = OPER_I_8(); + uint ea = EA_A7_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_ai(void) { - uint res = OPER_AY_AI_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_AY_AI_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_pi(void) { - uint res = OPER_AY_PI_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_AY_PI_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_pi7(void) { - uint res = OPER_A7_PI_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_A7_PI_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_pd(void) { - uint res = OPER_AY_PD_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_AY_PD_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_pd7(void) { - uint res = OPER_A7_PD_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_A7_PD_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_di(void) { - uint res = OPER_AY_DI_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_AY_DI_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_ix(void) { - uint res = OPER_AY_IX_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_AY_IX_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_aw(void) { - uint res = OPER_AW_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_AW_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_al(void) { - uint res = OPER_AL_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_AL_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_pcdi(void) { - uint res = OPER_PCDI_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_PCDI_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_pcix(void) { - uint res = OPER_PCIX_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_PCIX_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pi_i(void) { - uint res = OPER_I_8(); - uint ea = EA_AX_PI_8(); + uint res = OPER_I_8(); + uint ea = EA_AX_PI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint ea = EA_A7_PD_8(); + uint res = MASK_OUT_ABOVE_8(DY); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint ea = EA_AX_PD_8(); + uint res = MASK_OUT_ABOVE_8(DY); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_ai(void) { - uint res = OPER_AY_AI_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_AY_AI_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_pi(void) { - uint res = OPER_AY_PI_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_AY_PI_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_pi7(void) { - uint res = OPER_A7_PI_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_A7_PI_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_pd(void) { - uint res = OPER_AY_PD_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_AY_PD_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_pd7(void) { - uint res = OPER_A7_PD_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_A7_PD_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_di(void) { - uint res = OPER_AY_DI_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_AY_DI_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_ix(void) { - uint res = OPER_AY_IX_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_AY_IX_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_aw(void) { - uint res = OPER_AW_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_AW_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_al(void) { - uint res = OPER_AL_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_AL_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_pcdi(void) { - uint res = OPER_PCDI_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_PCDI_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_pcix(void) { - uint res = OPER_PCIX_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_PCIX_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd7_i(void) { - uint res = OPER_I_8(); - uint ea = EA_A7_PD_8(); + uint res = OPER_I_8(); + uint ea = EA_A7_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_ai(void) { - uint res = OPER_AY_AI_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_AY_AI_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_pi(void) { - uint res = OPER_AY_PI_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_AY_PI_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_pi7(void) { - uint res = OPER_A7_PI_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_A7_PI_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_pd(void) { - uint res = OPER_AY_PD_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_AY_PD_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_pd7(void) { - uint res = OPER_A7_PD_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_A7_PD_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_di(void) { - uint res = OPER_AY_DI_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_AY_DI_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_ix(void) { - uint res = OPER_AY_IX_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_AY_IX_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_aw(void) { - uint res = OPER_AW_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_AW_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_al(void) { - uint res = OPER_AL_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_AL_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_pcdi(void) { - uint res = OPER_PCDI_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_PCDI_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_pcix(void) { - uint res = OPER_PCIX_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_PCIX_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_pd_i(void) { - uint res = OPER_I_8(); - uint ea = EA_AX_PD_8(); + uint res = OPER_I_8(); + uint ea = EA_AX_PD_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint ea = EA_AX_DI_8(); + uint res = MASK_OUT_ABOVE_8(DY); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_ai(void) { - uint res = OPER_AY_AI_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_AY_AI_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_pi(void) { - uint res = OPER_AY_PI_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_AY_PI_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_pi7(void) { - uint res = OPER_A7_PI_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_A7_PI_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_pd(void) { - uint res = OPER_AY_PD_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_AY_PD_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_pd7(void) { - uint res = OPER_A7_PD_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_A7_PD_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_di(void) { - uint res = OPER_AY_DI_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_AY_DI_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_ix(void) { - uint res = OPER_AY_IX_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_AY_IX_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_aw(void) { - uint res = OPER_AW_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_AW_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_al(void) { - uint res = OPER_AL_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_AL_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_pcdi(void) { - uint res = OPER_PCDI_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_PCDI_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_pcix(void) { - uint res = OPER_PCIX_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_PCIX_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_di_i(void) { - uint res = OPER_I_8(); - uint ea = EA_AX_DI_8(); + uint res = OPER_I_8(); + uint ea = EA_AX_DI_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint ea = EA_AX_IX_8(); + uint res = MASK_OUT_ABOVE_8(DY); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_ai(void) { - uint res = OPER_AY_AI_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_AY_AI_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_pi(void) { - uint res = OPER_AY_PI_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_AY_PI_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_pi7(void) { - uint res = OPER_A7_PI_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_A7_PI_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_pd(void) { - uint res = OPER_AY_PD_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_AY_PD_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_pd7(void) { - uint res = OPER_A7_PD_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_A7_PD_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_di(void) { - uint res = OPER_AY_DI_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_AY_DI_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_ix(void) { - uint res = OPER_AY_IX_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_AY_IX_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_aw(void) { - uint res = OPER_AW_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_AW_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_al(void) { - uint res = OPER_AL_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_AL_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_pcdi(void) { - uint res = OPER_PCDI_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_PCDI_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_pcix(void) { - uint res = OPER_PCIX_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_PCIX_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_ix_i(void) { - uint res = OPER_I_8(); - uint ea = EA_AX_IX_8(); + uint res = OPER_I_8(); + uint ea = EA_AX_IX_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint ea = EA_AW_8(); + uint res = MASK_OUT_ABOVE_8(DY); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_ai(void) { - uint res = OPER_AY_AI_8(); - uint ea = EA_AW_8(); + uint res = OPER_AY_AI_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_pi(void) { - uint res = OPER_AY_PI_8(); - uint ea = EA_AW_8(); + uint res = OPER_AY_PI_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_pi7(void) { - uint res = OPER_A7_PI_8(); - uint ea = EA_AW_8(); + uint res = OPER_A7_PI_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_pd(void) { - uint res = OPER_AY_PD_8(); - uint ea = EA_AW_8(); + uint res = OPER_AY_PD_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_pd7(void) { - uint res = OPER_A7_PD_8(); - uint ea = EA_AW_8(); + uint res = OPER_A7_PD_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_di(void) { - uint res = OPER_AY_DI_8(); - uint ea = EA_AW_8(); + uint res = OPER_AY_DI_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_ix(void) { - uint res = OPER_AY_IX_8(); - uint ea = EA_AW_8(); + uint res = OPER_AY_IX_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_aw(void) { - uint res = OPER_AW_8(); - uint ea = EA_AW_8(); + uint res = OPER_AW_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_al(void) { - uint res = OPER_AL_8(); - uint ea = EA_AW_8(); + uint res = OPER_AL_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_pcdi(void) { - uint res = OPER_PCDI_8(); - uint ea = EA_AW_8(); + uint res = OPER_PCDI_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_pcix(void) { - uint res = OPER_PCIX_8(); - uint ea = EA_AW_8(); + uint res = OPER_PCIX_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_aw_i(void) { - uint res = OPER_I_8(); - uint ea = EA_AW_8(); + uint res = OPER_I_8(); + uint ea = EA_AW_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); - uint ea = EA_AL_8(); + uint res = MASK_OUT_ABOVE_8(DY); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_ai(void) { - uint res = OPER_AY_AI_8(); - uint ea = EA_AL_8(); + uint res = OPER_AY_AI_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_pi(void) { - uint res = OPER_AY_PI_8(); - uint ea = EA_AL_8(); + uint res = OPER_AY_PI_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_pi7(void) { - uint res = OPER_A7_PI_8(); - uint ea = EA_AL_8(); + uint res = OPER_A7_PI_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_pd(void) { - uint res = OPER_AY_PD_8(); - uint ea = EA_AL_8(); + uint res = OPER_AY_PD_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_pd7(void) { - uint res = OPER_A7_PD_8(); - uint ea = EA_AL_8(); + uint res = OPER_A7_PD_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_di(void) { - uint res = OPER_AY_DI_8(); - uint ea = EA_AL_8(); + uint res = OPER_AY_DI_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_ix(void) { - uint res = OPER_AY_IX_8(); - uint ea = EA_AL_8(); + uint res = OPER_AY_IX_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_aw(void) { - uint res = OPER_AW_8(); - uint ea = EA_AL_8(); + uint res = OPER_AW_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_al(void) { - uint res = OPER_AL_8(); - uint ea = EA_AL_8(); + uint res = OPER_AL_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_pcdi(void) { - uint res = OPER_PCDI_8(); - uint ea = EA_AL_8(); + uint res = OPER_PCDI_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_pcix(void) { - uint res = OPER_PCIX_8(); - uint ea = EA_AL_8(); + uint res = OPER_PCIX_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_8_al_i(void) { - uint res = OPER_I_8(); - uint ea = EA_AL_8(); + uint res = OPER_I_8(); + uint ea = EA_AL_8(); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_d(void) { - uint res = MASK_OUT_ABOVE_16(DY); - uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_16(DY); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_a(void) { - uint res = MASK_OUT_ABOVE_16(AY); - uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_16(AY); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_ai(void) { - uint res = OPER_AY_AI_16(); - uint* r_dst = &DX; + uint res = OPER_AY_AI_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_pi(void) { - uint res = OPER_AY_PI_16(); - uint* r_dst = &DX; + uint res = OPER_AY_PI_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_pd(void) { - uint res = OPER_AY_PD_16(); - uint* r_dst = &DX; + uint res = OPER_AY_PD_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_di(void) { - uint res = OPER_AY_DI_16(); - uint* r_dst = &DX; + uint res = OPER_AY_DI_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_ix(void) { - uint res = OPER_AY_IX_16(); - uint* r_dst = &DX; + uint res = OPER_AY_IX_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_aw(void) { - uint res = OPER_AW_16(); - uint* r_dst = &DX; + uint res = OPER_AW_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_al(void) { - uint res = OPER_AL_16(); - uint* r_dst = &DX; + uint res = OPER_AL_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_pcdi(void) { - uint res = OPER_PCDI_16(); - uint* r_dst = &DX; + uint res = OPER_PCDI_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_pcix(void) { - uint res = OPER_PCIX_16(); - uint* r_dst = &DX; + uint res = OPER_PCIX_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_d_i(void) { - uint res = OPER_I_16(); - uint* r_dst = &DX; + uint res = OPER_I_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_d(void) { - uint res = MASK_OUT_ABOVE_16(DY); - uint ea = EA_AX_AI_16(); + uint res = MASK_OUT_ABOVE_16(DY); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_a(void) { - uint res = MASK_OUT_ABOVE_16(AY); - uint ea = EA_AX_AI_16(); + uint res = MASK_OUT_ABOVE_16(AY); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_ai(void) { - uint res = OPER_AY_AI_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_AY_AI_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_pi(void) { - uint res = OPER_AY_PI_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_AY_PI_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_pd(void) { - uint res = OPER_AY_PD_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_AY_PD_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_di(void) { - uint res = OPER_AY_DI_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_AY_DI_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_ix(void) { - uint res = OPER_AY_IX_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_AY_IX_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_aw(void) { - uint res = OPER_AW_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_AW_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_al(void) { - uint res = OPER_AL_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_AL_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_pcdi(void) { - uint res = OPER_PCDI_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_PCDI_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_pcix(void) { - uint res = OPER_PCIX_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_PCIX_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ai_i(void) { - uint res = OPER_I_16(); - uint ea = EA_AX_AI_16(); + uint res = OPER_I_16(); + uint ea = EA_AX_AI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_d(void) { - uint res = MASK_OUT_ABOVE_16(DY); - uint ea = EA_AX_PI_16(); + uint res = MASK_OUT_ABOVE_16(DY); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_a(void) { - uint res = MASK_OUT_ABOVE_16(AY); - uint ea = EA_AX_PI_16(); + uint res = MASK_OUT_ABOVE_16(AY); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_ai(void) { - uint res = OPER_AY_AI_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_AY_AI_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_pi(void) { - uint res = OPER_AY_PI_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_AY_PI_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_pd(void) { - uint res = OPER_AY_PD_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_AY_PD_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_di(void) { - uint res = OPER_AY_DI_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_AY_DI_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_ix(void) { - uint res = OPER_AY_IX_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_AY_IX_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_aw(void) { - uint res = OPER_AW_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_AW_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_al(void) { - uint res = OPER_AL_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_AL_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_pcdi(void) { - uint res = OPER_PCDI_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_PCDI_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_pcix(void) { - uint res = OPER_PCIX_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_PCIX_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pi_i(void) { - uint res = OPER_I_16(); - uint ea = EA_AX_PI_16(); + uint res = OPER_I_16(); + uint ea = EA_AX_PI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_d(void) { - uint res = MASK_OUT_ABOVE_16(DY); - uint ea = EA_AX_PD_16(); + uint res = MASK_OUT_ABOVE_16(DY); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_a(void) { - uint res = MASK_OUT_ABOVE_16(AY); - uint ea = EA_AX_PD_16(); + uint res = MASK_OUT_ABOVE_16(AY); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_ai(void) { - uint res = OPER_AY_AI_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_AY_AI_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_pi(void) { - uint res = OPER_AY_PI_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_AY_PI_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_pd(void) { - uint res = OPER_AY_PD_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_AY_PD_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_di(void) { - uint res = OPER_AY_DI_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_AY_DI_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_ix(void) { - uint res = OPER_AY_IX_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_AY_IX_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_aw(void) { - uint res = OPER_AW_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_AW_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_al(void) { - uint res = OPER_AL_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_AL_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_pcdi(void) { - uint res = OPER_PCDI_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_PCDI_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_pcix(void) { - uint res = OPER_PCIX_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_PCIX_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_pd_i(void) { - uint res = OPER_I_16(); - uint ea = EA_AX_PD_16(); + uint res = OPER_I_16(); + uint ea = EA_AX_PD_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_d(void) { - uint res = MASK_OUT_ABOVE_16(DY); - uint ea = EA_AX_DI_16(); + uint res = MASK_OUT_ABOVE_16(DY); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_a(void) { - uint res = MASK_OUT_ABOVE_16(AY); - uint ea = EA_AX_DI_16(); + uint res = MASK_OUT_ABOVE_16(AY); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_ai(void) { - uint res = OPER_AY_AI_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_AY_AI_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_pi(void) { - uint res = OPER_AY_PI_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_AY_PI_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_pd(void) { - uint res = OPER_AY_PD_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_AY_PD_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_di(void) { - uint res = OPER_AY_DI_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_AY_DI_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_ix(void) { - uint res = OPER_AY_IX_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_AY_IX_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_aw(void) { - uint res = OPER_AW_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_AW_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_al(void) { - uint res = OPER_AL_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_AL_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_pcdi(void) { - uint res = OPER_PCDI_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_PCDI_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_pcix(void) { - uint res = OPER_PCIX_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_PCIX_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_di_i(void) { - uint res = OPER_I_16(); - uint ea = EA_AX_DI_16(); + uint res = OPER_I_16(); + uint ea = EA_AX_DI_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_d(void) { - uint res = MASK_OUT_ABOVE_16(DY); - uint ea = EA_AX_IX_16(); + uint res = MASK_OUT_ABOVE_16(DY); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_a(void) { - uint res = MASK_OUT_ABOVE_16(AY); - uint ea = EA_AX_IX_16(); + uint res = MASK_OUT_ABOVE_16(AY); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_ai(void) { - uint res = OPER_AY_AI_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_AY_AI_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_pi(void) { - uint res = OPER_AY_PI_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_AY_PI_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_pd(void) { - uint res = OPER_AY_PD_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_AY_PD_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_di(void) { - uint res = OPER_AY_DI_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_AY_DI_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_ix(void) { - uint res = OPER_AY_IX_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_AY_IX_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_aw(void) { - uint res = OPER_AW_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_AW_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_al(void) { - uint res = OPER_AL_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_AL_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_pcdi(void) { - uint res = OPER_PCDI_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_PCDI_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_pcix(void) { - uint res = OPER_PCIX_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_PCIX_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_ix_i(void) { - uint res = OPER_I_16(); - uint ea = EA_AX_IX_16(); + uint res = OPER_I_16(); + uint ea = EA_AX_IX_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_d(void) { - uint res = MASK_OUT_ABOVE_16(DY); - uint ea = EA_AW_16(); + uint res = MASK_OUT_ABOVE_16(DY); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_a(void) { - uint res = MASK_OUT_ABOVE_16(AY); - uint ea = EA_AW_16(); + uint res = MASK_OUT_ABOVE_16(AY); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_ai(void) { - uint res = OPER_AY_AI_16(); - uint ea = EA_AW_16(); + uint res = OPER_AY_AI_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_pi(void) { - uint res = OPER_AY_PI_16(); - uint ea = EA_AW_16(); + uint res = OPER_AY_PI_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_pd(void) { - uint res = OPER_AY_PD_16(); - uint ea = EA_AW_16(); + uint res = OPER_AY_PD_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_di(void) { - uint res = OPER_AY_DI_16(); - uint ea = EA_AW_16(); + uint res = OPER_AY_DI_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_ix(void) { - uint res = OPER_AY_IX_16(); - uint ea = EA_AW_16(); + uint res = OPER_AY_IX_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_aw(void) { - uint res = OPER_AW_16(); - uint ea = EA_AW_16(); + uint res = OPER_AW_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_al(void) { - uint res = OPER_AL_16(); - uint ea = EA_AW_16(); + uint res = OPER_AL_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_pcdi(void) { - uint res = OPER_PCDI_16(); - uint ea = EA_AW_16(); + uint res = OPER_PCDI_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_pcix(void) { - uint res = OPER_PCIX_16(); - uint ea = EA_AW_16(); + uint res = OPER_PCIX_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_aw_i(void) { - uint res = OPER_I_16(); - uint ea = EA_AW_16(); + uint res = OPER_I_16(); + uint ea = EA_AW_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_d(void) { - uint res = MASK_OUT_ABOVE_16(DY); - uint ea = EA_AL_16(); + uint res = MASK_OUT_ABOVE_16(DY); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_a(void) { - uint res = MASK_OUT_ABOVE_16(AY); - uint ea = EA_AL_16(); + uint res = MASK_OUT_ABOVE_16(AY); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_ai(void) { - uint res = OPER_AY_AI_16(); - uint ea = EA_AL_16(); + uint res = OPER_AY_AI_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_pi(void) { - uint res = OPER_AY_PI_16(); - uint ea = EA_AL_16(); + uint res = OPER_AY_PI_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_pd(void) { - uint res = OPER_AY_PD_16(); - uint ea = EA_AL_16(); + uint res = OPER_AY_PD_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_di(void) { - uint res = OPER_AY_DI_16(); - uint ea = EA_AL_16(); + uint res = OPER_AY_DI_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_ix(void) { - uint res = OPER_AY_IX_16(); - uint ea = EA_AL_16(); + uint res = OPER_AY_IX_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_aw(void) { - uint res = OPER_AW_16(); - uint ea = EA_AL_16(); + uint res = OPER_AW_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_al(void) { - uint res = OPER_AL_16(); - uint ea = EA_AL_16(); + uint res = OPER_AL_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_pcdi(void) { - uint res = OPER_PCDI_16(); - uint ea = EA_AL_16(); + uint res = OPER_PCDI_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_pcix(void) { - uint res = OPER_PCIX_16(); - uint ea = EA_AL_16(); + uint res = OPER_PCIX_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_16_al_i(void) { - uint res = OPER_I_16(); - uint ea = EA_AL_16(); + uint res = OPER_I_16(); + uint ea = EA_AL_16(); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_d(void) { - uint res = DY; - uint* r_dst = &DX; + uint res = DY; + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_a(void) { - uint res = AY; - uint* r_dst = &DX; + uint res = AY; + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_ai(void) { - uint res = OPER_AY_AI_32(); - uint* r_dst = &DX; + uint res = OPER_AY_AI_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_pi(void) { - uint res = OPER_AY_PI_32(); - uint* r_dst = &DX; + uint res = OPER_AY_PI_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_pd(void) { - uint res = OPER_AY_PD_32(); - uint* r_dst = &DX; + uint res = OPER_AY_PD_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_di(void) { - uint res = OPER_AY_DI_32(); - uint* r_dst = &DX; + uint res = OPER_AY_DI_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_ix(void) { - uint res = OPER_AY_IX_32(); - uint* r_dst = &DX; + uint res = OPER_AY_IX_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_aw(void) { - uint res = OPER_AW_32(); - uint* r_dst = &DX; + uint res = OPER_AW_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_al(void) { - uint res = OPER_AL_32(); - uint* r_dst = &DX; + uint res = OPER_AL_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_pcdi(void) { - uint res = OPER_PCDI_32(); - uint* r_dst = &DX; + uint res = OPER_PCDI_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_pcix(void) { - uint res = OPER_PCIX_32(); - uint* r_dst = &DX; + uint res = OPER_PCIX_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_d_i(void) { - uint res = OPER_I_32(); - uint* r_dst = &DX; + uint res = OPER_I_32(); + uint* r_dst = &DX; - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_d(void) { - uint res = DY; - uint ea = EA_AX_AI_32(); + uint res = DY; + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_a(void) { - uint res = AY; - uint ea = EA_AX_AI_32(); + uint res = AY; + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_ai(void) { - uint res = OPER_AY_AI_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_AY_AI_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_pi(void) { - uint res = OPER_AY_PI_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_AY_PI_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_pd(void) { - uint res = OPER_AY_PD_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_AY_PD_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_di(void) { - uint res = OPER_AY_DI_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_AY_DI_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_ix(void) { - uint res = OPER_AY_IX_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_AY_IX_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_aw(void) { - uint res = OPER_AW_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_AW_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_al(void) { - uint res = OPER_AL_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_AL_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_pcdi(void) { - uint res = OPER_PCDI_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_PCDI_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_pcix(void) { - uint res = OPER_PCIX_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_PCIX_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ai_i(void) { - uint res = OPER_I_32(); - uint ea = EA_AX_AI_32(); + uint res = OPER_I_32(); + uint ea = EA_AX_AI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_d(void) { - uint res = DY; - uint ea = EA_AX_PI_32(); + uint res = DY; + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_a(void) { - uint res = AY; - uint ea = EA_AX_PI_32(); + uint res = AY; + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_ai(void) { - uint res = OPER_AY_AI_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_AY_AI_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_pi(void) { - uint res = OPER_AY_PI_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_AY_PI_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_pd(void) { - uint res = OPER_AY_PD_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_AY_PD_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_di(void) { - uint res = OPER_AY_DI_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_AY_DI_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_ix(void) { - uint res = OPER_AY_IX_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_AY_IX_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_aw(void) { - uint res = OPER_AW_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_AW_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_al(void) { - uint res = OPER_AL_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_AL_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_pcdi(void) { - uint res = OPER_PCDI_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_PCDI_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_pcix(void) { - uint res = OPER_PCIX_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_PCIX_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pi_i(void) { - uint res = OPER_I_32(); - uint ea = EA_AX_PI_32(); + uint res = OPER_I_32(); + uint ea = EA_AX_PI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_d(void) { - uint res = DY; - uint ea = EA_AX_PD_32(); + uint res = DY; + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_a(void) { - uint res = AY; - uint ea = EA_AX_PD_32(); + uint res = AY; + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_ai(void) { - uint res = OPER_AY_AI_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_AY_AI_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_pi(void) { - uint res = OPER_AY_PI_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_AY_PI_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_pd(void) { - uint res = OPER_AY_PD_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_AY_PD_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_di(void) { - uint res = OPER_AY_DI_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_AY_DI_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_ix(void) { - uint res = OPER_AY_IX_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_AY_IX_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_aw(void) { - uint res = OPER_AW_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_AW_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_al(void) { - uint res = OPER_AL_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_AL_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_pcdi(void) { - uint res = OPER_PCDI_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_PCDI_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_pcix(void) { - uint res = OPER_PCIX_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_PCIX_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_pd_i(void) { - uint res = OPER_I_32(); - uint ea = EA_AX_PD_32(); + uint res = OPER_I_32(); + uint ea = EA_AX_PD_32(); - m68ki_write_16(ea+2, res & 0xFFFF ); - m68ki_write_16(ea, (res >> 16) & 0xFFFF ); + m68ki_write_16(ea+2, res & 0xFFFF ); + m68ki_write_16(ea, (res >> 16) & 0xFFFF ); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_d(void) { - uint res = DY; - uint ea = EA_AX_DI_32(); + uint res = DY; + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_a(void) { - uint res = AY; - uint ea = EA_AX_DI_32(); + uint res = AY; + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_ai(void) { - uint res = OPER_AY_AI_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_AY_AI_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_pi(void) { - uint res = OPER_AY_PI_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_AY_PI_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_pd(void) { - uint res = OPER_AY_PD_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_AY_PD_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_di(void) { - uint res = OPER_AY_DI_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_AY_DI_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_ix(void) { - uint res = OPER_AY_IX_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_AY_IX_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_aw(void) { - uint res = OPER_AW_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_AW_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_al(void) { - uint res = OPER_AL_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_AL_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_pcdi(void) { - uint res = OPER_PCDI_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_PCDI_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_pcix(void) { - uint res = OPER_PCIX_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_PCIX_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_di_i(void) { - uint res = OPER_I_32(); - uint ea = EA_AX_DI_32(); + uint res = OPER_I_32(); + uint ea = EA_AX_DI_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_d(void) { - uint res = DY; - uint ea = EA_AX_IX_32(); + uint res = DY; + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_a(void) { - uint res = AY; - uint ea = EA_AX_IX_32(); + uint res = AY; + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_ai(void) { - uint res = OPER_AY_AI_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_AY_AI_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_pi(void) { - uint res = OPER_AY_PI_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_AY_PI_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_pd(void) { - uint res = OPER_AY_PD_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_AY_PD_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_di(void) { - uint res = OPER_AY_DI_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_AY_DI_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_ix(void) { - uint res = OPER_AY_IX_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_AY_IX_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_aw(void) { - uint res = OPER_AW_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_AW_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_al(void) { - uint res = OPER_AL_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_AL_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_pcdi(void) { - uint res = OPER_PCDI_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_PCDI_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_pcix(void) { - uint res = OPER_PCIX_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_PCIX_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_ix_i(void) { - uint res = OPER_I_32(); - uint ea = EA_AX_IX_32(); + uint res = OPER_I_32(); + uint ea = EA_AX_IX_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_d(void) { - uint res = DY; - uint ea = EA_AW_32(); + uint res = DY; + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_a(void) { - uint res = AY; - uint ea = EA_AW_32(); + uint res = AY; + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_ai(void) { - uint res = OPER_AY_AI_32(); - uint ea = EA_AW_32(); + uint res = OPER_AY_AI_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_pi(void) { - uint res = OPER_AY_PI_32(); - uint ea = EA_AW_32(); + uint res = OPER_AY_PI_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_pd(void) { - uint res = OPER_AY_PD_32(); - uint ea = EA_AW_32(); + uint res = OPER_AY_PD_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_di(void) { - uint res = OPER_AY_DI_32(); - uint ea = EA_AW_32(); + uint res = OPER_AY_DI_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_ix(void) { - uint res = OPER_AY_IX_32(); - uint ea = EA_AW_32(); + uint res = OPER_AY_IX_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_aw(void) { - uint res = OPER_AW_32(); - uint ea = EA_AW_32(); + uint res = OPER_AW_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_al(void) { - uint res = OPER_AL_32(); - uint ea = EA_AW_32(); + uint res = OPER_AL_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_pcdi(void) { - uint res = OPER_PCDI_32(); - uint ea = EA_AW_32(); + uint res = OPER_PCDI_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_pcix(void) { - uint res = OPER_PCIX_32(); - uint ea = EA_AW_32(); + uint res = OPER_PCIX_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_aw_i(void) { - uint res = OPER_I_32(); - uint ea = EA_AW_32(); + uint res = OPER_I_32(); + uint ea = EA_AW_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_d(void) { - uint res = DY; - uint ea = EA_AL_32(); + uint res = DY; + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_a(void) { - uint res = AY; - uint ea = EA_AL_32(); + uint res = AY; + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_ai(void) { - uint res = OPER_AY_AI_32(); - uint ea = EA_AL_32(); + uint res = OPER_AY_AI_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_pi(void) { - uint res = OPER_AY_PI_32(); - uint ea = EA_AL_32(); + uint res = OPER_AY_PI_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_pd(void) { - uint res = OPER_AY_PD_32(); - uint ea = EA_AL_32(); + uint res = OPER_AY_PD_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_di(void) { - uint res = OPER_AY_DI_32(); - uint ea = EA_AL_32(); + uint res = OPER_AY_DI_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_ix(void) { - uint res = OPER_AY_IX_32(); - uint ea = EA_AL_32(); + uint res = OPER_AY_IX_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_aw(void) { - uint res = OPER_AW_32(); - uint ea = EA_AL_32(); + uint res = OPER_AW_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_al(void) { - uint res = OPER_AL_32(); - uint ea = EA_AL_32(); + uint res = OPER_AL_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_pcdi(void) { - uint res = OPER_PCDI_32(); - uint ea = EA_AL_32(); + uint res = OPER_PCDI_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_pcix(void) { - uint res = OPER_PCIX_32(); - uint ea = EA_AL_32(); + uint res = OPER_PCIX_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move_32_al_i(void) { - uint res = OPER_I_32(); - uint ea = EA_AL_32(); + uint res = OPER_I_32(); + uint ea = EA_AL_32(); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_movea_16_d(void) { - AX = MAKE_INT_16(DY); + AX = MAKE_INT_16(DY); } static void m68k_op_movea_16_a(void) { - AX = MAKE_INT_16(AY); + AX = MAKE_INT_16(AY); } static void m68k_op_movea_16_ai(void) { - AX = MAKE_INT_16(OPER_AY_AI_16()); + AX = MAKE_INT_16(OPER_AY_AI_16()); } static void m68k_op_movea_16_pi(void) { - AX = MAKE_INT_16(OPER_AY_PI_16()); + AX = MAKE_INT_16(OPER_AY_PI_16()); } static void m68k_op_movea_16_pd(void) { - AX = MAKE_INT_16(OPER_AY_PD_16()); + AX = MAKE_INT_16(OPER_AY_PD_16()); } static void m68k_op_movea_16_di(void) { - AX = MAKE_INT_16(OPER_AY_DI_16()); + AX = MAKE_INT_16(OPER_AY_DI_16()); } static void m68k_op_movea_16_ix(void) { - AX = MAKE_INT_16(OPER_AY_IX_16()); + AX = MAKE_INT_16(OPER_AY_IX_16()); } static void m68k_op_movea_16_aw(void) { - AX = MAKE_INT_16(OPER_AW_16()); + AX = MAKE_INT_16(OPER_AW_16()); } static void m68k_op_movea_16_al(void) { - AX = MAKE_INT_16(OPER_AL_16()); + AX = MAKE_INT_16(OPER_AL_16()); } static void m68k_op_movea_16_pcdi(void) { - AX = MAKE_INT_16(OPER_PCDI_16()); + AX = MAKE_INT_16(OPER_PCDI_16()); } static void m68k_op_movea_16_pcix(void) { - AX = MAKE_INT_16(OPER_PCIX_16()); + AX = MAKE_INT_16(OPER_PCIX_16()); } static void m68k_op_movea_16_i(void) { - AX = MAKE_INT_16(OPER_I_16()); + AX = MAKE_INT_16(OPER_I_16()); } static void m68k_op_movea_32_d(void) { - AX = DY; + AX = DY; } static void m68k_op_movea_32_a(void) { - AX = AY; + AX = AY; } static void m68k_op_movea_32_ai(void) { - AX = OPER_AY_AI_32(); + AX = OPER_AY_AI_32(); } static void m68k_op_movea_32_pi(void) { - AX = OPER_AY_PI_32(); + AX = OPER_AY_PI_32(); } static void m68k_op_movea_32_pd(void) { - AX = OPER_AY_PD_32(); + AX = OPER_AY_PD_32(); } static void m68k_op_movea_32_di(void) { - AX = OPER_AY_DI_32(); + AX = OPER_AY_DI_32(); } static void m68k_op_movea_32_ix(void) { - AX = OPER_AY_IX_32(); + AX = OPER_AY_IX_32(); } static void m68k_op_movea_32_aw(void) { - AX = OPER_AW_32(); + AX = OPER_AW_32(); } static void m68k_op_movea_32_al(void) { - AX = OPER_AL_32(); + AX = OPER_AL_32(); } static void m68k_op_movea_32_pcdi(void) { - AX = OPER_PCDI_32(); + AX = OPER_PCDI_32(); } static void m68k_op_movea_32_pcix(void) { - AX = OPER_PCIX_32(); + AX = OPER_PCIX_32(); } static void m68k_op_movea_32_i(void) { - AX = OPER_I_32(); + AX = OPER_I_32(); } static void m68k_op_move_16_frc_d(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - DY = MASK_OUT_BELOW_16(DY) | m68ki_get_ccr(); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + DY = MASK_OUT_BELOW_16(DY) | m68ki_get_ccr(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_move_16_frc_ai(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - m68ki_write_16(EA_AY_AI_16(), m68ki_get_ccr()); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + m68ki_write_16(EA_AY_AI_16(), m68ki_get_ccr()); + return; + } + m68ki_exception_illegal(); } static void m68k_op_move_16_frc_pi(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - m68ki_write_16(EA_AY_PI_16(), m68ki_get_ccr()); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + m68ki_write_16(EA_AY_PI_16(), m68ki_get_ccr()); + return; + } + m68ki_exception_illegal(); } static void m68k_op_move_16_frc_pd(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - m68ki_write_16(EA_AY_PD_16(), m68ki_get_ccr()); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + m68ki_write_16(EA_AY_PD_16(), m68ki_get_ccr()); + return; + } + m68ki_exception_illegal(); } static void m68k_op_move_16_frc_di(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - m68ki_write_16(EA_AY_DI_16(), m68ki_get_ccr()); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + m68ki_write_16(EA_AY_DI_16(), m68ki_get_ccr()); + return; + } + m68ki_exception_illegal(); } static void m68k_op_move_16_frc_ix(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - m68ki_write_16(EA_AY_IX_16(), m68ki_get_ccr()); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + m68ki_write_16(EA_AY_IX_16(), m68ki_get_ccr()); + return; + } + m68ki_exception_illegal(); } static void m68k_op_move_16_frc_aw(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - m68ki_write_16(EA_AW_16(), m68ki_get_ccr()); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + m68ki_write_16(EA_AW_16(), m68ki_get_ccr()); + return; + } + m68ki_exception_illegal(); } static void m68k_op_move_16_frc_al(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - m68ki_write_16(EA_AL_16(), m68ki_get_ccr()); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + m68ki_write_16(EA_AL_16(), m68ki_get_ccr()); + return; + } + m68ki_exception_illegal(); } static void m68k_op_move_16_toc_d(void) { - m68ki_set_ccr(DY); + m68ki_set_ccr(DY); } static void m68k_op_move_16_toc_ai(void) { - m68ki_set_ccr(OPER_AY_AI_16()); + m68ki_set_ccr(OPER_AY_AI_16()); } static void m68k_op_move_16_toc_pi(void) { - m68ki_set_ccr(OPER_AY_PI_16()); + m68ki_set_ccr(OPER_AY_PI_16()); } static void m68k_op_move_16_toc_pd(void) { - m68ki_set_ccr(OPER_AY_PD_16()); + m68ki_set_ccr(OPER_AY_PD_16()); } static void m68k_op_move_16_toc_di(void) { - m68ki_set_ccr(OPER_AY_DI_16()); + m68ki_set_ccr(OPER_AY_DI_16()); } static void m68k_op_move_16_toc_ix(void) { - m68ki_set_ccr(OPER_AY_IX_16()); + m68ki_set_ccr(OPER_AY_IX_16()); } static void m68k_op_move_16_toc_aw(void) { - m68ki_set_ccr(OPER_AW_16()); + m68ki_set_ccr(OPER_AW_16()); } static void m68k_op_move_16_toc_al(void) { - m68ki_set_ccr(OPER_AL_16()); + m68ki_set_ccr(OPER_AL_16()); } static void m68k_op_move_16_toc_pcdi(void) { - m68ki_set_ccr(OPER_PCDI_16()); + m68ki_set_ccr(OPER_PCDI_16()); } static void m68k_op_move_16_toc_pcix(void) { - m68ki_set_ccr(OPER_PCIX_16()); + m68ki_set_ccr(OPER_PCIX_16()); } static void m68k_op_move_16_toc_i(void) { - m68ki_set_ccr(OPER_I_16()); + m68ki_set_ccr(OPER_I_16()); } static void m68k_op_move_16_frs_d(void) { - if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ - { - DY = MASK_OUT_BELOW_16(DY) | m68ki_get_sr(); - return; - } - m68ki_exception_privilege_violation(); + if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ + { + DY = MASK_OUT_BELOW_16(DY) | m68ki_get_sr(); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_frs_ai(void) { - if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ - { - uint ea = EA_AY_AI_16(); - m68ki_write_16(ea, m68ki_get_sr()); - return; - } - m68ki_exception_privilege_violation(); + if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ + { + uint ea = EA_AY_AI_16(); + m68ki_write_16(ea, m68ki_get_sr()); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_frs_pi(void) { - if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ - { - uint ea = EA_AY_PI_16(); - m68ki_write_16(ea, m68ki_get_sr()); - return; - } - m68ki_exception_privilege_violation(); + if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ + { + uint ea = EA_AY_PI_16(); + m68ki_write_16(ea, m68ki_get_sr()); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_frs_pd(void) { - if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ - { - uint ea = EA_AY_PD_16(); - m68ki_write_16(ea, m68ki_get_sr()); - return; - } - m68ki_exception_privilege_violation(); + if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ + { + uint ea = EA_AY_PD_16(); + m68ki_write_16(ea, m68ki_get_sr()); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_frs_di(void) { - if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ - { - uint ea = EA_AY_DI_16(); - m68ki_write_16(ea, m68ki_get_sr()); - return; - } - m68ki_exception_privilege_violation(); + if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ + { + uint ea = EA_AY_DI_16(); + m68ki_write_16(ea, m68ki_get_sr()); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_frs_ix(void) { - if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ - { - uint ea = EA_AY_IX_16(); - m68ki_write_16(ea, m68ki_get_sr()); - return; - } - m68ki_exception_privilege_violation(); + if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ + { + uint ea = EA_AY_IX_16(); + m68ki_write_16(ea, m68ki_get_sr()); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_frs_aw(void) { - if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ - { - uint ea = EA_AW_16(); - m68ki_write_16(ea, m68ki_get_sr()); - return; - } - m68ki_exception_privilege_violation(); + if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ + { + uint ea = EA_AW_16(); + m68ki_write_16(ea, m68ki_get_sr()); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_frs_al(void) { - if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ - { - uint ea = EA_AL_16(); - m68ki_write_16(ea, m68ki_get_sr()); - return; - } - m68ki_exception_privilege_violation(); + if(CPU_TYPE_IS_000(CPU_TYPE) || FLAG_S) /* NS990408 */ + { + uint ea = EA_AL_16(); + m68ki_write_16(ea, m68ki_get_sr()); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_d(void) { - if(FLAG_S) - { - m68ki_set_sr(DY); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + m68ki_set_sr(DY); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_ai(void) { - if(FLAG_S) - { - uint new_sr = OPER_AY_AI_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_AY_AI_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_pi(void) { - if(FLAG_S) - { - uint new_sr = OPER_AY_PI_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_AY_PI_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_pd(void) { - if(FLAG_S) - { - uint new_sr = OPER_AY_PD_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_AY_PD_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_di(void) { - if(FLAG_S) - { - uint new_sr = OPER_AY_DI_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_AY_DI_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_ix(void) { - if(FLAG_S) - { - uint new_sr = OPER_AY_IX_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_AY_IX_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_aw(void) { - if(FLAG_S) - { - uint new_sr = OPER_AW_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_AW_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_al(void) { - if(FLAG_S) - { - uint new_sr = OPER_AL_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_AL_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_pcdi(void) { - if(FLAG_S) - { - uint new_sr = OPER_PCDI_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_PCDI_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_pcix(void) { - if(FLAG_S) - { - uint new_sr = OPER_PCIX_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_PCIX_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_16_tos_i(void) { - if(FLAG_S) - { - uint new_sr = OPER_I_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(new_sr); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_I_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(new_sr); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_32_fru(void) { - if(FLAG_S) - { - AY = REG_USP; - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + AY = REG_USP; + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_move_32_tou(void) { - if(FLAG_S) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - REG_USP = AY; - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + REG_USP = AY; + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_movec_32_cr(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - switch (word2 & 0xfff) - { - case 0x000: /* SFC */ - REG_DA[(word2 >> 12) & 15] = REG_SFC; - return; - case 0x001: /* DFC */ - REG_DA[(word2 >> 12) & 15] = REG_DFC; - return; - case 0x002: /* CACR */ - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - REG_DA[(word2 >> 12) & 15] = REG_CACR; - return; - } - return; - case 0x800: /* USP */ - REG_DA[(word2 >> 12) & 15] = REG_USP; - return; - case 0x801: /* VBR */ - REG_DA[(word2 >> 12) & 15] = REG_VBR; - return; - case 0x802: /* CAAR */ - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - REG_DA[(word2 >> 12) & 15] = REG_CAAR; - return; - } - m68ki_exception_illegal(); - break; - case 0x803: /* MSP */ - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - REG_DA[(word2 >> 12) & 15] = FLAG_M ? REG_SP : REG_MSP; - return; - } - m68ki_exception_illegal(); - return; - case 0x804: /* ISP */ - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - REG_DA[(word2 >> 12) & 15] = FLAG_M ? REG_ISP : REG_SP; - return; - } - m68ki_exception_illegal(); - return; - case 0x003: /* TC */ - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x004: /* ITT0 */ - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x005: /* ITT1 */ - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x006: /* DTT0 */ - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x007: /* DTT1 */ - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x805: /* MMUSR */ - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x806: /* URP */ - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x807: /* SRP */ - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - default: - m68ki_exception_illegal(); - return; - } - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + switch (word2 & 0xfff) + { + case 0x000: /* SFC */ + REG_DA[(word2 >> 12) & 15] = REG_SFC; + return; + case 0x001: /* DFC */ + REG_DA[(word2 >> 12) & 15] = REG_DFC; + return; + case 0x002: /* CACR */ + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + REG_DA[(word2 >> 12) & 15] = REG_CACR; + return; + } + return; + case 0x800: /* USP */ + REG_DA[(word2 >> 12) & 15] = REG_USP; + return; + case 0x801: /* VBR */ + REG_DA[(word2 >> 12) & 15] = REG_VBR; + return; + case 0x802: /* CAAR */ + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + REG_DA[(word2 >> 12) & 15] = REG_CAAR; + return; + } + m68ki_exception_illegal(); + break; + case 0x803: /* MSP */ + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + REG_DA[(word2 >> 12) & 15] = FLAG_M ? REG_SP : REG_MSP; + return; + } + m68ki_exception_illegal(); + return; + case 0x804: /* ISP */ + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + REG_DA[(word2 >> 12) & 15] = FLAG_M ? REG_ISP : REG_SP; + return; + } + m68ki_exception_illegal(); + return; + case 0x003: /* TC */ + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x004: /* ITT0 */ + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x005: /* ITT1 */ + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x006: /* DTT0 */ + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x007: /* DTT1 */ + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x805: /* MMUSR */ + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x806: /* URP */ + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x807: /* SRP */ + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + default: + m68ki_exception_illegal(); + return; + } + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_movec_32_rc(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - switch (word2 & 0xfff) - { - case 0x000: /* SFC */ - REG_SFC = REG_DA[(word2 >> 12) & 15] & 7; - return; - case 0x001: /* DFC */ - REG_DFC = REG_DA[(word2 >> 12) & 15] & 7; - return; - case 0x002: /* CACR */ - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - REG_CACR = REG_DA[(word2 >> 12) & 15]; - } - else - { - /* non 68040 can only set the lower 4 bits (C,CE,F,E) */ - REG_CACR = REG_DA[(word2 >> 12) & 15] & 0x0f; - } - return; - } - m68ki_exception_illegal(); - return; - case 0x800: /* USP */ - REG_USP = REG_DA[(word2 >> 12) & 15]; - return; - case 0x801: /* VBR */ - REG_VBR = REG_DA[(word2 >> 12) & 15]; - return; - case 0x802: /* CAAR */ - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - REG_CAAR = REG_DA[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(); - return; - case 0x803: /* MSP */ - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* we are in supervisor mode so just check for M flag */ - if(!FLAG_M) - { - REG_MSP = REG_DA[(word2 >> 12) & 15]; - return; - } - REG_SP = REG_DA[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(); - return; - case 0x804: /* ISP */ - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(!FLAG_M) - { - REG_SP = REG_DA[(word2 >> 12) & 15]; - return; - } - REG_ISP = REG_DA[(word2 >> 12) & 15]; - return; - } - m68ki_exception_illegal(); - return; - case 0x003: /* TC */ - if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x004: /* ITT0 */ - if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x005: /* ITT1 */ - if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x006: /* DTT0 */ - if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x007: /* DTT1 */ - if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x805: /* MMUSR */ - if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x806: /* URP */ - if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - case 0x807: /* SRP */ - if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - /* TODO */ - return; - } - m68ki_exception_illegal(); - return; - default: - m68ki_exception_illegal(); - return; - } - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + switch (word2 & 0xfff) + { + case 0x000: /* SFC */ + REG_SFC = REG_DA[(word2 >> 12) & 15] & 7; + return; + case 0x001: /* DFC */ + REG_DFC = REG_DA[(word2 >> 12) & 15] & 7; + return; + case 0x002: /* CACR */ + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + REG_CACR = REG_DA[(word2 >> 12) & 15]; + } + else + { + /* non 68040 can only set the lower 4 bits (C,CE,F,E) */ + REG_CACR = REG_DA[(word2 >> 12) & 15] & 0x0f; + } + return; + } + m68ki_exception_illegal(); + return; + case 0x800: /* USP */ + REG_USP = REG_DA[(word2 >> 12) & 15]; + return; + case 0x801: /* VBR */ + REG_VBR = REG_DA[(word2 >> 12) & 15]; + return; + case 0x802: /* CAAR */ + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + REG_CAAR = REG_DA[(word2 >> 12) & 15]; + return; + } + m68ki_exception_illegal(); + return; + case 0x803: /* MSP */ + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* we are in supervisor mode so just check for M flag */ + if(!FLAG_M) + { + REG_MSP = REG_DA[(word2 >> 12) & 15]; + return; + } + REG_SP = REG_DA[(word2 >> 12) & 15]; + return; + } + m68ki_exception_illegal(); + return; + case 0x804: /* ISP */ + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(!FLAG_M) + { + REG_SP = REG_DA[(word2 >> 12) & 15]; + return; + } + REG_ISP = REG_DA[(word2 >> 12) & 15]; + return; + } + m68ki_exception_illegal(); + return; + case 0x003: /* TC */ + if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x004: /* ITT0 */ + if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x005: /* ITT1 */ + if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x006: /* DTT0 */ + if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x007: /* DTT1 */ + if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x805: /* MMUSR */ + if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x806: /* URP */ + if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + case 0x807: /* SRP */ + if (CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + /* TODO */ + return; + } + m68ki_exception_illegal(); + return; + default: + m68ki_exception_illegal(); + return; + } + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_movem_16_re_pd(void) { - uint i = 0; - uint register_list = OPER_I_16(); - uint ea = AY; - uint count = 0; + uint i = 0; + uint register_list = OPER_I_16(); + uint ea = AY; + uint count = 0; - for(; i < 16; i++) - if(register_list & (1 << i)) - { - ea -= 2; - m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_DA[15-i])); - count++; - } - AY = ea; + for(; i < 16; i++) + if(register_list & (1 << i)) + { + ea -= 2; + m68ki_write_16(ea, MASK_OUT_ABOVE_16(REG_DA[15-i])); + count++; + } + AY = ea; - USE_CYCLES(count<> 16) & 0xFFFF ); - count++; - } - AY = ea; + for(; i < 16; i++) + if(register_list & (1 << i)) + { + ea -= 4; + m68ki_write_16(ea+2, REG_DA[15-i] & 0xFFFF ); + m68ki_write_16(ea, (REG_DA[15-i] >> 16) & 0xFFFF ); + count++; + } + AY = ea; - USE_CYCLES(count<> 8)); - m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(src >> 8)); + m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src)); } static void m68k_op_movep_32_re(void) { - uint ea = EA_AY_DI_32(); - uint src = DX; + uint ea = EA_AY_DI_32(); + uint src = DX; - m68ki_write_8(ea, MASK_OUT_ABOVE_8(src >> 24)); - m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src >> 16)); - m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src >> 8)); - m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(src >> 24)); + m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src >> 16)); + m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src >> 8)); + m68ki_write_8(ea += 2, MASK_OUT_ABOVE_8(src)); } static void m68k_op_movep_16_er(void) { - uint ea = EA_AY_DI_16(); - uint* r_dst = &DX; + uint ea = EA_AY_DI_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | ((m68ki_read_8(ea) << 8) + m68ki_read_8(ea + 2)); + *r_dst = MASK_OUT_BELOW_16(*r_dst) | ((m68ki_read_8(ea) << 8) + m68ki_read_8(ea + 2)); } static void m68k_op_movep_32_er(void) { - uint ea = EA_AY_DI_32(); + uint ea = EA_AY_DI_32(); - DX = (m68ki_read_8(ea) << 24) + (m68ki_read_8(ea + 2) << 16) - + (m68ki_read_8(ea + 4) << 8) + m68ki_read_8(ea + 6); + DX = (m68ki_read_8(ea) << 24) + (m68ki_read_8(ea + 2) << 16) + + (m68ki_read_8(ea + 4) << 8) + m68ki_read_8(ea + 6); } static void m68k_op_moves_8_ai(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_AI_8(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_AI_8(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_8_pi(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PI_8(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PI_8(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_8_pi7(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_A7_PI_8(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_A7_PI_8(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_8_pd(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PD_8(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PD_8(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_8_pd7(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_A7_PD_8(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_A7_PD_8(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_8_di(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_DI_8(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_DI_8(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_8_ix(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_IX_8(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_IX_8(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_8_aw(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AW_8(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AW_8(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_8_al(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AL_8(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AL_8(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_8_fc(ea, REG_DFC, MASK_OUT_ABOVE_8(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_8(m68ki_read_8_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_8(REG_D[(word2 >> 12) & 7]) | m68ki_read_8_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_16_ai(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_AI_16(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_AI_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_16_pi(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PI_16(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PI_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_16_pd(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PD_16(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PD_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_16_di(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_DI_16(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_DI_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_16_ix(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_IX_16(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_IX_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_16_aw(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AW_16(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AW_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_16_al(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AL_16(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AL_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); - return; - } - if(BIT_F(word2)) /* Memory to address register */ - { - REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to data register */ - REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_16_fc(ea, REG_DFC, MASK_OUT_ABOVE_16(REG_DA[(word2 >> 12) & 15])); + return; + } + if(BIT_F(word2)) /* Memory to address register */ + { + REG_A[(word2 >> 12) & 7] = MAKE_INT_16(m68ki_read_16_fc(ea, REG_SFC)); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to data register */ + REG_D[(word2 >> 12) & 7] = MASK_OUT_BELOW_16(REG_D[(word2 >> 12) & 7]) | m68ki_read_16_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_32_ai(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_AI_32(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_AI_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to register */ - REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to register */ + REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_32_pi(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PI_32(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PI_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to register */ - REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to register */ + REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_32_pd(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_PD_32(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_PD_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to register */ - REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to register */ + REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_32_di(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_DI_32(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_DI_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to register */ - REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to register */ + REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_32_ix(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AY_IX_32(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AY_IX_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to register */ - REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to register */ + REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_32_aw(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AW_32(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AW_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to register */ - REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to register */ + REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moves_32_al(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - if(FLAG_S) - { - uint word2 = OPER_I_16(); - uint ea = EA_AL_32(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + if(FLAG_S) + { + uint word2 = OPER_I_16(); + uint ea = EA_AL_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(BIT_B(word2)) /* Register to memory */ - { - m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - /* Memory to register */ - REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - USE_CYCLES(2); - return; - } - m68ki_exception_privilege_violation(); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + if(BIT_B(word2)) /* Register to memory */ + { + m68ki_write_32_fc(ea, REG_DFC, REG_DA[(word2 >> 12) & 15]); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + /* Memory to register */ + REG_DA[(word2 >> 12) & 15] = m68ki_read_32_fc(ea, REG_SFC); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + USE_CYCLES(2); + return; + } + m68ki_exception_privilege_violation(); + return; + } + m68ki_exception_illegal(); } static void m68k_op_moveq_32(void) { - uint res = DX = MAKE_INT_8(MASK_OUT_ABOVE_8(REG_IR)); + uint res = DX = MAKE_INT_8(MASK_OUT_ABOVE_8(REG_IR)); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_move16_32(void) { - uint16 w2 = OPER_I_16(); - int ax = REG_IR & 7; - int ay = (w2 >> 12) & 7; + uint16 w2 = OPER_I_16(); + int ax = REG_IR & 7; + int ay = (w2 >> 12) & 7; - m68ki_write_32(REG_A[ay], m68ki_read_32(REG_A[ax])); - m68ki_write_32(REG_A[ay]+4, m68ki_read_32(REG_A[ax]+4)); - m68ki_write_32(REG_A[ay]+8, m68ki_read_32(REG_A[ax]+8)); - m68ki_write_32(REG_A[ay]+12, m68ki_read_32(REG_A[ax]+12)); + m68ki_write_32(REG_A[ay], m68ki_read_32(REG_A[ax])); + m68ki_write_32(REG_A[ay]+4, m68ki_read_32(REG_A[ax]+4)); + m68ki_write_32(REG_A[ay]+8, m68ki_read_32(REG_A[ax]+8)); + m68ki_write_32(REG_A[ay]+12, m68ki_read_32(REG_A[ax]+12)); - REG_A[ax] += 16; - REG_A[ay] += 16; + REG_A[ax] += 16; + REG_A[ay] += 16; } static void m68k_op_muls_16_d(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(DY) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(DY) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_ai(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_AI_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_AI_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_pi(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_PI_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_PI_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_pd(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_PD_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_PD_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_di(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_DI_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_DI_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_ix(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_IX_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AY_IX_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_aw(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AW_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AW_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_al(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AL_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_AL_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_pcdi(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_PCDI_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_PCDI_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_pcix(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_PCIX_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_PCIX_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_muls_16_i(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_I_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_32(MAKE_INT_16(OPER_I_16()) * MAKE_INT_16(MASK_OUT_ABOVE_16(*r_dst))); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_d(void) { - uint* r_dst = &DX; - uint res = MASK_OUT_ABOVE_16(DY) * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = MASK_OUT_ABOVE_16(DY) * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_ai(void) { - uint* r_dst = &DX; - uint res = OPER_AY_AI_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_AY_AI_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_pi(void) { - uint* r_dst = &DX; - uint res = OPER_AY_PI_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_AY_PI_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_pd(void) { - uint* r_dst = &DX; - uint res = OPER_AY_PD_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_AY_PD_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_di(void) { - uint* r_dst = &DX; - uint res = OPER_AY_DI_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_AY_DI_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_ix(void) { - uint* r_dst = &DX; - uint res = OPER_AY_IX_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_AY_IX_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_aw(void) { - uint* r_dst = &DX; - uint res = OPER_AW_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_AW_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_al(void) { - uint* r_dst = &DX; - uint res = OPER_AL_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_AL_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_pcdi(void) { - uint* r_dst = &DX; - uint res = OPER_PCDI_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_PCDI_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_pcix(void) { - uint* r_dst = &DX; - uint res = OPER_PCIX_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_PCIX_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_mulu_16_i(void) { - uint* r_dst = &DX; - uint res = OPER_I_16() * MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DX; + uint res = OPER_I_16() * MASK_OUT_ABOVE_16(*r_dst); - *r_dst = res; + *r_dst = res; - FLAG_Z = res; - FLAG_N = NFLAG_32(res); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = res; + FLAG_N = NFLAG_32(res); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } @@ -24260,121 +24260,121 @@ static void m68k_op_mull_32_d(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = DY; - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = DY; + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = DY; - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = DY; + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -24384,121 +24384,121 @@ static void m68k_op_mull_32_ai(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_AY_AI_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_AY_AI_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_AY_AI_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_AY_AI_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -24508,121 +24508,121 @@ static void m68k_op_mull_32_pi(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_AY_PI_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_AY_PI_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_AY_PI_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_AY_PI_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -24632,121 +24632,121 @@ static void m68k_op_mull_32_pd(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_AY_PD_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_AY_PD_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_AY_PD_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_AY_PD_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -24756,121 +24756,121 @@ static void m68k_op_mull_32_di(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_AY_DI_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_AY_DI_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_AY_DI_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_AY_DI_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -24880,121 +24880,121 @@ static void m68k_op_mull_32_ix(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_AY_IX_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_AY_IX_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_AY_IX_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_AY_IX_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -25004,121 +25004,121 @@ static void m68k_op_mull_32_aw(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_AW_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_AW_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_AW_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_AW_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -25128,121 +25128,121 @@ static void m68k_op_mull_32_al(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_AL_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_AL_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_AL_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_AL_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -25252,121 +25252,121 @@ static void m68k_op_mull_32_pcdi(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_PCDI_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_PCDI_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_PCDI_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_PCDI_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -25376,121 +25376,121 @@ static void m68k_op_mull_32_pcix(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_PCIX_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_PCIX_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_PCIX_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_PCIX_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -25500,121 +25500,121 @@ static void m68k_op_mull_32_i(void) { #if M68K_USE_64_BIT - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint64 src = OPER_I_32(); - uint64 dst = REG_D[(word2 >> 12) & 7]; - uint64 res; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint64 src = OPER_I_32(); + uint64 dst = REG_D[(word2 >> 12) & 7]; + uint64 res; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - res = (sint64)((sint32)src) * (sint64)((sint32)dst); - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = ((sint64)res != (sint32)res)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } + if(BIT_B(word2)) /* signed */ + { + res = (sint64)((sint32)src) * (sint64)((sint32)dst); + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = ((sint64)res != (sint32)res)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } - res = src * dst; - if(!BIT_A(word2)) - { - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_N = NFLAG_32(res); - FLAG_V = (res > 0xffffffff)<<7; - REG_D[(word2 >> 12) & 7] = FLAG_Z; - return; - } - FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); - FLAG_N = NFLAG_64(res); - FLAG_V = VFLAG_CLEAR; - REG_D[word2 & 7] = (res >> 32); - REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); - return; - } - m68ki_exception_illegal(); + res = src * dst; + if(!BIT_A(word2)) + { + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_V = (res > 0xffffffff)<<7; + REG_D[(word2 >> 12) & 7] = FLAG_Z; + return; + } + FLAG_Z = MASK_OUT_ABOVE_32(res) | (res>>32); + FLAG_N = NFLAG_64(res); + FLAG_V = VFLAG_CLEAR; + REG_D[word2 & 7] = (res >> 32); + REG_D[(word2 >> 12) & 7] = MASK_OUT_ABOVE_32(res); + return; + } + m68ki_exception_illegal(); #else - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint word2 = OPER_I_16(); - uint src = OPER_I_32(); - uint dst = REG_D[(word2 >> 12) & 7]; - uint neg = GET_MSB_32(src ^ dst); - uint src1; - uint src2; - uint dst1; - uint dst2; - uint r1; - uint r2; - uint r3; - uint r4; - uint lo; - uint hi; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint word2 = OPER_I_16(); + uint src = OPER_I_32(); + uint dst = REG_D[(word2 >> 12) & 7]; + uint neg = GET_MSB_32(src ^ dst); + uint src1; + uint src2; + uint dst1; + uint dst2; + uint r1; + uint r2; + uint r3; + uint r4; + uint lo; + uint hi; - FLAG_C = CFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - if(BIT_B(word2)) /* signed */ - { - if(GET_MSB_32(src)) - src = (uint)MASK_OUT_ABOVE_32(-(sint)src); - if(GET_MSB_32(dst)) - dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); - } + if(BIT_B(word2)) /* signed */ + { + if(GET_MSB_32(src)) + src = (uint)MASK_OUT_ABOVE_32(-(sint)src); + if(GET_MSB_32(dst)) + dst = (uint)MASK_OUT_ABOVE_32(-(sint)dst); + } - src1 = MASK_OUT_ABOVE_16(src); - src2 = src>>16; - dst1 = MASK_OUT_ABOVE_16(dst); - dst2 = dst>>16; + src1 = MASK_OUT_ABOVE_16(src); + src2 = src>>16; + dst1 = MASK_OUT_ABOVE_16(dst); + dst2 = dst>>16; - r1 = src1 * dst1; - r2 = src1 * dst2; - r3 = src2 * dst1; - r4 = src2 * dst2; + r1 = src1 * dst1; + r2 = src1 * dst2; + r3 = src2 * dst1; + r4 = src2 * dst2; - lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); - hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); + lo = r1 + (MASK_OUT_ABOVE_16(r2)<<16) + (MASK_OUT_ABOVE_16(r3)<<16); + hi = r4 + (r2>>16) + (r3>>16) + (((r1>>16) + MASK_OUT_ABOVE_16(r2) + MASK_OUT_ABOVE_16(r3)) >> 16); - if(BIT_B(word2) && neg) - { - hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); - lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); - } + if(BIT_B(word2) && neg) + { + hi = (uint)MASK_OUT_ABOVE_32((-(sint)hi) - (lo != 0)); + lo = (uint)MASK_OUT_ABOVE_32(-(sint)lo); + } - if(BIT_A(word2)) - { - REG_D[word2 & 7] = hi; - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(hi); - FLAG_Z = hi | lo; - FLAG_V = VFLAG_CLEAR; - return; - } + if(BIT_A(word2)) + { + REG_D[word2 & 7] = hi; + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(hi); + FLAG_Z = hi | lo; + FLAG_V = VFLAG_CLEAR; + return; + } - REG_D[(word2 >> 12) & 7] = lo; - FLAG_N = NFLAG_32(lo); - FLAG_Z = lo; - if(BIT_B(word2)) - FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; - else - FLAG_V = (hi != 0) << 7; - return; - } - m68ki_exception_illegal(); + REG_D[(word2 >> 12) & 7] = lo; + FLAG_N = NFLAG_32(lo); + FLAG_Z = lo; + if(BIT_B(word2)) + FLAG_V = (!((GET_MSB_32(lo) && hi == 0xffffffff) || (!GET_MSB_32(lo) && !hi)))<<7; + else + FLAG_V = (hi != 0) << 7; + return; + } + m68ki_exception_illegal(); #endif } @@ -25622,3337 +25622,3337 @@ static void m68k_op_mull_32_i(void) static void m68k_op_nbcd_8_d(void) { - uint* r_dst = &DY; - uint dst = *r_dst; - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint* r_dst = &DY; + uint dst = *r_dst; + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_nbcd_8_ai(void) { - uint ea = EA_AY_AI_8(); - uint dst = m68ki_read_8(ea); - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint ea = EA_AY_AI_8(); + uint dst = m68ki_read_8(ea); + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_nbcd_8_pi(void) { - uint ea = EA_AY_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint ea = EA_AY_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_nbcd_8_pi7(void) { - uint ea = EA_A7_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint ea = EA_A7_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_nbcd_8_pd(void) { - uint ea = EA_AY_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint ea = EA_AY_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_nbcd_8_pd7(void) { - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_nbcd_8_di(void) { - uint ea = EA_AY_DI_8(); - uint dst = m68ki_read_8(ea); - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint ea = EA_AY_DI_8(); + uint dst = m68ki_read_8(ea); + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_nbcd_8_ix(void) { - uint ea = EA_AY_IX_8(); - uint dst = m68ki_read_8(ea); - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint ea = EA_AY_IX_8(); + uint dst = m68ki_read_8(ea); + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_nbcd_8_aw(void) { - uint ea = EA_AW_8(); - uint dst = m68ki_read_8(ea); - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint ea = EA_AW_8(); + uint dst = m68ki_read_8(ea); + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_nbcd_8_al(void) { - uint ea = EA_AL_8(); - uint dst = m68ki_read_8(ea); - uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); + uint ea = EA_AL_8(); + uint dst = m68ki_read_8(ea); + uint res = MASK_OUT_ABOVE_8(0x9a - dst - XFLAG_AS_1()); - if(res != 0x9a) - { - FLAG_V = ~res; /* Undefined V behavior */ + if(res != 0x9a) + { + FLAG_V = ~res; /* Undefined V behavior */ - if((res & 0x0f) == 0xa) - res = (res & 0xf0) + 0x10; + if((res & 0x0f) == 0xa) + res = (res & 0xf0) + 0x10; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); - FLAG_V &= res; /* Undefined V behavior part II */ + FLAG_V &= res; /* Undefined V behavior part II */ - m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); + m68ki_write_8(ea, MASK_OUT_ABOVE_8(res)); - FLAG_Z |= res; - FLAG_C = CFLAG_SET; - FLAG_X = XFLAG_SET; - } - else - { - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - FLAG_X = XFLAG_CLEAR; - } - FLAG_N = NFLAG_8(res); /* Undefined N behavior */ + FLAG_Z |= res; + FLAG_C = CFLAG_SET; + FLAG_X = XFLAG_SET; + } + else + { + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_X = XFLAG_CLEAR; + } + FLAG_N = NFLAG_8(res); /* Undefined N behavior */ } static void m68k_op_neg_8_d(void) { - uint* r_dst = &DY; - uint res = 0 - MASK_OUT_ABOVE_8(*r_dst); + uint* r_dst = &DY; + uint res = 0 - MASK_OUT_ABOVE_8(*r_dst); - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = *r_dst & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = *r_dst & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_neg_8_ai(void) { - uint ea = EA_AY_AI_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src; + uint ea = EA_AY_AI_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src; - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = src & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = src & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_neg_8_pi(void) { - uint ea = EA_AY_PI_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src; + uint ea = EA_AY_PI_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src; - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = src & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = src & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_neg_8_pi7(void) { - uint ea = EA_A7_PI_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src; + uint ea = EA_A7_PI_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src; - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = src & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = src & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_neg_8_pd(void) { - uint ea = EA_AY_PD_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src; + uint ea = EA_AY_PD_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src; - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = src & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = src & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_neg_8_pd7(void) { - uint ea = EA_A7_PD_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src; + uint ea = EA_A7_PD_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src; - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = src & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = src & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_neg_8_di(void) { - uint ea = EA_AY_DI_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src; + uint ea = EA_AY_DI_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src; - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = src & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = src & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_neg_8_ix(void) { - uint ea = EA_AY_IX_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src; + uint ea = EA_AY_IX_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src; - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = src & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = src & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_neg_8_aw(void) { - uint ea = EA_AW_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src; + uint ea = EA_AW_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src; - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = src & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = src & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_neg_8_al(void) { - uint ea = EA_AL_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src; + uint ea = EA_AL_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src; - FLAG_N = NFLAG_8(res); - FLAG_C = FLAG_X = CFLAG_8(res); - FLAG_V = src & res; - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_C = FLAG_X = CFLAG_8(res); + FLAG_V = src & res; + FLAG_Z = MASK_OUT_ABOVE_8(res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_neg_16_d(void) { - uint* r_dst = &DY; - uint res = 0 - MASK_OUT_ABOVE_16(*r_dst); + uint* r_dst = &DY; + uint res = 0 - MASK_OUT_ABOVE_16(*r_dst); - FLAG_N = NFLAG_16(res); - FLAG_C = FLAG_X = CFLAG_16(res); - FLAG_V = (*r_dst & res)>>8; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = FLAG_X = CFLAG_16(res); + FLAG_V = (*r_dst & res)>>8; + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_neg_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - src; + uint ea = EA_AY_AI_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - src; - FLAG_N = NFLAG_16(res); - FLAG_C = FLAG_X = CFLAG_16(res); - FLAG_V = (src & res)>>8; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = FLAG_X = CFLAG_16(res); + FLAG_V = (src & res)>>8; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_neg_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - src; + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - src; - FLAG_N = NFLAG_16(res); - FLAG_C = FLAG_X = CFLAG_16(res); - FLAG_V = (src & res)>>8; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = FLAG_X = CFLAG_16(res); + FLAG_V = (src & res)>>8; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_neg_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - src; + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - src; - FLAG_N = NFLAG_16(res); - FLAG_C = FLAG_X = CFLAG_16(res); - FLAG_V = (src & res)>>8; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = FLAG_X = CFLAG_16(res); + FLAG_V = (src & res)>>8; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_neg_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - src; + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - src; - FLAG_N = NFLAG_16(res); - FLAG_C = FLAG_X = CFLAG_16(res); - FLAG_V = (src & res)>>8; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = FLAG_X = CFLAG_16(res); + FLAG_V = (src & res)>>8; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_neg_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - src; + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - src; - FLAG_N = NFLAG_16(res); - FLAG_C = FLAG_X = CFLAG_16(res); - FLAG_V = (src & res)>>8; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = FLAG_X = CFLAG_16(res); + FLAG_V = (src & res)>>8; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_neg_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - src; + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - src; - FLAG_N = NFLAG_16(res); - FLAG_C = FLAG_X = CFLAG_16(res); - FLAG_V = (src & res)>>8; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = FLAG_X = CFLAG_16(res); + FLAG_V = (src & res)>>8; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_neg_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - src; + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - src; - FLAG_N = NFLAG_16(res); - FLAG_C = FLAG_X = CFLAG_16(res); - FLAG_V = (src & res)>>8; - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_C = FLAG_X = CFLAG_16(res); + FLAG_V = (src & res)>>8; + FLAG_Z = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_neg_32_d(void) { - uint* r_dst = &DY; - uint res = 0 - *r_dst; + uint* r_dst = &DY; + uint res = 0 - *r_dst; - FLAG_N = NFLAG_32(res); - FLAG_C = FLAG_X = CFLAG_SUB_32(*r_dst, 0, res); - FLAG_V = (*r_dst & res)>>24; - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_C = FLAG_X = CFLAG_SUB_32(*r_dst, 0, res); + FLAG_V = (*r_dst & res)>>24; + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_neg_32_ai(void) { - uint ea = EA_AY_AI_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - src; + uint ea = EA_AY_AI_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - src; - FLAG_N = NFLAG_32(res); - FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_neg_32_pi(void) { - uint ea = EA_AY_PI_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - src; + uint ea = EA_AY_PI_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - src; - FLAG_N = NFLAG_32(res); - FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_neg_32_pd(void) { - uint ea = EA_AY_PD_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - src; + uint ea = EA_AY_PD_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - src; - FLAG_N = NFLAG_32(res); - FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_neg_32_di(void) { - uint ea = EA_AY_DI_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - src; + uint ea = EA_AY_DI_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - src; - FLAG_N = NFLAG_32(res); - FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_neg_32_ix(void) { - uint ea = EA_AY_IX_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - src; + uint ea = EA_AY_IX_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - src; - FLAG_N = NFLAG_32(res); - FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_neg_32_aw(void) { - uint ea = EA_AW_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - src; + uint ea = EA_AW_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - src; - FLAG_N = NFLAG_32(res); - FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_neg_32_al(void) { - uint ea = EA_AL_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - src; + uint ea = EA_AL_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - src; - FLAG_N = NFLAG_32(res); - FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_C = FLAG_X = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; + FLAG_Z = MASK_OUT_ABOVE_32(res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_negx_8_d(void) { - uint* r_dst = &DY; - uint res = 0 - MASK_OUT_ABOVE_8(*r_dst) - XFLAG_AS_1(); + uint* r_dst = &DY; + uint res = 0 - MASK_OUT_ABOVE_8(*r_dst) - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = *r_dst & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = *r_dst & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; } static void m68k_op_negx_8_ai(void) { - uint ea = EA_AY_AI_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src - XFLAG_AS_1(); + uint ea = EA_AY_AI_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = src & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = src & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_negx_8_pi(void) { - uint ea = EA_AY_PI_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src - XFLAG_AS_1(); + uint ea = EA_AY_PI_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = src & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = src & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_negx_8_pi7(void) { - uint ea = EA_A7_PI_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src - XFLAG_AS_1(); + uint ea = EA_A7_PI_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = src & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = src & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_negx_8_pd(void) { - uint ea = EA_AY_PD_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src - XFLAG_AS_1(); + uint ea = EA_AY_PD_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = src & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = src & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_negx_8_pd7(void) { - uint ea = EA_A7_PD_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src - XFLAG_AS_1(); + uint ea = EA_A7_PD_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = src & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = src & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_negx_8_di(void) { - uint ea = EA_AY_DI_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src - XFLAG_AS_1(); + uint ea = EA_AY_DI_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = src & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = src & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_negx_8_ix(void) { - uint ea = EA_AY_IX_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src - XFLAG_AS_1(); + uint ea = EA_AY_IX_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = src & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = src & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_negx_8_aw(void) { - uint ea = EA_AW_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src - XFLAG_AS_1(); + uint ea = EA_AW_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = src & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = src & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_negx_8_al(void) { - uint ea = EA_AL_8(); - uint src = m68ki_read_8(ea); - uint res = 0 - src - XFLAG_AS_1(); + uint ea = EA_AL_8(); + uint src = m68ki_read_8(ea); + uint res = 0 - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = src & res; + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = src & res; - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_negx_16_d(void) { - uint* r_dst = &DY; - uint res = 0 - MASK_OUT_ABOVE_16(*r_dst) - XFLAG_AS_1(); + uint* r_dst = &DY; + uint res = 0 - MASK_OUT_ABOVE_16(*r_dst) - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = (*r_dst & res)>>8; + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = (*r_dst & res)>>8; - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; } static void m68k_op_negx_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); + uint ea = EA_AY_AI_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = (src & res)>>8; + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = (src & res)>>8; - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_negx_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = (src & res)>>8; + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = (src & res)>>8; - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_negx_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = (src & res)>>8; + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = (src & res)>>8; - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_negx_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = (src & res)>>8; + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = (src & res)>>8; - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_negx_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = (src & res)>>8; + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = (src & res)>>8; - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_negx_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = (src & res)>>8; + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = (src & res)>>8; - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_negx_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = 0 - MASK_OUT_ABOVE_16(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = (src & res)>>8; + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = (src & res)>>8; - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_negx_32_d(void) { - uint* r_dst = &DY; - uint res = 0 - MASK_OUT_ABOVE_32(*r_dst) - XFLAG_AS_1(); + uint* r_dst = &DY; + uint res = 0 - MASK_OUT_ABOVE_32(*r_dst) - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(*r_dst, 0, res); - FLAG_V = (*r_dst & res)>>24; + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(*r_dst, 0, res); + FLAG_V = (*r_dst & res)>>24; - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - *r_dst = res; + *r_dst = res; } static void m68k_op_negx_32_ai(void) { - uint ea = EA_AY_AI_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); + uint ea = EA_AY_AI_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_negx_32_pi(void) { - uint ea = EA_AY_PI_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); + uint ea = EA_AY_PI_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_negx_32_pd(void) { - uint ea = EA_AY_PD_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); + uint ea = EA_AY_PD_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_negx_32_di(void) { - uint ea = EA_AY_DI_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); + uint ea = EA_AY_DI_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_negx_32_ix(void) { - uint ea = EA_AY_IX_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); + uint ea = EA_AY_IX_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_negx_32_aw(void) { - uint ea = EA_AW_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); + uint ea = EA_AW_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_negx_32_al(void) { - uint ea = EA_AL_32(); - uint src = m68ki_read_32(ea); - uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); + uint ea = EA_AL_32(); + uint src = m68ki_read_32(ea); + uint res = 0 - MASK_OUT_ABOVE_32(src) - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); - FLAG_V = (src & res)>>24; + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, 0, res); + FLAG_V = (src & res)>>24; - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_nop(void) { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ } static void m68k_op_not_8_d(void) { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_8(~*r_dst); + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_8(~*r_dst); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_8_ai(void) { - uint ea = EA_AY_AI_8(); - uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); + uint ea = EA_AY_AI_8(); + uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_8_pi(void) { - uint ea = EA_AY_PI_8(); - uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); + uint ea = EA_AY_PI_8(); + uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_8_pi7(void) { - uint ea = EA_A7_PI_8(); - uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); + uint ea = EA_A7_PI_8(); + uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_8_pd(void) { - uint ea = EA_AY_PD_8(); - uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); + uint ea = EA_AY_PD_8(); + uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_8_pd7(void) { - uint ea = EA_A7_PD_8(); - uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); + uint ea = EA_A7_PD_8(); + uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_8_di(void) { - uint ea = EA_AY_DI_8(); - uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); + uint ea = EA_AY_DI_8(); + uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_8_ix(void) { - uint ea = EA_AY_IX_8(); - uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); + uint ea = EA_AY_IX_8(); + uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_8_aw(void) { - uint ea = EA_AW_8(); - uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); + uint ea = EA_AW_8(); + uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_8_al(void) { - uint ea = EA_AL_8(); - uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); + uint ea = EA_AL_8(); + uint res = MASK_OUT_ABOVE_8(~m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_16_d(void) { - uint* r_dst = &DY; - uint res = MASK_OUT_ABOVE_16(~*r_dst); + uint* r_dst = &DY; + uint res = MASK_OUT_ABOVE_16(~*r_dst); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); + uint ea = EA_AY_AI_16(); + uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); + uint ea = EA_AY_PI_16(); + uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); + uint ea = EA_AY_PD_16(); + uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_16_di(void) { - uint ea = EA_AY_DI_16(); - uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); + uint ea = EA_AY_DI_16(); + uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); + uint ea = EA_AY_IX_16(); + uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_16_aw(void) { - uint ea = EA_AW_16(); - uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); + uint ea = EA_AW_16(); + uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_16_al(void) { - uint ea = EA_AL_16(); - uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); + uint ea = EA_AL_16(); + uint res = MASK_OUT_ABOVE_16(~m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_32_d(void) { - uint* r_dst = &DY; - uint res = *r_dst = MASK_OUT_ABOVE_32(~*r_dst); + uint* r_dst = &DY; + uint res = *r_dst = MASK_OUT_ABOVE_32(~*r_dst); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_32_ai(void) { - uint ea = EA_AY_AI_32(); - uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); + uint ea = EA_AY_AI_32(); + uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_32_pi(void) { - uint ea = EA_AY_PI_32(); - uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); + uint ea = EA_AY_PI_32(); + uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_32_pd(void) { - uint ea = EA_AY_PD_32(); - uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); + uint ea = EA_AY_PD_32(); + uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_32_di(void) { - uint ea = EA_AY_DI_32(); - uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); + uint ea = EA_AY_DI_32(); + uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_32_ix(void) { - uint ea = EA_AY_IX_32(); - uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); + uint ea = EA_AY_IX_32(); + uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_32_aw(void) { - uint ea = EA_AW_32(); - uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); + uint ea = EA_AW_32(); + uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_not_32_al(void) { - uint ea = EA_AL_32(); - uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); + uint ea = EA_AL_32(); + uint res = MASK_OUT_ABOVE_32(~m68ki_read_32(ea)); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_d(void) { - uint res = MASK_OUT_ABOVE_8((DX |= MASK_OUT_ABOVE_8(DY))); + uint res = MASK_OUT_ABOVE_8((DX |= MASK_OUT_ABOVE_8(DY))); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_ai(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_AI_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_AI_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_pi(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_PI_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_PI_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_pi7(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_A7_PI_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_A7_PI_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_pd(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_PD_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_PD_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_pd7(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_A7_PD_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_A7_PD_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_di(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_DI_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_DI_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_ix(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_IX_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_AY_IX_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_aw(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_AW_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_AW_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_al(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_AL_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_AL_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_pcdi(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_PCDI_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_PCDI_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_pcix(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_PCIX_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_PCIX_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_er_i(void) { - uint res = MASK_OUT_ABOVE_8((DX |= OPER_I_8())); + uint res = MASK_OUT_ABOVE_8((DX |= OPER_I_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_d(void) { - uint res = MASK_OUT_ABOVE_16((DX |= MASK_OUT_ABOVE_16(DY))); + uint res = MASK_OUT_ABOVE_16((DX |= MASK_OUT_ABOVE_16(DY))); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_ai(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_AI_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_AI_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_pi(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_PI_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_PI_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_pd(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_PD_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_PD_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_di(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_DI_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_DI_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_ix(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_IX_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_AY_IX_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_aw(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_AW_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_AW_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_al(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_AL_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_AL_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_pcdi(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_PCDI_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_PCDI_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_pcix(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_PCIX_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_PCIX_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_er_i(void) { - uint res = MASK_OUT_ABOVE_16((DX |= OPER_I_16())); + uint res = MASK_OUT_ABOVE_16((DX |= OPER_I_16())); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_d(void) { - uint res = DX |= DY; + uint res = DX |= DY; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_ai(void) { - uint res = DX |= OPER_AY_AI_32(); + uint res = DX |= OPER_AY_AI_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_pi(void) { - uint res = DX |= OPER_AY_PI_32(); + uint res = DX |= OPER_AY_PI_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_pd(void) { - uint res = DX |= OPER_AY_PD_32(); + uint res = DX |= OPER_AY_PD_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_di(void) { - uint res = DX |= OPER_AY_DI_32(); + uint res = DX |= OPER_AY_DI_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_ix(void) { - uint res = DX |= OPER_AY_IX_32(); + uint res = DX |= OPER_AY_IX_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_aw(void) { - uint res = DX |= OPER_AW_32(); + uint res = DX |= OPER_AW_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_al(void) { - uint res = DX |= OPER_AL_32(); + uint res = DX |= OPER_AL_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_pcdi(void) { - uint res = DX |= OPER_PCDI_32(); + uint res = DX |= OPER_PCDI_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_pcix(void) { - uint res = DX |= OPER_PCIX_32(); + uint res = DX |= OPER_PCIX_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_er_i(void) { - uint res = DX |= OPER_I_32(); + uint res = DX |= OPER_I_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_re_ai(void) { - uint ea = EA_AY_AI_8(); - uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); + uint ea = EA_AY_AI_8(); + uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_re_pi(void) { - uint ea = EA_AY_PI_8(); - uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); + uint ea = EA_AY_PI_8(); + uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_re_pi7(void) { - uint ea = EA_A7_PI_8(); - uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); + uint ea = EA_A7_PI_8(); + uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_re_pd(void) { - uint ea = EA_AY_PD_8(); - uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); + uint ea = EA_AY_PD_8(); + uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_re_pd7(void) { - uint ea = EA_A7_PD_8(); - uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); + uint ea = EA_A7_PD_8(); + uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_re_di(void) { - uint ea = EA_AY_DI_8(); - uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); + uint ea = EA_AY_DI_8(); + uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_re_ix(void) { - uint ea = EA_AY_IX_8(); - uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); + uint ea = EA_AY_IX_8(); + uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_re_aw(void) { - uint ea = EA_AW_8(); - uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); + uint ea = EA_AW_8(); + uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_8_re_al(void) { - uint ea = EA_AL_8(); - uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); + uint ea = EA_AL_8(); + uint res = MASK_OUT_ABOVE_8(DX | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_re_ai(void) { - uint ea = EA_AY_AI_16(); - uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); + uint ea = EA_AY_AI_16(); + uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_re_pi(void) { - uint ea = EA_AY_PI_16(); - uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); + uint ea = EA_AY_PI_16(); + uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_re_pd(void) { - uint ea = EA_AY_PD_16(); - uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); + uint ea = EA_AY_PD_16(); + uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_re_di(void) { - uint ea = EA_AY_DI_16(); - uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); + uint ea = EA_AY_DI_16(); + uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_re_ix(void) { - uint ea = EA_AY_IX_16(); - uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); + uint ea = EA_AY_IX_16(); + uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_re_aw(void) { - uint ea = EA_AW_16(); - uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); + uint ea = EA_AW_16(); + uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_16_re_al(void) { - uint ea = EA_AL_16(); - uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); + uint ea = EA_AL_16(); + uint res = MASK_OUT_ABOVE_16(DX | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_re_ai(void) { - uint ea = EA_AY_AI_32(); - uint res = DX | m68ki_read_32(ea); + uint ea = EA_AY_AI_32(); + uint res = DX | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_re_pi(void) { - uint ea = EA_AY_PI_32(); - uint res = DX | m68ki_read_32(ea); + uint ea = EA_AY_PI_32(); + uint res = DX | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_re_pd(void) { - uint ea = EA_AY_PD_32(); - uint res = DX | m68ki_read_32(ea); + uint ea = EA_AY_PD_32(); + uint res = DX | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_re_di(void) { - uint ea = EA_AY_DI_32(); - uint res = DX | m68ki_read_32(ea); + uint ea = EA_AY_DI_32(); + uint res = DX | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_re_ix(void) { - uint ea = EA_AY_IX_32(); - uint res = DX | m68ki_read_32(ea); + uint ea = EA_AY_IX_32(); + uint res = DX | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_re_aw(void) { - uint ea = EA_AW_32(); - uint res = DX | m68ki_read_32(ea); + uint ea = EA_AW_32(); + uint res = DX | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_or_32_re_al(void) { - uint ea = EA_AL_32(); - uint res = DX | m68ki_read_32(ea); + uint ea = EA_AL_32(); + uint res = DX | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_d(void) { - uint res = MASK_OUT_ABOVE_8((DY |= OPER_I_8())); + uint res = MASK_OUT_ABOVE_8((DY |= OPER_I_8())); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_ai(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_AI_8(); - uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); + uint src = OPER_I_8(); + uint ea = EA_AY_AI_8(); + uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_pi(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PI_8(); - uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); + uint src = OPER_I_8(); + uint ea = EA_AY_PI_8(); + uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_pi7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PI_8(); - uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); + uint src = OPER_I_8(); + uint ea = EA_A7_PI_8(); + uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_pd(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PD_8(); - uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); + uint src = OPER_I_8(); + uint ea = EA_AY_PD_8(); + uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_pd7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PD_8(); - uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); + uint src = OPER_I_8(); + uint ea = EA_A7_PD_8(); + uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_di(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_DI_8(); - uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); + uint src = OPER_I_8(); + uint ea = EA_AY_DI_8(); + uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_ix(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_IX_8(); - uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); + uint src = OPER_I_8(); + uint ea = EA_AY_IX_8(); + uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_aw(void) { - uint src = OPER_I_8(); - uint ea = EA_AW_8(); - uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); + uint src = OPER_I_8(); + uint ea = EA_AW_8(); + uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_8_al(void) { - uint src = OPER_I_8(); - uint ea = EA_AL_8(); - uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); + uint src = OPER_I_8(); + uint ea = EA_AL_8(); + uint res = MASK_OUT_ABOVE_8(src | m68ki_read_8(ea)); - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_16_d(void) { - uint res = MASK_OUT_ABOVE_16(DY |= OPER_I_16()); + uint res = MASK_OUT_ABOVE_16(DY |= OPER_I_16()); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_16_ai(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_AI_16(); - uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); + uint src = OPER_I_16(); + uint ea = EA_AY_AI_16(); + uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_16_pi(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PI_16(); - uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); + uint src = OPER_I_16(); + uint ea = EA_AY_PI_16(); + uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_16_pd(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PD_16(); - uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); + uint src = OPER_I_16(); + uint ea = EA_AY_PD_16(); + uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_16_di(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_DI_16(); - uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); + uint src = OPER_I_16(); + uint ea = EA_AY_DI_16(); + uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_16_ix(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_IX_16(); - uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); + uint src = OPER_I_16(); + uint ea = EA_AY_IX_16(); + uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_16_aw(void) { - uint src = OPER_I_16(); - uint ea = EA_AW_16(); - uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); + uint src = OPER_I_16(); + uint ea = EA_AW_16(); + uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_16_al(void) { - uint src = OPER_I_16(); - uint ea = EA_AL_16(); - uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); + uint src = OPER_I_16(); + uint ea = EA_AL_16(); + uint res = MASK_OUT_ABOVE_16(src | m68ki_read_16(ea)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_32_d(void) { - uint res = DY |= OPER_I_32(); + uint res = DY |= OPER_I_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_32_ai(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_AI_32(); - uint res = src | m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_AI_32(); + uint res = src | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_32_pi(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PI_32(); - uint res = src | m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_PI_32(); + uint res = src | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_32_pd(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PD_32(); - uint res = src | m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_PD_32(); + uint res = src | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_32_di(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_DI_32(); - uint res = src | m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_DI_32(); + uint res = src | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_32_ix(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_IX_32(); - uint res = src | m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AY_IX_32(); + uint res = src | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_32_aw(void) { - uint src = OPER_I_32(); - uint ea = EA_AW_32(); - uint res = src | m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AW_32(); + uint res = src | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_32_al(void) { - uint src = OPER_I_32(); - uint ea = EA_AL_32(); - uint res = src | m68ki_read_32(ea); + uint src = OPER_I_32(); + uint ea = EA_AL_32(); + uint res = src | m68ki_read_32(ea); - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ori_16_toc(void) { - m68ki_set_ccr(m68ki_get_ccr() | OPER_I_16()); + m68ki_set_ccr(m68ki_get_ccr() | OPER_I_16()); } static void m68k_op_ori_16_tos(void) { - if(FLAG_S) - { - uint src = OPER_I_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_sr(m68ki_get_sr() | src); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint src = OPER_I_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_sr(m68ki_get_sr() | src); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_pack_16_rr(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* Note: DX and DY are reversed in Motorola's docs */ - uint src = DY + OPER_I_16(); - uint* r_dst = &DX; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* Note: DX and DY are reversed in Motorola's docs */ + uint src = DY + OPER_I_16(); + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | ((src >> 4) & 0x00f0) | (src & 0x000f); - return; - } - m68ki_exception_illegal(); + *r_dst = MASK_OUT_BELOW_8(*r_dst) | ((src >> 4) & 0x00f0) | (src & 0x000f); + return; + } + m68ki_exception_illegal(); } static void m68k_op_pack_16_mm_ax7(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - uint ea_src = EA_AY_PD_8(); - uint src = m68ki_read_8(ea_src); - ea_src = EA_AY_PD_8(); - src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* Note: AX and AY are reversed in Motorola's docs */ + uint ea_src = EA_AY_PD_8(); + uint src = m68ki_read_8(ea_src); + ea_src = EA_AY_PD_8(); + src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16(); - m68ki_write_8(EA_A7_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f)); - return; - } - m68ki_exception_illegal(); + m68ki_write_8(EA_A7_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f)); + return; + } + m68ki_exception_illegal(); } static void m68k_op_pack_16_mm_ay7(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - uint ea_src = EA_A7_PD_8(); - uint src = m68ki_read_8(ea_src); - ea_src = EA_A7_PD_8(); - src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* Note: AX and AY are reversed in Motorola's docs */ + uint ea_src = EA_A7_PD_8(); + uint src = m68ki_read_8(ea_src); + ea_src = EA_A7_PD_8(); + src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16(); - m68ki_write_8(EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f)); - return; - } - m68ki_exception_illegal(); + m68ki_write_8(EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f)); + return; + } + m68ki_exception_illegal(); } static void m68k_op_pack_16_mm_axy7(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint ea_src = EA_A7_PD_8(); - uint src = m68ki_read_8(ea_src); - ea_src = EA_A7_PD_8(); - src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint ea_src = EA_A7_PD_8(); + uint src = m68ki_read_8(ea_src); + ea_src = EA_A7_PD_8(); + src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16(); - m68ki_write_8(EA_A7_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f)); - return; - } - m68ki_exception_illegal(); + m68ki_write_8(EA_A7_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f)); + return; + } + m68ki_exception_illegal(); } static void m68k_op_pack_16_mm(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - uint ea_src = EA_AY_PD_8(); - uint src = m68ki_read_8(ea_src); - ea_src = EA_AY_PD_8(); - src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* Note: AX and AY are reversed in Motorola's docs */ + uint ea_src = EA_AY_PD_8(); + uint src = m68ki_read_8(ea_src); + ea_src = EA_AY_PD_8(); + src = ((src << 8) | m68ki_read_8(ea_src)) + OPER_I_16(); - m68ki_write_8(EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f)); - return; - } - m68ki_exception_illegal(); + m68ki_write_8(EA_AX_PD_8(), ((src >> 4) & 0x00f0) | (src & 0x000f)); + return; + } + m68ki_exception_illegal(); } static void m68k_op_pea_32_ai(void) { - uint ea = EA_AY_AI_32(); + uint ea = EA_AY_AI_32(); - m68ki_push_32(ea); + m68ki_push_32(ea); } static void m68k_op_pea_32_di(void) { - uint ea = EA_AY_DI_32(); + uint ea = EA_AY_DI_32(); - m68ki_push_32(ea); + m68ki_push_32(ea); } static void m68k_op_pea_32_ix(void) { - uint ea = EA_AY_IX_32(); + uint ea = EA_AY_IX_32(); - m68ki_push_32(ea); + m68ki_push_32(ea); } static void m68k_op_pea_32_aw(void) { - uint ea = EA_AW_32(); + uint ea = EA_AW_32(); - m68ki_push_32(ea); + m68ki_push_32(ea); } static void m68k_op_pea_32_al(void) { - uint ea = EA_AL_32(); + uint ea = EA_AL_32(); - m68ki_push_32(ea); + m68ki_push_32(ea); } static void m68k_op_pea_32_pcdi(void) { - uint ea = EA_PCDI_32(); + uint ea = EA_PCDI_32(); - m68ki_push_32(ea); + m68ki_push_32(ea); } static void m68k_op_pea_32_pcix(void) { - uint ea = EA_PCIX_32(); + uint ea = EA_PCIX_32(); - m68ki_push_32(ea); + m68ki_push_32(ea); } static void m68k_op_pflush_32(void) { - if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) - { - // Nothing to do, unless address translation cache is emulated - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_040_PLUS(CPU_TYPE)) + { + // Nothing to do, unless address translation cache is emulated + return; + } + m68ki_exception_illegal(); } static void m68k_op_reset(void) { - if(FLAG_S) - { - m68ki_output_reset(); /* auto-disable (see m68kcpu.h) */ - USE_CYCLES(CYC_RESET); - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + m68ki_output_reset(); /* auto-disable (see m68kcpu.h) */ + USE_CYCLES(CYC_RESET); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_ror_8_s(void) { - uint* r_dst = &DY; - uint orig_shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint shift = orig_shift & 7; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = ROR_8(src, shift); + uint* r_dst = &DY; + uint orig_shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint shift = orig_shift & 7; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = ROR_8(src, shift); - if(orig_shift != 0) - USE_CYCLES(orig_shift<> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_16(*r_dst); - uint res = ROR_16(src, shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = ROR_16(src, shift); - if(shift != 0) - USE_CYCLES(shift<> 9) - 1) & 7) + 1; - uint64 src = *r_dst; - uint res = ROR_32(src, shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint64 src = *r_dst; + uint res = ROR_32(src, shift); - if(shift != 0) - USE_CYCLES(shift<> ((shift - 1) & 15)) << 8; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + FLAG_C = (src >> ((shift - 1) & 15)) << 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_16(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ror_32_r(void) { - uint* r_dst = &DY; - uint orig_shift = DX & 0x3f; - uint shift = orig_shift & 31; - uint64 src = *r_dst; - uint res = ROR_32(src, shift); + uint* r_dst = &DY; + uint orig_shift = DX & 0x3f; + uint shift = orig_shift & 31; + uint64 src = *r_dst; + uint res = ROR_32(src, shift); - if(orig_shift != 0) - { - USE_CYCLES(orig_shift<> ((shift - 1) & 31)) << 8; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst = res; + FLAG_C = (src >> ((shift - 1) & 31)) << 8; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_32(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ror_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_16(src, 1); + uint ea = EA_AY_AI_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_16(src, 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ror_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_16(src, 1); + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_16(src, 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ror_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_16(src, 1); + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_16(src, 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ror_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_16(src, 1); + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_16(src, 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ror_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_16(src, 1); + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_16(src, 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ror_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_16(src, 1); + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_16(src, 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_ror_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_16(src, 1); + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_16(src, 1); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src << 8; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src << 8; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_8_s(void) { - uint* r_dst = &DY; - uint orig_shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint shift = orig_shift & 7; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = ROL_8(src, shift); + uint* r_dst = &DY; + uint orig_shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint shift = orig_shift & 7; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = ROL_8(src, shift); - if(orig_shift != 0) - USE_CYCLES(orig_shift<> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_16(*r_dst); - uint res = ROL_16(src, shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = ROL_16(src, shift); - if(shift != 0) - USE_CYCLES(shift<> (8-shift); - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src >> (8-shift); + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_32_s(void) { - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint64 src = *r_dst; - uint res = ROL_32(src, shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint64 src = *r_dst; + uint res = ROL_32(src, shift); - if(shift != 0) - USE_CYCLES(shift<> (24-shift); - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_C = src >> (24-shift); + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_8_r(void) { - uint* r_dst = &DY; - uint orig_shift = DX & 0x3f; - uint shift = orig_shift & 7; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = ROL_8(src, shift); + uint* r_dst = &DY; + uint orig_shift = DX & 0x3f; + uint shift = orig_shift & 7; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = ROL_8(src, shift); - if(orig_shift != 0) - { - USE_CYCLES(orig_shift<> 8; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } - FLAG_C = (src & 1)<<8; - FLAG_N = NFLAG_16(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; - return; - } + if(shift != 0) + { + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + FLAG_C = (src << shift) >> 8; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } + FLAG_C = (src & 1)<<8; + FLAG_N = NFLAG_16(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_16(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_32_r(void) { - uint* r_dst = &DY; - uint orig_shift = DX & 0x3f; - uint shift = orig_shift & 31; - uint64 src = *r_dst; - uint res = ROL_32(src, shift); + uint* r_dst = &DY; + uint orig_shift = DX & 0x3f; + uint shift = orig_shift & 31; + uint64 src = *r_dst; + uint res = ROL_32(src, shift); - if(orig_shift != 0) - { - USE_CYCLES(orig_shift<> ((32 - shift) & 0x1f)) << 8; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + FLAG_C = (src >> ((32 - shift) & 0x1f)) << 8; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = CFLAG_CLEAR; - FLAG_N = NFLAG_32(src); - FLAG_Z = src; - FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(src); + FLAG_Z = src; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_16_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); + uint ea = EA_AY_AI_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rol_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = MASK_OUT_ABOVE_16(ROL_16(src, 1)); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_C = src >> 7; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_C = src >> 7; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxr_8_s(void) { - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = ROR_9(src | (XFLAG_AS_1() << 8), shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = ROR_9(src | (XFLAG_AS_1() << 8), shift); - if(shift != 0) - USE_CYCLES(shift<> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_16(*r_dst); - uint res = ROR_17(src | (XFLAG_AS_1() << 16), shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = ROR_17(src | (XFLAG_AS_1() << 16), shift); - if(shift != 0) - USE_CYCLES(shift<> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } @@ -28960,42 +28960,42 @@ static void m68k_op_roxr_32_s(void) { #if M68K_USE_64_BIT - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint64 src = *r_dst; - uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint64 src = *r_dst; + uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); - if(shift != 0) - USE_CYCLES(shift<> 24; - res = MASK_OUT_ABOVE_32(res); + FLAG_C = FLAG_X = res >> 24; + res = MASK_OUT_ABOVE_32(res); - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; #else - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = *r_dst; - uint res = MASK_OUT_ABOVE_32((ROR_33(src, shift) & ~(1 << (32 - shift))) | (XFLAG_AS_1() << (32 - shift))); - uint new_x_flag = src & (1 << (shift - 1)); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = *r_dst; + uint res = MASK_OUT_ABOVE_32((ROR_33(src, shift) & ~(1 << (32 - shift))) | (XFLAG_AS_1() << (32 - shift))); + uint new_x_flag = src & (1 << (shift - 1)); - if(shift != 0) - USE_CYCLES(shift<> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = FLAG_X; - FLAG_N = NFLAG_16(*r_dst); - FLAG_Z = MASK_OUT_ABOVE_16(*r_dst); - FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X; + FLAG_N = NFLAG_16(*r_dst); + FLAG_Z = MASK_OUT_ABOVE_16(*r_dst); + FLAG_V = VFLAG_CLEAR; } @@ -29065,57 +29065,57 @@ static void m68k_op_roxr_32_r(void) { #if M68K_USE_64_BIT - uint* r_dst = &DY; - uint orig_shift = DX & 0x3f; + uint* r_dst = &DY; + uint orig_shift = DX & 0x3f; - if(orig_shift != 0) - { - uint shift = orig_shift % 33; - uint64 src = *r_dst; - uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); + if(orig_shift != 0) + { + uint shift = orig_shift % 33; + uint64 src = *r_dst; + uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); - res = ROR_33_64(res, shift); + res = ROR_33_64(res, shift); - USE_CYCLES(orig_shift<> 24; - res = MASK_OUT_ABOVE_32(res); + FLAG_C = FLAG_X = res >> 24; + res = MASK_OUT_ABOVE_32(res); - *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst = res; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = FLAG_X; - FLAG_N = NFLAG_32(*r_dst); - FLAG_Z = *r_dst; - FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X; + FLAG_N = NFLAG_32(*r_dst); + FLAG_Z = *r_dst; + FLAG_V = VFLAG_CLEAR; #else - uint* r_dst = &DY; - uint orig_shift = DX & 0x3f; - uint shift = orig_shift % 33; - uint src = *r_dst; - uint res = MASK_OUT_ABOVE_32((ROR_33(src, shift) & ~(1 << (32 - shift))) | (XFLAG_AS_1() << (32 - shift))); - uint new_x_flag = src & (1 << (shift - 1)); + uint* r_dst = &DY; + uint orig_shift = DX & 0x3f; + uint shift = orig_shift % 33; + uint src = *r_dst; + uint res = MASK_OUT_ABOVE_32((ROR_33(src, shift) & ~(1 << (32 - shift))) | (XFLAG_AS_1() << (32 - shift))); + uint new_x_flag = src & (1 << (shift - 1)); - if(orig_shift != 0) - USE_CYCLES(orig_shift<> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxr_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxr_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxr_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxr_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxr_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxr_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = ROR_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxl_8_s(void) { - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_8(*r_dst); - uint res = ROL_9(src | (XFLAG_AS_1() << 8), shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_8(*r_dst); + uint res = ROL_9(src | (XFLAG_AS_1() << 8), shift); - if(shift != 0) - USE_CYCLES(shift<> 9) - 1) & 7) + 1; - uint src = MASK_OUT_ABOVE_16(*r_dst); - uint res = ROL_17(src | (XFLAG_AS_1() << 16), shift); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = MASK_OUT_ABOVE_16(*r_dst); + uint res = ROL_17(src | (XFLAG_AS_1() << 16), shift); - if(shift != 0) - USE_CYCLES(shift<> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } @@ -29286,42 +29286,42 @@ static void m68k_op_roxl_32_s(void) { #if M68K_USE_64_BIT - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint64 src = *r_dst; - uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint64 src = *r_dst; + uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); - if(shift != 0) - USE_CYCLES(shift<> 24; - res = MASK_OUT_ABOVE_32(res); + FLAG_C = FLAG_X = res >> 24; + res = MASK_OUT_ABOVE_32(res); - *r_dst = res; + *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; #else - uint* r_dst = &DY; - uint shift = (((REG_IR >> 9) - 1) & 7) + 1; - uint src = *r_dst; - uint res = MASK_OUT_ABOVE_32((ROL_33(src, shift) & ~(1 << (shift - 1))) | (XFLAG_AS_1() << (shift - 1))); - uint new_x_flag = src & (1 << (32 - shift)); + uint* r_dst = &DY; + uint shift = (((REG_IR >> 9) - 1) & 7) + 1; + uint src = *r_dst; + uint res = MASK_OUT_ABOVE_32((ROL_33(src, shift) & ~(1 << (shift - 1))) | (XFLAG_AS_1() << (shift - 1))); + uint new_x_flag = src & (1 << (32 - shift)); - if(shift != 0) - USE_CYCLES(shift<> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = FLAG_X; - FLAG_N = NFLAG_16(*r_dst); - FLAG_Z = MASK_OUT_ABOVE_16(*r_dst); - FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X; + FLAG_N = NFLAG_16(*r_dst); + FLAG_Z = MASK_OUT_ABOVE_16(*r_dst); + FLAG_V = VFLAG_CLEAR; } @@ -29392,57 +29392,57 @@ static void m68k_op_roxl_32_r(void) { #if M68K_USE_64_BIT - uint* r_dst = &DY; - uint orig_shift = DX & 0x3f; + uint* r_dst = &DY; + uint orig_shift = DX & 0x3f; - if(orig_shift != 0) - { - uint shift = orig_shift % 33; - uint64 src = *r_dst; - uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); + if(orig_shift != 0) + { + uint shift = orig_shift % 33; + uint64 src = *r_dst; + uint64 res = src | (((uint64)XFLAG_AS_1()) << 32); - res = ROL_33_64(res, shift); + res = ROL_33_64(res, shift); - USE_CYCLES(orig_shift<> 24; - res = MASK_OUT_ABOVE_32(res); + FLAG_C = FLAG_X = res >> 24; + res = MASK_OUT_ABOVE_32(res); - *r_dst = res; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - return; - } + *r_dst = res; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + return; + } - FLAG_C = FLAG_X; - FLAG_N = NFLAG_32(*r_dst); - FLAG_Z = *r_dst; - FLAG_V = VFLAG_CLEAR; + FLAG_C = FLAG_X; + FLAG_N = NFLAG_32(*r_dst); + FLAG_Z = *r_dst; + FLAG_V = VFLAG_CLEAR; #else - uint* r_dst = &DY; - uint orig_shift = DX & 0x3f; - uint shift = orig_shift % 33; - uint src = *r_dst; - uint res = MASK_OUT_ABOVE_32((ROL_33(src, shift) & ~(1 << (shift - 1))) | (XFLAG_AS_1() << (shift - 1))); - uint new_x_flag = src & (1 << (32 - shift)); + uint* r_dst = &DY; + uint orig_shift = DX & 0x3f; + uint shift = orig_shift % 33; + uint src = *r_dst; + uint res = MASK_OUT_ABOVE_32((ROL_33(src, shift) & ~(1 << (shift - 1))) | (XFLAG_AS_1() << (shift - 1))); + uint new_x_flag = src & (1 << (32 - shift)); - if(orig_shift != 0) - USE_CYCLES(orig_shift<> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxl_16_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = m68ki_read_16(ea); - uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AY_PI_16(); + uint src = m68ki_read_16(ea); + uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxl_16_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = m68ki_read_16(ea); - uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AY_PD_16(); + uint src = m68ki_read_16(ea); + uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxl_16_di(void) { - uint ea = EA_AY_DI_16(); - uint src = m68ki_read_16(ea); - uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AY_DI_16(); + uint src = m68ki_read_16(ea); + uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxl_16_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = m68ki_read_16(ea); - uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AY_IX_16(); + uint src = m68ki_read_16(ea); + uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxl_16_aw(void) { - uint ea = EA_AW_16(); - uint src = m68ki_read_16(ea); - uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AW_16(); + uint src = m68ki_read_16(ea); + uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_roxl_16_al(void) { - uint ea = EA_AL_16(); - uint src = m68ki_read_16(ea); - uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); + uint ea = EA_AL_16(); + uint src = m68ki_read_16(ea); + uint res = ROL_17(src | (XFLAG_AS_1() << 16), 1); - FLAG_C = FLAG_X = res >> 8; - res = MASK_OUT_ABOVE_16(res); + FLAG_C = FLAG_X = res >> 8; + res = MASK_OUT_ABOVE_16(res); - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_rtd_32(void) { - if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) - { - uint new_pc = m68ki_pull_32(); + if(CPU_TYPE_IS_010_PLUS(CPU_TYPE)) + { + uint new_pc = m68ki_pull_32(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + MAKE_INT_16(OPER_I_16())); - m68ki_jump(new_pc); - return; - } - m68ki_exception_illegal(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + REG_A[7] = MASK_OUT_ABOVE_32(REG_A[7] + MAKE_INT_16(OPER_I_16())); + m68ki_jump(new_pc); + return; + } + m68ki_exception_illegal(); } static void m68k_op_rte_32(void) { - if(FLAG_S) - { - uint new_sr; - uint new_pc; - uint format_word; + if(FLAG_S) + { + uint new_sr; + uint new_pc; + uint format_word; - m68ki_rte_callback(); /* auto-disable (see m68kcpu.h) */ - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_rte_callback(); /* auto-disable (see m68kcpu.h) */ + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - if(CPU_TYPE_IS_000(CPU_TYPE)) - { - new_sr = m68ki_pull_16(); - new_pc = m68ki_pull_32(); - m68ki_jump(new_pc); - m68ki_set_sr(new_sr); + if(CPU_TYPE_IS_000(CPU_TYPE)) + { + new_sr = m68ki_pull_16(); + new_pc = m68ki_pull_32(); + m68ki_jump(new_pc); + m68ki_set_sr(new_sr); - CPU_INSTR_MODE = INSTRUCTION_YES; - CPU_RUN_MODE = RUN_MODE_NORMAL; + CPU_INSTR_MODE = INSTRUCTION_YES; + CPU_RUN_MODE = RUN_MODE_NORMAL; - return; - } + return; + } - if(CPU_TYPE_IS_010(CPU_TYPE)) - { - format_word = m68ki_read_16(REG_A[7]+6) >> 12; - if(format_word == 0) - { - new_sr = m68ki_pull_16(); - new_pc = m68ki_pull_32(); - m68ki_fake_pull_16(); /* format word */ - m68ki_jump(new_pc); - m68ki_set_sr(new_sr); - CPU_INSTR_MODE = INSTRUCTION_YES; - CPU_RUN_MODE = RUN_MODE_NORMAL; - return; - } - CPU_INSTR_MODE = INSTRUCTION_YES; - CPU_RUN_MODE = RUN_MODE_NORMAL; - /* Not handling bus fault (9) */ - m68ki_exception_format_error(); - return; - } + if(CPU_TYPE_IS_010(CPU_TYPE)) + { + format_word = m68ki_read_16(REG_A[7]+6) >> 12; + if(format_word == 0) + { + new_sr = m68ki_pull_16(); + new_pc = m68ki_pull_32(); + m68ki_fake_pull_16(); /* format word */ + m68ki_jump(new_pc); + m68ki_set_sr(new_sr); + CPU_INSTR_MODE = INSTRUCTION_YES; + CPU_RUN_MODE = RUN_MODE_NORMAL; + return; + } + CPU_INSTR_MODE = INSTRUCTION_YES; + CPU_RUN_MODE = RUN_MODE_NORMAL; + /* Not handling bus fault (9) */ + m68ki_exception_format_error(); + return; + } - /* Otherwise it's 020 */ + /* Otherwise it's 020 */ rte_loop: - format_word = m68ki_read_16(REG_A[7]+6) >> 12; - switch(format_word) - { - case 0: /* Normal */ - new_sr = m68ki_pull_16(); - new_pc = m68ki_pull_32(); - m68ki_fake_pull_16(); /* format word */ - m68ki_jump(new_pc); - m68ki_set_sr(new_sr); - CPU_INSTR_MODE = INSTRUCTION_YES; - CPU_RUN_MODE = RUN_MODE_NORMAL; - return; - case 1: /* Throwaway */ - new_sr = m68ki_pull_16(); - m68ki_fake_pull_32(); /* program counter */ - m68ki_fake_pull_16(); /* format word */ - m68ki_set_sr_noint(new_sr); - goto rte_loop; - case 2: /* Trap */ - new_sr = m68ki_pull_16(); - new_pc = m68ki_pull_32(); - m68ki_fake_pull_16(); /* format word */ - m68ki_fake_pull_32(); /* address */ - m68ki_jump(new_pc); - m68ki_set_sr(new_sr); - CPU_INSTR_MODE = INSTRUCTION_YES; - CPU_RUN_MODE = RUN_MODE_NORMAL; - return; - } - /* Not handling long or short bus fault */ - CPU_INSTR_MODE = INSTRUCTION_YES; - CPU_RUN_MODE = RUN_MODE_NORMAL; - m68ki_exception_format_error(); - return; - } - m68ki_exception_privilege_violation(); + format_word = m68ki_read_16(REG_A[7]+6) >> 12; + switch(format_word) + { + case 0: /* Normal */ + new_sr = m68ki_pull_16(); + new_pc = m68ki_pull_32(); + m68ki_fake_pull_16(); /* format word */ + m68ki_jump(new_pc); + m68ki_set_sr(new_sr); + CPU_INSTR_MODE = INSTRUCTION_YES; + CPU_RUN_MODE = RUN_MODE_NORMAL; + return; + case 1: /* Throwaway */ + new_sr = m68ki_pull_16(); + m68ki_fake_pull_32(); /* program counter */ + m68ki_fake_pull_16(); /* format word */ + m68ki_set_sr_noint(new_sr); + goto rte_loop; + case 2: /* Trap */ + new_sr = m68ki_pull_16(); + new_pc = m68ki_pull_32(); + m68ki_fake_pull_16(); /* format word */ + m68ki_fake_pull_32(); /* address */ + m68ki_jump(new_pc); + m68ki_set_sr(new_sr); + CPU_INSTR_MODE = INSTRUCTION_YES; + CPU_RUN_MODE = RUN_MODE_NORMAL; + return; + } + /* Not handling long or short bus fault */ + CPU_INSTR_MODE = INSTRUCTION_YES; + CPU_RUN_MODE = RUN_MODE_NORMAL; + m68ki_exception_format_error(); + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_rtm_32(void) { - if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) - { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", - m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, - m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_020_VARIANT(CPU_TYPE)) + { + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + M68K_DO_LOG((M68K_LOG_FILEHANDLE "%s at %08x: called unimplemented instruction %04x (%s)\n", + m68ki_cpu_names[CPU_TYPE], ADDRESS_68K(REG_PC - 2), REG_IR, + m68k_disassemble_quick(ADDRESS_68K(REG_PC - 2)))); + return; + } + m68ki_exception_illegal(); } static void m68k_op_rtr_32(void) { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_set_ccr(m68ki_pull_16()); - m68ki_jump(m68ki_pull_32()); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_set_ccr(m68ki_pull_16()); + m68ki_jump(m68ki_pull_32()); } static void m68k_op_rts_32(void) { - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - m68ki_jump(m68ki_pull_32()); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + m68ki_jump(m68ki_pull_32()); } static void m68k_op_sbcd_8_rr(void) { - uint* r_dst = &DX; - uint src = DY; - uint dst = *r_dst; - uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); + uint* r_dst = &DX; + uint src = DY; + uint dst = *r_dst; + uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); // FLAG_V = ~res; /* Undefined V behavior */ - FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to assume cleared. */ + FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to assume cleared. */ - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - FLAG_X = FLAG_C = CFLAG_SET; - FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - FLAG_N = FLAG_X = FLAG_C = 0; + if(res > 9) + res -= 6; + res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); + if(res > 0x99) + { + res += 0xa0; + FLAG_X = FLAG_C = CFLAG_SET; + FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ + } + else + FLAG_N = FLAG_X = FLAG_C = 0; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); // FLAG_V &= res; /* Undefined V behavior part II */ // FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - FLAG_Z |= res; + FLAG_Z |= res; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; } static void m68k_op_sbcd_8_mm_ax7(void) { - uint src = OPER_AY_PD_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); + uint src = OPER_AY_PD_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); // FLAG_V = ~res; /* Undefined V behavior */ - FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ + FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - FLAG_X = FLAG_C = CFLAG_SET; - FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - FLAG_N = FLAG_X = FLAG_C = 0; + if(res > 9) + res -= 6; + res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); + if(res > 0x99) + { + res += 0xa0; + FLAG_X = FLAG_C = CFLAG_SET; + FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ + } + else + FLAG_N = FLAG_X = FLAG_C = 0; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); // FLAG_V &= res; /* Undefined V behavior part II */ // FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - FLAG_Z |= res; + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_sbcd_8_mm_ay7(void) { - uint src = OPER_A7_PD_8(); - uint ea = EA_AX_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); + uint src = OPER_A7_PD_8(); + uint ea = EA_AX_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); // FLAG_V = ~res; /* Undefined V behavior */ - FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ + FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - FLAG_X = FLAG_C = CFLAG_SET; - FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - FLAG_N = FLAG_X = FLAG_C = 0; + if(res > 9) + res -= 6; + res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); + if(res > 0x99) + { + res += 0xa0; + FLAG_X = FLAG_C = CFLAG_SET; + FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ + } + else + FLAG_N = FLAG_X = FLAG_C = 0; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); // FLAG_V &= res; /* Undefined V behavior part II */ // FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - FLAG_Z |= res; + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_sbcd_8_mm_axy7(void) { - uint src = OPER_A7_PD_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); + uint src = OPER_A7_PD_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); // FLAG_V = ~res; /* Undefined V behavior */ - FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ + FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - FLAG_X = FLAG_C = CFLAG_SET; - FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - FLAG_N = FLAG_X = FLAG_C = 0; + if(res > 9) + res -= 6; + res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); + if(res > 0x99) + { + res += 0xa0; + FLAG_X = FLAG_C = CFLAG_SET; + FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ + } + else + FLAG_N = FLAG_X = FLAG_C = 0; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); // FLAG_V &= res; /* Undefined V behavior part II */ // FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - FLAG_Z |= res; + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_sbcd_8_mm(void) { - uint src = OPER_AY_PD_8(); - uint ea = EA_AX_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); + uint src = OPER_AY_PD_8(); + uint ea = EA_AX_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = LOW_NIBBLE(dst) - LOW_NIBBLE(src) - XFLAG_AS_1(); // FLAG_V = ~res; /* Undefined V behavior */ - FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ + FLAG_V = VFLAG_CLEAR; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to return zero. */ - if(res > 9) - res -= 6; - res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); - if(res > 0x99) - { - res += 0xa0; - FLAG_X = FLAG_C = CFLAG_SET; - FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ - } - else - FLAG_N = FLAG_X = FLAG_C = 0; + if(res > 9) + res -= 6; + res += HIGH_NIBBLE(dst) - HIGH_NIBBLE(src); + if(res > 0x99) + { + res += 0xa0; + FLAG_X = FLAG_C = CFLAG_SET; + FLAG_N = NFLAG_SET; /* Undefined in Motorola's M68000PM/AD rev.1 and safer to follow carry. */ + } + else + FLAG_N = FLAG_X = FLAG_C = 0; - res = MASK_OUT_ABOVE_8(res); + res = MASK_OUT_ABOVE_8(res); // FLAG_V &= res; /* Undefined V behavior part II */ // FLAG_N = NFLAG_8(res); /* Undefined N behavior */ - FLAG_Z |= res; + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_st_8_d(void) { - DY |= 0xff; + DY |= 0xff; } static void m68k_op_st_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), 0xff); + m68ki_write_8(EA_AY_AI_8(), 0xff); } static void m68k_op_st_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), 0xff); + m68ki_write_8(EA_AY_PI_8(), 0xff); } static void m68k_op_st_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), 0xff); + m68ki_write_8(EA_A7_PI_8(), 0xff); } static void m68k_op_st_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), 0xff); + m68ki_write_8(EA_AY_PD_8(), 0xff); } static void m68k_op_st_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), 0xff); + m68ki_write_8(EA_A7_PD_8(), 0xff); } static void m68k_op_st_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), 0xff); + m68ki_write_8(EA_AY_DI_8(), 0xff); } static void m68k_op_st_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), 0xff); + m68ki_write_8(EA_AY_IX_8(), 0xff); } static void m68k_op_st_8_aw(void) { - m68ki_write_8(EA_AW_8(), 0xff); + m68ki_write_8(EA_AW_8(), 0xff); } static void m68k_op_st_8_al(void) { - m68ki_write_8(EA_AL_8(), 0xff); + m68ki_write_8(EA_AL_8(), 0xff); } static void m68k_op_sf_8_d(void) { - DY &= 0xffffff00; + DY &= 0xffffff00; } static void m68k_op_sf_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), 0); + m68ki_write_8(EA_AY_AI_8(), 0); } static void m68k_op_sf_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), 0); + m68ki_write_8(EA_AY_PI_8(), 0); } static void m68k_op_sf_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), 0); + m68ki_write_8(EA_A7_PI_8(), 0); } static void m68k_op_sf_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), 0); + m68ki_write_8(EA_AY_PD_8(), 0); } static void m68k_op_sf_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), 0); + m68ki_write_8(EA_A7_PD_8(), 0); } static void m68k_op_sf_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), 0); + m68ki_write_8(EA_AY_DI_8(), 0); } static void m68k_op_sf_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), 0); + m68ki_write_8(EA_AY_IX_8(), 0); } static void m68k_op_sf_8_aw(void) { - m68ki_write_8(EA_AW_8(), 0); + m68ki_write_8(EA_AW_8(), 0); } static void m68k_op_sf_8_al(void) { - m68ki_write_8(EA_AL_8(), 0); + m68ki_write_8(EA_AL_8(), 0); } static void m68k_op_shi_8_d(void) { - if(COND_HI()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_HI()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_sls_8_d(void) { - if(COND_LS()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_LS()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_scc_8_d(void) { - if(COND_CC()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_CC()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_scs_8_d(void) { - if(COND_CS()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_CS()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_sne_8_d(void) { - if(COND_NE()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_NE()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_seq_8_d(void) { - if(COND_EQ()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_EQ()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_svc_8_d(void) { - if(COND_VC()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_VC()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_svs_8_d(void) { - if(COND_VS()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_VS()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_spl_8_d(void) { - if(COND_PL()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_PL()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_smi_8_d(void) { - if(COND_MI()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_MI()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_sge_8_d(void) { - if(COND_GE()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_GE()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_slt_8_d(void) { - if(COND_LT()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_LT()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_sgt_8_d(void) { - if(COND_GT()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_GT()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_sle_8_d(void) { - if(COND_LE()) - { - DY |= 0xff; - USE_CYCLES(CYC_SCC_R_TRUE); - return; - } - DY &= 0xffffff00; + if(COND_LE()) + { + DY |= 0xff; + USE_CYCLES(CYC_SCC_R_TRUE); + return; + } + DY &= 0xffffff00; } static void m68k_op_shi_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_HI() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_HI() ? 0xff : 0); } static void m68k_op_shi_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_HI() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_HI() ? 0xff : 0); } static void m68k_op_shi_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_HI() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_HI() ? 0xff : 0); } static void m68k_op_shi_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_HI() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_HI() ? 0xff : 0); } static void m68k_op_shi_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_HI() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_HI() ? 0xff : 0); } static void m68k_op_shi_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_HI() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_HI() ? 0xff : 0); } static void m68k_op_shi_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_HI() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_HI() ? 0xff : 0); } static void m68k_op_shi_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_HI() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_HI() ? 0xff : 0); } static void m68k_op_shi_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_HI() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_HI() ? 0xff : 0); } static void m68k_op_sls_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_LS() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_LS() ? 0xff : 0); } static void m68k_op_sls_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_LS() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_LS() ? 0xff : 0); } static void m68k_op_sls_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_LS() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_LS() ? 0xff : 0); } static void m68k_op_sls_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_LS() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_LS() ? 0xff : 0); } static void m68k_op_sls_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_LS() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_LS() ? 0xff : 0); } static void m68k_op_sls_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_LS() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_LS() ? 0xff : 0); } static void m68k_op_sls_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_LS() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_LS() ? 0xff : 0); } static void m68k_op_sls_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_LS() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_LS() ? 0xff : 0); } static void m68k_op_sls_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_LS() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_LS() ? 0xff : 0); } static void m68k_op_scc_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_CC() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_CC() ? 0xff : 0); } static void m68k_op_scc_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_CC() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_CC() ? 0xff : 0); } static void m68k_op_scc_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_CC() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_CC() ? 0xff : 0); } static void m68k_op_scc_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_CC() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_CC() ? 0xff : 0); } static void m68k_op_scc_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_CC() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_CC() ? 0xff : 0); } static void m68k_op_scc_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_CC() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_CC() ? 0xff : 0); } static void m68k_op_scc_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_CC() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_CC() ? 0xff : 0); } static void m68k_op_scc_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_CC() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_CC() ? 0xff : 0); } static void m68k_op_scc_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_CC() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_CC() ? 0xff : 0); } static void m68k_op_scs_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_CS() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_CS() ? 0xff : 0); } static void m68k_op_scs_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_CS() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_CS() ? 0xff : 0); } static void m68k_op_scs_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_CS() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_CS() ? 0xff : 0); } static void m68k_op_scs_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_CS() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_CS() ? 0xff : 0); } static void m68k_op_scs_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_CS() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_CS() ? 0xff : 0); } static void m68k_op_scs_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_CS() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_CS() ? 0xff : 0); } static void m68k_op_scs_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_CS() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_CS() ? 0xff : 0); } static void m68k_op_scs_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_CS() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_CS() ? 0xff : 0); } static void m68k_op_scs_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_CS() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_CS() ? 0xff : 0); } static void m68k_op_sne_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_NE() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_NE() ? 0xff : 0); } static void m68k_op_sne_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_NE() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_NE() ? 0xff : 0); } static void m68k_op_sne_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_NE() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_NE() ? 0xff : 0); } static void m68k_op_sne_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_NE() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_NE() ? 0xff : 0); } static void m68k_op_sne_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_NE() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_NE() ? 0xff : 0); } static void m68k_op_sne_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_NE() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_NE() ? 0xff : 0); } static void m68k_op_sne_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_NE() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_NE() ? 0xff : 0); } static void m68k_op_sne_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_NE() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_NE() ? 0xff : 0); } static void m68k_op_sne_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_NE() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_NE() ? 0xff : 0); } static void m68k_op_seq_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_EQ() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_EQ() ? 0xff : 0); } static void m68k_op_seq_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_EQ() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_EQ() ? 0xff : 0); } static void m68k_op_seq_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_EQ() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_EQ() ? 0xff : 0); } static void m68k_op_seq_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_EQ() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_EQ() ? 0xff : 0); } static void m68k_op_seq_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_EQ() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_EQ() ? 0xff : 0); } static void m68k_op_seq_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_EQ() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_EQ() ? 0xff : 0); } static void m68k_op_seq_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_EQ() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_EQ() ? 0xff : 0); } static void m68k_op_seq_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_EQ() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_EQ() ? 0xff : 0); } static void m68k_op_seq_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_EQ() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_EQ() ? 0xff : 0); } static void m68k_op_svc_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_VC() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_VC() ? 0xff : 0); } static void m68k_op_svc_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_VC() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_VC() ? 0xff : 0); } static void m68k_op_svc_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_VC() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_VC() ? 0xff : 0); } static void m68k_op_svc_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_VC() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_VC() ? 0xff : 0); } static void m68k_op_svc_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_VC() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_VC() ? 0xff : 0); } static void m68k_op_svc_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_VC() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_VC() ? 0xff : 0); } static void m68k_op_svc_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_VC() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_VC() ? 0xff : 0); } static void m68k_op_svc_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_VC() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_VC() ? 0xff : 0); } static void m68k_op_svc_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_VC() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_VC() ? 0xff : 0); } static void m68k_op_svs_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_VS() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_VS() ? 0xff : 0); } static void m68k_op_svs_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_VS() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_VS() ? 0xff : 0); } static void m68k_op_svs_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_VS() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_VS() ? 0xff : 0); } static void m68k_op_svs_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_VS() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_VS() ? 0xff : 0); } static void m68k_op_svs_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_VS() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_VS() ? 0xff : 0); } static void m68k_op_svs_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_VS() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_VS() ? 0xff : 0); } static void m68k_op_svs_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_VS() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_VS() ? 0xff : 0); } static void m68k_op_svs_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_VS() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_VS() ? 0xff : 0); } static void m68k_op_svs_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_VS() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_VS() ? 0xff : 0); } static void m68k_op_spl_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_PL() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_PL() ? 0xff : 0); } static void m68k_op_spl_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_PL() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_PL() ? 0xff : 0); } static void m68k_op_spl_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_PL() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_PL() ? 0xff : 0); } static void m68k_op_spl_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_PL() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_PL() ? 0xff : 0); } static void m68k_op_spl_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_PL() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_PL() ? 0xff : 0); } static void m68k_op_spl_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_PL() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_PL() ? 0xff : 0); } static void m68k_op_spl_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_PL() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_PL() ? 0xff : 0); } static void m68k_op_spl_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_PL() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_PL() ? 0xff : 0); } static void m68k_op_spl_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_PL() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_PL() ? 0xff : 0); } static void m68k_op_smi_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_MI() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_MI() ? 0xff : 0); } static void m68k_op_smi_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_MI() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_MI() ? 0xff : 0); } static void m68k_op_smi_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_MI() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_MI() ? 0xff : 0); } static void m68k_op_smi_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_MI() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_MI() ? 0xff : 0); } static void m68k_op_smi_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_MI() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_MI() ? 0xff : 0); } static void m68k_op_smi_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_MI() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_MI() ? 0xff : 0); } static void m68k_op_smi_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_MI() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_MI() ? 0xff : 0); } static void m68k_op_smi_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_MI() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_MI() ? 0xff : 0); } static void m68k_op_smi_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_MI() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_MI() ? 0xff : 0); } static void m68k_op_sge_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_GE() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_GE() ? 0xff : 0); } static void m68k_op_sge_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_GE() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_GE() ? 0xff : 0); } static void m68k_op_sge_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_GE() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_GE() ? 0xff : 0); } static void m68k_op_sge_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_GE() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_GE() ? 0xff : 0); } static void m68k_op_sge_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_GE() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_GE() ? 0xff : 0); } static void m68k_op_sge_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_GE() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_GE() ? 0xff : 0); } static void m68k_op_sge_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_GE() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_GE() ? 0xff : 0); } static void m68k_op_sge_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_GE() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_GE() ? 0xff : 0); } static void m68k_op_sge_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_GE() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_GE() ? 0xff : 0); } static void m68k_op_slt_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_LT() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_LT() ? 0xff : 0); } static void m68k_op_slt_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_LT() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_LT() ? 0xff : 0); } static void m68k_op_slt_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_LT() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_LT() ? 0xff : 0); } static void m68k_op_slt_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_LT() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_LT() ? 0xff : 0); } static void m68k_op_slt_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_LT() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_LT() ? 0xff : 0); } static void m68k_op_slt_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_LT() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_LT() ? 0xff : 0); } static void m68k_op_slt_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_LT() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_LT() ? 0xff : 0); } static void m68k_op_slt_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_LT() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_LT() ? 0xff : 0); } static void m68k_op_slt_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_LT() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_LT() ? 0xff : 0); } static void m68k_op_sgt_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_GT() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_GT() ? 0xff : 0); } static void m68k_op_sgt_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_GT() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_GT() ? 0xff : 0); } static void m68k_op_sgt_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_GT() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_GT() ? 0xff : 0); } static void m68k_op_sgt_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_GT() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_GT() ? 0xff : 0); } static void m68k_op_sgt_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_GT() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_GT() ? 0xff : 0); } static void m68k_op_sgt_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_GT() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_GT() ? 0xff : 0); } static void m68k_op_sgt_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_GT() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_GT() ? 0xff : 0); } static void m68k_op_sgt_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_GT() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_GT() ? 0xff : 0); } static void m68k_op_sgt_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_GT() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_GT() ? 0xff : 0); } static void m68k_op_sle_8_ai(void) { - m68ki_write_8(EA_AY_AI_8(), COND_LE() ? 0xff : 0); + m68ki_write_8(EA_AY_AI_8(), COND_LE() ? 0xff : 0); } static void m68k_op_sle_8_pi(void) { - m68ki_write_8(EA_AY_PI_8(), COND_LE() ? 0xff : 0); + m68ki_write_8(EA_AY_PI_8(), COND_LE() ? 0xff : 0); } static void m68k_op_sle_8_pi7(void) { - m68ki_write_8(EA_A7_PI_8(), COND_LE() ? 0xff : 0); + m68ki_write_8(EA_A7_PI_8(), COND_LE() ? 0xff : 0); } static void m68k_op_sle_8_pd(void) { - m68ki_write_8(EA_AY_PD_8(), COND_LE() ? 0xff : 0); + m68ki_write_8(EA_AY_PD_8(), COND_LE() ? 0xff : 0); } static void m68k_op_sle_8_pd7(void) { - m68ki_write_8(EA_A7_PD_8(), COND_LE() ? 0xff : 0); + m68ki_write_8(EA_A7_PD_8(), COND_LE() ? 0xff : 0); } static void m68k_op_sle_8_di(void) { - m68ki_write_8(EA_AY_DI_8(), COND_LE() ? 0xff : 0); + m68ki_write_8(EA_AY_DI_8(), COND_LE() ? 0xff : 0); } static void m68k_op_sle_8_ix(void) { - m68ki_write_8(EA_AY_IX_8(), COND_LE() ? 0xff : 0); + m68ki_write_8(EA_AY_IX_8(), COND_LE() ? 0xff : 0); } static void m68k_op_sle_8_aw(void) { - m68ki_write_8(EA_AW_8(), COND_LE() ? 0xff : 0); + m68ki_write_8(EA_AW_8(), COND_LE() ? 0xff : 0); } static void m68k_op_sle_8_al(void) { - m68ki_write_8(EA_AL_8(), COND_LE() ? 0xff : 0); + m68ki_write_8(EA_AL_8(), COND_LE() ? 0xff : 0); } static void m68k_op_stop(void) { - if(FLAG_S) - { - uint new_sr = OPER_I_16(); - m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ - CPU_STOPPED |= STOP_LEVEL_STOP; - m68ki_set_sr(new_sr); - m68ki_remaining_cycles = 0; - return; - } - m68ki_exception_privilege_violation(); + if(FLAG_S) + { + uint new_sr = OPER_I_16(); + m68ki_trace_t0(); /* auto-disable (see m68kcpu.h) */ + CPU_STOPPED |= STOP_LEVEL_STOP; + m68ki_set_sr(new_sr); + m68ki_remaining_cycles = 0; + return; + } + m68ki_exception_privilege_violation(); } static void m68k_op_sub_8_er_d(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_8(DY); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_8(DY); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_ai(void) { - uint* r_dst = &DX; - uint src = OPER_AY_AI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_AI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_pi(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_PI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_pi7(void) { - uint* r_dst = &DX; - uint src = OPER_A7_PI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_A7_PI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_pd(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PD_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_PD_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_pd7(void) { - uint* r_dst = &DX; - uint src = OPER_A7_PD_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_A7_PD_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_di(void) { - uint* r_dst = &DX; - uint src = OPER_AY_DI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_DI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_ix(void) { - uint* r_dst = &DX; - uint src = OPER_AY_IX_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_IX_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_aw(void) { - uint* r_dst = &DX; - uint src = OPER_AW_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AW_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_al(void) { - uint* r_dst = &DX; - uint src = OPER_AL_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AL_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_pcdi(void) { - uint* r_dst = &DX; - uint src = OPER_PCDI_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_PCDI_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_pcix(void) { - uint* r_dst = &DX; - uint src = OPER_PCIX_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_PCIX_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_8_er_i(void) { - uint* r_dst = &DX; - uint src = OPER_I_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_I_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_8(res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_d(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_16(DY); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_16(DY); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_a(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_16(AY); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_16(AY); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_ai(void) { - uint* r_dst = &DX; - uint src = OPER_AY_AI_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_AI_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_pi(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PI_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_PI_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_pd(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PD_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_PD_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_di(void) { - uint* r_dst = &DX; - uint src = OPER_AY_DI_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_DI_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_ix(void) { - uint* r_dst = &DX; - uint src = OPER_AY_IX_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_IX_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_aw(void) { - uint* r_dst = &DX; - uint src = OPER_AW_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AW_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_al(void) { - uint* r_dst = &DX; - uint src = OPER_AL_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AL_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_pcdi(void) { - uint* r_dst = &DX; - uint src = OPER_PCDI_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_PCDI_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_pcix(void) { - uint* r_dst = &DX; - uint src = OPER_PCIX_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_PCIX_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_16_er_i(void) { - uint* r_dst = &DX; - uint src = OPER_I_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_I_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_16(res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_sub_32_er_d(void) { - uint* r_dst = &DX; - uint src = DY; - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = DY; + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_a(void) { - uint* r_dst = &DX; - uint src = AY; - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = AY; + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_ai(void) { - uint* r_dst = &DX; - uint src = OPER_AY_AI_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_AI_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_pi(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PI_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_PI_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_pd(void) { - uint* r_dst = &DX; - uint src = OPER_AY_PD_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_PD_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_di(void) { - uint* r_dst = &DX; - uint src = OPER_AY_DI_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_DI_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_ix(void) { - uint* r_dst = &DX; - uint src = OPER_AY_IX_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AY_IX_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_aw(void) { - uint* r_dst = &DX; - uint src = OPER_AW_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AW_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_al(void) { - uint* r_dst = &DX; - uint src = OPER_AL_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_AL_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_pcdi(void) { - uint* r_dst = &DX; - uint src = OPER_PCDI_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_PCDI_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_pcix(void) { - uint* r_dst = &DX; - uint src = OPER_PCIX_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_PCIX_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_32_er_i(void) { - uint* r_dst = &DX; - uint src = OPER_I_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DX; + uint src = OPER_I_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); - FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_Z = MASK_OUT_ABOVE_32(res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_sub_8_re_ai(void) { - uint ea = EA_AY_AI_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint ea = EA_AY_AI_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_sub_8_re_pi(void) { - uint ea = EA_AY_PI_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint ea = EA_AY_PI_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_sub_8_re_pi7(void) { - uint ea = EA_A7_PI_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint ea = EA_A7_PI_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_sub_8_re_pd(void) { - uint ea = EA_AY_PD_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint ea = EA_AY_PD_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_sub_8_re_pd7(void) { - uint ea = EA_A7_PD_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint ea = EA_A7_PD_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_sub_8_re_di(void) { - uint ea = EA_AY_DI_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint ea = EA_AY_DI_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_sub_8_re_ix(void) { - uint ea = EA_AY_IX_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint ea = EA_AY_IX_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_sub_8_re_aw(void) { - uint ea = EA_AW_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint ea = EA_AW_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_sub_8_re_al(void) { - uint ea = EA_AL_8(); - uint src = MASK_OUT_ABOVE_8(DX); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint ea = EA_AL_8(); + uint src = MASK_OUT_ABOVE_8(DX); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_sub_16_re_ai(void) { - uint ea = EA_AY_AI_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint ea = EA_AY_AI_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_sub_16_re_pi(void) { - uint ea = EA_AY_PI_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint ea = EA_AY_PI_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_sub_16_re_pd(void) { - uint ea = EA_AY_PD_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint ea = EA_AY_PD_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_sub_16_re_di(void) { - uint ea = EA_AY_DI_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint ea = EA_AY_DI_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_sub_16_re_ix(void) { - uint ea = EA_AY_IX_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint ea = EA_AY_IX_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_sub_16_re_aw(void) { - uint ea = EA_AW_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint ea = EA_AW_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_sub_16_re_al(void) { - uint ea = EA_AL_16(); - uint src = MASK_OUT_ABOVE_16(DX); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint ea = EA_AL_16(); + uint src = MASK_OUT_ABOVE_16(DX); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_sub_32_re_ai(void) { - uint ea = EA_AY_AI_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint ea = EA_AY_AI_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_sub_32_re_pi(void) { - uint ea = EA_AY_PI_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint ea = EA_AY_PI_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_sub_32_re_pd(void) { - uint ea = EA_AY_PD_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint ea = EA_AY_PD_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_sub_32_re_di(void) { - uint ea = EA_AY_DI_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint ea = EA_AY_DI_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_sub_32_re_ix(void) { - uint ea = EA_AY_IX_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint ea = EA_AY_IX_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_sub_32_re_aw(void) { - uint ea = EA_AW_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint ea = EA_AW_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_sub_32_re_al(void) { - uint ea = EA_AL_32(); - uint src = DX; - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint ea = EA_AL_32(); + uint src = DX; + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_suba_16_d(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(*r_dst - MAKE_INT_16(DY)); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - MAKE_INT_16(DY)); } static void m68k_op_suba_16_a(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(*r_dst - MAKE_INT_16(AY)); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - MAKE_INT_16(AY)); } static void m68k_op_suba_16_ai(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_AI_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_AI_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_16_pi(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_PI_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_PI_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_16_pd(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_PD_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_PD_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_16_di(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_DI_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_DI_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_16_ix(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AY_IX_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AY_IX_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_16_aw(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AW_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AW_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_16_al(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_AL_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_AL_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_16_pcdi(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_PCDI_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_PCDI_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_16_pcix(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_PCIX_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_PCIX_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_16_i(void) { - uint* r_dst = &AX; - uint src = MAKE_INT_16(OPER_I_16()); + uint* r_dst = &AX; + uint src = MAKE_INT_16(OPER_I_16()); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_d(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(*r_dst - DY); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - DY); } static void m68k_op_suba_32_a(void) { - uint* r_dst = &AX; + uint* r_dst = &AX; - *r_dst = MASK_OUT_ABOVE_32(*r_dst - AY); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - AY); } static void m68k_op_suba_32_ai(void) { - uint* r_dst = &AX; - uint src = OPER_AY_AI_32(); + uint* r_dst = &AX; + uint src = OPER_AY_AI_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_pi(void) { - uint* r_dst = &AX; - uint src = OPER_AY_PI_32(); + uint* r_dst = &AX; + uint src = OPER_AY_PI_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_pd(void) { - uint* r_dst = &AX; - uint src = OPER_AY_PD_32(); + uint* r_dst = &AX; + uint src = OPER_AY_PD_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_di(void) { - uint* r_dst = &AX; - uint src = OPER_AY_DI_32(); + uint* r_dst = &AX; + uint src = OPER_AY_DI_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_ix(void) { - uint* r_dst = &AX; - uint src = OPER_AY_IX_32(); + uint* r_dst = &AX; + uint src = OPER_AY_IX_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_aw(void) { - uint* r_dst = &AX; - uint src = OPER_AW_32(); + uint* r_dst = &AX; + uint src = OPER_AW_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_al(void) { - uint* r_dst = &AX; - uint src = OPER_AL_32(); + uint* r_dst = &AX; + uint src = OPER_AL_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_pcdi(void) { - uint* r_dst = &AX; - uint src = OPER_PCDI_32(); + uint* r_dst = &AX; + uint src = OPER_PCDI_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_pcix(void) { - uint* r_dst = &AX; - uint src = OPER_PCIX_32(); + uint* r_dst = &AX; + uint src = OPER_PCIX_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_suba_32_i(void) { - uint* r_dst = &AX; - uint src = OPER_I_32(); + uint* r_dst = &AX; + uint src = OPER_I_32(); - *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - src); } static void m68k_op_subi_8_d(void) { - uint* r_dst = &DY; - uint src = OPER_I_8(); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DY; + uint src = OPER_I_8(); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_subi_8_ai(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_AI_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = OPER_I_8(); + uint ea = EA_AY_AI_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subi_8_pi(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = OPER_I_8(); + uint ea = EA_AY_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subi_8_pi7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = OPER_I_8(); + uint ea = EA_A7_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subi_8_pd(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = OPER_I_8(); + uint ea = EA_AY_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subi_8_pd7(void) { - uint src = OPER_I_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = OPER_I_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subi_8_di(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_DI_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = OPER_I_8(); + uint ea = EA_AY_DI_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subi_8_ix(void) { - uint src = OPER_I_8(); - uint ea = EA_AY_IX_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = OPER_I_8(); + uint ea = EA_AY_IX_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subi_8_aw(void) { - uint src = OPER_I_8(); - uint ea = EA_AW_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = OPER_I_8(); + uint ea = EA_AW_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subi_8_al(void) { - uint src = OPER_I_8(); - uint ea = EA_AL_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = OPER_I_8(); + uint ea = EA_AL_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subi_16_d(void) { - uint* r_dst = &DY; - uint src = OPER_I_16(); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DY; + uint src = OPER_I_16(); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_subi_16_ai(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_AI_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = OPER_I_16(); + uint ea = EA_AY_AI_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subi_16_pi(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PI_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = OPER_I_16(); + uint ea = EA_AY_PI_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subi_16_pd(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_PD_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = OPER_I_16(); + uint ea = EA_AY_PD_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subi_16_di(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_DI_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = OPER_I_16(); + uint ea = EA_AY_DI_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subi_16_ix(void) { - uint src = OPER_I_16(); - uint ea = EA_AY_IX_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = OPER_I_16(); + uint ea = EA_AY_IX_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subi_16_aw(void) { - uint src = OPER_I_16(); - uint ea = EA_AW_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = OPER_I_16(); + uint ea = EA_AW_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subi_16_al(void) { - uint src = OPER_I_16(); - uint ea = EA_AL_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = OPER_I_16(); + uint ea = EA_AL_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subi_32_d(void) { - uint* r_dst = &DY; - uint src = OPER_I_32(); - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DY; + uint src = OPER_I_32(); + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_subi_32_ai(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_AI_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = OPER_I_32(); + uint ea = EA_AY_AI_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subi_32_pi(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PI_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = OPER_I_32(); + uint ea = EA_AY_PI_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subi_32_pd(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_PD_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = OPER_I_32(); + uint ea = EA_AY_PD_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subi_32_di(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_DI_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = OPER_I_32(); + uint ea = EA_AY_DI_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subi_32_ix(void) { - uint src = OPER_I_32(); - uint ea = EA_AY_IX_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = OPER_I_32(); + uint ea = EA_AY_IX_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subi_32_aw(void) { - uint src = OPER_I_32(); - uint ea = EA_AW_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = OPER_I_32(); + uint ea = EA_AW_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subi_32_al(void) { - uint src = OPER_I_32(); - uint ea = EA_AL_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = OPER_I_32(); + uint ea = EA_AL_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subq_8_d(void) { - uint* r_dst = &DY; - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src; + uint* r_dst = &DY; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | FLAG_Z; } static void m68k_op_subq_8_ai(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_AI_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_AI_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subq_8_pi(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subq_8_pi7(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_A7_PI_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_A7_PI_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subq_8_pd(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subq_8_pd7(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subq_8_di(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_DI_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_DI_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subq_8_ix(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_IX_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_IX_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subq_8_aw(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AW_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AW_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subq_8_al(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AL_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AL_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src; - FLAG_N = NFLAG_8(res); - FLAG_Z = MASK_OUT_ABOVE_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_Z = MASK_OUT_ABOVE_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - m68ki_write_8(ea, FLAG_Z); + m68ki_write_8(ea, FLAG_Z); } static void m68k_op_subq_16_d(void) { - uint* r_dst = &DY; - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src; + uint* r_dst = &DY; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | FLAG_Z; } static void m68k_op_subq_16_a(void) { - uint* r_dst = &AY; + uint* r_dst = &AY; - *r_dst = MASK_OUT_ABOVE_32(*r_dst - ((((REG_IR >> 9) - 1) & 7) + 1)); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - ((((REG_IR >> 9) - 1) & 7) + 1)); } static void m68k_op_subq_16_ai(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_AI_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_AI_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subq_16_pi(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PI_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PI_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subq_16_pd(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PD_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PD_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subq_16_di(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_DI_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_DI_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subq_16_ix(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_IX_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_IX_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subq_16_aw(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AW_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AW_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subq_16_al(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AL_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AL_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src; - FLAG_N = NFLAG_16(res); - FLAG_Z = MASK_OUT_ABOVE_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_Z = MASK_OUT_ABOVE_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - m68ki_write_16(ea, FLAG_Z); + m68ki_write_16(ea, FLAG_Z); } static void m68k_op_subq_32_d(void) { - uint* r_dst = &DY; - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint dst = *r_dst; - uint res = dst - src; + uint* r_dst = &DY; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint dst = *r_dst; + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - *r_dst = FLAG_Z; + *r_dst = FLAG_Z; } static void m68k_op_subq_32_a(void) { - uint* r_dst = &AY; + uint* r_dst = &AY; - *r_dst = MASK_OUT_ABOVE_32(*r_dst - ((((REG_IR >> 9) - 1) & 7) + 1)); + *r_dst = MASK_OUT_ABOVE_32(*r_dst - ((((REG_IR >> 9) - 1) & 7) + 1)); } static void m68k_op_subq_32_ai(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_AI_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_AI_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subq_32_pi(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PI_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PI_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subq_32_pd(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_PD_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_PD_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subq_32_di(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_DI_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_DI_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subq_32_ix(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AY_IX_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AY_IX_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subq_32_aw(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AW_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AW_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subq_32_al(void) { - uint src = (((REG_IR >> 9) - 1) & 7) + 1; - uint ea = EA_AL_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src; + uint src = (((REG_IR >> 9) - 1) & 7) + 1; + uint ea = EA_AL_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src; - FLAG_N = NFLAG_32(res); - FLAG_Z = MASK_OUT_ABOVE_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_Z = MASK_OUT_ABOVE_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - m68ki_write_32(ea, FLAG_Z); + m68ki_write_32(ea, FLAG_Z); } static void m68k_op_subx_8_rr(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_8(DY); - uint dst = MASK_OUT_ABOVE_8(*r_dst); - uint res = dst - src - XFLAG_AS_1(); + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_8(DY); + uint dst = MASK_OUT_ABOVE_8(*r_dst); + uint res = dst - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_8(*r_dst) | res; } static void m68k_op_subx_16_rr(void) { - uint* r_dst = &DX; - uint src = MASK_OUT_ABOVE_16(DY); - uint dst = MASK_OUT_ABOVE_16(*r_dst); - uint res = dst - src - XFLAG_AS_1(); + uint* r_dst = &DX; + uint src = MASK_OUT_ABOVE_16(DY); + uint dst = MASK_OUT_ABOVE_16(*r_dst); + uint res = dst - src - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; + *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; } static void m68k_op_subx_32_rr(void) { - uint* r_dst = &DX; - uint src = DY; - uint dst = *r_dst; - uint res = dst - src - XFLAG_AS_1(); + uint* r_dst = &DX; + uint src = DY; + uint dst = *r_dst; + uint res = dst - src - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - *r_dst = res; + *r_dst = res; } static void m68k_op_subx_8_mm_ax7(void) { - uint src = OPER_AY_PD_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src - XFLAG_AS_1(); + uint src = OPER_AY_PD_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_subx_8_mm_ay7(void) { - uint src = OPER_A7_PD_8(); - uint ea = EA_AX_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src - XFLAG_AS_1(); + uint src = OPER_A7_PD_8(); + uint ea = EA_AX_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_subx_8_mm_axy7(void) { - uint src = OPER_A7_PD_8(); - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src - XFLAG_AS_1(); + uint src = OPER_A7_PD_8(); + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_subx_8_mm(void) { - uint src = OPER_AY_PD_8(); - uint ea = EA_AX_PD_8(); - uint dst = m68ki_read_8(ea); - uint res = dst - src - XFLAG_AS_1(); + uint src = OPER_AY_PD_8(); + uint ea = EA_AX_PD_8(); + uint dst = m68ki_read_8(ea); + uint res = dst - src - XFLAG_AS_1(); - FLAG_N = NFLAG_8(res); - FLAG_X = FLAG_C = CFLAG_8(res); - FLAG_V = VFLAG_SUB_8(src, dst, res); + FLAG_N = NFLAG_8(res); + FLAG_X = FLAG_C = CFLAG_8(res); + FLAG_V = VFLAG_SUB_8(src, dst, res); - res = MASK_OUT_ABOVE_8(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_8(res); + FLAG_Z |= res; - m68ki_write_8(ea, res); + m68ki_write_8(ea, res); } static void m68k_op_subx_16_mm(void) { - uint src = OPER_AY_PD_16(); - uint ea = EA_AX_PD_16(); - uint dst = m68ki_read_16(ea); - uint res = dst - src - XFLAG_AS_1(); + uint src = OPER_AY_PD_16(); + uint ea = EA_AX_PD_16(); + uint dst = m68ki_read_16(ea); + uint res = dst - src - XFLAG_AS_1(); - FLAG_N = NFLAG_16(res); - FLAG_X = FLAG_C = CFLAG_16(res); - FLAG_V = VFLAG_SUB_16(src, dst, res); + FLAG_N = NFLAG_16(res); + FLAG_X = FLAG_C = CFLAG_16(res); + FLAG_V = VFLAG_SUB_16(src, dst, res); - res = MASK_OUT_ABOVE_16(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_16(res); + FLAG_Z |= res; - m68ki_write_16(ea, res); + m68ki_write_16(ea, res); } static void m68k_op_subx_32_mm(void) { - uint src = OPER_AY_PD_32(); - uint ea = EA_AX_PD_32(); - uint dst = m68ki_read_32(ea); - uint res = dst - src - XFLAG_AS_1(); + uint src = OPER_AY_PD_32(); + uint ea = EA_AX_PD_32(); + uint dst = m68ki_read_32(ea); + uint res = dst - src - XFLAG_AS_1(); - FLAG_N = NFLAG_32(res); - FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); - FLAG_V = VFLAG_SUB_32(src, dst, res); + FLAG_N = NFLAG_32(res); + FLAG_X = FLAG_C = CFLAG_SUB_32(src, dst, res); + FLAG_V = VFLAG_SUB_32(src, dst, res); - res = MASK_OUT_ABOVE_32(res); - FLAG_Z |= res; + res = MASK_OUT_ABOVE_32(res); + FLAG_Z |= res; - m68ki_write_32(ea, res); + m68ki_write_32(ea, res); } static void m68k_op_swap_32(void) { - uint* r_dst = &DY; + uint* r_dst = &DY; - FLAG_Z = MASK_OUT_ABOVE_32(*r_dst<<16); - *r_dst = (*r_dst>>16) | FLAG_Z; + FLAG_Z = MASK_OUT_ABOVE_32(*r_dst<<16); + *r_dst = (*r_dst>>16) | FLAG_Z; - FLAG_Z = *r_dst; - FLAG_N = NFLAG_32(*r_dst); - FLAG_C = CFLAG_CLEAR; - FLAG_V = VFLAG_CLEAR; + FLAG_Z = *r_dst; + FLAG_N = NFLAG_32(*r_dst); + FLAG_C = CFLAG_CLEAR; + FLAG_V = VFLAG_CLEAR; } static void m68k_op_tas_8_d(void) { - uint* r_dst = &DY; + uint* r_dst = &DY; - FLAG_Z = MASK_OUT_ABOVE_8(*r_dst); - FLAG_N = NFLAG_8(*r_dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - *r_dst |= 0x80; + FLAG_Z = MASK_OUT_ABOVE_8(*r_dst); + FLAG_N = NFLAG_8(*r_dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + *r_dst |= 0x80; } static void m68k_op_tas_8_ai(void) { - uint ea = EA_AY_AI_8(); - uint dst = m68ki_read_8(ea); - uint allow_writeback; + uint ea = EA_AY_AI_8(); + uint dst = m68ki_read_8(ea); + uint allow_writeback; - FLAG_Z = dst; - FLAG_N = NFLAG_8(dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = dst; + FLAG_N = NFLAG_8(dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback + /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback disabled in order to function properly. Some Amiga software may also rely on this, but only when accessing specific addresses so additional functionality will be needed. */ - allow_writeback = m68ki_tas_callback(); + allow_writeback = m68ki_tas_callback(); - if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); + if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); } static void m68k_op_tas_8_pi(void) { - uint ea = EA_AY_PI_8(); - uint dst = m68ki_read_8(ea); - uint allow_writeback; + uint ea = EA_AY_PI_8(); + uint dst = m68ki_read_8(ea); + uint allow_writeback; - FLAG_Z = dst; - FLAG_N = NFLAG_8(dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = dst; + FLAG_N = NFLAG_8(dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback + /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback disabled in order to function properly. Some Amiga software may also rely on this, but only when accessing specific addresses so additional functionality will be needed. */ - allow_writeback = m68ki_tas_callback(); + allow_writeback = m68ki_tas_callback(); - if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); + if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); } static void m68k_op_tas_8_pi7(void) { - uint ea = EA_A7_PI_8(); - uint dst = m68ki_read_8(ea); - uint allow_writeback; + uint ea = EA_A7_PI_8(); + uint dst = m68ki_read_8(ea); + uint allow_writeback; - FLAG_Z = dst; - FLAG_N = NFLAG_8(dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = dst; + FLAG_N = NFLAG_8(dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback + /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback disabled in order to function properly. Some Amiga software may also rely on this, but only when accessing specific addresses so additional functionality will be needed. */ - allow_writeback = m68ki_tas_callback(); + allow_writeback = m68ki_tas_callback(); - if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); + if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); } static void m68k_op_tas_8_pd(void) { - uint ea = EA_AY_PD_8(); - uint dst = m68ki_read_8(ea); - uint allow_writeback; + uint ea = EA_AY_PD_8(); + uint dst = m68ki_read_8(ea); + uint allow_writeback; - FLAG_Z = dst; - FLAG_N = NFLAG_8(dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = dst; + FLAG_N = NFLAG_8(dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback + /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback disabled in order to function properly. Some Amiga software may also rely on this, but only when accessing specific addresses so additional functionality will be needed. */ - allow_writeback = m68ki_tas_callback(); + allow_writeback = m68ki_tas_callback(); - if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); + if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); } static void m68k_op_tas_8_pd7(void) { - uint ea = EA_A7_PD_8(); - uint dst = m68ki_read_8(ea); - uint allow_writeback; + uint ea = EA_A7_PD_8(); + uint dst = m68ki_read_8(ea); + uint allow_writeback; - FLAG_Z = dst; - FLAG_N = NFLAG_8(dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = dst; + FLAG_N = NFLAG_8(dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback + /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback disabled in order to function properly. Some Amiga software may also rely on this, but only when accessing specific addresses so additional functionality will be needed. */ - allow_writeback = m68ki_tas_callback(); + allow_writeback = m68ki_tas_callback(); - if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); + if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); } static void m68k_op_tas_8_di(void) { - uint ea = EA_AY_DI_8(); - uint dst = m68ki_read_8(ea); - uint allow_writeback; + uint ea = EA_AY_DI_8(); + uint dst = m68ki_read_8(ea); + uint allow_writeback; - FLAG_Z = dst; - FLAG_N = NFLAG_8(dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = dst; + FLAG_N = NFLAG_8(dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback + /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback disabled in order to function properly. Some Amiga software may also rely on this, but only when accessing specific addresses so additional functionality will be needed. */ - allow_writeback = m68ki_tas_callback(); + allow_writeback = m68ki_tas_callback(); - if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); + if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); } static void m68k_op_tas_8_ix(void) { - uint ea = EA_AY_IX_8(); - uint dst = m68ki_read_8(ea); - uint allow_writeback; + uint ea = EA_AY_IX_8(); + uint dst = m68ki_read_8(ea); + uint allow_writeback; - FLAG_Z = dst; - FLAG_N = NFLAG_8(dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = dst; + FLAG_N = NFLAG_8(dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback + /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback disabled in order to function properly. Some Amiga software may also rely on this, but only when accessing specific addresses so additional functionality will be needed. */ - allow_writeback = m68ki_tas_callback(); + allow_writeback = m68ki_tas_callback(); - if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); + if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); } static void m68k_op_tas_8_aw(void) { - uint ea = EA_AW_8(); - uint dst = m68ki_read_8(ea); - uint allow_writeback; + uint ea = EA_AW_8(); + uint dst = m68ki_read_8(ea); + uint allow_writeback; - FLAG_Z = dst; - FLAG_N = NFLAG_8(dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = dst; + FLAG_N = NFLAG_8(dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback + /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback disabled in order to function properly. Some Amiga software may also rely on this, but only when accessing specific addresses so additional functionality will be needed. */ - allow_writeback = m68ki_tas_callback(); + allow_writeback = m68ki_tas_callback(); - if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); + if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); } static void m68k_op_tas_8_al(void) { - uint ea = EA_AL_8(); - uint dst = m68ki_read_8(ea); - uint allow_writeback; + uint ea = EA_AL_8(); + uint dst = m68ki_read_8(ea); + uint allow_writeback; - FLAG_Z = dst; - FLAG_N = NFLAG_8(dst); - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_Z = dst; + FLAG_N = NFLAG_8(dst); + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; - /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback + /* The Genesis/Megadrive games Gargoyles and Ex-Mutants need the TAS writeback disabled in order to function properly. Some Amiga software may also rely on this, but only when accessing specific addresses so additional functionality will be needed. */ - allow_writeback = m68ki_tas_callback(); + allow_writeback = m68ki_tas_callback(); - if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); + if (allow_writeback==1) m68ki_write_8(ea, dst | 0x80); } static void m68k_op_trap(void) { - /* Trap#n stacks exception frame type 0 */ - m68ki_exception_trapN(EXCEPTION_TRAP_BASE + (REG_IR & 0xf)); /* HJB 990403 */ + /* Trap#n stacks exception frame type 0 */ + m68ki_exception_trapN(EXCEPTION_TRAP_BASE + (REG_IR & 0xf)); /* HJB 990403 */ } static void m68k_op_trapt(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapt_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapt_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapf(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapf_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapf_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_traphi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_HI()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_HI()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapls(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LS()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LS()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapcc(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_CC()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_CC()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapcs(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_CS()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_CS()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapne(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_NE()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_NE()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapeq(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_EQ()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_EQ()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapvc(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_VC()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_VC()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapvs(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_VS()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_VS()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trappl(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_PL()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_PL()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapmi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_MI()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_MI()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapge(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_GE()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_GE()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_traplt(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LT()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LT()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapgt(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_GT()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_GT()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_traple(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LE()) - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LE()) + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + m68ki_exception_illegal(); } static void m68k_op_traphi_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_HI()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_HI()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapls_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LS()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LS()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapcc_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_CC()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_CC()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapcs_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_CS()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_CS()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapne_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_NE()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_NE()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapeq_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_EQ()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_EQ()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapvc_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_VC()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_VC()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapvs_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_VS()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_VS()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trappl_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_PL()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_PL()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapmi_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_MI()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_MI()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapge_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_GE()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_GE()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_traplt_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LT()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LT()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapgt_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_GT()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_GT()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_traple_16(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LE()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 2; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LE()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 2; + return; + } + m68ki_exception_illegal(); } static void m68k_op_traphi_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_HI()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_HI()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapls_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LS()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LS()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapcc_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_CC()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_CC()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapcs_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_CS()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_CS()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapne_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_NE()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_NE()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapeq_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_EQ()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_EQ()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapvc_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_VC()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_VC()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapvs_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_VS()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_VS()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trappl_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_PL()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_PL()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapmi_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_MI()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_MI()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapge_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_GE()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_GE()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_traplt_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LT()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LT()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapgt_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_GT()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_GT()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_traple_32(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - if(COND_LE()) - { - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ - return; - } - REG_PC += 4; - return; - } - m68ki_exception_illegal(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + if(COND_LE()) + { + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + return; + } + REG_PC += 4; + return; + } + m68ki_exception_illegal(); } static void m68k_op_trapv(void) { - if(COND_VC()) - { - return; - } - m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ + if(COND_VC()) + { + return; + } + m68ki_exception_trap(EXCEPTION_TRAPV); /* HJB 990403 */ } static void m68k_op_tst_8_d(void) { - uint res = MASK_OUT_ABOVE_8(DY); + uint res = MASK_OUT_ABOVE_8(DY); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_ai(void) { - uint res = OPER_AY_AI_8(); + uint res = OPER_AY_AI_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_pi(void) { - uint res = OPER_AY_PI_8(); + uint res = OPER_AY_PI_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_pi7(void) { - uint res = OPER_A7_PI_8(); + uint res = OPER_A7_PI_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_pd(void) { - uint res = OPER_AY_PD_8(); + uint res = OPER_AY_PD_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_pd7(void) { - uint res = OPER_A7_PD_8(); + uint res = OPER_A7_PD_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_di(void) { - uint res = OPER_AY_DI_8(); + uint res = OPER_AY_DI_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_ix(void) { - uint res = OPER_AY_IX_8(); + uint res = OPER_AY_IX_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_aw(void) { - uint res = OPER_AW_8(); + uint res = OPER_AW_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_al(void) { - uint res = OPER_AL_8(); + uint res = OPER_AL_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_8_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = OPER_PCDI_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = OPER_PCDI_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_8_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = OPER_PCIX_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = OPER_PCIX_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_8_i(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = OPER_I_8(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = OPER_I_8(); - FLAG_N = NFLAG_8(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_8(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_16_d(void) { - uint res = MASK_OUT_ABOVE_16(DY); + uint res = MASK_OUT_ABOVE_16(DY); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_16_a(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = MAKE_INT_16(AY); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = MAKE_INT_16(AY); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_16_ai(void) { - uint res = OPER_AY_AI_16(); + uint res = OPER_AY_AI_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_16_pi(void) { - uint res = OPER_AY_PI_16(); + uint res = OPER_AY_PI_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_16_pd(void) { - uint res = OPER_AY_PD_16(); + uint res = OPER_AY_PD_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_16_di(void) { - uint res = OPER_AY_DI_16(); + uint res = OPER_AY_DI_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_16_ix(void) { - uint res = OPER_AY_IX_16(); + uint res = OPER_AY_IX_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_16_aw(void) { - uint res = OPER_AW_16(); + uint res = OPER_AW_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_16_al(void) { - uint res = OPER_AL_16(); + uint res = OPER_AL_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_16_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = OPER_PCDI_16(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = OPER_PCDI_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_16_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = OPER_PCIX_16(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = OPER_PCIX_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_16_i(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = OPER_I_16(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = OPER_I_16(); - FLAG_N = NFLAG_16(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_16(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_32_d(void) { - uint res = DY; + uint res = DY; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_32_a(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = AY; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = AY; - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_32_ai(void) { - uint res = OPER_AY_AI_32(); + uint res = OPER_AY_AI_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_32_pi(void) { - uint res = OPER_AY_PI_32(); + uint res = OPER_AY_PI_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_32_pd(void) { - uint res = OPER_AY_PD_32(); + uint res = OPER_AY_PD_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_32_di(void) { - uint res = OPER_AY_DI_32(); + uint res = OPER_AY_DI_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_32_ix(void) { - uint res = OPER_AY_IX_32(); + uint res = OPER_AY_IX_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_32_aw(void) { - uint res = OPER_AW_32(); + uint res = OPER_AW_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_32_al(void) { - uint res = OPER_AL_32(); + uint res = OPER_AL_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; } static void m68k_op_tst_32_pcdi(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = OPER_PCDI_32(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = OPER_PCDI_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_32_pcix(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = OPER_PCIX_32(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = OPER_PCIX_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_tst_32_i(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint res = OPER_I_32(); + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint res = OPER_I_32(); - FLAG_N = NFLAG_32(res); - FLAG_Z = res; - FLAG_V = VFLAG_CLEAR; - FLAG_C = CFLAG_CLEAR; - return; - } - m68ki_exception_illegal(); + FLAG_N = NFLAG_32(res); + FLAG_Z = res; + FLAG_V = VFLAG_CLEAR; + FLAG_C = CFLAG_CLEAR; + return; + } + m68ki_exception_illegal(); } static void m68k_op_unlk_32_a7(void) { - REG_A[7] = m68ki_read_32(REG_A[7]); + REG_A[7] = m68ki_read_32(REG_A[7]); } static void m68k_op_unlk_32(void) { - uint* r_dst = &AY; + uint* r_dst = &AY; - REG_A[7] = *r_dst; - *r_dst = m68ki_pull_32(); + REG_A[7] = *r_dst; + *r_dst = m68ki_pull_32(); } static void m68k_op_unpk_16_rr(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* Note: DX and DY are reversed in Motorola's docs */ - uint src = DY; - uint* r_dst = &DX; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* Note: DX and DY are reversed in Motorola's docs */ + uint src = DY; + uint* r_dst = &DX; - *r_dst = MASK_OUT_BELOW_16(*r_dst) | (((((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16()) & 0xffff); - return; - } - m68ki_exception_illegal(); + *r_dst = MASK_OUT_BELOW_16(*r_dst) | (((((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16()) & 0xffff); + return; + } + m68ki_exception_illegal(); } static void m68k_op_unpk_16_mm_ax7(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - uint src = OPER_AY_PD_8(); - uint ea_dst; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* Note: AX and AY are reversed in Motorola's docs */ + uint src = OPER_AY_PD_8(); + uint ea_dst; - src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(); - ea_dst = EA_A7_PD_8(); - m68ki_write_8(ea_dst, (src >> 8) & 0xff); - ea_dst = EA_A7_PD_8(); - m68ki_write_8(ea_dst, src & 0xff); - return; - } - m68ki_exception_illegal(); + src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(); + ea_dst = EA_A7_PD_8(); + m68ki_write_8(ea_dst, (src >> 8) & 0xff); + ea_dst = EA_A7_PD_8(); + m68ki_write_8(ea_dst, src & 0xff); + return; + } + m68ki_exception_illegal(); } static void m68k_op_unpk_16_mm_ay7(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - uint src = OPER_A7_PD_8(); - uint ea_dst; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* Note: AX and AY are reversed in Motorola's docs */ + uint src = OPER_A7_PD_8(); + uint ea_dst; - src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(); - ea_dst = EA_AX_PD_8(); - m68ki_write_8(ea_dst, (src >> 8) & 0xff); - ea_dst = EA_AX_PD_8(); - m68ki_write_8(ea_dst, src & 0xff); - return; - } - m68ki_exception_illegal(); + src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(); + ea_dst = EA_AX_PD_8(); + m68ki_write_8(ea_dst, (src >> 8) & 0xff); + ea_dst = EA_AX_PD_8(); + m68ki_write_8(ea_dst, src & 0xff); + return; + } + m68ki_exception_illegal(); } static void m68k_op_unpk_16_mm_axy7(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - uint src = OPER_A7_PD_8(); - uint ea_dst; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + uint src = OPER_A7_PD_8(); + uint ea_dst; - src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(); - ea_dst = EA_A7_PD_8(); - m68ki_write_8(ea_dst, (src >> 8) & 0xff); - ea_dst = EA_A7_PD_8(); - m68ki_write_8(ea_dst, src & 0xff); - return; - } - m68ki_exception_illegal(); + src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(); + ea_dst = EA_A7_PD_8(); + m68ki_write_8(ea_dst, (src >> 8) & 0xff); + ea_dst = EA_A7_PD_8(); + m68ki_write_8(ea_dst, src & 0xff); + return; + } + m68ki_exception_illegal(); } static void m68k_op_unpk_16_mm(void) { - if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) - { - /* Note: AX and AY are reversed in Motorola's docs */ - uint src = OPER_AY_PD_8(); - uint ea_dst; + if(CPU_TYPE_IS_EC020_PLUS(CPU_TYPE)) + { + /* Note: AX and AY are reversed in Motorola's docs */ + uint src = OPER_AY_PD_8(); + uint ea_dst; - src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(); - ea_dst = EA_AX_PD_8(); - m68ki_write_8(ea_dst, (src >> 8) & 0xff); - ea_dst = EA_AX_PD_8(); - m68ki_write_8(ea_dst, src & 0xff); - return; - } - m68ki_exception_illegal(); + src = (((src << 4) & 0x0f00) | (src & 0x000f)) + OPER_I_16(); + ea_dst = EA_AX_PD_8(); + m68ki_write_8(ea_dst, (src >> 8) & 0xff); + ea_dst = EA_AX_PD_8(); + m68ki_write_8(ea_dst, src & 0xff); + return; + } + m68ki_exception_illegal(); } @@ -34597,10 +34597,10 @@ unsigned char m68ki_cycles[NUM_CPU_TYPES][0x10000]; /* Cycles used by CPU type * /* This is used to generate the opcode handler jump table */ typedef struct { - void (*opcode_handler)(void); /* handler function */ - unsigned int mask; /* mask on opcode */ - unsigned int match; /* what to match after masking */ - unsigned char cycles[NUM_CPU_TYPES]; /* cycles each cpu type takes */ + void (*opcode_handler)(void); /* handler function */ + unsigned int mask; /* mask on opcode */ + unsigned int match; /* what to match after masking */ + unsigned char cycles[NUM_CPU_TYPES]; /* cycles each cpu type takes */ } opcode_handler_struct; @@ -34610,2068 +34610,2068 @@ static const opcode_handler_struct m68k_opcode_handler_table[] = /* function mask match 000 010 020 040 */ - {m68k_op_1010 , 0xf000, 0xa000, { 4, 4, 4, 4}}, - {m68k_op_1111 , 0xf000, 0xf000, { 4, 4, 4, 4}}, - {m68k_op_moveq_32 , 0xf100, 0x7000, { 4, 4, 2, 2}}, - {m68k_op_cpbcc_32 , 0xf180, 0xf080, { 0, 0, 4, 0}}, - {m68k_op_cpgen_32 , 0xf1c0, 0xf000, { 0, 0, 4, 0}}, - {m68k_op_cpscc_32 , 0xf1c0, 0xf040, { 0, 0, 4, 0}}, - {m68k_op_bra_8 , 0xff00, 0x6000, { 10, 10, 10, 10}}, - {m68k_op_bsr_8 , 0xff00, 0x6100, { 18, 18, 7, 7}}, - {m68k_op_bhi_8 , 0xff00, 0x6200, { 10, 10, 6, 6}}, - {m68k_op_bls_8 , 0xff00, 0x6300, { 10, 10, 6, 6}}, - {m68k_op_bcc_8 , 0xff00, 0x6400, { 10, 10, 6, 6}}, - {m68k_op_bcs_8 , 0xff00, 0x6500, { 10, 10, 6, 6}}, - {m68k_op_bne_8 , 0xff00, 0x6600, { 10, 10, 6, 6}}, - {m68k_op_beq_8 , 0xff00, 0x6700, { 10, 10, 6, 6}}, - {m68k_op_bvc_8 , 0xff00, 0x6800, { 10, 10, 6, 6}}, - {m68k_op_bvs_8 , 0xff00, 0x6900, { 10, 10, 6, 6}}, - {m68k_op_bpl_8 , 0xff00, 0x6a00, { 10, 10, 6, 6}}, - {m68k_op_bmi_8 , 0xff00, 0x6b00, { 10, 10, 6, 6}}, - {m68k_op_bge_8 , 0xff00, 0x6c00, { 10, 10, 6, 6}}, - {m68k_op_blt_8 , 0xff00, 0x6d00, { 10, 10, 6, 6}}, - {m68k_op_bgt_8 , 0xff00, 0x6e00, { 10, 10, 6, 6}}, - {m68k_op_ble_8 , 0xff00, 0x6f00, { 10, 10, 6, 6}}, - {m68k_op_040fpu0_32 , 0xff00, 0xf200, { 0, 0, 0, 0}}, - {m68k_op_040fpu1_32 , 0xff00, 0xf300, { 0, 0, 0, 0}}, - {m68k_op_btst_32_r_d , 0xf1f8, 0x0100, { 6, 6, 4, 4}}, - {m68k_op_movep_16_er , 0xf1f8, 0x0108, { 16, 16, 12, 12}}, - {m68k_op_btst_8_r_ai , 0xf1f8, 0x0110, { 8, 8, 8, 8}}, - {m68k_op_btst_8_r_pi , 0xf1f8, 0x0118, { 8, 8, 8, 8}}, - {m68k_op_btst_8_r_pd , 0xf1f8, 0x0120, { 10, 10, 9, 9}}, - {m68k_op_btst_8_r_di , 0xf1f8, 0x0128, { 12, 12, 9, 9}}, - {m68k_op_btst_8_r_ix , 0xf1f8, 0x0130, { 14, 14, 11, 11}}, - {m68k_op_bchg_32_r_d , 0xf1f8, 0x0140, { 8, 8, 4, 4}}, - {m68k_op_movep_32_er , 0xf1f8, 0x0148, { 24, 24, 18, 18}}, - {m68k_op_bchg_8_r_ai , 0xf1f8, 0x0150, { 12, 12, 8, 8}}, - {m68k_op_bchg_8_r_pi , 0xf1f8, 0x0158, { 12, 12, 8, 8}}, - {m68k_op_bchg_8_r_pd , 0xf1f8, 0x0160, { 14, 14, 9, 9}}, - {m68k_op_bchg_8_r_di , 0xf1f8, 0x0168, { 16, 16, 9, 9}}, - {m68k_op_bchg_8_r_ix , 0xf1f8, 0x0170, { 18, 18, 11, 11}}, - {m68k_op_bclr_32_r_d , 0xf1f8, 0x0180, { 10, 10, 4, 4}}, - {m68k_op_movep_16_re , 0xf1f8, 0x0188, { 16, 16, 11, 11}}, - {m68k_op_bclr_8_r_ai , 0xf1f8, 0x0190, { 12, 14, 8, 8}}, - {m68k_op_bclr_8_r_pi , 0xf1f8, 0x0198, { 12, 14, 8, 8}}, - {m68k_op_bclr_8_r_pd , 0xf1f8, 0x01a0, { 14, 16, 9, 9}}, - {m68k_op_bclr_8_r_di , 0xf1f8, 0x01a8, { 16, 18, 9, 9}}, - {m68k_op_bclr_8_r_ix , 0xf1f8, 0x01b0, { 18, 20, 11, 11}}, - {m68k_op_bset_32_r_d , 0xf1f8, 0x01c0, { 8, 8, 4, 4}}, - {m68k_op_movep_32_re , 0xf1f8, 0x01c8, { 24, 24, 17, 17}}, - {m68k_op_bset_8_r_ai , 0xf1f8, 0x01d0, { 12, 12, 8, 8}}, - {m68k_op_bset_8_r_pi , 0xf1f8, 0x01d8, { 12, 12, 8, 8}}, - {m68k_op_bset_8_r_pd , 0xf1f8, 0x01e0, { 14, 14, 9, 9}}, - {m68k_op_bset_8_r_di , 0xf1f8, 0x01e8, { 16, 16, 9, 9}}, - {m68k_op_bset_8_r_ix , 0xf1f8, 0x01f0, { 18, 18, 11, 11}}, - {m68k_op_move_8_d_d , 0xf1f8, 0x1000, { 4, 4, 2, 2}}, - {m68k_op_move_8_d_ai , 0xf1f8, 0x1010, { 8, 8, 6, 6}}, - {m68k_op_move_8_d_pi , 0xf1f8, 0x1018, { 8, 8, 6, 6}}, - {m68k_op_move_8_d_pd , 0xf1f8, 0x1020, { 10, 10, 7, 7}}, - {m68k_op_move_8_d_di , 0xf1f8, 0x1028, { 12, 12, 7, 7}}, - {m68k_op_move_8_d_ix , 0xf1f8, 0x1030, { 14, 14, 9, 9}}, - {m68k_op_move_8_ai_d , 0xf1f8, 0x1080, { 8, 8, 4, 4}}, - {m68k_op_move_8_ai_ai , 0xf1f8, 0x1090, { 12, 12, 8, 8}}, - {m68k_op_move_8_ai_pi , 0xf1f8, 0x1098, { 12, 12, 8, 8}}, - {m68k_op_move_8_ai_pd , 0xf1f8, 0x10a0, { 14, 14, 9, 9}}, - {m68k_op_move_8_ai_di , 0xf1f8, 0x10a8, { 16, 16, 9, 9}}, - {m68k_op_move_8_ai_ix , 0xf1f8, 0x10b0, { 18, 18, 11, 11}}, - {m68k_op_move_8_pi_d , 0xf1f8, 0x10c0, { 8, 8, 4, 4}}, - {m68k_op_move_8_pi_ai , 0xf1f8, 0x10d0, { 12, 12, 8, 8}}, - {m68k_op_move_8_pi_pi , 0xf1f8, 0x10d8, { 12, 12, 8, 8}}, - {m68k_op_move_8_pi_pd , 0xf1f8, 0x10e0, { 14, 14, 9, 9}}, - {m68k_op_move_8_pi_di , 0xf1f8, 0x10e8, { 16, 16, 9, 9}}, - {m68k_op_move_8_pi_ix , 0xf1f8, 0x10f0, { 18, 18, 11, 11}}, - {m68k_op_move_8_pd_d , 0xf1f8, 0x1100, { 8, 8, 5, 5}}, - {m68k_op_move_8_pd_ai , 0xf1f8, 0x1110, { 12, 12, 9, 9}}, - {m68k_op_move_8_pd_pi , 0xf1f8, 0x1118, { 12, 12, 9, 9}}, - {m68k_op_move_8_pd_pd , 0xf1f8, 0x1120, { 14, 14, 10, 10}}, - {m68k_op_move_8_pd_di , 0xf1f8, 0x1128, { 16, 16, 10, 10}}, - {m68k_op_move_8_pd_ix , 0xf1f8, 0x1130, { 18, 18, 12, 12}}, - {m68k_op_move_8_di_d , 0xf1f8, 0x1140, { 12, 12, 5, 5}}, - {m68k_op_move_8_di_ai , 0xf1f8, 0x1150, { 16, 16, 9, 9}}, - {m68k_op_move_8_di_pi , 0xf1f8, 0x1158, { 16, 16, 9, 9}}, - {m68k_op_move_8_di_pd , 0xf1f8, 0x1160, { 18, 18, 10, 10}}, - {m68k_op_move_8_di_di , 0xf1f8, 0x1168, { 20, 20, 10, 10}}, - {m68k_op_move_8_di_ix , 0xf1f8, 0x1170, { 22, 22, 12, 12}}, - {m68k_op_move_8_ix_d , 0xf1f8, 0x1180, { 14, 14, 7, 7}}, - {m68k_op_move_8_ix_ai , 0xf1f8, 0x1190, { 18, 18, 11, 11}}, - {m68k_op_move_8_ix_pi , 0xf1f8, 0x1198, { 18, 18, 11, 11}}, - {m68k_op_move_8_ix_pd , 0xf1f8, 0x11a0, { 20, 20, 12, 12}}, - {m68k_op_move_8_ix_di , 0xf1f8, 0x11a8, { 22, 22, 12, 12}}, - {m68k_op_move_8_ix_ix , 0xf1f8, 0x11b0, { 24, 24, 14, 14}}, - {m68k_op_move_32_d_d , 0xf1f8, 0x2000, { 4, 4, 2, 2}}, - {m68k_op_move_32_d_a , 0xf1f8, 0x2008, { 4, 4, 2, 2}}, - {m68k_op_move_32_d_ai , 0xf1f8, 0x2010, { 12, 12, 6, 6}}, - {m68k_op_move_32_d_pi , 0xf1f8, 0x2018, { 12, 12, 6, 6}}, - {m68k_op_move_32_d_pd , 0xf1f8, 0x2020, { 14, 14, 7, 7}}, - {m68k_op_move_32_d_di , 0xf1f8, 0x2028, { 16, 16, 7, 7}}, - {m68k_op_move_32_d_ix , 0xf1f8, 0x2030, { 18, 18, 9, 9}}, - {m68k_op_movea_32_d , 0xf1f8, 0x2040, { 4, 4, 2, 2}}, - {m68k_op_movea_32_a , 0xf1f8, 0x2048, { 4, 4, 2, 2}}, - {m68k_op_movea_32_ai , 0xf1f8, 0x2050, { 12, 12, 6, 6}}, - {m68k_op_movea_32_pi , 0xf1f8, 0x2058, { 12, 12, 6, 6}}, - {m68k_op_movea_32_pd , 0xf1f8, 0x2060, { 14, 14, 7, 7}}, - {m68k_op_movea_32_di , 0xf1f8, 0x2068, { 16, 16, 7, 7}}, - {m68k_op_movea_32_ix , 0xf1f8, 0x2070, { 18, 18, 9, 9}}, - {m68k_op_move_32_ai_d , 0xf1f8, 0x2080, { 12, 12, 4, 4}}, - {m68k_op_move_32_ai_a , 0xf1f8, 0x2088, { 12, 12, 4, 4}}, - {m68k_op_move_32_ai_ai , 0xf1f8, 0x2090, { 20, 20, 8, 8}}, - {m68k_op_move_32_ai_pi , 0xf1f8, 0x2098, { 20, 20, 8, 8}}, - {m68k_op_move_32_ai_pd , 0xf1f8, 0x20a0, { 22, 22, 9, 9}}, - {m68k_op_move_32_ai_di , 0xf1f8, 0x20a8, { 24, 24, 9, 9}}, - {m68k_op_move_32_ai_ix , 0xf1f8, 0x20b0, { 26, 26, 11, 11}}, - {m68k_op_move_32_pi_d , 0xf1f8, 0x20c0, { 12, 12, 4, 4}}, - {m68k_op_move_32_pi_a , 0xf1f8, 0x20c8, { 12, 12, 4, 4}}, - {m68k_op_move_32_pi_ai , 0xf1f8, 0x20d0, { 20, 20, 8, 8}}, - {m68k_op_move_32_pi_pi , 0xf1f8, 0x20d8, { 20, 20, 8, 8}}, - {m68k_op_move_32_pi_pd , 0xf1f8, 0x20e0, { 22, 22, 9, 9}}, - {m68k_op_move_32_pi_di , 0xf1f8, 0x20e8, { 24, 24, 9, 9}}, - {m68k_op_move_32_pi_ix , 0xf1f8, 0x20f0, { 26, 26, 11, 11}}, - {m68k_op_move_32_pd_d , 0xf1f8, 0x2100, { 12, 14, 5, 5}}, - {m68k_op_move_32_pd_a , 0xf1f8, 0x2108, { 12, 14, 5, 5}}, - {m68k_op_move_32_pd_ai , 0xf1f8, 0x2110, { 20, 22, 9, 9}}, - {m68k_op_move_32_pd_pi , 0xf1f8, 0x2118, { 20, 22, 9, 9}}, - {m68k_op_move_32_pd_pd , 0xf1f8, 0x2120, { 22, 24, 10, 10}}, - {m68k_op_move_32_pd_di , 0xf1f8, 0x2128, { 24, 26, 10, 10}}, - {m68k_op_move_32_pd_ix , 0xf1f8, 0x2130, { 26, 28, 12, 12}}, - {m68k_op_move_32_di_d , 0xf1f8, 0x2140, { 16, 16, 5, 5}}, - {m68k_op_move_32_di_a , 0xf1f8, 0x2148, { 16, 16, 5, 5}}, - {m68k_op_move_32_di_ai , 0xf1f8, 0x2150, { 24, 24, 9, 9}}, - {m68k_op_move_32_di_pi , 0xf1f8, 0x2158, { 24, 24, 9, 9}}, - {m68k_op_move_32_di_pd , 0xf1f8, 0x2160, { 26, 26, 10, 10}}, - {m68k_op_move_32_di_di , 0xf1f8, 0x2168, { 28, 28, 10, 10}}, - {m68k_op_move_32_di_ix , 0xf1f8, 0x2170, { 30, 30, 12, 12}}, - {m68k_op_move_32_ix_d , 0xf1f8, 0x2180, { 18, 18, 7, 7}}, - {m68k_op_move_32_ix_a , 0xf1f8, 0x2188, { 18, 18, 7, 7}}, - {m68k_op_move_32_ix_ai , 0xf1f8, 0x2190, { 26, 26, 11, 11}}, - {m68k_op_move_32_ix_pi , 0xf1f8, 0x2198, { 26, 26, 11, 11}}, - {m68k_op_move_32_ix_pd , 0xf1f8, 0x21a0, { 28, 28, 12, 12}}, - {m68k_op_move_32_ix_di , 0xf1f8, 0x21a8, { 30, 30, 12, 12}}, - {m68k_op_move_32_ix_ix , 0xf1f8, 0x21b0, { 32, 32, 14, 14}}, - {m68k_op_move_16_d_d , 0xf1f8, 0x3000, { 4, 4, 2, 2}}, - {m68k_op_move_16_d_a , 0xf1f8, 0x3008, { 4, 4, 2, 2}}, - {m68k_op_move_16_d_ai , 0xf1f8, 0x3010, { 8, 8, 6, 6}}, - {m68k_op_move_16_d_pi , 0xf1f8, 0x3018, { 8, 8, 6, 6}}, - {m68k_op_move_16_d_pd , 0xf1f8, 0x3020, { 10, 10, 7, 7}}, - {m68k_op_move_16_d_di , 0xf1f8, 0x3028, { 12, 12, 7, 7}}, - {m68k_op_move_16_d_ix , 0xf1f8, 0x3030, { 14, 14, 9, 9}}, - {m68k_op_movea_16_d , 0xf1f8, 0x3040, { 4, 4, 2, 2}}, - {m68k_op_movea_16_a , 0xf1f8, 0x3048, { 4, 4, 2, 2}}, - {m68k_op_movea_16_ai , 0xf1f8, 0x3050, { 8, 8, 6, 6}}, - {m68k_op_movea_16_pi , 0xf1f8, 0x3058, { 8, 8, 6, 6}}, - {m68k_op_movea_16_pd , 0xf1f8, 0x3060, { 10, 10, 7, 7}}, - {m68k_op_movea_16_di , 0xf1f8, 0x3068, { 12, 12, 7, 7}}, - {m68k_op_movea_16_ix , 0xf1f8, 0x3070, { 14, 14, 9, 9}}, - {m68k_op_move_16_ai_d , 0xf1f8, 0x3080, { 8, 8, 4, 4}}, - {m68k_op_move_16_ai_a , 0xf1f8, 0x3088, { 8, 8, 4, 4}}, - {m68k_op_move_16_ai_ai , 0xf1f8, 0x3090, { 12, 12, 8, 8}}, - {m68k_op_move_16_ai_pi , 0xf1f8, 0x3098, { 12, 12, 8, 8}}, - {m68k_op_move_16_ai_pd , 0xf1f8, 0x30a0, { 14, 14, 9, 9}}, - {m68k_op_move_16_ai_di , 0xf1f8, 0x30a8, { 16, 16, 9, 9}}, - {m68k_op_move_16_ai_ix , 0xf1f8, 0x30b0, { 18, 18, 11, 11}}, - {m68k_op_move_16_pi_d , 0xf1f8, 0x30c0, { 8, 8, 4, 4}}, - {m68k_op_move_16_pi_a , 0xf1f8, 0x30c8, { 8, 8, 4, 4}}, - {m68k_op_move_16_pi_ai , 0xf1f8, 0x30d0, { 12, 12, 8, 8}}, - {m68k_op_move_16_pi_pi , 0xf1f8, 0x30d8, { 12, 12, 8, 8}}, - {m68k_op_move_16_pi_pd , 0xf1f8, 0x30e0, { 14, 14, 9, 9}}, - {m68k_op_move_16_pi_di , 0xf1f8, 0x30e8, { 16, 16, 9, 9}}, - {m68k_op_move_16_pi_ix , 0xf1f8, 0x30f0, { 18, 18, 11, 11}}, - {m68k_op_move_16_pd_d , 0xf1f8, 0x3100, { 8, 8, 5, 5}}, - {m68k_op_move_16_pd_a , 0xf1f8, 0x3108, { 8, 8, 5, 5}}, - {m68k_op_move_16_pd_ai , 0xf1f8, 0x3110, { 12, 12, 9, 9}}, - {m68k_op_move_16_pd_pi , 0xf1f8, 0x3118, { 12, 12, 9, 9}}, - {m68k_op_move_16_pd_pd , 0xf1f8, 0x3120, { 14, 14, 10, 10}}, - {m68k_op_move_16_pd_di , 0xf1f8, 0x3128, { 16, 16, 10, 10}}, - {m68k_op_move_16_pd_ix , 0xf1f8, 0x3130, { 18, 18, 12, 12}}, - {m68k_op_move_16_di_d , 0xf1f8, 0x3140, { 12, 12, 5, 5}}, - {m68k_op_move_16_di_a , 0xf1f8, 0x3148, { 12, 12, 5, 5}}, - {m68k_op_move_16_di_ai , 0xf1f8, 0x3150, { 16, 16, 9, 9}}, - {m68k_op_move_16_di_pi , 0xf1f8, 0x3158, { 16, 16, 9, 9}}, - {m68k_op_move_16_di_pd , 0xf1f8, 0x3160, { 18, 18, 10, 10}}, - {m68k_op_move_16_di_di , 0xf1f8, 0x3168, { 20, 20, 10, 10}}, - {m68k_op_move_16_di_ix , 0xf1f8, 0x3170, { 22, 22, 12, 12}}, - {m68k_op_move_16_ix_d , 0xf1f8, 0x3180, { 14, 14, 7, 7}}, - {m68k_op_move_16_ix_a , 0xf1f8, 0x3188, { 14, 14, 7, 7}}, - {m68k_op_move_16_ix_ai , 0xf1f8, 0x3190, { 18, 18, 11, 11}}, - {m68k_op_move_16_ix_pi , 0xf1f8, 0x3198, { 18, 18, 11, 11}}, - {m68k_op_move_16_ix_pd , 0xf1f8, 0x31a0, { 20, 20, 12, 12}}, - {m68k_op_move_16_ix_di , 0xf1f8, 0x31a8, { 22, 22, 12, 12}}, - {m68k_op_move_16_ix_ix , 0xf1f8, 0x31b0, { 24, 24, 14, 14}}, - {m68k_op_chk_32_d , 0xf1f8, 0x4100, { 0, 0, 8, 8}}, - {m68k_op_chk_32_ai , 0xf1f8, 0x4110, { 0, 0, 12, 12}}, - {m68k_op_chk_32_pi , 0xf1f8, 0x4118, { 0, 0, 12, 12}}, - {m68k_op_chk_32_pd , 0xf1f8, 0x4120, { 0, 0, 13, 13}}, - {m68k_op_chk_32_di , 0xf1f8, 0x4128, { 0, 0, 13, 13}}, - {m68k_op_chk_32_ix , 0xf1f8, 0x4130, { 0, 0, 15, 15}}, - {m68k_op_chk_16_d , 0xf1f8, 0x4180, { 10, 8, 8, 8}}, - {m68k_op_chk_16_ai , 0xf1f8, 0x4190, { 14, 12, 12, 12}}, - {m68k_op_chk_16_pi , 0xf1f8, 0x4198, { 14, 12, 12, 12}}, - {m68k_op_chk_16_pd , 0xf1f8, 0x41a0, { 16, 14, 13, 13}}, - {m68k_op_chk_16_di , 0xf1f8, 0x41a8, { 18, 16, 13, 13}}, - {m68k_op_chk_16_ix , 0xf1f8, 0x41b0, { 20, 18, 15, 15}}, - {m68k_op_lea_32_ai , 0xf1f8, 0x41d0, { 4, 4, 6, 6}}, - {m68k_op_lea_32_di , 0xf1f8, 0x41e8, { 8, 8, 7, 7}}, - {m68k_op_lea_32_ix , 0xf1f8, 0x41f0, { 12, 12, 9, 9}}, - {m68k_op_addq_8_d , 0xf1f8, 0x5000, { 4, 4, 2, 2}}, - {m68k_op_addq_8_ai , 0xf1f8, 0x5010, { 12, 12, 8, 8}}, - {m68k_op_addq_8_pi , 0xf1f8, 0x5018, { 12, 12, 8, 8}}, - {m68k_op_addq_8_pd , 0xf1f8, 0x5020, { 14, 14, 9, 9}}, - {m68k_op_addq_8_di , 0xf1f8, 0x5028, { 16, 16, 9, 9}}, - {m68k_op_addq_8_ix , 0xf1f8, 0x5030, { 18, 18, 11, 11}}, - {m68k_op_addq_16_d , 0xf1f8, 0x5040, { 4, 4, 2, 2}}, - {m68k_op_addq_16_a , 0xf1f8, 0x5048, { 4, 4, 2, 2}}, - {m68k_op_addq_16_ai , 0xf1f8, 0x5050, { 12, 12, 8, 8}}, - {m68k_op_addq_16_pi , 0xf1f8, 0x5058, { 12, 12, 8, 8}}, - {m68k_op_addq_16_pd , 0xf1f8, 0x5060, { 14, 14, 9, 9}}, - {m68k_op_addq_16_di , 0xf1f8, 0x5068, { 16, 16, 9, 9}}, - {m68k_op_addq_16_ix , 0xf1f8, 0x5070, { 18, 18, 11, 11}}, - {m68k_op_addq_32_d , 0xf1f8, 0x5080, { 8, 8, 2, 2}}, - {m68k_op_addq_32_a , 0xf1f8, 0x5088, { 8, 8, 2, 2}}, - {m68k_op_addq_32_ai , 0xf1f8, 0x5090, { 20, 20, 8, 8}}, - {m68k_op_addq_32_pi , 0xf1f8, 0x5098, { 20, 20, 8, 8}}, - {m68k_op_addq_32_pd , 0xf1f8, 0x50a0, { 22, 22, 9, 9}}, - {m68k_op_addq_32_di , 0xf1f8, 0x50a8, { 24, 24, 9, 9}}, - {m68k_op_addq_32_ix , 0xf1f8, 0x50b0, { 26, 26, 11, 11}}, - {m68k_op_subq_8_d , 0xf1f8, 0x5100, { 4, 4, 2, 2}}, - {m68k_op_subq_8_ai , 0xf1f8, 0x5110, { 12, 12, 8, 8}}, - {m68k_op_subq_8_pi , 0xf1f8, 0x5118, { 12, 12, 8, 8}}, - {m68k_op_subq_8_pd , 0xf1f8, 0x5120, { 14, 14, 9, 9}}, - {m68k_op_subq_8_di , 0xf1f8, 0x5128, { 16, 16, 9, 9}}, - {m68k_op_subq_8_ix , 0xf1f8, 0x5130, { 18, 18, 11, 11}}, - {m68k_op_subq_16_d , 0xf1f8, 0x5140, { 4, 4, 2, 2}}, - {m68k_op_subq_16_a , 0xf1f8, 0x5148, { 8, 4, 2, 2}}, - {m68k_op_subq_16_ai , 0xf1f8, 0x5150, { 12, 12, 8, 8}}, - {m68k_op_subq_16_pi , 0xf1f8, 0x5158, { 12, 12, 8, 8}}, - {m68k_op_subq_16_pd , 0xf1f8, 0x5160, { 14, 14, 9, 9}}, - {m68k_op_subq_16_di , 0xf1f8, 0x5168, { 16, 16, 9, 9}}, - {m68k_op_subq_16_ix , 0xf1f8, 0x5170, { 18, 18, 11, 11}}, - {m68k_op_subq_32_d , 0xf1f8, 0x5180, { 8, 8, 2, 2}}, - {m68k_op_subq_32_a , 0xf1f8, 0x5188, { 8, 8, 2, 2}}, - {m68k_op_subq_32_ai , 0xf1f8, 0x5190, { 20, 20, 8, 8}}, - {m68k_op_subq_32_pi , 0xf1f8, 0x5198, { 20, 20, 8, 8}}, - {m68k_op_subq_32_pd , 0xf1f8, 0x51a0, { 22, 22, 9, 9}}, - {m68k_op_subq_32_di , 0xf1f8, 0x51a8, { 24, 24, 9, 9}}, - {m68k_op_subq_32_ix , 0xf1f8, 0x51b0, { 26, 26, 11, 11}}, - {m68k_op_or_8_er_d , 0xf1f8, 0x8000, { 4, 4, 2, 2}}, - {m68k_op_or_8_er_ai , 0xf1f8, 0x8010, { 8, 8, 6, 6}}, - {m68k_op_or_8_er_pi , 0xf1f8, 0x8018, { 8, 8, 6, 6}}, - {m68k_op_or_8_er_pd , 0xf1f8, 0x8020, { 10, 10, 7, 7}}, - {m68k_op_or_8_er_di , 0xf1f8, 0x8028, { 12, 12, 7, 7}}, - {m68k_op_or_8_er_ix , 0xf1f8, 0x8030, { 14, 14, 9, 9}}, - {m68k_op_or_16_er_d , 0xf1f8, 0x8040, { 4, 4, 2, 2}}, - {m68k_op_or_16_er_ai , 0xf1f8, 0x8050, { 8, 8, 6, 6}}, - {m68k_op_or_16_er_pi , 0xf1f8, 0x8058, { 8, 8, 6, 6}}, - {m68k_op_or_16_er_pd , 0xf1f8, 0x8060, { 10, 10, 7, 7}}, - {m68k_op_or_16_er_di , 0xf1f8, 0x8068, { 12, 12, 7, 7}}, - {m68k_op_or_16_er_ix , 0xf1f8, 0x8070, { 14, 14, 9, 9}}, - {m68k_op_or_32_er_d , 0xf1f8, 0x8080, { 8, 6, 2, 2}}, - {m68k_op_or_32_er_ai , 0xf1f8, 0x8090, { 14, 14, 6, 6}}, - {m68k_op_or_32_er_pi , 0xf1f8, 0x8098, { 14, 14, 6, 6}}, - {m68k_op_or_32_er_pd , 0xf1f8, 0x80a0, { 16, 16, 7, 7}}, - {m68k_op_or_32_er_di , 0xf1f8, 0x80a8, { 18, 18, 7, 7}}, - {m68k_op_or_32_er_ix , 0xf1f8, 0x80b0, { 20, 20, 9, 9}}, - {m68k_op_divu_16_d , 0xf1f8, 0x80c0, {140, 108, 44, 44}}, - {m68k_op_divu_16_ai , 0xf1f8, 0x80d0, {144, 112, 48, 48}}, - {m68k_op_divu_16_pi , 0xf1f8, 0x80d8, {144, 112, 48, 48}}, - {m68k_op_divu_16_pd , 0xf1f8, 0x80e0, {146, 114, 49, 49}}, - {m68k_op_divu_16_di , 0xf1f8, 0x80e8, {148, 116, 49, 49}}, - {m68k_op_divu_16_ix , 0xf1f8, 0x80f0, {150, 118, 51, 51}}, - {m68k_op_sbcd_8_rr , 0xf1f8, 0x8100, { 6, 6, 4, 4}}, - {m68k_op_sbcd_8_mm , 0xf1f8, 0x8108, { 18, 18, 16, 16}}, - {m68k_op_or_8_re_ai , 0xf1f8, 0x8110, { 12, 12, 8, 8}}, - {m68k_op_or_8_re_pi , 0xf1f8, 0x8118, { 12, 12, 8, 8}}, - {m68k_op_or_8_re_pd , 0xf1f8, 0x8120, { 14, 14, 9, 9}}, - {m68k_op_or_8_re_di , 0xf1f8, 0x8128, { 16, 16, 9, 9}}, - {m68k_op_or_8_re_ix , 0xf1f8, 0x8130, { 18, 18, 11, 11}}, - {m68k_op_pack_16_rr , 0xf1f8, 0x8140, { 0, 0, 6, 6}}, - {m68k_op_pack_16_mm , 0xf1f8, 0x8148, { 0, 0, 13, 13}}, - {m68k_op_or_16_re_ai , 0xf1f8, 0x8150, { 12, 12, 8, 8}}, - {m68k_op_or_16_re_pi , 0xf1f8, 0x8158, { 12, 12, 8, 8}}, - {m68k_op_or_16_re_pd , 0xf1f8, 0x8160, { 14, 14, 9, 9}}, - {m68k_op_or_16_re_di , 0xf1f8, 0x8168, { 16, 16, 9, 9}}, - {m68k_op_or_16_re_ix , 0xf1f8, 0x8170, { 18, 18, 11, 11}}, - {m68k_op_unpk_16_rr , 0xf1f8, 0x8180, { 0, 0, 8, 8}}, - {m68k_op_unpk_16_mm , 0xf1f8, 0x8188, { 0, 0, 13, 13}}, - {m68k_op_or_32_re_ai , 0xf1f8, 0x8190, { 20, 20, 8, 8}}, - {m68k_op_or_32_re_pi , 0xf1f8, 0x8198, { 20, 20, 8, 8}}, - {m68k_op_or_32_re_pd , 0xf1f8, 0x81a0, { 22, 22, 9, 9}}, - {m68k_op_or_32_re_di , 0xf1f8, 0x81a8, { 24, 24, 9, 9}}, - {m68k_op_or_32_re_ix , 0xf1f8, 0x81b0, { 26, 26, 11, 11}}, - {m68k_op_divs_16_d , 0xf1f8, 0x81c0, {158, 122, 56, 56}}, - {m68k_op_divs_16_ai , 0xf1f8, 0x81d0, {162, 126, 60, 60}}, - {m68k_op_divs_16_pi , 0xf1f8, 0x81d8, {162, 126, 60, 60}}, - {m68k_op_divs_16_pd , 0xf1f8, 0x81e0, {164, 128, 61, 61}}, - {m68k_op_divs_16_di , 0xf1f8, 0x81e8, {166, 130, 61, 61}}, - {m68k_op_divs_16_ix , 0xf1f8, 0x81f0, {168, 132, 63, 63}}, - {m68k_op_sub_8_er_d , 0xf1f8, 0x9000, { 4, 4, 2, 2}}, - {m68k_op_sub_8_er_ai , 0xf1f8, 0x9010, { 8, 8, 6, 6}}, - {m68k_op_sub_8_er_pi , 0xf1f8, 0x9018, { 8, 8, 6, 6}}, - {m68k_op_sub_8_er_pd , 0xf1f8, 0x9020, { 10, 10, 7, 7}}, - {m68k_op_sub_8_er_di , 0xf1f8, 0x9028, { 12, 12, 7, 7}}, - {m68k_op_sub_8_er_ix , 0xf1f8, 0x9030, { 14, 14, 9, 9}}, - {m68k_op_sub_16_er_d , 0xf1f8, 0x9040, { 4, 4, 2, 2}}, - {m68k_op_sub_16_er_a , 0xf1f8, 0x9048, { 4, 4, 2, 2}}, - {m68k_op_sub_16_er_ai , 0xf1f8, 0x9050, { 8, 8, 6, 6}}, - {m68k_op_sub_16_er_pi , 0xf1f8, 0x9058, { 8, 8, 6, 6}}, - {m68k_op_sub_16_er_pd , 0xf1f8, 0x9060, { 10, 10, 7, 7}}, - {m68k_op_sub_16_er_di , 0xf1f8, 0x9068, { 12, 12, 7, 7}}, - {m68k_op_sub_16_er_ix , 0xf1f8, 0x9070, { 14, 14, 9, 9}}, - {m68k_op_sub_32_er_d , 0xf1f8, 0x9080, { 8, 6, 2, 2}}, - {m68k_op_sub_32_er_a , 0xf1f8, 0x9088, { 8, 6, 2, 2}}, - {m68k_op_sub_32_er_ai , 0xf1f8, 0x9090, { 14, 14, 6, 6}}, - {m68k_op_sub_32_er_pi , 0xf1f8, 0x9098, { 14, 14, 6, 6}}, - {m68k_op_sub_32_er_pd , 0xf1f8, 0x90a0, { 16, 16, 7, 7}}, - {m68k_op_sub_32_er_di , 0xf1f8, 0x90a8, { 18, 18, 7, 7}}, - {m68k_op_sub_32_er_ix , 0xf1f8, 0x90b0, { 20, 20, 9, 9}}, - {m68k_op_suba_16_d , 0xf1f8, 0x90c0, { 8, 8, 2, 2}}, - {m68k_op_suba_16_a , 0xf1f8, 0x90c8, { 8, 8, 2, 2}}, - {m68k_op_suba_16_ai , 0xf1f8, 0x90d0, { 12, 12, 6, 6}}, - {m68k_op_suba_16_pi , 0xf1f8, 0x90d8, { 12, 12, 6, 6}}, - {m68k_op_suba_16_pd , 0xf1f8, 0x90e0, { 14, 14, 7, 7}}, - {m68k_op_suba_16_di , 0xf1f8, 0x90e8, { 16, 16, 7, 7}}, - {m68k_op_suba_16_ix , 0xf1f8, 0x90f0, { 18, 18, 9, 9}}, - {m68k_op_subx_8_rr , 0xf1f8, 0x9100, { 4, 4, 2, 2}}, - {m68k_op_subx_8_mm , 0xf1f8, 0x9108, { 18, 18, 12, 12}}, - {m68k_op_sub_8_re_ai , 0xf1f8, 0x9110, { 12, 12, 8, 8}}, - {m68k_op_sub_8_re_pi , 0xf1f8, 0x9118, { 12, 12, 8, 8}}, - {m68k_op_sub_8_re_pd , 0xf1f8, 0x9120, { 14, 14, 9, 9}}, - {m68k_op_sub_8_re_di , 0xf1f8, 0x9128, { 16, 16, 9, 9}}, - {m68k_op_sub_8_re_ix , 0xf1f8, 0x9130, { 18, 18, 11, 11}}, - {m68k_op_subx_16_rr , 0xf1f8, 0x9140, { 4, 4, 2, 2}}, - {m68k_op_subx_16_mm , 0xf1f8, 0x9148, { 18, 18, 12, 12}}, - {m68k_op_sub_16_re_ai , 0xf1f8, 0x9150, { 12, 12, 8, 8}}, - {m68k_op_sub_16_re_pi , 0xf1f8, 0x9158, { 12, 12, 8, 8}}, - {m68k_op_sub_16_re_pd , 0xf1f8, 0x9160, { 14, 14, 9, 9}}, - {m68k_op_sub_16_re_di , 0xf1f8, 0x9168, { 16, 16, 9, 9}}, - {m68k_op_sub_16_re_ix , 0xf1f8, 0x9170, { 18, 18, 11, 11}}, - {m68k_op_subx_32_rr , 0xf1f8, 0x9180, { 8, 6, 2, 2}}, - {m68k_op_subx_32_mm , 0xf1f8, 0x9188, { 30, 30, 12, 12}}, - {m68k_op_sub_32_re_ai , 0xf1f8, 0x9190, { 20, 20, 8, 8}}, - {m68k_op_sub_32_re_pi , 0xf1f8, 0x9198, { 20, 20, 8, 8}}, - {m68k_op_sub_32_re_pd , 0xf1f8, 0x91a0, { 22, 22, 9, 9}}, - {m68k_op_sub_32_re_di , 0xf1f8, 0x91a8, { 24, 24, 9, 9}}, - {m68k_op_sub_32_re_ix , 0xf1f8, 0x91b0, { 26, 26, 11, 11}}, - {m68k_op_suba_32_d , 0xf1f8, 0x91c0, { 8, 6, 2, 2}}, - {m68k_op_suba_32_a , 0xf1f8, 0x91c8, { 8, 6, 2, 2}}, - {m68k_op_suba_32_ai , 0xf1f8, 0x91d0, { 14, 14, 6, 6}}, - {m68k_op_suba_32_pi , 0xf1f8, 0x91d8, { 14, 14, 6, 6}}, - {m68k_op_suba_32_pd , 0xf1f8, 0x91e0, { 16, 16, 7, 7}}, - {m68k_op_suba_32_di , 0xf1f8, 0x91e8, { 18, 18, 7, 7}}, - {m68k_op_suba_32_ix , 0xf1f8, 0x91f0, { 20, 20, 9, 9}}, - {m68k_op_cmp_8_d , 0xf1f8, 0xb000, { 4, 4, 2, 2}}, - {m68k_op_cmp_8_ai , 0xf1f8, 0xb010, { 8, 8, 6, 6}}, - {m68k_op_cmp_8_pi , 0xf1f8, 0xb018, { 8, 8, 6, 6}}, - {m68k_op_cmp_8_pd , 0xf1f8, 0xb020, { 10, 10, 7, 7}}, - {m68k_op_cmp_8_di , 0xf1f8, 0xb028, { 12, 12, 7, 7}}, - {m68k_op_cmp_8_ix , 0xf1f8, 0xb030, { 14, 14, 9, 9}}, - {m68k_op_cmp_16_d , 0xf1f8, 0xb040, { 4, 4, 2, 2}}, - {m68k_op_cmp_16_a , 0xf1f8, 0xb048, { 4, 4, 2, 2}}, - {m68k_op_cmp_16_ai , 0xf1f8, 0xb050, { 8, 8, 6, 6}}, - {m68k_op_cmp_16_pi , 0xf1f8, 0xb058, { 8, 8, 6, 6}}, - {m68k_op_cmp_16_pd , 0xf1f8, 0xb060, { 10, 10, 7, 7}}, - {m68k_op_cmp_16_di , 0xf1f8, 0xb068, { 12, 12, 7, 7}}, - {m68k_op_cmp_16_ix , 0xf1f8, 0xb070, { 14, 14, 9, 9}}, - {m68k_op_cmp_32_d , 0xf1f8, 0xb080, { 6, 6, 2, 2}}, - {m68k_op_cmp_32_a , 0xf1f8, 0xb088, { 6, 6, 2, 2}}, - {m68k_op_cmp_32_ai , 0xf1f8, 0xb090, { 14, 14, 6, 6}}, - {m68k_op_cmp_32_pi , 0xf1f8, 0xb098, { 14, 14, 6, 6}}, - {m68k_op_cmp_32_pd , 0xf1f8, 0xb0a0, { 16, 16, 7, 7}}, - {m68k_op_cmp_32_di , 0xf1f8, 0xb0a8, { 18, 18, 7, 7}}, - {m68k_op_cmp_32_ix , 0xf1f8, 0xb0b0, { 20, 20, 9, 9}}, - {m68k_op_cmpa_16_d , 0xf1f8, 0xb0c0, { 6, 6, 4, 4}}, - {m68k_op_cmpa_16_a , 0xf1f8, 0xb0c8, { 6, 6, 4, 4}}, - {m68k_op_cmpa_16_ai , 0xf1f8, 0xb0d0, { 10, 10, 8, 8}}, - {m68k_op_cmpa_16_pi , 0xf1f8, 0xb0d8, { 10, 10, 8, 8}}, - {m68k_op_cmpa_16_pd , 0xf1f8, 0xb0e0, { 12, 12, 9, 9}}, - {m68k_op_cmpa_16_di , 0xf1f8, 0xb0e8, { 14, 14, 9, 9}}, - {m68k_op_cmpa_16_ix , 0xf1f8, 0xb0f0, { 16, 16, 11, 11}}, - {m68k_op_eor_8_d , 0xf1f8, 0xb100, { 4, 4, 2, 2}}, - {m68k_op_cmpm_8 , 0xf1f8, 0xb108, { 12, 12, 9, 9}}, - {m68k_op_eor_8_ai , 0xf1f8, 0xb110, { 12, 12, 8, 8}}, - {m68k_op_eor_8_pi , 0xf1f8, 0xb118, { 12, 12, 8, 8}}, - {m68k_op_eor_8_pd , 0xf1f8, 0xb120, { 14, 14, 9, 9}}, - {m68k_op_eor_8_di , 0xf1f8, 0xb128, { 16, 16, 9, 9}}, - {m68k_op_eor_8_ix , 0xf1f8, 0xb130, { 18, 18, 11, 11}}, - {m68k_op_eor_16_d , 0xf1f8, 0xb140, { 4, 4, 2, 2}}, - {m68k_op_cmpm_16 , 0xf1f8, 0xb148, { 12, 12, 9, 9}}, - {m68k_op_eor_16_ai , 0xf1f8, 0xb150, { 12, 12, 8, 8}}, - {m68k_op_eor_16_pi , 0xf1f8, 0xb158, { 12, 12, 8, 8}}, - {m68k_op_eor_16_pd , 0xf1f8, 0xb160, { 14, 14, 9, 9}}, - {m68k_op_eor_16_di , 0xf1f8, 0xb168, { 16, 16, 9, 9}}, - {m68k_op_eor_16_ix , 0xf1f8, 0xb170, { 18, 18, 11, 11}}, - {m68k_op_eor_32_d , 0xf1f8, 0xb180, { 8, 6, 2, 2}}, - {m68k_op_cmpm_32 , 0xf1f8, 0xb188, { 20, 20, 9, 9}}, - {m68k_op_eor_32_ai , 0xf1f8, 0xb190, { 20, 20, 8, 8}}, - {m68k_op_eor_32_pi , 0xf1f8, 0xb198, { 20, 20, 8, 8}}, - {m68k_op_eor_32_pd , 0xf1f8, 0xb1a0, { 22, 22, 9, 9}}, - {m68k_op_eor_32_di , 0xf1f8, 0xb1a8, { 24, 24, 9, 9}}, - {m68k_op_eor_32_ix , 0xf1f8, 0xb1b0, { 26, 26, 11, 11}}, - {m68k_op_cmpa_32_d , 0xf1f8, 0xb1c0, { 6, 6, 4, 4}}, - {m68k_op_cmpa_32_a , 0xf1f8, 0xb1c8, { 6, 6, 4, 4}}, - {m68k_op_cmpa_32_ai , 0xf1f8, 0xb1d0, { 14, 14, 8, 8}}, - {m68k_op_cmpa_32_pi , 0xf1f8, 0xb1d8, { 14, 14, 8, 8}}, - {m68k_op_cmpa_32_pd , 0xf1f8, 0xb1e0, { 16, 16, 9, 9}}, - {m68k_op_cmpa_32_di , 0xf1f8, 0xb1e8, { 18, 18, 9, 9}}, - {m68k_op_cmpa_32_ix , 0xf1f8, 0xb1f0, { 20, 20, 11, 11}}, - {m68k_op_and_8_er_d , 0xf1f8, 0xc000, { 4, 4, 2, 2}}, - {m68k_op_and_8_er_ai , 0xf1f8, 0xc010, { 8, 8, 6, 6}}, - {m68k_op_and_8_er_pi , 0xf1f8, 0xc018, { 8, 8, 6, 6}}, - {m68k_op_and_8_er_pd , 0xf1f8, 0xc020, { 10, 10, 7, 7}}, - {m68k_op_and_8_er_di , 0xf1f8, 0xc028, { 12, 12, 7, 7}}, - {m68k_op_and_8_er_ix , 0xf1f8, 0xc030, { 14, 14, 9, 9}}, - {m68k_op_and_16_er_d , 0xf1f8, 0xc040, { 4, 4, 2, 2}}, - {m68k_op_and_16_er_ai , 0xf1f8, 0xc050, { 8, 8, 6, 6}}, - {m68k_op_and_16_er_pi , 0xf1f8, 0xc058, { 8, 8, 6, 6}}, - {m68k_op_and_16_er_pd , 0xf1f8, 0xc060, { 10, 10, 7, 7}}, - {m68k_op_and_16_er_di , 0xf1f8, 0xc068, { 12, 12, 7, 7}}, - {m68k_op_and_16_er_ix , 0xf1f8, 0xc070, { 14, 14, 9, 9}}, - {m68k_op_and_32_er_d , 0xf1f8, 0xc080, { 8, 6, 2, 2}}, - {m68k_op_and_32_er_ai , 0xf1f8, 0xc090, { 14, 14, 6, 6}}, - {m68k_op_and_32_er_pi , 0xf1f8, 0xc098, { 14, 14, 6, 6}}, - {m68k_op_and_32_er_pd , 0xf1f8, 0xc0a0, { 16, 16, 7, 7}}, - {m68k_op_and_32_er_di , 0xf1f8, 0xc0a8, { 18, 18, 7, 7}}, - {m68k_op_and_32_er_ix , 0xf1f8, 0xc0b0, { 20, 20, 9, 9}}, - {m68k_op_mulu_16_d , 0xf1f8, 0xc0c0, { 54, 30, 27, 27}}, - {m68k_op_mulu_16_ai , 0xf1f8, 0xc0d0, { 58, 34, 31, 31}}, - {m68k_op_mulu_16_pi , 0xf1f8, 0xc0d8, { 58, 34, 31, 31}}, - {m68k_op_mulu_16_pd , 0xf1f8, 0xc0e0, { 60, 36, 32, 32}}, - {m68k_op_mulu_16_di , 0xf1f8, 0xc0e8, { 62, 38, 32, 32}}, - {m68k_op_mulu_16_ix , 0xf1f8, 0xc0f0, { 64, 40, 34, 34}}, - {m68k_op_abcd_8_rr , 0xf1f8, 0xc100, { 6, 6, 4, 4}}, - {m68k_op_abcd_8_mm , 0xf1f8, 0xc108, { 18, 18, 16, 16}}, - {m68k_op_and_8_re_ai , 0xf1f8, 0xc110, { 12, 12, 8, 8}}, - {m68k_op_and_8_re_pi , 0xf1f8, 0xc118, { 12, 12, 8, 8}}, - {m68k_op_and_8_re_pd , 0xf1f8, 0xc120, { 14, 14, 9, 9}}, - {m68k_op_and_8_re_di , 0xf1f8, 0xc128, { 16, 16, 9, 9}}, - {m68k_op_and_8_re_ix , 0xf1f8, 0xc130, { 18, 18, 11, 11}}, - {m68k_op_exg_32_dd , 0xf1f8, 0xc140, { 6, 6, 2, 2}}, - {m68k_op_exg_32_aa , 0xf1f8, 0xc148, { 6, 6, 2, 2}}, - {m68k_op_and_16_re_ai , 0xf1f8, 0xc150, { 12, 12, 8, 8}}, - {m68k_op_and_16_re_pi , 0xf1f8, 0xc158, { 12, 12, 8, 8}}, - {m68k_op_and_16_re_pd , 0xf1f8, 0xc160, { 14, 14, 9, 9}}, - {m68k_op_and_16_re_di , 0xf1f8, 0xc168, { 16, 16, 9, 9}}, - {m68k_op_and_16_re_ix , 0xf1f8, 0xc170, { 18, 18, 11, 11}}, - {m68k_op_exg_32_da , 0xf1f8, 0xc188, { 6, 6, 2, 2}}, - {m68k_op_and_32_re_ai , 0xf1f8, 0xc190, { 20, 20, 8, 8}}, - {m68k_op_and_32_re_pi , 0xf1f8, 0xc198, { 20, 20, 8, 8}}, - {m68k_op_and_32_re_pd , 0xf1f8, 0xc1a0, { 22, 22, 9, 9}}, - {m68k_op_and_32_re_di , 0xf1f8, 0xc1a8, { 24, 24, 9, 9}}, - {m68k_op_and_32_re_ix , 0xf1f8, 0xc1b0, { 26, 26, 11, 11}}, - {m68k_op_muls_16_d , 0xf1f8, 0xc1c0, { 54, 32, 27, 27}}, - {m68k_op_muls_16_ai , 0xf1f8, 0xc1d0, { 58, 36, 31, 31}}, - {m68k_op_muls_16_pi , 0xf1f8, 0xc1d8, { 58, 36, 31, 31}}, - {m68k_op_muls_16_pd , 0xf1f8, 0xc1e0, { 60, 38, 32, 32}}, - {m68k_op_muls_16_di , 0xf1f8, 0xc1e8, { 62, 40, 32, 32}}, - {m68k_op_muls_16_ix , 0xf1f8, 0xc1f0, { 64, 42, 34, 34}}, - {m68k_op_add_8_er_d , 0xf1f8, 0xd000, { 4, 4, 2, 2}}, - {m68k_op_add_8_er_ai , 0xf1f8, 0xd010, { 8, 8, 6, 6}}, - {m68k_op_add_8_er_pi , 0xf1f8, 0xd018, { 8, 8, 6, 6}}, - {m68k_op_add_8_er_pd , 0xf1f8, 0xd020, { 10, 10, 7, 7}}, - {m68k_op_add_8_er_di , 0xf1f8, 0xd028, { 12, 12, 7, 7}}, - {m68k_op_add_8_er_ix , 0xf1f8, 0xd030, { 14, 14, 9, 9}}, - {m68k_op_add_16_er_d , 0xf1f8, 0xd040, { 4, 4, 2, 2}}, - {m68k_op_add_16_er_a , 0xf1f8, 0xd048, { 4, 4, 2, 2}}, - {m68k_op_add_16_er_ai , 0xf1f8, 0xd050, { 8, 8, 6, 6}}, - {m68k_op_add_16_er_pi , 0xf1f8, 0xd058, { 8, 8, 6, 6}}, - {m68k_op_add_16_er_pd , 0xf1f8, 0xd060, { 10, 10, 7, 7}}, - {m68k_op_add_16_er_di , 0xf1f8, 0xd068, { 12, 12, 7, 7}}, - {m68k_op_add_16_er_ix , 0xf1f8, 0xd070, { 14, 14, 9, 9}}, - {m68k_op_add_32_er_d , 0xf1f8, 0xd080, { 8, 6, 2, 2}}, - {m68k_op_add_32_er_a , 0xf1f8, 0xd088, { 8, 6, 2, 2}}, - {m68k_op_add_32_er_ai , 0xf1f8, 0xd090, { 14, 14, 6, 6}}, - {m68k_op_add_32_er_pi , 0xf1f8, 0xd098, { 14, 14, 6, 6}}, - {m68k_op_add_32_er_pd , 0xf1f8, 0xd0a0, { 16, 16, 7, 7}}, - {m68k_op_add_32_er_di , 0xf1f8, 0xd0a8, { 18, 18, 7, 7}}, - {m68k_op_add_32_er_ix , 0xf1f8, 0xd0b0, { 20, 20, 9, 9}}, - {m68k_op_adda_16_d , 0xf1f8, 0xd0c0, { 8, 8, 2, 2}}, - {m68k_op_adda_16_a , 0xf1f8, 0xd0c8, { 8, 8, 2, 2}}, - {m68k_op_adda_16_ai , 0xf1f8, 0xd0d0, { 12, 12, 6, 6}}, - {m68k_op_adda_16_pi , 0xf1f8, 0xd0d8, { 12, 12, 6, 6}}, - {m68k_op_adda_16_pd , 0xf1f8, 0xd0e0, { 14, 14, 7, 7}}, - {m68k_op_adda_16_di , 0xf1f8, 0xd0e8, { 16, 16, 7, 7}}, - {m68k_op_adda_16_ix , 0xf1f8, 0xd0f0, { 18, 18, 9, 9}}, - {m68k_op_addx_8_rr , 0xf1f8, 0xd100, { 4, 4, 2, 2}}, - {m68k_op_addx_8_mm , 0xf1f8, 0xd108, { 18, 18, 12, 12}}, - {m68k_op_add_8_re_ai , 0xf1f8, 0xd110, { 12, 12, 8, 8}}, - {m68k_op_add_8_re_pi , 0xf1f8, 0xd118, { 12, 12, 8, 8}}, - {m68k_op_add_8_re_pd , 0xf1f8, 0xd120, { 14, 14, 9, 9}}, - {m68k_op_add_8_re_di , 0xf1f8, 0xd128, { 16, 16, 9, 9}}, - {m68k_op_add_8_re_ix , 0xf1f8, 0xd130, { 18, 18, 11, 11}}, - {m68k_op_addx_16_rr , 0xf1f8, 0xd140, { 4, 4, 2, 2}}, - {m68k_op_addx_16_mm , 0xf1f8, 0xd148, { 18, 18, 12, 12}}, - {m68k_op_add_16_re_ai , 0xf1f8, 0xd150, { 12, 12, 8, 8}}, - {m68k_op_add_16_re_pi , 0xf1f8, 0xd158, { 12, 12, 8, 8}}, - {m68k_op_add_16_re_pd , 0xf1f8, 0xd160, { 14, 14, 9, 9}}, - {m68k_op_add_16_re_di , 0xf1f8, 0xd168, { 16, 16, 9, 9}}, - {m68k_op_add_16_re_ix , 0xf1f8, 0xd170, { 18, 18, 11, 11}}, - {m68k_op_addx_32_rr , 0xf1f8, 0xd180, { 8, 6, 2, 2}}, - {m68k_op_addx_32_mm , 0xf1f8, 0xd188, { 30, 30, 12, 12}}, - {m68k_op_add_32_re_ai , 0xf1f8, 0xd190, { 20, 20, 8, 8}}, - {m68k_op_add_32_re_pi , 0xf1f8, 0xd198, { 20, 20, 8, 8}}, - {m68k_op_add_32_re_pd , 0xf1f8, 0xd1a0, { 22, 22, 9, 9}}, - {m68k_op_add_32_re_di , 0xf1f8, 0xd1a8, { 24, 24, 9, 9}}, - {m68k_op_add_32_re_ix , 0xf1f8, 0xd1b0, { 26, 26, 11, 11}}, - {m68k_op_adda_32_d , 0xf1f8, 0xd1c0, { 8, 6, 2, 2}}, - {m68k_op_adda_32_a , 0xf1f8, 0xd1c8, { 8, 6, 2, 2}}, - {m68k_op_adda_32_ai , 0xf1f8, 0xd1d0, { 14, 14, 6, 6}}, - {m68k_op_adda_32_pi , 0xf1f8, 0xd1d8, { 14, 14, 6, 6}}, - {m68k_op_adda_32_pd , 0xf1f8, 0xd1e0, { 16, 16, 7, 7}}, - {m68k_op_adda_32_di , 0xf1f8, 0xd1e8, { 18, 18, 7, 7}}, - {m68k_op_adda_32_ix , 0xf1f8, 0xd1f0, { 20, 20, 9, 9}}, - {m68k_op_asr_8_s , 0xf1f8, 0xe000, { 6, 6, 6, 6}}, - {m68k_op_lsr_8_s , 0xf1f8, 0xe008, { 6, 6, 4, 4}}, - {m68k_op_roxr_8_s , 0xf1f8, 0xe010, { 6, 6, 12, 12}}, - {m68k_op_ror_8_s , 0xf1f8, 0xe018, { 6, 6, 8, 8}}, - {m68k_op_asr_8_r , 0xf1f8, 0xe020, { 6, 6, 6, 6}}, - {m68k_op_lsr_8_r , 0xf1f8, 0xe028, { 6, 6, 6, 6}}, - {m68k_op_roxr_8_r , 0xf1f8, 0xe030, { 6, 6, 12, 12}}, - {m68k_op_ror_8_r , 0xf1f8, 0xe038, { 6, 6, 8, 8}}, - {m68k_op_asr_16_s , 0xf1f8, 0xe040, { 6, 6, 6, 6}}, - {m68k_op_lsr_16_s , 0xf1f8, 0xe048, { 6, 6, 4, 4}}, - {m68k_op_roxr_16_s , 0xf1f8, 0xe050, { 6, 6, 12, 12}}, - {m68k_op_ror_16_s , 0xf1f8, 0xe058, { 6, 6, 8, 8}}, - {m68k_op_asr_16_r , 0xf1f8, 0xe060, { 6, 6, 6, 6}}, - {m68k_op_lsr_16_r , 0xf1f8, 0xe068, { 6, 6, 6, 6}}, - {m68k_op_roxr_16_r , 0xf1f8, 0xe070, { 6, 6, 12, 12}}, - {m68k_op_ror_16_r , 0xf1f8, 0xe078, { 6, 6, 8, 8}}, - {m68k_op_asr_32_s , 0xf1f8, 0xe080, { 8, 8, 6, 6}}, - {m68k_op_lsr_32_s , 0xf1f8, 0xe088, { 8, 8, 4, 4}}, - {m68k_op_roxr_32_s , 0xf1f8, 0xe090, { 8, 8, 12, 12}}, - {m68k_op_ror_32_s , 0xf1f8, 0xe098, { 8, 8, 8, 8}}, - {m68k_op_asr_32_r , 0xf1f8, 0xe0a0, { 8, 8, 6, 6}}, - {m68k_op_lsr_32_r , 0xf1f8, 0xe0a8, { 8, 8, 6, 6}}, - {m68k_op_roxr_32_r , 0xf1f8, 0xe0b0, { 8, 8, 12, 12}}, - {m68k_op_ror_32_r , 0xf1f8, 0xe0b8, { 8, 8, 8, 8}}, - {m68k_op_asl_8_s , 0xf1f8, 0xe100, { 6, 6, 8, 8}}, - {m68k_op_lsl_8_s , 0xf1f8, 0xe108, { 6, 6, 4, 4}}, - {m68k_op_roxl_8_s , 0xf1f8, 0xe110, { 6, 6, 12, 12}}, - {m68k_op_rol_8_s , 0xf1f8, 0xe118, { 6, 6, 8, 8}}, - {m68k_op_asl_8_r , 0xf1f8, 0xe120, { 6, 6, 8, 8}}, - {m68k_op_lsl_8_r , 0xf1f8, 0xe128, { 6, 6, 6, 6}}, - {m68k_op_roxl_8_r , 0xf1f8, 0xe130, { 6, 6, 12, 12}}, - {m68k_op_rol_8_r , 0xf1f8, 0xe138, { 6, 6, 8, 8}}, - {m68k_op_asl_16_s , 0xf1f8, 0xe140, { 6, 6, 8, 8}}, - {m68k_op_lsl_16_s , 0xf1f8, 0xe148, { 6, 6, 4, 4}}, - {m68k_op_roxl_16_s , 0xf1f8, 0xe150, { 6, 6, 12, 12}}, - {m68k_op_rol_16_s , 0xf1f8, 0xe158, { 6, 6, 8, 8}}, - {m68k_op_asl_16_r , 0xf1f8, 0xe160, { 6, 6, 8, 8}}, - {m68k_op_lsl_16_r , 0xf1f8, 0xe168, { 6, 6, 6, 6}}, - {m68k_op_roxl_16_r , 0xf1f8, 0xe170, { 6, 6, 12, 12}}, - {m68k_op_rol_16_r , 0xf1f8, 0xe178, { 6, 6, 8, 8}}, - {m68k_op_asl_32_s , 0xf1f8, 0xe180, { 8, 8, 8, 8}}, - {m68k_op_lsl_32_s , 0xf1f8, 0xe188, { 8, 8, 4, 4}}, - {m68k_op_roxl_32_s , 0xf1f8, 0xe190, { 8, 8, 12, 12}}, - {m68k_op_rol_32_s , 0xf1f8, 0xe198, { 8, 8, 8, 8}}, - {m68k_op_asl_32_r , 0xf1f8, 0xe1a0, { 8, 8, 8, 8}}, - {m68k_op_lsl_32_r , 0xf1f8, 0xe1a8, { 8, 8, 6, 6}}, - {m68k_op_roxl_32_r , 0xf1f8, 0xe1b0, { 8, 8, 12, 12}}, - {m68k_op_rol_32_r , 0xf1f8, 0xe1b8, { 8, 8, 8, 8}}, - {m68k_op_cpdbcc_32 , 0xf1f8, 0xf048, { 0, 0, 4, 0}}, - {m68k_op_cptrapcc_32 , 0xf1f8, 0xf078, { 0, 0, 4, 0}}, - {m68k_op_rtm_32 , 0xfff0, 0x06c0, { 0, 0, 19, 19}}, - {m68k_op_trap , 0xfff0, 0x4e40, { 4, 4, 4, 4}}, - {m68k_op_btst_8_r_pi7 , 0xf1ff, 0x011f, { 8, 8, 8, 8}}, - {m68k_op_btst_8_r_pd7 , 0xf1ff, 0x0127, { 10, 10, 9, 9}}, - {m68k_op_btst_8_r_aw , 0xf1ff, 0x0138, { 12, 12, 8, 8}}, - {m68k_op_btst_8_r_al , 0xf1ff, 0x0139, { 16, 16, 8, 8}}, - {m68k_op_btst_8_r_pcdi , 0xf1ff, 0x013a, { 12, 12, 9, 9}}, - {m68k_op_btst_8_r_pcix , 0xf1ff, 0x013b, { 14, 14, 11, 11}}, - {m68k_op_btst_8_r_i , 0xf1ff, 0x013c, { 8, 8, 6, 6}}, - {m68k_op_bchg_8_r_pi7 , 0xf1ff, 0x015f, { 12, 12, 8, 8}}, - {m68k_op_bchg_8_r_pd7 , 0xf1ff, 0x0167, { 14, 14, 9, 9}}, - {m68k_op_bchg_8_r_aw , 0xf1ff, 0x0178, { 16, 16, 8, 8}}, - {m68k_op_bchg_8_r_al , 0xf1ff, 0x0179, { 20, 20, 8, 8}}, - {m68k_op_bclr_8_r_pi7 , 0xf1ff, 0x019f, { 12, 14, 8, 8}}, - {m68k_op_bclr_8_r_pd7 , 0xf1ff, 0x01a7, { 14, 16, 9, 9}}, - {m68k_op_bclr_8_r_aw , 0xf1ff, 0x01b8, { 16, 18, 8, 8}}, - {m68k_op_bclr_8_r_al , 0xf1ff, 0x01b9, { 20, 22, 8, 8}}, - {m68k_op_bset_8_r_pi7 , 0xf1ff, 0x01df, { 12, 12, 8, 8}}, - {m68k_op_bset_8_r_pd7 , 0xf1ff, 0x01e7, { 14, 14, 9, 9}}, - {m68k_op_bset_8_r_aw , 0xf1ff, 0x01f8, { 16, 16, 8, 8}}, - {m68k_op_bset_8_r_al , 0xf1ff, 0x01f9, { 20, 20, 8, 8}}, - {m68k_op_move_8_d_pi7 , 0xf1ff, 0x101f, { 8, 8, 6, 6}}, - {m68k_op_move_8_d_pd7 , 0xf1ff, 0x1027, { 10, 10, 7, 7}}, - {m68k_op_move_8_d_aw , 0xf1ff, 0x1038, { 12, 12, 6, 6}}, - {m68k_op_move_8_d_al , 0xf1ff, 0x1039, { 16, 16, 6, 6}}, - {m68k_op_move_8_d_pcdi , 0xf1ff, 0x103a, { 12, 12, 7, 7}}, - {m68k_op_move_8_d_pcix , 0xf1ff, 0x103b, { 14, 14, 9, 9}}, - {m68k_op_move_8_d_i , 0xf1ff, 0x103c, { 8, 8, 4, 4}}, - {m68k_op_move_8_ai_pi7 , 0xf1ff, 0x109f, { 12, 12, 8, 8}}, - {m68k_op_move_8_ai_pd7 , 0xf1ff, 0x10a7, { 14, 14, 9, 9}}, - {m68k_op_move_8_ai_aw , 0xf1ff, 0x10b8, { 16, 16, 8, 8}}, - {m68k_op_move_8_ai_al , 0xf1ff, 0x10b9, { 20, 20, 8, 8}}, - {m68k_op_move_8_ai_pcdi , 0xf1ff, 0x10ba, { 16, 16, 9, 9}}, - {m68k_op_move_8_ai_pcix , 0xf1ff, 0x10bb, { 18, 18, 11, 11}}, - {m68k_op_move_8_ai_i , 0xf1ff, 0x10bc, { 12, 12, 6, 6}}, - {m68k_op_move_8_pi_pi7 , 0xf1ff, 0x10df, { 12, 12, 8, 8}}, - {m68k_op_move_8_pi_pd7 , 0xf1ff, 0x10e7, { 14, 14, 9, 9}}, - {m68k_op_move_8_pi_aw , 0xf1ff, 0x10f8, { 16, 16, 8, 8}}, - {m68k_op_move_8_pi_al , 0xf1ff, 0x10f9, { 20, 20, 8, 8}}, - {m68k_op_move_8_pi_pcdi , 0xf1ff, 0x10fa, { 16, 16, 9, 9}}, - {m68k_op_move_8_pi_pcix , 0xf1ff, 0x10fb, { 18, 18, 11, 11}}, - {m68k_op_move_8_pi_i , 0xf1ff, 0x10fc, { 12, 12, 6, 6}}, - {m68k_op_move_8_pd_pi7 , 0xf1ff, 0x111f, { 12, 12, 9, 9}}, - {m68k_op_move_8_pd_pd7 , 0xf1ff, 0x1127, { 14, 14, 10, 10}}, - {m68k_op_move_8_pd_aw , 0xf1ff, 0x1138, { 16, 16, 9, 9}}, - {m68k_op_move_8_pd_al , 0xf1ff, 0x1139, { 20, 20, 9, 9}}, - {m68k_op_move_8_pd_pcdi , 0xf1ff, 0x113a, { 16, 16, 10, 10}}, - {m68k_op_move_8_pd_pcix , 0xf1ff, 0x113b, { 18, 18, 12, 12}}, - {m68k_op_move_8_pd_i , 0xf1ff, 0x113c, { 12, 12, 7, 7}}, - {m68k_op_move_8_di_pi7 , 0xf1ff, 0x115f, { 16, 16, 9, 9}}, - {m68k_op_move_8_di_pd7 , 0xf1ff, 0x1167, { 18, 18, 10, 10}}, - {m68k_op_move_8_di_aw , 0xf1ff, 0x1178, { 20, 20, 9, 9}}, - {m68k_op_move_8_di_al , 0xf1ff, 0x1179, { 24, 24, 9, 9}}, - {m68k_op_move_8_di_pcdi , 0xf1ff, 0x117a, { 20, 20, 10, 10}}, - {m68k_op_move_8_di_pcix , 0xf1ff, 0x117b, { 22, 22, 12, 12}}, - {m68k_op_move_8_di_i , 0xf1ff, 0x117c, { 16, 16, 7, 7}}, - {m68k_op_move_8_ix_pi7 , 0xf1ff, 0x119f, { 18, 18, 11, 11}}, - {m68k_op_move_8_ix_pd7 , 0xf1ff, 0x11a7, { 20, 20, 12, 12}}, - {m68k_op_move_8_ix_aw , 0xf1ff, 0x11b8, { 22, 22, 11, 11}}, - {m68k_op_move_8_ix_al , 0xf1ff, 0x11b9, { 26, 26, 11, 11}}, - {m68k_op_move_8_ix_pcdi , 0xf1ff, 0x11ba, { 22, 22, 12, 12}}, - {m68k_op_move_8_ix_pcix , 0xf1ff, 0x11bb, { 24, 24, 14, 14}}, - {m68k_op_move_8_ix_i , 0xf1ff, 0x11bc, { 18, 18, 9, 9}}, - {m68k_op_move_32_d_aw , 0xf1ff, 0x2038, { 16, 16, 6, 6}}, - {m68k_op_move_32_d_al , 0xf1ff, 0x2039, { 20, 20, 6, 6}}, - {m68k_op_move_32_d_pcdi , 0xf1ff, 0x203a, { 16, 16, 7, 7}}, - {m68k_op_move_32_d_pcix , 0xf1ff, 0x203b, { 18, 18, 9, 9}}, - {m68k_op_move_32_d_i , 0xf1ff, 0x203c, { 12, 12, 6, 6}}, - {m68k_op_movea_32_aw , 0xf1ff, 0x2078, { 16, 16, 6, 6}}, - {m68k_op_movea_32_al , 0xf1ff, 0x2079, { 20, 20, 6, 6}}, - {m68k_op_movea_32_pcdi , 0xf1ff, 0x207a, { 16, 16, 7, 7}}, - {m68k_op_movea_32_pcix , 0xf1ff, 0x207b, { 18, 18, 9, 9}}, - {m68k_op_movea_32_i , 0xf1ff, 0x207c, { 12, 12, 6, 6}}, - {m68k_op_move_32_ai_aw , 0xf1ff, 0x20b8, { 24, 24, 8, 8}}, - {m68k_op_move_32_ai_al , 0xf1ff, 0x20b9, { 28, 28, 8, 8}}, - {m68k_op_move_32_ai_pcdi , 0xf1ff, 0x20ba, { 24, 24, 9, 9}}, - {m68k_op_move_32_ai_pcix , 0xf1ff, 0x20bb, { 26, 26, 11, 11}}, - {m68k_op_move_32_ai_i , 0xf1ff, 0x20bc, { 20, 20, 8, 8}}, - {m68k_op_move_32_pi_aw , 0xf1ff, 0x20f8, { 24, 24, 8, 8}}, - {m68k_op_move_32_pi_al , 0xf1ff, 0x20f9, { 28, 28, 8, 8}}, - {m68k_op_move_32_pi_pcdi , 0xf1ff, 0x20fa, { 24, 24, 9, 9}}, - {m68k_op_move_32_pi_pcix , 0xf1ff, 0x20fb, { 26, 26, 11, 11}}, - {m68k_op_move_32_pi_i , 0xf1ff, 0x20fc, { 20, 20, 8, 8}}, - {m68k_op_move_32_pd_aw , 0xf1ff, 0x2138, { 24, 26, 9, 9}}, - {m68k_op_move_32_pd_al , 0xf1ff, 0x2139, { 28, 30, 9, 9}}, - {m68k_op_move_32_pd_pcdi , 0xf1ff, 0x213a, { 24, 26, 10, 10}}, - {m68k_op_move_32_pd_pcix , 0xf1ff, 0x213b, { 26, 28, 12, 12}}, - {m68k_op_move_32_pd_i , 0xf1ff, 0x213c, { 20, 22, 9, 9}}, - {m68k_op_move_32_di_aw , 0xf1ff, 0x2178, { 28, 28, 9, 9}}, - {m68k_op_move_32_di_al , 0xf1ff, 0x2179, { 32, 32, 9, 9}}, - {m68k_op_move_32_di_pcdi , 0xf1ff, 0x217a, { 28, 28, 10, 10}}, - {m68k_op_move_32_di_pcix , 0xf1ff, 0x217b, { 30, 30, 12, 12}}, - {m68k_op_move_32_di_i , 0xf1ff, 0x217c, { 24, 24, 9, 9}}, - {m68k_op_move_32_ix_aw , 0xf1ff, 0x21b8, { 30, 30, 11, 11}}, - {m68k_op_move_32_ix_al , 0xf1ff, 0x21b9, { 34, 34, 11, 11}}, - {m68k_op_move_32_ix_pcdi , 0xf1ff, 0x21ba, { 30, 30, 12, 12}}, - {m68k_op_move_32_ix_pcix , 0xf1ff, 0x21bb, { 32, 32, 14, 14}}, - {m68k_op_move_32_ix_i , 0xf1ff, 0x21bc, { 26, 26, 11, 11}}, - {m68k_op_move_16_d_aw , 0xf1ff, 0x3038, { 12, 12, 6, 6}}, - {m68k_op_move_16_d_al , 0xf1ff, 0x3039, { 16, 16, 6, 6}}, - {m68k_op_move_16_d_pcdi , 0xf1ff, 0x303a, { 12, 12, 7, 7}}, - {m68k_op_move_16_d_pcix , 0xf1ff, 0x303b, { 14, 14, 9, 9}}, - {m68k_op_move_16_d_i , 0xf1ff, 0x303c, { 8, 8, 4, 4}}, - {m68k_op_movea_16_aw , 0xf1ff, 0x3078, { 12, 12, 6, 6}}, - {m68k_op_movea_16_al , 0xf1ff, 0x3079, { 16, 16, 6, 6}}, - {m68k_op_movea_16_pcdi , 0xf1ff, 0x307a, { 12, 12, 7, 7}}, - {m68k_op_movea_16_pcix , 0xf1ff, 0x307b, { 14, 14, 9, 9}}, - {m68k_op_movea_16_i , 0xf1ff, 0x307c, { 8, 8, 4, 4}}, - {m68k_op_move_16_ai_aw , 0xf1ff, 0x30b8, { 16, 16, 8, 8}}, - {m68k_op_move_16_ai_al , 0xf1ff, 0x30b9, { 20, 20, 8, 8}}, - {m68k_op_move_16_ai_pcdi , 0xf1ff, 0x30ba, { 16, 16, 9, 9}}, - {m68k_op_move_16_ai_pcix , 0xf1ff, 0x30bb, { 18, 18, 11, 11}}, - {m68k_op_move_16_ai_i , 0xf1ff, 0x30bc, { 12, 12, 6, 6}}, - {m68k_op_move_16_pi_aw , 0xf1ff, 0x30f8, { 16, 16, 8, 8}}, - {m68k_op_move_16_pi_al , 0xf1ff, 0x30f9, { 20, 20, 8, 8}}, - {m68k_op_move_16_pi_pcdi , 0xf1ff, 0x30fa, { 16, 16, 9, 9}}, - {m68k_op_move_16_pi_pcix , 0xf1ff, 0x30fb, { 18, 18, 11, 11}}, - {m68k_op_move_16_pi_i , 0xf1ff, 0x30fc, { 12, 12, 6, 6}}, - {m68k_op_move_16_pd_aw , 0xf1ff, 0x3138, { 16, 16, 9, 9}}, - {m68k_op_move_16_pd_al , 0xf1ff, 0x3139, { 20, 20, 9, 9}}, - {m68k_op_move_16_pd_pcdi , 0xf1ff, 0x313a, { 16, 16, 10, 10}}, - {m68k_op_move_16_pd_pcix , 0xf1ff, 0x313b, { 18, 18, 12, 12}}, - {m68k_op_move_16_pd_i , 0xf1ff, 0x313c, { 12, 12, 7, 7}}, - {m68k_op_move_16_di_aw , 0xf1ff, 0x3178, { 20, 20, 9, 9}}, - {m68k_op_move_16_di_al , 0xf1ff, 0x3179, { 24, 24, 9, 9}}, - {m68k_op_move_16_di_pcdi , 0xf1ff, 0x317a, { 20, 20, 10, 10}}, - {m68k_op_move_16_di_pcix , 0xf1ff, 0x317b, { 22, 22, 12, 12}}, - {m68k_op_move_16_di_i , 0xf1ff, 0x317c, { 16, 16, 7, 7}}, - {m68k_op_move_16_ix_aw , 0xf1ff, 0x31b8, { 22, 22, 11, 11}}, - {m68k_op_move_16_ix_al , 0xf1ff, 0x31b9, { 26, 26, 11, 11}}, - {m68k_op_move_16_ix_pcdi , 0xf1ff, 0x31ba, { 22, 22, 12, 12}}, - {m68k_op_move_16_ix_pcix , 0xf1ff, 0x31bb, { 24, 24, 14, 14}}, - {m68k_op_move_16_ix_i , 0xf1ff, 0x31bc, { 18, 18, 9, 9}}, - {m68k_op_chk_32_aw , 0xf1ff, 0x4138, { 0, 0, 12, 12}}, - {m68k_op_chk_32_al , 0xf1ff, 0x4139, { 0, 0, 12, 12}}, - {m68k_op_chk_32_pcdi , 0xf1ff, 0x413a, { 0, 0, 13, 13}}, - {m68k_op_chk_32_pcix , 0xf1ff, 0x413b, { 0, 0, 15, 15}}, - {m68k_op_chk_32_i , 0xf1ff, 0x413c, { 0, 0, 12, 12}}, - {m68k_op_chk_16_aw , 0xf1ff, 0x41b8, { 18, 16, 12, 12}}, - {m68k_op_chk_16_al , 0xf1ff, 0x41b9, { 22, 20, 12, 12}}, - {m68k_op_chk_16_pcdi , 0xf1ff, 0x41ba, { 18, 16, 13, 13}}, - {m68k_op_chk_16_pcix , 0xf1ff, 0x41bb, { 20, 18, 15, 15}}, - {m68k_op_chk_16_i , 0xf1ff, 0x41bc, { 14, 12, 10, 10}}, - {m68k_op_lea_32_aw , 0xf1ff, 0x41f8, { 8, 8, 6, 6}}, - {m68k_op_lea_32_al , 0xf1ff, 0x41f9, { 12, 12, 6, 6}}, - {m68k_op_lea_32_pcdi , 0xf1ff, 0x41fa, { 8, 8, 7, 7}}, - {m68k_op_lea_32_pcix , 0xf1ff, 0x41fb, { 12, 12, 9, 9}}, - {m68k_op_addq_8_pi7 , 0xf1ff, 0x501f, { 12, 12, 8, 8}}, - {m68k_op_addq_8_pd7 , 0xf1ff, 0x5027, { 14, 14, 9, 9}}, - {m68k_op_addq_8_aw , 0xf1ff, 0x5038, { 16, 16, 8, 8}}, - {m68k_op_addq_8_al , 0xf1ff, 0x5039, { 20, 20, 8, 8}}, - {m68k_op_addq_16_aw , 0xf1ff, 0x5078, { 16, 16, 8, 8}}, - {m68k_op_addq_16_al , 0xf1ff, 0x5079, { 20, 20, 8, 8}}, - {m68k_op_addq_32_aw , 0xf1ff, 0x50b8, { 24, 24, 8, 8}}, - {m68k_op_addq_32_al , 0xf1ff, 0x50b9, { 28, 28, 8, 8}}, - {m68k_op_subq_8_pi7 , 0xf1ff, 0x511f, { 12, 12, 8, 8}}, - {m68k_op_subq_8_pd7 , 0xf1ff, 0x5127, { 14, 14, 9, 9}}, - {m68k_op_subq_8_aw , 0xf1ff, 0x5138, { 16, 16, 8, 8}}, - {m68k_op_subq_8_al , 0xf1ff, 0x5139, { 20, 20, 8, 8}}, - {m68k_op_subq_16_aw , 0xf1ff, 0x5178, { 16, 16, 8, 8}}, - {m68k_op_subq_16_al , 0xf1ff, 0x5179, { 20, 20, 8, 8}}, - {m68k_op_subq_32_aw , 0xf1ff, 0x51b8, { 24, 24, 8, 8}}, - {m68k_op_subq_32_al , 0xf1ff, 0x51b9, { 28, 28, 8, 8}}, - {m68k_op_or_8_er_pi7 , 0xf1ff, 0x801f, { 8, 8, 6, 6}}, - {m68k_op_or_8_er_pd7 , 0xf1ff, 0x8027, { 10, 10, 7, 7}}, - {m68k_op_or_8_er_aw , 0xf1ff, 0x8038, { 12, 12, 6, 6}}, - {m68k_op_or_8_er_al , 0xf1ff, 0x8039, { 16, 16, 6, 6}}, - {m68k_op_or_8_er_pcdi , 0xf1ff, 0x803a, { 12, 12, 7, 7}}, - {m68k_op_or_8_er_pcix , 0xf1ff, 0x803b, { 14, 14, 9, 9}}, - {m68k_op_or_8_er_i , 0xf1ff, 0x803c, { 8, 8, 4, 4}}, - {m68k_op_or_16_er_aw , 0xf1ff, 0x8078, { 12, 12, 6, 6}}, - {m68k_op_or_16_er_al , 0xf1ff, 0x8079, { 16, 16, 6, 6}}, - {m68k_op_or_16_er_pcdi , 0xf1ff, 0x807a, { 12, 12, 7, 7}}, - {m68k_op_or_16_er_pcix , 0xf1ff, 0x807b, { 14, 14, 9, 9}}, - {m68k_op_or_16_er_i , 0xf1ff, 0x807c, { 8, 8, 4, 4}}, - {m68k_op_or_32_er_aw , 0xf1ff, 0x80b8, { 18, 18, 6, 6}}, - {m68k_op_or_32_er_al , 0xf1ff, 0x80b9, { 22, 22, 6, 6}}, - {m68k_op_or_32_er_pcdi , 0xf1ff, 0x80ba, { 18, 18, 7, 7}}, - {m68k_op_or_32_er_pcix , 0xf1ff, 0x80bb, { 20, 20, 9, 9}}, - {m68k_op_or_32_er_i , 0xf1ff, 0x80bc, { 16, 14, 6, 6}}, - {m68k_op_divu_16_aw , 0xf1ff, 0x80f8, {148, 116, 48, 48}}, - {m68k_op_divu_16_al , 0xf1ff, 0x80f9, {152, 120, 48, 48}}, - {m68k_op_divu_16_pcdi , 0xf1ff, 0x80fa, {148, 116, 49, 49}}, - {m68k_op_divu_16_pcix , 0xf1ff, 0x80fb, {150, 118, 51, 51}}, - {m68k_op_divu_16_i , 0xf1ff, 0x80fc, {144, 112, 46, 46}}, - {m68k_op_sbcd_8_mm_ay7 , 0xf1ff, 0x810f, { 18, 18, 16, 16}}, - {m68k_op_or_8_re_pi7 , 0xf1ff, 0x811f, { 12, 12, 8, 8}}, - {m68k_op_or_8_re_pd7 , 0xf1ff, 0x8127, { 14, 14, 9, 9}}, - {m68k_op_or_8_re_aw , 0xf1ff, 0x8138, { 16, 16, 8, 8}}, - {m68k_op_or_8_re_al , 0xf1ff, 0x8139, { 20, 20, 8, 8}}, - {m68k_op_pack_16_mm_ay7 , 0xf1ff, 0x814f, { 0, 0, 13, 13}}, - {m68k_op_or_16_re_aw , 0xf1ff, 0x8178, { 16, 16, 8, 8}}, - {m68k_op_or_16_re_al , 0xf1ff, 0x8179, { 20, 20, 8, 8}}, - {m68k_op_unpk_16_mm_ay7 , 0xf1ff, 0x818f, { 0, 0, 13, 13}}, - {m68k_op_or_32_re_aw , 0xf1ff, 0x81b8, { 24, 24, 8, 8}}, - {m68k_op_or_32_re_al , 0xf1ff, 0x81b9, { 28, 28, 8, 8}}, - {m68k_op_divs_16_aw , 0xf1ff, 0x81f8, {166, 130, 60, 60}}, - {m68k_op_divs_16_al , 0xf1ff, 0x81f9, {170, 134, 60, 60}}, - {m68k_op_divs_16_pcdi , 0xf1ff, 0x81fa, {166, 130, 61, 61}}, - {m68k_op_divs_16_pcix , 0xf1ff, 0x81fb, {168, 132, 63, 63}}, - {m68k_op_divs_16_i , 0xf1ff, 0x81fc, {162, 126, 58, 58}}, - {m68k_op_sub_8_er_pi7 , 0xf1ff, 0x901f, { 8, 8, 6, 6}}, - {m68k_op_sub_8_er_pd7 , 0xf1ff, 0x9027, { 10, 10, 7, 7}}, - {m68k_op_sub_8_er_aw , 0xf1ff, 0x9038, { 12, 12, 6, 6}}, - {m68k_op_sub_8_er_al , 0xf1ff, 0x9039, { 16, 16, 6, 6}}, - {m68k_op_sub_8_er_pcdi , 0xf1ff, 0x903a, { 12, 12, 7, 7}}, - {m68k_op_sub_8_er_pcix , 0xf1ff, 0x903b, { 14, 14, 9, 9}}, - {m68k_op_sub_8_er_i , 0xf1ff, 0x903c, { 8, 8, 4, 4}}, - {m68k_op_sub_16_er_aw , 0xf1ff, 0x9078, { 12, 12, 6, 6}}, - {m68k_op_sub_16_er_al , 0xf1ff, 0x9079, { 16, 16, 6, 6}}, - {m68k_op_sub_16_er_pcdi , 0xf1ff, 0x907a, { 12, 12, 7, 7}}, - {m68k_op_sub_16_er_pcix , 0xf1ff, 0x907b, { 14, 14, 9, 9}}, - {m68k_op_sub_16_er_i , 0xf1ff, 0x907c, { 8, 8, 4, 4}}, - {m68k_op_sub_32_er_aw , 0xf1ff, 0x90b8, { 18, 18, 6, 6}}, - {m68k_op_sub_32_er_al , 0xf1ff, 0x90b9, { 22, 22, 6, 6}}, - {m68k_op_sub_32_er_pcdi , 0xf1ff, 0x90ba, { 18, 18, 7, 7}}, - {m68k_op_sub_32_er_pcix , 0xf1ff, 0x90bb, { 20, 20, 9, 9}}, - {m68k_op_sub_32_er_i , 0xf1ff, 0x90bc, { 16, 14, 6, 6}}, - {m68k_op_suba_16_aw , 0xf1ff, 0x90f8, { 16, 16, 6, 6}}, - {m68k_op_suba_16_al , 0xf1ff, 0x90f9, { 20, 20, 6, 6}}, - {m68k_op_suba_16_pcdi , 0xf1ff, 0x90fa, { 16, 16, 7, 7}}, - {m68k_op_suba_16_pcix , 0xf1ff, 0x90fb, { 18, 18, 9, 9}}, - {m68k_op_suba_16_i , 0xf1ff, 0x90fc, { 12, 12, 4, 4}}, - {m68k_op_subx_8_mm_ay7 , 0xf1ff, 0x910f, { 18, 18, 12, 12}}, - {m68k_op_sub_8_re_pi7 , 0xf1ff, 0x911f, { 12, 12, 8, 8}}, - {m68k_op_sub_8_re_pd7 , 0xf1ff, 0x9127, { 14, 14, 9, 9}}, - {m68k_op_sub_8_re_aw , 0xf1ff, 0x9138, { 16, 16, 8, 8}}, - {m68k_op_sub_8_re_al , 0xf1ff, 0x9139, { 20, 20, 8, 8}}, - {m68k_op_sub_16_re_aw , 0xf1ff, 0x9178, { 16, 16, 8, 8}}, - {m68k_op_sub_16_re_al , 0xf1ff, 0x9179, { 20, 20, 8, 8}}, - {m68k_op_sub_32_re_aw , 0xf1ff, 0x91b8, { 24, 24, 8, 8}}, - {m68k_op_sub_32_re_al , 0xf1ff, 0x91b9, { 28, 28, 8, 8}}, - {m68k_op_suba_32_aw , 0xf1ff, 0x91f8, { 18, 18, 6, 6}}, - {m68k_op_suba_32_al , 0xf1ff, 0x91f9, { 22, 22, 6, 6}}, - {m68k_op_suba_32_pcdi , 0xf1ff, 0x91fa, { 18, 18, 7, 7}}, - {m68k_op_suba_32_pcix , 0xf1ff, 0x91fb, { 20, 20, 9, 9}}, - {m68k_op_suba_32_i , 0xf1ff, 0x91fc, { 16, 14, 6, 6}}, - {m68k_op_cmp_8_pi7 , 0xf1ff, 0xb01f, { 8, 8, 6, 6}}, - {m68k_op_cmp_8_pd7 , 0xf1ff, 0xb027, { 10, 10, 7, 7}}, - {m68k_op_cmp_8_aw , 0xf1ff, 0xb038, { 12, 12, 6, 6}}, - {m68k_op_cmp_8_al , 0xf1ff, 0xb039, { 16, 16, 6, 6}}, - {m68k_op_cmp_8_pcdi , 0xf1ff, 0xb03a, { 12, 12, 7, 7}}, - {m68k_op_cmp_8_pcix , 0xf1ff, 0xb03b, { 14, 14, 9, 9}}, - {m68k_op_cmp_8_i , 0xf1ff, 0xb03c, { 8, 8, 4, 4}}, - {m68k_op_cmp_16_aw , 0xf1ff, 0xb078, { 12, 12, 6, 6}}, - {m68k_op_cmp_16_al , 0xf1ff, 0xb079, { 16, 16, 6, 6}}, - {m68k_op_cmp_16_pcdi , 0xf1ff, 0xb07a, { 12, 12, 7, 7}}, - {m68k_op_cmp_16_pcix , 0xf1ff, 0xb07b, { 14, 14, 9, 9}}, - {m68k_op_cmp_16_i , 0xf1ff, 0xb07c, { 8, 8, 4, 4}}, - {m68k_op_cmp_32_aw , 0xf1ff, 0xb0b8, { 18, 18, 6, 6}}, - {m68k_op_cmp_32_al , 0xf1ff, 0xb0b9, { 22, 22, 6, 6}}, - {m68k_op_cmp_32_pcdi , 0xf1ff, 0xb0ba, { 18, 18, 7, 7}}, - {m68k_op_cmp_32_pcix , 0xf1ff, 0xb0bb, { 20, 20, 9, 9}}, - {m68k_op_cmp_32_i , 0xf1ff, 0xb0bc, { 14, 14, 6, 6}}, - {m68k_op_cmpa_16_aw , 0xf1ff, 0xb0f8, { 14, 14, 8, 8}}, - {m68k_op_cmpa_16_al , 0xf1ff, 0xb0f9, { 18, 18, 8, 8}}, - {m68k_op_cmpa_16_pcdi , 0xf1ff, 0xb0fa, { 14, 14, 9, 9}}, - {m68k_op_cmpa_16_pcix , 0xf1ff, 0xb0fb, { 16, 16, 11, 11}}, - {m68k_op_cmpa_16_i , 0xf1ff, 0xb0fc, { 10, 10, 6, 6}}, - {m68k_op_cmpm_8_ay7 , 0xf1ff, 0xb10f, { 12, 12, 9, 9}}, - {m68k_op_eor_8_pi7 , 0xf1ff, 0xb11f, { 12, 12, 8, 8}}, - {m68k_op_eor_8_pd7 , 0xf1ff, 0xb127, { 14, 14, 9, 9}}, - {m68k_op_eor_8_aw , 0xf1ff, 0xb138, { 16, 16, 8, 8}}, - {m68k_op_eor_8_al , 0xf1ff, 0xb139, { 20, 20, 8, 8}}, - {m68k_op_eor_16_aw , 0xf1ff, 0xb178, { 16, 16, 8, 8}}, - {m68k_op_eor_16_al , 0xf1ff, 0xb179, { 20, 20, 8, 8}}, - {m68k_op_eor_32_aw , 0xf1ff, 0xb1b8, { 24, 24, 8, 8}}, - {m68k_op_eor_32_al , 0xf1ff, 0xb1b9, { 28, 28, 8, 8}}, - {m68k_op_cmpa_32_aw , 0xf1ff, 0xb1f8, { 18, 18, 8, 8}}, - {m68k_op_cmpa_32_al , 0xf1ff, 0xb1f9, { 22, 22, 8, 8}}, - {m68k_op_cmpa_32_pcdi , 0xf1ff, 0xb1fa, { 18, 18, 9, 9}}, - {m68k_op_cmpa_32_pcix , 0xf1ff, 0xb1fb, { 20, 20, 11, 11}}, - {m68k_op_cmpa_32_i , 0xf1ff, 0xb1fc, { 14, 14, 8, 8}}, - {m68k_op_and_8_er_pi7 , 0xf1ff, 0xc01f, { 8, 8, 6, 6}}, - {m68k_op_and_8_er_pd7 , 0xf1ff, 0xc027, { 10, 10, 7, 7}}, - {m68k_op_and_8_er_aw , 0xf1ff, 0xc038, { 12, 12, 6, 6}}, - {m68k_op_and_8_er_al , 0xf1ff, 0xc039, { 16, 16, 6, 6}}, - {m68k_op_and_8_er_pcdi , 0xf1ff, 0xc03a, { 12, 12, 7, 7}}, - {m68k_op_and_8_er_pcix , 0xf1ff, 0xc03b, { 14, 14, 9, 9}}, - {m68k_op_and_8_er_i , 0xf1ff, 0xc03c, { 8, 8, 4, 4}}, - {m68k_op_and_16_er_aw , 0xf1ff, 0xc078, { 12, 12, 6, 6}}, - {m68k_op_and_16_er_al , 0xf1ff, 0xc079, { 16, 16, 6, 6}}, - {m68k_op_and_16_er_pcdi , 0xf1ff, 0xc07a, { 12, 12, 7, 7}}, - {m68k_op_and_16_er_pcix , 0xf1ff, 0xc07b, { 14, 14, 9, 9}}, - {m68k_op_and_16_er_i , 0xf1ff, 0xc07c, { 8, 8, 4, 4}}, - {m68k_op_and_32_er_aw , 0xf1ff, 0xc0b8, { 18, 18, 6, 6}}, - {m68k_op_and_32_er_al , 0xf1ff, 0xc0b9, { 22, 22, 6, 6}}, - {m68k_op_and_32_er_pcdi , 0xf1ff, 0xc0ba, { 18, 18, 7, 7}}, - {m68k_op_and_32_er_pcix , 0xf1ff, 0xc0bb, { 20, 20, 9, 9}}, - {m68k_op_and_32_er_i , 0xf1ff, 0xc0bc, { 16, 14, 6, 6}}, - {m68k_op_mulu_16_aw , 0xf1ff, 0xc0f8, { 62, 38, 31, 31}}, - {m68k_op_mulu_16_al , 0xf1ff, 0xc0f9, { 66, 42, 31, 31}}, - {m68k_op_mulu_16_pcdi , 0xf1ff, 0xc0fa, { 62, 38, 32, 32}}, - {m68k_op_mulu_16_pcix , 0xf1ff, 0xc0fb, { 64, 40, 34, 34}}, - {m68k_op_mulu_16_i , 0xf1ff, 0xc0fc, { 58, 34, 29, 29}}, - {m68k_op_abcd_8_mm_ay7 , 0xf1ff, 0xc10f, { 18, 18, 16, 16}}, - {m68k_op_and_8_re_pi7 , 0xf1ff, 0xc11f, { 12, 12, 8, 8}}, - {m68k_op_and_8_re_pd7 , 0xf1ff, 0xc127, { 14, 14, 9, 9}}, - {m68k_op_and_8_re_aw , 0xf1ff, 0xc138, { 16, 16, 8, 8}}, - {m68k_op_and_8_re_al , 0xf1ff, 0xc139, { 20, 20, 8, 8}}, - {m68k_op_and_16_re_aw , 0xf1ff, 0xc178, { 16, 16, 8, 8}}, - {m68k_op_and_16_re_al , 0xf1ff, 0xc179, { 20, 20, 8, 8}}, - {m68k_op_and_32_re_aw , 0xf1ff, 0xc1b8, { 24, 24, 8, 8}}, - {m68k_op_and_32_re_al , 0xf1ff, 0xc1b9, { 28, 28, 8, 8}}, - {m68k_op_muls_16_aw , 0xf1ff, 0xc1f8, { 62, 40, 31, 31}}, - {m68k_op_muls_16_al , 0xf1ff, 0xc1f9, { 66, 44, 31, 31}}, - {m68k_op_muls_16_pcdi , 0xf1ff, 0xc1fa, { 62, 40, 32, 32}}, - {m68k_op_muls_16_pcix , 0xf1ff, 0xc1fb, { 64, 42, 34, 34}}, - {m68k_op_muls_16_i , 0xf1ff, 0xc1fc, { 58, 36, 29, 29}}, - {m68k_op_add_8_er_pi7 , 0xf1ff, 0xd01f, { 8, 8, 6, 6}}, - {m68k_op_add_8_er_pd7 , 0xf1ff, 0xd027, { 10, 10, 7, 7}}, - {m68k_op_add_8_er_aw , 0xf1ff, 0xd038, { 12, 12, 6, 6}}, - {m68k_op_add_8_er_al , 0xf1ff, 0xd039, { 16, 16, 6, 6}}, - {m68k_op_add_8_er_pcdi , 0xf1ff, 0xd03a, { 12, 12, 7, 7}}, - {m68k_op_add_8_er_pcix , 0xf1ff, 0xd03b, { 14, 14, 9, 9}}, - {m68k_op_add_8_er_i , 0xf1ff, 0xd03c, { 8, 8, 4, 4}}, - {m68k_op_add_16_er_aw , 0xf1ff, 0xd078, { 12, 12, 6, 6}}, - {m68k_op_add_16_er_al , 0xf1ff, 0xd079, { 16, 16, 6, 6}}, - {m68k_op_add_16_er_pcdi , 0xf1ff, 0xd07a, { 12, 12, 7, 7}}, - {m68k_op_add_16_er_pcix , 0xf1ff, 0xd07b, { 14, 14, 9, 9}}, - {m68k_op_add_16_er_i , 0xf1ff, 0xd07c, { 8, 8, 4, 4}}, - {m68k_op_add_32_er_aw , 0xf1ff, 0xd0b8, { 18, 18, 6, 6}}, - {m68k_op_add_32_er_al , 0xf1ff, 0xd0b9, { 22, 22, 6, 6}}, - {m68k_op_add_32_er_pcdi , 0xf1ff, 0xd0ba, { 18, 18, 7, 7}}, - {m68k_op_add_32_er_pcix , 0xf1ff, 0xd0bb, { 20, 20, 9, 9}}, - {m68k_op_add_32_er_i , 0xf1ff, 0xd0bc, { 16, 14, 6, 6}}, - {m68k_op_adda_16_aw , 0xf1ff, 0xd0f8, { 16, 16, 6, 6}}, - {m68k_op_adda_16_al , 0xf1ff, 0xd0f9, { 20, 20, 6, 6}}, - {m68k_op_adda_16_pcdi , 0xf1ff, 0xd0fa, { 16, 16, 7, 7}}, - {m68k_op_adda_16_pcix , 0xf1ff, 0xd0fb, { 18, 18, 9, 9}}, - {m68k_op_adda_16_i , 0xf1ff, 0xd0fc, { 12, 12, 4, 4}}, - {m68k_op_addx_8_mm_ay7 , 0xf1ff, 0xd10f, { 18, 18, 12, 12}}, - {m68k_op_add_8_re_pi7 , 0xf1ff, 0xd11f, { 12, 12, 8, 8}}, - {m68k_op_add_8_re_pd7 , 0xf1ff, 0xd127, { 14, 14, 9, 9}}, - {m68k_op_add_8_re_aw , 0xf1ff, 0xd138, { 16, 16, 8, 8}}, - {m68k_op_add_8_re_al , 0xf1ff, 0xd139, { 20, 20, 8, 8}}, - {m68k_op_add_16_re_aw , 0xf1ff, 0xd178, { 16, 16, 8, 8}}, - {m68k_op_add_16_re_al , 0xf1ff, 0xd179, { 20, 20, 8, 8}}, - {m68k_op_add_32_re_aw , 0xf1ff, 0xd1b8, { 24, 24, 8, 8}}, - {m68k_op_add_32_re_al , 0xf1ff, 0xd1b9, { 28, 28, 8, 8}}, - {m68k_op_adda_32_aw , 0xf1ff, 0xd1f8, { 18, 18, 6, 6}}, - {m68k_op_adda_32_al , 0xf1ff, 0xd1f9, { 22, 22, 6, 6}}, - {m68k_op_adda_32_pcdi , 0xf1ff, 0xd1fa, { 18, 18, 7, 7}}, - {m68k_op_adda_32_pcix , 0xf1ff, 0xd1fb, { 20, 20, 9, 9}}, - {m68k_op_adda_32_i , 0xf1ff, 0xd1fc, { 16, 14, 6, 6}}, - {m68k_op_ori_8_d , 0xfff8, 0x0000, { 8, 8, 2, 2}}, - {m68k_op_ori_8_ai , 0xfff8, 0x0010, { 16, 16, 8, 8}}, - {m68k_op_ori_8_pi , 0xfff8, 0x0018, { 16, 16, 8, 8}}, - {m68k_op_ori_8_pd , 0xfff8, 0x0020, { 18, 18, 9, 9}}, - {m68k_op_ori_8_di , 0xfff8, 0x0028, { 20, 20, 9, 9}}, - {m68k_op_ori_8_ix , 0xfff8, 0x0030, { 22, 22, 11, 11}}, - {m68k_op_ori_16_d , 0xfff8, 0x0040, { 8, 8, 2, 2}}, - {m68k_op_ori_16_ai , 0xfff8, 0x0050, { 16, 16, 8, 8}}, - {m68k_op_ori_16_pi , 0xfff8, 0x0058, { 16, 16, 8, 8}}, - {m68k_op_ori_16_pd , 0xfff8, 0x0060, { 18, 18, 9, 9}}, - {m68k_op_ori_16_di , 0xfff8, 0x0068, { 20, 20, 9, 9}}, - {m68k_op_ori_16_ix , 0xfff8, 0x0070, { 22, 22, 11, 11}}, - {m68k_op_ori_32_d , 0xfff8, 0x0080, { 16, 14, 2, 2}}, - {m68k_op_ori_32_ai , 0xfff8, 0x0090, { 28, 28, 8, 8}}, - {m68k_op_ori_32_pi , 0xfff8, 0x0098, { 28, 28, 8, 8}}, - {m68k_op_ori_32_pd , 0xfff8, 0x00a0, { 30, 30, 9, 9}}, - {m68k_op_ori_32_di , 0xfff8, 0x00a8, { 32, 32, 9, 9}}, - {m68k_op_ori_32_ix , 0xfff8, 0x00b0, { 34, 34, 11, 11}}, - {m68k_op_chk2cmp2_8_ai , 0xfff8, 0x00d0, { 0, 0, 22, 22}}, - {m68k_op_chk2cmp2_8_di , 0xfff8, 0x00e8, { 0, 0, 23, 23}}, - {m68k_op_chk2cmp2_8_ix , 0xfff8, 0x00f0, { 0, 0, 25, 25}}, - {m68k_op_andi_8_d , 0xfff8, 0x0200, { 8, 8, 2, 2}}, - {m68k_op_andi_8_ai , 0xfff8, 0x0210, { 16, 16, 8, 8}}, - {m68k_op_andi_8_pi , 0xfff8, 0x0218, { 16, 16, 8, 8}}, - {m68k_op_andi_8_pd , 0xfff8, 0x0220, { 18, 18, 9, 9}}, - {m68k_op_andi_8_di , 0xfff8, 0x0228, { 20, 20, 9, 9}}, - {m68k_op_andi_8_ix , 0xfff8, 0x0230, { 22, 22, 11, 11}}, - {m68k_op_andi_16_d , 0xfff8, 0x0240, { 8, 8, 2, 2}}, - {m68k_op_andi_16_ai , 0xfff8, 0x0250, { 16, 16, 8, 8}}, - {m68k_op_andi_16_pi , 0xfff8, 0x0258, { 16, 16, 8, 8}}, - {m68k_op_andi_16_pd , 0xfff8, 0x0260, { 18, 18, 9, 9}}, - {m68k_op_andi_16_di , 0xfff8, 0x0268, { 20, 20, 9, 9}}, - {m68k_op_andi_16_ix , 0xfff8, 0x0270, { 22, 22, 11, 11}}, - {m68k_op_andi_32_d , 0xfff8, 0x0280, { 14, 14, 2, 2}}, - {m68k_op_andi_32_ai , 0xfff8, 0x0290, { 28, 28, 8, 8}}, - {m68k_op_andi_32_pi , 0xfff8, 0x0298, { 28, 28, 8, 8}}, - {m68k_op_andi_32_pd , 0xfff8, 0x02a0, { 30, 30, 9, 9}}, - {m68k_op_andi_32_di , 0xfff8, 0x02a8, { 32, 32, 9, 9}}, - {m68k_op_andi_32_ix , 0xfff8, 0x02b0, { 34, 34, 11, 11}}, - {m68k_op_chk2cmp2_16_ai , 0xfff8, 0x02d0, { 0, 0, 22, 22}}, - {m68k_op_chk2cmp2_16_di , 0xfff8, 0x02e8, { 0, 0, 23, 23}}, - {m68k_op_chk2cmp2_16_ix , 0xfff8, 0x02f0, { 0, 0, 25, 25}}, - {m68k_op_subi_8_d , 0xfff8, 0x0400, { 8, 8, 2, 2}}, - {m68k_op_subi_8_ai , 0xfff8, 0x0410, { 16, 16, 8, 8}}, - {m68k_op_subi_8_pi , 0xfff8, 0x0418, { 16, 16, 8, 8}}, - {m68k_op_subi_8_pd , 0xfff8, 0x0420, { 18, 18, 9, 9}}, - {m68k_op_subi_8_di , 0xfff8, 0x0428, { 20, 20, 9, 9}}, - {m68k_op_subi_8_ix , 0xfff8, 0x0430, { 22, 22, 11, 11}}, - {m68k_op_subi_16_d , 0xfff8, 0x0440, { 8, 8, 2, 2}}, - {m68k_op_subi_16_ai , 0xfff8, 0x0450, { 16, 16, 8, 8}}, - {m68k_op_subi_16_pi , 0xfff8, 0x0458, { 16, 16, 8, 8}}, - {m68k_op_subi_16_pd , 0xfff8, 0x0460, { 18, 18, 9, 9}}, - {m68k_op_subi_16_di , 0xfff8, 0x0468, { 20, 20, 9, 9}}, - {m68k_op_subi_16_ix , 0xfff8, 0x0470, { 22, 22, 11, 11}}, - {m68k_op_subi_32_d , 0xfff8, 0x0480, { 16, 14, 2, 2}}, - {m68k_op_subi_32_ai , 0xfff8, 0x0490, { 28, 28, 8, 8}}, - {m68k_op_subi_32_pi , 0xfff8, 0x0498, { 28, 28, 8, 8}}, - {m68k_op_subi_32_pd , 0xfff8, 0x04a0, { 30, 30, 9, 9}}, - {m68k_op_subi_32_di , 0xfff8, 0x04a8, { 32, 32, 9, 9}}, - {m68k_op_subi_32_ix , 0xfff8, 0x04b0, { 34, 34, 11, 11}}, - {m68k_op_chk2cmp2_32_ai , 0xfff8, 0x04d0, { 0, 0, 22, 22}}, - {m68k_op_chk2cmp2_32_di , 0xfff8, 0x04e8, { 0, 0, 23, 23}}, - {m68k_op_chk2cmp2_32_ix , 0xfff8, 0x04f0, { 0, 0, 25, 25}}, - {m68k_op_addi_8_d , 0xfff8, 0x0600, { 8, 8, 2, 2}}, - {m68k_op_addi_8_ai , 0xfff8, 0x0610, { 16, 16, 8, 8}}, - {m68k_op_addi_8_pi , 0xfff8, 0x0618, { 16, 16, 8, 8}}, - {m68k_op_addi_8_pd , 0xfff8, 0x0620, { 18, 18, 9, 9}}, - {m68k_op_addi_8_di , 0xfff8, 0x0628, { 20, 20, 9, 9}}, - {m68k_op_addi_8_ix , 0xfff8, 0x0630, { 22, 22, 11, 11}}, - {m68k_op_addi_16_d , 0xfff8, 0x0640, { 8, 8, 2, 2}}, - {m68k_op_addi_16_ai , 0xfff8, 0x0650, { 16, 16, 8, 8}}, - {m68k_op_addi_16_pi , 0xfff8, 0x0658, { 16, 16, 8, 8}}, - {m68k_op_addi_16_pd , 0xfff8, 0x0660, { 18, 18, 9, 9}}, - {m68k_op_addi_16_di , 0xfff8, 0x0668, { 20, 20, 9, 9}}, - {m68k_op_addi_16_ix , 0xfff8, 0x0670, { 22, 22, 11, 11}}, - {m68k_op_addi_32_d , 0xfff8, 0x0680, { 16, 14, 2, 2}}, - {m68k_op_addi_32_ai , 0xfff8, 0x0690, { 28, 28, 8, 8}}, - {m68k_op_addi_32_pi , 0xfff8, 0x0698, { 28, 28, 8, 8}}, - {m68k_op_addi_32_pd , 0xfff8, 0x06a0, { 30, 30, 9, 9}}, - {m68k_op_addi_32_di , 0xfff8, 0x06a8, { 32, 32, 9, 9}}, - {m68k_op_addi_32_ix , 0xfff8, 0x06b0, { 34, 34, 11, 11}}, - {m68k_op_callm_32_ai , 0xfff8, 0x06d0, { 0, 0, 64, 64}}, - {m68k_op_callm_32_di , 0xfff8, 0x06e8, { 0, 0, 65, 65}}, - {m68k_op_callm_32_ix , 0xfff8, 0x06f0, { 0, 0, 67, 67}}, - {m68k_op_btst_32_s_d , 0xfff8, 0x0800, { 10, 10, 4, 4}}, - {m68k_op_btst_8_s_ai , 0xfff8, 0x0810, { 12, 12, 8, 8}}, - {m68k_op_btst_8_s_pi , 0xfff8, 0x0818, { 12, 12, 8, 8}}, - {m68k_op_btst_8_s_pd , 0xfff8, 0x0820, { 14, 14, 9, 9}}, - {m68k_op_btst_8_s_di , 0xfff8, 0x0828, { 16, 16, 9, 9}}, - {m68k_op_btst_8_s_ix , 0xfff8, 0x0830, { 18, 18, 11, 11}}, - {m68k_op_bchg_32_s_d , 0xfff8, 0x0840, { 12, 12, 4, 4}}, - {m68k_op_bchg_8_s_ai , 0xfff8, 0x0850, { 16, 16, 8, 8}}, - {m68k_op_bchg_8_s_pi , 0xfff8, 0x0858, { 16, 16, 8, 8}}, - {m68k_op_bchg_8_s_pd , 0xfff8, 0x0860, { 18, 18, 9, 9}}, - {m68k_op_bchg_8_s_di , 0xfff8, 0x0868, { 20, 20, 9, 9}}, - {m68k_op_bchg_8_s_ix , 0xfff8, 0x0870, { 22, 22, 11, 11}}, - {m68k_op_bclr_32_s_d , 0xfff8, 0x0880, { 14, 14, 4, 4}}, - {m68k_op_bclr_8_s_ai , 0xfff8, 0x0890, { 16, 16, 8, 8}}, - {m68k_op_bclr_8_s_pi , 0xfff8, 0x0898, { 16, 16, 8, 8}}, - {m68k_op_bclr_8_s_pd , 0xfff8, 0x08a0, { 18, 18, 9, 9}}, - {m68k_op_bclr_8_s_di , 0xfff8, 0x08a8, { 20, 20, 9, 9}}, - {m68k_op_bclr_8_s_ix , 0xfff8, 0x08b0, { 22, 22, 11, 11}}, - {m68k_op_bset_32_s_d , 0xfff8, 0x08c0, { 12, 12, 4, 4}}, - {m68k_op_bset_8_s_ai , 0xfff8, 0x08d0, { 16, 16, 8, 8}}, - {m68k_op_bset_8_s_pi , 0xfff8, 0x08d8, { 16, 16, 8, 8}}, - {m68k_op_bset_8_s_pd , 0xfff8, 0x08e0, { 18, 18, 9, 9}}, - {m68k_op_bset_8_s_di , 0xfff8, 0x08e8, { 20, 20, 9, 9}}, - {m68k_op_bset_8_s_ix , 0xfff8, 0x08f0, { 22, 22, 11, 11}}, - {m68k_op_eori_8_d , 0xfff8, 0x0a00, { 8, 8, 2, 2}}, - {m68k_op_eori_8_ai , 0xfff8, 0x0a10, { 16, 16, 8, 8}}, - {m68k_op_eori_8_pi , 0xfff8, 0x0a18, { 16, 16, 8, 8}}, - {m68k_op_eori_8_pd , 0xfff8, 0x0a20, { 18, 18, 9, 9}}, - {m68k_op_eori_8_di , 0xfff8, 0x0a28, { 20, 20, 9, 9}}, - {m68k_op_eori_8_ix , 0xfff8, 0x0a30, { 22, 22, 11, 11}}, - {m68k_op_eori_16_d , 0xfff8, 0x0a40, { 8, 8, 2, 2}}, - {m68k_op_eori_16_ai , 0xfff8, 0x0a50, { 16, 16, 8, 8}}, - {m68k_op_eori_16_pi , 0xfff8, 0x0a58, { 16, 16, 8, 8}}, - {m68k_op_eori_16_pd , 0xfff8, 0x0a60, { 18, 18, 9, 9}}, - {m68k_op_eori_16_di , 0xfff8, 0x0a68, { 20, 20, 9, 9}}, - {m68k_op_eori_16_ix , 0xfff8, 0x0a70, { 22, 22, 11, 11}}, - {m68k_op_eori_32_d , 0xfff8, 0x0a80, { 16, 14, 2, 2}}, - {m68k_op_eori_32_ai , 0xfff8, 0x0a90, { 28, 28, 8, 8}}, - {m68k_op_eori_32_pi , 0xfff8, 0x0a98, { 28, 28, 8, 8}}, - {m68k_op_eori_32_pd , 0xfff8, 0x0aa0, { 30, 30, 9, 9}}, - {m68k_op_eori_32_di , 0xfff8, 0x0aa8, { 32, 32, 9, 9}}, - {m68k_op_eori_32_ix , 0xfff8, 0x0ab0, { 34, 34, 11, 11}}, - {m68k_op_cas_8_ai , 0xfff8, 0x0ad0, { 0, 0, 16, 16}}, - {m68k_op_cas_8_pi , 0xfff8, 0x0ad8, { 0, 0, 16, 16}}, - {m68k_op_cas_8_pd , 0xfff8, 0x0ae0, { 0, 0, 17, 17}}, - {m68k_op_cas_8_di , 0xfff8, 0x0ae8, { 0, 0, 17, 17}}, - {m68k_op_cas_8_ix , 0xfff8, 0x0af0, { 0, 0, 19, 19}}, - {m68k_op_cmpi_8_d , 0xfff8, 0x0c00, { 8, 8, 2, 2}}, - {m68k_op_cmpi_8_ai , 0xfff8, 0x0c10, { 12, 12, 6, 6}}, - {m68k_op_cmpi_8_pi , 0xfff8, 0x0c18, { 12, 12, 6, 6}}, - {m68k_op_cmpi_8_pd , 0xfff8, 0x0c20, { 14, 14, 7, 7}}, - {m68k_op_cmpi_8_di , 0xfff8, 0x0c28, { 16, 16, 7, 7}}, - {m68k_op_cmpi_8_ix , 0xfff8, 0x0c30, { 18, 18, 9, 9}}, - {m68k_op_cmpi_16_d , 0xfff8, 0x0c40, { 8, 8, 2, 2}}, - {m68k_op_cmpi_16_ai , 0xfff8, 0x0c50, { 12, 12, 6, 6}}, - {m68k_op_cmpi_16_pi , 0xfff8, 0x0c58, { 12, 12, 6, 6}}, - {m68k_op_cmpi_16_pd , 0xfff8, 0x0c60, { 14, 14, 7, 7}}, - {m68k_op_cmpi_16_di , 0xfff8, 0x0c68, { 16, 16, 7, 7}}, - {m68k_op_cmpi_16_ix , 0xfff8, 0x0c70, { 18, 18, 9, 9}}, - {m68k_op_cmpi_32_d , 0xfff8, 0x0c80, { 14, 12, 2, 2}}, - {m68k_op_cmpi_32_ai , 0xfff8, 0x0c90, { 20, 20, 6, 6}}, - {m68k_op_cmpi_32_pi , 0xfff8, 0x0c98, { 20, 20, 6, 6}}, - {m68k_op_cmpi_32_pd , 0xfff8, 0x0ca0, { 22, 22, 7, 7}}, - {m68k_op_cmpi_32_di , 0xfff8, 0x0ca8, { 24, 24, 7, 7}}, - {m68k_op_cmpi_32_ix , 0xfff8, 0x0cb0, { 26, 26, 9, 9}}, - {m68k_op_cas_16_ai , 0xfff8, 0x0cd0, { 0, 0, 16, 16}}, - {m68k_op_cas_16_pi , 0xfff8, 0x0cd8, { 0, 0, 16, 16}}, - {m68k_op_cas_16_pd , 0xfff8, 0x0ce0, { 0, 0, 17, 17}}, - {m68k_op_cas_16_di , 0xfff8, 0x0ce8, { 0, 0, 17, 17}}, - {m68k_op_cas_16_ix , 0xfff8, 0x0cf0, { 0, 0, 19, 19}}, - {m68k_op_moves_8_ai , 0xfff8, 0x0e10, { 0, 18, 9, 9}}, - {m68k_op_moves_8_pi , 0xfff8, 0x0e18, { 0, 18, 9, 9}}, - {m68k_op_moves_8_pd , 0xfff8, 0x0e20, { 0, 20, 10, 10}}, - {m68k_op_moves_8_di , 0xfff8, 0x0e28, { 0, 26, 10, 10}}, - {m68k_op_moves_8_ix , 0xfff8, 0x0e30, { 0, 30, 12, 12}}, - {m68k_op_moves_16_ai , 0xfff8, 0x0e50, { 0, 18, 9, 9}}, - {m68k_op_moves_16_pi , 0xfff8, 0x0e58, { 0, 18, 9, 9}}, - {m68k_op_moves_16_pd , 0xfff8, 0x0e60, { 0, 20, 10, 10}}, - {m68k_op_moves_16_di , 0xfff8, 0x0e68, { 0, 26, 10, 10}}, - {m68k_op_moves_16_ix , 0xfff8, 0x0e70, { 0, 30, 12, 12}}, - {m68k_op_moves_32_ai , 0xfff8, 0x0e90, { 0, 22, 9, 9}}, - {m68k_op_moves_32_pi , 0xfff8, 0x0e98, { 0, 22, 9, 9}}, - {m68k_op_moves_32_pd , 0xfff8, 0x0ea0, { 0, 28, 10, 10}}, - {m68k_op_moves_32_di , 0xfff8, 0x0ea8, { 0, 32, 10, 10}}, - {m68k_op_moves_32_ix , 0xfff8, 0x0eb0, { 0, 36, 12, 12}}, - {m68k_op_cas_32_ai , 0xfff8, 0x0ed0, { 0, 0, 16, 16}}, - {m68k_op_cas_32_pi , 0xfff8, 0x0ed8, { 0, 0, 16, 16}}, - {m68k_op_cas_32_pd , 0xfff8, 0x0ee0, { 0, 0, 17, 17}}, - {m68k_op_cas_32_di , 0xfff8, 0x0ee8, { 0, 0, 17, 17}}, - {m68k_op_cas_32_ix , 0xfff8, 0x0ef0, { 0, 0, 19, 19}}, - {m68k_op_move_8_aw_d , 0xfff8, 0x11c0, { 12, 12, 4, 4}}, - {m68k_op_move_8_aw_ai , 0xfff8, 0x11d0, { 16, 16, 8, 8}}, - {m68k_op_move_8_aw_pi , 0xfff8, 0x11d8, { 16, 16, 8, 8}}, - {m68k_op_move_8_aw_pd , 0xfff8, 0x11e0, { 18, 18, 9, 9}}, - {m68k_op_move_8_aw_di , 0xfff8, 0x11e8, { 20, 20, 9, 9}}, - {m68k_op_move_8_aw_ix , 0xfff8, 0x11f0, { 22, 22, 11, 11}}, - {m68k_op_move_8_al_d , 0xfff8, 0x13c0, { 16, 16, 6, 6}}, - {m68k_op_move_8_al_ai , 0xfff8, 0x13d0, { 20, 20, 10, 10}}, - {m68k_op_move_8_al_pi , 0xfff8, 0x13d8, { 20, 20, 10, 10}}, - {m68k_op_move_8_al_pd , 0xfff8, 0x13e0, { 22, 22, 11, 11}}, - {m68k_op_move_8_al_di , 0xfff8, 0x13e8, { 24, 24, 11, 11}}, - {m68k_op_move_8_al_ix , 0xfff8, 0x13f0, { 26, 26, 13, 13}}, - {m68k_op_move_8_pi7_d , 0xfff8, 0x1ec0, { 8, 8, 4, 4}}, - {m68k_op_move_8_pi7_ai , 0xfff8, 0x1ed0, { 12, 12, 8, 8}}, - {m68k_op_move_8_pi7_pi , 0xfff8, 0x1ed8, { 12, 12, 8, 8}}, - {m68k_op_move_8_pi7_pd , 0xfff8, 0x1ee0, { 14, 14, 9, 9}}, - {m68k_op_move_8_pi7_di , 0xfff8, 0x1ee8, { 16, 16, 9, 9}}, - {m68k_op_move_8_pi7_ix , 0xfff8, 0x1ef0, { 18, 18, 11, 11}}, - {m68k_op_move_8_pd7_d , 0xfff8, 0x1f00, { 8, 8, 5, 5}}, - {m68k_op_move_8_pd7_ai , 0xfff8, 0x1f10, { 12, 12, 9, 9}}, - {m68k_op_move_8_pd7_pi , 0xfff8, 0x1f18, { 12, 12, 9, 9}}, - {m68k_op_move_8_pd7_pd , 0xfff8, 0x1f20, { 14, 14, 10, 10}}, - {m68k_op_move_8_pd7_di , 0xfff8, 0x1f28, { 16, 16, 10, 10}}, - {m68k_op_move_8_pd7_ix , 0xfff8, 0x1f30, { 18, 18, 12, 12}}, - {m68k_op_move_32_aw_d , 0xfff8, 0x21c0, { 16, 16, 4, 4}}, - {m68k_op_move_32_aw_a , 0xfff8, 0x21c8, { 16, 16, 4, 4}}, - {m68k_op_move_32_aw_ai , 0xfff8, 0x21d0, { 24, 24, 8, 8}}, - {m68k_op_move_32_aw_pi , 0xfff8, 0x21d8, { 24, 24, 8, 8}}, - {m68k_op_move_32_aw_pd , 0xfff8, 0x21e0, { 26, 26, 9, 9}}, - {m68k_op_move_32_aw_di , 0xfff8, 0x21e8, { 28, 28, 9, 9}}, - {m68k_op_move_32_aw_ix , 0xfff8, 0x21f0, { 30, 30, 11, 11}}, - {m68k_op_move_32_al_d , 0xfff8, 0x23c0, { 20, 20, 6, 6}}, - {m68k_op_move_32_al_a , 0xfff8, 0x23c8, { 20, 20, 6, 6}}, - {m68k_op_move_32_al_ai , 0xfff8, 0x23d0, { 28, 28, 10, 10}}, - {m68k_op_move_32_al_pi , 0xfff8, 0x23d8, { 28, 28, 10, 10}}, - {m68k_op_move_32_al_pd , 0xfff8, 0x23e0, { 30, 30, 11, 11}}, - {m68k_op_move_32_al_di , 0xfff8, 0x23e8, { 32, 32, 11, 11}}, - {m68k_op_move_32_al_ix , 0xfff8, 0x23f0, { 34, 34, 13, 13}}, - {m68k_op_move_16_aw_d , 0xfff8, 0x31c0, { 12, 12, 4, 4}}, - {m68k_op_move_16_aw_a , 0xfff8, 0x31c8, { 12, 12, 4, 4}}, - {m68k_op_move_16_aw_ai , 0xfff8, 0x31d0, { 16, 16, 8, 8}}, - {m68k_op_move_16_aw_pi , 0xfff8, 0x31d8, { 16, 16, 8, 8}}, - {m68k_op_move_16_aw_pd , 0xfff8, 0x31e0, { 18, 18, 9, 9}}, - {m68k_op_move_16_aw_di , 0xfff8, 0x31e8, { 20, 20, 9, 9}}, - {m68k_op_move_16_aw_ix , 0xfff8, 0x31f0, { 22, 22, 11, 11}}, - {m68k_op_move_16_al_d , 0xfff8, 0x33c0, { 16, 16, 6, 6}}, - {m68k_op_move_16_al_a , 0xfff8, 0x33c8, { 16, 16, 6, 6}}, - {m68k_op_move_16_al_ai , 0xfff8, 0x33d0, { 20, 20, 10, 10}}, - {m68k_op_move_16_al_pi , 0xfff8, 0x33d8, { 20, 20, 10, 10}}, - {m68k_op_move_16_al_pd , 0xfff8, 0x33e0, { 22, 22, 11, 11}}, - {m68k_op_move_16_al_di , 0xfff8, 0x33e8, { 24, 24, 11, 11}}, - {m68k_op_move_16_al_ix , 0xfff8, 0x33f0, { 26, 26, 13, 13}}, - {m68k_op_negx_8_d , 0xfff8, 0x4000, { 4, 4, 2, 2}}, - {m68k_op_negx_8_ai , 0xfff8, 0x4010, { 12, 12, 8, 8}}, - {m68k_op_negx_8_pi , 0xfff8, 0x4018, { 12, 12, 8, 8}}, - {m68k_op_negx_8_pd , 0xfff8, 0x4020, { 14, 14, 9, 9}}, - {m68k_op_negx_8_di , 0xfff8, 0x4028, { 16, 16, 9, 9}}, - {m68k_op_negx_8_ix , 0xfff8, 0x4030, { 18, 18, 11, 11}}, - {m68k_op_negx_16_d , 0xfff8, 0x4040, { 4, 4, 2, 2}}, - {m68k_op_negx_16_ai , 0xfff8, 0x4050, { 12, 12, 8, 8}}, - {m68k_op_negx_16_pi , 0xfff8, 0x4058, { 12, 12, 8, 8}}, - {m68k_op_negx_16_pd , 0xfff8, 0x4060, { 14, 14, 9, 9}}, - {m68k_op_negx_16_di , 0xfff8, 0x4068, { 16, 16, 9, 9}}, - {m68k_op_negx_16_ix , 0xfff8, 0x4070, { 18, 18, 11, 11}}, - {m68k_op_negx_32_d , 0xfff8, 0x4080, { 6, 6, 2, 2}}, - {m68k_op_negx_32_ai , 0xfff8, 0x4090, { 20, 20, 8, 8}}, - {m68k_op_negx_32_pi , 0xfff8, 0x4098, { 20, 20, 8, 8}}, - {m68k_op_negx_32_pd , 0xfff8, 0x40a0, { 22, 22, 9, 9}}, - {m68k_op_negx_32_di , 0xfff8, 0x40a8, { 24, 24, 9, 9}}, - {m68k_op_negx_32_ix , 0xfff8, 0x40b0, { 26, 26, 11, 11}}, - {m68k_op_move_16_frs_d , 0xfff8, 0x40c0, { 6, 4, 8, 8}}, - {m68k_op_move_16_frs_ai , 0xfff8, 0x40d0, { 12, 12, 12, 12}}, - {m68k_op_move_16_frs_pi , 0xfff8, 0x40d8, { 12, 12, 12, 12}}, - {m68k_op_move_16_frs_pd , 0xfff8, 0x40e0, { 14, 14, 13, 13}}, - {m68k_op_move_16_frs_di , 0xfff8, 0x40e8, { 16, 16, 13, 13}}, - {m68k_op_move_16_frs_ix , 0xfff8, 0x40f0, { 18, 18, 15, 15}}, - {m68k_op_clr_8_d , 0xfff8, 0x4200, { 4, 4, 2, 2}}, - {m68k_op_clr_8_ai , 0xfff8, 0x4210, { 12, 8, 8, 8}}, - {m68k_op_clr_8_pi , 0xfff8, 0x4218, { 12, 8, 8, 8}}, - {m68k_op_clr_8_pd , 0xfff8, 0x4220, { 14, 10, 9, 9}}, - {m68k_op_clr_8_di , 0xfff8, 0x4228, { 16, 12, 9, 9}}, - {m68k_op_clr_8_ix , 0xfff8, 0x4230, { 18, 14, 11, 11}}, - {m68k_op_clr_16_d , 0xfff8, 0x4240, { 4, 4, 2, 2}}, - {m68k_op_clr_16_ai , 0xfff8, 0x4250, { 12, 8, 8, 8}}, - {m68k_op_clr_16_pi , 0xfff8, 0x4258, { 12, 8, 8, 8}}, - {m68k_op_clr_16_pd , 0xfff8, 0x4260, { 14, 10, 9, 9}}, - {m68k_op_clr_16_di , 0xfff8, 0x4268, { 16, 12, 9, 9}}, - {m68k_op_clr_16_ix , 0xfff8, 0x4270, { 18, 14, 11, 11}}, - {m68k_op_clr_32_d , 0xfff8, 0x4280, { 6, 6, 2, 2}}, - {m68k_op_clr_32_ai , 0xfff8, 0x4290, { 20, 12, 8, 8}}, - {m68k_op_clr_32_pi , 0xfff8, 0x4298, { 20, 12, 8, 8}}, - {m68k_op_clr_32_pd , 0xfff8, 0x42a0, { 22, 14, 9, 9}}, - {m68k_op_clr_32_di , 0xfff8, 0x42a8, { 24, 16, 9, 9}}, - {m68k_op_clr_32_ix , 0xfff8, 0x42b0, { 26, 20, 11, 11}}, - {m68k_op_move_16_frc_d , 0xfff8, 0x42c0, { 0, 4, 4, 4}}, - {m68k_op_move_16_frc_ai , 0xfff8, 0x42d0, { 0, 12, 8, 8}}, - {m68k_op_move_16_frc_pi , 0xfff8, 0x42d8, { 0, 12, 8, 8}}, - {m68k_op_move_16_frc_pd , 0xfff8, 0x42e0, { 0, 14, 9, 9}}, - {m68k_op_move_16_frc_di , 0xfff8, 0x42e8, { 0, 16, 9, 9}}, - {m68k_op_move_16_frc_ix , 0xfff8, 0x42f0, { 0, 18, 11, 11}}, - {m68k_op_neg_8_d , 0xfff8, 0x4400, { 4, 4, 2, 2}}, - {m68k_op_neg_8_ai , 0xfff8, 0x4410, { 12, 12, 8, 8}}, - {m68k_op_neg_8_pi , 0xfff8, 0x4418, { 12, 12, 8, 8}}, - {m68k_op_neg_8_pd , 0xfff8, 0x4420, { 14, 14, 9, 9}}, - {m68k_op_neg_8_di , 0xfff8, 0x4428, { 16, 16, 9, 9}}, - {m68k_op_neg_8_ix , 0xfff8, 0x4430, { 18, 18, 11, 11}}, - {m68k_op_neg_16_d , 0xfff8, 0x4440, { 4, 4, 2, 2}}, - {m68k_op_neg_16_ai , 0xfff8, 0x4450, { 12, 12, 8, 8}}, - {m68k_op_neg_16_pi , 0xfff8, 0x4458, { 12, 12, 8, 8}}, - {m68k_op_neg_16_pd , 0xfff8, 0x4460, { 14, 14, 9, 9}}, - {m68k_op_neg_16_di , 0xfff8, 0x4468, { 16, 16, 9, 9}}, - {m68k_op_neg_16_ix , 0xfff8, 0x4470, { 18, 18, 11, 11}}, - {m68k_op_neg_32_d , 0xfff8, 0x4480, { 6, 6, 2, 2}}, - {m68k_op_neg_32_ai , 0xfff8, 0x4490, { 20, 20, 8, 8}}, - {m68k_op_neg_32_pi , 0xfff8, 0x4498, { 20, 20, 8, 8}}, - {m68k_op_neg_32_pd , 0xfff8, 0x44a0, { 22, 22, 9, 9}}, - {m68k_op_neg_32_di , 0xfff8, 0x44a8, { 24, 24, 9, 9}}, - {m68k_op_neg_32_ix , 0xfff8, 0x44b0, { 26, 26, 11, 11}}, - {m68k_op_move_16_toc_d , 0xfff8, 0x44c0, { 12, 12, 4, 4}}, - {m68k_op_move_16_toc_ai , 0xfff8, 0x44d0, { 16, 16, 8, 8}}, - {m68k_op_move_16_toc_pi , 0xfff8, 0x44d8, { 16, 16, 8, 8}}, - {m68k_op_move_16_toc_pd , 0xfff8, 0x44e0, { 18, 18, 9, 9}}, - {m68k_op_move_16_toc_di , 0xfff8, 0x44e8, { 20, 20, 9, 9}}, - {m68k_op_move_16_toc_ix , 0xfff8, 0x44f0, { 22, 22, 11, 11}}, - {m68k_op_not_8_d , 0xfff8, 0x4600, { 4, 4, 2, 2}}, - {m68k_op_not_8_ai , 0xfff8, 0x4610, { 12, 12, 8, 8}}, - {m68k_op_not_8_pi , 0xfff8, 0x4618, { 12, 12, 8, 8}}, - {m68k_op_not_8_pd , 0xfff8, 0x4620, { 14, 14, 9, 9}}, - {m68k_op_not_8_di , 0xfff8, 0x4628, { 16, 16, 9, 9}}, - {m68k_op_not_8_ix , 0xfff8, 0x4630, { 18, 18, 11, 11}}, - {m68k_op_not_16_d , 0xfff8, 0x4640, { 4, 4, 2, 2}}, - {m68k_op_not_16_ai , 0xfff8, 0x4650, { 12, 12, 8, 8}}, - {m68k_op_not_16_pi , 0xfff8, 0x4658, { 12, 12, 8, 8}}, - {m68k_op_not_16_pd , 0xfff8, 0x4660, { 14, 14, 9, 9}}, - {m68k_op_not_16_di , 0xfff8, 0x4668, { 16, 16, 9, 9}}, - {m68k_op_not_16_ix , 0xfff8, 0x4670, { 18, 18, 11, 11}}, - {m68k_op_not_32_d , 0xfff8, 0x4680, { 6, 6, 2, 2}}, - {m68k_op_not_32_ai , 0xfff8, 0x4690, { 20, 20, 8, 8}}, - {m68k_op_not_32_pi , 0xfff8, 0x4698, { 20, 20, 8, 8}}, - {m68k_op_not_32_pd , 0xfff8, 0x46a0, { 22, 22, 9, 9}}, - {m68k_op_not_32_di , 0xfff8, 0x46a8, { 24, 24, 9, 9}}, - {m68k_op_not_32_ix , 0xfff8, 0x46b0, { 26, 26, 11, 11}}, - {m68k_op_move_16_tos_d , 0xfff8, 0x46c0, { 12, 12, 8, 8}}, - {m68k_op_move_16_tos_ai , 0xfff8, 0x46d0, { 16, 16, 12, 12}}, - {m68k_op_move_16_tos_pi , 0xfff8, 0x46d8, { 16, 16, 12, 12}}, - {m68k_op_move_16_tos_pd , 0xfff8, 0x46e0, { 18, 18, 13, 13}}, - {m68k_op_move_16_tos_di , 0xfff8, 0x46e8, { 20, 20, 13, 13}}, - {m68k_op_move_16_tos_ix , 0xfff8, 0x46f0, { 22, 22, 15, 15}}, - {m68k_op_nbcd_8_d , 0xfff8, 0x4800, { 6, 6, 6, 6}}, - {m68k_op_link_32 , 0xfff8, 0x4808, { 0, 0, 6, 6}}, - {m68k_op_nbcd_8_ai , 0xfff8, 0x4810, { 12, 12, 10, 10}}, - {m68k_op_nbcd_8_pi , 0xfff8, 0x4818, { 12, 12, 10, 10}}, - {m68k_op_nbcd_8_pd , 0xfff8, 0x4820, { 14, 14, 11, 11}}, - {m68k_op_nbcd_8_di , 0xfff8, 0x4828, { 16, 16, 11, 11}}, - {m68k_op_nbcd_8_ix , 0xfff8, 0x4830, { 18, 18, 13, 13}}, - {m68k_op_swap_32 , 0xfff8, 0x4840, { 4, 4, 4, 4}}, - {m68k_op_bkpt , 0xfff8, 0x4848, { 0, 10, 10, 10}}, - {m68k_op_pea_32_ai , 0xfff8, 0x4850, { 12, 12, 9, 9}}, - {m68k_op_pea_32_di , 0xfff8, 0x4868, { 16, 16, 10, 10}}, - {m68k_op_pea_32_ix , 0xfff8, 0x4870, { 20, 20, 12, 12}}, - {m68k_op_ext_16 , 0xfff8, 0x4880, { 4, 4, 4, 4}}, - {m68k_op_movem_16_re_ai , 0xfff8, 0x4890, { 8, 8, 8, 8}}, - {m68k_op_movem_16_re_pd , 0xfff8, 0x48a0, { 8, 8, 4, 4}}, - {m68k_op_movem_16_re_di , 0xfff8, 0x48a8, { 12, 12, 9, 9}}, - {m68k_op_movem_16_re_ix , 0xfff8, 0x48b0, { 14, 14, 11, 11}}, - {m68k_op_ext_32 , 0xfff8, 0x48c0, { 4, 4, 4, 4}}, - {m68k_op_movem_32_re_ai , 0xfff8, 0x48d0, { 8, 8, 8, 8}}, - {m68k_op_movem_32_re_pd , 0xfff8, 0x48e0, { 8, 8, 4, 4}}, - {m68k_op_movem_32_re_di , 0xfff8, 0x48e8, { 12, 12, 9, 9}}, - {m68k_op_movem_32_re_ix , 0xfff8, 0x48f0, { 14, 14, 11, 11}}, - {m68k_op_extb_32 , 0xfff8, 0x49c0, { 0, 0, 4, 4}}, - {m68k_op_tst_8_d , 0xfff8, 0x4a00, { 4, 4, 2, 2}}, - {m68k_op_tst_8_ai , 0xfff8, 0x4a10, { 8, 8, 6, 6}}, - {m68k_op_tst_8_pi , 0xfff8, 0x4a18, { 8, 8, 6, 6}}, - {m68k_op_tst_8_pd , 0xfff8, 0x4a20, { 10, 10, 7, 7}}, - {m68k_op_tst_8_di , 0xfff8, 0x4a28, { 12, 12, 7, 7}}, - {m68k_op_tst_8_ix , 0xfff8, 0x4a30, { 14, 14, 9, 9}}, - {m68k_op_tst_16_d , 0xfff8, 0x4a40, { 4, 4, 2, 2}}, - {m68k_op_tst_16_a , 0xfff8, 0x4a48, { 0, 0, 2, 2}}, - {m68k_op_tst_16_ai , 0xfff8, 0x4a50, { 8, 8, 6, 6}}, - {m68k_op_tst_16_pi , 0xfff8, 0x4a58, { 8, 8, 6, 6}}, - {m68k_op_tst_16_pd , 0xfff8, 0x4a60, { 10, 10, 7, 7}}, - {m68k_op_tst_16_di , 0xfff8, 0x4a68, { 12, 12, 7, 7}}, - {m68k_op_tst_16_ix , 0xfff8, 0x4a70, { 14, 14, 9, 9}}, - {m68k_op_tst_32_d , 0xfff8, 0x4a80, { 4, 4, 2, 2}}, - {m68k_op_tst_32_a , 0xfff8, 0x4a88, { 0, 0, 2, 2}}, - {m68k_op_tst_32_ai , 0xfff8, 0x4a90, { 12, 12, 6, 6}}, - {m68k_op_tst_32_pi , 0xfff8, 0x4a98, { 12, 12, 6, 6}}, - {m68k_op_tst_32_pd , 0xfff8, 0x4aa0, { 14, 14, 7, 7}}, - {m68k_op_tst_32_di , 0xfff8, 0x4aa8, { 16, 16, 7, 7}}, - {m68k_op_tst_32_ix , 0xfff8, 0x4ab0, { 18, 18, 9, 9}}, - {m68k_op_tas_8_d , 0xfff8, 0x4ac0, { 4, 4, 4, 4}}, - {m68k_op_tas_8_ai , 0xfff8, 0x4ad0, { 18, 18, 16, 16}}, - {m68k_op_tas_8_pi , 0xfff8, 0x4ad8, { 18, 18, 16, 16}}, - {m68k_op_tas_8_pd , 0xfff8, 0x4ae0, { 20, 20, 17, 17}}, - {m68k_op_tas_8_di , 0xfff8, 0x4ae8, { 22, 22, 17, 17}}, - {m68k_op_tas_8_ix , 0xfff8, 0x4af0, { 24, 24, 19, 19}}, - {m68k_op_mull_32_d , 0xfff8, 0x4c00, { 0, 0, 43, 43}}, - {m68k_op_mull_32_ai , 0xfff8, 0x4c10, { 0, 0, 47, 47}}, - {m68k_op_mull_32_pi , 0xfff8, 0x4c18, { 0, 0, 47, 47}}, - {m68k_op_mull_32_pd , 0xfff8, 0x4c20, { 0, 0, 48, 48}}, - {m68k_op_mull_32_di , 0xfff8, 0x4c28, { 0, 0, 48, 48}}, - {m68k_op_mull_32_ix , 0xfff8, 0x4c30, { 0, 0, 50, 50}}, - {m68k_op_divl_32_d , 0xfff8, 0x4c40, { 0, 0, 84, 84}}, - {m68k_op_divl_32_ai , 0xfff8, 0x4c50, { 0, 0, 88, 88}}, - {m68k_op_divl_32_pi , 0xfff8, 0x4c58, { 0, 0, 88, 88}}, - {m68k_op_divl_32_pd , 0xfff8, 0x4c60, { 0, 0, 89, 89}}, - {m68k_op_divl_32_di , 0xfff8, 0x4c68, { 0, 0, 89, 89}}, - {m68k_op_divl_32_ix , 0xfff8, 0x4c70, { 0, 0, 91, 91}}, - {m68k_op_movem_16_er_ai , 0xfff8, 0x4c90, { 12, 12, 12, 12}}, - {m68k_op_movem_16_er_pi , 0xfff8, 0x4c98, { 12, 12, 8, 8}}, - {m68k_op_movem_16_er_di , 0xfff8, 0x4ca8, { 16, 16, 13, 13}}, - {m68k_op_movem_16_er_ix , 0xfff8, 0x4cb0, { 18, 18, 15, 15}}, - {m68k_op_movem_32_er_ai , 0xfff8, 0x4cd0, { 12, 12, 12, 12}}, - {m68k_op_movem_32_er_pi , 0xfff8, 0x4cd8, { 12, 12, 8, 8}}, - {m68k_op_movem_32_er_di , 0xfff8, 0x4ce8, { 16, 16, 13, 13}}, - {m68k_op_movem_32_er_ix , 0xfff8, 0x4cf0, { 18, 18, 15, 15}}, - {m68k_op_link_16 , 0xfff8, 0x4e50, { 16, 16, 5, 5}}, - {m68k_op_unlk_32 , 0xfff8, 0x4e58, { 12, 12, 6, 6}}, - {m68k_op_move_32_tou , 0xfff8, 0x4e60, { 4, 6, 2, 2}}, - {m68k_op_move_32_fru , 0xfff8, 0x4e68, { 4, 6, 2, 2}}, - {m68k_op_jsr_32_ai , 0xfff8, 0x4e90, { 16, 16, 4, 4}}, - {m68k_op_jsr_32_di , 0xfff8, 0x4ea8, { 18, 18, 5, 5}}, - {m68k_op_jsr_32_ix , 0xfff8, 0x4eb0, { 22, 22, 7, 7}}, - {m68k_op_jmp_32_ai , 0xfff8, 0x4ed0, { 8, 8, 4, 4}}, - {m68k_op_jmp_32_di , 0xfff8, 0x4ee8, { 10, 10, 5, 5}}, - {m68k_op_jmp_32_ix , 0xfff8, 0x4ef0, { 14, 14, 7, 7}}, - {m68k_op_st_8_d , 0xfff8, 0x50c0, { 6, 4, 4, 4}}, - {m68k_op_dbt_16 , 0xfff8, 0x50c8, { 12, 12, 6, 6}}, - {m68k_op_st_8_ai , 0xfff8, 0x50d0, { 12, 12, 10, 10}}, - {m68k_op_st_8_pi , 0xfff8, 0x50d8, { 12, 12, 10, 10}}, - {m68k_op_st_8_pd , 0xfff8, 0x50e0, { 14, 14, 11, 11}}, - {m68k_op_st_8_di , 0xfff8, 0x50e8, { 16, 16, 11, 11}}, - {m68k_op_st_8_ix , 0xfff8, 0x50f0, { 18, 18, 13, 13}}, - {m68k_op_sf_8_d , 0xfff8, 0x51c0, { 4, 4, 4, 4}}, - {m68k_op_dbf_16 , 0xfff8, 0x51c8, { 12, 12, 6, 6}}, - {m68k_op_sf_8_ai , 0xfff8, 0x51d0, { 12, 12, 10, 10}}, - {m68k_op_sf_8_pi , 0xfff8, 0x51d8, { 12, 12, 10, 10}}, - {m68k_op_sf_8_pd , 0xfff8, 0x51e0, { 14, 14, 11, 11}}, - {m68k_op_sf_8_di , 0xfff8, 0x51e8, { 16, 16, 11, 11}}, - {m68k_op_sf_8_ix , 0xfff8, 0x51f0, { 18, 18, 13, 13}}, - {m68k_op_shi_8_d , 0xfff8, 0x52c0, { 4, 4, 4, 4}}, - {m68k_op_dbhi_16 , 0xfff8, 0x52c8, { 12, 12, 6, 6}}, - {m68k_op_shi_8_ai , 0xfff8, 0x52d0, { 12, 12, 10, 10}}, - {m68k_op_shi_8_pi , 0xfff8, 0x52d8, { 12, 12, 10, 10}}, - {m68k_op_shi_8_pd , 0xfff8, 0x52e0, { 14, 14, 11, 11}}, - {m68k_op_shi_8_di , 0xfff8, 0x52e8, { 16, 16, 11, 11}}, - {m68k_op_shi_8_ix , 0xfff8, 0x52f0, { 18, 18, 13, 13}}, - {m68k_op_sls_8_d , 0xfff8, 0x53c0, { 4, 4, 4, 4}}, - {m68k_op_dbls_16 , 0xfff8, 0x53c8, { 12, 12, 6, 6}}, - {m68k_op_sls_8_ai , 0xfff8, 0x53d0, { 12, 12, 10, 10}}, - {m68k_op_sls_8_pi , 0xfff8, 0x53d8, { 12, 12, 10, 10}}, - {m68k_op_sls_8_pd , 0xfff8, 0x53e0, { 14, 14, 11, 11}}, - {m68k_op_sls_8_di , 0xfff8, 0x53e8, { 16, 16, 11, 11}}, - {m68k_op_sls_8_ix , 0xfff8, 0x53f0, { 18, 18, 13, 13}}, - {m68k_op_scc_8_d , 0xfff8, 0x54c0, { 4, 4, 4, 4}}, - {m68k_op_dbcc_16 , 0xfff8, 0x54c8, { 12, 12, 6, 6}}, - {m68k_op_scc_8_ai , 0xfff8, 0x54d0, { 12, 12, 10, 10}}, - {m68k_op_scc_8_pi , 0xfff8, 0x54d8, { 12, 12, 10, 10}}, - {m68k_op_scc_8_pd , 0xfff8, 0x54e0, { 14, 14, 11, 11}}, - {m68k_op_scc_8_di , 0xfff8, 0x54e8, { 16, 16, 11, 11}}, - {m68k_op_scc_8_ix , 0xfff8, 0x54f0, { 18, 18, 13, 13}}, - {m68k_op_scs_8_d , 0xfff8, 0x55c0, { 4, 4, 4, 4}}, - {m68k_op_dbcs_16 , 0xfff8, 0x55c8, { 12, 12, 6, 6}}, - {m68k_op_scs_8_ai , 0xfff8, 0x55d0, { 12, 12, 10, 10}}, - {m68k_op_scs_8_pi , 0xfff8, 0x55d8, { 12, 12, 10, 10}}, - {m68k_op_scs_8_pd , 0xfff8, 0x55e0, { 14, 14, 11, 11}}, - {m68k_op_scs_8_di , 0xfff8, 0x55e8, { 16, 16, 11, 11}}, - {m68k_op_scs_8_ix , 0xfff8, 0x55f0, { 18, 18, 13, 13}}, - {m68k_op_sne_8_d , 0xfff8, 0x56c0, { 4, 4, 4, 4}}, - {m68k_op_dbne_16 , 0xfff8, 0x56c8, { 12, 12, 6, 6}}, - {m68k_op_sne_8_ai , 0xfff8, 0x56d0, { 12, 12, 10, 10}}, - {m68k_op_sne_8_pi , 0xfff8, 0x56d8, { 12, 12, 10, 10}}, - {m68k_op_sne_8_pd , 0xfff8, 0x56e0, { 14, 14, 11, 11}}, - {m68k_op_sne_8_di , 0xfff8, 0x56e8, { 16, 16, 11, 11}}, - {m68k_op_sne_8_ix , 0xfff8, 0x56f0, { 18, 18, 13, 13}}, - {m68k_op_seq_8_d , 0xfff8, 0x57c0, { 4, 4, 4, 4}}, - {m68k_op_dbeq_16 , 0xfff8, 0x57c8, { 12, 12, 6, 6}}, - {m68k_op_seq_8_ai , 0xfff8, 0x57d0, { 12, 12, 10, 10}}, - {m68k_op_seq_8_pi , 0xfff8, 0x57d8, { 12, 12, 10, 10}}, - {m68k_op_seq_8_pd , 0xfff8, 0x57e0, { 14, 14, 11, 11}}, - {m68k_op_seq_8_di , 0xfff8, 0x57e8, { 16, 16, 11, 11}}, - {m68k_op_seq_8_ix , 0xfff8, 0x57f0, { 18, 18, 13, 13}}, - {m68k_op_svc_8_d , 0xfff8, 0x58c0, { 4, 4, 4, 4}}, - {m68k_op_dbvc_16 , 0xfff8, 0x58c8, { 12, 12, 6, 6}}, - {m68k_op_svc_8_ai , 0xfff8, 0x58d0, { 12, 12, 10, 10}}, - {m68k_op_svc_8_pi , 0xfff8, 0x58d8, { 12, 12, 10, 10}}, - {m68k_op_svc_8_pd , 0xfff8, 0x58e0, { 14, 14, 11, 11}}, - {m68k_op_svc_8_di , 0xfff8, 0x58e8, { 16, 16, 11, 11}}, - {m68k_op_svc_8_ix , 0xfff8, 0x58f0, { 18, 18, 13, 13}}, - {m68k_op_svs_8_d , 0xfff8, 0x59c0, { 4, 4, 4, 4}}, - {m68k_op_dbvs_16 , 0xfff8, 0x59c8, { 12, 12, 6, 6}}, - {m68k_op_svs_8_ai , 0xfff8, 0x59d0, { 12, 12, 10, 10}}, - {m68k_op_svs_8_pi , 0xfff8, 0x59d8, { 12, 12, 10, 10}}, - {m68k_op_svs_8_pd , 0xfff8, 0x59e0, { 14, 14, 11, 11}}, - {m68k_op_svs_8_di , 0xfff8, 0x59e8, { 16, 16, 11, 11}}, - {m68k_op_svs_8_ix , 0xfff8, 0x59f0, { 18, 18, 13, 13}}, - {m68k_op_spl_8_d , 0xfff8, 0x5ac0, { 4, 4, 4, 4}}, - {m68k_op_dbpl_16 , 0xfff8, 0x5ac8, { 12, 12, 6, 6}}, - {m68k_op_spl_8_ai , 0xfff8, 0x5ad0, { 12, 12, 10, 10}}, - {m68k_op_spl_8_pi , 0xfff8, 0x5ad8, { 12, 12, 10, 10}}, - {m68k_op_spl_8_pd , 0xfff8, 0x5ae0, { 14, 14, 11, 11}}, - {m68k_op_spl_8_di , 0xfff8, 0x5ae8, { 16, 16, 11, 11}}, - {m68k_op_spl_8_ix , 0xfff8, 0x5af0, { 18, 18, 13, 13}}, - {m68k_op_smi_8_d , 0xfff8, 0x5bc0, { 4, 4, 4, 4}}, - {m68k_op_dbmi_16 , 0xfff8, 0x5bc8, { 12, 12, 6, 6}}, - {m68k_op_smi_8_ai , 0xfff8, 0x5bd0, { 12, 12, 10, 10}}, - {m68k_op_smi_8_pi , 0xfff8, 0x5bd8, { 12, 12, 10, 10}}, - {m68k_op_smi_8_pd , 0xfff8, 0x5be0, { 14, 14, 11, 11}}, - {m68k_op_smi_8_di , 0xfff8, 0x5be8, { 16, 16, 11, 11}}, - {m68k_op_smi_8_ix , 0xfff8, 0x5bf0, { 18, 18, 13, 13}}, - {m68k_op_sge_8_d , 0xfff8, 0x5cc0, { 4, 4, 4, 4}}, - {m68k_op_dbge_16 , 0xfff8, 0x5cc8, { 12, 12, 6, 6}}, - {m68k_op_sge_8_ai , 0xfff8, 0x5cd0, { 12, 12, 10, 10}}, - {m68k_op_sge_8_pi , 0xfff8, 0x5cd8, { 12, 12, 10, 10}}, - {m68k_op_sge_8_pd , 0xfff8, 0x5ce0, { 14, 14, 11, 11}}, - {m68k_op_sge_8_di , 0xfff8, 0x5ce8, { 16, 16, 11, 11}}, - {m68k_op_sge_8_ix , 0xfff8, 0x5cf0, { 18, 18, 13, 13}}, - {m68k_op_slt_8_d , 0xfff8, 0x5dc0, { 4, 4, 4, 4}}, - {m68k_op_dblt_16 , 0xfff8, 0x5dc8, { 12, 12, 6, 6}}, - {m68k_op_slt_8_ai , 0xfff8, 0x5dd0, { 12, 12, 10, 10}}, - {m68k_op_slt_8_pi , 0xfff8, 0x5dd8, { 12, 12, 10, 10}}, - {m68k_op_slt_8_pd , 0xfff8, 0x5de0, { 14, 14, 11, 11}}, - {m68k_op_slt_8_di , 0xfff8, 0x5de8, { 16, 16, 11, 11}}, - {m68k_op_slt_8_ix , 0xfff8, 0x5df0, { 18, 18, 13, 13}}, - {m68k_op_sgt_8_d , 0xfff8, 0x5ec0, { 4, 4, 4, 4}}, - {m68k_op_dbgt_16 , 0xfff8, 0x5ec8, { 12, 12, 6, 6}}, - {m68k_op_sgt_8_ai , 0xfff8, 0x5ed0, { 12, 12, 10, 10}}, - {m68k_op_sgt_8_pi , 0xfff8, 0x5ed8, { 12, 12, 10, 10}}, - {m68k_op_sgt_8_pd , 0xfff8, 0x5ee0, { 14, 14, 11, 11}}, - {m68k_op_sgt_8_di , 0xfff8, 0x5ee8, { 16, 16, 11, 11}}, - {m68k_op_sgt_8_ix , 0xfff8, 0x5ef0, { 18, 18, 13, 13}}, - {m68k_op_sle_8_d , 0xfff8, 0x5fc0, { 4, 4, 4, 4}}, - {m68k_op_dble_16 , 0xfff8, 0x5fc8, { 12, 12, 6, 6}}, - {m68k_op_sle_8_ai , 0xfff8, 0x5fd0, { 12, 12, 10, 10}}, - {m68k_op_sle_8_pi , 0xfff8, 0x5fd8, { 12, 12, 10, 10}}, - {m68k_op_sle_8_pd , 0xfff8, 0x5fe0, { 14, 14, 11, 11}}, - {m68k_op_sle_8_di , 0xfff8, 0x5fe8, { 16, 16, 11, 11}}, - {m68k_op_sle_8_ix , 0xfff8, 0x5ff0, { 18, 18, 13, 13}}, - {m68k_op_sbcd_8_mm_ax7 , 0xfff8, 0x8f08, { 18, 18, 16, 16}}, - {m68k_op_pack_16_mm_ax7 , 0xfff8, 0x8f48, { 0, 0, 13, 13}}, - {m68k_op_unpk_16_mm_ax7 , 0xfff8, 0x8f88, { 0, 0, 13, 13}}, - {m68k_op_subx_8_mm_ax7 , 0xfff8, 0x9f08, { 18, 18, 12, 12}}, - {m68k_op_cmpm_8_ax7 , 0xfff8, 0xbf08, { 12, 12, 9, 9}}, - {m68k_op_abcd_8_mm_ax7 , 0xfff8, 0xcf08, { 18, 18, 16, 16}}, - {m68k_op_addx_8_mm_ax7 , 0xfff8, 0xdf08, { 18, 18, 12, 12}}, - {m68k_op_asr_16_ai , 0xfff8, 0xe0d0, { 12, 12, 9, 9}}, - {m68k_op_asr_16_pi , 0xfff8, 0xe0d8, { 12, 12, 9, 9}}, - {m68k_op_asr_16_pd , 0xfff8, 0xe0e0, { 14, 14, 10, 10}}, - {m68k_op_asr_16_di , 0xfff8, 0xe0e8, { 16, 16, 10, 10}}, - {m68k_op_asr_16_ix , 0xfff8, 0xe0f0, { 18, 18, 12, 12}}, - {m68k_op_asl_16_ai , 0xfff8, 0xe1d0, { 12, 12, 10, 10}}, - {m68k_op_asl_16_pi , 0xfff8, 0xe1d8, { 12, 12, 10, 10}}, - {m68k_op_asl_16_pd , 0xfff8, 0xe1e0, { 14, 14, 11, 11}}, - {m68k_op_asl_16_di , 0xfff8, 0xe1e8, { 16, 16, 11, 11}}, - {m68k_op_asl_16_ix , 0xfff8, 0xe1f0, { 18, 18, 13, 13}}, - {m68k_op_lsr_16_ai , 0xfff8, 0xe2d0, { 12, 12, 9, 9}}, - {m68k_op_lsr_16_pi , 0xfff8, 0xe2d8, { 12, 12, 9, 9}}, - {m68k_op_lsr_16_pd , 0xfff8, 0xe2e0, { 14, 14, 10, 10}}, - {m68k_op_lsr_16_di , 0xfff8, 0xe2e8, { 16, 16, 10, 10}}, - {m68k_op_lsr_16_ix , 0xfff8, 0xe2f0, { 18, 18, 12, 12}}, - {m68k_op_lsl_16_ai , 0xfff8, 0xe3d0, { 12, 12, 9, 9}}, - {m68k_op_lsl_16_pi , 0xfff8, 0xe3d8, { 12, 12, 9, 9}}, - {m68k_op_lsl_16_pd , 0xfff8, 0xe3e0, { 14, 14, 10, 10}}, - {m68k_op_lsl_16_di , 0xfff8, 0xe3e8, { 16, 16, 10, 10}}, - {m68k_op_lsl_16_ix , 0xfff8, 0xe3f0, { 18, 18, 12, 12}}, - {m68k_op_roxr_16_ai , 0xfff8, 0xe4d0, { 12, 12, 9, 9}}, - {m68k_op_roxr_16_pi , 0xfff8, 0xe4d8, { 12, 12, 9, 9}}, - {m68k_op_roxr_16_pd , 0xfff8, 0xe4e0, { 14, 14, 10, 10}}, - {m68k_op_roxr_16_di , 0xfff8, 0xe4e8, { 16, 16, 10, 10}}, - {m68k_op_roxr_16_ix , 0xfff8, 0xe4f0, { 18, 18, 12, 12}}, - {m68k_op_roxl_16_ai , 0xfff8, 0xe5d0, { 12, 12, 9, 9}}, - {m68k_op_roxl_16_pi , 0xfff8, 0xe5d8, { 12, 12, 9, 9}}, - {m68k_op_roxl_16_pd , 0xfff8, 0xe5e0, { 14, 14, 10, 10}}, - {m68k_op_roxl_16_di , 0xfff8, 0xe5e8, { 16, 16, 10, 10}}, - {m68k_op_roxl_16_ix , 0xfff8, 0xe5f0, { 18, 18, 12, 12}}, - {m68k_op_ror_16_ai , 0xfff8, 0xe6d0, { 12, 12, 11, 11}}, - {m68k_op_ror_16_pi , 0xfff8, 0xe6d8, { 12, 12, 11, 11}}, - {m68k_op_ror_16_pd , 0xfff8, 0xe6e0, { 14, 14, 12, 12}}, - {m68k_op_ror_16_di , 0xfff8, 0xe6e8, { 16, 16, 12, 12}}, - {m68k_op_ror_16_ix , 0xfff8, 0xe6f0, { 18, 18, 14, 14}}, - {m68k_op_rol_16_ai , 0xfff8, 0xe7d0, { 12, 12, 11, 11}}, - {m68k_op_rol_16_pi , 0xfff8, 0xe7d8, { 12, 12, 11, 11}}, - {m68k_op_rol_16_pd , 0xfff8, 0xe7e0, { 14, 14, 12, 12}}, - {m68k_op_rol_16_di , 0xfff8, 0xe7e8, { 16, 16, 12, 12}}, - {m68k_op_rol_16_ix , 0xfff8, 0xe7f0, { 18, 18, 14, 14}}, - {m68k_op_bftst_32_d , 0xfff8, 0xe8c0, { 0, 0, 6, 6}}, - {m68k_op_bftst_32_ai , 0xfff8, 0xe8d0, { 0, 0, 17, 17}}, - {m68k_op_bftst_32_di , 0xfff8, 0xe8e8, { 0, 0, 18, 18}}, - {m68k_op_bftst_32_ix , 0xfff8, 0xe8f0, { 0, 0, 20, 20}}, - {m68k_op_bfextu_32_d , 0xfff8, 0xe9c0, { 0, 0, 8, 8}}, - {m68k_op_bfextu_32_ai , 0xfff8, 0xe9d0, { 0, 0, 19, 19}}, - {m68k_op_bfextu_32_di , 0xfff8, 0xe9e8, { 0, 0, 20, 20}}, - {m68k_op_bfextu_32_ix , 0xfff8, 0xe9f0, { 0, 0, 22, 22}}, - {m68k_op_bfchg_32_d , 0xfff8, 0xeac0, { 0, 0, 12, 12}}, - {m68k_op_bfchg_32_ai , 0xfff8, 0xead0, { 0, 0, 24, 24}}, - {m68k_op_bfchg_32_di , 0xfff8, 0xeae8, { 0, 0, 25, 25}}, - {m68k_op_bfchg_32_ix , 0xfff8, 0xeaf0, { 0, 0, 27, 27}}, - {m68k_op_bfexts_32_d , 0xfff8, 0xebc0, { 0, 0, 8, 8}}, - {m68k_op_bfexts_32_ai , 0xfff8, 0xebd0, { 0, 0, 19, 19}}, - {m68k_op_bfexts_32_di , 0xfff8, 0xebe8, { 0, 0, 20, 20}}, - {m68k_op_bfexts_32_ix , 0xfff8, 0xebf0, { 0, 0, 22, 22}}, - {m68k_op_bfclr_32_d , 0xfff8, 0xecc0, { 0, 0, 12, 12}}, - {m68k_op_bfclr_32_ai , 0xfff8, 0xecd0, { 0, 0, 24, 24}}, - {m68k_op_bfclr_32_di , 0xfff8, 0xece8, { 0, 0, 25, 25}}, - {m68k_op_bfclr_32_ix , 0xfff8, 0xecf0, { 0, 0, 27, 27}}, - {m68k_op_bfffo_32_d , 0xfff8, 0xedc0, { 0, 0, 18, 18}}, - {m68k_op_bfffo_32_ai , 0xfff8, 0xedd0, { 0, 0, 32, 32}}, - {m68k_op_bfffo_32_di , 0xfff8, 0xede8, { 0, 0, 33, 33}}, - {m68k_op_bfffo_32_ix , 0xfff8, 0xedf0, { 0, 0, 35, 35}}, - {m68k_op_bfset_32_d , 0xfff8, 0xeec0, { 0, 0, 12, 12}}, - {m68k_op_bfset_32_ai , 0xfff8, 0xeed0, { 0, 0, 24, 24}}, - {m68k_op_bfset_32_di , 0xfff8, 0xeee8, { 0, 0, 25, 25}}, - {m68k_op_bfset_32_ix , 0xfff8, 0xeef0, { 0, 0, 27, 27}}, - {m68k_op_bfins_32_d , 0xfff8, 0xefc0, { 0, 0, 10, 10}}, - {m68k_op_bfins_32_ai , 0xfff8, 0xefd0, { 0, 0, 21, 21}}, - {m68k_op_bfins_32_di , 0xfff8, 0xefe8, { 0, 0, 22, 22}}, - {m68k_op_bfins_32_ix , 0xfff8, 0xeff0, { 0, 0, 24, 24}}, - {m68k_op_move16_32 , 0xfff8, 0xf620, { 0, 0, 0, 4}}, - {m68k_op_ori_8_pi7 , 0xffff, 0x001f, { 16, 16, 8, 8}}, - {m68k_op_ori_8_pd7 , 0xffff, 0x0027, { 18, 18, 9, 9}}, - {m68k_op_ori_8_aw , 0xffff, 0x0038, { 20, 20, 8, 8}}, - {m68k_op_ori_8_al , 0xffff, 0x0039, { 24, 24, 8, 8}}, - {m68k_op_ori_16_toc , 0xffff, 0x003c, { 20, 16, 12, 12}}, - {m68k_op_ori_16_aw , 0xffff, 0x0078, { 20, 20, 8, 8}}, - {m68k_op_ori_16_al , 0xffff, 0x0079, { 24, 24, 8, 8}}, - {m68k_op_ori_16_tos , 0xffff, 0x007c, { 20, 16, 12, 12}}, - {m68k_op_ori_32_aw , 0xffff, 0x00b8, { 32, 32, 8, 8}}, - {m68k_op_ori_32_al , 0xffff, 0x00b9, { 36, 36, 8, 8}}, - {m68k_op_chk2cmp2_8_aw , 0xffff, 0x00f8, { 0, 0, 22, 22}}, - {m68k_op_chk2cmp2_8_al , 0xffff, 0x00f9, { 0, 0, 22, 22}}, - {m68k_op_chk2cmp2_8_pcdi , 0xffff, 0x00fa, { 0, 0, 23, 23}}, - {m68k_op_chk2cmp2_8_pcix , 0xffff, 0x00fb, { 0, 0, 23, 23}}, - {m68k_op_andi_8_pi7 , 0xffff, 0x021f, { 16, 16, 8, 8}}, - {m68k_op_andi_8_pd7 , 0xffff, 0x0227, { 18, 18, 9, 9}}, - {m68k_op_andi_8_aw , 0xffff, 0x0238, { 20, 20, 8, 8}}, - {m68k_op_andi_8_al , 0xffff, 0x0239, { 24, 24, 8, 8}}, - {m68k_op_andi_16_toc , 0xffff, 0x023c, { 20, 16, 12, 12}}, - {m68k_op_andi_16_aw , 0xffff, 0x0278, { 20, 20, 8, 8}}, - {m68k_op_andi_16_al , 0xffff, 0x0279, { 24, 24, 8, 8}}, - {m68k_op_andi_16_tos , 0xffff, 0x027c, { 20, 16, 12, 12}}, - {m68k_op_andi_32_aw , 0xffff, 0x02b8, { 32, 32, 8, 8}}, - {m68k_op_andi_32_al , 0xffff, 0x02b9, { 36, 36, 8, 8}}, - {m68k_op_chk2cmp2_16_aw , 0xffff, 0x02f8, { 0, 0, 22, 22}}, - {m68k_op_chk2cmp2_16_al , 0xffff, 0x02f9, { 0, 0, 22, 22}}, - {m68k_op_chk2cmp2_16_pcdi , 0xffff, 0x02fa, { 0, 0, 23, 23}}, - {m68k_op_chk2cmp2_16_pcix , 0xffff, 0x02fb, { 0, 0, 23, 23}}, - {m68k_op_subi_8_pi7 , 0xffff, 0x041f, { 16, 16, 8, 8}}, - {m68k_op_subi_8_pd7 , 0xffff, 0x0427, { 18, 18, 9, 9}}, - {m68k_op_subi_8_aw , 0xffff, 0x0438, { 20, 20, 8, 8}}, - {m68k_op_subi_8_al , 0xffff, 0x0439, { 24, 24, 8, 8}}, - {m68k_op_subi_16_aw , 0xffff, 0x0478, { 20, 20, 8, 8}}, - {m68k_op_subi_16_al , 0xffff, 0x0479, { 24, 24, 8, 8}}, - {m68k_op_subi_32_aw , 0xffff, 0x04b8, { 32, 32, 8, 8}}, - {m68k_op_subi_32_al , 0xffff, 0x04b9, { 36, 36, 8, 8}}, - {m68k_op_chk2cmp2_32_aw , 0xffff, 0x04f8, { 0, 0, 22, 22}}, - {m68k_op_chk2cmp2_32_al , 0xffff, 0x04f9, { 0, 0, 22, 22}}, - {m68k_op_chk2cmp2_32_pcdi , 0xffff, 0x04fa, { 0, 0, 23, 23}}, - {m68k_op_chk2cmp2_32_pcix , 0xffff, 0x04fb, { 0, 0, 23, 23}}, - {m68k_op_addi_8_pi7 , 0xffff, 0x061f, { 16, 16, 8, 8}}, - {m68k_op_addi_8_pd7 , 0xffff, 0x0627, { 18, 18, 9, 9}}, - {m68k_op_addi_8_aw , 0xffff, 0x0638, { 20, 20, 8, 8}}, - {m68k_op_addi_8_al , 0xffff, 0x0639, { 24, 24, 8, 8}}, - {m68k_op_addi_16_aw , 0xffff, 0x0678, { 20, 20, 8, 8}}, - {m68k_op_addi_16_al , 0xffff, 0x0679, { 24, 24, 8, 8}}, - {m68k_op_addi_32_aw , 0xffff, 0x06b8, { 32, 32, 8, 8}}, - {m68k_op_addi_32_al , 0xffff, 0x06b9, { 36, 36, 8, 8}}, - {m68k_op_callm_32_aw , 0xffff, 0x06f8, { 0, 0, 64, 64}}, - {m68k_op_callm_32_al , 0xffff, 0x06f9, { 0, 0, 64, 64}}, - {m68k_op_callm_32_pcdi , 0xffff, 0x06fa, { 0, 0, 65, 65}}, - {m68k_op_callm_32_pcix , 0xffff, 0x06fb, { 0, 0, 67, 67}}, - {m68k_op_btst_8_s_pi7 , 0xffff, 0x081f, { 12, 12, 8, 8}}, - {m68k_op_btst_8_s_pd7 , 0xffff, 0x0827, { 14, 14, 9, 9}}, - {m68k_op_btst_8_s_aw , 0xffff, 0x0838, { 16, 16, 8, 8}}, - {m68k_op_btst_8_s_al , 0xffff, 0x0839, { 20, 20, 8, 8}}, - {m68k_op_btst_8_s_pcdi , 0xffff, 0x083a, { 16, 16, 9, 9}}, - {m68k_op_btst_8_s_pcix , 0xffff, 0x083b, { 18, 18, 11, 11}}, - {m68k_op_bchg_8_s_pi7 , 0xffff, 0x085f, { 16, 16, 8, 8}}, - {m68k_op_bchg_8_s_pd7 , 0xffff, 0x0867, { 18, 18, 9, 9}}, - {m68k_op_bchg_8_s_aw , 0xffff, 0x0878, { 20, 20, 8, 8}}, - {m68k_op_bchg_8_s_al , 0xffff, 0x0879, { 24, 24, 8, 8}}, - {m68k_op_bclr_8_s_pi7 , 0xffff, 0x089f, { 16, 16, 8, 8}}, - {m68k_op_bclr_8_s_pd7 , 0xffff, 0x08a7, { 18, 18, 9, 9}}, - {m68k_op_bclr_8_s_aw , 0xffff, 0x08b8, { 20, 20, 8, 8}}, - {m68k_op_bclr_8_s_al , 0xffff, 0x08b9, { 24, 24, 8, 8}}, - {m68k_op_bset_8_s_pi7 , 0xffff, 0x08df, { 16, 16, 8, 8}}, - {m68k_op_bset_8_s_pd7 , 0xffff, 0x08e7, { 18, 18, 9, 9}}, - {m68k_op_bset_8_s_aw , 0xffff, 0x08f8, { 20, 20, 8, 8}}, - {m68k_op_bset_8_s_al , 0xffff, 0x08f9, { 24, 24, 8, 8}}, - {m68k_op_eori_8_pi7 , 0xffff, 0x0a1f, { 16, 16, 8, 8}}, - {m68k_op_eori_8_pd7 , 0xffff, 0x0a27, { 18, 18, 9, 9}}, - {m68k_op_eori_8_aw , 0xffff, 0x0a38, { 20, 20, 8, 8}}, - {m68k_op_eori_8_al , 0xffff, 0x0a39, { 24, 24, 8, 8}}, - {m68k_op_eori_16_toc , 0xffff, 0x0a3c, { 20, 16, 12, 12}}, - {m68k_op_eori_16_aw , 0xffff, 0x0a78, { 20, 20, 8, 8}}, - {m68k_op_eori_16_al , 0xffff, 0x0a79, { 24, 24, 8, 8}}, - {m68k_op_eori_16_tos , 0xffff, 0x0a7c, { 20, 16, 12, 12}}, - {m68k_op_eori_32_aw , 0xffff, 0x0ab8, { 32, 32, 8, 8}}, - {m68k_op_eori_32_al , 0xffff, 0x0ab9, { 36, 36, 8, 8}}, - {m68k_op_cas_8_pi7 , 0xffff, 0x0adf, { 0, 0, 16, 16}}, - {m68k_op_cas_8_pd7 , 0xffff, 0x0ae7, { 0, 0, 17, 17}}, - {m68k_op_cas_8_aw , 0xffff, 0x0af8, { 0, 0, 16, 16}}, - {m68k_op_cas_8_al , 0xffff, 0x0af9, { 0, 0, 16, 16}}, - {m68k_op_cmpi_8_pi7 , 0xffff, 0x0c1f, { 12, 12, 6, 6}}, - {m68k_op_cmpi_8_pd7 , 0xffff, 0x0c27, { 14, 14, 7, 7}}, - {m68k_op_cmpi_8_aw , 0xffff, 0x0c38, { 16, 16, 6, 6}}, - {m68k_op_cmpi_8_al , 0xffff, 0x0c39, { 20, 20, 6, 6}}, - {m68k_op_cmpi_8_pcdi , 0xffff, 0x0c3a, { 0, 0, 7, 7}}, - {m68k_op_cmpi_8_pcix , 0xffff, 0x0c3b, { 0, 0, 9, 9}}, - {m68k_op_cmpi_16_aw , 0xffff, 0x0c78, { 16, 16, 6, 6}}, - {m68k_op_cmpi_16_al , 0xffff, 0x0c79, { 20, 20, 6, 6}}, - {m68k_op_cmpi_16_pcdi , 0xffff, 0x0c7a, { 0, 0, 7, 7}}, - {m68k_op_cmpi_16_pcix , 0xffff, 0x0c7b, { 0, 0, 9, 9}}, - {m68k_op_cmpi_32_aw , 0xffff, 0x0cb8, { 24, 24, 6, 6}}, - {m68k_op_cmpi_32_al , 0xffff, 0x0cb9, { 28, 28, 6, 6}}, - {m68k_op_cmpi_32_pcdi , 0xffff, 0x0cba, { 0, 0, 7, 7}}, - {m68k_op_cmpi_32_pcix , 0xffff, 0x0cbb, { 0, 0, 9, 9}}, - {m68k_op_cas_16_aw , 0xffff, 0x0cf8, { 0, 0, 16, 16}}, - {m68k_op_cas_16_al , 0xffff, 0x0cf9, { 0, 0, 16, 16}}, - {m68k_op_cas2_16 , 0xffff, 0x0cfc, { 0, 0, 12, 12}}, - {m68k_op_moves_8_pi7 , 0xffff, 0x0e1f, { 0, 18, 9, 9}}, - {m68k_op_moves_8_pd7 , 0xffff, 0x0e27, { 0, 20, 10, 10}}, - {m68k_op_moves_8_aw , 0xffff, 0x0e38, { 0, 26, 9, 9}}, - {m68k_op_moves_8_al , 0xffff, 0x0e39, { 0, 30, 9, 9}}, - {m68k_op_moves_16_aw , 0xffff, 0x0e78, { 0, 26, 9, 9}}, - {m68k_op_moves_16_al , 0xffff, 0x0e79, { 0, 30, 9, 9}}, - {m68k_op_moves_32_aw , 0xffff, 0x0eb8, { 0, 32, 9, 9}}, - {m68k_op_moves_32_al , 0xffff, 0x0eb9, { 0, 36, 9, 9}}, - {m68k_op_cas_32_aw , 0xffff, 0x0ef8, { 0, 0, 16, 16}}, - {m68k_op_cas_32_al , 0xffff, 0x0ef9, { 0, 0, 16, 16}}, - {m68k_op_cas2_32 , 0xffff, 0x0efc, { 0, 0, 12, 12}}, - {m68k_op_move_8_aw_pi7 , 0xffff, 0x11df, { 16, 16, 8, 8}}, - {m68k_op_move_8_aw_pd7 , 0xffff, 0x11e7, { 18, 18, 9, 9}}, - {m68k_op_move_8_aw_aw , 0xffff, 0x11f8, { 20, 20, 8, 8}}, - {m68k_op_move_8_aw_al , 0xffff, 0x11f9, { 24, 24, 8, 8}}, - {m68k_op_move_8_aw_pcdi , 0xffff, 0x11fa, { 20, 20, 9, 9}}, - {m68k_op_move_8_aw_pcix , 0xffff, 0x11fb, { 22, 22, 11, 11}}, - {m68k_op_move_8_aw_i , 0xffff, 0x11fc, { 16, 16, 6, 6}}, - {m68k_op_move_8_al_pi7 , 0xffff, 0x13df, { 20, 20, 10, 10}}, - {m68k_op_move_8_al_pd7 , 0xffff, 0x13e7, { 22, 22, 11, 11}}, - {m68k_op_move_8_al_aw , 0xffff, 0x13f8, { 24, 24, 10, 10}}, - {m68k_op_move_8_al_al , 0xffff, 0x13f9, { 28, 28, 10, 10}}, - {m68k_op_move_8_al_pcdi , 0xffff, 0x13fa, { 24, 24, 11, 11}}, - {m68k_op_move_8_al_pcix , 0xffff, 0x13fb, { 26, 26, 13, 13}}, - {m68k_op_move_8_al_i , 0xffff, 0x13fc, { 20, 20, 8, 8}}, - {m68k_op_move_8_pi7_pi7 , 0xffff, 0x1edf, { 12, 12, 8, 8}}, - {m68k_op_move_8_pi7_pd7 , 0xffff, 0x1ee7, { 14, 14, 9, 9}}, - {m68k_op_move_8_pi7_aw , 0xffff, 0x1ef8, { 16, 16, 8, 8}}, - {m68k_op_move_8_pi7_al , 0xffff, 0x1ef9, { 20, 20, 8, 8}}, - {m68k_op_move_8_pi7_pcdi , 0xffff, 0x1efa, { 16, 16, 9, 9}}, - {m68k_op_move_8_pi7_pcix , 0xffff, 0x1efb, { 18, 18, 11, 11}}, - {m68k_op_move_8_pi7_i , 0xffff, 0x1efc, { 12, 12, 6, 6}}, - {m68k_op_move_8_pd7_pi7 , 0xffff, 0x1f1f, { 12, 12, 9, 9}}, - {m68k_op_move_8_pd7_pd7 , 0xffff, 0x1f27, { 14, 14, 10, 10}}, - {m68k_op_move_8_pd7_aw , 0xffff, 0x1f38, { 16, 16, 9, 9}}, - {m68k_op_move_8_pd7_al , 0xffff, 0x1f39, { 20, 20, 9, 9}}, - {m68k_op_move_8_pd7_pcdi , 0xffff, 0x1f3a, { 16, 16, 10, 10}}, - {m68k_op_move_8_pd7_pcix , 0xffff, 0x1f3b, { 18, 18, 12, 12}}, - {m68k_op_move_8_pd7_i , 0xffff, 0x1f3c, { 12, 12, 7, 7}}, - {m68k_op_move_32_aw_aw , 0xffff, 0x21f8, { 28, 28, 8, 8}}, - {m68k_op_move_32_aw_al , 0xffff, 0x21f9, { 32, 32, 8, 8}}, - {m68k_op_move_32_aw_pcdi , 0xffff, 0x21fa, { 28, 28, 9, 9}}, - {m68k_op_move_32_aw_pcix , 0xffff, 0x21fb, { 30, 30, 11, 11}}, - {m68k_op_move_32_aw_i , 0xffff, 0x21fc, { 24, 24, 8, 8}}, - {m68k_op_move_32_al_aw , 0xffff, 0x23f8, { 32, 32, 10, 10}}, - {m68k_op_move_32_al_al , 0xffff, 0x23f9, { 36, 36, 10, 10}}, - {m68k_op_move_32_al_pcdi , 0xffff, 0x23fa, { 32, 32, 11, 11}}, - {m68k_op_move_32_al_pcix , 0xffff, 0x23fb, { 34, 34, 13, 13}}, - {m68k_op_move_32_al_i , 0xffff, 0x23fc, { 28, 28, 10, 10}}, - {m68k_op_move_16_aw_aw , 0xffff, 0x31f8, { 20, 20, 8, 8}}, - {m68k_op_move_16_aw_al , 0xffff, 0x31f9, { 24, 24, 8, 8}}, - {m68k_op_move_16_aw_pcdi , 0xffff, 0x31fa, { 20, 20, 9, 9}}, - {m68k_op_move_16_aw_pcix , 0xffff, 0x31fb, { 22, 22, 11, 11}}, - {m68k_op_move_16_aw_i , 0xffff, 0x31fc, { 16, 16, 6, 6}}, - {m68k_op_move_16_al_aw , 0xffff, 0x33f8, { 24, 24, 10, 10}}, - {m68k_op_move_16_al_al , 0xffff, 0x33f9, { 28, 28, 10, 10}}, - {m68k_op_move_16_al_pcdi , 0xffff, 0x33fa, { 24, 24, 11, 11}}, - {m68k_op_move_16_al_pcix , 0xffff, 0x33fb, { 26, 26, 13, 13}}, - {m68k_op_move_16_al_i , 0xffff, 0x33fc, { 20, 20, 8, 8}}, - {m68k_op_negx_8_pi7 , 0xffff, 0x401f, { 12, 12, 8, 8}}, - {m68k_op_negx_8_pd7 , 0xffff, 0x4027, { 14, 14, 9, 9}}, - {m68k_op_negx_8_aw , 0xffff, 0x4038, { 16, 16, 8, 8}}, - {m68k_op_negx_8_al , 0xffff, 0x4039, { 20, 20, 8, 8}}, - {m68k_op_negx_16_aw , 0xffff, 0x4078, { 16, 16, 8, 8}}, - {m68k_op_negx_16_al , 0xffff, 0x4079, { 20, 20, 8, 8}}, - {m68k_op_negx_32_aw , 0xffff, 0x40b8, { 24, 24, 8, 8}}, - {m68k_op_negx_32_al , 0xffff, 0x40b9, { 28, 28, 8, 8}}, - {m68k_op_move_16_frs_aw , 0xffff, 0x40f8, { 16, 16, 12, 12}}, - {m68k_op_move_16_frs_al , 0xffff, 0x40f9, { 20, 20, 12, 12}}, - {m68k_op_clr_8_pi7 , 0xffff, 0x421f, { 12, 8, 8, 8}}, - {m68k_op_clr_8_pd7 , 0xffff, 0x4227, { 14, 10, 9, 9}}, - {m68k_op_clr_8_aw , 0xffff, 0x4238, { 16, 12, 8, 8}}, - {m68k_op_clr_8_al , 0xffff, 0x4239, { 20, 14, 8, 8}}, - {m68k_op_clr_16_aw , 0xffff, 0x4278, { 16, 12, 8, 8}}, - {m68k_op_clr_16_al , 0xffff, 0x4279, { 20, 14, 8, 8}}, - {m68k_op_clr_32_aw , 0xffff, 0x42b8, { 24, 16, 8, 8}}, - {m68k_op_clr_32_al , 0xffff, 0x42b9, { 28, 20, 8, 8}}, - {m68k_op_move_16_frc_aw , 0xffff, 0x42f8, { 0, 16, 8, 8}}, - {m68k_op_move_16_frc_al , 0xffff, 0x42f9, { 0, 20, 8, 8}}, - {m68k_op_neg_8_pi7 , 0xffff, 0x441f, { 12, 12, 8, 8}}, - {m68k_op_neg_8_pd7 , 0xffff, 0x4427, { 14, 14, 9, 9}}, - {m68k_op_neg_8_aw , 0xffff, 0x4438, { 16, 16, 8, 8}}, - {m68k_op_neg_8_al , 0xffff, 0x4439, { 20, 20, 8, 8}}, - {m68k_op_neg_16_aw , 0xffff, 0x4478, { 16, 16, 8, 8}}, - {m68k_op_neg_16_al , 0xffff, 0x4479, { 20, 20, 8, 8}}, - {m68k_op_neg_32_aw , 0xffff, 0x44b8, { 24, 24, 8, 8}}, - {m68k_op_neg_32_al , 0xffff, 0x44b9, { 28, 28, 8, 8}}, - {m68k_op_move_16_toc_aw , 0xffff, 0x44f8, { 20, 20, 8, 8}}, - {m68k_op_move_16_toc_al , 0xffff, 0x44f9, { 24, 24, 8, 8}}, - {m68k_op_move_16_toc_pcdi , 0xffff, 0x44fa, { 20, 20, 9, 9}}, - {m68k_op_move_16_toc_pcix , 0xffff, 0x44fb, { 22, 22, 11, 11}}, - {m68k_op_move_16_toc_i , 0xffff, 0x44fc, { 16, 16, 6, 6}}, - {m68k_op_not_8_pi7 , 0xffff, 0x461f, { 12, 12, 8, 8}}, - {m68k_op_not_8_pd7 , 0xffff, 0x4627, { 14, 14, 9, 9}}, - {m68k_op_not_8_aw , 0xffff, 0x4638, { 16, 16, 8, 8}}, - {m68k_op_not_8_al , 0xffff, 0x4639, { 20, 20, 8, 8}}, - {m68k_op_not_16_aw , 0xffff, 0x4678, { 16, 16, 8, 8}}, - {m68k_op_not_16_al , 0xffff, 0x4679, { 20, 20, 8, 8}}, - {m68k_op_not_32_aw , 0xffff, 0x46b8, { 24, 24, 8, 8}}, - {m68k_op_not_32_al , 0xffff, 0x46b9, { 28, 28, 8, 8}}, - {m68k_op_move_16_tos_aw , 0xffff, 0x46f8, { 20, 20, 12, 12}}, - {m68k_op_move_16_tos_al , 0xffff, 0x46f9, { 24, 24, 12, 12}}, - {m68k_op_move_16_tos_pcdi , 0xffff, 0x46fa, { 20, 20, 13, 13}}, - {m68k_op_move_16_tos_pcix , 0xffff, 0x46fb, { 22, 22, 15, 15}}, - {m68k_op_move_16_tos_i , 0xffff, 0x46fc, { 16, 16, 10, 10}}, - {m68k_op_link_32_a7 , 0xffff, 0x480f, { 0, 0, 6, 6}}, - {m68k_op_nbcd_8_pi7 , 0xffff, 0x481f, { 12, 12, 10, 10}}, - {m68k_op_nbcd_8_pd7 , 0xffff, 0x4827, { 14, 14, 11, 11}}, - {m68k_op_nbcd_8_aw , 0xffff, 0x4838, { 16, 16, 10, 10}}, - {m68k_op_nbcd_8_al , 0xffff, 0x4839, { 20, 20, 10, 10}}, - {m68k_op_pea_32_aw , 0xffff, 0x4878, { 16, 16, 9, 9}}, - {m68k_op_pea_32_al , 0xffff, 0x4879, { 20, 20, 9, 9}}, - {m68k_op_pea_32_pcdi , 0xffff, 0x487a, { 16, 16, 10, 10}}, - {m68k_op_pea_32_pcix , 0xffff, 0x487b, { 20, 20, 12, 12}}, - {m68k_op_movem_16_re_aw , 0xffff, 0x48b8, { 12, 12, 8, 8}}, - {m68k_op_movem_16_re_al , 0xffff, 0x48b9, { 16, 16, 8, 8}}, - {m68k_op_movem_32_re_aw , 0xffff, 0x48f8, { 12, 12, 8, 8}}, - {m68k_op_movem_32_re_al , 0xffff, 0x48f9, { 16, 16, 8, 8}}, - {m68k_op_tst_8_pi7 , 0xffff, 0x4a1f, { 8, 8, 6, 6}}, - {m68k_op_tst_8_pd7 , 0xffff, 0x4a27, { 10, 10, 7, 7}}, - {m68k_op_tst_8_aw , 0xffff, 0x4a38, { 12, 12, 6, 6}}, - {m68k_op_tst_8_al , 0xffff, 0x4a39, { 16, 16, 6, 6}}, - {m68k_op_tst_8_pcdi , 0xffff, 0x4a3a, { 0, 0, 7, 7}}, - {m68k_op_tst_8_pcix , 0xffff, 0x4a3b, { 0, 0, 9, 9}}, - {m68k_op_tst_8_i , 0xffff, 0x4a3c, { 0, 0, 6, 6}}, - {m68k_op_tst_16_aw , 0xffff, 0x4a78, { 12, 12, 6, 6}}, - {m68k_op_tst_16_al , 0xffff, 0x4a79, { 16, 16, 6, 6}}, - {m68k_op_tst_16_pcdi , 0xffff, 0x4a7a, { 0, 0, 7, 7}}, - {m68k_op_tst_16_pcix , 0xffff, 0x4a7b, { 0, 0, 9, 9}}, - {m68k_op_tst_16_i , 0xffff, 0x4a7c, { 0, 0, 6, 6}}, - {m68k_op_tst_32_aw , 0xffff, 0x4ab8, { 16, 16, 6, 6}}, - {m68k_op_tst_32_al , 0xffff, 0x4ab9, { 20, 20, 6, 6}}, - {m68k_op_tst_32_pcdi , 0xffff, 0x4aba, { 0, 0, 7, 7}}, - {m68k_op_tst_32_pcix , 0xffff, 0x4abb, { 0, 0, 9, 9}}, - {m68k_op_tst_32_i , 0xffff, 0x4abc, { 0, 0, 6, 6}}, - {m68k_op_tas_8_pi7 , 0xffff, 0x4adf, { 18, 18, 16, 16}}, - {m68k_op_tas_8_pd7 , 0xffff, 0x4ae7, { 20, 20, 17, 17}}, - {m68k_op_tas_8_aw , 0xffff, 0x4af8, { 22, 22, 16, 16}}, - {m68k_op_tas_8_al , 0xffff, 0x4af9, { 26, 26, 16, 16}}, - {m68k_op_illegal , 0xffff, 0x4afc, { 4, 4, 4, 4}}, - {m68k_op_mull_32_aw , 0xffff, 0x4c38, { 0, 0, 47, 47}}, - {m68k_op_mull_32_al , 0xffff, 0x4c39, { 0, 0, 47, 47}}, - {m68k_op_mull_32_pcdi , 0xffff, 0x4c3a, { 0, 0, 48, 48}}, - {m68k_op_mull_32_pcix , 0xffff, 0x4c3b, { 0, 0, 50, 50}}, - {m68k_op_mull_32_i , 0xffff, 0x4c3c, { 0, 0, 47, 47}}, - {m68k_op_divl_32_aw , 0xffff, 0x4c78, { 0, 0, 88, 88}}, - {m68k_op_divl_32_al , 0xffff, 0x4c79, { 0, 0, 88, 88}}, - {m68k_op_divl_32_pcdi , 0xffff, 0x4c7a, { 0, 0, 89, 89}}, - {m68k_op_divl_32_pcix , 0xffff, 0x4c7b, { 0, 0, 91, 91}}, - {m68k_op_divl_32_i , 0xffff, 0x4c7c, { 0, 0, 88, 88}}, - {m68k_op_movem_16_er_aw , 0xffff, 0x4cb8, { 16, 16, 12, 12}}, - {m68k_op_movem_16_er_al , 0xffff, 0x4cb9, { 20, 20, 12, 12}}, - {m68k_op_movem_16_er_pcdi , 0xffff, 0x4cba, { 16, 16, 9, 9}}, - {m68k_op_movem_16_er_pcix , 0xffff, 0x4cbb, { 18, 18, 11, 11}}, - {m68k_op_movem_32_er_aw , 0xffff, 0x4cf8, { 16, 16, 12, 12}}, - {m68k_op_movem_32_er_al , 0xffff, 0x4cf9, { 20, 20, 12, 12}}, - {m68k_op_movem_32_er_pcdi , 0xffff, 0x4cfa, { 16, 16, 9, 9}}, - {m68k_op_movem_32_er_pcix , 0xffff, 0x4cfb, { 18, 18, 11, 11}}, - {m68k_op_link_16_a7 , 0xffff, 0x4e57, { 16, 16, 5, 5}}, - {m68k_op_unlk_32_a7 , 0xffff, 0x4e5f, { 12, 12, 6, 6}}, - {m68k_op_reset , 0xffff, 0x4e70, { 0, 0, 0, 0}}, - {m68k_op_nop , 0xffff, 0x4e71, { 4, 4, 2, 2}}, - {m68k_op_stop , 0xffff, 0x4e72, { 4, 4, 8, 8}}, - {m68k_op_rte_32 , 0xffff, 0x4e73, { 20, 24, 20, 20}}, - {m68k_op_rtd_32 , 0xffff, 0x4e74, { 0, 16, 10, 10}}, - {m68k_op_rts_32 , 0xffff, 0x4e75, { 16, 16, 10, 10}}, - {m68k_op_trapv , 0xffff, 0x4e76, { 4, 4, 4, 4}}, - {m68k_op_rtr_32 , 0xffff, 0x4e77, { 20, 20, 14, 14}}, - {m68k_op_movec_32_cr , 0xffff, 0x4e7a, { 0, 12, 6, 6}}, - {m68k_op_movec_32_rc , 0xffff, 0x4e7b, { 0, 10, 12, 12}}, - {m68k_op_jsr_32_aw , 0xffff, 0x4eb8, { 18, 18, 4, 4}}, - {m68k_op_jsr_32_al , 0xffff, 0x4eb9, { 20, 20, 4, 4}}, - {m68k_op_jsr_32_pcdi , 0xffff, 0x4eba, { 18, 18, 5, 5}}, - {m68k_op_jsr_32_pcix , 0xffff, 0x4ebb, { 22, 22, 7, 7}}, - {m68k_op_jmp_32_aw , 0xffff, 0x4ef8, { 10, 10, 4, 4}}, - {m68k_op_jmp_32_al , 0xffff, 0x4ef9, { 12, 12, 4, 4}}, - {m68k_op_jmp_32_pcdi , 0xffff, 0x4efa, { 10, 10, 5, 5}}, - {m68k_op_jmp_32_pcix , 0xffff, 0x4efb, { 14, 14, 7, 7}}, - {m68k_op_st_8_pi7 , 0xffff, 0x50df, { 12, 12, 10, 10}}, - {m68k_op_st_8_pd7 , 0xffff, 0x50e7, { 14, 14, 11, 11}}, - {m68k_op_st_8_aw , 0xffff, 0x50f8, { 16, 16, 10, 10}}, - {m68k_op_st_8_al , 0xffff, 0x50f9, { 20, 20, 10, 10}}, - {m68k_op_trapt_16 , 0xffff, 0x50fa, { 0, 0, 6, 6}}, - {m68k_op_trapt_32 , 0xffff, 0x50fb, { 0, 0, 8, 8}}, - {m68k_op_trapt , 0xffff, 0x50fc, { 0, 0, 4, 4}}, - {m68k_op_sf_8_pi7 , 0xffff, 0x51df, { 12, 12, 10, 10}}, - {m68k_op_sf_8_pd7 , 0xffff, 0x51e7, { 14, 14, 11, 11}}, - {m68k_op_sf_8_aw , 0xffff, 0x51f8, { 16, 16, 10, 10}}, - {m68k_op_sf_8_al , 0xffff, 0x51f9, { 20, 20, 10, 10}}, - {m68k_op_trapf_16 , 0xffff, 0x51fa, { 0, 0, 6, 6}}, - {m68k_op_trapf_32 , 0xffff, 0x51fb, { 0, 0, 8, 8}}, - {m68k_op_trapf , 0xffff, 0x51fc, { 0, 0, 4, 4}}, - {m68k_op_shi_8_pi7 , 0xffff, 0x52df, { 12, 12, 10, 10}}, - {m68k_op_shi_8_pd7 , 0xffff, 0x52e7, { 14, 14, 11, 11}}, - {m68k_op_shi_8_aw , 0xffff, 0x52f8, { 16, 16, 10, 10}}, - {m68k_op_shi_8_al , 0xffff, 0x52f9, { 20, 20, 10, 10}}, - {m68k_op_traphi_16 , 0xffff, 0x52fa, { 0, 0, 6, 6}}, - {m68k_op_traphi_32 , 0xffff, 0x52fb, { 0, 0, 8, 8}}, - {m68k_op_traphi , 0xffff, 0x52fc, { 0, 0, 4, 4}}, - {m68k_op_sls_8_pi7 , 0xffff, 0x53df, { 12, 12, 10, 10}}, - {m68k_op_sls_8_pd7 , 0xffff, 0x53e7, { 14, 14, 11, 11}}, - {m68k_op_sls_8_aw , 0xffff, 0x53f8, { 16, 16, 10, 10}}, - {m68k_op_sls_8_al , 0xffff, 0x53f9, { 20, 20, 10, 10}}, - {m68k_op_trapls_16 , 0xffff, 0x53fa, { 0, 0, 6, 6}}, - {m68k_op_trapls_32 , 0xffff, 0x53fb, { 0, 0, 8, 8}}, - {m68k_op_trapls , 0xffff, 0x53fc, { 0, 0, 4, 4}}, - {m68k_op_scc_8_pi7 , 0xffff, 0x54df, { 12, 12, 10, 10}}, - {m68k_op_scc_8_pd7 , 0xffff, 0x54e7, { 14, 14, 11, 11}}, - {m68k_op_scc_8_aw , 0xffff, 0x54f8, { 16, 16, 10, 10}}, - {m68k_op_scc_8_al , 0xffff, 0x54f9, { 20, 20, 10, 10}}, - {m68k_op_trapcc_16 , 0xffff, 0x54fa, { 0, 0, 6, 6}}, - {m68k_op_trapcc_32 , 0xffff, 0x54fb, { 0, 0, 8, 8}}, - {m68k_op_trapcc , 0xffff, 0x54fc, { 0, 0, 4, 4}}, - {m68k_op_scs_8_pi7 , 0xffff, 0x55df, { 12, 12, 10, 10}}, - {m68k_op_scs_8_pd7 , 0xffff, 0x55e7, { 14, 14, 11, 11}}, - {m68k_op_scs_8_aw , 0xffff, 0x55f8, { 16, 16, 10, 10}}, - {m68k_op_scs_8_al , 0xffff, 0x55f9, { 20, 20, 10, 10}}, - {m68k_op_trapcs_16 , 0xffff, 0x55fa, { 0, 0, 6, 6}}, - {m68k_op_trapcs_32 , 0xffff, 0x55fb, { 0, 0, 8, 8}}, - {m68k_op_trapcs , 0xffff, 0x55fc, { 0, 0, 4, 4}}, - {m68k_op_sne_8_pi7 , 0xffff, 0x56df, { 12, 12, 10, 10}}, - {m68k_op_sne_8_pd7 , 0xffff, 0x56e7, { 14, 14, 11, 11}}, - {m68k_op_sne_8_aw , 0xffff, 0x56f8, { 16, 16, 10, 10}}, - {m68k_op_sne_8_al , 0xffff, 0x56f9, { 20, 20, 10, 10}}, - {m68k_op_trapne_16 , 0xffff, 0x56fa, { 0, 0, 6, 6}}, - {m68k_op_trapne_32 , 0xffff, 0x56fb, { 0, 0, 8, 8}}, - {m68k_op_trapne , 0xffff, 0x56fc, { 0, 0, 4, 4}}, - {m68k_op_seq_8_pi7 , 0xffff, 0x57df, { 12, 12, 10, 10}}, - {m68k_op_seq_8_pd7 , 0xffff, 0x57e7, { 14, 14, 11, 11}}, - {m68k_op_seq_8_aw , 0xffff, 0x57f8, { 16, 16, 10, 10}}, - {m68k_op_seq_8_al , 0xffff, 0x57f9, { 20, 20, 10, 10}}, - {m68k_op_trapeq_16 , 0xffff, 0x57fa, { 0, 0, 6, 6}}, - {m68k_op_trapeq_32 , 0xffff, 0x57fb, { 0, 0, 8, 8}}, - {m68k_op_trapeq , 0xffff, 0x57fc, { 0, 0, 4, 4}}, - {m68k_op_svc_8_pi7 , 0xffff, 0x58df, { 12, 12, 10, 10}}, - {m68k_op_svc_8_pd7 , 0xffff, 0x58e7, { 14, 14, 11, 11}}, - {m68k_op_svc_8_aw , 0xffff, 0x58f8, { 16, 16, 10, 10}}, - {m68k_op_svc_8_al , 0xffff, 0x58f9, { 20, 20, 10, 10}}, - {m68k_op_trapvc_16 , 0xffff, 0x58fa, { 0, 0, 6, 6}}, - {m68k_op_trapvc_32 , 0xffff, 0x58fb, { 0, 0, 8, 8}}, - {m68k_op_trapvc , 0xffff, 0x58fc, { 0, 0, 4, 4}}, - {m68k_op_svs_8_pi7 , 0xffff, 0x59df, { 12, 12, 10, 10}}, - {m68k_op_svs_8_pd7 , 0xffff, 0x59e7, { 14, 14, 11, 11}}, - {m68k_op_svs_8_aw , 0xffff, 0x59f8, { 16, 16, 10, 10}}, - {m68k_op_svs_8_al , 0xffff, 0x59f9, { 20, 20, 10, 10}}, - {m68k_op_trapvs_16 , 0xffff, 0x59fa, { 0, 0, 6, 6}}, - {m68k_op_trapvs_32 , 0xffff, 0x59fb, { 0, 0, 8, 8}}, - {m68k_op_trapvs , 0xffff, 0x59fc, { 0, 0, 4, 4}}, - {m68k_op_spl_8_pi7 , 0xffff, 0x5adf, { 12, 12, 10, 10}}, - {m68k_op_spl_8_pd7 , 0xffff, 0x5ae7, { 14, 14, 11, 11}}, - {m68k_op_spl_8_aw , 0xffff, 0x5af8, { 16, 16, 10, 10}}, - {m68k_op_spl_8_al , 0xffff, 0x5af9, { 20, 20, 10, 10}}, - {m68k_op_trappl_16 , 0xffff, 0x5afa, { 0, 0, 6, 6}}, - {m68k_op_trappl_32 , 0xffff, 0x5afb, { 0, 0, 8, 8}}, - {m68k_op_trappl , 0xffff, 0x5afc, { 0, 0, 4, 4}}, - {m68k_op_smi_8_pi7 , 0xffff, 0x5bdf, { 12, 12, 10, 10}}, - {m68k_op_smi_8_pd7 , 0xffff, 0x5be7, { 14, 14, 11, 11}}, - {m68k_op_smi_8_aw , 0xffff, 0x5bf8, { 16, 16, 10, 10}}, - {m68k_op_smi_8_al , 0xffff, 0x5bf9, { 20, 20, 10, 10}}, - {m68k_op_trapmi_16 , 0xffff, 0x5bfa, { 0, 0, 6, 6}}, - {m68k_op_trapmi_32 , 0xffff, 0x5bfb, { 0, 0, 8, 8}}, - {m68k_op_trapmi , 0xffff, 0x5bfc, { 0, 0, 4, 4}}, - {m68k_op_sge_8_pi7 , 0xffff, 0x5cdf, { 12, 12, 10, 10}}, - {m68k_op_sge_8_pd7 , 0xffff, 0x5ce7, { 14, 14, 11, 11}}, - {m68k_op_sge_8_aw , 0xffff, 0x5cf8, { 16, 16, 10, 10}}, - {m68k_op_sge_8_al , 0xffff, 0x5cf9, { 20, 20, 10, 10}}, - {m68k_op_trapge_16 , 0xffff, 0x5cfa, { 0, 0, 6, 6}}, - {m68k_op_trapge_32 , 0xffff, 0x5cfb, { 0, 0, 8, 8}}, - {m68k_op_trapge , 0xffff, 0x5cfc, { 0, 0, 4, 4}}, - {m68k_op_slt_8_pi7 , 0xffff, 0x5ddf, { 12, 12, 10, 10}}, - {m68k_op_slt_8_pd7 , 0xffff, 0x5de7, { 14, 14, 11, 11}}, - {m68k_op_slt_8_aw , 0xffff, 0x5df8, { 16, 16, 10, 10}}, - {m68k_op_slt_8_al , 0xffff, 0x5df9, { 20, 20, 10, 10}}, - {m68k_op_traplt_16 , 0xffff, 0x5dfa, { 0, 0, 6, 6}}, - {m68k_op_traplt_32 , 0xffff, 0x5dfb, { 0, 0, 8, 8}}, - {m68k_op_traplt , 0xffff, 0x5dfc, { 0, 0, 4, 4}}, - {m68k_op_sgt_8_pi7 , 0xffff, 0x5edf, { 12, 12, 10, 10}}, - {m68k_op_sgt_8_pd7 , 0xffff, 0x5ee7, { 14, 14, 11, 11}}, - {m68k_op_sgt_8_aw , 0xffff, 0x5ef8, { 16, 16, 10, 10}}, - {m68k_op_sgt_8_al , 0xffff, 0x5ef9, { 20, 20, 10, 10}}, - {m68k_op_trapgt_16 , 0xffff, 0x5efa, { 0, 0, 6, 6}}, - {m68k_op_trapgt_32 , 0xffff, 0x5efb, { 0, 0, 8, 8}}, - {m68k_op_trapgt , 0xffff, 0x5efc, { 0, 0, 4, 4}}, - {m68k_op_sle_8_pi7 , 0xffff, 0x5fdf, { 12, 12, 10, 10}}, - {m68k_op_sle_8_pd7 , 0xffff, 0x5fe7, { 14, 14, 11, 11}}, - {m68k_op_sle_8_aw , 0xffff, 0x5ff8, { 16, 16, 10, 10}}, - {m68k_op_sle_8_al , 0xffff, 0x5ff9, { 20, 20, 10, 10}}, - {m68k_op_traple_16 , 0xffff, 0x5ffa, { 0, 0, 6, 6}}, - {m68k_op_traple_32 , 0xffff, 0x5ffb, { 0, 0, 8, 8}}, - {m68k_op_traple , 0xffff, 0x5ffc, { 0, 0, 4, 4}}, - {m68k_op_bra_16 , 0xffff, 0x6000, { 10, 10, 10, 10}}, - {m68k_op_bra_32 , 0xffff, 0x60ff, { 10, 10, 10, 10}}, - {m68k_op_bsr_16 , 0xffff, 0x6100, { 18, 18, 7, 7}}, - {m68k_op_bsr_32 , 0xffff, 0x61ff, { 18, 18, 7, 7}}, - {m68k_op_bhi_16 , 0xffff, 0x6200, { 10, 10, 6, 6}}, - {m68k_op_bhi_32 , 0xffff, 0x62ff, { 10, 10, 6, 6}}, - {m68k_op_bls_16 , 0xffff, 0x6300, { 10, 10, 6, 6}}, - {m68k_op_bls_32 , 0xffff, 0x63ff, { 10, 10, 6, 6}}, - {m68k_op_bcc_16 , 0xffff, 0x6400, { 10, 10, 6, 6}}, - {m68k_op_bcc_32 , 0xffff, 0x64ff, { 10, 10, 6, 6}}, - {m68k_op_bcs_16 , 0xffff, 0x6500, { 10, 10, 6, 6}}, - {m68k_op_bcs_32 , 0xffff, 0x65ff, { 10, 10, 6, 6}}, - {m68k_op_bne_16 , 0xffff, 0x6600, { 10, 10, 6, 6}}, - {m68k_op_bne_32 , 0xffff, 0x66ff, { 10, 10, 6, 6}}, - {m68k_op_beq_16 , 0xffff, 0x6700, { 10, 10, 6, 6}}, - {m68k_op_beq_32 , 0xffff, 0x67ff, { 10, 10, 6, 6}}, - {m68k_op_bvc_16 , 0xffff, 0x6800, { 10, 10, 6, 6}}, - {m68k_op_bvc_32 , 0xffff, 0x68ff, { 10, 10, 6, 6}}, - {m68k_op_bvs_16 , 0xffff, 0x6900, { 10, 10, 6, 6}}, - {m68k_op_bvs_32 , 0xffff, 0x69ff, { 10, 10, 6, 6}}, - {m68k_op_bpl_16 , 0xffff, 0x6a00, { 10, 10, 6, 6}}, - {m68k_op_bpl_32 , 0xffff, 0x6aff, { 10, 10, 6, 6}}, - {m68k_op_bmi_16 , 0xffff, 0x6b00, { 10, 10, 6, 6}}, - {m68k_op_bmi_32 , 0xffff, 0x6bff, { 10, 10, 6, 6}}, - {m68k_op_bge_16 , 0xffff, 0x6c00, { 10, 10, 6, 6}}, - {m68k_op_bge_32 , 0xffff, 0x6cff, { 10, 10, 6, 6}}, - {m68k_op_blt_16 , 0xffff, 0x6d00, { 10, 10, 6, 6}}, - {m68k_op_blt_32 , 0xffff, 0x6dff, { 10, 10, 6, 6}}, - {m68k_op_bgt_16 , 0xffff, 0x6e00, { 10, 10, 6, 6}}, - {m68k_op_bgt_32 , 0xffff, 0x6eff, { 10, 10, 6, 6}}, - {m68k_op_ble_16 , 0xffff, 0x6f00, { 10, 10, 6, 6}}, - {m68k_op_ble_32 , 0xffff, 0x6fff, { 10, 10, 6, 6}}, - {m68k_op_sbcd_8_mm_axy7 , 0xffff, 0x8f0f, { 18, 18, 16, 16}}, - {m68k_op_pack_16_mm_axy7 , 0xffff, 0x8f4f, { 0, 0, 13, 13}}, - {m68k_op_unpk_16_mm_axy7 , 0xffff, 0x8f8f, { 0, 0, 13, 13}}, - {m68k_op_subx_8_mm_axy7 , 0xffff, 0x9f0f, { 18, 18, 12, 12}}, - {m68k_op_cmpm_8_axy7 , 0xffff, 0xbf0f, { 12, 12, 9, 9}}, - {m68k_op_abcd_8_mm_axy7 , 0xffff, 0xcf0f, { 18, 18, 16, 16}}, - {m68k_op_addx_8_mm_axy7 , 0xffff, 0xdf0f, { 18, 18, 12, 12}}, - {m68k_op_asr_16_aw , 0xffff, 0xe0f8, { 16, 16, 9, 9}}, - {m68k_op_asr_16_al , 0xffff, 0xe0f9, { 20, 20, 9, 9}}, - {m68k_op_asl_16_aw , 0xffff, 0xe1f8, { 16, 16, 10, 10}}, - {m68k_op_asl_16_al , 0xffff, 0xe1f9, { 20, 20, 10, 10}}, - {m68k_op_lsr_16_aw , 0xffff, 0xe2f8, { 16, 16, 9, 9}}, - {m68k_op_lsr_16_al , 0xffff, 0xe2f9, { 20, 20, 9, 9}}, - {m68k_op_lsl_16_aw , 0xffff, 0xe3f8, { 16, 16, 9, 9}}, - {m68k_op_lsl_16_al , 0xffff, 0xe3f9, { 20, 20, 9, 9}}, - {m68k_op_roxr_16_aw , 0xffff, 0xe4f8, { 16, 16, 9, 9}}, - {m68k_op_roxr_16_al , 0xffff, 0xe4f9, { 20, 20, 9, 9}}, - {m68k_op_roxl_16_aw , 0xffff, 0xe5f8, { 16, 16, 9, 9}}, - {m68k_op_roxl_16_al , 0xffff, 0xe5f9, { 20, 20, 9, 9}}, - {m68k_op_ror_16_aw , 0xffff, 0xe6f8, { 16, 16, 11, 11}}, - {m68k_op_ror_16_al , 0xffff, 0xe6f9, { 20, 20, 11, 11}}, - {m68k_op_rol_16_aw , 0xffff, 0xe7f8, { 16, 16, 11, 11}}, - {m68k_op_rol_16_al , 0xffff, 0xe7f9, { 20, 20, 11, 11}}, - {m68k_op_bftst_32_aw , 0xffff, 0xe8f8, { 0, 0, 17, 17}}, - {m68k_op_bftst_32_al , 0xffff, 0xe8f9, { 0, 0, 17, 17}}, - {m68k_op_bftst_32_pcdi , 0xffff, 0xe8fa, { 0, 0, 18, 18}}, - {m68k_op_bftst_32_pcix , 0xffff, 0xe8fb, { 0, 0, 20, 20}}, - {m68k_op_bfextu_32_aw , 0xffff, 0xe9f8, { 0, 0, 19, 19}}, - {m68k_op_bfextu_32_al , 0xffff, 0xe9f9, { 0, 0, 19, 19}}, - {m68k_op_bfextu_32_pcdi , 0xffff, 0xe9fa, { 0, 0, 20, 20}}, - {m68k_op_bfextu_32_pcix , 0xffff, 0xe9fb, { 0, 0, 22, 22}}, - {m68k_op_bfchg_32_aw , 0xffff, 0xeaf8, { 0, 0, 24, 24}}, - {m68k_op_bfchg_32_al , 0xffff, 0xeaf9, { 0, 0, 24, 24}}, - {m68k_op_bfexts_32_aw , 0xffff, 0xebf8, { 0, 0, 19, 19}}, - {m68k_op_bfexts_32_al , 0xffff, 0xebf9, { 0, 0, 19, 19}}, - {m68k_op_bfexts_32_pcdi , 0xffff, 0xebfa, { 0, 0, 20, 20}}, - {m68k_op_bfexts_32_pcix , 0xffff, 0xebfb, { 0, 0, 22, 22}}, - {m68k_op_bfclr_32_aw , 0xffff, 0xecf8, { 0, 0, 24, 24}}, - {m68k_op_bfclr_32_al , 0xffff, 0xecf9, { 0, 0, 24, 24}}, - {m68k_op_bfffo_32_aw , 0xffff, 0xedf8, { 0, 0, 32, 32}}, - {m68k_op_bfffo_32_al , 0xffff, 0xedf9, { 0, 0, 32, 32}}, - {m68k_op_bfffo_32_pcdi , 0xffff, 0xedfa, { 0, 0, 33, 33}}, - {m68k_op_bfffo_32_pcix , 0xffff, 0xedfb, { 0, 0, 35, 35}}, - {m68k_op_bfset_32_aw , 0xffff, 0xeef8, { 0, 0, 24, 24}}, - {m68k_op_bfset_32_al , 0xffff, 0xeef9, { 0, 0, 24, 24}}, - {m68k_op_bfins_32_aw , 0xffff, 0xeff8, { 0, 0, 21, 21}}, - {m68k_op_bfins_32_al , 0xffff, 0xeff9, { 0, 0, 21, 21}}, - {m68k_op_pflush_32 , 0xffff, 0xf518, { 0, 0, 0, 4}}, - {0, 0, 0, {0, 0, 0, 0}} + {m68k_op_1010 , 0xf000, 0xa000, { 4, 4, 4, 4}}, + {m68k_op_1111 , 0xf000, 0xf000, { 4, 4, 4, 4}}, + {m68k_op_moveq_32 , 0xf100, 0x7000, { 4, 4, 2, 2}}, + {m68k_op_cpbcc_32 , 0xf180, 0xf080, { 0, 0, 4, 0}}, + {m68k_op_cpgen_32 , 0xf1c0, 0xf000, { 0, 0, 4, 0}}, + {m68k_op_cpscc_32 , 0xf1c0, 0xf040, { 0, 0, 4, 0}}, + {m68k_op_bra_8 , 0xff00, 0x6000, { 10, 10, 10, 10}}, + {m68k_op_bsr_8 , 0xff00, 0x6100, { 18, 18, 7, 7}}, + {m68k_op_bhi_8 , 0xff00, 0x6200, { 10, 10, 6, 6}}, + {m68k_op_bls_8 , 0xff00, 0x6300, { 10, 10, 6, 6}}, + {m68k_op_bcc_8 , 0xff00, 0x6400, { 10, 10, 6, 6}}, + {m68k_op_bcs_8 , 0xff00, 0x6500, { 10, 10, 6, 6}}, + {m68k_op_bne_8 , 0xff00, 0x6600, { 10, 10, 6, 6}}, + {m68k_op_beq_8 , 0xff00, 0x6700, { 10, 10, 6, 6}}, + {m68k_op_bvc_8 , 0xff00, 0x6800, { 10, 10, 6, 6}}, + {m68k_op_bvs_8 , 0xff00, 0x6900, { 10, 10, 6, 6}}, + {m68k_op_bpl_8 , 0xff00, 0x6a00, { 10, 10, 6, 6}}, + {m68k_op_bmi_8 , 0xff00, 0x6b00, { 10, 10, 6, 6}}, + {m68k_op_bge_8 , 0xff00, 0x6c00, { 10, 10, 6, 6}}, + {m68k_op_blt_8 , 0xff00, 0x6d00, { 10, 10, 6, 6}}, + {m68k_op_bgt_8 , 0xff00, 0x6e00, { 10, 10, 6, 6}}, + {m68k_op_ble_8 , 0xff00, 0x6f00, { 10, 10, 6, 6}}, + {m68k_op_040fpu0_32 , 0xff00, 0xf200, { 0, 0, 0, 0}}, + {m68k_op_040fpu1_32 , 0xff00, 0xf300, { 0, 0, 0, 0}}, + {m68k_op_btst_32_r_d , 0xf1f8, 0x0100, { 6, 6, 4, 4}}, + {m68k_op_movep_16_er , 0xf1f8, 0x0108, { 16, 16, 12, 12}}, + {m68k_op_btst_8_r_ai , 0xf1f8, 0x0110, { 8, 8, 8, 8}}, + {m68k_op_btst_8_r_pi , 0xf1f8, 0x0118, { 8, 8, 8, 8}}, + {m68k_op_btst_8_r_pd , 0xf1f8, 0x0120, { 10, 10, 9, 9}}, + {m68k_op_btst_8_r_di , 0xf1f8, 0x0128, { 12, 12, 9, 9}}, + {m68k_op_btst_8_r_ix , 0xf1f8, 0x0130, { 14, 14, 11, 11}}, + {m68k_op_bchg_32_r_d , 0xf1f8, 0x0140, { 8, 8, 4, 4}}, + {m68k_op_movep_32_er , 0xf1f8, 0x0148, { 24, 24, 18, 18}}, + {m68k_op_bchg_8_r_ai , 0xf1f8, 0x0150, { 12, 12, 8, 8}}, + {m68k_op_bchg_8_r_pi , 0xf1f8, 0x0158, { 12, 12, 8, 8}}, + {m68k_op_bchg_8_r_pd , 0xf1f8, 0x0160, { 14, 14, 9, 9}}, + {m68k_op_bchg_8_r_di , 0xf1f8, 0x0168, { 16, 16, 9, 9}}, + {m68k_op_bchg_8_r_ix , 0xf1f8, 0x0170, { 18, 18, 11, 11}}, + {m68k_op_bclr_32_r_d , 0xf1f8, 0x0180, { 10, 10, 4, 4}}, + {m68k_op_movep_16_re , 0xf1f8, 0x0188, { 16, 16, 11, 11}}, + {m68k_op_bclr_8_r_ai , 0xf1f8, 0x0190, { 12, 14, 8, 8}}, + {m68k_op_bclr_8_r_pi , 0xf1f8, 0x0198, { 12, 14, 8, 8}}, + {m68k_op_bclr_8_r_pd , 0xf1f8, 0x01a0, { 14, 16, 9, 9}}, + {m68k_op_bclr_8_r_di , 0xf1f8, 0x01a8, { 16, 18, 9, 9}}, + {m68k_op_bclr_8_r_ix , 0xf1f8, 0x01b0, { 18, 20, 11, 11}}, + {m68k_op_bset_32_r_d , 0xf1f8, 0x01c0, { 8, 8, 4, 4}}, + {m68k_op_movep_32_re , 0xf1f8, 0x01c8, { 24, 24, 17, 17}}, + {m68k_op_bset_8_r_ai , 0xf1f8, 0x01d0, { 12, 12, 8, 8}}, + {m68k_op_bset_8_r_pi , 0xf1f8, 0x01d8, { 12, 12, 8, 8}}, + {m68k_op_bset_8_r_pd , 0xf1f8, 0x01e0, { 14, 14, 9, 9}}, + {m68k_op_bset_8_r_di , 0xf1f8, 0x01e8, { 16, 16, 9, 9}}, + {m68k_op_bset_8_r_ix , 0xf1f8, 0x01f0, { 18, 18, 11, 11}}, + {m68k_op_move_8_d_d , 0xf1f8, 0x1000, { 4, 4, 2, 2}}, + {m68k_op_move_8_d_ai , 0xf1f8, 0x1010, { 8, 8, 6, 6}}, + {m68k_op_move_8_d_pi , 0xf1f8, 0x1018, { 8, 8, 6, 6}}, + {m68k_op_move_8_d_pd , 0xf1f8, 0x1020, { 10, 10, 7, 7}}, + {m68k_op_move_8_d_di , 0xf1f8, 0x1028, { 12, 12, 7, 7}}, + {m68k_op_move_8_d_ix , 0xf1f8, 0x1030, { 14, 14, 9, 9}}, + {m68k_op_move_8_ai_d , 0xf1f8, 0x1080, { 8, 8, 4, 4}}, + {m68k_op_move_8_ai_ai , 0xf1f8, 0x1090, { 12, 12, 8, 8}}, + {m68k_op_move_8_ai_pi , 0xf1f8, 0x1098, { 12, 12, 8, 8}}, + {m68k_op_move_8_ai_pd , 0xf1f8, 0x10a0, { 14, 14, 9, 9}}, + {m68k_op_move_8_ai_di , 0xf1f8, 0x10a8, { 16, 16, 9, 9}}, + {m68k_op_move_8_ai_ix , 0xf1f8, 0x10b0, { 18, 18, 11, 11}}, + {m68k_op_move_8_pi_d , 0xf1f8, 0x10c0, { 8, 8, 4, 4}}, + {m68k_op_move_8_pi_ai , 0xf1f8, 0x10d0, { 12, 12, 8, 8}}, + {m68k_op_move_8_pi_pi , 0xf1f8, 0x10d8, { 12, 12, 8, 8}}, + {m68k_op_move_8_pi_pd , 0xf1f8, 0x10e0, { 14, 14, 9, 9}}, + {m68k_op_move_8_pi_di , 0xf1f8, 0x10e8, { 16, 16, 9, 9}}, + {m68k_op_move_8_pi_ix , 0xf1f8, 0x10f0, { 18, 18, 11, 11}}, + {m68k_op_move_8_pd_d , 0xf1f8, 0x1100, { 8, 8, 5, 5}}, + {m68k_op_move_8_pd_ai , 0xf1f8, 0x1110, { 12, 12, 9, 9}}, + {m68k_op_move_8_pd_pi , 0xf1f8, 0x1118, { 12, 12, 9, 9}}, + {m68k_op_move_8_pd_pd , 0xf1f8, 0x1120, { 14, 14, 10, 10}}, + {m68k_op_move_8_pd_di , 0xf1f8, 0x1128, { 16, 16, 10, 10}}, + {m68k_op_move_8_pd_ix , 0xf1f8, 0x1130, { 18, 18, 12, 12}}, + {m68k_op_move_8_di_d , 0xf1f8, 0x1140, { 12, 12, 5, 5}}, + {m68k_op_move_8_di_ai , 0xf1f8, 0x1150, { 16, 16, 9, 9}}, + {m68k_op_move_8_di_pi , 0xf1f8, 0x1158, { 16, 16, 9, 9}}, + {m68k_op_move_8_di_pd , 0xf1f8, 0x1160, { 18, 18, 10, 10}}, + {m68k_op_move_8_di_di , 0xf1f8, 0x1168, { 20, 20, 10, 10}}, + {m68k_op_move_8_di_ix , 0xf1f8, 0x1170, { 22, 22, 12, 12}}, + {m68k_op_move_8_ix_d , 0xf1f8, 0x1180, { 14, 14, 7, 7}}, + {m68k_op_move_8_ix_ai , 0xf1f8, 0x1190, { 18, 18, 11, 11}}, + {m68k_op_move_8_ix_pi , 0xf1f8, 0x1198, { 18, 18, 11, 11}}, + {m68k_op_move_8_ix_pd , 0xf1f8, 0x11a0, { 20, 20, 12, 12}}, + {m68k_op_move_8_ix_di , 0xf1f8, 0x11a8, { 22, 22, 12, 12}}, + {m68k_op_move_8_ix_ix , 0xf1f8, 0x11b0, { 24, 24, 14, 14}}, + {m68k_op_move_32_d_d , 0xf1f8, 0x2000, { 4, 4, 2, 2}}, + {m68k_op_move_32_d_a , 0xf1f8, 0x2008, { 4, 4, 2, 2}}, + {m68k_op_move_32_d_ai , 0xf1f8, 0x2010, { 12, 12, 6, 6}}, + {m68k_op_move_32_d_pi , 0xf1f8, 0x2018, { 12, 12, 6, 6}}, + {m68k_op_move_32_d_pd , 0xf1f8, 0x2020, { 14, 14, 7, 7}}, + {m68k_op_move_32_d_di , 0xf1f8, 0x2028, { 16, 16, 7, 7}}, + {m68k_op_move_32_d_ix , 0xf1f8, 0x2030, { 18, 18, 9, 9}}, + {m68k_op_movea_32_d , 0xf1f8, 0x2040, { 4, 4, 2, 2}}, + {m68k_op_movea_32_a , 0xf1f8, 0x2048, { 4, 4, 2, 2}}, + {m68k_op_movea_32_ai , 0xf1f8, 0x2050, { 12, 12, 6, 6}}, + {m68k_op_movea_32_pi , 0xf1f8, 0x2058, { 12, 12, 6, 6}}, + {m68k_op_movea_32_pd , 0xf1f8, 0x2060, { 14, 14, 7, 7}}, + {m68k_op_movea_32_di , 0xf1f8, 0x2068, { 16, 16, 7, 7}}, + {m68k_op_movea_32_ix , 0xf1f8, 0x2070, { 18, 18, 9, 9}}, + {m68k_op_move_32_ai_d , 0xf1f8, 0x2080, { 12, 12, 4, 4}}, + {m68k_op_move_32_ai_a , 0xf1f8, 0x2088, { 12, 12, 4, 4}}, + {m68k_op_move_32_ai_ai , 0xf1f8, 0x2090, { 20, 20, 8, 8}}, + {m68k_op_move_32_ai_pi , 0xf1f8, 0x2098, { 20, 20, 8, 8}}, + {m68k_op_move_32_ai_pd , 0xf1f8, 0x20a0, { 22, 22, 9, 9}}, + {m68k_op_move_32_ai_di , 0xf1f8, 0x20a8, { 24, 24, 9, 9}}, + {m68k_op_move_32_ai_ix , 0xf1f8, 0x20b0, { 26, 26, 11, 11}}, + {m68k_op_move_32_pi_d , 0xf1f8, 0x20c0, { 12, 12, 4, 4}}, + {m68k_op_move_32_pi_a , 0xf1f8, 0x20c8, { 12, 12, 4, 4}}, + {m68k_op_move_32_pi_ai , 0xf1f8, 0x20d0, { 20, 20, 8, 8}}, + {m68k_op_move_32_pi_pi , 0xf1f8, 0x20d8, { 20, 20, 8, 8}}, + {m68k_op_move_32_pi_pd , 0xf1f8, 0x20e0, { 22, 22, 9, 9}}, + {m68k_op_move_32_pi_di , 0xf1f8, 0x20e8, { 24, 24, 9, 9}}, + {m68k_op_move_32_pi_ix , 0xf1f8, 0x20f0, { 26, 26, 11, 11}}, + {m68k_op_move_32_pd_d , 0xf1f8, 0x2100, { 12, 14, 5, 5}}, + {m68k_op_move_32_pd_a , 0xf1f8, 0x2108, { 12, 14, 5, 5}}, + {m68k_op_move_32_pd_ai , 0xf1f8, 0x2110, { 20, 22, 9, 9}}, + {m68k_op_move_32_pd_pi , 0xf1f8, 0x2118, { 20, 22, 9, 9}}, + {m68k_op_move_32_pd_pd , 0xf1f8, 0x2120, { 22, 24, 10, 10}}, + {m68k_op_move_32_pd_di , 0xf1f8, 0x2128, { 24, 26, 10, 10}}, + {m68k_op_move_32_pd_ix , 0xf1f8, 0x2130, { 26, 28, 12, 12}}, + {m68k_op_move_32_di_d , 0xf1f8, 0x2140, { 16, 16, 5, 5}}, + {m68k_op_move_32_di_a , 0xf1f8, 0x2148, { 16, 16, 5, 5}}, + {m68k_op_move_32_di_ai , 0xf1f8, 0x2150, { 24, 24, 9, 9}}, + {m68k_op_move_32_di_pi , 0xf1f8, 0x2158, { 24, 24, 9, 9}}, + {m68k_op_move_32_di_pd , 0xf1f8, 0x2160, { 26, 26, 10, 10}}, + {m68k_op_move_32_di_di , 0xf1f8, 0x2168, { 28, 28, 10, 10}}, + {m68k_op_move_32_di_ix , 0xf1f8, 0x2170, { 30, 30, 12, 12}}, + {m68k_op_move_32_ix_d , 0xf1f8, 0x2180, { 18, 18, 7, 7}}, + {m68k_op_move_32_ix_a , 0xf1f8, 0x2188, { 18, 18, 7, 7}}, + {m68k_op_move_32_ix_ai , 0xf1f8, 0x2190, { 26, 26, 11, 11}}, + {m68k_op_move_32_ix_pi , 0xf1f8, 0x2198, { 26, 26, 11, 11}}, + {m68k_op_move_32_ix_pd , 0xf1f8, 0x21a0, { 28, 28, 12, 12}}, + {m68k_op_move_32_ix_di , 0xf1f8, 0x21a8, { 30, 30, 12, 12}}, + {m68k_op_move_32_ix_ix , 0xf1f8, 0x21b0, { 32, 32, 14, 14}}, + {m68k_op_move_16_d_d , 0xf1f8, 0x3000, { 4, 4, 2, 2}}, + {m68k_op_move_16_d_a , 0xf1f8, 0x3008, { 4, 4, 2, 2}}, + {m68k_op_move_16_d_ai , 0xf1f8, 0x3010, { 8, 8, 6, 6}}, + {m68k_op_move_16_d_pi , 0xf1f8, 0x3018, { 8, 8, 6, 6}}, + {m68k_op_move_16_d_pd , 0xf1f8, 0x3020, { 10, 10, 7, 7}}, + {m68k_op_move_16_d_di , 0xf1f8, 0x3028, { 12, 12, 7, 7}}, + {m68k_op_move_16_d_ix , 0xf1f8, 0x3030, { 14, 14, 9, 9}}, + {m68k_op_movea_16_d , 0xf1f8, 0x3040, { 4, 4, 2, 2}}, + {m68k_op_movea_16_a , 0xf1f8, 0x3048, { 4, 4, 2, 2}}, + {m68k_op_movea_16_ai , 0xf1f8, 0x3050, { 8, 8, 6, 6}}, + {m68k_op_movea_16_pi , 0xf1f8, 0x3058, { 8, 8, 6, 6}}, + {m68k_op_movea_16_pd , 0xf1f8, 0x3060, { 10, 10, 7, 7}}, + {m68k_op_movea_16_di , 0xf1f8, 0x3068, { 12, 12, 7, 7}}, + {m68k_op_movea_16_ix , 0xf1f8, 0x3070, { 14, 14, 9, 9}}, + {m68k_op_move_16_ai_d , 0xf1f8, 0x3080, { 8, 8, 4, 4}}, + {m68k_op_move_16_ai_a , 0xf1f8, 0x3088, { 8, 8, 4, 4}}, + {m68k_op_move_16_ai_ai , 0xf1f8, 0x3090, { 12, 12, 8, 8}}, + {m68k_op_move_16_ai_pi , 0xf1f8, 0x3098, { 12, 12, 8, 8}}, + {m68k_op_move_16_ai_pd , 0xf1f8, 0x30a0, { 14, 14, 9, 9}}, + {m68k_op_move_16_ai_di , 0xf1f8, 0x30a8, { 16, 16, 9, 9}}, + {m68k_op_move_16_ai_ix , 0xf1f8, 0x30b0, { 18, 18, 11, 11}}, + {m68k_op_move_16_pi_d , 0xf1f8, 0x30c0, { 8, 8, 4, 4}}, + {m68k_op_move_16_pi_a , 0xf1f8, 0x30c8, { 8, 8, 4, 4}}, + {m68k_op_move_16_pi_ai , 0xf1f8, 0x30d0, { 12, 12, 8, 8}}, + {m68k_op_move_16_pi_pi , 0xf1f8, 0x30d8, { 12, 12, 8, 8}}, + {m68k_op_move_16_pi_pd , 0xf1f8, 0x30e0, { 14, 14, 9, 9}}, + {m68k_op_move_16_pi_di , 0xf1f8, 0x30e8, { 16, 16, 9, 9}}, + {m68k_op_move_16_pi_ix , 0xf1f8, 0x30f0, { 18, 18, 11, 11}}, + {m68k_op_move_16_pd_d , 0xf1f8, 0x3100, { 8, 8, 5, 5}}, + {m68k_op_move_16_pd_a , 0xf1f8, 0x3108, { 8, 8, 5, 5}}, + {m68k_op_move_16_pd_ai , 0xf1f8, 0x3110, { 12, 12, 9, 9}}, + {m68k_op_move_16_pd_pi , 0xf1f8, 0x3118, { 12, 12, 9, 9}}, + {m68k_op_move_16_pd_pd , 0xf1f8, 0x3120, { 14, 14, 10, 10}}, + {m68k_op_move_16_pd_di , 0xf1f8, 0x3128, { 16, 16, 10, 10}}, + {m68k_op_move_16_pd_ix , 0xf1f8, 0x3130, { 18, 18, 12, 12}}, + {m68k_op_move_16_di_d , 0xf1f8, 0x3140, { 12, 12, 5, 5}}, + {m68k_op_move_16_di_a , 0xf1f8, 0x3148, { 12, 12, 5, 5}}, + {m68k_op_move_16_di_ai , 0xf1f8, 0x3150, { 16, 16, 9, 9}}, + {m68k_op_move_16_di_pi , 0xf1f8, 0x3158, { 16, 16, 9, 9}}, + {m68k_op_move_16_di_pd , 0xf1f8, 0x3160, { 18, 18, 10, 10}}, + {m68k_op_move_16_di_di , 0xf1f8, 0x3168, { 20, 20, 10, 10}}, + {m68k_op_move_16_di_ix , 0xf1f8, 0x3170, { 22, 22, 12, 12}}, + {m68k_op_move_16_ix_d , 0xf1f8, 0x3180, { 14, 14, 7, 7}}, + {m68k_op_move_16_ix_a , 0xf1f8, 0x3188, { 14, 14, 7, 7}}, + {m68k_op_move_16_ix_ai , 0xf1f8, 0x3190, { 18, 18, 11, 11}}, + {m68k_op_move_16_ix_pi , 0xf1f8, 0x3198, { 18, 18, 11, 11}}, + {m68k_op_move_16_ix_pd , 0xf1f8, 0x31a0, { 20, 20, 12, 12}}, + {m68k_op_move_16_ix_di , 0xf1f8, 0x31a8, { 22, 22, 12, 12}}, + {m68k_op_move_16_ix_ix , 0xf1f8, 0x31b0, { 24, 24, 14, 14}}, + {m68k_op_chk_32_d , 0xf1f8, 0x4100, { 0, 0, 8, 8}}, + {m68k_op_chk_32_ai , 0xf1f8, 0x4110, { 0, 0, 12, 12}}, + {m68k_op_chk_32_pi , 0xf1f8, 0x4118, { 0, 0, 12, 12}}, + {m68k_op_chk_32_pd , 0xf1f8, 0x4120, { 0, 0, 13, 13}}, + {m68k_op_chk_32_di , 0xf1f8, 0x4128, { 0, 0, 13, 13}}, + {m68k_op_chk_32_ix , 0xf1f8, 0x4130, { 0, 0, 15, 15}}, + {m68k_op_chk_16_d , 0xf1f8, 0x4180, { 10, 8, 8, 8}}, + {m68k_op_chk_16_ai , 0xf1f8, 0x4190, { 14, 12, 12, 12}}, + {m68k_op_chk_16_pi , 0xf1f8, 0x4198, { 14, 12, 12, 12}}, + {m68k_op_chk_16_pd , 0xf1f8, 0x41a0, { 16, 14, 13, 13}}, + {m68k_op_chk_16_di , 0xf1f8, 0x41a8, { 18, 16, 13, 13}}, + {m68k_op_chk_16_ix , 0xf1f8, 0x41b0, { 20, 18, 15, 15}}, + {m68k_op_lea_32_ai , 0xf1f8, 0x41d0, { 4, 4, 6, 6}}, + {m68k_op_lea_32_di , 0xf1f8, 0x41e8, { 8, 8, 7, 7}}, + {m68k_op_lea_32_ix , 0xf1f8, 0x41f0, { 12, 12, 9, 9}}, + {m68k_op_addq_8_d , 0xf1f8, 0x5000, { 4, 4, 2, 2}}, + {m68k_op_addq_8_ai , 0xf1f8, 0x5010, { 12, 12, 8, 8}}, + {m68k_op_addq_8_pi , 0xf1f8, 0x5018, { 12, 12, 8, 8}}, + {m68k_op_addq_8_pd , 0xf1f8, 0x5020, { 14, 14, 9, 9}}, + {m68k_op_addq_8_di , 0xf1f8, 0x5028, { 16, 16, 9, 9}}, + {m68k_op_addq_8_ix , 0xf1f8, 0x5030, { 18, 18, 11, 11}}, + {m68k_op_addq_16_d , 0xf1f8, 0x5040, { 4, 4, 2, 2}}, + {m68k_op_addq_16_a , 0xf1f8, 0x5048, { 4, 4, 2, 2}}, + {m68k_op_addq_16_ai , 0xf1f8, 0x5050, { 12, 12, 8, 8}}, + {m68k_op_addq_16_pi , 0xf1f8, 0x5058, { 12, 12, 8, 8}}, + {m68k_op_addq_16_pd , 0xf1f8, 0x5060, { 14, 14, 9, 9}}, + {m68k_op_addq_16_di , 0xf1f8, 0x5068, { 16, 16, 9, 9}}, + {m68k_op_addq_16_ix , 0xf1f8, 0x5070, { 18, 18, 11, 11}}, + {m68k_op_addq_32_d , 0xf1f8, 0x5080, { 8, 8, 2, 2}}, + {m68k_op_addq_32_a , 0xf1f8, 0x5088, { 8, 8, 2, 2}}, + {m68k_op_addq_32_ai , 0xf1f8, 0x5090, { 20, 20, 8, 8}}, + {m68k_op_addq_32_pi , 0xf1f8, 0x5098, { 20, 20, 8, 8}}, + {m68k_op_addq_32_pd , 0xf1f8, 0x50a0, { 22, 22, 9, 9}}, + {m68k_op_addq_32_di , 0xf1f8, 0x50a8, { 24, 24, 9, 9}}, + {m68k_op_addq_32_ix , 0xf1f8, 0x50b0, { 26, 26, 11, 11}}, + {m68k_op_subq_8_d , 0xf1f8, 0x5100, { 4, 4, 2, 2}}, + {m68k_op_subq_8_ai , 0xf1f8, 0x5110, { 12, 12, 8, 8}}, + {m68k_op_subq_8_pi , 0xf1f8, 0x5118, { 12, 12, 8, 8}}, + {m68k_op_subq_8_pd , 0xf1f8, 0x5120, { 14, 14, 9, 9}}, + {m68k_op_subq_8_di , 0xf1f8, 0x5128, { 16, 16, 9, 9}}, + {m68k_op_subq_8_ix , 0xf1f8, 0x5130, { 18, 18, 11, 11}}, + {m68k_op_subq_16_d , 0xf1f8, 0x5140, { 4, 4, 2, 2}}, + {m68k_op_subq_16_a , 0xf1f8, 0x5148, { 8, 4, 2, 2}}, + {m68k_op_subq_16_ai , 0xf1f8, 0x5150, { 12, 12, 8, 8}}, + {m68k_op_subq_16_pi , 0xf1f8, 0x5158, { 12, 12, 8, 8}}, + {m68k_op_subq_16_pd , 0xf1f8, 0x5160, { 14, 14, 9, 9}}, + {m68k_op_subq_16_di , 0xf1f8, 0x5168, { 16, 16, 9, 9}}, + {m68k_op_subq_16_ix , 0xf1f8, 0x5170, { 18, 18, 11, 11}}, + {m68k_op_subq_32_d , 0xf1f8, 0x5180, { 8, 8, 2, 2}}, + {m68k_op_subq_32_a , 0xf1f8, 0x5188, { 8, 8, 2, 2}}, + {m68k_op_subq_32_ai , 0xf1f8, 0x5190, { 20, 20, 8, 8}}, + {m68k_op_subq_32_pi , 0xf1f8, 0x5198, { 20, 20, 8, 8}}, + {m68k_op_subq_32_pd , 0xf1f8, 0x51a0, { 22, 22, 9, 9}}, + {m68k_op_subq_32_di , 0xf1f8, 0x51a8, { 24, 24, 9, 9}}, + {m68k_op_subq_32_ix , 0xf1f8, 0x51b0, { 26, 26, 11, 11}}, + {m68k_op_or_8_er_d , 0xf1f8, 0x8000, { 4, 4, 2, 2}}, + {m68k_op_or_8_er_ai , 0xf1f8, 0x8010, { 8, 8, 6, 6}}, + {m68k_op_or_8_er_pi , 0xf1f8, 0x8018, { 8, 8, 6, 6}}, + {m68k_op_or_8_er_pd , 0xf1f8, 0x8020, { 10, 10, 7, 7}}, + {m68k_op_or_8_er_di , 0xf1f8, 0x8028, { 12, 12, 7, 7}}, + {m68k_op_or_8_er_ix , 0xf1f8, 0x8030, { 14, 14, 9, 9}}, + {m68k_op_or_16_er_d , 0xf1f8, 0x8040, { 4, 4, 2, 2}}, + {m68k_op_or_16_er_ai , 0xf1f8, 0x8050, { 8, 8, 6, 6}}, + {m68k_op_or_16_er_pi , 0xf1f8, 0x8058, { 8, 8, 6, 6}}, + {m68k_op_or_16_er_pd , 0xf1f8, 0x8060, { 10, 10, 7, 7}}, + {m68k_op_or_16_er_di , 0xf1f8, 0x8068, { 12, 12, 7, 7}}, + {m68k_op_or_16_er_ix , 0xf1f8, 0x8070, { 14, 14, 9, 9}}, + {m68k_op_or_32_er_d , 0xf1f8, 0x8080, { 8, 6, 2, 2}}, + {m68k_op_or_32_er_ai , 0xf1f8, 0x8090, { 14, 14, 6, 6}}, + {m68k_op_or_32_er_pi , 0xf1f8, 0x8098, { 14, 14, 6, 6}}, + {m68k_op_or_32_er_pd , 0xf1f8, 0x80a0, { 16, 16, 7, 7}}, + {m68k_op_or_32_er_di , 0xf1f8, 0x80a8, { 18, 18, 7, 7}}, + {m68k_op_or_32_er_ix , 0xf1f8, 0x80b0, { 20, 20, 9, 9}}, + {m68k_op_divu_16_d , 0xf1f8, 0x80c0, {140, 108, 44, 44}}, + {m68k_op_divu_16_ai , 0xf1f8, 0x80d0, {144, 112, 48, 48}}, + {m68k_op_divu_16_pi , 0xf1f8, 0x80d8, {144, 112, 48, 48}}, + {m68k_op_divu_16_pd , 0xf1f8, 0x80e0, {146, 114, 49, 49}}, + {m68k_op_divu_16_di , 0xf1f8, 0x80e8, {148, 116, 49, 49}}, + {m68k_op_divu_16_ix , 0xf1f8, 0x80f0, {150, 118, 51, 51}}, + {m68k_op_sbcd_8_rr , 0xf1f8, 0x8100, { 6, 6, 4, 4}}, + {m68k_op_sbcd_8_mm , 0xf1f8, 0x8108, { 18, 18, 16, 16}}, + {m68k_op_or_8_re_ai , 0xf1f8, 0x8110, { 12, 12, 8, 8}}, + {m68k_op_or_8_re_pi , 0xf1f8, 0x8118, { 12, 12, 8, 8}}, + {m68k_op_or_8_re_pd , 0xf1f8, 0x8120, { 14, 14, 9, 9}}, + {m68k_op_or_8_re_di , 0xf1f8, 0x8128, { 16, 16, 9, 9}}, + {m68k_op_or_8_re_ix , 0xf1f8, 0x8130, { 18, 18, 11, 11}}, + {m68k_op_pack_16_rr , 0xf1f8, 0x8140, { 0, 0, 6, 6}}, + {m68k_op_pack_16_mm , 0xf1f8, 0x8148, { 0, 0, 13, 13}}, + {m68k_op_or_16_re_ai , 0xf1f8, 0x8150, { 12, 12, 8, 8}}, + {m68k_op_or_16_re_pi , 0xf1f8, 0x8158, { 12, 12, 8, 8}}, + {m68k_op_or_16_re_pd , 0xf1f8, 0x8160, { 14, 14, 9, 9}}, + {m68k_op_or_16_re_di , 0xf1f8, 0x8168, { 16, 16, 9, 9}}, + {m68k_op_or_16_re_ix , 0xf1f8, 0x8170, { 18, 18, 11, 11}}, + {m68k_op_unpk_16_rr , 0xf1f8, 0x8180, { 0, 0, 8, 8}}, + {m68k_op_unpk_16_mm , 0xf1f8, 0x8188, { 0, 0, 13, 13}}, + {m68k_op_or_32_re_ai , 0xf1f8, 0x8190, { 20, 20, 8, 8}}, + {m68k_op_or_32_re_pi , 0xf1f8, 0x8198, { 20, 20, 8, 8}}, + {m68k_op_or_32_re_pd , 0xf1f8, 0x81a0, { 22, 22, 9, 9}}, + {m68k_op_or_32_re_di , 0xf1f8, 0x81a8, { 24, 24, 9, 9}}, + {m68k_op_or_32_re_ix , 0xf1f8, 0x81b0, { 26, 26, 11, 11}}, + {m68k_op_divs_16_d , 0xf1f8, 0x81c0, {158, 122, 56, 56}}, + {m68k_op_divs_16_ai , 0xf1f8, 0x81d0, {162, 126, 60, 60}}, + {m68k_op_divs_16_pi , 0xf1f8, 0x81d8, {162, 126, 60, 60}}, + {m68k_op_divs_16_pd , 0xf1f8, 0x81e0, {164, 128, 61, 61}}, + {m68k_op_divs_16_di , 0xf1f8, 0x81e8, {166, 130, 61, 61}}, + {m68k_op_divs_16_ix , 0xf1f8, 0x81f0, {168, 132, 63, 63}}, + {m68k_op_sub_8_er_d , 0xf1f8, 0x9000, { 4, 4, 2, 2}}, + {m68k_op_sub_8_er_ai , 0xf1f8, 0x9010, { 8, 8, 6, 6}}, + {m68k_op_sub_8_er_pi , 0xf1f8, 0x9018, { 8, 8, 6, 6}}, + {m68k_op_sub_8_er_pd , 0xf1f8, 0x9020, { 10, 10, 7, 7}}, + {m68k_op_sub_8_er_di , 0xf1f8, 0x9028, { 12, 12, 7, 7}}, + {m68k_op_sub_8_er_ix , 0xf1f8, 0x9030, { 14, 14, 9, 9}}, + {m68k_op_sub_16_er_d , 0xf1f8, 0x9040, { 4, 4, 2, 2}}, + {m68k_op_sub_16_er_a , 0xf1f8, 0x9048, { 4, 4, 2, 2}}, + {m68k_op_sub_16_er_ai , 0xf1f8, 0x9050, { 8, 8, 6, 6}}, + {m68k_op_sub_16_er_pi , 0xf1f8, 0x9058, { 8, 8, 6, 6}}, + {m68k_op_sub_16_er_pd , 0xf1f8, 0x9060, { 10, 10, 7, 7}}, + {m68k_op_sub_16_er_di , 0xf1f8, 0x9068, { 12, 12, 7, 7}}, + {m68k_op_sub_16_er_ix , 0xf1f8, 0x9070, { 14, 14, 9, 9}}, + {m68k_op_sub_32_er_d , 0xf1f8, 0x9080, { 8, 6, 2, 2}}, + {m68k_op_sub_32_er_a , 0xf1f8, 0x9088, { 8, 6, 2, 2}}, + {m68k_op_sub_32_er_ai , 0xf1f8, 0x9090, { 14, 14, 6, 6}}, + {m68k_op_sub_32_er_pi , 0xf1f8, 0x9098, { 14, 14, 6, 6}}, + {m68k_op_sub_32_er_pd , 0xf1f8, 0x90a0, { 16, 16, 7, 7}}, + {m68k_op_sub_32_er_di , 0xf1f8, 0x90a8, { 18, 18, 7, 7}}, + {m68k_op_sub_32_er_ix , 0xf1f8, 0x90b0, { 20, 20, 9, 9}}, + {m68k_op_suba_16_d , 0xf1f8, 0x90c0, { 8, 8, 2, 2}}, + {m68k_op_suba_16_a , 0xf1f8, 0x90c8, { 8, 8, 2, 2}}, + {m68k_op_suba_16_ai , 0xf1f8, 0x90d0, { 12, 12, 6, 6}}, + {m68k_op_suba_16_pi , 0xf1f8, 0x90d8, { 12, 12, 6, 6}}, + {m68k_op_suba_16_pd , 0xf1f8, 0x90e0, { 14, 14, 7, 7}}, + {m68k_op_suba_16_di , 0xf1f8, 0x90e8, { 16, 16, 7, 7}}, + {m68k_op_suba_16_ix , 0xf1f8, 0x90f0, { 18, 18, 9, 9}}, + {m68k_op_subx_8_rr , 0xf1f8, 0x9100, { 4, 4, 2, 2}}, + {m68k_op_subx_8_mm , 0xf1f8, 0x9108, { 18, 18, 12, 12}}, + {m68k_op_sub_8_re_ai , 0xf1f8, 0x9110, { 12, 12, 8, 8}}, + {m68k_op_sub_8_re_pi , 0xf1f8, 0x9118, { 12, 12, 8, 8}}, + {m68k_op_sub_8_re_pd , 0xf1f8, 0x9120, { 14, 14, 9, 9}}, + {m68k_op_sub_8_re_di , 0xf1f8, 0x9128, { 16, 16, 9, 9}}, + {m68k_op_sub_8_re_ix , 0xf1f8, 0x9130, { 18, 18, 11, 11}}, + {m68k_op_subx_16_rr , 0xf1f8, 0x9140, { 4, 4, 2, 2}}, + {m68k_op_subx_16_mm , 0xf1f8, 0x9148, { 18, 18, 12, 12}}, + {m68k_op_sub_16_re_ai , 0xf1f8, 0x9150, { 12, 12, 8, 8}}, + {m68k_op_sub_16_re_pi , 0xf1f8, 0x9158, { 12, 12, 8, 8}}, + {m68k_op_sub_16_re_pd , 0xf1f8, 0x9160, { 14, 14, 9, 9}}, + {m68k_op_sub_16_re_di , 0xf1f8, 0x9168, { 16, 16, 9, 9}}, + {m68k_op_sub_16_re_ix , 0xf1f8, 0x9170, { 18, 18, 11, 11}}, + {m68k_op_subx_32_rr , 0xf1f8, 0x9180, { 8, 6, 2, 2}}, + {m68k_op_subx_32_mm , 0xf1f8, 0x9188, { 30, 30, 12, 12}}, + {m68k_op_sub_32_re_ai , 0xf1f8, 0x9190, { 20, 20, 8, 8}}, + {m68k_op_sub_32_re_pi , 0xf1f8, 0x9198, { 20, 20, 8, 8}}, + {m68k_op_sub_32_re_pd , 0xf1f8, 0x91a0, { 22, 22, 9, 9}}, + {m68k_op_sub_32_re_di , 0xf1f8, 0x91a8, { 24, 24, 9, 9}}, + {m68k_op_sub_32_re_ix , 0xf1f8, 0x91b0, { 26, 26, 11, 11}}, + {m68k_op_suba_32_d , 0xf1f8, 0x91c0, { 8, 6, 2, 2}}, + {m68k_op_suba_32_a , 0xf1f8, 0x91c8, { 8, 6, 2, 2}}, + {m68k_op_suba_32_ai , 0xf1f8, 0x91d0, { 14, 14, 6, 6}}, + {m68k_op_suba_32_pi , 0xf1f8, 0x91d8, { 14, 14, 6, 6}}, + {m68k_op_suba_32_pd , 0xf1f8, 0x91e0, { 16, 16, 7, 7}}, + {m68k_op_suba_32_di , 0xf1f8, 0x91e8, { 18, 18, 7, 7}}, + {m68k_op_suba_32_ix , 0xf1f8, 0x91f0, { 20, 20, 9, 9}}, + {m68k_op_cmp_8_d , 0xf1f8, 0xb000, { 4, 4, 2, 2}}, + {m68k_op_cmp_8_ai , 0xf1f8, 0xb010, { 8, 8, 6, 6}}, + {m68k_op_cmp_8_pi , 0xf1f8, 0xb018, { 8, 8, 6, 6}}, + {m68k_op_cmp_8_pd , 0xf1f8, 0xb020, { 10, 10, 7, 7}}, + {m68k_op_cmp_8_di , 0xf1f8, 0xb028, { 12, 12, 7, 7}}, + {m68k_op_cmp_8_ix , 0xf1f8, 0xb030, { 14, 14, 9, 9}}, + {m68k_op_cmp_16_d , 0xf1f8, 0xb040, { 4, 4, 2, 2}}, + {m68k_op_cmp_16_a , 0xf1f8, 0xb048, { 4, 4, 2, 2}}, + {m68k_op_cmp_16_ai , 0xf1f8, 0xb050, { 8, 8, 6, 6}}, + {m68k_op_cmp_16_pi , 0xf1f8, 0xb058, { 8, 8, 6, 6}}, + {m68k_op_cmp_16_pd , 0xf1f8, 0xb060, { 10, 10, 7, 7}}, + {m68k_op_cmp_16_di , 0xf1f8, 0xb068, { 12, 12, 7, 7}}, + {m68k_op_cmp_16_ix , 0xf1f8, 0xb070, { 14, 14, 9, 9}}, + {m68k_op_cmp_32_d , 0xf1f8, 0xb080, { 6, 6, 2, 2}}, + {m68k_op_cmp_32_a , 0xf1f8, 0xb088, { 6, 6, 2, 2}}, + {m68k_op_cmp_32_ai , 0xf1f8, 0xb090, { 14, 14, 6, 6}}, + {m68k_op_cmp_32_pi , 0xf1f8, 0xb098, { 14, 14, 6, 6}}, + {m68k_op_cmp_32_pd , 0xf1f8, 0xb0a0, { 16, 16, 7, 7}}, + {m68k_op_cmp_32_di , 0xf1f8, 0xb0a8, { 18, 18, 7, 7}}, + {m68k_op_cmp_32_ix , 0xf1f8, 0xb0b0, { 20, 20, 9, 9}}, + {m68k_op_cmpa_16_d , 0xf1f8, 0xb0c0, { 6, 6, 4, 4}}, + {m68k_op_cmpa_16_a , 0xf1f8, 0xb0c8, { 6, 6, 4, 4}}, + {m68k_op_cmpa_16_ai , 0xf1f8, 0xb0d0, { 10, 10, 8, 8}}, + {m68k_op_cmpa_16_pi , 0xf1f8, 0xb0d8, { 10, 10, 8, 8}}, + {m68k_op_cmpa_16_pd , 0xf1f8, 0xb0e0, { 12, 12, 9, 9}}, + {m68k_op_cmpa_16_di , 0xf1f8, 0xb0e8, { 14, 14, 9, 9}}, + {m68k_op_cmpa_16_ix , 0xf1f8, 0xb0f0, { 16, 16, 11, 11}}, + {m68k_op_eor_8_d , 0xf1f8, 0xb100, { 4, 4, 2, 2}}, + {m68k_op_cmpm_8 , 0xf1f8, 0xb108, { 12, 12, 9, 9}}, + {m68k_op_eor_8_ai , 0xf1f8, 0xb110, { 12, 12, 8, 8}}, + {m68k_op_eor_8_pi , 0xf1f8, 0xb118, { 12, 12, 8, 8}}, + {m68k_op_eor_8_pd , 0xf1f8, 0xb120, { 14, 14, 9, 9}}, + {m68k_op_eor_8_di , 0xf1f8, 0xb128, { 16, 16, 9, 9}}, + {m68k_op_eor_8_ix , 0xf1f8, 0xb130, { 18, 18, 11, 11}}, + {m68k_op_eor_16_d , 0xf1f8, 0xb140, { 4, 4, 2, 2}}, + {m68k_op_cmpm_16 , 0xf1f8, 0xb148, { 12, 12, 9, 9}}, + {m68k_op_eor_16_ai , 0xf1f8, 0xb150, { 12, 12, 8, 8}}, + {m68k_op_eor_16_pi , 0xf1f8, 0xb158, { 12, 12, 8, 8}}, + {m68k_op_eor_16_pd , 0xf1f8, 0xb160, { 14, 14, 9, 9}}, + {m68k_op_eor_16_di , 0xf1f8, 0xb168, { 16, 16, 9, 9}}, + {m68k_op_eor_16_ix , 0xf1f8, 0xb170, { 18, 18, 11, 11}}, + {m68k_op_eor_32_d , 0xf1f8, 0xb180, { 8, 6, 2, 2}}, + {m68k_op_cmpm_32 , 0xf1f8, 0xb188, { 20, 20, 9, 9}}, + {m68k_op_eor_32_ai , 0xf1f8, 0xb190, { 20, 20, 8, 8}}, + {m68k_op_eor_32_pi , 0xf1f8, 0xb198, { 20, 20, 8, 8}}, + {m68k_op_eor_32_pd , 0xf1f8, 0xb1a0, { 22, 22, 9, 9}}, + {m68k_op_eor_32_di , 0xf1f8, 0xb1a8, { 24, 24, 9, 9}}, + {m68k_op_eor_32_ix , 0xf1f8, 0xb1b0, { 26, 26, 11, 11}}, + {m68k_op_cmpa_32_d , 0xf1f8, 0xb1c0, { 6, 6, 4, 4}}, + {m68k_op_cmpa_32_a , 0xf1f8, 0xb1c8, { 6, 6, 4, 4}}, + {m68k_op_cmpa_32_ai , 0xf1f8, 0xb1d0, { 14, 14, 8, 8}}, + {m68k_op_cmpa_32_pi , 0xf1f8, 0xb1d8, { 14, 14, 8, 8}}, + {m68k_op_cmpa_32_pd , 0xf1f8, 0xb1e0, { 16, 16, 9, 9}}, + {m68k_op_cmpa_32_di , 0xf1f8, 0xb1e8, { 18, 18, 9, 9}}, + {m68k_op_cmpa_32_ix , 0xf1f8, 0xb1f0, { 20, 20, 11, 11}}, + {m68k_op_and_8_er_d , 0xf1f8, 0xc000, { 4, 4, 2, 2}}, + {m68k_op_and_8_er_ai , 0xf1f8, 0xc010, { 8, 8, 6, 6}}, + {m68k_op_and_8_er_pi , 0xf1f8, 0xc018, { 8, 8, 6, 6}}, + {m68k_op_and_8_er_pd , 0xf1f8, 0xc020, { 10, 10, 7, 7}}, + {m68k_op_and_8_er_di , 0xf1f8, 0xc028, { 12, 12, 7, 7}}, + {m68k_op_and_8_er_ix , 0xf1f8, 0xc030, { 14, 14, 9, 9}}, + {m68k_op_and_16_er_d , 0xf1f8, 0xc040, { 4, 4, 2, 2}}, + {m68k_op_and_16_er_ai , 0xf1f8, 0xc050, { 8, 8, 6, 6}}, + {m68k_op_and_16_er_pi , 0xf1f8, 0xc058, { 8, 8, 6, 6}}, + {m68k_op_and_16_er_pd , 0xf1f8, 0xc060, { 10, 10, 7, 7}}, + {m68k_op_and_16_er_di , 0xf1f8, 0xc068, { 12, 12, 7, 7}}, + {m68k_op_and_16_er_ix , 0xf1f8, 0xc070, { 14, 14, 9, 9}}, + {m68k_op_and_32_er_d , 0xf1f8, 0xc080, { 8, 6, 2, 2}}, + {m68k_op_and_32_er_ai , 0xf1f8, 0xc090, { 14, 14, 6, 6}}, + {m68k_op_and_32_er_pi , 0xf1f8, 0xc098, { 14, 14, 6, 6}}, + {m68k_op_and_32_er_pd , 0xf1f8, 0xc0a0, { 16, 16, 7, 7}}, + {m68k_op_and_32_er_di , 0xf1f8, 0xc0a8, { 18, 18, 7, 7}}, + {m68k_op_and_32_er_ix , 0xf1f8, 0xc0b0, { 20, 20, 9, 9}}, + {m68k_op_mulu_16_d , 0xf1f8, 0xc0c0, { 54, 30, 27, 27}}, + {m68k_op_mulu_16_ai , 0xf1f8, 0xc0d0, { 58, 34, 31, 31}}, + {m68k_op_mulu_16_pi , 0xf1f8, 0xc0d8, { 58, 34, 31, 31}}, + {m68k_op_mulu_16_pd , 0xf1f8, 0xc0e0, { 60, 36, 32, 32}}, + {m68k_op_mulu_16_di , 0xf1f8, 0xc0e8, { 62, 38, 32, 32}}, + {m68k_op_mulu_16_ix , 0xf1f8, 0xc0f0, { 64, 40, 34, 34}}, + {m68k_op_abcd_8_rr , 0xf1f8, 0xc100, { 6, 6, 4, 4}}, + {m68k_op_abcd_8_mm , 0xf1f8, 0xc108, { 18, 18, 16, 16}}, + {m68k_op_and_8_re_ai , 0xf1f8, 0xc110, { 12, 12, 8, 8}}, + {m68k_op_and_8_re_pi , 0xf1f8, 0xc118, { 12, 12, 8, 8}}, + {m68k_op_and_8_re_pd , 0xf1f8, 0xc120, { 14, 14, 9, 9}}, + {m68k_op_and_8_re_di , 0xf1f8, 0xc128, { 16, 16, 9, 9}}, + {m68k_op_and_8_re_ix , 0xf1f8, 0xc130, { 18, 18, 11, 11}}, + {m68k_op_exg_32_dd , 0xf1f8, 0xc140, { 6, 6, 2, 2}}, + {m68k_op_exg_32_aa , 0xf1f8, 0xc148, { 6, 6, 2, 2}}, + {m68k_op_and_16_re_ai , 0xf1f8, 0xc150, { 12, 12, 8, 8}}, + {m68k_op_and_16_re_pi , 0xf1f8, 0xc158, { 12, 12, 8, 8}}, + {m68k_op_and_16_re_pd , 0xf1f8, 0xc160, { 14, 14, 9, 9}}, + {m68k_op_and_16_re_di , 0xf1f8, 0xc168, { 16, 16, 9, 9}}, + {m68k_op_and_16_re_ix , 0xf1f8, 0xc170, { 18, 18, 11, 11}}, + {m68k_op_exg_32_da , 0xf1f8, 0xc188, { 6, 6, 2, 2}}, + {m68k_op_and_32_re_ai , 0xf1f8, 0xc190, { 20, 20, 8, 8}}, + {m68k_op_and_32_re_pi , 0xf1f8, 0xc198, { 20, 20, 8, 8}}, + {m68k_op_and_32_re_pd , 0xf1f8, 0xc1a0, { 22, 22, 9, 9}}, + {m68k_op_and_32_re_di , 0xf1f8, 0xc1a8, { 24, 24, 9, 9}}, + {m68k_op_and_32_re_ix , 0xf1f8, 0xc1b0, { 26, 26, 11, 11}}, + {m68k_op_muls_16_d , 0xf1f8, 0xc1c0, { 54, 32, 27, 27}}, + {m68k_op_muls_16_ai , 0xf1f8, 0xc1d0, { 58, 36, 31, 31}}, + {m68k_op_muls_16_pi , 0xf1f8, 0xc1d8, { 58, 36, 31, 31}}, + {m68k_op_muls_16_pd , 0xf1f8, 0xc1e0, { 60, 38, 32, 32}}, + {m68k_op_muls_16_di , 0xf1f8, 0xc1e8, { 62, 40, 32, 32}}, + {m68k_op_muls_16_ix , 0xf1f8, 0xc1f0, { 64, 42, 34, 34}}, + {m68k_op_add_8_er_d , 0xf1f8, 0xd000, { 4, 4, 2, 2}}, + {m68k_op_add_8_er_ai , 0xf1f8, 0xd010, { 8, 8, 6, 6}}, + {m68k_op_add_8_er_pi , 0xf1f8, 0xd018, { 8, 8, 6, 6}}, + {m68k_op_add_8_er_pd , 0xf1f8, 0xd020, { 10, 10, 7, 7}}, + {m68k_op_add_8_er_di , 0xf1f8, 0xd028, { 12, 12, 7, 7}}, + {m68k_op_add_8_er_ix , 0xf1f8, 0xd030, { 14, 14, 9, 9}}, + {m68k_op_add_16_er_d , 0xf1f8, 0xd040, { 4, 4, 2, 2}}, + {m68k_op_add_16_er_a , 0xf1f8, 0xd048, { 4, 4, 2, 2}}, + {m68k_op_add_16_er_ai , 0xf1f8, 0xd050, { 8, 8, 6, 6}}, + {m68k_op_add_16_er_pi , 0xf1f8, 0xd058, { 8, 8, 6, 6}}, + {m68k_op_add_16_er_pd , 0xf1f8, 0xd060, { 10, 10, 7, 7}}, + {m68k_op_add_16_er_di , 0xf1f8, 0xd068, { 12, 12, 7, 7}}, + {m68k_op_add_16_er_ix , 0xf1f8, 0xd070, { 14, 14, 9, 9}}, + {m68k_op_add_32_er_d , 0xf1f8, 0xd080, { 8, 6, 2, 2}}, + {m68k_op_add_32_er_a , 0xf1f8, 0xd088, { 8, 6, 2, 2}}, + {m68k_op_add_32_er_ai , 0xf1f8, 0xd090, { 14, 14, 6, 6}}, + {m68k_op_add_32_er_pi , 0xf1f8, 0xd098, { 14, 14, 6, 6}}, + {m68k_op_add_32_er_pd , 0xf1f8, 0xd0a0, { 16, 16, 7, 7}}, + {m68k_op_add_32_er_di , 0xf1f8, 0xd0a8, { 18, 18, 7, 7}}, + {m68k_op_add_32_er_ix , 0xf1f8, 0xd0b0, { 20, 20, 9, 9}}, + {m68k_op_adda_16_d , 0xf1f8, 0xd0c0, { 8, 8, 2, 2}}, + {m68k_op_adda_16_a , 0xf1f8, 0xd0c8, { 8, 8, 2, 2}}, + {m68k_op_adda_16_ai , 0xf1f8, 0xd0d0, { 12, 12, 6, 6}}, + {m68k_op_adda_16_pi , 0xf1f8, 0xd0d8, { 12, 12, 6, 6}}, + {m68k_op_adda_16_pd , 0xf1f8, 0xd0e0, { 14, 14, 7, 7}}, + {m68k_op_adda_16_di , 0xf1f8, 0xd0e8, { 16, 16, 7, 7}}, + {m68k_op_adda_16_ix , 0xf1f8, 0xd0f0, { 18, 18, 9, 9}}, + {m68k_op_addx_8_rr , 0xf1f8, 0xd100, { 4, 4, 2, 2}}, + {m68k_op_addx_8_mm , 0xf1f8, 0xd108, { 18, 18, 12, 12}}, + {m68k_op_add_8_re_ai , 0xf1f8, 0xd110, { 12, 12, 8, 8}}, + {m68k_op_add_8_re_pi , 0xf1f8, 0xd118, { 12, 12, 8, 8}}, + {m68k_op_add_8_re_pd , 0xf1f8, 0xd120, { 14, 14, 9, 9}}, + {m68k_op_add_8_re_di , 0xf1f8, 0xd128, { 16, 16, 9, 9}}, + {m68k_op_add_8_re_ix , 0xf1f8, 0xd130, { 18, 18, 11, 11}}, + {m68k_op_addx_16_rr , 0xf1f8, 0xd140, { 4, 4, 2, 2}}, + {m68k_op_addx_16_mm , 0xf1f8, 0xd148, { 18, 18, 12, 12}}, + {m68k_op_add_16_re_ai , 0xf1f8, 0xd150, { 12, 12, 8, 8}}, + {m68k_op_add_16_re_pi , 0xf1f8, 0xd158, { 12, 12, 8, 8}}, + {m68k_op_add_16_re_pd , 0xf1f8, 0xd160, { 14, 14, 9, 9}}, + {m68k_op_add_16_re_di , 0xf1f8, 0xd168, { 16, 16, 9, 9}}, + {m68k_op_add_16_re_ix , 0xf1f8, 0xd170, { 18, 18, 11, 11}}, + {m68k_op_addx_32_rr , 0xf1f8, 0xd180, { 8, 6, 2, 2}}, + {m68k_op_addx_32_mm , 0xf1f8, 0xd188, { 30, 30, 12, 12}}, + {m68k_op_add_32_re_ai , 0xf1f8, 0xd190, { 20, 20, 8, 8}}, + {m68k_op_add_32_re_pi , 0xf1f8, 0xd198, { 20, 20, 8, 8}}, + {m68k_op_add_32_re_pd , 0xf1f8, 0xd1a0, { 22, 22, 9, 9}}, + {m68k_op_add_32_re_di , 0xf1f8, 0xd1a8, { 24, 24, 9, 9}}, + {m68k_op_add_32_re_ix , 0xf1f8, 0xd1b0, { 26, 26, 11, 11}}, + {m68k_op_adda_32_d , 0xf1f8, 0xd1c0, { 8, 6, 2, 2}}, + {m68k_op_adda_32_a , 0xf1f8, 0xd1c8, { 8, 6, 2, 2}}, + {m68k_op_adda_32_ai , 0xf1f8, 0xd1d0, { 14, 14, 6, 6}}, + {m68k_op_adda_32_pi , 0xf1f8, 0xd1d8, { 14, 14, 6, 6}}, + {m68k_op_adda_32_pd , 0xf1f8, 0xd1e0, { 16, 16, 7, 7}}, + {m68k_op_adda_32_di , 0xf1f8, 0xd1e8, { 18, 18, 7, 7}}, + {m68k_op_adda_32_ix , 0xf1f8, 0xd1f0, { 20, 20, 9, 9}}, + {m68k_op_asr_8_s , 0xf1f8, 0xe000, { 6, 6, 6, 6}}, + {m68k_op_lsr_8_s , 0xf1f8, 0xe008, { 6, 6, 4, 4}}, + {m68k_op_roxr_8_s , 0xf1f8, 0xe010, { 6, 6, 12, 12}}, + {m68k_op_ror_8_s , 0xf1f8, 0xe018, { 6, 6, 8, 8}}, + {m68k_op_asr_8_r , 0xf1f8, 0xe020, { 6, 6, 6, 6}}, + {m68k_op_lsr_8_r , 0xf1f8, 0xe028, { 6, 6, 6, 6}}, + {m68k_op_roxr_8_r , 0xf1f8, 0xe030, { 6, 6, 12, 12}}, + {m68k_op_ror_8_r , 0xf1f8, 0xe038, { 6, 6, 8, 8}}, + {m68k_op_asr_16_s , 0xf1f8, 0xe040, { 6, 6, 6, 6}}, + {m68k_op_lsr_16_s , 0xf1f8, 0xe048, { 6, 6, 4, 4}}, + {m68k_op_roxr_16_s , 0xf1f8, 0xe050, { 6, 6, 12, 12}}, + {m68k_op_ror_16_s , 0xf1f8, 0xe058, { 6, 6, 8, 8}}, + {m68k_op_asr_16_r , 0xf1f8, 0xe060, { 6, 6, 6, 6}}, + {m68k_op_lsr_16_r , 0xf1f8, 0xe068, { 6, 6, 6, 6}}, + {m68k_op_roxr_16_r , 0xf1f8, 0xe070, { 6, 6, 12, 12}}, + {m68k_op_ror_16_r , 0xf1f8, 0xe078, { 6, 6, 8, 8}}, + {m68k_op_asr_32_s , 0xf1f8, 0xe080, { 8, 8, 6, 6}}, + {m68k_op_lsr_32_s , 0xf1f8, 0xe088, { 8, 8, 4, 4}}, + {m68k_op_roxr_32_s , 0xf1f8, 0xe090, { 8, 8, 12, 12}}, + {m68k_op_ror_32_s , 0xf1f8, 0xe098, { 8, 8, 8, 8}}, + {m68k_op_asr_32_r , 0xf1f8, 0xe0a0, { 8, 8, 6, 6}}, + {m68k_op_lsr_32_r , 0xf1f8, 0xe0a8, { 8, 8, 6, 6}}, + {m68k_op_roxr_32_r , 0xf1f8, 0xe0b0, { 8, 8, 12, 12}}, + {m68k_op_ror_32_r , 0xf1f8, 0xe0b8, { 8, 8, 8, 8}}, + {m68k_op_asl_8_s , 0xf1f8, 0xe100, { 6, 6, 8, 8}}, + {m68k_op_lsl_8_s , 0xf1f8, 0xe108, { 6, 6, 4, 4}}, + {m68k_op_roxl_8_s , 0xf1f8, 0xe110, { 6, 6, 12, 12}}, + {m68k_op_rol_8_s , 0xf1f8, 0xe118, { 6, 6, 8, 8}}, + {m68k_op_asl_8_r , 0xf1f8, 0xe120, { 6, 6, 8, 8}}, + {m68k_op_lsl_8_r , 0xf1f8, 0xe128, { 6, 6, 6, 6}}, + {m68k_op_roxl_8_r , 0xf1f8, 0xe130, { 6, 6, 12, 12}}, + {m68k_op_rol_8_r , 0xf1f8, 0xe138, { 6, 6, 8, 8}}, + {m68k_op_asl_16_s , 0xf1f8, 0xe140, { 6, 6, 8, 8}}, + {m68k_op_lsl_16_s , 0xf1f8, 0xe148, { 6, 6, 4, 4}}, + {m68k_op_roxl_16_s , 0xf1f8, 0xe150, { 6, 6, 12, 12}}, + {m68k_op_rol_16_s , 0xf1f8, 0xe158, { 6, 6, 8, 8}}, + {m68k_op_asl_16_r , 0xf1f8, 0xe160, { 6, 6, 8, 8}}, + {m68k_op_lsl_16_r , 0xf1f8, 0xe168, { 6, 6, 6, 6}}, + {m68k_op_roxl_16_r , 0xf1f8, 0xe170, { 6, 6, 12, 12}}, + {m68k_op_rol_16_r , 0xf1f8, 0xe178, { 6, 6, 8, 8}}, + {m68k_op_asl_32_s , 0xf1f8, 0xe180, { 8, 8, 8, 8}}, + {m68k_op_lsl_32_s , 0xf1f8, 0xe188, { 8, 8, 4, 4}}, + {m68k_op_roxl_32_s , 0xf1f8, 0xe190, { 8, 8, 12, 12}}, + {m68k_op_rol_32_s , 0xf1f8, 0xe198, { 8, 8, 8, 8}}, + {m68k_op_asl_32_r , 0xf1f8, 0xe1a0, { 8, 8, 8, 8}}, + {m68k_op_lsl_32_r , 0xf1f8, 0xe1a8, { 8, 8, 6, 6}}, + {m68k_op_roxl_32_r , 0xf1f8, 0xe1b0, { 8, 8, 12, 12}}, + {m68k_op_rol_32_r , 0xf1f8, 0xe1b8, { 8, 8, 8, 8}}, + {m68k_op_cpdbcc_32 , 0xf1f8, 0xf048, { 0, 0, 4, 0}}, + {m68k_op_cptrapcc_32 , 0xf1f8, 0xf078, { 0, 0, 4, 0}}, + {m68k_op_rtm_32 , 0xfff0, 0x06c0, { 0, 0, 19, 19}}, + {m68k_op_trap , 0xfff0, 0x4e40, { 4, 4, 4, 4}}, + {m68k_op_btst_8_r_pi7 , 0xf1ff, 0x011f, { 8, 8, 8, 8}}, + {m68k_op_btst_8_r_pd7 , 0xf1ff, 0x0127, { 10, 10, 9, 9}}, + {m68k_op_btst_8_r_aw , 0xf1ff, 0x0138, { 12, 12, 8, 8}}, + {m68k_op_btst_8_r_al , 0xf1ff, 0x0139, { 16, 16, 8, 8}}, + {m68k_op_btst_8_r_pcdi , 0xf1ff, 0x013a, { 12, 12, 9, 9}}, + {m68k_op_btst_8_r_pcix , 0xf1ff, 0x013b, { 14, 14, 11, 11}}, + {m68k_op_btst_8_r_i , 0xf1ff, 0x013c, { 8, 8, 6, 6}}, + {m68k_op_bchg_8_r_pi7 , 0xf1ff, 0x015f, { 12, 12, 8, 8}}, + {m68k_op_bchg_8_r_pd7 , 0xf1ff, 0x0167, { 14, 14, 9, 9}}, + {m68k_op_bchg_8_r_aw , 0xf1ff, 0x0178, { 16, 16, 8, 8}}, + {m68k_op_bchg_8_r_al , 0xf1ff, 0x0179, { 20, 20, 8, 8}}, + {m68k_op_bclr_8_r_pi7 , 0xf1ff, 0x019f, { 12, 14, 8, 8}}, + {m68k_op_bclr_8_r_pd7 , 0xf1ff, 0x01a7, { 14, 16, 9, 9}}, + {m68k_op_bclr_8_r_aw , 0xf1ff, 0x01b8, { 16, 18, 8, 8}}, + {m68k_op_bclr_8_r_al , 0xf1ff, 0x01b9, { 20, 22, 8, 8}}, + {m68k_op_bset_8_r_pi7 , 0xf1ff, 0x01df, { 12, 12, 8, 8}}, + {m68k_op_bset_8_r_pd7 , 0xf1ff, 0x01e7, { 14, 14, 9, 9}}, + {m68k_op_bset_8_r_aw , 0xf1ff, 0x01f8, { 16, 16, 8, 8}}, + {m68k_op_bset_8_r_al , 0xf1ff, 0x01f9, { 20, 20, 8, 8}}, + {m68k_op_move_8_d_pi7 , 0xf1ff, 0x101f, { 8, 8, 6, 6}}, + {m68k_op_move_8_d_pd7 , 0xf1ff, 0x1027, { 10, 10, 7, 7}}, + {m68k_op_move_8_d_aw , 0xf1ff, 0x1038, { 12, 12, 6, 6}}, + {m68k_op_move_8_d_al , 0xf1ff, 0x1039, { 16, 16, 6, 6}}, + {m68k_op_move_8_d_pcdi , 0xf1ff, 0x103a, { 12, 12, 7, 7}}, + {m68k_op_move_8_d_pcix , 0xf1ff, 0x103b, { 14, 14, 9, 9}}, + {m68k_op_move_8_d_i , 0xf1ff, 0x103c, { 8, 8, 4, 4}}, + {m68k_op_move_8_ai_pi7 , 0xf1ff, 0x109f, { 12, 12, 8, 8}}, + {m68k_op_move_8_ai_pd7 , 0xf1ff, 0x10a7, { 14, 14, 9, 9}}, + {m68k_op_move_8_ai_aw , 0xf1ff, 0x10b8, { 16, 16, 8, 8}}, + {m68k_op_move_8_ai_al , 0xf1ff, 0x10b9, { 20, 20, 8, 8}}, + {m68k_op_move_8_ai_pcdi , 0xf1ff, 0x10ba, { 16, 16, 9, 9}}, + {m68k_op_move_8_ai_pcix , 0xf1ff, 0x10bb, { 18, 18, 11, 11}}, + {m68k_op_move_8_ai_i , 0xf1ff, 0x10bc, { 12, 12, 6, 6}}, + {m68k_op_move_8_pi_pi7 , 0xf1ff, 0x10df, { 12, 12, 8, 8}}, + {m68k_op_move_8_pi_pd7 , 0xf1ff, 0x10e7, { 14, 14, 9, 9}}, + {m68k_op_move_8_pi_aw , 0xf1ff, 0x10f8, { 16, 16, 8, 8}}, + {m68k_op_move_8_pi_al , 0xf1ff, 0x10f9, { 20, 20, 8, 8}}, + {m68k_op_move_8_pi_pcdi , 0xf1ff, 0x10fa, { 16, 16, 9, 9}}, + {m68k_op_move_8_pi_pcix , 0xf1ff, 0x10fb, { 18, 18, 11, 11}}, + {m68k_op_move_8_pi_i , 0xf1ff, 0x10fc, { 12, 12, 6, 6}}, + {m68k_op_move_8_pd_pi7 , 0xf1ff, 0x111f, { 12, 12, 9, 9}}, + {m68k_op_move_8_pd_pd7 , 0xf1ff, 0x1127, { 14, 14, 10, 10}}, + {m68k_op_move_8_pd_aw , 0xf1ff, 0x1138, { 16, 16, 9, 9}}, + {m68k_op_move_8_pd_al , 0xf1ff, 0x1139, { 20, 20, 9, 9}}, + {m68k_op_move_8_pd_pcdi , 0xf1ff, 0x113a, { 16, 16, 10, 10}}, + {m68k_op_move_8_pd_pcix , 0xf1ff, 0x113b, { 18, 18, 12, 12}}, + {m68k_op_move_8_pd_i , 0xf1ff, 0x113c, { 12, 12, 7, 7}}, + {m68k_op_move_8_di_pi7 , 0xf1ff, 0x115f, { 16, 16, 9, 9}}, + {m68k_op_move_8_di_pd7 , 0xf1ff, 0x1167, { 18, 18, 10, 10}}, + {m68k_op_move_8_di_aw , 0xf1ff, 0x1178, { 20, 20, 9, 9}}, + {m68k_op_move_8_di_al , 0xf1ff, 0x1179, { 24, 24, 9, 9}}, + {m68k_op_move_8_di_pcdi , 0xf1ff, 0x117a, { 20, 20, 10, 10}}, + {m68k_op_move_8_di_pcix , 0xf1ff, 0x117b, { 22, 22, 12, 12}}, + {m68k_op_move_8_di_i , 0xf1ff, 0x117c, { 16, 16, 7, 7}}, + {m68k_op_move_8_ix_pi7 , 0xf1ff, 0x119f, { 18, 18, 11, 11}}, + {m68k_op_move_8_ix_pd7 , 0xf1ff, 0x11a7, { 20, 20, 12, 12}}, + {m68k_op_move_8_ix_aw , 0xf1ff, 0x11b8, { 22, 22, 11, 11}}, + {m68k_op_move_8_ix_al , 0xf1ff, 0x11b9, { 26, 26, 11, 11}}, + {m68k_op_move_8_ix_pcdi , 0xf1ff, 0x11ba, { 22, 22, 12, 12}}, + {m68k_op_move_8_ix_pcix , 0xf1ff, 0x11bb, { 24, 24, 14, 14}}, + {m68k_op_move_8_ix_i , 0xf1ff, 0x11bc, { 18, 18, 9, 9}}, + {m68k_op_move_32_d_aw , 0xf1ff, 0x2038, { 16, 16, 6, 6}}, + {m68k_op_move_32_d_al , 0xf1ff, 0x2039, { 20, 20, 6, 6}}, + {m68k_op_move_32_d_pcdi , 0xf1ff, 0x203a, { 16, 16, 7, 7}}, + {m68k_op_move_32_d_pcix , 0xf1ff, 0x203b, { 18, 18, 9, 9}}, + {m68k_op_move_32_d_i , 0xf1ff, 0x203c, { 12, 12, 6, 6}}, + {m68k_op_movea_32_aw , 0xf1ff, 0x2078, { 16, 16, 6, 6}}, + {m68k_op_movea_32_al , 0xf1ff, 0x2079, { 20, 20, 6, 6}}, + {m68k_op_movea_32_pcdi , 0xf1ff, 0x207a, { 16, 16, 7, 7}}, + {m68k_op_movea_32_pcix , 0xf1ff, 0x207b, { 18, 18, 9, 9}}, + {m68k_op_movea_32_i , 0xf1ff, 0x207c, { 12, 12, 6, 6}}, + {m68k_op_move_32_ai_aw , 0xf1ff, 0x20b8, { 24, 24, 8, 8}}, + {m68k_op_move_32_ai_al , 0xf1ff, 0x20b9, { 28, 28, 8, 8}}, + {m68k_op_move_32_ai_pcdi , 0xf1ff, 0x20ba, { 24, 24, 9, 9}}, + {m68k_op_move_32_ai_pcix , 0xf1ff, 0x20bb, { 26, 26, 11, 11}}, + {m68k_op_move_32_ai_i , 0xf1ff, 0x20bc, { 20, 20, 8, 8}}, + {m68k_op_move_32_pi_aw , 0xf1ff, 0x20f8, { 24, 24, 8, 8}}, + {m68k_op_move_32_pi_al , 0xf1ff, 0x20f9, { 28, 28, 8, 8}}, + {m68k_op_move_32_pi_pcdi , 0xf1ff, 0x20fa, { 24, 24, 9, 9}}, + {m68k_op_move_32_pi_pcix , 0xf1ff, 0x20fb, { 26, 26, 11, 11}}, + {m68k_op_move_32_pi_i , 0xf1ff, 0x20fc, { 20, 20, 8, 8}}, + {m68k_op_move_32_pd_aw , 0xf1ff, 0x2138, { 24, 26, 9, 9}}, + {m68k_op_move_32_pd_al , 0xf1ff, 0x2139, { 28, 30, 9, 9}}, + {m68k_op_move_32_pd_pcdi , 0xf1ff, 0x213a, { 24, 26, 10, 10}}, + {m68k_op_move_32_pd_pcix , 0xf1ff, 0x213b, { 26, 28, 12, 12}}, + {m68k_op_move_32_pd_i , 0xf1ff, 0x213c, { 20, 22, 9, 9}}, + {m68k_op_move_32_di_aw , 0xf1ff, 0x2178, { 28, 28, 9, 9}}, + {m68k_op_move_32_di_al , 0xf1ff, 0x2179, { 32, 32, 9, 9}}, + {m68k_op_move_32_di_pcdi , 0xf1ff, 0x217a, { 28, 28, 10, 10}}, + {m68k_op_move_32_di_pcix , 0xf1ff, 0x217b, { 30, 30, 12, 12}}, + {m68k_op_move_32_di_i , 0xf1ff, 0x217c, { 24, 24, 9, 9}}, + {m68k_op_move_32_ix_aw , 0xf1ff, 0x21b8, { 30, 30, 11, 11}}, + {m68k_op_move_32_ix_al , 0xf1ff, 0x21b9, { 34, 34, 11, 11}}, + {m68k_op_move_32_ix_pcdi , 0xf1ff, 0x21ba, { 30, 30, 12, 12}}, + {m68k_op_move_32_ix_pcix , 0xf1ff, 0x21bb, { 32, 32, 14, 14}}, + {m68k_op_move_32_ix_i , 0xf1ff, 0x21bc, { 26, 26, 11, 11}}, + {m68k_op_move_16_d_aw , 0xf1ff, 0x3038, { 12, 12, 6, 6}}, + {m68k_op_move_16_d_al , 0xf1ff, 0x3039, { 16, 16, 6, 6}}, + {m68k_op_move_16_d_pcdi , 0xf1ff, 0x303a, { 12, 12, 7, 7}}, + {m68k_op_move_16_d_pcix , 0xf1ff, 0x303b, { 14, 14, 9, 9}}, + {m68k_op_move_16_d_i , 0xf1ff, 0x303c, { 8, 8, 4, 4}}, + {m68k_op_movea_16_aw , 0xf1ff, 0x3078, { 12, 12, 6, 6}}, + {m68k_op_movea_16_al , 0xf1ff, 0x3079, { 16, 16, 6, 6}}, + {m68k_op_movea_16_pcdi , 0xf1ff, 0x307a, { 12, 12, 7, 7}}, + {m68k_op_movea_16_pcix , 0xf1ff, 0x307b, { 14, 14, 9, 9}}, + {m68k_op_movea_16_i , 0xf1ff, 0x307c, { 8, 8, 4, 4}}, + {m68k_op_move_16_ai_aw , 0xf1ff, 0x30b8, { 16, 16, 8, 8}}, + {m68k_op_move_16_ai_al , 0xf1ff, 0x30b9, { 20, 20, 8, 8}}, + {m68k_op_move_16_ai_pcdi , 0xf1ff, 0x30ba, { 16, 16, 9, 9}}, + {m68k_op_move_16_ai_pcix , 0xf1ff, 0x30bb, { 18, 18, 11, 11}}, + {m68k_op_move_16_ai_i , 0xf1ff, 0x30bc, { 12, 12, 6, 6}}, + {m68k_op_move_16_pi_aw , 0xf1ff, 0x30f8, { 16, 16, 8, 8}}, + {m68k_op_move_16_pi_al , 0xf1ff, 0x30f9, { 20, 20, 8, 8}}, + {m68k_op_move_16_pi_pcdi , 0xf1ff, 0x30fa, { 16, 16, 9, 9}}, + {m68k_op_move_16_pi_pcix , 0xf1ff, 0x30fb, { 18, 18, 11, 11}}, + {m68k_op_move_16_pi_i , 0xf1ff, 0x30fc, { 12, 12, 6, 6}}, + {m68k_op_move_16_pd_aw , 0xf1ff, 0x3138, { 16, 16, 9, 9}}, + {m68k_op_move_16_pd_al , 0xf1ff, 0x3139, { 20, 20, 9, 9}}, + {m68k_op_move_16_pd_pcdi , 0xf1ff, 0x313a, { 16, 16, 10, 10}}, + {m68k_op_move_16_pd_pcix , 0xf1ff, 0x313b, { 18, 18, 12, 12}}, + {m68k_op_move_16_pd_i , 0xf1ff, 0x313c, { 12, 12, 7, 7}}, + {m68k_op_move_16_di_aw , 0xf1ff, 0x3178, { 20, 20, 9, 9}}, + {m68k_op_move_16_di_al , 0xf1ff, 0x3179, { 24, 24, 9, 9}}, + {m68k_op_move_16_di_pcdi , 0xf1ff, 0x317a, { 20, 20, 10, 10}}, + {m68k_op_move_16_di_pcix , 0xf1ff, 0x317b, { 22, 22, 12, 12}}, + {m68k_op_move_16_di_i , 0xf1ff, 0x317c, { 16, 16, 7, 7}}, + {m68k_op_move_16_ix_aw , 0xf1ff, 0x31b8, { 22, 22, 11, 11}}, + {m68k_op_move_16_ix_al , 0xf1ff, 0x31b9, { 26, 26, 11, 11}}, + {m68k_op_move_16_ix_pcdi , 0xf1ff, 0x31ba, { 22, 22, 12, 12}}, + {m68k_op_move_16_ix_pcix , 0xf1ff, 0x31bb, { 24, 24, 14, 14}}, + {m68k_op_move_16_ix_i , 0xf1ff, 0x31bc, { 18, 18, 9, 9}}, + {m68k_op_chk_32_aw , 0xf1ff, 0x4138, { 0, 0, 12, 12}}, + {m68k_op_chk_32_al , 0xf1ff, 0x4139, { 0, 0, 12, 12}}, + {m68k_op_chk_32_pcdi , 0xf1ff, 0x413a, { 0, 0, 13, 13}}, + {m68k_op_chk_32_pcix , 0xf1ff, 0x413b, { 0, 0, 15, 15}}, + {m68k_op_chk_32_i , 0xf1ff, 0x413c, { 0, 0, 12, 12}}, + {m68k_op_chk_16_aw , 0xf1ff, 0x41b8, { 18, 16, 12, 12}}, + {m68k_op_chk_16_al , 0xf1ff, 0x41b9, { 22, 20, 12, 12}}, + {m68k_op_chk_16_pcdi , 0xf1ff, 0x41ba, { 18, 16, 13, 13}}, + {m68k_op_chk_16_pcix , 0xf1ff, 0x41bb, { 20, 18, 15, 15}}, + {m68k_op_chk_16_i , 0xf1ff, 0x41bc, { 14, 12, 10, 10}}, + {m68k_op_lea_32_aw , 0xf1ff, 0x41f8, { 8, 8, 6, 6}}, + {m68k_op_lea_32_al , 0xf1ff, 0x41f9, { 12, 12, 6, 6}}, + {m68k_op_lea_32_pcdi , 0xf1ff, 0x41fa, { 8, 8, 7, 7}}, + {m68k_op_lea_32_pcix , 0xf1ff, 0x41fb, { 12, 12, 9, 9}}, + {m68k_op_addq_8_pi7 , 0xf1ff, 0x501f, { 12, 12, 8, 8}}, + {m68k_op_addq_8_pd7 , 0xf1ff, 0x5027, { 14, 14, 9, 9}}, + {m68k_op_addq_8_aw , 0xf1ff, 0x5038, { 16, 16, 8, 8}}, + {m68k_op_addq_8_al , 0xf1ff, 0x5039, { 20, 20, 8, 8}}, + {m68k_op_addq_16_aw , 0xf1ff, 0x5078, { 16, 16, 8, 8}}, + {m68k_op_addq_16_al , 0xf1ff, 0x5079, { 20, 20, 8, 8}}, + {m68k_op_addq_32_aw , 0xf1ff, 0x50b8, { 24, 24, 8, 8}}, + {m68k_op_addq_32_al , 0xf1ff, 0x50b9, { 28, 28, 8, 8}}, + {m68k_op_subq_8_pi7 , 0xf1ff, 0x511f, { 12, 12, 8, 8}}, + {m68k_op_subq_8_pd7 , 0xf1ff, 0x5127, { 14, 14, 9, 9}}, + {m68k_op_subq_8_aw , 0xf1ff, 0x5138, { 16, 16, 8, 8}}, + {m68k_op_subq_8_al , 0xf1ff, 0x5139, { 20, 20, 8, 8}}, + {m68k_op_subq_16_aw , 0xf1ff, 0x5178, { 16, 16, 8, 8}}, + {m68k_op_subq_16_al , 0xf1ff, 0x5179, { 20, 20, 8, 8}}, + {m68k_op_subq_32_aw , 0xf1ff, 0x51b8, { 24, 24, 8, 8}}, + {m68k_op_subq_32_al , 0xf1ff, 0x51b9, { 28, 28, 8, 8}}, + {m68k_op_or_8_er_pi7 , 0xf1ff, 0x801f, { 8, 8, 6, 6}}, + {m68k_op_or_8_er_pd7 , 0xf1ff, 0x8027, { 10, 10, 7, 7}}, + {m68k_op_or_8_er_aw , 0xf1ff, 0x8038, { 12, 12, 6, 6}}, + {m68k_op_or_8_er_al , 0xf1ff, 0x8039, { 16, 16, 6, 6}}, + {m68k_op_or_8_er_pcdi , 0xf1ff, 0x803a, { 12, 12, 7, 7}}, + {m68k_op_or_8_er_pcix , 0xf1ff, 0x803b, { 14, 14, 9, 9}}, + {m68k_op_or_8_er_i , 0xf1ff, 0x803c, { 8, 8, 4, 4}}, + {m68k_op_or_16_er_aw , 0xf1ff, 0x8078, { 12, 12, 6, 6}}, + {m68k_op_or_16_er_al , 0xf1ff, 0x8079, { 16, 16, 6, 6}}, + {m68k_op_or_16_er_pcdi , 0xf1ff, 0x807a, { 12, 12, 7, 7}}, + {m68k_op_or_16_er_pcix , 0xf1ff, 0x807b, { 14, 14, 9, 9}}, + {m68k_op_or_16_er_i , 0xf1ff, 0x807c, { 8, 8, 4, 4}}, + {m68k_op_or_32_er_aw , 0xf1ff, 0x80b8, { 18, 18, 6, 6}}, + {m68k_op_or_32_er_al , 0xf1ff, 0x80b9, { 22, 22, 6, 6}}, + {m68k_op_or_32_er_pcdi , 0xf1ff, 0x80ba, { 18, 18, 7, 7}}, + {m68k_op_or_32_er_pcix , 0xf1ff, 0x80bb, { 20, 20, 9, 9}}, + {m68k_op_or_32_er_i , 0xf1ff, 0x80bc, { 16, 14, 6, 6}}, + {m68k_op_divu_16_aw , 0xf1ff, 0x80f8, {148, 116, 48, 48}}, + {m68k_op_divu_16_al , 0xf1ff, 0x80f9, {152, 120, 48, 48}}, + {m68k_op_divu_16_pcdi , 0xf1ff, 0x80fa, {148, 116, 49, 49}}, + {m68k_op_divu_16_pcix , 0xf1ff, 0x80fb, {150, 118, 51, 51}}, + {m68k_op_divu_16_i , 0xf1ff, 0x80fc, {144, 112, 46, 46}}, + {m68k_op_sbcd_8_mm_ay7 , 0xf1ff, 0x810f, { 18, 18, 16, 16}}, + {m68k_op_or_8_re_pi7 , 0xf1ff, 0x811f, { 12, 12, 8, 8}}, + {m68k_op_or_8_re_pd7 , 0xf1ff, 0x8127, { 14, 14, 9, 9}}, + {m68k_op_or_8_re_aw , 0xf1ff, 0x8138, { 16, 16, 8, 8}}, + {m68k_op_or_8_re_al , 0xf1ff, 0x8139, { 20, 20, 8, 8}}, + {m68k_op_pack_16_mm_ay7 , 0xf1ff, 0x814f, { 0, 0, 13, 13}}, + {m68k_op_or_16_re_aw , 0xf1ff, 0x8178, { 16, 16, 8, 8}}, + {m68k_op_or_16_re_al , 0xf1ff, 0x8179, { 20, 20, 8, 8}}, + {m68k_op_unpk_16_mm_ay7 , 0xf1ff, 0x818f, { 0, 0, 13, 13}}, + {m68k_op_or_32_re_aw , 0xf1ff, 0x81b8, { 24, 24, 8, 8}}, + {m68k_op_or_32_re_al , 0xf1ff, 0x81b9, { 28, 28, 8, 8}}, + {m68k_op_divs_16_aw , 0xf1ff, 0x81f8, {166, 130, 60, 60}}, + {m68k_op_divs_16_al , 0xf1ff, 0x81f9, {170, 134, 60, 60}}, + {m68k_op_divs_16_pcdi , 0xf1ff, 0x81fa, {166, 130, 61, 61}}, + {m68k_op_divs_16_pcix , 0xf1ff, 0x81fb, {168, 132, 63, 63}}, + {m68k_op_divs_16_i , 0xf1ff, 0x81fc, {162, 126, 58, 58}}, + {m68k_op_sub_8_er_pi7 , 0xf1ff, 0x901f, { 8, 8, 6, 6}}, + {m68k_op_sub_8_er_pd7 , 0xf1ff, 0x9027, { 10, 10, 7, 7}}, + {m68k_op_sub_8_er_aw , 0xf1ff, 0x9038, { 12, 12, 6, 6}}, + {m68k_op_sub_8_er_al , 0xf1ff, 0x9039, { 16, 16, 6, 6}}, + {m68k_op_sub_8_er_pcdi , 0xf1ff, 0x903a, { 12, 12, 7, 7}}, + {m68k_op_sub_8_er_pcix , 0xf1ff, 0x903b, { 14, 14, 9, 9}}, + {m68k_op_sub_8_er_i , 0xf1ff, 0x903c, { 8, 8, 4, 4}}, + {m68k_op_sub_16_er_aw , 0xf1ff, 0x9078, { 12, 12, 6, 6}}, + {m68k_op_sub_16_er_al , 0xf1ff, 0x9079, { 16, 16, 6, 6}}, + {m68k_op_sub_16_er_pcdi , 0xf1ff, 0x907a, { 12, 12, 7, 7}}, + {m68k_op_sub_16_er_pcix , 0xf1ff, 0x907b, { 14, 14, 9, 9}}, + {m68k_op_sub_16_er_i , 0xf1ff, 0x907c, { 8, 8, 4, 4}}, + {m68k_op_sub_32_er_aw , 0xf1ff, 0x90b8, { 18, 18, 6, 6}}, + {m68k_op_sub_32_er_al , 0xf1ff, 0x90b9, { 22, 22, 6, 6}}, + {m68k_op_sub_32_er_pcdi , 0xf1ff, 0x90ba, { 18, 18, 7, 7}}, + {m68k_op_sub_32_er_pcix , 0xf1ff, 0x90bb, { 20, 20, 9, 9}}, + {m68k_op_sub_32_er_i , 0xf1ff, 0x90bc, { 16, 14, 6, 6}}, + {m68k_op_suba_16_aw , 0xf1ff, 0x90f8, { 16, 16, 6, 6}}, + {m68k_op_suba_16_al , 0xf1ff, 0x90f9, { 20, 20, 6, 6}}, + {m68k_op_suba_16_pcdi , 0xf1ff, 0x90fa, { 16, 16, 7, 7}}, + {m68k_op_suba_16_pcix , 0xf1ff, 0x90fb, { 18, 18, 9, 9}}, + {m68k_op_suba_16_i , 0xf1ff, 0x90fc, { 12, 12, 4, 4}}, + {m68k_op_subx_8_mm_ay7 , 0xf1ff, 0x910f, { 18, 18, 12, 12}}, + {m68k_op_sub_8_re_pi7 , 0xf1ff, 0x911f, { 12, 12, 8, 8}}, + {m68k_op_sub_8_re_pd7 , 0xf1ff, 0x9127, { 14, 14, 9, 9}}, + {m68k_op_sub_8_re_aw , 0xf1ff, 0x9138, { 16, 16, 8, 8}}, + {m68k_op_sub_8_re_al , 0xf1ff, 0x9139, { 20, 20, 8, 8}}, + {m68k_op_sub_16_re_aw , 0xf1ff, 0x9178, { 16, 16, 8, 8}}, + {m68k_op_sub_16_re_al , 0xf1ff, 0x9179, { 20, 20, 8, 8}}, + {m68k_op_sub_32_re_aw , 0xf1ff, 0x91b8, { 24, 24, 8, 8}}, + {m68k_op_sub_32_re_al , 0xf1ff, 0x91b9, { 28, 28, 8, 8}}, + {m68k_op_suba_32_aw , 0xf1ff, 0x91f8, { 18, 18, 6, 6}}, + {m68k_op_suba_32_al , 0xf1ff, 0x91f9, { 22, 22, 6, 6}}, + {m68k_op_suba_32_pcdi , 0xf1ff, 0x91fa, { 18, 18, 7, 7}}, + {m68k_op_suba_32_pcix , 0xf1ff, 0x91fb, { 20, 20, 9, 9}}, + {m68k_op_suba_32_i , 0xf1ff, 0x91fc, { 16, 14, 6, 6}}, + {m68k_op_cmp_8_pi7 , 0xf1ff, 0xb01f, { 8, 8, 6, 6}}, + {m68k_op_cmp_8_pd7 , 0xf1ff, 0xb027, { 10, 10, 7, 7}}, + {m68k_op_cmp_8_aw , 0xf1ff, 0xb038, { 12, 12, 6, 6}}, + {m68k_op_cmp_8_al , 0xf1ff, 0xb039, { 16, 16, 6, 6}}, + {m68k_op_cmp_8_pcdi , 0xf1ff, 0xb03a, { 12, 12, 7, 7}}, + {m68k_op_cmp_8_pcix , 0xf1ff, 0xb03b, { 14, 14, 9, 9}}, + {m68k_op_cmp_8_i , 0xf1ff, 0xb03c, { 8, 8, 4, 4}}, + {m68k_op_cmp_16_aw , 0xf1ff, 0xb078, { 12, 12, 6, 6}}, + {m68k_op_cmp_16_al , 0xf1ff, 0xb079, { 16, 16, 6, 6}}, + {m68k_op_cmp_16_pcdi , 0xf1ff, 0xb07a, { 12, 12, 7, 7}}, + {m68k_op_cmp_16_pcix , 0xf1ff, 0xb07b, { 14, 14, 9, 9}}, + {m68k_op_cmp_16_i , 0xf1ff, 0xb07c, { 8, 8, 4, 4}}, + {m68k_op_cmp_32_aw , 0xf1ff, 0xb0b8, { 18, 18, 6, 6}}, + {m68k_op_cmp_32_al , 0xf1ff, 0xb0b9, { 22, 22, 6, 6}}, + {m68k_op_cmp_32_pcdi , 0xf1ff, 0xb0ba, { 18, 18, 7, 7}}, + {m68k_op_cmp_32_pcix , 0xf1ff, 0xb0bb, { 20, 20, 9, 9}}, + {m68k_op_cmp_32_i , 0xf1ff, 0xb0bc, { 14, 14, 6, 6}}, + {m68k_op_cmpa_16_aw , 0xf1ff, 0xb0f8, { 14, 14, 8, 8}}, + {m68k_op_cmpa_16_al , 0xf1ff, 0xb0f9, { 18, 18, 8, 8}}, + {m68k_op_cmpa_16_pcdi , 0xf1ff, 0xb0fa, { 14, 14, 9, 9}}, + {m68k_op_cmpa_16_pcix , 0xf1ff, 0xb0fb, { 16, 16, 11, 11}}, + {m68k_op_cmpa_16_i , 0xf1ff, 0xb0fc, { 10, 10, 6, 6}}, + {m68k_op_cmpm_8_ay7 , 0xf1ff, 0xb10f, { 12, 12, 9, 9}}, + {m68k_op_eor_8_pi7 , 0xf1ff, 0xb11f, { 12, 12, 8, 8}}, + {m68k_op_eor_8_pd7 , 0xf1ff, 0xb127, { 14, 14, 9, 9}}, + {m68k_op_eor_8_aw , 0xf1ff, 0xb138, { 16, 16, 8, 8}}, + {m68k_op_eor_8_al , 0xf1ff, 0xb139, { 20, 20, 8, 8}}, + {m68k_op_eor_16_aw , 0xf1ff, 0xb178, { 16, 16, 8, 8}}, + {m68k_op_eor_16_al , 0xf1ff, 0xb179, { 20, 20, 8, 8}}, + {m68k_op_eor_32_aw , 0xf1ff, 0xb1b8, { 24, 24, 8, 8}}, + {m68k_op_eor_32_al , 0xf1ff, 0xb1b9, { 28, 28, 8, 8}}, + {m68k_op_cmpa_32_aw , 0xf1ff, 0xb1f8, { 18, 18, 8, 8}}, + {m68k_op_cmpa_32_al , 0xf1ff, 0xb1f9, { 22, 22, 8, 8}}, + {m68k_op_cmpa_32_pcdi , 0xf1ff, 0xb1fa, { 18, 18, 9, 9}}, + {m68k_op_cmpa_32_pcix , 0xf1ff, 0xb1fb, { 20, 20, 11, 11}}, + {m68k_op_cmpa_32_i , 0xf1ff, 0xb1fc, { 14, 14, 8, 8}}, + {m68k_op_and_8_er_pi7 , 0xf1ff, 0xc01f, { 8, 8, 6, 6}}, + {m68k_op_and_8_er_pd7 , 0xf1ff, 0xc027, { 10, 10, 7, 7}}, + {m68k_op_and_8_er_aw , 0xf1ff, 0xc038, { 12, 12, 6, 6}}, + {m68k_op_and_8_er_al , 0xf1ff, 0xc039, { 16, 16, 6, 6}}, + {m68k_op_and_8_er_pcdi , 0xf1ff, 0xc03a, { 12, 12, 7, 7}}, + {m68k_op_and_8_er_pcix , 0xf1ff, 0xc03b, { 14, 14, 9, 9}}, + {m68k_op_and_8_er_i , 0xf1ff, 0xc03c, { 8, 8, 4, 4}}, + {m68k_op_and_16_er_aw , 0xf1ff, 0xc078, { 12, 12, 6, 6}}, + {m68k_op_and_16_er_al , 0xf1ff, 0xc079, { 16, 16, 6, 6}}, + {m68k_op_and_16_er_pcdi , 0xf1ff, 0xc07a, { 12, 12, 7, 7}}, + {m68k_op_and_16_er_pcix , 0xf1ff, 0xc07b, { 14, 14, 9, 9}}, + {m68k_op_and_16_er_i , 0xf1ff, 0xc07c, { 8, 8, 4, 4}}, + {m68k_op_and_32_er_aw , 0xf1ff, 0xc0b8, { 18, 18, 6, 6}}, + {m68k_op_and_32_er_al , 0xf1ff, 0xc0b9, { 22, 22, 6, 6}}, + {m68k_op_and_32_er_pcdi , 0xf1ff, 0xc0ba, { 18, 18, 7, 7}}, + {m68k_op_and_32_er_pcix , 0xf1ff, 0xc0bb, { 20, 20, 9, 9}}, + {m68k_op_and_32_er_i , 0xf1ff, 0xc0bc, { 16, 14, 6, 6}}, + {m68k_op_mulu_16_aw , 0xf1ff, 0xc0f8, { 62, 38, 31, 31}}, + {m68k_op_mulu_16_al , 0xf1ff, 0xc0f9, { 66, 42, 31, 31}}, + {m68k_op_mulu_16_pcdi , 0xf1ff, 0xc0fa, { 62, 38, 32, 32}}, + {m68k_op_mulu_16_pcix , 0xf1ff, 0xc0fb, { 64, 40, 34, 34}}, + {m68k_op_mulu_16_i , 0xf1ff, 0xc0fc, { 58, 34, 29, 29}}, + {m68k_op_abcd_8_mm_ay7 , 0xf1ff, 0xc10f, { 18, 18, 16, 16}}, + {m68k_op_and_8_re_pi7 , 0xf1ff, 0xc11f, { 12, 12, 8, 8}}, + {m68k_op_and_8_re_pd7 , 0xf1ff, 0xc127, { 14, 14, 9, 9}}, + {m68k_op_and_8_re_aw , 0xf1ff, 0xc138, { 16, 16, 8, 8}}, + {m68k_op_and_8_re_al , 0xf1ff, 0xc139, { 20, 20, 8, 8}}, + {m68k_op_and_16_re_aw , 0xf1ff, 0xc178, { 16, 16, 8, 8}}, + {m68k_op_and_16_re_al , 0xf1ff, 0xc179, { 20, 20, 8, 8}}, + {m68k_op_and_32_re_aw , 0xf1ff, 0xc1b8, { 24, 24, 8, 8}}, + {m68k_op_and_32_re_al , 0xf1ff, 0xc1b9, { 28, 28, 8, 8}}, + {m68k_op_muls_16_aw , 0xf1ff, 0xc1f8, { 62, 40, 31, 31}}, + {m68k_op_muls_16_al , 0xf1ff, 0xc1f9, { 66, 44, 31, 31}}, + {m68k_op_muls_16_pcdi , 0xf1ff, 0xc1fa, { 62, 40, 32, 32}}, + {m68k_op_muls_16_pcix , 0xf1ff, 0xc1fb, { 64, 42, 34, 34}}, + {m68k_op_muls_16_i , 0xf1ff, 0xc1fc, { 58, 36, 29, 29}}, + {m68k_op_add_8_er_pi7 , 0xf1ff, 0xd01f, { 8, 8, 6, 6}}, + {m68k_op_add_8_er_pd7 , 0xf1ff, 0xd027, { 10, 10, 7, 7}}, + {m68k_op_add_8_er_aw , 0xf1ff, 0xd038, { 12, 12, 6, 6}}, + {m68k_op_add_8_er_al , 0xf1ff, 0xd039, { 16, 16, 6, 6}}, + {m68k_op_add_8_er_pcdi , 0xf1ff, 0xd03a, { 12, 12, 7, 7}}, + {m68k_op_add_8_er_pcix , 0xf1ff, 0xd03b, { 14, 14, 9, 9}}, + {m68k_op_add_8_er_i , 0xf1ff, 0xd03c, { 8, 8, 4, 4}}, + {m68k_op_add_16_er_aw , 0xf1ff, 0xd078, { 12, 12, 6, 6}}, + {m68k_op_add_16_er_al , 0xf1ff, 0xd079, { 16, 16, 6, 6}}, + {m68k_op_add_16_er_pcdi , 0xf1ff, 0xd07a, { 12, 12, 7, 7}}, + {m68k_op_add_16_er_pcix , 0xf1ff, 0xd07b, { 14, 14, 9, 9}}, + {m68k_op_add_16_er_i , 0xf1ff, 0xd07c, { 8, 8, 4, 4}}, + {m68k_op_add_32_er_aw , 0xf1ff, 0xd0b8, { 18, 18, 6, 6}}, + {m68k_op_add_32_er_al , 0xf1ff, 0xd0b9, { 22, 22, 6, 6}}, + {m68k_op_add_32_er_pcdi , 0xf1ff, 0xd0ba, { 18, 18, 7, 7}}, + {m68k_op_add_32_er_pcix , 0xf1ff, 0xd0bb, { 20, 20, 9, 9}}, + {m68k_op_add_32_er_i , 0xf1ff, 0xd0bc, { 16, 14, 6, 6}}, + {m68k_op_adda_16_aw , 0xf1ff, 0xd0f8, { 16, 16, 6, 6}}, + {m68k_op_adda_16_al , 0xf1ff, 0xd0f9, { 20, 20, 6, 6}}, + {m68k_op_adda_16_pcdi , 0xf1ff, 0xd0fa, { 16, 16, 7, 7}}, + {m68k_op_adda_16_pcix , 0xf1ff, 0xd0fb, { 18, 18, 9, 9}}, + {m68k_op_adda_16_i , 0xf1ff, 0xd0fc, { 12, 12, 4, 4}}, + {m68k_op_addx_8_mm_ay7 , 0xf1ff, 0xd10f, { 18, 18, 12, 12}}, + {m68k_op_add_8_re_pi7 , 0xf1ff, 0xd11f, { 12, 12, 8, 8}}, + {m68k_op_add_8_re_pd7 , 0xf1ff, 0xd127, { 14, 14, 9, 9}}, + {m68k_op_add_8_re_aw , 0xf1ff, 0xd138, { 16, 16, 8, 8}}, + {m68k_op_add_8_re_al , 0xf1ff, 0xd139, { 20, 20, 8, 8}}, + {m68k_op_add_16_re_aw , 0xf1ff, 0xd178, { 16, 16, 8, 8}}, + {m68k_op_add_16_re_al , 0xf1ff, 0xd179, { 20, 20, 8, 8}}, + {m68k_op_add_32_re_aw , 0xf1ff, 0xd1b8, { 24, 24, 8, 8}}, + {m68k_op_add_32_re_al , 0xf1ff, 0xd1b9, { 28, 28, 8, 8}}, + {m68k_op_adda_32_aw , 0xf1ff, 0xd1f8, { 18, 18, 6, 6}}, + {m68k_op_adda_32_al , 0xf1ff, 0xd1f9, { 22, 22, 6, 6}}, + {m68k_op_adda_32_pcdi , 0xf1ff, 0xd1fa, { 18, 18, 7, 7}}, + {m68k_op_adda_32_pcix , 0xf1ff, 0xd1fb, { 20, 20, 9, 9}}, + {m68k_op_adda_32_i , 0xf1ff, 0xd1fc, { 16, 14, 6, 6}}, + {m68k_op_ori_8_d , 0xfff8, 0x0000, { 8, 8, 2, 2}}, + {m68k_op_ori_8_ai , 0xfff8, 0x0010, { 16, 16, 8, 8}}, + {m68k_op_ori_8_pi , 0xfff8, 0x0018, { 16, 16, 8, 8}}, + {m68k_op_ori_8_pd , 0xfff8, 0x0020, { 18, 18, 9, 9}}, + {m68k_op_ori_8_di , 0xfff8, 0x0028, { 20, 20, 9, 9}}, + {m68k_op_ori_8_ix , 0xfff8, 0x0030, { 22, 22, 11, 11}}, + {m68k_op_ori_16_d , 0xfff8, 0x0040, { 8, 8, 2, 2}}, + {m68k_op_ori_16_ai , 0xfff8, 0x0050, { 16, 16, 8, 8}}, + {m68k_op_ori_16_pi , 0xfff8, 0x0058, { 16, 16, 8, 8}}, + {m68k_op_ori_16_pd , 0xfff8, 0x0060, { 18, 18, 9, 9}}, + {m68k_op_ori_16_di , 0xfff8, 0x0068, { 20, 20, 9, 9}}, + {m68k_op_ori_16_ix , 0xfff8, 0x0070, { 22, 22, 11, 11}}, + {m68k_op_ori_32_d , 0xfff8, 0x0080, { 16, 14, 2, 2}}, + {m68k_op_ori_32_ai , 0xfff8, 0x0090, { 28, 28, 8, 8}}, + {m68k_op_ori_32_pi , 0xfff8, 0x0098, { 28, 28, 8, 8}}, + {m68k_op_ori_32_pd , 0xfff8, 0x00a0, { 30, 30, 9, 9}}, + {m68k_op_ori_32_di , 0xfff8, 0x00a8, { 32, 32, 9, 9}}, + {m68k_op_ori_32_ix , 0xfff8, 0x00b0, { 34, 34, 11, 11}}, + {m68k_op_chk2cmp2_8_ai , 0xfff8, 0x00d0, { 0, 0, 22, 22}}, + {m68k_op_chk2cmp2_8_di , 0xfff8, 0x00e8, { 0, 0, 23, 23}}, + {m68k_op_chk2cmp2_8_ix , 0xfff8, 0x00f0, { 0, 0, 25, 25}}, + {m68k_op_andi_8_d , 0xfff8, 0x0200, { 8, 8, 2, 2}}, + {m68k_op_andi_8_ai , 0xfff8, 0x0210, { 16, 16, 8, 8}}, + {m68k_op_andi_8_pi , 0xfff8, 0x0218, { 16, 16, 8, 8}}, + {m68k_op_andi_8_pd , 0xfff8, 0x0220, { 18, 18, 9, 9}}, + {m68k_op_andi_8_di , 0xfff8, 0x0228, { 20, 20, 9, 9}}, + {m68k_op_andi_8_ix , 0xfff8, 0x0230, { 22, 22, 11, 11}}, + {m68k_op_andi_16_d , 0xfff8, 0x0240, { 8, 8, 2, 2}}, + {m68k_op_andi_16_ai , 0xfff8, 0x0250, { 16, 16, 8, 8}}, + {m68k_op_andi_16_pi , 0xfff8, 0x0258, { 16, 16, 8, 8}}, + {m68k_op_andi_16_pd , 0xfff8, 0x0260, { 18, 18, 9, 9}}, + {m68k_op_andi_16_di , 0xfff8, 0x0268, { 20, 20, 9, 9}}, + {m68k_op_andi_16_ix , 0xfff8, 0x0270, { 22, 22, 11, 11}}, + {m68k_op_andi_32_d , 0xfff8, 0x0280, { 14, 14, 2, 2}}, + {m68k_op_andi_32_ai , 0xfff8, 0x0290, { 28, 28, 8, 8}}, + {m68k_op_andi_32_pi , 0xfff8, 0x0298, { 28, 28, 8, 8}}, + {m68k_op_andi_32_pd , 0xfff8, 0x02a0, { 30, 30, 9, 9}}, + {m68k_op_andi_32_di , 0xfff8, 0x02a8, { 32, 32, 9, 9}}, + {m68k_op_andi_32_ix , 0xfff8, 0x02b0, { 34, 34, 11, 11}}, + {m68k_op_chk2cmp2_16_ai , 0xfff8, 0x02d0, { 0, 0, 22, 22}}, + {m68k_op_chk2cmp2_16_di , 0xfff8, 0x02e8, { 0, 0, 23, 23}}, + {m68k_op_chk2cmp2_16_ix , 0xfff8, 0x02f0, { 0, 0, 25, 25}}, + {m68k_op_subi_8_d , 0xfff8, 0x0400, { 8, 8, 2, 2}}, + {m68k_op_subi_8_ai , 0xfff8, 0x0410, { 16, 16, 8, 8}}, + {m68k_op_subi_8_pi , 0xfff8, 0x0418, { 16, 16, 8, 8}}, + {m68k_op_subi_8_pd , 0xfff8, 0x0420, { 18, 18, 9, 9}}, + {m68k_op_subi_8_di , 0xfff8, 0x0428, { 20, 20, 9, 9}}, + {m68k_op_subi_8_ix , 0xfff8, 0x0430, { 22, 22, 11, 11}}, + {m68k_op_subi_16_d , 0xfff8, 0x0440, { 8, 8, 2, 2}}, + {m68k_op_subi_16_ai , 0xfff8, 0x0450, { 16, 16, 8, 8}}, + {m68k_op_subi_16_pi , 0xfff8, 0x0458, { 16, 16, 8, 8}}, + {m68k_op_subi_16_pd , 0xfff8, 0x0460, { 18, 18, 9, 9}}, + {m68k_op_subi_16_di , 0xfff8, 0x0468, { 20, 20, 9, 9}}, + {m68k_op_subi_16_ix , 0xfff8, 0x0470, { 22, 22, 11, 11}}, + {m68k_op_subi_32_d , 0xfff8, 0x0480, { 16, 14, 2, 2}}, + {m68k_op_subi_32_ai , 0xfff8, 0x0490, { 28, 28, 8, 8}}, + {m68k_op_subi_32_pi , 0xfff8, 0x0498, { 28, 28, 8, 8}}, + {m68k_op_subi_32_pd , 0xfff8, 0x04a0, { 30, 30, 9, 9}}, + {m68k_op_subi_32_di , 0xfff8, 0x04a8, { 32, 32, 9, 9}}, + {m68k_op_subi_32_ix , 0xfff8, 0x04b0, { 34, 34, 11, 11}}, + {m68k_op_chk2cmp2_32_ai , 0xfff8, 0x04d0, { 0, 0, 22, 22}}, + {m68k_op_chk2cmp2_32_di , 0xfff8, 0x04e8, { 0, 0, 23, 23}}, + {m68k_op_chk2cmp2_32_ix , 0xfff8, 0x04f0, { 0, 0, 25, 25}}, + {m68k_op_addi_8_d , 0xfff8, 0x0600, { 8, 8, 2, 2}}, + {m68k_op_addi_8_ai , 0xfff8, 0x0610, { 16, 16, 8, 8}}, + {m68k_op_addi_8_pi , 0xfff8, 0x0618, { 16, 16, 8, 8}}, + {m68k_op_addi_8_pd , 0xfff8, 0x0620, { 18, 18, 9, 9}}, + {m68k_op_addi_8_di , 0xfff8, 0x0628, { 20, 20, 9, 9}}, + {m68k_op_addi_8_ix , 0xfff8, 0x0630, { 22, 22, 11, 11}}, + {m68k_op_addi_16_d , 0xfff8, 0x0640, { 8, 8, 2, 2}}, + {m68k_op_addi_16_ai , 0xfff8, 0x0650, { 16, 16, 8, 8}}, + {m68k_op_addi_16_pi , 0xfff8, 0x0658, { 16, 16, 8, 8}}, + {m68k_op_addi_16_pd , 0xfff8, 0x0660, { 18, 18, 9, 9}}, + {m68k_op_addi_16_di , 0xfff8, 0x0668, { 20, 20, 9, 9}}, + {m68k_op_addi_16_ix , 0xfff8, 0x0670, { 22, 22, 11, 11}}, + {m68k_op_addi_32_d , 0xfff8, 0x0680, { 16, 14, 2, 2}}, + {m68k_op_addi_32_ai , 0xfff8, 0x0690, { 28, 28, 8, 8}}, + {m68k_op_addi_32_pi , 0xfff8, 0x0698, { 28, 28, 8, 8}}, + {m68k_op_addi_32_pd , 0xfff8, 0x06a0, { 30, 30, 9, 9}}, + {m68k_op_addi_32_di , 0xfff8, 0x06a8, { 32, 32, 9, 9}}, + {m68k_op_addi_32_ix , 0xfff8, 0x06b0, { 34, 34, 11, 11}}, + {m68k_op_callm_32_ai , 0xfff8, 0x06d0, { 0, 0, 64, 64}}, + {m68k_op_callm_32_di , 0xfff8, 0x06e8, { 0, 0, 65, 65}}, + {m68k_op_callm_32_ix , 0xfff8, 0x06f0, { 0, 0, 67, 67}}, + {m68k_op_btst_32_s_d , 0xfff8, 0x0800, { 10, 10, 4, 4}}, + {m68k_op_btst_8_s_ai , 0xfff8, 0x0810, { 12, 12, 8, 8}}, + {m68k_op_btst_8_s_pi , 0xfff8, 0x0818, { 12, 12, 8, 8}}, + {m68k_op_btst_8_s_pd , 0xfff8, 0x0820, { 14, 14, 9, 9}}, + {m68k_op_btst_8_s_di , 0xfff8, 0x0828, { 16, 16, 9, 9}}, + {m68k_op_btst_8_s_ix , 0xfff8, 0x0830, { 18, 18, 11, 11}}, + {m68k_op_bchg_32_s_d , 0xfff8, 0x0840, { 12, 12, 4, 4}}, + {m68k_op_bchg_8_s_ai , 0xfff8, 0x0850, { 16, 16, 8, 8}}, + {m68k_op_bchg_8_s_pi , 0xfff8, 0x0858, { 16, 16, 8, 8}}, + {m68k_op_bchg_8_s_pd , 0xfff8, 0x0860, { 18, 18, 9, 9}}, + {m68k_op_bchg_8_s_di , 0xfff8, 0x0868, { 20, 20, 9, 9}}, + {m68k_op_bchg_8_s_ix , 0xfff8, 0x0870, { 22, 22, 11, 11}}, + {m68k_op_bclr_32_s_d , 0xfff8, 0x0880, { 14, 14, 4, 4}}, + {m68k_op_bclr_8_s_ai , 0xfff8, 0x0890, { 16, 16, 8, 8}}, + {m68k_op_bclr_8_s_pi , 0xfff8, 0x0898, { 16, 16, 8, 8}}, + {m68k_op_bclr_8_s_pd , 0xfff8, 0x08a0, { 18, 18, 9, 9}}, + {m68k_op_bclr_8_s_di , 0xfff8, 0x08a8, { 20, 20, 9, 9}}, + {m68k_op_bclr_8_s_ix , 0xfff8, 0x08b0, { 22, 22, 11, 11}}, + {m68k_op_bset_32_s_d , 0xfff8, 0x08c0, { 12, 12, 4, 4}}, + {m68k_op_bset_8_s_ai , 0xfff8, 0x08d0, { 16, 16, 8, 8}}, + {m68k_op_bset_8_s_pi , 0xfff8, 0x08d8, { 16, 16, 8, 8}}, + {m68k_op_bset_8_s_pd , 0xfff8, 0x08e0, { 18, 18, 9, 9}}, + {m68k_op_bset_8_s_di , 0xfff8, 0x08e8, { 20, 20, 9, 9}}, + {m68k_op_bset_8_s_ix , 0xfff8, 0x08f0, { 22, 22, 11, 11}}, + {m68k_op_eori_8_d , 0xfff8, 0x0a00, { 8, 8, 2, 2}}, + {m68k_op_eori_8_ai , 0xfff8, 0x0a10, { 16, 16, 8, 8}}, + {m68k_op_eori_8_pi , 0xfff8, 0x0a18, { 16, 16, 8, 8}}, + {m68k_op_eori_8_pd , 0xfff8, 0x0a20, { 18, 18, 9, 9}}, + {m68k_op_eori_8_di , 0xfff8, 0x0a28, { 20, 20, 9, 9}}, + {m68k_op_eori_8_ix , 0xfff8, 0x0a30, { 22, 22, 11, 11}}, + {m68k_op_eori_16_d , 0xfff8, 0x0a40, { 8, 8, 2, 2}}, + {m68k_op_eori_16_ai , 0xfff8, 0x0a50, { 16, 16, 8, 8}}, + {m68k_op_eori_16_pi , 0xfff8, 0x0a58, { 16, 16, 8, 8}}, + {m68k_op_eori_16_pd , 0xfff8, 0x0a60, { 18, 18, 9, 9}}, + {m68k_op_eori_16_di , 0xfff8, 0x0a68, { 20, 20, 9, 9}}, + {m68k_op_eori_16_ix , 0xfff8, 0x0a70, { 22, 22, 11, 11}}, + {m68k_op_eori_32_d , 0xfff8, 0x0a80, { 16, 14, 2, 2}}, + {m68k_op_eori_32_ai , 0xfff8, 0x0a90, { 28, 28, 8, 8}}, + {m68k_op_eori_32_pi , 0xfff8, 0x0a98, { 28, 28, 8, 8}}, + {m68k_op_eori_32_pd , 0xfff8, 0x0aa0, { 30, 30, 9, 9}}, + {m68k_op_eori_32_di , 0xfff8, 0x0aa8, { 32, 32, 9, 9}}, + {m68k_op_eori_32_ix , 0xfff8, 0x0ab0, { 34, 34, 11, 11}}, + {m68k_op_cas_8_ai , 0xfff8, 0x0ad0, { 0, 0, 16, 16}}, + {m68k_op_cas_8_pi , 0xfff8, 0x0ad8, { 0, 0, 16, 16}}, + {m68k_op_cas_8_pd , 0xfff8, 0x0ae0, { 0, 0, 17, 17}}, + {m68k_op_cas_8_di , 0xfff8, 0x0ae8, { 0, 0, 17, 17}}, + {m68k_op_cas_8_ix , 0xfff8, 0x0af0, { 0, 0, 19, 19}}, + {m68k_op_cmpi_8_d , 0xfff8, 0x0c00, { 8, 8, 2, 2}}, + {m68k_op_cmpi_8_ai , 0xfff8, 0x0c10, { 12, 12, 6, 6}}, + {m68k_op_cmpi_8_pi , 0xfff8, 0x0c18, { 12, 12, 6, 6}}, + {m68k_op_cmpi_8_pd , 0xfff8, 0x0c20, { 14, 14, 7, 7}}, + {m68k_op_cmpi_8_di , 0xfff8, 0x0c28, { 16, 16, 7, 7}}, + {m68k_op_cmpi_8_ix , 0xfff8, 0x0c30, { 18, 18, 9, 9}}, + {m68k_op_cmpi_16_d , 0xfff8, 0x0c40, { 8, 8, 2, 2}}, + {m68k_op_cmpi_16_ai , 0xfff8, 0x0c50, { 12, 12, 6, 6}}, + {m68k_op_cmpi_16_pi , 0xfff8, 0x0c58, { 12, 12, 6, 6}}, + {m68k_op_cmpi_16_pd , 0xfff8, 0x0c60, { 14, 14, 7, 7}}, + {m68k_op_cmpi_16_di , 0xfff8, 0x0c68, { 16, 16, 7, 7}}, + {m68k_op_cmpi_16_ix , 0xfff8, 0x0c70, { 18, 18, 9, 9}}, + {m68k_op_cmpi_32_d , 0xfff8, 0x0c80, { 14, 12, 2, 2}}, + {m68k_op_cmpi_32_ai , 0xfff8, 0x0c90, { 20, 20, 6, 6}}, + {m68k_op_cmpi_32_pi , 0xfff8, 0x0c98, { 20, 20, 6, 6}}, + {m68k_op_cmpi_32_pd , 0xfff8, 0x0ca0, { 22, 22, 7, 7}}, + {m68k_op_cmpi_32_di , 0xfff8, 0x0ca8, { 24, 24, 7, 7}}, + {m68k_op_cmpi_32_ix , 0xfff8, 0x0cb0, { 26, 26, 9, 9}}, + {m68k_op_cas_16_ai , 0xfff8, 0x0cd0, { 0, 0, 16, 16}}, + {m68k_op_cas_16_pi , 0xfff8, 0x0cd8, { 0, 0, 16, 16}}, + {m68k_op_cas_16_pd , 0xfff8, 0x0ce0, { 0, 0, 17, 17}}, + {m68k_op_cas_16_di , 0xfff8, 0x0ce8, { 0, 0, 17, 17}}, + {m68k_op_cas_16_ix , 0xfff8, 0x0cf0, { 0, 0, 19, 19}}, + {m68k_op_moves_8_ai , 0xfff8, 0x0e10, { 0, 18, 9, 9}}, + {m68k_op_moves_8_pi , 0xfff8, 0x0e18, { 0, 18, 9, 9}}, + {m68k_op_moves_8_pd , 0xfff8, 0x0e20, { 0, 20, 10, 10}}, + {m68k_op_moves_8_di , 0xfff8, 0x0e28, { 0, 26, 10, 10}}, + {m68k_op_moves_8_ix , 0xfff8, 0x0e30, { 0, 30, 12, 12}}, + {m68k_op_moves_16_ai , 0xfff8, 0x0e50, { 0, 18, 9, 9}}, + {m68k_op_moves_16_pi , 0xfff8, 0x0e58, { 0, 18, 9, 9}}, + {m68k_op_moves_16_pd , 0xfff8, 0x0e60, { 0, 20, 10, 10}}, + {m68k_op_moves_16_di , 0xfff8, 0x0e68, { 0, 26, 10, 10}}, + {m68k_op_moves_16_ix , 0xfff8, 0x0e70, { 0, 30, 12, 12}}, + {m68k_op_moves_32_ai , 0xfff8, 0x0e90, { 0, 22, 9, 9}}, + {m68k_op_moves_32_pi , 0xfff8, 0x0e98, { 0, 22, 9, 9}}, + {m68k_op_moves_32_pd , 0xfff8, 0x0ea0, { 0, 28, 10, 10}}, + {m68k_op_moves_32_di , 0xfff8, 0x0ea8, { 0, 32, 10, 10}}, + {m68k_op_moves_32_ix , 0xfff8, 0x0eb0, { 0, 36, 12, 12}}, + {m68k_op_cas_32_ai , 0xfff8, 0x0ed0, { 0, 0, 16, 16}}, + {m68k_op_cas_32_pi , 0xfff8, 0x0ed8, { 0, 0, 16, 16}}, + {m68k_op_cas_32_pd , 0xfff8, 0x0ee0, { 0, 0, 17, 17}}, + {m68k_op_cas_32_di , 0xfff8, 0x0ee8, { 0, 0, 17, 17}}, + {m68k_op_cas_32_ix , 0xfff8, 0x0ef0, { 0, 0, 19, 19}}, + {m68k_op_move_8_aw_d , 0xfff8, 0x11c0, { 12, 12, 4, 4}}, + {m68k_op_move_8_aw_ai , 0xfff8, 0x11d0, { 16, 16, 8, 8}}, + {m68k_op_move_8_aw_pi , 0xfff8, 0x11d8, { 16, 16, 8, 8}}, + {m68k_op_move_8_aw_pd , 0xfff8, 0x11e0, { 18, 18, 9, 9}}, + {m68k_op_move_8_aw_di , 0xfff8, 0x11e8, { 20, 20, 9, 9}}, + {m68k_op_move_8_aw_ix , 0xfff8, 0x11f0, { 22, 22, 11, 11}}, + {m68k_op_move_8_al_d , 0xfff8, 0x13c0, { 16, 16, 6, 6}}, + {m68k_op_move_8_al_ai , 0xfff8, 0x13d0, { 20, 20, 10, 10}}, + {m68k_op_move_8_al_pi , 0xfff8, 0x13d8, { 20, 20, 10, 10}}, + {m68k_op_move_8_al_pd , 0xfff8, 0x13e0, { 22, 22, 11, 11}}, + {m68k_op_move_8_al_di , 0xfff8, 0x13e8, { 24, 24, 11, 11}}, + {m68k_op_move_8_al_ix , 0xfff8, 0x13f0, { 26, 26, 13, 13}}, + {m68k_op_move_8_pi7_d , 0xfff8, 0x1ec0, { 8, 8, 4, 4}}, + {m68k_op_move_8_pi7_ai , 0xfff8, 0x1ed0, { 12, 12, 8, 8}}, + {m68k_op_move_8_pi7_pi , 0xfff8, 0x1ed8, { 12, 12, 8, 8}}, + {m68k_op_move_8_pi7_pd , 0xfff8, 0x1ee0, { 14, 14, 9, 9}}, + {m68k_op_move_8_pi7_di , 0xfff8, 0x1ee8, { 16, 16, 9, 9}}, + {m68k_op_move_8_pi7_ix , 0xfff8, 0x1ef0, { 18, 18, 11, 11}}, + {m68k_op_move_8_pd7_d , 0xfff8, 0x1f00, { 8, 8, 5, 5}}, + {m68k_op_move_8_pd7_ai , 0xfff8, 0x1f10, { 12, 12, 9, 9}}, + {m68k_op_move_8_pd7_pi , 0xfff8, 0x1f18, { 12, 12, 9, 9}}, + {m68k_op_move_8_pd7_pd , 0xfff8, 0x1f20, { 14, 14, 10, 10}}, + {m68k_op_move_8_pd7_di , 0xfff8, 0x1f28, { 16, 16, 10, 10}}, + {m68k_op_move_8_pd7_ix , 0xfff8, 0x1f30, { 18, 18, 12, 12}}, + {m68k_op_move_32_aw_d , 0xfff8, 0x21c0, { 16, 16, 4, 4}}, + {m68k_op_move_32_aw_a , 0xfff8, 0x21c8, { 16, 16, 4, 4}}, + {m68k_op_move_32_aw_ai , 0xfff8, 0x21d0, { 24, 24, 8, 8}}, + {m68k_op_move_32_aw_pi , 0xfff8, 0x21d8, { 24, 24, 8, 8}}, + {m68k_op_move_32_aw_pd , 0xfff8, 0x21e0, { 26, 26, 9, 9}}, + {m68k_op_move_32_aw_di , 0xfff8, 0x21e8, { 28, 28, 9, 9}}, + {m68k_op_move_32_aw_ix , 0xfff8, 0x21f0, { 30, 30, 11, 11}}, + {m68k_op_move_32_al_d , 0xfff8, 0x23c0, { 20, 20, 6, 6}}, + {m68k_op_move_32_al_a , 0xfff8, 0x23c8, { 20, 20, 6, 6}}, + {m68k_op_move_32_al_ai , 0xfff8, 0x23d0, { 28, 28, 10, 10}}, + {m68k_op_move_32_al_pi , 0xfff8, 0x23d8, { 28, 28, 10, 10}}, + {m68k_op_move_32_al_pd , 0xfff8, 0x23e0, { 30, 30, 11, 11}}, + {m68k_op_move_32_al_di , 0xfff8, 0x23e8, { 32, 32, 11, 11}}, + {m68k_op_move_32_al_ix , 0xfff8, 0x23f0, { 34, 34, 13, 13}}, + {m68k_op_move_16_aw_d , 0xfff8, 0x31c0, { 12, 12, 4, 4}}, + {m68k_op_move_16_aw_a , 0xfff8, 0x31c8, { 12, 12, 4, 4}}, + {m68k_op_move_16_aw_ai , 0xfff8, 0x31d0, { 16, 16, 8, 8}}, + {m68k_op_move_16_aw_pi , 0xfff8, 0x31d8, { 16, 16, 8, 8}}, + {m68k_op_move_16_aw_pd , 0xfff8, 0x31e0, { 18, 18, 9, 9}}, + {m68k_op_move_16_aw_di , 0xfff8, 0x31e8, { 20, 20, 9, 9}}, + {m68k_op_move_16_aw_ix , 0xfff8, 0x31f0, { 22, 22, 11, 11}}, + {m68k_op_move_16_al_d , 0xfff8, 0x33c0, { 16, 16, 6, 6}}, + {m68k_op_move_16_al_a , 0xfff8, 0x33c8, { 16, 16, 6, 6}}, + {m68k_op_move_16_al_ai , 0xfff8, 0x33d0, { 20, 20, 10, 10}}, + {m68k_op_move_16_al_pi , 0xfff8, 0x33d8, { 20, 20, 10, 10}}, + {m68k_op_move_16_al_pd , 0xfff8, 0x33e0, { 22, 22, 11, 11}}, + {m68k_op_move_16_al_di , 0xfff8, 0x33e8, { 24, 24, 11, 11}}, + {m68k_op_move_16_al_ix , 0xfff8, 0x33f0, { 26, 26, 13, 13}}, + {m68k_op_negx_8_d , 0xfff8, 0x4000, { 4, 4, 2, 2}}, + {m68k_op_negx_8_ai , 0xfff8, 0x4010, { 12, 12, 8, 8}}, + {m68k_op_negx_8_pi , 0xfff8, 0x4018, { 12, 12, 8, 8}}, + {m68k_op_negx_8_pd , 0xfff8, 0x4020, { 14, 14, 9, 9}}, + {m68k_op_negx_8_di , 0xfff8, 0x4028, { 16, 16, 9, 9}}, + {m68k_op_negx_8_ix , 0xfff8, 0x4030, { 18, 18, 11, 11}}, + {m68k_op_negx_16_d , 0xfff8, 0x4040, { 4, 4, 2, 2}}, + {m68k_op_negx_16_ai , 0xfff8, 0x4050, { 12, 12, 8, 8}}, + {m68k_op_negx_16_pi , 0xfff8, 0x4058, { 12, 12, 8, 8}}, + {m68k_op_negx_16_pd , 0xfff8, 0x4060, { 14, 14, 9, 9}}, + {m68k_op_negx_16_di , 0xfff8, 0x4068, { 16, 16, 9, 9}}, + {m68k_op_negx_16_ix , 0xfff8, 0x4070, { 18, 18, 11, 11}}, + {m68k_op_negx_32_d , 0xfff8, 0x4080, { 6, 6, 2, 2}}, + {m68k_op_negx_32_ai , 0xfff8, 0x4090, { 20, 20, 8, 8}}, + {m68k_op_negx_32_pi , 0xfff8, 0x4098, { 20, 20, 8, 8}}, + {m68k_op_negx_32_pd , 0xfff8, 0x40a0, { 22, 22, 9, 9}}, + {m68k_op_negx_32_di , 0xfff8, 0x40a8, { 24, 24, 9, 9}}, + {m68k_op_negx_32_ix , 0xfff8, 0x40b0, { 26, 26, 11, 11}}, + {m68k_op_move_16_frs_d , 0xfff8, 0x40c0, { 6, 4, 8, 8}}, + {m68k_op_move_16_frs_ai , 0xfff8, 0x40d0, { 12, 12, 12, 12}}, + {m68k_op_move_16_frs_pi , 0xfff8, 0x40d8, { 12, 12, 12, 12}}, + {m68k_op_move_16_frs_pd , 0xfff8, 0x40e0, { 14, 14, 13, 13}}, + {m68k_op_move_16_frs_di , 0xfff8, 0x40e8, { 16, 16, 13, 13}}, + {m68k_op_move_16_frs_ix , 0xfff8, 0x40f0, { 18, 18, 15, 15}}, + {m68k_op_clr_8_d , 0xfff8, 0x4200, { 4, 4, 2, 2}}, + {m68k_op_clr_8_ai , 0xfff8, 0x4210, { 12, 8, 8, 8}}, + {m68k_op_clr_8_pi , 0xfff8, 0x4218, { 12, 8, 8, 8}}, + {m68k_op_clr_8_pd , 0xfff8, 0x4220, { 14, 10, 9, 9}}, + {m68k_op_clr_8_di , 0xfff8, 0x4228, { 16, 12, 9, 9}}, + {m68k_op_clr_8_ix , 0xfff8, 0x4230, { 18, 14, 11, 11}}, + {m68k_op_clr_16_d , 0xfff8, 0x4240, { 4, 4, 2, 2}}, + {m68k_op_clr_16_ai , 0xfff8, 0x4250, { 12, 8, 8, 8}}, + {m68k_op_clr_16_pi , 0xfff8, 0x4258, { 12, 8, 8, 8}}, + {m68k_op_clr_16_pd , 0xfff8, 0x4260, { 14, 10, 9, 9}}, + {m68k_op_clr_16_di , 0xfff8, 0x4268, { 16, 12, 9, 9}}, + {m68k_op_clr_16_ix , 0xfff8, 0x4270, { 18, 14, 11, 11}}, + {m68k_op_clr_32_d , 0xfff8, 0x4280, { 6, 6, 2, 2}}, + {m68k_op_clr_32_ai , 0xfff8, 0x4290, { 20, 12, 8, 8}}, + {m68k_op_clr_32_pi , 0xfff8, 0x4298, { 20, 12, 8, 8}}, + {m68k_op_clr_32_pd , 0xfff8, 0x42a0, { 22, 14, 9, 9}}, + {m68k_op_clr_32_di , 0xfff8, 0x42a8, { 24, 16, 9, 9}}, + {m68k_op_clr_32_ix , 0xfff8, 0x42b0, { 26, 20, 11, 11}}, + {m68k_op_move_16_frc_d , 0xfff8, 0x42c0, { 0, 4, 4, 4}}, + {m68k_op_move_16_frc_ai , 0xfff8, 0x42d0, { 0, 12, 8, 8}}, + {m68k_op_move_16_frc_pi , 0xfff8, 0x42d8, { 0, 12, 8, 8}}, + {m68k_op_move_16_frc_pd , 0xfff8, 0x42e0, { 0, 14, 9, 9}}, + {m68k_op_move_16_frc_di , 0xfff8, 0x42e8, { 0, 16, 9, 9}}, + {m68k_op_move_16_frc_ix , 0xfff8, 0x42f0, { 0, 18, 11, 11}}, + {m68k_op_neg_8_d , 0xfff8, 0x4400, { 4, 4, 2, 2}}, + {m68k_op_neg_8_ai , 0xfff8, 0x4410, { 12, 12, 8, 8}}, + {m68k_op_neg_8_pi , 0xfff8, 0x4418, { 12, 12, 8, 8}}, + {m68k_op_neg_8_pd , 0xfff8, 0x4420, { 14, 14, 9, 9}}, + {m68k_op_neg_8_di , 0xfff8, 0x4428, { 16, 16, 9, 9}}, + {m68k_op_neg_8_ix , 0xfff8, 0x4430, { 18, 18, 11, 11}}, + {m68k_op_neg_16_d , 0xfff8, 0x4440, { 4, 4, 2, 2}}, + {m68k_op_neg_16_ai , 0xfff8, 0x4450, { 12, 12, 8, 8}}, + {m68k_op_neg_16_pi , 0xfff8, 0x4458, { 12, 12, 8, 8}}, + {m68k_op_neg_16_pd , 0xfff8, 0x4460, { 14, 14, 9, 9}}, + {m68k_op_neg_16_di , 0xfff8, 0x4468, { 16, 16, 9, 9}}, + {m68k_op_neg_16_ix , 0xfff8, 0x4470, { 18, 18, 11, 11}}, + {m68k_op_neg_32_d , 0xfff8, 0x4480, { 6, 6, 2, 2}}, + {m68k_op_neg_32_ai , 0xfff8, 0x4490, { 20, 20, 8, 8}}, + {m68k_op_neg_32_pi , 0xfff8, 0x4498, { 20, 20, 8, 8}}, + {m68k_op_neg_32_pd , 0xfff8, 0x44a0, { 22, 22, 9, 9}}, + {m68k_op_neg_32_di , 0xfff8, 0x44a8, { 24, 24, 9, 9}}, + {m68k_op_neg_32_ix , 0xfff8, 0x44b0, { 26, 26, 11, 11}}, + {m68k_op_move_16_toc_d , 0xfff8, 0x44c0, { 12, 12, 4, 4}}, + {m68k_op_move_16_toc_ai , 0xfff8, 0x44d0, { 16, 16, 8, 8}}, + {m68k_op_move_16_toc_pi , 0xfff8, 0x44d8, { 16, 16, 8, 8}}, + {m68k_op_move_16_toc_pd , 0xfff8, 0x44e0, { 18, 18, 9, 9}}, + {m68k_op_move_16_toc_di , 0xfff8, 0x44e8, { 20, 20, 9, 9}}, + {m68k_op_move_16_toc_ix , 0xfff8, 0x44f0, { 22, 22, 11, 11}}, + {m68k_op_not_8_d , 0xfff8, 0x4600, { 4, 4, 2, 2}}, + {m68k_op_not_8_ai , 0xfff8, 0x4610, { 12, 12, 8, 8}}, + {m68k_op_not_8_pi , 0xfff8, 0x4618, { 12, 12, 8, 8}}, + {m68k_op_not_8_pd , 0xfff8, 0x4620, { 14, 14, 9, 9}}, + {m68k_op_not_8_di , 0xfff8, 0x4628, { 16, 16, 9, 9}}, + {m68k_op_not_8_ix , 0xfff8, 0x4630, { 18, 18, 11, 11}}, + {m68k_op_not_16_d , 0xfff8, 0x4640, { 4, 4, 2, 2}}, + {m68k_op_not_16_ai , 0xfff8, 0x4650, { 12, 12, 8, 8}}, + {m68k_op_not_16_pi , 0xfff8, 0x4658, { 12, 12, 8, 8}}, + {m68k_op_not_16_pd , 0xfff8, 0x4660, { 14, 14, 9, 9}}, + {m68k_op_not_16_di , 0xfff8, 0x4668, { 16, 16, 9, 9}}, + {m68k_op_not_16_ix , 0xfff8, 0x4670, { 18, 18, 11, 11}}, + {m68k_op_not_32_d , 0xfff8, 0x4680, { 6, 6, 2, 2}}, + {m68k_op_not_32_ai , 0xfff8, 0x4690, { 20, 20, 8, 8}}, + {m68k_op_not_32_pi , 0xfff8, 0x4698, { 20, 20, 8, 8}}, + {m68k_op_not_32_pd , 0xfff8, 0x46a0, { 22, 22, 9, 9}}, + {m68k_op_not_32_di , 0xfff8, 0x46a8, { 24, 24, 9, 9}}, + {m68k_op_not_32_ix , 0xfff8, 0x46b0, { 26, 26, 11, 11}}, + {m68k_op_move_16_tos_d , 0xfff8, 0x46c0, { 12, 12, 8, 8}}, + {m68k_op_move_16_tos_ai , 0xfff8, 0x46d0, { 16, 16, 12, 12}}, + {m68k_op_move_16_tos_pi , 0xfff8, 0x46d8, { 16, 16, 12, 12}}, + {m68k_op_move_16_tos_pd , 0xfff8, 0x46e0, { 18, 18, 13, 13}}, + {m68k_op_move_16_tos_di , 0xfff8, 0x46e8, { 20, 20, 13, 13}}, + {m68k_op_move_16_tos_ix , 0xfff8, 0x46f0, { 22, 22, 15, 15}}, + {m68k_op_nbcd_8_d , 0xfff8, 0x4800, { 6, 6, 6, 6}}, + {m68k_op_link_32 , 0xfff8, 0x4808, { 0, 0, 6, 6}}, + {m68k_op_nbcd_8_ai , 0xfff8, 0x4810, { 12, 12, 10, 10}}, + {m68k_op_nbcd_8_pi , 0xfff8, 0x4818, { 12, 12, 10, 10}}, + {m68k_op_nbcd_8_pd , 0xfff8, 0x4820, { 14, 14, 11, 11}}, + {m68k_op_nbcd_8_di , 0xfff8, 0x4828, { 16, 16, 11, 11}}, + {m68k_op_nbcd_8_ix , 0xfff8, 0x4830, { 18, 18, 13, 13}}, + {m68k_op_swap_32 , 0xfff8, 0x4840, { 4, 4, 4, 4}}, + {m68k_op_bkpt , 0xfff8, 0x4848, { 0, 10, 10, 10}}, + {m68k_op_pea_32_ai , 0xfff8, 0x4850, { 12, 12, 9, 9}}, + {m68k_op_pea_32_di , 0xfff8, 0x4868, { 16, 16, 10, 10}}, + {m68k_op_pea_32_ix , 0xfff8, 0x4870, { 20, 20, 12, 12}}, + {m68k_op_ext_16 , 0xfff8, 0x4880, { 4, 4, 4, 4}}, + {m68k_op_movem_16_re_ai , 0xfff8, 0x4890, { 8, 8, 8, 8}}, + {m68k_op_movem_16_re_pd , 0xfff8, 0x48a0, { 8, 8, 4, 4}}, + {m68k_op_movem_16_re_di , 0xfff8, 0x48a8, { 12, 12, 9, 9}}, + {m68k_op_movem_16_re_ix , 0xfff8, 0x48b0, { 14, 14, 11, 11}}, + {m68k_op_ext_32 , 0xfff8, 0x48c0, { 4, 4, 4, 4}}, + {m68k_op_movem_32_re_ai , 0xfff8, 0x48d0, { 8, 8, 8, 8}}, + {m68k_op_movem_32_re_pd , 0xfff8, 0x48e0, { 8, 8, 4, 4}}, + {m68k_op_movem_32_re_di , 0xfff8, 0x48e8, { 12, 12, 9, 9}}, + {m68k_op_movem_32_re_ix , 0xfff8, 0x48f0, { 14, 14, 11, 11}}, + {m68k_op_extb_32 , 0xfff8, 0x49c0, { 0, 0, 4, 4}}, + {m68k_op_tst_8_d , 0xfff8, 0x4a00, { 4, 4, 2, 2}}, + {m68k_op_tst_8_ai , 0xfff8, 0x4a10, { 8, 8, 6, 6}}, + {m68k_op_tst_8_pi , 0xfff8, 0x4a18, { 8, 8, 6, 6}}, + {m68k_op_tst_8_pd , 0xfff8, 0x4a20, { 10, 10, 7, 7}}, + {m68k_op_tst_8_di , 0xfff8, 0x4a28, { 12, 12, 7, 7}}, + {m68k_op_tst_8_ix , 0xfff8, 0x4a30, { 14, 14, 9, 9}}, + {m68k_op_tst_16_d , 0xfff8, 0x4a40, { 4, 4, 2, 2}}, + {m68k_op_tst_16_a , 0xfff8, 0x4a48, { 0, 0, 2, 2}}, + {m68k_op_tst_16_ai , 0xfff8, 0x4a50, { 8, 8, 6, 6}}, + {m68k_op_tst_16_pi , 0xfff8, 0x4a58, { 8, 8, 6, 6}}, + {m68k_op_tst_16_pd , 0xfff8, 0x4a60, { 10, 10, 7, 7}}, + {m68k_op_tst_16_di , 0xfff8, 0x4a68, { 12, 12, 7, 7}}, + {m68k_op_tst_16_ix , 0xfff8, 0x4a70, { 14, 14, 9, 9}}, + {m68k_op_tst_32_d , 0xfff8, 0x4a80, { 4, 4, 2, 2}}, + {m68k_op_tst_32_a , 0xfff8, 0x4a88, { 0, 0, 2, 2}}, + {m68k_op_tst_32_ai , 0xfff8, 0x4a90, { 12, 12, 6, 6}}, + {m68k_op_tst_32_pi , 0xfff8, 0x4a98, { 12, 12, 6, 6}}, + {m68k_op_tst_32_pd , 0xfff8, 0x4aa0, { 14, 14, 7, 7}}, + {m68k_op_tst_32_di , 0xfff8, 0x4aa8, { 16, 16, 7, 7}}, + {m68k_op_tst_32_ix , 0xfff8, 0x4ab0, { 18, 18, 9, 9}}, + {m68k_op_tas_8_d , 0xfff8, 0x4ac0, { 4, 4, 4, 4}}, + {m68k_op_tas_8_ai , 0xfff8, 0x4ad0, { 18, 18, 16, 16}}, + {m68k_op_tas_8_pi , 0xfff8, 0x4ad8, { 18, 18, 16, 16}}, + {m68k_op_tas_8_pd , 0xfff8, 0x4ae0, { 20, 20, 17, 17}}, + {m68k_op_tas_8_di , 0xfff8, 0x4ae8, { 22, 22, 17, 17}}, + {m68k_op_tas_8_ix , 0xfff8, 0x4af0, { 24, 24, 19, 19}}, + {m68k_op_mull_32_d , 0xfff8, 0x4c00, { 0, 0, 43, 43}}, + {m68k_op_mull_32_ai , 0xfff8, 0x4c10, { 0, 0, 47, 47}}, + {m68k_op_mull_32_pi , 0xfff8, 0x4c18, { 0, 0, 47, 47}}, + {m68k_op_mull_32_pd , 0xfff8, 0x4c20, { 0, 0, 48, 48}}, + {m68k_op_mull_32_di , 0xfff8, 0x4c28, { 0, 0, 48, 48}}, + {m68k_op_mull_32_ix , 0xfff8, 0x4c30, { 0, 0, 50, 50}}, + {m68k_op_divl_32_d , 0xfff8, 0x4c40, { 0, 0, 84, 84}}, + {m68k_op_divl_32_ai , 0xfff8, 0x4c50, { 0, 0, 88, 88}}, + {m68k_op_divl_32_pi , 0xfff8, 0x4c58, { 0, 0, 88, 88}}, + {m68k_op_divl_32_pd , 0xfff8, 0x4c60, { 0, 0, 89, 89}}, + {m68k_op_divl_32_di , 0xfff8, 0x4c68, { 0, 0, 89, 89}}, + {m68k_op_divl_32_ix , 0xfff8, 0x4c70, { 0, 0, 91, 91}}, + {m68k_op_movem_16_er_ai , 0xfff8, 0x4c90, { 12, 12, 12, 12}}, + {m68k_op_movem_16_er_pi , 0xfff8, 0x4c98, { 12, 12, 8, 8}}, + {m68k_op_movem_16_er_di , 0xfff8, 0x4ca8, { 16, 16, 13, 13}}, + {m68k_op_movem_16_er_ix , 0xfff8, 0x4cb0, { 18, 18, 15, 15}}, + {m68k_op_movem_32_er_ai , 0xfff8, 0x4cd0, { 12, 12, 12, 12}}, + {m68k_op_movem_32_er_pi , 0xfff8, 0x4cd8, { 12, 12, 8, 8}}, + {m68k_op_movem_32_er_di , 0xfff8, 0x4ce8, { 16, 16, 13, 13}}, + {m68k_op_movem_32_er_ix , 0xfff8, 0x4cf0, { 18, 18, 15, 15}}, + {m68k_op_link_16 , 0xfff8, 0x4e50, { 16, 16, 5, 5}}, + {m68k_op_unlk_32 , 0xfff8, 0x4e58, { 12, 12, 6, 6}}, + {m68k_op_move_32_tou , 0xfff8, 0x4e60, { 4, 6, 2, 2}}, + {m68k_op_move_32_fru , 0xfff8, 0x4e68, { 4, 6, 2, 2}}, + {m68k_op_jsr_32_ai , 0xfff8, 0x4e90, { 16, 16, 4, 4}}, + {m68k_op_jsr_32_di , 0xfff8, 0x4ea8, { 18, 18, 5, 5}}, + {m68k_op_jsr_32_ix , 0xfff8, 0x4eb0, { 22, 22, 7, 7}}, + {m68k_op_jmp_32_ai , 0xfff8, 0x4ed0, { 8, 8, 4, 4}}, + {m68k_op_jmp_32_di , 0xfff8, 0x4ee8, { 10, 10, 5, 5}}, + {m68k_op_jmp_32_ix , 0xfff8, 0x4ef0, { 14, 14, 7, 7}}, + {m68k_op_st_8_d , 0xfff8, 0x50c0, { 6, 4, 4, 4}}, + {m68k_op_dbt_16 , 0xfff8, 0x50c8, { 12, 12, 6, 6}}, + {m68k_op_st_8_ai , 0xfff8, 0x50d0, { 12, 12, 10, 10}}, + {m68k_op_st_8_pi , 0xfff8, 0x50d8, { 12, 12, 10, 10}}, + {m68k_op_st_8_pd , 0xfff8, 0x50e0, { 14, 14, 11, 11}}, + {m68k_op_st_8_di , 0xfff8, 0x50e8, { 16, 16, 11, 11}}, + {m68k_op_st_8_ix , 0xfff8, 0x50f0, { 18, 18, 13, 13}}, + {m68k_op_sf_8_d , 0xfff8, 0x51c0, { 4, 4, 4, 4}}, + {m68k_op_dbf_16 , 0xfff8, 0x51c8, { 12, 12, 6, 6}}, + {m68k_op_sf_8_ai , 0xfff8, 0x51d0, { 12, 12, 10, 10}}, + {m68k_op_sf_8_pi , 0xfff8, 0x51d8, { 12, 12, 10, 10}}, + {m68k_op_sf_8_pd , 0xfff8, 0x51e0, { 14, 14, 11, 11}}, + {m68k_op_sf_8_di , 0xfff8, 0x51e8, { 16, 16, 11, 11}}, + {m68k_op_sf_8_ix , 0xfff8, 0x51f0, { 18, 18, 13, 13}}, + {m68k_op_shi_8_d , 0xfff8, 0x52c0, { 4, 4, 4, 4}}, + {m68k_op_dbhi_16 , 0xfff8, 0x52c8, { 12, 12, 6, 6}}, + {m68k_op_shi_8_ai , 0xfff8, 0x52d0, { 12, 12, 10, 10}}, + {m68k_op_shi_8_pi , 0xfff8, 0x52d8, { 12, 12, 10, 10}}, + {m68k_op_shi_8_pd , 0xfff8, 0x52e0, { 14, 14, 11, 11}}, + {m68k_op_shi_8_di , 0xfff8, 0x52e8, { 16, 16, 11, 11}}, + {m68k_op_shi_8_ix , 0xfff8, 0x52f0, { 18, 18, 13, 13}}, + {m68k_op_sls_8_d , 0xfff8, 0x53c0, { 4, 4, 4, 4}}, + {m68k_op_dbls_16 , 0xfff8, 0x53c8, { 12, 12, 6, 6}}, + {m68k_op_sls_8_ai , 0xfff8, 0x53d0, { 12, 12, 10, 10}}, + {m68k_op_sls_8_pi , 0xfff8, 0x53d8, { 12, 12, 10, 10}}, + {m68k_op_sls_8_pd , 0xfff8, 0x53e0, { 14, 14, 11, 11}}, + {m68k_op_sls_8_di , 0xfff8, 0x53e8, { 16, 16, 11, 11}}, + {m68k_op_sls_8_ix , 0xfff8, 0x53f0, { 18, 18, 13, 13}}, + {m68k_op_scc_8_d , 0xfff8, 0x54c0, { 4, 4, 4, 4}}, + {m68k_op_dbcc_16 , 0xfff8, 0x54c8, { 12, 12, 6, 6}}, + {m68k_op_scc_8_ai , 0xfff8, 0x54d0, { 12, 12, 10, 10}}, + {m68k_op_scc_8_pi , 0xfff8, 0x54d8, { 12, 12, 10, 10}}, + {m68k_op_scc_8_pd , 0xfff8, 0x54e0, { 14, 14, 11, 11}}, + {m68k_op_scc_8_di , 0xfff8, 0x54e8, { 16, 16, 11, 11}}, + {m68k_op_scc_8_ix , 0xfff8, 0x54f0, { 18, 18, 13, 13}}, + {m68k_op_scs_8_d , 0xfff8, 0x55c0, { 4, 4, 4, 4}}, + {m68k_op_dbcs_16 , 0xfff8, 0x55c8, { 12, 12, 6, 6}}, + {m68k_op_scs_8_ai , 0xfff8, 0x55d0, { 12, 12, 10, 10}}, + {m68k_op_scs_8_pi , 0xfff8, 0x55d8, { 12, 12, 10, 10}}, + {m68k_op_scs_8_pd , 0xfff8, 0x55e0, { 14, 14, 11, 11}}, + {m68k_op_scs_8_di , 0xfff8, 0x55e8, { 16, 16, 11, 11}}, + {m68k_op_scs_8_ix , 0xfff8, 0x55f0, { 18, 18, 13, 13}}, + {m68k_op_sne_8_d , 0xfff8, 0x56c0, { 4, 4, 4, 4}}, + {m68k_op_dbne_16 , 0xfff8, 0x56c8, { 12, 12, 6, 6}}, + {m68k_op_sne_8_ai , 0xfff8, 0x56d0, { 12, 12, 10, 10}}, + {m68k_op_sne_8_pi , 0xfff8, 0x56d8, { 12, 12, 10, 10}}, + {m68k_op_sne_8_pd , 0xfff8, 0x56e0, { 14, 14, 11, 11}}, + {m68k_op_sne_8_di , 0xfff8, 0x56e8, { 16, 16, 11, 11}}, + {m68k_op_sne_8_ix , 0xfff8, 0x56f0, { 18, 18, 13, 13}}, + {m68k_op_seq_8_d , 0xfff8, 0x57c0, { 4, 4, 4, 4}}, + {m68k_op_dbeq_16 , 0xfff8, 0x57c8, { 12, 12, 6, 6}}, + {m68k_op_seq_8_ai , 0xfff8, 0x57d0, { 12, 12, 10, 10}}, + {m68k_op_seq_8_pi , 0xfff8, 0x57d8, { 12, 12, 10, 10}}, + {m68k_op_seq_8_pd , 0xfff8, 0x57e0, { 14, 14, 11, 11}}, + {m68k_op_seq_8_di , 0xfff8, 0x57e8, { 16, 16, 11, 11}}, + {m68k_op_seq_8_ix , 0xfff8, 0x57f0, { 18, 18, 13, 13}}, + {m68k_op_svc_8_d , 0xfff8, 0x58c0, { 4, 4, 4, 4}}, + {m68k_op_dbvc_16 , 0xfff8, 0x58c8, { 12, 12, 6, 6}}, + {m68k_op_svc_8_ai , 0xfff8, 0x58d0, { 12, 12, 10, 10}}, + {m68k_op_svc_8_pi , 0xfff8, 0x58d8, { 12, 12, 10, 10}}, + {m68k_op_svc_8_pd , 0xfff8, 0x58e0, { 14, 14, 11, 11}}, + {m68k_op_svc_8_di , 0xfff8, 0x58e8, { 16, 16, 11, 11}}, + {m68k_op_svc_8_ix , 0xfff8, 0x58f0, { 18, 18, 13, 13}}, + {m68k_op_svs_8_d , 0xfff8, 0x59c0, { 4, 4, 4, 4}}, + {m68k_op_dbvs_16 , 0xfff8, 0x59c8, { 12, 12, 6, 6}}, + {m68k_op_svs_8_ai , 0xfff8, 0x59d0, { 12, 12, 10, 10}}, + {m68k_op_svs_8_pi , 0xfff8, 0x59d8, { 12, 12, 10, 10}}, + {m68k_op_svs_8_pd , 0xfff8, 0x59e0, { 14, 14, 11, 11}}, + {m68k_op_svs_8_di , 0xfff8, 0x59e8, { 16, 16, 11, 11}}, + {m68k_op_svs_8_ix , 0xfff8, 0x59f0, { 18, 18, 13, 13}}, + {m68k_op_spl_8_d , 0xfff8, 0x5ac0, { 4, 4, 4, 4}}, + {m68k_op_dbpl_16 , 0xfff8, 0x5ac8, { 12, 12, 6, 6}}, + {m68k_op_spl_8_ai , 0xfff8, 0x5ad0, { 12, 12, 10, 10}}, + {m68k_op_spl_8_pi , 0xfff8, 0x5ad8, { 12, 12, 10, 10}}, + {m68k_op_spl_8_pd , 0xfff8, 0x5ae0, { 14, 14, 11, 11}}, + {m68k_op_spl_8_di , 0xfff8, 0x5ae8, { 16, 16, 11, 11}}, + {m68k_op_spl_8_ix , 0xfff8, 0x5af0, { 18, 18, 13, 13}}, + {m68k_op_smi_8_d , 0xfff8, 0x5bc0, { 4, 4, 4, 4}}, + {m68k_op_dbmi_16 , 0xfff8, 0x5bc8, { 12, 12, 6, 6}}, + {m68k_op_smi_8_ai , 0xfff8, 0x5bd0, { 12, 12, 10, 10}}, + {m68k_op_smi_8_pi , 0xfff8, 0x5bd8, { 12, 12, 10, 10}}, + {m68k_op_smi_8_pd , 0xfff8, 0x5be0, { 14, 14, 11, 11}}, + {m68k_op_smi_8_di , 0xfff8, 0x5be8, { 16, 16, 11, 11}}, + {m68k_op_smi_8_ix , 0xfff8, 0x5bf0, { 18, 18, 13, 13}}, + {m68k_op_sge_8_d , 0xfff8, 0x5cc0, { 4, 4, 4, 4}}, + {m68k_op_dbge_16 , 0xfff8, 0x5cc8, { 12, 12, 6, 6}}, + {m68k_op_sge_8_ai , 0xfff8, 0x5cd0, { 12, 12, 10, 10}}, + {m68k_op_sge_8_pi , 0xfff8, 0x5cd8, { 12, 12, 10, 10}}, + {m68k_op_sge_8_pd , 0xfff8, 0x5ce0, { 14, 14, 11, 11}}, + {m68k_op_sge_8_di , 0xfff8, 0x5ce8, { 16, 16, 11, 11}}, + {m68k_op_sge_8_ix , 0xfff8, 0x5cf0, { 18, 18, 13, 13}}, + {m68k_op_slt_8_d , 0xfff8, 0x5dc0, { 4, 4, 4, 4}}, + {m68k_op_dblt_16 , 0xfff8, 0x5dc8, { 12, 12, 6, 6}}, + {m68k_op_slt_8_ai , 0xfff8, 0x5dd0, { 12, 12, 10, 10}}, + {m68k_op_slt_8_pi , 0xfff8, 0x5dd8, { 12, 12, 10, 10}}, + {m68k_op_slt_8_pd , 0xfff8, 0x5de0, { 14, 14, 11, 11}}, + {m68k_op_slt_8_di , 0xfff8, 0x5de8, { 16, 16, 11, 11}}, + {m68k_op_slt_8_ix , 0xfff8, 0x5df0, { 18, 18, 13, 13}}, + {m68k_op_sgt_8_d , 0xfff8, 0x5ec0, { 4, 4, 4, 4}}, + {m68k_op_dbgt_16 , 0xfff8, 0x5ec8, { 12, 12, 6, 6}}, + {m68k_op_sgt_8_ai , 0xfff8, 0x5ed0, { 12, 12, 10, 10}}, + {m68k_op_sgt_8_pi , 0xfff8, 0x5ed8, { 12, 12, 10, 10}}, + {m68k_op_sgt_8_pd , 0xfff8, 0x5ee0, { 14, 14, 11, 11}}, + {m68k_op_sgt_8_di , 0xfff8, 0x5ee8, { 16, 16, 11, 11}}, + {m68k_op_sgt_8_ix , 0xfff8, 0x5ef0, { 18, 18, 13, 13}}, + {m68k_op_sle_8_d , 0xfff8, 0x5fc0, { 4, 4, 4, 4}}, + {m68k_op_dble_16 , 0xfff8, 0x5fc8, { 12, 12, 6, 6}}, + {m68k_op_sle_8_ai , 0xfff8, 0x5fd0, { 12, 12, 10, 10}}, + {m68k_op_sle_8_pi , 0xfff8, 0x5fd8, { 12, 12, 10, 10}}, + {m68k_op_sle_8_pd , 0xfff8, 0x5fe0, { 14, 14, 11, 11}}, + {m68k_op_sle_8_di , 0xfff8, 0x5fe8, { 16, 16, 11, 11}}, + {m68k_op_sle_8_ix , 0xfff8, 0x5ff0, { 18, 18, 13, 13}}, + {m68k_op_sbcd_8_mm_ax7 , 0xfff8, 0x8f08, { 18, 18, 16, 16}}, + {m68k_op_pack_16_mm_ax7 , 0xfff8, 0x8f48, { 0, 0, 13, 13}}, + {m68k_op_unpk_16_mm_ax7 , 0xfff8, 0x8f88, { 0, 0, 13, 13}}, + {m68k_op_subx_8_mm_ax7 , 0xfff8, 0x9f08, { 18, 18, 12, 12}}, + {m68k_op_cmpm_8_ax7 , 0xfff8, 0xbf08, { 12, 12, 9, 9}}, + {m68k_op_abcd_8_mm_ax7 , 0xfff8, 0xcf08, { 18, 18, 16, 16}}, + {m68k_op_addx_8_mm_ax7 , 0xfff8, 0xdf08, { 18, 18, 12, 12}}, + {m68k_op_asr_16_ai , 0xfff8, 0xe0d0, { 12, 12, 9, 9}}, + {m68k_op_asr_16_pi , 0xfff8, 0xe0d8, { 12, 12, 9, 9}}, + {m68k_op_asr_16_pd , 0xfff8, 0xe0e0, { 14, 14, 10, 10}}, + {m68k_op_asr_16_di , 0xfff8, 0xe0e8, { 16, 16, 10, 10}}, + {m68k_op_asr_16_ix , 0xfff8, 0xe0f0, { 18, 18, 12, 12}}, + {m68k_op_asl_16_ai , 0xfff8, 0xe1d0, { 12, 12, 10, 10}}, + {m68k_op_asl_16_pi , 0xfff8, 0xe1d8, { 12, 12, 10, 10}}, + {m68k_op_asl_16_pd , 0xfff8, 0xe1e0, { 14, 14, 11, 11}}, + {m68k_op_asl_16_di , 0xfff8, 0xe1e8, { 16, 16, 11, 11}}, + {m68k_op_asl_16_ix , 0xfff8, 0xe1f0, { 18, 18, 13, 13}}, + {m68k_op_lsr_16_ai , 0xfff8, 0xe2d0, { 12, 12, 9, 9}}, + {m68k_op_lsr_16_pi , 0xfff8, 0xe2d8, { 12, 12, 9, 9}}, + {m68k_op_lsr_16_pd , 0xfff8, 0xe2e0, { 14, 14, 10, 10}}, + {m68k_op_lsr_16_di , 0xfff8, 0xe2e8, { 16, 16, 10, 10}}, + {m68k_op_lsr_16_ix , 0xfff8, 0xe2f0, { 18, 18, 12, 12}}, + {m68k_op_lsl_16_ai , 0xfff8, 0xe3d0, { 12, 12, 9, 9}}, + {m68k_op_lsl_16_pi , 0xfff8, 0xe3d8, { 12, 12, 9, 9}}, + {m68k_op_lsl_16_pd , 0xfff8, 0xe3e0, { 14, 14, 10, 10}}, + {m68k_op_lsl_16_di , 0xfff8, 0xe3e8, { 16, 16, 10, 10}}, + {m68k_op_lsl_16_ix , 0xfff8, 0xe3f0, { 18, 18, 12, 12}}, + {m68k_op_roxr_16_ai , 0xfff8, 0xe4d0, { 12, 12, 9, 9}}, + {m68k_op_roxr_16_pi , 0xfff8, 0xe4d8, { 12, 12, 9, 9}}, + {m68k_op_roxr_16_pd , 0xfff8, 0xe4e0, { 14, 14, 10, 10}}, + {m68k_op_roxr_16_di , 0xfff8, 0xe4e8, { 16, 16, 10, 10}}, + {m68k_op_roxr_16_ix , 0xfff8, 0xe4f0, { 18, 18, 12, 12}}, + {m68k_op_roxl_16_ai , 0xfff8, 0xe5d0, { 12, 12, 9, 9}}, + {m68k_op_roxl_16_pi , 0xfff8, 0xe5d8, { 12, 12, 9, 9}}, + {m68k_op_roxl_16_pd , 0xfff8, 0xe5e0, { 14, 14, 10, 10}}, + {m68k_op_roxl_16_di , 0xfff8, 0xe5e8, { 16, 16, 10, 10}}, + {m68k_op_roxl_16_ix , 0xfff8, 0xe5f0, { 18, 18, 12, 12}}, + {m68k_op_ror_16_ai , 0xfff8, 0xe6d0, { 12, 12, 11, 11}}, + {m68k_op_ror_16_pi , 0xfff8, 0xe6d8, { 12, 12, 11, 11}}, + {m68k_op_ror_16_pd , 0xfff8, 0xe6e0, { 14, 14, 12, 12}}, + {m68k_op_ror_16_di , 0xfff8, 0xe6e8, { 16, 16, 12, 12}}, + {m68k_op_ror_16_ix , 0xfff8, 0xe6f0, { 18, 18, 14, 14}}, + {m68k_op_rol_16_ai , 0xfff8, 0xe7d0, { 12, 12, 11, 11}}, + {m68k_op_rol_16_pi , 0xfff8, 0xe7d8, { 12, 12, 11, 11}}, + {m68k_op_rol_16_pd , 0xfff8, 0xe7e0, { 14, 14, 12, 12}}, + {m68k_op_rol_16_di , 0xfff8, 0xe7e8, { 16, 16, 12, 12}}, + {m68k_op_rol_16_ix , 0xfff8, 0xe7f0, { 18, 18, 14, 14}}, + {m68k_op_bftst_32_d , 0xfff8, 0xe8c0, { 0, 0, 6, 6}}, + {m68k_op_bftst_32_ai , 0xfff8, 0xe8d0, { 0, 0, 17, 17}}, + {m68k_op_bftst_32_di , 0xfff8, 0xe8e8, { 0, 0, 18, 18}}, + {m68k_op_bftst_32_ix , 0xfff8, 0xe8f0, { 0, 0, 20, 20}}, + {m68k_op_bfextu_32_d , 0xfff8, 0xe9c0, { 0, 0, 8, 8}}, + {m68k_op_bfextu_32_ai , 0xfff8, 0xe9d0, { 0, 0, 19, 19}}, + {m68k_op_bfextu_32_di , 0xfff8, 0xe9e8, { 0, 0, 20, 20}}, + {m68k_op_bfextu_32_ix , 0xfff8, 0xe9f0, { 0, 0, 22, 22}}, + {m68k_op_bfchg_32_d , 0xfff8, 0xeac0, { 0, 0, 12, 12}}, + {m68k_op_bfchg_32_ai , 0xfff8, 0xead0, { 0, 0, 24, 24}}, + {m68k_op_bfchg_32_di , 0xfff8, 0xeae8, { 0, 0, 25, 25}}, + {m68k_op_bfchg_32_ix , 0xfff8, 0xeaf0, { 0, 0, 27, 27}}, + {m68k_op_bfexts_32_d , 0xfff8, 0xebc0, { 0, 0, 8, 8}}, + {m68k_op_bfexts_32_ai , 0xfff8, 0xebd0, { 0, 0, 19, 19}}, + {m68k_op_bfexts_32_di , 0xfff8, 0xebe8, { 0, 0, 20, 20}}, + {m68k_op_bfexts_32_ix , 0xfff8, 0xebf0, { 0, 0, 22, 22}}, + {m68k_op_bfclr_32_d , 0xfff8, 0xecc0, { 0, 0, 12, 12}}, + {m68k_op_bfclr_32_ai , 0xfff8, 0xecd0, { 0, 0, 24, 24}}, + {m68k_op_bfclr_32_di , 0xfff8, 0xece8, { 0, 0, 25, 25}}, + {m68k_op_bfclr_32_ix , 0xfff8, 0xecf0, { 0, 0, 27, 27}}, + {m68k_op_bfffo_32_d , 0xfff8, 0xedc0, { 0, 0, 18, 18}}, + {m68k_op_bfffo_32_ai , 0xfff8, 0xedd0, { 0, 0, 32, 32}}, + {m68k_op_bfffo_32_di , 0xfff8, 0xede8, { 0, 0, 33, 33}}, + {m68k_op_bfffo_32_ix , 0xfff8, 0xedf0, { 0, 0, 35, 35}}, + {m68k_op_bfset_32_d , 0xfff8, 0xeec0, { 0, 0, 12, 12}}, + {m68k_op_bfset_32_ai , 0xfff8, 0xeed0, { 0, 0, 24, 24}}, + {m68k_op_bfset_32_di , 0xfff8, 0xeee8, { 0, 0, 25, 25}}, + {m68k_op_bfset_32_ix , 0xfff8, 0xeef0, { 0, 0, 27, 27}}, + {m68k_op_bfins_32_d , 0xfff8, 0xefc0, { 0, 0, 10, 10}}, + {m68k_op_bfins_32_ai , 0xfff8, 0xefd0, { 0, 0, 21, 21}}, + {m68k_op_bfins_32_di , 0xfff8, 0xefe8, { 0, 0, 22, 22}}, + {m68k_op_bfins_32_ix , 0xfff8, 0xeff0, { 0, 0, 24, 24}}, + {m68k_op_move16_32 , 0xfff8, 0xf620, { 0, 0, 0, 4}}, + {m68k_op_ori_8_pi7 , 0xffff, 0x001f, { 16, 16, 8, 8}}, + {m68k_op_ori_8_pd7 , 0xffff, 0x0027, { 18, 18, 9, 9}}, + {m68k_op_ori_8_aw , 0xffff, 0x0038, { 20, 20, 8, 8}}, + {m68k_op_ori_8_al , 0xffff, 0x0039, { 24, 24, 8, 8}}, + {m68k_op_ori_16_toc , 0xffff, 0x003c, { 20, 16, 12, 12}}, + {m68k_op_ori_16_aw , 0xffff, 0x0078, { 20, 20, 8, 8}}, + {m68k_op_ori_16_al , 0xffff, 0x0079, { 24, 24, 8, 8}}, + {m68k_op_ori_16_tos , 0xffff, 0x007c, { 20, 16, 12, 12}}, + {m68k_op_ori_32_aw , 0xffff, 0x00b8, { 32, 32, 8, 8}}, + {m68k_op_ori_32_al , 0xffff, 0x00b9, { 36, 36, 8, 8}}, + {m68k_op_chk2cmp2_8_aw , 0xffff, 0x00f8, { 0, 0, 22, 22}}, + {m68k_op_chk2cmp2_8_al , 0xffff, 0x00f9, { 0, 0, 22, 22}}, + {m68k_op_chk2cmp2_8_pcdi , 0xffff, 0x00fa, { 0, 0, 23, 23}}, + {m68k_op_chk2cmp2_8_pcix , 0xffff, 0x00fb, { 0, 0, 23, 23}}, + {m68k_op_andi_8_pi7 , 0xffff, 0x021f, { 16, 16, 8, 8}}, + {m68k_op_andi_8_pd7 , 0xffff, 0x0227, { 18, 18, 9, 9}}, + {m68k_op_andi_8_aw , 0xffff, 0x0238, { 20, 20, 8, 8}}, + {m68k_op_andi_8_al , 0xffff, 0x0239, { 24, 24, 8, 8}}, + {m68k_op_andi_16_toc , 0xffff, 0x023c, { 20, 16, 12, 12}}, + {m68k_op_andi_16_aw , 0xffff, 0x0278, { 20, 20, 8, 8}}, + {m68k_op_andi_16_al , 0xffff, 0x0279, { 24, 24, 8, 8}}, + {m68k_op_andi_16_tos , 0xffff, 0x027c, { 20, 16, 12, 12}}, + {m68k_op_andi_32_aw , 0xffff, 0x02b8, { 32, 32, 8, 8}}, + {m68k_op_andi_32_al , 0xffff, 0x02b9, { 36, 36, 8, 8}}, + {m68k_op_chk2cmp2_16_aw , 0xffff, 0x02f8, { 0, 0, 22, 22}}, + {m68k_op_chk2cmp2_16_al , 0xffff, 0x02f9, { 0, 0, 22, 22}}, + {m68k_op_chk2cmp2_16_pcdi , 0xffff, 0x02fa, { 0, 0, 23, 23}}, + {m68k_op_chk2cmp2_16_pcix , 0xffff, 0x02fb, { 0, 0, 23, 23}}, + {m68k_op_subi_8_pi7 , 0xffff, 0x041f, { 16, 16, 8, 8}}, + {m68k_op_subi_8_pd7 , 0xffff, 0x0427, { 18, 18, 9, 9}}, + {m68k_op_subi_8_aw , 0xffff, 0x0438, { 20, 20, 8, 8}}, + {m68k_op_subi_8_al , 0xffff, 0x0439, { 24, 24, 8, 8}}, + {m68k_op_subi_16_aw , 0xffff, 0x0478, { 20, 20, 8, 8}}, + {m68k_op_subi_16_al , 0xffff, 0x0479, { 24, 24, 8, 8}}, + {m68k_op_subi_32_aw , 0xffff, 0x04b8, { 32, 32, 8, 8}}, + {m68k_op_subi_32_al , 0xffff, 0x04b9, { 36, 36, 8, 8}}, + {m68k_op_chk2cmp2_32_aw , 0xffff, 0x04f8, { 0, 0, 22, 22}}, + {m68k_op_chk2cmp2_32_al , 0xffff, 0x04f9, { 0, 0, 22, 22}}, + {m68k_op_chk2cmp2_32_pcdi , 0xffff, 0x04fa, { 0, 0, 23, 23}}, + {m68k_op_chk2cmp2_32_pcix , 0xffff, 0x04fb, { 0, 0, 23, 23}}, + {m68k_op_addi_8_pi7 , 0xffff, 0x061f, { 16, 16, 8, 8}}, + {m68k_op_addi_8_pd7 , 0xffff, 0x0627, { 18, 18, 9, 9}}, + {m68k_op_addi_8_aw , 0xffff, 0x0638, { 20, 20, 8, 8}}, + {m68k_op_addi_8_al , 0xffff, 0x0639, { 24, 24, 8, 8}}, + {m68k_op_addi_16_aw , 0xffff, 0x0678, { 20, 20, 8, 8}}, + {m68k_op_addi_16_al , 0xffff, 0x0679, { 24, 24, 8, 8}}, + {m68k_op_addi_32_aw , 0xffff, 0x06b8, { 32, 32, 8, 8}}, + {m68k_op_addi_32_al , 0xffff, 0x06b9, { 36, 36, 8, 8}}, + {m68k_op_callm_32_aw , 0xffff, 0x06f8, { 0, 0, 64, 64}}, + {m68k_op_callm_32_al , 0xffff, 0x06f9, { 0, 0, 64, 64}}, + {m68k_op_callm_32_pcdi , 0xffff, 0x06fa, { 0, 0, 65, 65}}, + {m68k_op_callm_32_pcix , 0xffff, 0x06fb, { 0, 0, 67, 67}}, + {m68k_op_btst_8_s_pi7 , 0xffff, 0x081f, { 12, 12, 8, 8}}, + {m68k_op_btst_8_s_pd7 , 0xffff, 0x0827, { 14, 14, 9, 9}}, + {m68k_op_btst_8_s_aw , 0xffff, 0x0838, { 16, 16, 8, 8}}, + {m68k_op_btst_8_s_al , 0xffff, 0x0839, { 20, 20, 8, 8}}, + {m68k_op_btst_8_s_pcdi , 0xffff, 0x083a, { 16, 16, 9, 9}}, + {m68k_op_btst_8_s_pcix , 0xffff, 0x083b, { 18, 18, 11, 11}}, + {m68k_op_bchg_8_s_pi7 , 0xffff, 0x085f, { 16, 16, 8, 8}}, + {m68k_op_bchg_8_s_pd7 , 0xffff, 0x0867, { 18, 18, 9, 9}}, + {m68k_op_bchg_8_s_aw , 0xffff, 0x0878, { 20, 20, 8, 8}}, + {m68k_op_bchg_8_s_al , 0xffff, 0x0879, { 24, 24, 8, 8}}, + {m68k_op_bclr_8_s_pi7 , 0xffff, 0x089f, { 16, 16, 8, 8}}, + {m68k_op_bclr_8_s_pd7 , 0xffff, 0x08a7, { 18, 18, 9, 9}}, + {m68k_op_bclr_8_s_aw , 0xffff, 0x08b8, { 20, 20, 8, 8}}, + {m68k_op_bclr_8_s_al , 0xffff, 0x08b9, { 24, 24, 8, 8}}, + {m68k_op_bset_8_s_pi7 , 0xffff, 0x08df, { 16, 16, 8, 8}}, + {m68k_op_bset_8_s_pd7 , 0xffff, 0x08e7, { 18, 18, 9, 9}}, + {m68k_op_bset_8_s_aw , 0xffff, 0x08f8, { 20, 20, 8, 8}}, + {m68k_op_bset_8_s_al , 0xffff, 0x08f9, { 24, 24, 8, 8}}, + {m68k_op_eori_8_pi7 , 0xffff, 0x0a1f, { 16, 16, 8, 8}}, + {m68k_op_eori_8_pd7 , 0xffff, 0x0a27, { 18, 18, 9, 9}}, + {m68k_op_eori_8_aw , 0xffff, 0x0a38, { 20, 20, 8, 8}}, + {m68k_op_eori_8_al , 0xffff, 0x0a39, { 24, 24, 8, 8}}, + {m68k_op_eori_16_toc , 0xffff, 0x0a3c, { 20, 16, 12, 12}}, + {m68k_op_eori_16_aw , 0xffff, 0x0a78, { 20, 20, 8, 8}}, + {m68k_op_eori_16_al , 0xffff, 0x0a79, { 24, 24, 8, 8}}, + {m68k_op_eori_16_tos , 0xffff, 0x0a7c, { 20, 16, 12, 12}}, + {m68k_op_eori_32_aw , 0xffff, 0x0ab8, { 32, 32, 8, 8}}, + {m68k_op_eori_32_al , 0xffff, 0x0ab9, { 36, 36, 8, 8}}, + {m68k_op_cas_8_pi7 , 0xffff, 0x0adf, { 0, 0, 16, 16}}, + {m68k_op_cas_8_pd7 , 0xffff, 0x0ae7, { 0, 0, 17, 17}}, + {m68k_op_cas_8_aw , 0xffff, 0x0af8, { 0, 0, 16, 16}}, + {m68k_op_cas_8_al , 0xffff, 0x0af9, { 0, 0, 16, 16}}, + {m68k_op_cmpi_8_pi7 , 0xffff, 0x0c1f, { 12, 12, 6, 6}}, + {m68k_op_cmpi_8_pd7 , 0xffff, 0x0c27, { 14, 14, 7, 7}}, + {m68k_op_cmpi_8_aw , 0xffff, 0x0c38, { 16, 16, 6, 6}}, + {m68k_op_cmpi_8_al , 0xffff, 0x0c39, { 20, 20, 6, 6}}, + {m68k_op_cmpi_8_pcdi , 0xffff, 0x0c3a, { 0, 0, 7, 7}}, + {m68k_op_cmpi_8_pcix , 0xffff, 0x0c3b, { 0, 0, 9, 9}}, + {m68k_op_cmpi_16_aw , 0xffff, 0x0c78, { 16, 16, 6, 6}}, + {m68k_op_cmpi_16_al , 0xffff, 0x0c79, { 20, 20, 6, 6}}, + {m68k_op_cmpi_16_pcdi , 0xffff, 0x0c7a, { 0, 0, 7, 7}}, + {m68k_op_cmpi_16_pcix , 0xffff, 0x0c7b, { 0, 0, 9, 9}}, + {m68k_op_cmpi_32_aw , 0xffff, 0x0cb8, { 24, 24, 6, 6}}, + {m68k_op_cmpi_32_al , 0xffff, 0x0cb9, { 28, 28, 6, 6}}, + {m68k_op_cmpi_32_pcdi , 0xffff, 0x0cba, { 0, 0, 7, 7}}, + {m68k_op_cmpi_32_pcix , 0xffff, 0x0cbb, { 0, 0, 9, 9}}, + {m68k_op_cas_16_aw , 0xffff, 0x0cf8, { 0, 0, 16, 16}}, + {m68k_op_cas_16_al , 0xffff, 0x0cf9, { 0, 0, 16, 16}}, + {m68k_op_cas2_16 , 0xffff, 0x0cfc, { 0, 0, 12, 12}}, + {m68k_op_moves_8_pi7 , 0xffff, 0x0e1f, { 0, 18, 9, 9}}, + {m68k_op_moves_8_pd7 , 0xffff, 0x0e27, { 0, 20, 10, 10}}, + {m68k_op_moves_8_aw , 0xffff, 0x0e38, { 0, 26, 9, 9}}, + {m68k_op_moves_8_al , 0xffff, 0x0e39, { 0, 30, 9, 9}}, + {m68k_op_moves_16_aw , 0xffff, 0x0e78, { 0, 26, 9, 9}}, + {m68k_op_moves_16_al , 0xffff, 0x0e79, { 0, 30, 9, 9}}, + {m68k_op_moves_32_aw , 0xffff, 0x0eb8, { 0, 32, 9, 9}}, + {m68k_op_moves_32_al , 0xffff, 0x0eb9, { 0, 36, 9, 9}}, + {m68k_op_cas_32_aw , 0xffff, 0x0ef8, { 0, 0, 16, 16}}, + {m68k_op_cas_32_al , 0xffff, 0x0ef9, { 0, 0, 16, 16}}, + {m68k_op_cas2_32 , 0xffff, 0x0efc, { 0, 0, 12, 12}}, + {m68k_op_move_8_aw_pi7 , 0xffff, 0x11df, { 16, 16, 8, 8}}, + {m68k_op_move_8_aw_pd7 , 0xffff, 0x11e7, { 18, 18, 9, 9}}, + {m68k_op_move_8_aw_aw , 0xffff, 0x11f8, { 20, 20, 8, 8}}, + {m68k_op_move_8_aw_al , 0xffff, 0x11f9, { 24, 24, 8, 8}}, + {m68k_op_move_8_aw_pcdi , 0xffff, 0x11fa, { 20, 20, 9, 9}}, + {m68k_op_move_8_aw_pcix , 0xffff, 0x11fb, { 22, 22, 11, 11}}, + {m68k_op_move_8_aw_i , 0xffff, 0x11fc, { 16, 16, 6, 6}}, + {m68k_op_move_8_al_pi7 , 0xffff, 0x13df, { 20, 20, 10, 10}}, + {m68k_op_move_8_al_pd7 , 0xffff, 0x13e7, { 22, 22, 11, 11}}, + {m68k_op_move_8_al_aw , 0xffff, 0x13f8, { 24, 24, 10, 10}}, + {m68k_op_move_8_al_al , 0xffff, 0x13f9, { 28, 28, 10, 10}}, + {m68k_op_move_8_al_pcdi , 0xffff, 0x13fa, { 24, 24, 11, 11}}, + {m68k_op_move_8_al_pcix , 0xffff, 0x13fb, { 26, 26, 13, 13}}, + {m68k_op_move_8_al_i , 0xffff, 0x13fc, { 20, 20, 8, 8}}, + {m68k_op_move_8_pi7_pi7 , 0xffff, 0x1edf, { 12, 12, 8, 8}}, + {m68k_op_move_8_pi7_pd7 , 0xffff, 0x1ee7, { 14, 14, 9, 9}}, + {m68k_op_move_8_pi7_aw , 0xffff, 0x1ef8, { 16, 16, 8, 8}}, + {m68k_op_move_8_pi7_al , 0xffff, 0x1ef9, { 20, 20, 8, 8}}, + {m68k_op_move_8_pi7_pcdi , 0xffff, 0x1efa, { 16, 16, 9, 9}}, + {m68k_op_move_8_pi7_pcix , 0xffff, 0x1efb, { 18, 18, 11, 11}}, + {m68k_op_move_8_pi7_i , 0xffff, 0x1efc, { 12, 12, 6, 6}}, + {m68k_op_move_8_pd7_pi7 , 0xffff, 0x1f1f, { 12, 12, 9, 9}}, + {m68k_op_move_8_pd7_pd7 , 0xffff, 0x1f27, { 14, 14, 10, 10}}, + {m68k_op_move_8_pd7_aw , 0xffff, 0x1f38, { 16, 16, 9, 9}}, + {m68k_op_move_8_pd7_al , 0xffff, 0x1f39, { 20, 20, 9, 9}}, + {m68k_op_move_8_pd7_pcdi , 0xffff, 0x1f3a, { 16, 16, 10, 10}}, + {m68k_op_move_8_pd7_pcix , 0xffff, 0x1f3b, { 18, 18, 12, 12}}, + {m68k_op_move_8_pd7_i , 0xffff, 0x1f3c, { 12, 12, 7, 7}}, + {m68k_op_move_32_aw_aw , 0xffff, 0x21f8, { 28, 28, 8, 8}}, + {m68k_op_move_32_aw_al , 0xffff, 0x21f9, { 32, 32, 8, 8}}, + {m68k_op_move_32_aw_pcdi , 0xffff, 0x21fa, { 28, 28, 9, 9}}, + {m68k_op_move_32_aw_pcix , 0xffff, 0x21fb, { 30, 30, 11, 11}}, + {m68k_op_move_32_aw_i , 0xffff, 0x21fc, { 24, 24, 8, 8}}, + {m68k_op_move_32_al_aw , 0xffff, 0x23f8, { 32, 32, 10, 10}}, + {m68k_op_move_32_al_al , 0xffff, 0x23f9, { 36, 36, 10, 10}}, + {m68k_op_move_32_al_pcdi , 0xffff, 0x23fa, { 32, 32, 11, 11}}, + {m68k_op_move_32_al_pcix , 0xffff, 0x23fb, { 34, 34, 13, 13}}, + {m68k_op_move_32_al_i , 0xffff, 0x23fc, { 28, 28, 10, 10}}, + {m68k_op_move_16_aw_aw , 0xffff, 0x31f8, { 20, 20, 8, 8}}, + {m68k_op_move_16_aw_al , 0xffff, 0x31f9, { 24, 24, 8, 8}}, + {m68k_op_move_16_aw_pcdi , 0xffff, 0x31fa, { 20, 20, 9, 9}}, + {m68k_op_move_16_aw_pcix , 0xffff, 0x31fb, { 22, 22, 11, 11}}, + {m68k_op_move_16_aw_i , 0xffff, 0x31fc, { 16, 16, 6, 6}}, + {m68k_op_move_16_al_aw , 0xffff, 0x33f8, { 24, 24, 10, 10}}, + {m68k_op_move_16_al_al , 0xffff, 0x33f9, { 28, 28, 10, 10}}, + {m68k_op_move_16_al_pcdi , 0xffff, 0x33fa, { 24, 24, 11, 11}}, + {m68k_op_move_16_al_pcix , 0xffff, 0x33fb, { 26, 26, 13, 13}}, + {m68k_op_move_16_al_i , 0xffff, 0x33fc, { 20, 20, 8, 8}}, + {m68k_op_negx_8_pi7 , 0xffff, 0x401f, { 12, 12, 8, 8}}, + {m68k_op_negx_8_pd7 , 0xffff, 0x4027, { 14, 14, 9, 9}}, + {m68k_op_negx_8_aw , 0xffff, 0x4038, { 16, 16, 8, 8}}, + {m68k_op_negx_8_al , 0xffff, 0x4039, { 20, 20, 8, 8}}, + {m68k_op_negx_16_aw , 0xffff, 0x4078, { 16, 16, 8, 8}}, + {m68k_op_negx_16_al , 0xffff, 0x4079, { 20, 20, 8, 8}}, + {m68k_op_negx_32_aw , 0xffff, 0x40b8, { 24, 24, 8, 8}}, + {m68k_op_negx_32_al , 0xffff, 0x40b9, { 28, 28, 8, 8}}, + {m68k_op_move_16_frs_aw , 0xffff, 0x40f8, { 16, 16, 12, 12}}, + {m68k_op_move_16_frs_al , 0xffff, 0x40f9, { 20, 20, 12, 12}}, + {m68k_op_clr_8_pi7 , 0xffff, 0x421f, { 12, 8, 8, 8}}, + {m68k_op_clr_8_pd7 , 0xffff, 0x4227, { 14, 10, 9, 9}}, + {m68k_op_clr_8_aw , 0xffff, 0x4238, { 16, 12, 8, 8}}, + {m68k_op_clr_8_al , 0xffff, 0x4239, { 20, 14, 8, 8}}, + {m68k_op_clr_16_aw , 0xffff, 0x4278, { 16, 12, 8, 8}}, + {m68k_op_clr_16_al , 0xffff, 0x4279, { 20, 14, 8, 8}}, + {m68k_op_clr_32_aw , 0xffff, 0x42b8, { 24, 16, 8, 8}}, + {m68k_op_clr_32_al , 0xffff, 0x42b9, { 28, 20, 8, 8}}, + {m68k_op_move_16_frc_aw , 0xffff, 0x42f8, { 0, 16, 8, 8}}, + {m68k_op_move_16_frc_al , 0xffff, 0x42f9, { 0, 20, 8, 8}}, + {m68k_op_neg_8_pi7 , 0xffff, 0x441f, { 12, 12, 8, 8}}, + {m68k_op_neg_8_pd7 , 0xffff, 0x4427, { 14, 14, 9, 9}}, + {m68k_op_neg_8_aw , 0xffff, 0x4438, { 16, 16, 8, 8}}, + {m68k_op_neg_8_al , 0xffff, 0x4439, { 20, 20, 8, 8}}, + {m68k_op_neg_16_aw , 0xffff, 0x4478, { 16, 16, 8, 8}}, + {m68k_op_neg_16_al , 0xffff, 0x4479, { 20, 20, 8, 8}}, + {m68k_op_neg_32_aw , 0xffff, 0x44b8, { 24, 24, 8, 8}}, + {m68k_op_neg_32_al , 0xffff, 0x44b9, { 28, 28, 8, 8}}, + {m68k_op_move_16_toc_aw , 0xffff, 0x44f8, { 20, 20, 8, 8}}, + {m68k_op_move_16_toc_al , 0xffff, 0x44f9, { 24, 24, 8, 8}}, + {m68k_op_move_16_toc_pcdi , 0xffff, 0x44fa, { 20, 20, 9, 9}}, + {m68k_op_move_16_toc_pcix , 0xffff, 0x44fb, { 22, 22, 11, 11}}, + {m68k_op_move_16_toc_i , 0xffff, 0x44fc, { 16, 16, 6, 6}}, + {m68k_op_not_8_pi7 , 0xffff, 0x461f, { 12, 12, 8, 8}}, + {m68k_op_not_8_pd7 , 0xffff, 0x4627, { 14, 14, 9, 9}}, + {m68k_op_not_8_aw , 0xffff, 0x4638, { 16, 16, 8, 8}}, + {m68k_op_not_8_al , 0xffff, 0x4639, { 20, 20, 8, 8}}, + {m68k_op_not_16_aw , 0xffff, 0x4678, { 16, 16, 8, 8}}, + {m68k_op_not_16_al , 0xffff, 0x4679, { 20, 20, 8, 8}}, + {m68k_op_not_32_aw , 0xffff, 0x46b8, { 24, 24, 8, 8}}, + {m68k_op_not_32_al , 0xffff, 0x46b9, { 28, 28, 8, 8}}, + {m68k_op_move_16_tos_aw , 0xffff, 0x46f8, { 20, 20, 12, 12}}, + {m68k_op_move_16_tos_al , 0xffff, 0x46f9, { 24, 24, 12, 12}}, + {m68k_op_move_16_tos_pcdi , 0xffff, 0x46fa, { 20, 20, 13, 13}}, + {m68k_op_move_16_tos_pcix , 0xffff, 0x46fb, { 22, 22, 15, 15}}, + {m68k_op_move_16_tos_i , 0xffff, 0x46fc, { 16, 16, 10, 10}}, + {m68k_op_link_32_a7 , 0xffff, 0x480f, { 0, 0, 6, 6}}, + {m68k_op_nbcd_8_pi7 , 0xffff, 0x481f, { 12, 12, 10, 10}}, + {m68k_op_nbcd_8_pd7 , 0xffff, 0x4827, { 14, 14, 11, 11}}, + {m68k_op_nbcd_8_aw , 0xffff, 0x4838, { 16, 16, 10, 10}}, + {m68k_op_nbcd_8_al , 0xffff, 0x4839, { 20, 20, 10, 10}}, + {m68k_op_pea_32_aw , 0xffff, 0x4878, { 16, 16, 9, 9}}, + {m68k_op_pea_32_al , 0xffff, 0x4879, { 20, 20, 9, 9}}, + {m68k_op_pea_32_pcdi , 0xffff, 0x487a, { 16, 16, 10, 10}}, + {m68k_op_pea_32_pcix , 0xffff, 0x487b, { 20, 20, 12, 12}}, + {m68k_op_movem_16_re_aw , 0xffff, 0x48b8, { 12, 12, 8, 8}}, + {m68k_op_movem_16_re_al , 0xffff, 0x48b9, { 16, 16, 8, 8}}, + {m68k_op_movem_32_re_aw , 0xffff, 0x48f8, { 12, 12, 8, 8}}, + {m68k_op_movem_32_re_al , 0xffff, 0x48f9, { 16, 16, 8, 8}}, + {m68k_op_tst_8_pi7 , 0xffff, 0x4a1f, { 8, 8, 6, 6}}, + {m68k_op_tst_8_pd7 , 0xffff, 0x4a27, { 10, 10, 7, 7}}, + {m68k_op_tst_8_aw , 0xffff, 0x4a38, { 12, 12, 6, 6}}, + {m68k_op_tst_8_al , 0xffff, 0x4a39, { 16, 16, 6, 6}}, + {m68k_op_tst_8_pcdi , 0xffff, 0x4a3a, { 0, 0, 7, 7}}, + {m68k_op_tst_8_pcix , 0xffff, 0x4a3b, { 0, 0, 9, 9}}, + {m68k_op_tst_8_i , 0xffff, 0x4a3c, { 0, 0, 6, 6}}, + {m68k_op_tst_16_aw , 0xffff, 0x4a78, { 12, 12, 6, 6}}, + {m68k_op_tst_16_al , 0xffff, 0x4a79, { 16, 16, 6, 6}}, + {m68k_op_tst_16_pcdi , 0xffff, 0x4a7a, { 0, 0, 7, 7}}, + {m68k_op_tst_16_pcix , 0xffff, 0x4a7b, { 0, 0, 9, 9}}, + {m68k_op_tst_16_i , 0xffff, 0x4a7c, { 0, 0, 6, 6}}, + {m68k_op_tst_32_aw , 0xffff, 0x4ab8, { 16, 16, 6, 6}}, + {m68k_op_tst_32_al , 0xffff, 0x4ab9, { 20, 20, 6, 6}}, + {m68k_op_tst_32_pcdi , 0xffff, 0x4aba, { 0, 0, 7, 7}}, + {m68k_op_tst_32_pcix , 0xffff, 0x4abb, { 0, 0, 9, 9}}, + {m68k_op_tst_32_i , 0xffff, 0x4abc, { 0, 0, 6, 6}}, + {m68k_op_tas_8_pi7 , 0xffff, 0x4adf, { 18, 18, 16, 16}}, + {m68k_op_tas_8_pd7 , 0xffff, 0x4ae7, { 20, 20, 17, 17}}, + {m68k_op_tas_8_aw , 0xffff, 0x4af8, { 22, 22, 16, 16}}, + {m68k_op_tas_8_al , 0xffff, 0x4af9, { 26, 26, 16, 16}}, + {m68k_op_illegal , 0xffff, 0x4afc, { 4, 4, 4, 4}}, + {m68k_op_mull_32_aw , 0xffff, 0x4c38, { 0, 0, 47, 47}}, + {m68k_op_mull_32_al , 0xffff, 0x4c39, { 0, 0, 47, 47}}, + {m68k_op_mull_32_pcdi , 0xffff, 0x4c3a, { 0, 0, 48, 48}}, + {m68k_op_mull_32_pcix , 0xffff, 0x4c3b, { 0, 0, 50, 50}}, + {m68k_op_mull_32_i , 0xffff, 0x4c3c, { 0, 0, 47, 47}}, + {m68k_op_divl_32_aw , 0xffff, 0x4c78, { 0, 0, 88, 88}}, + {m68k_op_divl_32_al , 0xffff, 0x4c79, { 0, 0, 88, 88}}, + {m68k_op_divl_32_pcdi , 0xffff, 0x4c7a, { 0, 0, 89, 89}}, + {m68k_op_divl_32_pcix , 0xffff, 0x4c7b, { 0, 0, 91, 91}}, + {m68k_op_divl_32_i , 0xffff, 0x4c7c, { 0, 0, 88, 88}}, + {m68k_op_movem_16_er_aw , 0xffff, 0x4cb8, { 16, 16, 12, 12}}, + {m68k_op_movem_16_er_al , 0xffff, 0x4cb9, { 20, 20, 12, 12}}, + {m68k_op_movem_16_er_pcdi , 0xffff, 0x4cba, { 16, 16, 9, 9}}, + {m68k_op_movem_16_er_pcix , 0xffff, 0x4cbb, { 18, 18, 11, 11}}, + {m68k_op_movem_32_er_aw , 0xffff, 0x4cf8, { 16, 16, 12, 12}}, + {m68k_op_movem_32_er_al , 0xffff, 0x4cf9, { 20, 20, 12, 12}}, + {m68k_op_movem_32_er_pcdi , 0xffff, 0x4cfa, { 16, 16, 9, 9}}, + {m68k_op_movem_32_er_pcix , 0xffff, 0x4cfb, { 18, 18, 11, 11}}, + {m68k_op_link_16_a7 , 0xffff, 0x4e57, { 16, 16, 5, 5}}, + {m68k_op_unlk_32_a7 , 0xffff, 0x4e5f, { 12, 12, 6, 6}}, + {m68k_op_reset , 0xffff, 0x4e70, { 0, 0, 0, 0}}, + {m68k_op_nop , 0xffff, 0x4e71, { 4, 4, 2, 2}}, + {m68k_op_stop , 0xffff, 0x4e72, { 4, 4, 8, 8}}, + {m68k_op_rte_32 , 0xffff, 0x4e73, { 20, 24, 20, 20}}, + {m68k_op_rtd_32 , 0xffff, 0x4e74, { 0, 16, 10, 10}}, + {m68k_op_rts_32 , 0xffff, 0x4e75, { 16, 16, 10, 10}}, + {m68k_op_trapv , 0xffff, 0x4e76, { 4, 4, 4, 4}}, + {m68k_op_rtr_32 , 0xffff, 0x4e77, { 20, 20, 14, 14}}, + {m68k_op_movec_32_cr , 0xffff, 0x4e7a, { 0, 12, 6, 6}}, + {m68k_op_movec_32_rc , 0xffff, 0x4e7b, { 0, 10, 12, 12}}, + {m68k_op_jsr_32_aw , 0xffff, 0x4eb8, { 18, 18, 4, 4}}, + {m68k_op_jsr_32_al , 0xffff, 0x4eb9, { 20, 20, 4, 4}}, + {m68k_op_jsr_32_pcdi , 0xffff, 0x4eba, { 18, 18, 5, 5}}, + {m68k_op_jsr_32_pcix , 0xffff, 0x4ebb, { 22, 22, 7, 7}}, + {m68k_op_jmp_32_aw , 0xffff, 0x4ef8, { 10, 10, 4, 4}}, + {m68k_op_jmp_32_al , 0xffff, 0x4ef9, { 12, 12, 4, 4}}, + {m68k_op_jmp_32_pcdi , 0xffff, 0x4efa, { 10, 10, 5, 5}}, + {m68k_op_jmp_32_pcix , 0xffff, 0x4efb, { 14, 14, 7, 7}}, + {m68k_op_st_8_pi7 , 0xffff, 0x50df, { 12, 12, 10, 10}}, + {m68k_op_st_8_pd7 , 0xffff, 0x50e7, { 14, 14, 11, 11}}, + {m68k_op_st_8_aw , 0xffff, 0x50f8, { 16, 16, 10, 10}}, + {m68k_op_st_8_al , 0xffff, 0x50f9, { 20, 20, 10, 10}}, + {m68k_op_trapt_16 , 0xffff, 0x50fa, { 0, 0, 6, 6}}, + {m68k_op_trapt_32 , 0xffff, 0x50fb, { 0, 0, 8, 8}}, + {m68k_op_trapt , 0xffff, 0x50fc, { 0, 0, 4, 4}}, + {m68k_op_sf_8_pi7 , 0xffff, 0x51df, { 12, 12, 10, 10}}, + {m68k_op_sf_8_pd7 , 0xffff, 0x51e7, { 14, 14, 11, 11}}, + {m68k_op_sf_8_aw , 0xffff, 0x51f8, { 16, 16, 10, 10}}, + {m68k_op_sf_8_al , 0xffff, 0x51f9, { 20, 20, 10, 10}}, + {m68k_op_trapf_16 , 0xffff, 0x51fa, { 0, 0, 6, 6}}, + {m68k_op_trapf_32 , 0xffff, 0x51fb, { 0, 0, 8, 8}}, + {m68k_op_trapf , 0xffff, 0x51fc, { 0, 0, 4, 4}}, + {m68k_op_shi_8_pi7 , 0xffff, 0x52df, { 12, 12, 10, 10}}, + {m68k_op_shi_8_pd7 , 0xffff, 0x52e7, { 14, 14, 11, 11}}, + {m68k_op_shi_8_aw , 0xffff, 0x52f8, { 16, 16, 10, 10}}, + {m68k_op_shi_8_al , 0xffff, 0x52f9, { 20, 20, 10, 10}}, + {m68k_op_traphi_16 , 0xffff, 0x52fa, { 0, 0, 6, 6}}, + {m68k_op_traphi_32 , 0xffff, 0x52fb, { 0, 0, 8, 8}}, + {m68k_op_traphi , 0xffff, 0x52fc, { 0, 0, 4, 4}}, + {m68k_op_sls_8_pi7 , 0xffff, 0x53df, { 12, 12, 10, 10}}, + {m68k_op_sls_8_pd7 , 0xffff, 0x53e7, { 14, 14, 11, 11}}, + {m68k_op_sls_8_aw , 0xffff, 0x53f8, { 16, 16, 10, 10}}, + {m68k_op_sls_8_al , 0xffff, 0x53f9, { 20, 20, 10, 10}}, + {m68k_op_trapls_16 , 0xffff, 0x53fa, { 0, 0, 6, 6}}, + {m68k_op_trapls_32 , 0xffff, 0x53fb, { 0, 0, 8, 8}}, + {m68k_op_trapls , 0xffff, 0x53fc, { 0, 0, 4, 4}}, + {m68k_op_scc_8_pi7 , 0xffff, 0x54df, { 12, 12, 10, 10}}, + {m68k_op_scc_8_pd7 , 0xffff, 0x54e7, { 14, 14, 11, 11}}, + {m68k_op_scc_8_aw , 0xffff, 0x54f8, { 16, 16, 10, 10}}, + {m68k_op_scc_8_al , 0xffff, 0x54f9, { 20, 20, 10, 10}}, + {m68k_op_trapcc_16 , 0xffff, 0x54fa, { 0, 0, 6, 6}}, + {m68k_op_trapcc_32 , 0xffff, 0x54fb, { 0, 0, 8, 8}}, + {m68k_op_trapcc , 0xffff, 0x54fc, { 0, 0, 4, 4}}, + {m68k_op_scs_8_pi7 , 0xffff, 0x55df, { 12, 12, 10, 10}}, + {m68k_op_scs_8_pd7 , 0xffff, 0x55e7, { 14, 14, 11, 11}}, + {m68k_op_scs_8_aw , 0xffff, 0x55f8, { 16, 16, 10, 10}}, + {m68k_op_scs_8_al , 0xffff, 0x55f9, { 20, 20, 10, 10}}, + {m68k_op_trapcs_16 , 0xffff, 0x55fa, { 0, 0, 6, 6}}, + {m68k_op_trapcs_32 , 0xffff, 0x55fb, { 0, 0, 8, 8}}, + {m68k_op_trapcs , 0xffff, 0x55fc, { 0, 0, 4, 4}}, + {m68k_op_sne_8_pi7 , 0xffff, 0x56df, { 12, 12, 10, 10}}, + {m68k_op_sne_8_pd7 , 0xffff, 0x56e7, { 14, 14, 11, 11}}, + {m68k_op_sne_8_aw , 0xffff, 0x56f8, { 16, 16, 10, 10}}, + {m68k_op_sne_8_al , 0xffff, 0x56f9, { 20, 20, 10, 10}}, + {m68k_op_trapne_16 , 0xffff, 0x56fa, { 0, 0, 6, 6}}, + {m68k_op_trapne_32 , 0xffff, 0x56fb, { 0, 0, 8, 8}}, + {m68k_op_trapne , 0xffff, 0x56fc, { 0, 0, 4, 4}}, + {m68k_op_seq_8_pi7 , 0xffff, 0x57df, { 12, 12, 10, 10}}, + {m68k_op_seq_8_pd7 , 0xffff, 0x57e7, { 14, 14, 11, 11}}, + {m68k_op_seq_8_aw , 0xffff, 0x57f8, { 16, 16, 10, 10}}, + {m68k_op_seq_8_al , 0xffff, 0x57f9, { 20, 20, 10, 10}}, + {m68k_op_trapeq_16 , 0xffff, 0x57fa, { 0, 0, 6, 6}}, + {m68k_op_trapeq_32 , 0xffff, 0x57fb, { 0, 0, 8, 8}}, + {m68k_op_trapeq , 0xffff, 0x57fc, { 0, 0, 4, 4}}, + {m68k_op_svc_8_pi7 , 0xffff, 0x58df, { 12, 12, 10, 10}}, + {m68k_op_svc_8_pd7 , 0xffff, 0x58e7, { 14, 14, 11, 11}}, + {m68k_op_svc_8_aw , 0xffff, 0x58f8, { 16, 16, 10, 10}}, + {m68k_op_svc_8_al , 0xffff, 0x58f9, { 20, 20, 10, 10}}, + {m68k_op_trapvc_16 , 0xffff, 0x58fa, { 0, 0, 6, 6}}, + {m68k_op_trapvc_32 , 0xffff, 0x58fb, { 0, 0, 8, 8}}, + {m68k_op_trapvc , 0xffff, 0x58fc, { 0, 0, 4, 4}}, + {m68k_op_svs_8_pi7 , 0xffff, 0x59df, { 12, 12, 10, 10}}, + {m68k_op_svs_8_pd7 , 0xffff, 0x59e7, { 14, 14, 11, 11}}, + {m68k_op_svs_8_aw , 0xffff, 0x59f8, { 16, 16, 10, 10}}, + {m68k_op_svs_8_al , 0xffff, 0x59f9, { 20, 20, 10, 10}}, + {m68k_op_trapvs_16 , 0xffff, 0x59fa, { 0, 0, 6, 6}}, + {m68k_op_trapvs_32 , 0xffff, 0x59fb, { 0, 0, 8, 8}}, + {m68k_op_trapvs , 0xffff, 0x59fc, { 0, 0, 4, 4}}, + {m68k_op_spl_8_pi7 , 0xffff, 0x5adf, { 12, 12, 10, 10}}, + {m68k_op_spl_8_pd7 , 0xffff, 0x5ae7, { 14, 14, 11, 11}}, + {m68k_op_spl_8_aw , 0xffff, 0x5af8, { 16, 16, 10, 10}}, + {m68k_op_spl_8_al , 0xffff, 0x5af9, { 20, 20, 10, 10}}, + {m68k_op_trappl_16 , 0xffff, 0x5afa, { 0, 0, 6, 6}}, + {m68k_op_trappl_32 , 0xffff, 0x5afb, { 0, 0, 8, 8}}, + {m68k_op_trappl , 0xffff, 0x5afc, { 0, 0, 4, 4}}, + {m68k_op_smi_8_pi7 , 0xffff, 0x5bdf, { 12, 12, 10, 10}}, + {m68k_op_smi_8_pd7 , 0xffff, 0x5be7, { 14, 14, 11, 11}}, + {m68k_op_smi_8_aw , 0xffff, 0x5bf8, { 16, 16, 10, 10}}, + {m68k_op_smi_8_al , 0xffff, 0x5bf9, { 20, 20, 10, 10}}, + {m68k_op_trapmi_16 , 0xffff, 0x5bfa, { 0, 0, 6, 6}}, + {m68k_op_trapmi_32 , 0xffff, 0x5bfb, { 0, 0, 8, 8}}, + {m68k_op_trapmi , 0xffff, 0x5bfc, { 0, 0, 4, 4}}, + {m68k_op_sge_8_pi7 , 0xffff, 0x5cdf, { 12, 12, 10, 10}}, + {m68k_op_sge_8_pd7 , 0xffff, 0x5ce7, { 14, 14, 11, 11}}, + {m68k_op_sge_8_aw , 0xffff, 0x5cf8, { 16, 16, 10, 10}}, + {m68k_op_sge_8_al , 0xffff, 0x5cf9, { 20, 20, 10, 10}}, + {m68k_op_trapge_16 , 0xffff, 0x5cfa, { 0, 0, 6, 6}}, + {m68k_op_trapge_32 , 0xffff, 0x5cfb, { 0, 0, 8, 8}}, + {m68k_op_trapge , 0xffff, 0x5cfc, { 0, 0, 4, 4}}, + {m68k_op_slt_8_pi7 , 0xffff, 0x5ddf, { 12, 12, 10, 10}}, + {m68k_op_slt_8_pd7 , 0xffff, 0x5de7, { 14, 14, 11, 11}}, + {m68k_op_slt_8_aw , 0xffff, 0x5df8, { 16, 16, 10, 10}}, + {m68k_op_slt_8_al , 0xffff, 0x5df9, { 20, 20, 10, 10}}, + {m68k_op_traplt_16 , 0xffff, 0x5dfa, { 0, 0, 6, 6}}, + {m68k_op_traplt_32 , 0xffff, 0x5dfb, { 0, 0, 8, 8}}, + {m68k_op_traplt , 0xffff, 0x5dfc, { 0, 0, 4, 4}}, + {m68k_op_sgt_8_pi7 , 0xffff, 0x5edf, { 12, 12, 10, 10}}, + {m68k_op_sgt_8_pd7 , 0xffff, 0x5ee7, { 14, 14, 11, 11}}, + {m68k_op_sgt_8_aw , 0xffff, 0x5ef8, { 16, 16, 10, 10}}, + {m68k_op_sgt_8_al , 0xffff, 0x5ef9, { 20, 20, 10, 10}}, + {m68k_op_trapgt_16 , 0xffff, 0x5efa, { 0, 0, 6, 6}}, + {m68k_op_trapgt_32 , 0xffff, 0x5efb, { 0, 0, 8, 8}}, + {m68k_op_trapgt , 0xffff, 0x5efc, { 0, 0, 4, 4}}, + {m68k_op_sle_8_pi7 , 0xffff, 0x5fdf, { 12, 12, 10, 10}}, + {m68k_op_sle_8_pd7 , 0xffff, 0x5fe7, { 14, 14, 11, 11}}, + {m68k_op_sle_8_aw , 0xffff, 0x5ff8, { 16, 16, 10, 10}}, + {m68k_op_sle_8_al , 0xffff, 0x5ff9, { 20, 20, 10, 10}}, + {m68k_op_traple_16 , 0xffff, 0x5ffa, { 0, 0, 6, 6}}, + {m68k_op_traple_32 , 0xffff, 0x5ffb, { 0, 0, 8, 8}}, + {m68k_op_traple , 0xffff, 0x5ffc, { 0, 0, 4, 4}}, + {m68k_op_bra_16 , 0xffff, 0x6000, { 10, 10, 10, 10}}, + {m68k_op_bra_32 , 0xffff, 0x60ff, { 10, 10, 10, 10}}, + {m68k_op_bsr_16 , 0xffff, 0x6100, { 18, 18, 7, 7}}, + {m68k_op_bsr_32 , 0xffff, 0x61ff, { 18, 18, 7, 7}}, + {m68k_op_bhi_16 , 0xffff, 0x6200, { 10, 10, 6, 6}}, + {m68k_op_bhi_32 , 0xffff, 0x62ff, { 10, 10, 6, 6}}, + {m68k_op_bls_16 , 0xffff, 0x6300, { 10, 10, 6, 6}}, + {m68k_op_bls_32 , 0xffff, 0x63ff, { 10, 10, 6, 6}}, + {m68k_op_bcc_16 , 0xffff, 0x6400, { 10, 10, 6, 6}}, + {m68k_op_bcc_32 , 0xffff, 0x64ff, { 10, 10, 6, 6}}, + {m68k_op_bcs_16 , 0xffff, 0x6500, { 10, 10, 6, 6}}, + {m68k_op_bcs_32 , 0xffff, 0x65ff, { 10, 10, 6, 6}}, + {m68k_op_bne_16 , 0xffff, 0x6600, { 10, 10, 6, 6}}, + {m68k_op_bne_32 , 0xffff, 0x66ff, { 10, 10, 6, 6}}, + {m68k_op_beq_16 , 0xffff, 0x6700, { 10, 10, 6, 6}}, + {m68k_op_beq_32 , 0xffff, 0x67ff, { 10, 10, 6, 6}}, + {m68k_op_bvc_16 , 0xffff, 0x6800, { 10, 10, 6, 6}}, + {m68k_op_bvc_32 , 0xffff, 0x68ff, { 10, 10, 6, 6}}, + {m68k_op_bvs_16 , 0xffff, 0x6900, { 10, 10, 6, 6}}, + {m68k_op_bvs_32 , 0xffff, 0x69ff, { 10, 10, 6, 6}}, + {m68k_op_bpl_16 , 0xffff, 0x6a00, { 10, 10, 6, 6}}, + {m68k_op_bpl_32 , 0xffff, 0x6aff, { 10, 10, 6, 6}}, + {m68k_op_bmi_16 , 0xffff, 0x6b00, { 10, 10, 6, 6}}, + {m68k_op_bmi_32 , 0xffff, 0x6bff, { 10, 10, 6, 6}}, + {m68k_op_bge_16 , 0xffff, 0x6c00, { 10, 10, 6, 6}}, + {m68k_op_bge_32 , 0xffff, 0x6cff, { 10, 10, 6, 6}}, + {m68k_op_blt_16 , 0xffff, 0x6d00, { 10, 10, 6, 6}}, + {m68k_op_blt_32 , 0xffff, 0x6dff, { 10, 10, 6, 6}}, + {m68k_op_bgt_16 , 0xffff, 0x6e00, { 10, 10, 6, 6}}, + {m68k_op_bgt_32 , 0xffff, 0x6eff, { 10, 10, 6, 6}}, + {m68k_op_ble_16 , 0xffff, 0x6f00, { 10, 10, 6, 6}}, + {m68k_op_ble_32 , 0xffff, 0x6fff, { 10, 10, 6, 6}}, + {m68k_op_sbcd_8_mm_axy7 , 0xffff, 0x8f0f, { 18, 18, 16, 16}}, + {m68k_op_pack_16_mm_axy7 , 0xffff, 0x8f4f, { 0, 0, 13, 13}}, + {m68k_op_unpk_16_mm_axy7 , 0xffff, 0x8f8f, { 0, 0, 13, 13}}, + {m68k_op_subx_8_mm_axy7 , 0xffff, 0x9f0f, { 18, 18, 12, 12}}, + {m68k_op_cmpm_8_axy7 , 0xffff, 0xbf0f, { 12, 12, 9, 9}}, + {m68k_op_abcd_8_mm_axy7 , 0xffff, 0xcf0f, { 18, 18, 16, 16}}, + {m68k_op_addx_8_mm_axy7 , 0xffff, 0xdf0f, { 18, 18, 12, 12}}, + {m68k_op_asr_16_aw , 0xffff, 0xe0f8, { 16, 16, 9, 9}}, + {m68k_op_asr_16_al , 0xffff, 0xe0f9, { 20, 20, 9, 9}}, + {m68k_op_asl_16_aw , 0xffff, 0xe1f8, { 16, 16, 10, 10}}, + {m68k_op_asl_16_al , 0xffff, 0xe1f9, { 20, 20, 10, 10}}, + {m68k_op_lsr_16_aw , 0xffff, 0xe2f8, { 16, 16, 9, 9}}, + {m68k_op_lsr_16_al , 0xffff, 0xe2f9, { 20, 20, 9, 9}}, + {m68k_op_lsl_16_aw , 0xffff, 0xe3f8, { 16, 16, 9, 9}}, + {m68k_op_lsl_16_al , 0xffff, 0xe3f9, { 20, 20, 9, 9}}, + {m68k_op_roxr_16_aw , 0xffff, 0xe4f8, { 16, 16, 9, 9}}, + {m68k_op_roxr_16_al , 0xffff, 0xe4f9, { 20, 20, 9, 9}}, + {m68k_op_roxl_16_aw , 0xffff, 0xe5f8, { 16, 16, 9, 9}}, + {m68k_op_roxl_16_al , 0xffff, 0xe5f9, { 20, 20, 9, 9}}, + {m68k_op_ror_16_aw , 0xffff, 0xe6f8, { 16, 16, 11, 11}}, + {m68k_op_ror_16_al , 0xffff, 0xe6f9, { 20, 20, 11, 11}}, + {m68k_op_rol_16_aw , 0xffff, 0xe7f8, { 16, 16, 11, 11}}, + {m68k_op_rol_16_al , 0xffff, 0xe7f9, { 20, 20, 11, 11}}, + {m68k_op_bftst_32_aw , 0xffff, 0xe8f8, { 0, 0, 17, 17}}, + {m68k_op_bftst_32_al , 0xffff, 0xe8f9, { 0, 0, 17, 17}}, + {m68k_op_bftst_32_pcdi , 0xffff, 0xe8fa, { 0, 0, 18, 18}}, + {m68k_op_bftst_32_pcix , 0xffff, 0xe8fb, { 0, 0, 20, 20}}, + {m68k_op_bfextu_32_aw , 0xffff, 0xe9f8, { 0, 0, 19, 19}}, + {m68k_op_bfextu_32_al , 0xffff, 0xe9f9, { 0, 0, 19, 19}}, + {m68k_op_bfextu_32_pcdi , 0xffff, 0xe9fa, { 0, 0, 20, 20}}, + {m68k_op_bfextu_32_pcix , 0xffff, 0xe9fb, { 0, 0, 22, 22}}, + {m68k_op_bfchg_32_aw , 0xffff, 0xeaf8, { 0, 0, 24, 24}}, + {m68k_op_bfchg_32_al , 0xffff, 0xeaf9, { 0, 0, 24, 24}}, + {m68k_op_bfexts_32_aw , 0xffff, 0xebf8, { 0, 0, 19, 19}}, + {m68k_op_bfexts_32_al , 0xffff, 0xebf9, { 0, 0, 19, 19}}, + {m68k_op_bfexts_32_pcdi , 0xffff, 0xebfa, { 0, 0, 20, 20}}, + {m68k_op_bfexts_32_pcix , 0xffff, 0xebfb, { 0, 0, 22, 22}}, + {m68k_op_bfclr_32_aw , 0xffff, 0xecf8, { 0, 0, 24, 24}}, + {m68k_op_bfclr_32_al , 0xffff, 0xecf9, { 0, 0, 24, 24}}, + {m68k_op_bfffo_32_aw , 0xffff, 0xedf8, { 0, 0, 32, 32}}, + {m68k_op_bfffo_32_al , 0xffff, 0xedf9, { 0, 0, 32, 32}}, + {m68k_op_bfffo_32_pcdi , 0xffff, 0xedfa, { 0, 0, 33, 33}}, + {m68k_op_bfffo_32_pcix , 0xffff, 0xedfb, { 0, 0, 35, 35}}, + {m68k_op_bfset_32_aw , 0xffff, 0xeef8, { 0, 0, 24, 24}}, + {m68k_op_bfset_32_al , 0xffff, 0xeef9, { 0, 0, 24, 24}}, + {m68k_op_bfins_32_aw , 0xffff, 0xeff8, { 0, 0, 21, 21}}, + {m68k_op_bfins_32_al , 0xffff, 0xeff9, { 0, 0, 21, 21}}, + {m68k_op_pflush_32 , 0xffff, 0xf518, { 0, 0, 0, 4}}, + {0, 0, 0, {0, 0, 0, 0}} }; /* Build the opcode handler jump table */ void m68ki_build_opcode_table(void) { - const opcode_handler_struct *ostruct; - int instr; - int i; - int j; - int k; + const opcode_handler_struct *ostruct; + int instr; + int i; + int j; + int k; - for(i = 0; i < 0x10000; i++) - { - /* default to illegal */ - m68ki_instruction_jump_table[i] = m68k_op_illegal; - for(k=0;kmask != 0xff00) - { - for(i = 0;i < 0x10000;i++) - { - if((i & ostruct->mask) == ostruct->match) - { - m68ki_instruction_jump_table[i] = ostruct->opcode_handler; - for(k=0;kcycles[k]; - } - } - ostruct++; - } - while(ostruct->mask == 0xff00) - { - for(i = 0;i <= 0xff;i++) - { - m68ki_instruction_jump_table[ostruct->match | i] = ostruct->opcode_handler; - for(k=0;kmatch | i] = ostruct->cycles[k]; - } - ostruct++; - } - while(ostruct->mask == 0xf1f8) - { - for(i = 0;i < 8;i++) - { - for(j = 0;j < 8;j++) - { - instr = ostruct->match | (i << 9) | j; - m68ki_instruction_jump_table[instr] = ostruct->opcode_handler; - for(k=0;kcycles[k]; - } - } - ostruct++; - } - while(ostruct->mask == 0xfff0) - { - for(i = 0;i <= 0x0f;i++) - { - m68ki_instruction_jump_table[ostruct->match | i] = ostruct->opcode_handler; - for(k=0;kmatch | i] = ostruct->cycles[k]; - } - ostruct++; - } - while(ostruct->mask == 0xf1ff) - { - for(i = 0;i <= 0x07;i++) - { - m68ki_instruction_jump_table[ostruct->match | (i << 9)] = ostruct->opcode_handler; - for(k=0;kmatch | (i << 9)] = ostruct->cycles[k]; - } - ostruct++; - } - while(ostruct->mask == 0xfff8) - { - for(i = 0;i <= 0x07;i++) - { - m68ki_instruction_jump_table[ostruct->match | i] = ostruct->opcode_handler; - for(k=0;kmatch | i] = ostruct->cycles[k]; - } - ostruct++; - } - while(ostruct->mask == 0xffff) - { - m68ki_instruction_jump_table[ostruct->match] = ostruct->opcode_handler; - for(k=0;kmatch] = ostruct->cycles[k]; - ostruct++; - } + ostruct = m68k_opcode_handler_table; + while(ostruct->mask != 0xff00) + { + for(i = 0;i < 0x10000;i++) + { + if((i & ostruct->mask) == ostruct->match) + { + m68ki_instruction_jump_table[i] = ostruct->opcode_handler; + for(k=0;kcycles[k]; + } + } + ostruct++; + } + while(ostruct->mask == 0xff00) + { + for(i = 0;i <= 0xff;i++) + { + m68ki_instruction_jump_table[ostruct->match | i] = ostruct->opcode_handler; + for(k=0;kmatch | i] = ostruct->cycles[k]; + } + ostruct++; + } + while(ostruct->mask == 0xf1f8) + { + for(i = 0;i < 8;i++) + { + for(j = 0;j < 8;j++) + { + instr = ostruct->match | (i << 9) | j; + m68ki_instruction_jump_table[instr] = ostruct->opcode_handler; + for(k=0;kcycles[k]; + } + } + ostruct++; + } + while(ostruct->mask == 0xfff0) + { + for(i = 0;i <= 0x0f;i++) + { + m68ki_instruction_jump_table[ostruct->match | i] = ostruct->opcode_handler; + for(k=0;kmatch | i] = ostruct->cycles[k]; + } + ostruct++; + } + while(ostruct->mask == 0xf1ff) + { + for(i = 0;i <= 0x07;i++) + { + m68ki_instruction_jump_table[ostruct->match | (i << 9)] = ostruct->opcode_handler; + for(k=0;kmatch | (i << 9)] = ostruct->cycles[k]; + } + ostruct++; + } + while(ostruct->mask == 0xfff8) + { + for(i = 0;i <= 0x07;i++) + { + m68ki_instruction_jump_table[ostruct->match | i] = ostruct->opcode_handler; + for(k=0;kmatch | i] = ostruct->cycles[k]; + } + ostruct++; + } + while(ostruct->mask == 0xffff) + { + m68ki_instruction_jump_table[ostruct->match] = ostruct->opcode_handler; + for(k=0;kmatch] = ostruct->cycles[k]; + ostruct++; + } } diff --git a/source/ngc/config.c b/source/ngc/config.c index afea63e..5b5b386 100644 --- a/source/ngc/config.c +++ b/source/ngc/config.c @@ -1,7 +1,27 @@ +/**************************************************************************** + * config.c + * + * Genesis Plus GX configuration file support + * + * code by Eke-Eke (2008) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ***************************************************************************/ #include "shared.h" -#include "font.h" -#include #include #ifdef HW_RVL diff --git a/source/ngc/config.h b/source/ngc/config.h index cd90ef3..400b109 100644 --- a/source/ngc/config.h +++ b/source/ngc/config.h @@ -1,3 +1,25 @@ +/**************************************************************************** + * config.c + * + * Genesis Plus GX configuration file support + * + * code by Eke-Eke (2008) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ***************************************************************************/ #ifndef _CONFIG_H_ #define _CONFIG_H_ diff --git a/source/ngc/dvd.h b/source/ngc/dvd.h deleted file mode 100644 index ccf99aa..0000000 --- a/source/ngc/dvd.h +++ /dev/null @@ -1,19 +0,0 @@ -/**************************************************************************** - * Nintendo Gamecube DVD Reading Library - * - * Low-Level DVD access - * - ***************************************************************************/ - -#ifndef _DVD_H_ -#define _DVD_H_ - -extern u32 dvd_read (void *dst, u32 len, u64 offset); -extern void dvd_motor_off (); - -#ifndef HW_RVL -extern void uselessinquiry (); -extern void dvd_drive_detect(); -#endif - -#endif diff --git a/source/ngc/dvd.c b/source/ngc/fileio/dvd.c similarity index 77% rename from source/ngc/dvd.c rename to source/ngc/fileio/dvd.c index bbfbd36..eacf345 100644 --- a/source/ngc/dvd.c +++ b/source/ngc/fileio/dvd.c @@ -1,9 +1,26 @@ -/**************************************************************************** - * Nintendo Gamecube DVD Reading Library +/* + * dvd.c + * + * Low-level DVD access * - * Low-Level DVD access + * code by Softdev (2006), Eke-Eke (2007,2008) * - ***************************************************************************/ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + #include "shared.h" #ifdef HW_RVL diff --git a/source/ngc/fileio/dvd.h b/source/ngc/fileio/dvd.h new file mode 100644 index 0000000..778b60e --- /dev/null +++ b/source/ngc/fileio/dvd.h @@ -0,0 +1,36 @@ +/* + * dvd.c + * + * Low-level DVD access + * + * code by Softdev (2006), Eke-Eke (2007,2008) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + + +#ifndef _DVD_H_ +#define _DVD_H_ + +extern u32 dvd_read (void *dst, u32 len, u64 offset); +extern void dvd_motor_off (); + +#ifndef HW_RVL +extern void uselessinquiry (); +extern void dvd_drive_detect(); +#endif + +#endif diff --git a/source/ngc/fileio_dvd.c b/source/ngc/fileio/file_dvd.c similarity index 86% rename from source/ngc/fileio_dvd.c rename to source/ngc/fileio/file_dvd.c index 3edc173..964f068 100644 --- a/source/ngc/fileio_dvd.c +++ b/source/ngc/fileio/file_dvd.c @@ -1,14 +1,31 @@ -/**************************************************************************** +/* + * file_dvd.c + * + * generic ISO9660/Joliet DVD loading support * - * DVD ISO9660/Joliet loading support + * code by Eke-Eke (2008) * - ***************************************************************************/ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + #include "shared.h" #include "font.h" -#include "fileio_dvd.h" -#include "filesel.h" -#include "fileio.h" #include "dvd.h" +#include "unzip.h" +#include "filesel.h" #ifdef HW_RVL #include "di/di.h" @@ -269,7 +286,7 @@ int DVD_ParseDirectory () * This functions return the actual size of data copied into the buffer * ****************************************************************************/ -int DVD_LoadFile (unsigned char *buffer) +int DVD_LoadFile (u8 *buffer) { /* file size */ int length = filelist[selection].length; @@ -284,6 +301,9 @@ int DVD_LoadFile (unsigned char *buffer) /* determine file type */ if (!IsZipFile ((char *) readbuffer)) { + char msg[50]; + sprintf(msg,"Loading %d bytes...", length); + ShowAction(msg); /* How many 2k blocks to read */ int blocks = length / 2048; int readoffset = 0; @@ -310,7 +330,7 @@ int DVD_LoadFile (unsigned char *buffer) } else { - return UnZipDVD (buffer, discoffset, length); + return UnZipBuffer (buffer, discoffset, NULL); } } @@ -323,7 +343,7 @@ int DVD_LoadFile (unsigned char *buffer) * Function to load a DVD directory and display to user. ****************************************************************************/ -int DVD_Open () +int DVD_Open (u8 *buffer) { /* reset flags */ useFAT = 0; @@ -385,7 +405,7 @@ int DVD_Open () selection = 0; old_offset = 0; old_selection = 0; - return FileSelector (); + return FileSelector (buffer); } else { @@ -395,5 +415,5 @@ int DVD_Open () } } - return FileSelector (); + return FileSelector (buffer); } diff --git a/source/ngc/fileio/file_dvd.h b/source/ngc/fileio/file_dvd.h new file mode 100644 index 0000000..89e500d --- /dev/null +++ b/source/ngc/fileio/file_dvd.h @@ -0,0 +1,32 @@ +/* + * file_dvd.c + * + * generic ISO9660/Joliet DVD loading support + * + * code by Eke-Eke (2008) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + +#ifndef _FILE_DVD_H +#define _FILE_DVD_H + +extern int DVD_UpdateDir(int go_up); +extern int DVD_ParseDirectory(); +extern int DVD_LoadFile(u8 *buffer); +extern int DVD_Open (u8 *buffer); + +#endif diff --git a/source/ngc/fileio_fat.c b/source/ngc/fileio/file_fat.c similarity index 83% rename from source/ngc/fileio_fat.c rename to source/ngc/fileio/file_fat.c index 56287d4..859e4c3 100644 --- a/source/ngc/fileio_fat.c +++ b/source/ngc/fileio/file_fat.c @@ -1,16 +1,35 @@ -/**************************************************************************** - * FAT loading support +/* + * file_fat.c + * + * generic FAT loading support * - ***************************************************************************/ + * code by Eke-Eke (2008) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + #include "shared.h" #include "font.h" -#include "fileio_fat.h" -#include "filesel.h" -#include "fileio.h" #include "history.h" +#include "unzip.h" +#include "filesel.h" +#include "file_fat.h" /* current FAT directory */ -static char fatdir[256]; +static char fatdir[MAXPATHLEN]; /* current FAT device */ static int fat_type = 0; @@ -149,7 +168,7 @@ int FAT_ParseDirectory() * This functions return the actual size of data copied into the buffer * ****************************************************************************/ -int FAT_LoadFile (unsigned char *buffer) +int FAT_LoadFile (u8 *buffer) { /* If loading from history then we need to setup a few more things. */ if(useHistory) @@ -203,6 +222,9 @@ int FAT_LoadFile (unsigned char *buffer) sdfile = fopen(fname, "rb"); if (sdfile) { + char msg[50]; + sprintf(msg,"Loading %d bytes...", length); + ShowAction(msg); fread(buffer, 1, length, sdfile); fclose(sdfile); return length; @@ -211,7 +233,7 @@ int FAT_LoadFile (unsigned char *buffer) else { /* unzip file */ - return UnZipFAT(buffer, fname); + return UnZipBuffer (buffer, 0, fname); } } @@ -223,7 +245,7 @@ int FAT_LoadFile (unsigned char *buffer) * * Function to load a FAT directory and display to user. ****************************************************************************/ -int FAT_Open(int type) +int FAT_Open(int type, u8 *buffer) { int max = 0; char root[10] = ""; @@ -299,7 +321,7 @@ int FAT_Open(int type) selection = 0; old_offset = 0; old_selection = 0; - return FileSelector (); + return FileSelector (buffer); } else { @@ -309,5 +331,5 @@ int FAT_Open(int type) } } - return FileSelector (); + return FileSelector (buffer); } diff --git a/source/ngc/fileio/file_fat.h b/source/ngc/fileio/file_fat.h new file mode 100644 index 0000000..bac7a41 --- /dev/null +++ b/source/ngc/fileio/file_fat.h @@ -0,0 +1,39 @@ +/* + * file_fat.c + * + * generic FAT loading support + * + * code by Eke-Eke (2008) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + +#ifndef _FILE_FAT_H +#define _FILE_FAT_H + +#define TYPE_RECENT 0 +#define TYPE_SD 1 + +#ifdef HW_RVL +#define TYPE_USB 2 +#endif + +extern int FAT_UpdateDir(int go_up); +extern int FAT_ParseDirectory(void); +extern int FAT_LoadFile(u8* buffer); +extern int FAT_Open (int type, u8 *buffer); + +#endif diff --git a/source/ngc/gui/filesel.c b/source/ngc/fileio/filesel.c similarity index 71% rename from source/ngc/gui/filesel.c rename to source/ngc/fileio/filesel.c index dc5641b..6c14f91 100644 --- a/source/ngc/gui/filesel.c +++ b/source/ngc/fileio/filesel.c @@ -1,19 +1,30 @@ -/**************************************************************************** - * ROM Selection Interface +/* + * filesel.c + * + * File Selection menu * - * The following features are implemented: - * . SDCARD access with LFN support (through softdev's VFAT library) - * . DVD access - * . easy subdirectory browsing - * . ROM browser - * . alphabetical file sorting (Marty Disibio) - * . load from history list (Marty Disibio) + * code by Softdev (2006), Eke-Eke (2007,2008) * - ***************************************************************************/ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + #include "shared.h" #include "font.h" -#include "fileio_dvd.h" -#include "fileio_fat.h" +#include "file_dvd.h" +#include "file_fat.h" #include "filesel.h" /* Global Variables */ @@ -27,6 +38,7 @@ int useHistory = 0; int haveDVDdir = 0; int haveFATdir = 0; +FILEENTRIES filelist[MAXFILES]; /*************************************************************************** * ShowFiles @@ -46,8 +58,8 @@ static void ShowFiles (int offset, int selection) memset(text,0,MAXJOLIET+2); if (filelist[i].flags) sprintf(text, "[%s]", filelist[i].filename + filelist[i].filename_offset); else sprintf (text, "%s", filelist[i].filename + filelist[i].filename_offset); - if (j == (selection - offset)) WriteCentre_HL ((j * fheight) + 120, text); - else WriteCentre ((j * fheight) + 120, text); + if (j == (selection - offset)) WriteCentre_HL ((j * fheight) + PAGEOFFSET, text); + else WriteCentre ((j * fheight) + PAGEOFFSET, text); j++; } SetScreen (); @@ -57,8 +69,11 @@ static void ShowFiles (int offset, int selection) * FileSelector * * Let user select a file from the File listing +.* ROM file buffer is provided as input + * ROM size is returned + * ****************************************************************************/ -int FileSelector() +int FileSelector(unsigned char *buffer) { short p; int redraw = 1; @@ -168,10 +183,15 @@ int FileSelector() if (filelist[selection].flags) { /* get new directory */ - ret = useFAT ? FAT_UpdateDir(go_up) : DVD_UpdateDir(go_up); + if (useFAT) ret =FAT_UpdateDir(go_up); + else ret = DVD_UpdateDir(go_up); /* get new entry list or quit */ - if (ret) maxfiles = useFAT ? FAT_ParseDirectory() : DVD_ParseDirectory(); + if (ret) + { + if (useFAT) maxfiles = FAT_ParseDirectory(); + else maxfiles = DVD_ParseDirectory(); + } else return 0; } @@ -179,16 +199,8 @@ int FileSelector() else { /* Load file */ - genromsize = useFAT ? FAT_LoadFile(cart_rom) : DVD_LoadFile(cart_rom); - if (genromsize) - { - memfile_autosave(); - reloadrom(); - memfile_autoload(); - return 1; - } - - return 0; + if (useFAT) return FAT_LoadFile(buffer); + else return DVD_LoadFile(buffer); } redraw = 1; } diff --git a/source/ngc/fileio/filesel.h b/source/ngc/fileio/filesel.h new file mode 100644 index 0000000..37441ba --- /dev/null +++ b/source/ngc/fileio/filesel.h @@ -0,0 +1,59 @@ +/* + * filesel.c + * + * File Selection menu + * + * code by Softdev (2006), Eke-Eke (2007,2008) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + +#ifndef _FILESEL_H +#define _FILESEL_H + +#define MAXJOLIET 256 +#define MAXFILES 1000 + +/* this is emulator specific ! */ +#define PAGESIZE 12 +#define PAGEOFFSET 120 + + +/* Filelist structure */ +typedef struct +{ + u64 offset; + unsigned int length; + char flags; + char filename[MAXJOLIET]; + u16 filename_offset; +}FILEENTRIES; + + +/* Global Variables */ +extern FILEENTRIES filelist[MAXFILES]; +extern int maxfiles; +extern int offset; +extern int selection; +extern int old_selection; +extern int old_offset; +extern int useFAT; +extern int haveDVDdir; +extern int haveFATdir; + +extern int FileSelector(unsigned char *buffer); + +#endif diff --git a/source/ngc/history.c b/source/ngc/fileio/history.c similarity index 72% rename from source/ngc/history.c rename to source/ngc/fileio/history.c index b240781..86f75ff 100644 --- a/source/ngc/history.c +++ b/source/ngc/fileio/history.c @@ -1,11 +1,25 @@ /* * history.c - * genplusgx-mdisibio * - * Created by Martin Disibio on 6/17/08. - * Copyright 2008 __MyCompanyName__. All rights reserved. + * Generic ROM history list managment * - */ + * code by Martin Disibio (6/17/08) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ #include "shared.h" #include "history.h" diff --git a/source/ngc/fileio/history.h b/source/ngc/fileio/history.h new file mode 100644 index 0000000..75fbff5 --- /dev/null +++ b/source/ngc/fileio/history.h @@ -0,0 +1,51 @@ +/* + * history.c + * + * Generic ROM history list managment + * + * code by Martin Disibio (6/17/08) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + +#ifndef _HISTORY_H +#define _HISTORY_H + +#include "filesel.h" + +#define NUM_HISTORY_ENTRIES (10) + +/**************************************************************************** + * ROM Play History + * + ****************************************************************************/ +typedef struct +{ + char filepath[MAXJOLIET]; + char filename[MAXJOLIET]; +} t_history_entry; + +typedef struct +{ + t_history_entry entries[NUM_HISTORY_ENTRIES]; +} t_history; + +extern t_history history; +extern void history_add_file(char *filepath, char *filename); +extern void history_load(); +extern void set_history_defaults(); + +#endif diff --git a/source/ngc/fileio.c b/source/ngc/fileio/unzip.c similarity index 66% rename from source/ngc/fileio.c rename to source/ngc/fileio/unzip.c index eaa861b..9f1bab6 100644 --- a/source/ngc/fileio.c +++ b/source/ngc/fileio/unzip.c @@ -1,16 +1,33 @@ /****************************************************************************** * - * Nintendo Gamecube Zip Support + * unzip.c * - * Only partial support is included, in that only the first file within the archive - * is considered to be a ROM image. - ***************************************************************************/ + * Zip Support + * + * Only partial support is included, in that only the first file within the archive + * is considered to be a ROM image. + * + * code by Softdev (2006), Eke-Eke (2007,2008) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + #include "shared.h" #include "dvd.h" #include "font.h" -#include "unzip.h" - -#include /* * PKWare Zip Header - adopted into zip standard @@ -72,12 +89,12 @@ int IsZipFile (char *buffer) return 0; } - /***************************************************************************** +/***************************************************************************** * UnZipBuffer * * It should be noted that there is a limit of 5MB total size for any ROM ******************************************************************************/ -int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length) +int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename) { PKZIPHEADER pkzip; int zipoffset = 0; @@ -89,9 +106,25 @@ int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length) int have = 0; char readbuffer[2048]; char msg[128]; + FILE *fatfile = NULL; + + /*** FAT file support ***/ + if (filename) + { + fatfile = fopen(filename, "rb"); + if (fatfile == NULL) return 0; + } /*** Read Zip Header ***/ - dvd_read (&readbuffer, 2048, discoffset); + if (fatfile) + { + fseek(fatfile, 0, SEEK_SET); + fread(readbuffer, 1, 2048, fatfile); + } + else + { + dvd_read (&readbuffer, 2048, discoffset); + } /*** Copy PKZip header to local, used as info ***/ memcpy (&pkzip, &readbuffer, sizeof (PKZIPHEADER)); @@ -125,7 +158,7 @@ int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length) { zs.avail_out = ZIPCHUNK; zs.next_out = (Bytef *) & out; - res = inflate (&zs, Z_NO_FLUSH); + res = inflate (&zs, Z_NO_FLUSH); if (res == Z_MEM_ERROR) { @@ -147,13 +180,23 @@ int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length) zipoffset = 0; zipchunk = ZIPCHUNK; - discoffset += 2048; - dvd_read (&readbuffer, 2048, discoffset); + if (fatfile) + { + fread(readbuffer, 1, 2048, fatfile); + } + else + { + discoffset += 2048; + dvd_read (&readbuffer, 2048, discoffset); + } } while (res != Z_STREAM_END); inflateEnd (&zs); + /* close file */ + if (fatfile) fclose(fatfile); + if (res == Z_STREAM_END) { if (FLIP32 (pkzip.uncompressedSize) == (u32) bufferoffset) return bufferoffset; @@ -163,72 +206,5 @@ int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length) return 0; } -int UnZipFAT (unsigned char *outbuffer, char *filename) -{ - unzFile *fd = NULL; - unz_file_info info; - int ret = 0; - int size; - char msg[128]; - /* Attempt to open the archive */ - fd = unzOpen(filename); - if(!fd) return (0); - - /* Go to first file in archive */ - ret = unzGoToFirstFile(fd); - if(ret != UNZ_OK) - { - unzClose(fd); - return (0); - } - - ret = unzGetCurrentFileInfo(fd, &info, NULL, 0, NULL, 0, NULL, 0); - if(ret != UNZ_OK) - { - unzClose(fd); - return (0); - } - - /* Open the file for reading */ - ret = unzOpenCurrentFile(fd); - if(ret != UNZ_OK) - { - unzClose(fd); - return (0); - } - - /* Allocate file data buffer */ - size = info.uncompressed_size; - - sprintf (msg, "Unzipping %d bytes ... Wait", size); - ShowAction (msg); - - /* Read (decompress) the file */ - ret = unzReadCurrentFile(fd, outbuffer, info.uncompressed_size); - if(ret != info.uncompressed_size) - { - unzCloseCurrentFile(fd); - unzClose(fd); - return (0); - } - - /* Close the current file */ - ret = unzCloseCurrentFile(fd); - if(ret != UNZ_OK) - { - unzClose(fd); - return (0); - } - - /* Close the archive */ - ret = unzClose(fd); - if(ret != UNZ_OK) - { - return (0); - } - - /* Update file size and return pointer to file data */ - return (size); -} diff --git a/source/ngc/fileio.h b/source/ngc/fileio/unzip.h similarity index 66% rename from source/ngc/fileio.h rename to source/ngc/fileio/unzip.h index 7044589..ae389c9 100644 --- a/source/ngc/fileio.h +++ b/source/ngc/fileio/unzip.h @@ -5,11 +5,10 @@ * Only partial support is included, in that only the first file within the archive * is considered to be a ROM image. ***************************************************************************/ -#ifndef _FILEIO_H_ -#define _FILEIO_H_ +#ifndef _UNZIP_H_ +#define _UNZIP_H_ extern int IsZipFile (char *buffer); -int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length); -int UnZipFAT (unsigned char *outbuffer, char *filename); +int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename); #endif diff --git a/source/ngc/fileio_dvd.h b/source/ngc/fileio_dvd.h deleted file mode 100644 index e37599d..0000000 --- a/source/ngc/fileio_dvd.h +++ /dev/null @@ -1,14 +0,0 @@ -/**************************************************************************** - * - * DVD ISO9660/Joliet loading support - * - ***************************************************************************/ -#ifndef _FILEIO_DVD_H -#define _FILEIO_DVD_H - -extern int DVD_UpdateDir(int go_up); -extern int DVD_ParseDirectory(); -extern int DVD_LoadFile(unsigned char* buffer); -extern int DVD_Open (); - -#endif diff --git a/source/ngc/fileio_fat.h b/source/ngc/fileio_fat.h deleted file mode 100644 index b4fbc6f..0000000 --- a/source/ngc/fileio_fat.h +++ /dev/null @@ -1,21 +0,0 @@ -/**************************************************************************** - * - * FAT loading support - * - ***************************************************************************/ -#ifndef _FILEIO_FAT_H -#define _FILEIO_FAT_H - -#define TYPE_RECENT 0 -#define TYPE_SD 1 - -#ifdef HW_RVL -#define TYPE_USB 2 -#endif - -extern int FAT_UpdateDir(int go_up); -extern int FAT_ParseDirectory(void); -extern int FAT_LoadFile(unsigned char* buffer); -extern int FAT_Open (int device); - -#endif diff --git a/source/ngc/memfile.c b/source/ngc/filemem.c similarity index 91% rename from source/ngc/memfile.c rename to source/ngc/filemem.c index 6d1aacd..22aa852 100644 --- a/source/ngc/memfile.c +++ b/source/ngc/filemem.c @@ -1,8 +1,26 @@ -/*************************************************************************** - * SDCARD/MEMCARD File support +/* + * filemem.c * + * FAT and Memory Card SRAM/Savestate files managment + * + * code by Softdev (2006), Eke-Eke (2007,2008) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ + #include "shared.h" #include "font.h" #include "saveicon.h" @@ -11,7 +29,6 @@ #include "dvd.h" #endif -#include #include /* Support for MemCards */ diff --git a/source/ngc/gcaram.c b/source/ngc/gcaram.c index 01b8cdf..695a60f 100644 --- a/source/ngc/gcaram.c +++ b/source/ngc/gcaram.c @@ -1,11 +1,27 @@ -/** - * Nintendo GameCube ARAM Wrapper for libOGC aram.c +/**************************************************************************** + * gcaram.c * - * This is an often overlooked area of ~16Mb extra RAM - * It's use in Genesis Plus is to shadow the ROM. - * Actually, only SSF2TNC needs shadowing, but it's always - * Good to know :) - */ + * ARAM wrapper for libogc + * + * code by Softdev (2006) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ***************************************************************************/ + + #include "shared.h" #define ARAMSTART 0x8000 diff --git a/source/ngc/gcaram.h b/source/ngc/gcaram.h index 72b0b6f..78e4350 100644 --- a/source/ngc/gcaram.h +++ b/source/ngc/gcaram.h @@ -1,11 +1,25 @@ -/** - * Nintendo GameCube ARAM Wrapper for libOGC aram.c +/**************************************************************************** + * gcaram.c * - * This is an often overlooked area of ~16Mb extra RAM - * It's use in Genesis Plus is to shadow the ROM. - * Actually, only SSF2TNC needs shadowing, but it's always - * Good to know :) - */ + * ARAM wrapper for libogc + * + * code by Softdev (2006) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ***************************************************************************/ #ifndef _ARAM_H #define _ARAM_H diff --git a/source/ngc/gui/filesel.h b/source/ngc/gui/filesel.h deleted file mode 100644 index d32988e..0000000 --- a/source/ngc/gui/filesel.h +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** - * ROM Selection Interface - * - ***************************************************************************/ -#ifndef _FILESEL_H -#define _FILESEL_H - -#define MAXJOLIET 256 -#define MAXFILES 1000 -#define PAGESIZE 12 - -typedef struct -{ - u64 offset; - unsigned int length; - char flags; - char filename[MAXJOLIET]; - u16 filename_offset; -}FILEENTRIES; - -FILEENTRIES filelist[MAXFILES]; - -/* Global Variables */ -extern int maxfiles; -extern int offset; -extern int selection; -extern int old_selection; -extern int old_offset; -extern int useFAT; -extern int haveDVDdir; -extern int haveFATdir; - -extern int FileSelector(); - -#endif diff --git a/source/ngc/gui/font.c b/source/ngc/gui/font.c index 8710aba..7f819ca 100644 --- a/source/ngc/gui/font.c +++ b/source/ngc/gui/font.c @@ -1,9 +1,27 @@ /***************************************************************************** - * IPL FONT Engine + * font.c * - * Based on Qoob MP3 Player Font - * Added IPL font extraction - *****************************************************************************/ + * IPL FONT Engine, based on Qoob MP3 Player Font + * + * code by Softdev (2006), Eke-Eke(2007-2008) + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + #include "shared.h" #include "gpback.h" diff --git a/source/ngc/gui/font.h b/source/ngc/gui/font.h index 8f064a8..99d2fa1 100644 --- a/source/ngc/gui/font.h +++ b/source/ngc/gui/font.h @@ -1,9 +1,27 @@ /***************************************************************************** - * IPL FONT Engine + * font.c * - * Based on Qoob MP3 Player Font - * Added IPL font extraction - *****************************************************************************/ + * IPL FONT Engine, based on Qoob MP3 Player Font + * + * code by Softdev (2006), Eke-Eke(2007-2008) + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + ********************************************************************************/ + #ifndef _FONT_H #define _FONT_H diff --git a/source/ngc/gui/ggentry.c b/source/ngc/gui/ggentry.c index d101162..ea60593 100644 --- a/source/ngc/gui/ggentry.c +++ b/source/ngc/gui/ggentry.c @@ -1,7 +1,9 @@ /**************************************************************************** - * Genesis Plus 1.2a + * ggentry.c * - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald + * Genesis Plus GX Game Genie + * + * code by Softdev (2006), Eke-Eke (2007,2008) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +19,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Nintendo Gamecube Game Genie Entry ***************************************************************************/ #include "shared.h" diff --git a/source/ngc/gui/legal.c b/source/ngc/gui/legal.c index 201a3b5..b9c3150 100644 --- a/source/ngc/gui/legal.c +++ b/source/ngc/gui/legal.c @@ -1,7 +1,9 @@ /**************************************************************************** - * Genesis Plus 1.2a + * legal.c * - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald + * generic legal informations screen + * + * code by Softdev (2006), Eke-Eke (2007,2008) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,8 +18,10 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * ***************************************************************************/ + #include "shared.h" #include "font.h" #include "dkpro.h" diff --git a/source/ngc/gui/menu.c b/source/ngc/gui/menu.c index 549b985..825bb51 100644 --- a/source/ngc/gui/menu.c +++ b/source/ngc/gui/menu.c @@ -1,7 +1,9 @@ /**************************************************************************** - * Genesis Plus 1.2a + * menu.c * - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald + * Genesis Plus GX menu + * + * code by Softdev (March 2006), Eke-Eke (2007,2008) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,15 +19,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Nintendo Gamecube Menus - * Please put any user menus here! - softdev March 12 2006 ***************************************************************************/ #include "shared.h" #include "dvd.h" #include "font.h" -#include "fileio_dvd.h" -#include "fileio_fat.h" +#include "file_dvd.h" +#include "file_fat.h" #ifdef HW_RVL #include @@ -896,10 +896,9 @@ static u8 dvd_on = 0; int loadmenu () { int prevmenu = menu; - int ret; + int ret,count,size; int quit = 0; #ifdef HW_RVL - int count = 4 + dvd_on; char item[5][25] = { {"Load Recent"}, {"Load from SD"}, @@ -908,7 +907,6 @@ int loadmenu () {"Stop DVD Motor"} }; #else - int count = 3 + dvd_on; char item[4][25] = { {"Load Recent"}, {"Load from SD"}, @@ -921,6 +919,11 @@ int loadmenu () while (quit == 0) { +#ifdef HW_RVL + count = 4 + dvd_on; +#else + count = 3 + dvd_on; +#endif strcpy (menutitle, "Press B to return"); ret = domenu (&item[0], count, 0); switch (ret) @@ -937,9 +940,14 @@ int loadmenu () case 2: #endif load_menu = menu; - if (DVD_Open()) + size = DVD_Open(cart_rom); + if (size) { dvd_on = 1; + genromsize = size; + memfile_autosave(); + reloadrom(); + memfile_autoload(); return 1; } break; @@ -952,18 +960,21 @@ int loadmenu () #endif dvd_motor_off(); dvd_on = 0; -#ifdef HW_RVL - count = 4 + dvd_on; -#else - count = 3 + dvd_on; -#endif menu = load_menu; break; /*** Load from FAT device ***/ default: load_menu = menu; - if (FAT_Open(ret)) return 1; + size = FAT_Open(ret,cart_rom); + if (size) + { + genromsize = size; + memfile_autosave(); + reloadrom(); + memfile_autoload(); + return 1; + } break; } diff --git a/source/ngc/history.h b/source/ngc/history.h deleted file mode 100644 index 4bc275c..0000000 --- a/source/ngc/history.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * history.h - * genplusgx-mdisibio - * - * Created by Martin Disibio on 6/17/08. - * - */ -#ifndef _HISTORY_H -#define _HISTORY_H - - -#include "types.h" -#include "filesel.h" - -#define NUM_HISTORY_ENTRIES (10) - -/**************************************************************************** - * ROM Play History - * - ****************************************************************************/ -typedef struct -{ - char filepath[MAXJOLIET]; - char filename[MAXJOLIET]; -} t_history_entry; - -typedef struct -{ - t_history_entry entries[NUM_HISTORY_ENTRIES]; -} t_history; - -extern t_history history; -extern void history_add_file(char *filepath, char *filename); -extern void history_load(); -extern void set_history_defaults(); - -#endif diff --git a/source/ngc/libogc_license.txt b/source/ngc/libogc_license.txt new file mode 100644 index 0000000..9d17e78 --- /dev/null +++ b/source/ngc/libogc_license.txt @@ -0,0 +1,20 @@ + Copyright (C) 2004 - 2008 + Michael Wiedenbauer (shagkur) + Dave Murphy (WinterMute) + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any + damages arising from the use of this software. + + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and + redistribute it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you use + this software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and + must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source + distribution. diff --git a/source/ngc/ngc.c b/source/ngc/ngc.c index 570e96c..efabc8f 100644 --- a/source/ngc/ngc.c +++ b/source/ngc/ngc.c @@ -1,7 +1,9 @@ /**************************************************************************** - * Genesis Plus 1.2a + * ngc.c * - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald + * Genesis Plus GX main + * + * code by Softdev (2006), Eke-Eke (2007,2008) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +18,9 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * ***************************************************************************/ + #include "shared.h" #include "gcaram.h" #include "font.h" @@ -54,7 +58,7 @@ static void load_bios() config.bios_enabled &= ~2; /* open file */ - sprintf (pathname, "%s/BIOS.bin", DEFAULT_PATH); + sprintf (pathname, "%s/BIOS.bin",DEFAULT_PATH); FILE *fp = fopen(pathname, "rb"); if (fp == NULL) return; diff --git a/source/ngc/ogc_audio.c b/source/ngc/ogc_audio.c index a85d9b2..3fc4adb 100644 --- a/source/ngc/ogc_audio.c +++ b/source/ngc/ogc_audio.c @@ -1,26 +1,27 @@ -/****************************************************************************** +/**************************************************************************** + * ogc_video.c * - * Genesis Plus - Sega Megadrive / Genesis Emulator + * Genesis Plus GX audio support * - * NGC/Wii Audio support + * code by Softdev (2006), Eke-Eke (2007,2008) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ #include "shared.h" -#include "ogc_input.h" /* global datas */ unsigned char soundbuffer[16][3840] ATTRIBUTE_ALIGN(32); diff --git a/source/ngc/ogc_audio.h b/source/ngc/ogc_audio.h index c6fdac0..4253895 100644 --- a/source/ngc/ogc_audio.h +++ b/source/ngc/ogc_audio.h @@ -1,23 +1,26 @@ -/****************************************************************************** +/**************************************************************************** + * ogc_video.c * - * SMS Plus - Sega Master System / GameGear Emulator + * Genesis Plus GX audio support * - * NGC/Wii Audio support + * code by Softdev (2006), Eke-Eke (2007,2008) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ + #ifndef _GC_AUDIO_H_ #define _GC_AUDIO_H_ diff --git a/source/ngc/ogc_input.c b/source/ngc/ogc_input.c index b016a0d..5f85c1d 100644 --- a/source/ngc/ogc_input.c +++ b/source/ngc/ogc_input.c @@ -1,22 +1,24 @@ -/****************************************************************************** +/**************************************************************************** + * ogc_input.c * - * SMS Plus GX - Sega Master System / GameGear Emulator + * Genesis Plus GX input support * - * SMS Plus - Sega Master System / GameGear Emulator + * code by Eke-Eke (2008) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ #include "shared.h" diff --git a/source/ngc/ogc_input.h b/source/ngc/ogc_input.h index f71b394..c57aaa1 100644 --- a/source/ngc/ogc_input.h +++ b/source/ngc/ogc_input.h @@ -1,23 +1,27 @@ -/****************************************************************************** +/**************************************************************************** + * ogc_input.c * - * SMS Plus - Sega Master System / GameGear Emulator + * Genesis Plus GX input support * - * NGC/Wii Controller support + * code by Eke-Eke (2008) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ + + #ifndef _GC_INPUT_H_ #define _GC_INPUT_H_ diff --git a/source/ngc/ogc_video.c b/source/ngc/ogc_video.c index 7563031..c706491 100644 --- a/source/ngc/ogc_video.c +++ b/source/ngc/ogc_video.c @@ -1,24 +1,27 @@ -/****************************************************************************** +/**************************************************************************** + * ogc_video.c * - * Genesis Plus - Sega Megadrive / Genesis Emulator + * Genesis Plus GX video support * - * NGC/Wii Video support + * code by Softdev (2006), Eke-Eke (2007,2008) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ + #include "shared.h" #include "font.h" #include "gcaram.h" diff --git a/source/ngc/ogc_video.h b/source/ngc/ogc_video.h index 9caa04b..1425dd1 100644 --- a/source/ngc/ogc_video.h +++ b/source/ngc/ogc_video.h @@ -1,23 +1,26 @@ -/****************************************************************************** +/**************************************************************************** + * ogc_video.c * - * SMS Plus - Sega Master System / GameGear Emulator + * Genesis Plus GX video support * - * NGC/Wii Video support + * code by Softdev (2006), Eke-Eke (2007,2008) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ + #ifndef _GC_VIDEO_H_ #define _GC_VIDEO_H_ diff --git a/source/ngc/osd.h b/source/ngc/osd.h index 320fe8b..b095b9e 100644 --- a/source/ngc/osd.h +++ b/source/ngc/osd.h @@ -16,12 +16,11 @@ #include "ogc_audio.h" #include "ogc_video.h" #include "config.h" -#include "history.h" - -#define DEFAULT_PATH "/genplus" #define update_input() ogc_input__update() +#define DEFAULT_PATH "/genplus" + /* globals */ extern u32 diff_usec(long long start,long long end); extern long long gettime(); @@ -35,9 +34,6 @@ extern void MainMenu(); extern void set_region(); extern int ManageSRAM(u8 direction, u8 device); extern int ManageState(u8 direction, u8 device); -extern int OpenDVD(); -extern int OpenFAT(char *name); -extern int OpenHistory(); extern void memfile_autosave(); extern void memfile_autoload(); diff --git a/source/ntsc/md_ntsc.c b/source/ntsc/md_ntsc.c index 1a01df0..43a8cfc 100644 --- a/source/ntsc/md_ntsc.c +++ b/source/ntsc/md_ntsc.c @@ -38,65 +38,65 @@ md_ntsc_setup_t const md_ntsc_rgb = { 0, 0, 0, 0,.2, 0,.7, -1, -1,-1, 0, /* 2 input pixels -> 4 composite samples */ pixel_info_t const md_ntsc_pixels [alignment_count] = { - { PIXEL_OFFSET( -4, -9 ), { 0.1f, 0.9f, 0.9f, 0.1f } }, - { PIXEL_OFFSET( -2, -7 ), { 0.1f, 0.9f, 0.9f, 0.1f } }, + { PIXEL_OFFSET( -4, -9 ), { 0.1f, 0.9f, 0.9f, 0.1f } }, + { PIXEL_OFFSET( -2, -7 ), { 0.1f, 0.9f, 0.9f, 0.1f } }, }; static void correct_errors( md_ntsc_rgb_t color, md_ntsc_rgb_t* out ) { - unsigned i; - for ( i = 0; i < rgb_kernel_size / 4; i++ ) - { - md_ntsc_rgb_t error = color - - out [i ] - out [i + 2 +16] - out [i + 4 ] - out [i + 6 +16] - - out [i + 8] - out [(i+10)%16+16] - out [(i+12)%16] - out [(i+14)%16+16]; - CORRECT_ERROR( i + 6 + 16 ); - /*DISTRIBUTE_ERROR( 2+16, 4, 6+16 );*/ - } + unsigned i; + for ( i = 0; i < rgb_kernel_size / 4; i++ ) + { + md_ntsc_rgb_t error = color - + out [i ] - out [i + 2 +16] - out [i + 4 ] - out [i + 6 +16] - + out [i + 8] - out [(i+10)%16+16] - out [(i+12)%16] - out [(i+14)%16+16]; + CORRECT_ERROR( i + 6 + 16 ); + /*DISTRIBUTE_ERROR( 2+16, 4, 6+16 );*/ + } } void md_ntsc_init( md_ntsc_t* ntsc, md_ntsc_setup_t const* setup ) { - int entry; - init_t impl; - if ( !setup ) - setup = &md_ntsc_composite; - init( &impl, setup ); + int entry; + init_t impl; + if ( !setup ) + setup = &md_ntsc_composite; + init( &impl, setup ); - for ( entry = 0; entry < md_ntsc_palette_size; entry++ ) - { - float bb = impl.to_float [entry >> 6 & 7]; - float gg = impl.to_float [entry >> 3 & 7]; - float rr = impl.to_float [entry & 7]; + for ( entry = 0; entry < md_ntsc_palette_size; entry++ ) + { + float bb = impl.to_float [entry >> 6 & 7]; + float gg = impl.to_float [entry >> 3 & 7]; + float rr = impl.to_float [entry & 7]; - float y, i, q = RGB_TO_YIQ( rr, gg, bb, y, i ); + float y, i, q = RGB_TO_YIQ( rr, gg, bb, y, i ); - int r, g, b = YIQ_TO_RGB( y, i, q, impl.to_rgb, int, r, g ); - md_ntsc_rgb_t rgb = PACK_RGB( r, g, b ); + int r, g, b = YIQ_TO_RGB( y, i, q, impl.to_rgb, int, r, g ); + md_ntsc_rgb_t rgb = PACK_RGB( r, g, b ); - if ( setup->palette_out ) - RGB_PALETTE_OUT( rgb, &setup->palette_out [entry * 3] ); + if ( setup->palette_out ) + RGB_PALETTE_OUT( rgb, &setup->palette_out [entry * 3] ); - if ( ntsc ) - { - gen_kernel( &impl, y, i, q, ntsc->table [entry] ); - correct_errors( rgb, ntsc->table [entry] ); - } - } + if ( ntsc ) + { + gen_kernel( &impl, y, i, q, ntsc->table [entry] ); + correct_errors( rgb, ntsc->table [entry] ); + } + } } #ifndef MD_NTSC_NO_BLITTERS /* modified blitters to work on a line basis with genesis plus renderer*/ void md_ntsc_blit( md_ntsc_t const* ntsc, MD_NTSC_IN_T const* table, unsigned char* input, - int in_width, int vline) + int in_width, int vline) { - int const chunk_count = in_width / md_ntsc_in_chunk - 1; + int const chunk_count = in_width / md_ntsc_in_chunk - 1; MD_NTSC_IN_T border = table[0]; - MD_NTSC_BEGIN_ROW( ntsc, border, - MD_NTSC_ADJ_IN( table[*input++] ), - MD_NTSC_ADJ_IN( table[*input++] ), - MD_NTSC_ADJ_IN( table[*input++] ) ); + MD_NTSC_BEGIN_ROW( ntsc, border, + MD_NTSC_ADJ_IN( table[*input++] ), + MD_NTSC_ADJ_IN( table[*input++] ), + MD_NTSC_ADJ_IN( table[*input++] ) ); #ifdef NGC /* directly fill the RGB565 texture */ @@ -112,52 +112,52 @@ void md_ntsc_blit( md_ntsc_t const* ntsc, MD_NTSC_IN_T const* table, unsigned ch int n; for ( n = chunk_count; n; --n ) - { - /* order of input and output pixels must not be altered */ - MD_NTSC_COLOR_IN( 0, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); - MD_NTSC_RGB_OUT( 0, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_RGB_OUT( 1, *line_out++, MD_NTSC_OUT_DEPTH ); + { + /* order of input and output pixels must not be altered */ + MD_NTSC_COLOR_IN( 0, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); + MD_NTSC_RGB_OUT( 0, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 1, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_COLOR_IN( 1, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); - MD_NTSC_RGB_OUT( 2, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_RGB_OUT( 3, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_COLOR_IN( 1, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); + MD_NTSC_RGB_OUT( 2, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 3, *line_out++, MD_NTSC_OUT_DEPTH ); #ifdef NGC line_out += 12; #endif - MD_NTSC_COLOR_IN( 2, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); - MD_NTSC_RGB_OUT( 4, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_RGB_OUT( 5, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_COLOR_IN( 2, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); + MD_NTSC_RGB_OUT( 4, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 5, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_COLOR_IN( 3, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); - MD_NTSC_RGB_OUT( 6, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_RGB_OUT( 7, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_COLOR_IN( 3, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); + MD_NTSC_RGB_OUT( 6, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 7, *line_out++, MD_NTSC_OUT_DEPTH ); #ifdef NGC line_out += 12; #endif } - /* finish final pixels */ - MD_NTSC_COLOR_IN( 0, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); - MD_NTSC_RGB_OUT( 0, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_RGB_OUT( 1, *line_out++, MD_NTSC_OUT_DEPTH ); + /* finish final pixels */ + MD_NTSC_COLOR_IN( 0, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) ); + MD_NTSC_RGB_OUT( 0, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 1, *line_out++, MD_NTSC_OUT_DEPTH ); MD_NTSC_COLOR_IN( 1, ntsc, border ); - MD_NTSC_RGB_OUT( 2, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_RGB_OUT( 3, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 2, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 3, *line_out++, MD_NTSC_OUT_DEPTH ); #ifdef NGC line_out += 12; #endif MD_NTSC_COLOR_IN( 2, ntsc, border ); - MD_NTSC_RGB_OUT( 4, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_RGB_OUT( 5, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 4, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 5, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_COLOR_IN( 3, ntsc, border ); - MD_NTSC_RGB_OUT( 6, *line_out++, MD_NTSC_OUT_DEPTH ); - MD_NTSC_RGB_OUT( 7, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_COLOR_IN( 3, ntsc, border ); + MD_NTSC_RGB_OUT( 6, *line_out++, MD_NTSC_OUT_DEPTH ); + MD_NTSC_RGB_OUT( 7, *line_out++, MD_NTSC_OUT_DEPTH ); } #endif diff --git a/source/ntsc/md_ntsc.h b/source/ntsc/md_ntsc.h index d30defa..dd2b09b 100644 --- a/source/ntsc/md_ntsc.h +++ b/source/ntsc/md_ntsc.h @@ -7,29 +7,29 @@ #include "md_ntsc_config.h" #ifdef __cplusplus - extern "C" { + extern "C" { #endif /* Image parameters, ranging from -1.0 to 1.0. Actual internal values shown in parenthesis and should remain fairly stable in future versions. */ typedef struct md_ntsc_setup_t { - /* Basic parameters */ - double hue; /* -1 = -180 degrees +1 = +180 degrees */ - double saturation; /* -1 = grayscale (0.0) +1 = oversaturated colors (2.0) */ - double contrast; /* -1 = dark (0.5) +1 = light (1.5) */ - double brightness; /* -1 = dark (0.5) +1 = light (1.5) */ - double sharpness; /* edge contrast enhancement/blurring */ + /* Basic parameters */ + double hue; /* -1 = -180 degrees +1 = +180 degrees */ + double saturation; /* -1 = grayscale (0.0) +1 = oversaturated colors (2.0) */ + double contrast; /* -1 = dark (0.5) +1 = light (1.5) */ + double brightness; /* -1 = dark (0.5) +1 = light (1.5) */ + double sharpness; /* edge contrast enhancement/blurring */ - /* Advanced parameters */ - double gamma; /* -1 = dark (1.5) +1 = light (0.5) */ - double resolution; /* image resolution */ - double artifacts; /* artifacts caused by color changes */ - double fringing; /* color artifacts caused by brightness changes */ - double bleed; /* color bleed (color resolution reduction) */ - float const* decoder_matrix; /* optional RGB decoder matrix, 6 elements */ + /* Advanced parameters */ + double gamma; /* -1 = dark (1.5) +1 = light (0.5) */ + double resolution; /* image resolution */ + double artifacts; /* artifacts caused by color changes */ + double fringing; /* color artifacts caused by brightness changes */ + double bleed; /* color bleed (color resolution reduction) */ + float const* decoder_matrix; /* optional RGB decoder matrix, 6 elements */ - unsigned char* palette_out; /* optional RGB palette out, 3 bytes per color */ + unsigned char* palette_out; /* optional RGB palette out, 3 bytes per color */ } md_ntsc_setup_t; /* Video format presets */ @@ -50,17 +50,17 @@ and output RGB depth is set by MD_NTSC_OUT_DEPTH. Both default to 16-bit RGB. In_row_width is the number of pixels to get to the next input row. Out_pitch is the number of *bytes* to get to the next output row. */ void md_ntsc_blit( md_ntsc_t const* ntsc, MD_NTSC_IN_T const* table, unsigned char* input, - int in_width, int vline); + int in_width, int vline); /* Number of output pixels written by blitter for given input width. */ #define MD_NTSC_OUT_WIDTH( in_width ) \ - (((in_width) - 3) / md_ntsc_in_chunk * md_ntsc_out_chunk + md_ntsc_out_chunk) + (((in_width) - 3) / md_ntsc_in_chunk * md_ntsc_out_chunk + md_ntsc_out_chunk) /* Number of input pixels that will fit within given output width. Might be rounded down slightly; use MD_NTSC_OUT_WIDTH() on result to find rounded value. */ #define MD_NTSC_IN_WIDTH( out_width ) \ - ((out_width) / md_ntsc_out_chunk * md_ntsc_in_chunk - md_ntsc_in_chunk + 3) + ((out_width) / md_ntsc_out_chunk * md_ntsc_in_chunk - md_ntsc_in_chunk + 3) /* Interface for user-defined custom blitters */ @@ -73,22 +73,22 @@ enum { md_ntsc_black = 0 }; /* palette index for black */ Use md_ntsc_black for unused pixels. Declares variables, so must be before first statement in a block (unless you're using C++). */ #define MD_NTSC_BEGIN_ROW( ntsc, pixel0, pixel1, pixel2, pixel3 ) \ - unsigned const md_pixel0_ = (pixel0);\ - md_ntsc_rgb_t const* kernel0 = MD_NTSC_IN_FORMAT( ntsc, md_pixel0_ );\ - unsigned const md_pixel1_ = (pixel1);\ - md_ntsc_rgb_t const* kernel1 = MD_NTSC_IN_FORMAT( ntsc, md_pixel1_ );\ - unsigned const md_pixel2_ = (pixel2);\ - md_ntsc_rgb_t const* kernel2 = MD_NTSC_IN_FORMAT( ntsc, md_pixel2_ );\ - unsigned const md_pixel3_ = (pixel3);\ - md_ntsc_rgb_t const* kernel3 = MD_NTSC_IN_FORMAT( ntsc, md_pixel3_ );\ - md_ntsc_rgb_t const* kernelx0;\ - md_ntsc_rgb_t const* kernelx1 = kernel0;\ - md_ntsc_rgb_t const* kernelx2 = kernel0;\ - md_ntsc_rgb_t const* kernelx3 = kernel0 + unsigned const md_pixel0_ = (pixel0);\ + md_ntsc_rgb_t const* kernel0 = MD_NTSC_IN_FORMAT( ntsc, md_pixel0_ );\ + unsigned const md_pixel1_ = (pixel1);\ + md_ntsc_rgb_t const* kernel1 = MD_NTSC_IN_FORMAT( ntsc, md_pixel1_ );\ + unsigned const md_pixel2_ = (pixel2);\ + md_ntsc_rgb_t const* kernel2 = MD_NTSC_IN_FORMAT( ntsc, md_pixel2_ );\ + unsigned const md_pixel3_ = (pixel3);\ + md_ntsc_rgb_t const* kernel3 = MD_NTSC_IN_FORMAT( ntsc, md_pixel3_ );\ + md_ntsc_rgb_t const* kernelx0;\ + md_ntsc_rgb_t const* kernelx1 = kernel0;\ + md_ntsc_rgb_t const* kernelx2 = kernel0;\ + md_ntsc_rgb_t const* kernelx3 = kernel0 /* Begin input pixel */ #define MD_NTSC_COLOR_IN( index, ntsc, color ) \ - MD_NTSC_COLOR_IN_( index, color, MD_NTSC_IN_FORMAT, ntsc ) + MD_NTSC_COLOR_IN_( index, color, MD_NTSC_IN_FORMAT, ntsc ) /* Generate output pixel. Bits can be 24, 16, 15, 32 (treated as 24), or 0: 24: RRRRRRRR GGGGGGGG BBBBBBBB @@ -96,11 +96,11 @@ statement in a block (unless you're using C++). */ 15: RRRRRGG GGGBBBBB 0: xxxRRRRR RRRxxGGG GGGGGxxB BBBBBBBx (native internal format; x = junk bits) */ #define MD_NTSC_RGB_OUT( x, rgb_out, bits ) {\ - md_ntsc_rgb_t raw_ =\ - kernel0 [x+ 0] + kernel1 [(x+6)%8+16] + kernel2 [(x+4)%8 ] + kernel3 [(x+2)%8+16] +\ - kernelx0 [x+ 8] + kernelx1 [(x+6)%8+24] + kernelx2 [(x+4)%8+8] + kernelx3 [(x+2)%8+24];\ - MD_NTSC_CLAMP_( raw_, 0 );\ - MD_NTSC_RGB_OUT_( rgb_out, bits, 0 );\ + md_ntsc_rgb_t raw_ =\ + kernel0 [x+ 0] + kernel1 [(x+6)%8+16] + kernel2 [(x+4)%8 ] + kernel3 [(x+2)%8+16] +\ + kernelx0 [x+ 8] + kernelx1 [(x+6)%8+24] + kernelx2 [(x+4)%8+8] + kernelx3 [(x+2)%8+24];\ + MD_NTSC_CLAMP_( raw_, 0 );\ + MD_NTSC_RGB_OUT_( rgb_out, bits, 0 );\ } @@ -108,41 +108,41 @@ statement in a block (unless you're using C++). */ enum { md_ntsc_entry_size = 2 * 16 }; typedef unsigned long md_ntsc_rgb_t; struct md_ntsc_t { - md_ntsc_rgb_t table [md_ntsc_palette_size] [md_ntsc_entry_size]; + md_ntsc_rgb_t table [md_ntsc_palette_size] [md_ntsc_entry_size]; }; #define MD_NTSC_BGR9( ntsc, n ) (ntsc)->table [n & 0x1FF] #define MD_NTSC_RGB16( ntsc, n ) \ - (md_ntsc_rgb_t*) ((char*) (ntsc)->table +\ - ((n << 9 & 0x3800) | (n & 0x0700) | (n >> 8 & 0x00E0)) *\ - (md_ntsc_entry_size * sizeof (md_ntsc_rgb_t) / 32)) + (md_ntsc_rgb_t*) ((char*) (ntsc)->table +\ + ((n << 9 & 0x3800) | (n & 0x0700) | (n >> 8 & 0x00E0)) *\ + (md_ntsc_entry_size * sizeof (md_ntsc_rgb_t) / 32)) /* common ntsc macros */ #define md_ntsc_rgb_builder ((1L << 21) | (1 << 11) | (1 << 1)) #define md_ntsc_clamp_mask (md_ntsc_rgb_builder * 3 / 2) #define md_ntsc_clamp_add (md_ntsc_rgb_builder * 0x101) #define MD_NTSC_CLAMP_( io, shift ) {\ - md_ntsc_rgb_t sub = (io) >> (9-(shift)) & md_ntsc_clamp_mask;\ - md_ntsc_rgb_t clamp = md_ntsc_clamp_add - sub;\ - io |= clamp;\ - clamp -= sub;\ - io &= clamp;\ + md_ntsc_rgb_t sub = (io) >> (9-(shift)) & md_ntsc_clamp_mask;\ + md_ntsc_rgb_t clamp = md_ntsc_clamp_add - sub;\ + io |= clamp;\ + clamp -= sub;\ + io &= clamp;\ } #define MD_NTSC_COLOR_IN_( index, color, ENTRY, table ) {\ - unsigned color_;\ - kernelx##index = kernel##index;\ - kernel##index = (color_ = (color), ENTRY( table, color_ ));\ + unsigned color_;\ + kernelx##index = kernel##index;\ + kernel##index = (color_ = (color), ENTRY( table, color_ ));\ } /* x is always zero except in snes_ntsc library */ #define MD_NTSC_RGB_OUT_( rgb_out, bits, x ) {\ - rgb_out = (raw_>>(13-x)& 0xF800)|(raw_>>(8-x)&0x07E0)|(raw_>>(4-x)&0x001F);\ + rgb_out = (raw_>>(13-x)& 0xF800)|(raw_>>(8-x)&0x07E0)|(raw_>>(4-x)&0x001F);\ } #ifdef __cplusplus - } +} #endif #endif diff --git a/source/ntsc/md_ntsc_impl.h b/source/ntsc/md_ntsc_impl.h index dab51b0..76f05a2 100644 --- a/source/ntsc/md_ntsc_impl.h +++ b/source/ntsc/md_ntsc_impl.h @@ -22,22 +22,22 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #define PI 3.14159265358979323846f #ifndef LUMA_CUTOFF - #define LUMA_CUTOFF 0.20 + #define LUMA_CUTOFF 0.20 #endif #ifndef gamma_size - #define gamma_size 1 + #define gamma_size 1 #endif #ifndef rgb_bits - #define rgb_bits 8 + #define rgb_bits 8 #endif #ifndef artifacts_max - #define artifacts_max (artifacts_mid * 1.5f) + #define artifacts_max (artifacts_mid * 1.5f) #endif #ifndef fringing_max - #define fringing_max (fringing_mid * 2) + #define fringing_max (fringing_mid * 2) #endif #ifndef STD_HUE_CONDITION - #define STD_HUE_CONDITION( setup ) 1 + #define STD_HUE_CONDITION( setup ) 1 #endif #define ext_decoder_hue (std_decoder_hue + 15) @@ -50,236 +50,236 @@ enum { kernel_size = kernel_half * 2 + 1 }; typedef struct init_t { - float to_rgb [burst_count * 6]; - float to_float [gamma_size]; - float contrast; - float brightness; - float artifacts; - float fringing; - float kernel [rescale_out * kernel_size * 2]; + float to_rgb [burst_count * 6]; + float to_float [gamma_size]; + float contrast; + float brightness; + float artifacts; + float fringing; + float kernel [rescale_out * kernel_size * 2]; } init_t; #define ROTATE_IQ( i, q, sin_b, cos_b ) {\ - float t;\ - t = i * cos_b - q * sin_b;\ - q = i * sin_b + q * cos_b;\ - i = t;\ + float t;\ + t = i * cos_b - q * sin_b;\ + q = i * sin_b + q * cos_b;\ + i = t;\ } static void init_filters( init_t* impl, md_ntsc_setup_t const* setup ) { #if rescale_out > 1 - float kernels [kernel_size * 2]; + float kernels [kernel_size * 2]; #else - float* const kernels = impl->kernel; + float* const kernels = impl->kernel; #endif - /* generate luma (y) filter using sinc kernel */ - { - /* sinc with rolloff (dsf) */ - float const rolloff = 1 + (float) setup->sharpness * (float) 0.032; - float const maxh = 32; - float const pow_a_n = (float) pow( rolloff, maxh ); - float sum; - int i; - /* quadratic mapping to reduce negative (blurring) range */ - float to_angle = (float) setup->resolution + 1; - to_angle = PI / maxh * (float) LUMA_CUTOFF * (to_angle * to_angle + 1); + /* generate luma (y) filter using sinc kernel */ + { + /* sinc with rolloff (dsf) */ + float const rolloff = 1 + (float) setup->sharpness * (float) 0.032; + float const maxh = 32; + float const pow_a_n = (float) pow( rolloff, maxh ); + float sum; + int i; + /* quadratic mapping to reduce negative (blurring) range */ + float to_angle = (float) setup->resolution + 1; + to_angle = PI / maxh * (float) LUMA_CUTOFF * (to_angle * to_angle + 1); - kernels [kernel_size * 3 / 2] = maxh; /* default center value */ - for ( i = 0; i < kernel_half * 2 + 1; i++ ) - { - int x = i - kernel_half; - float angle = x * to_angle; - /* instability occurs at center point with rolloff very close to 1.0 */ - if ( x || pow_a_n > (float) 1.056 || pow_a_n < (float) 0.981 ) - { - float rolloff_cos_a = rolloff * (float) cos( angle ); - float num = 1 - rolloff_cos_a - - pow_a_n * (float) cos( maxh * angle ) + - pow_a_n * rolloff * (float) cos( (maxh - 1) * angle ); - float den = 1 - rolloff_cos_a - rolloff_cos_a + rolloff * rolloff; - float dsf = num / den; - kernels [kernel_size * 3 / 2 - kernel_half + i] = dsf - (float) 0.5; - } - } + kernels [kernel_size * 3 / 2] = maxh; /* default center value */ + for ( i = 0; i < kernel_half * 2 + 1; i++ ) + { + int x = i - kernel_half; + float angle = x * to_angle; + /* instability occurs at center point with rolloff very close to 1.0 */ + if ( x || pow_a_n > (float) 1.056 || pow_a_n < (float) 0.981 ) + { + float rolloff_cos_a = rolloff * (float) cos( angle ); + float num = 1 - rolloff_cos_a - + pow_a_n * (float) cos( maxh * angle ) + + pow_a_n * rolloff * (float) cos( (maxh - 1) * angle ); + float den = 1 - rolloff_cos_a - rolloff_cos_a + rolloff * rolloff; + float dsf = num / den; + kernels [kernel_size * 3 / 2 - kernel_half + i] = dsf - (float) 0.5; + } + } - /* apply blackman window and find sum */ - sum = 0; - for ( i = 0; i < kernel_half * 2 + 1; i++ ) - { - float x = PI * 2 / (kernel_half * 2) * i; - float blackman = 0.42f - 0.5f * (float) cos( x ) + 0.08f * (float) cos( x * 2 ); - sum += (kernels [kernel_size * 3 / 2 - kernel_half + i] *= blackman); - } + /* apply blackman window and find sum */ + sum = 0; + for ( i = 0; i < kernel_half * 2 + 1; i++ ) + { + float x = PI * 2 / (kernel_half * 2) * i; + float blackman = 0.42f - 0.5f * (float) cos( x ) + 0.08f * (float) cos( x * 2 ); + sum += (kernels [kernel_size * 3 / 2 - kernel_half + i] *= blackman); + } - /* normalize kernel */ - sum = 1.0f / sum; - for ( i = 0; i < kernel_half * 2 + 1; i++ ) - { - int x = kernel_size * 3 / 2 - kernel_half + i; - kernels [x] *= sum; - assert( kernels [x] == kernels [x] ); /* catch numerical instability */ - } - } + /* normalize kernel */ + sum = 1.0f / sum; + for ( i = 0; i < kernel_half * 2 + 1; i++ ) + { + int x = kernel_size * 3 / 2 - kernel_half + i; + kernels [x] *= sum; + assert( kernels [x] == kernels [x] ); /* catch numerical instability */ + } + } - /* generate chroma (iq) filter using gaussian kernel */ - { - float const cutoff_factor = -0.03125f; - float cutoff = (float) setup->bleed; - int i; + /* generate chroma (iq) filter using gaussian kernel */ + { + float const cutoff_factor = -0.03125f; + float cutoff = (float) setup->bleed; + int i; - if ( cutoff < 0 ) - { - /* keep extreme value accessible only near upper end of scale (1.0) */ - cutoff *= cutoff; - cutoff *= cutoff; - cutoff *= cutoff; - cutoff *= -30.0f / 0.65f; - } - cutoff = cutoff_factor - 0.65f * cutoff_factor * cutoff; + if ( cutoff < 0 ) + { + /* keep extreme value accessible only near upper end of scale (1.0) */ + cutoff *= cutoff; + cutoff *= cutoff; + cutoff *= cutoff; + cutoff *= -30.0f / 0.65f; + } + cutoff = cutoff_factor - 0.65f * cutoff_factor * cutoff; - for ( i = -kernel_half; i <= kernel_half; i++ ) - kernels [kernel_size / 2 + i] = (float) exp( i * i * cutoff ); + for ( i = -kernel_half; i <= kernel_half; i++ ) + kernels [kernel_size / 2 + i] = (float) exp( i * i * cutoff ); - /* normalize even and odd phases separately */ - for ( i = 0; i < 2; i++ ) - { - float sum = 0; - int x; - for ( x = i; x < kernel_size; x += 2 ) - sum += kernels [x]; + /* normalize even and odd phases separately */ + for ( i = 0; i < 2; i++ ) + { + float sum = 0; + int x; + for ( x = i; x < kernel_size; x += 2 ) + sum += kernels [x]; - sum = 1.0f / sum; - for ( x = i; x < kernel_size; x += 2 ) - { - kernels [x] *= sum; - assert( kernels [x] == kernels [x] ); /* catch numerical instability */ - } - } - } + sum = 1.0f / sum; + for ( x = i; x < kernel_size; x += 2 ) + { + kernels [x] *= sum; + assert( kernels [x] == kernels [x] ); /* catch numerical instability */ + } + } + } - /* - printf( "luma:\n" ); - for ( i = kernel_size; i < kernel_size * 2; i++ ) - printf( "%f\n", kernels [i] ); - printf( "chroma:\n" ); - for ( i = 0; i < kernel_size; i++ ) - printf( "%f\n", kernels [i] ); - */ + /* + printf( "luma:\n" ); + for ( i = kernel_size; i < kernel_size * 2; i++ ) + printf( "%f\n", kernels [i] ); + printf( "chroma:\n" ); + for ( i = 0; i < kernel_size; i++ ) + printf( "%f\n", kernels [i] ); + */ - /* generate linear rescale kernels */ - #if rescale_out > 1 - { - float weight = 1.0f; - float* out = impl->kernel; - int n = rescale_out; - do - { - float remain = 0; - int i; - weight -= 1.0f / rescale_in; - for ( i = 0; i < kernel_size * 2; i++ ) - { - float cur = kernels [i]; - float m = cur * weight; - *out++ = m + remain; - remain = cur - m; - } - } - while ( --n ); - } - #endif + /* generate linear rescale kernels */ + #if rescale_out > 1 + { + float weight = 1.0f; + float* out = impl->kernel; + int n = rescale_out; + do + { + float remain = 0; + int i; + weight -= 1.0f / rescale_in; + for ( i = 0; i < kernel_size * 2; i++ ) + { + float cur = kernels [i]; + float m = cur * weight; + *out++ = m + remain; + remain = cur - m; + } + } + while ( --n ); + } + #endif } static float const default_decoder [6] = - { 0.956f, 0.621f, -0.272f, -0.647f, -1.105f, 1.702f }; + { 0.956f, 0.621f, -0.272f, -0.647f, -1.105f, 1.702f }; static void init( init_t* impl, md_ntsc_setup_t const* setup ) { - impl->brightness = (float) setup->brightness * (0.5f * rgb_unit) + rgb_offset; - impl->contrast = (float) setup->contrast * (0.5f * rgb_unit) + rgb_unit; - #ifdef default_palette_contrast - if ( !setup->palette ) - impl->contrast *= default_palette_contrast; - #endif + impl->brightness = (float) setup->brightness * (0.5f * rgb_unit) + rgb_offset; + impl->contrast = (float) setup->contrast * (0.5f * rgb_unit) + rgb_unit; + #ifdef default_palette_contrast + if ( !setup->palette ) + impl->contrast *= default_palette_contrast; + #endif - impl->artifacts = (float) setup->artifacts; - if ( impl->artifacts > 0 ) - impl->artifacts *= artifacts_max - artifacts_mid; - impl->artifacts = impl->artifacts * artifacts_mid + artifacts_mid; + impl->artifacts = (float) setup->artifacts; + if ( impl->artifacts > 0 ) + impl->artifacts *= artifacts_max - artifacts_mid; + impl->artifacts = impl->artifacts * artifacts_mid + artifacts_mid; - impl->fringing = (float) setup->fringing; - if ( impl->fringing > 0 ) - impl->fringing *= fringing_max - fringing_mid; - impl->fringing = impl->fringing * fringing_mid + fringing_mid; + impl->fringing = (float) setup->fringing; + if ( impl->fringing > 0 ) + impl->fringing *= fringing_max - fringing_mid; + impl->fringing = impl->fringing * fringing_mid + fringing_mid; - init_filters( impl, setup ); + init_filters( impl, setup ); - /* generate gamma table */ - if ( gamma_size > 1 ) - { - float const to_float = 1.0f / (gamma_size - (gamma_size > 1)); - float const gamma = 1.1333f - (float) setup->gamma * 0.5f; - /* match common PC's 2.2 gamma to TV's 2.65 gamma */ - int i; - for ( i = 0; i < gamma_size; i++ ) - impl->to_float [i] = - (float) pow( i * to_float, gamma ) * impl->contrast + impl->brightness; - } + /* generate gamma table */ + if ( gamma_size > 1 ) + { + float const to_float = 1.0f / (gamma_size - (gamma_size > 1)); + float const gamma = 1.1333f - (float) setup->gamma * 0.5f; + /* match common PC's 2.2 gamma to TV's 2.65 gamma */ + int i; + for ( i = 0; i < gamma_size; i++ ) + impl->to_float [i] = + (float) pow( i * to_float, gamma ) * impl->contrast + impl->brightness; + } - /* setup decoder matricies */ - { - float hue = (float) setup->hue * PI + PI / 180 * ext_decoder_hue; - float sat = (float) setup->saturation + 1; - float const* decoder = setup->decoder_matrix; - if ( !decoder ) - { - decoder = default_decoder; - if ( STD_HUE_CONDITION( setup ) ) - hue += PI / 180 * (std_decoder_hue - ext_decoder_hue); - } + /* setup decoder matricies */ + { + float hue = (float) setup->hue * PI + PI / 180 * ext_decoder_hue; + float sat = (float) setup->saturation + 1; + float const* decoder = setup->decoder_matrix; + if ( !decoder ) + { + decoder = default_decoder; + if ( STD_HUE_CONDITION( setup ) ) + hue += PI / 180 * (std_decoder_hue - ext_decoder_hue); + } - { - float s = (float) sin( hue ) * sat; - float c = (float) cos( hue ) * sat; - float* out = impl->to_rgb; - int n; + { + float s = (float) sin( hue ) * sat; + float c = (float) cos( hue ) * sat; + float* out = impl->to_rgb; + int n; - n = burst_count; - do - { - float const* in = decoder; - int n = 3; - do - { - float i = *in++; - float q = *in++; - *out++ = i * c - q * s; - *out++ = i * s + q * c; - } - while ( --n ); - if ( burst_count <= 1 ) - break; - ROTATE_IQ( s, c, 0.866025f, -0.5f ); /* +120 degrees */ - } - while ( --n ); - } - } + n = burst_count; + do + { + float const* in = decoder; + int n = 3; + do + { + float i = *in++; + float q = *in++; + *out++ = i * c - q * s; + *out++ = i * s + q * c; + } + while ( --n ); + if ( burst_count <= 1 ) + break; + ROTATE_IQ( s, c, 0.866025f, -0.5f ); /* +120 degrees */ + } + while ( --n ); + } + } } /* kernel generation */ #define RGB_TO_YIQ( r, g, b, y, i ) (\ - (y = (r) * 0.299f + (g) * 0.587f + (b) * 0.114f),\ - (i = (r) * 0.596f - (g) * 0.275f - (b) * 0.321f),\ - ((r) * 0.212f - (g) * 0.523f + (b) * 0.311f)\ + (y = (r) * 0.299f + (g) * 0.587f + (b) * 0.114f),\ + (i = (r) * 0.596f - (g) * 0.275f - (b) * 0.321f),\ + ((r) * 0.212f - (g) * 0.523f + (b) * 0.311f)\ ) #define YIQ_TO_RGB( y, i, q, to_rgb, type, r, g ) (\ - r = (type) (y + to_rgb [0] * i + to_rgb [1] * q),\ - g = (type) (y + to_rgb [2] * i + to_rgb [3] * q),\ - (type) (y + to_rgb [4] * i + to_rgb [5] * q)\ + r = (type) (y + to_rgb [0] * i + to_rgb [1] * q),\ + g = (type) (y + to_rgb [2] * i + to_rgb [3] * q),\ + (type) (y + to_rgb [4] * i + to_rgb [5] * q)\ ) #define PACK_RGB( r, g, b ) ((r) << 21 | (g) << 11 | (b) << 1) @@ -289,24 +289,24 @@ enum { rgb_bias = rgb_unit * 2 * md_ntsc_rgb_builder }; typedef struct pixel_info_t { - int offset; - float negate; - float kernel [4]; + int offset; + float negate; + float kernel [4]; } pixel_info_t; #if rescale_in > 1 - #define PIXEL_OFFSET_( ntsc, scaled ) \ - (kernel_size / 2 + ntsc + (scaled != 0) + (rescale_out - scaled) % rescale_out + \ - (kernel_size * 2 * scaled)) + #define PIXEL_OFFSET_( ntsc, scaled ) \ + (kernel_size / 2 + ntsc + (scaled != 0) + (rescale_out - scaled) % rescale_out + \ + (kernel_size * 2 * scaled)) - #define PIXEL_OFFSET( ntsc, scaled ) \ - PIXEL_OFFSET_( ((ntsc) - (scaled) / rescale_out * rescale_in),\ - (((scaled) + rescale_out * 10) % rescale_out) ),\ - (1.0f - (((ntsc) + 100) & 2)) + #define PIXEL_OFFSET( ntsc, scaled ) \ + PIXEL_OFFSET_( ((ntsc) - (scaled) / rescale_out * rescale_in),\ + (((scaled) + rescale_out * 10) % rescale_out) ),\ + (1.0f - (((ntsc) + 100) & 2)) #else - #define PIXEL_OFFSET( ntsc, scaled ) \ - (kernel_size / 2 + (ntsc) - (scaled)),\ - (1.0f - (((ntsc) + 100) & 2)) + #define PIXEL_OFFSET( ntsc, scaled ) \ + (kernel_size / 2 + (ntsc) - (scaled)),\ + (1.0f - (((ntsc) + 100) & 2)) #endif extern pixel_info_t const md_ntsc_pixels [alignment_count]; @@ -314,126 +314,126 @@ extern pixel_info_t const md_ntsc_pixels [alignment_count]; /* Generate pixel at all burst phases and column alignments */ static void gen_kernel( init_t* impl, float y, float i, float q, md_ntsc_rgb_t* out ) { - /* generate for each scanline burst phase */ - float const* to_rgb = impl->to_rgb; - int burst_remain = burst_count; - y -= rgb_offset; - do - { - /* Encode yiq into *two* composite signals (to allow control over artifacting). - Convolve these with kernels which: filter respective components, apply - sharpening, and rescale horizontally. Convert resulting yiq to rgb and pack - into integer. Based on algorithm by NewRisingSun. */ - pixel_info_t const* pixel = md_ntsc_pixels; - int alignment_remain = alignment_count; - do - { - /* negate is -1 when composite starts at odd multiple of 2 */ - float const yy = y * impl->fringing * pixel->negate; - float const ic0 = (i + yy) * pixel->kernel [0]; - float const qc1 = (q + yy) * pixel->kernel [1]; - float const ic2 = (i - yy) * pixel->kernel [2]; - float const qc3 = (q - yy) * pixel->kernel [3]; + /* generate for each scanline burst phase */ + float const* to_rgb = impl->to_rgb; + int burst_remain = burst_count; + y -= rgb_offset; + do + { + /* Encode yiq into *two* composite signals (to allow control over artifacting). + Convolve these with kernels which: filter respective components, apply + sharpening, and rescale horizontally. Convert resulting yiq to rgb and pack + into integer. Based on algorithm by NewRisingSun. */ + pixel_info_t const* pixel = md_ntsc_pixels; + int alignment_remain = alignment_count; + do + { + /* negate is -1 when composite starts at odd multiple of 2 */ + float const yy = y * impl->fringing * pixel->negate; + float const ic0 = (i + yy) * pixel->kernel [0]; + float const qc1 = (q + yy) * pixel->kernel [1]; + float const ic2 = (i - yy) * pixel->kernel [2]; + float const qc3 = (q - yy) * pixel->kernel [3]; - float const factor = impl->artifacts * pixel->negate; - float const ii = i * factor; - float const yc0 = (y + ii) * pixel->kernel [0]; - float const yc2 = (y - ii) * pixel->kernel [2]; + float const factor = impl->artifacts * pixel->negate; + float const ii = i * factor; + float const yc0 = (y + ii) * pixel->kernel [0]; + float const yc2 = (y - ii) * pixel->kernel [2]; - float const qq = q * factor; - float const yc1 = (y + qq) * pixel->kernel [1]; - float const yc3 = (y - qq) * pixel->kernel [3]; + float const qq = q * factor; + float const yc1 = (y + qq) * pixel->kernel [1]; + float const yc3 = (y - qq) * pixel->kernel [3]; - float const* k = &impl->kernel [pixel->offset]; - int n; - ++pixel; - for ( n = rgb_kernel_size; n; --n ) - { - float i = k[0]*ic0 + k[2]*ic2; - float q = k[1]*qc1 + k[3]*qc3; - float y = k[kernel_size+0]*yc0 + k[kernel_size+1]*yc1 + - k[kernel_size+2]*yc2 + k[kernel_size+3]*yc3 + rgb_offset; - if ( rescale_out <= 1 ) - k--; - else if ( k < &impl->kernel [kernel_size * 2 * (rescale_out - 1)] ) - k += kernel_size * 2 - 1; - else - k -= kernel_size * 2 * (rescale_out - 1) + 2; - { - int r, g, b = YIQ_TO_RGB( y, i, q, to_rgb, int, r, g ); - *out++ = PACK_RGB( r, g, b ) - rgb_bias; - } - } - } - while ( alignment_count > 1 && --alignment_remain ); + float const* k = &impl->kernel [pixel->offset]; + int n; + ++pixel; + for ( n = rgb_kernel_size; n; --n ) + { + float i = k[0]*ic0 + k[2]*ic2; + float q = k[1]*qc1 + k[3]*qc3; + float y = k[kernel_size+0]*yc0 + k[kernel_size+1]*yc1 + + k[kernel_size+2]*yc2 + k[kernel_size+3]*yc3 + rgb_offset; + if ( rescale_out <= 1 ) + k--; + else if ( k < &impl->kernel [kernel_size * 2 * (rescale_out - 1)] ) + k += kernel_size * 2 - 1; + else + k -= kernel_size * 2 * (rescale_out - 1) + 2; + { + int r, g, b = YIQ_TO_RGB( y, i, q, to_rgb, int, r, g ); + *out++ = PACK_RGB( r, g, b ) - rgb_bias; + } + } + } + while ( alignment_count > 1 && --alignment_remain ); - if ( burst_count <= 1 ) - break; + if ( burst_count <= 1 ) + break; - to_rgb += 6; + to_rgb += 6; - ROTATE_IQ( i, q, -0.866025f, -0.5f ); /* -120 degrees */ - } - while ( --burst_remain ); + ROTATE_IQ( i, q, -0.866025f, -0.5f ); /* -120 degrees */ + } + while ( --burst_remain ); } static void correct_errors( md_ntsc_rgb_t color, md_ntsc_rgb_t* out ); #if DISABLE_CORRECTION - #define CORRECT_ERROR( a ) { out [i] += rgb_bias; } - #define DISTRIBUTE_ERROR( a, b, c ) { out [i] += rgb_bias; } + #define CORRECT_ERROR( a ) { out [i] += rgb_bias; } + #define DISTRIBUTE_ERROR( a, b, c ) { out [i] += rgb_bias; } #else - #define CORRECT_ERROR( a ) { out [a] += error; } - #define DISTRIBUTE_ERROR( a, b, c ) {\ - md_ntsc_rgb_t fourth = (error + 2 * md_ntsc_rgb_builder) >> 2;\ - fourth &= (rgb_bias >> 1) - md_ntsc_rgb_builder;\ - fourth -= rgb_bias >> 2;\ - out [a] += fourth;\ - out [b] += fourth;\ - out [c] += fourth;\ - out [i] += error - (fourth * 3);\ - } + #define CORRECT_ERROR( a ) { out [a] += error; } + #define DISTRIBUTE_ERROR( a, b, c ) {\ + md_ntsc_rgb_t fourth = (error + 2 * md_ntsc_rgb_builder) >> 2;\ + fourth &= (rgb_bias >> 1) - md_ntsc_rgb_builder;\ + fourth -= rgb_bias >> 2;\ + out [a] += fourth;\ + out [b] += fourth;\ + out [c] += fourth;\ + out [i] += error - (fourth * 3);\ + } #endif #define RGB_PALETTE_OUT( rgb, out_ )\ {\ - unsigned char* out = (out_);\ - md_ntsc_rgb_t clamped = (rgb);\ - MD_NTSC_CLAMP_( clamped, (8 - rgb_bits) );\ - out [0] = (unsigned char) (clamped >> 21);\ - out [1] = (unsigned char) (clamped >> 11);\ - out [2] = (unsigned char) (clamped >> 1);\ + unsigned char* out = (out_);\ + md_ntsc_rgb_t clamped = (rgb);\ + MD_NTSC_CLAMP_( clamped, (8 - rgb_bits) );\ + out [0] = (unsigned char) (clamped >> 21);\ + out [1] = (unsigned char) (clamped >> 11);\ + out [2] = (unsigned char) (clamped >> 1);\ } /* blitter related */ #ifndef restrict - #if defined (__GNUC__) - #define restrict __restrict__ - #elif defined (_MSC_VER) && _MSC_VER > 1300 - #define restrict - #else - /* no support for restricted pointers */ - #define restrict - #endif + #if defined (__GNUC__) + #define restrict __restrict__ + #elif defined (_MSC_VER) && _MSC_VER > 1300 + #define restrict + #else + /* no support for restricted pointers */ + #define restrict + #endif #endif #include #if MD_NTSC_OUT_DEPTH <= 16 - #if USHRT_MAX == 0xFFFF - typedef unsigned short md_ntsc_out_t; - #else - #error "Need 16-bit int type" - #endif + #if USHRT_MAX == 0xFFFF + typedef unsigned short md_ntsc_out_t; + #else + #error "Need 16-bit int type" + #endif #else - #if UINT_MAX == 0xFFFFFFFF - typedef unsigned int md_ntsc_out_t; - #elif ULONG_MAX == 0xFFFFFFFF - typedef unsigned long md_ntsc_out_t; - #else - #error "Need 32-bit int type" - #endif + #if UINT_MAX == 0xFFFFFFFF + typedef unsigned int md_ntsc_out_t; + #elif ULONG_MAX == 0xFFFFFFFF + typedef unsigned long md_ntsc_out_t; + #else + #error "Need 32-bit int type" + #endif #endif diff --git a/source/ntsc/sms_ntsc.c b/source/ntsc/sms_ntsc.c index 2a7c652..48a9abc 100644 --- a/source/ntsc/sms_ntsc.c +++ b/source/ntsc/sms_ntsc.c @@ -35,71 +35,71 @@ sms_ntsc_setup_t const sms_ntsc_rgb = { 0, 0, 0, 0,.2, 0,.70, -1, -1,-1, /* 3 input pixels -> 8 composite samples */ pixel_info_t const sms_ntsc_pixels [alignment_count] = { - { PIXEL_OFFSET( -4, -9 ), { 1, 1, .6667f, 0 } }, - { PIXEL_OFFSET( -2, -7 ), { .3333f, 1, 1, .3333f } }, - { PIXEL_OFFSET( 0, -5 ), { 0, .6667f, 1, 1 } }, + { PIXEL_OFFSET( -4, -9 ), { 1, 1, .6667f, 0 } }, + { PIXEL_OFFSET( -2, -7 ), { .3333f, 1, 1, .3333f } }, + { PIXEL_OFFSET( 0, -5 ), { 0, .6667f, 1, 1 } }, }; static void correct_errors( sms_ntsc_rgb_t color, sms_ntsc_rgb_t* out ) { - unsigned i; - for ( i = 0; i < rgb_kernel_size / 2; i++ ) - { - sms_ntsc_rgb_t error = color - - out [i ] - out [(i+12)%14+14] - out [(i+10)%14+28] - - out [i + 7] - out [i + 5 +14] - out [i + 3 +28]; - CORRECT_ERROR( i + 3 + 28 ); - } + unsigned i; + for ( i = 0; i < rgb_kernel_size / 2; i++ ) + { + sms_ntsc_rgb_t error = color - + out [i ] - out [(i+12)%14+14] - out [(i+10)%14+28] - + out [i + 7] - out [i + 5 +14] - out [i + 3 +28]; + CORRECT_ERROR( i + 3 + 28 ); + } } void sms_ntsc_init( sms_ntsc_t* ntsc, sms_ntsc_setup_t const* setup ) { - int entry; - init_t impl; - if ( !setup ) - setup = &sms_ntsc_composite; - init( &impl, setup ); - - for ( entry = 0; entry < sms_ntsc_palette_size; entry++ ) - { - float bb = impl.to_float [entry >> 8 & 0x0F]; - float gg = impl.to_float [entry >> 4 & 0x0F]; - float rr = impl.to_float [entry & 0x0F]; - - float y, i, q = RGB_TO_YIQ( rr, gg, bb, y, i ); - - int r, g, b = YIQ_TO_RGB( y, i, q, impl.to_rgb, int, r, g ); - sms_ntsc_rgb_t rgb = PACK_RGB( r, g, b ); - - if ( setup->palette_out ) - RGB_PALETTE_OUT( rgb, &setup->palette_out [entry * 3] ); - - if ( ntsc ) - { - gen_kernel( &impl, y, i, q, ntsc->table [entry] ); - correct_errors( rgb, ntsc->table [entry] ); - } - } + int entry; + init_t impl; + if ( !setup ) + setup = &sms_ntsc_composite; + init( &impl, setup ); + + for ( entry = 0; entry < sms_ntsc_palette_size; entry++ ) + { + float bb = impl.to_float [entry >> 8 & 0x0F]; + float gg = impl.to_float [entry >> 4 & 0x0F]; + float rr = impl.to_float [entry & 0x0F]; + + float y, i, q = RGB_TO_YIQ( rr, gg, bb, y, i ); + + int r, g, b = YIQ_TO_RGB( y, i, q, impl.to_rgb, int, r, g ); + sms_ntsc_rgb_t rgb = PACK_RGB( r, g, b ); + + if ( setup->palette_out ) + RGB_PALETTE_OUT( rgb, &setup->palette_out [entry * 3] ); + + if ( ntsc ) + { + gen_kernel( &impl, y, i, q, ntsc->table [entry] ); + correct_errors( rgb, ntsc->table [entry] ); + } + } } #ifndef SMS_NTSC_NO_BLITTERS /* modified blitters to work on a line basis with genesis plus renderer*/ void sms_ntsc_blit( sms_ntsc_t const* ntsc, SMS_NTSC_IN_T const* table, unsigned char* input, - int in_width, int vline) + int in_width, int vline) { - int const chunk_count = in_width / sms_ntsc_in_chunk; - - /* handle extra 0, 1, or 2 pixels by placing them at beginning of row */ - int const in_extra = in_width - chunk_count * sms_ntsc_in_chunk; - unsigned const extra2 = (unsigned) -(in_extra >> 1 & 1); /* (unsigned) -1 = ~0 */ - unsigned const extra1 = (unsigned) -(in_extra & 1) | extra2; + int const chunk_count = in_width / sms_ntsc_in_chunk; + + /* handle extra 0, 1, or 2 pixels by placing them at beginning of row */ + int const in_extra = in_width - chunk_count * sms_ntsc_in_chunk; + unsigned const extra2 = (unsigned) -(in_extra >> 1 & 1); /* (unsigned) -1 = ~0 */ + unsigned const extra1 = (unsigned) -(in_extra & 1) | extra2; SMS_NTSC_IN_T border = table[0]; - - SMS_NTSC_BEGIN_ROW( ntsc, border, - (SMS_NTSC_ADJ_IN( table[input[0]] )) & extra2, - (SMS_NTSC_ADJ_IN( table[input[extra2 & 1]] )) & extra1 ); + + SMS_NTSC_BEGIN_ROW( ntsc, border, + (SMS_NTSC_ADJ_IN( table[input[0]] )) & extra2, + (SMS_NTSC_ADJ_IN( table[input[extra2 & 1]] )) & extra1 ); #ifdef NGC /* directly fill the RGB565 texture */ @@ -113,83 +113,83 @@ void sms_ntsc_blit( sms_ntsc_t const* ntsc, SMS_NTSC_IN_T const* table, unsigned sms_ntsc_out_t* restrict line_out = (sms_ntsc_out_t*)(&bitmap.data[(vline * bitmap.pitch)]); #endif int n; - input += in_extra; - - for ( n = chunk_count; n; --n ) - { - /* order of input and output pixels must not be altered */ - SMS_NTSC_COLOR_IN( 0, ntsc, SMS_NTSC_ADJ_IN( table[*input++] ) ); + input += in_extra; + + for ( n = chunk_count; n; --n ) + { + /* order of input and output pixels must not be altered */ + SMS_NTSC_COLOR_IN( 0, ntsc, SMS_NTSC_ADJ_IN( table[*input++] ) ); #ifdef NGC - SMS_NTSC_RGB_OUT( 0, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 0, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; - SMS_NTSC_RGB_OUT( 1, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 1, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; #else - SMS_NTSC_RGB_OUT( 0, *line_out++, SMS_NTSC_OUT_DEPTH ); - SMS_NTSC_RGB_OUT( 1, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 0, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 1, *line_out++, SMS_NTSC_OUT_DEPTH ); #endif - - SMS_NTSC_COLOR_IN( 1, ntsc, SMS_NTSC_ADJ_IN( table[*input++] ) ); + + SMS_NTSC_COLOR_IN( 1, ntsc, SMS_NTSC_ADJ_IN( table[*input++] ) ); #ifdef NGC - SMS_NTSC_RGB_OUT( 2, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 2, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; - SMS_NTSC_RGB_OUT( 3, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 3, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; #else - SMS_NTSC_RGB_OUT( 2, *line_out++, SMS_NTSC_OUT_DEPTH ); - SMS_NTSC_RGB_OUT( 3, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 2, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 3, *line_out++, SMS_NTSC_OUT_DEPTH ); #endif - - SMS_NTSC_COLOR_IN( 2, ntsc, SMS_NTSC_ADJ_IN( table[*input++] ) ); + + SMS_NTSC_COLOR_IN( 2, ntsc, SMS_NTSC_ADJ_IN( table[*input++] ) ); #ifdef NGC - SMS_NTSC_RGB_OUT( 4, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 4, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; - SMS_NTSC_RGB_OUT( 5, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 5, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; - SMS_NTSC_RGB_OUT( 6, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 6, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; #else - SMS_NTSC_RGB_OUT( 4, *line_out++, SMS_NTSC_OUT_DEPTH ); - SMS_NTSC_RGB_OUT( 5, *line_out++, SMS_NTSC_OUT_DEPTH ); - SMS_NTSC_RGB_OUT( 6, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 4, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 5, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 6, *line_out++, SMS_NTSC_OUT_DEPTH ); #endif - } - - /* finish final pixels */ - SMS_NTSC_COLOR_IN( 0, ntsc, border ); + } + + /* finish final pixels */ + SMS_NTSC_COLOR_IN( 0, ntsc, border ); #ifdef NGC - SMS_NTSC_RGB_OUT( 0, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 0, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; - SMS_NTSC_RGB_OUT( 1, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 1, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; #else - SMS_NTSC_RGB_OUT( 0, *line_out++, SMS_NTSC_OUT_DEPTH ); - SMS_NTSC_RGB_OUT( 1, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 0, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 1, *line_out++, SMS_NTSC_OUT_DEPTH ); #endif - - SMS_NTSC_COLOR_IN( 1, ntsc, border ); + + SMS_NTSC_COLOR_IN( 1, ntsc, border ); #ifdef NGC - SMS_NTSC_RGB_OUT( 2, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 2, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; - SMS_NTSC_RGB_OUT( 3, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 3, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; #else - SMS_NTSC_RGB_OUT( 2, *line_out++, SMS_NTSC_OUT_DEPTH ); - SMS_NTSC_RGB_OUT( 3, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 2, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 3, *line_out++, SMS_NTSC_OUT_DEPTH ); #endif - - SMS_NTSC_COLOR_IN( 2, ntsc, border ); + + SMS_NTSC_COLOR_IN( 2, ntsc, border ); #ifdef NGC - SMS_NTSC_RGB_OUT( 4, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 4, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; - SMS_NTSC_RGB_OUT( 5, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 5, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; - SMS_NTSC_RGB_OUT( 6, line_out[offset++], SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 6, line_out[offset++], SMS_NTSC_OUT_DEPTH ); if ((offset % 4) == 0) offset += 12; #else - SMS_NTSC_RGB_OUT( 4, *line_out++, SMS_NTSC_OUT_DEPTH ); - SMS_NTSC_RGB_OUT( 5, *line_out++, SMS_NTSC_OUT_DEPTH ); - SMS_NTSC_RGB_OUT( 6, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 4, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 5, *line_out++, SMS_NTSC_OUT_DEPTH ); + SMS_NTSC_RGB_OUT( 6, *line_out++, SMS_NTSC_OUT_DEPTH ); #endif } #endif diff --git a/source/ntsc/sms_ntsc.h b/source/ntsc/sms_ntsc.h index e380324..a3b543c 100644 --- a/source/ntsc/sms_ntsc.h +++ b/source/ntsc/sms_ntsc.h @@ -7,29 +7,29 @@ #include "sms_ntsc_config.h" #ifdef __cplusplus - extern "C" { + extern "C" { #endif /* Image parameters, ranging from -1.0 to 1.0. Actual internal values shown in parenthesis and should remain fairly stable in future versions. */ typedef struct sms_ntsc_setup_t { - /* Basic parameters */ - double hue; /* -1 = -180 degrees +1 = +180 degrees */ - double saturation; /* -1 = grayscale (0.0) +1 = oversaturated colors (2.0) */ - double contrast; /* -1 = dark (0.5) +1 = light (1.5) */ - double brightness; /* -1 = dark (0.5) +1 = light (1.5) */ - double sharpness; /* edge contrast enhancement/blurring */ - - /* Advanced parameters */ - double gamma; /* -1 = dark (1.5) +1 = light (0.5) */ - double resolution; /* image resolution */ - double artifacts; /* artifacts caused by color changes */ - double fringing; /* color artifacts caused by brightness changes */ - double bleed; /* color bleed (color resolution reduction) */ - float const* decoder_matrix; /* optional RGB decoder matrix, 6 elements */ - - unsigned char* palette_out; /* optional RGB palette out, 3 bytes per color */ + /* Basic parameters */ + double hue; /* -1 = -180 degrees +1 = +180 degrees */ + double saturation; /* -1 = grayscale (0.0) +1 = oversaturated colors (2.0) */ + double contrast; /* -1 = dark (0.5) +1 = light (1.5) */ + double brightness; /* -1 = dark (0.5) +1 = light (1.5) */ + double sharpness; /* edge contrast enhancement/blurring */ + + /* Advanced parameters */ + double gamma; /* -1 = dark (1.5) +1 = light (0.5) */ + double resolution; /* image resolution */ + double artifacts; /* artifacts caused by color changes */ + double fringing; /* color artifacts caused by brightness changes */ + double bleed; /* color bleed (color resolution reduction) */ + float const* decoder_matrix; /* optional RGB decoder matrix, 6 elements */ + + unsigned char* palette_out; /* optional RGB palette out, 3 bytes per color */ } sms_ntsc_setup_t; /* Video format presets */ @@ -50,17 +50,17 @@ and output RGB depth is set by SMS_NTSC_OUT_DEPTH. Both default to 16-bit RGB. In_row_width is the number of pixels to get to the next input row. Out_pitch is the number of *bytes* to get to the next output row. */ void sms_ntsc_blit( sms_ntsc_t const* ntsc, SMS_NTSC_IN_T const* table, unsigned char* input, - int in_width, int vline); + int in_width, int vline); /* Number of output pixels written by blitter for given input width. */ #define SMS_NTSC_OUT_WIDTH( in_width ) \ - (((in_width) / sms_ntsc_in_chunk + 1) * sms_ntsc_out_chunk) + (((in_width) / sms_ntsc_in_chunk + 1) * sms_ntsc_out_chunk) /* Number of input pixels that will fit within given output width. Might be rounded down slightly; use SMS_NTSC_OUT_WIDTH() on result to find rounded value. */ #define SMS_NTSC_IN_WIDTH( out_width ) \ - (((out_width) / sms_ntsc_out_chunk - 1) * sms_ntsc_in_chunk + 2) + (((out_width) / sms_ntsc_out_chunk - 1) * sms_ntsc_in_chunk + 2) /* Interface for user-defined custom blitters */ @@ -73,11 +73,11 @@ enum { sms_ntsc_black = 0 }; /* palette index for black */ Use sms_ntsc_black for unused pixels. Declares variables, so must be before first statement in a block (unless you're using C++). */ #define SMS_NTSC_BEGIN_ROW( ntsc, pixel0, pixel1, pixel2 ) \ - SMS_NTSC_BEGIN_ROW_6_( pixel0, pixel1, pixel2, SMS_NTSC_IN_FORMAT, ntsc ) + SMS_NTSC_BEGIN_ROW_6_( pixel0, pixel1, pixel2, SMS_NTSC_IN_FORMAT, ntsc ) /* Begins input pixel */ #define SMS_NTSC_COLOR_IN( in_index, ntsc, color_in ) \ - SMS_NTSC_COLOR_IN_( in_index, color_in, SMS_NTSC_IN_FORMAT, ntsc ) + SMS_NTSC_COLOR_IN_( in_index, color_in, SMS_NTSC_IN_FORMAT, ntsc ) /* Generates output pixel. Bits can be 24, 16, 15, 32 (treated as 24), or 0: 24: RRRRRRRR GGGGGGGG BBBBBBBB (8-8-8 RGB) @@ -85,46 +85,46 @@ statement in a block (unless you're using C++). */ 15: RRRRRGG GGGBBBBB (5-5-5 RGB) 0: xxxRRRRR RRRxxGGG GGGGGxxB BBBBBBBx (native internal format; x = junk bits) */ #define SMS_NTSC_RGB_OUT( index, rgb_out, bits ) \ - SMS_NTSC_RGB_OUT_14_( index, rgb_out, bits, 0 ) + SMS_NTSC_RGB_OUT_14_( index, rgb_out, bits, 0 ) /* private */ enum { sms_ntsc_entry_size = 3 * 14 }; typedef unsigned long sms_ntsc_rgb_t; struct sms_ntsc_t { - sms_ntsc_rgb_t table [sms_ntsc_palette_size] [sms_ntsc_entry_size]; + sms_ntsc_rgb_t table [sms_ntsc_palette_size] [sms_ntsc_entry_size]; }; #define SMS_NTSC_BGR12( ntsc, n ) (ntsc)->table [n & 0xFFF] #define SMS_NTSC_RGB16( ntsc, n ) \ - (sms_ntsc_rgb_t const*) ((char const*) (ntsc)->table +\ - ((n << 10 & 0x7800) | (n & 0x0780) | (n >> 9 & 0x0078)) *\ - (sms_ntsc_entry_size * sizeof (sms_ntsc_rgb_t) / 8)) + (sms_ntsc_rgb_t const*) ((char const*) (ntsc)->table +\ + ((n << 10 & 0x7800) | (n & 0x0780) | (n >> 9 & 0x0078)) *\ + (sms_ntsc_entry_size * sizeof (sms_ntsc_rgb_t) / 8)) #define SMS_NTSC_RGB15( ntsc, n ) \ - (sms_ntsc_rgb_t const*) ((char const*) (ntsc)->table +\ - ((n << 9 & 0x3C00) | (n & 0x03C0) | (n >> 9 & 0x003C)) *\ - (sms_ntsc_entry_size * sizeof (sms_ntsc_rgb_t) / 4)) + (sms_ntsc_rgb_t const*) ((char const*) (ntsc)->table +\ + ((n << 9 & 0x3C00) | (n & 0x03C0) | (n >> 9 & 0x003C)) *\ + (sms_ntsc_entry_size * sizeof (sms_ntsc_rgb_t) / 4)) /* common 3->7 ntsc macros */ #define SMS_NTSC_BEGIN_ROW_6_( pixel0, pixel1, pixel2, ENTRY, table ) \ - unsigned const sms_ntsc_pixel0_ = (pixel0);\ - sms_ntsc_rgb_t const* kernel0 = ENTRY( table, sms_ntsc_pixel0_ );\ - unsigned const sms_ntsc_pixel1_ = (pixel1);\ - sms_ntsc_rgb_t const* kernel1 = ENTRY( table, sms_ntsc_pixel1_ );\ - unsigned const sms_ntsc_pixel2_ = (pixel2);\ - sms_ntsc_rgb_t const* kernel2 = ENTRY( table, sms_ntsc_pixel2_ );\ - sms_ntsc_rgb_t const* kernelx0;\ - sms_ntsc_rgb_t const* kernelx1 = kernel0;\ - sms_ntsc_rgb_t const* kernelx2 = kernel0 + unsigned const sms_ntsc_pixel0_ = (pixel0);\ + sms_ntsc_rgb_t const* kernel0 = ENTRY( table, sms_ntsc_pixel0_ );\ + unsigned const sms_ntsc_pixel1_ = (pixel1);\ + sms_ntsc_rgb_t const* kernel1 = ENTRY( table, sms_ntsc_pixel1_ );\ + unsigned const sms_ntsc_pixel2_ = (pixel2);\ + sms_ntsc_rgb_t const* kernel2 = ENTRY( table, sms_ntsc_pixel2_ );\ + sms_ntsc_rgb_t const* kernelx0;\ + sms_ntsc_rgb_t const* kernelx1 = kernel0;\ + sms_ntsc_rgb_t const* kernelx2 = kernel0 #define SMS_NTSC_RGB_OUT_14_( x, rgb_out, bits, shift ) {\ - sms_ntsc_rgb_t raw_ =\ - kernel0 [x ] + kernel1 [(x+12)%7+14] + kernel2 [(x+10)%7+28] +\ - kernelx0 [(x+7)%14] + kernelx1 [(x+ 5)%7+21] + kernelx2 [(x+ 3)%7+35];\ - SMS_NTSC_CLAMP_( raw_, shift );\ - SMS_NTSC_RGB_OUT_( rgb_out, bits, shift );\ + sms_ntsc_rgb_t raw_ =\ + kernel0 [x ] + kernel1 [(x+12)%7+14] + kernel2 [(x+10)%7+28] +\ + kernelx0 [(x+7)%14] + kernelx1 [(x+ 5)%7+21] + kernelx2 [(x+ 3)%7+35];\ + SMS_NTSC_CLAMP_( raw_, shift );\ + SMS_NTSC_RGB_OUT_( rgb_out, bits, shift );\ } /* common ntsc macros */ @@ -132,26 +132,26 @@ struct sms_ntsc_t { #define sms_ntsc_clamp_mask (sms_ntsc_rgb_builder * 3 / 2) #define sms_ntsc_clamp_add (sms_ntsc_rgb_builder * 0x101) #define SMS_NTSC_CLAMP_( io, shift ) {\ - sms_ntsc_rgb_t sub = (io) >> (9-(shift)) & sms_ntsc_clamp_mask;\ - sms_ntsc_rgb_t clamp = sms_ntsc_clamp_add - sub;\ - io |= clamp;\ - clamp -= sub;\ - io &= clamp;\ + sms_ntsc_rgb_t sub = (io) >> (9-(shift)) & sms_ntsc_clamp_mask;\ + sms_ntsc_rgb_t clamp = sms_ntsc_clamp_add - sub;\ + io |= clamp;\ + clamp -= sub;\ + io &= clamp;\ } #define SMS_NTSC_COLOR_IN_( index, color, ENTRY, table ) {\ - unsigned color_;\ - kernelx##index = kernel##index;\ - kernel##index = (color_ = (color), ENTRY( table, color_ ));\ + unsigned color_;\ + kernelx##index = kernel##index;\ + kernel##index = (color_ = (color), ENTRY( table, color_ ));\ } /* x is always zero except in snes_ntsc library */ #define SMS_NTSC_RGB_OUT_( rgb_out, bits, x ) {\ - rgb_out = (raw_>>(13-x)& 0xF800)|(raw_>>(8-x)&0x07E0)|(raw_>>(4-x)&0x001F);\ + rgb_out = (raw_>>(13-x)& 0xF800)|(raw_>>(8-x)&0x07E0)|(raw_>>(4-x)&0x001F);\ } #ifdef __cplusplus - } + } #endif #endif diff --git a/source/ntsc/sms_ntsc_impl.h b/source/ntsc/sms_ntsc_impl.h index 9527142..c2f3415 100644 --- a/source/ntsc/sms_ntsc_impl.h +++ b/source/ntsc/sms_ntsc_impl.h @@ -22,22 +22,22 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #define PI 3.14159265358979323846f #ifndef LUMA_CUTOFF - #define LUMA_CUTOFF 0.20 + #define LUMA_CUTOFF 0.20 #endif #ifndef gamma_size - #define gamma_size 1 + #define gamma_size 1 #endif #ifndef rgb_bits - #define rgb_bits 8 + #define rgb_bits 8 #endif #ifndef artifacts_max - #define artifacts_max (artifacts_mid * 1.5f) + #define artifacts_max (artifacts_mid * 1.5f) #endif #ifndef fringing_max - #define fringing_max (fringing_mid * 2) + #define fringing_max (fringing_mid * 2) #endif #ifndef STD_HUE_CONDITION - #define STD_HUE_CONDITION( setup ) 1 + #define STD_HUE_CONDITION( setup ) 1 #endif #define ext_decoder_hue (std_decoder_hue + 15) @@ -50,236 +50,236 @@ enum { kernel_size = kernel_half * 2 + 1 }; typedef struct init_t { - float to_rgb [burst_count * 6]; - float to_float [gamma_size]; - float contrast; - float brightness; - float artifacts; - float fringing; - float kernel [rescale_out * kernel_size * 2]; + float to_rgb [burst_count * 6]; + float to_float [gamma_size]; + float contrast; + float brightness; + float artifacts; + float fringing; + float kernel [rescale_out * kernel_size * 2]; } init_t; #define ROTATE_IQ( i, q, sin_b, cos_b ) {\ - float t;\ - t = i * cos_b - q * sin_b;\ - q = i * sin_b + q * cos_b;\ - i = t;\ + float t;\ + t = i * cos_b - q * sin_b;\ + q = i * sin_b + q * cos_b;\ + i = t;\ } static void init_filters( init_t* impl, sms_ntsc_setup_t const* setup ) { #if rescale_out > 1 - float kernels [kernel_size * 2]; + float kernels [kernel_size * 2]; #else - float* const kernels = impl->kernel; + float* const kernels = impl->kernel; #endif - /* generate luma (y) filter using sinc kernel */ - { - /* sinc with rolloff (dsf) */ - float const rolloff = 1 + (float) setup->sharpness * (float) 0.032; - float const maxh = 32; - float const pow_a_n = (float) pow( rolloff, maxh ); - float sum; - int i; - /* quadratic mapping to reduce negative (blurring) range */ - float to_angle = (float) setup->resolution + 1; - to_angle = PI / maxh * (float) LUMA_CUTOFF * (to_angle * to_angle + 1); - - kernels [kernel_size * 3 / 2] = maxh; /* default center value */ - for ( i = 0; i < kernel_half * 2 + 1; i++ ) - { - int x = i - kernel_half; - float angle = x * to_angle; - /* instability occurs at center point with rolloff very close to 1.0 */ - if ( x || pow_a_n > (float) 1.056 || pow_a_n < (float) 0.981 ) - { - float rolloff_cos_a = rolloff * (float) cos( angle ); - float num = 1 - rolloff_cos_a - - pow_a_n * (float) cos( maxh * angle ) + - pow_a_n * rolloff * (float) cos( (maxh - 1) * angle ); - float den = 1 - rolloff_cos_a - rolloff_cos_a + rolloff * rolloff; - float dsf = num / den; - kernels [kernel_size * 3 / 2 - kernel_half + i] = dsf - (float) 0.5; - } - } - - /* apply blackman window and find sum */ - sum = 0; - for ( i = 0; i < kernel_half * 2 + 1; i++ ) - { - float x = PI * 2 / (kernel_half * 2) * i; - float blackman = 0.42f - 0.5f * (float) cos( x ) + 0.08f * (float) cos( x * 2 ); - sum += (kernels [kernel_size * 3 / 2 - kernel_half + i] *= blackman); - } - - /* normalize kernel */ - sum = 1.0f / sum; - for ( i = 0; i < kernel_half * 2 + 1; i++ ) - { - int x = kernel_size * 3 / 2 - kernel_half + i; - kernels [x] *= sum; - assert( kernels [x] == kernels [x] ); /* catch numerical instability */ - } - } + /* generate luma (y) filter using sinc kernel */ + { + /* sinc with rolloff (dsf) */ + float const rolloff = 1 + (float) setup->sharpness * (float) 0.032; + float const maxh = 32; + float const pow_a_n = (float) pow( rolloff, maxh ); + float sum; + int i; + /* quadratic mapping to reduce negative (blurring) range */ + float to_angle = (float) setup->resolution + 1; + to_angle = PI / maxh * (float) LUMA_CUTOFF * (to_angle * to_angle + 1); + + kernels [kernel_size * 3 / 2] = maxh; /* default center value */ + for ( i = 0; i < kernel_half * 2 + 1; i++ ) + { + int x = i - kernel_half; + float angle = x * to_angle; + /* instability occurs at center point with rolloff very close to 1.0 */ + if ( x || pow_a_n > (float) 1.056 || pow_a_n < (float) 0.981 ) + { + float rolloff_cos_a = rolloff * (float) cos( angle ); + float num = 1 - rolloff_cos_a - + pow_a_n * (float) cos( maxh * angle ) + + pow_a_n * rolloff * (float) cos( (maxh - 1) * angle ); + float den = 1 - rolloff_cos_a - rolloff_cos_a + rolloff * rolloff; + float dsf = num / den; + kernels [kernel_size * 3 / 2 - kernel_half + i] = dsf - (float) 0.5; + } + } + + /* apply blackman window and find sum */ + sum = 0; + for ( i = 0; i < kernel_half * 2 + 1; i++ ) + { + float x = PI * 2 / (kernel_half * 2) * i; + float blackman = 0.42f - 0.5f * (float) cos( x ) + 0.08f * (float) cos( x * 2 ); + sum += (kernels [kernel_size * 3 / 2 - kernel_half + i] *= blackman); + } + + /* normalize kernel */ + sum = 1.0f / sum; + for ( i = 0; i < kernel_half * 2 + 1; i++ ) + { + int x = kernel_size * 3 / 2 - kernel_half + i; + kernels [x] *= sum; + assert( kernels [x] == kernels [x] ); /* catch numerical instability */ + } + } - /* generate chroma (iq) filter using gaussian kernel */ - { - float const cutoff_factor = -0.03125f; - float cutoff = (float) setup->bleed; - int i; - - if ( cutoff < 0 ) - { - /* keep extreme value accessible only near upper end of scale (1.0) */ - cutoff *= cutoff; - cutoff *= cutoff; - cutoff *= cutoff; - cutoff *= -30.0f / 0.65f; - } - cutoff = cutoff_factor - 0.65f * cutoff_factor * cutoff; - - for ( i = -kernel_half; i <= kernel_half; i++ ) - kernels [kernel_size / 2 + i] = (float) exp( i * i * cutoff ); - - /* normalize even and odd phases separately */ - for ( i = 0; i < 2; i++ ) - { - float sum = 0; - int x; - for ( x = i; x < kernel_size; x += 2 ) - sum += kernels [x]; - - sum = 1.0f / sum; - for ( x = i; x < kernel_size; x += 2 ) - { - kernels [x] *= sum; - assert( kernels [x] == kernels [x] ); /* catch numerical instability */ - } - } - } - - /* - printf( "luma:\n" ); - for ( i = kernel_size; i < kernel_size * 2; i++ ) - printf( "%f\n", kernels [i] ); - printf( "chroma:\n" ); - for ( i = 0; i < kernel_size; i++ ) - printf( "%f\n", kernels [i] ); - */ - - /* generate linear rescale kernels */ - #if rescale_out > 1 - { - float weight = 1.0f; - float* out = impl->kernel; - int n = rescale_out; - do - { - float remain = 0; - int i; - weight -= 1.0f / rescale_in; - for ( i = 0; i < kernel_size * 2; i++ ) - { - float cur = kernels [i]; - float m = cur * weight; - *out++ = m + remain; - remain = cur - m; - } - } - while ( --n ); - } - #endif + /* generate chroma (iq) filter using gaussian kernel */ + { + float const cutoff_factor = -0.03125f; + float cutoff = (float) setup->bleed; + int i; + + if ( cutoff < 0 ) + { + /* keep extreme value accessible only near upper end of scale (1.0) */ + cutoff *= cutoff; + cutoff *= cutoff; + cutoff *= cutoff; + cutoff *= -30.0f / 0.65f; + } + cutoff = cutoff_factor - 0.65f * cutoff_factor * cutoff; + + for ( i = -kernel_half; i <= kernel_half; i++ ) + kernels [kernel_size / 2 + i] = (float) exp( i * i * cutoff ); + + /* normalize even and odd phases separately */ + for ( i = 0; i < 2; i++ ) + { + float sum = 0; + int x; + for ( x = i; x < kernel_size; x += 2 ) + sum += kernels [x]; + + sum = 1.0f / sum; + for ( x = i; x < kernel_size; x += 2 ) + { + kernels [x] *= sum; + assert( kernels [x] == kernels [x] ); /* catch numerical instability */ + } + } + } + + /* + printf( "luma:\n" ); + for ( i = kernel_size; i < kernel_size * 2; i++ ) + printf( "%f\n", kernels [i] ); + printf( "chroma:\n" ); + for ( i = 0; i < kernel_size; i++ ) + printf( "%f\n", kernels [i] ); + */ + + /* generate linear rescale kernels */ + #if rescale_out > 1 + { + float weight = 1.0f; + float* out = impl->kernel; + int n = rescale_out; + do + { + float remain = 0; + int i; + weight -= 1.0f / rescale_in; + for ( i = 0; i < kernel_size * 2; i++ ) + { + float cur = kernels [i]; + float m = cur * weight; + *out++ = m + remain; + remain = cur - m; + } + } + while ( --n ); + } + #endif } static float const default_decoder [6] = - { 0.956f, 0.621f, -0.272f, -0.647f, -1.105f, 1.702f }; + { 0.956f, 0.621f, -0.272f, -0.647f, -1.105f, 1.702f }; static void init( init_t* impl, sms_ntsc_setup_t const* setup ) { - impl->brightness = (float) setup->brightness * (0.5f * rgb_unit) + rgb_offset; - impl->contrast = (float) setup->contrast * (0.5f * rgb_unit) + rgb_unit; - #ifdef default_palette_contrast - if ( !setup->palette ) - impl->contrast *= default_palette_contrast; - #endif - - impl->artifacts = (float) setup->artifacts; - if ( impl->artifacts > 0 ) - impl->artifacts *= artifacts_max - artifacts_mid; - impl->artifacts = impl->artifacts * artifacts_mid + artifacts_mid; + impl->brightness = (float) setup->brightness * (0.5f * rgb_unit) + rgb_offset; + impl->contrast = (float) setup->contrast * (0.5f * rgb_unit) + rgb_unit; + #ifdef default_palette_contrast + if ( !setup->palette ) + impl->contrast *= default_palette_contrast; + #endif + + impl->artifacts = (float) setup->artifacts; + if ( impl->artifacts > 0 ) + impl->artifacts *= artifacts_max - artifacts_mid; + impl->artifacts = impl->artifacts * artifacts_mid + artifacts_mid; - impl->fringing = (float) setup->fringing; - if ( impl->fringing > 0 ) - impl->fringing *= fringing_max - fringing_mid; - impl->fringing = impl->fringing * fringing_mid + fringing_mid; - - init_filters( impl, setup ); - - /* generate gamma table */ - if ( gamma_size > 1 ) - { - float const to_float = 1.0f / (gamma_size - (gamma_size > 1)); - float const gamma = 1.1333f - (float) setup->gamma * 0.5f; - /* match common PC's 2.2 gamma to TV's 2.65 gamma */ - int i; - for ( i = 0; i < gamma_size; i++ ) - impl->to_float [i] = - (float) pow( i * to_float, gamma ) * impl->contrast + impl->brightness; - } - - /* setup decoder matricies */ - { - float hue = (float) setup->hue * PI + PI / 180 * ext_decoder_hue; - float sat = (float) setup->saturation + 1; - float const* decoder = setup->decoder_matrix; - if ( !decoder ) - { - decoder = default_decoder; - if ( STD_HUE_CONDITION( setup ) ) - hue += PI / 180 * (std_decoder_hue - ext_decoder_hue); - } - - { - float s = (float) sin( hue ) * sat; - float c = (float) cos( hue ) * sat; - float* out = impl->to_rgb; - int n; - - n = burst_count; - do - { - float const* in = decoder; - int n = 3; - do - { - float i = *in++; - float q = *in++; - *out++ = i * c - q * s; - *out++ = i * s + q * c; - } - while ( --n ); - if ( burst_count <= 1 ) - break; - ROTATE_IQ( s, c, 0.866025f, -0.5f ); /* +120 degrees */ - } - while ( --n ); - } - } + impl->fringing = (float) setup->fringing; + if ( impl->fringing > 0 ) + impl->fringing *= fringing_max - fringing_mid; + impl->fringing = impl->fringing * fringing_mid + fringing_mid; + + init_filters( impl, setup ); + + /* generate gamma table */ + if ( gamma_size > 1 ) + { + float const to_float = 1.0f / (gamma_size - (gamma_size > 1)); + float const gamma = 1.1333f - (float) setup->gamma * 0.5f; + /* match common PC's 2.2 gamma to TV's 2.65 gamma */ + int i; + for ( i = 0; i < gamma_size; i++ ) + impl->to_float [i] = + (float) pow( i * to_float, gamma ) * impl->contrast + impl->brightness; + } + + /* setup decoder matricies */ + { + float hue = (float) setup->hue * PI + PI / 180 * ext_decoder_hue; + float sat = (float) setup->saturation + 1; + float const* decoder = setup->decoder_matrix; + if ( !decoder ) + { + decoder = default_decoder; + if ( STD_HUE_CONDITION( setup ) ) + hue += PI / 180 * (std_decoder_hue - ext_decoder_hue); + } + + { + float s = (float) sin( hue ) * sat; + float c = (float) cos( hue ) * sat; + float* out = impl->to_rgb; + int n; + + n = burst_count; + do + { + float const* in = decoder; + int n = 3; + do + { + float i = *in++; + float q = *in++; + *out++ = i * c - q * s; + *out++ = i * s + q * c; + } + while ( --n ); + if ( burst_count <= 1 ) + break; + ROTATE_IQ( s, c, 0.866025f, -0.5f ); /* +120 degrees */ + } + while ( --n ); + } + } } /* kernel generation */ #define RGB_TO_YIQ( r, g, b, y, i ) (\ - (y = (r) * 0.299f + (g) * 0.587f + (b) * 0.114f),\ - (i = (r) * 0.596f - (g) * 0.275f - (b) * 0.321f),\ - ((r) * 0.212f - (g) * 0.523f + (b) * 0.311f)\ + (y = (r) * 0.299f + (g) * 0.587f + (b) * 0.114f),\ + (i = (r) * 0.596f - (g) * 0.275f - (b) * 0.321f),\ + ((r) * 0.212f - (g) * 0.523f + (b) * 0.311f)\ ) #define YIQ_TO_RGB( y, i, q, to_rgb, type, r, g ) (\ - r = (type) (y + to_rgb [0] * i + to_rgb [1] * q),\ - g = (type) (y + to_rgb [2] * i + to_rgb [3] * q),\ - (type) (y + to_rgb [4] * i + to_rgb [5] * q)\ + r = (type) (y + to_rgb [0] * i + to_rgb [1] * q),\ + g = (type) (y + to_rgb [2] * i + to_rgb [3] * q),\ + (type) (y + to_rgb [4] * i + to_rgb [5] * q)\ ) #define PACK_RGB( r, g, b ) ((r) << 21 | (g) << 11 | (b) << 1) @@ -289,24 +289,24 @@ enum { rgb_bias = rgb_unit * 2 * sms_ntsc_rgb_builder }; typedef struct pixel_info_t { - int offset; - float negate; - float kernel [4]; + int offset; + float negate; + float kernel [4]; } pixel_info_t; #if rescale_in > 1 - #define PIXEL_OFFSET_( ntsc, scaled ) \ - (kernel_size / 2 + ntsc + (scaled != 0) + (rescale_out - scaled) % rescale_out + \ - (kernel_size * 2 * scaled)) + #define PIXEL_OFFSET_( ntsc, scaled ) \ + (kernel_size / 2 + ntsc + (scaled != 0) + (rescale_out - scaled) % rescale_out + \ + (kernel_size * 2 * scaled)) - #define PIXEL_OFFSET( ntsc, scaled ) \ - PIXEL_OFFSET_( ((ntsc) - (scaled) / rescale_out * rescale_in),\ - (((scaled) + rescale_out * 10) % rescale_out) ),\ - (1.0f - (((ntsc) + 100) & 2)) + #define PIXEL_OFFSET( ntsc, scaled ) \ + PIXEL_OFFSET_( ((ntsc) - (scaled) / rescale_out * rescale_in),\ + (((scaled) + rescale_out * 10) % rescale_out) ),\ + (1.0f - (((ntsc) + 100) & 2)) #else - #define PIXEL_OFFSET( ntsc, scaled ) \ - (kernel_size / 2 + (ntsc) - (scaled)),\ - (1.0f - (((ntsc) + 100) & 2)) + #define PIXEL_OFFSET( ntsc, scaled ) \ + (kernel_size / 2 + (ntsc) - (scaled)),\ + (1.0f - (((ntsc) + 100) & 2)) #endif extern pixel_info_t const sms_ntsc_pixels [alignment_count]; @@ -314,126 +314,126 @@ extern pixel_info_t const sms_ntsc_pixels [alignment_count]; /* Generate pixel at all burst phases and column alignments */ static void gen_kernel( init_t* impl, float y, float i, float q, sms_ntsc_rgb_t* out ) { - /* generate for each scanline burst phase */ - float const* to_rgb = impl->to_rgb; - int burst_remain = burst_count; - y -= rgb_offset; - do - { - /* Encode yiq into *two* composite signals (to allow control over artifacting). - Convolve these with kernels which: filter respective components, apply - sharpening, and rescale horizontally. Convert resulting yiq to rgb and pack - into integer. Based on algorithm by NewRisingSun. */ - pixel_info_t const* pixel = sms_ntsc_pixels; - int alignment_remain = alignment_count; - do - { - /* negate is -1 when composite starts at odd multiple of 2 */ - float const yy = y * impl->fringing * pixel->negate; - float const ic0 = (i + yy) * pixel->kernel [0]; - float const qc1 = (q + yy) * pixel->kernel [1]; - float const ic2 = (i - yy) * pixel->kernel [2]; - float const qc3 = (q - yy) * pixel->kernel [3]; - - float const factor = impl->artifacts * pixel->negate; - float const ii = i * factor; - float const yc0 = (y + ii) * pixel->kernel [0]; - float const yc2 = (y - ii) * pixel->kernel [2]; - - float const qq = q * factor; - float const yc1 = (y + qq) * pixel->kernel [1]; - float const yc3 = (y - qq) * pixel->kernel [3]; - - float const* k = &impl->kernel [pixel->offset]; - int n; - ++pixel; - for ( n = rgb_kernel_size; n; --n ) - { - float i = k[0]*ic0 + k[2]*ic2; - float q = k[1]*qc1 + k[3]*qc3; - float y = k[kernel_size+0]*yc0 + k[kernel_size+1]*yc1 + - k[kernel_size+2]*yc2 + k[kernel_size+3]*yc3 + rgb_offset; - if ( rescale_out <= 1 ) - k--; - else if ( k < &impl->kernel [kernel_size * 2 * (rescale_out - 1)] ) - k += kernel_size * 2 - 1; - else - k -= kernel_size * 2 * (rescale_out - 1) + 2; - { - int r, g, b = YIQ_TO_RGB( y, i, q, to_rgb, int, r, g ); - *out++ = PACK_RGB( r, g, b ) - rgb_bias; - } - } - } - while ( alignment_count > 1 && --alignment_remain ); - - if ( burst_count <= 1 ) - break; - - to_rgb += 6; - - ROTATE_IQ( i, q, -0.866025f, -0.5f ); /* -120 degrees */ - } - while ( --burst_remain ); + /* generate for each scanline burst phase */ + float const* to_rgb = impl->to_rgb; + int burst_remain = burst_count; + y -= rgb_offset; + do + { + /* Encode yiq into *two* composite signals (to allow control over artifacting). + Convolve these with kernels which: filter respective components, apply + sharpening, and rescale horizontally. Convert resulting yiq to rgb and pack + into integer. Based on algorithm by NewRisingSun. */ + pixel_info_t const* pixel = sms_ntsc_pixels; + int alignment_remain = alignment_count; + do + { + /* negate is -1 when composite starts at odd multiple of 2 */ + float const yy = y * impl->fringing * pixel->negate; + float const ic0 = (i + yy) * pixel->kernel [0]; + float const qc1 = (q + yy) * pixel->kernel [1]; + float const ic2 = (i - yy) * pixel->kernel [2]; + float const qc3 = (q - yy) * pixel->kernel [3]; + + float const factor = impl->artifacts * pixel->negate; + float const ii = i * factor; + float const yc0 = (y + ii) * pixel->kernel [0]; + float const yc2 = (y - ii) * pixel->kernel [2]; + + float const qq = q * factor; + float const yc1 = (y + qq) * pixel->kernel [1]; + float const yc3 = (y - qq) * pixel->kernel [3]; + + float const* k = &impl->kernel [pixel->offset]; + int n; + ++pixel; + for ( n = rgb_kernel_size; n; --n ) + { + float i = k[0]*ic0 + k[2]*ic2; + float q = k[1]*qc1 + k[3]*qc3; + float y = k[kernel_size+0]*yc0 + k[kernel_size+1]*yc1 + + k[kernel_size+2]*yc2 + k[kernel_size+3]*yc3 + rgb_offset; + if ( rescale_out <= 1 ) + k--; + else if ( k < &impl->kernel [kernel_size * 2 * (rescale_out - 1)] ) + k += kernel_size * 2 - 1; + else + k -= kernel_size * 2 * (rescale_out - 1) + 2; + { + int r, g, b = YIQ_TO_RGB( y, i, q, to_rgb, int, r, g ); + *out++ = PACK_RGB( r, g, b ) - rgb_bias; + } + } + } + while ( alignment_count > 1 && --alignment_remain ); + + if ( burst_count <= 1 ) + break; + + to_rgb += 6; + + ROTATE_IQ( i, q, -0.866025f, -0.5f ); /* -120 degrees */ + } + while ( --burst_remain ); } static void correct_errors( sms_ntsc_rgb_t color, sms_ntsc_rgb_t* out ); #if DISABLE_CORRECTION - #define CORRECT_ERROR( a ) { out [i] += rgb_bias; } - #define DISTRIBUTE_ERROR( a, b, c ) { out [i] += rgb_bias; } + #define CORRECT_ERROR( a ) { out [i] += rgb_bias; } + #define DISTRIBUTE_ERROR( a, b, c ) { out [i] += rgb_bias; } #else - #define CORRECT_ERROR( a ) { out [a] += error; } - #define DISTRIBUTE_ERROR( a, b, c ) {\ - sms_ntsc_rgb_t fourth = (error + 2 * sms_ntsc_rgb_builder) >> 2;\ - fourth &= (rgb_bias >> 1) - sms_ntsc_rgb_builder;\ - fourth -= rgb_bias >> 2;\ - out [a] += fourth;\ - out [b] += fourth;\ - out [c] += fourth;\ - out [i] += error - (fourth * 3);\ - } + #define CORRECT_ERROR( a ) { out [a] += error; } + #define DISTRIBUTE_ERROR( a, b, c ) {\ + sms_ntsc_rgb_t fourth = (error + 2 * sms_ntsc_rgb_builder) >> 2;\ + fourth &= (rgb_bias >> 1) - sms_ntsc_rgb_builder;\ + fourth -= rgb_bias >> 2;\ + out [a] += fourth;\ + out [b] += fourth;\ + out [c] += fourth;\ + out [i] += error - (fourth * 3);\ + } #endif #define RGB_PALETTE_OUT( rgb, out_ )\ {\ - unsigned char* out = (out_);\ - sms_ntsc_rgb_t clamped = (rgb);\ - SMS_NTSC_CLAMP_( clamped, (8 - rgb_bits) );\ - out [0] = (unsigned char) (clamped >> 21);\ - out [1] = (unsigned char) (clamped >> 11);\ - out [2] = (unsigned char) (clamped >> 1);\ + unsigned char* out = (out_);\ + sms_ntsc_rgb_t clamped = (rgb);\ + SMS_NTSC_CLAMP_( clamped, (8 - rgb_bits) );\ + out [0] = (unsigned char) (clamped >> 21);\ + out [1] = (unsigned char) (clamped >> 11);\ + out [2] = (unsigned char) (clamped >> 1);\ } /* blitter related */ #ifndef restrict - #if defined (__GNUC__) - #define restrict __restrict__ - #elif defined (_MSC_VER) && _MSC_VER > 1300 - #define restrict __restrict - #else - /* no support for restricted pointers */ - #define restrict - #endif + #if defined (__GNUC__) + #define restrict __restrict__ + #elif defined (_MSC_VER) && _MSC_VER > 1300 + #define restrict __restrict + #else + /* no support for restricted pointers */ + #define restrict + #endif #endif #include #if SMS_NTSC_OUT_DEPTH <= 16 - #if USHRT_MAX == 0xFFFF - typedef unsigned short sms_ntsc_out_t; - #else - #error "Need 16-bit int type" - #endif + #if USHRT_MAX == 0xFFFF + typedef unsigned short sms_ntsc_out_t; + #else + #error "Need 16-bit int type" + #endif #else - #if UINT_MAX == 0xFFFFFFFF - typedef unsigned int sms_ntsc_out_t; - #elif ULONG_MAX == 0xFFFFFFFF - typedef unsigned long sms_ntsc_out_t; - #else - #error "Need 32-bit int type" - #endif + #if UINT_MAX == 0xFFFFFFFF + typedef unsigned int sms_ntsc_out_t; + #elif ULONG_MAX == 0xFFFFFFFF + typedef unsigned long sms_ntsc_out_t; + #else + #error "Need 32-bit int type" + #endif #endif diff --git a/source/sound/SRC/COPYING b/source/sound/SRC/COPYING index d60c31a..1dc8471 100644 --- a/source/sound/SRC/COPYING +++ b/source/sound/SRC/COPYING @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it diff --git a/source/sound/SRC/README b/source/sound/SRC/README index e764e7c..9ecb950 100644 --- a/source/sound/SRC/README +++ b/source/sound/SRC/README @@ -22,8 +22,8 @@ Win32 There are detailed instructions for building libsamplerate on Win32 in the file - doc/win32.html - + doc/win32.html + MacOSX ------ @@ -36,15 +36,15 @@ OTHER PLATFORMS To compile libsamplerate on platforms which have a Bourne Shell compatible shell, an ANSI C compiler and a make utility should require no more that the following three commands : - ./configure - make - make install - + ./configure + make + make install + CONTACTS -------- libsamplerate was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com). The libsamplerate home page is at : - http://www.mega-nerd.com/libsamplerate/ + http://www.mega-nerd.com/libsamplerate/ diff --git a/source/sound/SRC/common.h b/source/sound/SRC/common.h index 436e69c..d8189d7 100644 --- a/source/sound/SRC/common.h +++ b/source/sound/SRC/common.h @@ -19,7 +19,7 @@ /* ** This code is part of Secret Rabibt Code aka libsamplerate. A commercial ** use license for this code is available, please see: -** http://www.mega-nerd.com/SRC/procedure.html +** http://www.mega-nerd.com/SRC/procedure.html */ #ifndef COMMON_H_INCLUDED @@ -28,87 +28,87 @@ #ifdef HAVE_STDINT_H #include #elif (SIZEOF_INT == 4) -typedef int int32_t ; +typedef int int32_t ; #elif (SIZEOF_LONG == 4) -typedef long int32_t ; +typedef long int32_t ; #endif -#define SRC_MAX_RATIO 256 -#define SRC_MIN_RATIO_DIFF (1e-20) +#define SRC_MAX_RATIO 256 +#define SRC_MIN_RATIO_DIFF (1e-20) -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0]))) -#define OFFSETOF(type,member) ((int) (&((type*) 0)->member)) +#define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0]))) +#define OFFSETOF(type,member) ((int) (&((type*) 0)->member)) -#define MAKE_MAGIC(a,b,c,d,e,f) ((a) + ((b) << 4) + ((c) << 8) + ((d) << 12) + ((e) << 16) + ((f) << 20)) +#define MAKE_MAGIC(a,b,c,d,e,f) ((a) + ((b) << 4) + ((c) << 8) + ((d) << 12) + ((e) << 16) + ((f) << 20)) #include "samplerate.h" enum -{ SRC_FALSE = 0, - SRC_TRUE = 1, +{ SRC_FALSE = 0, + SRC_TRUE = 1, - SRC_MODE_PROCESS = 555, - SRC_MODE_CALLBACK = 556 + SRC_MODE_PROCESS = 555, + SRC_MODE_CALLBACK = 556 } ; enum -{ SRC_ERR_NO_ERROR = 0, +{ SRC_ERR_NO_ERROR = 0, - SRC_ERR_MALLOC_FAILED, - SRC_ERR_BAD_STATE, - SRC_ERR_BAD_DATA, - SRC_ERR_BAD_DATA_PTR, - SRC_ERR_NO_PRIVATE, - SRC_ERR_BAD_SRC_RATIO, - SRC_ERR_BAD_PROC_PTR, - SRC_ERR_SHIFT_BITS, - SRC_ERR_FILTER_LEN, - SRC_ERR_BAD_CONVERTER, - SRC_ERR_BAD_CHANNEL_COUNT, - SRC_ERR_SINC_BAD_BUFFER_LEN, - SRC_ERR_SIZE_INCOMPATIBILITY, - SRC_ERR_BAD_PRIV_PTR, - SRC_ERR_BAD_SINC_STATE, - SRC_ERR_DATA_OVERLAP, - SRC_ERR_BAD_CALLBACK, - SRC_ERR_BAD_MODE, - SRC_ERR_NULL_CALLBACK, - SRC_ERR_NO_VARIABLE_RATIO, + SRC_ERR_MALLOC_FAILED, + SRC_ERR_BAD_STATE, + SRC_ERR_BAD_DATA, + SRC_ERR_BAD_DATA_PTR, + SRC_ERR_NO_PRIVATE, + SRC_ERR_BAD_SRC_RATIO, + SRC_ERR_BAD_PROC_PTR, + SRC_ERR_SHIFT_BITS, + SRC_ERR_FILTER_LEN, + SRC_ERR_BAD_CONVERTER, + SRC_ERR_BAD_CHANNEL_COUNT, + SRC_ERR_SINC_BAD_BUFFER_LEN, + SRC_ERR_SIZE_INCOMPATIBILITY, + SRC_ERR_BAD_PRIV_PTR, + SRC_ERR_BAD_SINC_STATE, + SRC_ERR_DATA_OVERLAP, + SRC_ERR_BAD_CALLBACK, + SRC_ERR_BAD_MODE, + SRC_ERR_NULL_CALLBACK, + SRC_ERR_NO_VARIABLE_RATIO, - /* This must be the last error number. */ - SRC_ERR_MAX_ERROR + /* This must be the last error number. */ + SRC_ERR_MAX_ERROR } ; typedef struct SRC_PRIVATE_tag -{ double last_ratio, last_position ; +{ double last_ratio, last_position ; - int error ; - int channels ; + int error ; + int channels ; - /* SRC_MODE_PROCESS or SRC_MODE_CALLBACK */ - int mode ; + /* SRC_MODE_PROCESS or SRC_MODE_CALLBACK */ + int mode ; - /* Pointer to data to converter specific data. */ - void *private_data ; + /* Pointer to data to converter specific data. */ + void *private_data ; - /* Varispeed process function. */ - int (*vari_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ; + /* Varispeed process function. */ + int (*vari_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ; - /* Constant speed process function. */ - int (*const_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ; + /* Constant speed process function. */ + int (*const_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ; - /* State reset. */ - void (*reset) (struct SRC_PRIVATE_tag *psrc) ; + /* State reset. */ + void (*reset) (struct SRC_PRIVATE_tag *psrc) ; - /* Data specific to SRC_MODE_CALLBACK. */ - src_callback_t callback_func ; - void *user_callback_data ; - long saved_frames ; - float *saved_data ; + /* Data specific to SRC_MODE_CALLBACK. */ + src_callback_t callback_func ; + void *user_callback_data ; + long saved_frames ; + float *saved_data ; } SRC_PRIVATE ; /* In src_sinc.c */ @@ -130,19 +130,19 @@ const char* zoh_get_description (int src_enum) ; int zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) ; /*---------------------------------------------------------- -** Common static inline functions. +** Common static inline functions. */ static inline double fmod_one (double x) -{ double res ; +{ double res ; - res = x - lrint (x) ; - if (res < 0.0) - return res + 1.0 ; + res = x - lrint (x) ; + if (res < 0.0) + return res + 1.0 ; - return res ; + return res ; } /* fmod_one */ -#endif /* COMMON_H_INCLUDED */ +#endif /* COMMON_H_INCLUDED */ diff --git a/source/sound/SRC/fastest_coeffs.h b/source/sound/SRC/fastest_coeffs.h index dd68871..f7a24bd 100644 --- a/source/sound/SRC/fastest_coeffs.h +++ b/source/sound/SRC/fastest_coeffs.h @@ -19,7 +19,7 @@ /* ** This code is part of Secret Rabibt Code aka libsamplerate. A commercial ** use license for this code is available, please see: -** http://www.mega-nerd.com/SRC/procedure.html +** http://www.mega-nerd.com/SRC/procedure.html */ /* @@ -32,10 +32,10 @@ */ static const struct fastest_coeffs_s -{ int increment ; - coeff_t coeffs [2464] ; +{ int increment ; + coeff_t coeffs [2464] ; } fastest_coeffs = -{ 128, +{ 128, { 8.31472372954840555082e-01, 8.31414005540308198583e-01, @@ -2500,6 +2500,6 @@ static const struct fastest_coeffs_s -3.59691078491283933177e-07, -2.38952398011216803052e-07, -1.22889677382464548894e-07, - 0.0 /* Need a final zero coefficient */ + 0.0 /* Need a final zero coefficient */ } } ; /* fastest_coeffs */ diff --git a/source/sound/SRC/float_cast.h b/source/sound/SRC/float_cast.h index af3f237..e97674d 100644 --- a/source/sound/SRC/float_cast.h +++ b/source/sound/SRC/float_cast.h @@ -22,231 +22,231 @@ #define FLOAT_CAST_HEADER /*============================================================================ -** On Intel Pentium processors (especially PIII and probably P4), converting -** from float to int is very slow. To meet the C specs, the code produced by -** most C compilers targeting Pentium needs to change the FPU rounding mode -** before the float to int conversion is performed. +** On Intel Pentium processors (especially PIII and probably P4), converting +** from float to int is very slow. To meet the C specs, the code produced by +** most C compilers targeting Pentium needs to change the FPU rounding mode +** before the float to int conversion is performed. ** -** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It -** is this flushing of the pipeline which is so slow. +** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It +** is this flushing of the pipeline which is so slow. ** -** Fortunately the ISO C99 specifications define the functions lrint, lrintf, -** llrint and llrintf which fix this problem as a side effect. +** Fortunately the ISO C99 specifications define the functions lrint, lrintf, +** llrint and llrintf which fix this problem as a side effect. ** -** On Unix-like systems, the configure process should have detected the -** presence of these functions. If they weren't found we have to replace them -** here with a standard C cast. +** On Unix-like systems, the configure process should have detected the +** presence of these functions. If they weren't found we have to replace them +** here with a standard C cast. */ /* -** The C99 prototypes for lrint and lrintf are as follows: +** The C99 prototypes for lrint and lrintf are as follows: ** -** long int lrintf (float x) ; -** long int lrint (double x) ; +** long int lrintf (float x) ; +** long int lrint (double x) ; */ #include "config.h" /* -** The presence of the required functions are detected during the configure -** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in -** the config.h file. +** The presence of the required functions are detected during the configure +** process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in +** the config.h file. */ -#define HAVE_LRINT_REPLACEMENT 0 +#define HAVE_LRINT_REPLACEMENT 0 #if (HAVE_LRINT && HAVE_LRINTF) - /* - ** These defines enable functionality introduced with the 1999 ISO C - ** standard. They must be defined before the inclusion of math.h to - ** engage them. If optimisation is enabled, these functions will be - ** inlined. With optimisation switched off, you have to link in the - ** maths library using -lm. - */ + /* + ** These defines enable functionality introduced with the 1999 ISO C + ** standard. They must be defined before the inclusion of math.h to + ** engage them. If optimisation is enabled, these functions will be + ** inlined. With optimisation switched off, you have to link in the + ** maths library using -lm. + */ - #define _ISOC9X_SOURCE 1 - #define _ISOC99_SOURCE 1 + #define _ISOC9X_SOURCE 1 + #define _ISOC99_SOURCE 1 - #define __USE_ISOC9X 1 - #define __USE_ISOC99 1 + #define __USE_ISOC9X 1 + #define __USE_ISOC99 1 - #include + #include #elif (defined (__CYGWIN__)) - #include + #include - #undef HAVE_LRINT_REPLACEMENT - #define HAVE_LRINT_REPLACEMENT 1 + #undef HAVE_LRINT_REPLACEMENT + #define HAVE_LRINT_REPLACEMENT 1 - #undef lrint - #undef lrintf + #undef lrint + #undef lrintf - #define lrint double2int - #define lrintf float2int + #define lrint double2int + #define lrintf float2int - /* - ** The native CYGWIN lrint and lrintf functions are buggy: - ** http://sourceware.org/ml/cygwin/2005-06/msg00153.html - ** http://sourceware.org/ml/cygwin/2005-09/msg00047.html - ** and slow. - ** These functions (pulled from the Public Domain MinGW math.h header) - ** replace the native versions. - */ + /* + ** The native CYGWIN lrint and lrintf functions are buggy: + ** http://sourceware.org/ml/cygwin/2005-06/msg00153.html + ** http://sourceware.org/ml/cygwin/2005-09/msg00047.html + ** and slow. + ** These functions (pulled from the Public Domain MinGW math.h header) + ** replace the native versions. + */ - static inline long double2int (double in) - { long retval ; + static inline long double2int (double in) + { long retval ; - __asm__ __volatile__ - ( "fistpl %0" - : "=m" (retval) - : "t" (in) - : "st" - ) ; + __asm__ __volatile__ + ( "fistpl %0" + : "=m" (retval) + : "t" (in) + : "st" + ) ; - return retval ; - } /* double2int */ + return retval ; + } /* double2int */ - static inline long float2int (float in) - { long retval ; + static inline long float2int (float in) + { long retval ; - __asm__ __volatile__ - ( "fistpl %0" - : "=m" (retval) - : "t" (in) - : "st" - ) ; + __asm__ __volatile__ + ( "fistpl %0" + : "=m" (retval) + : "t" (in) + : "st" + ) ; - return retval ; - } /* float2int */ + return retval ; + } /* float2int */ #elif (defined (WIN32) || defined (_WIN32)) - #undef HAVE_LRINT_REPLACEMENT - #define HAVE_LRINT_REPLACEMENT 1 + #undef HAVE_LRINT_REPLACEMENT + #define HAVE_LRINT_REPLACEMENT 1 - #include + #include - /* - ** Win32 doesn't seem to have these functions. - ** Therefore implement inline versions of these functions here. - */ + /* + ** Win32 doesn't seem to have these functions. + ** Therefore implement inline versions of these functions here. + */ - __inline long int - lrint (double flt) - { int intgr ; + __inline long int + lrint (double flt) + { int intgr ; - _asm - { fld flt - fistp intgr - } ; + _asm + { fld flt + fistp intgr + } ; - return intgr ; - } + return intgr ; + } - __inline long int - lrintf (float flt) - { int intgr ; + __inline long int + lrintf (float flt) + { int intgr ; - _asm - { fld flt - fistp intgr - } ; + _asm + { fld flt + fistp intgr + } ; - return intgr ; - } + return intgr ; + } #elif (defined (__MWERKS__) && defined (macintosh)) - /* This MacOS 9 solution was provided by Stephane Letz */ + /* This MacOS 9 solution was provided by Stephane Letz */ - #undef HAVE_LRINT_REPLACEMENT - #define HAVE_LRINT_REPLACEMENT 1 - #include + #undef HAVE_LRINT_REPLACEMENT + #define HAVE_LRINT_REPLACEMENT 1 + #include - #undef lrint - #undef lrintf + #undef lrint + #undef lrintf - #define lrint double2int - #define lrintf float2int + #define lrint double2int + #define lrintf float2int - inline int - float2int (register float in) - { long res [2] ; + inline int + float2int (register float in) + { long res [2] ; - asm - { fctiw in, in - stfd in, res - } - return res [1] ; - } /* float2int */ + asm + { fctiw in, in + stfd in, res + } + return res [1] ; + } /* float2int */ - inline int - double2int (register double in) - { long res [2] ; + inline int + double2int (register double in) + { long res [2] ; - asm - { fctiw in, in - stfd in, res - } - return res [1] ; - } /* double2int */ + asm + { fctiw in, in + stfd in, res + } + return res [1] ; + } /* double2int */ #elif (defined (__MACH__) && defined (__APPLE__)) - /* For Apple MacOSX. */ + /* For Apple MacOSX. */ - #undef HAVE_LRINT_REPLACEMENT - #define HAVE_LRINT_REPLACEMENT 1 - #include + #undef HAVE_LRINT_REPLACEMENT + #define HAVE_LRINT_REPLACEMENT 1 + #include - #undef lrint - #undef lrintf + #undef lrint + #undef lrintf - #define lrint double2int - #define lrintf float2int + #define lrint double2int + #define lrintf float2int - inline static long - float2int (register float in) - { int res [2] ; + inline static long + float2int (register float in) + { int res [2] ; - __asm__ __volatile__ - ( "fctiw %1, %1\n\t" - "stfd %1, %0" - : "=m" (res) /* Output */ - : "f" (in) /* Input */ - : "memory" - ) ; + __asm__ __volatile__ + ( "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (in) /* Input */ + : "memory" + ) ; - return res [1] ; - } /* lrintf */ + return res [1] ; + } /* lrintf */ - inline static long - double2int (register double in) - { int res [2] ; + inline static long + double2int (register double in) + { int res [2] ; - __asm__ __volatile__ - ( "fctiw %1, %1\n\t" - "stfd %1, %0" - : "=m" (res) /* Output */ - : "f" (in) /* Input */ - : "memory" - ) ; + __asm__ __volatile__ + ( "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (in) /* Input */ + : "memory" + ) ; - return res [1] ; - } /* lrint */ + return res [1] ; + } /* lrint */ #else - #ifndef __sgi - #warning "Don't have the functions lrint() and lrintf()." - #warning "Replacing these functions with a standard C cast." - #endif + #ifndef __sgi + #warning "Don't have the functions lrint() and lrintf()." + #warning "Replacing these functions with a standard C cast." + #endif - #include + #include - #define lrint(dbl) ((long) (dbl)) - #define lrintf(flt) ((long) (flt)) + #define lrint(dbl) ((long) (dbl)) + #define lrintf(flt) ((long) (flt)) #endif diff --git a/source/sound/SRC/high_qual_coeffs.h b/source/sound/SRC/high_qual_coeffs.h index 370e932..2aeaaba 100644 --- a/source/sound/SRC/high_qual_coeffs.h +++ b/source/sound/SRC/high_qual_coeffs.h @@ -19,7 +19,7 @@ /* ** This code is part of Secret Rabibt Code aka libsamplerate. A commercial ** use license for this code is available, please see: -** http://www.mega-nerd.com/SRC/procedure.html +** http://www.mega-nerd.com/SRC/procedure.html */ /* @@ -31,10 +31,10 @@ ** increment : 2381 */ static const struct slow_high_qual_coeffs_s -{ int increment ; - coeff_t coeffs [340239] ; +{ int increment ; + coeff_t coeffs [340239] ; } slow_high_qual_coeffs = -{ 2381, +{ 2381, { 9.657284235393746030e-01, 9.657281621412726613e-01, diff --git a/source/sound/SRC/mid_qual_coeffs.h b/source/sound/SRC/mid_qual_coeffs.h index 2b6bc5a..3e5c01c 100644 --- a/source/sound/SRC/mid_qual_coeffs.h +++ b/source/sound/SRC/mid_qual_coeffs.h @@ -19,7 +19,7 @@ /* ** This code is part of Secret Rabibt Code aka libsamplerate. A commercial ** use license for this code is available, please see: -** http://www.mega-nerd.com/SRC/procedure.html +** http://www.mega-nerd.com/SRC/procedure.html */ /* @@ -32,10 +32,10 @@ */ static const struct slow_mid_qual_coeffs_s -{ int increment ; - coeff_t coeffs [22438] ; +{ int increment ; + coeff_t coeffs [22438] ; } slow_mid_qual_coeffs = -{ 491, +{ 491, { 9.190632349861385109e-01, 9.190579273831620544e-01, diff --git a/source/sound/SRC/samplerate.c b/source/sound/SRC/samplerate.c index 3a264ac..e2b7824 100644 --- a/source/sound/SRC/samplerate.c +++ b/source/sound/SRC/samplerate.c @@ -19,255 +19,255 @@ /* ** This code is part of Secret Rabibt Code aka libsamplerate. A commercial ** use license for this code is available, please see: -** http://www.mega-nerd.com/SRC/procedure.html +** http://www.mega-nerd.com/SRC/procedure.html */ -#include -#include -#include +#include +#include +#include -#include "config.h" +#include "config.h" -#include "samplerate.h" -#include "float_cast.h" -#include "common.h" +#include "samplerate.h" +#include "float_cast.h" +#include "common.h" -static int psrc_set_converter (SRC_PRIVATE *psrc, int converter_type) ; +static int psrc_set_converter (SRC_PRIVATE *psrc, int converter_type) ; static inline int is_bad_src_ratio (double ratio) -{ return (ratio < (1.0 / SRC_MAX_RATIO) || ratio > (1.0 * SRC_MAX_RATIO)) ; +{ return (ratio < (1.0 / SRC_MAX_RATIO) || ratio > (1.0 * SRC_MAX_RATIO)) ; } /* is_bad_src_ratio */ SRC_STATE * src_new (int converter_type, int channels, int *error) -{ SRC_PRIVATE *psrc ; +{ SRC_PRIVATE *psrc ; - if (error) - *error = SRC_ERR_NO_ERROR ; + if (error) + *error = SRC_ERR_NO_ERROR ; - if (channels < 1) - { if (error) - *error = SRC_ERR_BAD_CHANNEL_COUNT ; - return NULL ; - } ; + if (channels < 1) + { if (error) + *error = SRC_ERR_BAD_CHANNEL_COUNT ; + return NULL ; + } ; - if ((psrc = calloc (1, sizeof (*psrc))) == NULL) - { if (error) - *error = SRC_ERR_MALLOC_FAILED ; - return NULL ; - } ; + if ((psrc = calloc (1, sizeof (*psrc))) == NULL) + { if (error) + *error = SRC_ERR_MALLOC_FAILED ; + return NULL ; + } ; - psrc->channels = channels ; - psrc->mode = SRC_MODE_PROCESS ; + psrc->channels = channels ; + psrc->mode = SRC_MODE_PROCESS ; - if (psrc_set_converter (psrc, converter_type) != SRC_ERR_NO_ERROR) - { if (error) - *error = SRC_ERR_BAD_CONVERTER ; - free (psrc) ; - psrc = NULL ; - } ; + if (psrc_set_converter (psrc, converter_type) != SRC_ERR_NO_ERROR) + { if (error) + *error = SRC_ERR_BAD_CONVERTER ; + free (psrc) ; + psrc = NULL ; + } ; - src_reset ((SRC_STATE*) psrc) ; + src_reset ((SRC_STATE*) psrc) ; - return (SRC_STATE*) psrc ; + return (SRC_STATE*) psrc ; } /* src_new */ SRC_STATE* src_callback_new (src_callback_t func, int converter_type, int channels, int *error, void* cb_data) -{ SRC_STATE *src_state ; +{ SRC_STATE *src_state ; - if (func == NULL) - { if (error) - *error = SRC_ERR_BAD_CALLBACK ; - return NULL ; - } ; + if (func == NULL) + { if (error) + *error = SRC_ERR_BAD_CALLBACK ; + return NULL ; + } ; - if (error != NULL) - *error = 0 ; + if (error != NULL) + *error = 0 ; - src_state = src_new (converter_type, channels, error) ; + src_state = src_new (converter_type, channels, error) ; - src_reset (src_state) ; + src_reset (src_state) ; - ((SRC_PRIVATE*) src_state)->mode = SRC_MODE_CALLBACK ; - ((SRC_PRIVATE*) src_state)->callback_func = func ; - ((SRC_PRIVATE*) src_state)->user_callback_data = cb_data ; + ((SRC_PRIVATE*) src_state)->mode = SRC_MODE_CALLBACK ; + ((SRC_PRIVATE*) src_state)->callback_func = func ; + ((SRC_PRIVATE*) src_state)->user_callback_data = cb_data ; - return src_state ; + return src_state ; } /* src_callback_new */ SRC_STATE * src_delete (SRC_STATE *state) -{ SRC_PRIVATE *psrc ; +{ SRC_PRIVATE *psrc ; - psrc = (SRC_PRIVATE*) state ; - if (psrc) - { if (psrc->private_data) - free (psrc->private_data) ; - memset (psrc, 0, sizeof (SRC_PRIVATE)) ; - free (psrc) ; - } ; + psrc = (SRC_PRIVATE*) state ; + if (psrc) + { if (psrc->private_data) + free (psrc->private_data) ; + memset (psrc, 0, sizeof (SRC_PRIVATE)) ; + free (psrc) ; + } ; - return NULL ; + return NULL ; } /* src_state */ int src_process (SRC_STATE *state, SRC_DATA *data) -{ SRC_PRIVATE *psrc ; - int error ; +{ SRC_PRIVATE *psrc ; + int error ; - psrc = (SRC_PRIVATE*) state ; + psrc = (SRC_PRIVATE*) state ; - if (psrc == NULL) - return SRC_ERR_BAD_STATE ; - if (psrc->vari_process == NULL || psrc->const_process == NULL) - return SRC_ERR_BAD_PROC_PTR ; + if (psrc == NULL) + return SRC_ERR_BAD_STATE ; + if (psrc->vari_process == NULL || psrc->const_process == NULL) + return SRC_ERR_BAD_PROC_PTR ; - if (psrc->mode != SRC_MODE_PROCESS) - return SRC_ERR_BAD_MODE ; + if (psrc->mode != SRC_MODE_PROCESS) + return SRC_ERR_BAD_MODE ; - /* Check for valid SRC_DATA first. */ - if (data == NULL) - return SRC_ERR_BAD_DATA ; + /* Check for valid SRC_DATA first. */ + if (data == NULL) + return SRC_ERR_BAD_DATA ; - /* Check src_ratio is in range. */ - if (is_bad_src_ratio (data->src_ratio)) - return SRC_ERR_BAD_SRC_RATIO ; + /* Check src_ratio is in range. */ + if (is_bad_src_ratio (data->src_ratio)) + return SRC_ERR_BAD_SRC_RATIO ; - /* And that data_in and data_out are valid. */ - if (data->data_in == NULL || data->data_out == NULL) - return SRC_ERR_BAD_DATA_PTR ; + /* And that data_in and data_out are valid. */ + if (data->data_in == NULL || data->data_out == NULL) + return SRC_ERR_BAD_DATA_PTR ; - if (data->data_in == NULL) - data->input_frames = 0 ; + if (data->data_in == NULL) + data->input_frames = 0 ; - if (data->input_frames < 0) - data->input_frames = 0 ; - if (data->output_frames < 0) - data->output_frames = 0 ; + if (data->input_frames < 0) + data->input_frames = 0 ; + if (data->output_frames < 0) + data->output_frames = 0 ; - if (data->data_in < data->data_out) - { if (data->data_in + data->input_frames * psrc->channels > data->data_out) - { /*-printf ("\n\ndata_in: %p data_out: %p\n", - (void*) (data->data_in + data->input_frames * psrc->channels), (void*) data->data_out) ;-*/ - return SRC_ERR_DATA_OVERLAP ; - } ; - } - else if (data->data_out + data->output_frames * psrc->channels > data->data_in) - { /*-printf ("\n\ndata_in : %p ouput frames: %ld data_out: %p\n", (void*) data->data_in, data->output_frames, (void*) data->data_out) ; + if (data->data_in < data->data_out) + { if (data->data_in + data->input_frames * psrc->channels > data->data_out) + { /*-printf ("\n\ndata_in: %p data_out: %p\n", + (void*) (data->data_in + data->input_frames * psrc->channels), (void*) data->data_out) ;-*/ + return SRC_ERR_DATA_OVERLAP ; + } ; + } + else if (data->data_out + data->output_frames * psrc->channels > data->data_in) + { /*-printf ("\n\ndata_in : %p ouput frames: %ld data_out: %p\n", (void*) data->data_in, data->output_frames, (void*) data->data_out) ; - printf ("data_out: %p (%p) data_in: %p\n", (void*) data->data_out, - (void*) (data->data_out + data->input_frames * psrc->channels), (void*) data->data_in) ;-*/ - return SRC_ERR_DATA_OVERLAP ; - } ; + printf ("data_out: %p (%p) data_in: %p\n", (void*) data->data_out, + (void*) (data->data_out + data->input_frames * psrc->channels), (void*) data->data_in) ;-*/ + return SRC_ERR_DATA_OVERLAP ; + } ; - /* Set the input and output counts to zero. */ - data->input_frames_used = 0 ; - data->output_frames_gen = 0 ; + /* Set the input and output counts to zero. */ + data->input_frames_used = 0 ; + data->output_frames_gen = 0 ; - /* Special case for when last_ratio has not been set. */ - if (psrc->last_ratio < (1.0 / SRC_MAX_RATIO)) - psrc->last_ratio = data->src_ratio ; + /* Special case for when last_ratio has not been set. */ + if (psrc->last_ratio < (1.0 / SRC_MAX_RATIO)) + psrc->last_ratio = data->src_ratio ; - /* Now process. */ - if (fabs (psrc->last_ratio - data->src_ratio) < 1e-15) - error = psrc->const_process (psrc, data) ; - else - error = psrc->vari_process (psrc, data) ; + /* Now process. */ + if (fabs (psrc->last_ratio - data->src_ratio) < 1e-15) + error = psrc->const_process (psrc, data) ; + else + error = psrc->vari_process (psrc, data) ; - return error ; + return error ; } /* src_process */ long src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) -{ SRC_PRIVATE *psrc ; - SRC_DATA src_data ; +{ SRC_PRIVATE *psrc ; + SRC_DATA src_data ; - long output_frames_gen ; - int error = 0 ; + long output_frames_gen ; + int error = 0 ; - if (state == NULL) - return 0 ; + if (state == NULL) + return 0 ; - if (frames <= 0) - return 0 ; + if (frames <= 0) + return 0 ; - psrc = (SRC_PRIVATE*) state ; + psrc = (SRC_PRIVATE*) state ; - if (psrc->mode != SRC_MODE_CALLBACK) - { psrc->error = SRC_ERR_BAD_MODE ; - return 0 ; - } ; + if (psrc->mode != SRC_MODE_CALLBACK) + { psrc->error = SRC_ERR_BAD_MODE ; + return 0 ; + } ; - if (psrc->callback_func == NULL) - { psrc->error = SRC_ERR_NULL_CALLBACK ; - return 0 ; - } ; + if (psrc->callback_func == NULL) + { psrc->error = SRC_ERR_NULL_CALLBACK ; + return 0 ; + } ; - memset (&src_data, 0, sizeof (src_data)) ; + memset (&src_data, 0, sizeof (src_data)) ; - /* Check src_ratio is in range. */ - if (is_bad_src_ratio (src_ratio)) - { psrc->error = SRC_ERR_BAD_SRC_RATIO ; - return 0 ; - } ; + /* Check src_ratio is in range. */ + if (is_bad_src_ratio (src_ratio)) + { psrc->error = SRC_ERR_BAD_SRC_RATIO ; + return 0 ; + } ; - /* Switch modes temporarily. */ - src_data.src_ratio = src_ratio ; - src_data.data_out = data ; - src_data.output_frames = frames ; + /* Switch modes temporarily. */ + src_data.src_ratio = src_ratio ; + src_data.data_out = data ; + src_data.output_frames = frames ; - src_data.data_in = psrc->saved_data ; - src_data.input_frames = psrc->saved_frames ; + src_data.data_in = psrc->saved_data ; + src_data.input_frames = psrc->saved_frames ; - output_frames_gen = 0 ; - while (output_frames_gen < frames) - { - if (src_data.input_frames == 0) - { float *ptr ; + output_frames_gen = 0 ; + while (output_frames_gen < frames) + { + if (src_data.input_frames == 0) + { float *ptr ; - src_data.input_frames = psrc->callback_func (psrc->user_callback_data, &ptr) ; - src_data.data_in = ptr ; + src_data.input_frames = psrc->callback_func (psrc->user_callback_data, &ptr) ; + src_data.data_in = ptr ; - if (src_data.input_frames == 0) - src_data.end_of_input = 1 ; - } ; + if (src_data.input_frames == 0) + src_data.end_of_input = 1 ; + } ; - /* - ** Now call process function. However, we need to set the mode - ** to SRC_MODE_PROCESS first and when we return set it back to - ** SRC_MODE_CALLBACK. - */ - psrc->mode = SRC_MODE_PROCESS ; - error = src_process (state, &src_data) ; - psrc->mode = SRC_MODE_CALLBACK ; + /* + ** Now call process function. However, we need to set the mode + ** to SRC_MODE_PROCESS first and when we return set it back to + ** SRC_MODE_CALLBACK. + */ + psrc->mode = SRC_MODE_PROCESS ; + error = src_process (state, &src_data) ; + psrc->mode = SRC_MODE_CALLBACK ; - if (error != 0) - break ; + if (error != 0) + break ; - src_data.data_in += src_data.input_frames_used * psrc->channels ; - src_data.input_frames -= src_data.input_frames_used ; + src_data.data_in += src_data.input_frames_used * psrc->channels ; + src_data.input_frames -= src_data.input_frames_used ; - src_data.data_out += src_data.output_frames_gen * psrc->channels ; - src_data.output_frames -= src_data.output_frames_gen ; + src_data.data_out += src_data.output_frames_gen * psrc->channels ; + src_data.output_frames -= src_data.output_frames_gen ; - output_frames_gen += src_data.output_frames_gen ; + output_frames_gen += src_data.output_frames_gen ; - if (src_data.end_of_input == SRC_TRUE && src_data.output_frames_gen == 0) - break ; - } ; + if (src_data.end_of_input == SRC_TRUE && src_data.output_frames_gen == 0) + break ; + } ; - psrc->saved_data = src_data.data_in ; - psrc->saved_frames = src_data.input_frames ; + psrc->saved_data = src_data.data_in ; + psrc->saved_frames = src_data.input_frames ; - if (error != 0) - { psrc->error = error ; - return 0 ; - } ; + if (error != 0) + { psrc->error = error ; + return 0 ; + } ; - return output_frames_gen ; + return output_frames_gen ; } /* src_callback_read */ /*========================================================================== @@ -275,265 +275,265 @@ src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) int src_set_ratio (SRC_STATE *state, double new_ratio) -{ SRC_PRIVATE *psrc ; +{ SRC_PRIVATE *psrc ; - psrc = (SRC_PRIVATE*) state ; + psrc = (SRC_PRIVATE*) state ; - if (psrc == NULL) - return SRC_ERR_BAD_STATE ; - if (psrc->vari_process == NULL || psrc->const_process == NULL) - return SRC_ERR_BAD_PROC_PTR ; + if (psrc == NULL) + return SRC_ERR_BAD_STATE ; + if (psrc->vari_process == NULL || psrc->const_process == NULL) + return SRC_ERR_BAD_PROC_PTR ; - if (is_bad_src_ratio (new_ratio)) - return SRC_ERR_BAD_SRC_RATIO ; + if (is_bad_src_ratio (new_ratio)) + return SRC_ERR_BAD_SRC_RATIO ; - psrc->last_ratio = new_ratio ; + psrc->last_ratio = new_ratio ; - return SRC_ERR_NO_ERROR ; + return SRC_ERR_NO_ERROR ; } /* src_set_ratio */ int src_reset (SRC_STATE *state) -{ SRC_PRIVATE *psrc ; +{ SRC_PRIVATE *psrc ; - if ((psrc = (SRC_PRIVATE*) state) == NULL) - return SRC_ERR_BAD_STATE ; + if ((psrc = (SRC_PRIVATE*) state) == NULL) + return SRC_ERR_BAD_STATE ; - if (psrc->reset != NULL) - psrc->reset (psrc) ; + if (psrc->reset != NULL) + psrc->reset (psrc) ; - psrc->last_position = 0.0 ; - psrc->last_ratio = 0.0 ; + psrc->last_position = 0.0 ; + psrc->last_ratio = 0.0 ; - psrc->saved_data = NULL ; - psrc->saved_frames = 0 ; + psrc->saved_data = NULL ; + psrc->saved_frames = 0 ; - psrc->error = SRC_ERR_NO_ERROR ; + psrc->error = SRC_ERR_NO_ERROR ; - return SRC_ERR_NO_ERROR ; + return SRC_ERR_NO_ERROR ; } /* src_reset */ /*============================================================================== -** Control functions. +** Control functions. */ const char * src_get_name (int converter_type) -{ const char *desc ; +{ const char *desc ; - if ((desc = sinc_get_name (converter_type)) != NULL) - return desc ; + if ((desc = sinc_get_name (converter_type)) != NULL) + return desc ; - if ((desc = zoh_get_name (converter_type)) != NULL) - return desc ; + if ((desc = zoh_get_name (converter_type)) != NULL) + return desc ; - if ((desc = linear_get_name (converter_type)) != NULL) - return desc ; + if ((desc = linear_get_name (converter_type)) != NULL) + return desc ; - return NULL ; + return NULL ; } /* src_get_name */ const char * src_get_description (int converter_type) -{ const char *desc ; +{ const char *desc ; - if ((desc = sinc_get_description (converter_type)) != NULL) - return desc ; + if ((desc = sinc_get_description (converter_type)) != NULL) + return desc ; - if ((desc = zoh_get_description (converter_type)) != NULL) - return desc ; + if ((desc = zoh_get_description (converter_type)) != NULL) + return desc ; - if ((desc = linear_get_description (converter_type)) != NULL) - return desc ; + if ((desc = linear_get_description (converter_type)) != NULL) + return desc ; - return NULL ; + return NULL ; } /* src_get_description */ const char * src_get_version (void) -{ return PACKAGE "-" VERSION " (c) 2002-2008 Erik de Castro Lopo" ; +{ return PACKAGE "-" VERSION " (c) 2002-2008 Erik de Castro Lopo" ; } /* src_get_version */ int src_is_valid_ratio (double ratio) { - if (is_bad_src_ratio (ratio)) - return SRC_FALSE ; + if (is_bad_src_ratio (ratio)) + return SRC_FALSE ; - return SRC_TRUE ; + return SRC_TRUE ; } /* src_is_valid_ratio */ /*============================================================================== -** Error reporting functions. +** Error reporting functions. */ int src_error (SRC_STATE *state) -{ if (state) - return ((SRC_PRIVATE*) state)->error ; - return SRC_ERR_NO_ERROR ; +{ if (state) + return ((SRC_PRIVATE*) state)->error ; + return SRC_ERR_NO_ERROR ; } /* src_error */ const char* src_strerror (int error) { - switch (error) - { case SRC_ERR_NO_ERROR : - return "No error." ; - case SRC_ERR_MALLOC_FAILED : - return "Malloc failed." ; - case SRC_ERR_BAD_STATE : - return "SRC_STATE pointer is NULL." ; - case SRC_ERR_BAD_DATA : - return "SRC_DATA pointer is NULL." ; - case SRC_ERR_BAD_DATA_PTR : - return "SRC_DATA->data_out is NULL." ; - case SRC_ERR_NO_PRIVATE : - return "Internal error. No private data." ; - case SRC_ERR_BAD_SRC_RATIO : - return "SRC ratio outside [1/12, 12] range." ; - case SRC_ERR_BAD_SINC_STATE : - return "src_process() called without reset after end_of_input." ; - case SRC_ERR_BAD_PROC_PTR : - return "Internal error. No process pointer." ; - case SRC_ERR_SHIFT_BITS : - return "Internal error. SHIFT_BITS too large." ; - case SRC_ERR_FILTER_LEN : - return "Internal error. Filter length too large." ; - case SRC_ERR_BAD_CONVERTER : - return "Bad converter number." ; - case SRC_ERR_BAD_CHANNEL_COUNT : - return "Channel count must be >= 1." ; - case SRC_ERR_SINC_BAD_BUFFER_LEN : - return "Internal error. Bad buffer length. Please report this." ; - case SRC_ERR_SIZE_INCOMPATIBILITY : - return "Internal error. Input data / internal buffer size difference. Please report this." ; - case SRC_ERR_BAD_PRIV_PTR : - return "Internal error. Private pointer is NULL. Please report this." ; - case SRC_ERR_DATA_OVERLAP : - return "Input and output data arrays overlap." ; - case SRC_ERR_BAD_CALLBACK : - return "Supplied callback function pointer is NULL." ; - case SRC_ERR_BAD_MODE : - return "Calling mode differs from initialisation mode (ie process v callback)." ; - case SRC_ERR_NULL_CALLBACK : - return "Callback function pointer is NULL in src_callback_read ()." ; - case SRC_ERR_NO_VARIABLE_RATIO : - return "This converter only allows constant conversion ratios." ; + switch (error) + { case SRC_ERR_NO_ERROR : + return "No error." ; + case SRC_ERR_MALLOC_FAILED : + return "Malloc failed." ; + case SRC_ERR_BAD_STATE : + return "SRC_STATE pointer is NULL." ; + case SRC_ERR_BAD_DATA : + return "SRC_DATA pointer is NULL." ; + case SRC_ERR_BAD_DATA_PTR : + return "SRC_DATA->data_out is NULL." ; + case SRC_ERR_NO_PRIVATE : + return "Internal error. No private data." ; + case SRC_ERR_BAD_SRC_RATIO : + return "SRC ratio outside [1/12, 12] range." ; + case SRC_ERR_BAD_SINC_STATE : + return "src_process() called without reset after end_of_input." ; + case SRC_ERR_BAD_PROC_PTR : + return "Internal error. No process pointer." ; + case SRC_ERR_SHIFT_BITS : + return "Internal error. SHIFT_BITS too large." ; + case SRC_ERR_FILTER_LEN : + return "Internal error. Filter length too large." ; + case SRC_ERR_BAD_CONVERTER : + return "Bad converter number." ; + case SRC_ERR_BAD_CHANNEL_COUNT : + return "Channel count must be >= 1." ; + case SRC_ERR_SINC_BAD_BUFFER_LEN : + return "Internal error. Bad buffer length. Please report this." ; + case SRC_ERR_SIZE_INCOMPATIBILITY : + return "Internal error. Input data / internal buffer size difference. Please report this." ; + case SRC_ERR_BAD_PRIV_PTR : + return "Internal error. Private pointer is NULL. Please report this." ; + case SRC_ERR_DATA_OVERLAP : + return "Input and output data arrays overlap." ; + case SRC_ERR_BAD_CALLBACK : + return "Supplied callback function pointer is NULL." ; + case SRC_ERR_BAD_MODE : + return "Calling mode differs from initialisation mode (ie process v callback)." ; + case SRC_ERR_NULL_CALLBACK : + return "Callback function pointer is NULL in src_callback_read ()." ; + case SRC_ERR_NO_VARIABLE_RATIO : + return "This converter only allows constant conversion ratios." ; - case SRC_ERR_MAX_ERROR : - return "Placeholder. No error defined for this error number." ; + case SRC_ERR_MAX_ERROR : + return "Placeholder. No error defined for this error number." ; - default : break ; - } + default : break ; + } - return NULL ; + return NULL ; } /* src_strerror */ /*============================================================================== -** Simple interface for performing a single conversion from input buffer to -** output buffer at a fixed conversion ratio. +** Simple interface for performing a single conversion from input buffer to +** output buffer at a fixed conversion ratio. */ int src_simple (SRC_DATA *src_data, int converter, int channels) -{ SRC_STATE *src_state ; - int error ; +{ SRC_STATE *src_state ; + int error ; - if ((src_state = src_new (converter, channels, &error)) == NULL) - return error ; + if ((src_state = src_new (converter, channels, &error)) == NULL) + return error ; - src_data->end_of_input = 1 ; /* Only one buffer worth of input. */ + src_data->end_of_input = 1 ; /* Only one buffer worth of input. */ - error = src_process (src_state, src_data) ; + error = src_process (src_state, src_data) ; - src_state = src_delete (src_state) ; + src_state = src_delete (src_state) ; - return error ; + return error ; } /* src_simple */ void src_short_to_float_array (const short *in, float *out, int len) { - while (len) - { len -- ; - out [len] = (float) (in [len] / (1.0 * 0x8000)) ; - } ; + while (len) + { len -- ; + out [len] = (float) (in [len] / (1.0 * 0x8000)) ; + } ; - return ; + return ; } /* src_short_to_float_array */ void src_float_to_short_array (const float *in, short *out, int len) -{ double scaled_value ; +{ double scaled_value ; - while (len) - { len -- ; + while (len) + { len -- ; - scaled_value = in [len] * (8.0 * 0x10000000) ; - if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) - { out [len] = 32767 ; - continue ; - } ; - if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) - { out [len] = -32768 ; - continue ; - } ; + scaled_value = in [len] * (8.0 * 0x10000000) ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { out [len] = 32767 ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { out [len] = -32768 ; + continue ; + } ; - out [len] = (short) (lrint (scaled_value) >> 16) ; - } ; + out [len] = (short) (lrint (scaled_value) >> 16) ; + } ; } /* src_float_to_short_array */ void src_int_to_float_array (const int *in, float *out, int len) { - while (len) - { len -- ; - out [len] = (float) (in [len] / (8.0 * 0x10000000)) ; - } ; + while (len) + { len -- ; + out [len] = (float) (in [len] / (8.0 * 0x10000000)) ; + } ; - return ; + return ; } /* src_int_to_float_array */ void src_float_to_int_array (const float *in, int *out, int len) -{ double scaled_value ; +{ double scaled_value ; - while (len) - { len -- ; + while (len) + { len -- ; - scaled_value = in [len] * (8.0 * 0x10000000) ; - if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) - { out [len] = 0x7fffffff ; - continue ; - } ; - if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) - { out [len] = -1 - 0x7fffffff ; - continue ; - } ; + scaled_value = in [len] * (8.0 * 0x10000000) ; + if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFFFFFF)) + { out [len] = 0x7fffffff ; + continue ; + } ; + if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10000000)) + { out [len] = -1 - 0x7fffffff ; + continue ; + } ; - out [len] = lrint (scaled_value) ; - } ; + out [len] = lrint (scaled_value) ; + } ; } /* src_float_to_int_array */ /*============================================================================== -** Private functions. +** Private functions. */ static int -psrc_set_converter (SRC_PRIVATE *psrc, int converter_type) +psrc_set_converter (SRC_PRIVATE *psrc, int converter_type) { - if (sinc_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR) - return SRC_ERR_NO_ERROR ; + if (sinc_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR) + return SRC_ERR_NO_ERROR ; - if (zoh_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR) - return SRC_ERR_NO_ERROR ; + if (zoh_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR) + return SRC_ERR_NO_ERROR ; - if (linear_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR) - return SRC_ERR_NO_ERROR ; + if (linear_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR) + return SRC_ERR_NO_ERROR ; - return SRC_ERR_BAD_CONVERTER ; + return SRC_ERR_BAD_CONVERTER ; } /* psrc_set_converter */ diff --git a/source/sound/SRC/samplerate.h b/source/sound/SRC/samplerate.h index 9651e63..7a86efc 100644 --- a/source/sound/SRC/samplerate.h +++ b/source/sound/SRC/samplerate.h @@ -19,7 +19,7 @@ /* ** This code is part of Secret Rabibt Code aka libsamplerate. A commercial ** use license for this code is available, please see: -** http://www.mega-nerd.com/SRC/procedure.html +** http://www.mega-nerd.com/SRC/procedure.html */ /* @@ -32,7 +32,7 @@ #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif /* __cplusplus */ /* Opaque data type SRC_STATE. */ @@ -40,20 +40,20 @@ typedef struct SRC_STATE_tag SRC_STATE ; /* SRC_DATA is used to pass data to src_simple() and src_process(). */ typedef struct -{ float *data_in, *data_out ; +{ float *data_in, *data_out ; - long input_frames, output_frames ; - long input_frames_used, output_frames_gen ; + long input_frames, output_frames ; + long input_frames_used, output_frames_gen ; - int end_of_input ; + int end_of_input ; - double src_ratio ; + double src_ratio ; } SRC_DATA ; /* SRC_CB_DATA is used with callback based API. */ typedef struct -{ long frames ; - float *data_in ; +{ long frames ; + float *data_in ; } SRC_CB_DATA ; /* @@ -68,49 +68,49 @@ typedef struct typedef long (*src_callback_t) (void *cb_data, float **data) ; /* -** Standard initialisation function : return an anonymous pointer to the -** internal state of the converter. Choose a converter from the enums below. -** Error returned in *error. +** Standard initialisation function : return an anonymous pointer to the +** internal state of the converter. Choose a converter from the enums below. +** Error returned in *error. */ SRC_STATE* src_new (int converter_type, int channels, int *error) ; /* -** Initilisation for callback based API : return an anonymous pointer to the -** internal state of the converter. Choose a converter from the enums below. -** The cb_data pointer can point to any data or be set to NULL. Whatever the -** value, when processing, user supplied function "func" gets called with -** cb_data as first parameter. +** Initilisation for callback based API : return an anonymous pointer to the +** internal state of the converter. Choose a converter from the enums below. +** The cb_data pointer can point to any data or be set to NULL. Whatever the +** value, when processing, user supplied function "func" gets called with +** cb_data as first parameter. */ SRC_STATE* src_callback_new (src_callback_t func, int converter_type, int channels, - int *error, void* cb_data) ; + int *error, void* cb_data) ; /* -** Cleanup all internal allocations. -** Always returns NULL. +** Cleanup all internal allocations. +** Always returns NULL. */ SRC_STATE* src_delete (SRC_STATE *state) ; /* -** Standard processing function. -** Returns non zero on error. +** Standard processing function. +** Returns non zero on error. */ int src_process (SRC_STATE *state, SRC_DATA *data) ; /* -** Callback based processing function. Read up to frames worth of data from -** the converter int *data and return frames read or -1 on error. +** Callback based processing function. Read up to frames worth of data from +** the converter int *data and return frames read or -1 on error. */ long src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) ; /* -** Simple interface for performing a single conversion from input buffer to -** output buffer at a fixed conversion ratio. -** Simple interface does not require initialisation as it can only operate on -** a single buffer worth of audio. +** Simple interface for performing a single conversion from input buffer to +** output buffer at a fixed conversion ratio. +** Simple interface does not require initialisation as it can only operate on +** a single buffer worth of audio. */ int src_simple (SRC_DATA *data, int converter_type, int channels) ; @@ -129,18 +129,18 @@ const char *src_get_description (int converter_type) ; const char *src_get_version (void) ; /* -** Set a new SRC ratio. This allows step responses -** in the conversion ratio. -** Returns non zero on error. +** Set a new SRC ratio. This allows step responses +** in the conversion ratio. +** Returns non zero on error. */ int src_set_ratio (SRC_STATE *state, double new_ratio) ; /* -** Reset the internal SRC state. -** Does not modify the quality settings. -** Does not free any memory allocations. -** Returns non zero on error. +** Reset the internal SRC state. +** Does not modify the quality settings. +** Does not free any memory allocations. +** Returns non zero on error. */ int src_reset (SRC_STATE *state) ; @@ -153,13 +153,13 @@ int src_reset (SRC_STATE *state) ; int src_is_valid_ratio (double ratio) ; /* -** Return an error number. +** Return an error number. */ int src_error (SRC_STATE *state) ; /* -** Convert the error number into a string. +** Convert the error number into a string. */ const char* src_strerror (int error) ; @@ -170,11 +170,11 @@ const char* src_strerror (int error) ; enum { - SRC_SINC_BEST_QUALITY = 0, - SRC_SINC_MEDIUM_QUALITY = 1, - SRC_SINC_FASTEST = 2, - SRC_ZERO_ORDER_HOLD = 3, - SRC_LINEAR = 4, + SRC_SINC_BEST_QUALITY = 0, + SRC_SINC_MEDIUM_QUALITY = 1, + SRC_SINC_FASTEST = 2, + SRC_ZERO_ORDER_HOLD = 3, + SRC_LINEAR = 4, } ; /* @@ -190,8 +190,8 @@ void src_float_to_int_array (const float *in, int *out, int len) ; #ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ +} /* extern "C" */ +#endif /* __cplusplus */ -#endif /* SAMPLERATE_H */ +#endif /* SAMPLERATE_H */ diff --git a/source/sound/SRC/src_linear.c b/source/sound/SRC/src_linear.c index 960d204..21b1699 100644 --- a/source/sound/SRC/src_linear.c +++ b/source/sound/SRC/src_linear.c @@ -19,7 +19,7 @@ /* ** This code is part of Secret Rabibt Code aka libsamplerate. A commercial ** use license for this code is available, please see: -** http://www.mega-nerd.com/SRC/procedure.html +** http://www.mega-nerd.com/SRC/procedure.html */ #include @@ -36,17 +36,17 @@ static void linear_reset (SRC_PRIVATE *psrc) ; /*======================================================================================== */ -#define LINEAR_MAGIC_MARKER MAKE_MAGIC ('l', 'i', 'n', 'e', 'a', 'r') +#define LINEAR_MAGIC_MARKER MAKE_MAGIC ('l', 'i', 'n', 'e', 'a', 'r') -#define SRC_DEBUG 0 +#define SRC_DEBUG 0 typedef struct -{ int linear_magic_marker ; - int channels ; - int reset ; - long in_count, in_used ; - long out_count, out_gen ; - float last_value [1] ; +{ int linear_magic_marker ; + int channels ; + int reset ; + long in_count, in_used ; + long out_count, out_gen ; + float last_value [1] ; } LINEAR_DATA ; /*---------------------------------------------------------------------------------------- @@ -54,95 +54,95 @@ typedef struct static int linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) -{ LINEAR_DATA *linear ; - double src_ratio, input_index, rem ; - int ch ; +{ LINEAR_DATA *linear ; + double src_ratio, input_index, rem ; + int ch ; - if (psrc->private_data == NULL) - return SRC_ERR_NO_PRIVATE ; + if (psrc->private_data == NULL) + return SRC_ERR_NO_PRIVATE ; - linear = (LINEAR_DATA*) psrc->private_data ; + linear = (LINEAR_DATA*) psrc->private_data ; - if (linear->reset) - { /* If we have just been reset, set the last_value data. */ - for (ch = 0 ; ch < linear->channels ; ch++) - linear->last_value [ch] = data->data_in [ch] ; - linear->reset = 0 ; - } ; + if (linear->reset) + { /* If we have just been reset, set the last_value data. */ + for (ch = 0 ; ch < linear->channels ; ch++) + linear->last_value [ch] = data->data_in [ch] ; + linear->reset = 0 ; + } ; - linear->in_count = data->input_frames * linear->channels ; - linear->out_count = data->output_frames * linear->channels ; - linear->in_used = linear->out_gen = 0 ; + linear->in_count = data->input_frames * linear->channels ; + linear->out_count = data->output_frames * linear->channels ; + linear->in_used = linear->out_gen = 0 ; - src_ratio = psrc->last_ratio ; - input_index = psrc->last_position ; + src_ratio = psrc->last_ratio ; + input_index = psrc->last_position ; - /* Calculate samples before first sample in input array. */ - while (input_index < 1.0 && linear->out_gen < linear->out_count) - { - if (linear->in_used + linear->channels * input_index > linear->in_count) - break ; + /* Calculate samples before first sample in input array. */ + while (input_index < 1.0 && linear->out_gen < linear->out_count) + { + if (linear->in_used + linear->channels * input_index > linear->in_count) + break ; - if (linear->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) - src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / linear->out_count ; + if (linear->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) + src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / linear->out_count ; - for (ch = 0 ; ch < linear->channels ; ch++) - { data->data_out [linear->out_gen] = (float) (linear->last_value [ch] + input_index * - (data->data_in [ch] - linear->last_value [ch])) ; - linear->out_gen ++ ; - } ; + for (ch = 0 ; ch < linear->channels ; ch++) + { data->data_out [linear->out_gen] = (float) (linear->last_value [ch] + input_index * + (data->data_in [ch] - linear->last_value [ch])) ; + linear->out_gen ++ ; + } ; - /* Figure out the next index. */ - input_index += 1.0 / src_ratio ; - } ; + /* Figure out the next index. */ + input_index += 1.0 / src_ratio ; + } ; - rem = fmod_one (input_index) ; - linear->in_used += linear->channels * lrint (input_index - rem) ; - input_index = rem ; + rem = fmod_one (input_index) ; + linear->in_used += linear->channels * lrint (input_index - rem) ; + input_index = rem ; - /* Main processing loop. */ - while (linear->out_gen < linear->out_count && linear->in_used + linear->channels * input_index <= linear->in_count) - { - if (linear->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) - src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / linear->out_count ; + /* Main processing loop. */ + while (linear->out_gen < linear->out_count && linear->in_used + linear->channels * input_index <= linear->in_count) + { + if (linear->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) + src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / linear->out_count ; - if (SRC_DEBUG && linear->in_used < linear->channels && input_index < 1.0) - { printf ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", linear->in_used, linear->channels, input_index) ; - exit (1) ; - } ; + if (SRC_DEBUG && linear->in_used < linear->channels && input_index < 1.0) + { printf ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", linear->in_used, linear->channels, input_index) ; + exit (1) ; + } ; - for (ch = 0 ; ch < linear->channels ; ch++) - { data->data_out [linear->out_gen] = (float) (data->data_in [linear->in_used - linear->channels + ch] + input_index * - (data->data_in [linear->in_used + ch] - data->data_in [linear->in_used - linear->channels + ch])) ; - linear->out_gen ++ ; - } ; + for (ch = 0 ; ch < linear->channels ; ch++) + { data->data_out [linear->out_gen] = (float) (data->data_in [linear->in_used - linear->channels + ch] + input_index * + (data->data_in [linear->in_used + ch] - data->data_in [linear->in_used - linear->channels + ch])) ; + linear->out_gen ++ ; + } ; - /* Figure out the next index. */ - input_index += 1.0 / src_ratio ; - rem = fmod_one (input_index) ; + /* Figure out the next index. */ + input_index += 1.0 / src_ratio ; + rem = fmod_one (input_index) ; - linear->in_used += linear->channels * lrint (input_index - rem) ; - input_index = rem ; - } ; + linear->in_used += linear->channels * lrint (input_index - rem) ; + input_index = rem ; + } ; - if (linear->in_used > linear->in_count) - { input_index += (linear->in_used - linear->in_count) / linear->channels ; - linear->in_used = linear->in_count ; - } ; + if (linear->in_used > linear->in_count) + { input_index += (linear->in_used - linear->in_count) / linear->channels ; + linear->in_used = linear->in_count ; + } ; - psrc->last_position = input_index ; + psrc->last_position = input_index ; - if (linear->in_used > 0) - for (ch = 0 ; ch < linear->channels ; ch++) - linear->last_value [ch] = data->data_in [linear->in_used - linear->channels + ch] ; + if (linear->in_used > 0) + for (ch = 0 ; ch < linear->channels ; ch++) + linear->last_value [ch] = data->data_in [linear->in_used - linear->channels + ch] ; - /* Save current ratio rather then target ratio. */ - psrc->last_ratio = src_ratio ; + /* Save current ratio rather then target ratio. */ + psrc->last_ratio = src_ratio ; - data->input_frames_used = linear->in_used / linear->channels ; - data->output_frames_gen = linear->out_gen / linear->channels ; + data->input_frames_used = linear->in_used / linear->channels ; + data->output_frames_gen = linear->out_gen / linear->channels ; - return SRC_ERR_NO_ERROR ; + return SRC_ERR_NO_ERROR ; } /* linear_vari_process */ /*------------------------------------------------------------------------------ @@ -151,53 +151,53 @@ linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) const char* linear_get_name (int src_enum) { - if (src_enum == SRC_LINEAR) - return "Linear Interpolator" ; + if (src_enum == SRC_LINEAR) + return "Linear Interpolator" ; - return NULL ; + return NULL ; } /* linear_get_name */ const char* linear_get_description (int src_enum) { - if (src_enum == SRC_LINEAR) - return "Linear interpolator, very fast, poor quality." ; + if (src_enum == SRC_LINEAR) + return "Linear interpolator, very fast, poor quality." ; - return NULL ; + return NULL ; } /* linear_get_descrition */ int linear_set_converter (SRC_PRIVATE *psrc, int src_enum) -{ LINEAR_DATA *linear = NULL ; +{ LINEAR_DATA *linear = NULL ; - if (src_enum != SRC_LINEAR) - return SRC_ERR_BAD_CONVERTER ; + if (src_enum != SRC_LINEAR) + return SRC_ERR_BAD_CONVERTER ; - if (psrc->private_data != NULL) - { linear = (LINEAR_DATA*) psrc->private_data ; - if (linear->linear_magic_marker != LINEAR_MAGIC_MARKER) - { free (psrc->private_data) ; - psrc->private_data = NULL ; - } ; - } ; + if (psrc->private_data != NULL) + { linear = (LINEAR_DATA*) psrc->private_data ; + if (linear->linear_magic_marker != LINEAR_MAGIC_MARKER) + { free (psrc->private_data) ; + psrc->private_data = NULL ; + } ; + } ; - if (psrc->private_data == NULL) - { linear = calloc (1, sizeof (*linear) + psrc->channels * sizeof (float)) ; - if (linear == NULL) - return SRC_ERR_MALLOC_FAILED ; - psrc->private_data = linear ; - } ; + if (psrc->private_data == NULL) + { linear = calloc (1, sizeof (*linear) + psrc->channels * sizeof (float)) ; + if (linear == NULL) + return SRC_ERR_MALLOC_FAILED ; + psrc->private_data = linear ; + } ; - linear->linear_magic_marker = LINEAR_MAGIC_MARKER ; - linear->channels = psrc->channels ; + linear->linear_magic_marker = LINEAR_MAGIC_MARKER ; + linear->channels = psrc->channels ; - psrc->const_process = linear_vari_process ; - psrc->vari_process = linear_vari_process ; - psrc->reset = linear_reset ; + psrc->const_process = linear_vari_process ; + psrc->vari_process = linear_vari_process ; + psrc->reset = linear_reset ; - linear_reset (psrc) ; + linear_reset (psrc) ; - return SRC_ERR_NO_ERROR ; + return SRC_ERR_NO_ERROR ; } /* linear_set_converter */ /*=================================================================================== @@ -205,15 +205,15 @@ linear_set_converter (SRC_PRIVATE *psrc, int src_enum) static void linear_reset (SRC_PRIVATE *psrc) -{ LINEAR_DATA *linear = NULL ; +{ LINEAR_DATA *linear = NULL ; - linear = (LINEAR_DATA*) psrc->private_data ; - if (linear == NULL) - return ; + linear = (LINEAR_DATA*) psrc->private_data ; + if (linear == NULL) + return ; - linear->channels = psrc->channels ; - linear->reset = 1 ; + linear->channels = psrc->channels ; + linear->reset = 1 ; - memset (linear->last_value, 0, sizeof (linear->last_value [0]) * linear->channels) ; + memset (linear->last_value, 0, sizeof (linear->last_value [0]) * linear->channels) ; } /* linear_reset */ diff --git a/source/sound/SRC/src_sinc.c b/source/sound/SRC/src_sinc.c index abdd4b2..0b9c1e0 100644 --- a/source/sound/SRC/src_sinc.c +++ b/source/sound/SRC/src_sinc.c @@ -19,7 +19,7 @@ /* ** This code is part of Secret Rabibt Code aka libsamplerate. A commercial ** use license for this code is available, please see: -** http://www.mega-nerd.com/SRC/procedure.html +** http://www.mega-nerd.com/SRC/procedure.html */ #include @@ -30,22 +30,22 @@ #include "float_cast.h" #include "common.h" -#define SINC_MAGIC_MARKER MAKE_MAGIC (' ', 's', 'i', 'n', 'c', ' ') +#define SINC_MAGIC_MARKER MAKE_MAGIC (' ', 's', 'i', 'n', 'c', ' ') /*======================================================================================== */ -#define MAKE_INCREMENT_T(x) ((increment_t) (x)) +#define MAKE_INCREMENT_T(x) ((increment_t) (x)) -#define SHIFT_BITS 12 -#define FP_ONE ((double) (((increment_t) 1) << SHIFT_BITS)) -#define INV_FP_ONE (1.0 / FP_ONE) +#define SHIFT_BITS 12 +#define FP_ONE ((double) (((increment_t) 1) << SHIFT_BITS)) +#define INV_FP_ONE (1.0 / FP_ONE) /*======================================================================================== */ typedef int32_t increment_t ; -typedef float coeff_t ; +typedef float coeff_t ; #include "fastest_coeffs.h" #ifndef NGC @@ -54,20 +54,20 @@ typedef float coeff_t ; #endif typedef struct -{ int sinc_magic_marker ; +{ int sinc_magic_marker ; - int channels ; - long in_count, in_used ; - long out_count, out_gen ; + int channels ; + long in_count, in_used ; + long out_count, out_gen ; - int coeff_half_len, index_inc ; + int coeff_half_len, index_inc ; - double src_ratio, input_index ; + double src_ratio, input_index ; - coeff_t const *coeffs ; + coeff_t const *coeffs ; - int b_current, b_end, b_real_end, b_len ; - float buffer [1] ; + int b_current, b_end, b_real_end, b_len ; + float buffer [1] ; } SINC_FILTER ; static int sinc_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ; @@ -80,29 +80,29 @@ static void sinc_reset (SRC_PRIVATE *psrc) ; static inline increment_t double_to_fp (double x) -{ if (sizeof (increment_t) == 8) - return (llrint ((x) * FP_ONE)) ; - return (lrint ((x) * FP_ONE)) ; +{ if (sizeof (increment_t) == 8) + return (llrint ((x) * FP_ONE)) ; + return (lrint ((x) * FP_ONE)) ; } /* double_to_fp */ static inline increment_t int_to_fp (int x) -{ return (((increment_t) (x)) << SHIFT_BITS) ; +{ return (((increment_t) (x)) << SHIFT_BITS) ; } /* int_to_fp */ static inline int fp_to_int (increment_t x) -{ return (((x) >> SHIFT_BITS)) ; +{ return (((x) >> SHIFT_BITS)) ; } /* fp_to_int */ static inline increment_t fp_fraction_part (increment_t x) -{ return ((x) & ((((increment_t) 1) << SHIFT_BITS) - 1)) ; +{ return ((x) & ((((increment_t) 1) << SHIFT_BITS) - 1)) ; } /* fp_fraction_part */ static inline double fp_to_double (increment_t x) -{ return fp_fraction_part (x) * INV_FP_ONE ; +{ return fp_fraction_part (x) * INV_FP_ONE ; } /* fp_to_double */ @@ -112,245 +112,245 @@ fp_to_double (increment_t x) const char* sinc_get_name (int src_enum) { - switch (src_enum) - { + switch (src_enum) + { #ifndef NGC case SRC_SINC_BEST_QUALITY : - return "Best Sinc Interpolator" ; + return "Best Sinc Interpolator" ; - case SRC_SINC_MEDIUM_QUALITY : - return "Medium Sinc Interpolator" ; + case SRC_SINC_MEDIUM_QUALITY : + return "Medium Sinc Interpolator" ; #endif - case SRC_SINC_FASTEST : - return "Fastest Sinc Interpolator" ; + case SRC_SINC_FASTEST : + return "Fastest Sinc Interpolator" ; - default: break ; - } ; + default: break ; + } ; - return NULL ; + return NULL ; } /* sinc_get_descrition */ const char* sinc_get_description (int src_enum) { - switch (src_enum) - { + switch (src_enum) + { #ifndef NGC case SRC_SINC_FASTEST : - return "Band limited sinc interpolation, fastest, 97dB SNR, 80% BW." ; + return "Band limited sinc interpolation, fastest, 97dB SNR, 80% BW." ; - case SRC_SINC_MEDIUM_QUALITY : - return "Band limited sinc interpolation, medium quality, 121dB SNR, 90% BW." ; + case SRC_SINC_MEDIUM_QUALITY : + return "Band limited sinc interpolation, medium quality, 121dB SNR, 90% BW." ; #endif - case SRC_SINC_BEST_QUALITY : - return "Band limited sinc interpolation, best quality, 145dB SNR, 96% BW." ; + case SRC_SINC_BEST_QUALITY : + return "Band limited sinc interpolation, best quality, 145dB SNR, 96% BW." ; - default : - break ; - } ; + default : + break ; + } ; - return NULL ; + return NULL ; } /* sinc_get_descrition */ int sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) -{ SINC_FILTER *filter, temp_filter ; - increment_t count ; - int bits ; +{ SINC_FILTER *filter, temp_filter ; + increment_t count ; + int bits ; - /* Quick sanity check. */ - if (SHIFT_BITS >= sizeof (increment_t) * 8 - 1) - return SRC_ERR_SHIFT_BITS ; + /* Quick sanity check. */ + if (SHIFT_BITS >= sizeof (increment_t) * 8 - 1) + return SRC_ERR_SHIFT_BITS ; - if (psrc->private_data != NULL) - { filter = (SINC_FILTER*) psrc->private_data ; - if (filter->sinc_magic_marker != SINC_MAGIC_MARKER) - { free (psrc->private_data) ; - psrc->private_data = NULL ; - } ; - } ; + if (psrc->private_data != NULL) + { filter = (SINC_FILTER*) psrc->private_data ; + if (filter->sinc_magic_marker != SINC_MAGIC_MARKER) + { free (psrc->private_data) ; + psrc->private_data = NULL ; + } ; + } ; - memset (&temp_filter, 0, sizeof (temp_filter)) ; + memset (&temp_filter, 0, sizeof (temp_filter)) ; - temp_filter.sinc_magic_marker = SINC_MAGIC_MARKER ; - temp_filter.channels = psrc->channels ; + temp_filter.sinc_magic_marker = SINC_MAGIC_MARKER ; + temp_filter.channels = psrc->channels ; - psrc->const_process = sinc_vari_process ; - psrc->vari_process = sinc_vari_process ; - psrc->reset = sinc_reset ; + psrc->const_process = sinc_vari_process ; + psrc->vari_process = sinc_vari_process ; + psrc->reset = sinc_reset ; - switch (src_enum) - { case SRC_SINC_FASTEST : - temp_filter.coeffs = fastest_coeffs.coeffs ; - temp_filter.coeff_half_len = ARRAY_LEN (fastest_coeffs.coeffs) - 1 ; - temp_filter.index_inc = fastest_coeffs.increment ; - break ; + switch (src_enum) + { case SRC_SINC_FASTEST : + temp_filter.coeffs = fastest_coeffs.coeffs ; + temp_filter.coeff_half_len = ARRAY_LEN (fastest_coeffs.coeffs) - 1 ; + temp_filter.index_inc = fastest_coeffs.increment ; + break ; #ifndef NGC - case SRC_SINC_MEDIUM_QUALITY : - temp_filter.coeffs = slow_mid_qual_coeffs.coeffs ; - temp_filter.coeff_half_len = ARRAY_LEN (slow_mid_qual_coeffs.coeffs) - 1 ; - temp_filter.index_inc = slow_mid_qual_coeffs.increment ; - break ; + case SRC_SINC_MEDIUM_QUALITY : + temp_filter.coeffs = slow_mid_qual_coeffs.coeffs ; + temp_filter.coeff_half_len = ARRAY_LEN (slow_mid_qual_coeffs.coeffs) - 1 ; + temp_filter.index_inc = slow_mid_qual_coeffs.increment ; + break ; case SRC_SINC_BEST_QUALITY : - temp_filter.coeffs = slow_high_qual_coeffs.coeffs ; - temp_filter.coeff_half_len = ARRAY_LEN (slow_high_qual_coeffs.coeffs) - 1 ; - temp_filter.index_inc = slow_high_qual_coeffs.increment ; - break ; + temp_filter.coeffs = slow_high_qual_coeffs.coeffs ; + temp_filter.coeff_half_len = ARRAY_LEN (slow_high_qual_coeffs.coeffs) - 1 ; + temp_filter.index_inc = slow_high_qual_coeffs.increment ; + break ; #endif - default : - return SRC_ERR_BAD_CONVERTER ; - } ; + default : + return SRC_ERR_BAD_CONVERTER ; + } ; - /* - ** FIXME : This needs to be looked at more closely to see if there is - ** a better way. Need to look at prepare_data () at the same time. - */ + /* + ** FIXME : This needs to be looked at more closely to see if there is + ** a better way. Need to look at prepare_data () at the same time. + */ - temp_filter.b_len = 2 * lrint (1.0 + temp_filter.coeff_half_len / (temp_filter.index_inc * 1.0) * SRC_MAX_RATIO) ; - temp_filter.b_len = MAX (temp_filter.b_len, 4096) ; - temp_filter.b_len *= temp_filter.channels ; + temp_filter.b_len = 2 * lrint (1.0 + temp_filter.coeff_half_len / (temp_filter.index_inc * 1.0) * SRC_MAX_RATIO) ; + temp_filter.b_len = MAX (temp_filter.b_len, 4096) ; + temp_filter.b_len *= temp_filter.channels ; - if ((filter = calloc (1, sizeof (SINC_FILTER) + sizeof (filter->buffer [0]) * (temp_filter.b_len + temp_filter.channels))) == NULL) - return SRC_ERR_MALLOC_FAILED ; + if ((filter = calloc (1, sizeof (SINC_FILTER) + sizeof (filter->buffer [0]) * (temp_filter.b_len + temp_filter.channels))) == NULL) + return SRC_ERR_MALLOC_FAILED ; - *filter = temp_filter ; - memset (&temp_filter, 0xEE, sizeof (temp_filter)) ; + *filter = temp_filter ; + memset (&temp_filter, 0xEE, sizeof (temp_filter)) ; - psrc->private_data = filter ; + psrc->private_data = filter ; - sinc_reset (psrc) ; + sinc_reset (psrc) ; - count = filter->coeff_half_len ; - for (bits = 0 ; (MAKE_INCREMENT_T (1) << bits) < count ; bits++) - count |= (MAKE_INCREMENT_T (1) << bits) ; + count = filter->coeff_half_len ; + for (bits = 0 ; (MAKE_INCREMENT_T (1) << bits) < count ; bits++) + count |= (MAKE_INCREMENT_T (1) << bits) ; - if (bits + SHIFT_BITS - 1 >= (int) (sizeof (increment_t) * 8)) - return SRC_ERR_FILTER_LEN ; + if (bits + SHIFT_BITS - 1 >= (int) (sizeof (increment_t) * 8)) + return SRC_ERR_FILTER_LEN ; - return SRC_ERR_NO_ERROR ; + return SRC_ERR_NO_ERROR ; } /* sinc_set_converter */ static void sinc_reset (SRC_PRIVATE *psrc) -{ SINC_FILTER *filter ; +{ SINC_FILTER *filter ; - filter = (SINC_FILTER*) psrc->private_data ; - if (filter == NULL) - return ; + filter = (SINC_FILTER*) psrc->private_data ; + if (filter == NULL) + return ; - filter->b_current = filter->b_end = 0 ; - filter->b_real_end = -1 ; + filter->b_current = filter->b_end = 0 ; + filter->b_real_end = -1 ; - filter->src_ratio = filter->input_index = 0.0 ; + filter->src_ratio = filter->input_index = 0.0 ; - memset (filter->buffer, 0, filter->b_len * sizeof (filter->buffer [0])) ; + memset (filter->buffer, 0, filter->b_len * sizeof (filter->buffer [0])) ; - /* Set this for a sanity check */ - memset (filter->buffer + filter->b_len, 0xAA, filter->channels * sizeof (filter->buffer [0])) ; + /* Set this for a sanity check */ + memset (filter->buffer + filter->b_len, 0xAA, filter->channels * sizeof (filter->buffer [0])) ; } /* sinc_reset */ /*======================================================================================== -** Beware all ye who dare pass this point. There be dragons here. +** Beware all ye who dare pass this point. There be dragons here. */ static int sinc_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) -{ SINC_FILTER *filter ; - double input_index, src_ratio, count, float_increment, terminate, rem ; - increment_t increment, start_filter_index ; - int half_filter_chan_len, samples_in_hand, ch ; +{ SINC_FILTER *filter ; + double input_index, src_ratio, count, float_increment, terminate, rem ; + increment_t increment, start_filter_index ; + int half_filter_chan_len, samples_in_hand, ch ; - if (psrc->private_data == NULL) - return SRC_ERR_NO_PRIVATE ; + if (psrc->private_data == NULL) + return SRC_ERR_NO_PRIVATE ; - filter = (SINC_FILTER*) psrc->private_data ; + filter = (SINC_FILTER*) psrc->private_data ; - /* If there is not a problem, this will be optimised out. */ - if (sizeof (filter->buffer [0]) != sizeof (data->data_in [0])) - return SRC_ERR_SIZE_INCOMPATIBILITY ; + /* If there is not a problem, this will be optimised out. */ + if (sizeof (filter->buffer [0]) != sizeof (data->data_in [0])) + return SRC_ERR_SIZE_INCOMPATIBILITY ; - filter->in_count = data->input_frames * filter->channels ; - filter->out_count = data->output_frames * filter->channels ; - filter->in_used = filter->out_gen = 0 ; + filter->in_count = data->input_frames * filter->channels ; + filter->out_count = data->output_frames * filter->channels ; + filter->in_used = filter->out_gen = 0 ; - src_ratio = psrc->last_ratio ; + src_ratio = psrc->last_ratio ; - /* Check the sample rate ratio wrt the buffer len. */ - count = (filter->coeff_half_len + 2.0) / filter->index_inc ; - if (MIN (psrc->last_ratio, data->src_ratio) < 1.0) - count /= MIN (psrc->last_ratio, data->src_ratio) ; + /* Check the sample rate ratio wrt the buffer len. */ + count = (filter->coeff_half_len + 2.0) / filter->index_inc ; + if (MIN (psrc->last_ratio, data->src_ratio) < 1.0) + count /= MIN (psrc->last_ratio, data->src_ratio) ; - /* Maximum coefficientson either side of center point. */ - half_filter_chan_len = filter->channels * (lrint (count) + 1) ; + /* Maximum coefficientson either side of center point. */ + half_filter_chan_len = filter->channels * (lrint (count) + 1) ; - input_index = psrc->last_position ; - float_increment = filter->index_inc ; + input_index = psrc->last_position ; + float_increment = filter->index_inc ; - rem = fmod_one (input_index) ; - filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ; - input_index = rem ; + rem = fmod_one (input_index) ; + filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ; + input_index = rem ; - terminate = 1.0 / src_ratio + 1e-20 ; + terminate = 1.0 / src_ratio + 1e-20 ; - /* Main processing loop. */ - while (filter->out_gen < filter->out_count) - { - /* Need to reload buffer? */ - samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ; + /* Main processing loop. */ + while (filter->out_gen < filter->out_count) + { + /* Need to reload buffer? */ + samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ; - if (samples_in_hand <= half_filter_chan_len) - { prepare_data (filter, data, half_filter_chan_len) ; + if (samples_in_hand <= half_filter_chan_len) + { prepare_data (filter, data, half_filter_chan_len) ; - samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ; - if (samples_in_hand <= half_filter_chan_len) - break ; - } ; + samples_in_hand = (filter->b_end - filter->b_current + filter->b_len) % filter->b_len ; + if (samples_in_hand <= half_filter_chan_len) + break ; + } ; - /* This is the termination condition. */ - if (filter->b_real_end >= 0) - { if (filter->b_current + input_index + terminate >= filter->b_real_end) - break ; - } ; + /* This is the termination condition. */ + if (filter->b_real_end >= 0) + { if (filter->b_current + input_index + terminate >= filter->b_real_end) + break ; + } ; - if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10) - src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ; + if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10) + src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ; - float_increment = filter->index_inc * 1.0 ; - if (src_ratio < 1.0) - float_increment = filter->index_inc * src_ratio ; + float_increment = filter->index_inc * 1.0 ; + if (src_ratio < 1.0) + float_increment = filter->index_inc * src_ratio ; - increment = double_to_fp (float_increment) ; + increment = double_to_fp (float_increment) ; - start_filter_index = double_to_fp (input_index * float_increment) ; + start_filter_index = double_to_fp (input_index * float_increment) ; - for (ch = 0 ; ch < filter->channels ; ch++) - { data->data_out [filter->out_gen] = (float) ((float_increment / filter->index_inc) * - calc_output (filter, increment, start_filter_index, ch)) ; - filter->out_gen ++ ; - } ; + for (ch = 0 ; ch < filter->channels ; ch++) + { data->data_out [filter->out_gen] = (float) ((float_increment / filter->index_inc) * + calc_output (filter, increment, start_filter_index, ch)) ; + filter->out_gen ++ ; + } ; - /* Figure out the next index. */ - input_index += 1.0 / src_ratio ; - rem = fmod_one (input_index) ; + /* Figure out the next index. */ + input_index += 1.0 / src_ratio ; + rem = fmod_one (input_index) ; - filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ; - input_index = rem ; - } ; + filter->b_current = (filter->b_current + filter->channels * lrint (input_index - rem)) % filter->b_len ; + input_index = rem ; + } ; - psrc->last_position = input_index ; + psrc->last_position = input_index ; - /* Save current ratio rather then target ratio. */ - psrc->last_ratio = src_ratio ; + /* Save current ratio rather then target ratio. */ + psrc->last_ratio = src_ratio ; - data->input_frames_used = filter->in_used / filter->channels ; - data->output_frames_gen = filter->out_gen / filter->channels ; + data->input_frames_used = filter->in_used / filter->channels ; + data->output_frames_gen = filter->out_gen / filter->channels ; - return SRC_ERR_NO_ERROR ; + return SRC_ERR_NO_ERROR ; } /* sinc_vari_process */ /*---------------------------------------------------------------------------------------- @@ -358,121 +358,121 @@ sinc_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) static void prepare_data (SINC_FILTER *filter, SRC_DATA *data, int half_filter_chan_len) -{ int len = 0 ; +{ int len = 0 ; - if (filter->b_real_end >= 0) - return ; /* This doesn't make sense, so return. */ + if (filter->b_real_end >= 0) + return ; /* This doesn't make sense, so return. */ - if (filter->b_current == 0) - { /* Initial state. Set up zeros at the start of the buffer and - ** then load new data after that. - */ - len = filter->b_len - 2 * half_filter_chan_len ; + if (filter->b_current == 0) + { /* Initial state. Set up zeros at the start of the buffer and + ** then load new data after that. + */ + len = filter->b_len - 2 * half_filter_chan_len ; - filter->b_current = filter->b_end = half_filter_chan_len ; - } - else if (filter->b_end + half_filter_chan_len + filter->channels < filter->b_len) - { /* Load data at current end position. */ - len = MAX (filter->b_len - filter->b_current - half_filter_chan_len, 0) ; - } - else - { /* Move data at end of buffer back to the start of the buffer. */ - len = filter->b_end - filter->b_current ; - memmove (filter->buffer, filter->buffer + filter->b_current - half_filter_chan_len, - (half_filter_chan_len + len) * sizeof (filter->buffer [0])) ; + filter->b_current = filter->b_end = half_filter_chan_len ; + } + else if (filter->b_end + half_filter_chan_len + filter->channels < filter->b_len) + { /* Load data at current end position. */ + len = MAX (filter->b_len - filter->b_current - half_filter_chan_len, 0) ; + } + else + { /* Move data at end of buffer back to the start of the buffer. */ + len = filter->b_end - filter->b_current ; + memmove (filter->buffer, filter->buffer + filter->b_current - half_filter_chan_len, + (half_filter_chan_len + len) * sizeof (filter->buffer [0])) ; - filter->b_current = half_filter_chan_len ; - filter->b_end = filter->b_current + len ; + filter->b_current = half_filter_chan_len ; + filter->b_end = filter->b_current + len ; - /* Now load data at current end of buffer. */ - len = MAX (filter->b_len - filter->b_current - half_filter_chan_len, 0) ; - } ; + /* Now load data at current end of buffer. */ + len = MAX (filter->b_len - filter->b_current - half_filter_chan_len, 0) ; + } ; - len = MIN (filter->in_count - filter->in_used, len) ; - len -= (len % filter->channels) ; + len = MIN (filter->in_count - filter->in_used, len) ; + len -= (len % filter->channels) ; - memcpy (filter->buffer + filter->b_end, data->data_in + filter->in_used, - len * sizeof (filter->buffer [0])) ; + memcpy (filter->buffer + filter->b_end, data->data_in + filter->in_used, + len * sizeof (filter->buffer [0])) ; - filter->b_end += len ; - filter->in_used += len ; + filter->b_end += len ; + filter->in_used += len ; - if (filter->in_used == filter->in_count && - filter->b_end - filter->b_current < 2 * half_filter_chan_len && data->end_of_input) - { /* Handle the case where all data in the current buffer has been - ** consumed and this is the last buffer. - */ + if (filter->in_used == filter->in_count && + filter->b_end - filter->b_current < 2 * half_filter_chan_len && data->end_of_input) + { /* Handle the case where all data in the current buffer has been + ** consumed and this is the last buffer. + */ - if (filter->b_len - filter->b_end < half_filter_chan_len + 5) - { /* If necessary, move data down to the start of the buffer. */ - len = filter->b_end - filter->b_current ; - memmove (filter->buffer, filter->buffer + filter->b_current - half_filter_chan_len, - (half_filter_chan_len + len) * sizeof (filter->buffer [0])) ; + if (filter->b_len - filter->b_end < half_filter_chan_len + 5) + { /* If necessary, move data down to the start of the buffer. */ + len = filter->b_end - filter->b_current ; + memmove (filter->buffer, filter->buffer + filter->b_current - half_filter_chan_len, + (half_filter_chan_len + len) * sizeof (filter->buffer [0])) ; - filter->b_current = half_filter_chan_len ; - filter->b_end = filter->b_current + len ; - } ; + filter->b_current = half_filter_chan_len ; + filter->b_end = filter->b_current + len ; + } ; - filter->b_real_end = filter->b_end ; - len = half_filter_chan_len + 5 ; + filter->b_real_end = filter->b_end ; + len = half_filter_chan_len + 5 ; - memset (filter->buffer + filter->b_end, 0, len * sizeof (filter->buffer [0])) ; - filter->b_end += len ; - } ; + memset (filter->buffer + filter->b_end, 0, len * sizeof (filter->buffer [0])) ; + filter->b_end += len ; + } ; - return ; + return ; } /* prepare_data */ static double calc_output (SINC_FILTER *filter, increment_t increment, increment_t start_filter_index, int ch) -{ double fraction, left, right, icoeff ; - increment_t filter_index, max_filter_index ; - int data_index, coeff_count, indx ; +{ double fraction, left, right, icoeff ; + increment_t filter_index, max_filter_index ; + int data_index, coeff_count, indx ; - /* Convert input parameters into fixed point. */ - max_filter_index = int_to_fp (filter->coeff_half_len) ; + /* Convert input parameters into fixed point. */ + max_filter_index = int_to_fp (filter->coeff_half_len) ; - /* First apply the left half of the filter. */ - filter_index = start_filter_index ; - coeff_count = (max_filter_index - filter_index) / increment ; - filter_index = filter_index + coeff_count * increment ; - data_index = filter->b_current - filter->channels * coeff_count + ch ; + /* First apply the left half of the filter. */ + filter_index = start_filter_index ; + coeff_count = (max_filter_index - filter_index) / increment ; + filter_index = filter_index + coeff_count * increment ; + data_index = filter->b_current - filter->channels * coeff_count + ch ; - left = 0.0 ; - do - { fraction = fp_to_double (filter_index) ; - indx = fp_to_int (filter_index) ; + left = 0.0 ; + do + { fraction = fp_to_double (filter_index) ; + indx = fp_to_int (filter_index) ; - icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ; + icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ; - left += icoeff * filter->buffer [data_index] ; + left += icoeff * filter->buffer [data_index] ; - filter_index -= increment ; - data_index = data_index + filter->channels ; - } - while (filter_index >= MAKE_INCREMENT_T (0)) ; + filter_index -= increment ; + data_index = data_index + filter->channels ; + } + while (filter_index >= MAKE_INCREMENT_T (0)) ; - /* Now apply the right half of the filter. */ - filter_index = increment - start_filter_index ; - coeff_count = (max_filter_index - filter_index) / increment ; - filter_index = filter_index + coeff_count * increment ; - data_index = filter->b_current + filter->channels * (1 + coeff_count) + ch ; + /* Now apply the right half of the filter. */ + filter_index = increment - start_filter_index ; + coeff_count = (max_filter_index - filter_index) / increment ; + filter_index = filter_index + coeff_count * increment ; + data_index = filter->b_current + filter->channels * (1 + coeff_count) + ch ; - right = 0.0 ; - do - { fraction = fp_to_double (filter_index) ; - indx = fp_to_int (filter_index) ; + right = 0.0 ; + do + { fraction = fp_to_double (filter_index) ; + indx = fp_to_int (filter_index) ; - icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ; + icoeff = filter->coeffs [indx] + fraction * (filter->coeffs [indx + 1] - filter->coeffs [indx]) ; - right += icoeff * filter->buffer [data_index] ; + right += icoeff * filter->buffer [data_index] ; - filter_index -= increment ; - data_index = data_index - filter->channels ; - } - while (filter_index > MAKE_INCREMENT_T (0)) ; + filter_index -= increment ; + data_index = data_index - filter->channels ; + } + while (filter_index > MAKE_INCREMENT_T (0)) ; - return (left + right) ; + return (left + right) ; } /* calc_output */ diff --git a/source/sound/SRC/src_zoh.c b/source/sound/SRC/src_zoh.c index aa2e364..0a4074d 100644 --- a/source/sound/SRC/src_zoh.c +++ b/source/sound/SRC/src_zoh.c @@ -19,7 +19,7 @@ /* ** This code is part of Secret Rabibt Code aka libsamplerate. A commercial ** use license for this code is available, please see: -** http://www.mega-nerd.com/SRC/procedure.html +** http://www.mega-nerd.com/SRC/procedure.html */ #include @@ -36,15 +36,15 @@ static void zoh_reset (SRC_PRIVATE *psrc) ; /*======================================================================================== */ -#define ZOH_MAGIC_MARKER MAKE_MAGIC ('s', 'r', 'c', 'z', 'o', 'h') +#define ZOH_MAGIC_MARKER MAKE_MAGIC ('s', 'r', 'c', 'z', 'o', 'h') typedef struct -{ int zoh_magic_marker ; - int channels ; - int reset ; - long in_count, in_used ; - long out_count, out_gen ; - float last_value [1] ; +{ int zoh_magic_marker ; + int channels ; + int reset ; + long in_count, in_used ; + long out_count, out_gen ; + float last_value [1] ; } ZOH_DATA ; /*---------------------------------------------------------------------------------------- @@ -52,88 +52,88 @@ typedef struct static int zoh_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) -{ ZOH_DATA *zoh ; - double src_ratio, input_index, rem ; - int ch ; +{ ZOH_DATA *zoh ; + double src_ratio, input_index, rem ; + int ch ; - if (psrc->private_data == NULL) - return SRC_ERR_NO_PRIVATE ; + if (psrc->private_data == NULL) + return SRC_ERR_NO_PRIVATE ; - zoh = (ZOH_DATA*) psrc->private_data ; + zoh = (ZOH_DATA*) psrc->private_data ; - if (zoh->reset) - { /* If we have just been reset, set the last_value data. */ - for (ch = 0 ; ch < zoh->channels ; ch++) - zoh->last_value [ch] = data->data_in [ch] ; - zoh->reset = 0 ; - } ; + if (zoh->reset) + { /* If we have just been reset, set the last_value data. */ + for (ch = 0 ; ch < zoh->channels ; ch++) + zoh->last_value [ch] = data->data_in [ch] ; + zoh->reset = 0 ; + } ; - zoh->in_count = data->input_frames * zoh->channels ; - zoh->out_count = data->output_frames * zoh->channels ; - zoh->in_used = zoh->out_gen = 0 ; + zoh->in_count = data->input_frames * zoh->channels ; + zoh->out_count = data->output_frames * zoh->channels ; + zoh->in_used = zoh->out_gen = 0 ; - src_ratio = psrc->last_ratio ; - input_index = psrc->last_position ; + src_ratio = psrc->last_ratio ; + input_index = psrc->last_position ; - /* Calculate samples before first sample in input array. */ - while (input_index < 1.0 && zoh->out_gen < zoh->out_count) - { - if (zoh->in_used + zoh->channels * input_index >= zoh->in_count) - break ; + /* Calculate samples before first sample in input array. */ + while (input_index < 1.0 && zoh->out_gen < zoh->out_count) + { + if (zoh->in_used + zoh->channels * input_index >= zoh->in_count) + break ; - if (zoh->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) - src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / zoh->out_count ; + if (zoh->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) + src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / zoh->out_count ; - for (ch = 0 ; ch < zoh->channels ; ch++) - { data->data_out [zoh->out_gen] = zoh->last_value [ch] ; - zoh->out_gen ++ ; - } ; + for (ch = 0 ; ch < zoh->channels ; ch++) + { data->data_out [zoh->out_gen] = zoh->last_value [ch] ; + zoh->out_gen ++ ; + } ; - /* Figure out the next index. */ - input_index += 1.0 / src_ratio ; - } ; + /* Figure out the next index. */ + input_index += 1.0 / src_ratio ; + } ; - rem = fmod_one (input_index) ; - zoh->in_used += zoh->channels * lrint (input_index - rem) ; - input_index = rem ; + rem = fmod_one (input_index) ; + zoh->in_used += zoh->channels * lrint (input_index - rem) ; + input_index = rem ; - /* Main processing loop. */ - while (zoh->out_gen < zoh->out_count && zoh->in_used + zoh->channels * input_index <= zoh->in_count) - { - if (zoh->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) - src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / zoh->out_count ; + /* Main processing loop. */ + while (zoh->out_gen < zoh->out_count && zoh->in_used + zoh->channels * input_index <= zoh->in_count) + { + if (zoh->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF) + src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / zoh->out_count ; - for (ch = 0 ; ch < zoh->channels ; ch++) - { data->data_out [zoh->out_gen] = data->data_in [zoh->in_used - zoh->channels + ch] ; - zoh->out_gen ++ ; - } ; + for (ch = 0 ; ch < zoh->channels ; ch++) + { data->data_out [zoh->out_gen] = data->data_in [zoh->in_used - zoh->channels + ch] ; + zoh->out_gen ++ ; + } ; - /* Figure out the next index. */ - input_index += 1.0 / src_ratio ; - rem = fmod_one (input_index) ; + /* Figure out the next index. */ + input_index += 1.0 / src_ratio ; + rem = fmod_one (input_index) ; - zoh->in_used += zoh->channels * lrint (input_index - rem) ; - input_index = rem ; - } ; + zoh->in_used += zoh->channels * lrint (input_index - rem) ; + input_index = rem ; + } ; - if (zoh->in_used > zoh->in_count) - { input_index += (zoh->in_used - zoh->in_count) / zoh->channels ; - zoh->in_used = zoh->in_count ; - } ; + if (zoh->in_used > zoh->in_count) + { input_index += (zoh->in_used - zoh->in_count) / zoh->channels ; + zoh->in_used = zoh->in_count ; + } ; - psrc->last_position = input_index ; + psrc->last_position = input_index ; - if (zoh->in_used > 0) - for (ch = 0 ; ch < zoh->channels ; ch++) - zoh->last_value [ch] = data->data_in [zoh->in_used - zoh->channels + ch] ; + if (zoh->in_used > 0) + for (ch = 0 ; ch < zoh->channels ; ch++) + zoh->last_value [ch] = data->data_in [zoh->in_used - zoh->channels + ch] ; - /* Save current ratio rather then target ratio. */ - psrc->last_ratio = src_ratio ; + /* Save current ratio rather then target ratio. */ + psrc->last_ratio = src_ratio ; - data->input_frames_used = zoh->in_used / zoh->channels ; - data->output_frames_gen = zoh->out_gen / zoh->channels ; + data->input_frames_used = zoh->in_used / zoh->channels ; + data->output_frames_gen = zoh->out_gen / zoh->channels ; - return SRC_ERR_NO_ERROR ; + return SRC_ERR_NO_ERROR ; } /* zoh_vari_process */ /*------------------------------------------------------------------------------ @@ -142,53 +142,53 @@ zoh_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) const char* zoh_get_name (int src_enum) { - if (src_enum == SRC_ZERO_ORDER_HOLD) - return "ZOH Interpolator" ; + if (src_enum == SRC_ZERO_ORDER_HOLD) + return "ZOH Interpolator" ; - return NULL ; + return NULL ; } /* zoh_get_name */ const char* zoh_get_description (int src_enum) { - if (src_enum == SRC_ZERO_ORDER_HOLD) - return "Zero order hold interpolator, very fast, poor quality." ; + if (src_enum == SRC_ZERO_ORDER_HOLD) + return "Zero order hold interpolator, very fast, poor quality." ; - return NULL ; + return NULL ; } /* zoh_get_descrition */ int zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) -{ ZOH_DATA *zoh = NULL ; +{ ZOH_DATA *zoh = NULL ; - if (src_enum != SRC_ZERO_ORDER_HOLD) - return SRC_ERR_BAD_CONVERTER ; + if (src_enum != SRC_ZERO_ORDER_HOLD) + return SRC_ERR_BAD_CONVERTER ; - if (psrc->private_data != NULL) - { zoh = (ZOH_DATA*) psrc->private_data ; - if (zoh->zoh_magic_marker != ZOH_MAGIC_MARKER) - { free (psrc->private_data) ; - psrc->private_data = NULL ; - } ; - } ; + if (psrc->private_data != NULL) + { zoh = (ZOH_DATA*) psrc->private_data ; + if (zoh->zoh_magic_marker != ZOH_MAGIC_MARKER) + { free (psrc->private_data) ; + psrc->private_data = NULL ; + } ; + } ; - if (psrc->private_data == NULL) - { zoh = calloc (1, sizeof (*zoh) + psrc->channels * sizeof (float)) ; - if (zoh == NULL) - return SRC_ERR_MALLOC_FAILED ; - psrc->private_data = zoh ; - } ; + if (psrc->private_data == NULL) + { zoh = calloc (1, sizeof (*zoh) + psrc->channels * sizeof (float)) ; + if (zoh == NULL) + return SRC_ERR_MALLOC_FAILED ; + psrc->private_data = zoh ; + } ; - zoh->zoh_magic_marker = ZOH_MAGIC_MARKER ; - zoh->channels = psrc->channels ; + zoh->zoh_magic_marker = ZOH_MAGIC_MARKER ; + zoh->channels = psrc->channels ; - psrc->const_process = zoh_vari_process ; - psrc->vari_process = zoh_vari_process ; - psrc->reset = zoh_reset ; + psrc->const_process = zoh_vari_process ; + psrc->vari_process = zoh_vari_process ; + psrc->reset = zoh_reset ; - zoh_reset (psrc) ; + zoh_reset (psrc) ; - return SRC_ERR_NO_ERROR ; + return SRC_ERR_NO_ERROR ; } /* zoh_set_converter */ /*=================================================================================== @@ -196,16 +196,16 @@ zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) static void zoh_reset (SRC_PRIVATE *psrc) -{ ZOH_DATA *zoh ; +{ ZOH_DATA *zoh ; - zoh = (ZOH_DATA*) psrc->private_data ; - if (zoh == NULL) - return ; + zoh = (ZOH_DATA*) psrc->private_data ; + if (zoh == NULL) + return ; - zoh->channels = psrc->channels ; - zoh->reset = 1 ; - memset (zoh->last_value, 0, sizeof (zoh->last_value [0]) * zoh->channels) ; + zoh->channels = psrc->channels ; + zoh->reset = 1 ; + memset (zoh->last_value, 0, sizeof (zoh->last_value [0]) * zoh->channels) ; - return ; + return ; } /* zoh_reset */ diff --git a/source/sound/fm.c b/source/sound/fm.c index 05ebc60..b31eaaa 100644 --- a/source/sound/fm.c +++ b/source/sound/fm.c @@ -13,9 +13,9 @@ ** History: ** ** 2006-2008 Eke-Eke (gamecube&wii port of Genesis Plus): -** - fixed internal FM timer emulation -** - removed unused multichip support and YMxxx support -** - fixed CH3 CSM mode (which games actually use this ?), credits to Nemesis +** - fixed internal FM timer emulation +** - removed unused multichip support and YMxxx support +** - fixed CH3 CSM mode (which games actually use this ?), credits to Nemesis ** - implemented Detune overflow (Ariel, Comix Zone, Shaq Fu, Spiderman & many others), credits to Nemesis ** - fixed SSG-EG support (Asterix, Bubba'n Six & many others), credits to Nemesis ** - modified EG rates, tested by Nemesis on real hardware @@ -115,35 +115,35 @@ #include "shared.h" /* globals */ -#define FREQ_SH 16 /* 16.16 fixed point (frequency calculations) */ -#define EG_SH 16 /* 16.16 fixed point (envelope generator timing) */ -#define LFO_SH 24 /* 8.24 fixed point (LFO calculations) */ -#define TIMER_SH 16 /* 16.16 fixed point (timers calculations) */ +#define FREQ_SH 16 /* 16.16 fixed point (frequency calculations) */ +#define EG_SH 16 /* 16.16 fixed point (envelope generator timing) */ +#define LFO_SH 24 /* 8.24 fixed point (LFO calculations) */ +#define TIMER_SH 16 /* 16.16 fixed point (timers calculations) */ -#define FREQ_MASK ((1<>3) +#define ENV_QUIET (TL_TAB_LEN>>3) /* sin waveform table in 'decibel' scale */ static unsigned int sin_tab[SIN_LEN]; @@ -207,7 +207,7 @@ static const UINT8 eg_inc[19*RATE_STEPS]={ #define O(a) (a*RATE_STEPS) /*note that there is no O(17) in this table - it's directly in the code */ -static const UINT8 eg_rate_select[32+64+32]={ /* Envelope Generator rates (32 + 64 rates + 32 RKS) */ +static const UINT8 eg_rate_select[32+64+32]={ /* Envelope Generator rates (32 + 64 rates + 32 RKS) */ /* 32 infinite time rates */ O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), O(18),O(18),O(18),O(18),O(18),O(18),O(18),O(18), @@ -259,7 +259,7 @@ O(16),O(16),O(16),O(16),O(16),O(16),O(16),O(16) /*mask 2047, 1023, 511, 255, 127, 63, 31, 15, 7, 3, 1, 0, 0, 0, 0, 0 */ #define O(a) (a*1) -static const UINT8 eg_rate_shift[32+64+32]={ /* Envelope Generator counter shifts (32 + 64 rates + 32 RKS) */ +static const UINT8 eg_rate_shift[32+64+32]={ /* Envelope Generator counter shifts (32 + 64 rates + 32 RKS) */ /* 32 infinite time rates */ O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), O(0),O(0),O(0),O(0),O(0),O(0),O(0),O(0), @@ -304,17 +304,17 @@ O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0) static const UINT8 dt_tab[4 * 32]={ /* this is YM2151 and YM2612 phase increment data (in 10.10 fixed point format)*/ /* FD=0 */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* FD=1 */ - 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, - 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8, + 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8, /* FD=2 */ - 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, - 5, 6, 6, 7, 8, 8, 9,10,11,12,13,14,16,16,16,16, + 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, + 5, 6, 6, 7, 8, 8, 9,10,11,12,13,14,16,16,16,16, /* FD=3 */ - 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, - 8 , 8, 9,10,11,12,13,14,16,17,19,20,22,22,22,22 + 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, + 8 , 8, 9,10,11,12,13,14,16,17,19,20,22,22,22,22 }; @@ -370,7 +370,8 @@ static const UINT8 lfo_ams_depth_shift[4] = {8, 3, 1, 0}; samples (32*432=13824; 32 because we store only a quarter of whole waveform in the table below) */ -static const UINT8 lfo_pm_output[7*8][8]={ /* 7 bits meaningful (of F-NUMBER), 8 LFO output levels per one depth (out of 32), 8 LFO depths */ +static const UINT8 lfo_pm_output[7*8][8]={ +/* 7 bits meaningful (of F-NUMBER), 8 LFO output levels per one depth (out of 32), 8 LFO depths */ /* FNUM BIT 4: 000 0001xxxx */ /* DEPTH 0 */ {0, 0, 0, 0, 0, 0, 0, 0}, /* DEPTH 1 */ {0, 0, 0, 0, 0, 0, 0, 0}, @@ -459,92 +460,91 @@ static INT32 lfo_pm_table[128*8*32]; /* 128 combinations of 7 bits meaningful (o /* struct describing a single operator (SLOT) */ typedef struct { - INT32 *DT; /* detune :dt_tab[DT] */ - UINT8 KSR; /* key scale rate :3-KSR */ - UINT32 ar; /* attack rate */ - UINT32 d1r; /* decay rate */ - UINT32 d2r; /* sustain rate */ - UINT32 rr; /* release rate */ - UINT8 ksr; /* key scale rate :kcode>>(3-KSR) */ - UINT32 mul; /* multiple :ML_TABLE[ML] */ + INT32 *DT; /* detune :dt_tab[DT] */ + UINT8 KSR; /* key scale rate :3-KSR */ + UINT32 ar; /* attack rate */ + UINT32 d1r; /* decay rate */ + UINT32 d2r; /* sustain rate */ + UINT32 rr; /* release rate */ + UINT8 ksr; /* key scale rate :kcode>>(3-KSR) */ + UINT32 mul; /* multiple :ML_TABLE[ML] */ - /* Phase Generator */ - UINT32 phase; /* phase counter */ - INT32 Incr; /* phase step */ + /* Phase Generator */ + UINT32 phase; /* phase counter */ + INT32 Incr; /* phase step */ - /* Envelope Generator */ - UINT8 state; /* phase type */ - UINT32 tl; /* total level: TL << 3 */ - INT32 volume; /* envelope counter */ - UINT32 sl; /* sustain level:sl_table[SL] */ - UINT32 vol_out; /* current output from EG circuit (without AM from LFO) */ + /* Envelope Generator */ + UINT8 state; /* phase type */ + UINT32 tl; /* total level: TL << 3 */ + INT32 volume; /* envelope counter */ + UINT32 sl; /* sustain level:sl_table[SL] */ + UINT32 vol_out; /* current output from EG circuit (without AM from LFO) */ - UINT8 eg_sh_ar; /* (attack state) */ - UINT8 eg_sel_ar; /* (attack state) */ - UINT8 eg_sh_d1r; /* (decay state) */ - UINT8 eg_sel_d1r; /* (decay state) */ - UINT8 eg_sh_d2r; /* (sustain state) */ - UINT8 eg_sel_d2r; /* (sustain state) */ - UINT8 eg_sh_rr; /* (release state) */ - UINT8 eg_sel_rr; /* (release state) */ + UINT8 eg_sh_ar; /* (attack state) */ + UINT8 eg_sel_ar; /* (attack state) */ + UINT8 eg_sh_d1r; /* (decay state) */ + UINT8 eg_sel_d1r; /* (decay state) */ + UINT8 eg_sh_d2r; /* (sustain state) */ + UINT8 eg_sel_d2r; /* (sustain state) */ + UINT8 eg_sh_rr; /* (release state) */ + UINT8 eg_sel_rr; /* (release state) */ - UINT8 ssg; /* SSG-EG waveform */ - UINT8 ssgn; /* SSG-EG negated output */ + UINT8 ssg; /* SSG-EG waveform */ + UINT8 ssgn; /* SSG-EG negated output */ - UINT32 key; /* 0=last key was KEY OFF, 1=KEY ON */ + UINT32 key; /* 0=last key was KEY OFF, 1=KEY ON */ - /* LFO */ - UINT32 AMmask; /* AM enable flag */ + /* LFO */ + UINT32 AMmask; /* AM enable flag */ } FM_SLOT; typedef struct { - FM_SLOT SLOT[4]; /* four SLOTs (operators) */ + FM_SLOT SLOT[4]; /* four SLOTs (operators) */ - UINT8 ALGO; /* algorithm */ - UINT8 FB; /* feedback shift */ - INT32 op1_out[2]; /* op1 output for feedback */ + UINT8 ALGO; /* algorithm */ + UINT8 FB; /* feedback shift */ + INT32 op1_out[2]; /* op1 output for feedback */ - INT32 *connect1; /* SLOT1 output pointer */ - INT32 *connect3; /* SLOT3 output pointer */ - INT32 *connect2; /* SLOT2 output pointer */ - INT32 *connect4; /* SLOT4 output pointer */ + INT32 *connect1; /* SLOT1 output pointer */ + INT32 *connect3; /* SLOT3 output pointer */ + INT32 *connect2; /* SLOT2 output pointer */ + INT32 *connect4; /* SLOT4 output pointer */ - INT32 *mem_connect; /* where to put the delayed sample (MEM) */ - INT32 mem_value; /* delayed sample (MEM) value */ + INT32 *mem_connect; /* where to put the delayed sample (MEM) */ + INT32 mem_value; /* delayed sample (MEM) value */ - INT32 pms; /* channel PMS */ - UINT8 ams; /* channel AMS */ + INT32 pms; /* channel PMS */ + UINT8 ams; /* channel AMS */ - UINT32 fc; /* fnum,blk:adjusted to sample rate */ - UINT8 kcode; /* key code: */ - UINT32 block_fnum; /* current blk/fnum value for this slot (can be different betweeen slots of one channel in 3slot mode) */ + UINT32 fc; /* fnum,blk:adjusted to sample rate */ + UINT8 kcode; /* key code */ + UINT32 block_fnum; /* current blk/fnum value for this slot (can be different betweeen slots of one channel in 3slot mode) */ } FM_CH; typedef struct { - UINT32 clock; /* master clock (Hz) */ - UINT32 rate; /* sampling rate (Hz) */ - double freqbase; /* frequency base */ - UINT8 address[2]; /* address register */ - UINT8 status; /* status flag */ - UINT32 mode; /* mode CSM / 3SLOT */ - UINT8 fn_h; /* freq latch */ - INT32 TimerBase; /* Timer base time */ - INT32 TA; /* timer a value */ - INT32 TAL; /* timer a base */ - INT32 TAC; /* timer a counter */ - INT32 TB; /* timer b value */ - INT32 TBL; /* timer b base */ - INT32 TBC; /* timer b counter */ - INT32 dt_tab[8][32]; /* DeTune table */ + UINT32 clock; /* master clock (Hz) */ + UINT32 rate; /* sampling rate (Hz) */ + double freqbase; /* frequency base */ + UINT8 address[2]; /* address register */ + UINT8 status; /* status flag */ + UINT32 mode; /* mode CSM / 3SLOT */ + UINT8 fn_h; /* freq latch */ + INT32 TimerBase; /* Timer base time */ + INT32 TA; /* timer a value */ + INT32 TAL; /* timer a base */ + INT32 TAC; /* timer a counter */ + INT32 TB; /* timer b value */ + INT32 TBL; /* timer b base */ + INT32 TBC; /* timer b counter */ + INT32 dt_tab[8][32]; /* DeTune table */ } FM_ST; - /***********************************************************/ /* OPN unit */ /***********************************************************/ @@ -552,33 +552,33 @@ typedef struct /* OPN 3slot struct */ typedef struct { - UINT32 fc[3]; /* fnum3,blk3: calculated */ - UINT8 fn_h; /* freq3 latch */ - UINT8 kcode[3]; /* key code */ - UINT32 block_fnum[3]; /* current fnum value for this slot (can be different betweeen slots of one channel in 3slot mode) */ + UINT32 fc[3]; /* fnum3,blk3: calculated */ + UINT8 fn_h; /* freq3 latch */ + UINT8 kcode[3]; /* key code */ + UINT32 block_fnum[3]; /* current fnum value for this slot (can be different betweeen slots of one channel in 3slot mode) */ } FM_3SLOT; /* OPN/A/B common state */ typedef struct { - FM_ST ST; /* general state */ - FM_3SLOT SL3; /* 3 slot mode state */ - unsigned int pan[6*2]; /* fm channels output masks (0xffffffff = enable) */ + FM_ST ST; /* general state */ + FM_3SLOT SL3; /* 3 slot mode state */ + unsigned int pan[6*2]; /* fm channels output masks (0xffffffff = enable) */ - UINT32 eg_cnt; /* global envelope generator counter */ - UINT32 eg_timer; /* global envelope generator counter works at frequency = chipclock/64/3 */ - UINT32 eg_timer_add; /* step of eg_timer */ - UINT32 eg_timer_overflow; /* envelope generator timer overlfows every 3 samples (on real chip) */ + UINT32 eg_cnt; /* global envelope generator counter */ + UINT32 eg_timer; /* global envelope generator counter works at frequency = chipclock/64/3 */ + UINT32 eg_timer_add; /* step of eg_timer */ + UINT32 eg_timer_overflow; /* envelope generator timer overlfows every 3 samples (on real chip) */ - /* there are 2048 FNUMs that can be generated using FNUM/BLK registers + /* there are 2048 FNUMs that can be generated using FNUM/BLK registers but LFO works with one more bit of a precision so we really need 4096 elements */ - UINT32 fn_table[4096]; /* fnumber->increment counter */ - UINT32 fn_max; /* max increment (required for calculating phase overflow) */ + UINT32 fn_table[4096]; /* fnumber->increment counter */ + UINT32 fn_max; /* max increment (required for calculating phase overflow) */ - /* LFO */ - UINT32 lfo_cnt; /* current LFO phase */ - UINT32 lfo_inc; /* step of LFO counter */ - UINT32 lfo_freq[8]; /* LFO FREQ table */ + /* LFO */ + UINT32 lfo_cnt; /* current LFO phase */ + UINT32 lfo_inc; /* step of LFO counter */ + UINT32 lfo_freq[8]; /* LFO FREQ table */ } FM_OPN; /***********************************************************/ @@ -586,48 +586,48 @@ typedef struct /***********************************************************/ typedef struct { - FM_CH CH[6]; /* channel state */ - UINT8 dacen; /* DAC mode */ - INT32 dacout; /* DAC output */ - FM_OPN OPN; /* OPN state */ + FM_CH CH[6]; /* channel state */ + UINT8 dacen; /* DAC mode */ + INT32 dacout; /* DAC output */ + FM_OPN OPN; /* OPN state */ } YM2612; /* emulated chip */ static YM2612 ym2612; /* current chip state */ -static INT32 m2,c1,c2; /* Phase Modulation input for operators 2,3,4 */ -static INT32 mem; /* one sample delay memory */ -static INT32 out_fm[8]; /* outputs of working channels */ -static UINT32 LFO_AM; /* runtime LFO calculations helper */ -static INT32 LFO_PM; /* runtime LFO calculations helper */ +static INT32 m2,c1,c2; /* Phase Modulation input for operators 2,3,4 */ +static INT32 mem; /* one sample delay memory */ +static INT32 out_fm[8]; /* outputs of working channels */ +static UINT32 LFO_AM; /* runtime LFO calculations helper */ +static INT32 LFO_PM; /* runtime LFO calculations helper */ /* limitter */ #define Limit(val, max,min) { \ - if ( val > max ) val = max; \ - else if ( val < min ) val = min; \ + if ( val > max ) val = max; \ + else if ( val < min ) val = min; \ } /* OPN Mode Register Write */ INLINE void set_timers(int v ) { - /* b7 = CSM MODE */ - /* b6 = 3 slot mode */ - /* b5 = reset b */ - /* b4 = reset a */ - /* b3 = timer enable b */ - /* b2 = timer enable a */ - /* b1 = load b */ - /* b0 = load a */ + /* b7 = CSM MODE */ + /* b6 = 3 slot mode */ + /* b5 = reset b */ + /* b4 = reset a */ + /* b3 = timer enable b */ + /* b2 = timer enable a */ + /* b1 = load b */ + /* b0 = load a */ - if ((ym2612.OPN.ST.mode ^ v) & 0xC0) ym2612.CH[2].SLOT[SLOT1].Incr=-1; /* recalculate phase (from gens) */ + if ((ym2612.OPN.ST.mode ^ v) & 0xC0) ym2612.CH[2].SLOT[SLOT1].Incr=-1; /* recalculate phase (from gens) */ /* reload Timers */ if ((v&1) & !(ym2612.OPN.ST.mode&1)) ym2612.OPN.ST.TAC = ym2612.OPN.ST.TAL; if ((v&2) & !(ym2612.OPN.ST.mode&2)) ym2612.OPN.ST.TBC = ym2612.OPN.ST.TBL; - /* reset Timers flags */ + /* reset Timers flags */ ym2612.OPN.ST.status &= (~v >> 4); ym2612.OPN.ST.mode = v; @@ -636,16 +636,16 @@ INLINE void set_timers(int v ) INLINE void FM_KEYON(FM_CH *CH , int s ) { - FM_SLOT *SLOT = &CH->SLOT[s]; - if( !SLOT->key ) + FM_SLOT *SLOT = &CH->SLOT[s]; + if( !SLOT->key ) { - SLOT->key = 1; - SLOT->phase = 0; /* restart Phase Generator */ + SLOT->key = 1; + SLOT->phase = 0; /* restart Phase Generator */ SLOT->ssgn = (SLOT->ssg & 0x04) >> 1; - if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/) - { - SLOT->state = EG_ATT; /* phase -> Attack */ + if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/) + { + SLOT->state = EG_ATT; /* phase -> Attack */ } else { @@ -653,383 +653,383 @@ INLINE void FM_KEYON(FM_CH *CH , int s ) SLOT->volume = MIN_ATT_INDEX; SLOT->state = EG_DEC; } - } + } } INLINE void FM_KEYOFF(FM_CH *CH , int s ) { - FM_SLOT *SLOT = &CH->SLOT[s]; - if( SLOT->key ) - { - SLOT->key = 0; - if (SLOT->state>EG_REL) - { + FM_SLOT *SLOT = &CH->SLOT[s]; + if( SLOT->key ) + { + SLOT->key = 0; + if (SLOT->state>EG_REL) + { SLOT->state = EG_REL; /* phase -> Release */ - } + } } } /* set algorithm connection */ INLINE void setup_connection( FM_CH *CH, int ch ) { - INT32 *carrier = &out_fm[ch]; + INT32 *carrier = &out_fm[ch]; - INT32 **om1 = &CH->connect1; - INT32 **om2 = &CH->connect3; - INT32 **oc1 = &CH->connect2; + INT32 **om1 = &CH->connect1; + INT32 **om2 = &CH->connect3; + INT32 **oc1 = &CH->connect2; - INT32 **memc = &CH->mem_connect; + INT32 **memc = &CH->mem_connect; - switch( CH->ALGO ){ - case 0: - /* M1---C1---MEM---M2---C2---OUT */ - *om1 = &c1; - *oc1 = &mem; - *om2 = &c2; - *memc= &m2; - break; - case 1: - /* M1------+-MEM---M2---C2---OUT */ - /* C1-+ */ - *om1 = &mem; - *oc1 = &mem; - *om2 = &c2; - *memc= &m2; - break; - case 2: - /* M1-----------------+-C2---OUT */ - /* C1---MEM---M2-+ */ - *om1 = &c2; - *oc1 = &mem; - *om2 = &c2; - *memc= &m2; - break; - case 3: - /* M1---C1---MEM------+-C2---OUT */ - /* M2-+ */ - *om1 = &c1; - *oc1 = &mem; - *om2 = &c2; - *memc= &c2; - break; - case 4: - /* M1---C1-+-OUT */ - /* M2---C2-+ */ - /* MEM: not used */ - *om1 = &c1; - *oc1 = carrier; - *om2 = &c2; - *memc= &mem; /* store it anywhere where it will not be used */ - break; - case 5: - /* +----C1----+ */ - /* M1-+-MEM---M2-+-OUT */ - /* +----C2----+ */ - *om1 = 0; /* special mark */ - *oc1 = carrier; - *om2 = carrier; - *memc= &m2; - break; - case 6: - /* M1---C1-+ */ - /* M2-+-OUT */ - /* C2-+ */ - /* MEM: not used */ - *om1 = &c1; - *oc1 = carrier; - *om2 = carrier; - *memc= &mem; /* store it anywhere where it will not be used */ - break; - case 7: - /* M1-+ */ - /* C1-+-OUT */ - /* M2-+ */ - /* C2-+ */ - /* MEM: not used*/ - *om1 = carrier; - *oc1 = carrier; - *om2 = carrier; - *memc= &mem; /* store it anywhere where it will not be used */ - break; - } + switch( CH->ALGO ){ + case 0: + /* M1---C1---MEM---M2---C2---OUT */ + *om1 = &c1; + *oc1 = &mem; + *om2 = &c2; + *memc= &m2; + break; + case 1: + /* M1------+-MEM---M2---C2---OUT */ + /* C1-+ */ + *om1 = &mem; + *oc1 = &mem; + *om2 = &c2; + *memc= &m2; + break; + case 2: + /* M1-----------------+-C2---OUT */ + /* C1---MEM---M2-+ */ + *om1 = &c2; + *oc1 = &mem; + *om2 = &c2; + *memc= &m2; + break; + case 3: + /* M1---C1---MEM------+-C2---OUT */ + /* M2-+ */ + *om1 = &c1; + *oc1 = &mem; + *om2 = &c2; + *memc= &c2; + break; + case 4: + /* M1---C1-+-OUT */ + /* M2---C2-+ */ + /* MEM: not used */ + *om1 = &c1; + *oc1 = carrier; + *om2 = &c2; + *memc= &mem; /* store it anywhere where it will not be used */ + break; + case 5: + /* +----C1----+ */ + /* M1-+-MEM---M2-+-OUT */ + /* +----C2----+ */ + *om1 = 0; /* special mark */ + *oc1 = carrier; + *om2 = carrier; + *memc= &m2; + break; + case 6: + /* M1---C1-+ */ + /* M2-+-OUT */ + /* C2-+ */ + /* MEM: not used */ + *om1 = &c1; + *oc1 = carrier; + *om2 = carrier; + *memc= &mem; /* store it anywhere where it will not be used */ + break; + case 7: + /* M1-+ */ + /* C1-+-OUT */ + /* M2-+ */ + /* C2-+ */ + /* MEM: not used*/ + *om1 = carrier; + *oc1 = carrier; + *om2 = carrier; + *memc= &mem; /* store it anywhere where it will not be used */ + break; + } - CH->connect4 = carrier; + CH->connect4 = carrier; } /* set detune & multiple */ INLINE void set_det_mul(FM_CH *CH,FM_SLOT *SLOT,int v) { - SLOT->mul = (v&0x0f)? (v&0x0f)*2 : 1; - SLOT->DT = ym2612.OPN.ST.dt_tab[(v>>4)&7]; - CH->SLOT[SLOT1].Incr=-1; + SLOT->mul = (v&0x0f)? (v&0x0f)*2 : 1; + SLOT->DT = ym2612.OPN.ST.dt_tab[(v>>4)&7]; + CH->SLOT[SLOT1].Incr=-1; } /* set total level */ INLINE void set_tl(FM_CH *CH,FM_SLOT *SLOT , int v) { - SLOT->tl = (v&0x7f)<<(ENV_BITS-7); /* 7bit TL */ + SLOT->tl = (v&0x7f)<<(ENV_BITS-7); /* 7bit TL */ } /* set attack rate & key scale */ INLINE void set_ar_ksr(FM_CH *CH,FM_SLOT *SLOT,int v) { - UINT8 old_KSR = SLOT->KSR; + UINT8 old_KSR = SLOT->KSR; - SLOT->ar = (v&0x1f) ? 32 + ((v&0x1f)<<1) : 0; + SLOT->ar = (v&0x1f) ? 32 + ((v&0x1f)<<1) : 0; - SLOT->KSR = 3-(v>>6); - if (SLOT->KSR != old_KSR) - { - CH->SLOT[SLOT1].Incr=-1; - } + SLOT->KSR = 3-(v>>6); + if (SLOT->KSR != old_KSR) + { + CH->SLOT[SLOT1].Incr=-1; + } - /* refresh Attack rate */ - if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/) - { - SLOT->eg_sh_ar = eg_rate_shift [SLOT->ar + SLOT->ksr ]; - SLOT->eg_sel_ar = eg_rate_select[SLOT->ar + SLOT->ksr ]; - } - else - { - SLOT->eg_sh_ar = 0; - SLOT->eg_sel_ar = 17*RATE_STEPS; - } - } + /* refresh Attack rate */ + if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/) + { + SLOT->eg_sh_ar = eg_rate_shift [SLOT->ar + SLOT->ksr ]; + SLOT->eg_sel_ar = eg_rate_select[SLOT->ar + SLOT->ksr ]; + } + else + { + SLOT->eg_sh_ar = 0; + SLOT->eg_sel_ar = 17*RATE_STEPS; + } + } /* set decay rate */ INLINE void set_dr(FM_SLOT *SLOT,int v) { - SLOT->d1r = (v&0x1f) ? 32 + ((v&0x1f)<<1) : 0; + SLOT->d1r = (v&0x1f) ? 32 + ((v&0x1f)<<1) : 0; - SLOT->eg_sh_d1r = eg_rate_shift [SLOT->d1r + SLOT->ksr]; - SLOT->eg_sel_d1r= eg_rate_select[SLOT->d1r + SLOT->ksr]; + SLOT->eg_sh_d1r = eg_rate_shift [SLOT->d1r + SLOT->ksr]; + SLOT->eg_sel_d1r= eg_rate_select[SLOT->d1r + SLOT->ksr]; } /* set sustain rate */ INLINE void set_sr(FM_SLOT *SLOT,int v) { - SLOT->d2r = (v&0x1f) ? 32 + ((v&0x1f)<<1) : 0; + SLOT->d2r = (v&0x1f) ? 32 + ((v&0x1f)<<1) : 0; - SLOT->eg_sh_d2r = eg_rate_shift [SLOT->d2r + SLOT->ksr]; - SLOT->eg_sel_d2r= eg_rate_select[SLOT->d2r + SLOT->ksr]; + SLOT->eg_sh_d2r = eg_rate_shift [SLOT->d2r + SLOT->ksr]; + SLOT->eg_sel_d2r= eg_rate_select[SLOT->d2r + SLOT->ksr]; } /* set release rate */ INLINE void set_sl_rr(FM_SLOT *SLOT,int v) { - SLOT->sl = sl_table[ v>>4 ]; + SLOT->sl = sl_table[ v>>4 ]; - SLOT->rr = 34 + ((v&0x0f)<<2); + SLOT->rr = 34 + ((v&0x0f)<<2); - SLOT->eg_sh_rr = eg_rate_shift [SLOT->rr + SLOT->ksr]; - SLOT->eg_sel_rr = eg_rate_select[SLOT->rr + SLOT->ksr]; + SLOT->eg_sh_rr = eg_rate_shift [SLOT->rr + SLOT->ksr]; + SLOT->eg_sel_rr = eg_rate_select[SLOT->rr + SLOT->ksr]; } INLINE signed int op_calc(UINT32 phase, unsigned int env, signed int pm) { - UINT32 p; + UINT32 p; - p = (env<<3) + sin_tab[ ( ((signed int)((phase & ~FREQ_MASK) + (pm<<15))) >> FREQ_SH ) & SIN_MASK ]; + p = (env<<3) + sin_tab[ ( ((signed int)((phase & ~FREQ_MASK) + (pm<<15))) >> FREQ_SH ) & SIN_MASK ]; - if (p >= TL_TAB_LEN) - return 0; - return tl_tab[p]; + if (p >= TL_TAB_LEN) + return 0; + return tl_tab[p]; } INLINE signed int op_calc1(UINT32 phase, unsigned int env, signed int pm) { - UINT32 p; + UINT32 p; - p = (env<<3) + sin_tab[ ( ((signed int)((phase & ~FREQ_MASK) + pm )) >> FREQ_SH ) & SIN_MASK ]; + p = (env<<3) + sin_tab[ ( ((signed int)((phase & ~FREQ_MASK) + pm )) >> FREQ_SH ) & SIN_MASK ]; - if (p >= TL_TAB_LEN) - return 0; - return tl_tab[p]; + if (p >= TL_TAB_LEN) + return 0; + return tl_tab[p]; } /* advance LFO to next sample */ INLINE void advance_lfo() { - UINT8 pos; - /*UINT8 prev_pos;*/ + UINT8 pos; + /*UINT8 prev_pos;*/ - if (ym2612.OPN.lfo_inc) /* LFO enabled ? */ - { - /*prev_pos = ym2612.OPN.lfo_cnt>>LFO_SH & 127;*/ - - ym2612.OPN.lfo_cnt += ym2612.OPN.lfo_inc; - - pos = ( ym2612.OPN.lfo_cnt >> LFO_SH) & 127; + if (ym2612.OPN.lfo_inc) /* LFO enabled ? */ + { + /*prev_pos = ym2612.OPN.lfo_cnt>>LFO_SH & 127;*/ + + ym2612.OPN.lfo_cnt += ym2612.OPN.lfo_inc; + + pos = ( ym2612.OPN.lfo_cnt >> LFO_SH) & 127; - /* update AM when LFO output changes */ + /* update AM when LFO output changes */ - /*if (prev_pos != pos)*/ - /* actually I can't optimize is this way without rewritting chan_calc() + /*if (prev_pos != pos)*/ + /* actually I can't optimize is this way without rewritting chan_calc() to use chip->lfo_am instead of global lfo_am */ - { + { - /* triangle */ - /* AM: 0 to 126 step +2, 126 to 0 step -2 */ - if (pos<64) - LFO_AM = (pos&63) * 2; - else - LFO_AM = 126 - ((pos&63) * 2); - } + /* triangle */ + /* AM: 0 to 126 step +2, 126 to 0 step -2 */ + if (pos<64) + LFO_AM = (pos&63) * 2; + else + LFO_AM = 126 - ((pos&63) * 2); + } - /* PM works with 4 times slower clock */ - /*prev_pos >>= 2;*/ - pos >>= 2; - /* update PM when LFO output changes */ - /*if (prev_pos != pos)*/ /* can't use global lfo_pm for this optimization, must be chip->lfo_pm instead*/ - { - LFO_PM = pos; - } + /* PM works with 4 times slower clock */ + /*prev_pos >>= 2;*/ + pos >>= 2; + /* update PM when LFO output changes */ + /*if (prev_pos != pos)*/ /* can't use global lfo_pm for this optimization, must be chip->lfo_pm instead*/ + { + LFO_PM = pos; + } - } - else - { - LFO_AM = 0; - LFO_PM = 0; - } + } + else + { + LFO_AM = 0; + LFO_PM = 0; + } } INLINE void advance_eg_channel(FM_SLOT *SLOT) { - unsigned int swap_flag = 0; - unsigned int i = 4; /* four operators per channel */ + unsigned int swap_flag = 0; + unsigned int i = 4; /* four operators per channel */ - do - { + do + { /* reset SSG-EG swap flag (Eke-Eke) */ swap_flag = 0; - switch(SLOT->state) - { - case EG_ATT: /* attack phase */ - if (!(ym2612.OPN.eg_cnt & ((1<eg_sh_ar)-1))) - { - SLOT->volume += (~SLOT->volume * (eg_inc[SLOT->eg_sel_ar + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_ar)&7)]))>>4; - if (SLOT->volume <= MIN_ATT_INDEX) - { - SLOT->volume = MIN_ATT_INDEX; - SLOT->state = EG_DEC; - } - } - break; + switch(SLOT->state) + { + case EG_ATT: /* attack phase */ + if (!(ym2612.OPN.eg_cnt & ((1<eg_sh_ar)-1))) + { + SLOT->volume += (~SLOT->volume * (eg_inc[SLOT->eg_sel_ar + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_ar)&7)]))>>4; + if (SLOT->volume <= MIN_ATT_INDEX) + { + SLOT->volume = MIN_ATT_INDEX; + SLOT->state = EG_DEC; + } + } + break; - case EG_DEC: /* decay phase */ - if ( !(ym2612.OPN.eg_cnt & ((1<eg_sh_d1r)-1) ) ) - { - if (SLOT->ssg&0x08) /* SSG EG type envelope selected */ + case EG_DEC: /* decay phase */ + if ( !(ym2612.OPN.eg_cnt & ((1<eg_sh_d1r)-1) ) ) + { + if (SLOT->ssg&0x08) /* SSG EG type envelope selected */ SLOT->volume += 6 * eg_inc[SLOT->eg_sel_d1r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d1r)&7)]; - else - SLOT->volume += eg_inc[SLOT->eg_sel_d1r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d1r)&7)]; + else + SLOT->volume += eg_inc[SLOT->eg_sel_d1r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d1r)&7)]; } /* check transition even if no volume update: this fixes the case when SL = MIN_ATT_INDEX */ - if ( SLOT->volume >= (INT32)(SLOT->sl) ) - { + if ( SLOT->volume >= (INT32)(SLOT->sl) ) + { SLOT->volume = (INT32)(SLOT->sl); SLOT->state = EG_SUS; } - break; + break; - case EG_SUS: /* sustain phase */ - if (SLOT->ssg&0x08) /* SSG EG type envelope selected */ - { - if ( !(ym2612.OPN.eg_cnt & ((1<eg_sh_d2r)-1) ) ) - { + case EG_SUS: /* sustain phase */ + if (SLOT->ssg&0x08) /* SSG EG type envelope selected */ + { + if ( !(ym2612.OPN.eg_cnt & ((1<eg_sh_d2r)-1) ) ) + { /* Nemesis */ SLOT->volume += 6 * eg_inc[SLOT->eg_sel_d2r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d2r)&7)]; } if ( SLOT->volume >= ENV_QUIET) /* Alone Coder */ - { - if (SLOT->ssg&0x01) /* bit 0 = hold */ - { - if (SLOT->ssgn&1) /* have we swapped once ??? */ - { - /* yes, so do nothing, just hold current level */ - } - else - swap_flag = (SLOT->ssg&0x02) | 1 ; /* bit 1 = alternate */ - } - else - { - /* same as KEY-ON operation */ + { + if (SLOT->ssg&0x01) /* bit 0 = hold */ + { + if (SLOT->ssgn&1) /* have we swapped once ??? */ + { + /* yes, so do nothing, just hold current level */ + } + else + swap_flag = (SLOT->ssg&0x02) | 1 ; /* bit 1 = alternate */ + } + else + { + /* same as KEY-ON operation */ - /* restart of the Phase Generator should be here */ - SLOT->phase = 0; + /* restart of the Phase Generator should be here */ + SLOT->phase = 0; if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/) { - SLOT->state = EG_ATT; /* phase -> Attack */ + SLOT->state = EG_ATT; /* phase -> Attack */ } else { /* Attack Rate is maximal: directly switch to Decay (or Substain) */ SLOT->volume = MIN_ATT_INDEX; - SLOT->state = (SLOT->sl == MIN_ATT_INDEX) ? EG_SUS : EG_DEC; + SLOT->state = (SLOT->sl == MIN_ATT_INDEX) ? EG_SUS : EG_DEC; } - swap_flag = (SLOT->ssg&0x02); /* bit 1 = alternate */ + swap_flag = (SLOT->ssg&0x02); /* bit 1 = alternate */ - } - } + } + } } - else - { - if ( !(ym2612.OPN.eg_cnt & ((1<eg_sh_d2r)-1) ) ) - { + else + { + if ( !(ym2612.OPN.eg_cnt & ((1<eg_sh_d2r)-1) ) ) + { SLOT->volume += eg_inc[SLOT->eg_sel_d2r + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_d2r)&7)]; - if ( SLOT->volume >= MAX_ATT_INDEX ) - SLOT->volume = MAX_ATT_INDEX; - /* do not change SLOT->state (verified on real chip) */ - } - } - break; + if ( SLOT->volume >= MAX_ATT_INDEX ) + SLOT->volume = MAX_ATT_INDEX; + /* do not change SLOT->state (verified on real chip) */ + } + } + break; - case EG_REL: /* release phase */ - if ( !(ym2612.OPN.eg_cnt & ((1<eg_sh_rr)-1) ) ) - { + case EG_REL: /* release phase */ + if ( !(ym2612.OPN.eg_cnt & ((1<eg_sh_rr)-1) ) ) + { if (SLOT->ssg&0x08) /* SSG-EG affects Release phase also (Nemesis) */ SLOT->volume += 6 * eg_inc[SLOT->eg_sel_rr + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_rr)&7)]; else SLOT->volume += eg_inc[SLOT->eg_sel_rr + ((ym2612.OPN.eg_cnt>>SLOT->eg_sh_rr)&7)]; - if ( SLOT->volume >= MAX_ATT_INDEX ) - { - SLOT->volume = MAX_ATT_INDEX; - SLOT->state = EG_OFF; - } - } - break; + if ( SLOT->volume >= MAX_ATT_INDEX ) + { + SLOT->volume = MAX_ATT_INDEX; + SLOT->state = EG_OFF; + } + } + break; - } + } unsigned int out = (UINT32)SLOT->volume; - /* negate output (changes come from alternate bit, init comes from attack bit) */ + /* negate output (changes come from alternate bit, init comes from attack bit) */ if ((SLOT->ssg&0x08) && (SLOT->ssgn&2) && (SLOT->state > EG_REL)) - out ^= MAX_ATT_INDEX; + out ^= MAX_ATT_INDEX; - /* we need to store the result here because we are going to change ssgn + /* we need to store the result here because we are going to change ssgn in next instruction */ - SLOT->vol_out = out + SLOT->tl; + SLOT->vol_out = out + SLOT->tl; - /* reverse SLOT inversion flag if required */ + /* reverse SLOT inversion flag if required */ SLOT->ssgn ^= swap_flag; - SLOT++; - i--; - } while (i); + SLOT++; + i--; + } while (i); } @@ -1041,8 +1041,8 @@ INLINE void update_phase_lfo_slot(FM_SLOT *SLOT , INT32 pms, UINT32 block_fnum) { UINT32 fnum_lfo = ((block_fnum & 0x7f0) >> 4) * 32 * 8; INT32 lfo_fn_table_index_offset = lfo_pm_table[ fnum_lfo + pms + LFO_PM ]; - - if (lfo_fn_table_index_offset) /* LFO phase modulation active */ + + if (lfo_fn_table_index_offset) /* LFO phase modulation active */ { block_fnum = block_fnum*2 + lfo_fn_table_index_offset; @@ -1061,7 +1061,7 @@ INLINE void update_phase_lfo_slot(FM_SLOT *SLOT , INT32 pms, UINT32 block_fnum) /* update phase */ SLOT->phase += (fc * SLOT->mul) >> 1; } - else /* LFO phase modulation = zero */ + else /* LFO phase modulation = zero */ { SLOT->phase += SLOT->Incr; } @@ -1071,20 +1071,20 @@ INLINE void update_phase_lfo_channel(FM_CH *CH) { UINT32 block_fnum = CH->block_fnum; - UINT32 fnum_lfo = ((block_fnum & 0x7f0) >> 4) * 32 * 8; - INT32 lfo_fn_table_index_offset = lfo_pm_table[ fnum_lfo + CH->pms + LFO_PM ]; + UINT32 fnum_lfo = ((block_fnum & 0x7f0) >> 4) * 32 * 8; + INT32 lfo_fn_table_index_offset = lfo_pm_table[ fnum_lfo + CH->pms + LFO_PM ]; - if (lfo_fn_table_index_offset) /* LFO phase modulation active */ - { + if (lfo_fn_table_index_offset) /* LFO phase modulation active */ + { block_fnum = block_fnum*2 + lfo_fn_table_index_offset; - UINT8 blk = (block_fnum&0x7000) >> 12; - UINT32 fn = block_fnum & 0xfff; - + UINT8 blk = (block_fnum&0x7000) >> 12; + UINT32 fn = block_fnum & 0xfff; + /* keyscale code */ - int kc = (blk<<2) | opn_fktable[fn >> 8]; + int kc = (blk<<2) | opn_fktable[fn >> 8]; - /* (frequency) phase increment counter */ + /* (frequency) phase increment counter */ int fc = (ym2612.OPN.fn_table[fn]>>(7-blk)); /* (frequency) phase overflow (credits to Nemesis) */ @@ -1104,70 +1104,70 @@ INLINE void update_phase_lfo_channel(FM_CH *CH) if (finc < 0) finc += ym2612.OPN.fn_max; CH->SLOT[SLOT4].phase += (finc*CH->SLOT[SLOT4].mul) >> 1; } - else /* LFO phase modulation = zero */ - { - CH->SLOT[SLOT1].phase += CH->SLOT[SLOT1].Incr; - CH->SLOT[SLOT2].phase += CH->SLOT[SLOT2].Incr; - CH->SLOT[SLOT3].phase += CH->SLOT[SLOT3].Incr; - CH->SLOT[SLOT4].phase += CH->SLOT[SLOT4].Incr; - } + else /* LFO phase modulation = zero */ + { + CH->SLOT[SLOT1].phase += CH->SLOT[SLOT1].Incr; + CH->SLOT[SLOT2].phase += CH->SLOT[SLOT2].Incr; + CH->SLOT[SLOT3].phase += CH->SLOT[SLOT3].Incr; + CH->SLOT[SLOT4].phase += CH->SLOT[SLOT4].Incr; + } } INLINE void chan_calc(FM_CH *CH) { - unsigned int eg_out; + unsigned int eg_out; - UINT32 AM = LFO_AM >> CH->ams; + UINT32 AM = LFO_AM >> CH->ams; - m2 = c1 = c2 = mem = 0; + m2 = c1 = c2 = mem = 0; - *CH->mem_connect = CH->mem_value; /* restore delayed sample (MEM) value to m2 or c2 */ + *CH->mem_connect = CH->mem_value; /* restore delayed sample (MEM) value to m2 or c2 */ - eg_out = volume_calc(&CH->SLOT[SLOT1]); - { - INT32 out = CH->op1_out[0] + CH->op1_out[1]; - CH->op1_out[0] = CH->op1_out[1]; + eg_out = volume_calc(&CH->SLOT[SLOT1]); + { + INT32 out = CH->op1_out[0] + CH->op1_out[1]; + CH->op1_out[0] = CH->op1_out[1]; - if( !CH->connect1 ){ - /* algorithm 5 */ - mem = c1 = c2 = CH->op1_out[0]; - }else{ - /* other algorithms */ - *CH->connect1 += CH->op1_out[0]; - } + if( !CH->connect1 ){ + /* algorithm 5 */ + mem = c1 = c2 = CH->op1_out[0]; + }else{ + /* other algorithms */ + *CH->connect1 += CH->op1_out[0]; + } - CH->op1_out[1] = 0; - if( eg_out < ENV_QUIET ) /* SLOT 1 */ - { - if (!CH->FB) - out=0; + CH->op1_out[1] = 0; + if( eg_out < ENV_QUIET ) /* SLOT 1 */ + { + if (!CH->FB) + out=0; - CH->op1_out[1] = op_calc1(CH->SLOT[SLOT1].phase, eg_out, (out<FB) ); - } - } + CH->op1_out[1] = op_calc1(CH->SLOT[SLOT1].phase, eg_out, (out<FB) ); + } + } - eg_out = volume_calc(&CH->SLOT[SLOT3]); - if( eg_out < ENV_QUIET ) /* SLOT 3 */ - *CH->connect3 += op_calc(CH->SLOT[SLOT3].phase, eg_out, m2); + eg_out = volume_calc(&CH->SLOT[SLOT3]); + if( eg_out < ENV_QUIET ) /* SLOT 3 */ + *CH->connect3 += op_calc(CH->SLOT[SLOT3].phase, eg_out, m2); - eg_out = volume_calc(&CH->SLOT[SLOT2]); - if( eg_out < ENV_QUIET ) /* SLOT 2 */ - *CH->connect2 += op_calc(CH->SLOT[SLOT2].phase, eg_out, c1); + eg_out = volume_calc(&CH->SLOT[SLOT2]); + if( eg_out < ENV_QUIET ) /* SLOT 2 */ + *CH->connect2 += op_calc(CH->SLOT[SLOT2].phase, eg_out, c1); - eg_out = volume_calc(&CH->SLOT[SLOT4]); - if( eg_out < ENV_QUIET ) /* SLOT 4 */ - *CH->connect4 += op_calc(CH->SLOT[SLOT4].phase, eg_out, c2); + eg_out = volume_calc(&CH->SLOT[SLOT4]); + if( eg_out < ENV_QUIET ) /* SLOT 4 */ + *CH->connect4 += op_calc(CH->SLOT[SLOT4].phase, eg_out, c2); - /* store current MEM */ - CH->mem_value = mem; + /* store current MEM */ + CH->mem_value = mem; - /* update phase counters AFTER output calculations */ - if(CH->pms) - { - /* add support for 3 slot mode */ + /* update phase counters AFTER output calculations */ + if(CH->pms) + { + /* add support for 3 slot mode */ if ((ym2612.OPN.ST.mode & 0xC0) && (CH == &ym2612.CH[2])) { update_phase_lfo_slot(&CH->SLOT[SLOT1], CH->pms, ym2612.OPN.SL3.block_fnum[1]); @@ -1176,20 +1176,20 @@ INLINE void chan_calc(FM_CH *CH) update_phase_lfo_slot(&CH->SLOT[SLOT4], CH->pms, CH->block_fnum); } else update_phase_lfo_channel(CH); - } - else /* no LFO phase modulation */ - { - CH->SLOT[SLOT1].phase += CH->SLOT[SLOT1].Incr; - CH->SLOT[SLOT2].phase += CH->SLOT[SLOT2].Incr; - CH->SLOT[SLOT3].phase += CH->SLOT[SLOT3].Incr; - CH->SLOT[SLOT4].phase += CH->SLOT[SLOT4].Incr; - } + } + else /* no LFO phase modulation */ + { + CH->SLOT[SLOT1].phase += CH->SLOT[SLOT1].Incr; + CH->SLOT[SLOT2].phase += CH->SLOT[SLOT2].Incr; + CH->SLOT[SLOT3].phase += CH->SLOT[SLOT3].Incr; + CH->SLOT[SLOT4].phase += CH->SLOT[SLOT4].Incr; + } } /* update phase increment and envelope generator */ INLINE void refresh_fc_eg_slot(FM_SLOT *SLOT , int fc , int kc ) { - int ksr = kc >> SLOT->KSR; + int ksr = kc >> SLOT->KSR; fc += SLOT->DT[kc]; @@ -1199,243 +1199,243 @@ INLINE void refresh_fc_eg_slot(FM_SLOT *SLOT , int fc , int kc ) /* (frequency) phase increment counter */ SLOT->Incr = (fc * SLOT->mul) >> 1; - if( SLOT->ksr != ksr ) - { - SLOT->ksr = ksr; + if( SLOT->ksr != ksr ) + { + SLOT->ksr = ksr; - /* recalculate envelope generator rates */ - if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/) - { - SLOT->eg_sh_ar = eg_rate_shift [SLOT->ar + SLOT->ksr ]; - SLOT->eg_sel_ar = eg_rate_select[SLOT->ar + SLOT->ksr ]; - } - else - { - SLOT->eg_sh_ar = 0; - SLOT->eg_sel_ar = 17*RATE_STEPS; - } + /* recalculate envelope generator rates */ + if ((SLOT->ar + SLOT->ksr) < 94 /*32+62*/) + { + SLOT->eg_sh_ar = eg_rate_shift [SLOT->ar + SLOT->ksr ]; + SLOT->eg_sel_ar = eg_rate_select[SLOT->ar + SLOT->ksr ]; + } + else + { + SLOT->eg_sh_ar = 0; + SLOT->eg_sel_ar = 17*RATE_STEPS; + } - SLOT->eg_sh_d1r = eg_rate_shift [SLOT->d1r + SLOT->ksr]; - SLOT->eg_sel_d1r= eg_rate_select[SLOT->d1r + SLOT->ksr]; + SLOT->eg_sh_d1r = eg_rate_shift [SLOT->d1r + SLOT->ksr]; + SLOT->eg_sel_d1r= eg_rate_select[SLOT->d1r + SLOT->ksr]; - SLOT->eg_sh_d2r = eg_rate_shift [SLOT->d2r + SLOT->ksr]; - SLOT->eg_sel_d2r= eg_rate_select[SLOT->d2r + SLOT->ksr]; + SLOT->eg_sh_d2r = eg_rate_shift [SLOT->d2r + SLOT->ksr]; + SLOT->eg_sel_d2r= eg_rate_select[SLOT->d2r + SLOT->ksr]; - SLOT->eg_sh_rr = eg_rate_shift [SLOT->rr + SLOT->ksr]; - SLOT->eg_sel_rr = eg_rate_select[SLOT->rr + SLOT->ksr]; - } + SLOT->eg_sh_rr = eg_rate_shift [SLOT->rr + SLOT->ksr]; + SLOT->eg_sel_rr = eg_rate_select[SLOT->rr + SLOT->ksr]; + } } /* update phase increment counters */ INLINE void refresh_fc_eg_chan(FM_CH *CH ) { - if( CH->SLOT[SLOT1].Incr==-1){ - int fc = CH->fc; - int kc = CH->kcode; - refresh_fc_eg_slot(&CH->SLOT[SLOT1] , fc , kc ); - refresh_fc_eg_slot(&CH->SLOT[SLOT2] , fc , kc ); - refresh_fc_eg_slot(&CH->SLOT[SLOT3] , fc , kc ); - refresh_fc_eg_slot(&CH->SLOT[SLOT4] , fc , kc ); - } + if( CH->SLOT[SLOT1].Incr==-1){ + int fc = CH->fc; + int kc = CH->kcode; + refresh_fc_eg_slot(&CH->SLOT[SLOT1] , fc , kc ); + refresh_fc_eg_slot(&CH->SLOT[SLOT2] , fc , kc ); + refresh_fc_eg_slot(&CH->SLOT[SLOT3] , fc , kc ); + refresh_fc_eg_slot(&CH->SLOT[SLOT4] , fc , kc ); + } } /* initialize time tables */ static void init_timetables(const UINT8 *dttable ) { - int i,d; - double rate; + int i,d; + double rate; - /* DeTune table */ - for (d = 0;d <= 3;d++) - { - for (i = 0;i <= 31;i++) - { - rate = ((double)dttable[d*32 + i]) * SIN_LEN * ym2612.OPN.ST.freqbase * (1<>= 4; /* 12 bits here */ - if (n&1) /* round to nearest */ - n = (n>>1)+1; - else - n = n>>1; - /* 11 bits here (rounded) */ - n <<= 2; /* 13 bits here (as in real chip) */ - tl_tab[ x*2 + 0 ] = n; - tl_tab[ x*2 + 1 ] = -tl_tab[ x*2 + 0 ]; + n = (int)m; /* 16 bits here */ + n >>= 4; /* 12 bits here */ + if (n&1) /* round to nearest */ + n = (n>>1)+1; + else + n = n>>1; + /* 11 bits here (rounded) */ + n <<= 2; /* 13 bits here (as in real chip) */ + tl_tab[ x*2 + 0 ] = n; + tl_tab[ x*2 + 1 ] = -tl_tab[ x*2 + 0 ]; - for (i=1; i<13; i++) - { - tl_tab[ x*2+0 + i*2*TL_RES_LEN ] = tl_tab[ x*2+0 ]>>i; - tl_tab[ x*2+1 + i*2*TL_RES_LEN ] = -tl_tab[ x*2+0 + i*2*TL_RES_LEN ]; - } - } + for (i=1; i<13; i++) + { + tl_tab[ x*2+0 + i*2*TL_RES_LEN ] = tl_tab[ x*2+0 ]>>i; + tl_tab[ x*2+1 + i*2*TL_RES_LEN ] = -tl_tab[ x*2+0 + i*2*TL_RES_LEN ]; + } + } - for (i=0; i0.0) - o = 8*log(1.0/m)/log(2); /* convert to 'decibels' */ - else - o = 8*log(-1.0/m)/log(2); /* convert to 'decibels' */ + if (m>0.0) + o = 8*log(1.0/m)/log(2); /* convert to 'decibels' */ + else + o = 8*log(-1.0/m)/log(2); /* convert to 'decibels' */ - o = o / (ENV_STEP/4); + o = o / (ENV_STEP/4); - n = (int)(2.0*o); - if (n&1) /* round to nearest */ - n = (n>>1)+1; - else - n = n>>1; + n = (int)(2.0*o); + if (n&1) /* round to nearest */ + n = (n>>1)+1; + else + n = n>>1; - sin_tab[ i ] = n*2 + (m>=0.0? 0: 1 ); - } + sin_tab[ i ] = n*2 + (m>=0.0? 0: 1 ); + } - /* build LFO PM modulation table */ - for(i = 0; i < 8; i++) /* 8 PM depths */ - { - UINT8 fnum; - for (fnum=0; fnum<128; fnum++) /* 7 bits meaningful of F-NUMBER */ - { - UINT8 value; - UINT8 step; - UINT32 offset_depth = i; - UINT32 offset_fnum_bit; - UINT32 bit_tmp; + /* build LFO PM modulation table */ + for(i = 0; i < 8; i++) /* 8 PM depths */ + { + UINT8 fnum; + for (fnum=0; fnum<128; fnum++) /* 7 bits meaningful of F-NUMBER */ + { + UINT8 value; + UINT8 step; + UINT32 offset_depth = i; + UINT32 offset_fnum_bit; + UINT32 bit_tmp; - for (step=0; step<8; step++) - { - value = 0; - for (bit_tmp=0; bit_tmp<7; bit_tmp++) /* 7 bits */ - { - if (fnum & (1<SLOT[SLOT1].key) { - FM_KEYON(CH,SLOT1); - FM_KEYOFF(CH,SLOT1); - } + FM_KEYON(CH,SLOT1); + FM_KEYOFF(CH,SLOT1); + } if (!CH->SLOT[SLOT2].key) { - FM_KEYON(CH,SLOT2); - FM_KEYOFF(CH,SLOT2); - } + FM_KEYON(CH,SLOT2); + FM_KEYOFF(CH,SLOT2); + } if (!CH->SLOT[SLOT3].key) { - FM_KEYON(CH,SLOT3); - FM_KEYOFF(CH,SLOT3); - } + FM_KEYON(CH,SLOT3); + FM_KEYOFF(CH,SLOT3); + } if (!CH->SLOT[SLOT4].key) { - FM_KEYON(CH,SLOT4); - FM_KEYOFF(CH,SLOT4); - } + FM_KEYON(CH,SLOT4); + FM_KEYOFF(CH,SLOT4); + } } INLINE void INTERNAL_TIMER_A() { - if (ym2612.OPN.ST.mode & 0x01) - { - if ((ym2612.OPN.ST.TAC -= ym2612.OPN.ST.TimerBase) <= 0) - { - /* set status (if enabled) */ - if (ym2612.OPN.ST.mode & 0x04) ym2612.OPN.ST.status |= 0x01; + if (ym2612.OPN.ST.mode & 0x01) + { + if ((ym2612.OPN.ST.TAC -= ym2612.OPN.ST.TimerBase) <= 0) + { + /* set status (if enabled) */ + if (ym2612.OPN.ST.mode & 0x04) ym2612.OPN.ST.status |= 0x01; - /* reload the counter */ - if (ym2612.OPN.ST.TAL) ym2612.OPN.ST.TAC += ym2612.OPN.ST.TAL; + /* reload the counter */ + if (ym2612.OPN.ST.TAL) ym2612.OPN.ST.TAC += ym2612.OPN.ST.TAL; else ym2612.OPN.ST.TAC = ym2612.OPN.ST.TAL; - /* CSM mode total level latch and auto key on */ - if ((ym2612.OPN.ST.mode & 0xC0) == 0x80) CSMKeyControll (&(ym2612.CH[2])); - } - } + /* CSM mode total level latch and auto key on */ + if ((ym2612.OPN.ST.mode & 0xC0) == 0x80) CSMKeyControll (&(ym2612.CH[2])); + } + } } INLINE void INTERNAL_TIMER_B(int step) { - if (ym2612.OPN.ST.mode & 0x02) - { - if ((ym2612.OPN.ST.TBC -= (ym2612.OPN.ST.TimerBase * step)) <= 0) - { - /* set status (if enabled) */ - if (ym2612.OPN.ST.mode & 0x08) ym2612.OPN.ST.status |= 0x02; + if (ym2612.OPN.ST.mode & 0x02) + { + if ((ym2612.OPN.ST.TBC -= (ym2612.OPN.ST.TimerBase * step)) <= 0) + { + /* set status (if enabled) */ + if (ym2612.OPN.ST.mode & 0x08) ym2612.OPN.ST.status |= 0x02; - /* reload the counter */ - if (ym2612.OPN.ST.TBL) ym2612.OPN.ST.TBC += ym2612.OPN.ST.TBL; + /* reload the counter */ + if (ym2612.OPN.ST.TBL) ym2612.OPN.ST.TBC += ym2612.OPN.ST.TBL; else ym2612.OPN.ST.TBC = ym2612.OPN.ST.TBL; - } - } + } + } } /* prescaler set (and make time tables) */ static void OPNSetPres(int pres) { - int i; + int i; /* frequency base */ ym2612.OPN.ST.freqbase = ((double) ym2612.OPN.ST.clock / (double) ym2612.OPN.ST.rate) / ((double) pres); @@ -1447,358 +1447,358 @@ static void OPNSetPres(int pres) ym2612.OPN.eg_timer_overflow = ( 3 ) * (1< increment counter table */ - for(i = 0; i < 4096; i++) - { - /* freq table for octave 7 */ - /* OPN phase increment counter = 20bit */ - ym2612.OPN.fn_table[i] = (UINT32)( (double)i * 32 * ym2612.OPN.ST.freqbase * (1<<(FREQ_SH-10)) ); /* -10 because chip works with 10.10 fixed point, while we use 16.16 */ - } + /* calculate fnumber -> increment counter table */ + for(i = 0; i < 4096; i++) + { + /* freq table for octave 7 */ + /* OPN phase increment counter = 20bit */ + ym2612.OPN.fn_table[i] = (UINT32)( (double)i * 32 * ym2612.OPN.ST.freqbase * (1<<(FREQ_SH-10)) ); /* -10 because chip works with 10.10 fixed point, while we use 16.16 */ + } /* maximal frequency is required for Phase overflow calculation, register size is 17 bits (Nemesis) */ ym2612.OPN.fn_max = (UINT32)( (double)0x20000 * ym2612.OPN.ST.freqbase * (1<<(FREQ_SH-10)) ); - /* LFO freq. table */ - for(i = 0; i < 8; i++) - { - /* Amplitude modulation: 64 output levels (triangle waveform); 1 level lasts for one of "lfo_samples_per_step" samples */ - /* Phase modulation: one entry from lfo_pm_output lasts for one of 4 * "lfo_samples_per_step" samples */ - ym2612.OPN.lfo_freq[i] = (UINT32)((1.0 / lfo_samples_per_step[i]) * (1<= 0x100) c+=3; + if (r >= 0x100) c+=3; - CH = &ym2612.CH[c]; + CH = &ym2612.CH[c]; - SLOT = &(CH->SLOT[OPN_SLOT(r)]); + SLOT = &(CH->SLOT[OPN_SLOT(r)]); - switch( r & 0xf0 ) { - case 0x30: /* DET , MUL */ - set_det_mul(CH,SLOT,v); - break; + switch( r & 0xf0 ) { + case 0x30: /* DET , MUL */ + set_det_mul(CH,SLOT,v); + break; - case 0x40: /* TL */ - set_tl(CH,SLOT,v); - break; + case 0x40: /* TL */ + set_tl(CH,SLOT,v); + break; - case 0x50: /* KS, AR */ - set_ar_ksr(CH,SLOT,v); - break; + case 0x50: /* KS, AR */ + set_ar_ksr(CH,SLOT,v); + break; - case 0x60: /* bit7 = AM ENABLE, DR */ - set_dr(SLOT,v); - SLOT->AMmask = (v&0x80) ? ~0 : 0; - break; + case 0x60: /* bit7 = AM ENABLE, DR */ + set_dr(SLOT,v); + SLOT->AMmask = (v&0x80) ? ~0 : 0; + break; - case 0x70: /* SR */ - set_sr(SLOT,v); - break; + case 0x70: /* SR */ + set_sr(SLOT,v); + break; - case 0x80: /* SL, RR */ - set_sl_rr(SLOT,v); - break; + case 0x80: /* SL, RR */ + set_sl_rr(SLOT,v); + break; - case 0x90: /* SSG-EG */ - SLOT->ssg = v&0x0f; - SLOT->ssgn = (v&0x04)>>1; /* bit 1 in ssgn = attack */ + case 0x90: /* SSG-EG */ + SLOT->ssg = v&0x0f; + SLOT->ssgn = (v&0x04)>>1; /* bit 1 in ssgn = attack */ - /* SSG-EG envelope shapes : + /* SSG-EG envelope shapes : - E AtAlH - 1 0 0 0 \\\\ + E AtAlH + 1 0 0 0 \\\\ - 1 0 0 1 \___ + 1 0 0 1 \___ - 1 0 1 0 \/\/ - ___ - 1 0 1 1 \ + 1 0 1 0 \/\/ + ___ + 1 0 1 1 \ - 1 1 0 0 //// - ___ - 1 1 0 1 / + 1 1 0 0 //// + ___ + 1 1 0 1 / - 1 1 1 0 /\/\ + 1 1 1 0 /\/\ - 1 1 1 1 /___ + 1 1 1 1 /___ - E = SSG-EG enable + E = SSG-EG enable - The shapes are generated using Attack, Decay and Sustain phases. + The shapes are generated using Attack, Decay and Sustain phases. - Each single character in the diagrams above represents this whole - sequence: + Each single character in the diagrams above represents this whole + sequence: - - when KEY-ON = 1, normal Attack phase is generated (*without* any - difference when compared to normal mode), + - when KEY-ON = 1, normal Attack phase is generated (*without* any + difference when compared to normal mode), - - later, when envelope level reaches minimum level (max volume), - the EG switches to Decay phase (which works with bigger steps - when compared to normal mode - see below), + - later, when envelope level reaches minimum level (max volume), + the EG switches to Decay phase (which works with bigger steps + when compared to normal mode - see below), - - later when envelope level passes the SL level, - the EG swithes to Sustain phase (which works with bigger steps - when compared to normal mode - see below), + - later when envelope level passes the SL level, + the EG swithes to Sustain phase (which works with bigger steps + when compared to normal mode - see below), - - finally when envelope level reaches maximum level (min volume), - the EG switches to Attack phase again (depends on actual waveform). + - finally when envelope level reaches maximum level (min volume), + the EG switches to Attack phase again (depends on actual waveform). - Important is that when switch to Attack phase occurs, the phase counter - of that operator will be zeroed-out (as in normal KEY-ON) but not always. - (I havent found the rule for that - perhaps only when the output level is low) + Important is that when switch to Attack phase occurs, the phase counter + of that operator will be zeroed-out (as in normal KEY-ON) but not always. + (I havent found the rule for that - perhaps only when the output level is low) - The difference (when compared to normal Envelope Generator mode) is - that the resolution in Decay and Sustain phases is 4 times lower; - this results in only 256 steps instead of normal 1024. - In other words: - when SSG-EG is disabled, the step inside of the EG is one, - when SSG-EG is enabled, the step is four (in Decay and Sustain phases). + The difference (when compared to normal Envelope Generator mode) is + that the resolution in Decay and Sustain phases is 4 times lower; + this results in only 256 steps instead of normal 1024. + In other words: + when SSG-EG is disabled, the step inside of the EG is one, + when SSG-EG is enabled, the step is four (in Decay and Sustain phases). - Times between the level changes are the same in both modes. + Times between the level changes are the same in both modes. - Important: - Decay 1 Level (so called SL) is compared to actual SSG-EG output, so - it is the same in both SSG and no-SSG modes, with this exception: + Important: + Decay 1 Level (so called SL) is compared to actual SSG-EG output, so + it is the same in both SSG and no-SSG modes, with this exception: - when the SSG-EG is enabled and is generating raising levels - (when the EG output is inverted) the SL will be found at wrong level !!! - For example, when SL=02: - 0 -6 = -6dB in non-inverted EG output - 96-6 = -90dB in inverted EG output - Which means that EG compares its level to SL as usual, and that the - output is simply inverted afterall. + when the SSG-EG is enabled and is generating raising levels + (when the EG output is inverted) the SL will be found at wrong level !!! + For example, when SL=02: + 0 -6 = -6dB in non-inverted EG output + 96-6 = -90dB in inverted EG output + Which means that EG compares its level to SL as usual, and that the + output is simply inverted afterall. - The Yamaha's manuals say that AR should be set to 0x1f (max speed). - That is not necessary, but then EG will be generating Attack phase. + The Yamaha's manuals say that AR should be set to 0x1f (max speed). + That is not necessary, but then EG will be generating Attack phase. - */ + */ - break; + break; - case 0xa0: - switch( OPN_SLOT(r) ){ - case 0: /* 0xa0-0xa2 : FNUM1 */ - { - UINT32 fn = (((UINT32)((ym2612.OPN.ST.fn_h)&7))<<8) + v; - UINT8 blk = ym2612.OPN.ST.fn_h>>3; - /* keyscale code */ - CH->kcode = (blk<<2) | opn_fktable[fn >> 7]; - /* phase increment counter */ - CH->fc = ym2612.OPN.fn_table[fn*2]>>(7-blk); + case 0xa0: + switch( OPN_SLOT(r) ){ + case 0: /* 0xa0-0xa2 : FNUM1 */ + { + UINT32 fn = (((UINT32)((ym2612.OPN.ST.fn_h)&7))<<8) + v; + UINT8 blk = ym2612.OPN.ST.fn_h>>3; + /* keyscale code */ + CH->kcode = (blk<<2) | opn_fktable[fn >> 7]; + /* phase increment counter */ + CH->fc = ym2612.OPN.fn_table[fn*2]>>(7-blk); - /* store fnum in clear form for LFO PM calculations */ - CH->block_fnum = (blk<<11) | fn; + /* store fnum in clear form for LFO PM calculations */ + CH->block_fnum = (blk<<11) | fn; - CH->SLOT[SLOT1].Incr=-1; - } - break; - case 1: /* 0xa4-0xa6 : FNUM2,BLK */ - ym2612.OPN.ST.fn_h = v&0x3f; - break; - case 2: /* 0xa8-0xaa : 3CH FNUM1 */ - if(r < 0x100) - { - UINT32 fn = (((UINT32)(ym2612.OPN.SL3.fn_h&7))<<8) + v; - UINT8 blk = ym2612.OPN.SL3.fn_h>>3; - /* keyscale code */ - ym2612.OPN.SL3.kcode[c]= (blk<<2) | opn_fktable[fn >> 7]; - /* phase increment counter */ - ym2612.OPN.SL3.fc[c] = ym2612.OPN.fn_table[fn*2]>>(7-blk); - ym2612.OPN.SL3.block_fnum[c] = (blk<<11) | fn; //fn; - ym2612.CH[2].SLOT[SLOT1].Incr=-1; - } - break; - case 3: /* 0xac-0xae : 3CH FNUM2,BLK */ - if(r < 0x100) - ym2612.OPN.SL3.fn_h = v&0x3f; - break; - } - break; + CH->SLOT[SLOT1].Incr=-1; + } + break; + case 1: /* 0xa4-0xa6 : FNUM2,BLK */ + ym2612.OPN.ST.fn_h = v&0x3f; + break; + case 2: /* 0xa8-0xaa : 3CH FNUM1 */ + if(r < 0x100) + { + UINT32 fn = (((UINT32)(ym2612.OPN.SL3.fn_h&7))<<8) + v; + UINT8 blk = ym2612.OPN.SL3.fn_h>>3; + /* keyscale code */ + ym2612.OPN.SL3.kcode[c]= (blk<<2) | opn_fktable[fn >> 7]; + /* phase increment counter */ + ym2612.OPN.SL3.fc[c] = ym2612.OPN.fn_table[fn*2]>>(7-blk); + ym2612.OPN.SL3.block_fnum[c] = (blk<<11) | fn; //fn; + ym2612.CH[2].SLOT[SLOT1].Incr=-1; + } + break; + case 3: /* 0xac-0xae : 3CH FNUM2,BLK */ + if(r < 0x100) + ym2612.OPN.SL3.fn_h = v&0x3f; + break; + } + break; - case 0xb0: - switch( OPN_SLOT(r) ){ - case 0: /* 0xb0-0xb2 : FB,ALGO */ - { - int feedback = (v>>3)&7; - CH->ALGO = v&7; - CH->FB = feedback ? feedback+6 : 0; + case 0xb0: + switch( OPN_SLOT(r) ){ + case 0: /* 0xb0-0xb2 : FB,ALGO */ + { + int feedback = (v>>3)&7; + CH->ALGO = v&7; + CH->FB = feedback ? feedback+6 : 0; setup_connection( CH, c ); - } - break; - case 1: /* 0xb4-0xb6 : L , R , AMS , PMS (ym2612/YM2610B/YM2610/YM2608) */ - /* b0-2 PMS */ - CH->pms = (v & 7) * 32; /* CH->pms = PM depth * 32 (index in lfo_pm_table) */ + } + break; + case 1: /* 0xb4-0xb6 : L , R , AMS , PMS (ym2612/YM2610B/YM2610/YM2608) */ + /* b0-2 PMS */ + CH->pms = (v & 7) * 32; /* CH->pms = PM depth * 32 (index in lfo_pm_table) */ - /* b4-5 AMS */ - CH->ams = lfo_ams_depth_shift[(v>>4) & 0x03]; + /* b4-5 AMS */ + CH->ams = lfo_ams_depth_shift[(v>>4) & 0x03]; - /* PAN : b7 = L, b6 = R */ - ym2612.OPN.pan[ c*2 ] = (v & 0x80) ? ~0 : 0; - ym2612.OPN.pan[ c*2+1 ] = (v & 0x40) ? ~0 : 0; + /* PAN : b7 = L, b6 = R */ + ym2612.OPN.pan[ c*2 ] = (v & 0x80) ? ~0 : 0; + ym2612.OPN.pan[ c*2+1 ] = (v & 0x40) ? ~0 : 0; - break; - } - break; - } + break; + } + break; + } } /* Generate 32bits samples for ym2612 */ void YM2612UpdateOne(int **buffer, int length) { - int i; - int *bufL,*bufR; + int i; + int *bufL,*bufR; int lt,rt; - /* set buffer */ - bufL = buffer[0]; - bufR = buffer[1]; + /* set buffer */ + bufL = buffer[0]; + bufR = buffer[1]; - /* refresh PG and EG */ - refresh_fc_eg_chan(&ym2612.CH[0]); - refresh_fc_eg_chan(&ym2612.CH[1]); + /* refresh PG and EG */ + refresh_fc_eg_chan(&ym2612.CH[0]); + refresh_fc_eg_chan(&ym2612.CH[1]); - if (ym2612.OPN.ST.mode & 0xC0) - { - /* 3SLOT MODE (operator order is 0,1,3,2) */ - if(ym2612.CH[2].SLOT[SLOT1].Incr==-1) - { - refresh_fc_eg_slot(&ym2612.CH[2].SLOT[SLOT1] , ym2612.OPN.SL3.fc[1] , ym2612.OPN.SL3.kcode[1] ); - refresh_fc_eg_slot(&ym2612.CH[2].SLOT[SLOT2] , ym2612.OPN.SL3.fc[2] , ym2612.OPN.SL3.kcode[2] ); - refresh_fc_eg_slot(&ym2612.CH[2].SLOT[SLOT3] , ym2612.OPN.SL3.fc[0] , ym2612.OPN.SL3.kcode[0] ); - refresh_fc_eg_slot(&ym2612.CH[2].SLOT[SLOT4] , ym2612.CH[2].fc , ym2612.CH[2].kcode ); - } - } - else refresh_fc_eg_chan(&ym2612.CH[2]); + if (ym2612.OPN.ST.mode & 0xC0) + { + /* 3SLOT MODE (operator order is 0,1,3,2) */ + if(ym2612.CH[2].SLOT[SLOT1].Incr==-1) + { + refresh_fc_eg_slot(&ym2612.CH[2].SLOT[SLOT1] , ym2612.OPN.SL3.fc[1] , ym2612.OPN.SL3.kcode[1] ); + refresh_fc_eg_slot(&ym2612.CH[2].SLOT[SLOT2] , ym2612.OPN.SL3.fc[2] , ym2612.OPN.SL3.kcode[2] ); + refresh_fc_eg_slot(&ym2612.CH[2].SLOT[SLOT3] , ym2612.OPN.SL3.fc[0] , ym2612.OPN.SL3.kcode[0] ); + refresh_fc_eg_slot(&ym2612.CH[2].SLOT[SLOT4] , ym2612.CH[2].fc , ym2612.CH[2].kcode ); + } + } + else refresh_fc_eg_chan(&ym2612.CH[2]); - refresh_fc_eg_chan(&ym2612.CH[3]); - refresh_fc_eg_chan(&ym2612.CH[4]); - refresh_fc_eg_chan(&ym2612.CH[5]); + refresh_fc_eg_chan(&ym2612.CH[3]); + refresh_fc_eg_chan(&ym2612.CH[4]); + refresh_fc_eg_chan(&ym2612.CH[5]); - /* buffering */ - for(i=0; i < length ; i++) - { - advance_lfo(); + /* buffering */ + for(i=0; i < length ; i++) + { + advance_lfo(); - /* clear outputs */ - out_fm[0] = 0; - out_fm[1] = 0; - out_fm[2] = 0; - out_fm[3] = 0; - out_fm[4] = 0; - out_fm[5] = 0; + /* clear outputs */ + out_fm[0] = 0; + out_fm[1] = 0; + out_fm[2] = 0; + out_fm[3] = 0; + out_fm[4] = 0; + out_fm[5] = 0; - /* calculate FM */ - chan_calc(&ym2612.CH[0]); - chan_calc(&ym2612.CH[1]); + /* calculate FM */ + chan_calc(&ym2612.CH[0]); + chan_calc(&ym2612.CH[1]); chan_calc(&ym2612.CH[2]); - chan_calc(&ym2612.CH[3]); - chan_calc(&ym2612.CH[4]); - if (ym2612.dacen) - { - /* DAC Mode */ - *(ym2612.CH[5].connect4) += ym2612.dacout; - } - else chan_calc(&ym2612.CH[5]); + chan_calc(&ym2612.CH[3]); + chan_calc(&ym2612.CH[4]); + if (ym2612.dacen) + { + /* DAC Mode */ + *(ym2612.CH[5].connect4) += ym2612.dacout; + } + else chan_calc(&ym2612.CH[5]); /* advance envelope generator */ - ym2612.OPN.eg_timer += ym2612.OPN.eg_timer_add; - while (ym2612.OPN.eg_timer >= ym2612.OPN.eg_timer_overflow) - { - ym2612.OPN.eg_timer -= ym2612.OPN.eg_timer_overflow; - ym2612.OPN.eg_cnt++; + ym2612.OPN.eg_timer += ym2612.OPN.eg_timer_add; + while (ym2612.OPN.eg_timer >= ym2612.OPN.eg_timer_overflow) + { + ym2612.OPN.eg_timer -= ym2612.OPN.eg_timer_overflow; + ym2612.OPN.eg_cnt++; - advance_eg_channel(&ym2612.CH[0].SLOT[SLOT1]); - advance_eg_channel(&ym2612.CH[1].SLOT[SLOT1]); - advance_eg_channel(&ym2612.CH[2].SLOT[SLOT1]); - advance_eg_channel(&ym2612.CH[3].SLOT[SLOT1]); - advance_eg_channel(&ym2612.CH[4].SLOT[SLOT1]); - advance_eg_channel(&ym2612.CH[5].SLOT[SLOT1]); - } + advance_eg_channel(&ym2612.CH[0].SLOT[SLOT1]); + advance_eg_channel(&ym2612.CH[1].SLOT[SLOT1]); + advance_eg_channel(&ym2612.CH[2].SLOT[SLOT1]); + advance_eg_channel(&ym2612.CH[3].SLOT[SLOT1]); + advance_eg_channel(&ym2612.CH[4].SLOT[SLOT1]); + advance_eg_channel(&ym2612.CH[5].SLOT[SLOT1]); + } - lt = ((out_fm[0]>>0) & ym2612.OPN.pan[0]); - rt = ((out_fm[0]>>0) & ym2612.OPN.pan[1]); - lt += ((out_fm[1]>>0) & ym2612.OPN.pan[2]); - rt += ((out_fm[1]>>0) & ym2612.OPN.pan[3]); - lt += ((out_fm[2]>>0) & ym2612.OPN.pan[4]); - rt += ((out_fm[2]>>0) & ym2612.OPN.pan[5]); - lt += ((out_fm[3]>>0) & ym2612.OPN.pan[6]); - rt += ((out_fm[3]>>0) & ym2612.OPN.pan[7]); - lt += ((out_fm[4]>>0) & ym2612.OPN.pan[8]); - rt += ((out_fm[4]>>0) & ym2612.OPN.pan[9]); - lt += ((out_fm[5]>>0) & ym2612.OPN.pan[10]); - rt += ((out_fm[5]>>0) & ym2612.OPN.pan[11]); + lt = ((out_fm[0]>>0) & ym2612.OPN.pan[0]); + rt = ((out_fm[0]>>0) & ym2612.OPN.pan[1]); + lt += ((out_fm[1]>>0) & ym2612.OPN.pan[2]); + rt += ((out_fm[1]>>0) & ym2612.OPN.pan[3]); + lt += ((out_fm[2]>>0) & ym2612.OPN.pan[4]); + rt += ((out_fm[2]>>0) & ym2612.OPN.pan[5]); + lt += ((out_fm[3]>>0) & ym2612.OPN.pan[6]); + rt += ((out_fm[3]>>0) & ym2612.OPN.pan[7]); + lt += ((out_fm[4]>>0) & ym2612.OPN.pan[8]); + rt += ((out_fm[4]>>0) & ym2612.OPN.pan[9]); + lt += ((out_fm[5]>>0) & ym2612.OPN.pan[10]); + rt += ((out_fm[5]>>0) & ym2612.OPN.pan[11]); /* limiter */ Limit(lt,MAXOUT,MINOUT); @@ -1808,8 +1808,8 @@ void YM2612UpdateOne(int **buffer, int length) bufL[i] = lt; bufR[i] = rt; - /* timer A control */ - INTERNAL_TIMER_A(); + /* timer A control */ + INTERNAL_TIMER_A(); } INTERNAL_TIMER_B(length); @@ -1819,52 +1819,52 @@ void YM2612UpdateOne(int **buffer, int length) /* initialize ym2612 emulator(s) */ int YM2612Init(int clock, int rate) { - memset(&ym2612,0,sizeof(YM2612)); - init_tables(); - ym2612.OPN.ST.clock = clock; - ym2612.OPN.ST.rate = rate; - YM2612ResetChip(); - return 0; + memset(&ym2612,0,sizeof(YM2612)); + init_tables(); + ym2612.OPN.ST.clock = clock; + ym2612.OPN.ST.rate = rate; + YM2612ResetChip(); + return 0; } /* reset */ int YM2612ResetChip(void) { - int i; + int i; - OPNSetPres(6*24); - OPNWriteMode(0x27,0x30); /* mode 0 , timer reset */ + OPNSetPres(6*24); + OPNWriteMode(0x27,0x30); /* mode 0 , timer reset */ - ym2612.OPN.eg_timer = 0; - ym2612.OPN.eg_cnt = 0; - ym2612.OPN.ST.status = 0; - ym2612.OPN.ST.mode = 0; - ym2612.OPN.ST.TA = 0; - ym2612.OPN.ST.TAL = 0; - ym2612.OPN.ST.TAC = 0; - ym2612.OPN.ST.TB = 0; - ym2612.OPN.ST.TBL = 0; - ym2612.OPN.ST.TBC = 0; + ym2612.OPN.eg_timer = 0; + ym2612.OPN.eg_cnt = 0; + ym2612.OPN.ST.status = 0; + ym2612.OPN.ST.mode = 0; + ym2612.OPN.ST.TA = 0; + ym2612.OPN.ST.TAL = 0; + ym2612.OPN.ST.TAC = 0; + ym2612.OPN.ST.TB = 0; + ym2612.OPN.ST.TBL = 0; + ym2612.OPN.ST.TBC = 0; - reset_channels(&ym2612.CH[0] , 6 ); - for(i = 0xb6 ; i >= 0xb4 ; i-- ) - { - OPNWriteReg(i ,0xc0); - OPNWriteReg(i|0x100,0xc0); - } - for(i = 0xb2 ; i >= 0x30 ; i-- ) - { - OPNWriteReg(i ,0); - OPNWriteReg(i|0x100,0); - } - for(i = 0x26 ; i >= 0x20 ; i-- ) OPNWriteMode(i,0); /* fixed (Eke-Eke) */ + reset_channels(&ym2612.CH[0] , 6 ); + for(i = 0xb6 ; i >= 0xb4 ; i-- ) + { + OPNWriteReg(i ,0xc0); + OPNWriteReg(i|0x100,0xc0); + } + for(i = 0xb2 ; i >= 0x30 ; i-- ) + { + OPNWriteReg(i ,0); + OPNWriteReg(i|0x100,0); + } + for(i = 0x26 ; i >= 0x20 ; i-- ) OPNWriteMode(i,0); /* fixed (Eke-Eke) */ - /* DAC mode clear */ - ym2612.dacen = 0; - ym2612.dacout = 0; + /* DAC mode clear */ + ym2612.dacen = 0; + ym2612.dacout = 0; - return 0; + return 0; } /* ym2612 write */ @@ -1873,57 +1873,57 @@ int YM2612ResetChip(void) /* v = value */ int YM2612Write(unsigned char a, unsigned char v) { - int addr; + int addr; - v &= 0xff; /* adjust to 8 bit bus */ + v &= 0xff; /* adjust to 8 bit bus */ - switch( a&3 ) - { - case 0: /* address port 0 */ - ym2612.OPN.ST.address[0] = v; - break; + switch( a&3 ) + { + case 0: /* address port 0 */ + ym2612.OPN.ST.address[0] = v; + break; - case 1: /* data port 0 */ - addr = ym2612.OPN.ST.address[0]; - fm_reg[0][addr] = v; - switch( addr & 0xf0 ) - { - case 0x20: /* 0x20-0x2f Mode */ - switch( addr ) - { - case 0x2a: /* DAC data (ym2612) */ - ym2612.dacout = ((int)v - 0x80) << 6; /* level unknown (5 is too low, 8 is too loud) */ - break; - case 0x2b: /* DAC Sel (ym2612) */ - /* b7 = dac enable */ - ym2612.dacen = v & 0x80; - break; - default: /* OPN section */ - /* write register */ - OPNWriteMode(addr,v); - } - break; - default: /* 0x30-0xff OPN section */ - /* write register */ - OPNWriteReg(addr,v); - } - break; + case 1: /* data port 0 */ + addr = ym2612.OPN.ST.address[0]; + fm_reg[0][addr] = v; + switch( addr & 0xf0 ) + { + case 0x20: /* 0x20-0x2f Mode */ + switch( addr ) + { + case 0x2a: /* DAC data (ym2612) */ + ym2612.dacout = ((int)v - 0x80) << 6; /* level unknown (5 is too low, 8 is too loud) */ + break; + case 0x2b: /* DAC Sel (ym2612) */ + /* b7 = dac enable */ + ym2612.dacen = v & 0x80; + break; + default: /* OPN section */ + /* write register */ + OPNWriteMode(addr,v); + } + break; + default: /* 0x30-0xff OPN section */ + /* write register */ + OPNWriteReg(addr,v); + } + break; - case 2: /* address port 1 */ - ym2612.OPN.ST.address[1] = v; - break; + case 2: /* address port 1 */ + ym2612.OPN.ST.address[1] = v; + break; - case 3: /* data port 1 */ - addr = ym2612.OPN.ST.address[1]; - fm_reg[1][addr] = v; - OPNWriteReg(addr | 0x100,v); - break; - } + case 3: /* data port 1 */ + addr = ym2612.OPN.ST.address[1]; + fm_reg[1][addr] = v; + OPNWriteReg(addr | 0x100,v); + break; + } - return 0; + return 0; } int YM2612Read(void) { - return ym2612.OPN.ST.status; + return ym2612.OPN.ST.status; } diff --git a/source/sound/sn76489.c b/source/sound/sn76489.c index 9ddf1b1..55f55ed 100644 --- a/source/sound/sn76489.c +++ b/source/sound/sn76489.c @@ -37,7 +37,7 @@ static const int PSGVolumeValues[2][16] = { /* These values are taken from a real SMS2's output */ {892,892,892,760,623,497,404,323,257,198,159,123,96,75,60,0}, /* I can't remember why 892... :P some scaling I did at some point */ /* these values are true volumes for 2dB drops at each step (multiply previous by 10^-0.1), normalised at 760 */ - {1516,1205,957,760,603,479,381,303,240,191,152,120,96,76,60,0} + {1516,1205,957,760,603,479,381,303,240,191,152,120,96,76,60,0} }; static SN76489_Context SN76489[MAX_SN76489]; @@ -126,33 +126,33 @@ void SN76489_Write(int which, int data) { SN76489_Context *p = &SN76489[which]; - if (data&0x80) { + if (data&0x80) { /* Latch/data byte %1 cc t dddd */ p->LatchedRegister=((data>>4)&0x07); p->Registers[p->LatchedRegister]= (p->Registers[p->LatchedRegister] & 0x3f0) /* zero low 4 bits */ | (data&0xf); /* and replace with data */ - } else { + } else { /* Data byte %0 - dddddd */ if (!(p->LatchedRegister%2)&&(p->LatchedRegister<5)) /* Tone register */ p->Registers[p->LatchedRegister]= (p->Registers[p->LatchedRegister] & 0x00f) /* zero high 6 bits */ | ((data&0x3f)<<4); /* and replace with data */ - else + else /* Other register */ p->Registers[p->LatchedRegister]=data&0x0f; /* Replace with data */ } switch (p->LatchedRegister) { - case 0: - case 2: + case 0: + case 2: case 4: /* Tone channels */ if (p->Registers[p->LatchedRegister]==0) p->Registers[p->LatchedRegister]=1; /* Zero frequency changed to 1 to avoid div/0 */ - break; + break; case 6: /* Noise */ p->NoiseShiftRegister=NoiseInitialState; /* reset shift register */ p->NoiseFreq=0x10<<(p->Registers[6]&0x3); /* set noise signal generator frequency */ - break; + break; } } diff --git a/source/sound/sound.c b/source/sound/sound.c index b6a219c..b30ee36 100644 --- a/source/sound/sound.c +++ b/source/sound/sound.c @@ -48,56 +48,56 @@ int fm_reg[2][0x100]; /* return the number of samples that should have been rendered so far */ static inline uint32 fm_sample_cnt(uint8 is_z80) { - if (is_z80) return (uint32) ((double)(count_z80 + current_z80 - z80_ICount) / z80cycles_per_sample[0]); - else return (uint32) ((double) count_m68k / m68cycles_per_sample[0]); + if (is_z80) return (uint32) ((double)(count_z80 + current_z80 - z80_ICount) / z80cycles_per_sample[0]); + else return (uint32) ((double) count_m68k / m68cycles_per_sample[0]); } static inline uint32 psg_sample_cnt(uint8 is_z80) { - if (is_z80) return (uint32) ((double)(count_z80 + current_z80 - z80_ICount) / z80cycles_per_sample[1]); - else return (uint32) ((double) count_m68k / m68cycles_per_sample[1]); + if (is_z80) return (uint32) ((double)(count_z80 + current_z80 - z80_ICount) / z80cycles_per_sample[1]); + else return (uint32) ((double) count_m68k / m68cycles_per_sample[1]); } /* update FM samples */ static inline void fm_update() { - if(snd.fm.curStage - snd.fm.lastStage > 0) - { - int *tempBuffer[2]; + if(snd.fm.curStage - snd.fm.lastStage > 0) + { + int *tempBuffer[2]; if (config.hq_fm && !config.fm_core) { tempBuffer[0] = src_buffer[0] + snd.fm.lastStage; - tempBuffer[1] = src_buffer[1] + snd.fm.lastStage; + tempBuffer[1] = src_buffer[1] + snd.fm.lastStage; } else { tempBuffer[0] = snd.fm.buffer[0] + snd.fm.lastStage; - tempBuffer[1] = snd.fm.buffer[1] + snd.fm.lastStage; + tempBuffer[1] = snd.fm.buffer[1] + snd.fm.lastStage; } - _YM2612_Update(tempBuffer, snd.fm.curStage - snd.fm.lastStage); - snd.fm.lastStage = snd.fm.curStage; - } + _YM2612_Update(tempBuffer, snd.fm.curStage - snd.fm.lastStage); + snd.fm.lastStage = snd.fm.curStage; + } } /* update PSG samples */ static inline void psg_update() { - if(snd.psg.curStage - snd.psg.lastStage > 0) - { - int16 *tempBuffer = snd.psg.buffer + snd.psg.lastStage; - SN76489_Update (0, tempBuffer, snd.psg.curStage - snd.psg.lastStage); - snd.psg.lastStage = snd.psg.curStage; - } + if(snd.psg.curStage - snd.psg.lastStage > 0) + { + int16 *tempBuffer = snd.psg.buffer + snd.psg.lastStage; + SN76489_Update (0, tempBuffer, snd.psg.curStage - snd.psg.lastStage); + snd.psg.lastStage = snd.psg.curStage; + } } void sound_init(int rate) { - double vclk = (vdp_pal ? (double)CLOCK_PAL : (double)CLOCK_NTSC) / 7.0; /* 68000 and YM2612 clock */ - double zclk = (vdp_pal ? (double)CLOCK_PAL : (double)CLOCK_NTSC) / 15.0; /* Z80 and SN76489 clock */ + double vclk = (vdp_pal ? (double)CLOCK_PAL : (double)CLOCK_NTSC) / 7.0; /* 68000 and YM2612 clock */ + double zclk = (vdp_pal ? (double)CLOCK_PAL : (double)CLOCK_NTSC) / 15.0; /* Z80 and SN76489 clock */ - /* cycle-accurate FM samples */ + /* cycle-accurate FM samples */ if (config.hq_fm && !config.fm_core) { m68cycles_per_sample[0] = 144.0; @@ -113,44 +113,44 @@ void sound_init(int rate) else { m68cycles_per_sample[0] = ((double)m68cycles_per_line * (double)lines_per_frame) / (double) (rate / vdp_rate); - z80cycles_per_sample[0] = ((double)z80cycles_per_line * (double)lines_per_frame) / (double) (rate / vdp_rate); + z80cycles_per_sample[0] = ((double)z80cycles_per_line * (double)lines_per_frame) / (double) (rate / vdp_rate); } /* cycle-accurate PSG samples */ m68cycles_per_sample[1] = ((double)m68cycles_per_line * (double)lines_per_frame) / (double) (rate / vdp_rate); z80cycles_per_sample[1] = ((double)z80cycles_per_line * (double)lines_per_frame) / (double) (rate / vdp_rate); - /* initialize sound chips */ - SN76489_Init(0, (int)zclk, rate); - SN76489_Config(0, MUTE_ALLON, VOL_FULL, FB_SEGAVDP, SRW_SEGAVDP, 0); + /* initialize sound chips */ + SN76489_Init(0, (int)zclk, rate); + SN76489_Config(0, MUTE_ALLON, VOL_FULL, FB_SEGAVDP, SRW_SEGAVDP, 0); - if (config.fm_core) - { - _YM2612_Write = YM2612_Write; - _YM2612_Read = YM2612_Read; - _YM2612_Update = YM2612_Update; - _YM2612_Reset = YM2612_Reset; - YM2612_Init((int)vclk, rate, config.hq_fm); - } - else - { - _YM2612_Write = YM2612Write; - _YM2612_Read = YM2612Read; - _YM2612_Update = YM2612UpdateOne; - _YM2612_Reset = YM2612ResetChip; - YM2612Init ((int)vclk, rate); - } + if (config.fm_core) + { + _YM2612_Write = YM2612_Write; + _YM2612_Read = YM2612_Read; + _YM2612_Update = YM2612_Update; + _YM2612_Reset = YM2612_Reset; + YM2612_Init((int)vclk, rate, config.hq_fm); + } + else + { + _YM2612_Write = YM2612Write; + _YM2612_Read = YM2612Read; + _YM2612_Update = YM2612UpdateOne; + _YM2612_Reset = YM2612ResetChip; + YM2612Init ((int)vclk, rate); + } } void sound_update(void) { - /* finalize sound buffers */ - snd.fm.curStage = (config.hq_fm && !config.fm_core) ? src_data.input_frames : snd.buffer_size; - snd.psg.curStage = snd.buffer_size; + /* finalize sound buffers */ + snd.fm.curStage = (config.hq_fm && !config.fm_core) ? src_data.input_frames : snd.buffer_size; + snd.psg.curStage = snd.buffer_size; - /* update last samples (if needed) */ - fm_update(); - psg_update(); + /* update last samples (if needed) */ + fm_update(); + psg_update(); /* Resampling */ if (config.hq_fm && !config.fm_core) @@ -158,18 +158,18 @@ void sound_update(void) double scaled_value ; int len = src_data.input_frames; - /* this is basically libsamplerate "src_int_to_float_array" function, adapted to interlace samples */ + /* this is basically libsamplerate "src_int_to_float_array" function, adapted to interlace samples */ while (len) - { + { len -- ; - src_in[len*2] = (float) (src_buffer[0] [len] / (8.0 * 0x10000000)); - src_in[len*2 + 1] = (float) (src_buffer[1] [len] / (8.0 * 0x10000000)); - } + src_in[len*2] = (float) (src_buffer[0] [len] / (8.0 * 0x10000000)); + src_in[len*2 + 1] = (float) (src_buffer[1] [len] / (8.0 * 0x10000000)); + } /* samplerate conversion */ src_simple (&src_data, (config.hq_fm&1) ? SRC_LINEAR : SRC_SINC_FASTEST, 2); - /* this is basically libsamplerate "src_float_to_int_array" function, adapted to interlace samples */ + /* this is basically libsamplerate "src_float_to_int_array" function, adapted to interlace samples */ len = snd.buffer_size; while (len) { @@ -194,28 +194,28 @@ void sound_update(void) } /* reset samples count */ - snd.fm.curStage = 0; - snd.fm.lastStage = 0; - snd.psg.curStage = 0; - snd.psg.lastStage = 0; + snd.fm.curStage = 0; + snd.fm.lastStage = 0; + snd.psg.curStage = 0; + snd.psg.lastStage = 0; } /* YM2612 control */ /* restore FM registers */ void fm_restore(void) { - int i; + int i; - _YM2612_Reset(); + _YM2612_Reset(); - /* feed all the registers and update internal state */ - for(i = 0; i < 0x100; i++) - { - _YM2612_Write(0, i); - _YM2612_Write(1, fm_reg[0][i]); - _YM2612_Write(2, i); - _YM2612_Write(3, fm_reg[1][i]); - } + /* feed all the registers and update internal state */ + for(i = 0; i < 0x100; i++) + { + _YM2612_Write(0, i); + _YM2612_Write(1, fm_reg[0][i]); + _YM2612_Write(2, i); + _YM2612_Write(3, fm_reg[1][i]); + } } /* write FM chip */ @@ -224,7 +224,7 @@ void fm_write(unsigned int cpu, unsigned int address, unsigned int data) if (address & 1) { snd.fm.curStage = fm_sample_cnt(cpu); - fm_update(); + fm_update(); } _YM2612_Write(address & 3, data); } @@ -232,16 +232,16 @@ void fm_write(unsigned int cpu, unsigned int address, unsigned int data) /* read FM status */ unsigned int fm_read(unsigned int cpu, unsigned int address) { - snd.fm.curStage = fm_sample_cnt(cpu); - fm_update(); - return (_YM2612_Read() & 0xff); + snd.fm.curStage = fm_sample_cnt(cpu); + fm_update(); + return (_YM2612_Read() & 0xff); } /* PSG write */ void psg_write(unsigned int cpu, unsigned int data) { - snd.psg.curStage = psg_sample_cnt(cpu); - psg_update(); - SN76489_Write(0, data); + snd.psg.curStage = psg_sample_cnt(cpu); + psg_update(); + SN76489_Write(0, data); } diff --git a/source/sound/ym2612.c b/source/sound/ym2612.c index dcd24c1..a455dfa 100644 --- a/source/sound/ym2612.c +++ b/source/sound/ym2612.c @@ -35,36 +35,36 @@ // (ENV_LBITS + ENV_HBITS) <= 28 // (LFO_LBITS + LFO_HBITS) <= 28 -#define SIN_HBITS 12 // Sinus phase counter int part -#define SIN_LBITS (26 - SIN_HBITS) // Sinus phase counter float part (best setting) +#define SIN_HBITS 12 // Sinus phase counter int part +#define SIN_LBITS (26 - SIN_HBITS) // Sinus phase counter float part (best setting) #if (SIN_LBITS > 16) -#define SIN_LBITS 16 // Can't be greater than 16 bits +#define SIN_LBITS 16 // Can't be greater than 16 bits #endif -#define ENV_HBITS 12 // Env phase counter int part -#define ENV_LBITS (28 - ENV_HBITS) // Env phase counter float part (best setting) +#define ENV_HBITS 12 // Env phase counter int part +#define ENV_LBITS (28 - ENV_HBITS) // Env phase counter float part (best setting) -#define LFO_HBITS 10 // LFO phase counter int part -#define LFO_LBITS (28 - LFO_HBITS) // LFO phase counter float part (best setting) +#define LFO_HBITS 10 // LFO phase counter int part +#define LFO_LBITS (28 - LFO_HBITS) // LFO phase counter float part (best setting) #define SIN_LENGHT (1 << SIN_HBITS) #define ENV_LENGHT (1 << ENV_HBITS) #define LFO_LENGHT (1 << LFO_HBITS) -#define TL_LENGHT (ENV_LENGHT * 3) // Env + TL scaling + LFO +#define TL_LENGHT (ENV_LENGHT * 3) // Env + TL scaling + LFO #define SIN_MASK (SIN_LENGHT - 1) #define ENV_MASK (ENV_LENGHT - 1) #define LFO_MASK (LFO_LENGHT - 1) -#define ENV_STEP (96.0 / ENV_LENGHT) // ENV_MAX = 96 dB +#define ENV_STEP (96.0 / ENV_LENGHT) // ENV_MAX = 96 dB #define ENV_ATTACK ((ENV_LENGHT * 0) << ENV_LBITS) #define ENV_DECAY ((ENV_LENGHT * 1) << ENV_LBITS) #define ENV_END ((ENV_LENGHT * 2) << ENV_LBITS) -#define MAX_OUT_BITS (SIN_HBITS + SIN_LBITS + 2) // Modulation = -4 <--> +4 +#define MAX_OUT_BITS (SIN_HBITS + SIN_LBITS + 2) // Modulation = -4 <--> +4 #define MAX_OUT ((1 << MAX_OUT_BITS) - 1) //Just for tests stuff... @@ -85,10 +85,10 @@ //#define AR_RATE 426136 //#define DR_RATE (AR_RATE * 12) -#define LFO_FMS_LBITS 9 // FIXED (LFO_FMS_BASE gives somethink as 1) +#define LFO_FMS_LBITS 9 // FIXED (LFO_FMS_BASE gives somethink as 1) #define LFO_FMS_BASE ((int) (0.05946309436 * 0.0338 * (double) (1 << LFO_FMS_LBITS))) -#define S0 0 // Stupid typo of the YM2612 +#define S0 0 // Stupid typo of the YM2612 #define S1 2 #define S2 1 #define S3 3 @@ -147,79 +147,79 @@ void Env_NULL_Next(slot_ *SL); struct ym2612__ YM2612; -int *SIN_TAB[SIN_LENGHT]; // SINUS TABLE (pointer on TL TABLE) -int TL_TAB[TL_LENGHT * 2]; // TOTAL LEVEL TABLE (positif and minus) -unsigned int ENV_TAB[2 * ENV_LENGHT + 8]; // ENV CURVE TABLE (attack & decay) +int *SIN_TAB[SIN_LENGHT]; // SINUS TABLE (pointer on TL TABLE) +int TL_TAB[TL_LENGHT * 2]; // TOTAL LEVEL TABLE (positif and minus) +unsigned int ENV_TAB[2 * ENV_LENGHT + 8]; // ENV CURVE TABLE (attack & decay) -//unsigned int ATTACK_TO_DECAY[ENV_LENGHT]; // Conversion from attack to decay phase -unsigned int DECAY_TO_ATTACK[ENV_LENGHT]; // Conversion from decay to attack phase +//unsigned int ATTACK_TO_DECAY[ENV_LENGHT]; // Conversion from attack to decay phase +unsigned int DECAY_TO_ATTACK[ENV_LENGHT]; // Conversion from decay to attack phase -unsigned int FINC_TAB[2048]; // Frequency step table +unsigned int FINC_TAB[2048]; // Frequency step table -unsigned int AR_TAB[128]; // Attack rate table -unsigned int DR_TAB[96]; // Decay rate table -unsigned int DT_TAB[8][32]; // Detune table -unsigned int SL_TAB[16]; // Substain level table -unsigned int NULL_RATE[32]; // Table for NULL rate +unsigned int AR_TAB[128]; // Attack rate table +unsigned int DR_TAB[96]; // Decay rate table +unsigned int DT_TAB[8][32]; // Detune table +unsigned int SL_TAB[16]; // Substain level table +unsigned int NULL_RATE[32]; // Table for NULL rate -int LFO_ENV_TAB[LFO_LENGHT]; // LFO AMS TABLE (adjusted for 11.8 dB) -int LFO_FREQ_TAB[LFO_LENGHT]; // LFO FMS TABLE -int LFO_ENV_UP[MAX_UPDATE_LENGHT]; // Temporary calculated LFO AMS (adjusted for 11.8 dB) -int LFO_FREQ_UP[MAX_UPDATE_LENGHT]; // Temporary calculated LFO FMS +int LFO_ENV_TAB[LFO_LENGHT]; // LFO AMS TABLE (adjusted for 11.8 dB) +int LFO_FREQ_TAB[LFO_LENGHT]; // LFO FMS TABLE +int LFO_ENV_UP[MAX_UPDATE_LENGHT]; // Temporary calculated LFO AMS (adjusted for 11.8 dB) +int LFO_FREQ_UP[MAX_UPDATE_LENGHT]; // Temporary calculated LFO FMS -int INTER_TAB[MAX_UPDATE_LENGHT]; // Interpolation table +int INTER_TAB[MAX_UPDATE_LENGHT]; // Interpolation table -int LFO_INC_TAB[8]; // LFO step table +int LFO_INC_TAB[8]; // LFO step table -int in0, in1, in2, in3; // current phase calculation -int en0, en1, en2, en3; // current enveloppe calculation +int in0, in1, in2, in3; // current phase calculation +int en0, en1, en2, en3; // current enveloppe calculation -static void (*UPDATE_CHAN[8 * 8])(channel_ *CH, int **buf, int lenght) = // Update Channel functions pointer table +static void (*UPDATE_CHAN[8 * 8])(channel_ *CH, int **buf, int lenght) = // Update Channel functions pointer table { - (void *)Update_Chan_Algo0, - (void *)Update_Chan_Algo1, - (void *)Update_Chan_Algo2, - (void *)Update_Chan_Algo3, - (void *)Update_Chan_Algo4, - (void *)Update_Chan_Algo5, - (void *)Update_Chan_Algo6, - (void *)Update_Chan_Algo7, - (void *)Update_Chan_Algo0_LFO, - (void *)Update_Chan_Algo1_LFO, - (void *)Update_Chan_Algo2_LFO, - (void *)Update_Chan_Algo3_LFO, - (void *)Update_Chan_Algo4_LFO, - (void *)Update_Chan_Algo5_LFO, - (void *)Update_Chan_Algo6_LFO, - (void *)Update_Chan_Algo7_LFO, - (void *)Update_Chan_Algo0_Int, - (void *)Update_Chan_Algo1_Int, - (void *)Update_Chan_Algo2_Int, - (void *)Update_Chan_Algo3_Int, - (void *)Update_Chan_Algo4_Int, - (void *)Update_Chan_Algo5_Int, - (void *)Update_Chan_Algo6_Int, - (void *)Update_Chan_Algo7_Int, - (void *)Update_Chan_Algo0_LFO_Int, - (void *)Update_Chan_Algo1_LFO_Int, - (void *)Update_Chan_Algo2_LFO_Int, - (void *)Update_Chan_Algo3_LFO_Int, - (void *)Update_Chan_Algo4_LFO_Int, - (void *)Update_Chan_Algo5_LFO_Int, - (void *)Update_Chan_Algo6_LFO_Int, - (void *)Update_Chan_Algo7_LFO_Int + (void *)Update_Chan_Algo0, + (void *)Update_Chan_Algo1, + (void *)Update_Chan_Algo2, + (void *)Update_Chan_Algo3, + (void *)Update_Chan_Algo4, + (void *)Update_Chan_Algo5, + (void *)Update_Chan_Algo6, + (void *)Update_Chan_Algo7, + (void *)Update_Chan_Algo0_LFO, + (void *)Update_Chan_Algo1_LFO, + (void *)Update_Chan_Algo2_LFO, + (void *)Update_Chan_Algo3_LFO, + (void *)Update_Chan_Algo4_LFO, + (void *)Update_Chan_Algo5_LFO, + (void *)Update_Chan_Algo6_LFO, + (void *)Update_Chan_Algo7_LFO, + (void *)Update_Chan_Algo0_Int, + (void *)Update_Chan_Algo1_Int, + (void *)Update_Chan_Algo2_Int, + (void *)Update_Chan_Algo3_Int, + (void *)Update_Chan_Algo4_Int, + (void *)Update_Chan_Algo5_Int, + (void *)Update_Chan_Algo6_Int, + (void *)Update_Chan_Algo7_Int, + (void *)Update_Chan_Algo0_LFO_Int, + (void *)Update_Chan_Algo1_LFO_Int, + (void *)Update_Chan_Algo2_LFO_Int, + (void *)Update_Chan_Algo3_LFO_Int, + (void *)Update_Chan_Algo4_LFO_Int, + (void *)Update_Chan_Algo5_LFO_Int, + (void *)Update_Chan_Algo6_LFO_Int, + (void *)Update_Chan_Algo7_LFO_Int }; -static void (*ENV_NEXT_EVENT[8])(slot_ *SL) = // Next Enveloppe phase functions pointer table +static void (*ENV_NEXT_EVENT[8])(slot_ *SL) = // Next Enveloppe phase functions pointer table { - (void *)Env_Attack_Next, - (void *)Env_Decay_Next, - (void *)Env_Substain_Next, - (void *)Env_Release_Next, - (void *)Env_NULL_Next, - (void *)Env_NULL_Next, - (void *)Env_NULL_Next, - (void *)Env_NULL_Next + (void *)Env_Attack_Next, + (void *)Env_Decay_Next, + (void *)Env_Substain_Next, + (void *)Env_Release_Next, + (void *)Env_NULL_Next, + (void *)Env_NULL_Next, + (void *)Env_NULL_Next, + (void *)Env_NULL_Next }; const unsigned int DT_DEF_TAB[4 * 32] = @@ -243,29 +243,29 @@ const unsigned int DT_DEF_TAB[4 * 32] = const unsigned int FKEY_TAB[16] = { - 0, 0, 0, 0, - 0, 0, 0, 1, - 2, 3, 3, 3, - 3, 3, 3, 3 + 0, 0, 0, 0, + 0, 0, 0, 1, + 2, 3, 3, 3, + 3, 3, 3, 3 }; const unsigned int LFO_AMS_TAB[4] = { - 31, 4, 1, 0 + 31, 4, 1, 0 }; const unsigned int LFO_FMS_TAB[8] = { - LFO_FMS_BASE * 0, LFO_FMS_BASE * 1, - LFO_FMS_BASE * 2, LFO_FMS_BASE * 3, - LFO_FMS_BASE * 4, LFO_FMS_BASE * 6, - LFO_FMS_BASE * 12, LFO_FMS_BASE * 24 + LFO_FMS_BASE * 0, LFO_FMS_BASE * 1, + LFO_FMS_BASE * 2, LFO_FMS_BASE * 3, + LFO_FMS_BASE * 4, LFO_FMS_BASE * 6, + LFO_FMS_BASE * 12, LFO_FMS_BASE * 24 }; -int int_cnt; // Interpolation calculation +int int_cnt; // Interpolation calculation -#if YM_DEBUG_LEVEL > 0 // Debug +#if YM_DEBUG_LEVEL > 0 // Debug FILE *debug_file = NULL; #endif @@ -276,9 +276,9 @@ FILE *debug_file = NULL; INLINE void CALC_FINC_SL(slot_ *SL, int finc, int kc) { - int ksr; - - SL->Finc = (finc + SL->DT[kc]) * SL->MUL; + int ksr; + + SL->Finc = (finc + SL->DT[kc]) * SL->MUL; /* YM2612 Detune Bug (discovered by Nemesis) */ if (SL->Finc < 0) @@ -288,47 +288,47 @@ INLINE void CALC_FINC_SL(slot_ *SL, int finc, int kc) SL->Finc = (finc + SL->DT[kc]) * SL->MUL; } - ksr = kc >> SL->KSR_S; // keycode atténuation + ksr = kc >> SL->KSR_S; // keycode atténuation #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "FINC = %d SL->Finc = %d\n", finc, SL->Finc); + fprintf(debug_file, "FINC = %d SL->Finc = %d\n", finc, SL->Finc); #endif - if (SL->KSR != ksr) // si le KSR a changé alors - { // les différents taux pour l'enveloppe sont mis à jour - SL->KSR = ksr; + if (SL->KSR != ksr) // si le KSR a changé alors + { // les différents taux pour l'enveloppe sont mis à jour + SL->KSR = ksr; - SL->EincA = SL->AR[ksr]; - SL->EincD = SL->DR[ksr]; - SL->EincS = SL->SR[ksr]; - SL->EincR = SL->RR[ksr]; + SL->EincA = SL->AR[ksr]; + SL->EincD = SL->DR[ksr]; + SL->EincS = SL->SR[ksr]; + SL->EincR = SL->RR[ksr]; - if (SL->Ecurp == ATTACK) SL->Einc = SL->EincA; - else if (SL->Ecurp == DECAY) SL->Einc = SL->EincD; - else if (SL->Ecnt < ENV_END) - { - if (SL->Ecurp == SUBSTAIN) SL->Einc = SL->EincS; - else if (SL->Ecurp == RELEASE) SL->Einc = SL->EincR; - } + if (SL->Ecurp == ATTACK) SL->Einc = SL->EincA; + else if (SL->Ecurp == DECAY) SL->Einc = SL->EincD; + else if (SL->Ecnt < ENV_END) + { + if (SL->Ecurp == SUBSTAIN) SL->Einc = SL->EincS; + else if (SL->Ecurp == RELEASE) SL->Einc = SL->EincR; + } #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "KSR = %.4X EincA = %.8X EincD = %.8X EincS = %.8X EincR = %.8X\n", ksr, SL->EincA, SL->EincD, SL->EincS, SL->EincR); + fprintf(debug_file, "KSR = %.4X EincA = %.8X EincD = %.8X EincS = %.8X EincR = %.8X\n", ksr, SL->EincA, SL->EincD, SL->EincS, SL->EincR); #endif - } + } } INLINE void CALC_FINC_CH(channel_ *CH) { - int finc, kc; - - finc = FINC_TAB[CH->FNUM[0]] >> (7 - CH->FOCT[0]); - kc = CH->KC[0]; + int finc, kc; + + finc = FINC_TAB[CH->FNUM[0]] >> (7 - CH->FOCT[0]); + kc = CH->KC[0]; - CALC_FINC_SL(&CH->SLOT[0], finc, kc); - CALC_FINC_SL(&CH->SLOT[1], finc, kc); - CALC_FINC_SL(&CH->SLOT[2], finc, kc); - CALC_FINC_SL(&CH->SLOT[3], finc, kc); + CALC_FINC_SL(&CH->SLOT[0], finc, kc); + CALC_FINC_SL(&CH->SLOT[1], finc, kc); + CALC_FINC_SL(&CH->SLOT[2], finc, kc); + CALC_FINC_SL(&CH->SLOT[3], finc, kc); } @@ -340,466 +340,466 @@ INLINE void CALC_FINC_CH(channel_ *CH) INLINE void KEY_ON(channel_ *CH, int nsl) { - slot_ *SL = &(CH->SLOT[nsl]); // on recupère le bon pointeur de slot - - if (SL->Ecurp == RELEASE) // la touche est-elle relâchée ? - { - SL->Fcnt = 0; + slot_ *SL = &(CH->SLOT[nsl]); // on recupère le bon pointeur de slot + + if (SL->Ecurp == RELEASE) // la touche est-elle relâchée ? + { + SL->Fcnt = 0; - // Fix Ecco 2 splash sound - - SL->Ecnt = (DECAY_TO_ATTACK[ENV_TAB[SL->Ecnt >> ENV_LBITS]] + ENV_ATTACK) & SL->ChgEnM; - SL->ChgEnM = 0xFFFFFFFF; + // Fix Ecco 2 splash sound + + SL->Ecnt = (DECAY_TO_ATTACK[ENV_TAB[SL->Ecnt >> ENV_LBITS]] + ENV_ATTACK) & SL->ChgEnM; + SL->ChgEnM = 0xFFFFFFFF; -// SL->Ecnt = DECAY_TO_ATTACK[ENV_TAB[SL->Ecnt >> ENV_LBITS]] + ENV_ATTACK; -// SL->Ecnt = 0; +// SL->Ecnt = DECAY_TO_ATTACK[ENV_TAB[SL->Ecnt >> ENV_LBITS]] + ENV_ATTACK; +// SL->Ecnt = 0; - SL->Einc = SL->EincA; - SL->Ecmp = ENV_DECAY; - SL->Ecurp = ATTACK; - } + SL->Einc = SL->EincA; + SL->Ecmp = ENV_DECAY; + SL->Ecurp = ATTACK; + } } INLINE void KEY_OFF(channel_ *CH, int nsl) { - slot_ *SL = &(CH->SLOT[nsl]); // on recupère le bon pointeur de slot - - if (SL->Ecurp != RELEASE) // la touche est-elle appuyée ? - { - if (SL->Ecnt < ENV_DECAY) // attack phase ? - { - SL->Ecnt = (ENV_TAB[SL->Ecnt >> ENV_LBITS] << ENV_LBITS) + ENV_DECAY; - } + slot_ *SL = &(CH->SLOT[nsl]); // on recupère le bon pointeur de slot + + if (SL->Ecurp != RELEASE) // la touche est-elle appuyée ? + { + if (SL->Ecnt < ENV_DECAY) // attack phase ? + { + SL->Ecnt = (ENV_TAB[SL->Ecnt >> ENV_LBITS] << ENV_LBITS) + ENV_DECAY; + } - SL->Einc = SL->EincR; - SL->Ecmp = ENV_END; - SL->Ecurp = RELEASE; - } + SL->Einc = SL->EincR; + SL->Ecmp = ENV_END; + SL->Ecurp = RELEASE; + } } INLINE void CSM_Key_Control() { - KEY_ON(&YM2612.CHANNEL[2], 0); - KEY_ON(&YM2612.CHANNEL[2], 1); - KEY_ON(&YM2612.CHANNEL[2], 2); - KEY_ON(&YM2612.CHANNEL[2], 3); + KEY_ON(&YM2612.CHANNEL[2], 0); + KEY_ON(&YM2612.CHANNEL[2], 1); + KEY_ON(&YM2612.CHANNEL[2], 2); + KEY_ON(&YM2612.CHANNEL[2], 3); - /* found by Nemesis */ - KEY_OFF(&YM2612.CHANNEL[2], 0); - KEY_OFF(&YM2612.CHANNEL[2], 1); - KEY_OFF(&YM2612.CHANNEL[2], 2); - KEY_OFF(&YM2612.CHANNEL[2], 3); + /* found by Nemesis */ + KEY_OFF(&YM2612.CHANNEL[2], 0); + KEY_OFF(&YM2612.CHANNEL[2], 1); + KEY_OFF(&YM2612.CHANNEL[2], 2); + KEY_OFF(&YM2612.CHANNEL[2], 3); } int SLOT_SET(int Adr, unsigned char data) { - channel_ *CH; - slot_ *SL; - int nch, nsl; + channel_ *CH; + slot_ *SL; + int nch, nsl; - if ((nch = Adr & 3) == 3) return 1; - nsl = (Adr >> 2) & 3; + if ((nch = Adr & 3) == 3) return 1; + nsl = (Adr >> 2) & 3; - if (Adr & 0x100) nch += 3; + if (Adr & 0x100) nch += 3; - CH = &(YM2612.CHANNEL[nch]); - SL = &(CH->SLOT[nsl]); + CH = &(YM2612.CHANNEL[nch]); + SL = &(CH->SLOT[nsl]); - switch(Adr & 0xF0) - { - case 0x30: - if ((SL->MUL = (data & 0x0F))) SL->MUL <<= 1; - else SL->MUL = 1; + switch(Adr & 0xF0) + { + case 0x30: + if ((SL->MUL = (data & 0x0F))) SL->MUL <<= 1; + else SL->MUL = 1; - SL->DT = (int *)DT_TAB[(data >> 4) & 7]; + SL->DT = (int *)DT_TAB[(data >> 4) & 7]; - CH->SLOT[0].Finc = -1; + CH->SLOT[0].Finc = -1; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d], SLOT[%d] DTMUL = %.2X\n", nch, nsl, data & 0x7F); + fprintf(debug_file, "CHANNEL[%d], SLOT[%d] DTMUL = %.2X\n", nch, nsl, data & 0x7F); #endif - break; + break; - case 0x40: - SL->TL = data & 0x7F; + case 0x40: + SL->TL = data & 0x7F; - // SOR2 do a lot of TL adjustement and this fix R.Shinobi jump sound... - YM2612_Special_Update(); + // SOR2 do a lot of TL adjustement and this fix R.Shinobi jump sound... + YM2612_Special_Update(); #if ((ENV_HBITS - 7) < 0) - SL->TLL = SL->TL >> (7 - ENV_HBITS); + SL->TLL = SL->TL >> (7 - ENV_HBITS); #else - SL->TLL = SL->TL << (ENV_HBITS - 7); + SL->TLL = SL->TL << (ENV_HBITS - 7); #endif #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d], SLOT[%d] TL = %.2X\n", nch, nsl, SL->TL); + fprintf(debug_file, "CHANNEL[%d], SLOT[%d] TL = %.2X\n", nch, nsl, SL->TL); #endif - break; + break; - case 0x50: - SL->KSR_S = 3 - (data >> 6); + case 0x50: + SL->KSR_S = 3 - (data >> 6); - CH->SLOT[0].Finc = -1; + CH->SLOT[0].Finc = -1; - if (data &= 0x1F) SL->AR = (int *)&AR_TAB[data << 1]; - else SL->AR = (int *)&NULL_RATE[0]; + if (data &= 0x1F) SL->AR = (int *)&AR_TAB[data << 1]; + else SL->AR = (int *)&NULL_RATE[0]; - SL->EincA = SL->AR[SL->KSR]; - if (SL->Ecurp == ATTACK) SL->Einc = SL->EincA; + SL->EincA = SL->AR[SL->KSR]; + if (SL->Ecurp == ATTACK) SL->Einc = SL->EincA; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d], SLOT[%d] AR = %.2X EincA = %.6X\n", nch, nsl, data, SL->EincA); + fprintf(debug_file, "CHANNEL[%d], SLOT[%d] AR = %.2X EincA = %.6X\n", nch, nsl, data, SL->EincA); #endif - break; + break; - case 0x60: - if ((SL->AMSon = (data & 0x80))) SL->AMS = CH->AMS; - else SL->AMS = 31; + case 0x60: + if ((SL->AMSon = (data & 0x80))) SL->AMS = CH->AMS; + else SL->AMS = 31; - if (data &= 0x1F) SL->DR = (int *)&DR_TAB[data << 1]; - else SL->DR = (int *)&NULL_RATE[0]; + if (data &= 0x1F) SL->DR = (int *)&DR_TAB[data << 1]; + else SL->DR = (int *)&NULL_RATE[0]; - SL->EincD = SL->DR[SL->KSR]; - if (SL->Ecurp == DECAY) SL->Einc = SL->EincD; + SL->EincD = SL->DR[SL->KSR]; + if (SL->Ecurp == DECAY) SL->Einc = SL->EincD; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d], SLOT[%d] AMS = %d DR = %.2X EincD = %.6X\n", nch, nsl, SL->AMSon, data, SL->EincD); + fprintf(debug_file, "CHANNEL[%d], SLOT[%d] AMS = %d DR = %.2X EincD = %.6X\n", nch, nsl, SL->AMSon, data, SL->EincD); #endif - break; + break; - case 0x70: - if (data &= 0x1F) SL->SR = (int *)&DR_TAB[data << 1]; - else SL->SR = (int *)&NULL_RATE[0]; + case 0x70: + if (data &= 0x1F) SL->SR = (int *)&DR_TAB[data << 1]; + else SL->SR = (int *)&NULL_RATE[0]; - SL->EincS = SL->SR[SL->KSR]; - if ((SL->Ecurp == SUBSTAIN) && (SL->Ecnt < ENV_END)) SL->Einc = SL->EincS; + SL->EincS = SL->SR[SL->KSR]; + if ((SL->Ecurp == SUBSTAIN) && (SL->Ecnt < ENV_END)) SL->Einc = SL->EincS; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d], SLOT[%d] SR = %.2X EincS = %.6X\n", nch, nsl, data, SL->EincS); + fprintf(debug_file, "CHANNEL[%d], SLOT[%d] SR = %.2X EincS = %.6X\n", nch, nsl, data, SL->EincS); #endif - break; + break; - case 0x80: - SL->SLL = SL_TAB[data >> 4]; + case 0x80: + SL->SLL = SL_TAB[data >> 4]; - SL->RR = (int *)&DR_TAB[((data & 0xF) << 2) + 2]; + SL->RR = (int *)&DR_TAB[((data & 0xF) << 2) + 2]; - SL->EincR = SL->RR[SL->KSR]; - if ((SL->Ecurp == RELEASE) && (SL->Ecnt < ENV_END)) SL->Einc = SL->EincR; + SL->EincR = SL->RR[SL->KSR]; + if ((SL->Ecurp == RELEASE) && (SL->Ecnt < ENV_END)) SL->Einc = SL->EincR; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d], SLOT[%d] SL = %.8X\n", nch, nsl, SL->SLL); - fprintf(debug_file, "CHANNEL[%d], SLOT[%d] RR = %.2X EincR = %.2X\n", nch, nsl, ((data & 0xF) << 1) | 2, SL->EincR); + fprintf(debug_file, "CHANNEL[%d], SLOT[%d] SL = %.8X\n", nch, nsl, SL->SLL); + fprintf(debug_file, "CHANNEL[%d], SLOT[%d] RR = %.2X EincR = %.2X\n", nch, nsl, ((data & 0xF) << 1) | 2, SL->EincR); #endif - break; + break; - case 0x90: + case 0x90: /* - // SSG-EG envelope shapes : - // - // E At Al H - // - // 1 0 0 0 \\\\ - // - // 1 0 0 1 \___ - // - // 1 0 1 0 \/\/ - // ___ - // 1 0 1 1 \ - // - // 1 1 0 0 //// - // ___ - // 1 1 0 1 / - // - // 1 1 1 0 /\/\ - // - // 1 1 1 1 /___ - // - // E = SSG-EG enable - // At = Start negate - // Al = Altern - // H = Hold + // SSG-EG envelope shapes : + // + // E At Al H + // + // 1 0 0 0 \\\\ + // + // 1 0 0 1 \___ + // + // 1 0 1 0 \/\/ + // ___ + // 1 0 1 1 \ + // + // 1 1 0 0 //// + // ___ + // 1 1 0 1 / + // + // 1 1 1 0 /\/\ + // + // 1 1 1 1 /___ + // + // E = SSG-EG enable + // At = Start negate + // Al = Altern + // H = Hold */ - if (data & 0x08) SL->SEG = data & 0x0F; + if (data & 0x08) SL->SEG = data & 0x0F; else SL->SEG = 0; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d], SLOT[%d] SSG-EG = %.2X\n", nch, nsl, data); + fprintf(debug_file, "CHANNEL[%d], SLOT[%d] SSG-EG = %.2X\n", nch, nsl, data); #endif break; - } + } - return 0; + return 0; } int CHANNEL_SET(int Adr, unsigned char data) { - channel_ *CH; - int num; - - if ((num = Adr & 3) == 3) return 1; - - switch(Adr & 0xFC) - { - case 0xA0: - if (Adr & 0x100) num += 3; - CH = &(YM2612.CHANNEL[num]); + channel_ *CH; + int num; + + if ((num = Adr & 3) == 3) return 1; + + switch(Adr & 0xFC) + { + case 0xA0: + if (Adr & 0x100) num += 3; + CH = &(YM2612.CHANNEL[num]); - YM2612_Special_Update(); + YM2612_Special_Update(); - CH->FNUM[0] = (CH->FNUM[0] & 0x700) + data; - CH->KC[0] = (CH->FOCT[0] << 2) | FKEY_TAB[CH->FNUM[0] >> 7]; + CH->FNUM[0] = (CH->FNUM[0] & 0x700) + data; + CH->KC[0] = (CH->FOCT[0] << 2) | FKEY_TAB[CH->FNUM[0] >> 7]; - CH->SLOT[0].Finc = -1; + CH->SLOT[0].Finc = -1; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d] part1 FNUM = %d KC = %d\n", num, CH->FNUM[0], CH->KC[0]); + fprintf(debug_file, "CHANNEL[%d] part1 FNUM = %d KC = %d\n", num, CH->FNUM[0], CH->KC[0]); #endif - break; + break; - case 0xA4: - if (Adr & 0x100) num += 3; - CH = &(YM2612.CHANNEL[num]); + case 0xA4: + if (Adr & 0x100) num += 3; + CH = &(YM2612.CHANNEL[num]); - YM2612_Special_Update(); + YM2612_Special_Update(); - CH->FNUM[0] = (CH->FNUM[0] & 0x0FF) + ((int) (data & 0x07) << 8); - CH->FOCT[0] = (data & 0x38) >> 3; - CH->KC[0] = (CH->FOCT[0] << 2) | FKEY_TAB[CH->FNUM[0] >> 7]; + CH->FNUM[0] = (CH->FNUM[0] & 0x0FF) + ((int) (data & 0x07) << 8); + CH->FOCT[0] = (data & 0x38) >> 3; + CH->KC[0] = (CH->FOCT[0] << 2) | FKEY_TAB[CH->FNUM[0] >> 7]; - CH->SLOT[0].Finc = -1; + CH->SLOT[0].Finc = -1; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d] part2 FNUM = %d FOCT = %d KC = %d\n", num, CH->FNUM[0], CH->FOCT[0], CH->KC[0]); + fprintf(debug_file, "CHANNEL[%d] part2 FNUM = %d FOCT = %d KC = %d\n", num, CH->FNUM[0], CH->FOCT[0], CH->KC[0]); #endif - break; + break; - case 0xA8: - if (Adr < 0x100) - { - num++; + case 0xA8: + if (Adr < 0x100) + { + num++; - YM2612_Special_Update(); + YM2612_Special_Update(); - YM2612.CHANNEL[2].FNUM[num] = (YM2612.CHANNEL[2].FNUM[num] & 0x700) + data; - YM2612.CHANNEL[2].KC[num] = (YM2612.CHANNEL[2].FOCT[num] << 2) | FKEY_TAB[YM2612.CHANNEL[2].FNUM[num] >> 7]; + YM2612.CHANNEL[2].FNUM[num] = (YM2612.CHANNEL[2].FNUM[num] & 0x700) + data; + YM2612.CHANNEL[2].KC[num] = (YM2612.CHANNEL[2].FOCT[num] << 2) | FKEY_TAB[YM2612.CHANNEL[2].FNUM[num] >> 7]; - YM2612.CHANNEL[2].SLOT[0].Finc = -1; + YM2612.CHANNEL[2].SLOT[0].Finc = -1; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[2] part1 FNUM[%d] = %d KC[%d] = %d\n", num, YM2612.CHANNEL[2].FNUM[num], num, YM2612.CHANNEL[2].KC[num]); + fprintf(debug_file, "CHANNEL[2] part1 FNUM[%d] = %d KC[%d] = %d\n", num, YM2612.CHANNEL[2].FNUM[num], num, YM2612.CHANNEL[2].KC[num]); #endif - } - break; + } + break; - case 0xAC: - if (Adr < 0x100) - { - num++; + case 0xAC: + if (Adr < 0x100) + { + num++; - YM2612_Special_Update(); + YM2612_Special_Update(); - YM2612.CHANNEL[2].FNUM[num] = (YM2612.CHANNEL[2].FNUM[num] & 0x0FF) + ((int) (data & 0x07) << 8); - YM2612.CHANNEL[2].FOCT[num] = (data & 0x38) >> 3; - YM2612.CHANNEL[2].KC[num] = (YM2612.CHANNEL[2].FOCT[num] << 2) | FKEY_TAB[YM2612.CHANNEL[2].FNUM[num] >> 7]; + YM2612.CHANNEL[2].FNUM[num] = (YM2612.CHANNEL[2].FNUM[num] & 0x0FF) + ((int) (data & 0x07) << 8); + YM2612.CHANNEL[2].FOCT[num] = (data & 0x38) >> 3; + YM2612.CHANNEL[2].KC[num] = (YM2612.CHANNEL[2].FOCT[num] << 2) | FKEY_TAB[YM2612.CHANNEL[2].FNUM[num] >> 7]; - YM2612.CHANNEL[2].SLOT[0].Finc = -1; + YM2612.CHANNEL[2].SLOT[0].Finc = -1; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[2] part2 FNUM[%d] = %d FOCT[%d] = %d KC[%d] = %d\n", num, YM2612.CHANNEL[2].FNUM[num], num, YM2612.CHANNEL[2].FOCT[num], num, YM2612.CHANNEL[2].KC[num]); + fprintf(debug_file, "CHANNEL[2] part2 FNUM[%d] = %d FOCT[%d] = %d KC[%d] = %d\n", num, YM2612.CHANNEL[2].FNUM[num], num, YM2612.CHANNEL[2].FOCT[num], num, YM2612.CHANNEL[2].KC[num]); #endif - } - break; + } + break; - case 0xB0: - if (Adr & 0x100) num += 3; - CH = &(YM2612.CHANNEL[num]); + case 0xB0: + if (Adr & 0x100) num += 3; + CH = &(YM2612.CHANNEL[num]); - if (CH->ALGO != (data & 7)) - { - // Fix VectorMan 2 heli sound (level 1) - YM2612_Special_Update(); + if (CH->ALGO != (data & 7)) + { + // Fix VectorMan 2 heli sound (level 1) + YM2612_Special_Update(); - CH->ALGO = data & 7; - - CH->SLOT[0].ChgEnM = 0; - CH->SLOT[1].ChgEnM = 0; - CH->SLOT[2].ChgEnM = 0; - CH->SLOT[3].ChgEnM = 0; - } + CH->ALGO = data & 7; + + CH->SLOT[0].ChgEnM = 0; + CH->SLOT[1].ChgEnM = 0; + CH->SLOT[2].ChgEnM = 0; + CH->SLOT[3].ChgEnM = 0; + } - CH->FB = 9 - ((data >> 3) & 7); // Real thing ? + CH->FB = 9 - ((data >> 3) & 7); // Real thing ? -// if (CH->FB = ((data >> 3) & 7)) CH->FB = 9 - CH->FB; // Thunder force 4 (music stage 8), Gynoug, Aladdin bug sound... -// else CH->FB = 31; +// if (CH->FB = ((data >> 3) & 7)) CH->FB = 9 - CH->FB; // Thunder force 4 (music stage 8), Gynoug, Aladdin bug sound... +// else CH->FB = 31; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "CHANNEL[%d] ALGO = %d FB = %d\n", num, CH->ALGO, CH->FB); + fprintf(debug_file, "CHANNEL[%d] ALGO = %d FB = %d\n", num, CH->ALGO, CH->FB); #endif - break; + break; - case 0xB4: - if (Adr & 0x100) num += 3; - CH = &(YM2612.CHANNEL[num]); + case 0xB4: + if (Adr & 0x100) num += 3; + CH = &(YM2612.CHANNEL[num]); - YM2612_Special_Update(); + YM2612_Special_Update(); - if (data & 0x80) CH->LEFT = 0xFFFFFFFF; - else CH->LEFT = 0; - - if (data & 0x40) CH->RIGHT = 0xFFFFFFFF; - else CH->RIGHT = 0; - - CH->AMS = LFO_AMS_TAB[(data >> 4) & 3]; - CH->FMS = LFO_FMS_TAB[data & 7]; + if (data & 0x80) CH->LEFT = 0xFFFFFFFF; + else CH->LEFT = 0; + + if (data & 0x40) CH->RIGHT = 0xFFFFFFFF; + else CH->RIGHT = 0; + + CH->AMS = LFO_AMS_TAB[(data >> 4) & 3]; + CH->FMS = LFO_FMS_TAB[data & 7]; - if (CH->SLOT[0].AMSon) CH->SLOT[0].AMS = CH->AMS; - else CH->SLOT[0].AMS = 31; - if (CH->SLOT[1].AMSon) CH->SLOT[1].AMS = CH->AMS; - else CH->SLOT[1].AMS = 31; - if (CH->SLOT[2].AMSon) CH->SLOT[2].AMS = CH->AMS; - else CH->SLOT[2].AMS = 31; - if (CH->SLOT[3].AMSon) CH->SLOT[3].AMS = CH->AMS; - else CH->SLOT[3].AMS = 31; + if (CH->SLOT[0].AMSon) CH->SLOT[0].AMS = CH->AMS; + else CH->SLOT[0].AMS = 31; + if (CH->SLOT[1].AMSon) CH->SLOT[1].AMS = CH->AMS; + else CH->SLOT[1].AMS = 31; + if (CH->SLOT[2].AMSon) CH->SLOT[2].AMS = CH->AMS; + else CH->SLOT[2].AMS = 31; + if (CH->SLOT[3].AMSon) CH->SLOT[3].AMS = CH->AMS; + else CH->SLOT[3].AMS = 31; #if YM_DEBUG_LEVEL > 0 - fprintf(debug_file, "CHANNEL[%d] AMS = %d FMS = %d\n", num, CH->AMS, CH->FMS); + fprintf(debug_file, "CHANNEL[%d] AMS = %d FMS = %d\n", num, CH->AMS, CH->FMS); #endif - break; - } - - return 0; + break; + } + + return 0; } int YM_SET(int Adr, unsigned char data) { - channel_ *CH; - int nch; + channel_ *CH; + int nch; - switch(Adr) - { - case 0x22: - if (data & 8) - { - // Cool Spot music 1, LFO modified severals time which - // distord the sound, have to check that on a real genesis... + switch(Adr) + { + case 0x22: + if (data & 8) + { + // Cool Spot music 1, LFO modified severals time which + // distord the sound, have to check that on a real genesis... - YM2612.LFOinc = LFO_INC_TAB[data & 7]; + YM2612.LFOinc = LFO_INC_TAB[data & 7]; #if YM_DEBUG_LEVEL > 0 - fprintf(debug_file, "\nLFO Enable, LFOinc = %.8X %d\n", YM2612.LFOinc, data & 7); + fprintf(debug_file, "\nLFO Enable, LFOinc = %.8X %d\n", YM2612.LFOinc, data & 7); #endif - } - else - { - YM2612.LFOinc = YM2612.LFOcnt = 0; + } + else + { + YM2612.LFOinc = YM2612.LFOcnt = 0; #if YM_DEBUG_LEVEL > 0 - fprintf(debug_file, "\nLFO Disable\n"); + fprintf(debug_file, "\nLFO Disable\n"); #endif - } - break; + } + break; - case 0x24: - YM2612.TimerA = (YM2612.TimerA & 0x003) | (((int) data) << 2); - YM2612.TimerAL = (1024 - YM2612.TimerA) << 12; + case 0x24: + YM2612.TimerA = (YM2612.TimerA & 0x003) | (((int) data) << 2); + YM2612.TimerAL = (1024 - YM2612.TimerA) << 12; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "Timer A Set = %.8X\n", YM2612.TimerAL); + fprintf(debug_file, "Timer A Set = %.8X\n", YM2612.TimerAL); #endif - break; + break; - case 0x25: - YM2612.TimerA = (YM2612.TimerA & 0x3fc) | (data & 3); - YM2612.TimerAL = (1024 - YM2612.TimerA) << 12; + case 0x25: + YM2612.TimerA = (YM2612.TimerA & 0x3fc) | (data & 3); + YM2612.TimerAL = (1024 - YM2612.TimerA) << 12; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "Timer A Set = %.8X\n", YM2612.TimerAL); + fprintf(debug_file, "Timer A Set = %.8X\n", YM2612.TimerAL); #endif - break; + break; - case 0x26: - YM2612.TimerB = data; - YM2612.TimerBL = (256 - YM2612.TimerB) << (4 + 12); + case 0x26: + YM2612.TimerB = data; + YM2612.TimerBL = (256 - YM2612.TimerB) << (4 + 12); #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "Timer B Set = %.8X\n", YM2612.TimerBL); + fprintf(debug_file, "Timer B Set = %.8X\n", YM2612.TimerBL); #endif - break; + break; - case 0x27: - // Paramètre divers - // b7 = CSM MODE - // b6 = 3 slot mode - // b5 = reset b - // b4 = reset a - // b3 = timer enable b - // b2 = timer enable a - // b1 = load b - // b0 = load a + case 0x27: + // Paramètre divers + // b7 = CSM MODE + // b6 = 3 slot mode + // b5 = reset b + // b4 = reset a + // b3 = timer enable b + // b2 = timer enable a + // b1 = load b + // b0 = load a - if ((data ^ YM2612.Mode) & 0xC0) - { - // We changed the channel 2 mode, so recalculate phase step - // This fix the punch sound in Street of Rage 2 + if ((data ^ YM2612.Mode) & 0xC0) + { + // We changed the channel 2 mode, so recalculate phase step + // This fix the punch sound in Street of Rage 2 - YM2612_Special_Update(); + YM2612_Special_Update(); - YM2612.CHANNEL[2].SLOT[0].Finc = -1; // recalculate phase step - } + YM2612.CHANNEL[2].SLOT[0].Finc = -1; // recalculate phase step + } - if ((data & 2) && !(YM2612.Mode & 2)) YM2612.TimerBcnt = YM2612.TimerBL; - if ((data & 1) && !(YM2612.Mode & 1)) YM2612.TimerAcnt = YM2612.TimerAL; + if ((data & 2) && !(YM2612.Mode & 2)) YM2612.TimerBcnt = YM2612.TimerBL; + if ((data & 1) && !(YM2612.Mode & 1)) YM2612.TimerAcnt = YM2612.TimerAL; - YM2612.Status &= (~data >> 4)/* & (data >> 2)*/; // Reset Status + YM2612.Status &= (~data >> 4)/* & (data >> 2)*/; // Reset Status - YM2612.Mode = data; + YM2612.Mode = data; #if YM_DEBUG_LEVEL > 0 - fprintf(debug_file, "Mode reg = %.2X\n", data); + fprintf(debug_file, "Mode reg = %.2X\n", data); #endif - break; + break; - case 0x28: - if ((nch = data & 3) == 3) return 1; + case 0x28: + if ((nch = data & 3) == 3) return 1; - if (data & 4) nch += 3; - CH = &(YM2612.CHANNEL[nch]); + if (data & 4) nch += 3; + CH = &(YM2612.CHANNEL[nch]); - YM2612_Special_Update(); + YM2612_Special_Update(); - if (data & 0x10) KEY_ON(CH, S0); // On appuie sur la touche pour le slot 1 - else KEY_OFF(CH, S0); // On relâche la touche pour le slot 1 - if (data & 0x20) KEY_ON(CH, S1); // On appuie sur la touche pour le slot 3 - else KEY_OFF(CH, S1); // On relâche la touche pour le slot 3 - if (data & 0x40) KEY_ON(CH, S2); // On appuie sur la touche pour le slot 2 - else KEY_OFF(CH, S2); // On relâche la touche pour le slot 2 - if (data & 0x80) KEY_ON(CH, S3); // On appuie sur la touche pour le slot 4 - else KEY_OFF(CH, S3); // On relâche la touche pour le slot 4 + if (data & 0x10) KEY_ON(CH, S0); // On appuie sur la touche pour le slot 1 + else KEY_OFF(CH, S0); // On relâche la touche pour le slot 1 + if (data & 0x20) KEY_ON(CH, S1); // On appuie sur la touche pour le slot 3 + else KEY_OFF(CH, S1); // On relâche la touche pour le slot 3 + if (data & 0x40) KEY_ON(CH, S2); // On appuie sur la touche pour le slot 2 + else KEY_OFF(CH, S2); // On relâche la touche pour le slot 2 + if (data & 0x80) KEY_ON(CH, S3); // On appuie sur la touche pour le slot 4 + else KEY_OFF(CH, S3); // On relâche la touche pour le slot 4 #if YM_DEBUG_LEVEL > 0 - fprintf(debug_file, "CHANNEL[%d] KEY %.1X\n", nch, ((data & 0xf0) >> 4)); + fprintf(debug_file, "CHANNEL[%d] KEY %.1X\n", nch, ((data & 0xf0) >> 4)); #endif - break; + break; - case 0x2A: - YM2612.DACdata = ((int) data - 0x80) << 7; // donnée du DAC - break; + case 0x2A: + YM2612.DACdata = ((int) data - 0x80) << 7; // donnée du DAC + break; - case 0x2B: - if (YM2612.DAC ^ (data & 0x80)) YM2612_Special_Update(); + case 0x2B: + if (YM2612.DAC ^ (data & 0x80)) YM2612_Special_Update(); - YM2612.DAC = data & 0x80; // activation/désactivation du DAC - break; - } - - return 0; + YM2612.DAC = data & 0x80; // activation/désactivation du DAC + break; + } + + return 0; } @@ -816,645 +816,645 @@ void Env_NULL_Next(slot_ *SL) void Env_Attack_Next(slot_ *SL) { - // Verified with Gynoug even in HQ (explode SFX) - SL->Ecnt = ENV_DECAY; + // Verified with Gynoug even in HQ (explode SFX) + SL->Ecnt = ENV_DECAY; - SL->Einc = SL->EincD; - SL->Ecmp = SL->SLL; - SL->Ecurp = DECAY; + SL->Einc = SL->EincD; + SL->Ecmp = SL->SLL; + SL->Ecurp = DECAY; } void Env_Decay_Next(slot_ *SL) { - // Verified with Gynoug even in HQ (explode SFX) - SL->Ecnt = SL->SLL; + // Verified with Gynoug even in HQ (explode SFX) + SL->Ecnt = SL->SLL; - SL->Einc = SL->EincS; - SL->Ecmp = ENV_END; - SL->Ecurp = SUBSTAIN; + SL->Einc = SL->EincS; + SL->Ecmp = ENV_END; + SL->Ecurp = SUBSTAIN; } void Env_Substain_Next(slot_ *SL) { - if (SL->SEG & 8) // SSG envelope type - { - if (SL->SEG & 1) - { - SL->Ecnt = ENV_END; - SL->Einc = 0; - SL->Ecmp = ENV_END + 1; - } - else - { - // re KEY ON - // SL->Fcnt = 0; - // SL->ChgEnM = 0xFFFFFFFF; - SL->Ecnt = 0; - SL->Einc = SL->EincA; - SL->Ecmp = ENV_DECAY; - SL->Ecurp = ATTACK; - } + if (SL->SEG & 8) // SSG envelope type + { + if (SL->SEG & 1) + { + SL->Ecnt = ENV_END; + SL->Einc = 0; + SL->Ecmp = ENV_END + 1; + } + else + { + // re KEY ON + // SL->Fcnt = 0; + // SL->ChgEnM = 0xFFFFFFFF; + SL->Ecnt = 0; + SL->Einc = SL->EincA; + SL->Ecmp = ENV_DECAY; + SL->Ecurp = ATTACK; + } - SL->SEG ^= (SL->SEG & 2) << 1; - } - else - { - SL->Ecnt = ENV_END; - SL->Einc = 0; - SL->Ecmp = ENV_END + 1; - } + SL->SEG ^= (SL->SEG & 2) << 1; + } + else + { + SL->Ecnt = ENV_END; + SL->Einc = 0; + SL->Ecmp = ENV_END + 1; + } } void Env_Release_Next(slot_ *SL) { - SL->Ecnt = ENV_END; - SL->Einc = 0; - SL->Ecmp = ENV_END + 1; + SL->Ecnt = ENV_END; + SL->Einc = 0; + SL->Ecmp = ENV_END + 1; } -#define GET_CURRENT_PHASE \ -in0 = CH->SLOT[S0].Fcnt; \ -in1 = CH->SLOT[S1].Fcnt; \ -in2 = CH->SLOT[S2].Fcnt; \ +#define GET_CURRENT_PHASE \ +in0 = CH->SLOT[S0].Fcnt; \ +in1 = CH->SLOT[S1].Fcnt; \ +in2 = CH->SLOT[S2].Fcnt; \ in3 = CH->SLOT[S3].Fcnt; -#define UPDATE_PHASE \ -CH->SLOT[S0].Fcnt += CH->SLOT[S0].Finc; \ -CH->SLOT[S1].Fcnt += CH->SLOT[S1].Finc; \ -CH->SLOT[S2].Fcnt += CH->SLOT[S2].Finc; \ +#define UPDATE_PHASE \ +CH->SLOT[S0].Fcnt += CH->SLOT[S0].Finc; \ +CH->SLOT[S1].Fcnt += CH->SLOT[S1].Finc; \ +CH->SLOT[S2].Fcnt += CH->SLOT[S2].Finc; \ CH->SLOT[S3].Fcnt += CH->SLOT[S3].Finc; -#define UPDATE_PHASE_LFO \ -if ((freq_LFO = (CH->FMS * LFO_FREQ_UP[i]) >> (LFO_HBITS - 1))) \ -{ \ - CH->SLOT[S0].Fcnt += CH->SLOT[S0].Finc + ((CH->SLOT[S0].Finc * freq_LFO) >> LFO_FMS_LBITS); \ - CH->SLOT[S1].Fcnt += CH->SLOT[S1].Finc + ((CH->SLOT[S1].Finc * freq_LFO) >> LFO_FMS_LBITS); \ - CH->SLOT[S2].Fcnt += CH->SLOT[S2].Finc + ((CH->SLOT[S2].Finc * freq_LFO) >> LFO_FMS_LBITS); \ - CH->SLOT[S3].Fcnt += CH->SLOT[S3].Finc + ((CH->SLOT[S3].Finc * freq_LFO) >> LFO_FMS_LBITS); \ -} \ -else \ -{ \ - CH->SLOT[S0].Fcnt += CH->SLOT[S0].Finc; \ - CH->SLOT[S1].Fcnt += CH->SLOT[S1].Finc; \ - CH->SLOT[S2].Fcnt += CH->SLOT[S2].Finc; \ - CH->SLOT[S3].Fcnt += CH->SLOT[S3].Finc; \ +#define UPDATE_PHASE_LFO \ +if ((freq_LFO = (CH->FMS * LFO_FREQ_UP[i]) >> (LFO_HBITS - 1))) \ +{ \ + CH->SLOT[S0].Fcnt += CH->SLOT[S0].Finc + ((CH->SLOT[S0].Finc * freq_LFO) >> LFO_FMS_LBITS); \ + CH->SLOT[S1].Fcnt += CH->SLOT[S1].Finc + ((CH->SLOT[S1].Finc * freq_LFO) >> LFO_FMS_LBITS); \ + CH->SLOT[S2].Fcnt += CH->SLOT[S2].Finc + ((CH->SLOT[S2].Finc * freq_LFO) >> LFO_FMS_LBITS); \ + CH->SLOT[S3].Fcnt += CH->SLOT[S3].Finc + ((CH->SLOT[S3].Finc * freq_LFO) >> LFO_FMS_LBITS); \ +} \ +else \ +{ \ + CH->SLOT[S0].Fcnt += CH->SLOT[S0].Finc; \ + CH->SLOT[S1].Fcnt += CH->SLOT[S1].Finc; \ + CH->SLOT[S2].Fcnt += CH->SLOT[S2].Finc; \ + CH->SLOT[S3].Fcnt += CH->SLOT[S3].Finc; \ } -#define GET_CURRENT_ENV \ -if (CH->SLOT[S0].SEG & 4) \ -{ \ - if ((en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL) > ENV_MASK) en0 = 0; \ - else en0 ^= ENV_MASK; \ -} \ -else en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL; \ -if (CH->SLOT[S1].SEG & 4) \ -{ \ - if ((en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL) > ENV_MASK) en1 = 0; \ - else en1 ^= ENV_MASK; \ -} \ -else en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL; \ -if (CH->SLOT[S2].SEG & 4) \ -{ \ - if ((en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL) > ENV_MASK) en2 = 0; \ - else en2 ^= ENV_MASK; \ -} \ -else en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL; \ -if (CH->SLOT[S3].SEG & 4) \ -{ \ - if ((en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL) > ENV_MASK) en3 = 0; \ - else en3 ^= ENV_MASK; \ -} \ +#define GET_CURRENT_ENV \ +if (CH->SLOT[S0].SEG & 4) \ +{ \ + if ((en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL) > ENV_MASK) en0 = 0; \ + else en0 ^= ENV_MASK; \ +} \ +else en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL; \ +if (CH->SLOT[S1].SEG & 4) \ +{ \ + if ((en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL) > ENV_MASK) en1 = 0; \ + else en1 ^= ENV_MASK; \ +} \ +else en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL; \ +if (CH->SLOT[S2].SEG & 4) \ +{ \ + if ((en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL) > ENV_MASK) en2 = 0; \ + else en2 ^= ENV_MASK; \ +} \ +else en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL; \ +if (CH->SLOT[S3].SEG & 4) \ +{ \ + if ((en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL) > ENV_MASK) en3 = 0; \ + else en3 ^= ENV_MASK; \ +} \ else en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL; -#define GET_CURRENT_ENV_LFO \ -env_LFO = LFO_ENV_UP[i]; \ - \ -if (CH->SLOT[S0].SEG & 4) \ -{ \ - if ((en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL) > ENV_MASK) en0 = 0; \ - else en0 = (en0 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S0].AMS); \ -} \ -else en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL + (env_LFO >> CH->SLOT[S0].AMS); \ -if (CH->SLOT[S1].SEG & 4) \ -{ \ - if ((en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL) > ENV_MASK) en1 = 0; \ - else en1 = (en1 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S1].AMS); \ -} \ -else en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL + (env_LFO >> CH->SLOT[S1].AMS); \ -if (CH->SLOT[S2].SEG & 4) \ -{ \ - if ((en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL) > ENV_MASK) en2 = 0; \ - else en2 = (en2 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S2].AMS); \ -} \ -else en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL + (env_LFO >> CH->SLOT[S2].AMS); \ -if (CH->SLOT[S3].SEG & 4) \ -{ \ - if ((en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL) > ENV_MASK) en3 = 0; \ - else en3 = (en3 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S3].AMS); \ -} \ +#define GET_CURRENT_ENV_LFO \ +env_LFO = LFO_ENV_UP[i]; \ + \ +if (CH->SLOT[S0].SEG & 4) \ +{ \ + if ((en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL) > ENV_MASK) en0 = 0; \ + else en0 = (en0 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S0].AMS); \ +} \ +else en0 = ENV_TAB[(CH->SLOT[S0].Ecnt >> ENV_LBITS)] + CH->SLOT[S0].TLL + (env_LFO >> CH->SLOT[S0].AMS); \ +if (CH->SLOT[S1].SEG & 4) \ +{ \ + if ((en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL) > ENV_MASK) en1 = 0; \ + else en1 = (en1 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S1].AMS); \ +} \ +else en1 = ENV_TAB[(CH->SLOT[S1].Ecnt >> ENV_LBITS)] + CH->SLOT[S1].TLL + (env_LFO >> CH->SLOT[S1].AMS); \ +if (CH->SLOT[S2].SEG & 4) \ +{ \ + if ((en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL) > ENV_MASK) en2 = 0; \ + else en2 = (en2 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S2].AMS); \ +} \ +else en2 = ENV_TAB[(CH->SLOT[S2].Ecnt >> ENV_LBITS)] + CH->SLOT[S2].TLL + (env_LFO >> CH->SLOT[S2].AMS); \ +if (CH->SLOT[S3].SEG & 4) \ +{ \ + if ((en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL) > ENV_MASK) en3 = 0; \ + else en3 = (en3 ^ ENV_MASK) + (env_LFO >> CH->SLOT[S3].AMS); \ +} \ else en3 = ENV_TAB[(CH->SLOT[S3].Ecnt >> ENV_LBITS)] + CH->SLOT[S3].TLL + (env_LFO >> CH->SLOT[S3].AMS); -#define UPDATE_ENV \ -if ((CH->SLOT[S0].Ecnt += CH->SLOT[S0].Einc) >= CH->SLOT[S0].Ecmp) \ - ENV_NEXT_EVENT[CH->SLOT[S0].Ecurp](&(CH->SLOT[S0])); \ -if ((CH->SLOT[S1].Ecnt += CH->SLOT[S1].Einc) >= CH->SLOT[S1].Ecmp) \ - ENV_NEXT_EVENT[CH->SLOT[S1].Ecurp](&(CH->SLOT[S1])); \ -if ((CH->SLOT[S2].Ecnt += CH->SLOT[S2].Einc) >= CH->SLOT[S2].Ecmp) \ - ENV_NEXT_EVENT[CH->SLOT[S2].Ecurp](&(CH->SLOT[S2])); \ -if ((CH->SLOT[S3].Ecnt += CH->SLOT[S3].Einc) >= CH->SLOT[S3].Ecmp) \ - ENV_NEXT_EVENT[CH->SLOT[S3].Ecurp](&(CH->SLOT[S3])); +#define UPDATE_ENV \ +if ((CH->SLOT[S0].Ecnt += CH->SLOT[S0].Einc) >= CH->SLOT[S0].Ecmp) \ + ENV_NEXT_EVENT[CH->SLOT[S0].Ecurp](&(CH->SLOT[S0])); \ +if ((CH->SLOT[S1].Ecnt += CH->SLOT[S1].Einc) >= CH->SLOT[S1].Ecmp) \ + ENV_NEXT_EVENT[CH->SLOT[S1].Ecurp](&(CH->SLOT[S1])); \ +if ((CH->SLOT[S2].Ecnt += CH->SLOT[S2].Einc) >= CH->SLOT[S2].Ecmp) \ + ENV_NEXT_EVENT[CH->SLOT[S2].Ecurp](&(CH->SLOT[S2])); \ +if ((CH->SLOT[S3].Ecnt += CH->SLOT[S3].Einc) >= CH->SLOT[S3].Ecmp) \ + ENV_NEXT_EVENT[CH->SLOT[S3].Ecurp](&(CH->SLOT[S3])); -#define DO_LIMIT \ -if (CH->OUTd > LIMIT_CH_OUT) CH->OUTd = LIMIT_CH_OUT; \ +#define DO_LIMIT \ +if (CH->OUTd > LIMIT_CH_OUT) CH->OUTd = LIMIT_CH_OUT; \ else if (CH->OUTd < -LIMIT_CH_OUT) CH->OUTd = -LIMIT_CH_OUT; -#define DO_FEEDBACK0 \ -in0 += CH->S0_OUT[0] >> CH->FB; \ +#define DO_FEEDBACK0 \ +in0 += CH->S0_OUT[0] >> CH->FB; \ CH->S0_OUT[0] = SIN_TAB[(in0 >> SIN_LBITS) & SIN_MASK][en0]; -#define DO_FEEDBACK \ -in0 += (CH->S0_OUT[0] + CH->S0_OUT[1]) >> CH->FB; \ -CH->S0_OUT[1] = CH->S0_OUT[0]; \ +#define DO_FEEDBACK \ +in0 += (CH->S0_OUT[0] + CH->S0_OUT[1]) >> CH->FB; \ +CH->S0_OUT[1] = CH->S0_OUT[0]; \ CH->S0_OUT[0] = SIN_TAB[(in0 >> SIN_LBITS) & SIN_MASK][en0]; -#define DO_FEEDBACK2 \ -in0 += (CH->S0_OUT[0] + (CH->S0_OUT[0] >> 2) + CH->S0_OUT[1]) >> CH->FB; \ -CH->S0_OUT[1] = CH->S0_OUT[0] >> 2; \ +#define DO_FEEDBACK2 \ +in0 += (CH->S0_OUT[0] + (CH->S0_OUT[0] >> 2) + CH->S0_OUT[1]) >> CH->FB; \ +CH->S0_OUT[1] = CH->S0_OUT[0] >> 2; \ CH->S0_OUT[0] = SIN_TAB[(in0 >> SIN_LBITS) & SIN_MASK][en0]; - + -#define DO_FEEDBACK3 \ -in0 += (CH->S0_OUT[0] + CH->S0_OUT[1] + CH->S0_OUT[2] + CH->S0_OUT[3]) >> CH->FB; \ -CH->S0_OUT[3] = CH->S0_OUT[2] >> 1; \ -CH->S0_OUT[2] = CH->S0_OUT[1] >> 1; \ -CH->S0_OUT[1] = CH->S0_OUT[0] >> 1; \ +#define DO_FEEDBACK3 \ +in0 += (CH->S0_OUT[0] + CH->S0_OUT[1] + CH->S0_OUT[2] + CH->S0_OUT[3]) >> CH->FB; \ +CH->S0_OUT[3] = CH->S0_OUT[2] >> 1; \ +CH->S0_OUT[2] = CH->S0_OUT[1] >> 1; \ +CH->S0_OUT[1] = CH->S0_OUT[0] >> 1; \ CH->S0_OUT[0] = SIN_TAB[(in0 >> SIN_LBITS) & SIN_MASK][en0]; -#define DO_ALGO_0 \ -DO_FEEDBACK \ -in1 += CH->S0_OUT[1]; \ -in2 += SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]; \ -in3 += SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ +#define DO_ALGO_0 \ +DO_FEEDBACK \ +in1 += CH->S0_OUT[1]; \ +in2 += SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]; \ +in3 += SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ CH->OUTd = (SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3]) >> OUT_SHIFT; -#define DO_ALGO_1 \ -DO_FEEDBACK \ -in2 += CH->S0_OUT[1] + SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]; \ -in3 += SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ +#define DO_ALGO_1 \ +DO_FEEDBACK \ +in2 += CH->S0_OUT[1] + SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]; \ +in3 += SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ CH->OUTd = (SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3]) >> OUT_SHIFT; -#define DO_ALGO_2 \ -DO_FEEDBACK \ -in2 += SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]; \ -in3 += CH->S0_OUT[1] + SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ +#define DO_ALGO_2 \ +DO_FEEDBACK \ +in2 += SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]; \ +in3 += CH->S0_OUT[1] + SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ CH->OUTd = (SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3]) >> OUT_SHIFT; -#define DO_ALGO_3 \ -DO_FEEDBACK \ -in1 += CH->S0_OUT[1]; \ -in3 += SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ +#define DO_ALGO_3 \ +DO_FEEDBACK \ +in1 += CH->S0_OUT[1]; \ +in3 += SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ CH->OUTd = (SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3]) >> OUT_SHIFT; -#define DO_ALGO_4 \ -DO_FEEDBACK \ -in1 += CH->S0_OUT[1]; \ -in3 += SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ -CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]) >> OUT_SHIFT; \ +#define DO_ALGO_4 \ +DO_FEEDBACK \ +in1 += CH->S0_OUT[1]; \ +in3 += SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]; \ +CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1]) >> OUT_SHIFT; \ DO_LIMIT -#define DO_ALGO_5 \ -DO_FEEDBACK \ -in1 += CH->S0_OUT[1]; \ -in2 += CH->S0_OUT[1]; \ -in3 += CH->S0_OUT[1]; \ -CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + (int) SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]) >> OUT_SHIFT; \ +#define DO_ALGO_5 \ +DO_FEEDBACK \ +in1 += CH->S0_OUT[1]; \ +in2 += CH->S0_OUT[1]; \ +in3 += CH->S0_OUT[1]; \ +CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + (int) SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]) >> OUT_SHIFT; \ DO_LIMIT -#define DO_ALGO_6 \ -DO_FEEDBACK \ -in1 += CH->S0_OUT[1]; \ -CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + (int) SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]) >> OUT_SHIFT; \ +#define DO_ALGO_6 \ +DO_FEEDBACK \ +in1 += CH->S0_OUT[1]; \ +CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + (int) SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2]) >> OUT_SHIFT; \ DO_LIMIT -#define DO_ALGO_7 \ -DO_FEEDBACK \ -CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + (int) SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2] + CH->S0_OUT[1]) >> OUT_SHIFT; \ +#define DO_ALGO_7 \ +DO_FEEDBACK \ +CH->OUTd = ((int) SIN_TAB[(in3 >> SIN_LBITS) & SIN_MASK][en3] + (int) SIN_TAB[(in1 >> SIN_LBITS) & SIN_MASK][en1] + (int) SIN_TAB[(in2 >> SIN_LBITS) & SIN_MASK][en2] + CH->S0_OUT[1]) >> OUT_SHIFT; \ DO_LIMIT -#define DO_OUTPUT \ -buf[0][i] += CH->OUTd & CH->LEFT; \ +#define DO_OUTPUT \ +buf[0][i] += CH->OUTd & CH->LEFT; \ buf[1][i] += CH->OUTd & CH->RIGHT; -#define DO_OUTPUT_INT0 \ -if ((int_cnt += YM2612.Inter_Step) & 0x04000) \ -{ \ - int_cnt &= 0x3FFF; \ - buf[0][i] += CH->OUTd & CH->LEFT; \ - buf[1][i] += CH->OUTd & CH->RIGHT; \ -} \ +#define DO_OUTPUT_INT0 \ +if ((int_cnt += YM2612.Inter_Step) & 0x04000) \ +{ \ + int_cnt &= 0x3FFF; \ + buf[0][i] += CH->OUTd & CH->LEFT; \ + buf[1][i] += CH->OUTd & CH->RIGHT; \ +} \ else i--; -#define DO_OUTPUT_INT1 \ -CH->Old_OUTd = (CH->OUTd + CH->Old_OUTd) >> 1; \ -if ((int_cnt += YM2612.Inter_Step) & 0x04000) \ -{ \ - int_cnt &= 0x3FFF; \ - buf[0][i] += CH->Old_OUTd & CH->LEFT; \ - buf[1][i] += CH->Old_OUTd & CH->RIGHT; \ -} \ +#define DO_OUTPUT_INT1 \ +CH->Old_OUTd = (CH->OUTd + CH->Old_OUTd) >> 1; \ +if ((int_cnt += YM2612.Inter_Step) & 0x04000) \ +{ \ + int_cnt &= 0x3FFF; \ + buf[0][i] += CH->Old_OUTd & CH->LEFT; \ + buf[1][i] += CH->Old_OUTd & CH->RIGHT; \ +} \ else i--; -#define DO_OUTPUT_INT2 \ -if ((int_cnt += YM2612.Inter_Step) & 0x04000) \ -{ \ - int_cnt &= 0x3FFF; \ - CH->Old_OUTd = (CH->OUTd + CH->Old_OUTd) >> 1; \ - buf[0][i] += CH->Old_OUTd & CH->LEFT; \ - buf[1][i] += CH->Old_OUTd & CH->RIGHT; \ -} \ -else i--; \ +#define DO_OUTPUT_INT2 \ +if ((int_cnt += YM2612.Inter_Step) & 0x04000) \ +{ \ + int_cnt &= 0x3FFF; \ + CH->Old_OUTd = (CH->OUTd + CH->Old_OUTd) >> 1; \ + buf[0][i] += CH->Old_OUTd & CH->LEFT; \ + buf[1][i] += CH->Old_OUTd & CH->RIGHT; \ +} \ +else i--; \ CH->Old_OUTd = CH->OUTd; -#define DO_OUTPUT_INT \ -if ((int_cnt += YM2612.Inter_Step) & 0x04000) \ -{ \ - int_cnt &= 0x3FFF; \ - CH->Old_OUTd = (((int_cnt ^ 0x3FFF) * CH->OUTd) + (int_cnt * CH->Old_OUTd)) >> 14; \ - buf[0][i] += CH->Old_OUTd & CH->LEFT; \ - buf[1][i] += CH->Old_OUTd & CH->RIGHT; \ -} \ -else i--; \ +#define DO_OUTPUT_INT \ +if ((int_cnt += YM2612.Inter_Step) & 0x04000) \ +{ \ + int_cnt &= 0x3FFF; \ + CH->Old_OUTd = (((int_cnt ^ 0x3FFF) * CH->OUTd) + (int_cnt * CH->Old_OUTd)) >> 14; \ + buf[0][i] += CH->Old_OUTd & CH->LEFT; \ + buf[1][i] += CH->Old_OUTd & CH->RIGHT; \ +} \ +else i--; \ CH->Old_OUTd = CH->OUTd; void Update_Chan_Algo0(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 0 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 0 len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_0 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_0 + DO_OUTPUT + } } void Update_Chan_Algo1(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 1 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 1 len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_1 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_1 + DO_OUTPUT + } } void Update_Chan_Algo2(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 2 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 2 len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_2 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_2 + DO_OUTPUT + } } void Update_Chan_Algo3(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 3 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 3 len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_3 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_3 + DO_OUTPUT + } } void Update_Chan_Algo4(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 4 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 4 len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_4 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_4 + DO_OUTPUT + } } void Update_Chan_Algo5(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 5 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 5 len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_5 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_5 + DO_OUTPUT + } } void Update_Chan_Algo6(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 6 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 6 len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_6 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_6 + DO_OUTPUT + } } void Update_Chan_Algo7(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 7 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 7 len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_7 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_7 + DO_OUTPUT + } } void Update_Chan_Algo0_LFO(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 0 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 0 LFO len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_0 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_0 + DO_OUTPUT + } } void Update_Chan_Algo1_LFO(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 1 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 1 LFO len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_1 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_1 + DO_OUTPUT + } } void Update_Chan_Algo2_LFO(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 2 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 2 LFO len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_2 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_2 + DO_OUTPUT + } } void Update_Chan_Algo3_LFO(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 3 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 3 LFO len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_3 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_3 + DO_OUTPUT + } } void Update_Chan_Algo4_LFO(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 4 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 4 LFO len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_4 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_4 + DO_OUTPUT + } } void Update_Chan_Algo5_LFO(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 5 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 5 LFO len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_5 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_5 + DO_OUTPUT + } } void Update_Chan_Algo6_LFO(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 6 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 6 LFO len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_6 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_6 + DO_OUTPUT + } } void Update_Chan_Algo7_LFO(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 7 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 7 LFO len = %d\n\n", lenght); #endif - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_7 - DO_OUTPUT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_7 + DO_OUTPUT + } } @@ -1465,385 +1465,385 @@ void Update_Chan_Algo7_LFO(channel_ *CH, int **buf, int lenght) void Update_Chan_Algo0_Int(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 0 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 0 len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_0 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_0 + DO_OUTPUT_INT + } } void Update_Chan_Algo1_Int(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 1 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 1 len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_1 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_1 + DO_OUTPUT_INT + } } void Update_Chan_Algo2_Int(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 2 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 2 len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_2 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_2 + DO_OUTPUT_INT + } } void Update_Chan_Algo3_Int(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 3 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 3 len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_3 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_3 + DO_OUTPUT_INT + } } void Update_Chan_Algo4_Int(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 4 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 4 len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_4 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_4 + DO_OUTPUT_INT + } } void Update_Chan_Algo5_Int(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 5 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 5 len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_5 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_5 + DO_OUTPUT_INT + } } void Update_Chan_Algo6_Int(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 6 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 6 len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_6 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_6 + DO_OUTPUT_INT + } } void Update_Chan_Algo7_Int(channel_ *CH, int **buf, int lenght) { - int i; + int i; - if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 7 len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 7 len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE - GET_CURRENT_ENV - UPDATE_ENV - DO_ALGO_7 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE + GET_CURRENT_ENV + UPDATE_ENV + DO_ALGO_7 + DO_OUTPUT_INT + } } void Update_Chan_Algo0_LFO_Int(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 0 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 0 LFO len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_0 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_0 + DO_OUTPUT_INT + } } void Update_Chan_Algo1_LFO_Int(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 1 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 1 LFO len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_1 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_1 + DO_OUTPUT_INT + } } void Update_Chan_Algo2_LFO_Int(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 2 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 2 LFO len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_2 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_2 + DO_OUTPUT_INT + } } void Update_Chan_Algo3_LFO_Int(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if (CH->SLOT[S3].Ecnt == ENV_END) return; + if (CH->SLOT[S3].Ecnt == ENV_END) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 3 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 3 LFO len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_3 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_3 + DO_OUTPUT_INT + } } void Update_Chan_Algo4_LFO_Int(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 4 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 4 LFO len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_4 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_4 + DO_OUTPUT_INT + } } void Update_Chan_Algo5_LFO_Int(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 5 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 5 LFO len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_5 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_5 + DO_OUTPUT_INT + } } void Update_Chan_Algo6_LFO_Int(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 6 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 6 LFO len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_6 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_6 + DO_OUTPUT_INT + } } void Update_Chan_Algo7_LFO_Int(channel_ *CH, int **buf, int lenght) { - int i, env_LFO, freq_LFO; + int i, env_LFO, freq_LFO; - if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; + if ((CH->SLOT[S0].Ecnt == ENV_END) && (CH->SLOT[S1].Ecnt == ENV_END) && (CH->SLOT[S2].Ecnt == ENV_END) && (CH->SLOT[S3].Ecnt == ENV_END)) return; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nAlgo 7 LFO len = %d\n\n", lenght); + fprintf(debug_file, "\n\nAlgo 7 LFO len = %d\n\n", lenght); #endif - int_cnt = YM2612.Inter_Cnt; + int_cnt = YM2612.Inter_Cnt; - for(i = 0; i < lenght; i++) - { - GET_CURRENT_PHASE - UPDATE_PHASE_LFO - GET_CURRENT_ENV_LFO - UPDATE_ENV - DO_ALGO_7 - DO_OUTPUT_INT - } + for(i = 0; i < lenght; i++) + { + GET_CURRENT_PHASE + UPDATE_PHASE_LFO + GET_CURRENT_ENV_LFO + UPDATE_ENV + DO_ALGO_7 + DO_OUTPUT_INT + } } @@ -1857,570 +1857,570 @@ static long dac_highpass; // Initialisation de l'émulateur YM2612 int YM2612_Init(int Clock, int Rate, int Interpolation) { - int i, j; - double x; + int i, j; + double x; - if ((Rate == 0) || (Clock == 0)) return 1; + if ((Rate == 0) || (Clock == 0)) return 1; - memset(&YM2612, 0, sizeof(YM2612)); + memset(&YM2612, 0, sizeof(YM2612)); #if YM_DEBUG_LEVEL > 0 - if (debug_file == NULL) - { - debug_file = fopen("ym2612.log", "w"); - fprintf(debug_file, "YM2612 logging :\n\n"); - } + if (debug_file == NULL) + { + debug_file = fopen("ym2612.log", "w"); + fprintf(debug_file, "YM2612 logging :\n\n"); + } #endif - YM2612.Clock = Clock; - YM2612.Rate = Rate; + YM2612.Clock = Clock; + YM2612.Rate = Rate; - // 144 = 12 * (prescale * 2) = 12 * 6 * 2 - // prescale set to 6 by default + // 144 = 12 * (prescale * 2) = 12 * 6 * 2 + // prescale set to 6 by default - YM2612.Frequence = ((double) YM2612.Clock / (double) YM2612.Rate) / 144.0; - YM2612.TimerBase = (int) (YM2612.Frequence * 4096.0); + YM2612.Frequence = ((double) YM2612.Clock / (double) YM2612.Rate) / 144.0; + YM2612.TimerBase = (int) (YM2612.Frequence * 4096.0); - if ((Interpolation) && (YM2612.Frequence > 1.0)) - { - YM2612.Inter_Step = (unsigned int) ((1.0 / YM2612.Frequence) * (double) (0x4000)); - YM2612.Inter_Cnt = 0; + if ((Interpolation) && (YM2612.Frequence > 1.0)) + { + YM2612.Inter_Step = (unsigned int) ((1.0 / YM2612.Frequence) * (double) (0x4000)); + YM2612.Inter_Cnt = 0; - // We recalculate rate and frequence after interpolation - - YM2612.Rate = YM2612.Clock / 144; - YM2612.Frequence = 1.0; - } - else - { - YM2612.Inter_Step = 0x4000; - YM2612.Inter_Cnt = 0; - } + // We recalculate rate and frequence after interpolation + + YM2612.Rate = YM2612.Clock / 144; + YM2612.Frequence = 1.0; + } + else + { + YM2612.Inter_Step = 0x4000; + YM2612.Inter_Cnt = 0; + } #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "YM2612 frequence = %g rate = %d interp step = %.8X\n\n", YM2612.Frequence, YM2612.Rate, YM2612.Inter_Step); + fprintf(debug_file, "YM2612 frequence = %g rate = %d interp step = %.8X\n\n", YM2612.Frequence, YM2612.Rate, YM2612.Inter_Step); #endif - // Tableau TL : - // [0 - 4095] = +output [4095 - ...] = +output overflow (fill with 0) - // [12288 - 16383] = -output [16384 - ...] = -output overflow (fill with 0) + // Tableau TL : + // [0 - 4095] = +output [4095 - ...] = +output overflow (fill with 0) + // [12288 - 16383] = -output [16384 - ...] = -output overflow (fill with 0) - for(i = 0; i < TL_LENGHT; i++) - { - if (i >= PG_CUT_OFF) // YM2612 cut off sound after 78 dB (14 bits output ?) - { - TL_TAB[TL_LENGHT + i] = TL_TAB[i] = 0; - } - else - { - x = MAX_OUT; // Max output - x /= pow(10, (ENV_STEP * i) / 20); // Decibel -> Voltage + for(i = 0; i < TL_LENGHT; i++) + { + if (i >= PG_CUT_OFF) // YM2612 cut off sound after 78 dB (14 bits output ?) + { + TL_TAB[TL_LENGHT + i] = TL_TAB[i] = 0; + } + else + { + x = MAX_OUT; // Max output + x /= pow(10, (ENV_STEP * i) / 20); // Decibel -> Voltage - TL_TAB[i] = (int) x; - TL_TAB[TL_LENGHT + i] = -TL_TAB[i]; - } + TL_TAB[i] = (int) x; + TL_TAB[TL_LENGHT + i] = -TL_TAB[i]; + } #if YM_DEBUG_LEVEL > 2 - fprintf(debug_file, "TL_TAB[%d] = %.8X TL_TAB[%d] = %.8X\n", i, TL_TAB[i], TL_LENGHT + i, TL_TAB[TL_LENGHT + i]); + fprintf(debug_file, "TL_TAB[%d] = %.8X TL_TAB[%d] = %.8X\n", i, TL_TAB[i], TL_LENGHT + i, TL_TAB[TL_LENGHT + i]); #endif - } - + } + #if YM_DEBUG_LEVEL > 2 - fprintf(debug_file, "\n\n\n\n"); + fprintf(debug_file, "\n\n\n\n"); #endif - // Tableau SIN : - // SIN_TAB[x][y] = sin(x) * y; - // x = phase and y = volume + // Tableau SIN : + // SIN_TAB[x][y] = sin(x) * y; + // x = phase and y = volume - SIN_TAB[0] = SIN_TAB[SIN_LENGHT / 2] = &TL_TAB[(int)PG_CUT_OFF]; + SIN_TAB[0] = SIN_TAB[SIN_LENGHT / 2] = &TL_TAB[(int)PG_CUT_OFF]; - for(i = 1; i <= SIN_LENGHT / 4; i++) - { - x = sin(2.0 * PI * (double) (i) / (double) (SIN_LENGHT)); // Sinus - x = 20 * log10(1 / x); // convert to dB + for(i = 1; i <= SIN_LENGHT / 4; i++) + { + x = sin(2.0 * PI * (double) (i) / (double) (SIN_LENGHT)); // Sinus + x = 20 * log10(1 / x); // convert to dB - j = (int) (x / ENV_STEP); // Get TL range + j = (int) (x / ENV_STEP); // Get TL range - if (j > PG_CUT_OFF) j = (int) PG_CUT_OFF; + if (j > PG_CUT_OFF) j = (int) PG_CUT_OFF; - SIN_TAB[i] = SIN_TAB[(SIN_LENGHT / 2) - i] = &TL_TAB[j]; - SIN_TAB[(SIN_LENGHT / 2) + i] = SIN_TAB[SIN_LENGHT - i] = &TL_TAB[TL_LENGHT + j]; + SIN_TAB[i] = SIN_TAB[(SIN_LENGHT / 2) - i] = &TL_TAB[j]; + SIN_TAB[(SIN_LENGHT / 2) + i] = SIN_TAB[SIN_LENGHT - i] = &TL_TAB[TL_LENGHT + j]; #if YM_DEBUG_LEVEL > 2 - fprintf(debug_file, "SIN[%d][0] = %.8X SIN[%d][0] = %.8X SIN[%d][0] = %.8X SIN[%d][0] = %.8X\n", i, SIN_TAB[i][0], (SIN_LENGHT / 2) - i, SIN_TAB[(SIN_LENGHT / 2) - i][0], (SIN_LENGHT / 2) + i, SIN_TAB[(SIN_LENGHT / 2) + i][0], SIN_LENGHT - i, SIN_TAB[SIN_LENGHT - i][0]); + fprintf(debug_file, "SIN[%d][0] = %.8X SIN[%d][0] = %.8X SIN[%d][0] = %.8X SIN[%d][0] = %.8X\n", i, SIN_TAB[i][0], (SIN_LENGHT / 2) - i, SIN_TAB[(SIN_LENGHT / 2) - i][0], (SIN_LENGHT / 2) + i, SIN_TAB[(SIN_LENGHT / 2) + i][0], SIN_LENGHT - i, SIN_TAB[SIN_LENGHT - i][0]); #endif - } + } #if YM_DEBUG_LEVEL > 2 - fprintf(debug_file, "\n\n\n\n"); + fprintf(debug_file, "\n\n\n\n"); #endif - // Tableau LFO (LFO wav) : + // Tableau LFO (LFO wav) : - for(i = 0; i < LFO_LENGHT; i++) - { - x = sin(2.0 * PI * (double) (i) / (double) (LFO_LENGHT)); // Sinus - x += 1.0; - x /= 2.0; // positive only - x *= 11.8 / ENV_STEP; // ajusted to MAX enveloppe modulation + for(i = 0; i < LFO_LENGHT; i++) + { + x = sin(2.0 * PI * (double) (i) / (double) (LFO_LENGHT)); // Sinus + x += 1.0; + x /= 2.0; // positive only + x *= 11.8 / ENV_STEP; // ajusted to MAX enveloppe modulation - LFO_ENV_TAB[i] = (int) x; + LFO_ENV_TAB[i] = (int) x; - x = sin(2.0 * PI * (double) (i) / (double) (LFO_LENGHT)); // Sinus - x *= (double) ((1 << (LFO_HBITS - 1)) - 1); + x = sin(2.0 * PI * (double) (i) / (double) (LFO_LENGHT)); // Sinus + x *= (double) ((1 << (LFO_HBITS - 1)) - 1); - LFO_FREQ_TAB[i] = (int) x; + LFO_FREQ_TAB[i] = (int) x; #if YM_DEBUG_LEVEL > 2 - fprintf(debug_file, "LFO[%d] = %.8X\n", i, LFO_ENV_TAB[i]); + fprintf(debug_file, "LFO[%d] = %.8X\n", i, LFO_ENV_TAB[i]); #endif - } + } #if YM_DEBUG_LEVEL > 2 - fprintf(debug_file, "\n\n\n\n"); + fprintf(debug_file, "\n\n\n\n"); #endif - // Tableau Enveloppe : - // ENV_TAB[0] -> ENV_TAB[ENV_LENGHT - 1] = attack curve - // ENV_TAB[ENV_LENGHT] -> ENV_TAB[2 * ENV_LENGHT - 1] = decay curve + // Tableau Enveloppe : + // ENV_TAB[0] -> ENV_TAB[ENV_LENGHT - 1] = attack curve + // ENV_TAB[ENV_LENGHT] -> ENV_TAB[2 * ENV_LENGHT - 1] = decay curve - for(i = 0; i < ENV_LENGHT; i++) - { - // Attack curve (x^8 - music level 2 Vectorman 2) - x = pow(((double) ((ENV_LENGHT - 1) - i) / (double) (ENV_LENGHT)), 8); - x *= ENV_LENGHT; + for(i = 0; i < ENV_LENGHT; i++) + { + // Attack curve (x^8 - music level 2 Vectorman 2) + x = pow(((double) ((ENV_LENGHT - 1) - i) / (double) (ENV_LENGHT)), 8); + x *= ENV_LENGHT; - ENV_TAB[i] = (int) x; + ENV_TAB[i] = (int) x; - // Decay curve (just linear) - x = pow(((double) (i) / (double) (ENV_LENGHT)), 1); - x *= ENV_LENGHT; + // Decay curve (just linear) + x = pow(((double) (i) / (double) (ENV_LENGHT)), 1); + x *= ENV_LENGHT; - ENV_TAB[ENV_LENGHT + i] = (int) x; + ENV_TAB[ENV_LENGHT + i] = (int) x; #if YM_DEBUG_LEVEL > 2 - fprintf(debug_file, "ATTACK[%d] = %d DECAY[%d] = %d\n", i, ENV_TAB[i], i, ENV_TAB[ENV_LENGHT + i]); + fprintf(debug_file, "ATTACK[%d] = %d DECAY[%d] = %d\n", i, ENV_TAB[i], i, ENV_TAB[ENV_LENGHT + i]); #endif - } + } - ENV_TAB[ENV_END >> ENV_LBITS] = ENV_LENGHT - 1; // for the stopped state + ENV_TAB[ENV_END >> ENV_LBITS] = ENV_LENGHT - 1; // for the stopped state - // Tableau pour la conversion Attack -> Decay and Decay -> Attack - - for(i = 0, j = ENV_LENGHT - 1; i < ENV_LENGHT; i++) - { - while (j && (ENV_TAB[j] < (unsigned) i)) j--; + // Tableau pour la conversion Attack -> Decay and Decay -> Attack + + for(i = 0, j = ENV_LENGHT - 1; i < ENV_LENGHT; i++) + { + while (j && (ENV_TAB[j] < (unsigned) i)) j--; - DECAY_TO_ATTACK[i] = j << ENV_LBITS; - } + DECAY_TO_ATTACK[i] = j << ENV_LBITS; + } - // Tableau pour le Substain Level - - for(i = 0; i < 15; i++) - { - x = i * 3; // 3 and not 6 (Mickey Mania first music for test) - x /= ENV_STEP; + // Tableau pour le Substain Level + + for(i = 0; i < 15; i++) + { + x = i * 3; // 3 and not 6 (Mickey Mania first music for test) + x /= ENV_STEP; - j = (int) x; - j <<= ENV_LBITS; + j = (int) x; + j <<= ENV_LBITS; - SL_TAB[i] = j + ENV_DECAY; - } + SL_TAB[i] = j + ENV_DECAY; + } - j = ENV_LENGHT - 1; // special case : volume off - j <<= ENV_LBITS; - SL_TAB[15] = j + ENV_DECAY; + j = ENV_LENGHT - 1; // special case : volume off + j <<= ENV_LBITS; + SL_TAB[15] = j + ENV_DECAY; - // Tableau Frequency Step + // Tableau Frequency Step - for(i = 0; i < 2048; i++) - { - x = (double) (i) * YM2612.Frequence; + for(i = 0; i < 2048; i++) + { + x = (double) (i) * YM2612.Frequence; #if ((SIN_LBITS + SIN_HBITS - (21 - 7)) < 0) - x /= (double) (1 << ((21 - 7) - SIN_LBITS - SIN_HBITS)); + x /= (double) (1 << ((21 - 7) - SIN_LBITS - SIN_HBITS)); #else - x *= (double) (1 << (SIN_LBITS + SIN_HBITS - (21 - 7))); + x *= (double) (1 << (SIN_LBITS + SIN_HBITS - (21 - 7))); #endif - x /= 2.0; // because MUL = value * 2 + x /= 2.0; // because MUL = value * 2 - FINC_TAB[i] = (unsigned int) x; - } + FINC_TAB[i] = (unsigned int) x; + } - // Tableaux Attack & Decay Rate + // Tableaux Attack & Decay Rate - for(i = 0; i < 4; i++) - { - AR_TAB[i] = 0; - DR_TAB[i] = 0; - } + for(i = 0; i < 4; i++) + { + AR_TAB[i] = 0; + DR_TAB[i] = 0; + } - for(i = 0; i < 60; i++) - { - x = YM2612.Frequence; + for(i = 0; i < 60; i++) + { + x = YM2612.Frequence; - x *= 1.0 + ((i & 3) * 0.25); // bits 0-1 : x1.00, x1.25, x1.50, x1.75 - x *= (double) (1 << ((i >> 2))); // bits 2-5 : shift bits (x2^0 - x2^15) - x *= (double) (ENV_LENGHT << ENV_LBITS); // on ajuste pour le tableau ENV_TAB + x *= 1.0 + ((i & 3) * 0.25); // bits 0-1 : x1.00, x1.25, x1.50, x1.75 + x *= (double) (1 << ((i >> 2))); // bits 2-5 : shift bits (x2^0 - x2^15) + x *= (double) (ENV_LENGHT << ENV_LBITS); // on ajuste pour le tableau ENV_TAB - AR_TAB[i + 4] = (unsigned int) (x / AR_RATE); - DR_TAB[i + 4] = (unsigned int) (x / DR_RATE); - } + AR_TAB[i + 4] = (unsigned int) (x / AR_RATE); + DR_TAB[i + 4] = (unsigned int) (x / DR_RATE); + } - for(i = 64; i < 96; i++) - { - AR_TAB[i] = AR_TAB[63]; - DR_TAB[i] = DR_TAB[63]; + for(i = 64; i < 96; i++) + { + AR_TAB[i] = AR_TAB[63]; + DR_TAB[i] = DR_TAB[63]; - NULL_RATE[i - 64] = 0; - } + NULL_RATE[i - 64] = 0; + } - // Tableau Detune + // Tableau Detune - for(i = 0; i < 4; i++) - { - for (j = 0; j < 32; j++) - { + for(i = 0; i < 4; i++) + { + for (j = 0; j < 32; j++) + { #if ((SIN_LBITS + SIN_HBITS - 21) < 0) - x = (double) DT_DEF_TAB[(i << 5) + j] * YM2612.Frequence / (double) (1 << (21 - SIN_LBITS - SIN_HBITS)); + x = (double) DT_DEF_TAB[(i << 5) + j] * YM2612.Frequence / (double) (1 << (21 - SIN_LBITS - SIN_HBITS)); #else - x = (double) DT_DEF_TAB[(i << 5) + j] * YM2612.Frequence * (double) (1 << (SIN_LBITS + SIN_HBITS - 21)); + x = (double) DT_DEF_TAB[(i << 5) + j] * YM2612.Frequence * (double) (1 << (SIN_LBITS + SIN_HBITS - 21)); #endif - DT_TAB[i + 0][j] = (int) x; - DT_TAB[i + 4][j] = (int) -x; - } - } + DT_TAB[i + 0][j] = (int) x; + DT_TAB[i + 4][j] = (int) -x; + } + } - // Tableau LFO + // Tableau LFO - j = (YM2612.Rate * YM2612.Inter_Step) / 0x4000; + j = (YM2612.Rate * YM2612.Inter_Step) / 0x4000; - LFO_INC_TAB[0] = (unsigned int) (3.98 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); - LFO_INC_TAB[1] = (unsigned int) (5.56 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); - LFO_INC_TAB[2] = (unsigned int) (6.02 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); - LFO_INC_TAB[3] = (unsigned int) (6.37 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); - LFO_INC_TAB[4] = (unsigned int) (6.88 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); - LFO_INC_TAB[5] = (unsigned int) (9.63 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); - LFO_INC_TAB[6] = (unsigned int) (48.1 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); - LFO_INC_TAB[7] = (unsigned int) (72.2 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); + LFO_INC_TAB[0] = (unsigned int) (3.98 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); + LFO_INC_TAB[1] = (unsigned int) (5.56 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); + LFO_INC_TAB[2] = (unsigned int) (6.02 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); + LFO_INC_TAB[3] = (unsigned int) (6.37 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); + LFO_INC_TAB[4] = (unsigned int) (6.88 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); + LFO_INC_TAB[5] = (unsigned int) (9.63 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); + LFO_INC_TAB[6] = (unsigned int) (48.1 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); + LFO_INC_TAB[7] = (unsigned int) (72.2 * (double) (1 << (LFO_HBITS + LFO_LBITS)) / j); - YM2612_Reset(); + YM2612_Reset(); - return 0; + return 0; } int YM2612_Reset(void) { - int i, j; + int i, j; - YM2612.LFOcnt = 0; - YM2612.TimerA = 0; - YM2612.TimerAL = 0; - YM2612.TimerAcnt = 0; - YM2612.TimerB = 0; - YM2612.TimerBL = 0; - YM2612.TimerBcnt = 0; - YM2612.DAC = 0; - YM2612.DACdata = 0; - dac_highpass = 0; + YM2612.LFOcnt = 0; + YM2612.TimerA = 0; + YM2612.TimerAL = 0; + YM2612.TimerAcnt = 0; + YM2612.TimerB = 0; + YM2612.TimerBL = 0; + YM2612.TimerBcnt = 0; + YM2612.DAC = 0; + YM2612.DACdata = 0; + dac_highpass = 0; - YM2612.Status = 0; + YM2612.Status = 0; - YM2612.OPNAadr = 0; - YM2612.OPNBadr = 0; - YM2612.Inter_Cnt = 0; + YM2612.OPNAadr = 0; + YM2612.OPNBadr = 0; + YM2612.Inter_Cnt = 0; - for(i = 0; i < 6; i++) - { - YM2612.CHANNEL[i].Old_OUTd = 0; - YM2612.CHANNEL[i].OUTd = 0; - YM2612.CHANNEL[i].LEFT = 0xFFFFFFFF; - YM2612.CHANNEL[i].RIGHT = 0xFFFFFFFF; - YM2612.CHANNEL[i].ALGO = 0;; - YM2612.CHANNEL[i].FB = 31; - YM2612.CHANNEL[i].FMS = 0; - YM2612.CHANNEL[i].AMS = 0; + for(i = 0; i < 6; i++) + { + YM2612.CHANNEL[i].Old_OUTd = 0; + YM2612.CHANNEL[i].OUTd = 0; + YM2612.CHANNEL[i].LEFT = 0xFFFFFFFF; + YM2612.CHANNEL[i].RIGHT = 0xFFFFFFFF; + YM2612.CHANNEL[i].ALGO = 0;; + YM2612.CHANNEL[i].FB = 31; + YM2612.CHANNEL[i].FMS = 0; + YM2612.CHANNEL[i].AMS = 0; - for(j = 0 ;j < 4 ; j++) - { - YM2612.CHANNEL[i].S0_OUT[j] = 0; - YM2612.CHANNEL[i].FNUM[j] = 0; - YM2612.CHANNEL[i].FOCT[j] = 0; - YM2612.CHANNEL[i].KC[j] = 0; + for(j = 0 ;j < 4 ; j++) + { + YM2612.CHANNEL[i].S0_OUT[j] = 0; + YM2612.CHANNEL[i].FNUM[j] = 0; + YM2612.CHANNEL[i].FOCT[j] = 0; + YM2612.CHANNEL[i].KC[j] = 0; - YM2612.CHANNEL[i].SLOT[j].Fcnt = 0; - YM2612.CHANNEL[i].SLOT[j].Finc = 0; - YM2612.CHANNEL[i].SLOT[j].Ecnt = ENV_END; // Put it at the end of Decay phase... - YM2612.CHANNEL[i].SLOT[j].Einc = 0; - YM2612.CHANNEL[i].SLOT[j].Ecmp = 0; - YM2612.CHANNEL[i].SLOT[j].Ecurp = RELEASE; + YM2612.CHANNEL[i].SLOT[j].Fcnt = 0; + YM2612.CHANNEL[i].SLOT[j].Finc = 0; + YM2612.CHANNEL[i].SLOT[j].Ecnt = ENV_END; // Put it at the end of Decay phase... + YM2612.CHANNEL[i].SLOT[j].Einc = 0; + YM2612.CHANNEL[i].SLOT[j].Ecmp = 0; + YM2612.CHANNEL[i].SLOT[j].Ecurp = RELEASE; - YM2612.CHANNEL[i].SLOT[j].ChgEnM = 0; - } - } + YM2612.CHANNEL[i].SLOT[j].ChgEnM = 0; + } + } - for(i = 0; i < 0x100; i++) - { - YM2612.REG[0][i] = -1; - YM2612.REG[1][i] = -1; - } + for(i = 0; i < 0x100; i++) + { + YM2612.REG[0][i] = -1; + YM2612.REG[1][i] = -1; + } - for(i = 0xB6; i >= 0xB4; i--) - { - YM2612_Write(0, (unsigned char) i); - YM2612_Write(2, (unsigned char) i); - YM2612_Write(1, 0xC0); - YM2612_Write(3, 0xC0); - } + for(i = 0xB6; i >= 0xB4; i--) + { + YM2612_Write(0, (unsigned char) i); + YM2612_Write(2, (unsigned char) i); + YM2612_Write(1, 0xC0); + YM2612_Write(3, 0xC0); + } - for(i = 0xB2; i >= 0x22; i--) - { - YM2612_Write(0, (unsigned char) i); - YM2612_Write(2, (unsigned char) i); - YM2612_Write(1, 0); - YM2612_Write(3, 0); - } + for(i = 0xB2; i >= 0x22; i--) + { + YM2612_Write(0, (unsigned char) i); + YM2612_Write(2, (unsigned char) i); + YM2612_Write(1, 0); + YM2612_Write(3, 0); + } - YM2612_Write(0, 0x2A); - YM2612_Write(1, 0x80); + YM2612_Write(0, 0x2A); + YM2612_Write(1, 0x80); #if YM_DEBUG_LEVEL > 0 - fprintf(debug_file, "\n\nFinishing reseting YM2612 ...\n\n"); + fprintf(debug_file, "\n\nFinishing reseting YM2612 ...\n\n"); #endif - return 0; + return 0; } int YM2612_Read(void) { -/* static int cnt = 0; +/* static int cnt = 0; - if (cnt++ == 50) - { - cnt = 0; - return YM2612.Status; - } - else return YM2612.Status | 0x80; + if (cnt++ == 50) + { + cnt = 0; + return YM2612.Status; + } + else return YM2612.Status | 0x80; */ - return YM2612.Status; + return YM2612.Status; } int YM2612_Write(unsigned char adr, unsigned char data) { - int d; - - //data &= 0xFF; + int d; + + //data &= 0xFF; adr &= 0x03; - - switch(adr) - { - case 0: - YM2612.OPNAadr = data; - break; + + switch(adr) + { + case 0: + YM2612.OPNAadr = data; + break; - case 1: - // Trivial optimisation - if (YM2612.OPNAadr == 0x2A) - { - YM2612.DACdata = ((int) data - 0x80) << 7; - YM2612.REG[0][0x2A] = data; - return 0; - } + case 1: + // Trivial optimisation + if (YM2612.OPNAadr == 0x2A) + { + YM2612.DACdata = ((int) data - 0x80) << 7; + YM2612.REG[0][0x2A] = data; + return 0; + } - d = YM2612.OPNAadr & 0xF0; + d = YM2612.OPNAadr & 0xF0; - if (d >= 0x30) - { - if (YM2612.REG[0][YM2612.OPNAadr] == data) return 2; - YM2612.REG[0][YM2612.OPNAadr] = data; + if (d >= 0x30) + { + if (YM2612.REG[0][YM2612.OPNAadr] == data) return 2; + YM2612.REG[0][YM2612.OPNAadr] = data; - if (d < 0xA0) // SLOT - { - SLOT_SET(YM2612.OPNAadr, data); - } - else // CHANNEL - { - CHANNEL_SET(YM2612.OPNAadr, data); - } - } - else // YM2612 - { - YM2612.REG[0][YM2612.OPNAadr] = data; - YM_SET(YM2612.OPNAadr, data); - } - break; + if (d < 0xA0) // SLOT + { + SLOT_SET(YM2612.OPNAadr, data); + } + else // CHANNEL + { + CHANNEL_SET(YM2612.OPNAadr, data); + } + } + else // YM2612 + { + YM2612.REG[0][YM2612.OPNAadr] = data; + YM_SET(YM2612.OPNAadr, data); + } + break; - case 2: - YM2612.OPNBadr = data; - break; + case 2: + YM2612.OPNBadr = data; + break; - case 3: - d = YM2612.OPNBadr & 0xF0; + case 3: + d = YM2612.OPNBadr & 0xF0; - if (d >= 0x30) - { - if (YM2612.REG[1][YM2612.OPNBadr] == data) return 2; - YM2612.REG[1][YM2612.OPNBadr] = data; + if (d >= 0x30) + { + if (YM2612.REG[1][YM2612.OPNBadr] == data) return 2; + YM2612.REG[1][YM2612.OPNBadr] = data; - if (d < 0xA0) // SLOT - { - SLOT_SET(YM2612.OPNBadr + 0x100, data); - } - else // CHANNEL - { - CHANNEL_SET(YM2612.OPNBadr + 0x100, data); - } - } - else return 1; - break; - } + if (d < 0xA0) // SLOT + { + SLOT_SET(YM2612.OPNBadr + 0x100, data); + } + else // CHANNEL + { + CHANNEL_SET(YM2612.OPNBadr + 0x100, data); + } + } + else return 1; + break; + } - return 0; + return 0; } void YM2612_Update(int **buf, int length) { - int i, j, algo_type; + int i, j, algo_type; #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nStarting generating sound...\n\n"); + fprintf(debug_file, "\n\nStarting generating sound...\n\n"); #endif - // Mise à jour des pas des compteurs-fréquences s'ils ont été modifiés + // Mise à jour des pas des compteurs-fréquences s'ils ont été modifiés - if (YM2612.CHANNEL[0].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[0]); - if (YM2612.CHANNEL[1].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[1]); - if (YM2612.CHANNEL[2].SLOT[0].Finc == -1) - { - /*---------------------- - |Mode| Behaviour | - |----|---------------| - | 00 | Normal | - | 01 | Special | - | 10 | Special + CSM | - | 11 | Special | - ---------------------- */ - if (YM2612.Mode & 0xC0) - { - CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S0]), FINC_TAB[YM2612.CHANNEL[2].FNUM[2]] >> (7 - YM2612.CHANNEL[2].FOCT[2]), YM2612.CHANNEL[2].KC[2]); - CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S1]), FINC_TAB[YM2612.CHANNEL[2].FNUM[3]] >> (7 - YM2612.CHANNEL[2].FOCT[3]), YM2612.CHANNEL[2].KC[3]); - CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S2]), FINC_TAB[YM2612.CHANNEL[2].FNUM[1]] >> (7 - YM2612.CHANNEL[2].FOCT[1]), YM2612.CHANNEL[2].KC[1]); - CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S3]), FINC_TAB[YM2612.CHANNEL[2].FNUM[0]] >> (7 - YM2612.CHANNEL[2].FOCT[0]), YM2612.CHANNEL[2].KC[0]); - } - else - { - CALC_FINC_CH(&YM2612.CHANNEL[2]); - } - } - if (YM2612.CHANNEL[3].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[3]); - if (YM2612.CHANNEL[4].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[4]); - if (YM2612.CHANNEL[5].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[5]); + if (YM2612.CHANNEL[0].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[0]); + if (YM2612.CHANNEL[1].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[1]); + if (YM2612.CHANNEL[2].SLOT[0].Finc == -1) + { + /*---------------------- + |Mode| Behaviour | + |----|---------------| + | 00 | Normal | + | 01 | Special | + | 10 | Special + CSM | + | 11 | Special | + ---------------------- */ + if (YM2612.Mode & 0xC0) + { + CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S0]), FINC_TAB[YM2612.CHANNEL[2].FNUM[2]] >> (7 - YM2612.CHANNEL[2].FOCT[2]), YM2612.CHANNEL[2].KC[2]); + CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S1]), FINC_TAB[YM2612.CHANNEL[2].FNUM[3]] >> (7 - YM2612.CHANNEL[2].FOCT[3]), YM2612.CHANNEL[2].KC[3]); + CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S2]), FINC_TAB[YM2612.CHANNEL[2].FNUM[1]] >> (7 - YM2612.CHANNEL[2].FOCT[1]), YM2612.CHANNEL[2].KC[1]); + CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[S3]), FINC_TAB[YM2612.CHANNEL[2].FNUM[0]] >> (7 - YM2612.CHANNEL[2].FOCT[0]), YM2612.CHANNEL[2].KC[0]); + } + else + { + CALC_FINC_CH(&YM2612.CHANNEL[2]); + } + } + if (YM2612.CHANNEL[3].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[3]); + if (YM2612.CHANNEL[4].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[4]); + if (YM2612.CHANNEL[5].SLOT[0].Finc == -1) CALC_FINC_CH(&YM2612.CHANNEL[5]); /* - CALC_FINC_CH(&YM2612.CHANNEL[0]); - CALC_FINC_CH(&YM2612.CHANNEL[1]); - if (YM2612.Mode & 0x40) - { - CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[0]), FINC_TAB[YM2612.CHANNEL[2].FNUM[2]] >> (7 - YM2612.CHANNEL[2].FOCT[2]), YM2612.CHANNEL[2].KC[2]); - CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[1]), FINC_TAB[YM2612.CHANNEL[2].FNUM[3]] >> (7 - YM2612.CHANNEL[2].FOCT[3]), YM2612.CHANNEL[2].KC[3]); - CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[2]), FINC_TAB[YM2612.CHANNEL[2].FNUM[1]] >> (7 - YM2612.CHANNEL[2].FOCT[1]), YM2612.CHANNEL[2].KC[1]); - CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[3]), FINC_TAB[YM2612.CHANNEL[2].FNUM[0]] >> (7 - YM2612.CHANNEL[2].FOCT[0]), YM2612.CHANNEL[2].KC[0]); - } - else - { - CALC_FINC_CH(&YM2612.CHANNEL[2]); - } - CALC_FINC_CH(&YM2612.CHANNEL[3]); - CALC_FINC_CH(&YM2612.CHANNEL[4]); - CALC_FINC_CH(&YM2612.CHANNEL[5]); + CALC_FINC_CH(&YM2612.CHANNEL[0]); + CALC_FINC_CH(&YM2612.CHANNEL[1]); + if (YM2612.Mode & 0x40) + { + CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[0]), FINC_TAB[YM2612.CHANNEL[2].FNUM[2]] >> (7 - YM2612.CHANNEL[2].FOCT[2]), YM2612.CHANNEL[2].KC[2]); + CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[1]), FINC_TAB[YM2612.CHANNEL[2].FNUM[3]] >> (7 - YM2612.CHANNEL[2].FOCT[3]), YM2612.CHANNEL[2].KC[3]); + CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[2]), FINC_TAB[YM2612.CHANNEL[2].FNUM[1]] >> (7 - YM2612.CHANNEL[2].FOCT[1]), YM2612.CHANNEL[2].KC[1]); + CALC_FINC_SL(&(YM2612.CHANNEL[2].SLOT[3]), FINC_TAB[YM2612.CHANNEL[2].FNUM[0]] >> (7 - YM2612.CHANNEL[2].FOCT[0]), YM2612.CHANNEL[2].KC[0]); + } + else + { + CALC_FINC_CH(&YM2612.CHANNEL[2]); + } + CALC_FINC_CH(&YM2612.CHANNEL[3]); + CALC_FINC_CH(&YM2612.CHANNEL[4]); + CALC_FINC_CH(&YM2612.CHANNEL[5]); */ - if (YM2612.Inter_Step & 0x04000) algo_type = 0; - else algo_type = 16; + if (YM2612.Inter_Step & 0x04000) algo_type = 0; + else algo_type = 16; - if (YM2612.LFOinc) - { - // Precalcul LFO wav - - for(i = 0; i < length; i++) - { - j = ((YM2612.LFOcnt += YM2612.LFOinc) >> LFO_LBITS) & LFO_MASK; + if (YM2612.LFOinc) + { + // Precalcul LFO wav + + for(i = 0; i < length; i++) + { + j = ((YM2612.LFOcnt += YM2612.LFOinc) >> LFO_LBITS) & LFO_MASK; - LFO_ENV_UP[i] = LFO_ENV_TAB[j]; - LFO_FREQ_UP[i] = LFO_FREQ_TAB[j]; + LFO_ENV_UP[i] = LFO_ENV_TAB[j]; + LFO_FREQ_UP[i] = LFO_FREQ_TAB[j]; #if YM_DEBUG_LEVEL > 3 - fprintf(debug_file, "LFO_ENV_UP[%d] = %d LFO_FREQ_UP[%d] = %d\n", i, LFO_ENV_UP[i], i, LFO_FREQ_UP[i]); + fprintf(debug_file, "LFO_ENV_UP[%d] = %d LFO_FREQ_UP[%d] = %d\n", i, LFO_ENV_UP[i], i, LFO_FREQ_UP[i]); #endif - } + } - algo_type |= 8; - } + algo_type |= 8; + } - UPDATE_CHAN[YM2612.CHANNEL[0].ALGO + algo_type](&(YM2612.CHANNEL[0]), buf, length); - UPDATE_CHAN[YM2612.CHANNEL[1].ALGO + algo_type](&(YM2612.CHANNEL[1]), buf, length); - UPDATE_CHAN[YM2612.CHANNEL[2].ALGO + algo_type](&(YM2612.CHANNEL[2]), buf, length); - UPDATE_CHAN[YM2612.CHANNEL[3].ALGO + algo_type](&(YM2612.CHANNEL[3]), buf, length); - UPDATE_CHAN[YM2612.CHANNEL[4].ALGO + algo_type](&(YM2612.CHANNEL[4]), buf, length); - if (!(YM2612.DAC)) UPDATE_CHAN[YM2612.CHANNEL[5].ALGO + algo_type](&(YM2612.CHANNEL[5]), buf, length); - else - { - for(i = 0; i < length; i++) - { - buf[0][i] += YM2612.DACdata & YM2612.CHANNEL[5].LEFT; - buf[1][i] += YM2612.DACdata & YM2612.CHANNEL[5].RIGHT; - } - } + UPDATE_CHAN[YM2612.CHANNEL[0].ALGO + algo_type](&(YM2612.CHANNEL[0]), buf, length); + UPDATE_CHAN[YM2612.CHANNEL[1].ALGO + algo_type](&(YM2612.CHANNEL[1]), buf, length); + UPDATE_CHAN[YM2612.CHANNEL[2].ALGO + algo_type](&(YM2612.CHANNEL[2]), buf, length); + UPDATE_CHAN[YM2612.CHANNEL[3].ALGO + algo_type](&(YM2612.CHANNEL[3]), buf, length); + UPDATE_CHAN[YM2612.CHANNEL[4].ALGO + algo_type](&(YM2612.CHANNEL[4]), buf, length); + if (!(YM2612.DAC)) UPDATE_CHAN[YM2612.CHANNEL[5].ALGO + algo_type](&(YM2612.CHANNEL[5]), buf, length); + else + { + for(i = 0; i < length; i++) + { + buf[0][i] += YM2612.DACdata & YM2612.CHANNEL[5].LEFT; + buf[1][i] += YM2612.DACdata & YM2612.CHANNEL[5].RIGHT; + } + } - YM2612.Inter_Cnt = int_cnt; + YM2612.Inter_Cnt = int_cnt; - /* update timers here */ - YM2612_Timers_Update(length); + /* update timers here */ + YM2612_Timers_Update(length); #if YM_DEBUG_LEVEL > 1 - fprintf(debug_file, "\n\nFinishing generating sound...\n\n"); + fprintf(debug_file, "\n\nFinishing generating sound...\n\n"); #endif } void YM2612_Timers_Update(int length) { - int i; + int i; - i = YM2612.TimerBase * length; + i = YM2612.TimerBase * length; - if (YM2612.Mode & 1) // Timer A ON ? - { - if ((YM2612.TimerAcnt -= i) <= 0) - { - YM2612.Status |= (YM2612.Mode & 0x04) >> 2; - YM2612.TimerAcnt += YM2612.TimerAL; - /*---------------------- - |Mode| Behaviour | - |----|---------------| - | 00 | Normal | - | 01 | Special | - | 10 | Special + CSM | - | 11 | Special | - ---------------------- */ - if ((YM2612.Mode & 0xC0) == 0x80) CSM_Key_Control(); // found by Nemesis - } - } + if (YM2612.Mode & 1) // Timer A ON ? + { + if ((YM2612.TimerAcnt -= i) <= 0) + { + YM2612.Status |= (YM2612.Mode & 0x04) >> 2; + YM2612.TimerAcnt += YM2612.TimerAL; + /*---------------------- + |Mode| Behaviour | + |----|---------------| + | 00 | Normal | + | 01 | Special | + | 10 | Special + CSM | + | 11 | Special | + ---------------------- */ + if ((YM2612.Mode & 0xC0) == 0x80) CSM_Key_Control(); // found by Nemesis + } + } - if (YM2612.Mode & 2) // Timer B ON ? - { - if ((YM2612.TimerBcnt -= i) <= 0) - { - YM2612.Status |= (YM2612.Mode & 0x08) >> 2; - YM2612.TimerBcnt += YM2612.TimerBL; - } - } + if (YM2612.Mode & 2) // Timer B ON ? + { + if ((YM2612.TimerBcnt -= i) <= 0) + { + YM2612.Status |= (YM2612.Mode & 0x08) >> 2; + YM2612.TimerBcnt += YM2612.TimerBL; + } + } } void YM2612_Special_Update () diff --git a/source/sound/ym2612.h b/source/sound/ym2612.h index 1b8f940..2936433 100644 --- a/source/sound/ym2612.h +++ b/source/sound/ym2612.h @@ -14,93 +14,93 @@ #define _YM2612_H_ // Change it if you need to do long update -#define MAX_UPDATE_LENGHT 2000 +#define MAX_UPDATE_LENGHT 2000 // Gens always uses 16 bits sound (in 32 bits buffer) and do the convertion later if needed. #define OUTPUT_BITS 16 typedef struct slot__ { - int *DT; // paramètre detune - int MUL; // paramètre "multiple de fréquence" - int TL; // Total Level = volume lorsque l'enveloppe est au plus haut - int TLL; // Total Level ajusted - int SLL; // Sustin Level (ajusted) = volume où l'enveloppe termine sa première phase de régression - int KSR_S; // Key Scale Rate Shift = facteur de prise en compte du KSL dans la variations de l'enveloppe - int KSR; // Key Scale Rate = cette valeur est calculée par rapport à la fréquence actuelle, elle va influer - // sur les différents paramètres de l'enveloppe comme l'attaque, le decay ... comme dans la réalité ! - int SEG; // Type enveloppe SSG - int *AR; // Attack Rate (table pointeur) = Taux d'attaque (AR[KSR]) - int *DR; // Decay Rate (table pointeur) = Taux pour la régression (DR[KSR]) - int *SR; // Sustin Rate (table pointeur) = Taux pour le maintien (SR[KSR]) - int *RR; // Release Rate (table pointeur) = Taux pour le relâchement (RR[KSR]) - int Fcnt; // Frequency Count = compteur-fréquence pour déterminer l'amplitude actuelle (SIN[Finc >> 16]) - int Finc; // frequency step = pas d'incrémentation du compteur-fréquence - // plus le pas est grand, plus la fréquence est aïgu (ou haute) - int Ecurp; // Envelope current phase = cette variable permet de savoir dans quelle phase - // de l'enveloppe on se trouve, par exemple phase d'attaque ou phase de maintenue ... - // en fonction de la valeur de cette variable, on va appeler une fonction permettant - // de mettre à jour l'enveloppe courante. - int Ecnt; // Envelope counter = le compteur-enveloppe permet de savoir où l'on se trouve dans l'enveloppe - int Einc; // Envelope step courant - int Ecmp; // Envelope counter limite pour la prochaine phase - int EincA; // Envelope step for Attack = pas d'incrémentation du compteur durant la phase d'attaque - // cette valeur est égal à AR[KSR] - int EincD; // Envelope step for Decay = pas d'incrémentation du compteur durant la phase de regression - // cette valeur est égal à DR[KSR] - int EincS; // Envelope step for Sustain = pas d'incrémentation du compteur durant la phase de maintenue - // cette valeur est égal à SR[KSR] - int EincR; // Envelope step for Release = pas d'incrémentation du compteur durant la phase de relâchement - // cette valeur est égal à RR[KSR] - int *OUTp; // pointeur of SLOT output = pointeur permettant de connecter la sortie de ce slot à l'entrée - // d'un autre ou carrement à la sortie de la voie - int INd; // input data of the slot = données en entrée du slot - int ChgEnM; // Change envelop mask. - int AMS; // AMS depth level of this SLOT = degré de modulation de l'amplitude par le LFO - int AMSon; // AMS enable flag = drapeau d'activation de l'AMS + int *DT; // paramètre detune + int MUL; // paramètre "multiple de fréquence" + int TL; // Total Level = volume lorsque l'enveloppe est au plus haut + int TLL; // Total Level ajusted + int SLL; // Sustin Level (ajusted) = volume où l'enveloppe termine sa première phase de régression + int KSR_S; // Key Scale Rate Shift = facteur de prise en compte du KSL dans la variations de l'enveloppe + int KSR; // Key Scale Rate = cette valeur est calculée par rapport à la fréquence actuelle, elle va influer + // sur les différents paramètres de l'enveloppe comme l'attaque, le decay ... comme dans la réalité ! + int SEG; // Type enveloppe SSG + int *AR; // Attack Rate (table pointeur) = Taux d'attaque (AR[KSR]) + int *DR; // Decay Rate (table pointeur) = Taux pour la régression (DR[KSR]) + int *SR; // Sustin Rate (table pointeur) = Taux pour le maintien (SR[KSR]) + int *RR; // Release Rate (table pointeur) = Taux pour le relâchement (RR[KSR]) + int Fcnt; // Frequency Count = compteur-fréquence pour déterminer l'amplitude actuelle (SIN[Finc >> 16]) + int Finc; // frequency step = pas d'incrémentation du compteur-fréquence + // plus le pas est grand, plus la fréquence est aïgu (ou haute) + int Ecurp; // Envelope current phase = cette variable permet de savoir dans quelle phase + // de l'enveloppe on se trouve, par exemple phase d'attaque ou phase de maintenue ... + // en fonction de la valeur de cette variable, on va appeler une fonction permettant + // de mettre à jour l'enveloppe courante. + int Ecnt; // Envelope counter = le compteur-enveloppe permet de savoir où l'on se trouve dans l'enveloppe + int Einc; // Envelope step courant + int Ecmp; // Envelope counter limite pour la prochaine phase + int EincA; // Envelope step for Attack = pas d'incrémentation du compteur durant la phase d'attaque + // cette valeur est égal à AR[KSR] + int EincD; // Envelope step for Decay = pas d'incrémentation du compteur durant la phase de regression + // cette valeur est égal à DR[KSR] + int EincS; // Envelope step for Sustain = pas d'incrémentation du compteur durant la phase de maintenue + // cette valeur est égal à SR[KSR] + int EincR; // Envelope step for Release = pas d'incrémentation du compteur durant la phase de relâchement + // cette valeur est égal à RR[KSR] + int *OUTp; // pointeur of SLOT output = pointeur permettant de connecter la sortie de ce slot à l'entrée + // d'un autre ou carrement à la sortie de la voie + int INd; // input data of the slot = données en entrée du slot + int ChgEnM; // Change envelop mask. + int AMS; // AMS depth level of this SLOT = degré de modulation de l'amplitude par le LFO + int AMSon; // AMS enable flag = drapeau d'activation de l'AMS } slot_; typedef struct channel__ { - int S0_OUT[4]; // anciennes sorties slot 0 (pour le feed back) - int Old_OUTd; // ancienne sortie de la voie (son brut) - int OUTd; // sortie de la voie (son brut) - int LEFT; // LEFT enable flag - int RIGHT; // RIGHT enable flag - int ALGO; // Algorythm = détermine les connections entre les opérateurs - int FB; // shift count of self feed back = degré de "Feed-Back" du SLOT 1 (il est son unique entrée) - int FMS; // Fréquency Modulation Sensitivity of channel = degré de modulation de la fréquence sur la voie par le LFO - int AMS; // Amplitude Modulation Sensitivity of channel = degré de modulation de l'amplitude sur la voie par le LFO - int FNUM[4]; // hauteur fréquence de la voie (+ 3 pour le mode spécial) - int FOCT[4]; // octave de la voie (+ 3 pour le mode spécial) - int KC[4]; // Key Code = valeur fonction de la fréquence (voir KSR pour les slots, KSR = KC >> KSR_S) - struct slot__ SLOT[4]; // four slot.operators = les 4 slots de la voie - int FFlag; // Frequency step recalculation flag + int S0_OUT[4]; // anciennes sorties slot 0 (pour le feed back) + int Old_OUTd; // ancienne sortie de la voie (son brut) + int OUTd; // sortie de la voie (son brut) + int LEFT; // LEFT enable flag + int RIGHT; // RIGHT enable flag + int ALGO; // Algorythm = détermine les connections entre les opérateurs + int FB; // shift count of self feed back = degré de "Feed-Back" du SLOT 1 (il est son unique entrée) + int FMS; // Fréquency Modulation Sensitivity of channel = degré de modulation de la fréquence sur la voie par le LFO + int AMS; // Amplitude Modulation Sensitivity of channel = degré de modulation de l'amplitude sur la voie par le LFO + int FNUM[4]; // hauteur fréquence de la voie (+ 3 pour le mode spécial) + int FOCT[4]; // octave de la voie (+ 3 pour le mode spécial) + int KC[4]; // Key Code = valeur fonction de la fréquence (voir KSR pour les slots, KSR = KC >> KSR_S) + struct slot__ SLOT[4]; // four slot.operators = les 4 slots de la voie + int FFlag; // Frequency step recalculation flag } channel_; typedef struct ym2612__ { - int Clock; // Horloge YM2612 - int Rate; // Sample Rate (11025/22050/44100) - int TimerBase; // TimerBase calculation - int Status; // YM2612 Status (timer overflow) - int OPNAadr; // addresse pour l'écriture dans l'OPN A (propre à l'émulateur) - int OPNBadr; // addresse pour l'écriture dans l'OPN B (propre à l'émulateur) - int LFOcnt; // LFO counter = compteur-fréquence pour le LFO - int LFOinc; // LFO step counter = pas d'incrémentation du compteur-fréquence du LFO - // plus le pas est grand, plus la fréquence est grande - int TimerA; // timerA limit = valeur jusqu'à laquelle le timer A doit compter - int TimerAL; - int TimerAcnt; // timerA counter = valeur courante du Timer A - int TimerB; // timerB limit = valeur jusqu'à laquelle le timer B doit compter - int TimerBL; - int TimerBcnt; // timerB counter = valeur courante du Timer B - int Mode; // Mode actuel des voie 3 et 6 (normal / spécial) - int DAC; // DAC enabled flag - int DACdata; // DAC data - double Frequence; // Fréquence de base, se calcul par rapport à l'horlage et au sample rate - unsigned int Inter_Cnt; // Interpolation Counter - unsigned int Inter_Step; // Interpolation Step - struct channel__ CHANNEL[6]; // Les 6 voies du YM2612 - int REG[2][0x100]; // Sauvegardes des valeurs de tout les registres, c'est facultatif - // cela nous rend le débuggage plus facile + int Clock; // Horloge YM2612 + int Rate; // Sample Rate (11025/22050/44100) + int TimerBase; // TimerBase calculation + int Status; // YM2612 Status (timer overflow) + int OPNAadr; // addresse pour l'écriture dans l'OPN A (propre à l'émulateur) + int OPNBadr; // addresse pour l'écriture dans l'OPN B (propre à l'émulateur) + int LFOcnt; // LFO counter = compteur-fréquence pour le LFO + int LFOinc; // LFO step counter = pas d'incrémentation du compteur-fréquence du LFO + // plus le pas est grand, plus la fréquence est grande + int TimerA; // timerA limit = valeur jusqu'à laquelle le timer A doit compter + int TimerAL; + int TimerAcnt; // timerA counter = valeur courante du Timer A + int TimerB; // timerB limit = valeur jusqu'à laquelle le timer B doit compter + int TimerBL; + int TimerBcnt; // timerB counter = valeur courante du Timer B + int Mode; // Mode actuel des voie 3 et 6 (normal / spécial) + int DAC; // DAC enabled flag + int DACdata; // DAC data + double Frequence; // Fréquence de base, se calcul par rapport à l'horlage et au sample rate + unsigned int Inter_Cnt; // Interpolation Counter + unsigned int Inter_Step; // Interpolation Step + struct channel__ CHANNEL[6]; // Les 6 voies du YM2612 + int REG[2][0x100]; // Sauvegardes des valeurs de tout les registres, c'est facultatif + // cela nous rend le débuggage plus facile } ym2612_; diff --git a/source/types.h b/source/types.h index 4d4ff0d..dbf9764 100644 --- a/source/types.h +++ b/source/types.h @@ -21,8 +21,8 @@ #define uint8 unsigned char #define uint16 unsigned short -#define uint32 unsigned int +#define uint32 unsigned int #define int8 signed char #define int16 signed short -#define int32 signed long int +#define int32 signed long int diff --git a/source/unzip.c b/source/unzip.c deleted file mode 100644 index f9bc46a..0000000 --- a/source/unzip.c +++ /dev/null @@ -1,1301 +0,0 @@ -/* unzip.c -- IO on .zip files using zlib - Version 0.15 beta, Mar 19th, 1998, - - Read unzip.h for more info -*/ - - -#include -#include -#include -#include "zlib.h" -#include "unzip.h" - -#ifdef STDC -#include -#include -#include -#endif -#ifdef NO_ERRNO_H -extern int errno; -#else -#include -#endif - - -#ifndef local -#define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - - - -#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \ - !defined(CASESENSITIVITYDEFAULT_NO) -#define CASESENSITIVITYDEFAULT_NO -#endif - - -#ifndef UNZ_BUFSIZE -#define UNZ_BUFSIZE (16384) -#endif - -#ifndef UNZ_MAXFILENAMEINZIP -#define UNZ_MAXFILENAMEINZIP (256) -#endif - -#ifndef ALLOC -# define ALLOC(size) (malloc(size)) -#endif -#ifndef TRYFREE -# define TRYFREE(p) {if (p) free(p);} -#endif - -#define SIZECENTRALDIRITEM (0x2e) -#define SIZEZIPLOCALHEADER (0x1e) - -/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ - -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif - -#ifndef SEEK_END -#define SEEK_END 2 -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - -const char unz_copyright[] = - " unzip 0.15 Copyright 1998 Gilles Vollant "; - -/* unz_file_info_interntal contain internal info about a file in zipfile*/ -typedef struct unz_file_info_internal_s -{ - uLong offset_curfile;/* relative offset of local header 4 bytes */ -} unz_file_info_internal; - - -/* file_in_zip_read_info_s contain internal information about a file in zipfile, - when reading and decompress it */ -typedef struct -{ - char *read_buffer; /* internal buffer for compressed data */ - z_stream stream; /* zLib stream structure for inflate */ - - uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ - uLong stream_initialised; /* flag set if stream structure is initialised*/ - - uLong offset_local_extrafield;/* offset of the local extra field */ - uInt size_local_extrafield;/* size of the local extra field */ - uLong pos_local_extrafield; /* position in the local extra field in read*/ - - uLong crc32; /* crc32 of all data uncompressed */ - uLong crc32_wait; /* crc32 we must obtain after decompress all */ - uLong rest_read_compressed; /* number of byte to be decompressed */ - uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/ - FILE* file; /* io structore of the zipfile */ - uLong compression_method; /* compression method (0==store) */ - uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ -} file_in_zip_read_info_s; - - -/* unz_s contain internal information about the zipfile -*/ -typedef struct -{ - FILE* file; /* io structore of the zipfile */ - unz_global_info gi; /* public global information */ - uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ - uLong num_file; /* number of the current file in the zipfile*/ - uLong pos_in_central_dir; /* pos of the current file in the central dir*/ - uLong current_file_ok; /* flag about the usability of the current file*/ - uLong central_pos; /* position of the beginning of the central dir*/ - - uLong size_central_dir; /* size of the central directory */ - uLong offset_central_dir; /* offset of start of central directory with - respect to the starting disk number */ - - unz_file_info cur_file_info; /* public info about the current file in zip*/ - unz_file_info_internal cur_file_info_internal; /* private info about it*/ - file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current - file if we are decompressing it */ -} unz_s; - - -/* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF - for end of file. - IN assertion: the stream s has been sucessfully opened for reading. -*/ - - -local int unzlocal_getByte(fin,pi) - FILE *fin; - int *pi; -{ - unsigned char c; - int err = fread(&c, 1, 1, fin); - if (err==1) - { - *pi = (int)c; - return UNZ_OK; - } - else - { - if (ferror(fin)) - return UNZ_ERRNO; - else - return UNZ_EOF; - } -} - - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets -*/ -local int unzlocal_getShort (fin,pX) - FILE* fin; - uLong *pX; -{ - uLong x ; - int i = 0; - int err; - - err = unzlocal_getByte(fin,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<8; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - -local int unzlocal_getLong (fin,pX) - FILE* fin; - uLong *pX; -{ - uLong x ; - int i = 0; - int err; - - err = unzlocal_getByte(fin,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<8; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<16; - - if (err==UNZ_OK) - err = unzlocal_getByte(fin,&i); - x += ((uLong)i)<<24; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - - -/* My own strcmpi / strcasecmp */ -local int strcmpcasenosensitive_internal (fileName1,fileName2) - const char* fileName1; - const char* fileName2; -{ - for (;;) - { - char c1=*(fileName1++); - char c2=*(fileName2++); - if ((c1>='a') && (c1<='z')) - c1 -= 0x20; - if ((c2>='a') && (c2<='z')) - c2 -= 0x20; - if (c1=='\0') - return ((c2=='\0') ? 0 : -1); - if (c2=='\0') - return 1; - if (c1c2) - return 1; - } -} - - -#ifdef CASESENSITIVITYDEFAULT_NO -#define CASESENSITIVITYDEFAULTVALUE 2 -#else -#define CASESENSITIVITYDEFAULTVALUE 1 -#endif - -#ifndef STRCMPCASENOSENTIVEFUNCTION -#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal -#endif - -/* - Compare two filename (fileName1,fileName2). - If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) - If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) - If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) - -*/ -extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity) - const char* fileName1; - const char* fileName2; - int iCaseSensitivity; -{ - if (iCaseSensitivity==0) - iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; - - if (iCaseSensitivity==1) - return strcmp(fileName1,fileName2); - - return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); -} - -#define BUFREADCOMMENT (0x400) - -/* - Locate the Central directory of a zipfile (at the end, just before - the global comment) -*/ -local uLong unzlocal_SearchCentralDir(fin) - FILE *fin; -{ - unsigned char* buf; - uLong uSizeFile; - uLong uBackRead; - uLong uMaxBack=0xffff; /* maximum size of global comment */ - uLong uPosFound=0; - - if (fseek(fin,0,SEEK_END) != 0) - return 0; - - - uSizeFile = ftell( fin ); - - if (uMaxBack>uSizeFile) - uMaxBack = uSizeFile; - - buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); - if (buf==NULL) - return 0; - - uBackRead = 4; - while (uBackReaduMaxBack) - uBackRead = uMaxBack; - else - uBackRead+=BUFREADCOMMENT; - uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? - (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); - if (fseek(fin,uReadPos,SEEK_SET)!=0) - break; - - if (fread(buf,(uInt)uReadSize,1,fin)!=1) - break; - - for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && - ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) - { - uPosFound = uReadPos+i; - break; - } - - if (uPosFound!=0) - break; - } - TRYFREE(buf); - return uPosFound; -} - -/* - Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\test\\zlib109.zip" or on an Unix computer - "zlib/zlib109.zip". - If the zipfile cannot be opened (file don't exist or in not valid), the - return value is NULL. - Else, the return value is a unzFile Handle, usable with other function - of this unzip package. -*/ -extern unzFile ZEXPORT unzOpen (path) - const char *path; -{ - unz_s us; - unz_s *s; - uLong central_pos,uL; - FILE * fin ; - - uLong number_disk; /* number of the current dist, used for - spaning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used - for spaning ZIP, unsupported, always 0*/ - uLong number_entry_CD; /* total number of entries in - the central dir - (same than number_entry on nospan) */ - - int err=UNZ_OK; - - if (unz_copyright[0]!=' ') - return NULL; - - fin=fopen(path,"rb"); - if (fin==NULL) - return NULL; - - central_pos = unzlocal_SearchCentralDir(fin); - if (central_pos==0) - err=UNZ_ERRNO; - - if (fseek(fin,central_pos,SEEK_SET)!=0) - err=UNZ_ERRNO; - - /* the signature, already checked */ - if (unzlocal_getLong(fin,&uL)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of this disk */ - if (unzlocal_getShort(fin,&number_disk)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of the disk with the start of the central directory */ - if (unzlocal_getShort(fin,&number_disk_with_CD)!=UNZ_OK) - err=UNZ_ERRNO; - - /* total number of entries in the central dir on this disk */ - if (unzlocal_getShort(fin,&us.gi.number_entry)!=UNZ_OK) - err=UNZ_ERRNO; - - /* total number of entries in the central dir */ - if (unzlocal_getShort(fin,&number_entry_CD)!=UNZ_OK) - err=UNZ_ERRNO; - - if ((number_entry_CD!=us.gi.number_entry) || - (number_disk_with_CD!=0) || - (number_disk!=0)) - err=UNZ_BADZIPFILE; - - /* size of the central directory */ - if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; - - /* offset of start of central directory with respect to the - starting disk number */ - if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; - - /* zipfile comment length */ - if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) - err=UNZ_ERRNO; - - if ((central_pospfile_in_zip_read!=NULL) - unzCloseCurrentFile(file); - - fclose(s->file); - TRYFREE(s); - return UNZ_OK; -} - - -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. */ -extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info) - unzFile file; - unz_global_info *pglobal_info; -{ - unz_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - *pglobal_info=s->gi; - return UNZ_OK; -} - - -/* - Translate date/time from Dos format to tm_unz (readable more easilty) -*/ -local void unzlocal_DosDateToTmuDate (ulDosDate, ptm) - uLong ulDosDate; - tm_unz* ptm; -{ - uLong uDate; - uDate = (uLong)(ulDosDate>>16); - ptm->tm_mday = (uInt)(uDate&0x1f) ; - ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; - ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; - - ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); - ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; - ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; -} - -/* - Get Info about the current file in the zipfile, with internal only info -*/ -local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, - unz_file_info *pfile_info, - unz_file_info_internal - *pfile_info_internal, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); - -local int unzlocal_GetCurrentFileInfoInternal (file, - pfile_info, - pfile_info_internal, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - unz_file_info_internal *pfile_info_internal; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; -{ - unz_s* s; - unz_file_info file_info; - unz_file_info_internal file_info_internal; - int err=UNZ_OK; - uLong uMagic; - long lSeek=0; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (fseek(s->file,s->pos_in_central_dir+s->byte_before_the_zipfile,SEEK_SET)!=0) - err=UNZ_ERRNO; - - - /* we check the magic */ - if (err==UNZ_OK) - { - if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x02014b50) - err=UNZ_BADZIPFILE; - } - - if (unzlocal_getShort(s->file,&file_info.version) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.version_needed) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.flag) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.compression_method) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info.dosDate) != UNZ_OK) - err=UNZ_ERRNO; - - unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); - - if (unzlocal_getLong(s->file,&file_info.crc) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info.compressed_size) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info.uncompressed_size) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.size_filename) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.size_file_extra) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.size_file_comment) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.disk_num_start) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&file_info.internal_fa) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info.external_fa) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&file_info_internal.offset_curfile) != UNZ_OK) - err=UNZ_ERRNO; - - lSeek+=file_info.size_filename; - if ((err==UNZ_OK) && (szFileName!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_filename0) && (fileNameBufferSize>0)) - if (fread(szFileName,(uInt)uSizeRead,1,s->file)!=1) - err=UNZ_ERRNO; - lSeek -= uSizeRead; - } - - - if ((err==UNZ_OK) && (extraField!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_file_extrafile,lSeek,SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - } - if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) - if (fread(extraField,(uInt)uSizeRead,1,s->file)!=1) - err=UNZ_ERRNO; - lSeek += file_info.size_file_extra - uSizeRead; - } - else - lSeek+=file_info.size_file_extra; - - - if ((err==UNZ_OK) && (szComment!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_file_commentfile,lSeek,SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - } - if ((file_info.size_file_comment>0) && (commentBufferSize>0)) - if (fread(szComment,(uInt)uSizeRead,1,s->file)!=1) - err=UNZ_ERRNO; - lSeek+=file_info.size_file_comment - uSizeRead; - } - else - lSeek+=file_info.size_file_comment; - - if ((err==UNZ_OK) && (pfile_info!=NULL)) - *pfile_info=file_info; - - if ((err==UNZ_OK) && (pfile_info_internal!=NULL)) - *pfile_info_internal=file_info_internal; - - return err; -} - - - -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. -*/ -extern int ZEXPORT unzGetCurrentFileInfo (file, - pfile_info, - szFileName, fileNameBufferSize, - extraField, extraFieldBufferSize, - szComment, commentBufferSize) - unzFile file; - unz_file_info *pfile_info; - char *szFileName; - uLong fileNameBufferSize; - void *extraField; - uLong extraFieldBufferSize; - char *szComment; - uLong commentBufferSize; -{ - return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL, - szFileName,fileNameBufferSize, - extraField,extraFieldBufferSize, - szComment,commentBufferSize); -} - -/* - Set the current file of the zipfile to the first file. - return UNZ_OK if there is no problem -*/ -extern int ZEXPORT unzGoToFirstFile (file) - unzFile file; -{ - int err=UNZ_OK; - unz_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - s->pos_in_central_dir=s->offset_central_dir; - s->num_file=0; - err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - - -/* - Set the current file of the zipfile to the next file. - return UNZ_OK if there is no problem - return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. -*/ -extern int ZEXPORT unzGoToNextFile (file) - unzFile file; -{ - unz_s* s; - int err; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - if (s->num_file+1==s->gi.number_entry) - return UNZ_END_OF_LIST_OF_FILE; - - s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + - s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; - s->num_file++; - err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - - -/* - Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzipStringFileNameCompare - - return value : - UNZ_OK if the file is found. It becomes the current file. - UNZ_END_OF_LIST_OF_FILE if the file is not found -*/ -extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) - unzFile file; - const char *szFileName; - int iCaseSensitivity; -{ - unz_s* s; - int err; - - - uLong num_fileSaved; - uLong pos_in_central_dirSaved; - - - if (file==NULL) - return UNZ_PARAMERROR; - - if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) - return UNZ_PARAMERROR; - - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - - num_fileSaved = s->num_file; - pos_in_central_dirSaved = s->pos_in_central_dir; - - err = unzGoToFirstFile(file); - - while (err == UNZ_OK) - { - char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; - unzGetCurrentFileInfo(file,NULL, - szCurrentFileName,sizeof(szCurrentFileName)-1, - NULL,0,NULL,0); - if (unzStringFileNameCompare(szCurrentFileName, - szFileName,iCaseSensitivity)==0) - return UNZ_OK; - err = unzGoToNextFile(file); - } - - s->num_file = num_fileSaved ; - s->pos_in_central_dir = pos_in_central_dirSaved ; - return err; -} - - -/* - Read the local header of the current zipfile - Check the coherency of the local header and info in the end of central - directory about this file - store in *piSizeVar the size of extra info in local header - (filename and size of extra field data) -*/ -local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, - poffset_local_extrafield, - psize_local_extrafield) - unz_s* s; - uInt* piSizeVar; - uLong *poffset_local_extrafield; - uInt *psize_local_extrafield; -{ - uLong uMagic,uData,uFlags; - uLong size_filename; - uLong size_extra_field; - int err=UNZ_OK; - - *piSizeVar = 0; - *poffset_local_extrafield = 0; - *psize_local_extrafield = 0; - - if (fseek(s->file,s->cur_file_info_internal.offset_curfile + - s->byte_before_the_zipfile,SEEK_SET)!=0) - return UNZ_ERRNO; - - - if (err==UNZ_OK) - { - if (unzlocal_getLong(s->file,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x04034b50) - err=UNZ_BADZIPFILE; - } - - if (unzlocal_getShort(s->file,&uData) != UNZ_OK) - err=UNZ_ERRNO; -/* - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) - err=UNZ_BADZIPFILE; -*/ - if (unzlocal_getShort(s->file,&uFlags) != UNZ_OK) - err=UNZ_ERRNO; - - if (unzlocal_getShort(s->file,&uData) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) - err=UNZ_BADZIPFILE; - - if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; - - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ - err=UNZ_ERRNO; - - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* crc */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size compr */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && - ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - - if (unzlocal_getShort(s->file,&size_filename) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) - err=UNZ_BADZIPFILE; - - *piSizeVar += (uInt)size_filename; - - if (unzlocal_getShort(s->file,&size_extra_field) != UNZ_OK) - err=UNZ_ERRNO; - *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + - SIZEZIPLOCALHEADER + size_filename; - *psize_local_extrafield = (uInt)size_extra_field; - - *piSizeVar += (uInt)size_extra_field; - - return err; -} - -/* - Open for reading data the current file in the zipfile. - If there is no error and the file is opened, the return value is UNZ_OK. -*/ -extern int ZEXPORT unzOpenCurrentFile (file) - unzFile file; -{ - int err=UNZ_OK; - int Store; - uInt iSizeVar; - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - uLong offset_local_extrafield; /* offset of the local extra field */ - uInt size_local_extrafield; /* size of the local extra field */ - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - if (!s->current_file_ok) - return UNZ_PARAMERROR; - - if (s->pfile_in_zip_read != NULL) - unzCloseCurrentFile(file); - - if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, - &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) - return UNZ_BADZIPFILE; - - pfile_in_zip_read_info = (file_in_zip_read_info_s*) - ALLOC(sizeof(file_in_zip_read_info_s)); - if (pfile_in_zip_read_info==NULL) - return UNZ_INTERNALERROR; - - pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); - pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; - pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; - pfile_in_zip_read_info->pos_local_extrafield=0; - - if (pfile_in_zip_read_info->read_buffer==NULL) - { - TRYFREE(pfile_in_zip_read_info); - return UNZ_INTERNALERROR; - } - - pfile_in_zip_read_info->stream_initialised=0; - - if ((s->cur_file_info.compression_method!=0) && - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; - Store = s->cur_file_info.compression_method==0; - - pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; - pfile_in_zip_read_info->crc32=0; - pfile_in_zip_read_info->compression_method = - s->cur_file_info.compression_method; - pfile_in_zip_read_info->file=s->file; - pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; - - pfile_in_zip_read_info->stream.total_out = 0; - - if (!Store) - { - pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; - pfile_in_zip_read_info->stream.zfree = (free_func)0; - pfile_in_zip_read_info->stream.opaque = (voidpf)0; - - err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); - if (err == Z_OK) - pfile_in_zip_read_info->stream_initialised=1; - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. - * In unzip, i don't wait absolutely Z_STREAM_END because I known the - * size of both compressed and uncompressed data - */ - } - pfile_in_zip_read_info->rest_read_compressed = - s->cur_file_info.compressed_size ; - pfile_in_zip_read_info->rest_read_uncompressed = - s->cur_file_info.uncompressed_size ; - - - pfile_in_zip_read_info->pos_in_zipfile = - s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + - iSizeVar; - - pfile_in_zip_read_info->stream.avail_in = (uInt)0; - - - s->pfile_in_zip_read = pfile_in_zip_read_info; - return UNZ_OK; -} - - -/* - Read bytes from the current file. - buf contain buffer where data must be copied - len the size of buf. - - return the number of byte copied if somes bytes are copied - return 0 if the end of file was reached - return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) -*/ -extern int ZEXPORT unzReadCurrentFile (file, buf, len) - unzFile file; - voidp buf; - unsigned len; -{ - int err=UNZ_OK; - uInt iRead = 0; - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - - if ((pfile_in_zip_read_info->read_buffer == NULL)) - return UNZ_END_OF_LIST_OF_FILE; - if (len==0) - return 0; - - pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; - - pfile_in_zip_read_info->stream.avail_out = (uInt)len; - - if (len>pfile_in_zip_read_info->rest_read_uncompressed) - pfile_in_zip_read_info->stream.avail_out = - (uInt)pfile_in_zip_read_info->rest_read_uncompressed; - - while (pfile_in_zip_read_info->stream.avail_out>0) - { - if ((pfile_in_zip_read_info->stream.avail_in==0) && - (pfile_in_zip_read_info->rest_read_compressed>0)) - { - uInt uReadThis = UNZ_BUFSIZE; - if (pfile_in_zip_read_info->rest_read_compressedrest_read_compressed; - if (uReadThis == 0) - return UNZ_EOF; - if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->pos_in_zipfile + - pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) - return UNZ_ERRNO; - if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, - pfile_in_zip_read_info->file)!=1) - return UNZ_ERRNO; - pfile_in_zip_read_info->pos_in_zipfile += uReadThis; - - pfile_in_zip_read_info->rest_read_compressed-=uReadThis; - - pfile_in_zip_read_info->stream.next_in = - (Bytef*)pfile_in_zip_read_info->read_buffer; - pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; - } - - if (pfile_in_zip_read_info->compression_method==0) - { - uInt uDoCopy,i ; - if (pfile_in_zip_read_info->stream.avail_out < - pfile_in_zip_read_info->stream.avail_in) - uDoCopy = pfile_in_zip_read_info->stream.avail_out ; - else - uDoCopy = pfile_in_zip_read_info->stream.avail_in ; - - for (i=0;istream.next_out+i) = - *(pfile_in_zip_read_info->stream.next_in+i); - - pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, - pfile_in_zip_read_info->stream.next_out, - uDoCopy); - pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; - pfile_in_zip_read_info->stream.avail_in -= uDoCopy; - pfile_in_zip_read_info->stream.avail_out -= uDoCopy; - pfile_in_zip_read_info->stream.next_out += uDoCopy; - pfile_in_zip_read_info->stream.next_in += uDoCopy; - pfile_in_zip_read_info->stream.total_out += uDoCopy; - iRead += uDoCopy; - } - else - { - uLong uTotalOutBefore,uTotalOutAfter; - const Bytef *bufBefore; - uLong uOutThis; - int flush=Z_SYNC_FLUSH; - - uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; - bufBefore = pfile_in_zip_read_info->stream.next_out; - - /* - if ((pfile_in_zip_read_info->rest_read_uncompressed == - pfile_in_zip_read_info->stream.avail_out) && - (pfile_in_zip_read_info->rest_read_compressed == 0)) - flush = Z_FINISH; - */ - err=inflate(&pfile_in_zip_read_info->stream,flush); - - uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; - uOutThis = uTotalOutAfter-uTotalOutBefore; - - pfile_in_zip_read_info->crc32 = - crc32(pfile_in_zip_read_info->crc32,bufBefore, - (uInt)(uOutThis)); - - pfile_in_zip_read_info->rest_read_uncompressed -= - uOutThis; - - iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - - if (err==Z_STREAM_END) - return (iRead==0) ? UNZ_EOF : iRead; - if (err!=Z_OK) - break; - } - } - - if (err==Z_OK) - return iRead; - return err; -} - - -/* - Give the current position in uncompressed data -*/ -extern z_off_t ZEXPORT unztell (file) - unzFile file; -{ - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - return (z_off_t)pfile_in_zip_read_info->stream.total_out; -} - - -/* - return 1 if the end of file was reached, 0 elsewhere -*/ -extern int ZEXPORT unzeof (file) - unzFile file; -{ - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - return 1; - else - return 0; -} - - - -/* - Read extra field from the current file (opened by unzOpenCurrentFile) - This is the local-header version of the extra field (sometimes, there is - more info in the local-header version than in the central-header) - - if buf==NULL, it return the size of the local extra field that can be read - - if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code -*/ -extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) - unzFile file; - voidp buf; - unsigned len; -{ - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - uInt read_now; - uLong size_to_read; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - size_to_read = (pfile_in_zip_read_info->size_local_extrafield - - pfile_in_zip_read_info->pos_local_extrafield); - - if (buf==NULL) - return (int)size_to_read; - - if (len>size_to_read) - read_now = (uInt)size_to_read; - else - read_now = (uInt)len ; - - if (read_now==0) - return 0; - - if (fseek(pfile_in_zip_read_info->file, - pfile_in_zip_read_info->offset_local_extrafield + - pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) - return UNZ_ERRNO; - - if (fread(buf,(uInt)size_to_read,1,pfile_in_zip_read_info->file)!=1) - return UNZ_ERRNO; - - return (int)read_now; -} - -/* - Close the file in zip opened with unzipOpenCurrentFile - Return UNZ_CRCERROR if all the file was read but the CRC is not good -*/ -extern int ZEXPORT unzCloseCurrentFile (file) - unzFile file; -{ - int err=UNZ_OK; - - unz_s* s; - file_in_zip_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - { - if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) - err=UNZ_CRCERROR; - } - - - TRYFREE(pfile_in_zip_read_info->read_buffer); - pfile_in_zip_read_info->read_buffer = NULL; - if (pfile_in_zip_read_info->stream_initialised) - inflateEnd(&pfile_in_zip_read_info->stream); - - pfile_in_zip_read_info->stream_initialised = 0; - TRYFREE(pfile_in_zip_read_info); - - s->pfile_in_zip_read=NULL; - - return err; -} - - -/* - Get the global comment string of the ZipFile, in the szComment buffer. - uSizeBuf is the size of the szComment buffer. - return the number of byte copied or an error code <0 -*/ -extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) - unzFile file; - char *szComment; - uLong uSizeBuf; -{ -/* int err=UNZ_OK; */ - unz_s* s; - uLong uReadThis ; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz_s*)file; - - uReadThis = uSizeBuf; - if (uReadThis>s->gi.size_comment) - uReadThis = s->gi.size_comment; - - if (fseek(s->file,s->central_pos+22,SEEK_SET)!=0) - return UNZ_ERRNO; - - if (uReadThis>0) - { - *szComment='\0'; - if (fread(szComment,(uInt)uReadThis,1,s->file)!=1) - return UNZ_ERRNO; - } - - if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) - *(szComment+s->gi.size_comment)='\0'; - return (int)uReadThis; -} diff --git a/source/unzip.h b/source/unzip.h deleted file mode 100644 index c7ba82a..0000000 --- a/source/unzip.h +++ /dev/null @@ -1,274 +0,0 @@ -/* unzip.h -- IO for uncompress .zip files using zlib - Version 0.15 beta, Mar 19th, 1998, - - Copyright (C) 1998 Gilles Vollant - - This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g - WinZip, InfoZip tools and compatible. - Encryption and multi volume ZipFile (span) are not supported. - Old compressions used by old PKZip 1.x are not supported - - THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE - CAN CHANGE IN FUTURE VERSION !! - I WAIT FEEDBACK at mail info@winimage.com - Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution - - Condition of use and distribution are the same than zlib : - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* for more info about .ZIP format, see - ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip - PkWare has also a specification at : - ftp://ftp.pkware.com/probdesc.zip */ - -#ifndef _unz_H -#define _unz_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _ZLIB_H -#include "zlib.h" -#endif - -#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) -/* like the STRICT of WIN32, we define a pointer that cannot be converted - from (void*) without cast */ -typedef struct TagunzFile__ { int unused; } unzFile__; -typedef unzFile__ *unzFile; -#else -typedef voidp unzFile; -#endif - - -#define UNZ_OK (0) -#define UNZ_END_OF_LIST_OF_FILE (-100) -#define UNZ_ERRNO (Z_ERRNO) -#define UNZ_EOF (0) -#define UNZ_PARAMERROR (-102) -#define UNZ_BADZIPFILE (-103) -#define UNZ_INTERNALERROR (-104) -#define UNZ_CRCERROR (-105) - -/* tm_unz contain date/time info */ -typedef struct tm_unz_s -{ - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ -} tm_unz; - -/* unz_global_info structure contain global data about the ZIPfile - These data comes from the end of central dir */ -typedef struct unz_global_info_s -{ - uLong number_entry; /* total number of entries in - the central dir on this disk */ - uLong size_comment; /* size of the global comment of the zipfile */ -} unz_global_info; - - -/* unz_file_info contain information about a file in the zipfile */ -typedef struct unz_file_info_s -{ - uLong version; /* version made by 2 bytes */ - uLong version_needed; /* version needed to extract 2 bytes */ - uLong flag; /* general purpose bit flag 2 bytes */ - uLong compression_method; /* compression method 2 bytes */ - uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ - uLong crc; /* crc-32 4 bytes */ - uLong compressed_size; /* compressed size 4 bytes */ - uLong uncompressed_size; /* uncompressed size 4 bytes */ - uLong size_filename; /* filename length 2 bytes */ - uLong size_file_extra; /* extra field length 2 bytes */ - uLong size_file_comment; /* file comment length 2 bytes */ - - uLong disk_num_start; /* disk number start 2 bytes */ - uLong internal_fa; /* internal file attributes 2 bytes */ - uLong external_fa; /* external file attributes 4 bytes */ - - tm_unz tmu_date; -} unz_file_info; - -extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, - const char* fileName2, - int iCaseSensitivity)); -/* - Compare two filename (fileName1,fileName2). - If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) - If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) - If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) -*/ - - -extern unzFile ZEXPORT unzOpen OF((const char *path)); -/* - Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer - "zlib/zlib111.zip". - If the zipfile cannot be opened (file don't exist or in not valid), the - return value is NULL. - Else, the return value is a unzFile Handle, usable with other function - of this unzip package. -*/ - -extern int ZEXPORT unzClose OF((unzFile file)); -/* - Close a ZipFile opened with unzipOpen. - If there is files inside the .Zip opened with unzOpenCurrentFile (see later), - these files MUST be closed with unzipCloseCurrentFile before call unzipClose. - return UNZ_OK if there is no problem. */ - -extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, - unz_global_info *pglobal_info)); -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. */ - - -extern int ZEXPORT unzGetGlobalComment OF((unzFile file, - char *szComment, - uLong uSizeBuf)); -/* - Get the global comment string of the ZipFile, in the szComment buffer. - uSizeBuf is the size of the szComment buffer. - return the number of byte copied or an error code <0 -*/ - - -/***************************************************************************/ -/* Unzip package allow you browse the directory of the zipfile */ - -extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); -/* - Set the current file of the zipfile to the first file. - return UNZ_OK if there is no problem -*/ - -extern int ZEXPORT unzGoToNextFile OF((unzFile file)); -/* - Set the current file of the zipfile to the next file. - return UNZ_OK if there is no problem - return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. -*/ - -extern int ZEXPORT unzLocateFile OF((unzFile file, - const char *szFileName, - int iCaseSensitivity)); -/* - Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzStringFileNameCompare - - return value : - UNZ_OK if the file is found. It becomes the current file. - UNZ_END_OF_LIST_OF_FILE if the file is not found -*/ - - -extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, - unz_file_info *pfile_info, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); -/* - Get Info about the current file - if pfile_info!=NULL, the *pfile_info structure will contain somes info about - the current file - if szFileName!=NULL, the filemane string will be copied in szFileName - (fileNameBufferSize is the size of the buffer) - if extraField!=NULL, the extra field information will be copied in extraField - (extraFieldBufferSize is the size of the buffer). - This is the Central-header version of the extra field - if szComment!=NULL, the comment string of the file will be copied in szComment - (commentBufferSize is the size of the buffer) -*/ - -/***************************************************************************/ -/* for reading the content of the current zipfile, you can open it, read data - from it, and close it (you can close it before reading all the file) - */ - -extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); -/* - Open for reading data the current file in the zipfile. - If there is no error, the return value is UNZ_OK. -*/ - -extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); -/* - Close the file in zip opened with unzOpenCurrentFile - Return UNZ_CRCERROR if all the file was read but the CRC is not good -*/ - - -extern int ZEXPORT unzReadCurrentFile OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read bytes from the current file (opened by unzOpenCurrentFile) - buf contain buffer where data must be copied - len the size of buf. - - return the number of byte copied if somes bytes are copied - return 0 if the end of file was reached - return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) -*/ - -extern z_off_t ZEXPORT unztell OF((unzFile file)); -/* - Give the current position in uncompressed data -*/ - -extern int ZEXPORT unzeof OF((unzFile file)); -/* - return 1 if the end of file was reached, 0 elsewhere -*/ - -extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read extra field from the current file (opened by unzOpenCurrentFile) - This is the local-header version of the extra field (sometimes, there is - more info in the local-header version than in the central-header) - - if buf==NULL, it return the size of the local extra field - - if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code -*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _unz_H */ diff --git a/source/z80/cpuintrf.h b/source/z80/cpuintrf.h index 0c52e5f..e57a305 100644 --- a/source/z80/cpuintrf.h +++ b/source/z80/cpuintrf.h @@ -7,48 +7,48 @@ /* Interrupt line constants */ enum { - /* line states */ - CLEAR_LINE = 0, /* clear (a fired, held or pulsed) line */ - ASSERT_LINE, /* assert an interrupt immediately */ - HOLD_LINE, /* hold interrupt line until acknowledged */ - PULSE_LINE, /* pulse interrupt line for one instruction */ + /* line states */ + CLEAR_LINE = 0, /* clear (a fired, held or pulsed) line */ + ASSERT_LINE, /* assert an interrupt immediately */ + HOLD_LINE, /* hold interrupt line until acknowledged */ + PULSE_LINE, /* pulse interrupt line for one instruction */ - /* internal flags (not for use by drivers!) */ - INTERNAL_CLEAR_LINE = 100 + CLEAR_LINE, - INTERNAL_ASSERT_LINE = 100 + ASSERT_LINE, + /* internal flags (not for use by drivers!) */ + INTERNAL_CLEAR_LINE = 100 + CLEAR_LINE, + INTERNAL_ASSERT_LINE = 100 + ASSERT_LINE, - /* input lines */ - MAX_INPUT_LINES = 32+3, - INPUT_LINE_IRQ0 = 0, - INPUT_LINE_IRQ1 = 1, - INPUT_LINE_IRQ2 = 2, - INPUT_LINE_IRQ3 = 3, - INPUT_LINE_IRQ4 = 4, - INPUT_LINE_IRQ5 = 5, - INPUT_LINE_IRQ6 = 6, - INPUT_LINE_IRQ7 = 7, - INPUT_LINE_IRQ8 = 8, - INPUT_LINE_IRQ9 = 9, - INPUT_LINE_NMI = MAX_INPUT_LINES - 3, + /* input lines */ + MAX_INPUT_LINES = 32+3, + INPUT_LINE_IRQ0 = 0, + INPUT_LINE_IRQ1 = 1, + INPUT_LINE_IRQ2 = 2, + INPUT_LINE_IRQ3 = 3, + INPUT_LINE_IRQ4 = 4, + INPUT_LINE_IRQ5 = 5, + INPUT_LINE_IRQ6 = 6, + INPUT_LINE_IRQ7 = 7, + INPUT_LINE_IRQ8 = 8, + INPUT_LINE_IRQ9 = 9, + INPUT_LINE_NMI = MAX_INPUT_LINES - 3, - /* special input lines that are implemented in the core */ - INPUT_LINE_RESET = MAX_INPUT_LINES - 2, - INPUT_LINE_HALT = MAX_INPUT_LINES - 1, + /* special input lines that are implemented in the core */ + INPUT_LINE_RESET = MAX_INPUT_LINES - 2, + INPUT_LINE_HALT = MAX_INPUT_LINES - 1, - /* output lines */ - MAX_OUTPUT_LINES = 32 + /* output lines */ + MAX_OUTPUT_LINES = 32 }; /* daisy-chain link */ typedef struct { - void (*reset)(int); /* reset callback */ - int (*interrupt_entry)(int); /* entry callback */ - void (*interrupt_reti)(int); /* reti callback */ - int irq_param; /* callback paramater */ -} Z80_DaisyChain; + void (*reset)(int); /* reset callback */ + int (*interrupt_entry)(int); /* entry callback */ + void (*interrupt_reti)(int); /* reti callback */ + int irq_param; /* callback paramater */ +} Z80_DaisyChain; -#define Z80_MAXDAISY 4 /* maximum of daisy chan device */ +#define Z80_MAXDAISY 4 /* maximum of daisy chan device */ #define Z80_INT_REQ 0x01 /* interrupt request mask */ #define Z80_INT_IEO 0x02 /* interrupt disable mask(IEO) */ @@ -56,4 +56,4 @@ typedef struct { #define Z80_VECTOR(device,state) (((device)<<8)|(state)) -#endif /* CPUINTRF_H */ +#endif /* CPUINTRF_H */ diff --git a/source/z80/osd_cpu.h b/source/z80/osd_cpu.h index e6a813b..1ce392f 100644 --- a/source/z80/osd_cpu.h +++ b/source/z80/osd_cpu.h @@ -1,24 +1,24 @@ /******************************************************************************* -* * -* Define size independent data types and operations. * -* * -* The following types must be supported by all platforms: * -* * -* UINT8 - Unsigned 8-bit Integer INT8 - Signed 8-bit integer * -* UINT16 - Unsigned 16-bit Integer INT16 - Signed 16-bit integer * -* UINT32 - Unsigned 32-bit Integer INT32 - Signed 32-bit integer * -* UINT64 - Unsigned 64-bit Integer INT64 - Signed 64-bit integer * -* * -* * +* * +* Define size independent data types and operations. * +* * +* The following types must be supported by all platforms: * +* * +* UINT8 - Unsigned 8-bit Integer INT8 - Signed 8-bit integer * +* UINT16 - Unsigned 16-bit Integer INT16 - Signed 16-bit integer * +* UINT32 - Unsigned 32-bit Integer INT32 - Signed 32-bit integer * +* UINT64 - Unsigned 64-bit Integer INT64 - Signed 64-bit integer * +* * +* * * The macro names for the artithmatic operations are composed as follows: * -* * -* XXX_R_A_B, where XXX - 3 letter operation code (ADD, SUB, etc.) * -* R - The type of the result * -* A - The type of operand 1 * -* B - The type of operand 2 (if binary operation) * -* * -* Each type is one of: U8,8,U16,16,U32,32,U64,64 * -* * +* * +* XXX_R_A_B, where XXX - 3 letter operation code (ADD, SUB, etc.) * +* R - The type of the result * +* A - The type of operand 1 * +* B - The type of operand 2 (if binary operation) * +* * +* Each type is one of: U8,8,U16,16,U32,32,U64,64 * +* * *******************************************************************************/ @@ -35,14 +35,14 @@ #define FALSE 0 #endif -typedef unsigned char UINT8; -typedef unsigned short UINT16; +typedef unsigned char UINT8; +typedef unsigned short UINT16; //#ifdef DOS typedef unsigned int UINT32; __extension__ typedef unsigned long long UINT64; //#endif -typedef signed char INT8; -typedef signed short INT16; +typedef signed char INT8; +typedef signed short INT16; //#ifdef DOS typedef signed int INT32; __extension__ typedef signed long long INT64; @@ -53,20 +53,20 @@ __extension__ typedef signed long long INT64; #define COMBINE_U64_U32_U32(A,B) COMBINE_64_32_32(A,B) /* Return upper 32 bits of a 64-bit integer */ -#define HI32_32_64(A) (((UINT64)(A)) >> 32) -#define HI32_U32_U64(A) HI32_32_64(A) +#define HI32_32_64(A) (((UINT64)(A)) >> 32) +#define HI32_U32_U64(A) HI32_32_64(A) /* Return lower 32 bits of a 64-bit integer */ -#define LO32_32_64(A) ((A) & 0xffffffff) -#define LO32_U32_U64(A) LO32_32_64(A) +#define LO32_32_64(A) ((A) & 0xffffffff) +#define LO32_U32_U64(A) LO32_32_64(A) -#define DIV_64_64_32(A,B) ((A)/(B)) +#define DIV_64_64_32(A,B) ((A)/(B)) #define DIV_U64_U64_U32(A,B) ((A)/(UINT32)(B)) -#define MOD_32_64_32(A,B) ((A)%(B)) +#define MOD_32_64_32(A,B) ((A)%(B)) #define MOD_U32_U64_U32(A,B) ((A)%(UINT32)(B)) -#define MUL_64_32_32(A,B) ((A)*(INT64)(B)) +#define MUL_64_32_32(A,B) ((A)*(INT64)(B)) #define MUL_U64_U32_U32(A,B) ((A)*(UINT64)(UINT32)(B)) @@ -79,13 +79,13 @@ __extension__ typedef signed long long INT64; ******************************************************************************/ typedef union { #ifdef LSB_FIRST - struct { UINT8 l,h,h2,h3; } b; - struct { UINT16 l,h; } w; + struct { UINT8 l,h,h2,h3; } b; + struct { UINT16 l,h; } w; #else - struct { UINT8 h3,h2,h,l; } b; - struct { UINT16 h,l; } w; + struct { UINT8 h3,h2,h,l; } b; + struct { UINT16 h,l; } w; #endif - UINT32 d; -} PAIR; + UINT32 d; +} PAIR; -#endif /* defined OSD_CPU_H */ +#endif /* defined OSD_CPU_H */ diff --git a/source/z80/z80.c b/source/z80/z80.c index 4ef8058..60c799b 100644 --- a/source/z80/z80.c +++ b/source/z80/z80.c @@ -1,21 +1,21 @@ /***************************************************************************** * - * z80.c + * z80.c * Portable Z80 emulator V3.5 * - * Copyright (C) 1998,1999,2000 Juergen Buchmueller, all rights reserved. + * Copyright (C) 1998,1999,2000 Juergen Buchmueller, all rights reserved. * - * - This source code is released as freeware for non-commercial purposes. - * - You are free to use and redistribute this code in modified or - * unmodified form, provided you list me in the credits. - * - If you modify this source code, you must add a notice to each modified - * source file that it has been changed. If you're a nice person, you - * will clearly mark each change too. :) - * - If you wish to use this for commercial purposes, please contact me at - * pullmoll@t-online.de - * - The author of this copywritten work reserves the right to change the - * terms of its usage and license at any time, including retroactively - * - This entire notice must remain in the source code. + * - This source code is released as freeware for non-commercial purposes. + * - You are free to use and redistribute this code in modified or + * unmodified form, provided you list me in the credits. + * - If you modify this source code, you must add a notice to each modified + * source file that it has been changed. If you're a nice person, you + * will clearly mark each change too. :) + * - If you wish to use this for commercial purposes, please contact me at + * pullmoll@t-online.de + * - The author of this copywritten work reserves the right to change the + * terms of its usage and license at any time, including retroactively + * - This entire notice must remain in the source code. * * Changes in 3.7 [Aaron Giles] * - Changed NMI handling. NMIs are now latched in set_irq_state @@ -39,57 +39,57 @@ * - Removed Z80-MSX specific code as it's not needed any more. * - Implemented DAA without look-up table [Ramsoft, Sean Young] * Changes in 3.3 - * - Fixed undocumented flags XF & YF in the non-asm versions of CP, - * and all the 16 bit arithmetic instructions. [Sean Young] - * Changes in 3.2 - * - Fixed undocumented flags XF & YF of RRCA, and CF and HF of - * INI/IND/OUTI/OUTD/INIR/INDR/OTIR/OTDR [Sean Young] - * Changes in 3.1 - * - removed the REPEAT_AT_ONCE execution of LDIR/CPIR etc. opcodes - * for readabilities sake and because the implementation was buggy - * (and I was not able to find the difference) - * Changes in 3.0 - * - 'finished' switch to dynamically overrideable cycle count tables - * Changes in 2.9: - * - added methods to access and override the cycle count tables - * - fixed handling and timing of multiple DD/FD prefixed opcodes - * Changes in 2.8: - * - OUTI/OUTD/OTIR/OTDR also pre-decrement the B register now. - * This was wrong because of a bug fix on the wrong side - * (astrocade sound driver). - * Changes in 2.7: - * - removed z80_vm specific code, it's not needed (and never was). - * Changes in 2.6: + * - Fixed undocumented flags XF & YF in the non-asm versions of CP, + * and all the 16 bit arithmetic instructions. [Sean Young] + * Changes in 3.2 + * - Fixed undocumented flags XF & YF of RRCA, and CF and HF of + * INI/IND/OUTI/OUTD/INIR/INDR/OTIR/OTDR [Sean Young] + * Changes in 3.1 + * - removed the REPEAT_AT_ONCE execution of LDIR/CPIR etc. opcodes + * for readabilities sake and because the implementation was buggy + * (and I was not able to find the difference) + * Changes in 3.0 + * - 'finished' switch to dynamically overrideable cycle count tables + * Changes in 2.9: + * - added methods to access and override the cycle count tables + * - fixed handling and timing of multiple DD/FD prefixed opcodes + * Changes in 2.8: + * - OUTI/OUTD/OTIR/OTDR also pre-decrement the B register now. + * This was wrong because of a bug fix on the wrong side + * (astrocade sound driver). + * Changes in 2.7: + * - removed z80_vm specific code, it's not needed (and never was). + * Changes in 2.6: * - BUSY_LOOP_HACKS needed to call change_pc() earlier, before - * checking the opcodes at the new address, because otherwise they - * might access the old (wrong or even NULL) banked memory region. - * Thanks to Sean Young for finding this nasty bug. - * Changes in 2.5: - * - Burning cycles always adjusts the ICount by a multiple of 4. - * - In REPEAT_AT_ONCE cases the R register wasn't incremented twice - * per repetition as it should have been. Those repeated opcodes - * could also underflow the ICount. - * - Simplified TIME_LOOP_HACKS for BC and added two more for DE + HL - * timing loops. I think those hacks weren't endian safe before too. - * Changes in 2.4: - * - z80_reset zaps the entire context, sets IX and IY to 0xffff(!) and - * sets the Z flag. With these changes the Tehkan World Cup driver - * _seems_ to work again. - * Changes in 2.3: - * - External termination of the execution loop calls z80_burn() and - * z80_vm_burn() to burn an amount of cycles (R adjustment) - * - Shortcuts which burn CPU cycles (BUSY_LOOP_HACKS and TIME_LOOP_HACKS) - * now also adjust the R register depending on the skipped opcodes. - * Changes in 2.2: - * - Fixed bugs in CPL, SCF and CCF instructions flag handling. - * - Changed variable EA and ARG16() function to UINT32; this - * produces slightly more efficient code. - * - The DD/FD XY CB opcodes where XY is 40-7F and Y is not 6/E - * are changed to calls to the X6/XE opcodes to reduce object size. - * They're hardly ever used so this should not yield a speed penalty. - * New in 2.0: - * - Optional more exact Z80 emulation (#define Z80_EXACT 1) according - * to a detailed description by Sean Young which can be found at: + * checking the opcodes at the new address, because otherwise they + * might access the old (wrong or even NULL) banked memory region. + * Thanks to Sean Young for finding this nasty bug. + * Changes in 2.5: + * - Burning cycles always adjusts the ICount by a multiple of 4. + * - In REPEAT_AT_ONCE cases the R register wasn't incremented twice + * per repetition as it should have been. Those repeated opcodes + * could also underflow the ICount. + * - Simplified TIME_LOOP_HACKS for BC and added two more for DE + HL + * timing loops. I think those hacks weren't endian safe before too. + * Changes in 2.4: + * - z80_reset zaps the entire context, sets IX and IY to 0xffff(!) and + * sets the Z flag. With these changes the Tehkan World Cup driver + * _seems_ to work again. + * Changes in 2.3: + * - External termination of the execution loop calls z80_burn() and + * z80_vm_burn() to burn an amount of cycles (R adjustment) + * - Shortcuts which burn CPU cycles (BUSY_LOOP_HACKS and TIME_LOOP_HACKS) + * now also adjust the R register depending on the skipped opcodes. + * Changes in 2.2: + * - Fixed bugs in CPL, SCF and CCF instructions flag handling. + * - Changed variable EA and ARG16() function to UINT32; this + * produces slightly more efficient code. + * - The DD/FD XY CB opcodes where XY is 40-7F and Y is not 6/E + * are changed to calls to the X6/XE opcodes to reduce object size. + * They're hardly ever used so this should not yield a speed penalty. + * New in 2.0: + * - Optional more exact Z80 emulation (#define Z80_EXACT 1) according + * to a detailed description by Sean Young which can be found at: * http://www.msxnet.org/tech/z80-documented.pdf *****************************************************************************/ #include "shared.h" @@ -98,7 +98,7 @@ #define VERBOSE 0 #if VERBOSE -#define LOG(x) logerror x +#define LOG(x) logerror x #else #define LOG(x) #endif @@ -108,33 +108,33 @@ /* execute main opcodes inside a big switch statement */ #ifndef BIG_SWITCH -#define BIG_SWITCH 1 +#define BIG_SWITCH 1 #endif /* big flags array for ADD/ADC/SUB/SBC/CP results */ -#define BIG_FLAGS_ARRAY 1 +#define BIG_FLAGS_ARRAY 1 /* on JP and JR opcodes check for tight loops */ -#define BUSY_LOOP_HACKS 1 +#define BUSY_LOOP_HACKS 1 #define change_pc(a) -#define CF 0x01 -#define NF 0x02 -#define PF 0x04 -#define VF PF -#define XF 0x08 -#define HF 0x10 -#define YF 0x20 -#define ZF 0x40 -#define SF 0x80 +#define CF 0x01 +#define NF 0x02 +#define PF 0x04 +#define VF PF +#define XF 0x08 +#define HF 0x10 +#define YF 0x20 +#define ZF 0x40 +#define SF 0x80 #define INT_IRQ 0x01 #define NMI_IRQ 0x02 -#define PRVPC Z80.prvpc.d /* previous program counter */ +#define PRVPC Z80.prvpc.d /* previous program counter */ -#define PCD Z80.pc.d +#define PCD Z80.pc.d #define PC Z80.pc.w.l #define SPD Z80.sp.d @@ -182,9 +182,9 @@ int z80_ICount; Z80_Regs Z80; static UINT32 EA; -static UINT8 SZ[256]; /* zero and sign flags */ -static UINT8 SZ_BIT[256]; /* zero, sign and parity/overflow (=zero) flags for BIT opcode */ -static UINT8 SZP[256]; /* zero, sign and parity flags */ +static UINT8 SZ[256]; /* zero and sign flags */ +static UINT8 SZ_BIT[256]; /* zero, sign and parity/overflow (=zero) flags for BIT opcode */ +static UINT8 SZP[256]; /* zero, sign and parity flags */ static UINT8 SZHV_inc[256]; /* zero, sign, half carry and overflow flags INC r8 */ static UINT8 SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 */ @@ -286,9 +286,9 @@ static const UINT8 cc_xycb[0x100] = { /* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */ static const UINT8 cc_ex[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DJNZ */ - 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NZ/JR Z */ - 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NC/JR C */ + 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DJNZ */ + 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NZ/JR Z */ + 5, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, /* JR NC/JR C */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -296,116 +296,116 @@ static const UINT8 cc_ex[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, /* LDIR/CPIR/INIR/OTIR LDDR/CPDR/INDR/OTDR */ + 5, 5, 5, 5, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, /* LDIR/CPIR/INIR/OTIR LDDR/CPDR/INDR/OTDR */ 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2}; static const UINT8 *cc[6]; -#define Z80_TABLE_dd Z80_TABLE_xy -#define Z80_TABLE_fd Z80_TABLE_xy +#define Z80_TABLE_dd Z80_TABLE_xy +#define Z80_TABLE_fd Z80_TABLE_xy typedef void (*funcptr)(void); #define PROTOTYPES(tablename,prefix) \ - INLINE void prefix##_00(void); INLINE void prefix##_01(void); INLINE void prefix##_02(void); INLINE void prefix##_03(void); \ - INLINE void prefix##_04(void); INLINE void prefix##_05(void); INLINE void prefix##_06(void); INLINE void prefix##_07(void); \ - INLINE void prefix##_08(void); INLINE void prefix##_09(void); INLINE void prefix##_0a(void); INLINE void prefix##_0b(void); \ - INLINE void prefix##_0c(void); INLINE void prefix##_0d(void); INLINE void prefix##_0e(void); INLINE void prefix##_0f(void); \ - INLINE void prefix##_10(void); INLINE void prefix##_11(void); INLINE void prefix##_12(void); INLINE void prefix##_13(void); \ - INLINE void prefix##_14(void); INLINE void prefix##_15(void); INLINE void prefix##_16(void); INLINE void prefix##_17(void); \ - INLINE void prefix##_18(void); INLINE void prefix##_19(void); INLINE void prefix##_1a(void); INLINE void prefix##_1b(void); \ - INLINE void prefix##_1c(void); INLINE void prefix##_1d(void); INLINE void prefix##_1e(void); INLINE void prefix##_1f(void); \ - INLINE void prefix##_20(void); INLINE void prefix##_21(void); INLINE void prefix##_22(void); INLINE void prefix##_23(void); \ - INLINE void prefix##_24(void); INLINE void prefix##_25(void); INLINE void prefix##_26(void); INLINE void prefix##_27(void); \ - INLINE void prefix##_28(void); INLINE void prefix##_29(void); INLINE void prefix##_2a(void); INLINE void prefix##_2b(void); \ - INLINE void prefix##_2c(void); INLINE void prefix##_2d(void); INLINE void prefix##_2e(void); INLINE void prefix##_2f(void); \ - INLINE void prefix##_30(void); INLINE void prefix##_31(void); INLINE void prefix##_32(void); INLINE void prefix##_33(void); \ - INLINE void prefix##_34(void); INLINE void prefix##_35(void); INLINE void prefix##_36(void); INLINE void prefix##_37(void); \ - INLINE void prefix##_38(void); INLINE void prefix##_39(void); INLINE void prefix##_3a(void); INLINE void prefix##_3b(void); \ - INLINE void prefix##_3c(void); INLINE void prefix##_3d(void); INLINE void prefix##_3e(void); INLINE void prefix##_3f(void); \ - INLINE void prefix##_40(void); INLINE void prefix##_41(void); INLINE void prefix##_42(void); INLINE void prefix##_43(void); \ - INLINE void prefix##_44(void); INLINE void prefix##_45(void); INLINE void prefix##_46(void); INLINE void prefix##_47(void); \ - INLINE void prefix##_48(void); INLINE void prefix##_49(void); INLINE void prefix##_4a(void); INLINE void prefix##_4b(void); \ - INLINE void prefix##_4c(void); INLINE void prefix##_4d(void); INLINE void prefix##_4e(void); INLINE void prefix##_4f(void); \ - INLINE void prefix##_50(void); INLINE void prefix##_51(void); INLINE void prefix##_52(void); INLINE void prefix##_53(void); \ - INLINE void prefix##_54(void); INLINE void prefix##_55(void); INLINE void prefix##_56(void); INLINE void prefix##_57(void); \ - INLINE void prefix##_58(void); INLINE void prefix##_59(void); INLINE void prefix##_5a(void); INLINE void prefix##_5b(void); \ - INLINE void prefix##_5c(void); INLINE void prefix##_5d(void); INLINE void prefix##_5e(void); INLINE void prefix##_5f(void); \ - INLINE void prefix##_60(void); INLINE void prefix##_61(void); INLINE void prefix##_62(void); INLINE void prefix##_63(void); \ - INLINE void prefix##_64(void); INLINE void prefix##_65(void); INLINE void prefix##_66(void); INLINE void prefix##_67(void); \ - INLINE void prefix##_68(void); INLINE void prefix##_69(void); INLINE void prefix##_6a(void); INLINE void prefix##_6b(void); \ - INLINE void prefix##_6c(void); INLINE void prefix##_6d(void); INLINE void prefix##_6e(void); INLINE void prefix##_6f(void); \ - INLINE void prefix##_70(void); INLINE void prefix##_71(void); INLINE void prefix##_72(void); INLINE void prefix##_73(void); \ - INLINE void prefix##_74(void); INLINE void prefix##_75(void); INLINE void prefix##_76(void); INLINE void prefix##_77(void); \ - INLINE void prefix##_78(void); INLINE void prefix##_79(void); INLINE void prefix##_7a(void); INLINE void prefix##_7b(void); \ - INLINE void prefix##_7c(void); INLINE void prefix##_7d(void); INLINE void prefix##_7e(void); INLINE void prefix##_7f(void); \ - INLINE void prefix##_80(void); INLINE void prefix##_81(void); INLINE void prefix##_82(void); INLINE void prefix##_83(void); \ - INLINE void prefix##_84(void); INLINE void prefix##_85(void); INLINE void prefix##_86(void); INLINE void prefix##_87(void); \ - INLINE void prefix##_88(void); INLINE void prefix##_89(void); INLINE void prefix##_8a(void); INLINE void prefix##_8b(void); \ - INLINE void prefix##_8c(void); INLINE void prefix##_8d(void); INLINE void prefix##_8e(void); INLINE void prefix##_8f(void); \ - INLINE void prefix##_90(void); INLINE void prefix##_91(void); INLINE void prefix##_92(void); INLINE void prefix##_93(void); \ - INLINE void prefix##_94(void); INLINE void prefix##_95(void); INLINE void prefix##_96(void); INLINE void prefix##_97(void); \ - INLINE void prefix##_98(void); INLINE void prefix##_99(void); INLINE void prefix##_9a(void); INLINE void prefix##_9b(void); \ - INLINE void prefix##_9c(void); INLINE void prefix##_9d(void); INLINE void prefix##_9e(void); INLINE void prefix##_9f(void); \ - INLINE void prefix##_a0(void); INLINE void prefix##_a1(void); INLINE void prefix##_a2(void); INLINE void prefix##_a3(void); \ - INLINE void prefix##_a4(void); INLINE void prefix##_a5(void); INLINE void prefix##_a6(void); INLINE void prefix##_a7(void); \ - INLINE void prefix##_a8(void); INLINE void prefix##_a9(void); INLINE void prefix##_aa(void); INLINE void prefix##_ab(void); \ - INLINE void prefix##_ac(void); INLINE void prefix##_ad(void); INLINE void prefix##_ae(void); INLINE void prefix##_af(void); \ - INLINE void prefix##_b0(void); INLINE void prefix##_b1(void); INLINE void prefix##_b2(void); INLINE void prefix##_b3(void); \ - INLINE void prefix##_b4(void); INLINE void prefix##_b5(void); INLINE void prefix##_b6(void); INLINE void prefix##_b7(void); \ - INLINE void prefix##_b8(void); INLINE void prefix##_b9(void); INLINE void prefix##_ba(void); INLINE void prefix##_bb(void); \ - INLINE void prefix##_bc(void); INLINE void prefix##_bd(void); INLINE void prefix##_be(void); INLINE void prefix##_bf(void); \ - INLINE void prefix##_c0(void); INLINE void prefix##_c1(void); INLINE void prefix##_c2(void); INLINE void prefix##_c3(void); \ - INLINE void prefix##_c4(void); INLINE void prefix##_c5(void); INLINE void prefix##_c6(void); INLINE void prefix##_c7(void); \ - INLINE void prefix##_c8(void); INLINE void prefix##_c9(void); INLINE void prefix##_ca(void); INLINE void prefix##_cb(void); \ - INLINE void prefix##_cc(void); INLINE void prefix##_cd(void); INLINE void prefix##_ce(void); INLINE void prefix##_cf(void); \ - INLINE void prefix##_d0(void); INLINE void prefix##_d1(void); INLINE void prefix##_d2(void); INLINE void prefix##_d3(void); \ - INLINE void prefix##_d4(void); INLINE void prefix##_d5(void); INLINE void prefix##_d6(void); INLINE void prefix##_d7(void); \ - INLINE void prefix##_d8(void); INLINE void prefix##_d9(void); INLINE void prefix##_da(void); INLINE void prefix##_db(void); \ - INLINE void prefix##_dc(void); INLINE void prefix##_dd(void); INLINE void prefix##_de(void); INLINE void prefix##_df(void); \ - INLINE void prefix##_e0(void); INLINE void prefix##_e1(void); INLINE void prefix##_e2(void); INLINE void prefix##_e3(void); \ - INLINE void prefix##_e4(void); INLINE void prefix##_e5(void); INLINE void prefix##_e6(void); INLINE void prefix##_e7(void); \ - INLINE void prefix##_e8(void); INLINE void prefix##_e9(void); INLINE void prefix##_ea(void); INLINE void prefix##_eb(void); \ - INLINE void prefix##_ec(void); INLINE void prefix##_ed(void); INLINE void prefix##_ee(void); INLINE void prefix##_ef(void); \ - INLINE void prefix##_f0(void); INLINE void prefix##_f1(void); INLINE void prefix##_f2(void); INLINE void prefix##_f3(void); \ - INLINE void prefix##_f4(void); INLINE void prefix##_f5(void); INLINE void prefix##_f6(void); INLINE void prefix##_f7(void); \ - INLINE void prefix##_f8(void); INLINE void prefix##_f9(void); INLINE void prefix##_fa(void); INLINE void prefix##_fb(void); \ - INLINE void prefix##_fc(void); INLINE void prefix##_fd(void); INLINE void prefix##_fe(void); INLINE void prefix##_ff(void); \ -static const funcptr tablename[0x100] = { \ - prefix##_00,prefix##_01,prefix##_02,prefix##_03,prefix##_04,prefix##_05,prefix##_06,prefix##_07, \ - prefix##_08,prefix##_09,prefix##_0a,prefix##_0b,prefix##_0c,prefix##_0d,prefix##_0e,prefix##_0f, \ - prefix##_10,prefix##_11,prefix##_12,prefix##_13,prefix##_14,prefix##_15,prefix##_16,prefix##_17, \ - prefix##_18,prefix##_19,prefix##_1a,prefix##_1b,prefix##_1c,prefix##_1d,prefix##_1e,prefix##_1f, \ - prefix##_20,prefix##_21,prefix##_22,prefix##_23,prefix##_24,prefix##_25,prefix##_26,prefix##_27, \ - prefix##_28,prefix##_29,prefix##_2a,prefix##_2b,prefix##_2c,prefix##_2d,prefix##_2e,prefix##_2f, \ - prefix##_30,prefix##_31,prefix##_32,prefix##_33,prefix##_34,prefix##_35,prefix##_36,prefix##_37, \ - prefix##_38,prefix##_39,prefix##_3a,prefix##_3b,prefix##_3c,prefix##_3d,prefix##_3e,prefix##_3f, \ - prefix##_40,prefix##_41,prefix##_42,prefix##_43,prefix##_44,prefix##_45,prefix##_46,prefix##_47, \ - prefix##_48,prefix##_49,prefix##_4a,prefix##_4b,prefix##_4c,prefix##_4d,prefix##_4e,prefix##_4f, \ - prefix##_50,prefix##_51,prefix##_52,prefix##_53,prefix##_54,prefix##_55,prefix##_56,prefix##_57, \ - prefix##_58,prefix##_59,prefix##_5a,prefix##_5b,prefix##_5c,prefix##_5d,prefix##_5e,prefix##_5f, \ - prefix##_60,prefix##_61,prefix##_62,prefix##_63,prefix##_64,prefix##_65,prefix##_66,prefix##_67, \ - prefix##_68,prefix##_69,prefix##_6a,prefix##_6b,prefix##_6c,prefix##_6d,prefix##_6e,prefix##_6f, \ - prefix##_70,prefix##_71,prefix##_72,prefix##_73,prefix##_74,prefix##_75,prefix##_76,prefix##_77, \ - prefix##_78,prefix##_79,prefix##_7a,prefix##_7b,prefix##_7c,prefix##_7d,prefix##_7e,prefix##_7f, \ - prefix##_80,prefix##_81,prefix##_82,prefix##_83,prefix##_84,prefix##_85,prefix##_86,prefix##_87, \ - prefix##_88,prefix##_89,prefix##_8a,prefix##_8b,prefix##_8c,prefix##_8d,prefix##_8e,prefix##_8f, \ - prefix##_90,prefix##_91,prefix##_92,prefix##_93,prefix##_94,prefix##_95,prefix##_96,prefix##_97, \ - prefix##_98,prefix##_99,prefix##_9a,prefix##_9b,prefix##_9c,prefix##_9d,prefix##_9e,prefix##_9f, \ - prefix##_a0,prefix##_a1,prefix##_a2,prefix##_a3,prefix##_a4,prefix##_a5,prefix##_a6,prefix##_a7, \ - prefix##_a8,prefix##_a9,prefix##_aa,prefix##_ab,prefix##_ac,prefix##_ad,prefix##_ae,prefix##_af, \ - prefix##_b0,prefix##_b1,prefix##_b2,prefix##_b3,prefix##_b4,prefix##_b5,prefix##_b6,prefix##_b7, \ - prefix##_b8,prefix##_b9,prefix##_ba,prefix##_bb,prefix##_bc,prefix##_bd,prefix##_be,prefix##_bf, \ - prefix##_c0,prefix##_c1,prefix##_c2,prefix##_c3,prefix##_c4,prefix##_c5,prefix##_c6,prefix##_c7, \ - prefix##_c8,prefix##_c9,prefix##_ca,prefix##_cb,prefix##_cc,prefix##_cd,prefix##_ce,prefix##_cf, \ - prefix##_d0,prefix##_d1,prefix##_d2,prefix##_d3,prefix##_d4,prefix##_d5,prefix##_d6,prefix##_d7, \ - prefix##_d8,prefix##_d9,prefix##_da,prefix##_db,prefix##_dc,prefix##_dd,prefix##_de,prefix##_df, \ - prefix##_e0,prefix##_e1,prefix##_e2,prefix##_e3,prefix##_e4,prefix##_e5,prefix##_e6,prefix##_e7, \ - prefix##_e8,prefix##_e9,prefix##_ea,prefix##_eb,prefix##_ec,prefix##_ed,prefix##_ee,prefix##_ef, \ - prefix##_f0,prefix##_f1,prefix##_f2,prefix##_f3,prefix##_f4,prefix##_f5,prefix##_f6,prefix##_f7, \ - prefix##_f8,prefix##_f9,prefix##_fa,prefix##_fb,prefix##_fc,prefix##_fd,prefix##_fe,prefix##_ff \ + INLINE void prefix##_00(void); INLINE void prefix##_01(void); INLINE void prefix##_02(void); INLINE void prefix##_03(void); \ + INLINE void prefix##_04(void); INLINE void prefix##_05(void); INLINE void prefix##_06(void); INLINE void prefix##_07(void); \ + INLINE void prefix##_08(void); INLINE void prefix##_09(void); INLINE void prefix##_0a(void); INLINE void prefix##_0b(void); \ + INLINE void prefix##_0c(void); INLINE void prefix##_0d(void); INLINE void prefix##_0e(void); INLINE void prefix##_0f(void); \ + INLINE void prefix##_10(void); INLINE void prefix##_11(void); INLINE void prefix##_12(void); INLINE void prefix##_13(void); \ + INLINE void prefix##_14(void); INLINE void prefix##_15(void); INLINE void prefix##_16(void); INLINE void prefix##_17(void); \ + INLINE void prefix##_18(void); INLINE void prefix##_19(void); INLINE void prefix##_1a(void); INLINE void prefix##_1b(void); \ + INLINE void prefix##_1c(void); INLINE void prefix##_1d(void); INLINE void prefix##_1e(void); INLINE void prefix##_1f(void); \ + INLINE void prefix##_20(void); INLINE void prefix##_21(void); INLINE void prefix##_22(void); INLINE void prefix##_23(void); \ + INLINE void prefix##_24(void); INLINE void prefix##_25(void); INLINE void prefix##_26(void); INLINE void prefix##_27(void); \ + INLINE void prefix##_28(void); INLINE void prefix##_29(void); INLINE void prefix##_2a(void); INLINE void prefix##_2b(void); \ + INLINE void prefix##_2c(void); INLINE void prefix##_2d(void); INLINE void prefix##_2e(void); INLINE void prefix##_2f(void); \ + INLINE void prefix##_30(void); INLINE void prefix##_31(void); INLINE void prefix##_32(void); INLINE void prefix##_33(void); \ + INLINE void prefix##_34(void); INLINE void prefix##_35(void); INLINE void prefix##_36(void); INLINE void prefix##_37(void); \ + INLINE void prefix##_38(void); INLINE void prefix##_39(void); INLINE void prefix##_3a(void); INLINE void prefix##_3b(void); \ + INLINE void prefix##_3c(void); INLINE void prefix##_3d(void); INLINE void prefix##_3e(void); INLINE void prefix##_3f(void); \ + INLINE void prefix##_40(void); INLINE void prefix##_41(void); INLINE void prefix##_42(void); INLINE void prefix##_43(void); \ + INLINE void prefix##_44(void); INLINE void prefix##_45(void); INLINE void prefix##_46(void); INLINE void prefix##_47(void); \ + INLINE void prefix##_48(void); INLINE void prefix##_49(void); INLINE void prefix##_4a(void); INLINE void prefix##_4b(void); \ + INLINE void prefix##_4c(void); INLINE void prefix##_4d(void); INLINE void prefix##_4e(void); INLINE void prefix##_4f(void); \ + INLINE void prefix##_50(void); INLINE void prefix##_51(void); INLINE void prefix##_52(void); INLINE void prefix##_53(void); \ + INLINE void prefix##_54(void); INLINE void prefix##_55(void); INLINE void prefix##_56(void); INLINE void prefix##_57(void); \ + INLINE void prefix##_58(void); INLINE void prefix##_59(void); INLINE void prefix##_5a(void); INLINE void prefix##_5b(void); \ + INLINE void prefix##_5c(void); INLINE void prefix##_5d(void); INLINE void prefix##_5e(void); INLINE void prefix##_5f(void); \ + INLINE void prefix##_60(void); INLINE void prefix##_61(void); INLINE void prefix##_62(void); INLINE void prefix##_63(void); \ + INLINE void prefix##_64(void); INLINE void prefix##_65(void); INLINE void prefix##_66(void); INLINE void prefix##_67(void); \ + INLINE void prefix##_68(void); INLINE void prefix##_69(void); INLINE void prefix##_6a(void); INLINE void prefix##_6b(void); \ + INLINE void prefix##_6c(void); INLINE void prefix##_6d(void); INLINE void prefix##_6e(void); INLINE void prefix##_6f(void); \ + INLINE void prefix##_70(void); INLINE void prefix##_71(void); INLINE void prefix##_72(void); INLINE void prefix##_73(void); \ + INLINE void prefix##_74(void); INLINE void prefix##_75(void); INLINE void prefix##_76(void); INLINE void prefix##_77(void); \ + INLINE void prefix##_78(void); INLINE void prefix##_79(void); INLINE void prefix##_7a(void); INLINE void prefix##_7b(void); \ + INLINE void prefix##_7c(void); INLINE void prefix##_7d(void); INLINE void prefix##_7e(void); INLINE void prefix##_7f(void); \ + INLINE void prefix##_80(void); INLINE void prefix##_81(void); INLINE void prefix##_82(void); INLINE void prefix##_83(void); \ + INLINE void prefix##_84(void); INLINE void prefix##_85(void); INLINE void prefix##_86(void); INLINE void prefix##_87(void); \ + INLINE void prefix##_88(void); INLINE void prefix##_89(void); INLINE void prefix##_8a(void); INLINE void prefix##_8b(void); \ + INLINE void prefix##_8c(void); INLINE void prefix##_8d(void); INLINE void prefix##_8e(void); INLINE void prefix##_8f(void); \ + INLINE void prefix##_90(void); INLINE void prefix##_91(void); INLINE void prefix##_92(void); INLINE void prefix##_93(void); \ + INLINE void prefix##_94(void); INLINE void prefix##_95(void); INLINE void prefix##_96(void); INLINE void prefix##_97(void); \ + INLINE void prefix##_98(void); INLINE void prefix##_99(void); INLINE void prefix##_9a(void); INLINE void prefix##_9b(void); \ + INLINE void prefix##_9c(void); INLINE void prefix##_9d(void); INLINE void prefix##_9e(void); INLINE void prefix##_9f(void); \ + INLINE void prefix##_a0(void); INLINE void prefix##_a1(void); INLINE void prefix##_a2(void); INLINE void prefix##_a3(void); \ + INLINE void prefix##_a4(void); INLINE void prefix##_a5(void); INLINE void prefix##_a6(void); INLINE void prefix##_a7(void); \ + INLINE void prefix##_a8(void); INLINE void prefix##_a9(void); INLINE void prefix##_aa(void); INLINE void prefix##_ab(void); \ + INLINE void prefix##_ac(void); INLINE void prefix##_ad(void); INLINE void prefix##_ae(void); INLINE void prefix##_af(void); \ + INLINE void prefix##_b0(void); INLINE void prefix##_b1(void); INLINE void prefix##_b2(void); INLINE void prefix##_b3(void); \ + INLINE void prefix##_b4(void); INLINE void prefix##_b5(void); INLINE void prefix##_b6(void); INLINE void prefix##_b7(void); \ + INLINE void prefix##_b8(void); INLINE void prefix##_b9(void); INLINE void prefix##_ba(void); INLINE void prefix##_bb(void); \ + INLINE void prefix##_bc(void); INLINE void prefix##_bd(void); INLINE void prefix##_be(void); INLINE void prefix##_bf(void); \ + INLINE void prefix##_c0(void); INLINE void prefix##_c1(void); INLINE void prefix##_c2(void); INLINE void prefix##_c3(void); \ + INLINE void prefix##_c4(void); INLINE void prefix##_c5(void); INLINE void prefix##_c6(void); INLINE void prefix##_c7(void); \ + INLINE void prefix##_c8(void); INLINE void prefix##_c9(void); INLINE void prefix##_ca(void); INLINE void prefix##_cb(void); \ + INLINE void prefix##_cc(void); INLINE void prefix##_cd(void); INLINE void prefix##_ce(void); INLINE void prefix##_cf(void); \ + INLINE void prefix##_d0(void); INLINE void prefix##_d1(void); INLINE void prefix##_d2(void); INLINE void prefix##_d3(void); \ + INLINE void prefix##_d4(void); INLINE void prefix##_d5(void); INLINE void prefix##_d6(void); INLINE void prefix##_d7(void); \ + INLINE void prefix##_d8(void); INLINE void prefix##_d9(void); INLINE void prefix##_da(void); INLINE void prefix##_db(void); \ + INLINE void prefix##_dc(void); INLINE void prefix##_dd(void); INLINE void prefix##_de(void); INLINE void prefix##_df(void); \ + INLINE void prefix##_e0(void); INLINE void prefix##_e1(void); INLINE void prefix##_e2(void); INLINE void prefix##_e3(void); \ + INLINE void prefix##_e4(void); INLINE void prefix##_e5(void); INLINE void prefix##_e6(void); INLINE void prefix##_e7(void); \ + INLINE void prefix##_e8(void); INLINE void prefix##_e9(void); INLINE void prefix##_ea(void); INLINE void prefix##_eb(void); \ + INLINE void prefix##_ec(void); INLINE void prefix##_ed(void); INLINE void prefix##_ee(void); INLINE void prefix##_ef(void); \ + INLINE void prefix##_f0(void); INLINE void prefix##_f1(void); INLINE void prefix##_f2(void); INLINE void prefix##_f3(void); \ + INLINE void prefix##_f4(void); INLINE void prefix##_f5(void); INLINE void prefix##_f6(void); INLINE void prefix##_f7(void); \ + INLINE void prefix##_f8(void); INLINE void prefix##_f9(void); INLINE void prefix##_fa(void); INLINE void prefix##_fb(void); \ + INLINE void prefix##_fc(void); INLINE void prefix##_fd(void); INLINE void prefix##_fe(void); INLINE void prefix##_ff(void); \ +static const funcptr tablename[0x100] = { \ + prefix##_00,prefix##_01,prefix##_02,prefix##_03,prefix##_04,prefix##_05,prefix##_06,prefix##_07, \ + prefix##_08,prefix##_09,prefix##_0a,prefix##_0b,prefix##_0c,prefix##_0d,prefix##_0e,prefix##_0f, \ + prefix##_10,prefix##_11,prefix##_12,prefix##_13,prefix##_14,prefix##_15,prefix##_16,prefix##_17, \ + prefix##_18,prefix##_19,prefix##_1a,prefix##_1b,prefix##_1c,prefix##_1d,prefix##_1e,prefix##_1f, \ + prefix##_20,prefix##_21,prefix##_22,prefix##_23,prefix##_24,prefix##_25,prefix##_26,prefix##_27, \ + prefix##_28,prefix##_29,prefix##_2a,prefix##_2b,prefix##_2c,prefix##_2d,prefix##_2e,prefix##_2f, \ + prefix##_30,prefix##_31,prefix##_32,prefix##_33,prefix##_34,prefix##_35,prefix##_36,prefix##_37, \ + prefix##_38,prefix##_39,prefix##_3a,prefix##_3b,prefix##_3c,prefix##_3d,prefix##_3e,prefix##_3f, \ + prefix##_40,prefix##_41,prefix##_42,prefix##_43,prefix##_44,prefix##_45,prefix##_46,prefix##_47, \ + prefix##_48,prefix##_49,prefix##_4a,prefix##_4b,prefix##_4c,prefix##_4d,prefix##_4e,prefix##_4f, \ + prefix##_50,prefix##_51,prefix##_52,prefix##_53,prefix##_54,prefix##_55,prefix##_56,prefix##_57, \ + prefix##_58,prefix##_59,prefix##_5a,prefix##_5b,prefix##_5c,prefix##_5d,prefix##_5e,prefix##_5f, \ + prefix##_60,prefix##_61,prefix##_62,prefix##_63,prefix##_64,prefix##_65,prefix##_66,prefix##_67, \ + prefix##_68,prefix##_69,prefix##_6a,prefix##_6b,prefix##_6c,prefix##_6d,prefix##_6e,prefix##_6f, \ + prefix##_70,prefix##_71,prefix##_72,prefix##_73,prefix##_74,prefix##_75,prefix##_76,prefix##_77, \ + prefix##_78,prefix##_79,prefix##_7a,prefix##_7b,prefix##_7c,prefix##_7d,prefix##_7e,prefix##_7f, \ + prefix##_80,prefix##_81,prefix##_82,prefix##_83,prefix##_84,prefix##_85,prefix##_86,prefix##_87, \ + prefix##_88,prefix##_89,prefix##_8a,prefix##_8b,prefix##_8c,prefix##_8d,prefix##_8e,prefix##_8f, \ + prefix##_90,prefix##_91,prefix##_92,prefix##_93,prefix##_94,prefix##_95,prefix##_96,prefix##_97, \ + prefix##_98,prefix##_99,prefix##_9a,prefix##_9b,prefix##_9c,prefix##_9d,prefix##_9e,prefix##_9f, \ + prefix##_a0,prefix##_a1,prefix##_a2,prefix##_a3,prefix##_a4,prefix##_a5,prefix##_a6,prefix##_a7, \ + prefix##_a8,prefix##_a9,prefix##_aa,prefix##_ab,prefix##_ac,prefix##_ad,prefix##_ae,prefix##_af, \ + prefix##_b0,prefix##_b1,prefix##_b2,prefix##_b3,prefix##_b4,prefix##_b5,prefix##_b6,prefix##_b7, \ + prefix##_b8,prefix##_b9,prefix##_ba,prefix##_bb,prefix##_bc,prefix##_bd,prefix##_be,prefix##_bf, \ + prefix##_c0,prefix##_c1,prefix##_c2,prefix##_c3,prefix##_c4,prefix##_c5,prefix##_c6,prefix##_c7, \ + prefix##_c8,prefix##_c9,prefix##_ca,prefix##_cb,prefix##_cc,prefix##_cd,prefix##_ce,prefix##_cf, \ + prefix##_d0,prefix##_d1,prefix##_d2,prefix##_d3,prefix##_d4,prefix##_d5,prefix##_d6,prefix##_d7, \ + prefix##_d8,prefix##_d9,prefix##_da,prefix##_db,prefix##_dc,prefix##_dd,prefix##_de,prefix##_df, \ + prefix##_e0,prefix##_e1,prefix##_e2,prefix##_e3,prefix##_e4,prefix##_e5,prefix##_e6,prefix##_e7, \ + prefix##_e8,prefix##_e9,prefix##_ea,prefix##_eb,prefix##_ec,prefix##_ed,prefix##_ee,prefix##_ef, \ + prefix##_f0,prefix##_f1,prefix##_f2,prefix##_f3,prefix##_f4,prefix##_f5,prefix##_f6,prefix##_f7, \ + prefix##_f8,prefix##_f9,prefix##_fa,prefix##_fb,prefix##_fc,prefix##_fd,prefix##_fe,prefix##_ff \ } PROTOTYPES(Z80op,op); @@ -416,16 +416,16 @@ PROTOTYPES(Z80fd,fd); PROTOTYPES(Z80xycb,xycb); /****************************************************************************/ -/* Burn an odd amount of cycles, that is instructions taking something */ -/* different from 4 T-states per opcode (and R increment) */ +/* Burn an odd amount of cycles, that is instructions taking something */ +/* different from 4 T-states per opcode (and R increment) */ /****************************************************************************/ INLINE void BURNODD(int cycles, int opcodes, int cyclesum) { - if( cycles > 0 ) - { - R += (cycles / cyclesum) * opcodes; - z80_ICount -= (cycles / cyclesum) * cyclesum; - } + if( cycles > 0 ) + { + R += (cycles / cyclesum) * opcodes; + z80_ICount -= (cycles / cyclesum) * cyclesum; + } } /*************************************************************** @@ -441,85 +441,85 @@ INLINE void BURNODD(int cycles, int opcodes, int cyclesum) /*************************************************************** * execute an opcode ***************************************************************/ -#define EXEC(prefix,opcode) \ -{ \ - unsigned op = opcode; \ - (*Z80##prefix[op])(); \ - CC(prefix,op); \ +#define EXEC(prefix,opcode) \ +{ \ + unsigned op = opcode; \ + (*Z80##prefix[op])(); \ + CC(prefix,op); \ } #if BIG_SWITCH -#define EXEC_INLINE(prefix,opcode) \ -{ \ - unsigned op = opcode; \ - switch(op) \ - { \ - case 0x00:prefix##_##00();break; case 0x01:prefix##_##01();break; case 0x02:prefix##_##02();break; case 0x03:prefix##_##03();break; \ - case 0x04:prefix##_##04();break; case 0x05:prefix##_##05();break; case 0x06:prefix##_##06();break; case 0x07:prefix##_##07();break; \ - case 0x08:prefix##_##08();break; case 0x09:prefix##_##09();break; case 0x0a:prefix##_##0a();break; case 0x0b:prefix##_##0b();break; \ - case 0x0c:prefix##_##0c();break; case 0x0d:prefix##_##0d();break; case 0x0e:prefix##_##0e();break; case 0x0f:prefix##_##0f();break; \ - case 0x10:prefix##_##10();break; case 0x11:prefix##_##11();break; case 0x12:prefix##_##12();break; case 0x13:prefix##_##13();break; \ - case 0x14:prefix##_##14();break; case 0x15:prefix##_##15();break; case 0x16:prefix##_##16();break; case 0x17:prefix##_##17();break; \ - case 0x18:prefix##_##18();break; case 0x19:prefix##_##19();break; case 0x1a:prefix##_##1a();break; case 0x1b:prefix##_##1b();break; \ - case 0x1c:prefix##_##1c();break; case 0x1d:prefix##_##1d();break; case 0x1e:prefix##_##1e();break; case 0x1f:prefix##_##1f();break; \ - case 0x20:prefix##_##20();break; case 0x21:prefix##_##21();break; case 0x22:prefix##_##22();break; case 0x23:prefix##_##23();break; \ - case 0x24:prefix##_##24();break; case 0x25:prefix##_##25();break; case 0x26:prefix##_##26();break; case 0x27:prefix##_##27();break; \ - case 0x28:prefix##_##28();break; case 0x29:prefix##_##29();break; case 0x2a:prefix##_##2a();break; case 0x2b:prefix##_##2b();break; \ - case 0x2c:prefix##_##2c();break; case 0x2d:prefix##_##2d();break; case 0x2e:prefix##_##2e();break; case 0x2f:prefix##_##2f();break; \ - case 0x30:prefix##_##30();break; case 0x31:prefix##_##31();break; case 0x32:prefix##_##32();break; case 0x33:prefix##_##33();break; \ - case 0x34:prefix##_##34();break; case 0x35:prefix##_##35();break; case 0x36:prefix##_##36();break; case 0x37:prefix##_##37();break; \ - case 0x38:prefix##_##38();break; case 0x39:prefix##_##39();break; case 0x3a:prefix##_##3a();break; case 0x3b:prefix##_##3b();break; \ - case 0x3c:prefix##_##3c();break; case 0x3d:prefix##_##3d();break; case 0x3e:prefix##_##3e();break; case 0x3f:prefix##_##3f();break; \ - case 0x40:prefix##_##40();break; case 0x41:prefix##_##41();break; case 0x42:prefix##_##42();break; case 0x43:prefix##_##43();break; \ - case 0x44:prefix##_##44();break; case 0x45:prefix##_##45();break; case 0x46:prefix##_##46();break; case 0x47:prefix##_##47();break; \ - case 0x48:prefix##_##48();break; case 0x49:prefix##_##49();break; case 0x4a:prefix##_##4a();break; case 0x4b:prefix##_##4b();break; \ - case 0x4c:prefix##_##4c();break; case 0x4d:prefix##_##4d();break; case 0x4e:prefix##_##4e();break; case 0x4f:prefix##_##4f();break; \ - case 0x50:prefix##_##50();break; case 0x51:prefix##_##51();break; case 0x52:prefix##_##52();break; case 0x53:prefix##_##53();break; \ - case 0x54:prefix##_##54();break; case 0x55:prefix##_##55();break; case 0x56:prefix##_##56();break; case 0x57:prefix##_##57();break; \ - case 0x58:prefix##_##58();break; case 0x59:prefix##_##59();break; case 0x5a:prefix##_##5a();break; case 0x5b:prefix##_##5b();break; \ - case 0x5c:prefix##_##5c();break; case 0x5d:prefix##_##5d();break; case 0x5e:prefix##_##5e();break; case 0x5f:prefix##_##5f();break; \ - case 0x60:prefix##_##60();break; case 0x61:prefix##_##61();break; case 0x62:prefix##_##62();break; case 0x63:prefix##_##63();break; \ - case 0x64:prefix##_##64();break; case 0x65:prefix##_##65();break; case 0x66:prefix##_##66();break; case 0x67:prefix##_##67();break; \ - case 0x68:prefix##_##68();break; case 0x69:prefix##_##69();break; case 0x6a:prefix##_##6a();break; case 0x6b:prefix##_##6b();break; \ - case 0x6c:prefix##_##6c();break; case 0x6d:prefix##_##6d();break; case 0x6e:prefix##_##6e();break; case 0x6f:prefix##_##6f();break; \ - case 0x70:prefix##_##70();break; case 0x71:prefix##_##71();break; case 0x72:prefix##_##72();break; case 0x73:prefix##_##73();break; \ - case 0x74:prefix##_##74();break; case 0x75:prefix##_##75();break; case 0x76:prefix##_##76();break; case 0x77:prefix##_##77();break; \ - case 0x78:prefix##_##78();break; case 0x79:prefix##_##79();break; case 0x7a:prefix##_##7a();break; case 0x7b:prefix##_##7b();break; \ - case 0x7c:prefix##_##7c();break; case 0x7d:prefix##_##7d();break; case 0x7e:prefix##_##7e();break; case 0x7f:prefix##_##7f();break; \ - case 0x80:prefix##_##80();break; case 0x81:prefix##_##81();break; case 0x82:prefix##_##82();break; case 0x83:prefix##_##83();break; \ - case 0x84:prefix##_##84();break; case 0x85:prefix##_##85();break; case 0x86:prefix##_##86();break; case 0x87:prefix##_##87();break; \ - case 0x88:prefix##_##88();break; case 0x89:prefix##_##89();break; case 0x8a:prefix##_##8a();break; case 0x8b:prefix##_##8b();break; \ - case 0x8c:prefix##_##8c();break; case 0x8d:prefix##_##8d();break; case 0x8e:prefix##_##8e();break; case 0x8f:prefix##_##8f();break; \ - case 0x90:prefix##_##90();break; case 0x91:prefix##_##91();break; case 0x92:prefix##_##92();break; case 0x93:prefix##_##93();break; \ - case 0x94:prefix##_##94();break; case 0x95:prefix##_##95();break; case 0x96:prefix##_##96();break; case 0x97:prefix##_##97();break; \ - case 0x98:prefix##_##98();break; case 0x99:prefix##_##99();break; case 0x9a:prefix##_##9a();break; case 0x9b:prefix##_##9b();break; \ - case 0x9c:prefix##_##9c();break; case 0x9d:prefix##_##9d();break; case 0x9e:prefix##_##9e();break; case 0x9f:prefix##_##9f();break; \ - case 0xa0:prefix##_##a0();break; case 0xa1:prefix##_##a1();break; case 0xa2:prefix##_##a2();break; case 0xa3:prefix##_##a3();break; \ - case 0xa4:prefix##_##a4();break; case 0xa5:prefix##_##a5();break; case 0xa6:prefix##_##a6();break; case 0xa7:prefix##_##a7();break; \ - case 0xa8:prefix##_##a8();break; case 0xa9:prefix##_##a9();break; case 0xaa:prefix##_##aa();break; case 0xab:prefix##_##ab();break; \ - case 0xac:prefix##_##ac();break; case 0xad:prefix##_##ad();break; case 0xae:prefix##_##ae();break; case 0xaf:prefix##_##af();break; \ - case 0xb0:prefix##_##b0();break; case 0xb1:prefix##_##b1();break; case 0xb2:prefix##_##b2();break; case 0xb3:prefix##_##b3();break; \ - case 0xb4:prefix##_##b4();break; case 0xb5:prefix##_##b5();break; case 0xb6:prefix##_##b6();break; case 0xb7:prefix##_##b7();break; \ - case 0xb8:prefix##_##b8();break; case 0xb9:prefix##_##b9();break; case 0xba:prefix##_##ba();break; case 0xbb:prefix##_##bb();break; \ - case 0xbc:prefix##_##bc();break; case 0xbd:prefix##_##bd();break; case 0xbe:prefix##_##be();break; case 0xbf:prefix##_##bf();break; \ - case 0xc0:prefix##_##c0();break; case 0xc1:prefix##_##c1();break; case 0xc2:prefix##_##c2();break; case 0xc3:prefix##_##c3();break; \ - case 0xc4:prefix##_##c4();break; case 0xc5:prefix##_##c5();break; case 0xc6:prefix##_##c6();break; case 0xc7:prefix##_##c7();break; \ - case 0xc8:prefix##_##c8();break; case 0xc9:prefix##_##c9();break; case 0xca:prefix##_##ca();break; case 0xcb:prefix##_##cb();break; \ - case 0xcc:prefix##_##cc();break; case 0xcd:prefix##_##cd();break; case 0xce:prefix##_##ce();break; case 0xcf:prefix##_##cf();break; \ - case 0xd0:prefix##_##d0();break; case 0xd1:prefix##_##d1();break; case 0xd2:prefix##_##d2();break; case 0xd3:prefix##_##d3();break; \ - case 0xd4:prefix##_##d4();break; case 0xd5:prefix##_##d5();break; case 0xd6:prefix##_##d6();break; case 0xd7:prefix##_##d7();break; \ - case 0xd8:prefix##_##d8();break; case 0xd9:prefix##_##d9();break; case 0xda:prefix##_##da();break; case 0xdb:prefix##_##db();break; \ - case 0xdc:prefix##_##dc();break; case 0xdd:prefix##_##dd();break; case 0xde:prefix##_##de();break; case 0xdf:prefix##_##df();break; \ - case 0xe0:prefix##_##e0();break; case 0xe1:prefix##_##e1();break; case 0xe2:prefix##_##e2();break; case 0xe3:prefix##_##e3();break; \ - case 0xe4:prefix##_##e4();break; case 0xe5:prefix##_##e5();break; case 0xe6:prefix##_##e6();break; case 0xe7:prefix##_##e7();break; \ - case 0xe8:prefix##_##e8();break; case 0xe9:prefix##_##e9();break; case 0xea:prefix##_##ea();break; case 0xeb:prefix##_##eb();break; \ - case 0xec:prefix##_##ec();break; case 0xed:prefix##_##ed();break; case 0xee:prefix##_##ee();break; case 0xef:prefix##_##ef();break; \ - case 0xf0:prefix##_##f0();break; case 0xf1:prefix##_##f1();break; case 0xf2:prefix##_##f2();break; case 0xf3:prefix##_##f3();break; \ - case 0xf4:prefix##_##f4();break; case 0xf5:prefix##_##f5();break; case 0xf6:prefix##_##f6();break; case 0xf7:prefix##_##f7();break; \ - case 0xf8:prefix##_##f8();break; case 0xf9:prefix##_##f9();break; case 0xfa:prefix##_##fa();break; case 0xfb:prefix##_##fb();break; \ - case 0xfc:prefix##_##fc();break; case 0xfd:prefix##_##fd();break; case 0xfe:prefix##_##fe();break; case 0xff:prefix##_##ff();break; \ - } \ - CC(prefix,op); \ +#define EXEC_INLINE(prefix,opcode) \ +{ \ + unsigned op = opcode; \ + switch(op) \ + { \ + case 0x00:prefix##_##00();break; case 0x01:prefix##_##01();break; case 0x02:prefix##_##02();break; case 0x03:prefix##_##03();break; \ + case 0x04:prefix##_##04();break; case 0x05:prefix##_##05();break; case 0x06:prefix##_##06();break; case 0x07:prefix##_##07();break; \ + case 0x08:prefix##_##08();break; case 0x09:prefix##_##09();break; case 0x0a:prefix##_##0a();break; case 0x0b:prefix##_##0b();break; \ + case 0x0c:prefix##_##0c();break; case 0x0d:prefix##_##0d();break; case 0x0e:prefix##_##0e();break; case 0x0f:prefix##_##0f();break; \ + case 0x10:prefix##_##10();break; case 0x11:prefix##_##11();break; case 0x12:prefix##_##12();break; case 0x13:prefix##_##13();break; \ + case 0x14:prefix##_##14();break; case 0x15:prefix##_##15();break; case 0x16:prefix##_##16();break; case 0x17:prefix##_##17();break; \ + case 0x18:prefix##_##18();break; case 0x19:prefix##_##19();break; case 0x1a:prefix##_##1a();break; case 0x1b:prefix##_##1b();break; \ + case 0x1c:prefix##_##1c();break; case 0x1d:prefix##_##1d();break; case 0x1e:prefix##_##1e();break; case 0x1f:prefix##_##1f();break; \ + case 0x20:prefix##_##20();break; case 0x21:prefix##_##21();break; case 0x22:prefix##_##22();break; case 0x23:prefix##_##23();break; \ + case 0x24:prefix##_##24();break; case 0x25:prefix##_##25();break; case 0x26:prefix##_##26();break; case 0x27:prefix##_##27();break; \ + case 0x28:prefix##_##28();break; case 0x29:prefix##_##29();break; case 0x2a:prefix##_##2a();break; case 0x2b:prefix##_##2b();break; \ + case 0x2c:prefix##_##2c();break; case 0x2d:prefix##_##2d();break; case 0x2e:prefix##_##2e();break; case 0x2f:prefix##_##2f();break; \ + case 0x30:prefix##_##30();break; case 0x31:prefix##_##31();break; case 0x32:prefix##_##32();break; case 0x33:prefix##_##33();break; \ + case 0x34:prefix##_##34();break; case 0x35:prefix##_##35();break; case 0x36:prefix##_##36();break; case 0x37:prefix##_##37();break; \ + case 0x38:prefix##_##38();break; case 0x39:prefix##_##39();break; case 0x3a:prefix##_##3a();break; case 0x3b:prefix##_##3b();break; \ + case 0x3c:prefix##_##3c();break; case 0x3d:prefix##_##3d();break; case 0x3e:prefix##_##3e();break; case 0x3f:prefix##_##3f();break; \ + case 0x40:prefix##_##40();break; case 0x41:prefix##_##41();break; case 0x42:prefix##_##42();break; case 0x43:prefix##_##43();break; \ + case 0x44:prefix##_##44();break; case 0x45:prefix##_##45();break; case 0x46:prefix##_##46();break; case 0x47:prefix##_##47();break; \ + case 0x48:prefix##_##48();break; case 0x49:prefix##_##49();break; case 0x4a:prefix##_##4a();break; case 0x4b:prefix##_##4b();break; \ + case 0x4c:prefix##_##4c();break; case 0x4d:prefix##_##4d();break; case 0x4e:prefix##_##4e();break; case 0x4f:prefix##_##4f();break; \ + case 0x50:prefix##_##50();break; case 0x51:prefix##_##51();break; case 0x52:prefix##_##52();break; case 0x53:prefix##_##53();break; \ + case 0x54:prefix##_##54();break; case 0x55:prefix##_##55();break; case 0x56:prefix##_##56();break; case 0x57:prefix##_##57();break; \ + case 0x58:prefix##_##58();break; case 0x59:prefix##_##59();break; case 0x5a:prefix##_##5a();break; case 0x5b:prefix##_##5b();break; \ + case 0x5c:prefix##_##5c();break; case 0x5d:prefix##_##5d();break; case 0x5e:prefix##_##5e();break; case 0x5f:prefix##_##5f();break; \ + case 0x60:prefix##_##60();break; case 0x61:prefix##_##61();break; case 0x62:prefix##_##62();break; case 0x63:prefix##_##63();break; \ + case 0x64:prefix##_##64();break; case 0x65:prefix##_##65();break; case 0x66:prefix##_##66();break; case 0x67:prefix##_##67();break; \ + case 0x68:prefix##_##68();break; case 0x69:prefix##_##69();break; case 0x6a:prefix##_##6a();break; case 0x6b:prefix##_##6b();break; \ + case 0x6c:prefix##_##6c();break; case 0x6d:prefix##_##6d();break; case 0x6e:prefix##_##6e();break; case 0x6f:prefix##_##6f();break; \ + case 0x70:prefix##_##70();break; case 0x71:prefix##_##71();break; case 0x72:prefix##_##72();break; case 0x73:prefix##_##73();break; \ + case 0x74:prefix##_##74();break; case 0x75:prefix##_##75();break; case 0x76:prefix##_##76();break; case 0x77:prefix##_##77();break; \ + case 0x78:prefix##_##78();break; case 0x79:prefix##_##79();break; case 0x7a:prefix##_##7a();break; case 0x7b:prefix##_##7b();break; \ + case 0x7c:prefix##_##7c();break; case 0x7d:prefix##_##7d();break; case 0x7e:prefix##_##7e();break; case 0x7f:prefix##_##7f();break; \ + case 0x80:prefix##_##80();break; case 0x81:prefix##_##81();break; case 0x82:prefix##_##82();break; case 0x83:prefix##_##83();break; \ + case 0x84:prefix##_##84();break; case 0x85:prefix##_##85();break; case 0x86:prefix##_##86();break; case 0x87:prefix##_##87();break; \ + case 0x88:prefix##_##88();break; case 0x89:prefix##_##89();break; case 0x8a:prefix##_##8a();break; case 0x8b:prefix##_##8b();break; \ + case 0x8c:prefix##_##8c();break; case 0x8d:prefix##_##8d();break; case 0x8e:prefix##_##8e();break; case 0x8f:prefix##_##8f();break; \ + case 0x90:prefix##_##90();break; case 0x91:prefix##_##91();break; case 0x92:prefix##_##92();break; case 0x93:prefix##_##93();break; \ + case 0x94:prefix##_##94();break; case 0x95:prefix##_##95();break; case 0x96:prefix##_##96();break; case 0x97:prefix##_##97();break; \ + case 0x98:prefix##_##98();break; case 0x99:prefix##_##99();break; case 0x9a:prefix##_##9a();break; case 0x9b:prefix##_##9b();break; \ + case 0x9c:prefix##_##9c();break; case 0x9d:prefix##_##9d();break; case 0x9e:prefix##_##9e();break; case 0x9f:prefix##_##9f();break; \ + case 0xa0:prefix##_##a0();break; case 0xa1:prefix##_##a1();break; case 0xa2:prefix##_##a2();break; case 0xa3:prefix##_##a3();break; \ + case 0xa4:prefix##_##a4();break; case 0xa5:prefix##_##a5();break; case 0xa6:prefix##_##a6();break; case 0xa7:prefix##_##a7();break; \ + case 0xa8:prefix##_##a8();break; case 0xa9:prefix##_##a9();break; case 0xaa:prefix##_##aa();break; case 0xab:prefix##_##ab();break; \ + case 0xac:prefix##_##ac();break; case 0xad:prefix##_##ad();break; case 0xae:prefix##_##ae();break; case 0xaf:prefix##_##af();break; \ + case 0xb0:prefix##_##b0();break; case 0xb1:prefix##_##b1();break; case 0xb2:prefix##_##b2();break; case 0xb3:prefix##_##b3();break; \ + case 0xb4:prefix##_##b4();break; case 0xb5:prefix##_##b5();break; case 0xb6:prefix##_##b6();break; case 0xb7:prefix##_##b7();break; \ + case 0xb8:prefix##_##b8();break; case 0xb9:prefix##_##b9();break; case 0xba:prefix##_##ba();break; case 0xbb:prefix##_##bb();break; \ + case 0xbc:prefix##_##bc();break; case 0xbd:prefix##_##bd();break; case 0xbe:prefix##_##be();break; case 0xbf:prefix##_##bf();break; \ + case 0xc0:prefix##_##c0();break; case 0xc1:prefix##_##c1();break; case 0xc2:prefix##_##c2();break; case 0xc3:prefix##_##c3();break; \ + case 0xc4:prefix##_##c4();break; case 0xc5:prefix##_##c5();break; case 0xc6:prefix##_##c6();break; case 0xc7:prefix##_##c7();break; \ + case 0xc8:prefix##_##c8();break; case 0xc9:prefix##_##c9();break; case 0xca:prefix##_##ca();break; case 0xcb:prefix##_##cb();break; \ + case 0xcc:prefix##_##cc();break; case 0xcd:prefix##_##cd();break; case 0xce:prefix##_##ce();break; case 0xcf:prefix##_##cf();break; \ + case 0xd0:prefix##_##d0();break; case 0xd1:prefix##_##d1();break; case 0xd2:prefix##_##d2();break; case 0xd3:prefix##_##d3();break; \ + case 0xd4:prefix##_##d4();break; case 0xd5:prefix##_##d5();break; case 0xd6:prefix##_##d6();break; case 0xd7:prefix##_##d7();break; \ + case 0xd8:prefix##_##d8();break; case 0xd9:prefix##_##d9();break; case 0xda:prefix##_##da();break; case 0xdb:prefix##_##db();break; \ + case 0xdc:prefix##_##dc();break; case 0xdd:prefix##_##dd();break; case 0xde:prefix##_##de();break; case 0xdf:prefix##_##df();break; \ + case 0xe0:prefix##_##e0();break; case 0xe1:prefix##_##e1();break; case 0xe2:prefix##_##e2();break; case 0xe3:prefix##_##e3();break; \ + case 0xe4:prefix##_##e4();break; case 0xe5:prefix##_##e5();break; case 0xe6:prefix##_##e6();break; case 0xe7:prefix##_##e7();break; \ + case 0xe8:prefix##_##e8();break; case 0xe9:prefix##_##e9();break; case 0xea:prefix##_##ea();break; case 0xeb:prefix##_##eb();break; \ + case 0xec:prefix##_##ec();break; case 0xed:prefix##_##ed();break; case 0xee:prefix##_##ee();break; case 0xef:prefix##_##ef();break; \ + case 0xf0:prefix##_##f0();break; case 0xf1:prefix##_##f1();break; case 0xf2:prefix##_##f2();break; case 0xf3:prefix##_##f3();break; \ + case 0xf4:prefix##_##f4();break; case 0xf5:prefix##_##f5();break; case 0xf6:prefix##_##f6();break; case 0xf7:prefix##_##f7();break; \ + case 0xf8:prefix##_##f8();break; case 0xf9:prefix##_##f9();break; case 0xfa:prefix##_##fa();break; case 0xfb:prefix##_##fb();break; \ + case 0xfc:prefix##_##fc();break; case 0xfd:prefix##_##fd();break; case 0xfe:prefix##_##fe();break; case 0xff:prefix##_##ff();break; \ + } \ + CC(prefix,op); \ } #else #define EXEC_INLINE EXEC @@ -529,22 +529,22 @@ INLINE void BURNODD(int cycles, int opcodes, int cyclesum) /*************************************************************** * Enter HALT state; write 1 to fake port on first execution ***************************************************************/ -#define ENTER_HALT { \ - PC--; \ - HALT = 1; \ - if( Z80.irq_state == CLEAR_LINE ) \ - z80_burn( z80_ICount ); \ +#define ENTER_HALT { \ + PC--; \ + HALT = 1; \ + if( Z80.irq_state == CLEAR_LINE ) \ + z80_burn( z80_ICount ); \ } /*************************************************************** * Leave HALT state; write 0 to fake port ***************************************************************/ -#define LEAVE_HALT { \ - if( HALT ) \ - { \ - HALT = 0; \ - PC++; \ - } \ +#define LEAVE_HALT { \ + if( HALT ) \ + { \ + HALT = 0; \ + PC++; \ + } \ } /*************************************************************** @@ -567,8 +567,8 @@ INLINE void BURNODD(int cycles, int opcodes, int cyclesum) ***************************************************************/ INLINE void RM16( UINT32 addr, PAIR *r ) { - r->b.l = RM(addr); - r->b.h = RM((addr+1)&0xffff); + r->b.l = RM(addr); + r->b.h = RM((addr+1)&0xffff); } /*************************************************************** @@ -581,8 +581,8 @@ INLINE void RM16( UINT32 addr, PAIR *r ) ***************************************************************/ INLINE void WM16( UINT32 addr, PAIR *r ) { - WM(addr,r->b.l); - WM((addr+1)&0xffff,r->b.h); + WM(addr,r->b.l); + WM((addr+1)&0xffff,r->b.h); } /*************************************************************** @@ -592,9 +592,9 @@ INLINE void WM16( UINT32 addr, PAIR *r ) ***************************************************************/ INLINE UINT8 ROP(void) { - unsigned pc = PCD; - PC++; - return cpu_readop(pc); + unsigned pc = PCD; + PC++; + return cpu_readop(pc); } /**************************************************************** @@ -605,16 +605,16 @@ INLINE UINT8 ROP(void) ***************************************************************/ INLINE UINT8 ARG(void) { - unsigned pc = PCD; - PC++; - return cpu_readop_arg(pc); + unsigned pc = PCD; + PC++; + return cpu_readop_arg(pc); } INLINE UINT32 ARG16(void) { - unsigned pc = PCD; - PC += 2; - return cpu_readop_arg(pc) | (cpu_readop_arg((pc+1)&0xffff) << 8); + unsigned pc = PCD; + PC += 2; + return cpu_readop_arg(pc) | (cpu_readop_arg((pc+1)&0xffff) << 8); } /*************************************************************** @@ -638,43 +638,43 @@ INLINE UINT32 ARG16(void) * JP ***************************************************************/ #if BUSY_LOOP_HACKS -#define JP { \ - unsigned oldpc = PCD-1; \ - PCD = ARG16(); \ - change_pc(PCD); \ - /* speed up busy loop */ \ - if( PCD == oldpc ) \ - { \ - if( Z80.irq_state == CLEAR_LINE ) \ - BURNODD( z80_ICount, 1, cc[Z80_TABLE_op][0xc3] ); \ - } \ - else \ - { \ - UINT8 op = cpu_readop(PCD); \ - if( PCD == oldpc-1 ) \ - { \ - /* NOP - JP $-1 or EI - JP $-1 */ \ - if ( op == 0x00 || op == 0xfb ) \ - { \ - if( Z80.irq_state == CLEAR_LINE ) \ - BURNODD( z80_ICount-cc[Z80_TABLE_op][0x00], \ - 2, cc[Z80_TABLE_op][0x00]+cc[Z80_TABLE_op][0xc3]); \ - } \ - } \ - else \ - /* LD SP,#xxxx - JP $-3 (Galaga) */ \ - if( PCD == oldpc-3 && op == 0x31 ) \ - { \ - if( Z80.irq_state == CLEAR_LINE ) \ - BURNODD( z80_ICount-cc[Z80_TABLE_op][0x31], \ - 2, cc[Z80_TABLE_op][0x31]+cc[Z80_TABLE_op][0xc3]); \ - } \ - } \ +#define JP { \ + unsigned oldpc = PCD-1; \ + PCD = ARG16(); \ + change_pc(PCD); \ + /* speed up busy loop */ \ + if( PCD == oldpc ) \ + { \ + if( Z80.irq_state == CLEAR_LINE ) \ + BURNODD( z80_ICount, 1, cc[Z80_TABLE_op][0xc3] ); \ + } \ + else \ + { \ + UINT8 op = cpu_readop(PCD); \ + if( PCD == oldpc-1 ) \ + { \ + /* NOP - JP $-1 or EI - JP $-1 */ \ + if ( op == 0x00 || op == 0xfb ) \ + { \ + if( Z80.irq_state == CLEAR_LINE ) \ + BURNODD( z80_ICount-cc[Z80_TABLE_op][0x00], \ + 2, cc[Z80_TABLE_op][0x00]+cc[Z80_TABLE_op][0xc3]); \ + } \ + } \ + else \ + /* LD SP,#xxxx - JP $-3 (Galaga) */ \ + if( PCD == oldpc-3 && op == 0x31 ) \ + { \ + if( Z80.irq_state == CLEAR_LINE ) \ + BURNODD( z80_ICount-cc[Z80_TABLE_op][0x31], \ + 2, cc[Z80_TABLE_op][0x31]+cc[Z80_TABLE_op][0xc3]); \ + } \ + } \ } #else -#define JP { \ - PCD = ARG16(); \ - change_pc(PCD); \ +#define JP { \ + PCD = ARG16(); \ + change_pc(PCD); \ } #endif @@ -682,2676 +682,2676 @@ INLINE UINT32 ARG16(void) * JP_COND ***************************************************************/ -#define JP_COND(cond) \ - if( cond ) \ - { \ - PCD = ARG16(); \ - change_pc(PCD); \ - } \ - else \ - { \ - PC += 2; \ - } +#define JP_COND(cond) \ + if( cond ) \ + { \ + PCD = ARG16(); \ + change_pc(PCD); \ + } \ + else \ + { \ + PC += 2; \ + } /*************************************************************** * JR ***************************************************************/ -#define JR() \ -{ \ - unsigned oldpc = PCD-1; \ - INT8 arg = (INT8)ARG(); /* ARG() also increments PC */ \ - PC += arg; /* so don't do PC += ARG() */ \ - change_pc(PCD); \ - /* speed up busy loop */ \ - if( PCD == oldpc ) \ - { \ - if( Z80.irq_state == CLEAR_LINE ) \ - BURNODD( z80_ICount, 1, cc[Z80_TABLE_op][0x18] ); \ - } \ - else \ - { \ - UINT8 op = cpu_readop(PCD); \ - if( PCD == oldpc-1 ) \ - { \ - /* NOP - JR $-1 or EI - JR $-1 */ \ - if ( op == 0x00 || op == 0xfb ) \ - { \ - if( Z80.irq_state == CLEAR_LINE ) \ - BURNODD( z80_ICount-cc[Z80_TABLE_op][0x00], \ - 2, cc[Z80_TABLE_op][0x00]+cc[Z80_TABLE_op][0x18]); \ - } \ - } \ - else \ - /* LD SP,#xxxx - JR $-3 */ \ - if( PCD == oldpc-3 && op == 0x31 ) \ - { \ - if( Z80.irq_state == CLEAR_LINE ) \ - BURNODD( z80_ICount-cc[Z80_TABLE_op][0x31], \ - 2, cc[Z80_TABLE_op][0x31]+cc[Z80_TABLE_op][0x18]); \ - } \ - } \ +#define JR() \ +{ \ + unsigned oldpc = PCD-1; \ + INT8 arg = (INT8)ARG(); /* ARG() also increments PC */ \ + PC += arg; /* so don't do PC += ARG() */ \ + change_pc(PCD); \ + /* speed up busy loop */ \ + if( PCD == oldpc ) \ + { \ + if( Z80.irq_state == CLEAR_LINE ) \ + BURNODD( z80_ICount, 1, cc[Z80_TABLE_op][0x18] ); \ + } \ + else \ + { \ + UINT8 op = cpu_readop(PCD); \ + if( PCD == oldpc-1 ) \ + { \ + /* NOP - JR $-1 or EI - JR $-1 */ \ + if ( op == 0x00 || op == 0xfb ) \ + { \ + if( Z80.irq_state == CLEAR_LINE ) \ + BURNODD( z80_ICount-cc[Z80_TABLE_op][0x00], \ + 2, cc[Z80_TABLE_op][0x00]+cc[Z80_TABLE_op][0x18]); \ + } \ + } \ + else \ + /* LD SP,#xxxx - JR $-3 */ \ + if( PCD == oldpc-3 && op == 0x31 ) \ + { \ + if( Z80.irq_state == CLEAR_LINE ) \ + BURNODD( z80_ICount-cc[Z80_TABLE_op][0x31], \ + 2, cc[Z80_TABLE_op][0x31]+cc[Z80_TABLE_op][0x18]); \ + } \ + } \ } /*************************************************************** * JR_COND ***************************************************************/ -#define JR_COND(cond,opcode) \ - if( cond ) \ - { \ - INT8 arg = (INT8)ARG(); /* ARG() also increments PC */ \ - PC += arg; /* so don't do PC += ARG() */ \ - CC(ex,opcode); \ - change_pc(PCD); \ - } \ - else PC++; \ +#define JR_COND(cond,opcode) \ + if( cond ) \ + { \ + INT8 arg = (INT8)ARG(); /* ARG() also increments PC */ \ + PC += arg; /* so don't do PC += ARG() */ \ + CC(ex,opcode); \ + change_pc(PCD); \ + } \ + else PC++; \ /*************************************************************** * CALL ***************************************************************/ -#define CALL() \ - EA = ARG16(); \ - PUSH( pc ); \ - PCD = EA; \ - change_pc(PCD) +#define CALL() \ + EA = ARG16(); \ + PUSH( pc ); \ + PCD = EA; \ + change_pc(PCD) /*************************************************************** * CALL_COND ***************************************************************/ -#define CALL_COND(cond,opcode) \ - if( cond ) \ - { \ - EA = ARG16(); \ - PUSH( pc ); \ - PCD = EA; \ - CC(ex,opcode); \ - change_pc(PCD); \ - } \ - else \ - { \ - PC+=2; \ - } +#define CALL_COND(cond,opcode) \ + if( cond ) \ + { \ + EA = ARG16(); \ + PUSH( pc ); \ + PCD = EA; \ + CC(ex,opcode); \ + change_pc(PCD); \ + } \ + else \ + { \ + PC+=2; \ + } /*************************************************************** * RET_COND ***************************************************************/ -#define RET_COND(cond,opcode) \ - if( cond ) \ - { \ - POP( pc ); \ - change_pc(PCD); \ - CC(ex,opcode); \ - } +#define RET_COND(cond,opcode) \ + if( cond ) \ + { \ + POP( pc ); \ + change_pc(PCD); \ + CC(ex,opcode); \ + } /*************************************************************** * RETN ***************************************************************/ -#define RETN { \ - LOG(("Z80 #%d RETN IFF1:%d IFF2:%d\n", cpu_getactivecpu(), IFF1, IFF2)); \ - POP( pc ); \ - change_pc(PCD); \ - IFF1 = IFF2; \ +#define RETN { \ + LOG(("Z80 #%d RETN IFF1:%d IFF2:%d\n", cpu_getactivecpu(), IFF1, IFF2)); \ + POP( pc ); \ + change_pc(PCD); \ + IFF1 = IFF2; \ } /*************************************************************** * RETI ***************************************************************/ -#define RETI { \ - POP( pc ); \ - change_pc(PCD); \ +#define RETI { \ + POP( pc ); \ + change_pc(PCD); \ /* according to http://www.msxnet.org/tech/z80-documented.pdf */\ - IFF1 = IFF2; \ + IFF1 = IFF2; \ } /*************************************************************** - * LD R,A + * LD R,A ***************************************************************/ -#define LD_R_A { \ - R = A; \ - R2 = A & 0x80; /* keep bit 7 of R */ \ +#define LD_R_A { \ + R = A; \ + R2 = A & 0x80; /* keep bit 7 of R */ \ } /*************************************************************** - * LD A,R + * LD A,R ***************************************************************/ -#define LD_A_R { \ - A = (R & 0x7f) | R2; \ - F = (F & CF) | SZ[A] | ( IFF2 << 2 ); \ +#define LD_A_R { \ + A = (R & 0x7f) | R2; \ + F = (F & CF) | SZ[A] | ( IFF2 << 2 ); \ } /*************************************************************** - * LD I,A + * LD I,A ***************************************************************/ -#define LD_I_A { \ - I = A; \ +#define LD_I_A { \ + I = A; \ } /*************************************************************** - * LD A,I + * LD A,I ***************************************************************/ -#define LD_A_I { \ - A = I; \ - F = (F & CF) | SZ[A] | ( IFF2 << 2 ); \ +#define LD_A_I { \ + A = I; \ + F = (F & CF) | SZ[A] | ( IFF2 << 2 ); \ } /*************************************************************** * RST ***************************************************************/ -#define RST(addr) \ - PUSH( pc ); \ - PCD = addr; \ - change_pc(PCD) +#define RST(addr) \ + PUSH( pc ); \ + PCD = addr; \ + change_pc(PCD) /*************************************************************** - * INC r8 + * INC r8 ***************************************************************/ INLINE UINT8 INC(UINT8 value) { - UINT8 res = value + 1; - F = (F & CF) | SZHV_inc[res]; - return (UINT8)res; + UINT8 res = value + 1; + F = (F & CF) | SZHV_inc[res]; + return (UINT8)res; } /*************************************************************** - * DEC r8 + * DEC r8 ***************************************************************/ INLINE UINT8 DEC(UINT8 value) { - UINT8 res = value - 1; - F = (F & CF) | SZHV_dec[res]; - return res; + UINT8 res = value - 1; + F = (F & CF) | SZHV_dec[res]; + return res; } /*************************************************************** * RLCA ***************************************************************/ -#define RLCA \ - A = (A << 1) | (A >> 7); \ - F = (F & (SF | ZF | PF)) | (A & (YF | XF | CF)) +#define RLCA \ + A = (A << 1) | (A >> 7); \ + F = (F & (SF | ZF | PF)) | (A & (YF | XF | CF)) /*************************************************************** * RRCA ***************************************************************/ -#define RRCA \ - F = (F & (SF | ZF | PF)) | (A & CF); \ - A = (A >> 1) | (A << 7); \ - F |= (A & (YF | XF) ) +#define RRCA \ + F = (F & (SF | ZF | PF)) | (A & CF); \ + A = (A >> 1) | (A << 7); \ + F |= (A & (YF | XF) ) /*************************************************************** * RLA ***************************************************************/ -#define RLA { \ - UINT8 res = (A << 1) | (F & CF); \ - UINT8 c = (A & 0x80) ? CF : 0; \ - F = (F & (SF | ZF | PF)) | c | (res & (YF | XF)); \ - A = res; \ +#define RLA { \ + UINT8 res = (A << 1) | (F & CF); \ + UINT8 c = (A & 0x80) ? CF : 0; \ + F = (F & (SF | ZF | PF)) | c | (res & (YF | XF)); \ + A = res; \ } /*************************************************************** * RRA ***************************************************************/ -#define RRA { \ - UINT8 res = (A >> 1) | (F << 7); \ - UINT8 c = (A & 0x01) ? CF : 0; \ - F = (F & (SF | ZF | PF)) | c | (res & (YF | XF)); \ - A = res; \ +#define RRA { \ + UINT8 res = (A >> 1) | (F << 7); \ + UINT8 c = (A & 0x01) ? CF : 0; \ + F = (F & (SF | ZF | PF)) | c | (res & (YF | XF)); \ + A = res; \ } /*************************************************************** * RRD ***************************************************************/ -#define RRD { \ - UINT8 n = RM(HL); \ - WM( HL, (n >> 4) | (A << 4) ); \ - A = (A & 0xf0) | (n & 0x0f); \ - F = (F & CF) | SZP[A]; \ +#define RRD { \ + UINT8 n = RM(HL); \ + WM( HL, (n >> 4) | (A << 4) ); \ + A = (A & 0xf0) | (n & 0x0f); \ + F = (F & CF) | SZP[A]; \ } /*************************************************************** * RLD ***************************************************************/ -#define RLD { \ - UINT8 n = RM(HL); \ - WM( HL, (n << 4) | (A & 0x0f) ); \ - A = (A & 0xf0) | (n >> 4); \ - F = (F & CF) | SZP[A]; \ +#define RLD { \ + UINT8 n = RM(HL); \ + WM( HL, (n << 4) | (A & 0x0f) ); \ + A = (A & 0xf0) | (n >> 4); \ + F = (F & CF) | SZP[A]; \ } /*************************************************************** - * ADD A,n + * ADD A,n ***************************************************************/ #if BIG_FLAGS_ARRAY -#define ADD(value) \ -{ \ - UINT32 ah = AFD & 0xff00; \ - UINT32 res = (UINT8)((ah >> 8) + value); \ - F = SZHVC_add[ah | res]; \ - A = res; \ +#define ADD(value) \ +{ \ + UINT32 ah = AFD & 0xff00; \ + UINT32 res = (UINT8)((ah >> 8) + value); \ + F = SZHVC_add[ah | res]; \ + A = res; \ } #else -#define ADD(value) \ -{ \ - unsigned val = value; \ - unsigned res = A + val; \ - F = SZ[(UINT8)res] | ((res >> 8) & CF) | \ - ((A ^ res ^ val) & HF) | \ - (((val ^ A ^ 0x80) & (val ^ res) & 0x80) >> 5); \ - A = (UINT8)res; \ +#define ADD(value) \ +{ \ + unsigned val = value; \ + unsigned res = A + val; \ + F = SZ[(UINT8)res] | ((res >> 8) & CF) | \ + ((A ^ res ^ val) & HF) | \ + (((val ^ A ^ 0x80) & (val ^ res) & 0x80) >> 5); \ + A = (UINT8)res; \ } #endif /*************************************************************** - * ADC A,n + * ADC A,n ***************************************************************/ #if BIG_FLAGS_ARRAY -#define ADC(value) \ -{ \ - UINT32 ah = AFD & 0xff00, c = AFD & 1; \ - UINT32 res = (UINT8)((ah >> 8) + value + c); \ - F = SZHVC_add[(c << 16) | ah | res]; \ - A = res; \ +#define ADC(value) \ +{ \ + UINT32 ah = AFD & 0xff00, c = AFD & 1; \ + UINT32 res = (UINT8)((ah >> 8) + value + c); \ + F = SZHVC_add[(c << 16) | ah | res]; \ + A = res; \ } #else -#define ADC(value) \ -{ \ - unsigned val = value; \ - unsigned res = A + val + (F & CF); \ - F = SZ[res & 0xff] | ((res >> 8) & CF) | \ - ((A ^ res ^ val) & HF) | \ - (((val ^ A ^ 0x80) & (val ^ res) & 0x80) >> 5); \ - A = res; \ +#define ADC(value) \ +{ \ + unsigned val = value; \ + unsigned res = A + val + (F & CF); \ + F = SZ[res & 0xff] | ((res >> 8) & CF) | \ + ((A ^ res ^ val) & HF) | \ + (((val ^ A ^ 0x80) & (val ^ res) & 0x80) >> 5); \ + A = res; \ } #endif /*************************************************************** - * SUB n + * SUB n ***************************************************************/ #if BIG_FLAGS_ARRAY -#define SUB(value) \ -{ \ - UINT32 ah = AFD & 0xff00; \ - UINT32 res = (UINT8)((ah >> 8) - value); \ - F = SZHVC_sub[ah | res]; \ - A = res; \ +#define SUB(value) \ +{ \ + UINT32 ah = AFD & 0xff00; \ + UINT32 res = (UINT8)((ah >> 8) - value); \ + F = SZHVC_sub[ah | res]; \ + A = res; \ } #else -#define SUB(value) \ -{ \ - unsigned val = value; \ - unsigned res = A - val; \ - F = SZ[res & 0xff] | ((res >> 8) & CF) | NF | \ - ((A ^ res ^ val) & HF) | \ - (((val ^ A) & (A ^ res) & 0x80) >> 5); \ - A = res; \ +#define SUB(value) \ +{ \ + unsigned val = value; \ + unsigned res = A - val; \ + F = SZ[res & 0xff] | ((res >> 8) & CF) | NF | \ + ((A ^ res ^ val) & HF) | \ + (((val ^ A) & (A ^ res) & 0x80) >> 5); \ + A = res; \ } #endif /*************************************************************** - * SBC A,n + * SBC A,n ***************************************************************/ #if BIG_FLAGS_ARRAY -#define SBC(value) \ -{ \ - UINT32 ah = AFD & 0xff00, c = AFD & 1; \ - UINT32 res = (UINT8)((ah >> 8) - value - c); \ - F = SZHVC_sub[(c<<16) | ah | res]; \ - A = res; \ +#define SBC(value) \ +{ \ + UINT32 ah = AFD & 0xff00, c = AFD & 1; \ + UINT32 res = (UINT8)((ah >> 8) - value - c); \ + F = SZHVC_sub[(c<<16) | ah | res]; \ + A = res; \ } #else -#define SBC(value) \ -{ \ - unsigned val = value; \ - unsigned res = A - val - (F & CF); \ - F = SZ[res & 0xff] | ((res >> 8) & CF) | NF | \ - ((A ^ res ^ val) & HF) | \ - (((val ^ A) & (A ^ res) & 0x80) >> 5); \ - A = res; \ +#define SBC(value) \ +{ \ + unsigned val = value; \ + unsigned res = A - val - (F & CF); \ + F = SZ[res & 0xff] | ((res >> 8) & CF) | NF | \ + ((A ^ res ^ val) & HF) | \ + (((val ^ A) & (A ^ res) & 0x80) >> 5); \ + A = res; \ } #endif /*************************************************************** * NEG ***************************************************************/ -#define NEG { \ - UINT8 value = A; \ - A = 0; \ - SUB(value); \ +#define NEG { \ + UINT8 value = A; \ + A = 0; \ + SUB(value); \ } /*************************************************************** * DAA ***************************************************************/ -#define DAA { \ - UINT8 cf, nf, hf, lo, hi, diff; \ - cf = F & CF; \ - nf = F & NF; \ - hf = F & HF; \ - lo = A & 15; \ - hi = A / 16; \ - \ - if (cf) \ - { \ - diff = (lo <= 9 && !hf) ? 0x60 : 0x66; \ - } \ - else \ - { \ - if (lo >= 10) \ - { \ - diff = hi <= 8 ? 0x06 : 0x66; \ - } \ - else \ - { \ - if (hi >= 10) \ - { \ - diff = hf ? 0x66 : 0x60; \ - } \ - else \ - { \ - diff = hf ? 0x06 : 0x00; \ - } \ - } \ - } \ - if (nf) A -= diff; \ - else A += diff; \ - \ - F = SZP[A] | (F & NF); \ - if (cf || (lo <= 9 ? hi >= 10 : hi >= 9)) F |= CF; \ - if (nf ? hf && lo <= 5 : lo >= 10) F |= HF; \ +#define DAA { \ + UINT8 cf, nf, hf, lo, hi, diff; \ + cf = F & CF; \ + nf = F & NF; \ + hf = F & HF; \ + lo = A & 15; \ + hi = A / 16; \ + \ + if (cf) \ + { \ + diff = (lo <= 9 && !hf) ? 0x60 : 0x66; \ + } \ + else \ + { \ + if (lo >= 10) \ + { \ + diff = hi <= 8 ? 0x06 : 0x66; \ + } \ + else \ + { \ + if (hi >= 10) \ + { \ + diff = hf ? 0x66 : 0x60; \ + } \ + else \ + { \ + diff = hf ? 0x06 : 0x00; \ + } \ + } \ + } \ + if (nf) A -= diff; \ + else A += diff; \ + \ + F = SZP[A] | (F & NF); \ + if (cf || (lo <= 9 ? hi >= 10 : hi >= 9)) F |= CF; \ + if (nf ? hf && lo <= 5 : lo >= 10) F |= HF; \ } /*************************************************************** - * AND n + * AND n ***************************************************************/ -#define AND(value) \ - A &= value; \ - F = SZP[A] | HF +#define AND(value) \ + A &= value; \ + F = SZP[A] | HF /*************************************************************** - * OR n + * OR n ***************************************************************/ -#define OR(value) \ - A |= value; \ - F = SZP[A] +#define OR(value) \ + A |= value; \ + F = SZP[A] /*************************************************************** - * XOR n + * XOR n ***************************************************************/ -#define XOR(value) \ - A ^= value; \ - F = SZP[A] +#define XOR(value) \ + A ^= value; \ + F = SZP[A] /*************************************************************** - * CP n + * CP n ***************************************************************/ #if BIG_FLAGS_ARRAY -#define CP(value) \ -{ \ - unsigned val = value; \ - UINT32 ah = AFD & 0xff00; \ - UINT32 res = (UINT8)((ah >> 8) - val); \ - F = (SZHVC_sub[ah | res] & ~(YF | XF)) | \ - (val & (YF | XF)); \ +#define CP(value) \ +{ \ + unsigned val = value; \ + UINT32 ah = AFD & 0xff00; \ + UINT32 res = (UINT8)((ah >> 8) - val); \ + F = (SZHVC_sub[ah | res] & ~(YF | XF)) | \ + (val & (YF | XF)); \ } #else -#define CP(value) \ -{ \ - unsigned val = value; \ - unsigned res = A - val; \ - F = (SZ[res & 0xff] & (SF | ZF)) | \ - (val & (YF | XF)) | ((res >> 8) & CF) | NF | \ - ((A ^ res ^ val) & HF) | \ - ((((val ^ A) & (A ^ res)) >> 5) & VF); \ +#define CP(value) \ +{ \ + unsigned val = value; \ + unsigned res = A - val; \ + F = (SZ[res & 0xff] & (SF | ZF)) | \ + (val & (YF | XF)) | ((res >> 8) & CF) | NF | \ + ((A ^ res ^ val) & HF) | \ + ((((val ^ A) & (A ^ res)) >> 5) & VF); \ } #endif /*************************************************************** - * EX AF,AF' + * EX AF,AF' ***************************************************************/ -#define EX_AF { \ - PAIR tmp; \ - tmp = Z80.af; Z80.af = Z80.af2; Z80.af2 = tmp; \ +#define EX_AF { \ + PAIR tmp; \ + tmp = Z80.af; Z80.af = Z80.af2; Z80.af2 = tmp; \ } /*************************************************************** - * EX DE,HL + * EX DE,HL ***************************************************************/ -#define EX_DE_HL { \ - PAIR tmp; \ - tmp = Z80.de; Z80.de = Z80.hl; Z80.hl = tmp; \ +#define EX_DE_HL { \ + PAIR tmp; \ + tmp = Z80.de; Z80.de = Z80.hl; Z80.hl = tmp; \ } /*************************************************************** * EXX ***************************************************************/ -#define EXX { \ - PAIR tmp; \ - tmp = Z80.bc; Z80.bc = Z80.bc2; Z80.bc2 = tmp; \ - tmp = Z80.de; Z80.de = Z80.de2; Z80.de2 = tmp; \ - tmp = Z80.hl; Z80.hl = Z80.hl2; Z80.hl2 = tmp; \ +#define EXX { \ + PAIR tmp; \ + tmp = Z80.bc; Z80.bc = Z80.bc2; Z80.bc2 = tmp; \ + tmp = Z80.de; Z80.de = Z80.de2; Z80.de2 = tmp; \ + tmp = Z80.hl; Z80.hl = Z80.hl2; Z80.hl2 = tmp; \ } /*************************************************************** - * EX (SP),r16 + * EX (SP),r16 ***************************************************************/ -#define EXSP(DR) \ -{ \ - PAIR tmp = { { 0, 0, 0, 0 } }; \ - RM16( SPD, &tmp ); \ - WM16( SPD, &Z80.DR ); \ - Z80.DR = tmp; \ +#define EXSP(DR) \ +{ \ + PAIR tmp = { { 0, 0, 0, 0 } }; \ + RM16( SPD, &tmp ); \ + WM16( SPD, &Z80.DR ); \ + Z80.DR = tmp; \ } /*************************************************************** * ADD16 ***************************************************************/ -#define ADD16(DR,SR) \ -{ \ - UINT32 res = Z80.DR.d + Z80.SR.d; \ - F = (F & (SF | ZF | VF)) | \ - (((Z80.DR.d ^ res ^ Z80.SR.d) >> 8) & HF) | \ - ((res >> 16) & CF) | ((res >> 8) & (YF | XF)); \ - Z80.DR.w.l = (UINT16)res; \ +#define ADD16(DR,SR) \ +{ \ + UINT32 res = Z80.DR.d + Z80.SR.d; \ + F = (F & (SF | ZF | VF)) | \ + (((Z80.DR.d ^ res ^ Z80.SR.d) >> 8) & HF) | \ + ((res >> 16) & CF) | ((res >> 8) & (YF | XF)); \ + Z80.DR.w.l = (UINT16)res; \ } /*************************************************************** - * ADC r16,r16 + * ADC r16,r16 ***************************************************************/ -#define ADC16(Reg) \ -{ \ - UINT32 res = HLD + Z80.Reg.d + (F & CF); \ - F = (((HLD ^ res ^ Z80.Reg.d) >> 8) & HF) | \ - ((res >> 16) & CF) | \ - ((res >> 8) & (SF | YF | XF)) | \ - ((res & 0xffff) ? 0 : ZF) | \ - (((Z80.Reg.d ^ HLD ^ 0x8000) & (Z80.Reg.d ^ res) & 0x8000) >> 13); \ - HL = (UINT16)res; \ +#define ADC16(Reg) \ +{ \ + UINT32 res = HLD + Z80.Reg.d + (F & CF); \ + F = (((HLD ^ res ^ Z80.Reg.d) >> 8) & HF) | \ + ((res >> 16) & CF) | \ + ((res >> 8) & (SF | YF | XF)) | \ + ((res & 0xffff) ? 0 : ZF) | \ + (((Z80.Reg.d ^ HLD ^ 0x8000) & (Z80.Reg.d ^ res) & 0x8000) >> 13); \ + HL = (UINT16)res; \ } /*************************************************************** - * SBC r16,r16 + * SBC r16,r16 ***************************************************************/ -#define SBC16(Reg) \ -{ \ - UINT32 res = HLD - Z80.Reg.d - (F & CF); \ - F = (((HLD ^ res ^ Z80.Reg.d) >> 8) & HF) | NF | \ - ((res >> 16) & CF) | \ - ((res >> 8) & (SF | YF | XF)) | \ - ((res & 0xffff) ? 0 : ZF) | \ - (((Z80.Reg.d ^ HLD) & (HLD ^ res) &0x8000) >> 13); \ - HL = (UINT16)res; \ +#define SBC16(Reg) \ +{ \ + UINT32 res = HLD - Z80.Reg.d - (F & CF); \ + F = (((HLD ^ res ^ Z80.Reg.d) >> 8) & HF) | NF | \ + ((res >> 16) & CF) | \ + ((res >> 8) & (SF | YF | XF)) | \ + ((res & 0xffff) ? 0 : ZF) | \ + (((Z80.Reg.d ^ HLD) & (HLD ^ res) &0x8000) >> 13); \ + HL = (UINT16)res; \ } /*************************************************************** - * RLC r8 + * RLC r8 ***************************************************************/ INLINE UINT8 RLC(UINT8 value) { - unsigned res = value; - unsigned c = (res & 0x80) ? CF : 0; - res = ((res << 1) | (res >> 7)) & 0xff; - F = SZP[res] | c; - return res; + unsigned res = value; + unsigned c = (res & 0x80) ? CF : 0; + res = ((res << 1) | (res >> 7)) & 0xff; + F = SZP[res] | c; + return res; } /*************************************************************** - * RRC r8 + * RRC r8 ***************************************************************/ INLINE UINT8 RRC(UINT8 value) { - unsigned res = value; - unsigned c = (res & 0x01) ? CF : 0; - res = ((res >> 1) | (res << 7)) & 0xff; - F = SZP[res] | c; - return res; + unsigned res = value; + unsigned c = (res & 0x01) ? CF : 0; + res = ((res >> 1) | (res << 7)) & 0xff; + F = SZP[res] | c; + return res; } /*************************************************************** - * RL r8 + * RL r8 ***************************************************************/ INLINE UINT8 RL(UINT8 value) { - unsigned res = value; - unsigned c = (res & 0x80) ? CF : 0; - res = ((res << 1) | (F & CF)) & 0xff; - F = SZP[res] | c; - return res; + unsigned res = value; + unsigned c = (res & 0x80) ? CF : 0; + res = ((res << 1) | (F & CF)) & 0xff; + F = SZP[res] | c; + return res; } /*************************************************************** - * RR r8 + * RR r8 ***************************************************************/ INLINE UINT8 RR(UINT8 value) { - unsigned res = value; - unsigned c = (res & 0x01) ? CF : 0; - res = ((res >> 1) | (F << 7)) & 0xff; - F = SZP[res] | c; - return res; + unsigned res = value; + unsigned c = (res & 0x01) ? CF : 0; + res = ((res >> 1) | (F << 7)) & 0xff; + F = SZP[res] | c; + return res; } /*************************************************************** - * SLA r8 + * SLA r8 ***************************************************************/ INLINE UINT8 SLA(UINT8 value) { - unsigned res = value; - unsigned c = (res & 0x80) ? CF : 0; - res = (res << 1) & 0xff; - F = SZP[res] | c; - return res; + unsigned res = value; + unsigned c = (res & 0x80) ? CF : 0; + res = (res << 1) & 0xff; + F = SZP[res] | c; + return res; } /*************************************************************** - * SRA r8 + * SRA r8 ***************************************************************/ INLINE UINT8 SRA(UINT8 value) { - unsigned res = value; - unsigned c = (res & 0x01) ? CF : 0; - res = ((res >> 1) | (res & 0x80)) & 0xff; - F = SZP[res] | c; - return res; + unsigned res = value; + unsigned c = (res & 0x01) ? CF : 0; + res = ((res >> 1) | (res & 0x80)) & 0xff; + F = SZP[res] | c; + return res; } /*************************************************************** - * SLL r8 + * SLL r8 ***************************************************************/ INLINE UINT8 SLL(UINT8 value) { - unsigned res = value; - unsigned c = (res & 0x80) ? CF : 0; - res = ((res << 1) | 0x01) & 0xff; - F = SZP[res] | c; - return res; + unsigned res = value; + unsigned c = (res & 0x80) ? CF : 0; + res = ((res << 1) | 0x01) & 0xff; + F = SZP[res] | c; + return res; } /*************************************************************** - * SRL r8 + * SRL r8 ***************************************************************/ INLINE UINT8 SRL(UINT8 value) { - unsigned res = value; - unsigned c = (res & 0x01) ? CF : 0; - res = (res >> 1) & 0xff; - F = SZP[res] | c; - return res; + unsigned res = value; + unsigned c = (res & 0x01) ? CF : 0; + res = (res >> 1) & 0xff; + F = SZP[res] | c; + return res; } /*************************************************************** - * BIT bit,r8 + * BIT bit,r8 ***************************************************************/ #undef BIT -#define BIT(bit,reg) \ - F = (F & CF) | HF | SZ_BIT[reg & (1<>8) & (YF|XF)) +#define BIT_XY(bit,reg) \ + F = (F & CF) | HF | (SZ_BIT[reg & (1<>8) & (YF|XF)) /*************************************************************** - * RES bit,r8 + * RES bit,r8 ***************************************************************/ INLINE UINT8 RES(UINT8 bit, UINT8 value) { - return value & ~(1< flag 5 */ \ - if( (A + io) & 0x08 ) F |= XF; /* bit 3 -> flag 3 */ \ - HL++; DE++; BC--; \ - if( BC ) F |= VF; \ +#define LDI { \ + UINT8 io = RM(HL); \ + WM( DE, io ); \ + F &= SF | ZF | CF; \ + if( (A + io) & 0x02 ) F |= YF; /* bit 1 -> flag 5 */ \ + if( (A + io) & 0x08 ) F |= XF; /* bit 3 -> flag 3 */ \ + HL++; DE++; BC--; \ + if( BC ) F |= VF; \ } /*************************************************************** * CPI ***************************************************************/ -#define CPI { \ - UINT8 val = RM(HL); \ - UINT8 res = A - val; \ - HL++; BC--; \ - F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF; \ - if( F & HF ) res -= 1; \ - if( res & 0x02 ) F |= YF; /* bit 1 -> flag 5 */ \ - if( res & 0x08 ) F |= XF; /* bit 3 -> flag 3 */ \ - if( BC ) F |= VF; \ +#define CPI { \ + UINT8 val = RM(HL); \ + UINT8 res = A - val; \ + HL++; BC--; \ + F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF; \ + if( F & HF ) res -= 1; \ + if( res & 0x02 ) F |= YF; /* bit 1 -> flag 5 */ \ + if( res & 0x08 ) F |= XF; /* bit 3 -> flag 3 */ \ + if( BC ) F |= VF; \ } /*************************************************************** * INI ***************************************************************/ -#define INI { \ - unsigned t; \ - UINT8 io = IN(BC); \ - B--; \ - WM( HL, io ); \ - HL++; \ - F = SZ[B]; \ - t = (unsigned)((C + 1) & 0xff) + (unsigned)io; \ - if( io & SF ) F |= NF; \ - if( t & 0x100 ) F |= HF | CF; \ - F |= SZP[(UINT8)(t & 0x07) ^ B] & PF; \ +#define INI { \ + unsigned t; \ + UINT8 io = IN(BC); \ + B--; \ + WM( HL, io ); \ + HL++; \ + F = SZ[B]; \ + t = (unsigned)((C + 1) & 0xff) + (unsigned)io; \ + if( io & SF ) F |= NF; \ + if( t & 0x100 ) F |= HF | CF; \ + F |= SZP[(UINT8)(t & 0x07) ^ B] & PF; \ } /*************************************************************** * OUTI ***************************************************************/ -#define OUTI { \ - unsigned t; \ - UINT8 io = RM(HL); \ - B--; \ - OUT( BC, io ); \ - HL++; \ - F = SZ[B]; \ - t = (unsigned)L + (unsigned)io; \ - if( io & SF ) F |= NF; \ - if( t & 0x100 ) F |= HF | CF; \ - F |= SZP[(UINT8)(t & 0x07) ^ B] & PF; \ +#define OUTI { \ + unsigned t; \ + UINT8 io = RM(HL); \ + B--; \ + OUT( BC, io ); \ + HL++; \ + F = SZ[B]; \ + t = (unsigned)L + (unsigned)io; \ + if( io & SF ) F |= NF; \ + if( t & 0x100 ) F |= HF | CF; \ + F |= SZP[(UINT8)(t & 0x07) ^ B] & PF; \ } /*************************************************************** * LDD ***************************************************************/ -#define LDD { \ - UINT8 io = RM(HL); \ - WM( DE, io ); \ - F &= SF | ZF | CF; \ - if( (A + io) & 0x02 ) F |= YF; /* bit 1 -> flag 5 */ \ - if( (A + io) & 0x08 ) F |= XF; /* bit 3 -> flag 3 */ \ - HL--; DE--; BC--; \ - if( BC ) F |= VF; \ +#define LDD { \ + UINT8 io = RM(HL); \ + WM( DE, io ); \ + F &= SF | ZF | CF; \ + if( (A + io) & 0x02 ) F |= YF; /* bit 1 -> flag 5 */ \ + if( (A + io) & 0x08 ) F |= XF; /* bit 3 -> flag 3 */ \ + HL--; DE--; BC--; \ + if( BC ) F |= VF; \ } /*************************************************************** * CPD ***************************************************************/ -#define CPD { \ - UINT8 val = RM(HL); \ - UINT8 res = A - val; \ - HL--; BC--; \ - F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF; \ - if( F & HF ) res -= 1; \ - if( res & 0x02 ) F |= YF; /* bit 1 -> flag 5 */ \ - if( res & 0x08 ) F |= XF; /* bit 3 -> flag 3 */ \ - if( BC ) F |= VF; \ +#define CPD { \ + UINT8 val = RM(HL); \ + UINT8 res = A - val; \ + HL--; BC--; \ + F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF; \ + if( F & HF ) res -= 1; \ + if( res & 0x02 ) F |= YF; /* bit 1 -> flag 5 */ \ + if( res & 0x08 ) F |= XF; /* bit 3 -> flag 3 */ \ + if( BC ) F |= VF; \ } /*************************************************************** * IND ***************************************************************/ -#define IND { \ - unsigned t; \ - UINT8 io = IN(BC); \ - B--; \ - WM( HL, io ); \ - HL--; \ - F = SZ[B]; \ - t = ((unsigned)(C - 1) & 0xff) + (unsigned)io; \ - if( io & SF ) F |= NF; \ - if( t & 0x100 ) F |= HF | CF; \ - F |= SZP[(UINT8)(t & 0x07) ^ B] & PF; \ +#define IND { \ + unsigned t; \ + UINT8 io = IN(BC); \ + B--; \ + WM( HL, io ); \ + HL--; \ + F = SZ[B]; \ + t = ((unsigned)(C - 1) & 0xff) + (unsigned)io; \ + if( io & SF ) F |= NF; \ + if( t & 0x100 ) F |= HF | CF; \ + F |= SZP[(UINT8)(t & 0x07) ^ B] & PF; \ } /*************************************************************** * OUTD ***************************************************************/ -#define OUTD { \ - unsigned t; \ - UINT8 io = RM(HL); \ - B--; \ - OUT( BC, io ); \ - HL--; \ - F = SZ[B]; \ - t = (unsigned)L + (unsigned)io; \ - if( io & SF ) F |= NF; \ - if( t & 0x100 ) F |= HF | CF; \ - F |= SZP[(UINT8)(t & 0x07) ^ B] & PF; \ +#define OUTD { \ + unsigned t; \ + UINT8 io = RM(HL); \ + B--; \ + OUT( BC, io ); \ + HL--; \ + F = SZ[B]; \ + t = (unsigned)L + (unsigned)io; \ + if( io & SF ) F |= NF; \ + if( t & 0x100 ) F |= HF | CF; \ + F |= SZP[(UINT8)(t & 0x07) ^ B] & PF; \ } /*************************************************************** * LDIR ***************************************************************/ -#define LDIR \ - LDI; \ - if( BC ) \ - { \ - PC -= 2; \ - CC(ex,0xb0); \ - } +#define LDIR \ + LDI; \ + if( BC ) \ + { \ + PC -= 2; \ + CC(ex,0xb0); \ + } /*************************************************************** * CPIR ***************************************************************/ -#define CPIR \ - CPI; \ - if( BC && !(F & ZF) ) \ - { \ - PC -= 2; \ - CC(ex,0xb1); \ - } +#define CPIR \ + CPI; \ + if( BC && !(F & ZF) ) \ + { \ + PC -= 2; \ + CC(ex,0xb1); \ + } /*************************************************************** * INIR ***************************************************************/ -#define INIR \ - INI; \ - if( B ) \ - { \ - PC -= 2; \ - CC(ex,0xb2); \ - } +#define INIR \ + INI; \ + if( B ) \ + { \ + PC -= 2; \ + CC(ex,0xb2); \ + } /*************************************************************** * OTIR ***************************************************************/ -#define OTIR \ - OUTI; \ - if( B ) \ - { \ - PC -= 2; \ - CC(ex,0xb3); \ - } +#define OTIR \ + OUTI; \ + if( B ) \ + { \ + PC -= 2; \ + CC(ex,0xb3); \ + } /*************************************************************** * LDDR ***************************************************************/ -#define LDDR \ - LDD; \ - if( BC ) \ - { \ - PC -= 2; \ - CC(ex,0xb8); \ - } +#define LDDR \ + LDD; \ + if( BC ) \ + { \ + PC -= 2; \ + CC(ex,0xb8); \ + } /*************************************************************** * CPDR ***************************************************************/ -#define CPDR \ - CPD; \ - if( BC && !(F & ZF) ) \ - { \ - PC -= 2; \ - CC(ex,0xb9); \ - } +#define CPDR \ + CPD; \ + if( BC && !(F & ZF) ) \ + { \ + PC -= 2; \ + CC(ex,0xb9); \ + } /*************************************************************** * INDR ***************************************************************/ -#define INDR \ - IND; \ - if( B ) \ - { \ - PC -= 2; \ - CC(ex,0xba); \ - } +#define INDR \ + IND; \ + if( B ) \ + { \ + PC -= 2; \ + CC(ex,0xba); \ + } /*************************************************************** * OTDR ***************************************************************/ -#define OTDR \ - OUTD; \ - if( B ) \ - { \ - PC -= 2; \ - CC(ex,0xbb); \ - } +#define OTDR \ + OUTD; \ + if( B ) \ + { \ + PC -= 2; \ + CC(ex,0xbb); \ + } /*************************************************************** * EI ***************************************************************/ -#define EI { \ - IFF1 = IFF2 = 1; \ - Z80.after_ei = TRUE; \ +#define EI { \ + IFF1 = IFF2 = 1; \ + Z80.after_ei = TRUE; \ } /********************************************************** * opcodes with CB prefix * rotate, shift and bit operations **********************************************************/ -OP(cb,00) { B = RLC(B); } /* RLC B */ -OP(cb,01) { C = RLC(C); } /* RLC C */ -OP(cb,02) { D = RLC(D); } /* RLC D */ -OP(cb,03) { E = RLC(E); } /* RLC E */ -OP(cb,04) { H = RLC(H); } /* RLC H */ -OP(cb,05) { L = RLC(L); } /* RLC L */ -OP(cb,06) { WM( HL, RLC(RM(HL)) ); } /* RLC (HL) */ -OP(cb,07) { A = RLC(A); } /* RLC A */ +OP(cb,00) { B = RLC(B); } /* RLC B */ +OP(cb,01) { C = RLC(C); } /* RLC C */ +OP(cb,02) { D = RLC(D); } /* RLC D */ +OP(cb,03) { E = RLC(E); } /* RLC E */ +OP(cb,04) { H = RLC(H); } /* RLC H */ +OP(cb,05) { L = RLC(L); } /* RLC L */ +OP(cb,06) { WM( HL, RLC(RM(HL)) ); } /* RLC (HL) */ +OP(cb,07) { A = RLC(A); } /* RLC A */ -OP(cb,08) { B = RRC(B); } /* RRC B */ -OP(cb,09) { C = RRC(C); } /* RRC C */ -OP(cb,0a) { D = RRC(D); } /* RRC D */ -OP(cb,0b) { E = RRC(E); } /* RRC E */ -OP(cb,0c) { H = RRC(H); } /* RRC H */ -OP(cb,0d) { L = RRC(L); } /* RRC L */ -OP(cb,0e) { WM( HL, RRC(RM(HL)) ); } /* RRC (HL) */ -OP(cb,0f) { A = RRC(A); } /* RRC A */ +OP(cb,08) { B = RRC(B); } /* RRC B */ +OP(cb,09) { C = RRC(C); } /* RRC C */ +OP(cb,0a) { D = RRC(D); } /* RRC D */ +OP(cb,0b) { E = RRC(E); } /* RRC E */ +OP(cb,0c) { H = RRC(H); } /* RRC H */ +OP(cb,0d) { L = RRC(L); } /* RRC L */ +OP(cb,0e) { WM( HL, RRC(RM(HL)) ); } /* RRC (HL) */ +OP(cb,0f) { A = RRC(A); } /* RRC A */ -OP(cb,10) { B = RL(B); } /* RL B */ -OP(cb,11) { C = RL(C); } /* RL C */ -OP(cb,12) { D = RL(D); } /* RL D */ -OP(cb,13) { E = RL(E); } /* RL E */ -OP(cb,14) { H = RL(H); } /* RL H */ -OP(cb,15) { L = RL(L); } /* RL L */ -OP(cb,16) { WM( HL, RL(RM(HL)) ); } /* RL (HL) */ -OP(cb,17) { A = RL(A); } /* RL A */ +OP(cb,10) { B = RL(B); } /* RL B */ +OP(cb,11) { C = RL(C); } /* RL C */ +OP(cb,12) { D = RL(D); } /* RL D */ +OP(cb,13) { E = RL(E); } /* RL E */ +OP(cb,14) { H = RL(H); } /* RL H */ +OP(cb,15) { L = RL(L); } /* RL L */ +OP(cb,16) { WM( HL, RL(RM(HL)) ); } /* RL (HL) */ +OP(cb,17) { A = RL(A); } /* RL A */ -OP(cb,18) { B = RR(B); } /* RR B */ -OP(cb,19) { C = RR(C); } /* RR C */ -OP(cb,1a) { D = RR(D); } /* RR D */ -OP(cb,1b) { E = RR(E); } /* RR E */ -OP(cb,1c) { H = RR(H); } /* RR H */ -OP(cb,1d) { L = RR(L); } /* RR L */ -OP(cb,1e) { WM( HL, RR(RM(HL)) ); } /* RR (HL) */ -OP(cb,1f) { A = RR(A); } /* RR A */ +OP(cb,18) { B = RR(B); } /* RR B */ +OP(cb,19) { C = RR(C); } /* RR C */ +OP(cb,1a) { D = RR(D); } /* RR D */ +OP(cb,1b) { E = RR(E); } /* RR E */ +OP(cb,1c) { H = RR(H); } /* RR H */ +OP(cb,1d) { L = RR(L); } /* RR L */ +OP(cb,1e) { WM( HL, RR(RM(HL)) ); } /* RR (HL) */ +OP(cb,1f) { A = RR(A); } /* RR A */ -OP(cb,20) { B = SLA(B); } /* SLA B */ -OP(cb,21) { C = SLA(C); } /* SLA C */ -OP(cb,22) { D = SLA(D); } /* SLA D */ -OP(cb,23) { E = SLA(E); } /* SLA E */ -OP(cb,24) { H = SLA(H); } /* SLA H */ -OP(cb,25) { L = SLA(L); } /* SLA L */ -OP(cb,26) { WM( HL, SLA(RM(HL)) ); } /* SLA (HL) */ -OP(cb,27) { A = SLA(A); } /* SLA A */ +OP(cb,20) { B = SLA(B); } /* SLA B */ +OP(cb,21) { C = SLA(C); } /* SLA C */ +OP(cb,22) { D = SLA(D); } /* SLA D */ +OP(cb,23) { E = SLA(E); } /* SLA E */ +OP(cb,24) { H = SLA(H); } /* SLA H */ +OP(cb,25) { L = SLA(L); } /* SLA L */ +OP(cb,26) { WM( HL, SLA(RM(HL)) ); } /* SLA (HL) */ +OP(cb,27) { A = SLA(A); } /* SLA A */ -OP(cb,28) { B = SRA(B); } /* SRA B */ -OP(cb,29) { C = SRA(C); } /* SRA C */ -OP(cb,2a) { D = SRA(D); } /* SRA D */ -OP(cb,2b) { E = SRA(E); } /* SRA E */ -OP(cb,2c) { H = SRA(H); } /* SRA H */ -OP(cb,2d) { L = SRA(L); } /* SRA L */ -OP(cb,2e) { WM( HL, SRA(RM(HL)) ); } /* SRA (HL) */ -OP(cb,2f) { A = SRA(A); } /* SRA A */ +OP(cb,28) { B = SRA(B); } /* SRA B */ +OP(cb,29) { C = SRA(C); } /* SRA C */ +OP(cb,2a) { D = SRA(D); } /* SRA D */ +OP(cb,2b) { E = SRA(E); } /* SRA E */ +OP(cb,2c) { H = SRA(H); } /* SRA H */ +OP(cb,2d) { L = SRA(L); } /* SRA L */ +OP(cb,2e) { WM( HL, SRA(RM(HL)) ); } /* SRA (HL) */ +OP(cb,2f) { A = SRA(A); } /* SRA A */ -OP(cb,30) { B = SLL(B); } /* SLL B */ -OP(cb,31) { C = SLL(C); } /* SLL C */ -OP(cb,32) { D = SLL(D); } /* SLL D */ -OP(cb,33) { E = SLL(E); } /* SLL E */ -OP(cb,34) { H = SLL(H); } /* SLL H */ -OP(cb,35) { L = SLL(L); } /* SLL L */ -OP(cb,36) { WM( HL, SLL(RM(HL)) ); } /* SLL (HL) */ -OP(cb,37) { A = SLL(A); } /* SLL A */ +OP(cb,30) { B = SLL(B); } /* SLL B */ +OP(cb,31) { C = SLL(C); } /* SLL C */ +OP(cb,32) { D = SLL(D); } /* SLL D */ +OP(cb,33) { E = SLL(E); } /* SLL E */ +OP(cb,34) { H = SLL(H); } /* SLL H */ +OP(cb,35) { L = SLL(L); } /* SLL L */ +OP(cb,36) { WM( HL, SLL(RM(HL)) ); } /* SLL (HL) */ +OP(cb,37) { A = SLL(A); } /* SLL A */ -OP(cb,38) { B = SRL(B); } /* SRL B */ -OP(cb,39) { C = SRL(C); } /* SRL C */ -OP(cb,3a) { D = SRL(D); } /* SRL D */ -OP(cb,3b) { E = SRL(E); } /* SRL E */ -OP(cb,3c) { H = SRL(H); } /* SRL H */ -OP(cb,3d) { L = SRL(L); } /* SRL L */ -OP(cb,3e) { WM( HL, SRL(RM(HL)) ); } /* SRL (HL) */ -OP(cb,3f) { A = SRL(A); } /* SRL A */ +OP(cb,38) { B = SRL(B); } /* SRL B */ +OP(cb,39) { C = SRL(C); } /* SRL C */ +OP(cb,3a) { D = SRL(D); } /* SRL D */ +OP(cb,3b) { E = SRL(E); } /* SRL E */ +OP(cb,3c) { H = SRL(H); } /* SRL H */ +OP(cb,3d) { L = SRL(L); } /* SRL L */ +OP(cb,3e) { WM( HL, SRL(RM(HL)) ); } /* SRL (HL) */ +OP(cb,3f) { A = SRL(A); } /* SRL A */ -OP(cb,40) { BIT(0,B); } /* BIT 0,B */ -OP(cb,41) { BIT(0,C); } /* BIT 0,C */ -OP(cb,42) { BIT(0,D); } /* BIT 0,D */ -OP(cb,43) { BIT(0,E); } /* BIT 0,E */ -OP(cb,44) { BIT(0,H); } /* BIT 0,H */ -OP(cb,45) { BIT(0,L); } /* BIT 0,L */ -OP(cb,46) { BIT(0,RM(HL)); } /* BIT 0,(HL) */ -OP(cb,47) { BIT(0,A); } /* BIT 0,A */ +OP(cb,40) { BIT(0,B); } /* BIT 0,B */ +OP(cb,41) { BIT(0,C); } /* BIT 0,C */ +OP(cb,42) { BIT(0,D); } /* BIT 0,D */ +OP(cb,43) { BIT(0,E); } /* BIT 0,E */ +OP(cb,44) { BIT(0,H); } /* BIT 0,H */ +OP(cb,45) { BIT(0,L); } /* BIT 0,L */ +OP(cb,46) { BIT(0,RM(HL)); } /* BIT 0,(HL) */ +OP(cb,47) { BIT(0,A); } /* BIT 0,A */ -OP(cb,48) { BIT(1,B); } /* BIT 1,B */ -OP(cb,49) { BIT(1,C); } /* BIT 1,C */ -OP(cb,4a) { BIT(1,D); } /* BIT 1,D */ -OP(cb,4b) { BIT(1,E); } /* BIT 1,E */ -OP(cb,4c) { BIT(1,H); } /* BIT 1,H */ -OP(cb,4d) { BIT(1,L); } /* BIT 1,L */ -OP(cb,4e) { BIT(1,RM(HL)); } /* BIT 1,(HL) */ -OP(cb,4f) { BIT(1,A); } /* BIT 1,A */ +OP(cb,48) { BIT(1,B); } /* BIT 1,B */ +OP(cb,49) { BIT(1,C); } /* BIT 1,C */ +OP(cb,4a) { BIT(1,D); } /* BIT 1,D */ +OP(cb,4b) { BIT(1,E); } /* BIT 1,E */ +OP(cb,4c) { BIT(1,H); } /* BIT 1,H */ +OP(cb,4d) { BIT(1,L); } /* BIT 1,L */ +OP(cb,4e) { BIT(1,RM(HL)); } /* BIT 1,(HL) */ +OP(cb,4f) { BIT(1,A); } /* BIT 1,A */ -OP(cb,50) { BIT(2,B); } /* BIT 2,B */ -OP(cb,51) { BIT(2,C); } /* BIT 2,C */ -OP(cb,52) { BIT(2,D); } /* BIT 2,D */ -OP(cb,53) { BIT(2,E); } /* BIT 2,E */ -OP(cb,54) { BIT(2,H); } /* BIT 2,H */ -OP(cb,55) { BIT(2,L); } /* BIT 2,L */ -OP(cb,56) { BIT(2,RM(HL)); } /* BIT 2,(HL) */ -OP(cb,57) { BIT(2,A); } /* BIT 2,A */ +OP(cb,50) { BIT(2,B); } /* BIT 2,B */ +OP(cb,51) { BIT(2,C); } /* BIT 2,C */ +OP(cb,52) { BIT(2,D); } /* BIT 2,D */ +OP(cb,53) { BIT(2,E); } /* BIT 2,E */ +OP(cb,54) { BIT(2,H); } /* BIT 2,H */ +OP(cb,55) { BIT(2,L); } /* BIT 2,L */ +OP(cb,56) { BIT(2,RM(HL)); } /* BIT 2,(HL) */ +OP(cb,57) { BIT(2,A); } /* BIT 2,A */ -OP(cb,58) { BIT(3,B); } /* BIT 3,B */ -OP(cb,59) { BIT(3,C); } /* BIT 3,C */ -OP(cb,5a) { BIT(3,D); } /* BIT 3,D */ -OP(cb,5b) { BIT(3,E); } /* BIT 3,E */ -OP(cb,5c) { BIT(3,H); } /* BIT 3,H */ -OP(cb,5d) { BIT(3,L); } /* BIT 3,L */ -OP(cb,5e) { BIT(3,RM(HL)); } /* BIT 3,(HL) */ -OP(cb,5f) { BIT(3,A); } /* BIT 3,A */ +OP(cb,58) { BIT(3,B); } /* BIT 3,B */ +OP(cb,59) { BIT(3,C); } /* BIT 3,C */ +OP(cb,5a) { BIT(3,D); } /* BIT 3,D */ +OP(cb,5b) { BIT(3,E); } /* BIT 3,E */ +OP(cb,5c) { BIT(3,H); } /* BIT 3,H */ +OP(cb,5d) { BIT(3,L); } /* BIT 3,L */ +OP(cb,5e) { BIT(3,RM(HL)); } /* BIT 3,(HL) */ +OP(cb,5f) { BIT(3,A); } /* BIT 3,A */ -OP(cb,60) { BIT(4,B); } /* BIT 4,B */ -OP(cb,61) { BIT(4,C); } /* BIT 4,C */ -OP(cb,62) { BIT(4,D); } /* BIT 4,D */ -OP(cb,63) { BIT(4,E); } /* BIT 4,E */ -OP(cb,64) { BIT(4,H); } /* BIT 4,H */ -OP(cb,65) { BIT(4,L); } /* BIT 4,L */ -OP(cb,66) { BIT(4,RM(HL)); } /* BIT 4,(HL) */ -OP(cb,67) { BIT(4,A); } /* BIT 4,A */ +OP(cb,60) { BIT(4,B); } /* BIT 4,B */ +OP(cb,61) { BIT(4,C); } /* BIT 4,C */ +OP(cb,62) { BIT(4,D); } /* BIT 4,D */ +OP(cb,63) { BIT(4,E); } /* BIT 4,E */ +OP(cb,64) { BIT(4,H); } /* BIT 4,H */ +OP(cb,65) { BIT(4,L); } /* BIT 4,L */ +OP(cb,66) { BIT(4,RM(HL)); } /* BIT 4,(HL) */ +OP(cb,67) { BIT(4,A); } /* BIT 4,A */ -OP(cb,68) { BIT(5,B); } /* BIT 5,B */ -OP(cb,69) { BIT(5,C); } /* BIT 5,C */ -OP(cb,6a) { BIT(5,D); } /* BIT 5,D */ -OP(cb,6b) { BIT(5,E); } /* BIT 5,E */ -OP(cb,6c) { BIT(5,H); } /* BIT 5,H */ -OP(cb,6d) { BIT(5,L); } /* BIT 5,L */ -OP(cb,6e) { BIT(5,RM(HL)); } /* BIT 5,(HL) */ -OP(cb,6f) { BIT(5,A); } /* BIT 5,A */ +OP(cb,68) { BIT(5,B); } /* BIT 5,B */ +OP(cb,69) { BIT(5,C); } /* BIT 5,C */ +OP(cb,6a) { BIT(5,D); } /* BIT 5,D */ +OP(cb,6b) { BIT(5,E); } /* BIT 5,E */ +OP(cb,6c) { BIT(5,H); } /* BIT 5,H */ +OP(cb,6d) { BIT(5,L); } /* BIT 5,L */ +OP(cb,6e) { BIT(5,RM(HL)); } /* BIT 5,(HL) */ +OP(cb,6f) { BIT(5,A); } /* BIT 5,A */ -OP(cb,70) { BIT(6,B); } /* BIT 6,B */ -OP(cb,71) { BIT(6,C); } /* BIT 6,C */ -OP(cb,72) { BIT(6,D); } /* BIT 6,D */ -OP(cb,73) { BIT(6,E); } /* BIT 6,E */ -OP(cb,74) { BIT(6,H); } /* BIT 6,H */ -OP(cb,75) { BIT(6,L); } /* BIT 6,L */ -OP(cb,76) { BIT(6,RM(HL)); } /* BIT 6,(HL) */ -OP(cb,77) { BIT(6,A); } /* BIT 6,A */ +OP(cb,70) { BIT(6,B); } /* BIT 6,B */ +OP(cb,71) { BIT(6,C); } /* BIT 6,C */ +OP(cb,72) { BIT(6,D); } /* BIT 6,D */ +OP(cb,73) { BIT(6,E); } /* BIT 6,E */ +OP(cb,74) { BIT(6,H); } /* BIT 6,H */ +OP(cb,75) { BIT(6,L); } /* BIT 6,L */ +OP(cb,76) { BIT(6,RM(HL)); } /* BIT 6,(HL) */ +OP(cb,77) { BIT(6,A); } /* BIT 6,A */ -OP(cb,78) { BIT(7,B); } /* BIT 7,B */ -OP(cb,79) { BIT(7,C); } /* BIT 7,C */ -OP(cb,7a) { BIT(7,D); } /* BIT 7,D */ -OP(cb,7b) { BIT(7,E); } /* BIT 7,E */ -OP(cb,7c) { BIT(7,H); } /* BIT 7,H */ -OP(cb,7d) { BIT(7,L); } /* BIT 7,L */ -OP(cb,7e) { BIT(7,RM(HL)); } /* BIT 7,(HL) */ -OP(cb,7f) { BIT(7,A); } /* BIT 7,A */ +OP(cb,78) { BIT(7,B); } /* BIT 7,B */ +OP(cb,79) { BIT(7,C); } /* BIT 7,C */ +OP(cb,7a) { BIT(7,D); } /* BIT 7,D */ +OP(cb,7b) { BIT(7,E); } /* BIT 7,E */ +OP(cb,7c) { BIT(7,H); } /* BIT 7,H */ +OP(cb,7d) { BIT(7,L); } /* BIT 7,L */ +OP(cb,7e) { BIT(7,RM(HL)); } /* BIT 7,(HL) */ +OP(cb,7f) { BIT(7,A); } /* BIT 7,A */ -OP(cb,80) { B = RES(0,B); } /* RES 0,B */ -OP(cb,81) { C = RES(0,C); } /* RES 0,C */ -OP(cb,82) { D = RES(0,D); } /* RES 0,D */ -OP(cb,83) { E = RES(0,E); } /* RES 0,E */ -OP(cb,84) { H = RES(0,H); } /* RES 0,H */ -OP(cb,85) { L = RES(0,L); } /* RES 0,L */ -OP(cb,86) { WM( HL, RES(0,RM(HL)) ); } /* RES 0,(HL) */ -OP(cb,87) { A = RES(0,A); } /* RES 0,A */ +OP(cb,80) { B = RES(0,B); } /* RES 0,B */ +OP(cb,81) { C = RES(0,C); } /* RES 0,C */ +OP(cb,82) { D = RES(0,D); } /* RES 0,D */ +OP(cb,83) { E = RES(0,E); } /* RES 0,E */ +OP(cb,84) { H = RES(0,H); } /* RES 0,H */ +OP(cb,85) { L = RES(0,L); } /* RES 0,L */ +OP(cb,86) { WM( HL, RES(0,RM(HL)) ); } /* RES 0,(HL) */ +OP(cb,87) { A = RES(0,A); } /* RES 0,A */ -OP(cb,88) { B = RES(1,B); } /* RES 1,B */ -OP(cb,89) { C = RES(1,C); } /* RES 1,C */ -OP(cb,8a) { D = RES(1,D); } /* RES 1,D */ -OP(cb,8b) { E = RES(1,E); } /* RES 1,E */ -OP(cb,8c) { H = RES(1,H); } /* RES 1,H */ -OP(cb,8d) { L = RES(1,L); } /* RES 1,L */ -OP(cb,8e) { WM( HL, RES(1,RM(HL)) ); } /* RES 1,(HL) */ -OP(cb,8f) { A = RES(1,A); } /* RES 1,A */ +OP(cb,88) { B = RES(1,B); } /* RES 1,B */ +OP(cb,89) { C = RES(1,C); } /* RES 1,C */ +OP(cb,8a) { D = RES(1,D); } /* RES 1,D */ +OP(cb,8b) { E = RES(1,E); } /* RES 1,E */ +OP(cb,8c) { H = RES(1,H); } /* RES 1,H */ +OP(cb,8d) { L = RES(1,L); } /* RES 1,L */ +OP(cb,8e) { WM( HL, RES(1,RM(HL)) ); } /* RES 1,(HL) */ +OP(cb,8f) { A = RES(1,A); } /* RES 1,A */ -OP(cb,90) { B = RES(2,B); } /* RES 2,B */ -OP(cb,91) { C = RES(2,C); } /* RES 2,C */ -OP(cb,92) { D = RES(2,D); } /* RES 2,D */ -OP(cb,93) { E = RES(2,E); } /* RES 2,E */ -OP(cb,94) { H = RES(2,H); } /* RES 2,H */ -OP(cb,95) { L = RES(2,L); } /* RES 2,L */ -OP(cb,96) { WM( HL, RES(2,RM(HL)) ); } /* RES 2,(HL) */ -OP(cb,97) { A = RES(2,A); } /* RES 2,A */ +OP(cb,90) { B = RES(2,B); } /* RES 2,B */ +OP(cb,91) { C = RES(2,C); } /* RES 2,C */ +OP(cb,92) { D = RES(2,D); } /* RES 2,D */ +OP(cb,93) { E = RES(2,E); } /* RES 2,E */ +OP(cb,94) { H = RES(2,H); } /* RES 2,H */ +OP(cb,95) { L = RES(2,L); } /* RES 2,L */ +OP(cb,96) { WM( HL, RES(2,RM(HL)) ); } /* RES 2,(HL) */ +OP(cb,97) { A = RES(2,A); } /* RES 2,A */ -OP(cb,98) { B = RES(3,B); } /* RES 3,B */ -OP(cb,99) { C = RES(3,C); } /* RES 3,C */ -OP(cb,9a) { D = RES(3,D); } /* RES 3,D */ -OP(cb,9b) { E = RES(3,E); } /* RES 3,E */ -OP(cb,9c) { H = RES(3,H); } /* RES 3,H */ -OP(cb,9d) { L = RES(3,L); } /* RES 3,L */ -OP(cb,9e) { WM( HL, RES(3,RM(HL)) ); } /* RES 3,(HL) */ -OP(cb,9f) { A = RES(3,A); } /* RES 3,A */ +OP(cb,98) { B = RES(3,B); } /* RES 3,B */ +OP(cb,99) { C = RES(3,C); } /* RES 3,C */ +OP(cb,9a) { D = RES(3,D); } /* RES 3,D */ +OP(cb,9b) { E = RES(3,E); } /* RES 3,E */ +OP(cb,9c) { H = RES(3,H); } /* RES 3,H */ +OP(cb,9d) { L = RES(3,L); } /* RES 3,L */ +OP(cb,9e) { WM( HL, RES(3,RM(HL)) ); } /* RES 3,(HL) */ +OP(cb,9f) { A = RES(3,A); } /* RES 3,A */ -OP(cb,a0) { B = RES(4,B); } /* RES 4,B */ -OP(cb,a1) { C = RES(4,C); } /* RES 4,C */ -OP(cb,a2) { D = RES(4,D); } /* RES 4,D */ -OP(cb,a3) { E = RES(4,E); } /* RES 4,E */ -OP(cb,a4) { H = RES(4,H); } /* RES 4,H */ -OP(cb,a5) { L = RES(4,L); } /* RES 4,L */ -OP(cb,a6) { WM( HL, RES(4,RM(HL)) ); } /* RES 4,(HL) */ -OP(cb,a7) { A = RES(4,A); } /* RES 4,A */ +OP(cb,a0) { B = RES(4,B); } /* RES 4,B */ +OP(cb,a1) { C = RES(4,C); } /* RES 4,C */ +OP(cb,a2) { D = RES(4,D); } /* RES 4,D */ +OP(cb,a3) { E = RES(4,E); } /* RES 4,E */ +OP(cb,a4) { H = RES(4,H); } /* RES 4,H */ +OP(cb,a5) { L = RES(4,L); } /* RES 4,L */ +OP(cb,a6) { WM( HL, RES(4,RM(HL)) ); } /* RES 4,(HL) */ +OP(cb,a7) { A = RES(4,A); } /* RES 4,A */ -OP(cb,a8) { B = RES(5,B); } /* RES 5,B */ -OP(cb,a9) { C = RES(5,C); } /* RES 5,C */ -OP(cb,aa) { D = RES(5,D); } /* RES 5,D */ -OP(cb,ab) { E = RES(5,E); } /* RES 5,E */ -OP(cb,ac) { H = RES(5,H); } /* RES 5,H */ -OP(cb,ad) { L = RES(5,L); } /* RES 5,L */ -OP(cb,ae) { WM( HL, RES(5,RM(HL)) ); } /* RES 5,(HL) */ -OP(cb,af) { A = RES(5,A); } /* RES 5,A */ +OP(cb,a8) { B = RES(5,B); } /* RES 5,B */ +OP(cb,a9) { C = RES(5,C); } /* RES 5,C */ +OP(cb,aa) { D = RES(5,D); } /* RES 5,D */ +OP(cb,ab) { E = RES(5,E); } /* RES 5,E */ +OP(cb,ac) { H = RES(5,H); } /* RES 5,H */ +OP(cb,ad) { L = RES(5,L); } /* RES 5,L */ +OP(cb,ae) { WM( HL, RES(5,RM(HL)) ); } /* RES 5,(HL) */ +OP(cb,af) { A = RES(5,A); } /* RES 5,A */ -OP(cb,b0) { B = RES(6,B); } /* RES 6,B */ -OP(cb,b1) { C = RES(6,C); } /* RES 6,C */ -OP(cb,b2) { D = RES(6,D); } /* RES 6,D */ -OP(cb,b3) { E = RES(6,E); } /* RES 6,E */ -OP(cb,b4) { H = RES(6,H); } /* RES 6,H */ -OP(cb,b5) { L = RES(6,L); } /* RES 6,L */ -OP(cb,b6) { WM( HL, RES(6,RM(HL)) ); } /* RES 6,(HL) */ -OP(cb,b7) { A = RES(6,A); } /* RES 6,A */ +OP(cb,b0) { B = RES(6,B); } /* RES 6,B */ +OP(cb,b1) { C = RES(6,C); } /* RES 6,C */ +OP(cb,b2) { D = RES(6,D); } /* RES 6,D */ +OP(cb,b3) { E = RES(6,E); } /* RES 6,E */ +OP(cb,b4) { H = RES(6,H); } /* RES 6,H */ +OP(cb,b5) { L = RES(6,L); } /* RES 6,L */ +OP(cb,b6) { WM( HL, RES(6,RM(HL)) ); } /* RES 6,(HL) */ +OP(cb,b7) { A = RES(6,A); } /* RES 6,A */ -OP(cb,b8) { B = RES(7,B); } /* RES 7,B */ -OP(cb,b9) { C = RES(7,C); } /* RES 7,C */ -OP(cb,ba) { D = RES(7,D); } /* RES 7,D */ -OP(cb,bb) { E = RES(7,E); } /* RES 7,E */ -OP(cb,bc) { H = RES(7,H); } /* RES 7,H */ -OP(cb,bd) { L = RES(7,L); } /* RES 7,L */ -OP(cb,be) { WM( HL, RES(7,RM(HL)) ); } /* RES 7,(HL) */ -OP(cb,bf) { A = RES(7,A); } /* RES 7,A */ +OP(cb,b8) { B = RES(7,B); } /* RES 7,B */ +OP(cb,b9) { C = RES(7,C); } /* RES 7,C */ +OP(cb,ba) { D = RES(7,D); } /* RES 7,D */ +OP(cb,bb) { E = RES(7,E); } /* RES 7,E */ +OP(cb,bc) { H = RES(7,H); } /* RES 7,H */ +OP(cb,bd) { L = RES(7,L); } /* RES 7,L */ +OP(cb,be) { WM( HL, RES(7,RM(HL)) ); } /* RES 7,(HL) */ +OP(cb,bf) { A = RES(7,A); } /* RES 7,A */ -OP(cb,c0) { B = SET(0,B); } /* SET 0,B */ -OP(cb,c1) { C = SET(0,C); } /* SET 0,C */ -OP(cb,c2) { D = SET(0,D); } /* SET 0,D */ -OP(cb,c3) { E = SET(0,E); } /* SET 0,E */ -OP(cb,c4) { H = SET(0,H); } /* SET 0,H */ -OP(cb,c5) { L = SET(0,L); } /* SET 0,L */ -OP(cb,c6) { WM( HL, SET(0,RM(HL)) ); } /* SET 0,(HL) */ -OP(cb,c7) { A = SET(0,A); } /* SET 0,A */ +OP(cb,c0) { B = SET(0,B); } /* SET 0,B */ +OP(cb,c1) { C = SET(0,C); } /* SET 0,C */ +OP(cb,c2) { D = SET(0,D); } /* SET 0,D */ +OP(cb,c3) { E = SET(0,E); } /* SET 0,E */ +OP(cb,c4) { H = SET(0,H); } /* SET 0,H */ +OP(cb,c5) { L = SET(0,L); } /* SET 0,L */ +OP(cb,c6) { WM( HL, SET(0,RM(HL)) ); } /* SET 0,(HL) */ +OP(cb,c7) { A = SET(0,A); } /* SET 0,A */ -OP(cb,c8) { B = SET(1,B); } /* SET 1,B */ -OP(cb,c9) { C = SET(1,C); } /* SET 1,C */ -OP(cb,ca) { D = SET(1,D); } /* SET 1,D */ -OP(cb,cb) { E = SET(1,E); } /* SET 1,E */ -OP(cb,cc) { H = SET(1,H); } /* SET 1,H */ -OP(cb,cd) { L = SET(1,L); } /* SET 1,L */ -OP(cb,ce) { WM( HL, SET(1,RM(HL)) ); } /* SET 1,(HL) */ -OP(cb,cf) { A = SET(1,A); } /* SET 1,A */ +OP(cb,c8) { B = SET(1,B); } /* SET 1,B */ +OP(cb,c9) { C = SET(1,C); } /* SET 1,C */ +OP(cb,ca) { D = SET(1,D); } /* SET 1,D */ +OP(cb,cb) { E = SET(1,E); } /* SET 1,E */ +OP(cb,cc) { H = SET(1,H); } /* SET 1,H */ +OP(cb,cd) { L = SET(1,L); } /* SET 1,L */ +OP(cb,ce) { WM( HL, SET(1,RM(HL)) ); } /* SET 1,(HL) */ +OP(cb,cf) { A = SET(1,A); } /* SET 1,A */ -OP(cb,d0) { B = SET(2,B); } /* SET 2,B */ -OP(cb,d1) { C = SET(2,C); } /* SET 2,C */ -OP(cb,d2) { D = SET(2,D); } /* SET 2,D */ -OP(cb,d3) { E = SET(2,E); } /* SET 2,E */ -OP(cb,d4) { H = SET(2,H); } /* SET 2,H */ -OP(cb,d5) { L = SET(2,L); } /* SET 2,L */ -OP(cb,d6) { WM( HL, SET(2,RM(HL)) ); } /* SET 2,(HL) */ -OP(cb,d7) { A = SET(2,A); } /* SET 2,A */ +OP(cb,d0) { B = SET(2,B); } /* SET 2,B */ +OP(cb,d1) { C = SET(2,C); } /* SET 2,C */ +OP(cb,d2) { D = SET(2,D); } /* SET 2,D */ +OP(cb,d3) { E = SET(2,E); } /* SET 2,E */ +OP(cb,d4) { H = SET(2,H); } /* SET 2,H */ +OP(cb,d5) { L = SET(2,L); } /* SET 2,L */ +OP(cb,d6) { WM( HL, SET(2,RM(HL)) ); } /* SET 2,(HL) */ +OP(cb,d7) { A = SET(2,A); } /* SET 2,A */ -OP(cb,d8) { B = SET(3,B); } /* SET 3,B */ -OP(cb,d9) { C = SET(3,C); } /* SET 3,C */ -OP(cb,da) { D = SET(3,D); } /* SET 3,D */ -OP(cb,db) { E = SET(3,E); } /* SET 3,E */ -OP(cb,dc) { H = SET(3,H); } /* SET 3,H */ -OP(cb,dd) { L = SET(3,L); } /* SET 3,L */ -OP(cb,de) { WM( HL, SET(3,RM(HL)) ); } /* SET 3,(HL) */ -OP(cb,df) { A = SET(3,A); } /* SET 3,A */ +OP(cb,d8) { B = SET(3,B); } /* SET 3,B */ +OP(cb,d9) { C = SET(3,C); } /* SET 3,C */ +OP(cb,da) { D = SET(3,D); } /* SET 3,D */ +OP(cb,db) { E = SET(3,E); } /* SET 3,E */ +OP(cb,dc) { H = SET(3,H); } /* SET 3,H */ +OP(cb,dd) { L = SET(3,L); } /* SET 3,L */ +OP(cb,de) { WM( HL, SET(3,RM(HL)) ); } /* SET 3,(HL) */ +OP(cb,df) { A = SET(3,A); } /* SET 3,A */ -OP(cb,e0) { B = SET(4,B); } /* SET 4,B */ -OP(cb,e1) { C = SET(4,C); } /* SET 4,C */ -OP(cb,e2) { D = SET(4,D); } /* SET 4,D */ -OP(cb,e3) { E = SET(4,E); } /* SET 4,E */ -OP(cb,e4) { H = SET(4,H); } /* SET 4,H */ -OP(cb,e5) { L = SET(4,L); } /* SET 4,L */ -OP(cb,e6) { WM( HL, SET(4,RM(HL)) ); } /* SET 4,(HL) */ -OP(cb,e7) { A = SET(4,A); } /* SET 4,A */ +OP(cb,e0) { B = SET(4,B); } /* SET 4,B */ +OP(cb,e1) { C = SET(4,C); } /* SET 4,C */ +OP(cb,e2) { D = SET(4,D); } /* SET 4,D */ +OP(cb,e3) { E = SET(4,E); } /* SET 4,E */ +OP(cb,e4) { H = SET(4,H); } /* SET 4,H */ +OP(cb,e5) { L = SET(4,L); } /* SET 4,L */ +OP(cb,e6) { WM( HL, SET(4,RM(HL)) ); } /* SET 4,(HL) */ +OP(cb,e7) { A = SET(4,A); } /* SET 4,A */ -OP(cb,e8) { B = SET(5,B); } /* SET 5,B */ -OP(cb,e9) { C = SET(5,C); } /* SET 5,C */ -OP(cb,ea) { D = SET(5,D); } /* SET 5,D */ -OP(cb,eb) { E = SET(5,E); } /* SET 5,E */ -OP(cb,ec) { H = SET(5,H); } /* SET 5,H */ -OP(cb,ed) { L = SET(5,L); } /* SET 5,L */ -OP(cb,ee) { WM( HL, SET(5,RM(HL)) ); } /* SET 5,(HL) */ -OP(cb,ef) { A = SET(5,A); } /* SET 5,A */ +OP(cb,e8) { B = SET(5,B); } /* SET 5,B */ +OP(cb,e9) { C = SET(5,C); } /* SET 5,C */ +OP(cb,ea) { D = SET(5,D); } /* SET 5,D */ +OP(cb,eb) { E = SET(5,E); } /* SET 5,E */ +OP(cb,ec) { H = SET(5,H); } /* SET 5,H */ +OP(cb,ed) { L = SET(5,L); } /* SET 5,L */ +OP(cb,ee) { WM( HL, SET(5,RM(HL)) ); } /* SET 5,(HL) */ +OP(cb,ef) { A = SET(5,A); } /* SET 5,A */ -OP(cb,f0) { B = SET(6,B); } /* SET 6,B */ -OP(cb,f1) { C = SET(6,C); } /* SET 6,C */ -OP(cb,f2) { D = SET(6,D); } /* SET 6,D */ -OP(cb,f3) { E = SET(6,E); } /* SET 6,E */ -OP(cb,f4) { H = SET(6,H); } /* SET 6,H */ -OP(cb,f5) { L = SET(6,L); } /* SET 6,L */ -OP(cb,f6) { WM( HL, SET(6,RM(HL)) ); } /* SET 6,(HL) */ -OP(cb,f7) { A = SET(6,A); } /* SET 6,A */ +OP(cb,f0) { B = SET(6,B); } /* SET 6,B */ +OP(cb,f1) { C = SET(6,C); } /* SET 6,C */ +OP(cb,f2) { D = SET(6,D); } /* SET 6,D */ +OP(cb,f3) { E = SET(6,E); } /* SET 6,E */ +OP(cb,f4) { H = SET(6,H); } /* SET 6,H */ +OP(cb,f5) { L = SET(6,L); } /* SET 6,L */ +OP(cb,f6) { WM( HL, SET(6,RM(HL)) ); } /* SET 6,(HL) */ +OP(cb,f7) { A = SET(6,A); } /* SET 6,A */ -OP(cb,f8) { B = SET(7,B); } /* SET 7,B */ -OP(cb,f9) { C = SET(7,C); } /* SET 7,C */ -OP(cb,fa) { D = SET(7,D); } /* SET 7,D */ -OP(cb,fb) { E = SET(7,E); } /* SET 7,E */ -OP(cb,fc) { H = SET(7,H); } /* SET 7,H */ -OP(cb,fd) { L = SET(7,L); } /* SET 7,L */ -OP(cb,fe) { WM( HL, SET(7,RM(HL)) ); } /* SET 7,(HL) */ -OP(cb,ff) { A = SET(7,A); } /* SET 7,A */ +OP(cb,f8) { B = SET(7,B); } /* SET 7,B */ +OP(cb,f9) { C = SET(7,C); } /* SET 7,C */ +OP(cb,fa) { D = SET(7,D); } /* SET 7,D */ +OP(cb,fb) { E = SET(7,E); } /* SET 7,E */ +OP(cb,fc) { H = SET(7,H); } /* SET 7,H */ +OP(cb,fd) { L = SET(7,L); } /* SET 7,L */ +OP(cb,fe) { WM( HL, SET(7,RM(HL)) ); } /* SET 7,(HL) */ +OP(cb,ff) { A = SET(7,A); } /* SET 7,A */ /********************************************************** * opcodes with DD/FD CB prefix * rotate, shift and bit operations with (IX+o) **********************************************************/ -OP(xycb,00) { B = RLC( RM(EA) ); WM( EA,B ); } /* RLC B=(XY+o) */ -OP(xycb,01) { C = RLC( RM(EA) ); WM( EA,C ); } /* RLC C=(XY+o) */ -OP(xycb,02) { D = RLC( RM(EA) ); WM( EA,D ); } /* RLC D=(XY+o) */ -OP(xycb,03) { E = RLC( RM(EA) ); WM( EA,E ); } /* RLC E=(XY+o) */ -OP(xycb,04) { H = RLC( RM(EA) ); WM( EA,H ); } /* RLC H=(XY+o) */ -OP(xycb,05) { L = RLC( RM(EA) ); WM( EA,L ); } /* RLC L=(XY+o) */ -OP(xycb,06) { WM( EA, RLC( RM(EA) ) ); } /* RLC (XY+o) */ -OP(xycb,07) { A = RLC( RM(EA) ); WM( EA,A ); } /* RLC A=(XY+o) */ +OP(xycb,00) { B = RLC( RM(EA) ); WM( EA,B ); } /* RLC B=(XY+o) */ +OP(xycb,01) { C = RLC( RM(EA) ); WM( EA,C ); } /* RLC C=(XY+o) */ +OP(xycb,02) { D = RLC( RM(EA) ); WM( EA,D ); } /* RLC D=(XY+o) */ +OP(xycb,03) { E = RLC( RM(EA) ); WM( EA,E ); } /* RLC E=(XY+o) */ +OP(xycb,04) { H = RLC( RM(EA) ); WM( EA,H ); } /* RLC H=(XY+o) */ +OP(xycb,05) { L = RLC( RM(EA) ); WM( EA,L ); } /* RLC L=(XY+o) */ +OP(xycb,06) { WM( EA, RLC( RM(EA) ) ); } /* RLC (XY+o) */ +OP(xycb,07) { A = RLC( RM(EA) ); WM( EA,A ); } /* RLC A=(XY+o) */ -OP(xycb,08) { B = RRC( RM(EA) ); WM( EA,B ); } /* RRC B=(XY+o) */ -OP(xycb,09) { C = RRC( RM(EA) ); WM( EA,C ); } /* RRC C=(XY+o) */ -OP(xycb,0a) { D = RRC( RM(EA) ); WM( EA,D ); } /* RRC D=(XY+o) */ -OP(xycb,0b) { E = RRC( RM(EA) ); WM( EA,E ); } /* RRC E=(XY+o) */ -OP(xycb,0c) { H = RRC( RM(EA) ); WM( EA,H ); } /* RRC H=(XY+o) */ -OP(xycb,0d) { L = RRC( RM(EA) ); WM( EA,L ); } /* RRC L=(XY+o) */ -OP(xycb,0e) { WM( EA,RRC( RM(EA) ) ); } /* RRC (XY+o) */ -OP(xycb,0f) { A = RRC( RM(EA) ); WM( EA,A ); } /* RRC A=(XY+o) */ +OP(xycb,08) { B = RRC( RM(EA) ); WM( EA,B ); } /* RRC B=(XY+o) */ +OP(xycb,09) { C = RRC( RM(EA) ); WM( EA,C ); } /* RRC C=(XY+o) */ +OP(xycb,0a) { D = RRC( RM(EA) ); WM( EA,D ); } /* RRC D=(XY+o) */ +OP(xycb,0b) { E = RRC( RM(EA) ); WM( EA,E ); } /* RRC E=(XY+o) */ +OP(xycb,0c) { H = RRC( RM(EA) ); WM( EA,H ); } /* RRC H=(XY+o) */ +OP(xycb,0d) { L = RRC( RM(EA) ); WM( EA,L ); } /* RRC L=(XY+o) */ +OP(xycb,0e) { WM( EA,RRC( RM(EA) ) ); } /* RRC (XY+o) */ +OP(xycb,0f) { A = RRC( RM(EA) ); WM( EA,A ); } /* RRC A=(XY+o) */ -OP(xycb,10) { B = RL( RM(EA) ); WM( EA,B ); } /* RL B=(XY+o) */ -OP(xycb,11) { C = RL( RM(EA) ); WM( EA,C ); } /* RL C=(XY+o) */ -OP(xycb,12) { D = RL( RM(EA) ); WM( EA,D ); } /* RL D=(XY+o) */ -OP(xycb,13) { E = RL( RM(EA) ); WM( EA,E ); } /* RL E=(XY+o) */ -OP(xycb,14) { H = RL( RM(EA) ); WM( EA,H ); } /* RL H=(XY+o) */ -OP(xycb,15) { L = RL( RM(EA) ); WM( EA,L ); } /* RL L=(XY+o) */ -OP(xycb,16) { WM( EA,RL( RM(EA) ) ); } /* RL (XY+o) */ -OP(xycb,17) { A = RL( RM(EA) ); WM( EA,A ); } /* RL A=(XY+o) */ +OP(xycb,10) { B = RL( RM(EA) ); WM( EA,B ); } /* RL B=(XY+o) */ +OP(xycb,11) { C = RL( RM(EA) ); WM( EA,C ); } /* RL C=(XY+o) */ +OP(xycb,12) { D = RL( RM(EA) ); WM( EA,D ); } /* RL D=(XY+o) */ +OP(xycb,13) { E = RL( RM(EA) ); WM( EA,E ); } /* RL E=(XY+o) */ +OP(xycb,14) { H = RL( RM(EA) ); WM( EA,H ); } /* RL H=(XY+o) */ +OP(xycb,15) { L = RL( RM(EA) ); WM( EA,L ); } /* RL L=(XY+o) */ +OP(xycb,16) { WM( EA,RL( RM(EA) ) ); } /* RL (XY+o) */ +OP(xycb,17) { A = RL( RM(EA) ); WM( EA,A ); } /* RL A=(XY+o) */ -OP(xycb,18) { B = RR( RM(EA) ); WM( EA,B ); } /* RR B=(XY+o) */ -OP(xycb,19) { C = RR( RM(EA) ); WM( EA,C ); } /* RR C=(XY+o) */ -OP(xycb,1a) { D = RR( RM(EA) ); WM( EA,D ); } /* RR D=(XY+o) */ -OP(xycb,1b) { E = RR( RM(EA) ); WM( EA,E ); } /* RR E=(XY+o) */ -OP(xycb,1c) { H = RR( RM(EA) ); WM( EA,H ); } /* RR H=(XY+o) */ -OP(xycb,1d) { L = RR( RM(EA) ); WM( EA,L ); } /* RR L=(XY+o) */ -OP(xycb,1e) { WM( EA,RR( RM(EA) ) ); } /* RR (XY+o) */ -OP(xycb,1f) { A = RR( RM(EA) ); WM( EA,A ); } /* RR A=(XY+o) */ +OP(xycb,18) { B = RR( RM(EA) ); WM( EA,B ); } /* RR B=(XY+o) */ +OP(xycb,19) { C = RR( RM(EA) ); WM( EA,C ); } /* RR C=(XY+o) */ +OP(xycb,1a) { D = RR( RM(EA) ); WM( EA,D ); } /* RR D=(XY+o) */ +OP(xycb,1b) { E = RR( RM(EA) ); WM( EA,E ); } /* RR E=(XY+o) */ +OP(xycb,1c) { H = RR( RM(EA) ); WM( EA,H ); } /* RR H=(XY+o) */ +OP(xycb,1d) { L = RR( RM(EA) ); WM( EA,L ); } /* RR L=(XY+o) */ +OP(xycb,1e) { WM( EA,RR( RM(EA) ) ); } /* RR (XY+o) */ +OP(xycb,1f) { A = RR( RM(EA) ); WM( EA,A ); } /* RR A=(XY+o) */ -OP(xycb,20) { B = SLA( RM(EA) ); WM( EA,B ); } /* SLA B=(XY+o) */ -OP(xycb,21) { C = SLA( RM(EA) ); WM( EA,C ); } /* SLA C=(XY+o) */ -OP(xycb,22) { D = SLA( RM(EA) ); WM( EA,D ); } /* SLA D=(XY+o) */ -OP(xycb,23) { E = SLA( RM(EA) ); WM( EA,E ); } /* SLA E=(XY+o) */ -OP(xycb,24) { H = SLA( RM(EA) ); WM( EA,H ); } /* SLA H=(XY+o) */ -OP(xycb,25) { L = SLA( RM(EA) ); WM( EA,L ); } /* SLA L=(XY+o) */ -OP(xycb,26) { WM( EA,SLA( RM(EA) ) ); } /* SLA (XY+o) */ -OP(xycb,27) { A = SLA( RM(EA) ); WM( EA,A ); } /* SLA A=(XY+o) */ +OP(xycb,20) { B = SLA( RM(EA) ); WM( EA,B ); } /* SLA B=(XY+o) */ +OP(xycb,21) { C = SLA( RM(EA) ); WM( EA,C ); } /* SLA C=(XY+o) */ +OP(xycb,22) { D = SLA( RM(EA) ); WM( EA,D ); } /* SLA D=(XY+o) */ +OP(xycb,23) { E = SLA( RM(EA) ); WM( EA,E ); } /* SLA E=(XY+o) */ +OP(xycb,24) { H = SLA( RM(EA) ); WM( EA,H ); } /* SLA H=(XY+o) */ +OP(xycb,25) { L = SLA( RM(EA) ); WM( EA,L ); } /* SLA L=(XY+o) */ +OP(xycb,26) { WM( EA,SLA( RM(EA) ) ); } /* SLA (XY+o) */ +OP(xycb,27) { A = SLA( RM(EA) ); WM( EA,A ); } /* SLA A=(XY+o) */ -OP(xycb,28) { B = SRA( RM(EA) ); WM( EA,B ); } /* SRA B=(XY+o) */ -OP(xycb,29) { C = SRA( RM(EA) ); WM( EA,C ); } /* SRA C=(XY+o) */ -OP(xycb,2a) { D = SRA( RM(EA) ); WM( EA,D ); } /* SRA D=(XY+o) */ -OP(xycb,2b) { E = SRA( RM(EA) ); WM( EA,E ); } /* SRA E=(XY+o) */ -OP(xycb,2c) { H = SRA( RM(EA) ); WM( EA,H ); } /* SRA H=(XY+o) */ -OP(xycb,2d) { L = SRA( RM(EA) ); WM( EA,L ); } /* SRA L=(XY+o) */ -OP(xycb,2e) { WM( EA,SRA( RM(EA) ) ); } /* SRA (XY+o) */ -OP(xycb,2f) { A = SRA( RM(EA) ); WM( EA,A ); } /* SRA A=(XY+o) */ +OP(xycb,28) { B = SRA( RM(EA) ); WM( EA,B ); } /* SRA B=(XY+o) */ +OP(xycb,29) { C = SRA( RM(EA) ); WM( EA,C ); } /* SRA C=(XY+o) */ +OP(xycb,2a) { D = SRA( RM(EA) ); WM( EA,D ); } /* SRA D=(XY+o) */ +OP(xycb,2b) { E = SRA( RM(EA) ); WM( EA,E ); } /* SRA E=(XY+o) */ +OP(xycb,2c) { H = SRA( RM(EA) ); WM( EA,H ); } /* SRA H=(XY+o) */ +OP(xycb,2d) { L = SRA( RM(EA) ); WM( EA,L ); } /* SRA L=(XY+o) */ +OP(xycb,2e) { WM( EA,SRA( RM(EA) ) ); } /* SRA (XY+o) */ +OP(xycb,2f) { A = SRA( RM(EA) ); WM( EA,A ); } /* SRA A=(XY+o) */ -OP(xycb,30) { B = SLL( RM(EA) ); WM( EA,B ); } /* SLL B=(XY+o) */ -OP(xycb,31) { C = SLL( RM(EA) ); WM( EA,C ); } /* SLL C=(XY+o) */ -OP(xycb,32) { D = SLL( RM(EA) ); WM( EA,D ); } /* SLL D=(XY+o) */ -OP(xycb,33) { E = SLL( RM(EA) ); WM( EA,E ); } /* SLL E=(XY+o) */ -OP(xycb,34) { H = SLL( RM(EA) ); WM( EA,H ); } /* SLL H=(XY+o) */ -OP(xycb,35) { L = SLL( RM(EA) ); WM( EA,L ); } /* SLL L=(XY+o) */ -OP(xycb,36) { WM( EA,SLL( RM(EA) ) ); } /* SLL (XY+o) */ -OP(xycb,37) { A = SLL( RM(EA) ); WM( EA,A ); } /* SLL A=(XY+o) */ +OP(xycb,30) { B = SLL( RM(EA) ); WM( EA,B ); } /* SLL B=(XY+o) */ +OP(xycb,31) { C = SLL( RM(EA) ); WM( EA,C ); } /* SLL C=(XY+o) */ +OP(xycb,32) { D = SLL( RM(EA) ); WM( EA,D ); } /* SLL D=(XY+o) */ +OP(xycb,33) { E = SLL( RM(EA) ); WM( EA,E ); } /* SLL E=(XY+o) */ +OP(xycb,34) { H = SLL( RM(EA) ); WM( EA,H ); } /* SLL H=(XY+o) */ +OP(xycb,35) { L = SLL( RM(EA) ); WM( EA,L ); } /* SLL L=(XY+o) */ +OP(xycb,36) { WM( EA,SLL( RM(EA) ) ); } /* SLL (XY+o) */ +OP(xycb,37) { A = SLL( RM(EA) ); WM( EA,A ); } /* SLL A=(XY+o) */ -OP(xycb,38) { B = SRL( RM(EA) ); WM( EA,B ); } /* SRL B=(XY+o) */ -OP(xycb,39) { C = SRL( RM(EA) ); WM( EA,C ); } /* SRL C=(XY+o) */ -OP(xycb,3a) { D = SRL( RM(EA) ); WM( EA,D ); } /* SRL D=(XY+o) */ -OP(xycb,3b) { E = SRL( RM(EA) ); WM( EA,E ); } /* SRL E=(XY+o) */ -OP(xycb,3c) { H = SRL( RM(EA) ); WM( EA,H ); } /* SRL H=(XY+o) */ -OP(xycb,3d) { L = SRL( RM(EA) ); WM( EA,L ); } /* SRL L=(XY+o) */ -OP(xycb,3e) { WM( EA,SRL( RM(EA) ) ); } /* SRL (XY+o) */ -OP(xycb,3f) { A = SRL( RM(EA) ); WM( EA,A ); } /* SRL A=(XY+o) */ +OP(xycb,38) { B = SRL( RM(EA) ); WM( EA,B ); } /* SRL B=(XY+o) */ +OP(xycb,39) { C = SRL( RM(EA) ); WM( EA,C ); } /* SRL C=(XY+o) */ +OP(xycb,3a) { D = SRL( RM(EA) ); WM( EA,D ); } /* SRL D=(XY+o) */ +OP(xycb,3b) { E = SRL( RM(EA) ); WM( EA,E ); } /* SRL E=(XY+o) */ +OP(xycb,3c) { H = SRL( RM(EA) ); WM( EA,H ); } /* SRL H=(XY+o) */ +OP(xycb,3d) { L = SRL( RM(EA) ); WM( EA,L ); } /* SRL L=(XY+o) */ +OP(xycb,3e) { WM( EA,SRL( RM(EA) ) ); } /* SRL (XY+o) */ +OP(xycb,3f) { A = SRL( RM(EA) ); WM( EA,A ); } /* SRL A=(XY+o) */ -OP(xycb,40) { xycb_46(); } /* BIT 0,(XY+o) */ -OP(xycb,41) { xycb_46(); } /* BIT 0,(XY+o) */ -OP(xycb,42) { xycb_46(); } /* BIT 0,(XY+o) */ -OP(xycb,43) { xycb_46(); } /* BIT 0,(XY+o) */ -OP(xycb,44) { xycb_46(); } /* BIT 0,(XY+o) */ -OP(xycb,45) { xycb_46(); } /* BIT 0,(XY+o) */ -OP(xycb,46) { BIT_XY(0,RM(EA)); } /* BIT 0,(XY+o) */ -OP(xycb,47) { xycb_46(); } /* BIT 0,(XY+o) */ +OP(xycb,40) { xycb_46(); } /* BIT 0,(XY+o) */ +OP(xycb,41) { xycb_46(); } /* BIT 0,(XY+o) */ +OP(xycb,42) { xycb_46(); } /* BIT 0,(XY+o) */ +OP(xycb,43) { xycb_46(); } /* BIT 0,(XY+o) */ +OP(xycb,44) { xycb_46(); } /* BIT 0,(XY+o) */ +OP(xycb,45) { xycb_46(); } /* BIT 0,(XY+o) */ +OP(xycb,46) { BIT_XY(0,RM(EA)); } /* BIT 0,(XY+o) */ +OP(xycb,47) { xycb_46(); } /* BIT 0,(XY+o) */ -OP(xycb,48) { xycb_4e(); } /* BIT 1,(XY+o) */ -OP(xycb,49) { xycb_4e(); } /* BIT 1,(XY+o) */ -OP(xycb,4a) { xycb_4e(); } /* BIT 1,(XY+o) */ -OP(xycb,4b) { xycb_4e(); } /* BIT 1,(XY+o) */ -OP(xycb,4c) { xycb_4e(); } /* BIT 1,(XY+o) */ -OP(xycb,4d) { xycb_4e(); } /* BIT 1,(XY+o) */ -OP(xycb,4e) { BIT_XY(1,RM(EA)); } /* BIT 1,(XY+o) */ -OP(xycb,4f) { xycb_4e(); } /* BIT 1,(XY+o) */ +OP(xycb,48) { xycb_4e(); } /* BIT 1,(XY+o) */ +OP(xycb,49) { xycb_4e(); } /* BIT 1,(XY+o) */ +OP(xycb,4a) { xycb_4e(); } /* BIT 1,(XY+o) */ +OP(xycb,4b) { xycb_4e(); } /* BIT 1,(XY+o) */ +OP(xycb,4c) { xycb_4e(); } /* BIT 1,(XY+o) */ +OP(xycb,4d) { xycb_4e(); } /* BIT 1,(XY+o) */ +OP(xycb,4e) { BIT_XY(1,RM(EA)); } /* BIT 1,(XY+o) */ +OP(xycb,4f) { xycb_4e(); } /* BIT 1,(XY+o) */ -OP(xycb,50) { xycb_56(); } /* BIT 2,(XY+o) */ -OP(xycb,51) { xycb_56(); } /* BIT 2,(XY+o) */ -OP(xycb,52) { xycb_56(); } /* BIT 2,(XY+o) */ -OP(xycb,53) { xycb_56(); } /* BIT 2,(XY+o) */ -OP(xycb,54) { xycb_56(); } /* BIT 2,(XY+o) */ -OP(xycb,55) { xycb_56(); } /* BIT 2,(XY+o) */ -OP(xycb,56) { BIT_XY(2,RM(EA)); } /* BIT 2,(XY+o) */ -OP(xycb,57) { xycb_56(); } /* BIT 2,(XY+o) */ +OP(xycb,50) { xycb_56(); } /* BIT 2,(XY+o) */ +OP(xycb,51) { xycb_56(); } /* BIT 2,(XY+o) */ +OP(xycb,52) { xycb_56(); } /* BIT 2,(XY+o) */ +OP(xycb,53) { xycb_56(); } /* BIT 2,(XY+o) */ +OP(xycb,54) { xycb_56(); } /* BIT 2,(XY+o) */ +OP(xycb,55) { xycb_56(); } /* BIT 2,(XY+o) */ +OP(xycb,56) { BIT_XY(2,RM(EA)); } /* BIT 2,(XY+o) */ +OP(xycb,57) { xycb_56(); } /* BIT 2,(XY+o) */ -OP(xycb,58) { xycb_5e(); } /* BIT 3,(XY+o) */ -OP(xycb,59) { xycb_5e(); } /* BIT 3,(XY+o) */ -OP(xycb,5a) { xycb_5e(); } /* BIT 3,(XY+o) */ -OP(xycb,5b) { xycb_5e(); } /* BIT 3,(XY+o) */ -OP(xycb,5c) { xycb_5e(); } /* BIT 3,(XY+o) */ -OP(xycb,5d) { xycb_5e(); } /* BIT 3,(XY+o) */ -OP(xycb,5e) { BIT_XY(3,RM(EA)); } /* BIT 3,(XY+o) */ -OP(xycb,5f) { xycb_5e(); } /* BIT 3,(XY+o) */ +OP(xycb,58) { xycb_5e(); } /* BIT 3,(XY+o) */ +OP(xycb,59) { xycb_5e(); } /* BIT 3,(XY+o) */ +OP(xycb,5a) { xycb_5e(); } /* BIT 3,(XY+o) */ +OP(xycb,5b) { xycb_5e(); } /* BIT 3,(XY+o) */ +OP(xycb,5c) { xycb_5e(); } /* BIT 3,(XY+o) */ +OP(xycb,5d) { xycb_5e(); } /* BIT 3,(XY+o) */ +OP(xycb,5e) { BIT_XY(3,RM(EA)); } /* BIT 3,(XY+o) */ +OP(xycb,5f) { xycb_5e(); } /* BIT 3,(XY+o) */ -OP(xycb,60) { xycb_66(); } /* BIT 4,(XY+o) */ -OP(xycb,61) { xycb_66(); } /* BIT 4,(XY+o) */ -OP(xycb,62) { xycb_66(); } /* BIT 4,(XY+o) */ -OP(xycb,63) { xycb_66(); } /* BIT 4,(XY+o) */ -OP(xycb,64) { xycb_66(); } /* BIT 4,(XY+o) */ -OP(xycb,65) { xycb_66(); } /* BIT 4,(XY+o) */ -OP(xycb,66) { BIT_XY(4,RM(EA)); } /* BIT 4,(XY+o) */ -OP(xycb,67) { xycb_66(); } /* BIT 4,(XY+o) */ +OP(xycb,60) { xycb_66(); } /* BIT 4,(XY+o) */ +OP(xycb,61) { xycb_66(); } /* BIT 4,(XY+o) */ +OP(xycb,62) { xycb_66(); } /* BIT 4,(XY+o) */ +OP(xycb,63) { xycb_66(); } /* BIT 4,(XY+o) */ +OP(xycb,64) { xycb_66(); } /* BIT 4,(XY+o) */ +OP(xycb,65) { xycb_66(); } /* BIT 4,(XY+o) */ +OP(xycb,66) { BIT_XY(4,RM(EA)); } /* BIT 4,(XY+o) */ +OP(xycb,67) { xycb_66(); } /* BIT 4,(XY+o) */ -OP(xycb,68) { xycb_6e(); } /* BIT 5,(XY+o) */ -OP(xycb,69) { xycb_6e(); } /* BIT 5,(XY+o) */ -OP(xycb,6a) { xycb_6e(); } /* BIT 5,(XY+o) */ -OP(xycb,6b) { xycb_6e(); } /* BIT 5,(XY+o) */ -OP(xycb,6c) { xycb_6e(); } /* BIT 5,(XY+o) */ -OP(xycb,6d) { xycb_6e(); } /* BIT 5,(XY+o) */ -OP(xycb,6e) { BIT_XY(5,RM(EA)); } /* BIT 5,(XY+o) */ -OP(xycb,6f) { xycb_6e(); } /* BIT 5,(XY+o) */ +OP(xycb,68) { xycb_6e(); } /* BIT 5,(XY+o) */ +OP(xycb,69) { xycb_6e(); } /* BIT 5,(XY+o) */ +OP(xycb,6a) { xycb_6e(); } /* BIT 5,(XY+o) */ +OP(xycb,6b) { xycb_6e(); } /* BIT 5,(XY+o) */ +OP(xycb,6c) { xycb_6e(); } /* BIT 5,(XY+o) */ +OP(xycb,6d) { xycb_6e(); } /* BIT 5,(XY+o) */ +OP(xycb,6e) { BIT_XY(5,RM(EA)); } /* BIT 5,(XY+o) */ +OP(xycb,6f) { xycb_6e(); } /* BIT 5,(XY+o) */ -OP(xycb,70) { xycb_66(); } /* BIT 6,(XY+o) */ -OP(xycb,71) { xycb_66(); } /* BIT 6,(XY+o) */ -OP(xycb,72) { xycb_66(); } /* BIT 6,(XY+o) */ -OP(xycb,73) { xycb_66(); } /* BIT 6,(XY+o) */ -OP(xycb,74) { xycb_66(); } /* BIT 6,(XY+o) */ -OP(xycb,75) { xycb_66(); } /* BIT 6,(XY+o) */ -OP(xycb,76) { BIT_XY(6,RM(EA)); } /* BIT 6,(XY+o) */ -OP(xycb,77) { xycb_66(); } /* BIT 6,(XY+o) */ +OP(xycb,70) { xycb_66(); } /* BIT 6,(XY+o) */ +OP(xycb,71) { xycb_66(); } /* BIT 6,(XY+o) */ +OP(xycb,72) { xycb_66(); } /* BIT 6,(XY+o) */ +OP(xycb,73) { xycb_66(); } /* BIT 6,(XY+o) */ +OP(xycb,74) { xycb_66(); } /* BIT 6,(XY+o) */ +OP(xycb,75) { xycb_66(); } /* BIT 6,(XY+o) */ +OP(xycb,76) { BIT_XY(6,RM(EA)); } /* BIT 6,(XY+o) */ +OP(xycb,77) { xycb_66(); } /* BIT 6,(XY+o) */ -OP(xycb,78) { xycb_7e(); } /* BIT 7,(XY+o) */ -OP(xycb,79) { xycb_7e(); } /* BIT 7,(XY+o) */ -OP(xycb,7a) { xycb_7e(); } /* BIT 7,(XY+o) */ -OP(xycb,7b) { xycb_7e(); } /* BIT 7,(XY+o) */ -OP(xycb,7c) { xycb_7e(); } /* BIT 7,(XY+o) */ -OP(xycb,7d) { xycb_7e(); } /* BIT 7,(XY+o) */ -OP(xycb,7e) { BIT_XY(7,RM(EA)); } /* BIT 7,(XY+o) */ -OP(xycb,7f) { xycb_7e(); } /* BIT 7,(XY+o) */ +OP(xycb,78) { xycb_7e(); } /* BIT 7,(XY+o) */ +OP(xycb,79) { xycb_7e(); } /* BIT 7,(XY+o) */ +OP(xycb,7a) { xycb_7e(); } /* BIT 7,(XY+o) */ +OP(xycb,7b) { xycb_7e(); } /* BIT 7,(XY+o) */ +OP(xycb,7c) { xycb_7e(); } /* BIT 7,(XY+o) */ +OP(xycb,7d) { xycb_7e(); } /* BIT 7,(XY+o) */ +OP(xycb,7e) { BIT_XY(7,RM(EA)); } /* BIT 7,(XY+o) */ +OP(xycb,7f) { xycb_7e(); } /* BIT 7,(XY+o) */ -OP(xycb,80) { B = RES(0, RM(EA) ); WM( EA,B ); } /* RES 0,B=(XY+o) */ -OP(xycb,81) { C = RES(0, RM(EA) ); WM( EA,C ); } /* RES 0,C=(XY+o) */ -OP(xycb,82) { D = RES(0, RM(EA) ); WM( EA,D ); } /* RES 0,D=(XY+o) */ -OP(xycb,83) { E = RES(0, RM(EA) ); WM( EA,E ); } /* RES 0,E=(XY+o) */ -OP(xycb,84) { H = RES(0, RM(EA) ); WM( EA,H ); } /* RES 0,H=(XY+o) */ -OP(xycb,85) { L = RES(0, RM(EA) ); WM( EA,L ); } /* RES 0,L=(XY+o) */ -OP(xycb,86) { WM( EA, RES(0,RM(EA)) ); } /* RES 0,(XY+o) */ -OP(xycb,87) { A = RES(0, RM(EA) ); WM( EA,A ); } /* RES 0,A=(XY+o) */ +OP(xycb,80) { B = RES(0, RM(EA) ); WM( EA,B ); } /* RES 0,B=(XY+o) */ +OP(xycb,81) { C = RES(0, RM(EA) ); WM( EA,C ); } /* RES 0,C=(XY+o) */ +OP(xycb,82) { D = RES(0, RM(EA) ); WM( EA,D ); } /* RES 0,D=(XY+o) */ +OP(xycb,83) { E = RES(0, RM(EA) ); WM( EA,E ); } /* RES 0,E=(XY+o) */ +OP(xycb,84) { H = RES(0, RM(EA) ); WM( EA,H ); } /* RES 0,H=(XY+o) */ +OP(xycb,85) { L = RES(0, RM(EA) ); WM( EA,L ); } /* RES 0,L=(XY+o) */ +OP(xycb,86) { WM( EA, RES(0,RM(EA)) ); } /* RES 0,(XY+o) */ +OP(xycb,87) { A = RES(0, RM(EA) ); WM( EA,A ); } /* RES 0,A=(XY+o) */ -OP(xycb,88) { B = RES(1, RM(EA) ); WM( EA,B ); } /* RES 1,B=(XY+o) */ -OP(xycb,89) { C = RES(1, RM(EA) ); WM( EA,C ); } /* RES 1,C=(XY+o) */ -OP(xycb,8a) { D = RES(1, RM(EA) ); WM( EA,D ); } /* RES 1,D=(XY+o) */ -OP(xycb,8b) { E = RES(1, RM(EA) ); WM( EA,E ); } /* RES 1,E=(XY+o) */ -OP(xycb,8c) { H = RES(1, RM(EA) ); WM( EA,H ); } /* RES 1,H=(XY+o) */ -OP(xycb,8d) { L = RES(1, RM(EA) ); WM( EA,L ); } /* RES 1,L=(XY+o) */ -OP(xycb,8e) { WM( EA, RES(1,RM(EA)) ); } /* RES 1,(XY+o) */ -OP(xycb,8f) { A = RES(1, RM(EA) ); WM( EA,A ); } /* RES 1,A=(XY+o) */ +OP(xycb,88) { B = RES(1, RM(EA) ); WM( EA,B ); } /* RES 1,B=(XY+o) */ +OP(xycb,89) { C = RES(1, RM(EA) ); WM( EA,C ); } /* RES 1,C=(XY+o) */ +OP(xycb,8a) { D = RES(1, RM(EA) ); WM( EA,D ); } /* RES 1,D=(XY+o) */ +OP(xycb,8b) { E = RES(1, RM(EA) ); WM( EA,E ); } /* RES 1,E=(XY+o) */ +OP(xycb,8c) { H = RES(1, RM(EA) ); WM( EA,H ); } /* RES 1,H=(XY+o) */ +OP(xycb,8d) { L = RES(1, RM(EA) ); WM( EA,L ); } /* RES 1,L=(XY+o) */ +OP(xycb,8e) { WM( EA, RES(1,RM(EA)) ); } /* RES 1,(XY+o) */ +OP(xycb,8f) { A = RES(1, RM(EA) ); WM( EA,A ); } /* RES 1,A=(XY+o) */ -OP(xycb,90) { B = RES(2, RM(EA) ); WM( EA,B ); } /* RES 2,B=(XY+o) */ -OP(xycb,91) { C = RES(2, RM(EA) ); WM( EA,C ); } /* RES 2,C=(XY+o) */ -OP(xycb,92) { D = RES(2, RM(EA) ); WM( EA,D ); } /* RES 2,D=(XY+o) */ -OP(xycb,93) { E = RES(2, RM(EA) ); WM( EA,E ); } /* RES 2,E=(XY+o) */ -OP(xycb,94) { H = RES(2, RM(EA) ); WM( EA,H ); } /* RES 2,H=(XY+o) */ -OP(xycb,95) { L = RES(2, RM(EA) ); WM( EA,L ); } /* RES 2,L=(XY+o) */ -OP(xycb,96) { WM( EA, RES(2,RM(EA)) ); } /* RES 2,(XY+o) */ -OP(xycb,97) { A = RES(2, RM(EA) ); WM( EA,A ); } /* RES 2,A=(XY+o) */ +OP(xycb,90) { B = RES(2, RM(EA) ); WM( EA,B ); } /* RES 2,B=(XY+o) */ +OP(xycb,91) { C = RES(2, RM(EA) ); WM( EA,C ); } /* RES 2,C=(XY+o) */ +OP(xycb,92) { D = RES(2, RM(EA) ); WM( EA,D ); } /* RES 2,D=(XY+o) */ +OP(xycb,93) { E = RES(2, RM(EA) ); WM( EA,E ); } /* RES 2,E=(XY+o) */ +OP(xycb,94) { H = RES(2, RM(EA) ); WM( EA,H ); } /* RES 2,H=(XY+o) */ +OP(xycb,95) { L = RES(2, RM(EA) ); WM( EA,L ); } /* RES 2,L=(XY+o) */ +OP(xycb,96) { WM( EA, RES(2,RM(EA)) ); } /* RES 2,(XY+o) */ +OP(xycb,97) { A = RES(2, RM(EA) ); WM( EA,A ); } /* RES 2,A=(XY+o) */ -OP(xycb,98) { B = RES(3, RM(EA) ); WM( EA,B ); } /* RES 3,B=(XY+o) */ -OP(xycb,99) { C = RES(3, RM(EA) ); WM( EA,C ); } /* RES 3,C=(XY+o) */ -OP(xycb,9a) { D = RES(3, RM(EA) ); WM( EA,D ); } /* RES 3,D=(XY+o) */ -OP(xycb,9b) { E = RES(3, RM(EA) ); WM( EA,E ); } /* RES 3,E=(XY+o) */ -OP(xycb,9c) { H = RES(3, RM(EA) ); WM( EA,H ); } /* RES 3,H=(XY+o) */ -OP(xycb,9d) { L = RES(3, RM(EA) ); WM( EA,L ); } /* RES 3,L=(XY+o) */ -OP(xycb,9e) { WM( EA, RES(3,RM(EA)) ); } /* RES 3,(XY+o) */ -OP(xycb,9f) { A = RES(3, RM(EA) ); WM( EA,A ); } /* RES 3,A=(XY+o) */ +OP(xycb,98) { B = RES(3, RM(EA) ); WM( EA,B ); } /* RES 3,B=(XY+o) */ +OP(xycb,99) { C = RES(3, RM(EA) ); WM( EA,C ); } /* RES 3,C=(XY+o) */ +OP(xycb,9a) { D = RES(3, RM(EA) ); WM( EA,D ); } /* RES 3,D=(XY+o) */ +OP(xycb,9b) { E = RES(3, RM(EA) ); WM( EA,E ); } /* RES 3,E=(XY+o) */ +OP(xycb,9c) { H = RES(3, RM(EA) ); WM( EA,H ); } /* RES 3,H=(XY+o) */ +OP(xycb,9d) { L = RES(3, RM(EA) ); WM( EA,L ); } /* RES 3,L=(XY+o) */ +OP(xycb,9e) { WM( EA, RES(3,RM(EA)) ); } /* RES 3,(XY+o) */ +OP(xycb,9f) { A = RES(3, RM(EA) ); WM( EA,A ); } /* RES 3,A=(XY+o) */ -OP(xycb,a0) { B = RES(4, RM(EA) ); WM( EA,B ); } /* RES 4,B=(XY+o) */ -OP(xycb,a1) { C = RES(4, RM(EA) ); WM( EA,C ); } /* RES 4,C=(XY+o) */ -OP(xycb,a2) { D = RES(4, RM(EA) ); WM( EA,D ); } /* RES 4,D=(XY+o) */ -OP(xycb,a3) { E = RES(4, RM(EA) ); WM( EA,E ); } /* RES 4,E=(XY+o) */ -OP(xycb,a4) { H = RES(4, RM(EA) ); WM( EA,H ); } /* RES 4,H=(XY+o) */ -OP(xycb,a5) { L = RES(4, RM(EA) ); WM( EA,L ); } /* RES 4,L=(XY+o) */ -OP(xycb,a6) { WM( EA, RES(4,RM(EA)) ); } /* RES 4,(XY+o) */ -OP(xycb,a7) { A = RES(4, RM(EA) ); WM( EA,A ); } /* RES 4,A=(XY+o) */ +OP(xycb,a0) { B = RES(4, RM(EA) ); WM( EA,B ); } /* RES 4,B=(XY+o) */ +OP(xycb,a1) { C = RES(4, RM(EA) ); WM( EA,C ); } /* RES 4,C=(XY+o) */ +OP(xycb,a2) { D = RES(4, RM(EA) ); WM( EA,D ); } /* RES 4,D=(XY+o) */ +OP(xycb,a3) { E = RES(4, RM(EA) ); WM( EA,E ); } /* RES 4,E=(XY+o) */ +OP(xycb,a4) { H = RES(4, RM(EA) ); WM( EA,H ); } /* RES 4,H=(XY+o) */ +OP(xycb,a5) { L = RES(4, RM(EA) ); WM( EA,L ); } /* RES 4,L=(XY+o) */ +OP(xycb,a6) { WM( EA, RES(4,RM(EA)) ); } /* RES 4,(XY+o) */ +OP(xycb,a7) { A = RES(4, RM(EA) ); WM( EA,A ); } /* RES 4,A=(XY+o) */ -OP(xycb,a8) { B = RES(5, RM(EA) ); WM( EA,B ); } /* RES 5,B=(XY+o) */ -OP(xycb,a9) { C = RES(5, RM(EA) ); WM( EA,C ); } /* RES 5,C=(XY+o) */ -OP(xycb,aa) { D = RES(5, RM(EA) ); WM( EA,D ); } /* RES 5,D=(XY+o) */ -OP(xycb,ab) { E = RES(5, RM(EA) ); WM( EA,E ); } /* RES 5,E=(XY+o) */ -OP(xycb,ac) { H = RES(5, RM(EA) ); WM( EA,H ); } /* RES 5,H=(XY+o) */ -OP(xycb,ad) { L = RES(5, RM(EA) ); WM( EA,L ); } /* RES 5,L=(XY+o) */ -OP(xycb,ae) { WM( EA, RES(5,RM(EA)) ); } /* RES 5,(XY+o) */ -OP(xycb,af) { A = RES(5, RM(EA) ); WM( EA,A ); } /* RES 5,A=(XY+o) */ +OP(xycb,a8) { B = RES(5, RM(EA) ); WM( EA,B ); } /* RES 5,B=(XY+o) */ +OP(xycb,a9) { C = RES(5, RM(EA) ); WM( EA,C ); } /* RES 5,C=(XY+o) */ +OP(xycb,aa) { D = RES(5, RM(EA) ); WM( EA,D ); } /* RES 5,D=(XY+o) */ +OP(xycb,ab) { E = RES(5, RM(EA) ); WM( EA,E ); } /* RES 5,E=(XY+o) */ +OP(xycb,ac) { H = RES(5, RM(EA) ); WM( EA,H ); } /* RES 5,H=(XY+o) */ +OP(xycb,ad) { L = RES(5, RM(EA) ); WM( EA,L ); } /* RES 5,L=(XY+o) */ +OP(xycb,ae) { WM( EA, RES(5,RM(EA)) ); } /* RES 5,(XY+o) */ +OP(xycb,af) { A = RES(5, RM(EA) ); WM( EA,A ); } /* RES 5,A=(XY+o) */ -OP(xycb,b0) { B = RES(6, RM(EA) ); WM( EA,B ); } /* RES 6,B=(XY+o) */ -OP(xycb,b1) { C = RES(6, RM(EA) ); WM( EA,C ); } /* RES 6,C=(XY+o) */ -OP(xycb,b2) { D = RES(6, RM(EA) ); WM( EA,D ); } /* RES 6,D=(XY+o) */ -OP(xycb,b3) { E = RES(6, RM(EA) ); WM( EA,E ); } /* RES 6,E=(XY+o) */ -OP(xycb,b4) { H = RES(6, RM(EA) ); WM( EA,H ); } /* RES 6,H=(XY+o) */ -OP(xycb,b5) { L = RES(6, RM(EA) ); WM( EA,L ); } /* RES 6,L=(XY+o) */ -OP(xycb,b6) { WM( EA, RES(6,RM(EA)) ); } /* RES 6,(XY+o) */ -OP(xycb,b7) { A = RES(6, RM(EA) ); WM( EA,A ); } /* RES 6,A=(XY+o) */ +OP(xycb,b0) { B = RES(6, RM(EA) ); WM( EA,B ); } /* RES 6,B=(XY+o) */ +OP(xycb,b1) { C = RES(6, RM(EA) ); WM( EA,C ); } /* RES 6,C=(XY+o) */ +OP(xycb,b2) { D = RES(6, RM(EA) ); WM( EA,D ); } /* RES 6,D=(XY+o) */ +OP(xycb,b3) { E = RES(6, RM(EA) ); WM( EA,E ); } /* RES 6,E=(XY+o) */ +OP(xycb,b4) { H = RES(6, RM(EA) ); WM( EA,H ); } /* RES 6,H=(XY+o) */ +OP(xycb,b5) { L = RES(6, RM(EA) ); WM( EA,L ); } /* RES 6,L=(XY+o) */ +OP(xycb,b6) { WM( EA, RES(6,RM(EA)) ); } /* RES 6,(XY+o) */ +OP(xycb,b7) { A = RES(6, RM(EA) ); WM( EA,A ); } /* RES 6,A=(XY+o) */ -OP(xycb,b8) { B = RES(7, RM(EA) ); WM( EA,B ); } /* RES 7,B=(XY+o) */ -OP(xycb,b9) { C = RES(7, RM(EA) ); WM( EA,C ); } /* RES 7,C=(XY+o) */ -OP(xycb,ba) { D = RES(7, RM(EA) ); WM( EA,D ); } /* RES 7,D=(XY+o) */ -OP(xycb,bb) { E = RES(7, RM(EA) ); WM( EA,E ); } /* RES 7,E=(XY+o) */ -OP(xycb,bc) { H = RES(7, RM(EA) ); WM( EA,H ); } /* RES 7,H=(XY+o) */ -OP(xycb,bd) { L = RES(7, RM(EA) ); WM( EA,L ); } /* RES 7,L=(XY+o) */ -OP(xycb,be) { WM( EA, RES(7,RM(EA)) ); } /* RES 7,(XY+o) */ -OP(xycb,bf) { A = RES(7, RM(EA) ); WM( EA,A ); } /* RES 7,A=(XY+o) */ +OP(xycb,b8) { B = RES(7, RM(EA) ); WM( EA,B ); } /* RES 7,B=(XY+o) */ +OP(xycb,b9) { C = RES(7, RM(EA) ); WM( EA,C ); } /* RES 7,C=(XY+o) */ +OP(xycb,ba) { D = RES(7, RM(EA) ); WM( EA,D ); } /* RES 7,D=(XY+o) */ +OP(xycb,bb) { E = RES(7, RM(EA) ); WM( EA,E ); } /* RES 7,E=(XY+o) */ +OP(xycb,bc) { H = RES(7, RM(EA) ); WM( EA,H ); } /* RES 7,H=(XY+o) */ +OP(xycb,bd) { L = RES(7, RM(EA) ); WM( EA,L ); } /* RES 7,L=(XY+o) */ +OP(xycb,be) { WM( EA, RES(7,RM(EA)) ); } /* RES 7,(XY+o) */ +OP(xycb,bf) { A = RES(7, RM(EA) ); WM( EA,A ); } /* RES 7,A=(XY+o) */ -OP(xycb,c0) { B = SET(0, RM(EA) ); WM( EA,B ); } /* SET 0,B=(XY+o) */ -OP(xycb,c1) { C = SET(0, RM(EA) ); WM( EA,C ); } /* SET 0,C=(XY+o) */ -OP(xycb,c2) { D = SET(0, RM(EA) ); WM( EA,D ); } /* SET 0,D=(XY+o) */ -OP(xycb,c3) { E = SET(0, RM(EA) ); WM( EA,E ); } /* SET 0,E=(XY+o) */ -OP(xycb,c4) { H = SET(0, RM(EA) ); WM( EA,H ); } /* SET 0,H=(XY+o) */ -OP(xycb,c5) { L = SET(0, RM(EA) ); WM( EA,L ); } /* SET 0,L=(XY+o) */ -OP(xycb,c6) { WM( EA, SET(0,RM(EA)) ); } /* SET 0,(XY+o) */ -OP(xycb,c7) { A = SET(0, RM(EA) ); WM( EA,A ); } /* SET 0,A=(XY+o) */ +OP(xycb,c0) { B = SET(0, RM(EA) ); WM( EA,B ); } /* SET 0,B=(XY+o) */ +OP(xycb,c1) { C = SET(0, RM(EA) ); WM( EA,C ); } /* SET 0,C=(XY+o) */ +OP(xycb,c2) { D = SET(0, RM(EA) ); WM( EA,D ); } /* SET 0,D=(XY+o) */ +OP(xycb,c3) { E = SET(0, RM(EA) ); WM( EA,E ); } /* SET 0,E=(XY+o) */ +OP(xycb,c4) { H = SET(0, RM(EA) ); WM( EA,H ); } /* SET 0,H=(XY+o) */ +OP(xycb,c5) { L = SET(0, RM(EA) ); WM( EA,L ); } /* SET 0,L=(XY+o) */ +OP(xycb,c6) { WM( EA, SET(0,RM(EA)) ); } /* SET 0,(XY+o) */ +OP(xycb,c7) { A = SET(0, RM(EA) ); WM( EA,A ); } /* SET 0,A=(XY+o) */ -OP(xycb,c8) { B = SET(1, RM(EA) ); WM( EA,B ); } /* SET 1,B=(XY+o) */ -OP(xycb,c9) { C = SET(1, RM(EA) ); WM( EA,C ); } /* SET 1,C=(XY+o) */ -OP(xycb,ca) { D = SET(1, RM(EA) ); WM( EA,D ); } /* SET 1,D=(XY+o) */ -OP(xycb,cb) { E = SET(1, RM(EA) ); WM( EA,E ); } /* SET 1,E=(XY+o) */ -OP(xycb,cc) { H = SET(1, RM(EA) ); WM( EA,H ); } /* SET 1,H=(XY+o) */ -OP(xycb,cd) { L = SET(1, RM(EA) ); WM( EA,L ); } /* SET 1,L=(XY+o) */ -OP(xycb,ce) { WM( EA, SET(1,RM(EA)) ); } /* SET 1,(XY+o) */ -OP(xycb,cf) { A = SET(1, RM(EA) ); WM( EA,A ); } /* SET 1,A=(XY+o) */ +OP(xycb,c8) { B = SET(1, RM(EA) ); WM( EA,B ); } /* SET 1,B=(XY+o) */ +OP(xycb,c9) { C = SET(1, RM(EA) ); WM( EA,C ); } /* SET 1,C=(XY+o) */ +OP(xycb,ca) { D = SET(1, RM(EA) ); WM( EA,D ); } /* SET 1,D=(XY+o) */ +OP(xycb,cb) { E = SET(1, RM(EA) ); WM( EA,E ); } /* SET 1,E=(XY+o) */ +OP(xycb,cc) { H = SET(1, RM(EA) ); WM( EA,H ); } /* SET 1,H=(XY+o) */ +OP(xycb,cd) { L = SET(1, RM(EA) ); WM( EA,L ); } /* SET 1,L=(XY+o) */ +OP(xycb,ce) { WM( EA, SET(1,RM(EA)) ); } /* SET 1,(XY+o) */ +OP(xycb,cf) { A = SET(1, RM(EA) ); WM( EA,A ); } /* SET 1,A=(XY+o) */ -OP(xycb,d0) { B = SET(2, RM(EA) ); WM( EA,B ); } /* SET 2,B=(XY+o) */ -OP(xycb,d1) { C = SET(2, RM(EA) ); WM( EA,C ); } /* SET 2,C=(XY+o) */ -OP(xycb,d2) { D = SET(2, RM(EA) ); WM( EA,D ); } /* SET 2,D=(XY+o) */ -OP(xycb,d3) { E = SET(2, RM(EA) ); WM( EA,E ); } /* SET 2,E=(XY+o) */ -OP(xycb,d4) { H = SET(2, RM(EA) ); WM( EA,H ); } /* SET 2,H=(XY+o) */ -OP(xycb,d5) { L = SET(2, RM(EA) ); WM( EA,L ); } /* SET 2,L=(XY+o) */ -OP(xycb,d6) { WM( EA, SET(2,RM(EA)) ); } /* SET 2,(XY+o) */ -OP(xycb,d7) { A = SET(2, RM(EA) ); WM( EA,A ); } /* SET 2,A=(XY+o) */ +OP(xycb,d0) { B = SET(2, RM(EA) ); WM( EA,B ); } /* SET 2,B=(XY+o) */ +OP(xycb,d1) { C = SET(2, RM(EA) ); WM( EA,C ); } /* SET 2,C=(XY+o) */ +OP(xycb,d2) { D = SET(2, RM(EA) ); WM( EA,D ); } /* SET 2,D=(XY+o) */ +OP(xycb,d3) { E = SET(2, RM(EA) ); WM( EA,E ); } /* SET 2,E=(XY+o) */ +OP(xycb,d4) { H = SET(2, RM(EA) ); WM( EA,H ); } /* SET 2,H=(XY+o) */ +OP(xycb,d5) { L = SET(2, RM(EA) ); WM( EA,L ); } /* SET 2,L=(XY+o) */ +OP(xycb,d6) { WM( EA, SET(2,RM(EA)) ); } /* SET 2,(XY+o) */ +OP(xycb,d7) { A = SET(2, RM(EA) ); WM( EA,A ); } /* SET 2,A=(XY+o) */ -OP(xycb,d8) { B = SET(3, RM(EA) ); WM( EA,B ); } /* SET 3,B=(XY+o) */ -OP(xycb,d9) { C = SET(3, RM(EA) ); WM( EA,C ); } /* SET 3,C=(XY+o) */ -OP(xycb,da) { D = SET(3, RM(EA) ); WM( EA,D ); } /* SET 3,D=(XY+o) */ -OP(xycb,db) { E = SET(3, RM(EA) ); WM( EA,E ); } /* SET 3,E=(XY+o) */ -OP(xycb,dc) { H = SET(3, RM(EA) ); WM( EA,H ); } /* SET 3,H=(XY+o) */ -OP(xycb,dd) { L = SET(3, RM(EA) ); WM( EA,L ); } /* SET 3,L=(XY+o) */ -OP(xycb,de) { WM( EA, SET(3,RM(EA)) ); } /* SET 3,(XY+o) */ -OP(xycb,df) { A = SET(3, RM(EA) ); WM( EA,A ); } /* SET 3,A=(XY+o) */ +OP(xycb,d8) { B = SET(3, RM(EA) ); WM( EA,B ); } /* SET 3,B=(XY+o) */ +OP(xycb,d9) { C = SET(3, RM(EA) ); WM( EA,C ); } /* SET 3,C=(XY+o) */ +OP(xycb,da) { D = SET(3, RM(EA) ); WM( EA,D ); } /* SET 3,D=(XY+o) */ +OP(xycb,db) { E = SET(3, RM(EA) ); WM( EA,E ); } /* SET 3,E=(XY+o) */ +OP(xycb,dc) { H = SET(3, RM(EA) ); WM( EA,H ); } /* SET 3,H=(XY+o) */ +OP(xycb,dd) { L = SET(3, RM(EA) ); WM( EA,L ); } /* SET 3,L=(XY+o) */ +OP(xycb,de) { WM( EA, SET(3,RM(EA)) ); } /* SET 3,(XY+o) */ +OP(xycb,df) { A = SET(3, RM(EA) ); WM( EA,A ); } /* SET 3,A=(XY+o) */ -OP(xycb,e0) { B = SET(4, RM(EA) ); WM( EA,B ); } /* SET 4,B=(XY+o) */ -OP(xycb,e1) { C = SET(4, RM(EA) ); WM( EA,C ); } /* SET 4,C=(XY+o) */ -OP(xycb,e2) { D = SET(4, RM(EA) ); WM( EA,D ); } /* SET 4,D=(XY+o) */ -OP(xycb,e3) { E = SET(4, RM(EA) ); WM( EA,E ); } /* SET 4,E=(XY+o) */ -OP(xycb,e4) { H = SET(4, RM(EA) ); WM( EA,H ); } /* SET 4,H=(XY+o) */ -OP(xycb,e5) { L = SET(4, RM(EA) ); WM( EA,L ); } /* SET 4,L=(XY+o) */ -OP(xycb,e6) { WM( EA, SET(4,RM(EA)) ); } /* SET 4,(XY+o) */ -OP(xycb,e7) { A = SET(4, RM(EA) ); WM( EA,A ); } /* SET 4,A=(XY+o) */ +OP(xycb,e0) { B = SET(4, RM(EA) ); WM( EA,B ); } /* SET 4,B=(XY+o) */ +OP(xycb,e1) { C = SET(4, RM(EA) ); WM( EA,C ); } /* SET 4,C=(XY+o) */ +OP(xycb,e2) { D = SET(4, RM(EA) ); WM( EA,D ); } /* SET 4,D=(XY+o) */ +OP(xycb,e3) { E = SET(4, RM(EA) ); WM( EA,E ); } /* SET 4,E=(XY+o) */ +OP(xycb,e4) { H = SET(4, RM(EA) ); WM( EA,H ); } /* SET 4,H=(XY+o) */ +OP(xycb,e5) { L = SET(4, RM(EA) ); WM( EA,L ); } /* SET 4,L=(XY+o) */ +OP(xycb,e6) { WM( EA, SET(4,RM(EA)) ); } /* SET 4,(XY+o) */ +OP(xycb,e7) { A = SET(4, RM(EA) ); WM( EA,A ); } /* SET 4,A=(XY+o) */ -OP(xycb,e8) { B = SET(5, RM(EA) ); WM( EA,B ); } /* SET 5,B=(XY+o) */ -OP(xycb,e9) { C = SET(5, RM(EA) ); WM( EA,C ); } /* SET 5,C=(XY+o) */ -OP(xycb,ea) { D = SET(5, RM(EA) ); WM( EA,D ); } /* SET 5,D=(XY+o) */ -OP(xycb,eb) { E = SET(5, RM(EA) ); WM( EA,E ); } /* SET 5,E=(XY+o) */ -OP(xycb,ec) { H = SET(5, RM(EA) ); WM( EA,H ); } /* SET 5,H=(XY+o) */ -OP(xycb,ed) { L = SET(5, RM(EA) ); WM( EA,L ); } /* SET 5,L=(XY+o) */ -OP(xycb,ee) { WM( EA, SET(5,RM(EA)) ); } /* SET 5,(XY+o) */ -OP(xycb,ef) { A = SET(5, RM(EA) ); WM( EA,A ); } /* SET 5,A=(XY+o) */ +OP(xycb,e8) { B = SET(5, RM(EA) ); WM( EA,B ); } /* SET 5,B=(XY+o) */ +OP(xycb,e9) { C = SET(5, RM(EA) ); WM( EA,C ); } /* SET 5,C=(XY+o) */ +OP(xycb,ea) { D = SET(5, RM(EA) ); WM( EA,D ); } /* SET 5,D=(XY+o) */ +OP(xycb,eb) { E = SET(5, RM(EA) ); WM( EA,E ); } /* SET 5,E=(XY+o) */ +OP(xycb,ec) { H = SET(5, RM(EA) ); WM( EA,H ); } /* SET 5,H=(XY+o) */ +OP(xycb,ed) { L = SET(5, RM(EA) ); WM( EA,L ); } /* SET 5,L=(XY+o) */ +OP(xycb,ee) { WM( EA, SET(5,RM(EA)) ); } /* SET 5,(XY+o) */ +OP(xycb,ef) { A = SET(5, RM(EA) ); WM( EA,A ); } /* SET 5,A=(XY+o) */ -OP(xycb,f0) { B = SET(6, RM(EA) ); WM( EA,B ); } /* SET 6,B=(XY+o) */ -OP(xycb,f1) { C = SET(6, RM(EA) ); WM( EA,C ); } /* SET 6,C=(XY+o) */ -OP(xycb,f2) { D = SET(6, RM(EA) ); WM( EA,D ); } /* SET 6,D=(XY+o) */ -OP(xycb,f3) { E = SET(6, RM(EA) ); WM( EA,E ); } /* SET 6,E=(XY+o) */ -OP(xycb,f4) { H = SET(6, RM(EA) ); WM( EA,H ); } /* SET 6,H=(XY+o) */ -OP(xycb,f5) { L = SET(6, RM(EA) ); WM( EA,L ); } /* SET 6,L=(XY+o) */ -OP(xycb,f6) { WM( EA, SET(6,RM(EA)) ); } /* SET 6,(XY+o) */ -OP(xycb,f7) { A = SET(6, RM(EA) ); WM( EA,A ); } /* SET 6,A=(XY+o) */ +OP(xycb,f0) { B = SET(6, RM(EA) ); WM( EA,B ); } /* SET 6,B=(XY+o) */ +OP(xycb,f1) { C = SET(6, RM(EA) ); WM( EA,C ); } /* SET 6,C=(XY+o) */ +OP(xycb,f2) { D = SET(6, RM(EA) ); WM( EA,D ); } /* SET 6,D=(XY+o) */ +OP(xycb,f3) { E = SET(6, RM(EA) ); WM( EA,E ); } /* SET 6,E=(XY+o) */ +OP(xycb,f4) { H = SET(6, RM(EA) ); WM( EA,H ); } /* SET 6,H=(XY+o) */ +OP(xycb,f5) { L = SET(6, RM(EA) ); WM( EA,L ); } /* SET 6,L=(XY+o) */ +OP(xycb,f6) { WM( EA, SET(6,RM(EA)) ); } /* SET 6,(XY+o) */ +OP(xycb,f7) { A = SET(6, RM(EA) ); WM( EA,A ); } /* SET 6,A=(XY+o) */ -OP(xycb,f8) { B = SET(7, RM(EA) ); WM( EA,B ); } /* SET 7,B=(XY+o) */ -OP(xycb,f9) { C = SET(7, RM(EA) ); WM( EA,C ); } /* SET 7,C=(XY+o) */ -OP(xycb,fa) { D = SET(7, RM(EA) ); WM( EA,D ); } /* SET 7,D=(XY+o) */ -OP(xycb,fb) { E = SET(7, RM(EA) ); WM( EA,E ); } /* SET 7,E=(XY+o) */ -OP(xycb,fc) { H = SET(7, RM(EA) ); WM( EA,H ); } /* SET 7,H=(XY+o) */ -OP(xycb,fd) { L = SET(7, RM(EA) ); WM( EA,L ); } /* SET 7,L=(XY+o) */ -OP(xycb,fe) { WM( EA, SET(7,RM(EA)) ); } /* SET 7,(XY+o) */ -OP(xycb,ff) { A = SET(7, RM(EA) ); WM( EA,A ); } /* SET 7,A=(XY+o) */ +OP(xycb,f8) { B = SET(7, RM(EA) ); WM( EA,B ); } /* SET 7,B=(XY+o) */ +OP(xycb,f9) { C = SET(7, RM(EA) ); WM( EA,C ); } /* SET 7,C=(XY+o) */ +OP(xycb,fa) { D = SET(7, RM(EA) ); WM( EA,D ); } /* SET 7,D=(XY+o) */ +OP(xycb,fb) { E = SET(7, RM(EA) ); WM( EA,E ); } /* SET 7,E=(XY+o) */ +OP(xycb,fc) { H = SET(7, RM(EA) ); WM( EA,H ); } /* SET 7,H=(XY+o) */ +OP(xycb,fd) { L = SET(7, RM(EA) ); WM( EA,L ); } /* SET 7,L=(XY+o) */ +OP(xycb,fe) { WM( EA, SET(7,RM(EA)) ); } /* SET 7,(XY+o) */ +OP(xycb,ff) { A = SET(7, RM(EA) ); WM( EA,A ); } /* SET 7,A=(XY+o) */ OP(illegal,1) { #if VERBOSE - logerror("Z80 #%d ill. opcode $%02x $%02x\n", - cpu_getactivecpu(), cpu_readop((PCD-1)&0xffff), cpu_readop(PCD)); + logerror("Z80 #%d ill. opcode $%02x $%02x\n", + cpu_getactivecpu(), cpu_readop((PCD-1)&0xffff), cpu_readop(PCD)); #endif } /********************************************************** * IX register related opcodes (DD prefix) **********************************************************/ -OP(dd,00) { illegal_1(); op_00(); } /* DB DD */ -OP(dd,01) { illegal_1(); op_01(); } /* DB DD */ -OP(dd,02) { illegal_1(); op_02(); } /* DB DD */ -OP(dd,03) { illegal_1(); op_03(); } /* DB DD */ -OP(dd,04) { illegal_1(); op_04(); } /* DB DD */ -OP(dd,05) { illegal_1(); op_05(); } /* DB DD */ -OP(dd,06) { illegal_1(); op_06(); } /* DB DD */ -OP(dd,07) { illegal_1(); op_07(); } /* DB DD */ +OP(dd,00) { illegal_1(); op_00(); } /* DB DD */ +OP(dd,01) { illegal_1(); op_01(); } /* DB DD */ +OP(dd,02) { illegal_1(); op_02(); } /* DB DD */ +OP(dd,03) { illegal_1(); op_03(); } /* DB DD */ +OP(dd,04) { illegal_1(); op_04(); } /* DB DD */ +OP(dd,05) { illegal_1(); op_05(); } /* DB DD */ +OP(dd,06) { illegal_1(); op_06(); } /* DB DD */ +OP(dd,07) { illegal_1(); op_07(); } /* DB DD */ -OP(dd,08) { illegal_1(); op_08(); } /* DB DD */ -OP(dd,09) { R++; ADD16(ix,bc); } /* ADD IX,BC */ -OP(dd,0a) { illegal_1(); op_0a(); } /* DB DD */ -OP(dd,0b) { illegal_1(); op_0b(); } /* DB DD */ -OP(dd,0c) { illegal_1(); op_0c(); } /* DB DD */ -OP(dd,0d) { illegal_1(); op_0d(); } /* DB DD */ -OP(dd,0e) { illegal_1(); op_0e(); } /* DB DD */ -OP(dd,0f) { illegal_1(); op_0f(); } /* DB DD */ +OP(dd,08) { illegal_1(); op_08(); } /* DB DD */ +OP(dd,09) { R++; ADD16(ix,bc); } /* ADD IX,BC */ +OP(dd,0a) { illegal_1(); op_0a(); } /* DB DD */ +OP(dd,0b) { illegal_1(); op_0b(); } /* DB DD */ +OP(dd,0c) { illegal_1(); op_0c(); } /* DB DD */ +OP(dd,0d) { illegal_1(); op_0d(); } /* DB DD */ +OP(dd,0e) { illegal_1(); op_0e(); } /* DB DD */ +OP(dd,0f) { illegal_1(); op_0f(); } /* DB DD */ -OP(dd,10) { illegal_1(); op_10(); } /* DB DD */ -OP(dd,11) { illegal_1(); op_11(); } /* DB DD */ -OP(dd,12) { illegal_1(); op_12(); } /* DB DD */ -OP(dd,13) { illegal_1(); op_13(); } /* DB DD */ -OP(dd,14) { illegal_1(); op_14(); } /* DB DD */ -OP(dd,15) { illegal_1(); op_15(); } /* DB DD */ -OP(dd,16) { illegal_1(); op_16(); } /* DB DD */ -OP(dd,17) { illegal_1(); op_17(); } /* DB DD */ +OP(dd,10) { illegal_1(); op_10(); } /* DB DD */ +OP(dd,11) { illegal_1(); op_11(); } /* DB DD */ +OP(dd,12) { illegal_1(); op_12(); } /* DB DD */ +OP(dd,13) { illegal_1(); op_13(); } /* DB DD */ +OP(dd,14) { illegal_1(); op_14(); } /* DB DD */ +OP(dd,15) { illegal_1(); op_15(); } /* DB DD */ +OP(dd,16) { illegal_1(); op_16(); } /* DB DD */ +OP(dd,17) { illegal_1(); op_17(); } /* DB DD */ -OP(dd,18) { illegal_1(); op_18(); } /* DB DD */ -OP(dd,19) { R++; ADD16(ix,de); } /* ADD IX,DE */ -OP(dd,1a) { illegal_1(); op_1a(); } /* DB DD */ -OP(dd,1b) { illegal_1(); op_1b(); } /* DB DD */ -OP(dd,1c) { illegal_1(); op_1c(); } /* DB DD */ -OP(dd,1d) { illegal_1(); op_1d(); } /* DB DD */ -OP(dd,1e) { illegal_1(); op_1e(); } /* DB DD */ -OP(dd,1f) { illegal_1(); op_1f(); } /* DB DD */ +OP(dd,18) { illegal_1(); op_18(); } /* DB DD */ +OP(dd,19) { R++; ADD16(ix,de); } /* ADD IX,DE */ +OP(dd,1a) { illegal_1(); op_1a(); } /* DB DD */ +OP(dd,1b) { illegal_1(); op_1b(); } /* DB DD */ +OP(dd,1c) { illegal_1(); op_1c(); } /* DB DD */ +OP(dd,1d) { illegal_1(); op_1d(); } /* DB DD */ +OP(dd,1e) { illegal_1(); op_1e(); } /* DB DD */ +OP(dd,1f) { illegal_1(); op_1f(); } /* DB DD */ -OP(dd,20) { illegal_1(); op_20(); } /* DB DD */ -OP(dd,21) { R++; IX = ARG16(); } /* LD IX,w */ -OP(dd,22) { R++; EA = ARG16(); WM16( EA, &Z80.ix ); } /* LD (w),IX */ -OP(dd,23) { R++; IX++; } /* INC IX */ -OP(dd,24) { R++; HX = INC(HX); } /* INC HX */ -OP(dd,25) { R++; HX = DEC(HX); } /* DEC HX */ -OP(dd,26) { R++; HX = ARG(); } /* LD HX,n */ -OP(dd,27) { illegal_1(); op_27(); } /* DB DD */ +OP(dd,20) { illegal_1(); op_20(); } /* DB DD */ +OP(dd,21) { R++; IX = ARG16(); } /* LD IX,w */ +OP(dd,22) { R++; EA = ARG16(); WM16( EA, &Z80.ix ); } /* LD (w),IX */ +OP(dd,23) { R++; IX++; } /* INC IX */ +OP(dd,24) { R++; HX = INC(HX); } /* INC HX */ +OP(dd,25) { R++; HX = DEC(HX); } /* DEC HX */ +OP(dd,26) { R++; HX = ARG(); } /* LD HX,n */ +OP(dd,27) { illegal_1(); op_27(); } /* DB DD */ -OP(dd,28) { illegal_1(); op_28(); } /* DB DD */ -OP(dd,29) { R++; ADD16(ix,ix); } /* ADD IX,IX */ -OP(dd,2a) { R++; EA = ARG16(); RM16( EA, &Z80.ix ); } /* LD IX,(w) */ -OP(dd,2b) { R++; IX--; } /* DEC IX */ -OP(dd,2c) { R++; LX = INC(LX); } /* INC LX */ -OP(dd,2d) { R++; LX = DEC(LX); } /* DEC LX */ -OP(dd,2e) { R++; LX = ARG(); } /* LD LX,n */ -OP(dd,2f) { illegal_1(); op_2f(); } /* DB DD */ +OP(dd,28) { illegal_1(); op_28(); } /* DB DD */ +OP(dd,29) { R++; ADD16(ix,ix); } /* ADD IX,IX */ +OP(dd,2a) { R++; EA = ARG16(); RM16( EA, &Z80.ix ); } /* LD IX,(w) */ +OP(dd,2b) { R++; IX--; } /* DEC IX */ +OP(dd,2c) { R++; LX = INC(LX); } /* INC LX */ +OP(dd,2d) { R++; LX = DEC(LX); } /* DEC LX */ +OP(dd,2e) { R++; LX = ARG(); } /* LD LX,n */ +OP(dd,2f) { illegal_1(); op_2f(); } /* DB DD */ -OP(dd,30) { illegal_1(); op_30(); } /* DB DD */ -OP(dd,31) { illegal_1(); op_31(); } /* DB DD */ -OP(dd,32) { illegal_1(); op_32(); } /* DB DD */ -OP(dd,33) { illegal_1(); op_33(); } /* DB DD */ -OP(dd,34) { R++; EAX; WM( EA, INC(RM(EA)) ); } /* INC (IX+o) */ -OP(dd,35) { R++; EAX; WM( EA, DEC(RM(EA)) ); } /* DEC (IX+o) */ -OP(dd,36) { R++; EAX; WM( EA, ARG() ); } /* LD (IX+o),n */ -OP(dd,37) { illegal_1(); op_37(); } /* DB DD */ +OP(dd,30) { illegal_1(); op_30(); } /* DB DD */ +OP(dd,31) { illegal_1(); op_31(); } /* DB DD */ +OP(dd,32) { illegal_1(); op_32(); } /* DB DD */ +OP(dd,33) { illegal_1(); op_33(); } /* DB DD */ +OP(dd,34) { R++; EAX; WM( EA, INC(RM(EA)) ); } /* INC (IX+o) */ +OP(dd,35) { R++; EAX; WM( EA, DEC(RM(EA)) ); } /* DEC (IX+o) */ +OP(dd,36) { R++; EAX; WM( EA, ARG() ); } /* LD (IX+o),n */ +OP(dd,37) { illegal_1(); op_37(); } /* DB DD */ -OP(dd,38) { illegal_1(); op_38(); } /* DB DD */ -OP(dd,39) { R++; ADD16(ix,sp); } /* ADD IX,SP */ -OP(dd,3a) { illegal_1(); op_3a(); } /* DB DD */ -OP(dd,3b) { illegal_1(); op_3b(); } /* DB DD */ -OP(dd,3c) { illegal_1(); op_3c(); } /* DB DD */ -OP(dd,3d) { illegal_1(); op_3d(); } /* DB DD */ -OP(dd,3e) { illegal_1(); op_3e(); } /* DB DD */ -OP(dd,3f) { illegal_1(); op_3f(); } /* DB DD */ +OP(dd,38) { illegal_1(); op_38(); } /* DB DD */ +OP(dd,39) { R++; ADD16(ix,sp); } /* ADD IX,SP */ +OP(dd,3a) { illegal_1(); op_3a(); } /* DB DD */ +OP(dd,3b) { illegal_1(); op_3b(); } /* DB DD */ +OP(dd,3c) { illegal_1(); op_3c(); } /* DB DD */ +OP(dd,3d) { illegal_1(); op_3d(); } /* DB DD */ +OP(dd,3e) { illegal_1(); op_3e(); } /* DB DD */ +OP(dd,3f) { illegal_1(); op_3f(); } /* DB DD */ -OP(dd,40) { illegal_1(); op_40(); } /* DB DD */ -OP(dd,41) { illegal_1(); op_41(); } /* DB DD */ -OP(dd,42) { illegal_1(); op_42(); } /* DB DD */ -OP(dd,43) { illegal_1(); op_43(); } /* DB DD */ -OP(dd,44) { R++; B = HX; } /* LD B,HX */ -OP(dd,45) { R++; B = LX; } /* LD B,LX */ -OP(dd,46) { R++; EAX; B = RM(EA); } /* LD B,(IX+o) */ -OP(dd,47) { illegal_1(); op_47(); } /* DB DD */ +OP(dd,40) { illegal_1(); op_40(); } /* DB DD */ +OP(dd,41) { illegal_1(); op_41(); } /* DB DD */ +OP(dd,42) { illegal_1(); op_42(); } /* DB DD */ +OP(dd,43) { illegal_1(); op_43(); } /* DB DD */ +OP(dd,44) { R++; B = HX; } /* LD B,HX */ +OP(dd,45) { R++; B = LX; } /* LD B,LX */ +OP(dd,46) { R++; EAX; B = RM(EA); } /* LD B,(IX+o) */ +OP(dd,47) { illegal_1(); op_47(); } /* DB DD */ -OP(dd,48) { illegal_1(); op_48(); } /* DB DD */ -OP(dd,49) { illegal_1(); op_49(); } /* DB DD */ -OP(dd,4a) { illegal_1(); op_4a(); } /* DB DD */ -OP(dd,4b) { illegal_1(); op_4b(); } /* DB DD */ -OP(dd,4c) { R++; C = HX; } /* LD C,HX */ -OP(dd,4d) { R++; C = LX; } /* LD C,LX */ -OP(dd,4e) { R++; EAX; C = RM(EA); } /* LD C,(IX+o) */ -OP(dd,4f) { illegal_1(); op_4f(); } /* DB DD */ +OP(dd,48) { illegal_1(); op_48(); } /* DB DD */ +OP(dd,49) { illegal_1(); op_49(); } /* DB DD */ +OP(dd,4a) { illegal_1(); op_4a(); } /* DB DD */ +OP(dd,4b) { illegal_1(); op_4b(); } /* DB DD */ +OP(dd,4c) { R++; C = HX; } /* LD C,HX */ +OP(dd,4d) { R++; C = LX; } /* LD C,LX */ +OP(dd,4e) { R++; EAX; C = RM(EA); } /* LD C,(IX+o) */ +OP(dd,4f) { illegal_1(); op_4f(); } /* DB DD */ -OP(dd,50) { illegal_1(); op_50(); } /* DB DD */ -OP(dd,51) { illegal_1(); op_51(); } /* DB DD */ -OP(dd,52) { illegal_1(); op_52(); } /* DB DD */ -OP(dd,53) { illegal_1(); op_53(); } /* DB DD */ -OP(dd,54) { R++; D = HX; } /* LD D,HX */ -OP(dd,55) { R++; D = LX; } /* LD D,LX */ -OP(dd,56) { R++; EAX; D = RM(EA); } /* LD D,(IX+o) */ -OP(dd,57) { illegal_1(); op_57(); } /* DB DD */ +OP(dd,50) { illegal_1(); op_50(); } /* DB DD */ +OP(dd,51) { illegal_1(); op_51(); } /* DB DD */ +OP(dd,52) { illegal_1(); op_52(); } /* DB DD */ +OP(dd,53) { illegal_1(); op_53(); } /* DB DD */ +OP(dd,54) { R++; D = HX; } /* LD D,HX */ +OP(dd,55) { R++; D = LX; } /* LD D,LX */ +OP(dd,56) { R++; EAX; D = RM(EA); } /* LD D,(IX+o) */ +OP(dd,57) { illegal_1(); op_57(); } /* DB DD */ -OP(dd,58) { illegal_1(); op_58(); } /* DB DD */ -OP(dd,59) { illegal_1(); op_59(); } /* DB DD */ -OP(dd,5a) { illegal_1(); op_5a(); } /* DB DD */ -OP(dd,5b) { illegal_1(); op_5b(); } /* DB DD */ -OP(dd,5c) { R++; E = HX; } /* LD E,HX */ -OP(dd,5d) { R++; E = LX; } /* LD E,LX */ -OP(dd,5e) { R++; EAX; E = RM(EA); } /* LD E,(IX+o) */ -OP(dd,5f) { illegal_1(); op_5f(); } /* DB DD */ +OP(dd,58) { illegal_1(); op_58(); } /* DB DD */ +OP(dd,59) { illegal_1(); op_59(); } /* DB DD */ +OP(dd,5a) { illegal_1(); op_5a(); } /* DB DD */ +OP(dd,5b) { illegal_1(); op_5b(); } /* DB DD */ +OP(dd,5c) { R++; E = HX; } /* LD E,HX */ +OP(dd,5d) { R++; E = LX; } /* LD E,LX */ +OP(dd,5e) { R++; EAX; E = RM(EA); } /* LD E,(IX+o) */ +OP(dd,5f) { illegal_1(); op_5f(); } /* DB DD */ -OP(dd,60) { R++; HX = B; } /* LD HX,B */ -OP(dd,61) { R++; HX = C; } /* LD HX,C */ -OP(dd,62) { R++; HX = D; } /* LD HX,D */ -OP(dd,63) { R++; HX = E; } /* LD HX,E */ -OP(dd,64) { } /* LD HX,HX */ -OP(dd,65) { R++; HX = LX; } /* LD HX,LX */ -OP(dd,66) { R++; EAX; H = RM(EA); } /* LD H,(IX+o) */ -OP(dd,67) { R++; HX = A; } /* LD HX,A */ +OP(dd,60) { R++; HX = B; } /* LD HX,B */ +OP(dd,61) { R++; HX = C; } /* LD HX,C */ +OP(dd,62) { R++; HX = D; } /* LD HX,D */ +OP(dd,63) { R++; HX = E; } /* LD HX,E */ +OP(dd,64) { } /* LD HX,HX */ +OP(dd,65) { R++; HX = LX; } /* LD HX,LX */ +OP(dd,66) { R++; EAX; H = RM(EA); } /* LD H,(IX+o) */ +OP(dd,67) { R++; HX = A; } /* LD HX,A */ -OP(dd,68) { R++; LX = B; } /* LD LX,B */ -OP(dd,69) { R++; LX = C; } /* LD LX,C */ -OP(dd,6a) { R++; LX = D; } /* LD LX,D */ -OP(dd,6b) { R++; LX = E; } /* LD LX,E */ -OP(dd,6c) { R++; LX = HX; } /* LD LX,HX */ -OP(dd,6d) { } /* LD LX,LX */ -OP(dd,6e) { R++; EAX; L = RM(EA); } /* LD L,(IX+o) */ -OP(dd,6f) { R++; LX = A; } /* LD LX,A */ +OP(dd,68) { R++; LX = B; } /* LD LX,B */ +OP(dd,69) { R++; LX = C; } /* LD LX,C */ +OP(dd,6a) { R++; LX = D; } /* LD LX,D */ +OP(dd,6b) { R++; LX = E; } /* LD LX,E */ +OP(dd,6c) { R++; LX = HX; } /* LD LX,HX */ +OP(dd,6d) { } /* LD LX,LX */ +OP(dd,6e) { R++; EAX; L = RM(EA); } /* LD L,(IX+o) */ +OP(dd,6f) { R++; LX = A; } /* LD LX,A */ -OP(dd,70) { R++; EAX; WM( EA, B ); } /* LD (IX+o),B */ -OP(dd,71) { R++; EAX; WM( EA, C ); } /* LD (IX+o),C */ -OP(dd,72) { R++; EAX; WM( EA, D ); } /* LD (IX+o),D */ -OP(dd,73) { R++; EAX; WM( EA, E ); } /* LD (IX+o),E */ -OP(dd,74) { R++; EAX; WM( EA, H ); } /* LD (IX+o),H */ -OP(dd,75) { R++; EAX; WM( EA, L ); } /* LD (IX+o),L */ -OP(dd,76) { illegal_1(); op_76(); } /* DB DD */ -OP(dd,77) { R++; EAX; WM( EA, A ); } /* LD (IX+o),A */ +OP(dd,70) { R++; EAX; WM( EA, B ); } /* LD (IX+o),B */ +OP(dd,71) { R++; EAX; WM( EA, C ); } /* LD (IX+o),C */ +OP(dd,72) { R++; EAX; WM( EA, D ); } /* LD (IX+o),D */ +OP(dd,73) { R++; EAX; WM( EA, E ); } /* LD (IX+o),E */ +OP(dd,74) { R++; EAX; WM( EA, H ); } /* LD (IX+o),H */ +OP(dd,75) { R++; EAX; WM( EA, L ); } /* LD (IX+o),L */ +OP(dd,76) { illegal_1(); op_76(); } /* DB DD */ +OP(dd,77) { R++; EAX; WM( EA, A ); } /* LD (IX+o),A */ -OP(dd,78) { illegal_1(); op_78(); } /* DB DD */ -OP(dd,79) { illegal_1(); op_79(); } /* DB DD */ -OP(dd,7a) { illegal_1(); op_7a(); } /* DB DD */ -OP(dd,7b) { illegal_1(); op_7b(); } /* DB DD */ -OP(dd,7c) { R++; A = HX; } /* LD A,HX */ -OP(dd,7d) { R++; A = LX; } /* LD A,LX */ -OP(dd,7e) { R++; EAX; A = RM(EA); } /* LD A,(IX+o) */ -OP(dd,7f) { illegal_1(); op_7f(); } /* DB DD */ +OP(dd,78) { illegal_1(); op_78(); } /* DB DD */ +OP(dd,79) { illegal_1(); op_79(); } /* DB DD */ +OP(dd,7a) { illegal_1(); op_7a(); } /* DB DD */ +OP(dd,7b) { illegal_1(); op_7b(); } /* DB DD */ +OP(dd,7c) { R++; A = HX; } /* LD A,HX */ +OP(dd,7d) { R++; A = LX; } /* LD A,LX */ +OP(dd,7e) { R++; EAX; A = RM(EA); } /* LD A,(IX+o) */ +OP(dd,7f) { illegal_1(); op_7f(); } /* DB DD */ -OP(dd,80) { illegal_1(); op_80(); } /* DB DD */ -OP(dd,81) { illegal_1(); op_81(); } /* DB DD */ -OP(dd,82) { illegal_1(); op_82(); } /* DB DD */ -OP(dd,83) { illegal_1(); op_83(); } /* DB DD */ -OP(dd,84) { R++; ADD(HX); } /* ADD A,HX */ -OP(dd,85) { R++; ADD(LX); } /* ADD A,LX */ -OP(dd,86) { R++; EAX; ADD(RM(EA)); } /* ADD A,(IX+o) */ -OP(dd,87) { illegal_1(); op_87(); } /* DB DD */ +OP(dd,80) { illegal_1(); op_80(); } /* DB DD */ +OP(dd,81) { illegal_1(); op_81(); } /* DB DD */ +OP(dd,82) { illegal_1(); op_82(); } /* DB DD */ +OP(dd,83) { illegal_1(); op_83(); } /* DB DD */ +OP(dd,84) { R++; ADD(HX); } /* ADD A,HX */ +OP(dd,85) { R++; ADD(LX); } /* ADD A,LX */ +OP(dd,86) { R++; EAX; ADD(RM(EA)); } /* ADD A,(IX+o) */ +OP(dd,87) { illegal_1(); op_87(); } /* DB DD */ -OP(dd,88) { illegal_1(); op_88(); } /* DB DD */ -OP(dd,89) { illegal_1(); op_89(); } /* DB DD */ -OP(dd,8a) { illegal_1(); op_8a(); } /* DB DD */ -OP(dd,8b) { illegal_1(); op_8b(); } /* DB DD */ -OP(dd,8c) { R++; ADC(HX); } /* ADC A,HX */ -OP(dd,8d) { R++; ADC(LX); } /* ADC A,LX */ -OP(dd,8e) { R++; EAX; ADC(RM(EA)); } /* ADC A,(IX+o) */ -OP(dd,8f) { illegal_1(); op_8f(); } /* DB DD */ +OP(dd,88) { illegal_1(); op_88(); } /* DB DD */ +OP(dd,89) { illegal_1(); op_89(); } /* DB DD */ +OP(dd,8a) { illegal_1(); op_8a(); } /* DB DD */ +OP(dd,8b) { illegal_1(); op_8b(); } /* DB DD */ +OP(dd,8c) { R++; ADC(HX); } /* ADC A,HX */ +OP(dd,8d) { R++; ADC(LX); } /* ADC A,LX */ +OP(dd,8e) { R++; EAX; ADC(RM(EA)); } /* ADC A,(IX+o) */ +OP(dd,8f) { illegal_1(); op_8f(); } /* DB DD */ -OP(dd,90) { illegal_1(); op_90(); } /* DB DD */ -OP(dd,91) { illegal_1(); op_91(); } /* DB DD */ -OP(dd,92) { illegal_1(); op_92(); } /* DB DD */ -OP(dd,93) { illegal_1(); op_93(); } /* DB DD */ -OP(dd,94) { R++; SUB(HX); } /* SUB HX */ -OP(dd,95) { R++; SUB(LX); } /* SUB LX */ -OP(dd,96) { R++; EAX; SUB(RM(EA)); } /* SUB (IX+o) */ -OP(dd,97) { illegal_1(); op_97(); } /* DB DD */ +OP(dd,90) { illegal_1(); op_90(); } /* DB DD */ +OP(dd,91) { illegal_1(); op_91(); } /* DB DD */ +OP(dd,92) { illegal_1(); op_92(); } /* DB DD */ +OP(dd,93) { illegal_1(); op_93(); } /* DB DD */ +OP(dd,94) { R++; SUB(HX); } /* SUB HX */ +OP(dd,95) { R++; SUB(LX); } /* SUB LX */ +OP(dd,96) { R++; EAX; SUB(RM(EA)); } /* SUB (IX+o) */ +OP(dd,97) { illegal_1(); op_97(); } /* DB DD */ -OP(dd,98) { illegal_1(); op_98(); } /* DB DD */ -OP(dd,99) { illegal_1(); op_99(); } /* DB DD */ -OP(dd,9a) { illegal_1(); op_9a(); } /* DB DD */ -OP(dd,9b) { illegal_1(); op_9b(); } /* DB DD */ -OP(dd,9c) { R++; SBC(HX); } /* SBC A,HX */ -OP(dd,9d) { R++; SBC(LX); } /* SBC A,LX */ -OP(dd,9e) { R++; EAX; SBC(RM(EA)); } /* SBC A,(IX+o) */ -OP(dd,9f) { illegal_1(); op_9f(); } /* DB DD */ +OP(dd,98) { illegal_1(); op_98(); } /* DB DD */ +OP(dd,99) { illegal_1(); op_99(); } /* DB DD */ +OP(dd,9a) { illegal_1(); op_9a(); } /* DB DD */ +OP(dd,9b) { illegal_1(); op_9b(); } /* DB DD */ +OP(dd,9c) { R++; SBC(HX); } /* SBC A,HX */ +OP(dd,9d) { R++; SBC(LX); } /* SBC A,LX */ +OP(dd,9e) { R++; EAX; SBC(RM(EA)); } /* SBC A,(IX+o) */ +OP(dd,9f) { illegal_1(); op_9f(); } /* DB DD */ -OP(dd,a0) { illegal_1(); op_a0(); } /* DB DD */ -OP(dd,a1) { illegal_1(); op_a1(); } /* DB DD */ -OP(dd,a2) { illegal_1(); op_a2(); } /* DB DD */ -OP(dd,a3) { illegal_1(); op_a3(); } /* DB DD */ -OP(dd,a4) { R++; AND(HX); } /* AND HX */ -OP(dd,a5) { R++; AND(LX); } /* AND LX */ -OP(dd,a6) { R++; EAX; AND(RM(EA)); } /* AND (IX+o) */ -OP(dd,a7) { illegal_1(); op_a7(); } /* DB DD */ +OP(dd,a0) { illegal_1(); op_a0(); } /* DB DD */ +OP(dd,a1) { illegal_1(); op_a1(); } /* DB DD */ +OP(dd,a2) { illegal_1(); op_a2(); } /* DB DD */ +OP(dd,a3) { illegal_1(); op_a3(); } /* DB DD */ +OP(dd,a4) { R++; AND(HX); } /* AND HX */ +OP(dd,a5) { R++; AND(LX); } /* AND LX */ +OP(dd,a6) { R++; EAX; AND(RM(EA)); } /* AND (IX+o) */ +OP(dd,a7) { illegal_1(); op_a7(); } /* DB DD */ -OP(dd,a8) { illegal_1(); op_a8(); } /* DB DD */ -OP(dd,a9) { illegal_1(); op_a9(); } /* DB DD */ -OP(dd,aa) { illegal_1(); op_aa(); } /* DB DD */ -OP(dd,ab) { illegal_1(); op_ab(); } /* DB DD */ -OP(dd,ac) { R++; XOR(HX); } /* XOR HX */ -OP(dd,ad) { R++; XOR(LX); } /* XOR LX */ -OP(dd,ae) { R++; EAX; XOR(RM(EA)); } /* XOR (IX+o) */ -OP(dd,af) { illegal_1(); op_af(); } /* DB DD */ +OP(dd,a8) { illegal_1(); op_a8(); } /* DB DD */ +OP(dd,a9) { illegal_1(); op_a9(); } /* DB DD */ +OP(dd,aa) { illegal_1(); op_aa(); } /* DB DD */ +OP(dd,ab) { illegal_1(); op_ab(); } /* DB DD */ +OP(dd,ac) { R++; XOR(HX); } /* XOR HX */ +OP(dd,ad) { R++; XOR(LX); } /* XOR LX */ +OP(dd,ae) { R++; EAX; XOR(RM(EA)); } /* XOR (IX+o) */ +OP(dd,af) { illegal_1(); op_af(); } /* DB DD */ -OP(dd,b0) { illegal_1(); op_b0(); } /* DB DD */ -OP(dd,b1) { illegal_1(); op_b1(); } /* DB DD */ -OP(dd,b2) { illegal_1(); op_b2(); } /* DB DD */ -OP(dd,b3) { illegal_1(); op_b3(); } /* DB DD */ -OP(dd,b4) { R++; OR(HX); } /* OR HX */ -OP(dd,b5) { R++; OR(LX); } /* OR LX */ -OP(dd,b6) { R++; EAX; OR(RM(EA)); } /* OR (IX+o) */ -OP(dd,b7) { illegal_1(); op_b7(); } /* DB DD */ +OP(dd,b0) { illegal_1(); op_b0(); } /* DB DD */ +OP(dd,b1) { illegal_1(); op_b1(); } /* DB DD */ +OP(dd,b2) { illegal_1(); op_b2(); } /* DB DD */ +OP(dd,b3) { illegal_1(); op_b3(); } /* DB DD */ +OP(dd,b4) { R++; OR(HX); } /* OR HX */ +OP(dd,b5) { R++; OR(LX); } /* OR LX */ +OP(dd,b6) { R++; EAX; OR(RM(EA)); } /* OR (IX+o) */ +OP(dd,b7) { illegal_1(); op_b7(); } /* DB DD */ -OP(dd,b8) { illegal_1(); op_b8(); } /* DB DD */ -OP(dd,b9) { illegal_1(); op_b9(); } /* DB DD */ -OP(dd,ba) { illegal_1(); op_ba(); } /* DB DD */ -OP(dd,bb) { illegal_1(); op_bb(); } /* DB DD */ -OP(dd,bc) { R++; CP(HX); } /* CP HX */ -OP(dd,bd) { R++; CP(LX); } /* CP LX */ -OP(dd,be) { R++; EAX; CP(RM(EA)); } /* CP (IX+o) */ -OP(dd,bf) { illegal_1(); op_bf(); } /* DB DD */ +OP(dd,b8) { illegal_1(); op_b8(); } /* DB DD */ +OP(dd,b9) { illegal_1(); op_b9(); } /* DB DD */ +OP(dd,ba) { illegal_1(); op_ba(); } /* DB DD */ +OP(dd,bb) { illegal_1(); op_bb(); } /* DB DD */ +OP(dd,bc) { R++; CP(HX); } /* CP HX */ +OP(dd,bd) { R++; CP(LX); } /* CP LX */ +OP(dd,be) { R++; EAX; CP(RM(EA)); } /* CP (IX+o) */ +OP(dd,bf) { illegal_1(); op_bf(); } /* DB DD */ -OP(dd,c0) { illegal_1(); op_c0(); } /* DB DD */ -OP(dd,c1) { illegal_1(); op_c1(); } /* DB DD */ -OP(dd,c2) { illegal_1(); op_c2(); } /* DB DD */ -OP(dd,c3) { illegal_1(); op_c3(); } /* DB DD */ -OP(dd,c4) { illegal_1(); op_c4(); } /* DB DD */ -OP(dd,c5) { illegal_1(); op_c5(); } /* DB DD */ -OP(dd,c6) { illegal_1(); op_c6(); } /* DB DD */ -OP(dd,c7) { illegal_1(); op_c7(); } /* DB DD */ +OP(dd,c0) { illegal_1(); op_c0(); } /* DB DD */ +OP(dd,c1) { illegal_1(); op_c1(); } /* DB DD */ +OP(dd,c2) { illegal_1(); op_c2(); } /* DB DD */ +OP(dd,c3) { illegal_1(); op_c3(); } /* DB DD */ +OP(dd,c4) { illegal_1(); op_c4(); } /* DB DD */ +OP(dd,c5) { illegal_1(); op_c5(); } /* DB DD */ +OP(dd,c6) { illegal_1(); op_c6(); } /* DB DD */ +OP(dd,c7) { illegal_1(); op_c7(); } /* DB DD */ -OP(dd,c8) { illegal_1(); op_c8(); } /* DB DD */ -OP(dd,c9) { illegal_1(); op_c9(); } /* DB DD */ -OP(dd,ca) { illegal_1(); op_ca(); } /* DB DD */ -OP(dd,cb) { R++; EAX; EXEC(xycb,ARG()); } /* ** DD CB xx */ -OP(dd,cc) { illegal_1(); op_cc(); } /* DB DD */ -OP(dd,cd) { illegal_1(); op_cd(); } /* DB DD */ -OP(dd,ce) { illegal_1(); op_ce(); } /* DB DD */ -OP(dd,cf) { illegal_1(); op_cf(); } /* DB DD */ +OP(dd,c8) { illegal_1(); op_c8(); } /* DB DD */ +OP(dd,c9) { illegal_1(); op_c9(); } /* DB DD */ +OP(dd,ca) { illegal_1(); op_ca(); } /* DB DD */ +OP(dd,cb) { R++; EAX; EXEC(xycb,ARG()); } /* ** DD CB xx */ +OP(dd,cc) { illegal_1(); op_cc(); } /* DB DD */ +OP(dd,cd) { illegal_1(); op_cd(); } /* DB DD */ +OP(dd,ce) { illegal_1(); op_ce(); } /* DB DD */ +OP(dd,cf) { illegal_1(); op_cf(); } /* DB DD */ -OP(dd,d0) { illegal_1(); op_d0(); } /* DB DD */ -OP(dd,d1) { illegal_1(); op_d1(); } /* DB DD */ -OP(dd,d2) { illegal_1(); op_d2(); } /* DB DD */ -OP(dd,d3) { illegal_1(); op_d3(); } /* DB DD */ -OP(dd,d4) { illegal_1(); op_d4(); } /* DB DD */ -OP(dd,d5) { illegal_1(); op_d5(); } /* DB DD */ -OP(dd,d6) { illegal_1(); op_d6(); } /* DB DD */ -OP(dd,d7) { illegal_1(); op_d7(); } /* DB DD */ +OP(dd,d0) { illegal_1(); op_d0(); } /* DB DD */ +OP(dd,d1) { illegal_1(); op_d1(); } /* DB DD */ +OP(dd,d2) { illegal_1(); op_d2(); } /* DB DD */ +OP(dd,d3) { illegal_1(); op_d3(); } /* DB DD */ +OP(dd,d4) { illegal_1(); op_d4(); } /* DB DD */ +OP(dd,d5) { illegal_1(); op_d5(); } /* DB DD */ +OP(dd,d6) { illegal_1(); op_d6(); } /* DB DD */ +OP(dd,d7) { illegal_1(); op_d7(); } /* DB DD */ -OP(dd,d8) { illegal_1(); op_d8(); } /* DB DD */ -OP(dd,d9) { illegal_1(); op_d9(); } /* DB DD */ -OP(dd,da) { illegal_1(); op_da(); } /* DB DD */ -OP(dd,db) { illegal_1(); op_db(); } /* DB DD */ -OP(dd,dc) { illegal_1(); op_dc(); } /* DB DD */ -OP(dd,dd) { illegal_1(); op_dd(); } /* DB DD */ -OP(dd,de) { illegal_1(); op_de(); } /* DB DD */ -OP(dd,df) { illegal_1(); op_df(); } /* DB DD */ +OP(dd,d8) { illegal_1(); op_d8(); } /* DB DD */ +OP(dd,d9) { illegal_1(); op_d9(); } /* DB DD */ +OP(dd,da) { illegal_1(); op_da(); } /* DB DD */ +OP(dd,db) { illegal_1(); op_db(); } /* DB DD */ +OP(dd,dc) { illegal_1(); op_dc(); } /* DB DD */ +OP(dd,dd) { illegal_1(); op_dd(); } /* DB DD */ +OP(dd,de) { illegal_1(); op_de(); } /* DB DD */ +OP(dd,df) { illegal_1(); op_df(); } /* DB DD */ -OP(dd,e0) { illegal_1(); op_e0(); } /* DB DD */ -OP(dd,e1) { R++; POP( ix ); } /* POP IX */ -OP(dd,e2) { illegal_1(); op_e2(); } /* DB DD */ -OP(dd,e3) { R++; EXSP( ix ); } /* EX (SP),IX */ -OP(dd,e4) { illegal_1(); op_e4(); } /* DB DD */ -OP(dd,e5) { R++; PUSH( ix ); } /* PUSH IX */ -OP(dd,e6) { illegal_1(); op_e6(); } /* DB DD */ -OP(dd,e7) { illegal_1(); op_e7(); } /* DB DD */ +OP(dd,e0) { illegal_1(); op_e0(); } /* DB DD */ +OP(dd,e1) { R++; POP( ix ); } /* POP IX */ +OP(dd,e2) { illegal_1(); op_e2(); } /* DB DD */ +OP(dd,e3) { R++; EXSP( ix ); } /* EX (SP),IX */ +OP(dd,e4) { illegal_1(); op_e4(); } /* DB DD */ +OP(dd,e5) { R++; PUSH( ix ); } /* PUSH IX */ +OP(dd,e6) { illegal_1(); op_e6(); } /* DB DD */ +OP(dd,e7) { illegal_1(); op_e7(); } /* DB DD */ -OP(dd,e8) { illegal_1(); op_e8(); } /* DB DD */ -OP(dd,e9) { R++; PC = IX; change_pc(PCD); } /* JP (IX) */ -OP(dd,ea) { illegal_1(); op_ea(); } /* DB DD */ -OP(dd,eb) { illegal_1(); op_eb(); } /* DB DD */ -OP(dd,ec) { illegal_1(); op_ec(); } /* DB DD */ -OP(dd,ed) { illegal_1(); op_ed(); } /* DB DD */ -OP(dd,ee) { illegal_1(); op_ee(); } /* DB DD */ -OP(dd,ef) { illegal_1(); op_ef(); } /* DB DD */ +OP(dd,e8) { illegal_1(); op_e8(); } /* DB DD */ +OP(dd,e9) { R++; PC = IX; change_pc(PCD); } /* JP (IX) */ +OP(dd,ea) { illegal_1(); op_ea(); } /* DB DD */ +OP(dd,eb) { illegal_1(); op_eb(); } /* DB DD */ +OP(dd,ec) { illegal_1(); op_ec(); } /* DB DD */ +OP(dd,ed) { illegal_1(); op_ed(); } /* DB DD */ +OP(dd,ee) { illegal_1(); op_ee(); } /* DB DD */ +OP(dd,ef) { illegal_1(); op_ef(); } /* DB DD */ -OP(dd,f0) { illegal_1(); op_f0(); } /* DB DD */ -OP(dd,f1) { illegal_1(); op_f1(); } /* DB DD */ -OP(dd,f2) { illegal_1(); op_f2(); } /* DB DD */ -OP(dd,f3) { illegal_1(); op_f3(); } /* DB DD */ -OP(dd,f4) { illegal_1(); op_f4(); } /* DB DD */ -OP(dd,f5) { illegal_1(); op_f5(); } /* DB DD */ -OP(dd,f6) { illegal_1(); op_f6(); } /* DB DD */ -OP(dd,f7) { illegal_1(); op_f7(); } /* DB DD */ +OP(dd,f0) { illegal_1(); op_f0(); } /* DB DD */ +OP(dd,f1) { illegal_1(); op_f1(); } /* DB DD */ +OP(dd,f2) { illegal_1(); op_f2(); } /* DB DD */ +OP(dd,f3) { illegal_1(); op_f3(); } /* DB DD */ +OP(dd,f4) { illegal_1(); op_f4(); } /* DB DD */ +OP(dd,f5) { illegal_1(); op_f5(); } /* DB DD */ +OP(dd,f6) { illegal_1(); op_f6(); } /* DB DD */ +OP(dd,f7) { illegal_1(); op_f7(); } /* DB DD */ -OP(dd,f8) { illegal_1(); op_f8(); } /* DB DD */ -OP(dd,f9) { R++; SP = IX; } /* LD SP,IX */ -OP(dd,fa) { illegal_1(); op_fa(); } /* DB DD */ -OP(dd,fb) { illegal_1(); op_fb(); } /* DB DD */ -OP(dd,fc) { illegal_1(); op_fc(); } /* DB DD */ -OP(dd,fd) { illegal_1(); op_fd(); } /* DB DD */ -OP(dd,fe) { illegal_1(); op_fe(); } /* DB DD */ -OP(dd,ff) { illegal_1(); op_ff(); } /* DB DD */ +OP(dd,f8) { illegal_1(); op_f8(); } /* DB DD */ +OP(dd,f9) { R++; SP = IX; } /* LD SP,IX */ +OP(dd,fa) { illegal_1(); op_fa(); } /* DB DD */ +OP(dd,fb) { illegal_1(); op_fb(); } /* DB DD */ +OP(dd,fc) { illegal_1(); op_fc(); } /* DB DD */ +OP(dd,fd) { illegal_1(); op_fd(); } /* DB DD */ +OP(dd,fe) { illegal_1(); op_fe(); } /* DB DD */ +OP(dd,ff) { illegal_1(); op_ff(); } /* DB DD */ /********************************************************** * IY register related opcodes (FD prefix) **********************************************************/ -OP(fd,00) { illegal_1(); op_00(); } /* DB FD */ -OP(fd,01) { illegal_1(); op_01(); } /* DB FD */ -OP(fd,02) { illegal_1(); op_02(); } /* DB FD */ -OP(fd,03) { illegal_1(); op_03(); } /* DB FD */ -OP(fd,04) { illegal_1(); op_04(); } /* DB FD */ -OP(fd,05) { illegal_1(); op_05(); } /* DB FD */ -OP(fd,06) { illegal_1(); op_06(); } /* DB FD */ -OP(fd,07) { illegal_1(); op_07(); } /* DB FD */ +OP(fd,00) { illegal_1(); op_00(); } /* DB FD */ +OP(fd,01) { illegal_1(); op_01(); } /* DB FD */ +OP(fd,02) { illegal_1(); op_02(); } /* DB FD */ +OP(fd,03) { illegal_1(); op_03(); } /* DB FD */ +OP(fd,04) { illegal_1(); op_04(); } /* DB FD */ +OP(fd,05) { illegal_1(); op_05(); } /* DB FD */ +OP(fd,06) { illegal_1(); op_06(); } /* DB FD */ +OP(fd,07) { illegal_1(); op_07(); } /* DB FD */ -OP(fd,08) { illegal_1(); op_08(); } /* DB FD */ -OP(fd,09) { R++; ADD16(iy,bc); } /* ADD IY,BC */ -OP(fd,0a) { illegal_1(); op_0a(); } /* DB FD */ -OP(fd,0b) { illegal_1(); op_0b(); } /* DB FD */ -OP(fd,0c) { illegal_1(); op_0c(); } /* DB FD */ -OP(fd,0d) { illegal_1(); op_0d(); } /* DB FD */ -OP(fd,0e) { illegal_1(); op_0e(); } /* DB FD */ -OP(fd,0f) { illegal_1(); op_0f(); } /* DB FD */ +OP(fd,08) { illegal_1(); op_08(); } /* DB FD */ +OP(fd,09) { R++; ADD16(iy,bc); } /* ADD IY,BC */ +OP(fd,0a) { illegal_1(); op_0a(); } /* DB FD */ +OP(fd,0b) { illegal_1(); op_0b(); } /* DB FD */ +OP(fd,0c) { illegal_1(); op_0c(); } /* DB FD */ +OP(fd,0d) { illegal_1(); op_0d(); } /* DB FD */ +OP(fd,0e) { illegal_1(); op_0e(); } /* DB FD */ +OP(fd,0f) { illegal_1(); op_0f(); } /* DB FD */ -OP(fd,10) { illegal_1(); op_10(); } /* DB FD */ -OP(fd,11) { illegal_1(); op_11(); } /* DB FD */ -OP(fd,12) { illegal_1(); op_12(); } /* DB FD */ -OP(fd,13) { illegal_1(); op_13(); } /* DB FD */ -OP(fd,14) { illegal_1(); op_14(); } /* DB FD */ -OP(fd,15) { illegal_1(); op_15(); } /* DB FD */ -OP(fd,16) { illegal_1(); op_16(); } /* DB FD */ -OP(fd,17) { illegal_1(); op_17(); } /* DB FD */ +OP(fd,10) { illegal_1(); op_10(); } /* DB FD */ +OP(fd,11) { illegal_1(); op_11(); } /* DB FD */ +OP(fd,12) { illegal_1(); op_12(); } /* DB FD */ +OP(fd,13) { illegal_1(); op_13(); } /* DB FD */ +OP(fd,14) { illegal_1(); op_14(); } /* DB FD */ +OP(fd,15) { illegal_1(); op_15(); } /* DB FD */ +OP(fd,16) { illegal_1(); op_16(); } /* DB FD */ +OP(fd,17) { illegal_1(); op_17(); } /* DB FD */ -OP(fd,18) { illegal_1(); op_18(); } /* DB FD */ -OP(fd,19) { R++; ADD16(iy,de); } /* ADD IY,DE */ -OP(fd,1a) { illegal_1(); op_1a(); } /* DB FD */ -OP(fd,1b) { illegal_1(); op_1b(); } /* DB FD */ -OP(fd,1c) { illegal_1(); op_1c(); } /* DB FD */ -OP(fd,1d) { illegal_1(); op_1d(); } /* DB FD */ -OP(fd,1e) { illegal_1(); op_1e(); } /* DB FD */ -OP(fd,1f) { illegal_1(); op_1f(); } /* DB FD */ +OP(fd,18) { illegal_1(); op_18(); } /* DB FD */ +OP(fd,19) { R++; ADD16(iy,de); } /* ADD IY,DE */ +OP(fd,1a) { illegal_1(); op_1a(); } /* DB FD */ +OP(fd,1b) { illegal_1(); op_1b(); } /* DB FD */ +OP(fd,1c) { illegal_1(); op_1c(); } /* DB FD */ +OP(fd,1d) { illegal_1(); op_1d(); } /* DB FD */ +OP(fd,1e) { illegal_1(); op_1e(); } /* DB FD */ +OP(fd,1f) { illegal_1(); op_1f(); } /* DB FD */ -OP(fd,20) { illegal_1(); op_20(); } /* DB FD */ -OP(fd,21) { R++; IY = ARG16(); } /* LD IY,w */ -OP(fd,22) { R++; EA = ARG16(); WM16( EA, &Z80.iy ); } /* LD (w),IY */ -OP(fd,23) { R++; IY++; } /* INC IY */ -OP(fd,24) { R++; HY = INC(HY); } /* INC HY */ -OP(fd,25) { R++; HY = DEC(HY); } /* DEC HY */ -OP(fd,26) { R++; HY = ARG(); } /* LD HY,n */ -OP(fd,27) { illegal_1(); op_27(); } /* DB FD */ +OP(fd,20) { illegal_1(); op_20(); } /* DB FD */ +OP(fd,21) { R++; IY = ARG16(); } /* LD IY,w */ +OP(fd,22) { R++; EA = ARG16(); WM16( EA, &Z80.iy ); } /* LD (w),IY */ +OP(fd,23) { R++; IY++; } /* INC IY */ +OP(fd,24) { R++; HY = INC(HY); } /* INC HY */ +OP(fd,25) { R++; HY = DEC(HY); } /* DEC HY */ +OP(fd,26) { R++; HY = ARG(); } /* LD HY,n */ +OP(fd,27) { illegal_1(); op_27(); } /* DB FD */ -OP(fd,28) { illegal_1(); op_28(); } /* DB FD */ -OP(fd,29) { R++; ADD16(iy,iy); } /* ADD IY,IY */ -OP(fd,2a) { R++; EA = ARG16(); RM16( EA, &Z80.iy ); } /* LD IY,(w) */ -OP(fd,2b) { R++; IY--; } /* DEC IY */ -OP(fd,2c) { R++; LY = INC(LY); } /* INC LY */ -OP(fd,2d) { R++; LY = DEC(LY); } /* DEC LY */ -OP(fd,2e) { R++; LY = ARG(); } /* LD LY,n */ -OP(fd,2f) { illegal_1(); op_2f(); } /* DB FD */ +OP(fd,28) { illegal_1(); op_28(); } /* DB FD */ +OP(fd,29) { R++; ADD16(iy,iy); } /* ADD IY,IY */ +OP(fd,2a) { R++; EA = ARG16(); RM16( EA, &Z80.iy ); } /* LD IY,(w) */ +OP(fd,2b) { R++; IY--; } /* DEC IY */ +OP(fd,2c) { R++; LY = INC(LY); } /* INC LY */ +OP(fd,2d) { R++; LY = DEC(LY); } /* DEC LY */ +OP(fd,2e) { R++; LY = ARG(); } /* LD LY,n */ +OP(fd,2f) { illegal_1(); op_2f(); } /* DB FD */ -OP(fd,30) { illegal_1(); op_30(); } /* DB FD */ -OP(fd,31) { illegal_1(); op_31(); } /* DB FD */ -OP(fd,32) { illegal_1(); op_32(); } /* DB FD */ -OP(fd,33) { illegal_1(); op_33(); } /* DB FD */ -OP(fd,34) { R++; EAY; WM( EA, INC(RM(EA)) ); } /* INC (IY+o) */ -OP(fd,35) { R++; EAY; WM( EA, DEC(RM(EA)) ); } /* DEC (IY+o) */ -OP(fd,36) { R++; EAY; WM( EA, ARG() ); } /* LD (IY+o),n */ -OP(fd,37) { illegal_1(); op_37(); } /* DB FD */ +OP(fd,30) { illegal_1(); op_30(); } /* DB FD */ +OP(fd,31) { illegal_1(); op_31(); } /* DB FD */ +OP(fd,32) { illegal_1(); op_32(); } /* DB FD */ +OP(fd,33) { illegal_1(); op_33(); } /* DB FD */ +OP(fd,34) { R++; EAY; WM( EA, INC(RM(EA)) ); } /* INC (IY+o) */ +OP(fd,35) { R++; EAY; WM( EA, DEC(RM(EA)) ); } /* DEC (IY+o) */ +OP(fd,36) { R++; EAY; WM( EA, ARG() ); } /* LD (IY+o),n */ +OP(fd,37) { illegal_1(); op_37(); } /* DB FD */ -OP(fd,38) { illegal_1(); op_38(); } /* DB FD */ -OP(fd,39) { R++; ADD16(iy,sp); } /* ADD IY,SP */ -OP(fd,3a) { illegal_1(); op_3a(); } /* DB FD */ -OP(fd,3b) { illegal_1(); op_3b(); } /* DB FD */ -OP(fd,3c) { illegal_1(); op_3c(); } /* DB FD */ -OP(fd,3d) { illegal_1(); op_3d(); } /* DB FD */ -OP(fd,3e) { illegal_1(); op_3e(); } /* DB FD */ -OP(fd,3f) { illegal_1(); op_3f(); } /* DB FD */ +OP(fd,38) { illegal_1(); op_38(); } /* DB FD */ +OP(fd,39) { R++; ADD16(iy,sp); } /* ADD IY,SP */ +OP(fd,3a) { illegal_1(); op_3a(); } /* DB FD */ +OP(fd,3b) { illegal_1(); op_3b(); } /* DB FD */ +OP(fd,3c) { illegal_1(); op_3c(); } /* DB FD */ +OP(fd,3d) { illegal_1(); op_3d(); } /* DB FD */ +OP(fd,3e) { illegal_1(); op_3e(); } /* DB FD */ +OP(fd,3f) { illegal_1(); op_3f(); } /* DB FD */ -OP(fd,40) { illegal_1(); op_40(); } /* DB FD */ -OP(fd,41) { illegal_1(); op_41(); } /* DB FD */ -OP(fd,42) { illegal_1(); op_42(); } /* DB FD */ -OP(fd,43) { illegal_1(); op_43(); } /* DB FD */ -OP(fd,44) { R++; B = HY; } /* LD B,HY */ -OP(fd,45) { R++; B = LY; } /* LD B,LY */ -OP(fd,46) { R++; EAY; B = RM(EA); } /* LD B,(IY+o) */ -OP(fd,47) { illegal_1(); op_47(); } /* DB FD */ +OP(fd,40) { illegal_1(); op_40(); } /* DB FD */ +OP(fd,41) { illegal_1(); op_41(); } /* DB FD */ +OP(fd,42) { illegal_1(); op_42(); } /* DB FD */ +OP(fd,43) { illegal_1(); op_43(); } /* DB FD */ +OP(fd,44) { R++; B = HY; } /* LD B,HY */ +OP(fd,45) { R++; B = LY; } /* LD B,LY */ +OP(fd,46) { R++; EAY; B = RM(EA); } /* LD B,(IY+o) */ +OP(fd,47) { illegal_1(); op_47(); } /* DB FD */ -OP(fd,48) { illegal_1(); op_48(); } /* DB FD */ -OP(fd,49) { illegal_1(); op_49(); } /* DB FD */ -OP(fd,4a) { illegal_1(); op_4a(); } /* DB FD */ -OP(fd,4b) { illegal_1(); op_4b(); } /* DB FD */ -OP(fd,4c) { R++; C = HY; } /* LD C,HY */ -OP(fd,4d) { R++; C = LY; } /* LD C,LY */ -OP(fd,4e) { R++; EAY; C = RM(EA); } /* LD C,(IY+o) */ -OP(fd,4f) { illegal_1(); op_4f(); } /* DB FD */ +OP(fd,48) { illegal_1(); op_48(); } /* DB FD */ +OP(fd,49) { illegal_1(); op_49(); } /* DB FD */ +OP(fd,4a) { illegal_1(); op_4a(); } /* DB FD */ +OP(fd,4b) { illegal_1(); op_4b(); } /* DB FD */ +OP(fd,4c) { R++; C = HY; } /* LD C,HY */ +OP(fd,4d) { R++; C = LY; } /* LD C,LY */ +OP(fd,4e) { R++; EAY; C = RM(EA); } /* LD C,(IY+o) */ +OP(fd,4f) { illegal_1(); op_4f(); } /* DB FD */ -OP(fd,50) { illegal_1(); op_50(); } /* DB FD */ -OP(fd,51) { illegal_1(); op_51(); } /* DB FD */ -OP(fd,52) { illegal_1(); op_52(); } /* DB FD */ -OP(fd,53) { illegal_1(); op_53(); } /* DB FD */ -OP(fd,54) { R++; D = HY; } /* LD D,HY */ -OP(fd,55) { R++; D = LY; } /* LD D,LY */ -OP(fd,56) { R++; EAY; D = RM(EA); } /* LD D,(IY+o) */ -OP(fd,57) { illegal_1(); op_57(); } /* DB FD */ +OP(fd,50) { illegal_1(); op_50(); } /* DB FD */ +OP(fd,51) { illegal_1(); op_51(); } /* DB FD */ +OP(fd,52) { illegal_1(); op_52(); } /* DB FD */ +OP(fd,53) { illegal_1(); op_53(); } /* DB FD */ +OP(fd,54) { R++; D = HY; } /* LD D,HY */ +OP(fd,55) { R++; D = LY; } /* LD D,LY */ +OP(fd,56) { R++; EAY; D = RM(EA); } /* LD D,(IY+o) */ +OP(fd,57) { illegal_1(); op_57(); } /* DB FD */ -OP(fd,58) { illegal_1(); op_58(); } /* DB FD */ -OP(fd,59) { illegal_1(); op_59(); } /* DB FD */ -OP(fd,5a) { illegal_1(); op_5a(); } /* DB FD */ -OP(fd,5b) { illegal_1(); op_5b(); } /* DB FD */ -OP(fd,5c) { R++; E = HY; } /* LD E,HY */ -OP(fd,5d) { R++; E = LY; } /* LD E,LY */ -OP(fd,5e) { R++; EAY; E = RM(EA); } /* LD E,(IY+o) */ -OP(fd,5f) { illegal_1(); op_5f(); } /* DB FD */ +OP(fd,58) { illegal_1(); op_58(); } /* DB FD */ +OP(fd,59) { illegal_1(); op_59(); } /* DB FD */ +OP(fd,5a) { illegal_1(); op_5a(); } /* DB FD */ +OP(fd,5b) { illegal_1(); op_5b(); } /* DB FD */ +OP(fd,5c) { R++; E = HY; } /* LD E,HY */ +OP(fd,5d) { R++; E = LY; } /* LD E,LY */ +OP(fd,5e) { R++; EAY; E = RM(EA); } /* LD E,(IY+o) */ +OP(fd,5f) { illegal_1(); op_5f(); } /* DB FD */ -OP(fd,60) { R++; HY = B; } /* LD HY,B */ -OP(fd,61) { R++; HY = C; } /* LD HY,C */ -OP(fd,62) { R++; HY = D; } /* LD HY,D */ -OP(fd,63) { R++; HY = E; } /* LD HY,E */ -OP(fd,64) { R++; } /* LD HY,HY */ -OP(fd,65) { R++; HY = LY; } /* LD HY,LY */ -OP(fd,66) { R++; EAY; H = RM(EA); } /* LD H,(IY+o) */ -OP(fd,67) { R++; HY = A; } /* LD HY,A */ +OP(fd,60) { R++; HY = B; } /* LD HY,B */ +OP(fd,61) { R++; HY = C; } /* LD HY,C */ +OP(fd,62) { R++; HY = D; } /* LD HY,D */ +OP(fd,63) { R++; HY = E; } /* LD HY,E */ +OP(fd,64) { R++; } /* LD HY,HY */ +OP(fd,65) { R++; HY = LY; } /* LD HY,LY */ +OP(fd,66) { R++; EAY; H = RM(EA); } /* LD H,(IY+o) */ +OP(fd,67) { R++; HY = A; } /* LD HY,A */ -OP(fd,68) { R++; LY = B; } /* LD LY,B */ -OP(fd,69) { R++; LY = C; } /* LD LY,C */ -OP(fd,6a) { R++; LY = D; } /* LD LY,D */ -OP(fd,6b) { R++; LY = E; } /* LD LY,E */ -OP(fd,6c) { R++; LY = HY; } /* LD LY,HY */ -OP(fd,6d) { R++; } /* LD LY,LY */ -OP(fd,6e) { R++; EAY; L = RM(EA); } /* LD L,(IY+o) */ -OP(fd,6f) { R++; LY = A; } /* LD LY,A */ +OP(fd,68) { R++; LY = B; } /* LD LY,B */ +OP(fd,69) { R++; LY = C; } /* LD LY,C */ +OP(fd,6a) { R++; LY = D; } /* LD LY,D */ +OP(fd,6b) { R++; LY = E; } /* LD LY,E */ +OP(fd,6c) { R++; LY = HY; } /* LD LY,HY */ +OP(fd,6d) { R++; } /* LD LY,LY */ +OP(fd,6e) { R++; EAY; L = RM(EA); } /* LD L,(IY+o) */ +OP(fd,6f) { R++; LY = A; } /* LD LY,A */ -OP(fd,70) { R++; EAY; WM( EA, B ); } /* LD (IY+o),B */ -OP(fd,71) { R++; EAY; WM( EA, C ); } /* LD (IY+o),C */ -OP(fd,72) { R++; EAY; WM( EA, D ); } /* LD (IY+o),D */ -OP(fd,73) { R++; EAY; WM( EA, E ); } /* LD (IY+o),E */ -OP(fd,74) { R++; EAY; WM( EA, H ); } /* LD (IY+o),H */ -OP(fd,75) { R++; EAY; WM( EA, L ); } /* LD (IY+o),L */ -OP(fd,76) { illegal_1(); op_76(); } /* DB FD */ -OP(fd,77) { R++; EAY; WM( EA, A ); } /* LD (IY+o),A */ +OP(fd,70) { R++; EAY; WM( EA, B ); } /* LD (IY+o),B */ +OP(fd,71) { R++; EAY; WM( EA, C ); } /* LD (IY+o),C */ +OP(fd,72) { R++; EAY; WM( EA, D ); } /* LD (IY+o),D */ +OP(fd,73) { R++; EAY; WM( EA, E ); } /* LD (IY+o),E */ +OP(fd,74) { R++; EAY; WM( EA, H ); } /* LD (IY+o),H */ +OP(fd,75) { R++; EAY; WM( EA, L ); } /* LD (IY+o),L */ +OP(fd,76) { illegal_1(); op_76(); } /* DB FD */ +OP(fd,77) { R++; EAY; WM( EA, A ); } /* LD (IY+o),A */ -OP(fd,78) { illegal_1(); op_78(); } /* DB FD */ -OP(fd,79) { illegal_1(); op_79(); } /* DB FD */ -OP(fd,7a) { illegal_1(); op_7a(); } /* DB FD */ -OP(fd,7b) { illegal_1(); op_7b(); } /* DB FD */ -OP(fd,7c) { R++; A = HY; } /* LD A,HY */ -OP(fd,7d) { R++; A = LY; } /* LD A,LY */ -OP(fd,7e) { R++; EAY; A = RM(EA); } /* LD A,(IY+o) */ -OP(fd,7f) { illegal_1(); op_7f(); } /* DB FD */ +OP(fd,78) { illegal_1(); op_78(); } /* DB FD */ +OP(fd,79) { illegal_1(); op_79(); } /* DB FD */ +OP(fd,7a) { illegal_1(); op_7a(); } /* DB FD */ +OP(fd,7b) { illegal_1(); op_7b(); } /* DB FD */ +OP(fd,7c) { R++; A = HY; } /* LD A,HY */ +OP(fd,7d) { R++; A = LY; } /* LD A,LY */ +OP(fd,7e) { R++; EAY; A = RM(EA); } /* LD A,(IY+o) */ +OP(fd,7f) { illegal_1(); op_7f(); } /* DB FD */ -OP(fd,80) { illegal_1(); op_80(); } /* DB FD */ -OP(fd,81) { illegal_1(); op_81(); } /* DB FD */ -OP(fd,82) { illegal_1(); op_82(); } /* DB FD */ -OP(fd,83) { illegal_1(); op_83(); } /* DB FD */ -OP(fd,84) { R++; ADD(HY); } /* ADD A,HY */ -OP(fd,85) { R++; ADD(LY); } /* ADD A,LY */ -OP(fd,86) { R++; EAY; ADD(RM(EA)); } /* ADD A,(IY+o) */ -OP(fd,87) { illegal_1(); op_87(); } /* DB FD */ +OP(fd,80) { illegal_1(); op_80(); } /* DB FD */ +OP(fd,81) { illegal_1(); op_81(); } /* DB FD */ +OP(fd,82) { illegal_1(); op_82(); } /* DB FD */ +OP(fd,83) { illegal_1(); op_83(); } /* DB FD */ +OP(fd,84) { R++; ADD(HY); } /* ADD A,HY */ +OP(fd,85) { R++; ADD(LY); } /* ADD A,LY */ +OP(fd,86) { R++; EAY; ADD(RM(EA)); } /* ADD A,(IY+o) */ +OP(fd,87) { illegal_1(); op_87(); } /* DB FD */ -OP(fd,88) { illegal_1(); op_88(); } /* DB FD */ -OP(fd,89) { illegal_1(); op_89(); } /* DB FD */ -OP(fd,8a) { illegal_1(); op_8a(); } /* DB FD */ -OP(fd,8b) { illegal_1(); op_8b(); } /* DB FD */ -OP(fd,8c) { R++; ADC(HY); } /* ADC A,HY */ -OP(fd,8d) { R++; ADC(LY); } /* ADC A,LY */ -OP(fd,8e) { R++; EAY; ADC(RM(EA)); } /* ADC A,(IY+o) */ -OP(fd,8f) { illegal_1(); op_8f(); } /* DB FD */ +OP(fd,88) { illegal_1(); op_88(); } /* DB FD */ +OP(fd,89) { illegal_1(); op_89(); } /* DB FD */ +OP(fd,8a) { illegal_1(); op_8a(); } /* DB FD */ +OP(fd,8b) { illegal_1(); op_8b(); } /* DB FD */ +OP(fd,8c) { R++; ADC(HY); } /* ADC A,HY */ +OP(fd,8d) { R++; ADC(LY); } /* ADC A,LY */ +OP(fd,8e) { R++; EAY; ADC(RM(EA)); } /* ADC A,(IY+o) */ +OP(fd,8f) { illegal_1(); op_8f(); } /* DB FD */ -OP(fd,90) { illegal_1(); op_90(); } /* DB FD */ -OP(fd,91) { illegal_1(); op_91(); } /* DB FD */ -OP(fd,92) { illegal_1(); op_92(); } /* DB FD */ -OP(fd,93) { illegal_1(); op_93(); } /* DB FD */ -OP(fd,94) { R++; SUB(HY); } /* SUB HY */ -OP(fd,95) { R++; SUB(LY); } /* SUB LY */ -OP(fd,96) { R++; EAY; SUB(RM(EA)); } /* SUB (IY+o) */ -OP(fd,97) { illegal_1(); op_97(); } /* DB FD */ +OP(fd,90) { illegal_1(); op_90(); } /* DB FD */ +OP(fd,91) { illegal_1(); op_91(); } /* DB FD */ +OP(fd,92) { illegal_1(); op_92(); } /* DB FD */ +OP(fd,93) { illegal_1(); op_93(); } /* DB FD */ +OP(fd,94) { R++; SUB(HY); } /* SUB HY */ +OP(fd,95) { R++; SUB(LY); } /* SUB LY */ +OP(fd,96) { R++; EAY; SUB(RM(EA)); } /* SUB (IY+o) */ +OP(fd,97) { illegal_1(); op_97(); } /* DB FD */ -OP(fd,98) { illegal_1(); op_98(); } /* DB FD */ -OP(fd,99) { illegal_1(); op_99(); } /* DB FD */ -OP(fd,9a) { illegal_1(); op_9a(); } /* DB FD */ -OP(fd,9b) { illegal_1(); op_9b(); } /* DB FD */ -OP(fd,9c) { R++; SBC(HY); } /* SBC A,HY */ -OP(fd,9d) { R++; SBC(LY); } /* SBC A,LY */ -OP(fd,9e) { R++; EAY; SBC(RM(EA)); } /* SBC A,(IY+o) */ -OP(fd,9f) { illegal_1(); op_9f(); } /* DB FD */ +OP(fd,98) { illegal_1(); op_98(); } /* DB FD */ +OP(fd,99) { illegal_1(); op_99(); } /* DB FD */ +OP(fd,9a) { illegal_1(); op_9a(); } /* DB FD */ +OP(fd,9b) { illegal_1(); op_9b(); } /* DB FD */ +OP(fd,9c) { R++; SBC(HY); } /* SBC A,HY */ +OP(fd,9d) { R++; SBC(LY); } /* SBC A,LY */ +OP(fd,9e) { R++; EAY; SBC(RM(EA)); } /* SBC A,(IY+o) */ +OP(fd,9f) { illegal_1(); op_9f(); } /* DB FD */ -OP(fd,a0) { illegal_1(); op_a0(); } /* DB FD */ -OP(fd,a1) { illegal_1(); op_a1(); } /* DB FD */ -OP(fd,a2) { illegal_1(); op_a2(); } /* DB FD */ -OP(fd,a3) { illegal_1(); op_a3(); } /* DB FD */ -OP(fd,a4) { R++; AND(HY); } /* AND HY */ -OP(fd,a5) { R++; AND(LY); } /* AND LY */ -OP(fd,a6) { R++; EAY; AND(RM(EA)); } /* AND (IY+o) */ -OP(fd,a7) { illegal_1(); op_a7(); } /* DB FD */ +OP(fd,a0) { illegal_1(); op_a0(); } /* DB FD */ +OP(fd,a1) { illegal_1(); op_a1(); } /* DB FD */ +OP(fd,a2) { illegal_1(); op_a2(); } /* DB FD */ +OP(fd,a3) { illegal_1(); op_a3(); } /* DB FD */ +OP(fd,a4) { R++; AND(HY); } /* AND HY */ +OP(fd,a5) { R++; AND(LY); } /* AND LY */ +OP(fd,a6) { R++; EAY; AND(RM(EA)); } /* AND (IY+o) */ +OP(fd,a7) { illegal_1(); op_a7(); } /* DB FD */ -OP(fd,a8) { illegal_1(); op_a8(); } /* DB FD */ -OP(fd,a9) { illegal_1(); op_a9(); } /* DB FD */ -OP(fd,aa) { illegal_1(); op_aa(); } /* DB FD */ -OP(fd,ab) { illegal_1(); op_ab(); } /* DB FD */ -OP(fd,ac) { R++; XOR(HY); } /* XOR HY */ -OP(fd,ad) { R++; XOR(LY); } /* XOR LY */ -OP(fd,ae) { R++; EAY; XOR(RM(EA)); } /* XOR (IY+o) */ -OP(fd,af) { illegal_1(); op_af(); } /* DB FD */ +OP(fd,a8) { illegal_1(); op_a8(); } /* DB FD */ +OP(fd,a9) { illegal_1(); op_a9(); } /* DB FD */ +OP(fd,aa) { illegal_1(); op_aa(); } /* DB FD */ +OP(fd,ab) { illegal_1(); op_ab(); } /* DB FD */ +OP(fd,ac) { R++; XOR(HY); } /* XOR HY */ +OP(fd,ad) { R++; XOR(LY); } /* XOR LY */ +OP(fd,ae) { R++; EAY; XOR(RM(EA)); } /* XOR (IY+o) */ +OP(fd,af) { illegal_1(); op_af(); } /* DB FD */ -OP(fd,b0) { illegal_1(); op_b0(); } /* DB FD */ -OP(fd,b1) { illegal_1(); op_b1(); } /* DB FD */ -OP(fd,b2) { illegal_1(); op_b2(); } /* DB FD */ -OP(fd,b3) { illegal_1(); op_b3(); } /* DB FD */ -OP(fd,b4) { R++; OR(HY); } /* OR HY */ -OP(fd,b5) { R++; OR(LY); } /* OR LY */ -OP(fd,b6) { R++; EAY; OR(RM(EA)); } /* OR (IY+o) */ -OP(fd,b7) { illegal_1(); op_b7(); } /* DB FD */ +OP(fd,b0) { illegal_1(); op_b0(); } /* DB FD */ +OP(fd,b1) { illegal_1(); op_b1(); } /* DB FD */ +OP(fd,b2) { illegal_1(); op_b2(); } /* DB FD */ +OP(fd,b3) { illegal_1(); op_b3(); } /* DB FD */ +OP(fd,b4) { R++; OR(HY); } /* OR HY */ +OP(fd,b5) { R++; OR(LY); } /* OR LY */ +OP(fd,b6) { R++; EAY; OR(RM(EA)); } /* OR (IY+o) */ +OP(fd,b7) { illegal_1(); op_b7(); } /* DB FD */ -OP(fd,b8) { illegal_1(); op_b8(); } /* DB FD */ -OP(fd,b9) { illegal_1(); op_b9(); } /* DB FD */ -OP(fd,ba) { illegal_1(); op_ba(); } /* DB FD */ -OP(fd,bb) { illegal_1(); op_bb(); } /* DB FD */ -OP(fd,bc) { R++; CP(HY); } /* CP HY */ -OP(fd,bd) { R++; CP(LY); } /* CP LY */ -OP(fd,be) { R++; EAY; CP(RM(EA)); } /* CP (IY+o) */ -OP(fd,bf) { illegal_1(); op_bf(); } /* DB FD */ +OP(fd,b8) { illegal_1(); op_b8(); } /* DB FD */ +OP(fd,b9) { illegal_1(); op_b9(); } /* DB FD */ +OP(fd,ba) { illegal_1(); op_ba(); } /* DB FD */ +OP(fd,bb) { illegal_1(); op_bb(); } /* DB FD */ +OP(fd,bc) { R++; CP(HY); } /* CP HY */ +OP(fd,bd) { R++; CP(LY); } /* CP LY */ +OP(fd,be) { R++; EAY; CP(RM(EA)); } /* CP (IY+o) */ +OP(fd,bf) { illegal_1(); op_bf(); } /* DB FD */ -OP(fd,c0) { illegal_1(); op_c0(); } /* DB FD */ -OP(fd,c1) { illegal_1(); op_c1(); } /* DB FD */ -OP(fd,c2) { illegal_1(); op_c2(); } /* DB FD */ -OP(fd,c3) { illegal_1(); op_c3(); } /* DB FD */ -OP(fd,c4) { illegal_1(); op_c4(); } /* DB FD */ -OP(fd,c5) { illegal_1(); op_c5(); } /* DB FD */ -OP(fd,c6) { illegal_1(); op_c6(); } /* DB FD */ -OP(fd,c7) { illegal_1(); op_c7(); } /* DB FD */ +OP(fd,c0) { illegal_1(); op_c0(); } /* DB FD */ +OP(fd,c1) { illegal_1(); op_c1(); } /* DB FD */ +OP(fd,c2) { illegal_1(); op_c2(); } /* DB FD */ +OP(fd,c3) { illegal_1(); op_c3(); } /* DB FD */ +OP(fd,c4) { illegal_1(); op_c4(); } /* DB FD */ +OP(fd,c5) { illegal_1(); op_c5(); } /* DB FD */ +OP(fd,c6) { illegal_1(); op_c6(); } /* DB FD */ +OP(fd,c7) { illegal_1(); op_c7(); } /* DB FD */ -OP(fd,c8) { illegal_1(); op_c8(); } /* DB FD */ -OP(fd,c9) { illegal_1(); op_c9(); } /* DB FD */ -OP(fd,ca) { illegal_1(); op_ca(); } /* DB FD */ -OP(fd,cb) { R++; EAY; EXEC(xycb,ARG()); } /* ** FD CB xx */ -OP(fd,cc) { illegal_1(); op_cc(); } /* DB FD */ -OP(fd,cd) { illegal_1(); op_cd(); } /* DB FD */ -OP(fd,ce) { illegal_1(); op_ce(); } /* DB FD */ -OP(fd,cf) { illegal_1(); op_cf(); } /* DB FD */ +OP(fd,c8) { illegal_1(); op_c8(); } /* DB FD */ +OP(fd,c9) { illegal_1(); op_c9(); } /* DB FD */ +OP(fd,ca) { illegal_1(); op_ca(); } /* DB FD */ +OP(fd,cb) { R++; EAY; EXEC(xycb,ARG()); } /* ** FD CB xx */ +OP(fd,cc) { illegal_1(); op_cc(); } /* DB FD */ +OP(fd,cd) { illegal_1(); op_cd(); } /* DB FD */ +OP(fd,ce) { illegal_1(); op_ce(); } /* DB FD */ +OP(fd,cf) { illegal_1(); op_cf(); } /* DB FD */ -OP(fd,d0) { illegal_1(); op_d0(); } /* DB FD */ -OP(fd,d1) { illegal_1(); op_d1(); } /* DB FD */ -OP(fd,d2) { illegal_1(); op_d2(); } /* DB FD */ -OP(fd,d3) { illegal_1(); op_d3(); } /* DB FD */ -OP(fd,d4) { illegal_1(); op_d4(); } /* DB FD */ -OP(fd,d5) { illegal_1(); op_d5(); } /* DB FD */ -OP(fd,d6) { illegal_1(); op_d6(); } /* DB FD */ -OP(fd,d7) { illegal_1(); op_d7(); } /* DB FD */ +OP(fd,d0) { illegal_1(); op_d0(); } /* DB FD */ +OP(fd,d1) { illegal_1(); op_d1(); } /* DB FD */ +OP(fd,d2) { illegal_1(); op_d2(); } /* DB FD */ +OP(fd,d3) { illegal_1(); op_d3(); } /* DB FD */ +OP(fd,d4) { illegal_1(); op_d4(); } /* DB FD */ +OP(fd,d5) { illegal_1(); op_d5(); } /* DB FD */ +OP(fd,d6) { illegal_1(); op_d6(); } /* DB FD */ +OP(fd,d7) { illegal_1(); op_d7(); } /* DB FD */ -OP(fd,d8) { illegal_1(); op_d8(); } /* DB FD */ -OP(fd,d9) { illegal_1(); op_d9(); } /* DB FD */ -OP(fd,da) { illegal_1(); op_da(); } /* DB FD */ -OP(fd,db) { illegal_1(); op_db(); } /* DB FD */ -OP(fd,dc) { illegal_1(); op_dc(); } /* DB FD */ -OP(fd,dd) { illegal_1(); op_dd(); } /* DB FD */ -OP(fd,de) { illegal_1(); op_de(); } /* DB FD */ -OP(fd,df) { illegal_1(); op_df(); } /* DB FD */ +OP(fd,d8) { illegal_1(); op_d8(); } /* DB FD */ +OP(fd,d9) { illegal_1(); op_d9(); } /* DB FD */ +OP(fd,da) { illegal_1(); op_da(); } /* DB FD */ +OP(fd,db) { illegal_1(); op_db(); } /* DB FD */ +OP(fd,dc) { illegal_1(); op_dc(); } /* DB FD */ +OP(fd,dd) { illegal_1(); op_dd(); } /* DB FD */ +OP(fd,de) { illegal_1(); op_de(); } /* DB FD */ +OP(fd,df) { illegal_1(); op_df(); } /* DB FD */ -OP(fd,e0) { illegal_1(); op_e0(); } /* DB FD */ -OP(fd,e1) { R++; POP( iy ); } /* POP IY */ -OP(fd,e2) { illegal_1(); op_e2(); } /* DB FD */ -OP(fd,e3) { R++; EXSP( iy ); } /* EX (SP),IY */ -OP(fd,e4) { illegal_1(); op_e4(); } /* DB FD */ -OP(fd,e5) { R++; PUSH( iy ); } /* PUSH IY */ -OP(fd,e6) { illegal_1(); op_e6(); } /* DB FD */ -OP(fd,e7) { illegal_1(); op_e7(); } /* DB FD */ +OP(fd,e0) { illegal_1(); op_e0(); } /* DB FD */ +OP(fd,e1) { R++; POP( iy ); } /* POP IY */ +OP(fd,e2) { illegal_1(); op_e2(); } /* DB FD */ +OP(fd,e3) { R++; EXSP( iy ); } /* EX (SP),IY */ +OP(fd,e4) { illegal_1(); op_e4(); } /* DB FD */ +OP(fd,e5) { R++; PUSH( iy ); } /* PUSH IY */ +OP(fd,e6) { illegal_1(); op_e6(); } /* DB FD */ +OP(fd,e7) { illegal_1(); op_e7(); } /* DB FD */ -OP(fd,e8) { illegal_1(); op_e8(); } /* DB FD */ -OP(fd,e9) { R++; PC = IY; change_pc(PCD); } /* JP (IY) */ -OP(fd,ea) { illegal_1(); op_ea(); } /* DB FD */ -OP(fd,eb) { illegal_1(); op_eb(); } /* DB FD */ -OP(fd,ec) { illegal_1(); op_ec(); } /* DB FD */ -OP(fd,ed) { illegal_1(); op_ed(); } /* DB FD */ -OP(fd,ee) { illegal_1(); op_ee(); } /* DB FD */ -OP(fd,ef) { illegal_1(); op_ef(); } /* DB FD */ +OP(fd,e8) { illegal_1(); op_e8(); } /* DB FD */ +OP(fd,e9) { R++; PC = IY; change_pc(PCD); } /* JP (IY) */ +OP(fd,ea) { illegal_1(); op_ea(); } /* DB FD */ +OP(fd,eb) { illegal_1(); op_eb(); } /* DB FD */ +OP(fd,ec) { illegal_1(); op_ec(); } /* DB FD */ +OP(fd,ed) { illegal_1(); op_ed(); } /* DB FD */ +OP(fd,ee) { illegal_1(); op_ee(); } /* DB FD */ +OP(fd,ef) { illegal_1(); op_ef(); } /* DB FD */ -OP(fd,f0) { illegal_1(); op_f0(); } /* DB FD */ -OP(fd,f1) { illegal_1(); op_f1(); } /* DB FD */ -OP(fd,f2) { illegal_1(); op_f2(); } /* DB FD */ -OP(fd,f3) { illegal_1(); op_f3(); } /* DB FD */ -OP(fd,f4) { illegal_1(); op_f4(); } /* DB FD */ -OP(fd,f5) { illegal_1(); op_f5(); } /* DB FD */ -OP(fd,f6) { illegal_1(); op_f6(); } /* DB FD */ -OP(fd,f7) { illegal_1(); op_f7(); } /* DB FD */ +OP(fd,f0) { illegal_1(); op_f0(); } /* DB FD */ +OP(fd,f1) { illegal_1(); op_f1(); } /* DB FD */ +OP(fd,f2) { illegal_1(); op_f2(); } /* DB FD */ +OP(fd,f3) { illegal_1(); op_f3(); } /* DB FD */ +OP(fd,f4) { illegal_1(); op_f4(); } /* DB FD */ +OP(fd,f5) { illegal_1(); op_f5(); } /* DB FD */ +OP(fd,f6) { illegal_1(); op_f6(); } /* DB FD */ +OP(fd,f7) { illegal_1(); op_f7(); } /* DB FD */ -OP(fd,f8) { illegal_1(); op_f8(); } /* DB FD */ -OP(fd,f9) { R++; SP = IY; } /* LD SP,IY */ -OP(fd,fa) { illegal_1(); op_fa(); } /* DB FD */ -OP(fd,fb) { illegal_1(); op_fb(); } /* DB FD */ -OP(fd,fc) { illegal_1(); op_fc(); } /* DB FD */ -OP(fd,fd) { illegal_1(); op_fd(); } /* DB FD */ -OP(fd,fe) { illegal_1(); op_fe(); } /* DB FD */ -OP(fd,ff) { illegal_1(); op_ff(); } /* DB FD */ +OP(fd,f8) { illegal_1(); op_f8(); } /* DB FD */ +OP(fd,f9) { R++; SP = IY; } /* LD SP,IY */ +OP(fd,fa) { illegal_1(); op_fa(); } /* DB FD */ +OP(fd,fb) { illegal_1(); op_fb(); } /* DB FD */ +OP(fd,fc) { illegal_1(); op_fc(); } /* DB FD */ +OP(fd,fd) { illegal_1(); op_fd(); } /* DB FD */ +OP(fd,fe) { illegal_1(); op_fe(); } /* DB FD */ +OP(fd,ff) { illegal_1(); op_ff(); } /* DB FD */ OP(illegal,2) { #if VERBOSE logerror("Z80 #%d ill. opcode $ed $%02x\n", - cpu_getactivecpu(), cpu_readop((PCD-1)&0xffff)); + cpu_getactivecpu(), cpu_readop((PCD-1)&0xffff)); #endif } /********************************************************** * special opcodes (ED prefix) **********************************************************/ -OP(ed,00) { illegal_2(); } /* DB ED */ -OP(ed,01) { illegal_2(); } /* DB ED */ -OP(ed,02) { illegal_2(); } /* DB ED */ -OP(ed,03) { illegal_2(); } /* DB ED */ -OP(ed,04) { illegal_2(); } /* DB ED */ -OP(ed,05) { illegal_2(); } /* DB ED */ -OP(ed,06) { illegal_2(); } /* DB ED */ -OP(ed,07) { illegal_2(); } /* DB ED */ +OP(ed,00) { illegal_2(); } /* DB ED */ +OP(ed,01) { illegal_2(); } /* DB ED */ +OP(ed,02) { illegal_2(); } /* DB ED */ +OP(ed,03) { illegal_2(); } /* DB ED */ +OP(ed,04) { illegal_2(); } /* DB ED */ +OP(ed,05) { illegal_2(); } /* DB ED */ +OP(ed,06) { illegal_2(); } /* DB ED */ +OP(ed,07) { illegal_2(); } /* DB ED */ -OP(ed,08) { illegal_2(); } /* DB ED */ -OP(ed,09) { illegal_2(); } /* DB ED */ -OP(ed,0a) { illegal_2(); } /* DB ED */ -OP(ed,0b) { illegal_2(); } /* DB ED */ -OP(ed,0c) { illegal_2(); } /* DB ED */ -OP(ed,0d) { illegal_2(); } /* DB ED */ -OP(ed,0e) { illegal_2(); } /* DB ED */ -OP(ed,0f) { illegal_2(); } /* DB ED */ +OP(ed,08) { illegal_2(); } /* DB ED */ +OP(ed,09) { illegal_2(); } /* DB ED */ +OP(ed,0a) { illegal_2(); } /* DB ED */ +OP(ed,0b) { illegal_2(); } /* DB ED */ +OP(ed,0c) { illegal_2(); } /* DB ED */ +OP(ed,0d) { illegal_2(); } /* DB ED */ +OP(ed,0e) { illegal_2(); } /* DB ED */ +OP(ed,0f) { illegal_2(); } /* DB ED */ -OP(ed,10) { illegal_2(); } /* DB ED */ -OP(ed,11) { illegal_2(); } /* DB ED */ -OP(ed,12) { illegal_2(); } /* DB ED */ -OP(ed,13) { illegal_2(); } /* DB ED */ -OP(ed,14) { illegal_2(); } /* DB ED */ -OP(ed,15) { illegal_2(); } /* DB ED */ -OP(ed,16) { illegal_2(); } /* DB ED */ -OP(ed,17) { illegal_2(); } /* DB ED */ +OP(ed,10) { illegal_2(); } /* DB ED */ +OP(ed,11) { illegal_2(); } /* DB ED */ +OP(ed,12) { illegal_2(); } /* DB ED */ +OP(ed,13) { illegal_2(); } /* DB ED */ +OP(ed,14) { illegal_2(); } /* DB ED */ +OP(ed,15) { illegal_2(); } /* DB ED */ +OP(ed,16) { illegal_2(); } /* DB ED */ +OP(ed,17) { illegal_2(); } /* DB ED */ -OP(ed,18) { illegal_2(); } /* DB ED */ -OP(ed,19) { illegal_2(); } /* DB ED */ -OP(ed,1a) { illegal_2(); } /* DB ED */ -OP(ed,1b) { illegal_2(); } /* DB ED */ -OP(ed,1c) { illegal_2(); } /* DB ED */ -OP(ed,1d) { illegal_2(); } /* DB ED */ -OP(ed,1e) { illegal_2(); } /* DB ED */ -OP(ed,1f) { illegal_2(); } /* DB ED */ +OP(ed,18) { illegal_2(); } /* DB ED */ +OP(ed,19) { illegal_2(); } /* DB ED */ +OP(ed,1a) { illegal_2(); } /* DB ED */ +OP(ed,1b) { illegal_2(); } /* DB ED */ +OP(ed,1c) { illegal_2(); } /* DB ED */ +OP(ed,1d) { illegal_2(); } /* DB ED */ +OP(ed,1e) { illegal_2(); } /* DB ED */ +OP(ed,1f) { illegal_2(); } /* DB ED */ -OP(ed,20) { illegal_2(); } /* DB ED */ -OP(ed,21) { illegal_2(); } /* DB ED */ -OP(ed,22) { illegal_2(); } /* DB ED */ -OP(ed,23) { illegal_2(); } /* DB ED */ -OP(ed,24) { illegal_2(); } /* DB ED */ -OP(ed,25) { illegal_2(); } /* DB ED */ -OP(ed,26) { illegal_2(); } /* DB ED */ -OP(ed,27) { illegal_2(); } /* DB ED */ +OP(ed,20) { illegal_2(); } /* DB ED */ +OP(ed,21) { illegal_2(); } /* DB ED */ +OP(ed,22) { illegal_2(); } /* DB ED */ +OP(ed,23) { illegal_2(); } /* DB ED */ +OP(ed,24) { illegal_2(); } /* DB ED */ +OP(ed,25) { illegal_2(); } /* DB ED */ +OP(ed,26) { illegal_2(); } /* DB ED */ +OP(ed,27) { illegal_2(); } /* DB ED */ -OP(ed,28) { illegal_2(); } /* DB ED */ -OP(ed,29) { illegal_2(); } /* DB ED */ -OP(ed,2a) { illegal_2(); } /* DB ED */ -OP(ed,2b) { illegal_2(); } /* DB ED */ -OP(ed,2c) { illegal_2(); } /* DB ED */ -OP(ed,2d) { illegal_2(); } /* DB ED */ -OP(ed,2e) { illegal_2(); } /* DB ED */ -OP(ed,2f) { illegal_2(); } /* DB ED */ +OP(ed,28) { illegal_2(); } /* DB ED */ +OP(ed,29) { illegal_2(); } /* DB ED */ +OP(ed,2a) { illegal_2(); } /* DB ED */ +OP(ed,2b) { illegal_2(); } /* DB ED */ +OP(ed,2c) { illegal_2(); } /* DB ED */ +OP(ed,2d) { illegal_2(); } /* DB ED */ +OP(ed,2e) { illegal_2(); } /* DB ED */ +OP(ed,2f) { illegal_2(); } /* DB ED */ -OP(ed,30) { illegal_2(); } /* DB ED */ -OP(ed,31) { illegal_2(); } /* DB ED */ -OP(ed,32) { illegal_2(); } /* DB ED */ -OP(ed,33) { illegal_2(); } /* DB ED */ -OP(ed,34) { illegal_2(); } /* DB ED */ -OP(ed,35) { illegal_2(); } /* DB ED */ -OP(ed,36) { illegal_2(); } /* DB ED */ -OP(ed,37) { illegal_2(); } /* DB ED */ +OP(ed,30) { illegal_2(); } /* DB ED */ +OP(ed,31) { illegal_2(); } /* DB ED */ +OP(ed,32) { illegal_2(); } /* DB ED */ +OP(ed,33) { illegal_2(); } /* DB ED */ +OP(ed,34) { illegal_2(); } /* DB ED */ +OP(ed,35) { illegal_2(); } /* DB ED */ +OP(ed,36) { illegal_2(); } /* DB ED */ +OP(ed,37) { illegal_2(); } /* DB ED */ -OP(ed,38) { illegal_2(); } /* DB ED */ -OP(ed,39) { illegal_2(); } /* DB ED */ -OP(ed,3a) { illegal_2(); } /* DB ED */ -OP(ed,3b) { illegal_2(); } /* DB ED */ -OP(ed,3c) { illegal_2(); } /* DB ED */ -OP(ed,3d) { illegal_2(); } /* DB ED */ -OP(ed,3e) { illegal_2(); } /* DB ED */ -OP(ed,3f) { illegal_2(); } /* DB ED */ +OP(ed,38) { illegal_2(); } /* DB ED */ +OP(ed,39) { illegal_2(); } /* DB ED */ +OP(ed,3a) { illegal_2(); } /* DB ED */ +OP(ed,3b) { illegal_2(); } /* DB ED */ +OP(ed,3c) { illegal_2(); } /* DB ED */ +OP(ed,3d) { illegal_2(); } /* DB ED */ +OP(ed,3e) { illegal_2(); } /* DB ED */ +OP(ed,3f) { illegal_2(); } /* DB ED */ -OP(ed,40) { B = IN(BC); F = (F & CF) | SZP[B]; } /* IN B,(C) */ -OP(ed,41) { OUT(BC, B); } /* OUT (C),B */ -OP(ed,42) { SBC16( bc ); } /* SBC HL,BC */ -OP(ed,43) { EA = ARG16(); WM16( EA, &Z80.bc ); } /* LD (w),BC */ -OP(ed,44) { NEG; } /* NEG */ -OP(ed,45) { RETN; } /* RETN; */ -OP(ed,46) { IM = 0; } /* IM 0 */ -OP(ed,47) { LD_I_A; } /* LD I,A */ +OP(ed,40) { B = IN(BC); F = (F & CF) | SZP[B]; } /* IN B,(C) */ +OP(ed,41) { OUT(BC, B); } /* OUT (C),B */ +OP(ed,42) { SBC16( bc ); } /* SBC HL,BC */ +OP(ed,43) { EA = ARG16(); WM16( EA, &Z80.bc ); } /* LD (w),BC */ +OP(ed,44) { NEG; } /* NEG */ +OP(ed,45) { RETN; } /* RETN; */ +OP(ed,46) { IM = 0; } /* IM 0 */ +OP(ed,47) { LD_I_A; } /* LD I,A */ -OP(ed,48) { C = IN(BC); F = (F & CF) | SZP[C]; } /* IN C,(C) */ -OP(ed,49) { OUT(BC, C); } /* OUT (C),C */ -OP(ed,4a) { ADC16( bc ); } /* ADC HL,BC */ -OP(ed,4b) { EA = ARG16(); RM16( EA, &Z80.bc ); } /* LD BC,(w) */ -OP(ed,4c) { NEG; } /* NEG */ -OP(ed,4d) { RETI; } /* RETI */ -OP(ed,4e) { IM = 0; } /* IM 0 */ -OP(ed,4f) { LD_R_A; } /* LD R,A */ +OP(ed,48) { C = IN(BC); F = (F & CF) | SZP[C]; } /* IN C,(C) */ +OP(ed,49) { OUT(BC, C); } /* OUT (C),C */ +OP(ed,4a) { ADC16( bc ); } /* ADC HL,BC */ +OP(ed,4b) { EA = ARG16(); RM16( EA, &Z80.bc ); } /* LD BC,(w) */ +OP(ed,4c) { NEG; } /* NEG */ +OP(ed,4d) { RETI; } /* RETI */ +OP(ed,4e) { IM = 0; } /* IM 0 */ +OP(ed,4f) { LD_R_A; } /* LD R,A */ -OP(ed,50) { D = IN(BC); F = (F & CF) | SZP[D]; } /* IN D,(C) */ -OP(ed,51) { OUT(BC, D); } /* OUT (C),D */ -OP(ed,52) { SBC16( de ); } /* SBC HL,DE */ -OP(ed,53) { EA = ARG16(); WM16( EA, &Z80.de ); } /* LD (w),DE */ -OP(ed,54) { NEG; } /* NEG */ -OP(ed,55) { RETN; } /* RETN; */ -OP(ed,56) { IM = 1; } /* IM 1 */ -OP(ed,57) { LD_A_I; } /* LD A,I */ +OP(ed,50) { D = IN(BC); F = (F & CF) | SZP[D]; } /* IN D,(C) */ +OP(ed,51) { OUT(BC, D); } /* OUT (C),D */ +OP(ed,52) { SBC16( de ); } /* SBC HL,DE */ +OP(ed,53) { EA = ARG16(); WM16( EA, &Z80.de ); } /* LD (w),DE */ +OP(ed,54) { NEG; } /* NEG */ +OP(ed,55) { RETN; } /* RETN; */ +OP(ed,56) { IM = 1; } /* IM 1 */ +OP(ed,57) { LD_A_I; } /* LD A,I */ -OP(ed,58) { E = IN(BC); F = (F & CF) | SZP[E]; } /* IN E,(C) */ -OP(ed,59) { OUT(BC, E); } /* OUT (C),E */ -OP(ed,5a) { ADC16( de ); } /* ADC HL,DE */ -OP(ed,5b) { EA = ARG16(); RM16( EA, &Z80.de ); } /* LD DE,(w) */ -OP(ed,5c) { NEG; } /* NEG */ -OP(ed,5d) { RETI; } /* RETI */ -OP(ed,5e) { IM = 2; } /* IM 2 */ -OP(ed,5f) { LD_A_R; } /* LD A,R */ +OP(ed,58) { E = IN(BC); F = (F & CF) | SZP[E]; } /* IN E,(C) */ +OP(ed,59) { OUT(BC, E); } /* OUT (C),E */ +OP(ed,5a) { ADC16( de ); } /* ADC HL,DE */ +OP(ed,5b) { EA = ARG16(); RM16( EA, &Z80.de ); } /* LD DE,(w) */ +OP(ed,5c) { NEG; } /* NEG */ +OP(ed,5d) { RETI; } /* RETI */ +OP(ed,5e) { IM = 2; } /* IM 2 */ +OP(ed,5f) { LD_A_R; } /* LD A,R */ -OP(ed,60) { H = IN(BC); F = (F & CF) | SZP[H]; } /* IN H,(C) */ -OP(ed,61) { OUT(BC, H); } /* OUT (C),H */ -OP(ed,62) { SBC16( hl ); } /* SBC HL,HL */ -OP(ed,63) { EA = ARG16(); WM16( EA, &Z80.hl ); } /* LD (w),HL */ -OP(ed,64) { NEG; } /* NEG */ -OP(ed,65) { RETN; } /* RETN; */ -OP(ed,66) { IM = 0; } /* IM 0 */ -OP(ed,67) { RRD; } /* RRD (HL) */ +OP(ed,60) { H = IN(BC); F = (F & CF) | SZP[H]; } /* IN H,(C) */ +OP(ed,61) { OUT(BC, H); } /* OUT (C),H */ +OP(ed,62) { SBC16( hl ); } /* SBC HL,HL */ +OP(ed,63) { EA = ARG16(); WM16( EA, &Z80.hl ); } /* LD (w),HL */ +OP(ed,64) { NEG; } /* NEG */ +OP(ed,65) { RETN; } /* RETN; */ +OP(ed,66) { IM = 0; } /* IM 0 */ +OP(ed,67) { RRD; } /* RRD (HL) */ -OP(ed,68) { L = IN(BC); F = (F & CF) | SZP[L]; } /* IN L,(C) */ -OP(ed,69) { OUT(BC, L); } /* OUT (C),L */ -OP(ed,6a) { ADC16( hl ); } /* ADC HL,HL */ -OP(ed,6b) { EA = ARG16(); RM16( EA, &Z80.hl ); } /* LD HL,(w) */ -OP(ed,6c) { NEG; } /* NEG */ -OP(ed,6d) { RETI; } /* RETI */ -OP(ed,6e) { IM = 0; } /* IM 0 */ -OP(ed,6f) { RLD; } /* RLD (HL) */ +OP(ed,68) { L = IN(BC); F = (F & CF) | SZP[L]; } /* IN L,(C) */ +OP(ed,69) { OUT(BC, L); } /* OUT (C),L */ +OP(ed,6a) { ADC16( hl ); } /* ADC HL,HL */ +OP(ed,6b) { EA = ARG16(); RM16( EA, &Z80.hl ); } /* LD HL,(w) */ +OP(ed,6c) { NEG; } /* NEG */ +OP(ed,6d) { RETI; } /* RETI */ +OP(ed,6e) { IM = 0; } /* IM 0 */ +OP(ed,6f) { RLD; } /* RLD (HL) */ -OP(ed,70) { UINT8 res = IN(BC); F = (F & CF) | SZP[res]; } /* IN 0,(C) */ -OP(ed,71) { OUT(BC, 0); } /* OUT (C),0 */ -OP(ed,72) { SBC16( sp ); } /* SBC HL,SP */ -OP(ed,73) { EA = ARG16(); WM16( EA, &Z80.sp ); } /* LD (w),SP */ -OP(ed,74) { NEG; } /* NEG */ -OP(ed,75) { RETN; } /* RETN; */ -OP(ed,76) { IM = 1; } /* IM 1 */ -OP(ed,77) { illegal_2(); } /* DB ED,77 */ +OP(ed,70) { UINT8 res = IN(BC); F = (F & CF) | SZP[res]; } /* IN 0,(C) */ +OP(ed,71) { OUT(BC, 0); } /* OUT (C),0 */ +OP(ed,72) { SBC16( sp ); } /* SBC HL,SP */ +OP(ed,73) { EA = ARG16(); WM16( EA, &Z80.sp ); } /* LD (w),SP */ +OP(ed,74) { NEG; } /* NEG */ +OP(ed,75) { RETN; } /* RETN; */ +OP(ed,76) { IM = 1; } /* IM 1 */ +OP(ed,77) { illegal_2(); } /* DB ED,77 */ -OP(ed,78) { A = IN(BC); F = (F & CF) | SZP[A]; } /* IN E,(C) */ -OP(ed,79) { OUT(BC, A); } /* OUT (C),A */ -OP(ed,7a) { ADC16( sp ); } /* ADC HL,SP */ -OP(ed,7b) { EA = ARG16(); RM16( EA, &Z80.sp ); } /* LD SP,(w) */ -OP(ed,7c) { NEG; } /* NEG */ -OP(ed,7d) { RETI; } /* RETI */ -OP(ed,7e) { IM = 2; } /* IM 2 */ -OP(ed,7f) { illegal_2(); } /* DB ED,7F */ +OP(ed,78) { A = IN(BC); F = (F & CF) | SZP[A]; } /* IN E,(C) */ +OP(ed,79) { OUT(BC, A); } /* OUT (C),A */ +OP(ed,7a) { ADC16( sp ); } /* ADC HL,SP */ +OP(ed,7b) { EA = ARG16(); RM16( EA, &Z80.sp ); } /* LD SP,(w) */ +OP(ed,7c) { NEG; } /* NEG */ +OP(ed,7d) { RETI; } /* RETI */ +OP(ed,7e) { IM = 2; } /* IM 2 */ +OP(ed,7f) { illegal_2(); } /* DB ED,7F */ -OP(ed,80) { illegal_2(); } /* DB ED */ -OP(ed,81) { illegal_2(); } /* DB ED */ -OP(ed,82) { illegal_2(); } /* DB ED */ -OP(ed,83) { illegal_2(); } /* DB ED */ -OP(ed,84) { illegal_2(); } /* DB ED */ -OP(ed,85) { illegal_2(); } /* DB ED */ -OP(ed,86) { illegal_2(); } /* DB ED */ -OP(ed,87) { illegal_2(); } /* DB ED */ +OP(ed,80) { illegal_2(); } /* DB ED */ +OP(ed,81) { illegal_2(); } /* DB ED */ +OP(ed,82) { illegal_2(); } /* DB ED */ +OP(ed,83) { illegal_2(); } /* DB ED */ +OP(ed,84) { illegal_2(); } /* DB ED */ +OP(ed,85) { illegal_2(); } /* DB ED */ +OP(ed,86) { illegal_2(); } /* DB ED */ +OP(ed,87) { illegal_2(); } /* DB ED */ -OP(ed,88) { illegal_2(); } /* DB ED */ -OP(ed,89) { illegal_2(); } /* DB ED */ -OP(ed,8a) { illegal_2(); } /* DB ED */ -OP(ed,8b) { illegal_2(); } /* DB ED */ -OP(ed,8c) { illegal_2(); } /* DB ED */ -OP(ed,8d) { illegal_2(); } /* DB ED */ -OP(ed,8e) { illegal_2(); } /* DB ED */ -OP(ed,8f) { illegal_2(); } /* DB ED */ +OP(ed,88) { illegal_2(); } /* DB ED */ +OP(ed,89) { illegal_2(); } /* DB ED */ +OP(ed,8a) { illegal_2(); } /* DB ED */ +OP(ed,8b) { illegal_2(); } /* DB ED */ +OP(ed,8c) { illegal_2(); } /* DB ED */ +OP(ed,8d) { illegal_2(); } /* DB ED */ +OP(ed,8e) { illegal_2(); } /* DB ED */ +OP(ed,8f) { illegal_2(); } /* DB ED */ -OP(ed,90) { illegal_2(); } /* DB ED */ -OP(ed,91) { illegal_2(); } /* DB ED */ -OP(ed,92) { illegal_2(); } /* DB ED */ -OP(ed,93) { illegal_2(); } /* DB ED */ -OP(ed,94) { illegal_2(); } /* DB ED */ -OP(ed,95) { illegal_2(); } /* DB ED */ -OP(ed,96) { illegal_2(); } /* DB ED */ -OP(ed,97) { illegal_2(); } /* DB ED */ +OP(ed,90) { illegal_2(); } /* DB ED */ +OP(ed,91) { illegal_2(); } /* DB ED */ +OP(ed,92) { illegal_2(); } /* DB ED */ +OP(ed,93) { illegal_2(); } /* DB ED */ +OP(ed,94) { illegal_2(); } /* DB ED */ +OP(ed,95) { illegal_2(); } /* DB ED */ +OP(ed,96) { illegal_2(); } /* DB ED */ +OP(ed,97) { illegal_2(); } /* DB ED */ -OP(ed,98) { illegal_2(); } /* DB ED */ -OP(ed,99) { illegal_2(); } /* DB ED */ -OP(ed,9a) { illegal_2(); } /* DB ED */ -OP(ed,9b) { illegal_2(); } /* DB ED */ -OP(ed,9c) { illegal_2(); } /* DB ED */ -OP(ed,9d) { illegal_2(); } /* DB ED */ -OP(ed,9e) { illegal_2(); } /* DB ED */ -OP(ed,9f) { illegal_2(); } /* DB ED */ +OP(ed,98) { illegal_2(); } /* DB ED */ +OP(ed,99) { illegal_2(); } /* DB ED */ +OP(ed,9a) { illegal_2(); } /* DB ED */ +OP(ed,9b) { illegal_2(); } /* DB ED */ +OP(ed,9c) { illegal_2(); } /* DB ED */ +OP(ed,9d) { illegal_2(); } /* DB ED */ +OP(ed,9e) { illegal_2(); } /* DB ED */ +OP(ed,9f) { illegal_2(); } /* DB ED */ -OP(ed,a0) { LDI; } /* LDI */ -OP(ed,a1) { CPI; } /* CPI */ -OP(ed,a2) { INI; } /* INI */ -OP(ed,a3) { OUTI; } /* OUTI */ -OP(ed,a4) { illegal_2(); } /* DB ED */ -OP(ed,a5) { illegal_2(); } /* DB ED */ -OP(ed,a6) { illegal_2(); } /* DB ED */ -OP(ed,a7) { illegal_2(); } /* DB ED */ +OP(ed,a0) { LDI; } /* LDI */ +OP(ed,a1) { CPI; } /* CPI */ +OP(ed,a2) { INI; } /* INI */ +OP(ed,a3) { OUTI; } /* OUTI */ +OP(ed,a4) { illegal_2(); } /* DB ED */ +OP(ed,a5) { illegal_2(); } /* DB ED */ +OP(ed,a6) { illegal_2(); } /* DB ED */ +OP(ed,a7) { illegal_2(); } /* DB ED */ -OP(ed,a8) { LDD; } /* LDD */ -OP(ed,a9) { CPD; } /* CPD */ -OP(ed,aa) { IND; } /* IND */ -OP(ed,ab) { OUTD; } /* OUTD */ -OP(ed,ac) { illegal_2(); } /* DB ED */ -OP(ed,ad) { illegal_2(); } /* DB ED */ -OP(ed,ae) { illegal_2(); } /* DB ED */ -OP(ed,af) { illegal_2(); } /* DB ED */ +OP(ed,a8) { LDD; } /* LDD */ +OP(ed,a9) { CPD; } /* CPD */ +OP(ed,aa) { IND; } /* IND */ +OP(ed,ab) { OUTD; } /* OUTD */ +OP(ed,ac) { illegal_2(); } /* DB ED */ +OP(ed,ad) { illegal_2(); } /* DB ED */ +OP(ed,ae) { illegal_2(); } /* DB ED */ +OP(ed,af) { illegal_2(); } /* DB ED */ -OP(ed,b0) { LDIR; } /* LDIR */ -OP(ed,b1) { CPIR; } /* CPIR */ -OP(ed,b2) { INIR; } /* INIR */ -OP(ed,b3) { OTIR; } /* OTIR */ -OP(ed,b4) { illegal_2(); } /* DB ED */ -OP(ed,b5) { illegal_2(); } /* DB ED */ -OP(ed,b6) { illegal_2(); } /* DB ED */ -OP(ed,b7) { illegal_2(); } /* DB ED */ +OP(ed,b0) { LDIR; } /* LDIR */ +OP(ed,b1) { CPIR; } /* CPIR */ +OP(ed,b2) { INIR; } /* INIR */ +OP(ed,b3) { OTIR; } /* OTIR */ +OP(ed,b4) { illegal_2(); } /* DB ED */ +OP(ed,b5) { illegal_2(); } /* DB ED */ +OP(ed,b6) { illegal_2(); } /* DB ED */ +OP(ed,b7) { illegal_2(); } /* DB ED */ -OP(ed,b8) { LDDR; } /* LDDR */ -OP(ed,b9) { CPDR; } /* CPDR */ -OP(ed,ba) { INDR; } /* INDR */ -OP(ed,bb) { OTDR; } /* OTDR */ -OP(ed,bc) { illegal_2(); } /* DB ED */ -OP(ed,bd) { illegal_2(); } /* DB ED */ -OP(ed,be) { illegal_2(); } /* DB ED */ -OP(ed,bf) { illegal_2(); } /* DB ED */ +OP(ed,b8) { LDDR; } /* LDDR */ +OP(ed,b9) { CPDR; } /* CPDR */ +OP(ed,ba) { INDR; } /* INDR */ +OP(ed,bb) { OTDR; } /* OTDR */ +OP(ed,bc) { illegal_2(); } /* DB ED */ +OP(ed,bd) { illegal_2(); } /* DB ED */ +OP(ed,be) { illegal_2(); } /* DB ED */ +OP(ed,bf) { illegal_2(); } /* DB ED */ -OP(ed,c0) { illegal_2(); } /* DB ED */ -OP(ed,c1) { illegal_2(); } /* DB ED */ -OP(ed,c2) { illegal_2(); } /* DB ED */ -OP(ed,c3) { illegal_2(); } /* DB ED */ -OP(ed,c4) { illegal_2(); } /* DB ED */ -OP(ed,c5) { illegal_2(); } /* DB ED */ -OP(ed,c6) { illegal_2(); } /* DB ED */ -OP(ed,c7) { illegal_2(); } /* DB ED */ +OP(ed,c0) { illegal_2(); } /* DB ED */ +OP(ed,c1) { illegal_2(); } /* DB ED */ +OP(ed,c2) { illegal_2(); } /* DB ED */ +OP(ed,c3) { illegal_2(); } /* DB ED */ +OP(ed,c4) { illegal_2(); } /* DB ED */ +OP(ed,c5) { illegal_2(); } /* DB ED */ +OP(ed,c6) { illegal_2(); } /* DB ED */ +OP(ed,c7) { illegal_2(); } /* DB ED */ -OP(ed,c8) { illegal_2(); } /* DB ED */ -OP(ed,c9) { illegal_2(); } /* DB ED */ -OP(ed,ca) { illegal_2(); } /* DB ED */ -OP(ed,cb) { illegal_2(); } /* DB ED */ -OP(ed,cc) { illegal_2(); } /* DB ED */ -OP(ed,cd) { illegal_2(); } /* DB ED */ -OP(ed,ce) { illegal_2(); } /* DB ED */ -OP(ed,cf) { illegal_2(); } /* DB ED */ +OP(ed,c8) { illegal_2(); } /* DB ED */ +OP(ed,c9) { illegal_2(); } /* DB ED */ +OP(ed,ca) { illegal_2(); } /* DB ED */ +OP(ed,cb) { illegal_2(); } /* DB ED */ +OP(ed,cc) { illegal_2(); } /* DB ED */ +OP(ed,cd) { illegal_2(); } /* DB ED */ +OP(ed,ce) { illegal_2(); } /* DB ED */ +OP(ed,cf) { illegal_2(); } /* DB ED */ -OP(ed,d0) { illegal_2(); } /* DB ED */ -OP(ed,d1) { illegal_2(); } /* DB ED */ -OP(ed,d2) { illegal_2(); } /* DB ED */ -OP(ed,d3) { illegal_2(); } /* DB ED */ -OP(ed,d4) { illegal_2(); } /* DB ED */ -OP(ed,d5) { illegal_2(); } /* DB ED */ -OP(ed,d6) { illegal_2(); } /* DB ED */ -OP(ed,d7) { illegal_2(); } /* DB ED */ +OP(ed,d0) { illegal_2(); } /* DB ED */ +OP(ed,d1) { illegal_2(); } /* DB ED */ +OP(ed,d2) { illegal_2(); } /* DB ED */ +OP(ed,d3) { illegal_2(); } /* DB ED */ +OP(ed,d4) { illegal_2(); } /* DB ED */ +OP(ed,d5) { illegal_2(); } /* DB ED */ +OP(ed,d6) { illegal_2(); } /* DB ED */ +OP(ed,d7) { illegal_2(); } /* DB ED */ -OP(ed,d8) { illegal_2(); } /* DB ED */ -OP(ed,d9) { illegal_2(); } /* DB ED */ -OP(ed,da) { illegal_2(); } /* DB ED */ -OP(ed,db) { illegal_2(); } /* DB ED */ -OP(ed,dc) { illegal_2(); } /* DB ED */ -OP(ed,dd) { illegal_2(); } /* DB ED */ -OP(ed,de) { illegal_2(); } /* DB ED */ -OP(ed,df) { illegal_2(); } /* DB ED */ +OP(ed,d8) { illegal_2(); } /* DB ED */ +OP(ed,d9) { illegal_2(); } /* DB ED */ +OP(ed,da) { illegal_2(); } /* DB ED */ +OP(ed,db) { illegal_2(); } /* DB ED */ +OP(ed,dc) { illegal_2(); } /* DB ED */ +OP(ed,dd) { illegal_2(); } /* DB ED */ +OP(ed,de) { illegal_2(); } /* DB ED */ +OP(ed,df) { illegal_2(); } /* DB ED */ -OP(ed,e0) { illegal_2(); } /* DB ED */ -OP(ed,e1) { illegal_2(); } /* DB ED */ -OP(ed,e2) { illegal_2(); } /* DB ED */ -OP(ed,e3) { illegal_2(); } /* DB ED */ -OP(ed,e4) { illegal_2(); } /* DB ED */ -OP(ed,e5) { illegal_2(); } /* DB ED */ -OP(ed,e6) { illegal_2(); } /* DB ED */ -OP(ed,e7) { illegal_2(); } /* DB ED */ +OP(ed,e0) { illegal_2(); } /* DB ED */ +OP(ed,e1) { illegal_2(); } /* DB ED */ +OP(ed,e2) { illegal_2(); } /* DB ED */ +OP(ed,e3) { illegal_2(); } /* DB ED */ +OP(ed,e4) { illegal_2(); } /* DB ED */ +OP(ed,e5) { illegal_2(); } /* DB ED */ +OP(ed,e6) { illegal_2(); } /* DB ED */ +OP(ed,e7) { illegal_2(); } /* DB ED */ -OP(ed,e8) { illegal_2(); } /* DB ED */ -OP(ed,e9) { illegal_2(); } /* DB ED */ -OP(ed,ea) { illegal_2(); } /* DB ED */ -OP(ed,eb) { illegal_2(); } /* DB ED */ -OP(ed,ec) { illegal_2(); } /* DB ED */ -OP(ed,ed) { illegal_2(); } /* DB ED */ -OP(ed,ee) { illegal_2(); } /* DB ED */ -OP(ed,ef) { illegal_2(); } /* DB ED */ +OP(ed,e8) { illegal_2(); } /* DB ED */ +OP(ed,e9) { illegal_2(); } /* DB ED */ +OP(ed,ea) { illegal_2(); } /* DB ED */ +OP(ed,eb) { illegal_2(); } /* DB ED */ +OP(ed,ec) { illegal_2(); } /* DB ED */ +OP(ed,ed) { illegal_2(); } /* DB ED */ +OP(ed,ee) { illegal_2(); } /* DB ED */ +OP(ed,ef) { illegal_2(); } /* DB ED */ -OP(ed,f0) { illegal_2(); } /* DB ED */ -OP(ed,f1) { illegal_2(); } /* DB ED */ -OP(ed,f2) { illegal_2(); } /* DB ED */ -OP(ed,f3) { illegal_2(); } /* DB ED */ -OP(ed,f4) { illegal_2(); } /* DB ED */ -OP(ed,f5) { illegal_2(); } /* DB ED */ -OP(ed,f6) { illegal_2(); } /* DB ED */ -OP(ed,f7) { illegal_2(); } /* DB ED */ +OP(ed,f0) { illegal_2(); } /* DB ED */ +OP(ed,f1) { illegal_2(); } /* DB ED */ +OP(ed,f2) { illegal_2(); } /* DB ED */ +OP(ed,f3) { illegal_2(); } /* DB ED */ +OP(ed,f4) { illegal_2(); } /* DB ED */ +OP(ed,f5) { illegal_2(); } /* DB ED */ +OP(ed,f6) { illegal_2(); } /* DB ED */ +OP(ed,f7) { illegal_2(); } /* DB ED */ -OP(ed,f8) { illegal_2(); } /* DB ED */ -OP(ed,f9) { illegal_2(); } /* DB ED */ -OP(ed,fa) { illegal_2(); } /* DB ED */ -OP(ed,fb) { illegal_2(); } /* DB ED */ -OP(ed,fc) { illegal_2(); } /* DB ED */ -OP(ed,fd) { illegal_2(); } /* DB ED */ -OP(ed,fe) { illegal_2(); } /* DB ED */ -OP(ed,ff) { illegal_2(); } /* DB ED */ +OP(ed,f8) { illegal_2(); } /* DB ED */ +OP(ed,f9) { illegal_2(); } /* DB ED */ +OP(ed,fa) { illegal_2(); } /* DB ED */ +OP(ed,fb) { illegal_2(); } /* DB ED */ +OP(ed,fc) { illegal_2(); } /* DB ED */ +OP(ed,fd) { illegal_2(); } /* DB ED */ +OP(ed,fe) { illegal_2(); } /* DB ED */ +OP(ed,ff) { illegal_2(); } /* DB ED */ /********************************************************** * main opcodes **********************************************************/ -OP(op,00) { } /* NOP */ -OP(op,01) { BC = ARG16(); } /* LD BC,w */ -OP(op,02) { WM( BC, A ); } /* LD (BC),A */ -OP(op,03) { BC++; } /* INC BC */ -OP(op,04) { B = INC(B); } /* INC B */ -OP(op,05) { B = DEC(B); } /* DEC B */ -OP(op,06) { B = ARG(); } /* LD B,n */ -OP(op,07) { RLCA; } /* RLCA */ +OP(op,00) { } /* NOP */ +OP(op,01) { BC = ARG16(); } /* LD BC,w */ +OP(op,02) { WM( BC, A ); } /* LD (BC),A */ +OP(op,03) { BC++; } /* INC BC */ +OP(op,04) { B = INC(B); } /* INC B */ +OP(op,05) { B = DEC(B); } /* DEC B */ +OP(op,06) { B = ARG(); } /* LD B,n */ +OP(op,07) { RLCA; } /* RLCA */ -OP(op,08) { EX_AF; } /* EX AF,AF' */ -OP(op,09) { ADD16(hl, bc); } /* ADD HL,BC */ -OP(op,0a) { A = RM( BC ); } /* LD A,(BC) */ -OP(op,0b) { BC--; } /* DEC BC */ -OP(op,0c) { C = INC(C); } /* INC C */ -OP(op,0d) { C = DEC(C); } /* DEC C */ -OP(op,0e) { C = ARG(); } /* LD C,n */ -OP(op,0f) { RRCA; } /* RRCA */ +OP(op,08) { EX_AF; } /* EX AF,AF' */ +OP(op,09) { ADD16(hl, bc); } /* ADD HL,BC */ +OP(op,0a) { A = RM( BC ); } /* LD A,(BC) */ +OP(op,0b) { BC--; } /* DEC BC */ +OP(op,0c) { C = INC(C); } /* INC C */ +OP(op,0d) { C = DEC(C); } /* DEC C */ +OP(op,0e) { C = ARG(); } /* LD C,n */ +OP(op,0f) { RRCA; } /* RRCA */ -OP(op,10) { B--; JR_COND( B, 0x10 ); } /* DJNZ o */ -OP(op,11) { DE = ARG16(); } /* LD DE,w */ -OP(op,12) { WM( DE, A ); } /* LD (DE),A */ -OP(op,13) { DE++; } /* INC DE */ -OP(op,14) { D = INC(D); } /* INC D */ -OP(op,15) { D = DEC(D); } /* DEC D */ -OP(op,16) { D = ARG(); } /* LD D,n */ -OP(op,17) { RLA; } /* RLA */ +OP(op,10) { B--; JR_COND( B, 0x10 ); } /* DJNZ o */ +OP(op,11) { DE = ARG16(); } /* LD DE,w */ +OP(op,12) { WM( DE, A ); } /* LD (DE),A */ +OP(op,13) { DE++; } /* INC DE */ +OP(op,14) { D = INC(D); } /* INC D */ +OP(op,15) { D = DEC(D); } /* DEC D */ +OP(op,16) { D = ARG(); } /* LD D,n */ +OP(op,17) { RLA; } /* RLA */ -OP(op,18) { JR(); } /* JR o */ -OP(op,19) { ADD16(hl, de); } /* ADD HL,DE */ -OP(op,1a) { A = RM( DE ); } /* LD A,(DE) */ -OP(op,1b) { DE--; } /* DEC DE */ -OP(op,1c) { E = INC(E); } /* INC E */ -OP(op,1d) { E = DEC(E); } /* DEC E */ -OP(op,1e) { E = ARG(); } /* LD E,n */ -OP(op,1f) { RRA; } /* RRA */ +OP(op,18) { JR(); } /* JR o */ +OP(op,19) { ADD16(hl, de); } /* ADD HL,DE */ +OP(op,1a) { A = RM( DE ); } /* LD A,(DE) */ +OP(op,1b) { DE--; } /* DEC DE */ +OP(op,1c) { E = INC(E); } /* INC E */ +OP(op,1d) { E = DEC(E); } /* DEC E */ +OP(op,1e) { E = ARG(); } /* LD E,n */ +OP(op,1f) { RRA; } /* RRA */ -OP(op,20) { JR_COND( !(F & ZF), 0x20 ); } /* JR NZ,o */ -OP(op,21) { HL = ARG16(); } /* LD HL,w */ -OP(op,22) { EA = ARG16(); WM16( EA, &Z80.hl ); } /* LD (w),HL */ -OP(op,23) { HL++; } /* INC HL */ -OP(op,24) { H = INC(H); } /* INC H */ -OP(op,25) { H = DEC(H); } /* DEC H */ -OP(op,26) { H = ARG(); } /* LD H,n */ -OP(op,27) { DAA; } /* DAA */ +OP(op,20) { JR_COND( !(F & ZF), 0x20 ); } /* JR NZ,o */ +OP(op,21) { HL = ARG16(); } /* LD HL,w */ +OP(op,22) { EA = ARG16(); WM16( EA, &Z80.hl ); } /* LD (w),HL */ +OP(op,23) { HL++; } /* INC HL */ +OP(op,24) { H = INC(H); } /* INC H */ +OP(op,25) { H = DEC(H); } /* DEC H */ +OP(op,26) { H = ARG(); } /* LD H,n */ +OP(op,27) { DAA; } /* DAA */ -OP(op,28) { JR_COND( F & ZF, 0x28 ); } /* JR Z,o */ -OP(op,29) { ADD16(hl, hl); } /* ADD HL,HL */ -OP(op,2a) { EA = ARG16(); RM16( EA, &Z80.hl ); } /* LD HL,(w) */ -OP(op,2b) { HL--; } /* DEC HL */ -OP(op,2c) { L = INC(L); } /* INC L */ -OP(op,2d) { L = DEC(L); } /* DEC L */ -OP(op,2e) { L = ARG(); } /* LD L,n */ -OP(op,2f) { A ^= 0xff; F = (F&(SF|ZF|PF|CF))|HF|NF|(A&(YF|XF)); } /* CPL */ +OP(op,28) { JR_COND( F & ZF, 0x28 ); } /* JR Z,o */ +OP(op,29) { ADD16(hl, hl); } /* ADD HL,HL */ +OP(op,2a) { EA = ARG16(); RM16( EA, &Z80.hl ); } /* LD HL,(w) */ +OP(op,2b) { HL--; } /* DEC HL */ +OP(op,2c) { L = INC(L); } /* INC L */ +OP(op,2d) { L = DEC(L); } /* DEC L */ +OP(op,2e) { L = ARG(); } /* LD L,n */ +OP(op,2f) { A ^= 0xff; F = (F&(SF|ZF|PF|CF))|HF|NF|(A&(YF|XF)); } /* CPL */ -OP(op,30) { JR_COND( !(F & CF), 0x30 ); } /* JR NC,o */ -OP(op,31) { SP = ARG16(); } /* LD SP,w */ -OP(op,32) { EA = ARG16(); WM( EA, A ); } /* LD (w),A */ -OP(op,33) { SP++; } /* INC SP */ -OP(op,34) { WM( HL, INC(RM(HL)) ); } /* INC (HL) */ -OP(op,35) { WM( HL, DEC(RM(HL)) ); } /* DEC (HL) */ -OP(op,36) { WM( HL, ARG() ); } /* LD (HL),n */ -OP(op,37) { F = (F & (SF|ZF|PF)) | CF | (A & (YF|XF)); } /* SCF */ +OP(op,30) { JR_COND( !(F & CF), 0x30 ); } /* JR NC,o */ +OP(op,31) { SP = ARG16(); } /* LD SP,w */ +OP(op,32) { EA = ARG16(); WM( EA, A ); } /* LD (w),A */ +OP(op,33) { SP++; } /* INC SP */ +OP(op,34) { WM( HL, INC(RM(HL)) ); } /* INC (HL) */ +OP(op,35) { WM( HL, DEC(RM(HL)) ); } /* DEC (HL) */ +OP(op,36) { WM( HL, ARG() ); } /* LD (HL),n */ +OP(op,37) { F = (F & (SF|ZF|PF)) | CF | (A & (YF|XF)); } /* SCF */ -OP(op,38) { JR_COND( F & CF, 0x38 ); } /* JR C,o */ -OP(op,39) { ADD16(hl, sp); } /* ADD HL,SP */ -OP(op,3a) { EA = ARG16(); A = RM( EA ); } /* LD A,(w) */ -OP(op,3b) { SP--; } /* DEC SP */ -OP(op,3c) { A = INC(A); } /* INC A */ -OP(op,3d) { A = DEC(A); } /* DEC A */ -OP(op,3e) { A = ARG(); } /* LD A,n */ -OP(op,3f) { F = ((F&(SF|ZF|PF|CF))|((F&CF)<<4)|(A&(YF|XF)))^CF; } /* CCF */ +OP(op,38) { JR_COND( F & CF, 0x38 ); } /* JR C,o */ +OP(op,39) { ADD16(hl, sp); } /* ADD HL,SP */ +OP(op,3a) { EA = ARG16(); A = RM( EA ); } /* LD A,(w) */ +OP(op,3b) { SP--; } /* DEC SP */ +OP(op,3c) { A = INC(A); } /* INC A */ +OP(op,3d) { A = DEC(A); } /* DEC A */ +OP(op,3e) { A = ARG(); } /* LD A,n */ +OP(op,3f) { F = ((F&(SF|ZF|PF|CF))|((F&CF)<<4)|(A&(YF|XF)))^CF; } /* CCF */ -OP(op,40) { } /* LD B,B */ -OP(op,41) { B = C; } /* LD B,C */ -OP(op,42) { B = D; } /* LD B,D */ -OP(op,43) { B = E; } /* LD B,E */ -OP(op,44) { B = H; } /* LD B,H */ -OP(op,45) { B = L; } /* LD B,L */ -OP(op,46) { B = RM(HL); } /* LD B,(HL) */ -OP(op,47) { B = A; } /* LD B,A */ +OP(op,40) { } /* LD B,B */ +OP(op,41) { B = C; } /* LD B,C */ +OP(op,42) { B = D; } /* LD B,D */ +OP(op,43) { B = E; } /* LD B,E */ +OP(op,44) { B = H; } /* LD B,H */ +OP(op,45) { B = L; } /* LD B,L */ +OP(op,46) { B = RM(HL); } /* LD B,(HL) */ +OP(op,47) { B = A; } /* LD B,A */ -OP(op,48) { C = B; } /* LD C,B */ -OP(op,49) { } /* LD C,C */ -OP(op,4a) { C = D; } /* LD C,D */ -OP(op,4b) { C = E; } /* LD C,E */ -OP(op,4c) { C = H; } /* LD C,H */ -OP(op,4d) { C = L; } /* LD C,L */ -OP(op,4e) { C = RM(HL); } /* LD C,(HL) */ -OP(op,4f) { C = A; } /* LD C,A */ +OP(op,48) { C = B; } /* LD C,B */ +OP(op,49) { } /* LD C,C */ +OP(op,4a) { C = D; } /* LD C,D */ +OP(op,4b) { C = E; } /* LD C,E */ +OP(op,4c) { C = H; } /* LD C,H */ +OP(op,4d) { C = L; } /* LD C,L */ +OP(op,4e) { C = RM(HL); } /* LD C,(HL) */ +OP(op,4f) { C = A; } /* LD C,A */ -OP(op,50) { D = B; } /* LD D,B */ -OP(op,51) { D = C; } /* LD D,C */ -OP(op,52) { } /* LD D,D */ -OP(op,53) { D = E; } /* LD D,E */ -OP(op,54) { D = H; } /* LD D,H */ -OP(op,55) { D = L; } /* LD D,L */ -OP(op,56) { D = RM(HL); } /* LD D,(HL) */ -OP(op,57) { D = A; } /* LD D,A */ +OP(op,50) { D = B; } /* LD D,B */ +OP(op,51) { D = C; } /* LD D,C */ +OP(op,52) { } /* LD D,D */ +OP(op,53) { D = E; } /* LD D,E */ +OP(op,54) { D = H; } /* LD D,H */ +OP(op,55) { D = L; } /* LD D,L */ +OP(op,56) { D = RM(HL); } /* LD D,(HL) */ +OP(op,57) { D = A; } /* LD D,A */ -OP(op,58) { E = B; } /* LD E,B */ -OP(op,59) { E = C; } /* LD E,C */ -OP(op,5a) { E = D; } /* LD E,D */ -OP(op,5b) { } /* LD E,E */ -OP(op,5c) { E = H; } /* LD E,H */ -OP(op,5d) { E = L; } /* LD E,L */ -OP(op,5e) { E = RM(HL); } /* LD E,(HL) */ -OP(op,5f) { E = A; } /* LD E,A */ +OP(op,58) { E = B; } /* LD E,B */ +OP(op,59) { E = C; } /* LD E,C */ +OP(op,5a) { E = D; } /* LD E,D */ +OP(op,5b) { } /* LD E,E */ +OP(op,5c) { E = H; } /* LD E,H */ +OP(op,5d) { E = L; } /* LD E,L */ +OP(op,5e) { E = RM(HL); } /* LD E,(HL) */ +OP(op,5f) { E = A; } /* LD E,A */ -OP(op,60) { H = B; } /* LD H,B */ -OP(op,61) { H = C; } /* LD H,C */ -OP(op,62) { H = D; } /* LD H,D */ -OP(op,63) { H = E; } /* LD H,E */ -OP(op,64) { } /* LD H,H */ -OP(op,65) { H = L; } /* LD H,L */ -OP(op,66) { H = RM(HL); } /* LD H,(HL) */ -OP(op,67) { H = A; } /* LD H,A */ +OP(op,60) { H = B; } /* LD H,B */ +OP(op,61) { H = C; } /* LD H,C */ +OP(op,62) { H = D; } /* LD H,D */ +OP(op,63) { H = E; } /* LD H,E */ +OP(op,64) { } /* LD H,H */ +OP(op,65) { H = L; } /* LD H,L */ +OP(op,66) { H = RM(HL); } /* LD H,(HL) */ +OP(op,67) { H = A; } /* LD H,A */ -OP(op,68) { L = B; } /* LD L,B */ -OP(op,69) { L = C; } /* LD L,C */ -OP(op,6a) { L = D; } /* LD L,D */ -OP(op,6b) { L = E; } /* LD L,E */ -OP(op,6c) { L = H; } /* LD L,H */ -OP(op,6d) { } /* LD L,L */ -OP(op,6e) { L = RM(HL); } /* LD L,(HL) */ -OP(op,6f) { L = A; } /* LD L,A */ +OP(op,68) { L = B; } /* LD L,B */ +OP(op,69) { L = C; } /* LD L,C */ +OP(op,6a) { L = D; } /* LD L,D */ +OP(op,6b) { L = E; } /* LD L,E */ +OP(op,6c) { L = H; } /* LD L,H */ +OP(op,6d) { } /* LD L,L */ +OP(op,6e) { L = RM(HL); } /* LD L,(HL) */ +OP(op,6f) { L = A; } /* LD L,A */ -OP(op,70) { WM( HL, B ); } /* LD (HL),B */ -OP(op,71) { WM( HL, C ); } /* LD (HL),C */ -OP(op,72) { WM( HL, D ); } /* LD (HL),D */ -OP(op,73) { WM( HL, E ); } /* LD (HL),E */ -OP(op,74) { WM( HL, H ); } /* LD (HL),H */ -OP(op,75) { WM( HL, L ); } /* LD (HL),L */ -OP(op,76) { ENTER_HALT; } /* HALT */ -OP(op,77) { WM( HL, A ); } /* LD (HL),A */ +OP(op,70) { WM( HL, B ); } /* LD (HL),B */ +OP(op,71) { WM( HL, C ); } /* LD (HL),C */ +OP(op,72) { WM( HL, D ); } /* LD (HL),D */ +OP(op,73) { WM( HL, E ); } /* LD (HL),E */ +OP(op,74) { WM( HL, H ); } /* LD (HL),H */ +OP(op,75) { WM( HL, L ); } /* LD (HL),L */ +OP(op,76) { ENTER_HALT; } /* HALT */ +OP(op,77) { WM( HL, A ); } /* LD (HL),A */ -OP(op,78) { A = B; } /* LD A,B */ -OP(op,79) { A = C; } /* LD A,C */ -OP(op,7a) { A = D; } /* LD A,D */ -OP(op,7b) { A = E; } /* LD A,E */ -OP(op,7c) { A = H; } /* LD A,H */ -OP(op,7d) { A = L; } /* LD A,L */ -OP(op,7e) { A = RM(HL); } /* LD A,(HL) */ -OP(op,7f) { } /* LD A,A */ +OP(op,78) { A = B; } /* LD A,B */ +OP(op,79) { A = C; } /* LD A,C */ +OP(op,7a) { A = D; } /* LD A,D */ +OP(op,7b) { A = E; } /* LD A,E */ +OP(op,7c) { A = H; } /* LD A,H */ +OP(op,7d) { A = L; } /* LD A,L */ +OP(op,7e) { A = RM(HL); } /* LD A,(HL) */ +OP(op,7f) { } /* LD A,A */ -OP(op,80) { ADD(B); } /* ADD A,B */ -OP(op,81) { ADD(C); } /* ADD A,C */ -OP(op,82) { ADD(D); } /* ADD A,D */ -OP(op,83) { ADD(E); } /* ADD A,E */ -OP(op,84) { ADD(H); } /* ADD A,H */ -OP(op,85) { ADD(L); } /* ADD A,L */ -OP(op,86) { ADD(RM(HL)); } /* ADD A,(HL) */ -OP(op,87) { ADD(A); } /* ADD A,A */ +OP(op,80) { ADD(B); } /* ADD A,B */ +OP(op,81) { ADD(C); } /* ADD A,C */ +OP(op,82) { ADD(D); } /* ADD A,D */ +OP(op,83) { ADD(E); } /* ADD A,E */ +OP(op,84) { ADD(H); } /* ADD A,H */ +OP(op,85) { ADD(L); } /* ADD A,L */ +OP(op,86) { ADD(RM(HL)); } /* ADD A,(HL) */ +OP(op,87) { ADD(A); } /* ADD A,A */ -OP(op,88) { ADC(B); } /* ADC A,B */ -OP(op,89) { ADC(C); } /* ADC A,C */ -OP(op,8a) { ADC(D); } /* ADC A,D */ -OP(op,8b) { ADC(E); } /* ADC A,E */ -OP(op,8c) { ADC(H); } /* ADC A,H */ -OP(op,8d) { ADC(L); } /* ADC A,L */ -OP(op,8e) { ADC(RM(HL)); } /* ADC A,(HL) */ -OP(op,8f) { ADC(A); } /* ADC A,A */ +OP(op,88) { ADC(B); } /* ADC A,B */ +OP(op,89) { ADC(C); } /* ADC A,C */ +OP(op,8a) { ADC(D); } /* ADC A,D */ +OP(op,8b) { ADC(E); } /* ADC A,E */ +OP(op,8c) { ADC(H); } /* ADC A,H */ +OP(op,8d) { ADC(L); } /* ADC A,L */ +OP(op,8e) { ADC(RM(HL)); } /* ADC A,(HL) */ +OP(op,8f) { ADC(A); } /* ADC A,A */ -OP(op,90) { SUB(B); } /* SUB B */ -OP(op,91) { SUB(C); } /* SUB C */ -OP(op,92) { SUB(D); } /* SUB D */ -OP(op,93) { SUB(E); } /* SUB E */ -OP(op,94) { SUB(H); } /* SUB H */ -OP(op,95) { SUB(L); } /* SUB L */ -OP(op,96) { SUB(RM(HL)); } /* SUB (HL) */ -OP(op,97) { SUB(A); } /* SUB A */ +OP(op,90) { SUB(B); } /* SUB B */ +OP(op,91) { SUB(C); } /* SUB C */ +OP(op,92) { SUB(D); } /* SUB D */ +OP(op,93) { SUB(E); } /* SUB E */ +OP(op,94) { SUB(H); } /* SUB H */ +OP(op,95) { SUB(L); } /* SUB L */ +OP(op,96) { SUB(RM(HL)); } /* SUB (HL) */ +OP(op,97) { SUB(A); } /* SUB A */ -OP(op,98) { SBC(B); } /* SBC A,B */ -OP(op,99) { SBC(C); } /* SBC A,C */ -OP(op,9a) { SBC(D); } /* SBC A,D */ -OP(op,9b) { SBC(E); } /* SBC A,E */ -OP(op,9c) { SBC(H); } /* SBC A,H */ -OP(op,9d) { SBC(L); } /* SBC A,L */ -OP(op,9e) { SBC(RM(HL)); } /* SBC A,(HL) */ -OP(op,9f) { SBC(A); } /* SBC A,A */ +OP(op,98) { SBC(B); } /* SBC A,B */ +OP(op,99) { SBC(C); } /* SBC A,C */ +OP(op,9a) { SBC(D); } /* SBC A,D */ +OP(op,9b) { SBC(E); } /* SBC A,E */ +OP(op,9c) { SBC(H); } /* SBC A,H */ +OP(op,9d) { SBC(L); } /* SBC A,L */ +OP(op,9e) { SBC(RM(HL)); } /* SBC A,(HL) */ +OP(op,9f) { SBC(A); } /* SBC A,A */ -OP(op,a0) { AND(B); } /* AND B */ -OP(op,a1) { AND(C); } /* AND C */ -OP(op,a2) { AND(D); } /* AND D */ -OP(op,a3) { AND(E); } /* AND E */ -OP(op,a4) { AND(H); } /* AND H */ -OP(op,a5) { AND(L); } /* AND L */ -OP(op,a6) { AND(RM(HL)); } /* AND (HL) */ -OP(op,a7) { AND(A); } /* AND A */ +OP(op,a0) { AND(B); } /* AND B */ +OP(op,a1) { AND(C); } /* AND C */ +OP(op,a2) { AND(D); } /* AND D */ +OP(op,a3) { AND(E); } /* AND E */ +OP(op,a4) { AND(H); } /* AND H */ +OP(op,a5) { AND(L); } /* AND L */ +OP(op,a6) { AND(RM(HL)); } /* AND (HL) */ +OP(op,a7) { AND(A); } /* AND A */ -OP(op,a8) { XOR(B); } /* XOR B */ -OP(op,a9) { XOR(C); } /* XOR C */ -OP(op,aa) { XOR(D); } /* XOR D */ -OP(op,ab) { XOR(E); } /* XOR E */ -OP(op,ac) { XOR(H); } /* XOR H */ -OP(op,ad) { XOR(L); } /* XOR L */ -OP(op,ae) { XOR(RM(HL)); } /* XOR (HL) */ -OP(op,af) { XOR(A); } /* XOR A */ +OP(op,a8) { XOR(B); } /* XOR B */ +OP(op,a9) { XOR(C); } /* XOR C */ +OP(op,aa) { XOR(D); } /* XOR D */ +OP(op,ab) { XOR(E); } /* XOR E */ +OP(op,ac) { XOR(H); } /* XOR H */ +OP(op,ad) { XOR(L); } /* XOR L */ +OP(op,ae) { XOR(RM(HL)); } /* XOR (HL) */ +OP(op,af) { XOR(A); } /* XOR A */ -OP(op,b0) { OR(B); } /* OR B */ -OP(op,b1) { OR(C); } /* OR C */ -OP(op,b2) { OR(D); } /* OR D */ -OP(op,b3) { OR(E); } /* OR E */ -OP(op,b4) { OR(H); } /* OR H */ -OP(op,b5) { OR(L); } /* OR L */ -OP(op,b6) { OR(RM(HL)); } /* OR (HL) */ -OP(op,b7) { OR(A); } /* OR A */ +OP(op,b0) { OR(B); } /* OR B */ +OP(op,b1) { OR(C); } /* OR C */ +OP(op,b2) { OR(D); } /* OR D */ +OP(op,b3) { OR(E); } /* OR E */ +OP(op,b4) { OR(H); } /* OR H */ +OP(op,b5) { OR(L); } /* OR L */ +OP(op,b6) { OR(RM(HL)); } /* OR (HL) */ +OP(op,b7) { OR(A); } /* OR A */ -OP(op,b8) { CP(B); } /* CP B */ -OP(op,b9) { CP(C); } /* CP C */ -OP(op,ba) { CP(D); } /* CP D */ -OP(op,bb) { CP(E); } /* CP E */ -OP(op,bc) { CP(H); } /* CP H */ -OP(op,bd) { CP(L); } /* CP L */ -OP(op,be) { CP(RM(HL)); } /* CP (HL) */ -OP(op,bf) { CP(A); } /* CP A */ +OP(op,b8) { CP(B); } /* CP B */ +OP(op,b9) { CP(C); } /* CP C */ +OP(op,ba) { CP(D); } /* CP D */ +OP(op,bb) { CP(E); } /* CP E */ +OP(op,bc) { CP(H); } /* CP H */ +OP(op,bd) { CP(L); } /* CP L */ +OP(op,be) { CP(RM(HL)); } /* CP (HL) */ +OP(op,bf) { CP(A); } /* CP A */ -OP(op,c0) { RET_COND( !(F & ZF), 0xc0 ); } /* RET NZ */ -OP(op,c1) { POP( bc ); } /* POP BC */ -OP(op,c2) { JP_COND( !(F & ZF) ); } /* JP NZ,a */ -OP(op,c3) { JP; } /* JP a */ -OP(op,c4) { CALL_COND( !(F & ZF), 0xc4 ); } /* CALL NZ,a */ -OP(op,c5) { PUSH( bc ); } /* PUSH BC */ -OP(op,c6) { ADD(ARG()); } /* ADD A,n */ -OP(op,c7) { RST(0x00); } /* RST 0 */ +OP(op,c0) { RET_COND( !(F & ZF), 0xc0 ); } /* RET NZ */ +OP(op,c1) { POP( bc ); } /* POP BC */ +OP(op,c2) { JP_COND( !(F & ZF) ); } /* JP NZ,a */ +OP(op,c3) { JP; } /* JP a */ +OP(op,c4) { CALL_COND( !(F & ZF), 0xc4 ); } /* CALL NZ,a */ +OP(op,c5) { PUSH( bc ); } /* PUSH BC */ +OP(op,c6) { ADD(ARG()); } /* ADD A,n */ +OP(op,c7) { RST(0x00); } /* RST 0 */ -OP(op,c8) { RET_COND( F & ZF, 0xc8 ); } /* RET Z */ -OP(op,c9) { POP( pc ); change_pc(PCD); } /* RET */ -OP(op,ca) { JP_COND( F & ZF ); } /* JP Z,a */ -OP(op,cb) { R++; EXEC(cb,ROP()); } /* **** CB xx */ -OP(op,cc) { CALL_COND( F & ZF, 0xcc ); } /* CALL Z,a */ -OP(op,cd) { CALL(); } /* CALL a */ -OP(op,ce) { ADC(ARG()); } /* ADC A,n */ -OP(op,cf) { RST(0x08); } /* RST 1 */ +OP(op,c8) { RET_COND( F & ZF, 0xc8 ); } /* RET Z */ +OP(op,c9) { POP( pc ); change_pc(PCD); } /* RET */ +OP(op,ca) { JP_COND( F & ZF ); } /* JP Z,a */ +OP(op,cb) { R++; EXEC(cb,ROP()); } /* **** CB xx */ +OP(op,cc) { CALL_COND( F & ZF, 0xcc ); } /* CALL Z,a */ +OP(op,cd) { CALL(); } /* CALL a */ +OP(op,ce) { ADC(ARG()); } /* ADC A,n */ +OP(op,cf) { RST(0x08); } /* RST 1 */ -OP(op,d0) { RET_COND( !(F & CF), 0xd0 ); } /* RET NC */ -OP(op,d1) { POP( de ); } /* POP DE */ -OP(op,d2) { JP_COND( !(F & CF) ); } /* JP NC,a */ -OP(op,d3) { unsigned n = ARG() | (A << 8); OUT( n, A ); } /* OUT (n),A */ -OP(op,d4) { CALL_COND( !(F & CF), 0xd4 ); } /* CALL NC,a */ -OP(op,d5) { PUSH( de ); } /* PUSH DE */ -OP(op,d6) { SUB(ARG()); } /* SUB n */ -OP(op,d7) { RST(0x10); } /* RST 2 */ +OP(op,d0) { RET_COND( !(F & CF), 0xd0 ); } /* RET NC */ +OP(op,d1) { POP( de ); } /* POP DE */ +OP(op,d2) { JP_COND( !(F & CF) ); } /* JP NC,a */ +OP(op,d3) { unsigned n = ARG() | (A << 8); OUT( n, A ); } /* OUT (n),A */ +OP(op,d4) { CALL_COND( !(F & CF), 0xd4 ); } /* CALL NC,a */ +OP(op,d5) { PUSH( de ); } /* PUSH DE */ +OP(op,d6) { SUB(ARG()); } /* SUB n */ +OP(op,d7) { RST(0x10); } /* RST 2 */ -OP(op,d8) { RET_COND( F & CF, 0xd8 ); } /* RET C */ -OP(op,d9) { EXX; } /* EXX */ -OP(op,da) { JP_COND( F & CF ); } /* JP C,a */ -OP(op,db) { unsigned n = ARG() | (A << 8); A = IN( n ); } /* IN A,(n) */ -OP(op,dc) { CALL_COND( F & CF, 0xdc ); } /* CALL C,a */ -OP(op,dd) { R++; EXEC(dd,ROP()); } /* **** DD xx */ -OP(op,de) { SBC(ARG()); } /* SBC A,n */ -OP(op,df) { RST(0x18); } /* RST 3 */ +OP(op,d8) { RET_COND( F & CF, 0xd8 ); } /* RET C */ +OP(op,d9) { EXX; } /* EXX */ +OP(op,da) { JP_COND( F & CF ); } /* JP C,a */ +OP(op,db) { unsigned n = ARG() | (A << 8); A = IN( n ); } /* IN A,(n) */ +OP(op,dc) { CALL_COND( F & CF, 0xdc ); } /* CALL C,a */ +OP(op,dd) { R++; EXEC(dd,ROP()); } /* **** DD xx */ +OP(op,de) { SBC(ARG()); } /* SBC A,n */ +OP(op,df) { RST(0x18); } /* RST 3 */ -OP(op,e0) { RET_COND( !(F & PF), 0xe0 ); } /* RET PO */ -OP(op,e1) { POP( hl ); } /* POP HL */ -OP(op,e2) { JP_COND( !(F & PF) ); } /* JP PO,a */ -OP(op,e3) { EXSP( hl ); } /* EX HL,(SP) */ -OP(op,e4) { CALL_COND( !(F & PF), 0xe4 ); } /* CALL PO,a */ -OP(op,e5) { PUSH( hl ); } /* PUSH HL */ -OP(op,e6) { AND(ARG()); } /* AND n */ -OP(op,e7) { RST(0x20); } /* RST 4 */ +OP(op,e0) { RET_COND( !(F & PF), 0xe0 ); } /* RET PO */ +OP(op,e1) { POP( hl ); } /* POP HL */ +OP(op,e2) { JP_COND( !(F & PF) ); } /* JP PO,a */ +OP(op,e3) { EXSP( hl ); } /* EX HL,(SP) */ +OP(op,e4) { CALL_COND( !(F & PF), 0xe4 ); } /* CALL PO,a */ +OP(op,e5) { PUSH( hl ); } /* PUSH HL */ +OP(op,e6) { AND(ARG()); } /* AND n */ +OP(op,e7) { RST(0x20); } /* RST 4 */ -OP(op,e8) { RET_COND( F & PF, 0xe8 ); } /* RET PE */ -OP(op,e9) { PC = HL; change_pc(PCD); } /* JP (HL) */ -OP(op,ea) { JP_COND( F & PF ); } /* JP PE,a */ -OP(op,eb) { EX_DE_HL; } /* EX DE,HL */ -OP(op,ec) { CALL_COND( F & PF, 0xec ); } /* CALL PE,a */ -OP(op,ed) { R++; EXEC(ed,ROP()); } /* **** ED xx */ -OP(op,ee) { XOR(ARG()); } /* XOR n */ -OP(op,ef) { RST(0x28); } /* RST 5 */ +OP(op,e8) { RET_COND( F & PF, 0xe8 ); } /* RET PE */ +OP(op,e9) { PC = HL; change_pc(PCD); } /* JP (HL) */ +OP(op,ea) { JP_COND( F & PF ); } /* JP PE,a */ +OP(op,eb) { EX_DE_HL; } /* EX DE,HL */ +OP(op,ec) { CALL_COND( F & PF, 0xec ); } /* CALL PE,a */ +OP(op,ed) { R++; EXEC(ed,ROP()); } /* **** ED xx */ +OP(op,ee) { XOR(ARG()); } /* XOR n */ +OP(op,ef) { RST(0x28); } /* RST 5 */ -OP(op,f0) { RET_COND( !(F & SF), 0xf0 ); } /* RET P */ -OP(op,f1) { POP( af ); } /* POP AF */ -OP(op,f2) { JP_COND( !(F & SF) ); } /* JP P,a */ -OP(op,f3) { IFF1 = IFF2 = 0; } /* DI */ -OP(op,f4) { CALL_COND( !(F & SF), 0xf4 ); } /* CALL P,a */ -OP(op,f5) { PUSH( af ); } /* PUSH AF */ -OP(op,f6) { OR(ARG()); } /* OR n */ -OP(op,f7) { RST(0x30); } /* RST 6 */ +OP(op,f0) { RET_COND( !(F & SF), 0xf0 ); } /* RET P */ +OP(op,f1) { POP( af ); } /* POP AF */ +OP(op,f2) { JP_COND( !(F & SF) ); } /* JP P,a */ +OP(op,f3) { IFF1 = IFF2 = 0; } /* DI */ +OP(op,f4) { CALL_COND( !(F & SF), 0xf4 ); } /* CALL P,a */ +OP(op,f5) { PUSH( af ); } /* PUSH AF */ +OP(op,f6) { OR(ARG()); } /* OR n */ +OP(op,f7) { RST(0x30); } /* RST 6 */ -OP(op,f8) { RET_COND( F & SF, 0xf8 ); } /* RET M */ -OP(op,f9) { SP = HL; } /* LD SP,HL */ -OP(op,fa) { JP_COND(F & SF); } /* JP M,a */ -OP(op,fb) { EI; } /* EI */ -OP(op,fc) { CALL_COND( F & SF, 0xfc ); } /* CALL M,a */ -OP(op,fd) { R++; EXEC(fd,ROP()); } /* **** FD xx */ -OP(op,fe) { CP(ARG()); } /* CP n */ -OP(op,ff) { RST(0x38); } /* RST 7 */ +OP(op,f8) { RET_COND( F & SF, 0xf8 ); } /* RET M */ +OP(op,f9) { SP = HL; } /* LD SP,HL */ +OP(op,fa) { JP_COND(F & SF); } /* JP M,a */ +OP(op,fb) { EI; } /* EI */ +OP(op,fc) { CALL_COND( F & SF, 0xfc ); } /* CALL M,a */ +OP(op,fd) { R++; EXEC(fd,ROP()); } /* **** FD xx */ +OP(op,fe) { CP(ARG()); } /* CP n */ +OP(op,ff) { RST(0x38); } /* RST 7 */ static void take_interrupt(void) { - int irq_vector; + int irq_vector; - /* there isn't a valid previous program counter */ - PRVPC = -1; + /* there isn't a valid previous program counter */ + PRVPC = -1; - /* Check if processor was halted */ - LEAVE_HALT; + /* Check if processor was halted */ + LEAVE_HALT; - /* Clear both interrupt flip flops */ - IFF1 = IFF2 = 0; + /* Clear both interrupt flip flops */ + IFF1 = IFF2 = 0; - /* call back the cpu interface to retrieve the vector */ - irq_vector = (*Z80.irq_callback)(0); + /* call back the cpu interface to retrieve the vector */ + irq_vector = (*Z80.irq_callback)(0); - LOG(("Z80 #%d single int. irq_vector $%02x\n", cpu_getactivecpu(), irq_vector)); + LOG(("Z80 #%d single int. irq_vector $%02x\n", cpu_getactivecpu(), irq_vector)); - /* Interrupt mode 2. Call [Z80.i:databyte] */ - if( IM == 2 ) - { - irq_vector = (irq_vector & 0xff) | (I << 8); - PUSH( pc ); - RM16( irq_vector, &Z80.pc ); - LOG(("Z80 #%d IM2 [$%04x] = $%04x\n",cpu_getactivecpu() , irq_vector, PCD)); - /* CALL opcode timing */ - z80_ICount -= cc[Z80_TABLE_op][0xcd]; - } - else - /* Interrupt mode 1. RST 38h */ - if( IM == 1 ) - { - LOG(("Z80 #%d IM1 $0038\n",cpu_getactivecpu() )); - PUSH( pc ); - PCD = 0x0038; - /* RST $38 + 'interrupt latency' cycles */ - z80_ICount -= cc[Z80_TABLE_op][0xff] + cc[Z80_TABLE_ex][0xff]; - } - else - { - /* Interrupt mode 0. We check for CALL and JP instructions, */ - /* if neither of these were found we assume a 1 byte opcode */ - /* was placed on the databus */ - LOG(("Z80 #%d IM0 $%04x\n",cpu_getactivecpu() , irq_vector)); - switch (irq_vector & 0xff0000) - { - case 0xcd0000: /* call */ - PUSH( pc ); - PCD = irq_vector & 0xffff; - /* CALL $xxxx + 'interrupt latency' cycles */ - z80_ICount -= cc[Z80_TABLE_op][0xcd] + cc[Z80_TABLE_ex][0xff]; - break; - case 0xc30000: /* jump */ - PCD = irq_vector & 0xffff; - /* JP $xxxx + 2 cycles */ - z80_ICount -= cc[Z80_TABLE_op][0xc3] + cc[Z80_TABLE_ex][0xff]; - break; - default: /* rst (or other opcodes?) */ - PUSH( pc ); - PCD = irq_vector & 0x0038; - /* RST $xx + 2 cycles */ - z80_ICount -= cc[Z80_TABLE_op][PCD] + cc[Z80_TABLE_ex][PCD]; - break; - } - } - change_pc(PCD); + /* Interrupt mode 2. Call [Z80.i:databyte] */ + if( IM == 2 ) + { + irq_vector = (irq_vector & 0xff) | (I << 8); + PUSH( pc ); + RM16( irq_vector, &Z80.pc ); + LOG(("Z80 #%d IM2 [$%04x] = $%04x\n",cpu_getactivecpu() , irq_vector, PCD)); + /* CALL opcode timing */ + z80_ICount -= cc[Z80_TABLE_op][0xcd]; + } + else + /* Interrupt mode 1. RST 38h */ + if( IM == 1 ) + { + LOG(("Z80 #%d IM1 $0038\n",cpu_getactivecpu() )); + PUSH( pc ); + PCD = 0x0038; + /* RST $38 + 'interrupt latency' cycles */ + z80_ICount -= cc[Z80_TABLE_op][0xff] + cc[Z80_TABLE_ex][0xff]; + } + else + { + /* Interrupt mode 0. We check for CALL and JP instructions, */ + /* if neither of these were found we assume a 1 byte opcode */ + /* was placed on the databus */ + LOG(("Z80 #%d IM0 $%04x\n",cpu_getactivecpu() , irq_vector)); + switch (irq_vector & 0xff0000) + { + case 0xcd0000: /* call */ + PUSH( pc ); + PCD = irq_vector & 0xffff; + /* CALL $xxxx + 'interrupt latency' cycles */ + z80_ICount -= cc[Z80_TABLE_op][0xcd] + cc[Z80_TABLE_ex][0xff]; + break; + case 0xc30000: /* jump */ + PCD = irq_vector & 0xffff; + /* JP $xxxx + 2 cycles */ + z80_ICount -= cc[Z80_TABLE_op][0xc3] + cc[Z80_TABLE_ex][0xff]; + break; + default: /* rst (or other opcodes?) */ + PUSH( pc ); + PCD = irq_vector & 0x0038; + /* RST $xx + 2 cycles */ + z80_ICount -= cc[Z80_TABLE_op][PCD] + cc[Z80_TABLE_ex][PCD]; + break; + } + } + change_pc(PCD); } /**************************************************************************** @@ -3359,102 +3359,102 @@ static void take_interrupt(void) ****************************************************************************/ void z80_init(int index, int clock, const void *config, int (*irqcallback)(int)) { - int i, p; + int i, p; - /* setup cycle tables */ - cc[Z80_TABLE_op] = cc_op; - cc[Z80_TABLE_cb] = cc_cb; - cc[Z80_TABLE_ed] = cc_ed; - cc[Z80_TABLE_xy] = cc_xy; - cc[Z80_TABLE_xycb] = cc_xycb; - cc[Z80_TABLE_ex] = cc_ex; + /* setup cycle tables */ + cc[Z80_TABLE_op] = cc_op; + cc[Z80_TABLE_cb] = cc_cb; + cc[Z80_TABLE_ed] = cc_ed; + cc[Z80_TABLE_xy] = cc_xy; + cc[Z80_TABLE_xycb] = cc_xycb; + cc[Z80_TABLE_ex] = cc_ex; #if BIG_FLAGS_ARRAY - if( !SZHVC_add || !SZHVC_sub ) - { - int oldval, newval, val; - UINT8 *padd, *padc, *psub, *psbc; - /* allocate big flag arrays once */ - SZHVC_add = (UINT8 *)malloc(2*256*256); - SZHVC_sub = (UINT8 *)malloc(2*256*256); - if( !SZHVC_add || !SZHVC_sub ) - { - return; - } - padd = &SZHVC_add[ 0*256]; - padc = &SZHVC_add[256*256]; - psub = &SZHVC_sub[ 0*256]; - psbc = &SZHVC_sub[256*256]; - for (oldval = 0; oldval < 256; oldval++) - { - for (newval = 0; newval < 256; newval++) - { - /* add or adc w/o carry set */ - val = newval - oldval; - *padd = (newval) ? ((newval & 0x80) ? SF : 0) : ZF; - *padd |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */ - if( (newval & 0x0f) < (oldval & 0x0f) ) *padd |= HF; - if( newval < oldval ) *padd |= CF; - if( (val^oldval^0x80) & (val^newval) & 0x80 ) *padd |= VF; - padd++; + if( !SZHVC_add || !SZHVC_sub ) + { + int oldval, newval, val; + UINT8 *padd, *padc, *psub, *psbc; + /* allocate big flag arrays once */ + SZHVC_add = (UINT8 *)malloc(2*256*256); + SZHVC_sub = (UINT8 *)malloc(2*256*256); + if( !SZHVC_add || !SZHVC_sub ) + { + return; + } + padd = &SZHVC_add[ 0*256]; + padc = &SZHVC_add[256*256]; + psub = &SZHVC_sub[ 0*256]; + psbc = &SZHVC_sub[256*256]; + for (oldval = 0; oldval < 256; oldval++) + { + for (newval = 0; newval < 256; newval++) + { + /* add or adc w/o carry set */ + val = newval - oldval; + *padd = (newval) ? ((newval & 0x80) ? SF : 0) : ZF; + *padd |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */ + if( (newval & 0x0f) < (oldval & 0x0f) ) *padd |= HF; + if( newval < oldval ) *padd |= CF; + if( (val^oldval^0x80) & (val^newval) & 0x80 ) *padd |= VF; + padd++; - /* adc with carry set */ - val = newval - oldval - 1; - *padc = (newval) ? ((newval & 0x80) ? SF : 0) : ZF; - *padc |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */ - if( (newval & 0x0f) <= (oldval & 0x0f) ) *padc |= HF; - if( newval <= oldval ) *padc |= CF; - if( (val^oldval^0x80) & (val^newval) & 0x80 ) *padc |= VF; - padc++; + /* adc with carry set */ + val = newval - oldval - 1; + *padc = (newval) ? ((newval & 0x80) ? SF : 0) : ZF; + *padc |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */ + if( (newval & 0x0f) <= (oldval & 0x0f) ) *padc |= HF; + if( newval <= oldval ) *padc |= CF; + if( (val^oldval^0x80) & (val^newval) & 0x80 ) *padc |= VF; + padc++; - /* cp, sub or sbc w/o carry set */ - val = oldval - newval; - *psub = NF | ((newval) ? ((newval & 0x80) ? SF : 0) : ZF); - *psub |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */ - if( (newval & 0x0f) > (oldval & 0x0f) ) *psub |= HF; - if( newval > oldval ) *psub |= CF; - if( (val^oldval) & (oldval^newval) & 0x80 ) *psub |= VF; - psub++; + /* cp, sub or sbc w/o carry set */ + val = oldval - newval; + *psub = NF | ((newval) ? ((newval & 0x80) ? SF : 0) : ZF); + *psub |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */ + if( (newval & 0x0f) > (oldval & 0x0f) ) *psub |= HF; + if( newval > oldval ) *psub |= CF; + if( (val^oldval) & (oldval^newval) & 0x80 ) *psub |= VF; + psub++; - /* sbc with carry set */ - val = oldval - newval - 1; - *psbc = NF | ((newval) ? ((newval & 0x80) ? SF : 0) : ZF); - *psbc |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */ - if( (newval & 0x0f) >= (oldval & 0x0f) ) *psbc |= HF; - if( newval >= oldval ) *psbc |= CF; - if( (val^oldval) & (oldval^newval) & 0x80 ) *psbc |= VF; - psbc++; - } - } - } + /* sbc with carry set */ + val = oldval - newval - 1; + *psbc = NF | ((newval) ? ((newval & 0x80) ? SF : 0) : ZF); + *psbc |= (newval & (YF | XF)); /* undocumented flag bits 5+3 */ + if( (newval & 0x0f) >= (oldval & 0x0f) ) *psbc |= HF; + if( newval >= oldval ) *psbc |= CF; + if( (val^oldval) & (oldval^newval) & 0x80 ) *psbc |= VF; + psbc++; + } + } + } #endif - for (i = 0; i < 256; i++) - { - p = 0; - if( i&0x01 ) ++p; - if( i&0x02 ) ++p; - if( i&0x04 ) ++p; - if( i&0x08 ) ++p; - if( i&0x10 ) ++p; - if( i&0x20 ) ++p; - if( i&0x40 ) ++p; - if( i&0x80 ) ++p; - SZ[i] = i ? i & SF : ZF; - SZ[i] |= (i & (YF | XF)); /* undocumented flag bits 5+3 */ - SZ_BIT[i] = i ? i & SF : ZF | PF; - SZ_BIT[i] |= (i & (YF | XF)); /* undocumented flag bits 5+3 */ - SZP[i] = SZ[i] | ((p & 1) ? 0 : PF); - SZHV_inc[i] = SZ[i]; - if( i == 0x80 ) SZHV_inc[i] |= VF; - if( (i & 0x0f) == 0x00 ) SZHV_inc[i] |= HF; - SZHV_dec[i] = SZ[i] | NF; - if( i == 0x7f ) SZHV_dec[i] |= VF; - if( (i & 0x0f) == 0x0f ) SZHV_dec[i] |= HF; - } + for (i = 0; i < 256; i++) + { + p = 0; + if( i&0x01 ) ++p; + if( i&0x02 ) ++p; + if( i&0x04 ) ++p; + if( i&0x08 ) ++p; + if( i&0x10 ) ++p; + if( i&0x20 ) ++p; + if( i&0x40 ) ++p; + if( i&0x80 ) ++p; + SZ[i] = i ? i & SF : ZF; + SZ[i] |= (i & (YF | XF)); /* undocumented flag bits 5+3 */ + SZ_BIT[i] = i ? i & SF : ZF | PF; + SZ_BIT[i] |= (i & (YF | XF)); /* undocumented flag bits 5+3 */ + SZP[i] = SZ[i] | ((p & 1) ? 0 : PF); + SZHV_inc[i] = SZ[i]; + if( i == 0x80 ) SZHV_inc[i] |= VF; + if( (i & 0x0f) == 0x00 ) SZHV_inc[i] |= HF; + SZHV_dec[i] = SZ[i] | NF; + if( i == 0x7f ) SZHV_dec[i] |= VF; + if( (i & 0x0f) == 0x0f ) SZHV_dec[i] |= HF; + } - /* Reset registers to their initial values */ - Z80.daisy = config; - Z80.irq_callback = irqcallback; + /* Reset registers to their initial values */ + Z80.daisy = config; + Z80.irq_callback = irqcallback; } /**************************************************************************** @@ -3462,35 +3462,35 @@ void z80_init(int index, int clock, const void *config, int (*irqcallback)(int)) ****************************************************************************/ void z80_reset(void) { - /* save previous values */ - void *config = (void *) Z80.daisy; - int (*irqcallback)(int) = Z80.irq_callback; + /* save previous values */ + void *config = (void *) Z80.daisy; + int (*irqcallback)(int) = Z80.irq_callback; - /* Reset registers to their initial values */ - memset(&Z80, 0, sizeof(Z80)); - Z80.daisy = config; - Z80.irq_callback = irqcallback; - IX = IY = 0xffff; /* IX and IY are FFFF after a reset! */ - F = ZF; /* Zero flag is set */ + /* Reset registers to their initial values */ + memset(&Z80, 0, sizeof(Z80)); + Z80.daisy = config; + Z80.irq_callback = irqcallback; + IX = IY = 0xffff; /* IX and IY are FFFF after a reset! */ + F = ZF; /* Zero flag is set */ - PC = 0x0000; - I = 0; - R = 0; - R2 = 0; - Z80.nmi_state = CLEAR_LINE; - Z80.nmi_pending = FALSE; - Z80.irq_state = CLEAR_LINE; - Z80.after_ei = FALSE; - change_pc(PCD); + PC = 0x0000; + I = 0; + R = 0; + R2 = 0; + Z80.nmi_state = CLEAR_LINE; + Z80.nmi_pending = FALSE; + Z80.irq_state = CLEAR_LINE; + Z80.after_ei = FALSE; + change_pc(PCD); } void z80_exit(void) { #if BIG_FLAGS_ARRAY - if (SZHVC_add) free(SZHVC_add); - SZHVC_add = NULL; - if (SZHVC_sub) free(SZHVC_sub); - SZHVC_sub = NULL; + if (SZHVC_add) free(SZHVC_add); + SZHVC_add = NULL; + if (SZHVC_sub) free(SZHVC_sub); + SZHVC_sub = NULL; #endif } @@ -3499,38 +3499,38 @@ void z80_exit(void) ****************************************************************************/ int z80_execute(int cycles) { - z80_ICount = cycles; + z80_ICount = cycles; - /* check for NMIs on the way in; they can only be set externally */ - /* via timers, and can't be dynamically enabled, so it is safe */ - /* to just check here */ - if (Z80.nmi_pending) + /* check for NMIs on the way in; they can only be set externally */ + /* via timers, and can't be dynamically enabled, so it is safe */ + /* to just check here */ + if (Z80.nmi_pending) { - LOG(("Z80 #%d take NMI\n", cpu_getactivecpu())); - PRVPC = -1; /* there isn't a valid previous program counter */ - LEAVE_HALT; /* Check if processor was halted */ + LOG(("Z80 #%d take NMI\n", cpu_getactivecpu())); + PRVPC = -1; /* there isn't a valid previous program counter */ + LEAVE_HALT; /* Check if processor was halted */ - IFF1 = 0; - PUSH( pc ); - PCD = 0x0066; - change_pc(PCD); - z80_ICount -= 11; - Z80.nmi_pending = FALSE; - } + IFF1 = 0; + PUSH( pc ); + PCD = 0x0066; + change_pc(PCD); + z80_ICount -= 11; + Z80.nmi_pending = FALSE; + } - do - { - /* check for IRQs before each instruction */ - if (Z80.irq_state != CLEAR_LINE && IFF1 && !Z80.after_ei) - take_interrupt(); - Z80.after_ei = FALSE; + do + { + /* check for IRQs before each instruction */ + if (Z80.irq_state != CLEAR_LINE && IFF1 && !Z80.after_ei) + take_interrupt(); + Z80.after_ei = FALSE; - PRVPC = PCD; - R++; - EXEC_INLINE(op,ROP()); - } while( z80_ICount > 0 ); + PRVPC = PCD; + R++; + EXEC_INLINE(op,ROP()); + } while( z80_ICount > 0 ); - return cycles - z80_ICount; + return cycles - z80_ICount; } /**************************************************************************** @@ -3538,13 +3538,13 @@ int z80_execute(int cycles) ****************************************************************************/ void z80_burn(int cycles) { - if( cycles > 0 ) - { - /* NOP takes 4 cycles per instruction */ - int n = (cycles + 3) / 4; - R += n; - z80_ICount -= 4 * n; - } + if( cycles > 0 ) + { + /* NOP takes 4 cycles per instruction */ + int n = (cycles + 3) / 4; + R += n; + z80_ICount -= 4 * n; + } } /**************************************************************************** @@ -3552,8 +3552,8 @@ void z80_burn(int cycles) ****************************************************************************/ void z80_get_context (void *dst) { - if( dst ) - *(Z80_Regs*)dst = Z80; + if( dst ) + *(Z80_Regs*)dst = Z80; } /**************************************************************************** @@ -3561,9 +3561,9 @@ void z80_get_context (void *dst) ****************************************************************************/ void z80_set_context (void *src) { - if( src ) - Z80 = *(Z80_Regs*)src; - change_pc(PCD); + if( src ) + Z80 = *(Z80_Regs*)src; + change_pc(PCD); } /**************************************************************************** @@ -3571,19 +3571,19 @@ void z80_set_context (void *src) ****************************************************************************/ void z80_set_irq_line(int irqline, int state) { - if (irqline == INPUT_LINE_NMI) - { - /* mark an NMI pending on the rising edge */ - if (Z80.nmi_state == CLEAR_LINE && state != CLEAR_LINE) - Z80.nmi_pending = TRUE; - Z80.nmi_state = state; - } - else - { - /* update the IRQ state via the daisy chain */ - Z80.irq_state = state; + if (irqline == INPUT_LINE_NMI) + { + /* mark an NMI pending on the rising edge */ + if (Z80.nmi_state == CLEAR_LINE && state != CLEAR_LINE) + Z80.nmi_pending = TRUE; + Z80.nmi_state = state; + } + else + { + /* update the IRQ state via the daisy chain */ + Z80.irq_state = state; - /* the main execute loop will take the interrupt */ - } + /* the main execute loop will take the interrupt */ + } } diff --git a/source/z80/z80.h b/source/z80/z80.h index 58eabaa..2c0943b 100644 --- a/source/z80/z80.h +++ b/source/z80/z80.h @@ -4,21 +4,21 @@ #include "cpuintrf.h" enum { - Z80_PC=1, Z80_SP, Z80_A, Z80_B, - Z80_C, Z80_D, Z80_E, Z80_H, Z80_L, - Z80_AF, Z80_BC, Z80_DE, Z80_HL, - Z80_IX, Z80_IY, Z80_AF2, Z80_BC2, Z80_DE2, Z80_HL2, - Z80_R, Z80_I, Z80_IM, Z80_IFF1, Z80_IFF2, Z80_HALT, - Z80_DC0, Z80_DC1, Z80_DC2, Z80_DC3 + Z80_PC=1, Z80_SP, Z80_A, Z80_B, + Z80_C, Z80_D, Z80_E, Z80_H, Z80_L, + Z80_AF, Z80_BC, Z80_DE, Z80_HL, + Z80_IX, Z80_IY, Z80_AF2, Z80_BC2, Z80_DE2, Z80_HL2, + Z80_R, Z80_I, Z80_IM, Z80_IFF1, Z80_IFF2, Z80_HALT, + Z80_DC0, Z80_DC1, Z80_DC2, Z80_DC3 }; enum { - Z80_TABLE_op, - Z80_TABLE_cb, - Z80_TABLE_ed, - Z80_TABLE_xy, - Z80_TABLE_xycb, - Z80_TABLE_ex /* cycles counts for taken jr/jp/call and interrupt latency (rst opcodes) */ + Z80_TABLE_op, + Z80_TABLE_cb, + Z80_TABLE_ed, + Z80_TABLE_xy, + Z80_TABLE_xycb, + Z80_TABLE_ex /* cycles counts for taken jr/jp/call and interrupt latency (rst opcodes) */ }; /****************************************************************************/ @@ -27,16 +27,16 @@ enum { /****************************************************************************/ typedef struct { - PAIR prvpc,pc,sp,af,bc,de,hl,ix,iy; - PAIR af2,bc2,de2,hl2; - UINT8 r,r2,iff1,iff2,halt,im,i; - UINT8 nmi_state; /* nmi line state */ - UINT8 nmi_pending; /* nmi pending */ - UINT8 irq_state; /* irq line state */ - UINT8 after_ei; /* are we in the EI shadow? */ - const struct z80_irq_daisy_chain *daisy; - int (*irq_callback)(int irqline); -} Z80_Regs; + PAIR prvpc,pc,sp,af,bc,de,hl,ix,iy; + PAIR af2,bc2,de2,hl2; + UINT8 r,r2,iff1,iff2,halt,im,i; + UINT8 nmi_state; /* nmi line state */ + UINT8 nmi_pending; /* nmi pending */ + UINT8 irq_state; /* irq line state */ + UINT8 after_ei; /* are we in the EI shadow? */ + const struct z80_irq_daisy_chain *daisy; + int (*irq_callback)(int irqline); +} Z80_Regs; extern int z80_ICount;