trunk/src/osd/windows/ledutil.c
| r24077 | r24078 | |
| 104 | 104 | // LED methods |
| 105 | 105 | #define LED_METHOD_PS2 0 |
| 106 | 106 | #define LED_METHOD_USB 1 |
| 107 | | #define LED_METHOD_WIN9X 2 |
| 108 | 107 | |
| 109 | 108 | // window parameters |
| 110 | 109 | #define WINDOW_CLASS TEXT("LEDSample") |
| r24077 | r24078 | |
| 508 | 507 | |
| 509 | 508 | static void output_startup(const char *commandline) |
| 510 | 509 | { |
| 511 | | OSVERSIONINFO osinfo = { sizeof(OSVERSIONINFO) }; |
| 512 | | |
| 513 | 510 | // default to PS/2, override if USB is specified as a parameter |
| 514 | 511 | ledmethod = LED_METHOD_PS2; |
| 515 | 512 | if (commandline != NULL && strcmp(commandline, "-usb") == 0) |
| 516 | 513 | ledmethod = LED_METHOD_USB; |
| 517 | 514 | |
| 518 | | // force Win9x method if we're on Win 9x |
| 519 | | GetVersionEx(&osinfo); |
| 520 | | if (osinfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) |
| 521 | | ledmethod = LED_METHOD_WIN9X; |
| 522 | | |
| 523 | 515 | // output the method |
| 524 | 516 | switch (ledmethod) |
| 525 | 517 | { |
| r24077 | r24078 | |
| 530 | 522 | case LED_METHOD_USB: |
| 531 | 523 | DEBUG_PRINTF(("Using USB method\n")); |
| 532 | 524 | break; |
| 533 | | |
| 534 | | case LED_METHOD_WIN9X: |
| 535 | | DEBUG_PRINTF(("Using Win9x method\n")); |
| 536 | | break; |
| 537 | 525 | } |
| 538 | 526 | } |
| 539 | 527 | |
| r24077 | r24078 | |
| 653 | 641 | |
| 654 | 642 | switch (ledmethod) |
| 655 | 643 | { |
| 656 | | case LED_METHOD_WIN9X: |
| 657 | 644 | case LED_METHOD_USB: |
| 658 | 645 | { |
| 659 | 646 | BYTE key_states[256]; |
| r24077 | r24078 | |
| 704 | 691 | |
| 705 | 692 | switch (ledmethod) |
| 706 | 693 | { |
| 707 | | case LED_METHOD_WIN9X: |
| 708 | | { |
| 709 | | // thanks to Lee Taylor for the original version of this code |
| 710 | | BYTE key_states[256]; |
| 711 | | |
| 712 | | // get the current state |
| 713 | | GetKeyboardState(&key_states[0]); |
| 714 | | |
| 715 | | // mask states and set new states |
| 716 | | key_states[VK_NUMLOCK] = (key_states[VK_NUMLOCK] & ~1) | ((state >> 0) & 1); |
| 717 | | key_states[VK_CAPITAL] = (key_states[VK_CAPITAL] & ~1) | ((state >> 1) & 1); |
| 718 | | key_states[VK_SCROLL] = (key_states[VK_SCROLL] & ~1) | ((state >> 2) & 1); |
| 719 | | |
| 720 | | SetKeyboardState(&key_states[0]); |
| 721 | | break; |
| 722 | | } |
| 723 | | |
| 724 | 694 | case LED_METHOD_USB: |
| 725 | 695 | { |
| 726 | 696 | static const BYTE vk[3] = { VK_NUMLOCK, VK_CAPITAL, VK_SCROLL }; |
trunk/src/lib/formats/oric_dsk.c
| r24077 | r24078 | |
| 52 | 52 | |
| 53 | 53 | floppy_image_read(floppy, header, 0, mfm_disk_header_size); |
| 54 | 54 | if ( memcmp( header, MFM_ID, 8 ) ==0) { |
| 55 | | int heads = pick_integer_le(header, 8, 4); |
| 56 | | int tracks = pick_integer_le(header, 12, 4); |
| 55 | UINT32 heads = pick_integer_le(header, 8, 4); |
| 56 | UINT32 tracks = pick_integer_le(header, 12, 4); |
| 57 | 57 | |
| 58 | 58 | if (floppy_image_size(floppy)==((tracks*heads*TRACK_SIZE_MFM)+mfm_disk_header_size)) { |
| 59 | 59 | *vote = 100; |
trunk/src/lib/formats/d64_dsk.c
| r24077 | r24078 | |
| 113 | 113 | |
| 114 | 114 | int d64_format::find_size(io_generic *io, UINT32 form_factor) |
| 115 | 115 | { |
| 116 | | int size = io_generic_size(io); |
| 116 | UINT64 size = io_generic_size(io); |
| 117 | 117 | for(int i=0; formats[i].sector_count; i++) { |
| 118 | 118 | const format &f = formats[i]; |
| 119 | | if(size == f.sector_count*f.sector_base_size) |
| 119 | if(size == (UINT32) f.sector_count*f.sector_base_size) |
| 120 | 120 | return i; |
| 121 | | if(size == (f.sector_count*f.sector_base_size) + f.sector_count) |
| 121 | if(size == (UINT32) (f.sector_count*f.sector_base_size) + f.sector_count) |
| 122 | 122 | return i; |
| 123 | 123 | } |
| 124 | 124 | return -1; |
| r24077 | r24078 | |
| 218 | 218 | return false; |
| 219 | 219 | |
| 220 | 220 | const format &f = formats[type]; |
| 221 | | int size = io_generic_size(io); |
| 221 | UINT64 size = io_generic_size(io); |
| 222 | 222 | UINT8 *img; |
| 223 | 223 | |
| 224 | | if(size == f.sector_count*f.sector_base_size) { |
| 224 | if(size == (UINT32)f.sector_count*f.sector_base_size) { |
| 225 | 225 | img = global_alloc_array(UINT8, size + f.sector_count); |
| 226 | 226 | memset(&img[size], ERROR_00, f.sector_count); |
| 227 | 227 | } |
trunk/src/lib/formats/pc98fdi_dsk.c
| r24077 | r24078 | |
| 63 | 63 | |
| 64 | 64 | int pc98fdi_format::identify(io_generic *io, UINT32 form_factor) |
| 65 | 65 | { |
| 66 | | int size = io_generic_size(io); |
| 66 | UINT64 size = io_generic_size(io); |
| 67 | 67 | UINT8 h[32]; |
| 68 | 68 | |
| 69 | 69 | io_generic_read(io, h, 0, 32); |
| 70 | | int hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8)); |
| 71 | | int psize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0xc)); |
| 72 | | int ssize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10)); |
| 73 | | int scnt = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14)); |
| 74 | | int sides = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18)); |
| 75 | | int ntrk = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)); |
| 70 | UINT32 hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x8)); |
| 71 | UINT32 psize = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0xc)); |
| 72 | UINT32 ssize = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x10)); |
| 73 | UINT32 scnt = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x14)); |
| 74 | UINT32 sides = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x18)); |
| 75 | UINT32 ntrk = LITTLE_ENDIANIZE_INT32(*(UINT32 *) (h + 0x1c)); |
| 76 | 76 | if(size == hsize + psize && psize == ssize*scnt*sides*ntrk) |
| 77 | 77 | return 100; |
| 78 | 78 | |
| r24077 | r24078 | |
| 85 | 85 | |
| 86 | 86 | io_generic_read(io, h, 0, 32); |
| 87 | 87 | |
| 88 | | int hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8)); |
| 89 | | int sector_size = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10)); |
| 90 | | int sector_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14)); |
| 91 | | int head_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18)); |
| 92 | | int track_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)); |
| 88 | UINT32 hsize = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x8)); |
| 89 | UINT32 sector_size = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x10)); |
| 90 | UINT32 sector_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x14)); |
| 91 | UINT32 head_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x18)); |
| 92 | UINT32 track_count = LITTLE_ENDIANIZE_INT32(*(UINT32 *)(h+0x1c)); |
| 93 | 93 | |
| 94 | 94 | int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666; |
| 95 | 95 | |
trunk/src/lib/formats/coco_dsk.c
| r24077 | r24078 | |
| 487 | 487 | static int coco_vdk_decode_header(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry) |
| 488 | 488 | { |
| 489 | 489 | UINT8 header[12]; |
| 490 | | int heads, tracks, sectors, sector_length, offset; |
| 490 | UINT8 heads, tracks, sectors; |
| 491 | UINT16 sector_length, offset; |
| 491 | 492 | UINT64 size; |
| 492 | 493 | |
| 493 | 494 | size = floppy_image_size(floppy); |
| r24077 | r24078 | |
| 508 | 509 | sectors = 18; |
| 509 | 510 | sector_length = 0x100; |
| 510 | 511 | |
| 511 | | offset = ((int) header[3]) * 0x100 + header[2]; |
| 512 | offset = header[3] * 0x100 + header[2]; |
| 512 | 513 | |
| 513 | | if (size != (heads * tracks * sectors * sector_length + offset)) |
| 514 | if (size != ((UINT32) heads * tracks * sectors * sector_length + offset)) |
| 514 | 515 | return -1; |
| 515 | 516 | |
| 516 | 517 | if (geometry) |
trunk/src/lib/formats/esq16_dsk.c
| r24077 | r24078 | |
| 68 | 68 | return true; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | | void esqimg_format::find_size(io_generic *io, int &track_count, int &head_count, int §or_count) |
| 71 | void esqimg_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 §or_count) |
| 72 | 72 | { |
| 73 | | int size = io_generic_size(io); |
| 73 | UINT64 size = io_generic_size(io); |
| 74 | 74 | track_count = 80; |
| 75 | 75 | head_count = 2; |
| 76 | 76 | sector_count = 10; |
| 77 | 77 | |
| 78 | | if (size == 512*track_count*head_count*sector_count) |
| 78 | UINT32 expected_size = 512 * track_count*head_count*sector_count; |
| 79 | if (size == expected_size) |
| 79 | 80 | { |
| 80 | 81 | return; |
| 81 | 82 | } |
| r24077 | r24078 | |
| 85 | 86 | |
| 86 | 87 | int esqimg_format::identify(io_generic *io, UINT32 form_factor) |
| 87 | 88 | { |
| 88 | | int track_count, head_count, sector_count; |
| 89 | UINT8 track_count, head_count, sector_count; |
| 89 | 90 | find_size(io, track_count, head_count, sector_count); |
| 90 | 91 | |
| 91 | 92 | if(track_count) |
| r24077 | r24078 | |
| 95 | 96 | |
| 96 | 97 | bool esqimg_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) |
| 97 | 98 | { |
| 98 | | int track_count, head_count, sector_count; |
| 99 | UINT8 track_count, head_count, sector_count; |
| 99 | 100 | find_size(io, track_count, head_count, sector_count); |
| 100 | 101 | |
| 101 | 102 | UINT8 sectdata[10*512]; |
trunk/src/lib/formats/ap_dsk35.c
| r24077 | r24078 | |
| 1259 | 1259 | int dc42_format::identify(io_generic *io, UINT32 form_factor) |
| 1260 | 1260 | { |
| 1261 | 1261 | UINT8 h[0x54]; |
| 1262 | | int size = io_generic_size(io); |
| 1262 | UINT64 size = io_generic_size(io); |
| 1263 | 1263 | if(size < 0x54) |
| 1264 | 1264 | return 0; |
| 1265 | 1265 | |
| 1266 | 1266 | io_generic_read(io, h, 0, 0x54); |
| 1267 | | int dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43]; |
| 1268 | | int tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47]; |
| 1267 | UINT32 dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43]; |
| 1268 | UINT32 tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47]; |
| 1269 | 1269 | |
| 1270 | 1270 | return dsize > 0 && tsize >= 0 && size == 0x54+tsize+dsize && h[0] < 64 && h[0x52] == 1 && h[0x53] == 0 ? 100 : 0; |
| 1271 | 1271 | } |
trunk/src/lib/formats/st_dsk.c
| r24077 | r24078 | |
| 66 | 66 | return true; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | | void st_format::find_size(io_generic *io, int &track_count, int &head_count, int §or_count) |
| 69 | void st_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 §or_count) |
| 70 | 70 | { |
| 71 | | int size = io_generic_size(io); |
| 71 | UINT64 size = io_generic_size(io); |
| 72 | 72 | for(track_count=80; track_count <= 82; track_count++) |
| 73 | 73 | for(head_count=1; head_count <= 2; head_count++) |
| 74 | 74 | for(sector_count=9; sector_count <= 11; sector_count++) |
| 75 | | if(size == 512*track_count*head_count*sector_count) |
| 75 | if(size == (UINT32)512*track_count*head_count*sector_count) |
| 76 | 76 | return; |
| 77 | 77 | track_count = head_count = sector_count = 0; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | int st_format::identify(io_generic *io, UINT32 form_factor) |
| 81 | 81 | { |
| 82 | | int track_count, head_count, sector_count; |
| 82 | UINT8 track_count, head_count, sector_count; |
| 83 | 83 | find_size(io, track_count, head_count, sector_count); |
| 84 | 84 | |
| 85 | 85 | if(track_count) |
| r24077 | r24078 | |
| 89 | 89 | |
| 90 | 90 | bool st_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) |
| 91 | 91 | { |
| 92 | | int track_count, head_count, sector_count; |
| 92 | UINT8 track_count, head_count, sector_count; |
| 93 | 93 | find_size(io, track_count, head_count, sector_count); |
| 94 | 94 | |
| 95 | 95 | UINT8 sectdata[11*512]; |
trunk/src/lib/formats/thom_dsk.c
| r24077 | r24078 | |
| 251 | 251 | { |
| 252 | 252 | struct FloppyCallbacks *callbacks; |
| 253 | 253 | struct sap_dsk_tag *tag; |
| 254 | | int i,j; |
| 254 | int j; |
| 255 | 255 | UINT8 fmt; |
| 256 | 256 | tag = (struct sap_dsk_tag *) floppy_create_tag(floppy, sizeof(struct sap_dsk_tag)); |
| 257 | 257 | if (!tag) |
| r24077 | r24078 | |
| 263 | 263 | |
| 264 | 264 | /* start with an empty offset table */ |
| 265 | 265 | tag->tracks = 0; |
| 266 | | for ( i = 0; i < 80; i++ ) |
| 266 | for ( int i = 0; i < 80; i++ ) |
| 267 | 267 | for ( j = 0; j < 16; j++ ) |
| 268 | 268 | tag->sector_pos[i][j] = 0; |
| 269 | 269 | |
| 270 | 270 | /* count tracks & fill sector offset table */ |
| 271 | | for ( i = 0x42; i+4 < floppy_image_size(floppy); i += tag->sector_size + 6 ) // CRC 2 bytes + 4 bytes sector header |
| 271 | for ( UINT64 i = 0x42; i+4 < floppy_image_size(floppy); i += tag->sector_size + 6 ) // CRC 2 bytes + 4 bytes sector header |
| 272 | 272 | { |
| 273 | 273 | UINT8 sector, track; |
| 274 | 274 | floppy_image_read(floppy, &track, i+2, 1); |
trunk/src/lib/formats/ap2_dsk.c
| r24077 | r24078 | |
| 576 | 576 | |
| 577 | 577 | int a2_16sect_format::identify(io_generic *io, UINT32 form_factor) |
| 578 | 578 | { |
| 579 | | int size = io_generic_size(io); |
| 580 | | int expected_size = 35 * 16 * 256; |
| 579 | UINT64 size = io_generic_size(io); |
| 580 | UINT32 expected_size = 35 * 16 * 256; |
| 581 | 581 | return size == expected_size; |
| 582 | 582 | } |
| 583 | 583 | |
| r24077 | r24078 | |
| 935 | 935 | |
| 936 | 936 | int a2_rwts18_format::identify(io_generic *io, UINT32 form_factor) |
| 937 | 937 | { |
| 938 | | int size = io_generic_size(io); |
| 939 | | int expected_size = 35 * 16 * 256; |
| 938 | UINT64 size = io_generic_size(io); |
| 939 | UINT32 expected_size = 35 * 16 * 256; |
| 940 | 940 | return size == expected_size; |
| 941 | 941 | } |
| 942 | 942 | |
trunk/src/emu/debug/debugcmd.c
| r24077 | r24078 | |
| 2061 | 2061 | return; |
| 2062 | 2062 | |
| 2063 | 2063 | cheat_map *newmap = auto_alloc_array(machine, cheat_map, cheat.length + real_length); |
| 2064 | | for (int item = 0; item < cheat.length; item++) |
| 2064 | for (UINT64 item = 0; item < cheat.length; item++) |
| 2065 | 2065 | newmap[item] = cheat.cheatmap[item]; |
| 2066 | 2066 | auto_free(machine, cheat.cheatmap); |
| 2067 | 2067 | cheat.cheatmap = newmap; |
| r24077 | r24078 | |
| 2373 | 2373 | int cur_data_size; |
| 2374 | 2374 | int data_count = 0; |
| 2375 | 2375 | int found = 0; |
| 2376 | | UINT64 i, j; |
| 2376 | int j; |
| 2377 | 2377 | |
| 2378 | 2378 | /* validate parameters */ |
| 2379 | 2379 | if (!debug_command_parameter_number(machine, param[0], &offset)) |
| r24077 | r24078 | |
| 2391 | 2391 | cur_data_size = 1; |
| 2392 | 2392 | |
| 2393 | 2393 | /* parse the data parameters */ |
| 2394 | | for (i = 2; i < params; i++) |
| 2394 | for (int i = 2; i < params; i++) |
| 2395 | 2395 | { |
| 2396 | 2396 | const char *pdata = param[i]; |
| 2397 | 2397 | |
| r24077 | r24078 | |
| 2426 | 2426 | } |
| 2427 | 2427 | |
| 2428 | 2428 | /* now search */ |
| 2429 | | for (i = offset; i <= endoffset; i += data_size[0]) |
| 2429 | for (UINT64 i = offset; i <= endoffset; i += data_size[0]) |
| 2430 | 2430 | { |
| 2431 | 2431 | int suboffset = 0; |
| 2432 | 2432 | int match = 1; |
| r24077 | r24078 | |
| 2469 | 2469 | int minbytes, maxbytes, byteswidth; |
| 2470 | 2470 | address_space *space; |
| 2471 | 2471 | FILE *f = NULL; |
| 2472 | | int i, j; |
| 2472 | int j; |
| 2473 | 2473 | |
| 2474 | 2474 | /* validate parameters */ |
| 2475 | 2475 | if (!debug_command_parameter_number(machine, param[1], &offset)) |
| r24077 | r24078 | |
| 2501 | 2501 | } |
| 2502 | 2502 | |
| 2503 | 2503 | /* now write the data out */ |
| 2504 | | for (i = 0; i < length; ) |
| 2504 | for (UINT64 i = 0; i < length; ) |
| 2505 | 2505 | { |
| 2506 | 2506 | int pcbyte = space->address_to_byte(offset + i) & space->bytemask(); |
| 2507 | 2507 | char output[512], disasm[200]; |
| r24077 | r24078 | |
| 2677 | 2677 | |
| 2678 | 2678 | /* loop over lines */ |
| 2679 | 2679 | int maxbytes = debug->max_opcode_bytes(); |
| 2680 | | for (int index = 0; index < count; index++) |
| 2680 | for (int index = 0; index < (int) count; index++) |
| 2681 | 2681 | { |
| 2682 | 2682 | offs_t pc = debug->history_pc(-index); |
| 2683 | 2683 | |
trunk/src/emu/cpu/tms32031/32031ops.c
| r24077 | r24078 | |
| 84 | 84 | #define OR_V_ADD(a,b,r) do { UINT32 temp = ((((a) ^ (r)) & ((b) ^ (r))) >> 30) & VFLAG; IREG(TMR_ST) |= temp | (temp << 4); } while (0) |
| 85 | 85 | #define OR_C_SUB(a,b,r) do { IREG(TMR_ST) |= ((UINT32)(b) > (UINT32)(a)); } while (0) |
| 86 | 86 | #define OR_C_ADD(a,b,r) do { IREG(TMR_ST) |= ((UINT32)(a) > (UINT32)(r)); } while (0) |
| 87 | | #define OR_C_SBB(a,b,c) do { INT64 temp = (UINT32)(a) - (UINT32)(b) - (UINT32)(c); IREG(TMR_ST) |= (temp < 0); } while (0) |
| 88 | | #define OR_C_ADC(a,b,c) do { UINT64 temp = (UINT32)(a) + (UINT32)(b) + (UINT32)(c); IREG(TMR_ST) |= (temp > 0xffffffffUL); } while (0) |
| 87 | #define OR_C_SBB(a,b,c) do { INT64 temp = (INT64)(a) - (UINT32)(b) - (UINT32)(c); IREG(TMR_ST) |= (temp < 0); } while (0) |
| 88 | #define OR_C_ADC(a,b,c) do { UINT64 temp = (UINT64)(a) + (UINT32)(b) + (UINT32)(c); IREG(TMR_ST) |= (temp > 0xffffffff); } while (0) |
| 89 | 89 | |
| 90 | 90 | #define OVM() (IREG(TMR_ST) & OVMFLAG) |
| 91 | 91 | |
trunk/src/mame/video/tia.c
| r24077 | r24078 | |
| 835 | 835 | { |
| 836 | 836 | if (data & 0x80) |
| 837 | 837 | { |
| 838 | | paddle_cycles = machine().firstcpu->total_cycles(); |
| 838 | paddle_start = machine().firstcpu->total_cycles(); |
| 839 | 839 | } |
| 840 | 840 | if ( ! ( VBLANK & 0x40 ) ) { |
| 841 | 841 | INPT4 = 0x80; |
| r24077 | r24078 | |
| 1588 | 1588 | |
| 1589 | 1589 | READ8_MEMBER( tia_video_device::INPT_r ) |
| 1590 | 1590 | { |
| 1591 | | UINT64 elapsed = machine().firstcpu->total_cycles() - paddle_cycles; |
| 1592 | | int input = TIA_INPUT_PORT_ALWAYS_ON; |
| 1591 | UINT64 elapsed = machine().firstcpu->total_cycles() - paddle_start; |
| 1592 | UINT16 input = TIA_INPUT_PORT_ALWAYS_ON; |
| 1593 | 1593 | if ( !m_read_input_port_func.isnull() ) |
| 1594 | 1594 | { |
| 1595 | 1595 | input = m_read_input_port_func(offset & 3, 0xFFFF); |
| r24077 | r24078 | |
| 1600 | 1600 | if ( input == TIA_INPUT_PORT_ALWAYS_OFF ) |
| 1601 | 1601 | return 0x00; |
| 1602 | 1602 | |
| 1603 | | return elapsed > 76 * input ? 0x80 : 0x00; |
| 1603 | UINT16 paddle_cycles = input * 76; |
| 1604 | return elapsed > paddle_cycles ? 0x80 : 0x00; |
| 1604 | 1605 | } |
| 1605 | 1606 | |
| 1606 | 1607 | |
trunk/src/mame/machine/harddriv.c
| r24077 | r24078 | |
| 1985 | 1985 | READ16_HANDLER( rdgsp_speedup1_r ) |
| 1986 | 1986 | { |
| 1987 | 1987 | harddriv_state *state = space.machine().driver_data<harddriv_state>(); |
| 1988 | | int result = state->m_gsp_speedup_addr[0][offset]; |
| 1988 | UINT16 result = state->m_gsp_speedup_addr[0][offset]; |
| 1989 | 1989 | |
| 1990 | 1990 | /* if this address is equal to $f000, spin until something gets written */ |
| 1991 | 1991 | if (&space.device() == state->m_gsp && space.device().safe_pc() == state->m_gsp_speedup_pc && |
| 1992 | | (result & 0xff) < space.device().state().state_int(TMS34010_A1)) |
| 1992 | (UINT8)result < space.device().state().state_int(TMS34010_A1)) |
| 1993 | 1993 | { |
| 1994 | 1994 | state->m_gsp_speedup_count[0]++; |
| 1995 | 1995 | space.device().execute().spin_until_interrupt(); |
trunk/src/tools/chdman.c
| r24077 | r24078 | |
| 400 | 400 | virtual UINT32 read_data(void *_dest, UINT64 offset, UINT32 length) |
| 401 | 401 | { |
| 402 | 402 | UINT8 *dest = reinterpret_cast<UINT8 *>(_dest); |
| 403 | | int interlace_factor = m_info.interlaced ? 2 : 1; |
| 403 | UINT8 interlace_factor = m_info.interlaced ? 2 : 1; |
| 404 | 404 | UINT32 length_remaining = length; |
| 405 | 405 | |
| 406 | 406 | // iterate over frames |
| r24077 | r24078 | |
| 1497 | 1497 | progress(false, "Verifying, %.1f%% complete... \r", 100.0 * double(offset) / double(input_chd.logical_bytes())); |
| 1498 | 1498 | |
| 1499 | 1499 | // determine how much to read |
| 1500 | | UINT32 bytes_to_read = MIN(buffer.count(), input_chd.logical_bytes() - offset); |
| 1500 | UINT32 bytes_to_read = MIN((UINT32)buffer.count(), input_chd.logical_bytes() - offset); |
| 1501 | 1501 | chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read); |
| 1502 | 1502 | if (err != CHDERR_NONE) |
| 1503 | 1503 | report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err)); |
| r24077 | r24078 | |
| 2213 | 2213 | progress(false, "Extracting, %.1f%% complete... \r", 100.0 * double(offset - input_start) / double(input_end - input_start)); |
| 2214 | 2214 | |
| 2215 | 2215 | // determine how much to read |
| 2216 | | UINT32 bytes_to_read = MIN(buffer.count(), input_end - offset); |
| 2216 | UINT32 bytes_to_read = MIN((UINT32)buffer.count(), input_end - offset); |
| 2217 | 2217 | chd_error err = input_chd.read_bytes(offset, buffer, bytes_to_read); |
| 2218 | 2218 | if (err != CHDERR_NONE) |
| 2219 | 2219 | report_error(1, "Error reading CHD file (%s): %s", params.find(OPTION_INPUT)->cstr(), chd_file::error_string(err)); |
| r24077 | r24078 | |
| 2475 | 2475 | report_error(1, "Improperly formatted A/V metadata found"); |
| 2476 | 2476 | fps_times_1million = fps * 1000000 + fpsfrac; |
| 2477 | 2477 | } |
| 2478 | | int interlace_factor = interlaced ? 2 : 1; |
| 2478 | UINT8 interlace_factor = interlaced ? 2 : 1; |
| 2479 | 2479 | |
| 2480 | 2480 | // determine key parameters and validate |
| 2481 | 2481 | max_samples_per_frame = (UINT64(rate) * 1000000 + fps_times_1million - 1) / fps_times_1million; |
| r24077 | r24078 | |
| 2543 | 2543 | |
| 2544 | 2544 | // iterate over frames |
| 2545 | 2545 | bitmap_yuy16 fullbitmap(width, height * interlace_factor); |
| 2546 | | for (int framenum = input_start; framenum < input_end; framenum++) |
| 2546 | for (UINT64 framenum = input_start; framenum < input_end; framenum++) |
| 2547 | 2547 | { |
| 2548 | | progress(framenum == 0, "Extracting, %.1f%% complete... \r", 100.0 * double(framenum - input_start) / double(input_end - input_start)); |
| 2548 | progress(framenum == input_start, "Extracting, %.1f%% complete... \r", 100.0 * double(framenum - input_start) / double(input_end - input_start)); |
| 2549 | 2549 | |
| 2550 | 2550 | // set up the fake bitmap for this frame |
| 2551 | 2551 | avconfig.video.wrap(&fullbitmap.pix(framenum % interlace_factor), fullbitmap.width(), fullbitmap.height() / interlace_factor, fullbitmap.rowpixels() * interlace_factor); |
| r24077 | r24078 | |
| 2565 | 2565 | } |
| 2566 | 2566 | |
| 2567 | 2567 | // write video |
| 2568 | | if (framenum % interlace_factor == interlace_factor - 1) |
| 2568 | if ((framenum + 1) % interlace_factor == 0) |
| 2569 | 2569 | { |
| 2570 | 2570 | avi_error avierr = avi_append_video_frame(output_file, fullbitmap); |
| 2571 | 2571 | if (avierr != AVIERR_NONE) |