diff --git a/src/mame/drivers/adp.c b/src/mame/drivers/adp.c index 062cc5c1623..8dee9cc1f58 100644 --- a/src/mame/drivers/adp.c +++ b/src/mame/drivers/adp.c @@ -228,9 +228,9 @@ static VIDEO_UPDATE(adp) int x,y,b; b = ((HD63484_reg[0xcc/2] & 0x000f) << 16) + HD63484_reg[0xce/2]; - for (y = 0;y < 480;y++) + for (y = 0;y < 280;y++) { - for (x = 0 ; x<(HD63484_reg[0xca/2] & 0x0fff) * 2 ; x += 4) + for (x = 0 ; x < (HD63484_reg[0xca/2] & 0x0fff) * 4 ; x += 4) { b &= (HD63484_RAM_SIZE-1); *BITMAP_ADDR16(bitmap, y, x ) = (HD63484_ram[b] & 0x000f); @@ -251,9 +251,9 @@ static VIDEO_UPDATE(adp) b = (((HD63484_reg[0xdc/2] & 0x000f) << 16) + HD63484_reg[0xde/2]); - for (y = sy ; y <= sy + h && y < 480 ; y++) + for (y = sy ; y <= sy + h && y < 280 ; y++) { - for (x = 0 ; x < (HD63484_reg[0xca/2] & 0x0fff) * 2 ; x += 4) + for (x = 0 ; x < (HD63484_reg[0xca/2] & 0x0fff) * 4 ; x += 4) { b &= (HD63484_RAM_SIZE - 1); if (x <= w && x + sx >= 0 && x + sx < (HD63484_reg[0xca/2] & 0x0fff) * 2) @@ -271,34 +271,27 @@ static VIDEO_UPDATE(adp) return 0; } -static READ16_HANDLER( handler1_r ) +static READ16_HANDLER(test_r) { - return 0x13; + switch (mame_rand(machine) & 3) + { + case 0: + return 0; + case 1: + return 0xffff; + default: + return mame_rand(machine) % 0xffff; + } } -static READ16_HANDLER( handler2_r ) -{ - if (input_code_pressed(KEYCODE_Q)) return 0x01; - if (input_code_pressed(KEYCODE_W)) return 0x02; - if (input_code_pressed(KEYCODE_E)) return 0x04; - if (input_code_pressed(KEYCODE_R)) return 0x08; - return mame_rand(machine) & 0xff; -} - -/* -static READ16_HANDLER( handler3_r ) -{ - return mame_rand(machine) & 0x0000; -// return mame_rand(machine) & 0xffff; -} -*/ - static ADDRESS_MAP_START( skattv_mem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0fffff) AM_ROM - AM_RANGE(0x800080, 0x800081) AM_READWRITE(HD63484_status_r, HD63484_address_w) // bad - AM_RANGE(0x800082, 0x800083) AM_READWRITE(HD63484_data_r, HD63484_data_w) // bad - AM_RANGE(0x8000a0, 0x8000a1) AM_READ(handler2_r) - AM_RANGE(0x8000a2, 0x8000a3) AM_READ(handler2_r) + AM_RANGE(0x400000, 0x4000ff) AM_READ(test_r) //18b too + AM_RANGE(0x800080, 0x800081) AM_READWRITE(HD63484_status_r, HD63484_address_w) + AM_RANGE(0x800082, 0x800083) AM_READWRITE(HD63484_data_r, HD63484_data_w) +// AM_RANGE(0x8000a0, 0x8000a1) AM_READ(handler2_r) +// AM_RANGE(0x8000a2, 0x8000a3) AM_READ(handler2_r) + AM_RANGE(0x800100, 0x80017f) AM_READ(test_r) //18b too AM_RANGE(0x800180, 0x80019f) AM_DEVREADWRITE8( DUART68681, "duart68681", duart68681_r, duart68681_w, 0xff ) // AM_RANGE(0xffd246, 0xffd247) AM_READ(handler3_r) // AM_RANGE(0xffd248, 0xffd249) AM_READ(handler3_r) @@ -308,11 +301,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( quickjac_mem, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0fffff) AM_ROM AM_RANGE(0x400000, 0x40001f) AM_DEVREADWRITE8( DUART68681, "duart68681", duart68681_r, duart68681_w, 0xff ) -// AM_RANGE(0x800080, 0x800081) AM_READWRITE(HD63484_status_r, HD63484_address_w) // bad -// AM_RANGE(0x800082, 0x800083) AM_READWRITE(HD63484_data_r, HD63484_data_w) // bad - AM_RANGE(0x800080, 0x800081) AM_READ(handler1_r) - AM_RANGE(0x800082, 0x800083) AM_READ(handler1_r) - AM_RANGE(0x800100, 0x8001ff) AM_RAM // bad + AM_RANGE(0x800080, 0x800081) AM_READWRITE(HD63484_status_r, HD63484_address_w) // bad + AM_RANGE(0x800082, 0x800083) AM_READWRITE(HD63484_data_r, HD63484_data_w) // bad + AM_RANGE(0x800100, 0x8001ff) AM_READ(test_r) //18b too AM_RANGE(0xffc000, 0xffffff) AM_RAM ADDRESS_MAP_END @@ -351,10 +342,17 @@ static INPUT_PORTS_START( skattv ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_COIN4 ) // "E. Coin 4" (ECA?) INPUT_PORTS_END +/* +static INTERRUPT_GEN( adp_int ) +{ + cpunum_set_input_line(machine, 0, 1, HOLD_LINE); // ??? All irqs have the same vector, and the mask used is 0 or 7 +} +*/ + static MACHINE_DRIVER_START( quickjac ) MDRV_CPU_ADD("main", M68000, 8000000) MDRV_CPU_PROGRAM_MAP(quickjac_mem, 0) - //MDRV_CPU_VBLANK_INT("main", irq1_line_hold) +// MDRV_CPU_VBLANK_INT("main", adp_int) MDRV_MACHINE_START(skattv) MDRV_MACHINE_RESET(skattv) @@ -363,11 +361,11 @@ static MACHINE_DRIVER_START( quickjac ) MDRV_DEVICE_CONFIG( skattv_duart68681_config ) MDRV_SCREEN_ADD("main", RASTER) - MDRV_SCREEN_REFRESH_RATE(60) + MDRV_SCREEN_REFRESH_RATE(30) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(640, 480) - MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MDRV_SCREEN_SIZE(384, 280) + MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 280-1) MDRV_PALETTE_LENGTH(0x100) MDRV_PALETTE_INIT(adp) @@ -383,7 +381,7 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( skattv ) MDRV_CPU_ADD("main", M68000, 8000000) MDRV_CPU_PROGRAM_MAP(skattv_mem, 0) -// MDRV_CPU_VBLANK_INT("main", irq4_line_hold) +// MDRV_CPU_VBLANK_INT("main", adp_int) MDRV_MACHINE_START(skattv) MDRV_MACHINE_RESET(skattv) @@ -392,11 +390,11 @@ static MACHINE_DRIVER_START( skattv ) MDRV_DEVICE_CONFIG( skattv_duart68681_config ) MDRV_SCREEN_ADD("main", RASTER) - MDRV_SCREEN_REFRESH_RATE(60) + MDRV_SCREEN_REFRESH_RATE(30) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(640, 480) - MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) + MDRV_SCREEN_SIZE(384, 280) + MDRV_SCREEN_VISIBLE_AREA(0, 384-1, 0, 280-1) MDRV_PALETTE_LENGTH(0x100) MDRV_PALETTE_INIT(adp) @@ -486,9 +484,37 @@ ROM_START( fashiong ) ROM_LOAD16_BYTE( "m48z08posz.bin", 0x0001, 0x2000, CRC(7c5a4b78) SHA1(262d0d7f5b24e356ab54eb2450bbaa90e3fb5464) ) ROM_END +static DRIVER_INIT(skattv) +{ + UINT16 i; + UINT16 *prgrom = (UINT16*)memory_region(machine, "main"); + + i = prgrom[0x66]; + prgrom[0x66] = prgrom[0x106]; + prgrom[0x106] = i; + + i = prgrom[0x67]; + prgrom[0x67] = prgrom[0x107]; + prgrom[0x107] = i; +} + +static DRIVER_INIT(quickjac) +{ + UINT16 i; + UINT16 *prgrom = (UINT16*)memory_region(machine, "main"); + + i = prgrom[0x66]; + prgrom[0x66] = prgrom[0x102]; + prgrom[0x102] = i; + + i = prgrom[0x67]; + prgrom[0x67] = prgrom[0x103]; + prgrom[0x103] = i; +} + GAME( 1990, backgamn, 0, backgamn, adp, 0, ROT0, "ADP", "Backgammon", GAME_NOT_WORKING ) -GAME( 1993, quickjac, 0, quickjac, skattv, 0, ROT0, "ADP", "Quick Jack", GAME_NOT_WORKING ) -GAME( 1994, skattv, 0, skattv, skattv, 0, ROT0, "ADP", "Skat TV", GAME_NOT_WORKING ) -GAME( 1995, skattva, skattv, skattv, skattv, 0, ROT0, "ADP", "Skat TV (version TS3)", GAME_NOT_WORKING ) +GAME( 1993, quickjac, 0, quickjac, skattv, quickjac, ROT0, "ADP", "Quick Jack", GAME_NOT_WORKING ) +GAME( 1994, skattv, 0, skattv, skattv, skattv, ROT0, "ADP", "Skat TV", GAME_NOT_WORKING ) +GAME( 1995, skattva, skattv, skattv, skattv, skattv, ROT0, "ADP", "Skat TV (version TS3)", GAME_NOT_WORKING ) GAME( 1997, fashiong, 0, skattv, adp, 0, ROT0, "ADP", "Fashion Gambler", GAME_NOT_WORKING ) diff --git a/src/mame/video/hd63484.c b/src/mame/video/hd63484.c index 584d368abdb..8d59afc782b 100644 --- a/src/mame/video/hd63484.c +++ b/src/mame/video/hd63484.c @@ -17,7 +17,7 @@ static int get_pixel(int x,int y); /* decoding of long commands. Commands can be up to 64KB long... but Shanghai */ /* doesn't reach that length. */ -#define FIFO_LENGTH 50 +#define FIFO_LENGTH 65536 static int fifo_counter; static UINT16 fifo[FIFO_LENGTH]; @@ -540,6 +540,58 @@ static void agcpy(int opcode,int src_x,int src_y,int dst_x,int dst_y,INT16 _ax,I } } +void line(INT16 sx, INT16 sy, INT16 ex, INT16 ey, INT16 col) +{ + + INT16 ax,ay; + + int cpx_t=sx; + int cpy_t=sy; + + ax = ex - sx; + ay = ey - sy; + + if (abs(ax) >= abs(ay)) + { + while (ax) + { + dot(cpx_t,cpy_t,col,cl0); + + if (ax > 0) + { + cpx_t++; + ax--; + } + else + { + cpx_t--; + ax++; + } + cpy_t = sy + ay * (cpx_t - sx) / (ex - sx); + } + } + else + { + while (ay) + { + dot(cpx_t,cpy_t,col,cl0); + + if (ay > 0) + { + cpy_t++; + ay--; + } + else + { + cpy_t--; + ay++; + } + cpx_t = sx + ax * (cpy_t - sy) / (ey - sy); + } + } + +} + static void HD63484_command_w(UINT16 cmd) { int len; @@ -691,140 +743,56 @@ logerror("unsupported register\n"); cpx = fifo[1]; cpy = fifo[2]; } - else if ((fifo[0] & 0xfff8) == 0x8800) /* ALINE */ + else if (fifo[0] == 0x8400) /* RMOVE */ { - INT16 ex,ey,sx,sy; - INT16 ax,ay; - - sx = cpx; - sy = cpy; - ex = fifo[1]; - ey = fifo[2]; - - ax = ex - sx; - ay = ey - sy; - - if (abs(ax) >= abs(ay)) - { - while (ax) - { - dot(cpx,cpy,fifo[0] & 0x0007,cl0); - - if (ax > 0) - { - cpx++; - ax--; - } - else - { - cpx--; - ax++; - } - cpy = sy + ay * (cpx - sx) / (ex - sx); - } - } - else - { - while (ay) - { - dot(cpx,cpy,fifo[0] & 0x0007,cl0); - - if (ay > 0) - { - cpy++; - ay--; - } - else - { - cpy--; - ay++; - } - cpx = sx + ax * (cpy - sy) / (ey - sy); - } - } + cpx += (INT16)fifo[1]; + cpy += (INT16)fifo[2]; + } + else if ((fifo[0] & 0xff00) == 0x8800) /* ALINE */ + { + line(cpx,cpy,fifo[1],fifo[2],fifo[0]&7); + cpx=(INT16)fifo[1]; + cpy=(INT16)fifo[2]; + } + else if ((fifo[0] & 0xff00) == 0x8c00) /* RLINE */ + { + line(cpx,cpy,cpx+(INT16)fifo[1],cpy+(INT16)fifo[2],fifo[0]&7); + cpx+=(INT16)fifo[1]; + cpy+=(INT16)fifo[2]; } else if ((fifo[0] & 0xfff8) == 0x9000) /* ARCT */ { - INT16 pcx,pcy; - INT16 ax,ay,xx,yy; - - pcx = fifo[1]; - pcy = fifo[2]; - - xx = cpx; - yy = cpy; - - ax = pcx - cpx; - for (;;) + line(cpx,cpy,(INT16)fifo[1],cpy,fifo[0]&7); + line((INT16)fifo[1],cpy,(INT16)fifo[1],(INT16)fifo[2],fifo[0]&7); + line((INT16)fifo[1],(INT16)fifo[2],cpx,(INT16)fifo[2],fifo[0]&7); + line(cpx,(INT16)fifo[2],cpx,cpy,fifo[0]&7); + cpx=(INT16)fifo[1]; + cpy=(INT16)fifo[2]; + } + else if ((fifo[0] & 0xfff8) == 0x9400) /* RRCT added*/ + { + line(cpx,cpy,cpx+(INT16)fifo[1],cpy,fifo[0]&7); + line(cpx+(INT16)fifo[1],cpy,cpx+(INT16)fifo[1],cpy+(INT16)fifo[2],fifo[0]&7); + line(cpx+(INT16)fifo[1],cpy+(INT16)fifo[2],cpx,cpy+(INT16)fifo[2],fifo[0]&7); + line(cpx,cpy+(INT16)fifo[2],cpx,cpy,fifo[0]&7); + + cpx=cpx+(INT16)fifo[1]; + cpy=cpy+(INT16)fifo[2]; + } + else if ((fifo[0] & 0xfff8) == 0xa400) /* RPLG added*/ + { + int nseg,sx,sy,ex,ey; + sx=cpx; + sy=cpy; + for(nseg=0;nseg 0) - { - xx++; - ax--; - } - else - { - xx--; - ax++; - } - } - - ay = pcy - cpy; - for (;;) - { - dot(xx,yy,fifo[0] & 0x0007,cl0); - - if (ay == 0) break; - else if (ay > 0) - { - yy++; - ay--; - } - else - { - yy--; - ay++; - } - } - - ax = cpx - pcx; - for (;;) - { - dot(xx,yy,fifo[0] & 0x0007,cl0); - - if (ax == 0) break; - else if (ax > 0) - { - xx++; - ax--; - } - else - { - xx--; - ax++; - } - } - - ay = cpy - pcy; - for (;;) - { - dot(xx,yy,fifo[0] & 0x0007,cl0); - - if (ay == 0) break; - else if (ay > 0) - { - yy++; - ay--; - } - else - { - yy--; - ay++; - } + ex=sx+(INT16)fifo[2+nseg*2]; + ey=sy+(INT16)fifo[2+nseg*2+1]; + line(sx,sy,ex,ey,fifo[0]&7); + sx=ex; + sy=ey; } + line(sx,sy,cpx,cpy,fifo[0]&7); } else if ((fifo[0] & 0xfff8) == 0xc000) /* AFRCT */ { @@ -875,6 +843,16 @@ logerror("unsupported register\n"); } } } + else if ((fifo[0] & 0xfff8) == 0xc400) /* RFRCT added TODO*/ + { + line(cpx,cpy,cpx+(INT16)fifo[1],cpy,fifo[0]&7); + line(cpx+fifo[1],cpy,cpx+fifo[1],cpy+fifo[2],fifo[0]&7); + line(cpx+fifo[1],cpy+fifo[2],cpx,cpy+fifo[2],fifo[0]&7); + line(cpx,cpy+fifo[2],cpx,cpy,fifo[0]&7); + + cpx=cpx+(INT16)fifo[1]; + cpy=cpy+(INT16)fifo[2]; + } else if ((fifo[0] & 0xfff8) == 0xcc00) /* DOT */ { dot(cpx,cpy,fifo[0] & 0x0007,cl0);