branches/alto2/src/emu/cpu/alto2/a2disk.c
| r26242 | r26243 | |
| 10 | 10 | #include "alto2.h" |
| 11 | 11 | |
| 12 | 12 | |
| 13 | | #define JKFF_FUNCTION 1 //!< define 1 to debug the JK flip-flops, 0 to use a lookup table |
| 13 | #define JKFF_FUNCTION 0 //!< define 1 to debug the JK flip-flops, 0 to use a lookup table |
| 14 | 14 | |
| 15 | 15 | #define GET_KADDR_SECTOR(kaddr) A2_GET16(kaddr,16, 0, 3) //!< get sector number from address register |
| 16 | 16 | #define PUT_KADDR_SECTOR(kaddr,val) A2_PUT16(kaddr,16, 0, 3,val) //!< put sector number into address register |
| r26242 | r26243 | |
| 2316 | 2316 | #else |
| 2317 | 2317 | // TODO: verify current sector == requested sector and only then run the bitclk? |
| 2318 | 2318 | // HACK: no command, no bit clock |
| 2319 | | // if (debug_read_mem(0521)) |
| 2319 | if (debug_read_mem(0521)) |
| 2320 | 2320 | { |
| 2321 | 2321 | // Make the CPU execution loop call disk_bitclk |
| 2322 | 2322 | m_bitclk_time = 0; |
branches/alto2/src/emu/cpu/alto2/a2disp.c
| r26242 | r26243 | |
| 194 | 194 | */ |
| 195 | 195 | int alto2_cpu_device::unload_word(int x) |
| 196 | 196 | { |
| 197 | | UINT32 word, word1, word2; |
| 198 | 197 | int y = ((m_dsp.hlc - m_dsp.vblank) & ~(1024|1)) + HLC1024(); |
| 198 | UINT16* scanline = m_dsp.scanline[y]; |
| 199 | UINT8 dirty = m_dsp.scanline_dirty[y]; |
| 199 | 200 | |
| 200 | | word = m_dsp.inverse; |
| 201 | UINT32 word = m_dsp.inverse; |
| 201 | 202 | if (FIFO_MBEMPTY_0() == 0) { |
| 202 | 203 | LOG((LOG_DISPL,1, " DSP FIFO underrun y:%d x:%d\n", y, x)); |
| 203 | 204 | } else { |
| r26242 | r26243 | |
| 209 | 210 | |
| 210 | 211 | if (y >= 0 && y < ALTO2_DISPLAY_HEIGHT && x < ALTO2_DISPLAY_VISIBLE_WORDS) { |
| 211 | 212 | if (m_dsp.halfclock) { |
| 212 | | word1 = double_bits[word / 256]; |
| 213 | | word2 = double_bits[word % 256]; |
| 213 | UINT32 word1 = double_bits[word / 256]; |
| 214 | UINT32 word2 = double_bits[word % 256]; |
| 214 | 215 | /* mixing with the cursor */ |
| 215 | 216 | if (x == m_dsp.curword + 0) |
| 216 | 217 | word1 ^= m_dsp.curdata >> 16; |
| 217 | 218 | if (x == m_dsp.curword + 1) |
| 218 | 219 | word1 ^= m_dsp.curdata & 0177777; |
| 219 | | if (word1 != m_dsp.raw_bitmap[y * ALTO2_DISPLAY_SCANLINE_WORDS + x]) { |
| 220 | | m_dsp.raw_bitmap[y * ALTO2_DISPLAY_SCANLINE_WORDS + x] = word1; |
| 221 | | m_dsp.scanline_dirty[y] = 1; |
| 220 | if (word1 != scanline[x]) { |
| 221 | scanline[x] = word1; |
| 222 | dirty = 1; |
| 222 | 223 | } |
| 223 | 224 | x++; |
| 224 | 225 | if (x < ALTO2_DISPLAY_VISIBLE_WORDS) { |
| r26242 | r26243 | |
| 227 | 228 | word2 ^= m_dsp.curdata >> 16; |
| 228 | 229 | if (x == m_dsp.curword + 1) |
| 229 | 230 | word2 ^= m_dsp.curdata & 0177777; |
| 230 | | if (word2 != m_dsp.raw_bitmap[y * ALTO2_DISPLAY_SCANLINE_WORDS + x]) { |
| 231 | | m_dsp.raw_bitmap[y * ALTO2_DISPLAY_SCANLINE_WORDS + x] = word2; |
| 232 | | m_dsp.scanline_dirty[y] = 1; |
| 231 | if (word2 != scanline[x]) { |
| 232 | scanline[x] = word2; |
| 233 | dirty = 1; |
| 233 | 234 | } |
| 234 | 235 | x++; |
| 235 | 236 | } |
| r26242 | r26243 | |
| 239 | 240 | word ^= m_dsp.curdata >> 16; |
| 240 | 241 | if (x == m_dsp.curword + 1) |
| 241 | 242 | word ^= m_dsp.curdata & 0177777; |
| 242 | | if (word != m_dsp.raw_bitmap[y * ALTO2_DISPLAY_SCANLINE_WORDS + x]) { |
| 243 | | m_dsp.raw_bitmap[y * ALTO2_DISPLAY_SCANLINE_WORDS + x] = word; |
| 244 | | m_dsp.scanline_dirty[y] = 1; |
| 243 | if (word != scanline[x]) { |
| 244 | scanline[x] = word; |
| 245 | dirty = 1; |
| 245 | 246 | } |
| 246 | 247 | x++; |
| 247 | 248 | } |
| 248 | 249 | } |
| 249 | | |
| 250 | m_dsp.scanline_dirty[y] = dirty; |
| 250 | 251 | if (x < ALTO2_DISPLAY_VISIBLE_WORDS) { |
| 251 | 252 | m_unload_time += ALTO2_DISPLAY_BITTIME(m_dsp.halfclock ? 32 : 16); |
| 252 | 253 | return x; |
| r26242 | r26243 | |
| 440 | 441 | memset(&m_dsp, 0, sizeof(m_dsp)); |
| 441 | 442 | m_dsp.hlc = ALTO2_DISPLAY_HLC_START; |
| 442 | 443 | m_dsp.raw_bitmap = auto_alloc_array(machine(), UINT16, ALTO2_DISPLAY_HEIGHT * ALTO2_DISPLAY_SCANLINE_WORDS); |
| 443 | | for (int y = 0; y < ALTO2_DISPLAY_HEIGHT; y++) |
| 444 | | memset(m_dsp.raw_bitmap + y * ALTO2_DISPLAY_SCANLINE_WORDS, 0, ALTO2_DISPLAY_VISIBLE_WORDS * sizeof(UINT16)); |
| 445 | | |
| 444 | m_dsp.scanline = auto_alloc_array(machine(), UINT16*, ALTO2_DISPLAY_HEIGHT); |
| 445 | for (int y = 0; y < ALTO2_DISPLAY_HEIGHT; y++) { |
| 446 | m_dsp.scanline[y] = m_dsp.raw_bitmap + y * ALTO2_DISPLAY_SCANLINE_WORDS; |
| 447 | memset(m_dsp.scanline[y], 0, sizeof(UINT16) * ALTO2_DISPLAY_VISIBLE_WORDS); |
| 448 | } |
| 446 | 449 | m_dsp.scanline_dirty = auto_alloc_array(machine(), UINT8, ALTO2_DISPLAY_HEIGHT); |
| 447 | 450 | memset(m_dsp.scanline_dirty, 1, sizeof(UINT8) * ALTO2_DISPLAY_HEIGHT); |
| 448 | 451 | } |
| r26242 | r26243 | |
| 462 | 465 | if (0 == m_dsp.scanline_dirty[y]) |
| 463 | 466 | continue; |
| 464 | 467 | m_dsp.scanline_dirty[y] = 0; |
| 465 | | UINT16* src = &m_dsp.raw_bitmap[y * ALTO2_DISPLAY_SCANLINE_WORDS]; |
| 468 | UINT16* src = m_dsp.scanline[y]; |
| 466 | 469 | UINT16* pix = &bitmap.pix16(y); |
| 467 | 470 | for (UINT32 x = 0; x < ALTO2_DISPLAY_WIDTH; x += 16) { |
| 468 | 471 | UINT16 w = *src++; |
branches/alto2/src/emu/cpu/alto2/alto2.h
| r26242 | r26243 | |
| 20 | 20 | #define ALTO2_TAG "alto2" |
| 21 | 21 | |
| 22 | 22 | #ifndef ALTO2_DEBUG |
| 23 | | #define ALTO2_DEBUG 1 |
| 23 | #define ALTO2_DEBUG 0 //!< define to 1 to enable logerror() output |
| 24 | 24 | #endif |
| 25 | 25 | |
| 26 | 26 | #define USE_PRIO_F9318 0 //!< define to 1 to use the F9318 priority encoder code |
| r26242 | r26243 | |
| 147 | 147 | #define ALTO2_DISPLAY_WIDTH 606 //!< visible width of the display |
| 148 | 148 | #define ALTO2_DISPLAY_VISIBLE_WORDS ((ALTO2_DISPLAY_WIDTH+15)/16) //!< visible words per scanline |
| 149 | 149 | #define ALTO2_DISPLAY_BITCLOCK 20160000ll //!< display bit clock in in Hertz (20.16MHz) |
| 150 | | #define ALTO2_DISPLAY_BITTIME(n) (HZ_TO_ATTOSECONDS(ALTO2_DISPLAY_BITCLOCK)*(n)) //!< display bit time in in atto seconds (~= 49.6031ns) |
| 150 | #define ALTO2_DISPLAY_BITTIME(n) ((n)*U64(1000000000)/ALTO2_DISPLAY_BITCLOCK) //!< display bit time in in atto seconds (~= 49.6031ns) |
| 151 | 151 | #define ALTO2_DISPLAY_SCANLINE_TIME ALTO2_DISPLAY_BITTIME(ALTO2_DISPLAY_TOTAL_WIDTH) //!< time for a scanline in nano seconds (768 * 49.6031ns) |
| 152 | 152 | #define ALTO2_DISPLAY_VISIBLE_TIME ALTO2_DISPLAY_BITTIME(ALTO2_DISPLAY_WIDTH) //!< time of the visible part of a scanline (606 * 49.6031ns) |
| 153 | 153 | #define ALTO2_DISPLAY_WORD_TIME ALTO2_DISPLAY_BITTIME(16) //!< time for a word (16 pixels * 49.6031ns) |
| r26242 | r26243 | |
| 1600 | 1600 | UINT32 curword; //!< helper: first cursor word in current scanline |
| 1601 | 1601 | UINT32 curdata; //!< helper: shifted cursor data (32-bit) |
| 1602 | 1602 | UINT16 *raw_bitmap; //!< array of words of the raw bitmap that is displayed |
| 1603 | UINT16 **scanline; //!< array of pointers to the scanlines |
| 1603 | 1604 | UINT8 *scanline_dirty; //!< array of flags indicating whenever the scanline contents changed |
| 1604 | 1605 | } m_dsp; |
| 1605 | 1606 | |