Previous 15994 Revisions Next

r3704 Friday 28th November, 2008 at 11:39:20 UTC by Dirk Best
[SAMCOUPE] Cleanups and use MDRV_DRIVER_DATA instead of a global variables
[src/mess/drivers]samcoupe.c
[src/mess/includes]samcoupe.h
[src/mess/machine]samcoupe.c
[src/mess/video]samcoupe.c

src/mess/video/samcoupe.c
r3703r3704
1313#include "includes/samcoupe.h"
1414
1515
16static void drawMode4_line(bitmap_t *bitmap,int y)
16static void draw_mode4_line(const device_config *screen, bitmap_t *bitmap, int y)
1717{
18   coupe_asic *asic = screen->machine->driver_data;
1819   int x;
19   unsigned char tmp=0;
2020
21   for (x=0;x<256;)
21   for (x = 0; x < 256;)
2222   {
23      tmp=*(videoram + (x/2) + (y*128));
23      UINT8 tmp = *(videoram + (x/2) + (y*128));
24
2425#ifdef MONO
2526      if (tmp>>4)
2627      {
r3703r3704
4546      }
4647      x++;
4748#else
48      *BITMAP_ADDR16(bitmap, y, x*2+0) = samcoupe_regs.clut[tmp>>4];
49      *BITMAP_ADDR16(bitmap, y, x*2+1) = samcoupe_regs.clut[tmp>>4];
49      *BITMAP_ADDR16(bitmap, y, x*2+0) = asic->clut[tmp >> 4];
50      *BITMAP_ADDR16(bitmap, y, x*2+1) = asic->clut[tmp >> 4];
5051      x++;
51      *BITMAP_ADDR16(bitmap, y, x*2+0) = samcoupe_regs.clut[tmp&0x0F];
52      *BITMAP_ADDR16(bitmap, y, x*2+1) = samcoupe_regs.clut[tmp&0x0F];
52      *BITMAP_ADDR16(bitmap, y, x*2+0) = asic->clut[tmp & 0x0f];
53      *BITMAP_ADDR16(bitmap, y, x*2+1) = asic->clut[tmp & 0x0f];
5354      x++;
5455#endif
5556   }
5657}
5758
58static void drawMode3_line(bitmap_t *bitmap,int y)
59static void draw_mode3_line(const device_config *screen, bitmap_t *bitmap, int y)
5960{
61   coupe_asic *asic = screen->machine->driver_data;
6062   int x;
61   unsigned char tmp=0;
6263
63   for (x=0;x<512;)
64   for (x = 0; x < 512;)
6465   {
65      tmp=*(videoram + (x/4) + (y*128));
66      UINT8 tmp = *(videoram + (x/4) + (y*128));
67
6668#ifdef MONO
67      if (tmp>>6)
68         plot_pixel(bitmap,x,y,127);
69      if (tmp >> 6)
70         plot_pixel(bitmap, x, y, 127);
6971      else
70         plot_pixel(bitmap,x,y,0);
72         plot_pixel(bitmap, x, y, 0);
7173      x++;
72      if ((tmp>>4)&0x03)
73         plot_pixel(bitmap,x,y,127);
74      if ((tmp >> 4) & 0x03)
75         plot_pixel(bitmap, x, y, 127);
7476      else
75         plot_pixel(bitmap,x,y,0);
77         plot_pixel(bitmap, x, y, 0);
7678      x++;
77      if ((tmp>>2)&0x03)
78         plot_pixel(bitmap,x,y,127);
79      if ((tmp >> 2) & 0x03)
80         plot_pixel(bitmap, x, y, 127);
7981      else
80         plot_pixel(bitmap,x,y,0);
82         plot_pixel(bitmap, x, y, 0);
8183      x++;
82      if (tmp&0x03)
83         plot_pixel(bitmap,x,y,127);
84      if (tmp & 0x03)
85         plot_pixel(bitmap, x, y, 127);
8486      else
85         plot_pixel(bitmap,x,y,0);
87         plot_pixel(bitmap, x, y, 0);
8688      x++;
8789#else
88      *BITMAP_ADDR16(bitmap, y, x) = samcoupe_regs.clut[tmp>>6];
90      *BITMAP_ADDR16(bitmap, y, x) = asic->clut[tmp >> 6];
8991      x++;
90      *BITMAP_ADDR16(bitmap, y, x) = samcoupe_regs.clut[(tmp>>4)&0x03];
92      *BITMAP_ADDR16(bitmap, y, x) = asic->clut[(tmp >> 4) & 0x03];
9193      x++;
92      *BITMAP_ADDR16(bitmap, y, x) = samcoupe_regs.clut[(tmp>>2)&0x03];
94      *BITMAP_ADDR16(bitmap, y, x) = asic->clut[(tmp >> 2) & 0x03];
9395      x++;
94      *BITMAP_ADDR16(bitmap, y, x) = samcoupe_regs.clut[tmp&0x03];
96      *BITMAP_ADDR16(bitmap, y, x) = asic->clut[tmp & 0x03];
9597      x++;
9698#endif
9799   }
98100}
99101
100static void drawMode2_line(bitmap_t *bitmap,int y)
102static void draw_mode2_line(const device_config *screen, bitmap_t *bitmap, int y)
101103{
102   int x,b,scrx;
103   unsigned char tmp=0;
104   unsigned short ink,pap;
105   unsigned char *attr;
104   coupe_asic *asic = screen->machine->driver_data;
105   int b, scrx = 0;
106   UINT16 ink = 127, pap = 0;
107   UINT8 *attr = videoram + 32*192 + y*32;
108   int x;
106109
107   attr=videoram + 32*192 + y*32;
108
109   scrx=0;
110   for (x=0;x<256/8;x++)
110   for (x = 0; x < 256/8; x++)
111111   {
112      tmp=*(videoram + x + (y*32));
113#ifdef MONO
114      ink = 127;
115      pap = 0;
116#else
117      ink = samcoupe_regs.clut[(*attr) & 0x07];
118      pap = samcoupe_regs.clut[((*attr)>>3) & 0x07];
112      UINT8 tmp = *(videoram + x + (y*32));
113
114#ifndef MONO
115      ink = asic->clut[(*attr) & 0x07];
116      pap = asic->clut[((*attr) >> 3) & 0x07];
119117#endif
118
120119      attr++;
121120
122      for (b=0x80;b!=0;b>>=1)
121      for (b = 0x80; b!= 0; b >>= 1)
123122      {
124         *BITMAP_ADDR16(bitmap, y, scrx++) = (tmp&b) ? ink : pap;
125         *BITMAP_ADDR16(bitmap, y, scrx++) = (tmp&b) ? ink : pap;
123         *BITMAP_ADDR16(bitmap, y, scrx++) = (tmp & b) ? ink : pap;
124         *BITMAP_ADDR16(bitmap, y, scrx++) = (tmp & b) ? ink : pap;
126125      }
127126   }
128127}
129128
130static void drawMode1_line(bitmap_t *bitmap,int y)
129static void draw_mode1_line(const device_config *screen, bitmap_t *bitmap, int y)
131130{
132   int x,b,scrx,scry;
133   unsigned char tmp=0;
134   unsigned short ink,pap;
135   unsigned char *attr;
131   coupe_asic *asic = screen->machine->driver_data;
132   int x, b;
133   UINT16 ink = 127, pap = 0;
134   UINT8 *attr = videoram + 32*192 + (y/8)*32;
136135
137   attr=videoram + 32*192 + (y/8)*32;
136   int scrx = 0;
137   int scry = ((y & 7) * 8) + ((y & 0x38) >> 3) + (y & 0xc0);
138138
139   scrx=0;
140   scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0);
141   for (x=0;x<256/8;x++)
139   for (x = 0; x < 256/8; x++)
142140   {
143      tmp=*(videoram + x + (y*32));
144#ifdef MONO
145      ink = 127;
146      pap = 0;
147#else
148      ink = samcoupe_regs.clut[(*attr) & 0x07];
149      pap = samcoupe_regs.clut[((*attr)>>3) & 0x07];
141      UINT8 tmp = *(videoram + x + (y*32));
142
143#ifndef MONO
144      ink = asic->clut[(*attr) & 0x07];
145      pap = asic->clut[((*attr)>>3) & 0x07];
150146#endif
147
151148      attr++;
152      for (b=0x80;b!=0;b>>=1)
149
150      for (b = 0x80; b != 0; b>>= 1)
153151      {
154         *BITMAP_ADDR16(bitmap, scry, scrx++) = (tmp&b) ? ink : pap;
155         *BITMAP_ADDR16(bitmap, scry, scrx++) = (tmp&b) ? ink : pap;
152         *BITMAP_ADDR16(bitmap, scry, scrx++) = (tmp & b) ? ink : pap;
153         *BITMAP_ADDR16(bitmap, scry, scrx++) = (tmp & b) ? ink : pap;
156154      }
157155   }
158156}
r3703r3704
160158VIDEO_UPDATE( samcoupe )
161159{
162160   int scanline = video_screen_get_vpos(screen);
161   coupe_asic *asic = screen->machine->driver_data;
163162
164163   /* line interrupt? */
165   if (samcoupe_regs.line_int == scanline) samcoupe_irq(screen->machine, 0x01);
164   if (asic->line_int == scanline)
165      samcoupe_irq(screen->machine->cpu[0], 0x01);
166166
167167   /* display disabled? (only in mode 3 or 4) */
168   if ((samcoupe_regs.vmpr & 0x40) && (samcoupe_regs.border & 0x80))
168   if ((asic->vmpr & 0x40) && (asic->border & 0x80))
169169   {
170      /* display is disabled, draw a black screen */
170171      fillbitmap(bitmap, 0, cliprect);
171172   }
172173   else
173174   {
174      switch ((samcoupe_regs.vmpr & 0x60) >> 5)
175      /* display enabled, draw line in the right screen mode */
176      switch ((asic->vmpr & 0x60) >> 5)
175177      {
176      case 0: /* mode 1 */
177         drawMode1_line(bitmap, scanline);
178         break;
179      case 1: /* mode 2 */
180         drawMode2_line(bitmap, scanline);
181         break;
182      case 2: /* mode 3 */
183         drawMode3_line(bitmap, scanline);
184         break;
185      case 3: /* mode 4 */
186         drawMode4_line(bitmap, scanline);
187         break;
178      case 0:   draw_mode1_line(screen, bitmap, scanline); break;
179      case 1:   draw_mode2_line(screen, bitmap, scanline); break;
180      case 2:   draw_mode3_line(screen, bitmap, scanline); break;
181      case 3:   draw_mode4_line(screen, bitmap, scanline); break;
188182      }
189183   }
190184
src/mess/includes/samcoupe.h
r3703r3704
1212#define SAMCOUPE_H_
1313
1414
15struct samcoupe_asic
15typedef struct _coupe_asic coupe_asic;
16struct _coupe_asic
1617{
1718   UINT8 lmpr, hmpr, vmpr; /* memory pages */
1819   UINT8 lext, hext;       /* extended memory page */
r3703r3704
2526
2627/*----------- defined in drivers/samcoupe.c -----------*/
2728
28void samcoupe_irq(running_machine *machine, UINT8 src);
29void samcoupe_irq(const device_config *device, UINT8 src);
2930
3031
3132/*----------- defined in machine/samcoupe.c -----------*/
3233
33extern struct samcoupe_asic samcoupe_regs;
34void samcoupe_update_memory(const address_space *space);
3435
35void samcoupe_update_memory(running_machine *machine);
36
3736WRITE8_HANDLER( samcoupe_ext_mem_w );
3837MACHINE_START( samcoupe );
3938MACHINE_RESET( samcoupe );
src/mess/machine/samcoupe.c
r3703r3704
1919#define HMPR_MCNTRL  0x80   /* If set external RAM is enabled */
2020
2121
22struct samcoupe_asic samcoupe_regs;
23
24
25static void samcoupe_update_bank(running_machine *machine, int bank, UINT8 *memory, int is_readonly)
22static void samcoupe_update_bank(const address_space *space, int bank, UINT8 *memory, int is_readonly)
2623{
27   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2824   read8_space_func rh = SMH_NOP;
2925   write8_space_func wh = SMH_NOP;
3026
3127   if (memory)
3228   {
33      memory_set_bankptr(machine,bank, memory);
29      memory_set_bankptr(space->machine, bank, memory);
3430      rh = (read8_space_func) (STATIC_BANK1 + (FPTR)bank - 1);
3531      wh = is_readonly ? SMH_UNMAP : (write8_space_func) (STATIC_BANK1 + (FPTR)bank - 1);
3632   }
r3703r3704
4036}
4137
4238
43static void samcoupe_install_ext_mem(running_machine *machine)
39static void samcoupe_install_ext_mem(const address_space *space)
4440{
41   coupe_asic *asic = space->machine->driver_data;
4542   UINT8 *mem;
4643
4744   /* bank 3 */
48   if (samcoupe_regs.lext >> 6 < mess_ram_size >> 20)
49      mem = &mess_ram[(mess_ram_size & 0xfffff) + (samcoupe_regs.lext >> 6) * 0x100000 + (samcoupe_regs.lext & 0x3f) * 0x4000];
45   if (asic->lext >> 6 < mess_ram_size >> 20)
46      mem = &mess_ram[(mess_ram_size & 0xfffff) + (asic->lext >> 6) * 0x100000 + (asic->lext & 0x3f) * 0x4000];
5047   else
5148      mem = NULL;
5249
53   samcoupe_update_bank(machine, 3, mem, FALSE);
50   samcoupe_update_bank(space, 3, mem, FALSE);
5451
5552   /* bank 4 */
56   if (samcoupe_regs.hext >> 6 < mess_ram_size >> 20)
57      mem = &mess_ram[(mess_ram_size & 0xfffff) + (samcoupe_regs.hext >> 6) * 0x100000 + (samcoupe_regs.hext & 0x3f) * 0x4000];
53   if (asic->hext >> 6 < mess_ram_size >> 20)
54      mem = &mess_ram[(mess_ram_size & 0xfffff) + (asic->hext >> 6) * 0x100000 + (asic->hext & 0x3f) * 0x4000];
5855   else
5956      mem = NULL;
6057
61   samcoupe_update_bank(machine, 4, mem, FALSE);
58   samcoupe_update_bank(space, 4, mem, FALSE);
6259}
6360
6461
65void samcoupe_update_memory(running_machine *machine)
62void samcoupe_update_memory(const address_space *space)
6663{
64   coupe_asic *asic = space->machine->driver_data;
6765   const int PAGE_MASK = ((mess_ram_size & 0xfffff) / 0x4000) - 1;
68   UINT8 *rom = memory_region(machine, "main");
66   UINT8 *rom = memory_region(space->machine, "main");
6967   UINT8 *memory;
7068   int is_readonly;
7169
7270   /* BANK1 */
73    if (samcoupe_regs.lmpr & LMPR_RAM0)   /* Is ram paged in at bank 1 */
71    if (asic->lmpr & LMPR_RAM0)   /* Is ram paged in at bank 1 */
7472   {
75      if ((samcoupe_regs.lmpr & 0x1F) <= PAGE_MASK)
76         memory = &mess_ram[(samcoupe_regs.lmpr & PAGE_MASK) * 0x4000];
73      if ((asic->lmpr & 0x1F) <= PAGE_MASK)
74         memory = &mess_ram[(asic->lmpr & PAGE_MASK) * 0x4000];
7775      else
7876         memory = NULL;   /* Attempt to page in non existant ram region */
7977      is_readonly = FALSE;
r3703r3704
8381      memory = rom;   /* Rom0 paged in */
8482      is_readonly = TRUE;
8583   }
86   samcoupe_update_bank(machine, 1, memory, is_readonly);
84   samcoupe_update_bank(space, 1, memory, is_readonly);
8785
8886
8987   /* BANK2 */
90   if (((samcoupe_regs.lmpr + 1) & 0x1f) <= PAGE_MASK)
91      memory = &mess_ram[((samcoupe_regs.lmpr + 1) & PAGE_MASK) * 0x4000];
88   if (((asic->lmpr + 1) & 0x1f) <= PAGE_MASK)
89      memory = &mess_ram[((asic->lmpr + 1) & PAGE_MASK) * 0x4000];
9290   else
9391      memory = NULL;   /* Attempt to page in non existant ram region */
94   samcoupe_update_bank(machine, 2, memory, FALSE);
92   samcoupe_update_bank(space, 2, memory, FALSE);
9593
9694   /* only update bank 3 and 4 when external memory is not enabled */
97   if (samcoupe_regs.hmpr & HMPR_MCNTRL)
95   if (asic->hmpr & HMPR_MCNTRL)
9896   {
99      samcoupe_install_ext_mem(machine);
97      samcoupe_install_ext_mem(space);
10098   }
10199   else
102100   {
103101      /* BANK3 */
104      if ((samcoupe_regs.hmpr & 0x1F) <= PAGE_MASK )
105         memory = &mess_ram[(samcoupe_regs.hmpr & PAGE_MASK)*0x4000];
102      if ((asic->hmpr & 0x1F) <= PAGE_MASK )
103         memory = &mess_ram[(asic->hmpr & PAGE_MASK)*0x4000];
106104      else
107105         memory = NULL;   /* Attempt to page in non existant ram region */
108      samcoupe_update_bank(machine, 3, memory, FALSE);
106      samcoupe_update_bank(space, 3, memory, FALSE);
109107
110108
111109      /* BANK4 */
112      if (samcoupe_regs.lmpr & LMPR_ROM1)   /* Is Rom1 paged in at bank 4 */
110      if (asic->lmpr & LMPR_ROM1)   /* Is Rom1 paged in at bank 4 */
113111      {
114112         memory = rom + 0x4000;
115113         is_readonly = TRUE;
116114      }
117115      else
118116      {
119         if (((samcoupe_regs.hmpr + 1) & 0x1f) <= PAGE_MASK)
120            memory = &mess_ram[((samcoupe_regs.hmpr + 1) & PAGE_MASK) * 0x4000];
117         if (((asic->hmpr + 1) & 0x1f) <= PAGE_MASK)
118            memory = &mess_ram[((asic->hmpr + 1) & PAGE_MASK) * 0x4000];
121119         else
122120            memory = NULL;   /* Attempt to page in non existant ram region */
123121         is_readonly = FALSE;
124122      }
125      samcoupe_update_bank(machine, 4, memory, FALSE);
123      samcoupe_update_bank(space, 4, memory, FALSE);
126124   }
127125
128126   /* video memory location */
129   if (samcoupe_regs.vmpr & 0x40)   /* if bit set in 2 bank screen mode */
130      videoram = &mess_ram[((samcoupe_regs.vmpr & 0x1e) & PAGE_MASK) * 0x4000];
127   if (asic->vmpr & 0x40)   /* if bit set in 2 bank screen mode */
128      videoram = &mess_ram[((asic->vmpr & 0x1e) & PAGE_MASK) * 0x4000];
131129   else
132      videoram = &mess_ram[((samcoupe_regs.vmpr & 0x1f) & PAGE_MASK) * 0x4000];
130      videoram = &mess_ram[((asic->vmpr & 0x1f) & PAGE_MASK) * 0x4000];
133131}
134132
135133
136134WRITE8_HANDLER( samcoupe_ext_mem_w )
137135{
136   const address_space *space_program = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
137   coupe_asic *asic = space->machine->driver_data;
138
138139   if (offset & 1)
139      samcoupe_regs.hext = data;
140      asic->hext = data;
140141   else
141      samcoupe_regs.lext = data;
142      asic->lext = data;
142143
143144   /* external RAM enabled? */
144   if (samcoupe_regs.hmpr & HMPR_MCNTRL)
145   if (asic->hmpr & HMPR_MCNTRL)
145146   {
146      samcoupe_install_ext_mem(space->machine);
147      samcoupe_install_ext_mem(space_program);
147148   }
148149}
149150
r3703r3704
164165
165166MACHINE_RESET( samcoupe )
166167{
168   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
167169   const address_space *spaceio = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
168   memset(&samcoupe_regs, 0, sizeof(samcoupe_regs));
169   
170   samcoupe_regs.lmpr = 0x0f;      /* ROM0 paged in, ROM1 paged out RAM Banks */
171   samcoupe_regs.hmpr = 0x01;
172   samcoupe_regs.vmpr = 0x81;
173   samcoupe_regs.line_int = 0xff;  /* line interrupts disabled */
174   samcoupe_regs.status = 0x1f;    /* no interrupts active */
170   coupe_asic *asic = machine->driver_data;
175171
172   asic->lmpr = 0x0f;      /* ROM0 paged in, ROM1 paged out RAM Banks */
173   asic->hmpr = 0x01;
174   asic->vmpr = 0x81;
175   asic->line_int = 0xff;  /* line interrupts disabled */
176   asic->status = 0x1f;    /* no interrupts active */
177
176178   if (input_port_read(machine, "config") & 0x01)
177179   {
178180      /* install RTC */
r3703r3704
184186      memory_install_readwrite8_handler(spaceio, 0xef, 0xef, 0xffff, 0xff00, SMH_UNMAP, SMH_UNMAP);
185187   }
186188
187   samcoupe_update_memory(machine);
189   samcoupe_update_memory(space);
188190}
189191
190192
src/mess/drivers/samcoupe.c
r3703r3704
2525                  the future to support others
2626
2727Note on the bioses:
28 SAM Coupé ROM Images
28 SAM Coupe ROM Images
2929 --------------------
3030
31 This archive contains many versions of the SAM Coupé 32K ROM image, released
31 This archive contains many versions of the SAM Coupe 32K ROM image, released
3232 with kind permission from the ROM author, Dr Andy Wright.
3333
3434 Thanks to Simon N Goodwin for supplying the files, which include two dumped
3535 from pre-production hardware (and which only work with the early hardware!).
36   
36
3737 Beware - the early ROMs are very buggy, and tend to go mad once BASIC starts
3838 paging.  ROM 10 (version 1.0) requires the CALL after F9 or BOOT because the
3939 ROM loads the bootstrap but fails to execute it. The address depends on the
r3703r3704
121121   if (offset & 0x100)
122122   {
123123      /* return either the current line or 192 for the vblank area */
124      int line = video_screen_get_vpos(space->machine->primary_screen);
124      int line = video_screen_get_vpos(space->machine->primary_screen);
125125      data = video_screen_get_vblank(space->machine->primary_screen) ? 192 : line;
126126   }
127127   else
r3703r3704
135135
136136
137137static WRITE8_HANDLER( samcoupe_clut_w )
138{   
139   samcoupe_regs.clut[(offset >> 8) & 0x0f] = data & 0x7f;
138{
139   coupe_asic *asic = space->machine->driver_data;
140   asic->clut[(offset >> 8) & 0x0f] = data & 0x7f;
140141}
141142
142143
143144static READ8_HANDLER( samcoupe_status_r )
144145{
146   coupe_asic *asic = space->machine->driver_data;
145147   UINT8 data = 0xe0;
146148   UINT8 row = ~(offset >> 8);
147149
r3703r3704
154156   if (row & 0x02) data &= input_port_read(space->machine, "keyboard_row_fd") & 0xe0;
155157   if (row & 0x01) data &= input_port_read(space->machine, "keyboard_row_fe") & 0xe0;
156158
157   return data | samcoupe_regs.status;
159   return data | asic->status;
158160}
159161
160162
161163static WRITE8_HANDLER( samcoupe_line_int_w )
162164{
163   samcoupe_regs.line_int = data;
165   coupe_asic *asic = space->machine->driver_data;
166   asic->line_int = data;
164167}
165168
166169
167170static READ8_HANDLER( samcoupe_lmpr_r )
168171{
169   return samcoupe_regs.lmpr;
172   coupe_asic *asic = space->machine->driver_data;
173   return asic->lmpr;
170174}
171175
172176
173177static WRITE8_HANDLER( samcoupe_lmpr_w )
174178{
175   samcoupe_regs.lmpr = data;
176   samcoupe_update_memory(space->machine);
179   const address_space *space_program = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
180   coupe_asic *asic = space->machine->driver_data;
181   asic->lmpr = data;
182   samcoupe_update_memory(space_program);
177183}
178184
179185
180186static READ8_HANDLER( samcoupe_hmpr_r )
181187{
182   return samcoupe_regs.hmpr;
188   coupe_asic *asic = space->machine->driver_data;
189   return asic->hmpr;
183190}
184191
185192
186193static WRITE8_HANDLER( samcoupe_hmpr_w )
187194{
188   samcoupe_regs.hmpr = data;
189   samcoupe_update_memory(space->machine);
195   const address_space *space_program = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
196   coupe_asic *asic = space->machine->driver_data;
197   asic->hmpr = data;
198   samcoupe_update_memory(space_program);
190199}
191200
192201
193202static READ8_HANDLER( samcoupe_vmpr_r )
194203{
195   return samcoupe_regs.vmpr;
204   coupe_asic *asic = space->machine->driver_data;
205   return asic->vmpr;
196206}
197207
198208
199209static WRITE8_HANDLER( samcoupe_vmpr_w )
200210{
201   samcoupe_regs.vmpr = data;
202   samcoupe_update_memory(space->machine);
211   const address_space *space_program = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
212   coupe_asic *asic = space->machine->driver_data;
213   asic->vmpr = data;
214   samcoupe_update_memory(space_program);
203215}
204216
205217
r3703r3704
243255
244256static WRITE8_HANDLER( samcoupe_border_w )
245257{
246   samcoupe_regs.border = data;
258   coupe_asic *asic = space->machine->driver_data;
259   asic->border = data;
247260
248261   /* DAC output state */
249262   speaker_level_w(0,(data >> 4) & 0x01);
r3703r3704
260273   else
261274   {
262275      /* TODO: This actually needs to return various attributes
263      * of the currently displayed screen data */
276        * of the currently displayed screen data */
264277      return 0x00;
265278   }
266279}
r3703r3704
313326
314327static TIMER_CALLBACK( irq_off )
315328{
329   coupe_asic *asic = machine->driver_data;
330
316331   /* clear interrupt */
317332   cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE);
318   
333
319334   /* adjust STATUS register */
320   samcoupe_regs.status |= param;
335   asic->status |= param;
321336}
322337
323338
324void samcoupe_irq(running_machine *machine, UINT8 src)
339void samcoupe_irq(const device_config *device, UINT8 src)
325340{
341   coupe_asic *asic = device->machine->driver_data;
342
326343   /* set irq and a timer to set it off again */
327   cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
344   cpu_set_input_line(device, 0, HOLD_LINE);
328345   timer_set(ATTOTIME_IN_USEC(20), NULL, src, irq_off);
329   
346
330347   /* adjust STATUS register */
331   samcoupe_regs.status &= ~src;
348   asic->status &= ~src;
332349}
333350
334351
335352static INTERRUPT_GEN( samcoupe_frame_interrupt )
336353{
337354   /* signal frame interrupt */
338   samcoupe_irq(device->machine, 0x08);
355   samcoupe_irq(device, 0x08);
339356}
340357
341358
r3703r3704
514531   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE)
515532
516533   /* devices */
534   MDRV_DRIVER_DATA(coupe_asic)
517535   MDRV_DEVICE_ADD("sambus_clock", MSM6242)
518536
519537   /* sound hardware */
r3703r3704
532550 *
533551 *************************************/
534552
535/*
536   The bios is actually 32K. This is the combined version of the two old 16K MESS roms.
537   It does match the 3.0 one the most, but the first half differs in one byte
538   and in the second half, the case of the "plc" in the company string differs.
553/*
554    The bios is actually 32K. This is the combined version of the two old 16K MESS roms.
555    It does match the 3.0 one the most, but the first half differs in one byte
556    and in the second half, the case of the "plc" in the company string differs.
539557*/
540558ROM_START( samcoupe )
541559   ROM_REGION( 0x8000, "main", 0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team