src/mess/video/avigo.c
| r1721 | r1722 | |
| 14 | 14 | Start the video hardware emulation. |
| 15 | 15 | ***************************************************************************/ |
| 16 | 16 | |
| 17 | | /* backdrop */ |
| 18 | | //struct artwork_info *avigo_backdrop; |
| 19 | | |
| 20 | 17 | /* mem size = 0x017c0 */ |
| 21 | 18 | |
| 22 | 19 | static unsigned char *avigo_video_memory; |
| r1721 | r1722 | |
| 59 | 56 | stylus_y = y; |
| 60 | 57 | } |
| 61 | 58 | |
| 62 | | READ8_HANDLER(avigo_vid_memory_r) |
| 59 | READ8_HANDLER(avigo_vid_memory_r) |
| 63 | 60 | { |
| 64 | 61 | unsigned char *ptr; |
| 65 | 62 | |
| r1721 | r1722 | |
| 126 | 123 | avigo_video_memory = auto_malloc(((AVIGO_SCREEN_WIDTH>>3)*AVIGO_SCREEN_HEIGHT)); |
| 127 | 124 | machine->gfx[0] = stylus_pointer = allocgfx(&pointerlayout); |
| 128 | 125 | 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;*/ |
| 131 | 126 | stylus_pointer->total_colors = 3; |
| 132 | 127 | stylus_color_table[1] = machine->pens[0]; |
| 133 | 128 | stylus_color_table[2] = machine->pens[1]; |
| 134 | 129 | } |
| 135 | 130 | |
| 136 | | /* two colours */ |
| 137 | | static const unsigned short avigo_colour_table[AVIGO_NUM_COLOURS] = |
| 138 | | { |
| 139 | | 0, 1 |
| 140 | | }; |
| 141 | | |
| 142 | | /* black/white */ |
| 143 | | static const unsigned char avigo_palette[AVIGO_NUM_COLOURS * 3] = |
| 144 | | { |
| 145 | | 0x0ff, 0x0ff, 0x0ff, |
| 146 | | 0x000, 0x000, 0x000 |
| 147 | | }; |
| 148 | | |
| 149 | | |
| 150 | 131 | /* Initialise the palette */ |
| 151 | 132 | PALETTE_INIT( avigo ) |
| 152 | 133 | { |
| 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 */ |
| 185 | 136 | } |
| 137 | |
| 186 | 138 | static unsigned int avigo_ad_x; |
| 187 | 139 | static unsigned int avigo_ad_y; |
| 188 | 140 | |
| 189 | | |
| 190 | | |
| 191 | 141 | /*************************************************************************** |
| 192 | 142 | Draw the game screen in the given mame_bitmap. |
| 193 | 143 | Do NOT call osd_update_display() from this function, |
| r1721 | r1722 | |
| 195 | 145 | ***************************************************************************/ |
| 196 | 146 | VIDEO_UPDATE( avigo ) |
| 197 | 147 | { |
| 198 | | int y; |
| 199 | | int b; |
| 200 | | int x; |
| 201 | | int pens[2]; |
| 148 | int y; |
| 149 | int b; |
| 150 | int x; |
| 202 | 151 | rectangle r; |
| 203 | 152 | |
| 204 | 153 | /* 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)); |
| 207 | 158 | |
| 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 | { |
| 217 | 162 | int px; |
| 218 | | unsigned char byte; |
| 163 | unsigned char byte; |
| 219 | 164 | |
| 220 | | byte = line_ptr[0]; |
| 165 | byte = line_ptr[0]; |
| 221 | 166 | |
| 222 | 167 | 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++; |
| 227 | 172 | byte = byte<<1; |
| 228 | | } |
| 173 | } |
| 229 | 174 | |
| 230 | | x = px; |
| 175 | x = px; |
| 176 | line_ptr = line_ptr+1; |
| 177 | } |
| 178 | } |
| 231 | 179 | |
| 232 | | line_ptr = line_ptr+1; |
| 233 | | } |
| 234 | | } |
| 235 | | |
| 236 | 180 | r.min_x = 0; |
| 237 | 181 | r.max_x = AVIGO_SCREEN_WIDTH; |
| 238 | 182 | r.min_y = 0; |
| 239 | 183 | r.max_y = AVIGO_SCREEN_HEIGHT; |
| 240 | 184 | |
| 241 | 185 | /* 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 |
| 245 | 188 | { |
| 246 | 189 | |
| 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); |
| 251 | 194 | } |
| 252 | 195 | { |
| 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; |
| 260 | 203 | |
| 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); |
| 264 | 207 | } |
| 208 | #endif |
| 265 | 209 | return 0; |
| 266 | 210 | } |
| 267 | 211 | |