trunk/src/mess/video/maria.c
| r31941 | r31942 | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | - some history: |
| 7 | 2014-10-03 Mike Saarna, Robert Tuccitto reorganized DMA penalties to |
| 8 | support new rendering timeout code. |
| 9 | |
| 10 | 2014-08-29 Mike Saarna Timeout rendering added. |
| 7 | 11 | |
| 8 | 12 | 2014-08-26 Fabio Priuli Converted to device |
| 9 | 13 | |
| r31941 | r31942 | |
| 161 | 165 | int d, c, pixel_cell, cells; |
| 162 | 166 | int maria_cycles; |
| 163 | 167 | |
| 164 | | if (m_offset == 0) |
| 165 | | { |
| 166 | | if (READ_MEM(m_dll + 3) & 0x80) |
| 167 | | maria_cycles = 40; // DMA + maria interrupt overhead |
| 168 | | else |
| 169 | | maria_cycles = 19; // DMA |
| 170 | | } |
| 171 | | else |
| 172 | | { |
| 173 | | maria_cycles = 16; // DMA |
| 174 | | } |
| 168 | // All lines in a zone have the same initial DMA startup time. We'll adjust |
| 169 | // cycles for the special last zone line later, as those penalties happen after |
| 170 | // MARIA is done rendering, or after its hit the maximum rendering time. |
| 171 | maria_cycles = 16; |
| 175 | 172 | |
| 176 | 173 | cells = 0; |
| 177 | 174 | |
| r31941 | r31942 | |
| 179 | 176 | dl = m_dl; |
| 180 | 177 | |
| 181 | 178 | /* DMA */ |
| 182 | | /* Step through DL's */ |
| 183 | | while ((READ_MEM(dl + 1) & 0x5f) != 0) |
| 179 | /* Step through DL's while we're within maximum rendering time. max render time = ( scanline length - DMA start ) */ |
| 180 | /* 426 = ( 454 - 28 ) */ |
| 181 | |
| 182 | while (((READ_MEM(dl + 1) & 0x5f) != 0) && (maria_cycles<426)) |
| 184 | 183 | { |
| 185 | 184 | /* Extended header */ |
| 186 | 185 | if (!(READ_MEM(dl + 1) & 0x1f)) |
| r31941 | r31942 | |
| 210 | 209 | |
| 211 | 210 | for (int x = 0; x < width; x++) |
| 212 | 211 | { |
| 212 | if (maria_cycles >= 426) // ensure we haven't overrun the maximum render time |
| 213 | break; |
| 214 | |
| 213 | 215 | /* Do indirect mode */ |
| 214 | 216 | if (ind) |
| 215 | 217 | { |
| r31941 | r31942 | |
| 217 | 219 | data_addr = (m_charbase | c) + (m_offset << 8); |
| 218 | 220 | if (is_holey(data_addr)) |
| 219 | 221 | continue; |
| 220 | | |
| 222 | |
| 221 | 223 | maria_cycles += 3; |
| 222 | 224 | if (m_cwidth) // two data bytes per map byte |
| 223 | 225 | { |
| r31941 | r31942 | |
| 245 | 247 | } |
| 246 | 248 | } |
| 247 | 249 | } |
| 250 | |
| 251 | // Last Line post-render DMA cycle penalties... |
| 252 | if (m_offset == 0) |
| 253 | { |
| 254 | maria_cycles += 3; // extra shutdown time |
| 255 | if (READ_MEM(m_dll + 3) & 0x80) |
| 256 | maria_cycles += 21; // interrupt overhead |
| 257 | } |
| 258 | |
| 248 | 259 | // Spin the CPU for Maria DMA, if it's not already spinning for WSYNC. |
| 249 | 260 | // MARIA generates the 6502 clock by dividing its own clock by 4. It needs to HALT and unHALT |
| 250 | 261 | // the 6502 on ths same clock phase, so MARIA will wait until its clock divides evenly by 4. |