src/mess/video/hp48.c
| r1876 | r1877 | |
| 1 | 1 | #include "driver.h" |
| 2 | | #include "mslegacy.h" |
| 3 | | |
| 4 | 2 | #include "includes/hp48.h" |
| 5 | 3 | |
| 6 | 4 | static const UINT8 hp48_palette[] = |
| r1876 | r1877 | |
| 14 | 12 | |
| 15 | 13 | PALETTE_INIT( hp48 ) |
| 16 | 14 | { |
| 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 | } |
| 18 | 20 | } |
| 19 | 21 | |
| 20 | 22 | |
| r1876 | r1877 | |
| 103 | 105 | |
| 104 | 106 | #define DOWN 98 |
| 105 | 107 | #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)\ |
| 109 | 111 | |(hp48_hardware.data[0x22]<<8)|(hp48_hardware.data[0x23]<<12)\ |
| 110 | 112 | |(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)) |
| 111 | 117 | |
| 112 | 118 | #define LCD_LINE_OFFSET (hp48_hardware.data[0x25]|(hp48_hardware.data[0x26]<<4)\ |
| 113 | 119 | |(hp48_hardware.data[0x27]<<8)) |
| 114 | 120 | |
| 115 | 121 | VIDEO_UPDATE( hp48 ) |
| 116 | 122 | { |
| 117 | | int x, y, i; |
| 123 | int x, y, i, p, data, max_y; |
| 118 | 124 | 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)); |
| 120 | 126 | |
| 121 | 127 | /* HJB: we cannot initialize array with values from other arrays, thus... */ |
| 122 | 128 | color[0] = machine->pens[0]; |
| 123 | 129 | // color[0] = machine->pens[1]; |
| 124 | 130 | color[1] = machine->pens[1]; |
| 125 | 131 | |
| 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 | } |
| 126 | 137 | |
| 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 ); |
| 128 | 143 | 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 | } |
| 134 | 151 | } |
| 152 | i += 34 + LCD_LINE_OFFSET; |
| 135 | 153 | } |
| 136 | 154 | |
| 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 | |
| 137 | 172 | 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]); |
| 139 | 174 | hp48_draw_special(bitmap,RIGHT+57,DOWN-13,hp48_blue, |
| 140 | 175 | hp48_hardware.data[0xb]&2?color[1]:color[0]); |
| 141 | 176 | hp48_draw_special(bitmap,RIGHT+102,DOWN-13,hp48_alpha, |