Previous 15994 Revisions Next

r1950 Tuesday 11th March, 2008 at 22:38:46 UTC by Wilbert Pol
Removed deprecat.h dependency from video/amstrad.c
[src/mess/drivers]amstrad.c
[src/mess/includes]amstrad.h
[src/mess/machine]amstrad.c
[src/mess/video]amstrad.c

src/mess/includes/amstrad.h
r1949r1950
2424
2525/*----------- defined in drivers/amstrad.c -----------*/
2626
27void amstrad_reset_machine(void);
28void amstrad_GateArray_write(int);
27void amstrad_reset_machine(running_machine *);
28void amstrad_GateArray_write(running_machine *,int);
2929void amstrad_rethinkMemory(void);
3030void amstrad_setLowerRom(void);
3131void amstrad_setUpperRom(void);
r1949r1950
3636
3737/*----------- defined in machine/amstrad.c -----------*/
3838
39void amstrad_setup_machine(void);
39void amstrad_setup_machine(running_machine *);
4040
4141SNAPSHOT_LOAD( amstrad );
4242
r1949r1950
4646
4747/*----------- defined in video/amstrad.c -----------*/
4848
49void amstrad_plus_setspritecolour(unsigned int off, int r, int g, int b);
49void amstrad_plus_setspritecolour(running_machine *machine, unsigned int off, int r, int g, int b);
5050void amstrad_plus_setsplitline(unsigned int line, unsigned int address);
5151
5252/* On the Amstrad, any part of the 64k memory can be access by the video
r1949r1950
8181extern VIDEO_START( aleste );
8282extern VIDEO_UPDATE( amstrad );
8383void amstrad_vh_execute_crtc_cycles(int);
84void amstrad_vh_update_colour(int, int);
84void amstrad_vh_update_colour(running_machine *machine, int, int);
8585void amstrad_vh_update_mode(int);
8686
8787/* The VSYNC signal of the CRTC */
r1949r1950
105105
106106/**** ALESTE SPECIFIC ***/
107107extern PALETTE_INIT( aleste );
108void aleste_vh_update_colour(int, int);
108void aleste_vh_update_colour(running_machine *machine, int, int);
109109
110110#endif /* AMSTRAD_H_ */
src/mess/video/amstrad.c
r1949r1950
88
99
1010#include "driver.h"
11#include "deprecat.h"
1211#include "devices/snapquik.h"
1312#include "includes/amstrad.h"
1413
r1949r1950
302301   }
303302}
304303
305void amstrad_plus_setspritecolour(unsigned int off, int r, int g, int b)
304void amstrad_plus_setspritecolour(running_machine *machine, unsigned int off, int r, int g, int b)
306305{
307   palette_set_color_rgb(Machine, (off/2) + 33, r, g, b);
306   palette_set_color_rgb(machine, (off/2) + 33, r, g, b);
308307}
309308
310309static void amstrad_init_lookups(void)
r1949r1950
336335   }
337336}
338337/* Set the new colour from the GateArray */
339void amstrad_vh_update_colour(int PenIndex, int hw_colour_index)
338void amstrad_vh_update_colour(running_machine *machine, int PenIndex, int hw_colour_index)
340339{
341340   int val;
342341/*  int cpu_cycles = ((cycles_currently_ran()>>2)-1) & 63;
343342
344   logerror("color is changed(%d,%d) = %d\n",PenIndex, cpu_cycles, Machine->pens[hw_colour_index]);
343   logerror("color is changed(%d,%d) = %d\n",PenIndex, cpu_cycles, machine->pens[hw_colour_index]);
345344  amstrad_GateArray_colours_ischanged++;
346   amstrad_GateArray_changed_colours[cpu_cycles][PenIndex] = Machine->pens[hw_colour_index];
345   amstrad_GateArray_changed_colours[cpu_cycles][PenIndex] = machine->pens[hw_colour_index];
347346*/
348   amstrad_GateArray_render_colours[PenIndex] = Machine->pens[hw_colour_index];
347   amstrad_GateArray_render_colours[PenIndex] = machine->pens[hw_colour_index];
349348   if(amstrad_system_type != 0)
350349   {  // CPC+/GX4000 - normal palette changes through the Gate Array also makes the corresponding change in the ASIC palette
351350      val = (amstrad_palette[hw_colour_index] & 0xf00000) >> 16; // red
r1949r1950
356355   }
357356}
358357
359void aleste_vh_update_colour(int PenIndex, int hw_colour_index)
358void aleste_vh_update_colour(running_machine *machine, int PenIndex, int hw_colour_index)
360359{
361360/*  int cpu_cycles = ((cycles_currently_ran()>>2)-1) & 63;
362361
363   logerror("color is changed(%d,%d) = %d\n",PenIndex, cpu_cycles, Machine->pens[hw_colour_index]);
362   logerror("color is changed(%d,%d) = %d\n",PenIndex, cpu_cycles, machine->pens[hw_colour_index]);
364363  amstrad_GateArray_colours_ischanged++;
365   amstrad_GateArray_changed_colours[cpu_cycles][PenIndex] = Machine->pens[hw_colour_index];
364   amstrad_GateArray_changed_colours[cpu_cycles][PenIndex] = machine->pens[hw_colour_index];
366365*/
367   amstrad_GateArray_render_colours[PenIndex] = Machine->pens[hw_colour_index+32];
366   amstrad_GateArray_render_colours[PenIndex] = machine->pens[hw_colour_index+32];
368367}
369368
370369/* Set the new screen mode (0,1,2,4) from the GateArray */
r1949r1950
920919
921920  &6422 - &643f   Sprite palette, 12-bit, xxxxGGGGRRRRBBBB, sprite pens 1-15 (0 is always transparent)
922921*/
923static void amstrad_plus_sprite_draw(bitmap_t* scr_bitmap)
922static void amstrad_plus_sprite_draw(running_machine *machine, bitmap_t* scr_bitmap)
924923{
925924   int spr;  // sprite number
926925   int xloc,yloc;
r1949r1950
947946         xloc += rect.min_x;
948947         yloc = amstrad_plus_asic_ram[sprptr+2] + (amstrad_plus_asic_ram[sprptr+3] << 8);
949948         yloc += rect.min_y;
950         decodechar(Machine->gfx[0],spr,amstrad_plus_asic_ram);
951         drawgfxzoom(scr_bitmap,Machine->gfx[0],spr,0,0,0,xloc,yloc,&rect,
949         decodechar(machine->gfx[0],spr,amstrad_plus_asic_ram);
950         drawgfxzoom(scr_bitmap,machine->gfx[0],spr,0,0,0,xloc,yloc,&rect,
952951            TRANSPARENCY_PEN,0,xmag,ymag);
953952      }
954953   }
r1949r1950
979978static void amstrad_plus_dma_parse(int channel, int *addr)
980979{
981980   unsigned short command;
982   running_machine *machine = Machine;
981   running_machine *machine = machine;
983982
984983   if(*addr & 0x01)
985984      (*addr)++;  // align to even address
r1949r1950
11351134/* CRTC - Set new Horizontal Sync Status */
11361135static void amstrad_Set_HS(int offset, int data)
11371136{
1138   running_machine *machine = Machine;
1137   running_machine *machine = machine;
11391138
11401139   if (data != 0)
11411140   {
r1949r1950
12841283   #endif
12851284      copybitmap(bitmap, amstrad_bitmap, 0,0,0,0,&rect);
12861285      if(amstrad_plus_asic_enabled != 0)
1287         amstrad_plus_sprite_draw(bitmap);
1286         amstrad_plus_sprite_draw(machine, bitmap);
12881287      amstrad_scanline = y_screen_pos - 32;
12891288      return 0;
12901289   }
src/mess/machine/amstrad.c
r1949r1950
3131#include "deprecat.h"
3232
3333
34void amstrad_setup_machine(void)
34void amstrad_setup_machine(running_machine *machine)
3535{
36   amstrad_reset_machine();
36   amstrad_reset_machine(machine);
3737}
3838
3939/* load CPCEMU style snapshots */
r1949r1950
113113   /* init GA */
114114   for (i=0; i<17; i++)
115115   {
116      amstrad_GateArray_write(i);
116      amstrad_GateArray_write(machine, i);
117117
118      amstrad_GateArray_write(((pSnapshot[0x02f + i] & 0x01f) | 0x040));
118      amstrad_GateArray_write(machine, ((pSnapshot[0x02f + i] & 0x01f) | 0x040));
119119   }
120120
121   amstrad_GateArray_write(pSnapshot[0x02e] & 0x01f);
121   amstrad_GateArray_write(machine, pSnapshot[0x02e] & 0x01f);
122122
123   amstrad_GateArray_write(((pSnapshot[0x040] & 0x03f) | 0x080));
123   amstrad_GateArray_write(machine, ((pSnapshot[0x040] & 0x03f) | 0x080));
124124
125125   AmstradCPC_PALWrite(((pSnapshot[0x041] & 0x03f) | 0x0c0));
126126
src/mess/drivers/amstrad.c
r1949r1950
702702            b = (amstrad_plus_asic_ram[offset+0x1fff] & 0x0f) << 4;
703703            offset--;
704704         }
705         amstrad_plus_setspritecolour((offset - 0x422), r, g, b);
705         amstrad_plus_setspritecolour(machine, (offset - 0x422), r, g, b);
706706      }
707707      if(offset == 0x0800)  // Programmable raster interrupt
708708      {
r1949r1950
975975
976976Note 1 : This function is not available in the Gate-Array, but is performed by a device at the same I/O port address location. In the CPC464,CPC664 and KC compact, this function is performed in a memory-expansion (e.g. Dk'Tronics 64K Ram Expansion), if this expansion is not present then the function is not available. In the CPC6128, this function is performed by a PAL located on the main PCB, or a memory-expansion. In the 464+ and 6128+ this function is performed by the ASIC or a memory expansion. Please read the document on Ram Management for more information.*/
977977
978void amstrad_GateArray_write(int dataToGateArray)
978void amstrad_GateArray_write(running_machine *machine, int dataToGateArray)
979979{
980980/* Get Bit 7 and 6 of the dataToGateArray = Gate Array function selected */
981981   switch ((dataToGateArray & 0xc0)>>6) {
r1949r1950
10131013#ifdef AMSTRAD_VIDEO_EVENT_LIST
10141014    EventList_AddItemOffset((EVENT_LIST_CODE_GA_COLOUR<<6) | PenIndex, AmstradCPC_PenColours[PenIndex], TIME_TO_CYCLES(0,video_screen_get_vpos(0)*video_screen_get_scan_period(0)));
10151015#else
1016      amstrad_vh_update_colour(amstrad_GateArray_PenSelected, (dataToGateArray & 0x1F));
1016      amstrad_vh_update_colour(machine, amstrad_GateArray_PenSelected, (dataToGateArray & 0x1F));
10171017#endif
10181018    } break;
10191019/* Select screen mode and rom configuration
r1949r1950
11041104  }
11051105}
11061106
1107static void aleste_msx_mapper(int offset, int data)
1107static void aleste_msx_mapper(running_machine *machine, int offset, int data)
11081108{
11091109   int page = (offset & 0x0300) >> 8;
11101110   int ramptr = (data & 0x1f) * 0x4000;
r1949r1950
11151115   switch(function)
11161116   {
11171117   case 0:  // Pen select (same as Gate Array?)
1118      amstrad_GateArray_write(data);
1118      amstrad_GateArray_write(machine, data);
11191119      break;
11201120   case 1:  // Colour select (6-bit palette)
1121      aleste_vh_update_colour(amstrad_GateArray_PenSelected,data & 0x3f);
1121      aleste_vh_update_colour(machine, amstrad_GateArray_PenSelected,data & 0x3f);
11221122      break;
11231123   case 2:  // Screen mode, Upper/Lower ROM select
1124      amstrad_GateArray_write(data);
1124      amstrad_GateArray_write(machine, data);
11251125      break;
11261126   case 3: // RAM banks
11271127      switch(page)
r1949r1950
13421342   {
13431343      if(aleste_mode & 0x04) // Aleste mode
13441344      {
1345         aleste_msx_mapper(offset,data);
1345         aleste_msx_mapper(machine, offset,data);
13461346      }
13471347      else
13481348      {
13491349      /* if b15 = 0 and b14 = 1 : Gate-Array Write Selected*/
13501350      if ((offset & (1<<14)) != 0)
1351               amstrad_GateArray_write(data);
1351               amstrad_GateArray_write(machine, data);
13521352      /* if b15 = 0 : RAM Configuration Write Selected*/
13531353        AmstradCPC_GA_SetRamConfiguration();
13541354      }
r1949r1950
18371837All hardware is reset and the firmware is completely initialized
18381838Once all tables and jumpblocks have been set up,
18391839control is passed to the default entry in rom 0*/
1840void amstrad_reset_machine(void)
1840void amstrad_reset_machine(running_machine *machine)
18411841{
18421842   /* enable lower rom (OS rom) */
1843   amstrad_GateArray_write(0x089);
1843   amstrad_GateArray_write(machine, 0x089);
18441844
18451845   /* set ram config 0 */
1846   amstrad_GateArray_write(0x0c0);
1846   amstrad_GateArray_write(machine, 0x0c0);
18471847
18481848  // Get manufacturer name and TV refresh rate from PCB link (dipswitch for mess emulation)
18491849   ppi_port_inputs[amstrad_ppi_PortB] = (((readinputportbytag("solder_links")&MANUFACTURER_NAME)<<1) | (readinputportbytag("solder_links")&TV_REFRESH_RATE));
r1949r1950
18541854   multiface_reset();
18551855}
18561856
1857static void kccomp_reset_machine(void)
1857static void kccomp_reset_machine(running_machine *machine)
18581858{
18591859   /* enable lower rom (OS rom) */
1860   amstrad_GateArray_write(0x089);
1860   amstrad_GateArray_write(machine, 0x089);
18611861
18621862   /* set ram config 0 */
1863   amstrad_GateArray_write(0x0c0);
1863   amstrad_GateArray_write(machine, 0x0c0);
18641864}
18651865
18661866/* the following timings have been measured! */
r1949r1950
20872087
20882088   Amstrad_ROM_Table[7] = &memory_region(REGION_CPU1)[0x018000];
20892089   amstrad_common_init();
2090   amstrad_reset_machine();
2090   amstrad_reset_machine(machine);
20912091
20922092   multiface_init();
20932093
r1949r1950
21302130   amstrad_plus_irq_cause = 6;
21312131
21322132   amstrad_common_init();
2133   amstrad_reset_machine();
2133   amstrad_reset_machine(machine);
21342134   amstrad_plus_asic_ram[0x2805] = 0x01;  // interrupt vector is undefined at startup, except that bit 0 is always 1.
21352135   AmstradCPC_GA_SetRamConfiguration();
21362136   amstrad_plus_setsplitline(0,0);
r1949r1950
21792179   amstrad_plus_irq_cause = 6;
21802180
21812181   amstrad_common_init();
2182   amstrad_reset_machine();
2182   amstrad_reset_machine(machine);
21832183   amstrad_plus_asic_ram[0x2805] = 0x01;  // interrupt vector is undefined at startup, except that bit 0 is always 1.
21842184   AmstradCPC_GA_SetRamConfiguration();
21852185   amstrad_plus_setsplitline(0,0);
r1949r1950
21982198   }
21992199
22002200   amstrad_common_init();
2201   kccomp_reset_machine();
2201   kccomp_reset_machine(machine);
22022202
22032203   /* bit 1 = /TEST. When 0, KC compact will enter data transfer
22042204    sequence, where another system using the expansion port signals
r1949r1950
22282228   Amstrad_ROM_Table[3] = &memory_region(REGION_CPU1)[0x01c000];  // MSX-DOS / BIOS
22292229   Amstrad_ROM_Table[7] = &memory_region(REGION_CPU1)[0x018000];  // AMSDOS
22302230   amstrad_common_init();
2231   amstrad_reset_machine();
2231   amstrad_reset_machine(machine);
22322232
22332233   nec765_init(&aleste_8272_interface,NEC765A);
22342234   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0),  FLOPPY_DRIVE_DS_80);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team