src/mess/drivers/super80.c
| r1816 | r1817 | |
| 30 | 30 | static UINT8 mc6845_reg; /* register index */ |
| 31 | 31 | static UINT8 mc6845_mask[]={0xff,0xff,0xff,0x0f,0x7f,0x1f,0x7f,0x7f,3,0x1f,0x7f,0x1f,0x3f,0xff,0x3f,0xff,0,0}; |
| 32 | 32 | |
| 33 | | #define SUPER80V_SCREEN_WIDTH (560) |
| 34 | | #define SUPER80V_SCREEN_HEIGHT (300) |
| 33 | #define MASTER_CLOCK (12e6) /* 12mhz */ |
| 34 | #define HTOTAL (384) |
| 35 | #define HBEND (0) |
| 36 | #define HBSTART (256) |
| 37 | #define VTOTAL (240) |
| 38 | #define VBEND (0) |
| 39 | #define VBSTART (160) |
| 35 | 40 | |
| 41 | #define SUPER80V_SCREEN_WIDTH (560) |
| 42 | #define SUPER80V_SCREEN_HEIGHT (300) |
| 43 | |
| 36 | 44 | /**************************** PALETTES for super80m and super80v ******************************************/ |
| 37 | 45 | |
| 38 | 46 | static const UINT8 super80_rgb_palette[16*3] = |
| r1816 | r1817 | |
| 196 | 204 | visarea.min_y = 0; |
| 197 | 205 | visarea.max_y = SUPER80V_SCREEN_HEIGHT-1; |
| 198 | 206 | |
| 199 | | /* dynamic screen sizing - we must override some user settings */ |
| 200 | | if (dyn) |
| 201 | | { |
| 202 | | mc6845[4] = mc6845[6]; // no band at top or bottom |
| 203 | | mc6845[7] = mc6845[6]; // screen starts at the top line |
| 204 | | mc6845[5] = 0; // exactly at the top |
| 205 | | } |
| 206 | | |
| 207 | 207 | /* calculate the effect of sync and vertical adjustments */ |
| 208 | 208 | if ( mc6845[2] ) off_x = mc6845[0] - mc6845[2] - 23; else off_x = -24; |
| 209 | 209 | |
| r1816 | r1817 | |
| 213 | 213 | |
| 214 | 214 | if( off_y > 128 ) off_y = 128; |
| 215 | 215 | |
| 216 | if (dyn) |
| 217 | { |
| 218 | off_x = 0; |
| 219 | off_y = 0; |
| 220 | } |
| 221 | |
| 216 | 222 | width = mc6845[1]*7-1; // width in pixels |
| 217 | 223 | height = mc6845[6]*(mc6845[9]+1)-1; // height in pixels |
| 218 | 224 | bytes = mc6845[1]*mc6845[6]-1; // video ram needed -1 |
| r1816 | r1817 | |
| 233 | 239 | video_screen_configure(0, SUPER80V_SCREEN_WIDTH, SUPER80V_SCREEN_HEIGHT, &visarea, state->refresh); // in case dipswitch was just turned to NO |
| 234 | 240 | } |
| 235 | 241 | |
| 236 | | static VIDEO_EOF( super80 ) |
| 242 | static VIDEO_EOF( super80m ) |
| 237 | 243 | { |
| 238 | | UINT8 go_fast = 0; |
| 239 | | if ((super80_mhz == 2) || (!(readinputport(9) & 2))) /* bit 2 of port F0 is low, OR user turned on config switch */ |
| 240 | | go_fast++; |
| 241 | | |
| 242 | | /* code to slow down computer to 1mhz by halting cpu on every second frame */ |
| 243 | | if (!go_fast) |
| 244 | | { |
| 245 | | if (!int_sw) |
| 246 | | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE); // if going, stop it |
| 247 | | |
| 248 | | int_sw++; |
| 249 | | if (int_sw > 1) |
| 250 | | { |
| 251 | | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE); // if stopped, start it |
| 252 | | int_sw = 0; |
| 253 | | } |
| 254 | | } |
| 255 | | else |
| 256 | | { |
| 257 | | if (int_sw < 8) // @2mhz, reset just once |
| 258 | | { |
| 259 | | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE); |
| 260 | | int_sw = 8; // ...not every time |
| 261 | | } |
| 262 | | } |
| 263 | | } |
| 264 | | |
| 265 | | static VIDEO_EOF( super80v ) |
| 266 | | { |
| 267 | 244 | /* if we chose another palette or colour mode, enable it */ |
| 268 | 245 | UINT8 chosen_palette = (readinputport(9) & 0x60)>>5; // read colour dipswitches |
| 269 | 246 | |
| r1816 | r1817 | |
| 277 | 254 | } |
| 278 | 255 | } |
| 279 | 256 | |
| 280 | | static VIDEO_EOF( super80m ) |
| 281 | | { |
| 282 | | VIDEO_EOF_CALL( super80v ); |
| 283 | | VIDEO_EOF_CALL( super80 ); |
| 284 | | } |
| 285 | | |
| 286 | 257 | static VIDEO_UPDATE( super80 ) |
| 287 | 258 | { |
| 288 | 259 | UINT8 x, y, code=32, screen_on=0; |
| r1816 | r1817 | |
| 811 | 782 | |
| 812 | 783 | /**************************** BASIC MACHINE CONSTRUCTION ***********************************************************/ |
| 813 | 784 | |
| 785 | static TIMER_CALLBACK( super80_halfspeed ) |
| 786 | { |
| 787 | UINT8 go_fast = 0; |
| 788 | if ((super80_mhz == 2) || (!(readinputport(9) & 2))) /* bit 2 of port F0 is low, OR user turned on config switch */ |
| 789 | go_fast++; |
| 790 | |
| 791 | /* code to slow down computer to 1mhz by halting cpu on every second frame */ |
| 792 | if (!go_fast) |
| 793 | { |
| 794 | if (!int_sw) |
| 795 | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, ASSERT_LINE); // if going, stop it |
| 796 | |
| 797 | int_sw++; |
| 798 | if (int_sw > 1) |
| 799 | { |
| 800 | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE); // if stopped, start it |
| 801 | int_sw = 0; |
| 802 | } |
| 803 | } |
| 804 | else |
| 805 | { |
| 806 | if (int_sw < 8) // @2mhz, reset just once |
| 807 | { |
| 808 | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, CLEAR_LINE); |
| 809 | int_sw = 8; // ...not every time |
| 810 | } |
| 811 | } |
| 812 | } |
| 813 | |
| 814 | |
| 814 | 815 | /* after the first 4 bytes have been read from ROM, switch the ram back in */ |
| 815 | 816 | static TIMER_CALLBACK( super80_reset ) |
| 816 | 817 | { |
| r1816 | r1817 | |
| 826 | 827 | |
| 827 | 828 | static MACHINE_DRIVER_START( super80 ) |
| 828 | 829 | /* basic machine hardware */ |
| 829 | | MDRV_CPU_ADD_TAG("main", Z80, 12000000/6) /* 2 Mhz */ |
| 830 | MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/6) /* 2 Mhz */ |
| 830 | 831 | MDRV_CPU_PROGRAM_MAP(super80_map, 0) |
| 831 | 832 | MDRV_CPU_IO_MAP(super80_io, 0) |
| 832 | 833 | MDRV_CPU_CONFIG(super80_daisy_chain) |
| r1816 | r1817 | |
| 836 | 837 | MDRV_GFXDECODE(super80) |
| 837 | 838 | MDRV_SCREEN_ADD("main", RASTER) |
| 838 | 839 | MDRV_SCREEN_REFRESH_RATE(48.8) |
| 839 | | // MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(200)) |
| 840 | 840 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 841 | | MDRV_SCREEN_SIZE(32*8, 16*10) |
| 842 | | MDRV_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 16*10-1) |
| 841 | MDRV_SCREEN_RAW_PARAMS(MASTER_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) |
| 843 | 842 | MDRV_PALETTE_LENGTH(2) |
| 844 | 843 | MDRV_PALETTE_INIT(black_and_white) |
| 845 | 844 | |
| 846 | | MDRV_VIDEO_EOF(super80) |
| 847 | 845 | MDRV_VIDEO_UPDATE(super80) |
| 848 | 846 | |
| 849 | 847 | /* sound hardware */ |
| r1816 | r1817 | |
| 872 | 870 | MACHINE_DRIVER_END |
| 873 | 871 | |
| 874 | 872 | static MACHINE_DRIVER_START( super80v ) |
| 875 | | MDRV_IMPORT_FROM(super80m) |
| 876 | | MDRV_CPU_MODIFY("main") |
| 873 | /* basic machine hardware */ |
| 874 | MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/6) /* 2 Mhz */ |
| 877 | 875 | MDRV_CPU_PROGRAM_MAP(super80v_map, 0) |
| 878 | 876 | MDRV_CPU_IO_MAP(super80v_io, 0) |
| 877 | MDRV_CPU_CONFIG(super80_daisy_chain) |
| 879 | 878 | |
| 880 | | // MDRV_SCREEN_REFRESH_RATE(50) |
| 879 | MDRV_MACHINE_RESET( super80 ) |
| 880 | |
| 881 | 881 | MDRV_GFXDECODE(super80v) |
| 882 | | // MDRV_SCREEN_SIZE(SUPER80V_SCREEN_WIDTH, SUPER80V_SCREEN_HEIGHT) |
| 883 | | // MDRV_SCREEN_VISIBLE_AREA(0, SUPER80V_SCREEN_WIDTH-1, 0, SUPER80V_SCREEN_HEIGHT-1) |
| 884 | | MDRV_VIDEO_EOF(super80v) |
| 882 | MDRV_SCREEN_ADD("main", RASTER) |
| 883 | MDRV_SCREEN_REFRESH_RATE(50) |
| 884 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 885 | MDRV_SCREEN_SIZE(SUPER80V_SCREEN_WIDTH, SUPER80V_SCREEN_HEIGHT) |
| 886 | MDRV_SCREEN_VISIBLE_AREA(0, SUPER80V_SCREEN_WIDTH-1, 0, SUPER80V_SCREEN_HEIGHT-1) |
| 887 | MDRV_PALETTE_LENGTH(256*2) |
| 888 | MDRV_PALETTE_INIT(super80m) |
| 889 | |
| 890 | MDRV_VIDEO_EOF(super80m) |
| 885 | 891 | MDRV_VIDEO_UPDATE(super80v) |
| 892 | |
| 893 | /* sound hardware */ |
| 894 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 895 | MDRV_SOUND_ADD(WAVE, 0) |
| 896 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 897 | MDRV_SOUND_ADD(SPEAKER, 0) |
| 898 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 886 | 899 | MACHINE_DRIVER_END |
| 887 | 900 | |
| 888 | | |
| 889 | | static DRIVER_INIT( super80 ) |
| 901 | static void driver_init_common( void ) |
| 890 | 902 | { |
| 891 | 903 | UINT8 *RAM = memory_region(REGION_CPU1); |
| 892 | 904 | memory_configure_bank(1, 0, 2, &RAM[0x0000], 0xc000); |
| 893 | 905 | timer_pulse(ATTOTIME_IN_HZ(200000),NULL,0,super80_timer); /* timer for keyboard and cassette */ |
| 894 | 906 | } |
| 895 | 907 | |
| 908 | static DRIVER_INIT( super80 ) |
| 909 | { |
| 910 | timer_pulse(ATTOTIME_IN_HZ(100),NULL,0,super80_halfspeed); /* timer for 1mhz slowdown */ |
| 911 | driver_init_common(); |
| 912 | } |
| 913 | |
| 896 | 914 | static DRIVER_INIT( super80d ) |
| 897 | 915 | { |
| 898 | 916 | UINT8 *RAM = memory_region(REGION_GFX1); |
| r1816 | r1817 | |
| 906 | 924 | pcgram = memory_region(REGION_CPU1)+0xf000; |
| 907 | 925 | videoram = memory_region(REGION_CPU1)+0x18000; |
| 908 | 926 | colorram = memory_region(REGION_CPU1)+0x1C000; |
| 909 | | DRIVER_INIT_CALL( super80 ); |
| 927 | driver_init_common(); |
| 910 | 928 | } |
| 911 | 929 | |
| 912 | 930 | |