Previous 15994 Revisions Next

r1722 Sunday 24th February, 2008 at 17:17:18 UTC by R. Belmont
[AVIGO] Small video draw cleanup.
[src/mess/video]avigo.c

src/mess/video/avigo.c
r1721r1722
1414  Start the video hardware emulation.
1515***************************************************************************/
1616
17/* backdrop */
18//struct artwork_info *avigo_backdrop;
19
2017/* mem size = 0x017c0 */
2118
2219static unsigned char *avigo_video_memory;
r1721r1722
5956   stylus_y = y;
6057}
6158
62 READ8_HANDLER(avigo_vid_memory_r)
59READ8_HANDLER(avigo_vid_memory_r)
6360{
6461        unsigned char *ptr;
6562
r1721r1722
126123    avigo_video_memory = auto_malloc(((AVIGO_SCREEN_WIDTH>>3)*AVIGO_SCREEN_HEIGHT));
127124   machine->gfx[0] = stylus_pointer = allocgfx(&pointerlayout);
128125   decodegfx(stylus_pointer, pointermask, 0, 1);
129   /* 7-Sep-2007 - After 0.118u5, you cannot revector the color table */
130   /*stylus_pointer->colortable = stylus_color_table;*/
131126   stylus_pointer->total_colors = 3;
132127   stylus_color_table[1] = machine->pens[0];
133128   stylus_color_table[2] = machine->pens[1];
134129}
135130
136/* two colours */
137static const unsigned short avigo_colour_table[AVIGO_NUM_COLOURS] =
138{
139   0, 1
140};
141
142/* black/white */
143static const unsigned char avigo_palette[AVIGO_NUM_COLOURS * 3] =
144{
145    0x0ff, 0x0ff, 0x0ff,
146    0x000, 0x000, 0x000
147};
148
149
150131/* Initialise the palette */
151132PALETTE_INIT( avigo )
152133{
153/*   char *backdrop_name;
154    int used = 2; */
155   palette_set_colors_rgb(machine, 0, avigo_palette, sizeof(avigo_palette) / 3);
156
157   /* load backdrop */
158#if 0
159   backdrop_name = malloc(strlen(machine->gamedrv->name)+4+1);
160
161    if (backdrop_name!=NULL)
162   {
163      strcpy(backdrop_name, machine->gamedrv->name);
164      strcat(backdrop_name, ".png");
165
166      logerror("%s\n",backdrop_name);
167
168        artwork_load(&avigo_backdrop, backdrop_name, used,machine->config->total_colors-used);
169
170      if (avigo_backdrop)
171      {
172         LOG(("backdrop %s successfully loaded\n", backdrop_name));
173            memcpy (&sys_palette[used * 3], avigo_backdrop->orig_palette,
174                    avigo_backdrop->num_pens_used * 3 * sizeof (unsigned char));
175      }
176      else
177      {
178         logerror("no backdrop loaded\n");
179      }
180
181        free(backdrop_name);
182      backdrop_name = NULL;
183   }
184#endif
134   palette_set_color(machine,0,MAKE_RGB(0xff,0xff,0xff)); /* white  */
135   palette_set_color(machine,1,MAKE_RGB(0x00,0x00,0x00)); /* black  */
185136}
137
186138static unsigned int avigo_ad_x;
187139static unsigned int avigo_ad_y;
188140
189
190
191141/***************************************************************************
192142  Draw the game screen in the given mame_bitmap.
193143  Do NOT call osd_update_display() from this function,
r1721r1722
195145***************************************************************************/
196146VIDEO_UPDATE( avigo )
197147{
198    int y;
199    int b;
200    int x;
201    int pens[2];
148   int y;
149   int b;
150   int x;
202151   rectangle r;
203152
204153   /* draw avigo display */
205    pens[0] = machine->pens[0];
206    pens[1] = machine->pens[1];
154   for (y=0; y<AVIGO_SCREEN_HEIGHT; y++)
155   {
156      int by;
157      unsigned char *line_ptr = avigo_video_memory +  (y*(AVIGO_SCREEN_WIDTH>>3));
207158
208    for (y=0; y<AVIGO_SCREEN_HEIGHT; y++)
209    {
210        int by;
211
212        unsigned char *line_ptr = avigo_video_memory +  (y*(AVIGO_SCREEN_WIDTH>>3));
213
214        x = 0;
215        for (by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--)
216        {
159      x = 0;
160      for (by=((AVIGO_SCREEN_WIDTH>>3)-1); by>=0; by--)
161      {
217162         int px;
218            unsigned char byte;
163         unsigned char byte;
219164
220            byte = line_ptr[0];
165         byte = line_ptr[0];
221166
222167         px = x;
223            for (b=7; b>=0; b--)
224            {
225            *BITMAP_ADDR16(bitmap, y, px) = pens[(byte>>7) & 0x01];
226                px++;
168         for (b=7; b>=0; b--)
169         {
170            *BITMAP_ADDR16(bitmap, y, px) = ((byte>>7) & 0x01);
171            px++;
227172            byte = byte<<1;
228            }
173         }
229174
230            x = px;
175         x = px;
176         line_ptr = line_ptr+1;
177      }
178   }
231179
232            line_ptr = line_ptr+1;
233        }
234     }
235
236180   r.min_x = 0;
237181   r.max_x = AVIGO_SCREEN_WIDTH;
238182   r.min_y = 0;
239183   r.max_y = AVIGO_SCREEN_HEIGHT;
240184
241185   /* draw stylus marker */
242   drawgfx (bitmap, stylus_pointer, 0, 0, 0, 0,
243          stylus_x, stylus_y, &r, TRANSPARENCY_PEN, 0);
244
186   drawgfx (bitmap, stylus_pointer, 0, 0, 0, 0, stylus_x, stylus_y, &r, TRANSPARENCY_PEN, 0);
187#if 0
245188   {
246189
247      char   avigo_text[256];
248      sprintf(avigo_text,"X: %03x Y: %03x",avigo_ad_x, avigo_ad_y);
249      // FIXME
250      //ui_draw_text(avigo_text, 0, 200);
190   char   avigo_text[256];
191   sprintf(avigo_text,"X: %03x Y: %03x",avigo_ad_x, avigo_ad_y);
192   // FIXME
193   //ui_draw_text(avigo_text, 0, 200);
251194   }
252195   {
253      int xb,yb,zb,ab,bb;
254      char   avigo_text[256];
255      xb =cpunum_read_byte(0,0x0c1cf) & 0x0ff;
256      yb = cpunum_read_byte(0,0x0c1d0) & 0x0ff;
257      zb =cpunum_read_byte(0,0x0c1d1) & 0x0ff;
258      ab = cpunum_read_byte(0,0x0c1d2) & 0x0ff;
259      bb =cpunum_read_byte(0,0x0c1d3) & 0x0ff;
196   int xb,yb,zb,ab,bb;
197   char   avigo_text[256];
198   xb =cpunum_read_byte(0,0x0c1cf) & 0x0ff;
199   yb = cpunum_read_byte(0,0x0c1d0) & 0x0ff;
200   zb =cpunum_read_byte(0,0x0c1d1) & 0x0ff;
201   ab = cpunum_read_byte(0,0x0c1d2) & 0x0ff;
202   bb =cpunum_read_byte(0,0x0c1d3) & 0x0ff;
260203
261      sprintf(avigo_text,"Xb: %02x Yb: %02x zb: %02x ab:%02x bb:%02x",xb, yb,zb,ab,bb);
262      // FIXME
263      //ui_draw_text(avigo_text, 0, 216+16);
204   sprintf(avigo_text,"Xb: %02x Yb: %02x zb: %02x ab:%02x bb:%02x",xb, yb,zb,ab,bb);
205   // FIXME
206   //ui_draw_text(avigo_text, 0, 216+16);
264207   }
208#endif
265209   return 0;
266210}
267211

Previous 15994 Revisions Next


© 1998-2018 The MESS Team