trunk/src/emu/video/tms9928a.c
| r19821 | r19822 | |
| 18 | 18 | ** - Colours are incorrect. [fixed by R Nabet ?] |
| 19 | 19 | ** - Sprites 8-31 are ghosted/cloned in mode 3 when using less than |
| 20 | 20 | ** three pattern tables. Exact behaviour is not known. |
| 21 | | ** - On TMS99xxA, the colortable mask in mode 3 acts as a nametable |
| 22 | | ** mask as well (does not happen on TMS91xx) |
| 23 | 21 | ** - Address scrambling when setting TMS99xxA to 4K (not on TMS91xx) |
| 24 | 22 | */ |
| 25 | 23 | |
| r19821 | r19822 | |
| 92 | 90 | RGB_WHITE |
| 93 | 91 | }; |
| 94 | 92 | |
| 95 | | tms9928a_device::tms9928a_device( const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_50hz, bool is_reva ) |
| 93 | tms9928a_device::tms9928a_device( const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_50hz, bool is_reva, bool is_99 ) |
| 96 | 94 | : device_t( mconfig, type, name, tag, owner, clock ), |
| 97 | 95 | device_memory_interface(mconfig, *this), |
| 98 | 96 | m_space_config("vram",ENDIANNESS_BIG, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(memmap)) |
| 99 | 97 | { |
| 100 | 98 | m_50hz = is_50hz; |
| 101 | 99 | m_reva = is_reva; |
| 100 | m_99 = is_99; |
| 102 | 101 | // static_set_addrmap(*this, AS_DATA, ADDRESS_MAP_NAME(memmap)); |
| 103 | 102 | } |
| 104 | 103 | |
| r19821 | r19822 | |
| 110 | 109 | { |
| 111 | 110 | m_50hz = false; |
| 112 | 111 | m_reva = true; |
| 112 | m_99 = true; |
| 113 | 113 | // static_set_addrmap(*this, AS_DATA, ADDRESS_MAP_NAME(memmap)); |
| 114 | 114 | } |
| 115 | 115 | |
| r19821 | r19822 | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
| 172 | void tms9928a_device::update_table_masks() |
| 173 | { |
| 174 | m_colourmask = ( (m_Regs[3] & 0x7f) << 3 ) | 7; |
| 175 | |
| 176 | // on 91xx family, the colour table mask doesn't affect the pattern table mask |
| 177 | m_patternmask = ( (m_Regs[4] & 3) << 8 ) | ( m_99 ? (m_colourmask & 0xff) : 0xff ); |
| 178 | } |
| 179 | |
| 180 | |
| 172 | 181 | void tms9928a_device::change_register(UINT8 reg, UINT8 val) |
| 173 | 182 | { |
| 174 | 183 | static const UINT8 Mask[8] = |
| r19821 | r19822 | |
| 194 | 203 | if (val & 2) |
| 195 | 204 | { |
| 196 | 205 | m_colour = ((m_Regs[3] & 0x80) * 64) & (m_vram_size - 1); |
| 197 | | m_colourmask = (m_Regs[3] & 0x7f) * 8 | 7; |
| 198 | 206 | m_pattern = ((m_Regs[4] & 4) * 2048) & (m_vram_size - 1); |
| 199 | | m_patternmask = ( (m_Regs[4] & 3) << 8 ) | (m_colourmask & 0xff); |
| 207 | update_table_masks(); |
| 200 | 208 | } |
| 201 | 209 | else |
| 202 | 210 | { |
| r19821 | r19822 | |
| 220 | 228 | if (m_Regs[0] & 2) |
| 221 | 229 | { |
| 222 | 230 | m_colour = ((val & 0x80) * 64) & (m_vram_size - 1); |
| 223 | | m_colourmask = ( (val & 0x7f) * 8 ) | 7; |
| 231 | update_table_masks(); |
| 224 | 232 | } |
| 225 | 233 | else |
| 226 | 234 | { |
| 227 | 235 | m_colour = (val * 64) & (m_vram_size - 1); |
| 228 | 236 | } |
| 229 | | m_patternmask = ( (m_Regs[4] & 3) * 256 ) | (m_colourmask & 255); |
| 230 | 237 | break; |
| 231 | 238 | case 4: |
| 232 | 239 | if (m_Regs[0] & 2) |
| 233 | 240 | { |
| 234 | 241 | m_pattern = ((val & 4) * 2048) & (m_vram_size - 1); |
| 235 | | m_patternmask = ( (val & 3) * 256 ) | 255; |
| 242 | update_table_masks(); |
| 236 | 243 | } |
| 237 | 244 | else |
| 238 | 245 | { |
| r19821 | r19822 | |
| 664 | 671 | m_colour = 0; |
| 665 | 672 | m_spritepattern = 0; |
| 666 | 673 | m_spriteattribute = 0; |
| 667 | | m_colourmask = 0; |
| 668 | | m_patternmask = 0; |
| 674 | m_colourmask = 0x3fff; |
| 675 | m_patternmask = 0x3fff; |
| 669 | 676 | m_Addr = 0; |
| 670 | 677 | m_ReadAhead = 0; |
| 671 | 678 | m_INT = 0; |
trunk/src/emu/video/tms9928a.h
| r19821 | r19822 | |
| 89 | 89 | public: |
| 90 | 90 | // construction/destruction |
| 91 | 91 | tms9928a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 92 | | tms9928a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_50hz = false, bool is_reva = true); |
| 92 | tms9928a_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_50hz = false, bool is_reva = true, bool is_99 = true); |
| 93 | 93 | |
| 94 | 94 | DECLARE_READ8_MEMBER( vram_read ); |
| 95 | 95 | DECLARE_WRITE8_MEMBER( vram_write ); |
| r19821 | r19822 | |
| 117 | 117 | void change_register(UINT8 reg, UINT8 val); |
| 118 | 118 | void check_interrupt(); |
| 119 | 119 | void update_backdrop(); |
| 120 | void update_table_masks(); |
| 120 | 121 | |
| 121 | 122 | static const device_timer_id TIMER_LINE = 0; |
| 122 | 123 | |
| r19821 | r19822 | |
| 140 | 141 | devcb_resolved_write_line m_irq_changed; |
| 141 | 142 | bool m_50hz; |
| 142 | 143 | bool m_reva; |
| 144 | bool m_99; |
| 143 | 145 | rgb_t m_palette[16]; |
| 144 | 146 | |
| 145 | 147 | /* memory */ |
| r19821 | r19822 | |
| 160 | 162 | { |
| 161 | 163 | public: |
| 162 | 164 | tms9918_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 163 | | : tms9928a_device( mconfig, TMS9918, "TMS9918", tag, owner, clock, false, false ) { } |
| 165 | : tms9928a_device( mconfig, TMS9918, "TMS9918", tag, owner, clock, false, false, true ) { } |
| 164 | 166 | }; |
| 165 | 167 | |
| 166 | 168 | |
| r19821 | r19822 | |
| 168 | 170 | { |
| 169 | 171 | public: |
| 170 | 172 | tms9918a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 171 | | : tms9928a_device( mconfig, TMS9918A, "TMS9918a", tag, owner, clock, false, true ) { } |
| 173 | : tms9928a_device( mconfig, TMS9918A, "TMS9918A", tag, owner, clock, false, true, true ) { } |
| 172 | 174 | }; |
| 173 | 175 | |
| 174 | 176 | |
| r19821 | r19822 | |
| 176 | 178 | { |
| 177 | 179 | public: |
| 178 | 180 | tms9118_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 179 | | : tms9928a_device( mconfig, TMS9118, "TMS9118", tag, owner, clock, false, true ) { } |
| 181 | : tms9928a_device( mconfig, TMS9118, "TMS9118", tag, owner, clock, false, true, false ) { } |
| 180 | 182 | }; |
| 181 | 183 | |
| 182 | 184 | |
| r19821 | r19822 | |
| 184 | 186 | { |
| 185 | 187 | public: |
| 186 | 188 | tms9128_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 187 | | : tms9928a_device( mconfig, TMS9128, "TMS9128", tag, owner, clock, false, true ) { } |
| 189 | : tms9928a_device( mconfig, TMS9128, "TMS9128", tag, owner, clock, false, true, false ) { } |
| 188 | 190 | }; |
| 189 | 191 | |
| 190 | 192 | |
| r19821 | r19822 | |
| 192 | 194 | { |
| 193 | 195 | public: |
| 194 | 196 | tms9929_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 195 | | : tms9928a_device( mconfig, TMS9929, "TMS9929", tag, owner, clock, true, false ) { } |
| 197 | : tms9928a_device( mconfig, TMS9929, "TMS9929", tag, owner, clock, true, false, true ) { } |
| 196 | 198 | }; |
| 197 | 199 | |
| 198 | 200 | |
| r19821 | r19822 | |
| 200 | 202 | { |
| 201 | 203 | public: |
| 202 | 204 | tms9929a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 203 | | : tms9928a_device( mconfig, TMS9929A, "TMS9929A", tag, owner, clock, true, true ) { } |
| 205 | : tms9928a_device( mconfig, TMS9929A, "TMS9929A", tag, owner, clock, true, true, true ) { } |
| 204 | 206 | }; |
| 205 | 207 | |
| 206 | 208 | |
| r19821 | r19822 | |
| 208 | 210 | { |
| 209 | 211 | public: |
| 210 | 212 | tms9129_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 211 | | : tms9928a_device( mconfig, TMS9129, "TMS9129", tag, owner, clock, true, true ) { } |
| 213 | : tms9928a_device( mconfig, TMS9129, "TMS9129", tag, owner, clock, true, true, false ) { } |
| 212 | 214 | }; |
| 213 | 215 | |
| 214 | 216 | |