awboard: add "offset protection" used by some carts. samsptk and kofxi boot now. [R. Belmont, MetalliC]

This commit is contained in:
R. Belmont 2014-10-05 13:39:31 +00:00
parent 0a3884bd50
commit 410b0794dc
2 changed files with 18 additions and 2 deletions

View File

@ -108,6 +108,7 @@ DEVICE_ADDRESS_MAP_START(submap, 16, aw_rom_board)
AM_RANGE(0x08, 0x09) AM_WRITE(mpr_first_file_index_w)
AM_RANGE(0x0a, 0x0b) AM_WRITE(mpr_file_offsetl_w)
AM_RANGE(0x0c, 0x0d) AM_WRITE(mpr_file_offseth_w)
AM_RANGE(0x40, 0x41) AM_READWRITE(adj_offset_r, adj_offset_w)
ADDRESS_MAP_END
aw_rom_board::aw_rom_board(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
@ -238,6 +239,7 @@ void aw_rom_board::device_start()
save_item(NAME(mpr_file_offset));
save_item(NAME(dma_offset));
save_item(NAME(dma_limit));
save_item(NAME(adjust_off));
}
void aw_rom_board::device_reset()
@ -247,11 +249,22 @@ void aw_rom_board::device_reset()
mpr_record_index = 0;
mpr_first_file_index = 0;
mpr_file_offset = 0;
adjust_off = 0;
dma_offset = 0;
dma_limit = 0;
}
READ16_MEMBER(aw_rom_board::adj_offset_r)
{
return adjust_off;
}
WRITE16_MEMBER(aw_rom_board::adj_offset_w)
{
adjust_off = data;
}
WRITE16_MEMBER(aw_rom_board::epr_offsetl_w)
{
epr_offset = (epr_offset & 0xffff0000) | data;
@ -284,7 +297,8 @@ WRITE16_MEMBER(aw_rom_board::mpr_file_offsetl_w)
WRITE16_MEMBER(aw_rom_board::mpr_file_offseth_w)
{
mpr_file_offset = (mpr_file_offset & 0x0000ffff) | (data << 16);
mpr_file_offset = ((mpr_file_offset & 0x0000ffff) | ((data -(adjust_off*0x0100))<< 16));
recalc_dma_offset(MPR_FILE);
}

View File

@ -22,6 +22,8 @@ public:
DECLARE_WRITE16_MEMBER(mpr_first_file_index_w); // 5f7010
DECLARE_WRITE16_MEMBER(mpr_file_offsetl_w); // 5f7014
DECLARE_WRITE16_MEMBER(mpr_file_offseth_w); // 5f7018
DECLARE_READ16_MEMBER(adj_offset_r); // 5f7080
DECLARE_WRITE16_MEMBER(adj_offset_w); // 5f7080
protected:
virtual void device_start();
@ -37,7 +39,7 @@ private:
bool region_is_decrypted;
UINT32 epr_offset, mpr_file_offset;
UINT16 mpr_record_index, mpr_first_file_index;
UINT16 mpr_record_index, mpr_first_file_index, adjust_off;
UINT32 dma_offset, dma_limit;