diff options
author | 2011-09-21 20:49:59 +0000 | |
---|---|---|
committer | 2011-09-21 20:49:59 +0000 | |
commit | 8a0ab703b02c0176a11d79678e85b5fb69d35e50 (patch) | |
tree | 4d5a388ed36290455c6761c5d2bd708071578a89 /src/emu | |
parent | f603291c0e3e5e6d73280077f07b057aeab924b6 (diff) |
Added a bunch of new commands
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/video/h63484.c | 127 | ||||
-rw-r--r-- | src/emu/video/h63484.h | 3 |
2 files changed, 117 insertions, 13 deletions
diff --git a/src/emu/video/h63484.c b/src/emu/video/h63484.c index 93e8bb1ae0d..d31ced7ab89 100644 --- a/src/emu/video/h63484.c +++ b/src/emu/video/h63484.c @@ -619,7 +619,7 @@ int h63484_device::translate_command(UINT16 data) return COMMAND_INVALID; } -void h63484_device::command_end_seq() +inline void h63484_device::command_end_seq() { //h63484->param_ptr = 0; m_sr |= H63484_SR_CED; @@ -732,6 +732,96 @@ void h63484_device::command_cpy_exec() // ... } +void h63484_device::command_rct_exec() +{ + INT16 dX, dY; + UINT8 area,col,opm; + UINT32 offset; + int inc_x,inc_y; + int i; + UINT8 res,data_r; + + area = (m_cr & 0xe0) >> 5; + col = (m_cr & 0x18) >> 3; + opm = (m_cr & 0x07); + dX = m_pr[0]; + dY = m_pr[1]; + + offset = m_rwp[m_rwp_dn] & 0xfffff; + + inc_x = (dX < 0) ? -1 : 1; + inc_y = (dY < 0) ? -1 : 1; + + printf("%d %d\n",dX,dY); + + /* + 3<-2 + | ^ + v | + 0->1 + */ + + /* 0 -> 1 */ + for(i=0;i<dX;i+=inc_x) + { + offset = (((i + m_cpx) >> 1) + (0 + m_cpy) * m_mwr[m_rwp_dn]) & 0xfffff; /* TODO: address if bpp != 4 */ + data_r = readbyte(offset); + + if((i + m_cpx) & 1) + res = (col & 0x0f) | (data_r & 0xf0); + else + res = (col & 0xf0) | (data_r & 0x0f); + + writebyte(offset,res); + } + + /* 1 -> 2 */ + for(i=0;i<dY;i+=inc_y) + { + offset = (((dX + m_cpx) >> 1) + (i + m_cpy) * m_mwr[m_rwp_dn]) & 0xfffff; /* TODO: address if bpp != 4 */ + data_r = readbyte(offset); + + if((dX + m_cpx) & 1) + res = (col & 0x0f) | (data_r & 0xf0); + else + res = (col & 0xf0) | (data_r & 0x0f); + + writebyte(offset,res); + } + + /* 2 -> 3 */ + for(i=0;i<dX;i+=inc_x) + { + offset = (((i + m_cpx) >> 1) + (dY + m_cpy) * m_mwr[m_rwp_dn]) & 0xfffff; /* TODO: address if bpp != 4 */ + data_r = readbyte(offset); + + if((i + m_cpx) & 1) + res = (col & 0x0f) | (data_r & 0xf0); + else + res = (col & 0xf0) | (data_r & 0x0f); + + writebyte(offset,res); + } + + /* 3 -> 4 */ + for(i=0;i<dY;i+=inc_y) + { + offset = (((0 + m_cpx) >> 1) + (i + m_cpy) * m_mwr[m_rwp_dn]) & 0xfffff; /* TODO: address if bpp != 4 */ + data_r = readbyte(offset); + + if((0 + m_cpx) & 1) + res = (col & 0x0f) | (data_r & 0xf0); + else + res = (col & 0xf0) | (data_r & 0x0f); + + writebyte(offset,res); + } + + + m_cpx += dX; + m_cpy += dY; +} + void h63484_device::process_fifo() { UINT8 data; @@ -848,9 +938,26 @@ void h63484_device::process_fifo() } break; + case COMMAND_RRCT: + if (m_param_ptr == 2) + { + command_rct_exec(); + command_end_seq(); + } + break; + + case COMMAND_RMOVE: + if (m_param_ptr == 2) + { + m_cpx += (INT16)m_pr[0]; + m_cpy += (INT16)m_pr[1]; + command_end_seq(); + } + break; + default: printf("%04x\n",m_cr); - //fatalerror("stop!"); + fatalerror("stop!"); break; } } @@ -894,7 +1001,11 @@ void h63484_device::video_registers_w(int offset) switch(offset) { - case 0x00: // FIFO entry, not covered there + case 0x00: // FIFO entry + queue_w((vreg_data & 0xff00) >> 8); + queue_w((vreg_data & 0x00ff) >> 0); + if(FIFO_LOG) printf("%s -> %04x\n",acrtc_regnames[m_ar/2],vreg_data); + process_fifo(); break; case 0x02: // Command Entry @@ -1019,15 +1130,7 @@ WRITE16_MEMBER( h63484_device::data_w ) if(ACCESSING_BITS_0_7) m_vreg[m_ar+1] = (data & 0xff); - if(m_ar == 0) - { - queue_w((data & 0xff00) >> 8); - queue_w((data & 0x00ff) >> 0); - if(FIFO_LOG) printf("%s -> %02x\n",acrtc_regnames[m_ar/2],data); - process_fifo(); - } - else - video_registers_w(m_ar); + video_registers_w(m_ar); if(m_ar & 0x80) { diff --git a/src/emu/video/h63484.h b/src/emu/video/h63484.h index bcc2bf9033e..29a9e7a79c9 100644 --- a/src/emu/video/h63484.h +++ b/src/emu/video/h63484.h @@ -78,11 +78,12 @@ private: inline void queue_r(UINT8 data); inline void dequeue_r(UINT8 *data); inline void recompute_parameters(); + inline void command_end_seq(); - void command_end_seq(); void command_wpr_exec(); void command_clr_exec(); void command_cpy_exec(); + void command_rct_exec(); void process_fifo(); void exec_abort_sequence(); UINT16 video_registers_r(int offset); |