src/mess/video/amstrad.c
| r1558 | r1559 | |
| 16 | 16 | |
| 17 | 17 | #include "sound/ay8910.h" |
| 18 | 18 | |
| 19 | | |
| 20 | 19 | static m6845_state amstrad_vidhrdw_6845_state; |
| 21 | 20 | int prev_reg; |
| 22 | 21 | |
| r1558 | r1559 | |
| 46 | 45 | |
| 47 | 46 | static void amstrad_plus_handle_dma(void); |
| 48 | 47 | |
| 48 | extern int aleste_mode; |
| 49 | |
| 49 | 50 | #ifdef MAME_DEBUG |
| 50 | 51 | extern int amstrad_plus_lower_enabled; |
| 51 | 52 | #endif |
| r1558 | r1559 | |
| 279 | 280 | } |
| 280 | 281 | } |
| 281 | 282 | |
| 283 | |
| 284 | /* Aleste has a 6-bit RGB palette */ |
| 285 | PALETTE_INIT( aleste ) |
| 286 | { |
| 287 | int i; |
| 288 | |
| 289 | palette_set_colors(machine, 0, amstrad_palette, sizeof(amstrad_palette) / 3); |
| 290 | for(i=0; i<64; i++) |
| 291 | { |
| 292 | int r,g,b; |
| 293 | |
| 294 | r = (i >> 4) & 0x03; |
| 295 | g = (i >> 2) & 0x03; |
| 296 | b = i & 0x03; |
| 297 | |
| 298 | r = (r << 6); |
| 299 | g = (g << 6); |
| 300 | b = (b << 6); |
| 301 | |
| 302 | palette_set_color_rgb(machine, i+32, r, g, b); |
| 303 | colortable[i+32] = i+32; // take into account the CPC and MSX palette |
| 304 | } |
| 305 | } |
| 306 | |
| 282 | 307 | void amstrad_plus_setspritecolour(unsigned int off, int r, int g, int b) |
| 283 | 308 | { |
| 284 | 309 | palette_set_color_rgb(Machine, (off/2) + 33, r, g, b); |
| r1558 | r1559 | |
| 333 | 358 | } |
| 334 | 359 | } |
| 335 | 360 | |
| 361 | void aleste_vh_update_colour(int PenIndex, int hw_colour_index) |
| 362 | { |
| 363 | /* int cpu_cycles = ((cycles_currently_ran()>>2)-1) & 63; |
| 364 | |
| 365 | logerror("color is changed(%d,%d) = %d\n",PenIndex, cpu_cycles, Machine->pens[hw_colour_index]); |
| 366 | amstrad_GateArray_colours_ischanged++; |
| 367 | amstrad_GateArray_changed_colours[cpu_cycles][PenIndex] = Machine->pens[hw_colour_index]; |
| 368 | */ |
| 369 | amstrad_GateArray_render_colours[PenIndex] = Machine->pens[hw_colour_index+32]; |
| 370 | } |
| 371 | |
| 336 | 372 | /* Set the new screen mode (0,1,2,4) from the GateArray */ |
| 337 | 373 | void amstrad_vh_update_mode(int new_mode) |
| 338 | 374 | { |
| r1558 | r1559 | |
| 633 | 669 | return; |
| 634 | 670 | } |
| 635 | 671 | |
| 636 | | for (i=0;i<4;i++) { |
| 672 | if(aleste_mode & 0x04) // if in Aleste mode |
| 673 | { |
| 674 | if(~aleste_mode & 0x08) // and VRAM is not active |
| 675 | { |
| 676 | amstrad_draw_screen_disabled(); |
| 677 | return; |
| 678 | } |
| 679 | } |
| 680 | |
| 681 | for (i=0;i<4;i++) { |
| 637 | 682 | cpcpen = Mode1Lookup[data1& 0xFF]; |
| 638 | 683 | messpen = amstrad_GateArray_render_colours[cpcpen]; |
| 639 | 684 | plot_box(bitmap,x,y,2,1,messpen); |
| r1558 | r1559 | |
| 671 | 716 | return; |
| 672 | 717 | } |
| 673 | 718 | |
| 719 | if(aleste_mode & 0x04) // if in Aleste mode |
| 720 | { |
| 721 | if(~aleste_mode & 0x08) // and VRAM is not active |
| 722 | { |
| 723 | amstrad_draw_screen_disabled(); |
| 724 | return; |
| 725 | } |
| 726 | } |
| 727 | |
| 674 | 728 | for (i=0; i<16; i++) |
| 675 | 729 | { |
| 676 | 730 | cpcpen = (data>>15) & 0x01; |
| r1558 | r1559 | |
| 728 | 782 | plot_box(bitmap,x+12,y,4,1,messpen); |
| 729 | 783 | } |
| 730 | 784 | |
| 785 | /* Aleste mode 2: high resolution - 4 colours */ |
| 786 | static void aleste_draw_screen_enabled_mode_2(void) |
| 787 | { |
| 788 | mame_bitmap *bitmap = amstrad_bitmap; |
| 789 | |
| 790 | int ma = amstrad_CRTC_MA; // m6845_memory_address_r(0); |
| 791 | int ra = amstrad_CRTC_RA; // m6845_row_address_r(0); |
| 792 | /* calc mem addr to fetch data from based on ma, and ra */ |
| 793 | unsigned int addr = (((ma>>13) & 0x01)<<15) | |
| 794 | ((ra & 0x06)<<11) | |
| 795 | ((ra & 0x01) << 14) | |
| 796 | ((ma & 0x07ff) << 1); |
| 797 | |
| 798 | int x = x_screen_pos; |
| 799 | int y = y_screen_pos; |
| 800 | int i, cpcpen, messpen; |
| 801 | unsigned char data1; |
| 802 | unsigned char data2; |
| 803 | |
| 804 | if(~aleste_mode & 0x08) |
| 805 | { |
| 806 | amstrad_draw_screen_disabled(); |
| 807 | return; |
| 808 | } |
| 809 | |
| 810 | data1 = mess_ram[addr]; |
| 811 | data2 = mess_ram[addr+1]; |
| 812 | |
| 813 | for (i=0;i<4;i++) |
| 814 | { |
| 815 | cpcpen = Mode1Lookup[data1& 0xFF]; |
| 816 | messpen = amstrad_GateArray_render_colours[cpcpen]; |
| 817 | plot_box(bitmap,x,y,1,1,messpen); |
| 818 | |
| 819 | cpcpen = Mode1Lookup[data2]; |
| 820 | messpen = amstrad_GateArray_render_colours[cpcpen]; |
| 821 | plot_box(bitmap,x+4,y,1,1,messpen); |
| 822 | |
| 823 | x += 1; |
| 824 | data1 = data1<<1; |
| 825 | data2 = data2<<1; |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | /* Aleste mode 3 - medium resolution, 16 colours */ |
| 830 | static void aleste_draw_screen_enabled_mode_3(void) |
| 831 | { |
| 832 | mame_bitmap *bitmap = amstrad_bitmap; |
| 833 | |
| 834 | int ma = amstrad_CRTC_MA; // m6845_memory_address_r(0); |
| 835 | int ra = amstrad_CRTC_RA; // m6845_row_address_r(0); |
| 836 | /* calc mem addr to fetch data from based on ma, and ra */ |
| 837 | unsigned int addr = (((ma>>13) & 0x01)<<15) | |
| 838 | ((ra & 0x06)<<11) | |
| 839 | ((ra & 0x01) << 14) | |
| 840 | ((ma & 0x07ff) << 1); |
| 841 | |
| 842 | int x = x_screen_pos; |
| 843 | int y = y_screen_pos; |
| 844 | int cpcpen, messpen; |
| 845 | |
| 846 | unsigned char data; |
| 847 | |
| 848 | if(~aleste_mode & 0x08) |
| 849 | { |
| 850 | amstrad_draw_screen_disabled(); |
| 851 | return; |
| 852 | } |
| 853 | |
| 854 | data = mess_ram[addr]; |
| 855 | |
| 856 | cpcpen = Mode0Lookup[data]; |
| 857 | messpen = amstrad_GateArray_render_colours[cpcpen]; |
| 858 | plot_box(bitmap,x,y,2,1,messpen); |
| 859 | |
| 860 | data = data<<1; |
| 861 | |
| 862 | cpcpen = Mode0Lookup[data]; |
| 863 | messpen = amstrad_GateArray_render_colours[cpcpen]; |
| 864 | plot_box(bitmap,x+2,y,2,1,messpen); |
| 865 | |
| 866 | data = mess_ram[addr+1]; |
| 867 | |
| 868 | cpcpen = Mode0Lookup[data]; |
| 869 | messpen = amstrad_GateArray_render_colours[cpcpen]; |
| 870 | plot_box(bitmap,x+4,y,2,1,messpen); |
| 871 | |
| 872 | data = data<<1; |
| 873 | |
| 874 | cpcpen = Mode0Lookup[data]; |
| 875 | messpen = amstrad_GateArray_render_colours[cpcpen]; |
| 876 | plot_box(bitmap,x+6,y,2,1,messpen); |
| 877 | |
| 878 | } |
| 879 | |
| 880 | |
| 881 | |
| 731 | 882 | /* execute crtc_execute_cycles of crtc */ |
| 732 | 883 | void amstrad_vh_execute_crtc_cycles(int dummy) |
| 733 | 884 | { |
| 885 | int scrwidth = AMSTRAD_SCREEN_WIDTH; |
| 734 | 886 | m6845_clock(); // Clock the 6845 |
| 735 | | if ((x_screen_pos >= 0) && (x_screen_pos < AMSTRAD_SCREEN_WIDTH) && (y_screen_pos >= 0)) |
| 887 | if(aleste_mode & 0x02) |
| 736 | 888 | { |
| 889 | // scrwidth = ALESTE_SCREEN_WIDTH; |
| 890 | } |
| 891 | |
| 892 | if ((x_screen_pos >= 0) && (x_screen_pos < scrwidth) && (y_screen_pos >= 0)) |
| 893 | { |
| 737 | 894 | /* render the screen */ |
| 738 | 895 | (draw_function)(); |
| 739 | 896 | } |
| 740 | | x_screen_pos += (AMSTRAD_CHARACTERS*2); // Move to next raster |
| 897 | if(aleste_mode & 0x02) // Aleste high res mode |
| 898 | x_screen_pos += (AMSTRAD_CHARACTERS); // Move to next raster |
| 899 | else |
| 900 | x_screen_pos += (AMSTRAD_CHARACTERS*2); // Move to next raster |
| 741 | 901 | /* }*/ |
| 742 | 902 | } |
| 743 | 903 | |
| r1558 | r1559 | |
| 934 | 1094 | display_update = 0; |
| 935 | 1095 | } |
| 936 | 1096 | |
| 937 | | switch (amstrad_current_mode) { |
| 938 | | case 0x00: |
| 939 | | draw_function = amstrad_draw_screen_enabled_mode_0; |
| 940 | | break; |
| 941 | | case 0x01: |
| 942 | | draw_function = amstrad_draw_screen_enabled_mode_1; |
| 943 | | break; |
| 944 | | case 0x02: |
| 945 | | draw_function = amstrad_draw_screen_enabled_mode_2; |
| 946 | | break; |
| 947 | | case 0x03: |
| 948 | | draw_function = amstrad_draw_screen_enabled_mode_3; |
| 949 | | break; |
| 1097 | if(aleste_mode & 0x02) |
| 1098 | { |
| 1099 | switch (amstrad_current_mode) |
| 1100 | { |
| 1101 | case 0x00: |
| 1102 | draw_function = amstrad_draw_screen_enabled_mode_2; |
| 1103 | break; |
| 1104 | case 0x01: |
| 1105 | draw_function = amstrad_draw_screen_enabled_mode_1; |
| 1106 | break; |
| 1107 | case 0x02: |
| 1108 | draw_function = aleste_draw_screen_enabled_mode_2; |
| 1109 | break; |
| 1110 | case 0x03: |
| 1111 | draw_function = aleste_draw_screen_enabled_mode_3; |
| 1112 | break; |
| 1113 | } |
| 950 | 1114 | } |
| 1115 | else |
| 1116 | { |
| 1117 | switch (amstrad_current_mode) |
| 1118 | { |
| 1119 | case 0x00: |
| 1120 | draw_function = amstrad_draw_screen_enabled_mode_0; |
| 1121 | break; |
| 1122 | case 0x01: |
| 1123 | draw_function = amstrad_draw_screen_enabled_mode_1; |
| 1124 | break; |
| 1125 | case 0x02: |
| 1126 | draw_function = amstrad_draw_screen_enabled_mode_2; |
| 1127 | break; |
| 1128 | case 0x03: |
| 1129 | draw_function = amstrad_draw_screen_enabled_mode_3; |
| 1130 | break; |
| 1131 | } |
| 1132 | } |
| 951 | 1133 | } |
| 952 | 1134 | } |
| 953 | 1135 | |
| r1558 | r1559 | |
| 1076 | 1258 | { |
| 1077 | 1259 | rectangle rect; |
| 1078 | 1260 | |
| 1079 | | rect.min_x = 0; |
| 1080 | | rect.max_x = AMSTRAD_SCREEN_WIDTH-1; |
| 1081 | | rect.min_y = 0; |
| 1082 | | rect.max_y = AMSTRAD_SCREEN_HEIGHT-1; |
| 1261 | // if(aleste_mode & 0x08) |
| 1262 | // { // MSX video |
| 1263 | // video_update_generic_bitmapped(machine,screen,bitmap,cliprect); |
| 1264 | // return 0; |
| 1265 | // } |
| 1266 | // else |
| 1267 | { // CPC video |
| 1268 | rect.min_x = 0; |
| 1269 | rect.max_x = AMSTRAD_SCREEN_WIDTH-1; |
| 1270 | rect.min_y = 0; |
| 1271 | rect.max_y = AMSTRAD_SCREEN_HEIGHT-1; |
| 1083 | 1272 | |
| 1084 | | #ifdef MAME_DEBUG |
| 1085 | | if(input_code_pressed(KEYCODE_Z) && amstrad_system_type != 0) |
| 1086 | | { |
| 1087 | | int x; |
| 1088 | | for(x=0;x<32;x+=2) |
| 1273 | #ifdef MAME_DEBUG |
| 1274 | if(input_code_pressed(KEYCODE_Z) && amstrad_system_type != 0) |
| 1089 | 1275 | { |
| 1090 | | amstrad_plus_asic_ram[0x2400+x] = ((x/2)<< 4) + x/2; |
| 1091 | | amstrad_plus_asic_ram[0x2401+x] = x/2; |
| 1276 | int x; |
| 1277 | for(x=0;x<32;x+=2) |
| 1278 | { |
| 1279 | amstrad_plus_asic_ram[0x2400+x] = ((x/2)<< 4) + x/2; |
| 1280 | amstrad_plus_asic_ram[0x2401+x] = x/2; |
| 1281 | } |
| 1092 | 1282 | } |
| 1283 | #endif |
| 1284 | copybitmap(bitmap, amstrad_bitmap, 0,0,0,0,&rect, TRANSPARENCY_NONE,0); |
| 1285 | if(amstrad_plus_asic_enabled != 0) |
| 1286 | amstrad_plus_sprite_draw(bitmap); |
| 1287 | amstrad_scanline = y_screen_pos - 32; |
| 1288 | return 0; |
| 1093 | 1289 | } |
| 1094 | | #endif |
| 1095 | | copybitmap(bitmap, amstrad_bitmap, 0,0,0,0,&rect, TRANSPARENCY_NONE,0); |
| 1096 | | if(amstrad_plus_asic_enabled != 0) |
| 1097 | | amstrad_plus_sprite_draw(bitmap); |
| 1098 | | amstrad_scanline = y_screen_pos - 32; |
| 1099 | | return 0; |
| 1100 | 1290 | } |
| 1101 | 1291 | |
| 1102 | 1292 | |
| r1558 | r1559 | |
| 1124 | 1314 | amstrad_bitmap = auto_bitmap_alloc(AMSTRAD_SCREEN_WIDTH, AMSTRAD_SCREEN_HEIGHT, BITMAP_FORMAT_INDEXED16); |
| 1125 | 1315 | display_update = 1; |
| 1126 | 1316 | } |
| 1317 | |
src/mess/drivers/amstrad.c
| r1558 | r1559 | |
| 56 | 56 | No Exit: Display is wrong, but usable, uses demo-like techniques. |
| 57 | 57 | |
| 58 | 58 | |
| 59 | January 2008 - added preliminary Aleste 520EX support |
| 60 | The Aleste 520EX is a Russian clone of the CPC6128, that expands on existing video mode, and can run MSX-DOS. |
| 61 | It also adds an MC146818 RTC/NVRAM, an Intel 8253 timer, and the "Magic Sound" board, a 4-channel DMA-based |
| 62 | sample player. Also includes a software emulation of the MSX2 VDP, used in the ports of MSX games. |
| 63 | |
| 64 | Known issues: |
| 65 | - The RTC doesn't always update in setup. It expects bit 4 of register C (Update End Interrupt) to be high. |
| 66 | - Title screens appear then disappear quickly (probably because the 8253 hasn't been plugged in yet). |
| 67 | - Some video modes display wrong (still needs some work here). |
| 68 | - Vampire Killer crashes after collecting a certain key part way through stage 1. |
| 69 | - Magic Sound isn't emulated. |
| 70 | |
| 71 | |
| 59 | 72 | Some bugs left : |
| 60 | 73 | ---------------- |
| 61 | 74 | - CRTC all type support (0,1,2,3,4) ? |
| r1558 | r1559 | |
| 74 | 87 | #include "video/m6845.h" /* CRTC display */ |
| 75 | 88 | #include "machine/nec765.h" /* for floppy disc controller */ |
| 76 | 89 | #include "sound/ay8910.h" |
| 90 | #include "machine/mc146818.h" /* Aleste RTC */ |
| 77 | 91 | |
| 78 | 92 | /* Devices */ |
| 79 | 93 | #include "devices/dsk.h" /* for CPCEMU style disk images */ |
| 94 | #include "devices/basicdsk.h" /* for 720k MSX disk images (Aleste supports these) */ |
| 95 | #include "includes/msx_slot.h" |
| 96 | #include "includes/msx.h" /* MSX floppy device load */ |
| 80 | 97 | #include "devices/snapquik.h" |
| 81 | 98 | #include "devices/cartslot.h" |
| 82 | 99 | #include "devices/printer.h" |
| r1558 | r1559 | |
| 108 | 125 | }; |
| 109 | 126 | |
| 110 | 127 | int amstrad_system_type; |
| 128 | int aleste_mode; |
| 111 | 129 | static int amstrad_plus_lower; // CPC+/GX4000 cartridge bank loaded in lower ROM area |
| 112 | 130 | static int amstrad_plus_lower_addr; // CPC+/GX4000 lower ROM area address / ASIC register page enable |
| 113 | 131 | static int amstrad_plus_lower_enabled; // secondary lower ROM select in use? |
| r1558 | r1559 | |
| 152 | 170 | |
| 153 | 171 | static unsigned char previous_amstrad_UpperRom_data; |
| 154 | 172 | static unsigned char previous_printer_data_byte; |
| 173 | |
| 174 | static int aleste_rtc_function; |
| 175 | static int aleste_fdc_int; |
| 176 | |
| 155 | 177 | /*------------------ |
| 156 | 178 | - Ram Management - |
| 157 | 179 | ------------------*/ |
| r1558 | r1559 | |
| 216 | 238 | |
| 217 | 239 | static void update_psg(void) |
| 218 | 240 | { |
| 219 | | switch (amstrad_Psg_FunctionSelected) { |
| 220 | | case 0: {/* Inactive */ |
| 221 | | } break; |
| 222 | | case 1: {/* b6 = 1 ? : Read from selected PSG register and make the register data available to PPI Port A */ |
| 223 | | ppi_port_inputs[amstrad_ppi_PortA] = AY8910_read_port_0_r(0); |
| 224 | | } break; |
| 225 | | case 2: {/* b7 = 1 ? : Write to selected PSG register and write data to PPI Port A */ |
| 226 | | AY8910_write_port_0_w(0, ppi_port_outputs[amstrad_ppi_PortA]); |
| 227 | | } break; |
| 228 | | case 3: {/* b6 and b7 = 1 ? : The register will now be selected and the user can read from or write to it. The register will remain selected until another is chosen.*/ |
| 229 | | AY8910_control_port_0_w(0, ppi_port_outputs[amstrad_ppi_PortA]); |
| 230 | | prev_reg = ppi_port_outputs[amstrad_ppi_PortA]; |
| 231 | | } break; |
| 241 | if(aleste_mode & 0x20) // RTC selected |
| 242 | { |
| 243 | switch(aleste_rtc_function) |
| 244 | { |
| 245 | case 0x02: // AS |
| 246 | mc146818_port_w(0,ppi_port_outputs[amstrad_ppi_PortA]); |
| 247 | break; |
| 248 | case 0x04: // DS write |
| 249 | mc146818_port_w(1,ppi_port_outputs[amstrad_ppi_PortA]); |
| 250 | break; |
| 251 | case 0x05: // DS read |
| 252 | ppi_port_inputs[amstrad_ppi_PortA] = mc146818_port_r(1); |
| 253 | break; |
| 254 | } |
| 255 | return; |
| 256 | } |
| 257 | switch (amstrad_Psg_FunctionSelected) |
| 258 | { |
| 259 | case 0: |
| 260 | {/* Inactive */ |
| 261 | } break; |
| 262 | case 1: |
| 263 | {/* b6 = 1 ? : Read from selected PSG register and make the register data available to PPI Port A */ |
| 264 | ppi_port_inputs[amstrad_ppi_PortA] = AY8910_read_port_0_r(0); |
| 265 | } |
| 266 | break; |
| 267 | case 2: |
| 268 | {/* b7 = 1 ? : Write to selected PSG register and write data to PPI Port A */ |
| 269 | AY8910_write_port_0_w(0, ppi_port_outputs[amstrad_ppi_PortA]); |
| 270 | } |
| 271 | break; |
| 272 | case 3: |
| 273 | {/* b6 and b7 = 1 ? : The register will now be selected and the user can read from or write to it. The register will remain selected until another is chosen.*/ |
| 274 | AY8910_control_port_0_w(0, ppi_port_outputs[amstrad_ppi_PortA]); |
| 275 | prev_reg = ppi_port_outputs[amstrad_ppi_PortA]; |
| 276 | } |
| 277 | break; |
| 232 | 278 | default: { |
| 233 | 279 | } break; |
| 234 | 280 | } |
| r1558 | r1559 | |
| 238 | 284 | static READ8_HANDLER ( amstrad_ppi_porta_r ) |
| 239 | 285 | { |
| 240 | 286 | update_psg(); |
| 241 | | return ppi_port_inputs[amstrad_ppi_PortA]; |
| 287 | return ppi_port_inputs[amstrad_ppi_PortA]; |
| 242 | 288 | } |
| 243 | 289 | |
| 244 | 290 | static WRITE8_HANDLER ( amstrad_ppi_porta_w ) |
| 245 | 291 | { |
| 246 | | ppi_port_outputs[amstrad_ppi_PortA] = data; |
| 247 | | update_psg(); |
| 292 | ppi_port_outputs[amstrad_ppi_PortA] = data; |
| 293 | update_psg(); |
| 248 | 294 | } |
| 249 | 295 | |
| 250 | 296 | /* - Read PPI Port B - |
| r1558 | r1559 | |
| 295 | 341 | /* Set b0 with VSync state from the CRTC */ |
| 296 | 342 | data |= amstrad_CRTC_VS; // m6845_vertical_sync_r(0); |
| 297 | 343 | |
| 344 | if(aleste_mode & 0x04) |
| 345 | { |
| 346 | if(aleste_fdc_int == 0) |
| 347 | data &= ~0x02; |
| 348 | else |
| 349 | data |= 0x02; |
| 350 | } |
| 351 | |
| 298 | 352 | return data; |
| 299 | 353 | } |
| 300 | 354 | |
| r1558 | r1559 | |
| 326 | 380 | /* get b7 and b6 (PSG Function Selected */ |
| 327 | 381 | amstrad_Psg_FunctionSelected = ((data & 0xC0)>>6); |
| 328 | 382 | |
| 383 | /* MC146818 function */ |
| 384 | aleste_rtc_function = data & 0x07; |
| 385 | |
| 329 | 386 | /* Perform PSG function */ |
| 330 | 387 | update_psg(); |
| 331 | 388 | |
| r1558 | r1559 | |
| 366 | 423 | {amstrad_ppi_portc_w} /* port C write */ |
| 367 | 424 | }; |
| 368 | 425 | |
| 426 | static void aleste_interrupt(int state) |
| 427 | { |
| 428 | if(state == CLEAR_LINE) |
| 429 | aleste_fdc_int = 0; |
| 430 | else |
| 431 | aleste_fdc_int = 1; |
| 432 | } |
| 433 | |
| 369 | 434 | /* Amstrad NEC765 interface doesn't use interrupts or DMA! */ |
| 370 | 435 | static const nec765_interface amstrad_nec765_interface = |
| 371 | 436 | { |
| r1558 | r1559 | |
| 373 | 438 | NULL |
| 374 | 439 | }; |
| 375 | 440 | |
| 441 | /* Aleste uses an 8272A, with the interrupt flag visible on PPI port B */ |
| 442 | static const nec765_interface aleste_8272_interface = |
| 443 | { |
| 444 | aleste_interrupt, |
| 445 | NULL |
| 446 | }; |
| 376 | 447 | |
| 377 | 448 | /* pointers to current ram configuration selected for banks */ |
| 378 | 449 | static unsigned char *AmstradCPC_RamBanks[4]; |
| 450 | static unsigned char *Aleste_RamBanks[4]; |
| 451 | static int aleste_active_page[4]; // page mapped to CPU RAM (is readable?) |
| 379 | 452 | |
| 380 | 453 | /* pointer to RAM used for the CPC+ ASIC memory-mapped registers */ |
| 381 | 454 | unsigned char *amstrad_plus_asic_ram; |
| r1558 | r1559 | |
| 395 | 468 | { |
| 396 | 469 | if ((amstrad_GateArray_ModeAndRomConfiguration & (1<<2)) == 0) { |
| 397 | 470 | BankBase = &memory_region(REGION_CPU1)[0x010000]; |
| 398 | | } else { |
| 399 | | BankBase = AmstradCPC_RamBanks[0]; |
| 471 | } else |
| 472 | { |
| 473 | if(aleste_mode & 0x04) |
| 474 | BankBase = Aleste_RamBanks[0]; |
| 475 | else |
| 476 | BankBase = AmstradCPC_RamBanks[0]; |
| 400 | 477 | } |
| 401 | 478 | memory_set_bankptr(1, BankBase); |
| 402 | 479 | memory_set_bankptr(2, BankBase+0x02000); |
| r1558 | r1559 | |
| 463 | 540 | { |
| 464 | 541 | unsigned char *BankBase; |
| 465 | 542 | /* b3 : "1" Upper rom area disable or "0" Upper rom area enable */ |
| 466 | | if ((amstrad_GateArray_ModeAndRomConfiguration & (1<<3)) == 0) { |
| 543 | if ((amstrad_GateArray_ModeAndRomConfiguration & (1<<3)) == 0) |
| 544 | { |
| 467 | 545 | BankBase = Amstrad_UpperRom; |
| 468 | | } else { |
| 469 | | BankBase = AmstradCPC_RamBanks[3]; |
| 470 | 546 | } |
| 547 | else |
| 548 | { |
| 549 | if(aleste_mode & 0x04) |
| 550 | BankBase = Aleste_RamBanks[3]; |
| 551 | else |
| 552 | BankBase = AmstradCPC_RamBanks[3]; |
| 553 | } |
| 471 | 554 | |
| 472 | 555 | if (BankBase) |
| 473 | 556 | { |
| r1558 | r1559 | |
| 787 | 870 | /* bank 1 - 0x04000..0x07fff */ |
| 788 | 871 | if(amstrad_system_type == SYSTEM_CPC || amstrad_plus_asic_enabled == 0) |
| 789 | 872 | { |
| 790 | | memory_set_bankptr(3, AmstradCPC_RamBanks[1]); |
| 791 | | memory_set_bankptr(4, AmstradCPC_RamBanks[1]+0x2000); |
| 792 | | /* bank 2 - 0x08000..0x0bfff */ |
| 793 | | memory_set_bankptr(5, AmstradCPC_RamBanks[2]); |
| 794 | | memory_set_bankptr(6, AmstradCPC_RamBanks[2]+0x2000); |
| 873 | if(aleste_mode & 0x04) |
| 874 | { |
| 875 | memory_set_bankptr(3, Aleste_RamBanks[1]); |
| 876 | memory_set_bankptr(4, Aleste_RamBanks[1]+0x2000); |
| 877 | /* bank 2 - 0x08000..0x0bfff */ |
| 878 | memory_set_bankptr(5, Aleste_RamBanks[2]); |
| 879 | memory_set_bankptr(6, Aleste_RamBanks[2]+0x2000); |
| 880 | } |
| 881 | else |
| 882 | { |
| 883 | memory_set_bankptr(3, AmstradCPC_RamBanks[1]); |
| 884 | memory_set_bankptr(4, AmstradCPC_RamBanks[1]+0x2000); |
| 885 | /* bank 2 - 0x08000..0x0bfff */ |
| 886 | memory_set_bankptr(5, AmstradCPC_RamBanks[2]); |
| 887 | memory_set_bankptr(6, AmstradCPC_RamBanks[2]+0x2000); |
| 888 | } |
| 795 | 889 | } |
| 796 | 890 | else |
| 797 | 891 | amstrad_setLowerRom(); |
| 798 | 892 | /* bank 3 - 0x0c000..0x0ffff */ |
| 799 | 893 | amstrad_setUpperRom(); |
| 800 | 894 | /* other banks */ |
| 801 | | memory_set_bankptr(9, AmstradCPC_RamBanks[0]); |
| 802 | | memory_set_bankptr(10, AmstradCPC_RamBanks[0]+0x2000); |
| 803 | | memory_set_bankptr(11, AmstradCPC_RamBanks[1]); |
| 804 | | memory_set_bankptr(12, AmstradCPC_RamBanks[1]+0x2000); |
| 805 | | memory_set_bankptr(13, AmstradCPC_RamBanks[2]); |
| 806 | | memory_set_bankptr(14, AmstradCPC_RamBanks[2]+0x2000); |
| 807 | | memory_set_bankptr(15, AmstradCPC_RamBanks[3]); |
| 808 | | memory_set_bankptr(16, AmstradCPC_RamBanks[3]+0x2000); |
| 895 | if(aleste_mode & 0x04) |
| 896 | { |
| 897 | memory_set_bankptr(9, Aleste_RamBanks[0]); |
| 898 | memory_set_bankptr(10, Aleste_RamBanks[0]+0x2000); |
| 899 | memory_set_bankptr(11, Aleste_RamBanks[1]); |
| 900 | memory_set_bankptr(12, Aleste_RamBanks[1]+0x2000); |
| 901 | memory_set_bankptr(13, Aleste_RamBanks[2]); |
| 902 | memory_set_bankptr(14, Aleste_RamBanks[2]+0x2000); |
| 903 | memory_set_bankptr(15, Aleste_RamBanks[3]); |
| 904 | memory_set_bankptr(16, Aleste_RamBanks[3]+0x2000); |
| 905 | } |
| 906 | else |
| 907 | { |
| 908 | memory_set_bankptr(9, AmstradCPC_RamBanks[0]); |
| 909 | memory_set_bankptr(10, AmstradCPC_RamBanks[0]+0x2000); |
| 910 | memory_set_bankptr(11, AmstradCPC_RamBanks[1]); |
| 911 | memory_set_bankptr(12, AmstradCPC_RamBanks[1]+0x2000); |
| 912 | memory_set_bankptr(13, AmstradCPC_RamBanks[2]); |
| 913 | memory_set_bankptr(14, AmstradCPC_RamBanks[2]+0x2000); |
| 914 | memory_set_bankptr(15, AmstradCPC_RamBanks[3]); |
| 915 | memory_set_bankptr(16, AmstradCPC_RamBanks[3]+0x2000); |
| 916 | } |
| 809 | 917 | |
| 810 | 918 | /* multiface hardware enabled? */ |
| 811 | 919 | if (multiface_hardware_enabled()) { |
| r1558 | r1559 | |
| 838 | 946 | for (i=0;i<4;i++) { |
| 839 | 947 | BankIndex = RamConfigurations[(ConfigurationIndex << 2) + i]; |
| 840 | 948 | BankAddr = mess_ram + (BankIndex << 14); |
| 949 | Aleste_RamBanks[i] = BankAddr; |
| 841 | 950 | AmstradCPC_RamBanks[i] = BankAddr; |
| 842 | 951 | } |
| 843 | 952 | } else {/* Need to add the ram expansion configuration here ! */ |
| r1558 | r1559 | |
| 992 | 1101 | } |
| 993 | 1102 | } |
| 994 | 1103 | |
| 1104 | void aleste_msx_mapper(int offset, int data) |
| 1105 | { |
| 1106 | int page = (offset & 0x0300) >> 8; |
| 1107 | int ramptr = (data & 0x1f) * 0x4000; |
| 1108 | int rampage = data & 0x1f; |
| 1109 | int function = (data & 0xc0) >> 6; |
| 1110 | |
| 1111 | // It is assumed that functions are all mapped to each port &7cff-&7fff, and b8 and b9 are only used for RAM bank location |
| 1112 | switch(function) |
| 1113 | { |
| 1114 | case 0: // Pen select (same as Gate Array?) |
| 1115 | amstrad_GateArray_write(data); |
| 1116 | break; |
| 1117 | case 1: // Colour select (6-bit palette) |
| 1118 | aleste_vh_update_colour(amstrad_GateArray_PenSelected,data & 0x3f); |
| 1119 | break; |
| 1120 | case 2: // Screen mode, Upper/Lower ROM select |
| 1121 | amstrad_GateArray_write(data); |
| 1122 | break; |
| 1123 | case 3: // RAM banks |
| 1124 | switch(page) |
| 1125 | { |
| 1126 | case 0: /* 0x0000 - 0x3fff */ |
| 1127 | memory_set_bankptr(1,mess_ram+ramptr); |
| 1128 | memory_set_bankptr(2,mess_ram+ramptr+0x2000); |
| 1129 | memory_set_bankptr(9,mess_ram+ramptr); |
| 1130 | memory_set_bankptr(10,mess_ram+ramptr+0x2000); |
| 1131 | Aleste_RamBanks[0] = mess_ram+ramptr; |
| 1132 | aleste_active_page[0] = data; |
| 1133 | logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x0000\n",ramptr,rampage); |
| 1134 | break; |
| 1135 | case 1: /* 0x4000 - 0x7fff */ |
| 1136 | memory_set_bankptr(3,mess_ram+ramptr); |
| 1137 | memory_set_bankptr(4,mess_ram+ramptr+0x2000); |
| 1138 | memory_set_bankptr(11,mess_ram+ramptr); |
| 1139 | memory_set_bankptr(12,mess_ram+ramptr+0x2000); |
| 1140 | Aleste_RamBanks[1] = mess_ram+ramptr; |
| 1141 | aleste_active_page[1] = data; |
| 1142 | logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x4000\n",ramptr,rampage); |
| 1143 | break; |
| 1144 | case 2: /* 0x8000 - 0xbfff */ |
| 1145 | memory_set_bankptr(5,mess_ram+ramptr); |
| 1146 | memory_set_bankptr(6,mess_ram+ramptr+0x2000); |
| 1147 | memory_set_bankptr(13,mess_ram+ramptr); |
| 1148 | memory_set_bankptr(14,mess_ram+ramptr+0x2000); |
| 1149 | Aleste_RamBanks[2] = mess_ram+ramptr; |
| 1150 | aleste_active_page[2] = data; |
| 1151 | logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x8000\n",ramptr,rampage); |
| 1152 | break; |
| 1153 | case 3: /* 0xc000 - 0xffff */ |
| 1154 | memory_set_bankptr(7,mess_ram+ramptr); |
| 1155 | memory_set_bankptr(8,mess_ram+ramptr+0x2000); |
| 1156 | memory_set_bankptr(15,mess_ram+ramptr); |
| 1157 | memory_set_bankptr(16,mess_ram+ramptr+0x2000); |
| 1158 | Aleste_RamBanks[3] = mess_ram+ramptr; |
| 1159 | aleste_active_page[3] = data; |
| 1160 | logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0xc000\n",ramptr,rampage); |
| 1161 | break; |
| 1162 | } |
| 1163 | break; |
| 1164 | } |
| 1165 | } |
| 1166 | |
| 995 | 1167 | /* used for loading snapshot only ! */ |
| 996 | 1168 | void AmstradCPC_PALWrite(int data) |
| 997 | 1169 | { |
| r1558 | r1559 | |
| 1067 | 1239 | unsigned char data = 0xFF; |
| 1068 | 1240 | unsigned int r1r0 = (unsigned int)((offset & 0x0300) >> 8); |
| 1069 | 1241 | m6845_personality_t crtc_type; |
| 1242 | int page; |
| 1070 | 1243 | |
| 1071 | 1244 | crtc_type = readinputportbytag_safe("crtc", 0); |
| 1072 | 1245 | m6845_set_personality(crtc_type); |
| 1073 | 1246 | |
| 1247 | if(aleste_mode & 0x04) |
| 1248 | { |
| 1249 | if ((offset & (1<<15)) == 0) // Aleste Mapper is readable? |
| 1250 | { |
| 1251 | page = (offset & 0x0300) >> 8; |
| 1252 | data = aleste_active_page[page]; |
| 1253 | return data; |
| 1254 | } |
| 1255 | } |
| 1256 | |
| 1074 | 1257 | /* if b14 = 0 : CRTC Read selected */ |
| 1075 | 1258 | if ((offset & (1<<14)) == 0) |
| 1076 | 1259 | { |
| r1558 | r1559 | |
| 1146 | 1329 | } |
| 1147 | 1330 | } |
| 1148 | 1331 | } |
| 1149 | | return data; |
| 1332 | return data; |
| 1150 | 1333 | } |
| 1151 | 1334 | |
| 1152 | 1335 | /* Offset handler for write */ |
| 1153 | 1336 | static WRITE8_HANDLER ( AmstradCPC_WritePortHandler ) |
| 1154 | 1337 | { |
| 1155 | | if ((offset & (1<<15)) == 0) { |
| 1156 | | /* if b15 = 0 and b14 = 1 : Gate-Array Write Selected*/ |
| 1157 | | if ((offset & (1<<14)) != 0) { |
| 1158 | | amstrad_GateArray_write(data); |
| 1159 | | } |
| 1160 | | /* if b15 = 0 : RAM Configuration Write Selected*/ |
| 1161 | | AmstradCPC_GA_SetRamConfiguration(); |
| 1162 | | } |
| 1338 | if ((offset & (1<<15)) == 0) |
| 1339 | { |
| 1340 | if(aleste_mode & 0x04) // Aleste mode |
| 1341 | { |
| 1342 | aleste_msx_mapper(offset,data); |
| 1343 | } |
| 1344 | else |
| 1345 | { |
| 1346 | /* if b15 = 0 and b14 = 1 : Gate-Array Write Selected*/ |
| 1347 | if ((offset & (1<<14)) != 0) |
| 1348 | amstrad_GateArray_write(data); |
| 1349 | /* if b15 = 0 : RAM Configuration Write Selected*/ |
| 1350 | AmstradCPC_GA_SetRamConfiguration(); |
| 1351 | } |
| 1352 | } |
| 1163 | 1353 | /*The Gate-Array and CRTC can't be selected simultaneously, which would otherwise cause potential display corruption.*/ |
| 1164 | 1354 | /* if b14 = 0 : CRTC Write Selected*/ |
| 1165 | 1355 | if ((offset & (1<<14)) == 0) { |
| r1558 | r1559 | |
| 1268 | 1458 | } |
| 1269 | 1459 | } |
| 1270 | 1460 | } |
| 1461 | |
| 1462 | /* Aleste Extend Port: |
| 1463 | D0 - VRAM Bank 0/1 (64K) |
| 1464 | D1 - MODE 0-Norm ,1-High resolution |
| 1465 | D2 - MAPMOD 0-Amstrad ,1-Yamaha mapper |
| 1466 | D3 - MAP Page 0/1 (256K) |
| 1467 | D4 - 580WI53 |
| 1468 | D5 - 0-AY8910 ,1-512WI1 */ |
| 1469 | if(offset == 0xfabf) |
| 1470 | { |
| 1471 | rectangle rect; |
| 1472 | aleste_mode = data; |
| 1473 | logerror("EXTEND: Port &FABF write 0x%02x\n",data); |
| 1474 | if(data & 0x02) |
| 1475 | { |
| 1476 | // Aleste high resolution settings |
| 1477 | rect.min_x = rect.min_y = 0; |
| 1478 | rect.max_x = (ALESTE_SCREEN_WIDTH-32) - 1; |
| 1479 | rect.max_y = (AMSTRAD_SCREEN_HEIGHT-40) - 1; |
| 1480 | video_screen_configure(0,800,312,&rect,HZ_TO_ATTOSECONDS(AMSTRAD_FPS)); |
| 1481 | } |
| 1482 | else |
| 1483 | { |
| 1484 | // Normal CPC video settings |
| 1485 | rect.min_x = rect.min_y = 0; |
| 1486 | rect.max_x = (AMSTRAD_SCREEN_WIDTH-32) - 1; |
| 1487 | rect.max_y = (AMSTRAD_SCREEN_HEIGHT-40) - 1; |
| 1488 | video_screen_configure(0,800,312,&rect,HZ_TO_ATTOSECONDS(AMSTRAD_FPS)); |
| 1489 | } |
| 1490 | } |
| 1271 | 1491 | multiface_io_write(offset,data); |
| 1272 | 1492 | } |
| 1273 | 1493 | |
| r1558 | r1559 | |
| 1777 | 1997 | |
| 1778 | 1998 | static void amstrad_common_init(void) |
| 1779 | 1999 | { |
| 2000 | aleste_mode = 0; |
| 2001 | |
| 1780 | 2002 | amstrad_GateArray_ModeAndRomConfiguration = 0; |
| 1781 | 2003 | amstrad_GateArray_RamConfiguration = 0; |
| 1782 | 2004 | amstrad_CRTC_HS_Counter = 2; |
| r1558 | r1559 | |
| 1784 | 2006 | |
| 1785 | 2007 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x1fff, 0, 0, MRA8_BANK1); |
| 1786 | 2008 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, MRA8_BANK2); |
| 1787 | | // if(amstrad_system_type == SYSTEM_CPC) |
| 1788 | | // { |
| 1789 | | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, MRA8_BANK3); |
| 1790 | | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, MRA8_BANK4); |
| 1791 | | // } |
| 1792 | | // else |
| 1793 | | // { |
| 1794 | | // memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, amstrad_plus_asic_4000_r); |
| 1795 | | // memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, amstrad_plus_asic_6000_r); |
| 1796 | | // } |
| 2009 | |
| 2010 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, MRA8_BANK3); |
| 2011 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, MRA8_BANK4); |
| 2012 | |
| 1797 | 2013 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x9fff, 0, 0, MRA8_BANK5); |
| 1798 | 2014 | memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0, MRA8_BANK6); |
| 1799 | 2015 | |
| r1558 | r1559 | |
| 1802 | 2018 | |
| 1803 | 2019 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x1fff, 0, 0, MWA8_BANK9); |
| 1804 | 2020 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, MWA8_BANK10); |
| 1805 | | // if(amstrad_system_type == SYSTEM_CPC) |
| 1806 | | // { |
| 1807 | | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, MWA8_BANK11); |
| 1808 | | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, MWA8_BANK12); |
| 1809 | | // } |
| 1810 | | // else |
| 1811 | | // { |
| 1812 | | // memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, amstrad_plus_asic_4000_w); |
| 1813 | | // memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, amstrad_plus_asic_6000_w); |
| 1814 | | // } |
| 2021 | |
| 2022 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x5fff, 0, 0, MWA8_BANK11); |
| 2023 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, MWA8_BANK12); |
| 2024 | |
| 1815 | 2025 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x9fff, 0, 0, MWA8_BANK13); |
| 1816 | 2026 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xbfff, 0, 0, MWA8_BANK14); |
| 2027 | |
| 1817 | 2028 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, MWA8_BANK15); |
| 1818 | 2029 | memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xffff, 0, 0, MWA8_BANK16); |
| 1819 | 2030 | |
| r1558 | r1559 | |
| 1995 | 2206 | ppi_port_inputs[amstrad_ppi_PortB] = (1<<4) | (1<<3) | 2; |
| 1996 | 2207 | } |
| 1997 | 2208 | |
| 2209 | static DRIVER_INIT( aleste ) |
| 2210 | { |
| 2211 | mc146818_init(MC146818_IGNORE_CENTURY); |
| 2212 | } |
| 1998 | 2213 | |
| 2214 | static MACHINE_RESET( aleste ) |
| 2215 | { |
| 2216 | int i; |
| 2217 | |
| 2218 | amstrad_system_type = SYSTEM_CPC; |
| 2219 | |
| 2220 | for (i=0; i<256; i++) |
| 2221 | { |
| 2222 | Amstrad_ROM_Table[i] = &memory_region(REGION_CPU1)[0x014000]; |
| 2223 | } |
| 2224 | |
| 2225 | Amstrad_ROM_Table[3] = &memory_region(REGION_CPU1)[0x01c000]; // MSX-DOS / BIOS |
| 2226 | Amstrad_ROM_Table[7] = &memory_region(REGION_CPU1)[0x018000]; // AMSDOS |
| 2227 | amstrad_common_init(); |
| 2228 | amstrad_reset_machine(); |
| 2229 | |
| 2230 | nec765_init(&aleste_8272_interface,NEC765A); |
| 2231 | floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80); |
| 2232 | floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 1), FLOPPY_DRIVE_DS_80); |
| 2233 | } |
| 2234 | |
| 1999 | 2235 | /* Memory is banked in 16k blocks. However, the multiface |
| 2000 | 2236 | pages the memory in 8k blocks! The ROM can |
| 2001 | 2237 | be paged into bank 0 and bank 3. */ |
| r1558 | r1559 | |
| 2031 | 2267 | If keyboard matrix line 11-14 are selected, the byte is always &ff. |
| 2032 | 2268 | After testing on a real CPC, it is found that these never change, they always return &FF. */ |
| 2033 | 2269 | |
| 2034 | | if (amstrad_keyboard_line > 9) { |
| 2035 | | return 0xFF; |
| 2036 | | } else { |
| 2037 | | int amstrad_read_keyboard_line = amstrad_keyboard_line; |
| 2038 | | amstrad_keyboard_line = 0xFF; |
| 2039 | | return (readinputport(amstrad_read_keyboard_line) & 0xFF); |
| 2040 | | } |
| 2270 | if (amstrad_keyboard_line > 10) |
| 2271 | { |
| 2272 | return 0xFF; |
| 2273 | } |
| 2274 | else |
| 2275 | { |
| 2276 | int amstrad_read_keyboard_line = amstrad_keyboard_line; |
| 2277 | if(aleste_mode == 0x08 && amstrad_keyboard_line == 10) |
| 2278 | return 0xff; |
| 2279 | amstrad_keyboard_line = 0xFF; |
| 2280 | return (readinputport(amstrad_read_keyboard_line) & 0xFF); |
| 2281 | } |
| 2041 | 2282 | } |
| 2042 | 2283 | |
| 2043 | 2284 | static INPUT_PORTS_START( amstrad_keyboard ) |
| r1558 | r1559 | |
| 2559 | 2800 | |
| 2560 | 2801 | INPUT_PORTS_END |
| 2561 | 2802 | |
| 2803 | static INPUT_PORTS_START(aleste) |
| 2804 | PORT_INCLUDE( amstrad_keyboard ) |
| 2805 | |
| 2806 | PORT_MODIFY( "keyboard_row_9" ) |
| 2807 | /* Documentation marks this input as "R/L", it's purpose is unknown - I can't even find it on the keyboard */ |
| 2808 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R L") PORT_CODE(KEYCODE_PGUP) |
| 2809 | |
| 2810 | PORT_START_TAG( "keyboard_row_10" ) |
| 2811 | PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F1 F6") PORT_CODE(KEYCODE_F1) |
| 2812 | PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F2 F7") PORT_CODE(KEYCODE_F2) |
| 2813 | PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F3 F8") PORT_CODE(KEYCODE_F3) |
| 2814 | PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F4 F9") PORT_CODE(KEYCODE_F4) |
| 2815 | PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F5 F10") PORT_CODE(KEYCODE_F5) |
| 2816 | PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("HELP") PORT_CODE(KEYCODE_PGDN) |
| 2817 | PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("INS") PORT_CODE(KEYCODE_DEL) |
| 2818 | PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Funny looking Russian symbol") PORT_CODE(KEYCODE_END) |
| 2819 | |
| 2820 | PORT_INCLUDE( crtc_links ) |
| 2821 | PORT_MODIFY("multiface") // move Multiface II stop to F6, as the Aleste has it's own F1-F5 keys. |
| 2822 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Multiface Two's Stop Button") PORT_CODE(KEYCODE_F6) |
| 2823 | INPUT_PORTS_END |
| 2824 | |
| 2562 | 2825 | /* -------------------- |
| 2563 | 2826 | - AY8910_interface - |
| 2564 | 2827 | --------------------*/ |
| r1558 | r1559 | |
| 2677 | 2940 | MDRV_PALETTE_INIT( amstrad_plus ) |
| 2678 | 2941 | MACHINE_DRIVER_END |
| 2679 | 2942 | |
| 2943 | static MACHINE_DRIVER_START( aleste ) |
| 2944 | MDRV_IMPORT_FROM( amstrad ) |
| 2945 | MDRV_MACHINE_RESET( aleste ) |
| 2946 | MDRV_PALETTE_LENGTH(32+64) |
| 2947 | MDRV_COLORTABLE_LENGTH(32+64) // standard CPC palette, and 6-bit MSX palette |
| 2948 | MDRV_PALETTE_INIT( aleste ) |
| 2949 | MDRV_NVRAM_HANDLER( mc146818 ) |
| 2950 | MACHINE_DRIVER_END |
| 2951 | |
| 2680 | 2952 | /*************************************************************************** |
| 2681 | 2953 | |
| 2682 | 2954 | Game driver(s) |
| r1558 | r1559 | |
| 2686 | 2958 | /* cpc6128.rom contains OS in first 16k, BASIC in second 16k */ |
| 2687 | 2959 | /* cpcados.rom contains Amstrad DOS */ |
| 2688 | 2960 | |
| 2961 | /*static DEVICE_LOAD( aleste ) |
| 2962 | { |
| 2963 | if (device_load_basicdsk_floppy(image)==INIT_PASS) |
| 2964 | { |
| 2965 | basicdsk_set_geometry(image, 80, 2, 9, 512, 0x01, 0, FALSE); |
| 2966 | return INIT_PASS; |
| 2967 | } |
| 2968 | return INIT_FAIL; |
| 2969 | }*/ |
| 2689 | 2970 | |
| 2690 | 2971 | static void cpc6128_floppy_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) |
| 2691 | 2972 | { |
| r1558 | r1559 | |
| 2699 | 2980 | } |
| 2700 | 2981 | } |
| 2701 | 2982 | |
| 2983 | static void aleste_floppy_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) |
| 2984 | { |
| 2985 | /* floppy */ |
| 2986 | switch(state) |
| 2987 | { |
| 2988 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 2989 | case DEVINFO_INT_COUNT: info->i = 2; break; |
| 2990 | case DEVINFO_PTR_LOAD: info->load = device_load_msx_floppy; break; |
| 2991 | case DEVINFO_STR_FILE_EXTENSIONS: strcpy(info->s = device_temp_str(), "dsk"); break; |
| 2992 | |
| 2993 | default: legacybasicdsk_device_getinfo(devclass, state, info); break; |
| 2994 | } |
| 2995 | } |
| 2996 | |
| 2997 | |
| 2702 | 2998 | static void cpc6128_cassette_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) |
| 2703 | 2999 | { |
| 2704 | 3000 | /* cassette */ |
| r1558 | r1559 | |
| 2778 | 3074 | CONFIG_DEVICE(cpcplus_snapshot_getinfo) |
| 2779 | 3075 | SYSTEM_CONFIG_END |
| 2780 | 3076 | |
| 3077 | SYSTEM_CONFIG_START(aleste) |
| 3078 | CONFIG_DEVICE(aleste_floppy_getinfo) |
| 3079 | CONFIG_DEVICE(cpc6128_cassette_getinfo) |
| 3080 | CONFIG_DEVICE(cpc6128_printer_getinfo) |
| 3081 | CONFIG_RAM_DEFAULT(2048 * 1024) // has 2048k RAM |
| 3082 | SYSTEM_CONFIG_END |
| 2781 | 3083 | |
| 2782 | 3084 | /* --------------------------------------------- |
| 2783 | 3085 | - Rom definition for the ROM loading system - |
| r1558 | r1559 | |
| 2855 | 3157 | ROM_REGION(0x4000, REGION_USER1,0) |
| 2856 | 3158 | ROM_END |
| 2857 | 3159 | |
| 3160 | ROM_START(al520ex) |
| 3161 | ROM_REGION(0x80000, REGION_CPU1,0) |
| 3162 | ROM_LOAD("al512.bin", 0x10000, 0x10000, CRC(e8c2a9a1) ) |
| 3163 | |
| 3164 | ROM_REGION(0x20, REGION_USER2,0) |
| 3165 | ROM_LOAD("af.bin", 0x00, 0x20, CRC(c81fb524) ) |
| 3166 | |
| 3167 | ROM_REGION(0x100, REGION_USER3,0) // RAM bank mappings |
| 3168 | ROM_LOAD("mapper.bin", 0x00, 0x100, CRC(0daebd80) ) |
| 3169 | |
| 3170 | ROM_REGION(0x800, REGION_USER4,0) // Colour data |
| 3171 | ROM_LOAD("rfcoldat.bin", 0x00, 0x800, CRC(c6ace0e6) ) |
| 3172 | |
| 3173 | ROM_REGION(0x800, REGION_USER5,0) // Keyboard / Video |
| 3174 | ROM_LOAD("rfvdkey.bin", 0x00, 0x800, CRC(cf2aa4b0) ) |
| 3175 | |
| 3176 | ROM_REGION(0x100, REGION_USER6,0) |
| 3177 | ROM_LOAD("romram.bin", 0x00, 0x100, CRC(b3ea95d7) ) |
| 3178 | ROM_END |
| 3179 | |
| 2858 | 3180 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 2859 | 3181 | COMP( 1984, cpc464, 0, 0, amstrad, cpc464, 0, cpc6128, "Amstrad plc", "Amstrad CPC464", 0) |
| 2860 | 3182 | COMP( 1985, cpc664, cpc464, 0, amstrad, cpc664, 0, cpc6128, "Amstrad plc", "Amstrad CPC664", 0) |
| r1558 | r1559 | |
| 2864 | 3186 | COMP( 1990, cpc6128p, 0, 0, cpcplus, plus, 0, cpcplus, "Amstrad plc", "Amstrad CPC6128+", 0) |
| 2865 | 3187 | CONS( 1990, gx4000, 0, 0, gx4000, gx4000, 0, gx4000, "Amstrad plc", "Amstrad GX4000", 0) |
| 2866 | 3188 | COMP( 1989, kccomp, cpc464, 0, kccomp, kccomp, 0, cpc6128, "VEB Mikroelektronik", "KC Compact", 0) |
| 2867 | | |
| 3189 | COMP( 1993, al520ex, cpc464, 0, aleste, aleste, aleste,aleste, "Patisonic", "Aleste 520EX", GAME_IMPERFECT_SOUND) |