src/mess/video/pc_video_mess.c
| r10616 | r10617 | |
| 1 | | /********************************************************************* |
| 2 | | |
| 3 | | pc_video.c |
| 4 | | |
| 5 | | PC Video code |
| 6 | | |
| 7 | | *********************************************************************/ |
| 8 | | |
| 9 | | #include "emu.h" |
| 10 | | #include "memconv.h" |
| 11 | | #include "includes/crtc6845.h" |
| 12 | | #include "video/pc_video_mess.h" |
| 13 | | |
| 14 | | |
| 15 | | |
| 16 | | /*************************************************************************** |
| 17 | | |
| 18 | | Local variables |
| 19 | | |
| 20 | | ***************************************************************************/ |
| 21 | | |
| 22 | | size_t pc_videoram_size; |
| 23 | | UINT8 *pc_videoram; |
| 24 | | |
| 25 | | static pc_video_update_proc (*pc_choosevideomode)(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc); |
| 26 | | static struct mscrtc6845 *pc_crtc; |
| 27 | | static int pc_anythingdirty; |
| 28 | | static int pc_current_height; |
| 29 | | static int pc_current_width; |
| 30 | | static const UINT16 dummy_palette[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; |
| 31 | | |
| 32 | | |
| 33 | | |
| 34 | | /**************************************************************************/ |
| 35 | | |
| 36 | | static STATE_POSTLOAD( pc_video_postload ) |
| 37 | | { |
| 38 | | pc_anythingdirty = 1; |
| 39 | | pc_current_height = -1; |
| 40 | | pc_current_width = -1; |
| 41 | | } |
| 42 | | |
| 43 | | |
| 44 | | |
| 45 | | struct mscrtc6845 *pc_video_start(running_machine *machine, const struct mscrtc6845_config *config, |
| 46 | | pc_video_update_proc (*choosevideomode)(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc), |
| 47 | | size_t vramsize) |
| 48 | | { |
| 49 | | pc_choosevideomode = choosevideomode; |
| 50 | | pc_crtc = NULL; |
| 51 | | pc_anythingdirty = 1; |
| 52 | | pc_current_height = -1; |
| 53 | | pc_current_width = -1; |
| 54 | | machine->generic.tmpbitmap = NULL; |
| 55 | | |
| 56 | | pc_videoram_size = vramsize; |
| 57 | | if (config) |
| 58 | | { |
| 59 | | pc_crtc = mscrtc6845_init(machine, config); |
| 60 | | if (!pc_crtc) |
| 61 | | return NULL; |
| 62 | | } |
| 63 | | |
| 64 | | if (pc_videoram_size) |
| 65 | | { |
| 66 | | video_start_generic_bitmapped(machine); |
| 67 | | } |
| 68 | | |
| 69 | | machine->state().register_postload(pc_video_postload, NULL); |
| 70 | | return pc_crtc; |
| 71 | | } |
| 72 | | |
| 73 | | |
| 74 | | |
| 75 | | SCREEN_UPDATE( pc_video ) |
| 76 | | { |
| 77 | | UINT32 rc = 0; |
| 78 | | int w = 0, h = 0; |
| 79 | | pc_video_update_proc video_update; |
| 80 | | |
| 81 | | if (pc_crtc) |
| 82 | | { |
| 83 | | w = mscrtc6845_get_char_columns(pc_crtc); |
| 84 | | h = mscrtc6845_get_char_height(pc_crtc) * mscrtc6845_get_char_lines(pc_crtc); |
| 85 | | } |
| 86 | | |
| 87 | | video_update = pc_choosevideomode(screen->machine, &w, &h, pc_crtc); |
| 88 | | |
| 89 | | if (video_update) |
| 90 | | { |
| 91 | | if ((pc_current_width != w) || (pc_current_height != h)) |
| 92 | | { |
| 93 | | int width = screen->width(); |
| 94 | | int height = screen->height(); |
| 95 | | |
| 96 | | pc_current_width = w; |
| 97 | | pc_current_height = h; |
| 98 | | pc_anythingdirty = 1; |
| 99 | | |
| 100 | | if (pc_current_width > width) |
| 101 | | pc_current_width = width; |
| 102 | | if (pc_current_height > height) |
| 103 | | pc_current_height = height; |
| 104 | | |
| 105 | | if ((pc_current_width > 100) && (pc_current_height > 100)) |
| 106 | | screen->set_visible_area(0, pc_current_width-1, 0, pc_current_height-1); |
| 107 | | |
| 108 | | bitmap_fill(bitmap, cliprect, 0); |
| 109 | | } |
| 110 | | |
| 111 | | video_update(screen->machine->generic.tmpbitmap ? screen->machine->generic.tmpbitmap : bitmap, pc_crtc); |
| 112 | | |
| 113 | | if (screen->machine->generic.tmpbitmap) |
| 114 | | { |
| 115 | | copybitmap(bitmap, screen->machine->generic.tmpbitmap, 0, 0, 0, 0, cliprect); |
| 116 | | if (!pc_anythingdirty) |
| 117 | | rc = UPDATE_HAS_NOT_CHANGED; |
| 118 | | pc_anythingdirty = 0; |
| 119 | | } |
| 120 | | } |
| 121 | | return rc; |
| 122 | | } |
| 123 | | |
| 124 | | |
| 125 | | |
| 126 | | WRITE8_HANDLER ( pc_video_videoram_w ) |
| 127 | | { |
| 128 | | UINT8 *videoram = pc_videoram; |
| 129 | | if (videoram && videoram[offset] != data) |
| 130 | | { |
| 131 | | videoram[offset] = data; |
| 132 | | pc_anythingdirty = 1; |
| 133 | | } |
| 134 | | } |
| 135 | | |
| 136 | | |
| 137 | | WRITE16_HANDLER( pc_video_videoram16le_w ) { write16le_with_write8_handler(pc_video_videoram_w, space, offset, data, mem_mask); } |
| 138 | | |
| 139 | | WRITE32_HANDLER( pc_video_videoram32_w ) |
| 140 | | { |
| 141 | | UINT32 *videoram = (UINT32 *)pc_videoram; |
| 142 | | COMBINE_DATA(videoram + offset); |
| 143 | | pc_anythingdirty = 1; |
| 144 | | } |
src/mess/video/pc_vga_mess.c
| r10616 | r10617 | |
| 30 | 30 | |
| 31 | 31 | #include "emu.h" |
| 32 | 32 | #include "pc_vga_mess.h" |
| 33 | | #include "pc_video_mess.h" |
| 34 | | |
| 35 | 33 | #include "includes/crtc6845.h" |
| 36 | 34 | #include "memconv.h" |
| 37 | 35 | |
| 38 | 36 | /*************************************************************************** |
| 39 | 37 | |
| 38 | Local variables |
| 39 | |
| 40 | ***************************************************************************/ |
| 41 | |
| 42 | static size_t pc_videoram_size; |
| 43 | static UINT8 *pc_videoram; |
| 44 | |
| 45 | static pc_video_update_proc (*pc_choosevideomode)(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc); |
| 46 | static struct mscrtc6845 *pc_crtc; |
| 47 | static int pc_anythingdirty; |
| 48 | static int pc_current_height; |
| 49 | static int pc_current_width; |
| 50 | /*************************************************************************** |
| 51 | |
| 40 | 52 | Static declarations |
| 41 | 53 | |
| 42 | 54 | ***************************************************************************/ |
| r10616 | r10617 | |
| 44 | 56 | #define LOG_ACCESSES 0 |
| 45 | 57 | #define LOG_REGISTERS 0 |
| 46 | 58 | |
| 47 | | static PALETTE_INIT( ega ); |
| 48 | 59 | static PALETTE_INIT( vga ); |
| 49 | | static VIDEO_START( ega ); |
| 50 | 60 | static VIDEO_START( vga ); |
| 51 | | static VIDEO_RESET( ega ); |
| 52 | 61 | static VIDEO_RESET( vga ); |
| 53 | 62 | |
| 54 | 63 | static pc_video_update_proc pc_vga_choosevideomode(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc); |
| 55 | | static pc_video_update_proc pc_ega_choosevideomode(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc); |
| 56 | 64 | |
| 57 | 65 | /*************************************************************************** |
| 58 | 66 | |
| r10616 | r10617 | |
| 61 | 69 | ***************************************************************************/ |
| 62 | 70 | |
| 63 | 71 | /* grabbed from dac inited by et4000 bios */ |
| 64 | | static const unsigned char ega_palette[] = |
| 65 | | { |
| 66 | | 0x00, 0x00, 0x00, |
| 67 | | 0x00, 0x00, 0xa8, |
| 68 | | 0x00, 0xa8, 0x00, |
| 69 | | 0x00, 0xa8, 0xa8, |
| 70 | | 0xa8, 0x00, 0x00, |
| 71 | | 0xa8, 0x00, 0xa8, |
| 72 | | 0xa8, 0x54, 0x00, |
| 73 | | 0xa8, 0xa8, 0xa8, |
| 74 | | 0x00, 0x00, 0x00, |
| 75 | | 0x00, 0x00, 0xa8, |
| 76 | | 0x00, 0xa8, 0x00, |
| 77 | | 0x00, 0xa8, 0xa8, |
| 78 | | 0xa8, 0x00, 0x00, |
| 79 | | 0xa8, 0x00, 0xa8, |
| 80 | | 0xa8, 0x54, 0x00, |
| 81 | | 0xa8, 0xa8, 0xa8, |
| 82 | | 0x54, 0x54, 0x54, |
| 83 | | 0x54, 0x54, 0xfc, |
| 84 | | 0x54, 0xfc, 0x54, |
| 85 | | 0x54, 0xfc, 0xfc, |
| 86 | | 0xfc, 0x54, 0x54, |
| 87 | | 0xfc, 0x54, 0xfc, |
| 88 | | 0xfc, 0xfc, 0x54, |
| 89 | | 0xfc, 0xfc, 0xfc, |
| 90 | | 0x54, 0x54, 0x54, |
| 91 | | 0x54, 0x54, 0xfc, |
| 92 | | 0x54, 0xfc, 0x54, |
| 93 | | 0x54, 0xfc, 0xfc, |
| 94 | | 0xfc, 0x54, 0x54, |
| 95 | | 0xfc, 0x54, 0xfc, |
| 96 | | 0xfc, 0xfc, 0x54, |
| 97 | | 0xfc, 0xfc, 0xfc, |
| 98 | | 0x00, 0x00, 0x00, |
| 99 | | 0x00, 0x00, 0xa8, |
| 100 | | 0x00, 0xa8, 0x00, |
| 101 | | 0x00, 0xa8, 0xa8, |
| 102 | | 0xa8, 0x00, 0x00, |
| 103 | | 0xa8, 0x00, 0xa8, |
| 104 | | 0xa8, 0x54, 0x00, |
| 105 | | 0xa8, 0xa8, 0xa8, |
| 106 | | 0x00, 0x00, 0x00, |
| 107 | | 0x00, 0x00, 0xa8, |
| 108 | | 0x00, 0xa8, 0x00, |
| 109 | | 0x00, 0xa8, 0xa8, |
| 110 | | 0xa8, 0x00, 0x00, |
| 111 | | 0xa8, 0x00, 0xa8, |
| 112 | | 0xa8, 0x54, 0x00, |
| 113 | | 0xa8, 0xa8, 0xa8, |
| 114 | | 0x54, 0x54, 0x54, |
| 115 | | 0x54, 0x54, 0xfc, |
| 116 | | 0x54, 0xfc, 0x54, |
| 117 | | 0x54, 0xfc, 0xfc, |
| 118 | | 0xfc, 0x54, 0x54, |
| 119 | | 0xfc, 0x54, 0xfc, |
| 120 | | 0xfc, 0xfc, 0x54, |
| 121 | | 0xfc, 0xfc, 0xfc, |
| 122 | | 0x54, 0x54, 0x54, |
| 123 | | 0x54, 0x54, 0xfc, |
| 124 | | 0x54, 0xfc, 0x54, |
| 125 | | 0x54, 0xfc, 0xfc, |
| 126 | | 0xfc, 0x54, 0x54, |
| 127 | | 0xfc, 0x54, 0xfc, |
| 128 | | 0xfc, 0xfc, 0x54, |
| 129 | | 0xfc, 0xfc, 0xfc |
| 130 | | }; |
| 131 | 72 | |
| 132 | 73 | static const unsigned short vga_colortable[] = |
| 133 | 74 | { |
| r10616 | r10617 | |
| 150 | 91 | 15, 0,15, 1,15, 2,15, 3,15, 4,15, 5,15, 6,15, 7,15, 8,15, 9,15,10,15,11,15,12,15,13,15,14,15,15 |
| 151 | 92 | }; |
| 152 | 93 | |
| 153 | | MACHINE_CONFIG_FRAGMENT( pcvideo_vga ) |
| 154 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 155 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 156 | | MCFG_SCREEN_SIZE(720, 480) |
| 157 | | MCFG_SCREEN_VISIBLE_AREA(0,720-1, 0,480-1) |
| 158 | | MCFG_PALETTE_LENGTH(0x100) |
| 159 | | MCFG_SCREEN_UPDATE(pc_video) |
| 160 | | MCFG_PALETTE_INIT(vga) |
| 94 | static STATE_POSTLOAD( pc_video_postload ) |
| 95 | { |
| 96 | pc_anythingdirty = 1; |
| 97 | pc_current_height = -1; |
| 98 | pc_current_width = -1; |
| 99 | } |
| 161 | 100 | |
| 162 | | MCFG_VIDEO_START(vga) |
| 163 | | MCFG_VIDEO_RESET(vga) |
| 164 | | MACHINE_CONFIG_END |
| 165 | 101 | |
| 166 | | MACHINE_CONFIG_FRAGMENT( pcvideo_pc1640 ) |
| 167 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 168 | | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 169 | | MCFG_SCREEN_SIZE(720, 350) |
| 170 | | MCFG_SCREEN_VISIBLE_AREA(0,720-1, 0,350-1) |
| 171 | | MCFG_SCREEN_UPDATE(pc_video) |
| 172 | 102 | |
| 173 | | MCFG_PALETTE_LENGTH(sizeof(ega_palette) / 3) |
| 174 | | MCFG_PALETTE_INIT(ega) |
| 103 | struct mscrtc6845 *pc_video_start(running_machine *machine, const struct mscrtc6845_config *config, |
| 104 | pc_video_update_proc (*choosevideomode)(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc), |
| 105 | size_t vramsize) |
| 106 | { |
| 107 | pc_choosevideomode = choosevideomode; |
| 108 | pc_crtc = NULL; |
| 109 | pc_anythingdirty = 1; |
| 110 | pc_current_height = -1; |
| 111 | pc_current_width = -1; |
| 112 | machine->generic.tmpbitmap = NULL; |
| 175 | 113 | |
| 176 | | MCFG_VIDEO_START(ega) |
| 177 | | MCFG_VIDEO_RESET(ega) |
| 178 | | MACHINE_CONFIG_END |
| 114 | pc_videoram_size = vramsize; |
| 115 | if (config) |
| 116 | { |
| 117 | pc_crtc = mscrtc6845_init(machine, config); |
| 118 | if (!pc_crtc) |
| 119 | return NULL; |
| 120 | } |
| 179 | 121 | |
| 180 | | /***************************************************************************/ |
| 122 | if (pc_videoram_size) |
| 123 | { |
| 124 | video_start_generic_bitmapped(machine); |
| 125 | } |
| 181 | 126 | |
| 182 | | static PALETTE_INIT( ega ) |
| 127 | machine->state().register_postload(pc_video_postload, NULL); |
| 128 | return pc_crtc; |
| 129 | } |
| 130 | |
| 131 | |
| 132 | |
| 133 | SCREEN_UPDATE( pc_video ) |
| 183 | 134 | { |
| 184 | | int i; |
| 135 | UINT32 rc = 0; |
| 136 | int w = 0, h = 0; |
| 137 | pc_video_update_proc video_update; |
| 185 | 138 | |
| 186 | | for ( i = 0; i < sizeof(ega_palette) / 3; i++ ) { |
| 187 | | palette_set_color_rgb(machine, i, ega_palette[i*3], ega_palette[i*3+1], ega_palette[i*3+2]); |
| 139 | if (pc_crtc) |
| 140 | { |
| 141 | w = mscrtc6845_get_char_columns(pc_crtc); |
| 142 | h = mscrtc6845_get_char_height(pc_crtc) * mscrtc6845_get_char_lines(pc_crtc); |
| 188 | 143 | } |
| 144 | |
| 145 | video_update = pc_choosevideomode(screen->machine, &w, &h, pc_crtc); |
| 146 | |
| 147 | if (video_update) |
| 148 | { |
| 149 | if ((pc_current_width != w) || (pc_current_height != h)) |
| 150 | { |
| 151 | int width = screen->width(); |
| 152 | int height = screen->height(); |
| 153 | |
| 154 | pc_current_width = w; |
| 155 | pc_current_height = h; |
| 156 | pc_anythingdirty = 1; |
| 157 | |
| 158 | if (pc_current_width > width) |
| 159 | pc_current_width = width; |
| 160 | if (pc_current_height > height) |
| 161 | pc_current_height = height; |
| 162 | |
| 163 | if ((pc_current_width > 100) && (pc_current_height > 100)) |
| 164 | screen->set_visible_area(0, pc_current_width-1, 0, pc_current_height-1); |
| 165 | |
| 166 | bitmap_fill(bitmap, cliprect, 0); |
| 167 | } |
| 168 | |
| 169 | video_update(screen->machine->generic.tmpbitmap ? screen->machine->generic.tmpbitmap : bitmap, pc_crtc); |
| 170 | |
| 171 | if (screen->machine->generic.tmpbitmap) |
| 172 | { |
| 173 | copybitmap(bitmap, screen->machine->generic.tmpbitmap, 0, 0, 0, 0, cliprect); |
| 174 | if (!pc_anythingdirty) |
| 175 | rc = UPDATE_HAS_NOT_CHANGED; |
| 176 | pc_anythingdirty = 0; |
| 177 | } |
| 178 | } |
| 179 | return rc; |
| 189 | 180 | } |
| 190 | 181 | |
| 182 | |
| 183 | |
| 184 | WRITE8_HANDLER ( pc_video_videoram_w ) |
| 185 | { |
| 186 | UINT8 *videoram = pc_videoram; |
| 187 | if (videoram && videoram[offset] != data) |
| 188 | { |
| 189 | videoram[offset] = data; |
| 190 | pc_anythingdirty = 1; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | |
| 195 | WRITE16_HANDLER( pc_video_videoram16le_w ) { write16le_with_write8_handler(pc_video_videoram_w, space, offset, data, mem_mask); } |
| 196 | |
| 197 | WRITE32_HANDLER( pc_video_videoram32_w ) |
| 198 | { |
| 199 | UINT32 *videoram = (UINT32 *)pc_videoram; |
| 200 | COMBINE_DATA(videoram + offset); |
| 201 | pc_anythingdirty = 1; |
| 202 | } |
| 203 | /***************************************************************************/ |
| 204 | |
| 191 | 205 | static PALETTE_INIT( vga ) |
| 192 | 206 | { |
| 193 | 207 | int i; |
| r10616 | r10617 | |
| 312 | 326 | |
| 313 | 327 | |
| 314 | 328 | |
| 315 | | static int ega_get_clock(void) |
| 316 | | { |
| 317 | | int clck=0; |
| 318 | | switch(vga.miscellaneous_output&0xc) { |
| 319 | | case 0: clck=14000000;break; |
| 320 | | case 4: clck=16000000;break; |
| 321 | | /* case 8: external */ |
| 322 | | /* case 0xc: reserved */ |
| 323 | | } |
| 324 | | if (vga.sequencer.data[1]&8) clck/=2; |
| 325 | | return clck; |
| 326 | | } |
| 327 | | |
| 328 | 329 | static int vga_get_clock(void) |
| 329 | 330 | { |
| 330 | 331 | int clck=0; |
| r10616 | r10617 | |
| 338 | 339 | return clck; |
| 339 | 340 | } |
| 340 | 341 | |
| 341 | | static int ega_get_crtc_columns(void) /* in clocks! */ |
| 342 | | { |
| 343 | | int columns=vga.crtc.data[0]+2; |
| 344 | | if (!GRAPHIC_MODE) { |
| 345 | | columns*=CHAR_WIDTH; |
| 346 | | } else { |
| 347 | | columns*=8; |
| 348 | | } |
| 349 | | return columns; |
| 350 | | } |
| 351 | | |
| 352 | | static int ega_get_crtc_lines(void) |
| 353 | | { |
| 354 | | int lines=vga.crtc.data[6]|((vga.crtc.data[7]&1)); |
| 355 | | |
| 356 | | return lines; |
| 357 | | } |
| 358 | | |
| 359 | 342 | static int vga_get_crtc_columns(void) /* in clocks! */ |
| 360 | 343 | { |
| 361 | 344 | int columns=vga.crtc.data[0]+5; |
| r10616 | r10617 | |
| 829 | 812 | return data; |
| 830 | 813 | } |
| 831 | 814 | |
| 832 | | |
| 833 | | |
| 834 | | READ8_HANDLER( ega_port_03c0_r ) |
| 835 | | { |
| 836 | | UINT8 data = 0xff; |
| 837 | | switch (offset) { |
| 838 | | case 2: data=0xff;/*!*/break; |
| 839 | | } |
| 840 | | return data; |
| 841 | | } |
| 842 | | |
| 843 | 815 | READ8_HANDLER( vga_port_03c0_r ) |
| 844 | 816 | { |
| 845 | 817 | UINT8 data = 0xff; |
| r10616 | r10617 | |
| 1090 | 1062 | vga_crtc_w(space, offset, data); |
| 1091 | 1063 | } |
| 1092 | 1064 | |
| 1093 | | |
| 1094 | | |
| 1095 | | READ8_HANDLER( paradise_ega_03c0_r ) |
| 1096 | | { |
| 1097 | | UINT8 data = vga_port_03c0_r(space, offset); |
| 1098 | | |
| 1099 | | if (offset == 2) |
| 1100 | | { |
| 1101 | | if ( (vga.feature_control&3)==2 ) { |
| 1102 | | data=(data&~0x60)|((vga.vga_intf.read_dipswitch(space, 0)&0xc0)>>1); |
| 1103 | | } else if ((vga.feature_control&3)==1 ) { |
| 1104 | | data=(data&~0x60)|((vga.vga_intf.read_dipswitch(space, 0)&0x30)<<1); |
| 1105 | | } |
| 1106 | | } |
| 1107 | | return data; |
| 1108 | | } |
| 1109 | | |
| 1110 | | |
| 1111 | | |
| 1112 | 1065 | void pc_vga_reset(running_machine *machine) |
| 1113 | 1066 | { |
| 1114 | 1067 | /* clear out the VGA structure */ |
| r10616 | r10617 | |
| 1272 | 1225 | { |
| 1273 | 1226 | vga.monitor.retrace=1; |
| 1274 | 1227 | } |
| 1275 | | |
| 1276 | | static VIDEO_START( ega ) |
| 1277 | | { |
| 1278 | | vga.monitor.get_clock = ega_get_clock; |
| 1279 | | vga.monitor.get_lines = ega_get_crtc_lines; |
| 1280 | | vga.monitor.get_columns = ega_get_crtc_columns; |
| 1281 | | vga.monitor.get_sync_lines = vga_get_crtc_sync_lines; |
| 1282 | | vga.monitor.get_sync_columns = vga_get_crtc_sync_columns; |
| 1283 | | machine->scheduler().timer_pulse(attotime::from_hz(60), FUNC(vga_timer)); |
| 1284 | | pc_video_start(machine, NULL, pc_ega_choosevideomode, 0); |
| 1285 | | } |
| 1286 | | |
| 1287 | | static VIDEO_RESET( ega ) |
| 1288 | | { |
| 1289 | | } |
| 1290 | | |
| 1291 | 1228 | static VIDEO_START( vga ) |
| 1292 | 1229 | { |
| 1293 | 1230 | vga.monitor.get_clock=vga_get_clock; |
| r10616 | r10617 | |
| 1474 | 1411 | } |
| 1475 | 1412 | } |
| 1476 | 1413 | |
| 1477 | | static pc_video_update_proc pc_ega_choosevideomode(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc) |
| 1478 | | { |
| 1479 | | pc_video_update_proc proc = NULL; |
| 1480 | | int i; |
| 1481 | | |
| 1482 | | if (CRTC_ON) |
| 1483 | | { |
| 1484 | | for (i = 0; i < 16; i++) |
| 1485 | | vga.pens[i]=machine->pens[i/*vga.attribute.data[i]&0x3f*/]; |
| 1486 | | |
| 1487 | | if (!GRAPHIC_MODE) |
| 1488 | | { |
| 1489 | | proc = vga_vh_text; |
| 1490 | | *height = TEXT_LINES; |
| 1491 | | *width = TEXT_COLUMNS*CHAR_WIDTH; |
| 1492 | | } |
| 1493 | | else |
| 1494 | | { |
| 1495 | | proc = vga_vh_ega; |
| 1496 | | *height = LINES; |
| 1497 | | *width = EGA_COLUMNS*8; |
| 1498 | | } |
| 1499 | | } |
| 1500 | | return proc; |
| 1501 | | } |
| 1502 | | |
| 1503 | 1414 | static pc_video_update_proc pc_vga_choosevideomode(running_machine *machine, int *width, int *height, struct mscrtc6845 *crtc) |
| 1504 | 1415 | { |
| 1505 | 1416 | pc_video_update_proc proc = NULL; |
| r10616 | r10617 | |
| 1577 | 1488 | return vga.svga_intf.vram_size; |
| 1578 | 1489 | } |
| 1579 | 1490 | |
| 1580 | | READ16_HANDLER( paradise_ega16le_03c0_r ) { return read16le_with_read8_handler(paradise_ega_03c0_r, space, offset, mem_mask); } |
| 1491 | MACHINE_CONFIG_FRAGMENT( pcvideo_vga ) |
| 1492 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1493 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 1494 | MCFG_SCREEN_SIZE(720, 480) |
| 1495 | MCFG_SCREEN_VISIBLE_AREA(0,720-1, 0,480-1) |
| 1496 | MCFG_SCREEN_UPDATE(pc_video) |
| 1497 | MCFG_SCREEN_REFRESH_RATE(60) |
| 1498 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1499 | |
| 1500 | MCFG_PALETTE_LENGTH(0x100) |
| 1501 | MCFG_PALETTE_INIT(vga) |
| 1502 | |
| 1503 | MCFG_VIDEO_START(vga) |
| 1504 | MCFG_VIDEO_RESET(vga) |
| 1505 | MACHINE_CONFIG_END |
src/mess/drivers/at.c
| r10616 | r10617 | |
| 51 | 51 | #include "sound/speaker.h" |
| 52 | 52 | #include "sound/saa1099.h" |
| 53 | 53 | #include "machine/ram.h" |
| 54 | | |
| 54 | #include "machine/nvram.h" |
| 55 | 55 | #include "memconv.h" |
| 56 | 56 | |
| 57 | 57 | |
| r10616 | r10617 | |
| 81 | 81 | |
| 82 | 82 | static ADDRESS_MAP_START( at16_map, ADDRESS_SPACE_PROGRAM, 16 ) |
| 83 | 83 | AM_RANGE(0x000000, 0x09ffff) AM_MIRROR(0xff000000) AM_RAMBANK("bank10") |
| 84 | | // AM_RANGE(0x0a0000, 0x0bffff) AM_READWRITE(SMH_RAM, pc_video_videoram16le_w) AM_BASE((UINT16 **)&videoram) AM_SIZE(&videoram_size) |
| 85 | 84 | AM_RANGE(0x0c0000, 0x0c7fff) AM_ROM |
| 86 | 85 | AM_RANGE(0x0c8000, 0x0cffff) AM_ROM |
| 87 | 86 | AM_RANGE(0x0d0000, 0x0effff) AM_RAM |
| r10616 | r10617 | |
| 95 | 94 | ADDRESS_MAP_GLOBAL_MASK(0x00ffffff) |
| 96 | 95 | AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("bank10") |
| 97 | 96 | AM_RANGE(0x000a0000, 0x000bffff) AM_NOP |
| 98 | | // AM_RANGE(0x000b8000, 0x000bffff) AM_READWRITE(SMH_RAM, pc_video_videoram32_w) AM_BASE((UINT32 **) &videoram) AM_SIZE(&videoram_size) |
| 99 | 97 | AM_RANGE(0x000c0000, 0x000c7fff) AM_ROM |
| 100 | 98 | AM_RANGE(0x000c8000, 0x000cffff) AM_ROM |
| 101 | 99 | AM_RANGE(0x000d0000, 0x000effff) AM_ROM |
| r10616 | r10617 | |
| 107 | 105 | static ADDRESS_MAP_START( at586_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 108 | 106 | AM_RANGE(0x00000000, 0x0009ffff) AM_RAMBANK("bank10") |
| 109 | 107 | AM_RANGE(0x000a0000, 0x000bffff) AM_NOP |
| 110 | | // AM_RANGE(0x000b8000, 0x000bffff) AM_READWRITE(SMH_RAM, pc_video_videoram32_w) AM_BASE((UINT32 **) &videoram) AM_SIZE(&videoram_size) |
| 111 | 108 | AM_RANGE(0x00800000, 0x00800bff) AM_RAM AM_SHARE("nvram") |
| 112 | 109 | AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("user1", 0x20000) |
| 113 | 110 | ADDRESS_MAP_END |
| r10616 | r10617 | |
| 673 | 670 | |
| 674 | 671 | MCFG_FRAGMENT_ADD( pcvideo_vga ) |
| 675 | 672 | |
| 676 | | MCFG_SCREEN_MODIFY("screen") |
| 677 | | MCFG_SCREEN_REFRESH_RATE(60) |
| 678 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 679 | | |
| 680 | 673 | /* sound hardware */ |
| 681 | 674 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 682 | 675 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| r10616 | r10617 | |
| 740 | 733 | |
| 741 | 734 | MCFG_FRAGMENT_ADD( pcvideo_vga ) |
| 742 | 735 | |
| 743 | | MCFG_SCREEN_MODIFY("screen") |
| 744 | | MCFG_SCREEN_REFRESH_RATE(60) |
| 745 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 746 | | |
| 747 | 736 | MCFG_MACHINE_START( at ) |
| 748 | 737 | MCFG_MACHINE_RESET( at ) |
| 749 | 738 | |
| r10616 | r10617 | |
| 816 | 805 | |
| 817 | 806 | MCFG_FRAGMENT_ADD( pcvideo_vga ) |
| 818 | 807 | |
| 819 | | MCFG_SCREEN_MODIFY("screen") |
| 820 | | MCFG_SCREEN_REFRESH_RATE(60) |
| 821 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 822 | | |
| 823 | 808 | /* sound hardware */ |
| 824 | 809 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 825 | 810 | MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) |
| r10616 | r10617 | |
| 842 | 827 | MCFG_KB_KEYTRONIC_ADD("keyboard", at_keytronic_intf) |
| 843 | 828 | |
| 844 | 829 | MCFG_MC146818_ADD( "rtc", MC146818_STANDARD ) |
| 845 | | // MCFG_NVRAM_ADD_0FILL("nvram") |
| 830 | MCFG_NVRAM_ADD_0FILL("nvram") |
| 846 | 831 | |
| 847 | 832 | /* printers */ |
| 848 | 833 | MCFG_PC_LPT_ADD("lpt_0", at_lpt_config) |