Previous 15994 Revisions Next

r2025 Thursday 20th March, 2008 at 04:32:36 UTC by Robbbert
[EXIDY] Removed hacky set_pc at boot, and did a quickload tidyup
[src/mess/drivers]exidy.c

src/mess/drivers/exidy.c
r2024r2025
221221   logerror("hd6402 state: %04x %04x\n",mask,data);
222222}
223223
224static TIMER_CALLBACK(exidy_reset_timer_callback)
224/* after the first 4 bytes have been read from ROM, switch the ram back in */
225static TIMER_CALLBACK( exidy_reset )
225226{
226   cpunum_set_reg(0, REG_PC, 0x0e000);
227   memory_set_bank(1, 0);
227228}
228229
229230static void exidy_printer_handshake_in(int number, int data, int mask)
r2024r2025
275276
276277   exidy_fe_port_w(machine, 0, 0);
277278
278   timer_set(attotime_zero, NULL, 0, exidy_reset_timer_callback);
279   timer_set(ATTOTIME_IN_USEC(10), NULL, 0, exidy_reset);
280   memory_set_bank(1, 1);
279281}
280282
281283static MACHINE_RESET( exidy )
282284{
285   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
283286   MACHINE_RESET_CALL( exidyd );
284   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
285287}
286288
287289
r2024r2025
324326}
325327
326328
327static ADDRESS_MAP_START( exidy_mem , ADDRESS_SPACE_PROGRAM, 8)
328   ADDRESS_MAP_UNMAP_HIGH
329   AM_RANGE(0x0000, 0x7fff) AM_RAM      /* ram 32k machine */
330   AM_RANGE(0xbc00, 0xbcff) AM_ROM
331   AM_RANGE(0xbe00, 0xbe03) AM_READWRITE(exidy_wd179x_r, exidy_wd179x_w)
332
333   AM_RANGE(0xc000, 0xefff) AM_ROM      /* rom pac */
334   AM_RANGE(0xf000, 0xf7ff) AM_RAM      /* screen ram */
335   AM_RANGE(0xf800, 0xfbff) AM_ROM      /* char rom */
336   AM_RANGE(0xfc00, 0xffff) AM_RAM      /* programmable chars */
337ADDRESS_MAP_END
338
339static ADDRESS_MAP_START( exidyd_mem , ADDRESS_SPACE_PROGRAM, 8)
340   ADDRESS_MAP_UNMAP_HIGH
341   AM_RANGE(0x0000, 0xbfff) AM_RAM      /* ram 48k diskless machine */
342   AM_RANGE(0xc000, 0xefff) AM_ROM      /* rom pac */
343   AM_RANGE(0xf000, 0xf7ff) AM_RAM      /* screen ram */
344   AM_RANGE(0xf800, 0xfbff) AM_ROM      /* char rom */
345   AM_RANGE(0xfc00, 0xffff) AM_RAM      /* programmable chars */
346ADDRESS_MAP_END
347
348329static WRITE8_HANDLER(exidy_fc_port_w)
349330{
350331   logerror("exidy fc w: %04x %02x\n",offset,data);
r2024r2025
506487   UINT8 data = 0xe0;
507488
508489   /* bit 4: parity error */
509   if (exidy_hd6402_state & HD6402_OUTPUT_PE) data |= (1<<4);
490   if (exidy_hd6402_state & HD6402_OUTPUT_PE) data |= 16;
510491
511492   /* bit 3: framing error */
512   if (exidy_hd6402_state & HD6402_OUTPUT_FE) data |= (1<<3);
493   if (exidy_hd6402_state & HD6402_OUTPUT_FE) data |= 8;
513494
514495   /* bit 2: over-run error */
515   if (exidy_hd6402_state & HD6402_OUTPUT_OE) data |= (1<<2);
496   if (exidy_hd6402_state & HD6402_OUTPUT_OE) data |= 4;
516497
517498   /* bit 1: data receive ready - data ready in receive reg */
518   if (exidy_hd6402_state & HD6402_OUTPUT_DR) data |= (1<<1);
499   if (exidy_hd6402_state & HD6402_OUTPUT_DR) data |= 2;
519500
520501   /* bit 0: transmitter buffer receive empty */
521502   /* if this BIT is forced high, then the cassette save routine does not hang */
522   if (exidy_hd6402_state & HD6402_OUTPUT_TBRE) data |= (1<<0);
503   if (exidy_hd6402_state & HD6402_OUTPUT_TBRE) data |= 1;
523504
524505   logerror("exidy fd r: %04x %02x\n",offset,data);
525506
r2024r2025
563544}
564545
565546
547static READ8_HANDLER( exidy_read_ff ) { return 0xff; }
548
549static ADDRESS_MAP_START( exidy_mem , ADDRESS_SPACE_PROGRAM, 8)
550   ADDRESS_MAP_UNMAP_HIGH
551   AM_RANGE(0x0000, 0x07ff) AM_RAMBANK(1)
552   AM_RANGE(0x0800, 0x7fff) AM_RAM      /* ram 32k machine */
553   AM_RANGE(0x8000, 0xbbff) AM_READWRITE(exidy_read_ff, SMH_NOP)
554   AM_RANGE(0xbc00, 0xbcff) AM_ROM      /* disk bios */
555   AM_RANGE(0xbd00, 0xbdff) AM_READWRITE(exidy_read_ff, SMH_NOP)
556   AM_RANGE(0xbe00, 0xbe03) AM_READWRITE(exidy_wd179x_r, exidy_wd179x_w)
557   AM_RANGE(0xbe04, 0xbfff) AM_READWRITE(exidy_read_ff, SMH_NOP)
558   AM_RANGE(0xc000, 0xefff) AM_ROM      /* rom pac and bios */
559   AM_RANGE(0xf000, 0xf7ff) AM_RAM      /* screen ram */
560   AM_RANGE(0xf800, 0xfbff) AM_ROM      /* char rom */
561   AM_RANGE(0xfc00, 0xffff) AM_RAM      /* programmable chars */
562ADDRESS_MAP_END
563
564static ADDRESS_MAP_START( exidyd_mem , ADDRESS_SPACE_PROGRAM, 8)
565   ADDRESS_MAP_UNMAP_HIGH
566   AM_RANGE(0x0000, 0x07ff) AM_RAMBANK(1)
567   AM_RANGE(0x0800, 0xbfff) AM_RAM      /* ram 48k diskless machine */
568   AM_RANGE(0xc000, 0xefff) AM_ROM      /* rom pac and bios */
569   AM_RANGE(0xf000, 0xf7ff) AM_RAM      /* screen ram */
570   AM_RANGE(0xf800, 0xfbff) AM_ROM      /* char rom */
571   AM_RANGE(0xfc00, 0xffff) AM_RAM      /* programmable chars */
572ADDRESS_MAP_END
573
566574static ADDRESS_MAP_START( exidy_io , ADDRESS_SPACE_IO, 8)
567575   ADDRESS_MAP_GLOBAL_MASK(0xff)
568576   ADDRESS_MAP_UNMAP_HIGH
r2024r2025
745753   MDRV_MACHINE_RESET( exidyd )
746754MACHINE_DRIVER_END
747755
756static DRIVER_INIT( exidy )
757{
758   UINT8 *RAM = memory_region(REGION_CPU1);
759   memory_configure_bank(1, 0, 2, &RAM[0x0000], 0xe000);
760//   timer_pulse(ATTOTIME_IN_HZ(200000),NULL,0,exidy_timer);      /* timer for cassette */
761}
762
748763/***************************************************************************
749764
750765  Game driver(s)
r2024r2025
757772   ROM_LOAD("exmo1-2.dat", 0xe800, 0x0800, CRC(ead1d0f6) SHA1(c68bed7344091bca135e427b4793cc7d49ca01be) )
758773   ROM_LOAD("exchr-1.dat", 0xf800, 0x0400, CRC(4a7e1cdd) SHA1(2bf07a59c506b6e0c01ec721fb7b747b20f5dced) ) /* char rom */
759774   ROM_LOAD_OPTIONAL("diskboot.dat",0xbc00, 0x0100, BAD_DUMP CRC(d82a40d6) SHA1(cd1ef5fb0312cd1640e0853d2442d7d858bc3e3b))
760   ROM_CART_LOAD(0, "rom", 0xc000, 0x2000, ROM_NOMIRROR | ROM_OPTIONAL)
775   ROM_CART_LOAD(0, "rom", 0xc000, 0x2000, ROM_FILL_FF | ROM_OPTIONAL)
761776
762777   ROM_REGION( 0x0020, REGION_PROMS, 0 )
763778   ROM_LOAD_OPTIONAL("bruce.dat",   0x0000, 0x0020, CRC(fae922cb) SHA1(470a86844cfeab0d9282242e03ff1d8a1b2238d1)) /* video prom */
r2024r2025
768783   ROM_LOAD("exmo1-1.dat", 0xe000, 0x0800, CRC(ac924f67) SHA1(72fcad6dd1ed5ec0527f967604401284d0e4b6a1) ) /* monitor roms */
769784   ROM_LOAD("exmo1-2.dat", 0xe800, 0x0800, CRC(ead1d0f6) SHA1(c68bed7344091bca135e427b4793cc7d49ca01be) )
770785   ROM_LOAD("exchr-1.dat", 0xf800, 0x0400, CRC(4a7e1cdd) SHA1(2bf07a59c506b6e0c01ec721fb7b747b20f5dced) ) /* char rom */
771   ROM_CART_LOAD(0, "rom", 0xc000, 0x2000, ROM_NOMIRROR | ROM_OPTIONAL)
786   ROM_CART_LOAD(0, "rom", 0xc000, 0x2000, ROM_FILL_FF | ROM_OPTIONAL)
772787
773788   ROM_REGION( 0x0020, REGION_PROMS, 0 )
774789   ROM_LOAD_OPTIONAL("bruce.dat",   0x0000, 0x0020, CRC(fae922cb) SHA1(470a86844cfeab0d9282242e03ff1d8a1b2238d1)) /* video prom */
r2024r2025
776791
777792static QUICKLOAD_LOAD( exidy )
778793{
779   UINT8 sw = readinputportbytag("CONFIG") & 1;            /* reading the dipswitch: 1 = autorun */
794   UINT8 sw = readinputportbytag("CONFIG") & 1;         /* reading the dipswitch: 1 = autorun */
780795   UINT16 exec_addr, start_addr, end_addr;
781796
782797   if (z80bin_load_file( machine, image, file_type, &exec_addr, &start_addr, &end_addr ) == INIT_FAIL)
783      return INIT_FAIL;   /* load file */
798      return INIT_FAIL;
784799
800   if (exec_addr == 0xffff) return INIT_PASS;         /* data file */
801
802   if ((exec_addr >= 0xc000) && (exec_addr <= 0xdfff) && (program_read_byte(0xdffa) != 0xc3))
803      return INIT_PASS;               /* can't run a program if the cartridge isn't in */
804
785805   /* Since Exidy Basic is by Microsoft, it needs some preprocessing before it can be run.
786806   1. A start address of 01D5 indicates a basic program which needs its pointers fixed up.
787   2. An exec address of C858 indicates a basic program.
788         This address is unsuitable, so the routine at F020 is used instead.
789   3. If the start address is 1D5 and the exec address is NOT C858,
790      the pointers still need fixing, but then jump to the exec address.
791   4. If autorun is turned off, the pointers still need fixing, but then display READY.
807   2. If autorunning, jump to C689 (command processor), else jump to C3DD (READY prompt).
792808   Important addresses:
793809      01D5 = start (load) address of a conventional basic program
794810      C858 = an autorun basic program will have this exec address on the tape
795      C3DD = part of basic that displays READY and lets user enter input
796      F020 = custom routine to fix basic pointers
797      F030 = exec address to jump to after fixing the pointers */
811      C3DD = part of basic that displays READY and lets user enter input */
798812
799813   if ((start_addr == 0x1d5) || (exec_addr == 0xc858))
800814   {
801      UINT8 i, sec[18]={
802         0x2a, 2, 0xf0,      // LD HL,(F002)   ;get saved end_addr+1
803         0x22, 0xb7, 1,      // LD (01B7),HL   ;move it to correct place
815      UINT8 i, data[]={
804816         0xcd, 0x26, 0xc4,   // CALL C426   ;set up other pointers
805         0x21, 0xd4, 1,      // LD HL,01D4   ;dummy-start address
806         0x36, 0,      // LD (HL),00   ;make sure it is end-of-line
807         0,         // NOP      ;line up jump address to an even byte
808         0xc3, 0x89, 0xc6,};   // JP C689   ;run program - f030 = adjustable jump
817         0x21, 0xd4, 1,      // LD HL,01D4   ;start of program address (used by C689)
818         0x36, 0,      // LD (HL),00   ;make sure dummy end-of-line is there
819         0xc3, 0x89, 0xc6,};   // JP C689   ;run program
809820
810      for (i = 0; i < 18; i++) program_write_byte(0xf020 + i, sec[i]);
821      for (i = 0; i < 11; i++) program_write_byte(0xf01f + i, data[i]);
822      if (!sw) program_write_word_16le(0xf028,0xc3dd);
823      program_write_byte(0x1b7, end_addr&0xff);      /* Tell BASIC where program ends */
824      program_write_byte(0x1b8, end_addr>>8);
825      if ((exec_addr != 0xc858) && (sw)) program_write_word_16le(0xf028,exec_addr);
826      cpunum_set_reg(0, REG_PC, 0xf01f);
827   }
828   else
829   if (sw) cpunum_set_reg(0, REG_PC, exec_addr);
811830
812      if (!sw) program_write_word_16le(0xf030,0xc3dd);
813
814      if (start_addr == 0x1d5)
815      {
816         program_write_word_16le(0xf002,end_addr+1);
817         if ((exec_addr != 0xc858) && (sw == 1)) program_write_word_16le(0xf030,exec_addr);
818         exec_addr=0xf020;
819      }
820      else
821         exec_addr=0xf02f;      // skip fixing pointers, just jump into bios
822     
823      sw = 1;
824
825      if (program_read_byte(0xdffa) != 0xc3) exec_addr=0xffff;   // can't run if cart not in
826   }   
827
828   if ((exec_addr != 0xffff) && (sw)) cpunum_set_reg(0, REG_PC, exec_addr);
829
830831   return INIT_PASS;
831832}
832833
r2024r2025
905906
906907
907908/*    YEAR  NAME    PARENT  COMPAT      MACHINE INPUT   INIT    CONFIG  COMPANY        FULLNAME */
908COMP(1979, exidy,   0,      0,   exidy,   exidy,   0,   exidy,   "Exidy Inc", "Sorcerer", 0 )
909COMP(1979, exidyd,  exidy,   0,   exidyd,   exidy,   0,   exidyd,   "Exidy Inc", "Sorcerer (Cassette only)", 0 )
909COMP(1979, exidy,   0,      0,   exidy,   exidy,   exidy,   exidy,   "Exidy Inc", "Sorcerer", 0 )
910COMP(1979, exidyd,  exidy,   0,   exidyd,   exidy,   exidy,   exidyd,   "Exidy Inc", "Sorcerer (Cassette only)", 0 )
910911

Previous 15994 Revisions Next


© 1998-2018 The MESS Team