src/mess/drivers/vk100.c
| r15639 | r15640 | |
| 93 | 93 | X - 0 X X X X (0x30) " |
| 94 | 94 | |
| 95 | 95 | */ |
| 96 | | #undef VG_VERBOSE |
| 96 | // show messages related to writes to the 0x4x VG registers |
| 97 | #undef VG40_VERBOSE |
| 98 | // show messages related to writes to the 0x6x VG registers |
| 99 | #undef VG60_VERBOSE |
| 100 | // show messages related to LED/beeper writes |
| 97 | 101 | #undef LED_VERBOSE |
| 102 | // show messages related to KYBD writes |
| 98 | 103 | #undef KBD_VERBOSE |
| 104 | // debug the pattern reg |
| 105 | #undef PAT_DEBUG |
| 99 | 106 | |
| 100 | 107 | #include "emu.h" |
| 101 | 108 | #include "cpu/i8085/i8085.h" |
| r15639 | r15640 | |
| 129 | 136 | UINT8 m_vgERR; |
| 130 | 137 | UINT8 m_vgSOPS; |
| 131 | 138 | UINT8 m_vgPAT; |
| 132 | | UINT8 m_vgPAT_Shift; // holds the shifted pattern |
| 139 | UINT16 m_vgPAT_Mask; // current mask for PAT but <<1 |
| 133 | 140 | UINT8 m_vgPMUL; // reload value for pmul_count |
| 134 | 141 | UINT8 m_vgPMUL_Count; |
| 135 | 142 | UINT8 m_vgDU; |
| r15639 | r15640 | |
| 167 | 174 | /* figure out ram address based on tech manual page 5-24: |
| 168 | 175 | * real address to 16-bit chunk a13 a12 | a11 a10 a9 a8 | a7 a6 a5 a4 | a3 a2 a1 a0 |
| 169 | 176 | * X+Y input Y8 Y7 | Y6 Y5 Y4 Y3 | Y2 Y1 X9' X8'| X7' X6' X5' X4' |
| 170 | | X3' and X2' choose a 4-bit block, X1 and X0 choose a bit within that. |
| 177 | * X3' and X2' choose a 4-bit block, X1 and X0 choose a bit within that. |
| 178 | * Figure out the ram address in address space "vram" based on this: |
| 179 | * vram is 0x8000 long (0x4000 16-bit blocks in sequence) |
| 180 | * so: |
| 181 | * vram: a14 a13 a12 | a11 a10 a9 a8 | a7 a6 a5 a4 | a3 a2 a1 a0 |
| 182 | * vg: Y8 Y7 Y6 | Y5 Y4 Y3 Y2 | Y1 X9' X8' X7'| X6' X5' X4'(x3') x2' x1 x0 |
| 183 | * X3' is handled by the nybblenum statement, as is X2' |
| 184 | * X1 and X0 are handled by the pattern rom directly: |
| 185 | * x0 -> a0, x1 -> a1 |
| 186 | * this handles bits like: |
| 187 | * x1 x0 |
| 188 | * 0 0 -> bit 0 |
| 189 | * 0 1 -> bit 1 |
| 190 | * 1 0 -> bit 2 |
| 191 | * 1 1 -> bit 3 |
| 192 | * |
| 171 | 193 | */ |
| 172 | 194 | vk100_state *state = machine.driver_data<vk100_state>(); |
| 173 | 195 | while (state->m_GO) // temporary hack to draw the entire vector in one call |
| 174 | 196 | { |
| 175 | | UINT16 XFinal = state->m_trans[(state->m_vgX&0x3FC)>>2]<<2|(state->m_vgX&3); // appears correct |
| 197 | // XFinal is (X'&0x3FC)|(X&0x3) |
| 198 | UINT16 XFinal = state->m_trans[(state->m_vgX&0x3FC)>>2]<<2|(state->m_vgX&0x3); // appears correct |
| 199 | // EA is the effective ram address for a 16-bit block |
| 176 | 200 | UINT16 EA = ((state->m_vgY&0x1FE)<<5)|(XFinal>>4); // appears correct |
| 177 | | //EA indexes a block of 16 bits |
| 201 | // block is the 16 bit block directly (note EA has to be <<1 to correctly index a byte) |
| 178 | 202 | UINT16 block = state->m_vram[(EA<<1)+1] | (state->m_vram[(EA<<1)]<<8); |
| 179 | 203 | // pattern rom addressing is a complex mess. see the pattern rom def later in this file. |
| 180 | 204 | UINT8 nybbleNum = (XFinal&0xC)>>2; // which of the four nybbles within the block to address. should NEVER be 3! |
| 181 | | printf("EA: %04X, nybblenum: %d X: %04X, X': %04X, Y: %04X\n", EA, nybbleNum, state->m_vgX, XFinal, state->m_vgY); |
| 205 | //printf("EA: %04X, nybblenum: %d X: %04X, X': %04X, Y: %04X\n", EA, nybbleNum, state->m_vgX, XFinal, state->m_vgY); |
| 206 | // patmask should be vg_patmask >>1 unless vg_patmask is 0x1 in which case it is 0x80 |
| 207 | UINT8 PATMask = state->m_vgPAT_Mask >> 1; |
| 208 | if (PATMask == 0) PATMask = 0x80; |
| 182 | 209 | UINT8 thisNyb = 0; |
| 183 | 210 | UINT16 blockRemain = 0; |
| 184 | 211 | switch(nybbleNum) |
| 185 | 212 | { |
| 186 | | case 0: // modify the left nybble only (from the first byte) |
| 187 | | thisNyb = (block&0xF000)>>12; |
| 188 | | blockRemain = (block&0x0FFF); // save the rest of the block |
| 189 | | thisNyb = state->m_pattern[((state->m_vgPAT&state->m_vgPAT_Shift)?0x200:0)|((state->m_vgWOPS&7)<<6)|((state->m_vgX&3)<<4)|thisNyb]; |
| 190 | | state->m_LASTVRAM = thisNyb; |
| 191 | | block = blockRemain | (thisNyb<<12); |
| 192 | | break; |
| 193 | | case 1: // modify the right nybble only (from the first byte) |
| 213 | case 2: // modify the left nybble only (from the first byte) |
| 194 | 214 | thisNyb = (block&0x0F00)>>8; |
| 195 | 215 | blockRemain = (block&0xF0FF); // save the rest of the block |
| 196 | | thisNyb = state->m_pattern[((state->m_vgPAT&state->m_vgPAT_Shift)?0x200:0)|((state->m_vgWOPS&7)<<6)|((state->m_vgX&3)<<4)|thisNyb]; |
| 216 | thisNyb = state->m_pattern[((state->m_vgPAT&PATMask)?0x200:0)|((state->m_vgWOPS&7)<<6)|((state->m_vgX&3)<<4)|thisNyb]; |
| 197 | 217 | state->m_LASTVRAM = thisNyb; |
| 198 | 218 | block = blockRemain | (thisNyb<<8); |
| 199 | 219 | break; |
| 200 | | case 2: // modify the left nybble of the second byte |
| 220 | case 1: // modify the right nybble only (from the first byte) |
| 201 | 221 | thisNyb = (block&0x00F0)>>4; |
| 202 | 222 | blockRemain = (block&0xFF0F); // save the rest of the block |
| 203 | | thisNyb = state->m_pattern[((state->m_vgPAT&state->m_vgPAT_Shift)?0x200:0)|((state->m_vgWOPS&7)<<6)|((state->m_vgX&3)<<4)|thisNyb]; |
| 223 | thisNyb = state->m_pattern[((state->m_vgPAT&PATMask)?0x200:0)|((state->m_vgWOPS&7)<<6)|((state->m_vgX&3)<<4)|thisNyb]; |
| 204 | 224 | state->m_LASTVRAM = thisNyb; |
| 205 | 225 | block = blockRemain | (thisNyb<<4); |
| 206 | 226 | break; |
| 227 | case 0: // modify the left nybble of the second byte |
| 228 | thisNyb = (block&0x000F); |
| 229 | blockRemain = (block&0xFFF0); // save the rest of the block |
| 230 | thisNyb = state->m_pattern[((state->m_vgPAT&PATMask)?0x200:0)|((state->m_vgWOPS&7)<<6)|((state->m_vgX&3)<<4)|thisNyb]; |
| 231 | state->m_LASTVRAM = thisNyb; |
| 232 | block = blockRemain | thisNyb; |
| 233 | break; |
| 207 | 234 | default: // should never EVER get here |
| 208 | | printf("ERROR: attempted to modify the attribute nybble!\n"); |
| 235 | fatalerror("ERROR: VK100 VG attempted to modify the attribute nybble!\n"); |
| 209 | 236 | break; |
| 210 | 237 | } |
| 211 | 238 | // check if the attribute nybble is supposed to be modified, and if so do so |
| 212 | | if (state->m_vgWOPS&0x08) block = (block&0xFFF0)|((state->m_vgWOPS&0xF0)>>4); |
| 239 | if (state->m_vgWOPS&0x08) block = (block&0x0FFF)|(((UINT16)state->m_vgWOPS&0xF0)<<8); |
| 213 | 240 | // finally write the block back to ram |
| 214 | 241 | state->m_vram[(EA<<1)+1] = block&0xFF; |
| 215 | 242 | state->m_vram[(EA<<1)] = (block&0xFF00)>>8; |
| 216 | | state->m_vgX++;// TODO: since the direction rom is missing; the vector generator direction is FIXED rightward!` |
| 243 | state->m_vgX++;// TODO: since the direction rom is missing; the vector generator direction is FIXED rightward! |
| 244 | //state->m_vgY++;// hack to mix stuff up a little |
| 217 | 245 | //printf("VG state: EA: %d, lastvram: %d, curvram: %d, pmulcount: %d |
| 218 | | if (((++state->m_vgPMUL_Count)&0xF)==0) { |
| 246 | if (((++state->m_vgPMUL_Count)&0xF)==0) { // if pattern multiplier counter overflowed |
| 219 | 247 | state->m_vgPMUL_Count = state->m_vgPMUL; // reload counter |
| 220 | | if (state->m_vgPAT_Shift == 0x80) state->m_GO = 0; // check if the pattern shifter is empty, if so we're done |
| 221 | | state->m_vgPAT_Shift <<= 1; |
| 222 | | } |
| 248 | state->m_vgPAT_Mask >>= 1; |
| 249 | if ((state->m_vgPAT_Mask) == 0x00) state->m_GO = 0; // check if the pattern shifter is empty, if so we're done |
| 250 | } |
| 223 | 251 | } |
| 224 | 252 | } |
| 225 | 253 | |
| r15639 | r15640 | |
| 234 | 262 | { |
| 235 | 263 | m_vgX &= 0xFF << ((1-offset)*8); |
| 236 | 264 | m_vgX |= ((UINT16)data) << (offset*8); |
| 237 | | #ifdef VG_VERBOSE |
| 265 | #ifdef VG40_VERBOSE |
| 238 | 266 | logerror("VG: 0x%02X: X Reg loaded with %04X, new X value is %04X\n", 0x40+offset, ((UINT16)data) << (offset*8), m_vgX); |
| 239 | 267 | #endif |
| 240 | 268 | } |
| r15639 | r15640 | |
| 244 | 272 | { |
| 245 | 273 | m_vgY &= 0xFF << ((1-offset)*8); |
| 246 | 274 | m_vgY |= ((UINT16)data) << (offset*8); |
| 247 | | #ifdef VG_VERBOSE |
| 275 | #ifdef VG40_VERBOSE |
| 248 | 276 | logerror("VG: 0x%02X: Y Reg loaded with %04X, new Y value is %04X\n", 0x42+offset, ((UINT16)data) << (offset*8), m_vgY); |
| 249 | 277 | #endif |
| 250 | 278 | } |
| r15639 | r15640 | |
| 253 | 281 | WRITE8_MEMBER(vk100_state::vgERR) |
| 254 | 282 | { |
| 255 | 283 | m_vgERR = data; |
| 256 | | #ifdef VG_VERBOSE |
| 284 | #ifdef VG40_VERBOSE |
| 257 | 285 | logerror("VG: 0x44: ERR Reg loaded with %02X\n", m_vgERR); |
| 258 | 286 | #endif |
| 259 | 287 | } |
| r15639 | r15640 | |
| 267 | 295 | WRITE8_MEMBER(vk100_state::vgSOPS) |
| 268 | 296 | { |
| 269 | 297 | m_vgSOPS = data; |
| 270 | | //#ifdef VG_VERBOSE |
| 298 | #ifdef VG40_VERBOSE |
| 271 | 299 | logerror("VG: 0x45: SOPS Reg loaded with %02X: Blink: %d, Background GRB: %d%d%d, Serial select: %x, Reverse BG/FG: %d\n", m_vgSOPS, (m_vgSOPS>>7)&1, (m_vgSOPS>>6)&1, (m_vgSOPS>>5)&1, (m_vgSOPS>>4)&1, (m_vgSOPS>>1)&7, m_vgSOPS&1); |
| 272 | | //#endif |
| 300 | #endif |
| 273 | 301 | } |
| 274 | 302 | |
| 275 | 303 | /* port 0x46: "PAT" load vg Pattern register */ |
| 276 | 304 | WRITE8_MEMBER(vk100_state::vgPAT) |
| 277 | 305 | { |
| 278 | 306 | m_vgPAT = data; |
| 279 | | #ifdef VG_VERBOSE |
| 307 | #ifdef PAT_DEBUG |
| 308 | for (int i = 7; i >= 0; i--) |
| 309 | { |
| 310 | printf("%s", (data&(1<<i))?"X":"."); |
| 311 | } |
| 312 | printf("\n"); |
| 313 | #endif |
| 314 | #ifdef VG40_VERBOSE |
| 280 | 315 | logerror("VG: 0x46: PAT Reg loaded with %02X\n", m_vgPAT); |
| 281 | 316 | #endif |
| 282 | 317 | } |
| r15639 | r15640 | |
| 289 | 324 | WRITE8_MEMBER(vk100_state::vgPMUL) |
| 290 | 325 | { |
| 291 | 326 | m_vgPMUL = data; |
| 292 | | #ifdef VG_VERBOSE |
| 327 | #ifdef VG40_VERBOSE |
| 293 | 328 | logerror("VG: 0x47: PMUL Reg loaded with %02X\n", m_vgPMUL); |
| 294 | 329 | #endif |
| 295 | 330 | } |
| r15639 | r15640 | |
| 298 | 333 | WRITE8_MEMBER(vk100_state::vgDU) |
| 299 | 334 | { |
| 300 | 335 | m_vgDU = data; |
| 301 | | #ifdef VG_VERBOSE |
| 336 | #ifdef VG60_VERBOSE |
| 302 | 337 | logerror("VG: 0x60: DU Reg loaded with %02X\n", m_vgDU); |
| 303 | 338 | #endif |
| 304 | 339 | } |
| r15639 | r15640 | |
| 307 | 342 | WRITE8_MEMBER(vk100_state::vgDVM) |
| 308 | 343 | { |
| 309 | 344 | m_vgDVM = data; |
| 310 | | #ifdef VG_VERBOSE |
| 345 | #ifdef VG60_VERBOSE |
| 311 | 346 | logerror("VG: 0x61: DVM Reg loaded with %02X\n", m_vgDVM); |
| 312 | 347 | #endif |
| 313 | 348 | } |
| r15639 | r15640 | |
| 316 | 351 | WRITE8_MEMBER(vk100_state::vgDIR) |
| 317 | 352 | { |
| 318 | 353 | m_vgDIR = data; |
| 319 | | #ifdef VG_VERBOSE |
| 354 | #ifdef VG60_VERBOSE |
| 320 | 355 | logerror("VG: 0x62: DIR Reg loaded with %02X\n", m_vgDIR); |
| 321 | 356 | #endif |
| 322 | 357 | } |
| r15639 | r15640 | |
| 330 | 365 | WRITE8_MEMBER(vk100_state::vgWOPS) |
| 331 | 366 | { |
| 332 | 367 | m_vgWOPS = data; |
| 333 | | #ifdef VG_VERBOSE |
| 368 | #ifdef VG60_VERBOSE |
| 334 | 369 | static const char *const functions[] = { "Overlay", "Replace", "Complement", "Erase" }; |
| 335 | 370 | logerror("VG: 0x64: WOPS Reg loaded with %02X: KGRB %d%d%d%d, AttrChange %d, Function %s, Negate %d\n", data, (m_vgWOPS>>7)&1, (m_vgWOPS>>6)&1, (m_vgWOPS>>5)&1, (m_vgWOPS>>4)&1, (m_vgWOPS>>3)&1, functions[(m_vgWOPS>>1)&3], m_vgWOPS&1); |
| 336 | 371 | #endif |
| r15639 | r15640 | |
| 339 | 374 | /* port 0x64: "EX MOV" execute a move (start the state machine) */ |
| 340 | 375 | WRITE8_MEMBER(vk100_state::vgEX_MOV) |
| 341 | 376 | { |
| 342 | | #ifdef VG_VERBOSE |
| 377 | #ifdef VG60_VERBOSE |
| 343 | 378 | logerror("VG Execute Move 0x64 written: stub!\n"); |
| 344 | 379 | #endif |
| 345 | 380 | // TODO: short term: do some calculations here and print the expected starting ram address etc |
| 346 | 381 | // TODO: long term: fire a timer and actually move the ram with correct timing |
| 347 | 382 | m_vgPMUL_Count = m_vgPMUL; // load PMUL_Count |
| 348 | | m_vgPAT_Shift = 1; // load vgPAT_Shift |
| 383 | m_vgPAT_Mask = 0x100; |
| 349 | 384 | m_EX_TYPE = 0; |
| 350 | 385 | m_GO = 1; |
| 351 | 386 | machine().scheduler().timer_set(attotime::zero, FUNC(execute_vg)); |
| r15639 | r15640 | |
| 354 | 389 | /* port 0x65: "EX DOT" execute a dot (start the state machine) */ |
| 355 | 390 | WRITE8_MEMBER(vk100_state::vgEX_DOT) |
| 356 | 391 | { |
| 357 | | #ifdef VG_VERBOSE |
| 392 | #ifdef VG60_VERBOSE |
| 358 | 393 | logerror("VG: 0x65: Execute Dot written: stub!\n"); |
| 359 | 394 | #endif |
| 360 | 395 | // TODO: short term: do some calculations here and print the expected starting ram address etc |
| 361 | 396 | // TODO: long term: fire a timer and actually draw the dot to ram with correct timing |
| 362 | 397 | m_vgPMUL_Count = m_vgPMUL; // load PMUL_Count |
| 363 | | m_vgPAT_Shift = 1; // load vgPAT_Shift |
| 398 | m_vgPAT_Mask = 0x100; // load vgPAT_Mask |
| 364 | 399 | m_EX_TYPE = 1; |
| 365 | 400 | m_GO = 1; |
| 366 | 401 | machine().scheduler().timer_set(attotime::zero, FUNC(execute_vg)); |
| r15639 | r15640 | |
| 369 | 404 | /* port 0x66: "EX VEC" execute a pattern (8 fixed direction) vector (start the state machine) */ |
| 370 | 405 | WRITE8_MEMBER(vk100_state::vgEX_VEC) |
| 371 | 406 | { |
| 372 | | #ifdef VG_VERBOSE |
| 407 | #ifdef VG60_VERBOSE |
| 373 | 408 | logerror("VG: 0x66: Execute Vector written: stub!\n"); |
| 374 | 409 | #endif |
| 375 | 410 | // TODO: short term: do some calculations here and print the expected starting ram address etc |
| 376 | 411 | // TODO: long term: fire a timer and actually draw the vector to ram with correct timing |
| 377 | 412 | m_vgPMUL_Count = m_vgPMUL; // load PMUL_Count |
| 378 | | m_vgPAT_Shift = 1; // load vgPAT_Shift |
| 413 | m_vgPAT_Mask = 0x100; // load vgPAT_Mask |
| 379 | 414 | m_EX_TYPE = 2; |
| 380 | 415 | m_GO = 1; |
| 381 | 416 | machine().scheduler().timer_set(attotime::zero, FUNC(execute_vg)); |
| r15639 | r15640 | |
| 384 | 419 | /* port 0x67: "EX ER" execute an arbitrary bresenham vector (start the state machine) */ |
| 385 | 420 | WRITE8_MEMBER(vk100_state::vgEX_ER) |
| 386 | 421 | { |
| 387 | | #ifdef VG_VERBOSE |
| 422 | #ifdef VG60_VERBOSE |
| 388 | 423 | logerror("VG: 0x67: Execute Arbitrary 'error' vector written: stub!\n"); |
| 389 | 424 | #endif |
| 390 | 425 | // TODO: short term: do some calculations here and print the expected starting ram address etc |
| 391 | 426 | // TODO: long term: fire a timer and actually use the state machine to draw the vector to ram with correct timing |
| 392 | 427 | m_vgPMUL_Count = m_vgPMUL; // load PMUL_Count |
| 393 | | m_vgPAT_Shift = 1; // load vgPAT_Shift |
| 428 | m_vgPAT_Mask = 0x100; // load vgPAT_Mask |
| 394 | 429 | m_EX_TYPE = 3; |
| 395 | 430 | m_GO = 1; |
| 396 | 431 | machine().scheduler().timer_set(attotime::zero, FUNC(execute_vg)); |
| r15639 | r15640 | |
| 406 | 441 | output_set_value("hardcopy_led", BIT(data, 2) ? 1 : 0); |
| 407 | 442 | output_set_value("l1_led", BIT(data, 1) ? 1 : 0); |
| 408 | 443 | output_set_value("l2_led", BIT(data, 0) ? 1 : 0); |
| 444 | #ifdef LED_VERBOSE |
| 409 | 445 | if (BIT(data, 6)) logerror("kb keyclick bit 6 set: not emulated yet (multivibrator)!\n"); |
| 446 | #endif |
| 410 | 447 | beep_set_state( m_speaker, BIT(data, 7)); |
| 411 | 448 | #ifdef LED_VERBOSE |
| 412 | 449 | logerror("LED state: %02X: %s %s %s %s %s %s\n", data&0xFF, (data&0x20)?"------- LOCAL ":"ON LINE ----- ", (data&0x10)?"--------- ":"NO SCROLL ", (data&0x8)?"----- ":"BASIC ", (data&0x4)?"--------- ":"HARD-COPY ", (data&0x2)?"-- ":"L1 ", (data&0x1)?"-- ":"L2 "); |
| r15639 | r15640 | |
| 529 | 566 | |
| 530 | 567 | PORT_START("CAPSSHIFT") // CAPS LOCK and SHIFT appear as the high 2 bits on all rows |
| 531 | 568 | PORT_BIT(0x3f, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 532 | | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps lock") PORT_CODE(KEYCODE_CAPSLOCK) |
| 533 | | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) |
| 534 | | PORT_START("COL0") |
| 569 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) |
| 570 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_TOGGLE PORT_NAME("Caps lock") PORT_CODE(KEYCODE_CAPSLOCK) |
| 571 | PORT_START("COL0") |
| 535 | 572 | PORT_BIT(0x1f, IP_ACTIVE_LOW, IPT_UNUSED) |
| 536 | 573 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) // row 0 bit 6 is always low, checked by keyboard test |
| 537 | 574 | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) // all rows have these bits left low to save a mask op later |
| r15639 | r15640 | |
| 673 | 710 | state->m_vgERR = 0; |
| 674 | 711 | state->m_vgSOPS = 0; |
| 675 | 712 | state->m_vgPAT = 0; |
| 676 | | state->m_vgPAT_Shift = 0x80; |
| 713 | state->m_vgPAT_Mask = 0x80; |
| 677 | 714 | state->m_vgPMUL = 0; |
| 678 | 715 | state->m_vgPMUL_Count = 0; |
| 679 | 716 | state->m_vgDU = 0; |
| r15639 | r15640 | |
| 689 | 726 | static DRIVER_INIT( vk100 ) |
| 690 | 727 | { |
| 691 | 728 | UINT8 *gfx = machine.root_device().memregion("vram")->base(); |
| 692 | | // for debug purposes, set the entire screen to black but with the attributes of all pixels set to white |
| 693 | | for (int i = 1; i < 0x8000; i+=2) |
| 694 | | gfx[i] = 0xF; |
| 729 | // for debug purposes, set the entire screen to a hash pattern |
| 730 | for (int i = 0; i < 0x8000; i+=2) |
| 731 | { |
| 732 | gfx[i] = 0xFA; |
| 733 | gfx[i+1] = 0xAA; |
| 695 | 734 | //gfx[i] = (((i&0x1)?0x00:0xFF)^((i&0x100)?0x00:0xff)); |
| 735 | } |
| 696 | 736 | } |
| 697 | 737 | |
| 698 | 738 | static PALETTE_INIT( vk100 ) |
| r15639 | r15640 | |
| 732 | 772 | |
| 733 | 773 | static MC6845_UPDATE_ROW( vk100_update_row ) |
| 734 | 774 | { |
| 735 | | static const UINT32 colorTable[8] = { 0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF }; |
| 775 | static const UINT32 colorTable[16] = { |
| 776 | 0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF, |
| 777 | 0x000000, 0x0000FF, 0xFF0000, 0xFF00FF, 0x00FF00, 0x00FFFF, 0xFFFF00, 0xFFFFFF }; |
| 736 | 778 | //printf("y=%d, ma=%04x, ra=%02x, x_count=%02x ", y, ma, ra, x_count); |
| 737 | 779 | /* figure out ram address based on tech manual page 5-23: |
| 738 | 780 | * real address to 16-bit chunk a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 |
| r15639 | r15640 | |
| 741 | 783 | vk100_state *state = device->machine().driver_data<vk100_state>(); |
| 742 | 784 | //UINT8 *gfx = device->machine.root_device().memregion("vram")->base(); |
| 743 | 785 | UINT16 EA = ((ma&0xfc0)<<2)|((ra&0x3)<<6)|(ma&0x3F); |
| 744 | | EA <<= 1; // this is needed to address the whole 0000-7fff area since we deal with 16 bit blocks |
| 745 | | //printf("EA: %04X\n", EA); |
| 746 | 786 | // display the 64 different 12-bit-wide chunks |
| 747 | 787 | for (int i = 0; i < 64; i++) |
| 748 | 788 | { |
| 749 | | UINT16 block = state->m_vram[(EA+(2*i))+1] | (state->m_vram[(EA+(2*i))]<<8); // store big endian |
| 750 | | UINT8 fgColor = block&0x7; |
| 751 | | // TODO: blink is NOT HANDLED YET!; is this done by using the cursor output of the CRTC somehow? |
| 752 | | //UINT8 blink = block&0x8; |
| 753 | | UINT8 bgColor = (state->m_vgSOPS&0x70)>>4; |
| 789 | UINT16 block = state->m_vram[(EA<<1)+(2*i)+1] | (state->m_vram[(EA<<1)+(2*i)]<<8); // store big endian |
| 790 | UINT8 fgColor = (block&0xF000)>>12; |
| 791 | // TODO: blink is NOT HANDLED YET! |
| 792 | UINT8 bgColor = (state->m_vgSOPS&0xF0)>>4; |
| 754 | 793 | // display a 12-bit wide chunk |
| 755 | 794 | for (int j = 0; j < 12; j++) |
| 756 | 795 | { |
| 757 | | bitmap.pix32(y, (12*i)+j) = ((block&(0x8000>>j))^(state->m_vgSOPS&1))?colorTable[fgColor]:colorTable[bgColor]; |
| 796 | bitmap.pix32(y, (12*i)+j) = ((block&(0x0001<<j))^(state->m_vgSOPS&1))?colorTable[fgColor]:colorTable[bgColor]; |
| 758 | 797 | } |
| 759 | 798 | } |
| 760 | 799 | } |