src/mess/machine/hecdisk2.c
| r0 | r9228 | |
| 1 | /*******************************************************/ |
| 2 | /************ HECDISK2.C in machine ******************/ |
| 3 | /*******************************************************/ |
| 4 | |
| 5 | /* Lecteur de disquette DISK II pour les machines : |
| 6 | Hector HRX |
| 7 | Hector MX40c |
| 8 | Hector MX80c |
| 9 | |
| 10 | JJStacino jj.stacino@aliceadsl.fr |
| 11 | |
| 12 | 26/09/2010 : first sending with bug2 (the first "dir" command finih with a crash of the Z80 disk II proc) |
| 13 | */ |
| 14 | /* explication bug 1. |
| 15 | A Y E : Les interruptions pour venir en 6C4 se font à un rythme trop grand : des que le processeur |
| 16 | à envoyé la commande au uPD celui ci repond NMI. |
| 17 | sans laisser le temps au prog d'avancer !!! |
| 18 | Ensuite à chaque pas apres un IN j'ai une nouvelle interruption sans avoir termine la precedente. C'est |
| 19 | pourquoi en visu cela ne fait que de in en 6b4 sans jamais pouvoir aller en inc HL !!! Le positonnement de |
| 20 | HL se faisant apres le pop HL de x0687 - e ne se faisait pas !!!! |
| 21 | (ff09 etait l'adresse du dernier octet de commande au uPD !!! |
| 22 | bug 2 : Revoir les interruptionse & NMI. |
| 23 | */ |
| 24 | |
| 25 | #include "emu.h" |
| 26 | |
| 27 | #include "sound/sn76477.h" /* for sn sound*/ |
| 28 | #include "sound/wave.h" /* for K7 sound*/ |
| 29 | #include "sound/discrete.h" /* for 1 Bit sound*/ |
| 30 | #include "machine/upd765.h" /* for floppy disc controller */ |
| 31 | #include "formats/basicdsk.h" |
| 32 | #include "cpu/z80/z80.h" |
| 33 | |
| 34 | #include "includes/hec2hrp.h" |
| 35 | |
| 36 | /* Disquette timer*/ |
| 37 | static TIMER_CALLBACK( Callback_DMA_irq ); |
| 38 | static emu_timer *DMA_timer; |
| 39 | static TIMER_CALLBACK( Callback_INT_irq ); |
| 40 | static emu_timer *INT_timer; |
| 41 | |
| 42 | |
| 43 | /* Callback uPD request */ |
| 44 | UPD765_DMA_REQUEST( disk2_fdc_dma_irq ); |
| 45 | |
| 46 | UINT8 Disk2memory[0x10000]; /* Memory space for Disk II unit*/ |
| 47 | UINT8 Mem_RNMI =0xff; |
| 48 | /* Buffer of the 74374 (IC1 and IC4) linked to the Hector port */ |
| 49 | UINT8 disk2_data_r_ready=0x0; /* =ff when PC2 = true and data in read buffer (disk2_data_read) */ |
| 50 | UINT8 disk2_data_w_ready=0x0; /* =ff when Disk 2 Port 40 had send a data in write buffer (disk2_data_write) */ |
| 51 | UINT8 disk2_data_read=0; /* Data send by Hector to Disk 2 when PC2=true */ |
| 52 | UINT8 disk2_data_write=0; /* Data send by Disk 2 to Hector when Write Port I/O 40 */ |
| 53 | UINT8 disk2_RNMI = 0; /* State of I/O 50 D5 = authorization for INT / NMI */ |
| 54 | static int NMI_current_state=0; |
| 55 | static int INT_current_state=0; |
| 56 | static int Time_arq = 4000; |
| 57 | |
| 58 | /* Fonctionnement du uPD765 : |
| 59 | |
| 60 | * ecriture du N° de comande suivi des octets necessaire a la commande (selon doc uPD) OUT ($61) |
| 61 | * Lecture ou ecriture des data en dma : |
| 62 | Demande DMA uPD => Z80 : NMI, |
| 63 | Lecture octet IN ($70) par le Z80 => DRQ uPD ou |
| 64 | Ecriture octet OUT ($70) par le Z80 => DRQ uPD |
| 65 | * En fin d'execution commande => INT. |
| 66 | * ff12 = 12 lors de l'INT, |
| 67 | * Sortie du programme d'attente => vers lecture compte rendu |
| 68 | * Lecture des octets de compte rendu IN ($61) |
| 69 | |
| 70 | */ |
| 71 | |
| 72 | FLOPPY_OPTIONS_START( hector_disk2 ) |
| 73 | FLOPPY_OPTION( disk2_h, "td0", "Disk II Micronique disk image", basicdsk_identify_default, basicdsk_construct_default, |
| 74 | HEADS([1]) |
| 75 | TRACKS([40]) |
| 76 | SECTORS([10]) |
| 77 | SECTOR_LENGTH([512]) |
| 78 | FIRST_SECTOR_ID([00])) |
| 79 | FLOPPY_OPTIONS_END |
| 80 | /* Lorsque systemMX.td0 est traduit avec TD02IMD : |
| 81 | IMD TD 1.5 5.25 LD MFM S-step, 1 sides 9/08/2009 20:10:17 |
| 82 | HECTOR SYSTEM CP/M 2.2 Disk |
| 83 | */ |
| 84 | |
| 85 | /* Hector Disk II uPD765 interface use interrupts and DMA! */ |
| 86 | const upd765_interface disk2_upd765_interface = |
| 87 | { |
| 88 | DEVCB_LINE(disk2_fdc_interrupt), |
| 89 | disk2_fdc_dma_irq, |
| 90 | NULL, // disk2_fdc_get_image, |
| 91 | UPD765_RDY_PIN_NOT_CONNECTED, //NOT_ |
| 92 | {FLOPPY_0,FLOPPY_1, NULL, NULL} |
| 93 | }; |
| 94 | |
| 95 | // Source : System.cfg |
| 96 | //Capacité Faces Densité Codage Pistes Secteurs Taille Lecteurs / Ordinateurs |
| 97 | // (Ko) (octet) |
| 98 | // 200 1 DD MFM 40 10 512 Micronique Hector |
| 99 | // 800 2 DD MFM 80 10 512 Micronique Hector |
| 100 | const floppy_config disk2_floppy_config = |
| 101 | { |
| 102 | DEVCB_NULL, // |
| 103 | DEVCB_NULL, |
| 104 | DEVCB_NULL, |
| 105 | DEVCB_NULL, |
| 106 | DEVCB_NULL, |
| 107 | FLOPPY_STANDARD_5_25_DSDD, //DSHD, for other 800Ko disk |
| 108 | FLOPPY_OPTIONS_NAME(hector_disk2), |
| 109 | // FLOPPY_OPTIONS_NAME(default), |
| 110 | NULL |
| 111 | }; |
| 112 | |
| 113 | WRITE8_HANDLER( hector_disk2_w ) |
| 114 | { |
| 115 | //if ((offset >= 0x0fff)) // || (offset == 0x066) || (offset == 0x067) || (offset == 0x068)) |
| 116 | Disk2memory[offset]= data; |
| 117 | |
| 118 | /* Autorisation d'ecriture uniquement dans les zones autorisees |
| 119 | if (offset == 0x066) |
| 120 | Disk2memory[offset]= data; |
| 121 | if (offset == 0x067) |
| 122 | Disk2memory[offset]= data; |
| 123 | if (offset == 0x068) |
| 124 | Disk2memory[offset]= data; |
| 125 | if (offset == 0x038) |
| 126 | Disk2memory[offset]= data; |
| 127 | if (offset == 0x039) |
| 128 | Disk2memory[offset]= data; |
| 129 | if (offset == 0x03A) |
| 130 | Disk2memory[offset]= data;*/ |
| 131 | } |
| 132 | |
| 133 | READ8_HANDLER( hector_disk2_r ) |
| 134 | { |
| 135 | UINT8 data =0; |
| 136 | data = Disk2memory[offset]; |
| 137 | //if (offset == 0xff6b) |
| 138 | // data = 0x0ff; // force mode verbose on Hector ! |
| 139 | return data; |
| 140 | } |
| 141 | |
| 142 | void valid_interrupt( running_machine *machine) |
| 143 | { |
| 144 | /* Called at each rising state of INT / NMI and RNMI ! */ |
| 145 | |
| 146 | /* Take NMI / INT only if RNMI ok*/ |
| 147 | |
| 148 | /* Checking for NMI interrupt */ |
| 149 | if ((disk2_RNMI ==0x00) && (NMI_current_state!=0)) |
| 150 | { |
| 151 | cputag_set_input_line(machine, "disk2cpu", INPUT_LINE_NMI, CLEAR_LINE); // NMI... |
| 152 | timer_adjust_oneshot(DMA_timer, ATTOTIME_IN_NSEC(Time_arq), 0 ); |
| 153 | Time_arq = 4000; // 6900us for next step ! |
| 154 | NMI_current_state=0; /* clear the current request*/ |
| 155 | } |
| 156 | |
| 157 | /* Checking for INT interrupt */ |
| 158 | if ((disk2_RNMI ==0x00) && (INT_current_state!=0)) |
| 159 | { |
| 160 | cputag_set_input_line(machine, "disk2cpu", INPUT_LINE_IRQ0, CLEAR_LINE); //INT... |
| 161 | timer_adjust_oneshot(INT_timer, ATTOTIME_IN_MSEC(400), 0 ); //2010 = 8000 |
| 162 | INT_current_state=0; /* clear the current request*/ |
| 163 | //printf("\nLancement interruption !"); |
| 164 | } |
| 165 | |
| 166 | } |
| 167 | |
| 168 | void Init_Timer_DiskII( running_machine *machine) |
| 169 | { |
| 170 | DMA_timer = timer_alloc(machine, Callback_DMA_irq, 0); |
| 171 | INT_timer = timer_alloc(machine, Callback_INT_irq, 0); |
| 172 | } |
| 173 | |
| 174 | static TIMER_CALLBACK( Callback_DMA_irq ) |
| 175 | { |
| 176 | /* To generate the NMI signal (late) when uPD DMA request*/ |
| 177 | cputag_set_input_line(machine, "disk2cpu", INPUT_LINE_NMI, ASSERT_LINE); //NMI... |
| 178 | |
| 179 | } |
| 180 | static TIMER_CALLBACK( Callback_INT_irq ) |
| 181 | { |
| 182 | /* To generate the INT signal (late) when uPD INT request*/ |
| 183 | cputag_set_input_line(machine, "disk2cpu", INPUT_LINE_IRQ0, ASSERT_LINE); //INT... |
| 184 | } |
| 185 | |
| 186 | /* upd765 INT is connected to interrupt of Z80 */ |
| 187 | WRITE_LINE_DEVICE_HANDLER( disk2_fdc_interrupt ) |
| 188 | { |
| 189 | INT_current_state = state; |
| 190 | valid_interrupt(device->machine); |
| 191 | } |
| 192 | /* upd765 DRQ is connected to NMI of Z80 within a RNMI hardware authorization*/ |
| 193 | UPD765_DMA_REQUEST( disk2_fdc_dma_irq ) |
| 194 | { |
| 195 | NMI_current_state = state; |
| 196 | valid_interrupt(device->machine); |
| 197 | } |
| 198 | ///////////////////////////////////// |
| 199 | // Port handling of the Disk II unit |
| 200 | ///////////////////////////////////// |
| 201 | READ8_HANDLER( disk2_io30_port_r) |
| 202 | { |
| 203 | return disk2_data_r_ready; |
| 204 | } |
| 205 | WRITE8_HANDLER( disk2_io30_port_w) |
| 206 | { |
| 207 | } |
| 208 | READ8_HANDLER( disk2_io40_port_r) |
| 209 | { |
| 210 | UINT8 data; |
| 211 | |
| 212 | data = disk2_data_read; |
| 213 | disk2_data_r_ready = 0x00; /* Raz memoire info read dispo*/ |
| 214 | return data; /* send thez data !*/ |
| 215 | } |
| 216 | WRITE8_HANDLER( disk2_io40_port_w) |
| 217 | { |
| 218 | /* Write a data */ |
| 219 | disk2_data_write = data; /* Memorisation donnee*/ |
| 220 | disk2_data_w_ready = 0xff; /* Memorisation donnee dispo*/ |
| 221 | } |
| 222 | |
| 223 | READ8_HANDLER( disk2_io50_port_r) |
| 224 | { |
| 225 | return disk2_data_w_ready; |
| 226 | } |
| 227 | WRITE8_HANDLER( disk2_io50_port_w) |
| 228 | { |
| 229 | /* FDC Motor Control - Bit 0/1 defines the state of the FDD motor: |
| 230 | * "1" the FDD motor will be active. |
| 231 | * "0" the FDD motor will be in-active.*/ |
| 232 | |
| 233 | running_device *fdc = space->machine->device("upd765"); |
| 234 | |
| 235 | floppy_mon_w(floppy_get_device(space->machine, 0), !BIT(data, 0)); |
| 236 | floppy_mon_w(floppy_get_device(space->machine, 1), !BIT(data, 1)); |
| 237 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1); |
| 238 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1); |
| 239 | |
| 240 | upd765_tc_w(fdc, ASSERT_LINE); |
| 241 | |
| 242 | /* Ecriture bit TC uPD765 sur D4 du port 50 */ |
| 243 | if (BIT(data, 4)) |
| 244 | upd765_tc_w(fdc, 1); |
| 245 | else |
| 246 | upd765_tc_w(fdc, 0); |
| 247 | |
| 248 | /* Authorization interrupt and NMI */ |
| 249 | if BIT(data, 5) |
| 250 | disk2_RNMI=0xff; |
| 251 | else |
| 252 | disk2_RNMI=0x00; |
| 253 | |
| 254 | /* if the programm give the authorization => try to interrupt and NMI ! */ |
| 255 | //if (disk2_RNMI==0xff) |
| 256 | // valid_interrupt(space->machine); |
| 257 | |
| 258 | } |
| 259 | |
| 260 | |
| 261 | READ8_HANDLER( disk2_io60_port_r) |
| 262 | { |
| 263 | /* Lecture du status uPD*/ |
| 264 | UINT8 data=0; |
| 265 | running_device *fdc = space->machine->device("upd765"); |
| 266 | |
| 267 | data = upd765_status_r(fdc, 0); |
| 268 | |
| 269 | return data; |
| 270 | } |
| 271 | READ8_HANDLER( disk2_io61_port_r) |
| 272 | { |
| 273 | /* Lecture d'une data uPD*/ |
| 274 | UINT8 data=0; |
| 275 | running_device *fdc = space->machine->device("upd765"); |
| 276 | |
| 277 | data=upd765_data_r(fdc, 0); /* when pin A0 =1 */ |
| 278 | |
| 279 | return data; |
| 280 | } |
| 281 | WRITE8_HANDLER( disk2_io60_port_w) |
| 282 | { |
| 283 | /* Ecriture du status uPD ??? impossible ! */ |
| 284 | running_device *fdc = space->machine->device("upd765"); |
| 285 | |
| 286 | upd765_data_w(fdc, 0,data); //upd765_data_w(device, offset, data); |
| 287 | |
| 288 | } |
| 289 | WRITE8_HANDLER( disk2_io61_port_w) |
| 290 | { |
| 291 | /* Ecriture d'une data uPD*/ |
| 292 | running_device *fdc = space->machine->device("upd765"); |
| 293 | |
| 294 | upd765_data_w(fdc, 0,data); //upd765_data_w(device, offset, data); |
| 295 | |
| 296 | } |
| 297 | READ8_HANDLER( disk2_io70_port_r) |
| 298 | { |
| 299 | /* Read DMA Data of FDC */ |
| 300 | UINT8 data=0; |
| 301 | //UINT16 hlreg;/*Used to debug*/ |
| 302 | |
| 303 | running_device *fdc = space->machine->device("upd765"); |
| 304 | data=upd765_dack_r(fdc, 1); /* when pin A0 =1*/ |
| 305 | //hlreg = cpu_get_reg(space->machine->device("disk2cpu"), Z80_HL); // voir H L |
| 306 | |
| 307 | //printf("%c",hlreg); |
| 308 | return data; |
| 309 | } |
| 310 | WRITE8_HANDLER( disk2_io70_port_w) |
| 311 | { |
| 312 | running_device *fdc = space->machine->device("upd765"); |
| 313 | /* Write DMA Data on FDC */ |
| 314 | upd765_dack_w(fdc, 0,data); |
| 315 | } |
src/mess/machine/hec2hrp.c
| r9227 | r9228 | |
| 25 | 25 | => add device MX80c and bank switching for the ROM |
| 26 | 26 | 03/01/2010 Update and clean prog by yo_fr (jj.stac@aliceadsl.fr) |
| 27 | 27 | => add the port mapping for keyboard |
| 28 | 28/09/2010 add the DISK II support by yo_fr (jj.stac@aliceadsl.fr) |
| 29 | => Note that actually the DISK II boot (loading CPM : OK) but do not run (don't run the CPM...). |
| 28 | 30 | |
| 29 | 31 | don't forget to keep some information about these machines, see DChector project : http://dchector.free.fr/ made by DanielCoulom |
| 30 | 32 | (and thank's to Daniel!) |
| r9227 | r9228 | |
| 40 | 42 | #include "sound/wave.h" /* for K7 sound*/ |
| 41 | 43 | #include "sound/discrete.h" /* for 1 Bit sound*/ |
| 42 | 44 | #include "deprecat.h" |
| 45 | #include "machine/upd765.h" /* for floppy disc controller */ |
| 46 | #include "formats/basicdsk.h" |
| 47 | |
| 48 | #include "formats/hect_tap.h" |
| 43 | 49 | #include "includes/hec2hrp.h" |
| 44 | 50 | |
| 45 | 51 | |
| r9227 | r9228 | |
| 71 | 77 | static UINT8 pot0 = 0x40, pot1 = 0x40; /* State for joy resistor*/ |
| 72 | 78 | static UINT8 actions; /* joy button off*/ |
| 73 | 79 | |
| 80 | // Etat des ports Hector (8255) |
| 81 | |
| 82 | UINT8 hector_port_a=0; |
| 83 | UINT8 hector_port_b=0; |
| 84 | UINT8 hector_port_c_h=0; |
| 85 | UINT8 hector_port_c_l=0; |
| 86 | UINT8 hector_port_cmd=0; |
| 74 | 87 | static TIMER_CALLBACK( Callback_CK ) |
| 75 | 88 | { |
| 76 | 89 | /* To generate the CK signal (K7)*/ |
| r9227 | r9228 | |
| 322 | 335 | Port Handling |
| 323 | 336 | ********************************************************************************/ |
| 324 | 337 | |
| 325 | | READ8_HANDLER( hector_mx_io_port_r) |
| 338 | /******************* Lecture PIO 8255 *******************/ |
| 339 | READ8_HANDLER( hector_io_8255_r) |
| 326 | 340 | { |
| 327 | | return 0; // printer ok |
| 341 | |
| 342 | /* 8255 in mode 0 */ |
| 343 | UINT8 data =0; |
| 344 | UINT8 data_l=0; |
| 345 | UINT8 data_h=0; |
| 346 | //hector_port_cmd = 0x8a; // FORCAGE ********************************************************************************************** |
| 347 | if ((offset & 0x3) == 0x0) /* Port A */ |
| 348 | data = hector_port_a; |
| 349 | if ((offset & 0x3) == 0x1) /* Port B */ |
| 350 | data = hector_port_b; |
| 351 | if ((offset & 0x3) == 0x2) /* Port C */ |
| 352 | { |
| 353 | data_l = (hector_port_c_l & 0x0f); |
| 354 | data_h = (hector_port_c_h & 0xf0); |
| 355 | |
| 356 | if (BIT(hector_port_cmd, 0)) /* Quartet inf en entree ?*/ |
| 357 | data_l = (hector_port_c_l & 0x0f); /*no change*/ |
| 358 | |
| 359 | if (BIT(hector_port_cmd, 3)) /* Quartet sup en entree ?*/ |
| 360 | { |
| 361 | hector_port_c_h = (hector_port_c_h & 0x0c0); /* Raz de l'etat des bits 4 et 5*/ |
| 362 | |
| 363 | if (disk2_data_w_ready != 0x00) |
| 364 | hector_port_c_h = hector_port_c_h + 0x010; // PC4 (donnee dispo en provenance du Disk II) |
| 365 | |
| 366 | if (disk2_data_r_ready != 0x00) |
| 367 | hector_port_c_h = hector_port_c_h + 0x020; // PC5 (donnee pas encore lue par Disk II) |
| 368 | |
| 369 | data_h = hector_port_c_h; |
| 370 | } |
| 371 | data= data_l + data_h; |
| 372 | } |
| 373 | return data; // Retour de la valeur ! |
| 328 | 374 | } |
| 375 | /******************* Ecriture PIO 8255 *******************/ |
| 376 | WRITE8_HANDLER( hector_io_8255_w) |
| 377 | { |
| 378 | /* 8255 in mode 0 */ |
| 379 | if ((offset & 0x3) == 0x0) /* Port A => to printer or Disk II*/ |
| 380 | hector_port_a = data; |
| 381 | //ex : printer_output(devtag_get_device(space->machine, "printer"), data); |
| 382 | |
| 383 | if ((offset & 0x3) == 0x1) /* Port B */ |
| 384 | hector_port_b = data; |
| 385 | |
| 386 | |
| 387 | if ((offset & 0x3) == 0x2) /* Port C => depending cmd word */ |
| 388 | { |
| 389 | if (!BIT(hector_port_cmd, 0)) /* cmd -> Quartet inf en sortie ?*/ |
| 390 | { |
| 391 | hector_port_c_l = data & 0x0f; |
| 392 | |
| 393 | // Utilisation des bit du port C : PC1 // PC2 |
| 394 | if BIT(hector_port_c_l, 1) // PC1 (bit X1)= true |
| 395 | { |
| 396 | // Lecture effectuee => RAZ memoire donnee disk2_data_write dispo |
| 397 | hector_port_b = disk2_data_write; // Mep sur port B si 2eme 74374 existant ! |
| 398 | disk2_data_w_ready = 0x00; |
| 399 | } |
| 400 | if BIT(hector_port_c_l, 2) // PC2 (bit X2)= true |
| 401 | { |
| 402 | disk2_data_read = hector_port_a; /* mise en place de l'info presente sur le port A */ |
| 403 | disk2_data_r_ready = 0xff; /* memorisation de l'info */ |
| 404 | } |
| 405 | |
| 406 | } |
| 407 | if (!BIT(hector_port_cmd, 3)) /* cmd -> Quartet sup en sortie ?*/ |
| 408 | hector_port_c_h = (data & 0xf0); |
| 409 | } |
| 410 | |
| 411 | if ((offset & 0x3) == 0x3) /* Port commande */ |
| 412 | { |
| 413 | hector_port_cmd = data; // 8a sur MX40! |
| 414 | // printf("Port de commande = %x",data); |
| 415 | } |
| 416 | } /* End of 8255 managing */ |
| 417 | |
| 418 | |
| 419 | /******************* Ecriture PIO specifique machine MX40 *******************/ |
| 329 | 420 | WRITE8_HANDLER( hector_mx40_io_port_w) |
| 330 | 421 | { |
| 422 | /* Bank switching on several address */ |
| 331 | 423 | if ((offset &0x0ff) == 0xf0) /* Port A => to printer*/ |
| 332 | 424 | printer_output(space->machine->device("printer"), data); |
| 333 | 425 | if ((offset &0x0ff) == 0x40) /* Port page 0*/ |
| r9227 | r9228 | |
| 343 | 435 | hector_flag_80c=0;/* No 80c in 40c !*/ |
| 344 | 436 | } |
| 345 | 437 | |
| 438 | /******************* Ecriture PIO specifique machine MX80 *******************/ |
| 346 | 439 | WRITE8_HANDLER( hector_mx80_io_port_w) |
| 347 | 440 | { |
| 348 | 441 | if ((offset &0x0ff) == 0xf0) /* Port A => to printer*/ |
| r9227 | r9228 | |
| 633 | 726 | hector_flag_hr = hr; |
| 634 | 727 | flag_clk = 0; |
| 635 | 728 | write_cassette = 0; |
| 729 | //const device_config *fdc = devtag_get_device(space->machine, "upd765"); |
| 730 | //upd765_reset_w(fdc, 1); |
| 731 | |
| 732 | cputag_set_input_line(machine, "disk2cpu", INPUT_LINE_RESET, PULSE_LINE); |
| 733 | |
| 636 | 734 | } |
| 637 | 735 | |
| 638 | 736 | void hector_init(running_machine *machine) |
src/mess/drivers/hec2hrp.c
| r9227 | r9228 | |
| 16 | 16 | victor - press R then L |
| 17 | 17 | |
| 18 | 18 | 12/05/2009 Skeleton driver - Micko |
| 19 | 31/06/2009 Video - Robbbert |
| 19 | 20 | |
| 20 | 21 | 29/10/2009 Update skeleton to functional machine |
| 21 | 22 | by yo_fr (jj.stac@aliceadsl.fr) |
| r9227 | r9228 | |
| 68 | 69 | #include "sound/sn76477.h" /* for sn sound*/ |
| 69 | 70 | #include "sound/wave.h" /* for K7 sound*/ |
| 70 | 71 | #include "sound/discrete.h" /* for 1 Bit sound*/ |
| 72 | #include "machine/upd765.h" /* for floppy disc controller */ |
| 73 | #include "devices/flopdrv.h" |
| 74 | #include "formats/basicdsk.h" |
| 71 | 75 | #include "cpu/z80/z80.h" |
| 72 | 76 | |
| 73 | 77 | #include "includes/hec2hrp.h" |
| 74 | 78 | |
| 79 | /*****************************************************************************/ |
| 80 | static ADDRESS_MAP_START(hecdisk2_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 81 | /*****************************************************************************/ |
| 82 | ADDRESS_MAP_UNMAP_HIGH |
| 75 | 83 | |
| 84 | /* Hardward address mapping*/ |
| 85 | AM_RANGE( 0x0000, 0x0fff ) AM_ROM AM_REGION("disk2cpu", 0) /* rom memory ->passage en RAM pour ecriture en zone 0x0066 */ |
| 86 | AM_RANGE( 0x0000, 0xffff ) AM_READWRITE( hector_disk2_r, hector_disk2_w)/* ram memory */ |
| 87 | |
| 88 | ADDRESS_MAP_END |
| 89 | |
| 90 | static ADDRESS_MAP_START( hecdisk2_io , ADDRESS_SPACE_IO, 8) |
| 91 | ADDRESS_MAP_UNMAP_HIGH |
| 92 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 93 | AM_RANGE(0x030,0x03f) AM_READWRITE( disk2_io30_port_r, disk2_io30_port_w ) |
| 94 | AM_RANGE(0x040,0x04f) AM_READWRITE( disk2_io40_port_r, disk2_io40_port_w ) |
| 95 | AM_RANGE(0x050,0x05f) AM_READWRITE( disk2_io50_port_r, disk2_io50_port_w ) |
| 96 | AM_RANGE(0x060,0x060) AM_READWRITE( disk2_io60_port_r, disk2_io60_port_w ) |
| 97 | AM_RANGE(0x061,0x061) AM_READWRITE( disk2_io61_port_r, disk2_io61_port_w ) |
| 98 | AM_RANGE(0x070,0x07f) AM_READWRITE( disk2_io70_port_r, disk2_io70_port_w ) |
| 99 | ADDRESS_MAP_END |
| 76 | 100 | /*****************************************************************************/ |
| 77 | 101 | static ADDRESS_MAP_START(hec2hrp_mem, ADDRESS_SPACE_PROGRAM, 8) |
| 78 | 102 | /*****************************************************************************/ |
| r9227 | r9228 | |
| 103 | 127 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 104 | 128 | ADDRESS_MAP_END |
| 105 | 129 | |
| 130 | static ADDRESS_MAP_START( hec2hrx_io , ADDRESS_SPACE_IO, 8) |
| 131 | ADDRESS_MAP_UNMAP_HIGH |
| 132 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 133 | AM_RANGE(0x0f0,0x0ff) AM_READWRITE( hector_io_8255_r, hector_io_8255_w ) |
| 134 | ADDRESS_MAP_END |
| 135 | |
| 106 | 136 | static ADDRESS_MAP_START( hec2mx40_io , ADDRESS_SPACE_IO, 8) |
| 107 | 137 | ADDRESS_MAP_UNMAP_HIGH |
| 108 | 138 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 109 | | AM_RANGE(0x000,0x0ff) AM_READWRITE( hector_mx_io_port_r, hector_mx40_io_port_w ) |
| 139 | AM_RANGE(0x000,0x0ef) AM_WRITE( hector_mx40_io_port_w ) |
| 140 | AM_RANGE(0x0f0,0x0f3) AM_READWRITE( hector_io_8255_r, hector_io_8255_w ) |
| 110 | 141 | ADDRESS_MAP_END |
| 111 | 142 | |
| 112 | 143 | static ADDRESS_MAP_START( hec2mx80_io , ADDRESS_SPACE_IO, 8) |
| 113 | 144 | ADDRESS_MAP_UNMAP_HIGH |
| 114 | | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 115 | | AM_RANGE(0x000,0x0ff) AM_READWRITE( hector_mx_io_port_r, hector_mx80_io_port_w ) |
| 145 | ADDRESS_MAP_GLOBAL_MASK(0xff)// sure ? |
| 146 | AM_RANGE(0x000,0x0ef) AM_WRITE( hector_mx80_io_port_w ) |
| 147 | |
| 148 | AM_RANGE(0x000,0x0ff) AM_READWRITE( hector_io_8255_r, hector_io_8255_w ) |
| 116 | 149 | ADDRESS_MAP_END |
| 117 | 150 | |
| 118 | 151 | /* Input ports */ |
| r9227 | r9228 | |
| 211 | 244 | /*****************************************************************************/ |
| 212 | 245 | { |
| 213 | 246 | UINT8 *RAM = memory_region(machine, "maincpu"); // pointer to mess ram |
| 247 | UINT8 *RAMD2 = memory_region(machine, "disk2cpu"); // pointer to mess ram |
| 214 | 248 | UINT8 *ROM1 = memory_region(machine, "page1"); // pointer to rom page 1 |
| 215 | 249 | UINT8 *ROM2 = memory_region(machine, "page2"); // pointer to rom page 2 |
| 250 | UINT32 index=0; |
| 251 | //Patch rom possible ! |
| 252 | //RAMD2[0xff6b] = 0x0ff; // force verbose mode hector ! |
| 216 | 253 | |
| 254 | //Initialisation ROM |
| 255 | while (index <0x01001) |
| 256 | { |
| 257 | Disk2memory[index] = RAMD2[index]; |
| 258 | index++; |
| 259 | } |
| 260 | cputag_set_input_line(machine, "disk2cpu", INPUT_LINE_RESET, PULSE_LINE); |
| 261 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE); |
| 262 | // cputag_set_input_line(machine, "disk2cpu", INPUT_LINE_IRQ0, CLEAR_LINE); //INT / NMI... |
| 263 | |
| 217 | 264 | // Memory install for bank switching |
| 218 | 265 | memory_configure_bank(machine, "bank1", HECTOR_BANK_PROG , 1, &RAM[0xc000] , 0); // Mess ram |
| 219 | 266 | memory_configure_bank(machine, "bank1", HECTOR_BANK_VIDEO, 1, hector_videoram, 0); // Video ram |
| r9227 | r9228 | |
| 228 | 275 | memory_set_bank(machine, "bank2", HECTORMX_BANK_PAGE0); |
| 229 | 276 | /******************************************************SPECIFIQUE MX ***************************/ |
| 230 | 277 | hector_init(machine); |
| 278 | Init_Timer_DiskII(machine); // Init of the Disk II ! |
| 231 | 279 | } |
| 232 | 280 | |
| 233 | 281 | static MACHINE_RESET(hec2hrp) |
| r9227 | r9228 | |
| 293 | 341 | MDRV_SOUND_CONFIG_DISCRETE( hec2hrp ) |
| 294 | 342 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 295 | 343 | |
| 344 | /* Gestion cassette*/ |
| 296 | 345 | MDRV_CASSETTE_ADD( "cassette", hector_cassette_config ) |
| 297 | 346 | |
| 298 | 347 | /* printer */ |
| r9227 | r9228 | |
| 335 | 384 | MDRV_SOUND_CONFIG_DISCRETE( hec2hrp ) |
| 336 | 385 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 337 | 386 | |
| 387 | /* Gestion cassette*/ |
| 338 | 388 | MDRV_CASSETTE_ADD( "cassette", hector_cassette_config ) |
| 339 | 389 | |
| 340 | 390 | /* printer */ |
| r9227 | r9228 | |
| 353 | 403 | MDRV_MACHINE_RESET(hec2hrp) |
| 354 | 404 | MDRV_MACHINE_START(hec2hrp) |
| 355 | 405 | |
| 406 | /* Disk II unit */ |
| 407 | MDRV_CPU_ADD("disk2cpu",Z80, XTAL_4MHz) |
| 408 | MDRV_CPU_PROGRAM_MAP(hecdisk2_mem) |
| 409 | MDRV_CPU_IO_MAP(hecdisk2_io) |
| 410 | // MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) // put on the Z80 irq in Hz |
| 411 | MDRV_UPD765A_ADD("upd765", disk2_upd765_interface) |
| 412 | MDRV_FLOPPY_2_DRIVES_ADD(disk2_floppy_config) |
| 356 | 413 | /* video hardware */ |
| 357 | 414 | MDRV_SCREEN_ADD("screen", RASTER) |
| 358 | 415 | MDRV_SCREEN_REFRESH_RATE(50) |
| r9227 | r9228 | |
| 377 | 434 | MDRV_SOUND_CONFIG_DISCRETE( hec2hrp ) |
| 378 | 435 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 379 | 436 | |
| 437 | /* Gestion cassette*/ |
| 380 | 438 | MDRV_CASSETTE_ADD( "cassette", hector_cassette_config ) |
| 381 | 439 | |
| 382 | 440 | /* printer */ |
| 383 | 441 | MDRV_PRINTER_ADD("printer") |
| 384 | 442 | |
| 385 | 443 | MACHINE_CONFIG_END |
| 444 | /*****************************************************************************/ |
| 445 | static MACHINE_CONFIG_START( hec2hrx, driver_device ) |
| 446 | /*****************************************************************************/ |
| 447 | /* basic machine hardware */ |
| 448 | MDRV_CPU_ADD("maincpu",Z80, XTAL_5MHz) |
| 449 | MDRV_CPU_PROGRAM_MAP(hec2hrp_mem) |
| 450 | MDRV_CPU_IO_MAP(hec2hrx_io) |
| 451 | MDRV_CPU_PERIODIC_INT(irq0_line_hold,50) // put on the Z80 irq in Hz |
| 452 | MDRV_MACHINE_RESET(hec2hrp) |
| 453 | MDRV_MACHINE_START(hec2hrp) |
| 386 | 454 | |
| 455 | /* Disk II unit */ |
| 456 | MDRV_CPU_ADD("disk2cpu",Z80, XTAL_4MHz) |
| 457 | MDRV_CPU_PROGRAM_MAP(hecdisk2_mem) |
| 458 | MDRV_CPU_IO_MAP(hecdisk2_io) |
| 459 | MDRV_UPD765A_ADD("upd765", disk2_upd765_interface) |
| 460 | MDRV_FLOPPY_2_DRIVES_ADD(disk2_floppy_config) |
| 461 | |
| 462 | |
| 463 | /* video hardware */ |
| 464 | MDRV_SCREEN_ADD("screen", RASTER) |
| 465 | MDRV_SCREEN_REFRESH_RATE(50) |
| 466 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ |
| 467 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 468 | MDRV_SCREEN_SIZE(512, 230) |
| 469 | MDRV_SCREEN_VISIBLE_AREA(0, 243, 0, 227) |
| 470 | MDRV_PALETTE_LENGTH(16) |
| 471 | MDRV_PALETTE_INIT(black_and_white) |
| 472 | MDRV_VIDEO_START(hec2hrp) |
| 473 | MDRV_VIDEO_UPDATE(hec2hrp) |
| 474 | |
| 475 | /* sound hardware */ |
| 476 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 477 | MDRV_SOUND_WAVE_ADD("wave", "cassette") |
| 478 | MDRV_SOUND_ROUTE(0, "mono", 0.1)// Sound level for cassette, as it is in mono => output channel=0 |
| 479 | |
| 480 | MDRV_SOUND_ADD("sn76477", SN76477, 0) |
| 481 | MDRV_SOUND_CONFIG(hector_sn76477_interface) |
| 482 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.1) |
| 483 | |
| 484 | MDRV_SOUND_ADD("discrete", DISCRETE, 0) // Son 1bit |
| 485 | MDRV_SOUND_CONFIG_DISCRETE( hec2hrp ) |
| 486 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 487 | |
| 488 | // Gestion cassette |
| 489 | MDRV_CASSETTE_ADD( "cassette", hector_cassette_config ) |
| 490 | |
| 491 | /* printer */ |
| 492 | MDRV_PRINTER_ADD("printer") |
| 493 | |
| 494 | MACHINE_CONFIG_END |
| 387 | 495 | /*****************************************************************************/ |
| 388 | 496 | static MACHINE_CONFIG_START( hec2mx80, hec2hrp_state ) |
| 389 | 497 | /*****************************************************************************/ |
| r9227 | r9228 | |
| 419 | 527 | MDRV_SOUND_CONFIG_DISCRETE( hec2hrp ) |
| 420 | 528 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 421 | 529 | |
| 530 | /* Gestion cassette*/ |
| 422 | 531 | MDRV_CASSETTE_ADD( "cassette", hector_cassette_config ) |
| 423 | 532 | |
| 424 | 533 | /* printer */ |
| r9227 | r9228 | |
| 453 | 562 | ROM_LOAD( "hector2hrx.rom", 0x0000, 0x4000, CRC(f047c521) SHA1(744336b2acc76acd7c245b562bdc96dca155b066)) |
| 454 | 563 | ROM_REGION( 0x4000, "page1", ROMREGION_ERASEFF ) |
| 455 | 564 | ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) |
| 565 | ROM_REGION( 0x10000, "disk2cpu", ROMREGION_ERASEFF ) |
| 566 | ROM_LOAD( "d800k.bin" , 0x0000,0x1000, CRC(831bd584) SHA1(9782ee58f570042608d9d568b2c3fc4c6d87d8b9)) |
| 456 | 567 | ROM_END |
| 457 | 568 | |
| 458 | 569 | ROM_START( hec2mx80 ) |
| r9227 | r9228 | |
| 471 | 582 | ROM_LOAD( "mx40c_page1.rom", 0x0000, 0x4000, CRC(192a76fa) SHA1(062aa6df0b554b85774d4b5edeea8496a4baca35)) |
| 472 | 583 | ROM_REGION( 0x4000, "page2", ROMREGION_ERASEFF ) |
| 473 | 584 | ROM_LOAD( "mx40c_page2.rom" , 0x0000,0x4000, CRC(ef1b2654) SHA1(66624ea040cb7ede4720ad2eca0738d0d3bad89a)) |
| 585 | ROM_REGION( 0x10000, "disk2cpu", ROMREGION_ERASEFF ) |
| 586 | // ROM_REGION( 0x10000, "rom_disk2", ROMREGION_ERASEFF ) // Marche avec cela sauf ecr en ram !!!! |
| 587 | // ROM_LOAD( "d360k.bin" , 0x0000,0x4000, CRC(2454eacb) SHA1(dc0d5a7d5891a7e422d9d142a2419527bb15dfd5)) |
| 588 | ROM_LOAD( "d800k.bin" , 0x0000,0x1000, CRC(831bd584) SHA1(9782ee58f570042608d9d568b2c3fc4c6d87d8b9)) |
| 589 | // ROM_LOAD( "d200k.bin" , 0x0000,0x4000, CRC(e2801377) SHA1(0926df5b417ecd8013e35c71b76780c5a25c1cbf)) |
| 590 | |
| 474 | 591 | ROM_END |
| 475 | 592 | |
| 476 | 593 | /* Driver */ |
| r9227 | r9228 | |
| 479 | 596 | COMP(1983, hec2hrp, 0, interact, hec2hrp, hec2hrp, 0, "Micronique", "Hector 2HR+", GAME_IMPERFECT_SOUND) |
| 480 | 597 | COMP(1980, victor, hec2hrp, 0, hec2hrp, hec2hrp, 0, "Micronique", "Victor", GAME_IMPERFECT_SOUND) |
| 481 | 598 | COMP(1983, hec2hr , hec2hrp, 0, hec2hr, hec2hrp, 0, "Micronique", "Hector 2HR", GAME_IMPERFECT_SOUND) |
| 482 | | COMP(1984, hec2hrx, hec2hrp, 0, hec2hrp, hec2hrp, 0, "Micronique", "Hector HRX", GAME_IMPERFECT_SOUND) |
| 599 | COMP(1984, hec2hrx, hec2hrp, 0, hec2hrx, hec2hrp, 0, "Micronique", "Hector HRX", GAME_IMPERFECT_SOUND) |
| 483 | 600 | COMP(1985, hec2mx80, hec2hrp, 0, hec2mx80, hec2hrp, 0, "Micronique", "Hector MX 80c" , GAME_IMPERFECT_SOUND) |
| 484 | 601 | COMP(1985, hec2mx40, hec2hrp, 0, hec2mx40, hec2hrp, 0, "Micronique", "Hector MX 40c" , GAME_IMPERFECT_SOUND) |