Previous 15994 Revisions Next

r1877 Sunday 9th March, 2008 at 18:31:46 UTC by Wilbert Pol
[HP48] Updated video code a bit.
[src/mess/video]hp48.c

src/mess/video/hp48.c
r1876r1877
11#include "driver.h"
2#include "mslegacy.h"
3
42#include "includes/hp48.h"
53
64static const UINT8 hp48_palette[] =
r1876r1877
1412
1513PALETTE_INIT( hp48 )
1614{
17   palette_set_colors_rgb(machine, 0, hp48_palette, sizeof(hp48_palette) / 3);
15   int i;
16
17   for ( i = 0; i < 4; i++ ) {
18      palette_set_color_rgb( machine, i, hp48_palette[i*3], hp48_palette[i*3+1], hp48_palette[i*3+2] );
19   }
1820}
1921
2022
r1876r1877
103105
104106#define DOWN 98
105107#define RIGHT 40
106#define LCD_ENABLE hp48_hardware.data[0]&8
107#define LCD_VERTICAL_OFFSET hp48_hardware.data[0]&7
108#define LCD_BASE_ADDRESS (hp48_hardware.data[0x20]|(hp48_hardware.data[0x21]<<4)\
108#define LCD_ENABLE (hp48_hardware.data[0]&8)
109#define LCD_VERTICAL_OFFSET (hp48_hardware.data[0]&7)
110#define LCD_MAIN_BASE_ADDRESS (hp48_hardware.data[0x20]|(hp48_hardware.data[0x21]<<4)\
109111      |(hp48_hardware.data[0x22]<<8)|(hp48_hardware.data[0x23]<<12)\
110112      |(hp48_hardware.data[0x24]<<16))
113#define LCD_MENU_BASE_ADDRESS (hp48_hardware.data[0x30]|(hp48_hardware.data[0x31]<<4)\
114      |(hp48_hardware.data[0x32]<<8)|(hp48_hardware.data[0x33]<<12)\
115      |(hp48_hardware.data[0x34]<<16))
116#define LCD_MAIN_SIZE (hp48_hardware.data[0x28]|(hp48_hardware.data[0x29]<<4))
111117
112118#define LCD_LINE_OFFSET (hp48_hardware.data[0x25]|(hp48_hardware.data[0x26]<<4)\
113119      |(hp48_hardware.data[0x27]<<8))
114120
115121VIDEO_UPDATE( hp48 )
116122{
117   int x, y, i;
123   int x, y, i, p, data, max_y;
118124   int color[2];
119   int contrast=(hp48_hardware.data[1]|((hp48_hardware.data[2]&1)<<4));
125//   int contrast=(hp48_hardware.data[1]|((hp48_hardware.data[2]&1)<<4));
120126
121127   /* HJB: we cannot initialize array with values from other arrays, thus... */
122128    color[0] = machine->pens[0];
123129//    color[0] = machine->pens[1];
124130   color[1] = machine->pens[1];
125131
132   i = LCD_MAIN_BASE_ADDRESS;
133   max_y = MIN(64, LCD_MAIN_SIZE + 1 );
134   if ( max_y < 3 ) {
135      max_y = 64;
136   }
126137
127   for (y=0,i=LCD_BASE_ADDRESS; y<64; y+=8, i+=LCD_LINE_OFFSET) {
138   i = LCD_MAIN_BASE_ADDRESS;
139   for (y=0; y< max_y; y++) {
140      int j = ( LCD_VERTICAL_OFFSET & 4 ? 1 : 0 );
141      p = LCD_VERTICAL_OFFSET & 0x03;
142      data = program_read_byte( i + j );
128143      for (x=0; x<131; x++) {
129         drawgfx(bitmap, machine->gfx[0],
130               program_read_byte(i+x),
131               contrast,0,0,
132               x*2+RIGHT,y*2+DOWN,
133               0, TRANSPARENCY_NONE,0);
144         *BITMAP_ADDR16(bitmap, DOWN + y, RIGHT + x) = ( ( data << p ) & 0x08 ) ? 3 : 2;
145         p++;
146         if ( p > 3 ) {
147            j++;
148            data = program_read_byte( i + j );
149            p = 0;
150         }
134151      }
152      i += 34 + LCD_LINE_OFFSET;
135153   }
136154
155   i = LCD_MENU_BASE_ADDRESS;
156   for ( ; y < 64; y++ ) {
157      int j = 0;
158      p = 0;
159      data = program_read_byte( i + j );
160      for ( x = 0; x < 131; x++ ) {
161         *BITMAP_ADDR16(bitmap, DOWN + y, RIGHT + x) = ( ( data << p ) & 0x08 ) ? 3 : 2;
162         p++;
163         if ( p > 3 ) {
164            j++;
165            data = program_read_byte( i + j );
166            p = 0;
167         }
168      }
169      i += 34;
170   }
171
137172   hp48_draw_special(bitmap,RIGHT+12,DOWN-13,hp48_orange,
138                 hp48_hardware.data[0xb]&1?color[1]:color[0]);
173                 hp48_hardware.data[0xb]&1?color[1]:color[1]);
139174   hp48_draw_special(bitmap,RIGHT+57,DOWN-13,hp48_blue,
140175                 hp48_hardware.data[0xb]&2?color[1]:color[0]);
141176   hp48_draw_special(bitmap,RIGHT+102,DOWN-13,hp48_alpha,

Previous 15994 Revisions Next


© 1998-2018 The MESS Team