trunk/src/emu/cpu/amis2000/amis2000op.inc
| r243263 | r243264 | |
| 187 | 187 | void amis2000_device::op_disb() |
| 188 | 188 | { |
| 189 | 189 | // DISB: set D-latch to ACC and RAM directly |
| 190 | | m_d = m_acc | ram_r() << 4; |
| 191 | | m_write_d(0, m_d, 0xff); |
| 192 | | // TODO: exit from floating mode on D-pins |
| 190 | op_illegal(); |
| 193 | 191 | } |
| 194 | 192 | |
| 195 | 193 | void amis2000_device::op_disn() |
| 196 | 194 | { |
| 197 | | // DISN: set D-latch to ACC+carry via on-die segment decoder |
| 198 | | static const UINT8 lut_segment_decoder[0x10] = |
| 199 | | { |
| 200 | | // 0-F digits in bit order [DP]abcdefg |
| 201 | | 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, 0x77, 0x1f, 0x4e, 0x3d, 0x4f, 0x47 |
| 202 | | }; |
| 203 | | m_d = lut_segment_decoder[m_acc] | (m_carry ? 0x80 : 0x00); |
| 204 | | m_write_d(0, m_d, 0xff); |
| 205 | | // TODO: exit from floating mode on D-pins |
| 195 | // DISN: set D-latch to ACC+carry via segment decoder |
| 196 | op_illegal(); |
| 206 | 197 | } |
| 207 | 198 | |
| 208 | 199 | void amis2000_device::op_mvs() |
| 209 | 200 | { |
| 210 | 201 | // MVS: output master strobe latch to A-pins |
| 211 | | m_write_a(0, m_a, 0xffff); |
| 212 | | // TODO: enter floating mode on D-pins |
| 202 | op_illegal(); |
| 213 | 203 | } |
| 214 | 204 | |
| 215 | 205 | void amis2000_device::op_psh() |
| 216 | 206 | { |
| 217 | 207 | // PSH: preset high(BL) master strobe latch |
| 218 | | switch (m_bl) |
| 219 | | { |
| 220 | | case 0xd: |
| 221 | | // set multiplex operation |
| 222 | | // ? |
| 223 | | break; |
| 224 | | |
| 225 | | case 0xe: |
| 226 | | // exit from floating mode on D-pins |
| 227 | | // ? |
| 228 | | break; |
| 229 | | |
| 230 | | case 0xf: |
| 231 | | // set all latch bits high |
| 232 | | m_a = 0x1fff; |
| 233 | | break; |
| 234 | | |
| 235 | | default: |
| 236 | | // set selected latch bit high |
| 237 | | m_a |= (1 << m_bl); |
| 238 | | break; |
| 239 | | } |
| 208 | op_illegal(); |
| 240 | 209 | } |
| 241 | 210 | |
| 242 | 211 | void amis2000_device::op_psl() |
| 243 | 212 | { |
| 244 | 213 | // PSL: preset low(BL) master strobe latch |
| 245 | | switch (m_bl) |
| 246 | | { |
| 247 | | case 0xd: |
| 248 | | // set static operation |
| 249 | | // ? |
| 250 | | break; |
| 251 | | |
| 252 | | case 0xe: |
| 253 | | // enter floating mode on D-pins |
| 254 | | // ? |
| 255 | | break; |
| 256 | | |
| 257 | | case 0xf: |
| 258 | | // set all latch bits low |
| 259 | | m_a = 0; |
| 260 | | break; |
| 261 | | |
| 262 | | default: |
| 263 | | // set selected latch bit low |
| 264 | | m_a &= ~(1 << m_bl); |
| 265 | | break; |
| 266 | | } |
| 214 | op_illegal(); |
| 267 | 215 | } |
| 268 | 216 | |
| 269 | 217 | void amis2000_device::op_eur() |
trunk/src/osd/sdl/video.c
| r243263 | r243264 | |
| 156 | 156 | #if defined(SDLMAME_WIN32) // Win32 version |
| 157 | 157 | MONITORINFOEX info; |
| 158 | 158 | info.cbSize = sizeof(info); |
| 159 | | GetMonitorInfo((HMONITOR)monitor->handle, (LPMONITORINFO)&info); |
| 160 | | monitor->m_dimensions.x = monitor->m_dimensions.y = 0; |
| 161 | | monitor->m_center_width = monitor->m_dimensions.w = info.rcMonitor.right - info.rcMonitor.left; |
| 162 | | monitor->m_center_height = monitor->m_dimensions.h = info.rcMonitor.bottom - info.rcMonitor.top; |
| 159 | GetMonitorInfo((HMONITOR)m_handle, (LPMONITORINFO)&info); |
| 160 | m_dimensions.x = m_dimensions.y = 0; |
| 161 | m_center_width = m_dimensions.w = info.rcMonitor.right - info.rcMonitor.left; |
| 162 | m_center_height = m_dimensions.h = info.rcMonitor.bottom - info.rcMonitor.top; |
| 163 | 163 | char *temp = utf8_from_wstring(info.szDevice); |
| 164 | | strcpy(monitor->monitor_device, temp); |
| 164 | strcpy(m_monitor_device, temp); |
| 165 | 165 | osd_free(temp); |
| 166 | 166 | #elif defined(SDLMAME_MACOSX) // Mac OS X Core Imaging version |
| 167 | 167 | CGDirectDisplayID primary; |
| r243263 | r243264 | |
| 171 | 171 | primary = CGMainDisplayID(); |
| 172 | 172 | dbounds = CGDisplayBounds(primary); |
| 173 | 173 | |
| 174 | | monitor->center_width = monitor->monitor_width = dbounds.size.width - dbounds.origin.x; |
| 175 | | monitor->center_height = monitor->monitor_height = dbounds.size.height - dbounds.origin.y; |
| 176 | | strcpy(monitor->monitor_device, "Mac OS X display"); |
| 174 | m_dimensions.x = m_dimensions.y = 0; |
| 175 | m_center_width = m_dimensions.w = dbounds.size.width - dbounds.origin.x; |
| 176 | m_center_height = m_dimensions.h = dbounds.size.height - dbounds.origin.y; |
| 177 | strcpy(m_monitor_device, "Mac OS X display"); |
| 177 | 178 | #elif defined(SDLMAME_X11) || defined(SDLMAME_NO_X11) // X11 version |
| 178 | 179 | { |
| 179 | 180 | #if defined(SDLMAME_X11) |
| r243263 | r243264 | |
| 185 | 186 | if ( SDL_GetWMInfo(&info) && (info.subsystem == SDL_SYSWM_X11) ) |
| 186 | 187 | { |
| 187 | 188 | screen = DefaultScreen(info.info.x11.display); |
| 188 | | SDL_VideoDriverName(monitor->monitor_device, sizeof(monitor->monitor_device)-1); |
| 189 | | monitor->monitor_width = DisplayWidth(info.info.x11.display, screen); |
| 190 | | monitor->monitor_height = DisplayHeight(info.info.x11.display, screen); |
| 189 | SDL_VideoDriverName(m_monitor_device, sizeof(m_monitor_device)-1); |
| 190 | m_dimensions.x = m_dimensions.y = 0; |
| 191 | m_dimensions.w = DisplayWidth(info.info.x11.display, screen); |
| 192 | m_dimensions.h = DisplayHeight(info.info.x11.display, screen); |
| 191 | 193 | |
| 192 | 194 | if ((XineramaIsActive(info.info.x11.display)) && video_config.restrictonemonitor) |
| 193 | 195 | { |
| r243263 | r243264 | |
| 196 | 198 | |
| 197 | 199 | xineinfo = XineramaQueryScreens(info.info.x11.display, &numscreens); |
| 198 | 200 | |
| 199 | | monitor->center_width = xineinfo[0].width; |
| 200 | | monitor->center_height = xineinfo[0].height; |
| 201 | m_center_width = xineinfo[0].width; |
| 202 | m_center_height = xineinfo[0].height; |
| 201 | 203 | |
| 202 | 204 | XFree(xineinfo); |
| 203 | 205 | } |
| 204 | 206 | else |
| 205 | 207 | { |
| 206 | | monitor->center_width = monitor->monitor_width; |
| 207 | | monitor->center_height = monitor->monitor_height; |
| 208 | m_center_width = m_dimensions.w; |
| 209 | m_center_height = m_dimensions.h; |
| 208 | 210 | } |
| 209 | 211 | } |
| 210 | 212 | else |
| r243263 | r243264 | |
| 213 | 215 | static int first_call=0; |
| 214 | 216 | static int cw = 0, ch = 0; |
| 215 | 217 | |
| 216 | | SDL_VideoDriverName(monitor->monitor_device, sizeof(monitor->monitor_device)-1); |
| 218 | SDL_VideoDriverName(m_monitor_device, sizeof(m_monitor_device)-1); |
| 217 | 219 | if (first_call==0) |
| 218 | 220 | { |
| 219 | 221 | const char *dimstr = osd_getenv(SDLENV_DESKTOPDIM); |
| r243263 | r243264 | |
| 233 | 235 | } |
| 234 | 236 | if ((cw==0) || (ch==0)) |
| 235 | 237 | { |
| 236 | | osd_printf_warning("WARNING: SDL_GetVideoInfo() for driver <%s> is broken.\n", monitor->monitor_device); |
| 238 | osd_printf_warning("WARNING: SDL_GetVideoInfo() for driver <%s> is broken.\n", m_monitor_device); |
| 237 | 239 | osd_printf_warning(" You should set SDLMAME_DESKTOPDIM to your desktop size.\n"); |
| 238 | 240 | osd_printf_warning(" e.g. export SDLMAME_DESKTOPDIM=800x600\n"); |
| 239 | 241 | osd_printf_warning(" Assuming 1024x768 now!\n"); |
| r243263 | r243264 | |
| 242 | 244 | } |
| 243 | 245 | } |
| 244 | 246 | } |
| 245 | | monitor->monitor_width = cw; |
| 246 | | monitor->monitor_height = ch; |
| 247 | | monitor->center_width = cw; |
| 248 | | monitor->center_height = ch; |
| 247 | m_dimensions.w = cw; |
| 248 | m_dimensions.h = ch; |
| 249 | m_center_width = cw; |
| 250 | m_center_height = ch; |
| 249 | 251 | } |
| 250 | 252 | } |
| 251 | 253 | #elif defined(SDLMAME_OS2) // OS2 version |
| 252 | | monitor->center_width = monitor->monitor_width = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); |
| 253 | | monitor->center_height = monitor->monitor_height = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ); |
| 254 | | strcpy(monitor->monitor_device, "OS/2 display"); |
| 254 | m_dimensions.x = m_dimensions.y = 0; |
| 255 | m_center_width = m_dimensions.w = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); |
| 256 | m_center_height = m_dimensions.h = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ); |
| 257 | strcpy(m_monitor_device, "OS/2 display"); |
| 255 | 258 | #else |
| 256 | 259 | #error Unknown SDLMAME_xx OS type! |
| 257 | 260 | #endif |
| r243263 | r243264 | |
| 260 | 263 | static int info_shown=0; |
| 261 | 264 | if (!info_shown) |
| 262 | 265 | { |
| 263 | | osd_printf_verbose("SDL Device Driver : %s\n", monitor->monitor_device); |
| 264 | | osd_printf_verbose("SDL Monitor Dimensions: %d x %d\n", monitor->monitor_width, monitor->monitor_height); |
| 266 | osd_printf_verbose("SDL Device Driver : %s\n", m_monitor_device); |
| 267 | osd_printf_verbose("SDL Monitor Dimensions: %d x %d\n", m_dimensions.w, m_dimensions.h); |
| 265 | 268 | info_shown = 1; |
| 266 | 269 | } |
| 267 | 270 | } |
| r243263 | r243264 | |
| 323 | 326 | //============================================================ |
| 324 | 327 | |
| 325 | 328 | #if !defined(SDLMAME_WIN32) && !(SDLMAME_SDL2) |
| 326 | | static void add_primary_monitor(void *data) |
| 329 | void sdl_monitor_info::add_primary_monitor(void *data) |
| 327 | 330 | { |
| 328 | 331 | sdl_monitor_info ***tailptr = (sdl_monitor_info ***)data; |
| 329 | 332 | sdl_monitor_info *monitor; |
| r243263 | r243264 | |
| 332 | 335 | monitor = global_alloc_clear(sdl_monitor_info); |
| 333 | 336 | |
| 334 | 337 | // copy in the data |
| 335 | | monitor->handle = 1; |
| 338 | monitor->m_handle = 1; |
| 336 | 339 | |
| 337 | | sdlvideo_monitor_refresh(monitor); |
| 340 | monitor->refresh(); |
| 338 | 341 | |
| 339 | 342 | // guess the aspect ratio assuming square pixels |
| 340 | | monitor->aspect = (float)(monitor->monitor_width) / (float)(monitor->monitor_height); |
| 343 | monitor->m_aspect = (float)(monitor->m_dimensions.w) / (float)(monitor->m_dimensions.h); |
| 341 | 344 | |
| 342 | 345 | // save the primary monitor handle |
| 343 | 346 | primary_monitor = monitor; |
| 344 | 347 | |
| 345 | 348 | // hook us into the list |
| 346 | 349 | **tailptr = monitor; |
| 347 | | *tailptr = &monitor->next; |
| 350 | *tailptr = &monitor->m_next; |
| 348 | 351 | } |
| 349 | 352 | #endif |
| 350 | 353 | |
| r243263 | r243264 | |
| 367 | 370 | assert(result); |
| 368 | 371 | (void)result; // to silence gcc 4.6 |
| 369 | 372 | |
| 370 | | // allocate a new monitor info |
| 371 | | monitor = global_alloc_clear(sdl_monitor_info); |
| 373 | // guess the aspect ratio assuming square pixels |
| 374 | float aspect = (float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top); |
| 372 | 375 | |
| 373 | | // copy in the data |
| 374 | | |
| 375 | | #ifdef PTR64 |
| 376 | | monitor->handle = (UINT64)handle; |
| 377 | | #else |
| 378 | | monitor->handle = (UINT32)handle; |
| 379 | | #endif |
| 380 | | monitor->monitor_width = info.rcMonitor.right - info.rcMonitor.left; |
| 381 | | monitor->monitor_height = info.rcMonitor.bottom - info.rcMonitor.top; |
| 382 | | monitor->center_width = monitor->monitor_width; |
| 383 | | monitor->center_height = monitor->monitor_height; |
| 376 | // allocate a new monitor info |
| 384 | 377 | char *temp = utf8_from_wstring(info.szDevice); |
| 385 | | strcpy(monitor->monitor_device, temp); |
| 378 | // copy in the data |
| 379 | monitor = global_alloc(sdl_monitor_info((UINT64) handle, temp, aspect)); |
| 386 | 380 | osd_free(temp); |
| 387 | 381 | |
| 388 | | // guess the aspect ratio assuming square pixels |
| 389 | | monitor->aspect = (float)(info.rcMonitor.right - info.rcMonitor.left) / (float)(info.rcMonitor.bottom - info.rcMonitor.top); |
| 390 | | |
| 391 | 382 | // save the primary monitor handle |
| 392 | 383 | if (info.dwFlags & MONITORINFOF_PRIMARY) |
| 393 | | primary_monitor = monitor; |
| 384 | sdl_monitor_info::primary_monitor = monitor; |
| 394 | 385 | |
| 395 | 386 | // hook us into the list |
| 396 | 387 | **tailptr = monitor; |
| 397 | | *tailptr = &monitor->next; |
| 388 | *tailptr = &monitor->m_next; |
| 398 | 389 | |
| 399 | 390 | // enumerate all the available monitors so to list their names in verbose mode |
| 400 | 391 | return TRUE; |
| r243263 | r243264 | |
| 449 | 440 | |
| 450 | 441 | // hook us into the list |
| 451 | 442 | *tailptr = monitor; |
| 452 | | tailptr = &monitor->next; |
| 443 | tailptr = &monitor->m_next; |
| 453 | 444 | } |
| 454 | 445 | } |
| 455 | 446 | osd_printf_verbose("Leave init_monitors\n"); |
| r243263 | r243264 | |
| 466 | 457 | while (sdl_monitor_info::list != NULL) |
| 467 | 458 | { |
| 468 | 459 | sdl_monitor_info *temp = sdl_monitor_info::list; |
| 469 | | sdl_monitor_info::list = temp->next; |
| 460 | sdl_monitor_info::list = temp->next(); |
| 470 | 461 | global_free(temp); |
| 471 | 462 | } |
| 472 | 463 | } |
| r243263 | r243264 | |
| 498 | 489 | // look for a match in the name first |
| 499 | 490 | if (scrname != NULL) |
| 500 | 491 | { |
| 501 | | for (monitor = sdl_monitor_info::list; monitor != NULL; monitor = monitor->next) |
| 492 | for (monitor = sdl_monitor_info::list; monitor != NULL; monitor = monitor->next()) |
| 502 | 493 | { |
| 503 | 494 | moncount++; |
| 504 | 495 | if (strcmp(scrname, monitor->device()) == 0) |
| r243263 | r243264 | |
| 508 | 499 | |
| 509 | 500 | // didn't find it; alternate monitors until we hit the jackpot |
| 510 | 501 | index %= moncount; |
| 511 | | for (monitor = sdl_monitor_info::list; monitor != NULL; monitor = monitor->next) |
| 502 | for (monitor = sdl_monitor_info::list; monitor != NULL; monitor = monitor->next()) |
| 512 | 503 | if (index-- == 0) |
| 513 | 504 | goto finishit; |
| 514 | 505 | |
| r243263 | r243264 | |
| 523 | 514 | return monitor; |
| 524 | 515 | } |
| 525 | 516 | #else |
| 526 | | static sdl_monitor_info *pick_monitor(sdl_options &options, int index) |
| 517 | sdl_monitor_info *sdl_monitor_info::pick_monitor(sdl_options &options, int index) |
| 527 | 518 | { |
| 528 | 519 | sdl_monitor_info *monitor; |
| 529 | 520 | float aspect; |
| r243263 | r243264 | |
| 536 | 527 | |
| 537 | 528 | if (aspect != 0) |
| 538 | 529 | { |
| 539 | | monitor->aspect = aspect; |
| 530 | monitor->m_aspect = aspect; |
| 540 | 531 | } |
| 541 | 532 | return monitor; |
| 542 | 533 | } |
trunk/src/osd/sdl/video.h
| r243263 | r243264 | |
| 58 | 58 | int height; |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | // FIXME: This is sort of ugly ... and should be a real interface only |
| 61 | 62 | class sdl_monitor_info |
| 62 | 63 | { |
| 63 | 64 | public: |
| 64 | | sdl_monitor_info * next; // pointer to next monitor in list |
| 65 | 65 | |
| 66 | sdl_monitor_info() |
| 67 | : m_next(NULL), m_handle(0), m_aspect(0.0f), |
| 68 | m_center_width(0), m_center_height(0) |
| 69 | {} |
| 70 | sdl_monitor_info(const UINT64 handle, const char *monitor_device, float aspect) |
| 71 | : m_next(NULL), m_handle(handle), m_aspect(aspect), |
| 72 | m_center_width(0), m_center_height(0) |
| 73 | { |
| 74 | strncpy(m_monitor_device, monitor_device, 64); |
| 75 | refresh(); |
| 76 | } |
| 77 | |
| 66 | 78 | const UINT64 handle() { return m_handle; } |
| 67 | 79 | const SDL_Rect &position_size() { refresh(); return m_dimensions; } |
| 68 | 80 | |
| 69 | 81 | const char *device() { return m_monitor_device; } |
| 70 | 82 | |
| 71 | 83 | float aspect(); |
| 84 | |
| 72 | 85 | int center_width() { refresh(); return m_center_width; } |
| 73 | 86 | int center_height() { refresh(); return m_center_height; } |
| 74 | 87 | |
| r243263 | r243264 | |
| 78 | 91 | static void init(); |
| 79 | 92 | static void exit(); |
| 80 | 93 | static sdl_monitor_info *pick_monitor(sdl_options &options, int index); |
| 94 | #if !defined(SDLMAME_WIN32) && !(SDLMAME_SDL2) |
| 95 | static void add_primary_monitor(void *data); |
| 96 | #endif |
| 81 | 97 | |
| 98 | sdl_monitor_info * next() { return m_next; } // pointer to next monitor in list |
| 99 | |
| 100 | // STATIC |
| 101 | static sdl_monitor_info *primary_monitor; |
| 102 | static sdl_monitor_info *list; |
| 103 | |
| 104 | // FIXME: shouldn't be here - see windows enumeration callback |
| 105 | sdl_monitor_info * m_next; // pointer to next monitor in list |
| 82 | 106 | private: |
| 83 | 107 | void refresh(); |
| 84 | 108 | |
| r243263 | r243264 | |
| 89 | 113 | int m_center_width; // width of first physical screen for centering |
| 90 | 114 | int m_center_height; // height of first physical screen for centering |
| 91 | 115 | |
| 92 | | // STATIC |
| 93 | | static sdl_monitor_info *primary_monitor; |
| 94 | | static sdl_monitor_info *list; |
| 95 | 116 | |
| 96 | 117 | }; |
| 97 | 118 | |