src/mess/video/vic6567.c
| r3274 | r3275 | |
| 93 | 93 | |
| 94 | 94 | /* 2008-05 FP: lightpen code needs to read input port from c64.c and cbmb.c */ |
| 95 | 95 | |
| 96 | | #define LIGHTPEN_BUTTON (input_port_read(machine, "OTHER") & 0x04) |
| 97 | | #define LIGHTPEN_X_VALUE (input_port_read(machine, "LIGHTX") & ~0x01) |
| 98 | | #define LIGHTPEN_Y_VALUE (input_port_read(machine, "LIGHTY") & ~0x01) |
| 96 | #define LIGHTPEN_BUTTON (((input_port_read(machine, "CTRLSEL") & 0xe000 ) == 0xa000 ) && (input_port_read(machine, "TRACKIPT") & 0x02)) |
| 97 | #define LIGHTPEN_POINTER (((input_port_read(machine, "CTRLSEL") & 0xe000 ) == 0xa000 ) && (input_port_read(machine, "CTRLSEL") & 0x1000)) |
| 98 | #define LIGHTPEN_X_VALUE (input_port_read(machine, "TRACKX") & ~1) |
| 99 | #define LIGHTPEN_Y_VALUE (input_port_read(machine, "TRACKY") & ~1) |
| 99 | 100 | |
| 100 | 101 | /* lightpen delivers values from internal counters |
| 101 | 102 | * they do not start with the visual area or frame area */ |
| r3274 | r3275 | |
| 974 | 975 | { |
| 975 | 976 | value = vic2.expandx_multi[bg = vic2.dma_read (addr + vic2.sprites[nr].line * 3 + i)]; |
| 976 | 977 | value2 = vic2.expandx[vic2.multi_collision[bg]]; |
| 977 | | vic2.sprites[nr].bitmap[y][i*2] = value2>>8; |
| 978 | | vic2.sprites[nr].bitmap[y][i*2+1] = value2&0xff; |
| 978 | vic2.sprites[nr].bitmap[y][i*2] = value2 >> 8; |
| 979 | vic2.sprites[nr].bitmap[y][i*2+1] = value2 & 0xff; |
| 979 | 980 | vic2_sprite_collision (nr, y, xbegin + i * 16, value2 >> 8); |
| 980 | 981 | vic2_sprite_collision (nr, y, xbegin + i * 16 + 8, value2 & 0xff); |
| 981 | 982 | if (prior || !collision) |
| 982 | 983 | { |
| 983 | | value3 = vic2_getforeground16 (yoff + y, xbegin + i * 16); |
| 984 | value3 = vic2_getforeground16 (yoff + y, xbegin + i * 16 - 7); |
| 984 | 985 | } |
| 985 | 986 | if (!collision && (value2 & value3)) |
| 986 | 987 | { |
| r3274 | r3275 | |
| 1029 | 1030 | vic2_sprite_collision (nr, y, xbegin + i * 8, value2); |
| 1030 | 1031 | if (prior || !collision) |
| 1031 | 1032 | { |
| 1032 | | value3 = vic2_getforeground (yoff + y, xbegin + i * 8); |
| 1033 | value3 = vic2_getforeground (yoff + y, xbegin + i * 8 - 7); |
| 1033 | 1034 | } |
| 1034 | 1035 | if (!collision && (value2 & value3)) |
| 1035 | 1036 | { |
| r3274 | r3275 | |
| 1089 | 1090 | vic2_sprite_collision (nr, y, xbegin + i * 16, value >> 8); |
| 1090 | 1091 | vic2_sprite_collision (nr, y, xbegin + i * 16 + 8, value & 0xff); |
| 1091 | 1092 | if (prior || !collision) |
| 1092 | | value3 = vic2_getforeground16 (yoff + y, xbegin + i * 16); |
| 1093 | value3 = vic2_getforeground16 (yoff + y, xbegin + i * 16 - 7); |
| 1093 | 1094 | if (!collision && (value & value3)) |
| 1094 | 1095 | { |
| 1095 | 1096 | collision = 1; |
| r3274 | r3275 | |
| 1129 | 1130 | vic2.sprites[nr].bitmap[y][i] = value; |
| 1130 | 1131 | vic2_sprite_collision (nr, y, xbegin + i * 8, value); |
| 1131 | 1132 | if (prior || !collision) |
| 1132 | | value3 = vic2_getforeground (yoff + y, xbegin + i * 8); |
| 1133 | value3 = vic2_getforeground (yoff + y, xbegin + i * 8 - 7); |
| 1133 | 1134 | if (!collision && (value & value3)) |
| 1134 | 1135 | { |
| 1135 | 1136 | collision = 1; |
| r3274 | r3275 | |
| 1488 | 1489 | |
| 1489 | 1490 | VIDEO_UPDATE( vic2 ) |
| 1490 | 1491 | { |
| 1492 | vic2.rasterline = 0; |
| 1491 | 1493 | if (vic2.on) |
| 1492 | 1494 | copybitmap(bitmap, vic2.bitmap, 0, 0, 0, 0, cliprect); |
| 1493 | 1495 | return 0; |
src/mess/video/vic6567.h
| r3274 | r3275 | |
| 15 | 15 | #define VIC6567_H_ |
| 16 | 16 | |
| 17 | 17 | #define VIC6567_VRETRACERATE 60 |
| 18 | | #define VIC6569_VRETRACERATE 50 |
| 18 | #define VIC6569_VRETRACERATE (50.12706 /* vice: 50.123432124542124 */) |
| 19 | 19 | #define VIC2_VRETRACERATE (vic2.pal?VIC6569_VRETRACERATE:VIC6567_VRETRACERATE) |
| 20 | 20 | |
| 21 | 21 | /* to be inserted in MachineDriver-Structure */ |
| r3274 | r3275 | |
| 24 | 24 | #define VIC2_HSIZE 320 |
| 25 | 25 | #define VIC2_VSIZE 200 |
| 26 | 26 | |
| 27 | | #define VIC6567_CYCLESPERLINE 63 |
| 27 | #define VIC6567_CYCLESPERLINE 65 |
| 28 | 28 | #define VIC6569_CYCLESPERLINE 63 |
| 29 | 29 | #define VIC2_CYCLESPERLINE (vic2.pal?VIC6569_CYCLESPERLINE:VIC6567_CYCLESPERLINE) |
| 30 | 30 | |
| 31 | 31 | /* of course you clock select an other clock, but for accurate */ |
| 32 | 32 | /* video timing */ |
| 33 | | #define VIC6567_CLOCK 1022730 |
| 34 | | /* (8180000/8) old value */ |
| 35 | | #define VIC6569_CLOCK 985248 |
| 36 | | /* (7880000/8) old value */ |
| 33 | #define VIC6567_CLOCK (1022725 /* (8181800/8) */ ) |
| 34 | #define VIC6569_CLOCK ( 985248 /* (7880000/8) */ ) |
| 37 | 35 | |
| 38 | 36 | /* pixel clock 8 mhz */ |
| 39 | 37 | /* accesses to memory with 2 megahertz */ |
| r3274 | r3275 | |
| 41 | 39 | /* + sprite + */ |
| 42 | 40 | /* but system clock 1 megahertz */ |
| 43 | 41 | /* cpu driven with one (visible screen area) */ |
| 44 | | #define VIC2_CLOCK ((vic2.pal?VIC6569_CLOCK:VIC6567_CLOCK)) |
| 42 | #define VIC2_CLOCK (vic2.pal?VIC6569_CLOCK:VIC6567_CLOCK) |
| 45 | 43 | |
| 46 | 44 | #define VIC6567_HRETRACERATE (VIC6567_CLOCK / 65) |
| 47 | 45 | #define VIC6569_HRETRACERATE (VIC6569_CLOCK / 63) |
| 48 | 46 | |
| 49 | 47 | #define VIC2_HRETRACERATE (vic2.pal?VIC6569_HRETRACERATE:VIC6567_HRETRACERATE) |
| 50 | 48 | |
| 51 | | /* pal 50 Hz vertical screen refresh, screen consists of 312 lines |
| 49 | /* pal 50 Hz vertical screen refresh, screen consists of 312 lines |
| 52 | 50 | * ntsc 60 Hz vertical screen refresh, screen consists of 262 lines */ |
| 53 | 51 | #define VIC6567_LINES 262 |
| 54 | 52 | #define VIC6569_LINES 312 |
| r3274 | r3275 | |
| 87 | 85 | |
| 88 | 86 | /* call to init videodriver */ |
| 89 | 87 | /* dma_read: videochip fetched 1 byte data from system bus */ |
| 90 | | extern void vic6567_init (int vic2e, int pal, int (*dma_read) (int), |
| 91 | | int (*dma_read_color) (int), void (*irq) (int)); |
| 88 | extern void vic6567_init (int vic2e, int pal, int (*dma_read) (int), int (*dma_read_color) (int), void (*irq) (int)); |
| 92 | 89 | |
| 93 | 90 | extern void vic2_set_rastering(int onoff); |
| 94 | 91 | |