diff options
author | 2008-11-22 18:38:41 +0000 | |
---|---|---|
committer | 2008-11-22 18:38:41 +0000 | |
commit | 9ee2f770aa2c3f2dfbb9b6a65a689b68bc0aa4dd (patch) | |
tree | 2bfa92601a711c73c397915857962e937ccf1414 /src/emu/cpu/dsp56k | |
parent | 7173ebcdba0a5ef66cf08f3ba2d155bede8111ba (diff) |
Converted a bunch of CPU cores over to the new memory functions.
Diffstat (limited to 'src/emu/cpu/dsp56k')
-rw-r--r-- | src/emu/cpu/dsp56k/dsp56k.c | 9 | ||||
-rw-r--r-- | src/emu/cpu/dsp56k/dsp56ops.c | 46 | ||||
-rw-r--r-- | src/emu/cpu/dsp56k/dsp56pcu.c | 6 |
3 files changed, 33 insertions, 28 deletions
diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c index 5a9768b6c21..5f1b310f653 100644 --- a/src/emu/cpu/dsp56k/dsp56k.c +++ b/src/emu/cpu/dsp56k/dsp56k.c @@ -29,6 +29,7 @@ - 1-21 Vectored exception requests on the Host Interface! ***************************************************************************/ +#define NO_LEGACY_MEMORY_HANDLERS 1 #include "debugger.h" #include "deprecat.h" #include "dsp56k.h" @@ -209,6 +210,8 @@ typedef struct int interrupt_cycles; void (*output_pins_changed)(UINT32 pins); const device_config *device; + const address_space *program; + const address_space *data; } dsp56k_core; @@ -249,7 +252,7 @@ static int dsp56k_icount; /*************************************************************************** MEMORY ACCESSORS ***************************************************************************/ -#define ROPCODE(pc) program_decrypted_read_word(pc) +#define ROPCODE(pc) memory_decrypted_read_word(core.program, pc) /*************************************************************************** @@ -401,6 +404,8 @@ static CPU_INIT( dsp56k ) //core.config = device->static_config; //core.irq_callback = irqcallback; core.device = device; + core.program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM); + core.data = memory_find_address_space(device, ADDRESS_SPACE_DATA); } static void agu_reset(void) @@ -449,7 +454,7 @@ static CPU_RESET( dsp56k ) alu_reset(); /* HACK - Put a jump to 0x0000 at 0x0000 - this keeps the CPU put in MAME */ - program_write_word_16le(0x0000, 0x0124); + memory_write_word_16le(core.program, 0x0000, 0x0124); } diff --git a/src/emu/cpu/dsp56k/dsp56ops.c b/src/emu/cpu/dsp56k/dsp56ops.c index f07455bdf53..6cba8a2cf62 100644 --- a/src/emu/cpu/dsp56k/dsp56ops.c +++ b/src/emu/cpu/dsp56k/dsp56ops.c @@ -2188,7 +2188,7 @@ static size_t dsp56k_op_bfop(const UINT16 op, const UINT16 op2, UINT8* cycles) decode_BBB_bitmask(BITS(op2,0xe000), &iVal); workAddr = assemble_address_from_Pppppp_table(BITS(OP,0x0020), BITS(OP,0x001f)); - previousValue = data_read_word_16le(WORD(workAddr)); + previousValue = memory_read_word_16le(core.data, WORD(workAddr)); workingWord = previousValue; switch(BITS(op2, 0x1f00)) @@ -2254,7 +2254,7 @@ static size_t dsp56k_op_bfop_1(const UINT16 op, const UINT16 op2, UINT8* cycles) decode_RR_table(BITS(op,0x0003), &R); workAddr = *((UINT16*)R.addr); - previousValue = data_read_word_16le(WORD(workAddr)); + previousValue = memory_read_word_16le(core.data, WORD(workAddr)); workingWord = previousValue; switch(BITS(op2, 0x1f00)) @@ -3030,7 +3030,7 @@ static size_t dsp56k_op_movec(const UINT16 op, UINT8* cycles) if (W) { /* Write D */ - UINT16 value = data_read_word_16le(WORD(*((UINT16*)R.addr))) ; + UINT16 value = memory_read_word_16le(core.data, WORD(*((UINT16*)R.addr))) ; typed_pointer temp_src = { &value, DT_WORD }; SetDestinationValue(temp_src, SD); } @@ -3072,7 +3072,7 @@ static size_t dsp56k_op_movec_1(const UINT16 op, UINT8* cycles) if (W) { /* Write D */ - UINT16 tempData = data_read_word_16le(WORD(memOffset)); + UINT16 tempData = memory_read_word_16le(core.data, WORD(memOffset)); typed_pointer temp_src = { (void*)&tempData, DT_WORD }; SetDestinationValue(temp_src, SD); } @@ -3116,7 +3116,7 @@ static size_t dsp56k_op_movec_2(const UINT16 op, UINT8* cycles) if (W) { /* Write D */ - UINT16 tempData = data_read_word_16le(WORD(memOffset)); + UINT16 tempData = memory_read_word_16le(core.data, WORD(memOffset)); typed_pointer temp_src = { (void*)&tempData, DT_WORD }; SetDestinationValue(temp_src, SD); } @@ -3167,7 +3167,7 @@ static size_t dsp56k_op_movec_3(const UINT16 op, const UINT16 op2, UINT8* cycles else { /* 16-bit long address */ - UINT16 tempD = data_read_word_16le(WORD(op2)); + UINT16 tempD = memory_read_word_16le(core.data, WORD(op2)); typed_pointer tempTP = {&tempD, DT_WORD}; SetDestinationValue(tempTP, SD); } @@ -3245,7 +3245,7 @@ static size_t dsp56k_op_movec_5(const UINT16 op, const UINT16 op2, UINT8* cycles if (W) { /* Write D */ - UINT16 tempData = data_read_word_16le(WORD(memOffset)); + UINT16 tempData = memory_read_word_16le(core.data, WORD(memOffset)); typed_pointer temp_src = { (void*)&tempData, DT_WORD }; SetDestinationValue(temp_src, SD); } @@ -3308,7 +3308,7 @@ static size_t dsp56k_op_movem(const UINT16 op, UINT8* cycles) { /* Read from Program Memory */ typed_pointer data; - UINT16 ldata = program_read_word_16le(WORD(*((UINT16*)R.addr))); + UINT16 ldata = memory_read_word_16le(core.program, WORD(*((UINT16*)R.addr))); data.addr = &ldata; data.data_type = DT_WORD; @@ -3362,7 +3362,7 @@ static size_t dsp56k_op_movep(const UINT16 op, UINT8* cycles) if (W) { - UINT16 data = data_read_word_16le(WORD(pp)); + UINT16 data = memory_read_word_16le(core.data, WORD(pp)); typed_pointer tempTP; tempTP.addr = &data; @@ -3401,7 +3401,7 @@ static size_t dsp56k_op_movep_1(const UINT16 op, UINT8* cycles) /* A little different than most W if's - opposite read and write */ if (W) { - UINT16 data = data_read_word_16le(WORD(*((UINT16*)SD.addr))); + UINT16 data = memory_read_word_16le(core.data, WORD(*((UINT16*)SD.addr))); typed_pointer tempTP; tempTP.addr = &data; @@ -4352,7 +4352,7 @@ static void execute_x_memory_data_move(const UINT16 op, typed_pointer* d_registe if (W) { /* From X:<ea> to SD */ - UINT16 data = data_read_word_16le(WORD(*((UINT16*)R.addr))); + UINT16 data = memory_read_word_16le(core.data, WORD(*((UINT16*)R.addr))); typed_pointer tempTP; tempTP.addr = &data; @@ -4400,7 +4400,7 @@ static void execute_x_memory_data_move2(const UINT16 op, typed_pointer* d_regist if (W) { /* Write D */ - UINT16 value = data_read_word_16le(WORD(*mem_offset)); + UINT16 value = memory_read_word_16le(core.data, WORD(*mem_offset)); typed_pointer tempV = {&value, DT_WORD}; SetDestinationValue(tempV, SD); } @@ -4428,7 +4428,7 @@ static void execute_x_memory_data_move_with_short_displacement(const UINT16 op, if (W) { /* Write D */ - UINT16 tempData = data_read_word_16le(WORD(memOffset)); + UINT16 tempData = memory_read_word_16le(core.data, WORD(memOffset)); typed_pointer temp_src = { (void*)&tempData, DT_WORD }; SetDestinationValue(temp_src, SD); } @@ -4464,13 +4464,13 @@ static void execute_dual_x_memory_data_read(const UINT16 op, typed_pointer* d_re fatalerror("Dsp56k: Unimplemented access to external X Data Memory >= 0xffc0 in Dual X Memory Data Read."); /* First memmove */ - srcVal1 = data_read_word_16le(WORD(*((UINT16*)R.addr))); + srcVal1 = memory_read_word_16le(core.data, WORD(*((UINT16*)R.addr))); tempV.addr = &srcVal1; tempV.data_type = DT_WORD; SetDestinationValue(tempV, D1); /* Second memmove */ - srcVal2 = data_read_word_16le(WORD(R3)); + srcVal2 = memory_read_word_16le(core.data, WORD(R3)); tempV.addr = &srcVal2; tempV.data_type = DT_WORD; SetDestinationValue(tempV, D2); @@ -4565,13 +4565,13 @@ static void SetDataMemoryValue(typed_pointer source, UINT32 destinationAddr) { switch(source.data_type) { - case DT_BYTE: data_write_word_16le(destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ; - case DT_WORD: data_write_word_16le(destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ; - case DT_DOUBLE_WORD: data_write_word_16le(destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ; + case DT_BYTE: memory_write_word_16le(core.data, destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ; + case DT_WORD: memory_write_word_16le(core.data, destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ; + case DT_DOUBLE_WORD: memory_write_word_16le(core.data, destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ; // !!! Is this universal ??? // !!! Forget not, yon shift-limiter !!! - case DT_LONG_WORD: data_write_word_16le(destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ; + case DT_LONG_WORD: memory_write_word_16le(core.data, destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ; } } @@ -4580,13 +4580,13 @@ static void SetProgramMemoryValue(typed_pointer source, UINT32 destinationAddr) { switch(source.data_type) { - case DT_BYTE: program_write_word_16le(destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ; - case DT_WORD: program_write_word_16le(destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ; - case DT_DOUBLE_WORD: program_write_word_16le(destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ; + case DT_BYTE: memory_write_word_16le(core.program, destinationAddr, (UINT16)( (*((UINT8*) source.addr) & 0xff) ) ) ; break ; + case DT_WORD: memory_write_word_16le(core.program, destinationAddr, (UINT16)( (*((UINT16*)source.addr) & 0xffff) ) ) ; break ; + case DT_DOUBLE_WORD: memory_write_word_16le(core.program, destinationAddr, (UINT16)( (*((UINT32*)source.addr) & 0x0000ffff) ) ) ; break ; // !!! Is this universal ??? // !!! Forget not, yon shift-limiter !!! - case DT_LONG_WORD: program_write_word_16le(destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ; + case DT_LONG_WORD: memory_write_word_16le(core.program, destinationAddr, (UINT16)( ((*((UINT64*)source.addr)) & U64(0x00000000ffff0000)) >> 16) ) ; break ; } } diff --git a/src/emu/cpu/dsp56k/dsp56pcu.c b/src/emu/cpu/dsp56k/dsp56pcu.c index a43188c5b50..07766f8ae39 100644 --- a/src/emu/cpu/dsp56k/dsp56pcu.c +++ b/src/emu/cpu/dsp56k/dsp56pcu.c @@ -150,8 +150,8 @@ static void pcu_reset(void) // ... // P:$cffe -> Internal P:$07ff low byte // P:$cfff -> Internal P:$07ff high byte - UINT8 mem_value_low = program_read_byte_16le(mem_offset); /* TODO: IS THIS READING RIGHT? */ - UINT8 mem_value_high = program_read_byte_16be(mem_offset); + UINT8 mem_value_low = memory_read_byte_16le(core.program, mem_offset); /* TODO: IS THIS READING RIGHT? */ + UINT8 mem_value_high = memory_read_byte_16be(core.program, mem_offset); dsp56k_program_ram[i] = (mem_value_high << 8) || mem_value_low; } @@ -172,7 +172,7 @@ static void pcu_reset(void) // they need. Once they've had their fill, they turn bootstrap mode off // and the CPU begins execution at 0x0000; // HACK - Read bit 15 at 0xc000 to see if we're working with the SSIO or host interface. - if (program_read_word_16le(0xc000<<1) & 0x8000) + if (memory_read_word_16le(core.program, 0xc000<<1) & 0x8000) { core.bootstrap_mode = BOOTSTRAP_SSIX; logerror("DSP56k : Currently in (hacked) bootstrap mode - reading from SSIx.\n"); |