Previous 15994 Revisions Next

r3275 Tuesday 16th September, 2008 at 08:04:54 UTC by Roberto Zandonà
[C65] fixed crash
[C64] fixed PAL timings and sprite/foreground priorities
[src/mess/drivers]c64.c
[src/mess/video]vic4567.c vic6567.c vic6567.h

src/mess/video/vic4567.c
r3274r3275
5252{
5353   memset(&vic2, 0, sizeof(vic2));
5454
55   vic2.totalcycles = 63;
5556   vic2.lines = VIC2_LINES;
5657   vic2.vic3 = TRUE;
5758
src/mess/video/vic6567.c
r3274r3275
9393
9494/* 2008-05 FP: lightpen code needs to read input port from c64.c and cbmb.c */
9595
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)
99100
100101/* lightpen delivers values from internal counters
101102 * they do not start with the visual area or frame area */
r3274r3275
974975         {
975976            value = vic2.expandx_multi[bg = vic2.dma_read (addr + vic2.sprites[nr].line * 3 + i)];
976977            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;
979980            vic2_sprite_collision (nr, y, xbegin + i * 16, value2 >> 8);
980981            vic2_sprite_collision (nr, y, xbegin + i * 16 + 8, value2 & 0xff);
981982            if (prior || !collision)
982983            {
983               value3 = vic2_getforeground16 (yoff + y, xbegin + i * 16);
984               value3 = vic2_getforeground16 (yoff + y, xbegin + i * 16 - 7);
984985            }
985986            if (!collision && (value2 & value3))
986987            {
r3274r3275
10291030            vic2_sprite_collision (nr, y, xbegin + i * 8, value2);
10301031            if (prior || !collision)
10311032            {
1032               value3 = vic2_getforeground (yoff + y, xbegin + i * 8);
1033               value3 = vic2_getforeground (yoff + y, xbegin + i * 8 - 7);
10331034            }
10341035            if (!collision && (value2 & value3))
10351036            {
r3274r3275
10891090            vic2_sprite_collision (nr, y, xbegin + i * 16, value >> 8);
10901091            vic2_sprite_collision (nr, y, xbegin + i * 16 + 8, value & 0xff);
10911092            if (prior || !collision)
1092               value3 = vic2_getforeground16 (yoff + y, xbegin + i * 16);
1093               value3 = vic2_getforeground16 (yoff + y, xbegin + i * 16 - 7);
10931094            if (!collision && (value & value3))
10941095            {
10951096               collision = 1;
r3274r3275
11291130            vic2.sprites[nr].bitmap[y][i] = value;
11301131            vic2_sprite_collision (nr, y, xbegin + i * 8, value);
11311132            if (prior || !collision)
1132               value3 = vic2_getforeground (yoff + y, xbegin + i * 8);
1133               value3 = vic2_getforeground (yoff + y, xbegin + i * 8 - 7);
11331134            if (!collision && (value & value3))
11341135            {
11351136               collision = 1;
r3274r3275
14881489
14891490VIDEO_UPDATE( vic2 )
14901491{
1492   vic2.rasterline = 0;
14911493   if (vic2.on)
14921494      copybitmap(bitmap, vic2.bitmap, 0, 0, 0, 0, cliprect);
14931495   return 0;
src/mess/video/vic6567.h
r3274r3275
1515#define VIC6567_H_
1616
1717#define VIC6567_VRETRACERATE 60
18#define VIC6569_VRETRACERATE 50
18#define VIC6569_VRETRACERATE (50.12706  /* vice: 50.123432124542124 */)
1919#define VIC2_VRETRACERATE (vic2.pal?VIC6569_VRETRACERATE:VIC6567_VRETRACERATE)
2020
2121/* to be inserted in MachineDriver-Structure */
r3274r3275
2424#define VIC2_HSIZE   320
2525#define VIC2_VSIZE   200
2626
27#define VIC6567_CYCLESPERLINE 63
27#define VIC6567_CYCLESPERLINE 65
2828#define VIC6569_CYCLESPERLINE 63
2929#define VIC2_CYCLESPERLINE (vic2.pal?VIC6569_CYCLESPERLINE:VIC6567_CYCLESPERLINE)
3030
3131/* of course you clock select an other clock, but for accurate */
3232/* 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) */ )
3735
3836/* pixel clock 8 mhz */
3937/* accesses to memory with 2 megahertz */
r3274r3275
4139/* + sprite + */
4240/* but system clock 1 megahertz */
4341/* 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)
4543
4644#define VIC6567_HRETRACERATE (VIC6567_CLOCK / 65)
4745#define VIC6569_HRETRACERATE (VIC6569_CLOCK / 63)
4846
4947#define VIC2_HRETRACERATE (vic2.pal?VIC6569_HRETRACERATE:VIC6567_HRETRACERATE)
5048
51/* pal 50 Hz vertical screen refresh, screen consists of 312 lines
49/* pal 50 Hz vertical screen refresh, screen consists of 312 lines
5250 * ntsc 60 Hz vertical screen refresh, screen consists of 262 lines */
5351#define VIC6567_LINES 262
5452#define VIC6569_LINES 312
r3274r3275
8785
8886/* call to init videodriver */
8987/* dma_read: videochip fetched 1 byte data from system bus */
90extern void vic6567_init (int vic2e, int pal, int (*dma_read) (int),
91                    int (*dma_read_color) (int), void (*irq) (int));
88extern void vic6567_init (int vic2e, int pal, int (*dma_read) (int), int (*dma_read_color) (int), void (*irq) (int));
9289
9390extern void vic2_set_rastering(int onoff);
9491
src/mess/drivers/c64.c
r3274r3275
538538   /* video hardware */
539539   MDRV_IMPORT_FROM( vh_vic2_pal )
540540   MDRV_SCREEN_MODIFY("main")
541   MDRV_SCREEN_REFRESH_RATE(VIC6569_VRETRACERATE)
542   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
541   MDRV_SCREEN_REFRESH_RATE(50.12706) /* vice: 50.123432124542124 - VIC6569_VRETRACERATE */
542   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) /* 2500 not accurate */
543543
544544   /* sound hardware */
545545   MDRV_SPEAKER_STANDARD_MONO("mono")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team