Previous 15994 Revisions Next

r8045 Saturday 15th May, 2010 at 08:44:02 UTC by Fabio Priuli
srcclean'd the MESS tree
[src/mess]climess.c image.c infomess.c messdriv.c softlist.c
[src/mess/audio]t6721.c ted7360.c upd1771.c
[src/mess/devices]aescart.c messram.c ti99_hd.c ti99_hd.h ti99cart.c
[src/mess/drivers]abc80x.c advision.c alesis.c arcadia.c at.c atom.c c16.c c64.c cd2650.c cgc7900.c chaos.c dc.c dm7000.c dolphin.c elektor.c fmtowns.c genesis.c geneve.c gmaster.c hec2hrp.c instruct.c interact.c intv.c jaguar.c lynx.c m20.c mtx.c mz2500.c n64.c nes.c ngp.c pasogo.c pc.c pegasus.c phc25.c pipbug.c pk8020.c pv1000.c pv9234.c px8.c radio86.c rmnimbus.c scv.c sg1000.c snes.c special.c spectrum.c svision.c swtpc.c sys2900.c tandy2k.c ti99_4p.c ti99_4x.c ti99_8.c trs80m2.c ut88.c vboy.c victor9k.c vidbrain.c vt240.c wswan.c x1.c z80dev.c
[src/mess/formats]atarist_dsk.c atom_atm.c atom_tap.c cbm_snqk.c cbm_snqk.h d64_dsk.c fdi_dsk.c flopimg.c nes_dsk.c ti99_dsk.c trs_cmd.c wavfile.c
[src/mess/includes]nes.h rmnimbus.h
[src/mess/machine]64h156.c 64h156.h 8530scc.c 99_dsk.c ac1.c amstrad.c apple2.c c1541.c c16.c c2040.c conkort.c gamecom.c gb.c genesis.c geneve.c lynx.c mac.c mc6852.c mtx.c nes.c nes_ines.c nes_mmc.c pce.c rmnimbus.c rs232.c smc92x4.c smc92x4.h snescart.c ti99_4x.c ti99_4x.h ti99pcod.c wd17xx.c
[src/mess/osd/winui]messui.c propertiesms.c
[src/mess/tools/imgtool/modules]fat.c
[src/mess/tools/imgtool/windows]secview.c
[src/mess/tools/messdocs]messdocs.c
[src/mess/video]cgc7900.c crt9007.c crt9007.h fmtowns.c mbee.c odyssey2.c pegasus.c

src/mess/climess.c
r8044r8045
113113    info_listsoftware - output the list of
114114    software supported by a given game or set of
115115    games
116   TODO: Add all information read from the source files
116    TODO: Add all information read from the source files
117117    Possible improvement: use a sorted list for
118118        identifying duplicate lists.
119119-------------------------------------------------*/
src/mess/devices/ti99cart.c
r8044r8045
8787struct _ti99_multicart_state
8888{
8989   /* Reserves space for all cartridges. This is also used in the legacy
90   cartridge system, but only for slot 0. */
90    cartridge system, but only for slot 0. */
9191   cartridge_t cartridge[NUMBER_OF_CARTRIDGE_SLOTS];
9292
9393   /* Determines which slot is currently active. This value is changed when there
94   are accesses to other GROM base addresses. */
94    are accesses to other GROM base addresses. */
9595   int active_slot;
9696
9797   /* Used in order to enforce a special slot. This value is retrieved
98   from the dipswitch setting. A value of -1 means automatic, that is,
99   the grom base switch is used. Values 0 .. max refer to the
100   respective slot. */
98    from the dipswitch setting. A value of -1 means automatic, that is,
99    the grom base switch is used. Values 0 .. max refer to the
100    respective slot. */
101101   int fixed_slot;
102102
103103   /* Holds the highest index of a cartridge being plugged in plus one.
104   If we only have one cartridge inserted, we don't want to get a
105   selection option, so we just mirror the memory contents. */
104    If we only have one cartridge inserted, we don't want to get a
105    selection option, so we just mirror the memory contents. */
106106   int next_free_slot;
107107
108108   /* Counts the number of slots which currently contain legacy format
109   cartridge images. */
109    cartridge images. */
110110   int legacy_slots;
111111
112112   /* Counts the number of slots which currently contain new format
113   cartridge images. */
113    cartridge images. */
114114   int multi_slots;
115115
116116   /* Legacy mode. Stores the slot number where the cartridge part is mounted.
117   Index is from slotc_type_t. */
117    Index is from slotc_type_t. */
118118   int legacy_slotnumber[5];
119119
120120   /* current address pointer for the active GROM in port (16 bits) */
r8044r8045
123123   UINT8 grom_buffer;
124124
125125   /* internal flip-flops that are set after the first access to the GROM
126   address so that next access is mapped to the LSB, and cleared after each
127   data access */
126    address so that next access is mapped to the LSB, and cleared after each
127    data access */
128128   char raddr_LSB, waddr_LSB;
129129};
130130typedef struct _ti99_multicart_state ti99_multicart_state;
r8044r8045
280280}
281281
282282/*
283   Set the address pointer value or write to GRAM (if available).
283    Set the address pointer value or write to GRAM (if available).
284284*/
285285WRITE8_DEVICE_HANDLER(ti99_cartridge_grom_w)
286286{
287287   ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token;
288288
289289   /* Set the cart slot. Note that the port must be adjusted for 16-bit
290      systems, i.e. it should be shifted left by 1.
291      // 1001 1wbb bbbb bbr0
292   */
290       systems, i.e. it should be shifted left by 1.
291        // 1001 1wbb bbbb bbr0
292    */
293293   cartridge_slot_set(device, (offset>>2) & 0x00ff);
294294
295295   if (offset & 0x0002)
r8044r8045
300300}
301301
302302/*
303   Deliver the local address pointer value. Note that this must be
304   in sync with the console.
303    Deliver the local address pointer value. Note that this must be
304    in sync with the console.
305305*/
306306static UINT8 grom_read_address(ti99_multicart_state *cartslots)
307307{
308308   UINT8 reply;
309309   /* When reading, reset the hi/lo flag byte for writing.
310   TODO: Verify this with a real machine. */
310    TODO: Verify this with a real machine. */
311311   cartslots->waddr_LSB = FALSE;
312312
313313   /* Address reading is done in two steps; first, the high byte
314   is transferred, then the low byte. */
314    is transferred, then the low byte. */
315315   if (cartslots->raddr_LSB)
316316   {
317317      /* second pass */
r8044r8045
328328}
329329
330330/*
331   GROM access. Accesses the GROMs in the cartridge. GROM memory is
332   accessed serially via a set of ports. The GRMWA port (bank 0: 0x9c02)
333   takes two consecutive byte writes which represent the high and low byte
334   of the memory address in the GROM space. Once set, bytes can be read
335   by repeated read accesses on the GRMRD port (bank 0: 0x9800). The
336   address pointer advances on each read. The pointer wraps at the end
337   of each GROM chip memory space, i.e. every 8KiB.
338   This function takes the current GROM address minus 0x6000 which is the
339   lowest address for cartridge GROMs. Lower addresses access GROMs in the
340   console only, which appear in all banks.
341   Note that the GROM access mechanism is identical for all cartridge
342   types.
331    GROM access. Accesses the GROMs in the cartridge. GROM memory is
332    accessed serially via a set of ports. The GRMWA port (bank 0: 0x9c02)
333    takes two consecutive byte writes which represent the high and low byte
334    of the memory address in the GROM space. Once set, bytes can be read
335    by repeated read accesses on the GRMRD port (bank 0: 0x9800). The
336    address pointer advances on each read. The pointer wraps at the end
337    of each GROM chip memory space, i.e. every 8KiB.
338    This function takes the current GROM address minus 0x6000 which is the
339    lowest address for cartridge GROMs. Lower addresses access GROMs in the
340    console only, which appear in all banks.
341    Note that the GROM access mechanism is identical for all cartridge
342    types.
343343*/
344344READ8_DEVICE_HANDLER(ti99_cartridge_grom_r)
345345{
r8044r8045
349349   ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token;
350350
351351   /* Set the cart slot. Note that the port must be adjusted for 16-bit
352      systems, i.e. it should be shifted left by 1.
353      1001 1wbb bbbb bbr0
354   */
352       systems, i.e. it should be shifted left by 1.
353        1001 1wbb bbbb bbr0
354    */
355355   cartridge_slot_set(device, (offset>>2) & 0x00ff);
356356
357357   if (offset & 0x0002)
r8044r8045
363363
364364   slot = cartslots->active_slot;
365365   /*
366      This fixes a minor issue: The selection mechanism of the console
367      concludes that there are multiple cartridges plugged in when it
368      checks the different GROM bases and finds different data. Empty
369      slots should return 0 at all addresses, but when we have only
370      one cartridge, this entails that the second cartridge is
371      different (all zeros), and so we get a meaningless selection
372      option between cartridge 1 and 1 and 1 ...
366        This fixes a minor issue: The selection mechanism of the console
367        concludes that there are multiple cartridges plugged in when it
368        checks the different GROM bases and finds different data. Empty
369        slots should return 0 at all addresses, but when we have only
370        one cartridge, this entails that the second cartridge is
371        different (all zeros), and so we get a meaningless selection
372        option between cartridge 1 and 1 and 1 ...
373373
374      So if next_free_slot==1, we have one cartridge in slot 0.
375      In that case we trick the OS to believe that the addressed
376      cartridge appears at all locations which causes it to assume a
377      standard single cartslot.
378   */
374        So if next_free_slot==1, we have one cartridge in slot 0.
375        In that case we trick the OS to believe that the addressed
376        cartridge appears at all locations which causes it to assume a
377        standard single cartslot.
378    */
379379   if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1)
380380      slot=0;
381381
r8044r8045
387387      if ((cartridge->grom_size>0) && (cartridge->pcb!=NULL))
388388      {
389389         /* This is the reason why we need the image size: Read
390         access beyond the image size must be detected. */
390            access beyond the image size must be detected. */
391391         /* TODO: replace this using a bitmap of the available GROMs */
392392         if ((cartslots->grom_address < 0x6000) || (cartslots->grom_address > (cartridge->grom_size+0x6000)))
393393            value = 0;
r8044r8045
405405         value = 0;
406406         //printf("Empty socket at address G(%d)>%04x\n", slot, cartslots->grom_address);
407407      }
408      //         printf("GROM address (cart) = %04x, reply = %02x\n", cartslots->grom_address, value);
408      //          printf("GROM address (cart) = %04x, reply = %02x\n", cartslots->grom_address, value);
409409      /* The program counter wraps at each GROM chip size (8K),
410      so 0x5fff + 1 = 0x4000. */
410        so 0x5fff + 1 = 0x4000. */
411411      cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000);
412412
413413      /* Reset the read and write address flipflops. */
r8044r8045
417417}
418418
419419/*
420   Find the index of the cartridge name. We assume the format
421   <name><number>, i.e. the number is the longest string from the right
422   which can be interpreted as a number.
420    Find the index of the cartridge name. We assume the format
421    <name><number>, i.e. the number is the longest string from the right
422    which can be interpreted as a number.
423423*/
424424static int get_index_from_tagname(running_device *image)
425425{
r8044r8045
433433}
434434
435435/*
436   Common routine to assemble cartridges from resources.
436    Common routine to assemble cartridges from resources.
437437*/
438438static cartridge_t *assemble_common(running_device *cartslot)
439439{
r8044r8045
457457   cartridge = &cartslots->cartridge[slotnumber];
458458
459459   /* Get the socket which is retrieved by the multicart instance in
460   the state of the cartslot instance. */
460    the state of the cartslot instance. */
461461   socketcont = cartslot_get_socket(cartslot, "grom_socket");
462462   reslength = cartslot_get_resource_length(cartslot, "grom_socket");
463463   if (socketcont != NULL)
r8044r8045
623623*/
624624static int assemble_std(running_device *image)
625625{
626//   cartridge_t *cart;
626//  cartridge_t *cart;
627627//  printf("assemble_std, %s\n", image->tag);
628628   /*cart = */assemble_common(image);
629629
r8044r8045
12951295
12961296static int assemble_mbx(running_device *image)
12971297{
1298//   cartridge_t *cart;
1298//  cartridge_t *cart;
12991299
13001300//  printf("assemble_mbx, %s\n", image->tag);
13011301   /*cart = */assemble_common(image);
r8044r8045
20152015
20162016         /* try opening this as a multicart */
20172017         /* This line requires that cartslot_t be included in cartslot.h,
2018         otherwise one cannot make use of multicart handling within such a
2019         custom LOAD function. */
2018            otherwise one cannot make use of multicart handling within such a
2019            custom LOAD function. */
20202020         multicart_open_error me = multicart_open(image_filename(image), image->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc);
20212021
20222022         /* Now that we have loaded the image files, let the PCB put them all
2023         together. This means we put the images in a structure which allows
2024         for a quick access by the memory handlers. Every PCB defines an
2025         own assembly method. */
2023            together. This means we put the images in a structure which allows
2024            for a quick access by the memory handlers. Every PCB defines an
2025            own assembly method. */
20262026         if (me == MCERR_NONE)
20272027            result = pcb->assemble(image);
20282028         else
20292029            fatalerror("Error loading multicart: %s\n", multicart_error_text(me));
20302030
20312031         /* This is for legacy support. If we have no multicart left
2032         but there are still legacy dumps, we switch to legacy mode. */
2032            but there are still legacy dumps, we switch to legacy mode. */
20332033         if (result != INIT_FAIL)
20342034            cartslots->multi_slots++;
20352035      }
r8044r8045
21272127   if (cartridge->grom_size>0)
21282128   {
21292129      /* This is the reason why we need the image size: Read
2130      access beyond the image size must be detected. */
2130        access beyond the image size must be detected. */
21312131      if ((cartslots->grom_address < 0x6000) || (cartslots->grom_address > (cartridge->grom_size+0x6000)))
21322132         return 0;
21332133
r8044r8045
21362136      cartslots->grom_buffer = cartridge->grom_ptr[cartslots->grom_address-0x6000];
21372137      //  printf("GROM address = %04x, reply = %02x\n", console_GROMs.addr, reply>>8);
21382138      /* The program counter wraps at each GROM chip size (8K),
2139      so 0x5fff + 1 = 0x4000. */
2139        so 0x5fff + 1 = 0x4000. */
21402140      cartslots->grom_address = ((cartslots->grom_address + 1) & 0x1FFF) | (cartslots->grom_address & 0xE000);
21412141
21422142      /* Reset the read and write address flipflops. */
r8044r8045
27032703static DEVICE_RESET(ti99_multicart)
27042704{
27052705   /* Consider to propagate RESET to cartridges.
2706   However, schematics do not reveal any pin for resetting a cartridge;
2707   the reset line is an input used when plugging in a cartridge. */
2706    However, schematics do not reveal any pin for resetting a cartridge;
2707    the reset line is an input used when plugging in a cartridge. */
27082708
27092709   /* Allows to manually lock the cartslot system to a specific slot.
2710      We take slot numbers from 0 (automatic mode) to the maximum. */
2710       We take slot numbers from 0 (automatic mode) to the maximum. */
27112711
27122712   ti99_multicart_state *cartslots = (ti99_multicart_state *)device->token;
27132713   int slotnumber = input_port_read(device->machine, "CARTSLOT");
r8044r8045
27392739      return 0;
27402740
27412741   /* Same as above (GROM read): If there is only one cartridge there
2742   is no use of trying other banks. There is one issue with the
2743   selection mechanism: When the console probes the GROM banks and
2744   we have a ROM-only cartridge plugged in, it checks bank 0 and bank 1,
2745   finds no GROM, and then fails to dummy-check bank 0 again which would
2746   have set our cartridge expander to slot 0. But in slot 1 there is no
2747   ROM cartridge, so nothing shows up in the selection list. We work
2748   around this with the following line. */
2742    is no use of trying other banks. There is one issue with the
2743    selection mechanism: When the console probes the GROM banks and
2744    we have a ROM-only cartridge plugged in, it checks bank 0 and bank 1,
2745    finds no GROM, and then fails to dummy-check bank 0 again which would
2746    have set our cartridge expander to slot 0. But in slot 1 there is no
2747    ROM cartridge, so nothing shows up in the selection list. We work
2748    around this with the following line. */
27492749   if (cartslots->fixed_slot==AUTO && cartslots->next_free_slot==1)
27502750      slot=0;
27512751
r8044r8045
27802780}
27812781
27822782/*
2783   Accesses the ROM regions of the cartridge for writing.
2784   This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible
2785   for all kinds of magic which is done inside this area. Specifically,
2786   writing is often used to swap banks for subsequent reads. The actual
2787   effect of writing (beyond setting values in a RAM chip) are
2788   cartridge-specific and must be handled within the cartridge pcb.
2789   The currently set GROM bank determines which cartridge is actually
2790   accessed, also for ROM reads.
2783    Accesses the ROM regions of the cartridge for writing.
2784    This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible
2785    for all kinds of magic which is done inside this area. Specifically,
2786    writing is often used to swap banks for subsequent reads. The actual
2787    effect of writing (beyond setting values in a RAM chip) are
2788    cartridge-specific and must be handled within the cartridge pcb.
2789    The currently set GROM bank determines which cartridge is actually
2790    accessed, also for ROM reads.
27912791*/
27922792WRITE16_DEVICE_HANDLER( ti99_multicart_w )
27932793{
src/mess/devices/ti99_hd.c
r8044r8045
11/*************************************************************************
22
3   Hard disk support
4   
5   This device wraps the plain image device as that device does not allow
6   for internal states (like head position)
7   The plain device is a subdevice ("drive") of this device, so we
8   get names like "mfmhd0:drive"
3    Hard disk support
94
10   Michael Zapf, April 2010
11   
5    This device wraps the plain image device as that device does not allow
6    for internal states (like head position)
7    The plain device is a subdevice ("drive") of this device, so we
8    get names like "mfmhd0:drive"
9
10    Michael Zapf, April 2010
11
1212**************************************************************************/
1313
1414#include "emu.h"
r8044r8045
1818
1919#include "ti99_hd.h"
2020
21typedef struct _mfmhd
21typedef struct _mfmhd
2222{
2323   int current_cylinder;
2424   int current_head;
r8044r8045
4242#endif
4343
4444/*
45   Returns the linear sector number, given the CHS data.
45    Returns the linear sector number, given the CHS data.
4646*/
4747static int harddisk_chs_to_lba(hard_disk_file *hdfile, int cylinder, int head, int sector, UINT32 *lba)
4848{
4949   const hard_disk_info *info;
50   
51   if ( hdfile != NULL)
50
51   if ( hdfile != NULL)
5252   {
5353      info = hard_disk_get_info(hdfile);
5454
55      if (   (cylinder >= info->cylinders) ||
56         (head >= info->heads) ||
55      if (   (cylinder >= info->cylinders) ||
56         (head >= info->heads) ||
5757              (sector >= info->sectors))
5858                   return FALSE;
59     
59
6060      *lba = (cylinder * info->heads + head)
61              * info->sectors
61              * info->sectors
6262         + sector;
6363      return TRUE;
6464   }
r8044r8045
7575
7676        *sector_length = 256;
7777        *buf = (UINT8 *)malloc(*sector_length);
78       
78
7979   if (cylinder != hd->current_cylinder)
80   {   
80   {
8181      return;
8282   }
83   
83
8484        if (file==NULL)
8585        {
8686                hd->status &= ~MFMHD_READY;
r8044r8045
121121                hd->status |= MFMHD_WRFAULT;
122122                return;
123123        }
124       
124
125125        if (!hard_disk_write(file, lba, buf))
126126   {
127127                hd->status &= ~MFMHD_READY;
128128                hd->status |= MFMHD_WRFAULT;
129129      return;
130130   }
131   
131
132132        hd->status |= MFMHD_READY;
133133}
134134
135135#define TI99HD_BLOCKNOTFOUND -1
136136
137137/*
138   Searches a block containing number * byte, starting at the given
139   position. Returns the position of the first byte of the block.
138    Searches a block containing number * byte, starting at the given
139    position. Returns the position of the first byte of the block.
140140*/
141141static int find_block(const UINT8 *buffer, int start, int stop, UINT8 byte, size_t number)
142142{
r8044r8045
162162}
163163
164164/*
165   Reads a complete track. We have to rebuild the gaps. This is basically
166   done in the same way as in the SDF format in ti99_dsk.
167   
168   WARNING: This function is untested! We need to create a suitable
169   application program for the TI which makes use of it.
165    Reads a complete track. We have to rebuild the gaps. This is basically
166    done in the same way as in the SDF format in ti99_dsk.
167
168    WARNING: This function is untested! We need to create a suitable
169    application program for the TI which makes use of it.
170170*/
171171void ti99_mfm_harddisk_read_track(running_device *harddisk, int head, UINT8 **pbuffer, int *data_count)
172172{
r8044r8045
174174   running_device *drive = harddisk->subdevice("drive");
175175
176176   /* We assume an interleave of 3 for 32 sectors. */
177   int step = 3; 
177   int step = 3;
178178        UINT32 lba;
179179        int i;
180180
r8044r8045
197197      hd->status &= ~MFMHD_READY;
198198      return;
199199   }
200       
200
201201   info = hard_disk_get_info(file);
202202
203203        count = info->sectors;
204204        size = info->sectorbytes/128;
205   
205
206206   *data_count = gap1 + count*(sync+12+gap2+sync+size*128+gap3)+gap4;
207   
207
208208   UINT8 *trackdata = (UINT8*)malloc(*data_count);
209     
209
210210   /* Write lead-in. */
211211   memset(trackdata, 0x4e, gap1);
212212
213213   position += gap1;
214214   for (i=0; i < info->sectors; i++)
215215   {
216      sector = (i*step) % info->sectors;     
216      sector = (i*step) % info->sectors;
217217      memset(&trackdata[position], 0x00, sync);
218218      position += 10;
219     
220      /* Write sync */     
219
220      /* Write sync */
221221      trackdata[position++] = 0xa1;
222222
223223      /* Write IDAM */
224      trackdata[position++] = cylinder_to_ident(hd->current_cylinder);
224      trackdata[position++] = cylinder_to_ident(hd->current_cylinder);
225225      trackdata[position++] = hd->current_cylinder;
226226      trackdata[position++] = head;
227227      trackdata[position++] = sector;
228228      trackdata[position++] = (size==1)? 0x00 : (0x01 << (size-1));
229     
229
230230      /* Set CRC16 */
231231      crc = ccitt_crc16(0xffff, &trackdata[position-5], 5);
232232      trackdata[position++] = (crc>>8)&0xff;
233233      trackdata[position++] = crc & 0xff;
234     
234
235235      /* Write Gap2 */
236236      memset(&trackdata[position], 0x4e, gap2);
237237      position += gap2;
r8044r8045
243243
244244      /* Write DAM */
245245      trackdata[position++] = 0xfb;
246     
246
247247      /* Locate the sector content in the image and load it. */
248     
248
249249      if (!harddisk_chs_to_lba(file, hd->current_cylinder, head, sector, &lba))
250250      {
251251         hd->status &= ~MFMHD_READY;
252252         free(trackdata);
253253         return;
254254      }
255     
255
256256      if (!hard_disk_read(file, lba, &trackdata[position]))
257257      {
258258         hd->status &= ~MFMHD_READY;
259259         free(trackdata);
260260         return;
261261      }
262     
262
263263      position += size;
264     
264
265265      /* Set CRC16. Includes the address mark. */
266266      crc = ccitt_crc16(0xffff, &trackdata[position-size-1], size+1);
267267      trackdata[position++] = (crc>>8)&0xff;
268268      trackdata[position++] = crc & 0xff;
269     
270      /* Write remaining 3 bytes which would have been used for ECC. */
269
270      /* Write remaining 3 bytes which would have been used for ECC. */
271271      memset(&trackdata[position], 0x00, 3);
272272      position += 3;
273     
273
274274      /* Write Gap3 */
275275      memset(&trackdata[position], 0x4e, gap3);
276276      position += gap3;
r8044r8045
280280   position += gap4;
281281
282282   *pbuffer = trackdata;
283   
283
284284   /* Remember to free the buffer! Except when an error has occured,
285      the function returns a newly allocated buffer. */
285       the function returns a newly allocated buffer. */
286286}
287287
288288/*
289   Writes a track to the image. We need to isolate the sector contents.
290   This is basically done in the same way as in the SDF format in ti99_dsk.
289    Writes a track to the image. We need to isolate the sector contents.
290    This is basically done in the same way as in the SDF format in ti99_dsk.
291291*/
292292void ti99_mfm_harddisk_write_track(running_device *harddisk, int head, UINT8 *track_image, int data_count)
293293{
r8044r8045
296296   UINT8 wident, whead = 0, wsector = 0, wsize;
297297   UINT16 wcyl = 0;
298298   int state;
299   
299
300300   /* Only search in the first 100 bytes for the start. */
301301   int gap1 = 16;
302302   int sync = 13;
303   
303
304304   UINT32 lba;
305305   mfmhd_state *hd = (mfmhd_state *)harddisk->token;
306306   running_device *drive = harddisk->subdevice("drive");
r8044r8045
315315   }
316316
317317   current_pos = find_block(track_image, 0, 100, 0x4e, gap1);
318   
318
319319   /* In case of defect formats, we continue as far as possible. This
320   may lead to sectors not being written. */
320    may lead to sectors not being written. */
321321   if (current_pos==TI99HD_BLOCKNOTFOUND)
322322   {
323323      logerror("ti99_hd Cannot find gap1 for cylinder %d, head %d.\n", hd->current_cylinder, head);
r8044r8045
328328   /* Get behind GAP1 */
329329   current_pos += gap1;
330330   found = FALSE;
331   
331
332332   while (current_pos < data_count)
333333   {
334334      /* We must find the address block to determine the sector. */
r8044r8045
342342      }
343343      found = TRUE;
344344
345      new_pos = new_pos + sync; /* skip sync bytes */     
345      new_pos = new_pos + sync; /* skip sync bytes */
346346
347347      if (track_image[new_pos]==0xa1)
348348      {
r8044r8045
367367            new_pos = find_block(track_image, current_pos, data_count, 0x00, sync);
368368            current_pos = new_pos + sync;
369369            if (track_image[current_pos]==0xa1)
370            {               
370            {
371371               current_pos += 2;
372372               state = hard_disk_write(file, lba, track_image+current_pos);
373373               if (state==0)
r8044r8045
382382            else
383383            {
384384               logerror("ti99_hd Cannot find DAM for cylinder %d, head %d, sector %d.\n", wcyl, whead, wsector);
385               return;
385               return;
386386            }
387387         }
388388         else
r8044r8045
393393      else
394394      {
395395         printf("ti99_hd Cannot find IDAM for cylinder %d, head %d, sector %d.\n", wcyl, whead, wsector);
396         return;
396         return;
397397      }
398398   }
399399}
r8044r8045
405405   mfmhd_state *hd = (mfmhd_state *)harddisk->token;
406406   drive = harddisk->subdevice("drive");
407407        hard_disk_file *file = mess_hd_get_hard_disk_file(drive);
408       
408
409409   if (file!=NULL)
410410      status |= MFMHD_READY;
411411
412412   if (hd->current_cylinder==0)
413413      status |= MFMHD_TRACK00;
414   
414
415415   if (!hd->seeking)
416416      status |= MFMHD_SEEKCOMP;
417   
417
418418   if (hd->id_index == 0)
419419      status |= MFMHD_INDEX;
420   
420
421421   hd->status = status;
422422   return status;
423423}
r8044r8045
429429   const hard_disk_info *info;
430430        hard_disk_file *file = mess_hd_get_hard_disk_file(drive);
431431
432   if (file==NULL)   return;       
433       
432   if (file==NULL)   return;
433
434434   info = hard_disk_get_info(file);
435435
436436   hd->seeking = TRUE;
r8044r8045
445445      if (hd->current_cylinder < info->cylinders)
446446         hd->current_cylinder++;
447447   }
448   
448
449449   hd->seeking = FALSE;
450450}
451451
r8044r8045
463463                hd->status &= ~MFMHD_READY;
464464      return;
465465   }
466   
466
467467   info = hard_disk_get_info(file);
468   
468
469469   hd->current_head = head;
470   
470
471471   /* TODO: implement an interleave suitable for the number of sectors in the track. */
472472   hd->id_index = (hd->id_index + interleave) % info->sectors;
473   
473
474474   /* build a new info block. */
475475   id->C = hd->current_cylinder;
476476   id->H = hd->current_head;
src/mess/devices/ti99_hd.h
r8044r8045
1313/* typedef struct _mfmhd_config mfmhd_config;
1414struct _mfmhd_config
1515{
16   device_start_func         device_start;
17   device_image_load_func         device_load;
18   device_image_unload_func      device_unload;
16    device_start_func           device_start;
17    device_image_load_func          device_load;
18    device_image_unload_func        device_unload;
1919}; */
2020
2121/* Accessor functions */
r8044r8045
4242
4343
4444/*
45   MDRV_MFMHD_START(mfmhd)            \
46   MDRV_MFMHD_LOAD(mfmhd)            \
47   MDRV_MFMHD_UNLOAD(mfmhd)         
45    MDRV_MFMHD_START(mfmhd)             \
46    MDRV_MFMHD_LOAD(mfmhd)              \
47    MDRV_MFMHD_UNLOAD(mfmhd)
4848*/
src/mess/devices/messram.c
r8044r8045
197197               for (j=0;j<size;j++) {
198198                  if (p[j]==',') p[j]=0;
199199               }
200               
200
201201               /* try to parse each option */
202202               while(p <= e)
203203               {
src/mess/devices/aescart.c
r8044r8045
258258*/
259259static int assemble_std(running_machine *machine, running_device *image)
260260{
261//   aescartridge_t *cart;
261//  aescartridge_t *cart;
262262//  printf("assemble_std, %s\n", image->tag);
263263   /*cart = */assemble_common(machine, image);
264264
r8044r8045
274274*/
275275static int disassemble_std(running_device *image)
276276{
277//   int slotnumber;
277//  int slotnumber;
278278//  int i;
279//   aescartridge_t *cart;
280//   running_device *cartsys = image->owner;
281//   aes_multicart_t *cartslots = (aes_multicart_t *)cartsys->token;
279//  aescartridge_t *cart;
280//  running_device *cartsys = image->owner;
281//  aes_multicart_t *cartslots = (aes_multicart_t *)cartsys->token;
282282
283//   slotnumber = get_index_from_tagname(image)-1;
283//  slotnumber = get_index_from_tagname(image)-1;
284284//  printf("Disassemble cartridge %d\n", slotnumber);
285285#if 0
286286   /* Search the highest remaining cartridge. */
r8044r8045
299299   }
300300#endif
301301   /* Do we have RAM? If so, swap the bytes (undo the BIG_ENDIANIZE) */
302//   cart = &cartslots->cartridge[slotnumber];
302//  cart = &cartslots->cartridge[slotnumber];
303303
304304//  clear_slot(cartsys, slotnumber);
305305
src/mess/softlist.c
r8044r8045
154154
155155
156156/*-------------------------------------------------
157   software_name_split
158   helper; splits a software_list:software:part
157    software_name_split
158    helper; splits a software_list:software:part
159159    string into seperate software_list, software,
160160    and part strings.
161161
162162    str1:str2:str3  => swlist_name - str1, swname - str2, swpart - str3
163   str1:str2      => swlist_name - NULL, swname - str1, swpart - str2
164    str1         => swlist_name - NULL, swname - str1, swpart - NULL
163    str1:str2       => swlist_name - NULL, swname - str1, swpart - str2
164    str1            => swlist_name - NULL, swname - str1, swpart - NULL
165165
166166    swlist_namem, swnane and swpart will be global_alloc'ed
167167    from the global pool. So they should be global_free'ed
r8044r8045
737737   if (filerr != FILERR_NONE)
738738      goto error;
739739
740//   if (is_preload)
741//      software_list_parse(swlist, swlist->error_proc, NULL);
740//  if (is_preload)
741//      software_list_parse(swlist, swlist->error_proc, NULL);
742742
743743   return swlist;
744744
r8044r8045
757757{
758758   if (swlist == NULL)
759759      return;
760   
760
761761   if (swlist->file)
762762      mame_fclose(swlist->file);
763763   pool_free_lib(swlist->pool);
r8044r8045
973973            software_info_ptr = software_list_find( software_list_ptr, swname );
974974
975975            if ( software_info_ptr )
976            {   
976            {
977977               software_part_ptr = software_find_part( software_info_ptr, swpart, interface );
978978            }
979979         }
r8044r8045
10771077   {
10781078      if (swlist->list_name[i])
10791079      {
1080         if (mame_options() == NULL)
1080         if (mame_options() == NULL)
10811081            return FALSE;
1082         
1082
10831083         software_list *list = software_list_open(mame_options(), swlist->list_name[i], FALSE, NULL);
10841084
10851085         /* if no .xml list is found, then return (this happens e.g. if you moved/renamed the xml list) */
1086         if (list == NULL)
1086         if (list == NULL)
10871087            return FALSE;
10881088
10891089         for (software_info *swinfo = software_list_first(list); swinfo != NULL; swinfo = software_list_next(list))
r8044r8045
10991099               mame_printf_error("%s: %s has no description\n", swlist->list_name[i], swinfo->shortname);
11001100               return TRUE;
11011101            }
1102           
1102
11031103            /* Did we lost any year? */
11041104            if (swinfo->year == NULL)
11051105            {
11061106               mame_printf_error("%s: %s has no year\n", swlist->list_name[i], swinfo->shortname);
11071107               return TRUE;
11081108            }
1109           
1109
11101110            /* Did we lost any publisher? */
11111111            if (swinfo->publisher == NULL)
11121112            {
11131113               mame_printf_error("%s: %s has no publisher\n", swlist->list_name[i], swinfo->shortname);
11141114               return TRUE;
11151115            }
1116           
1116
11171117            /* Second, since the xml is fine, run additional checks: */
11181118
11191119            /* check for duplicate names */
r8044r8045
11231123               mame_printf_error("%s: %s is a duplicate name (%s)\n", swlist->list_name[i], swinfo->shortname, match->shortname);
11241124               error = TRUE;
11251125            }
1126           
1126
11271127            /* check for duplicate descriptions */
11281128            if (descriptions.add(swinfo->longname, swinfo, FALSE) == TMERR_DUPLICATE)
11291129            {
r8044r8045
11311131               mame_printf_error("%s: %s is a duplicate description (%s)\n", swlist->list_name[i], swinfo->longname, match->longname);
11321132               error = TRUE;
11331133            }
1134           
1134
11351135            if (swinfo->parentname != NULL)
11361136               is_clone = 1;
1137           
1137
11381138            /* make sure the driver name is 8 chars or less */
11391139            if ((is_clone && strlen(swinfo->shortname) > NAME_LEN_CLONE) || ((!is_clone) && strlen(swinfo->shortname) > NAME_LEN_PARENT))
11401140            {
r8044r8045
11421142                             is_clone ? "clone" : "parent", is_clone ? NAME_LEN_CLONE : NAME_LEN_PARENT);
11431143               error = TRUE;
11441144            }
1145           
1145
11461146            /* make sure the year is only digits, '?' or '+' */
11471147            for (s = swinfo->year; *s; s++)
11481148               if (!isdigit((UINT8)*s) && *s != '?' && *s != '+')
r8044r8045
11591159      }
11601160   }
11611161   return error;
1162}   
1162}
11631163
11641164DEVICE_GET_INFO( software_list )
11651165{
src/mess/tools/messdocs/messdocs.c
r8044r8045
22#include <windows.h>
33#include <ctype.h>
44#include <tchar.h>
5#include <shlwapi.h>
5#include <shlwapi.h>
66#include <stdio.h>
77#include <ctype.h>
88
r8044r8045
139139   if (tempstr)
140140      osd_free(tempstr);
141141   return filerr;
142}
142}
143143
144144
145145//============================================================
r8044r8045
153153      return win_error_to_mame_file_error(GetLastError());
154154
155155   return FILERR_NONE;
156}
156}
157157
158158/***************************************************************************
159159    CORE IMPLEMENTATION
src/mess/tools/imgtool/windows/secview.c
r8044r8045
257257      err = read_sector_data(dialog, new_track, new_head, new_sector);
258258      // TODO: this causes a stack overflow
259259      //if (err)
260      //   set_sector_text(dialog);
260      //  set_sector_text(dialog);
261261   }
262262}
263263
src/mess/tools/imgtool/modules/fat.c
r8044r8045
15191519
15201520               /* move existing entries forward */
15211521               memmove(new_created_entry + 32, created_entry, created_entry_len);
1522               
1523               if (created_entry) free(created_entry);               
1522
1523               if (created_entry) free(created_entry);
15241524               created_entry = new_created_entry;
15251525               created_entry_len += 32;
15261526
src/mess/audio/t6721.c
r8044r8045
115115{
116116   t6721_state *t6721 = (t6721_state *)ptr;
117117
118   if (!t6721->playing)
118   if (!t6721->playing)
119119      return;
120120
121   if (t6721->sample_timeindex < 8000 / 50)
121   if (t6721->sample_timeindex < 8000 / 50)
122122   {
123123      t6721->sample_timeindex++;
124   }
125   else
124   }
125   else
126126   {
127127      t6721->end_of_sample = (memcmp(t6721->sample_data, "\xff\xff\xff\xff\xff\xff", 6) == 0);
128128
r8044r8045
137137
138138   DBG_LOG(2, "364", ("port write %.2x %.2x\n", offset, data));
139139
140   switch (offset)
140   switch (offset)
141141   {
142142   case 0:
143      if (data & 0x80)
143      if (data & 0x80)
144144      {
145         switch (t6721->command_state)
145         switch (t6721->command_state)
146146         {
147147         case 0:
148            switch (t6721->command_data)
148            switch (t6721->command_data)
149149            {
150150            case 9: case 0xb:
151151               t6721->playing = 0;
r8044r8045
178178            t6721->command_state = 0;
179179            break;
180180         }
181      }
182      else
181      }
182      else
183183      {
184184         t6721->command_data = data;
185185      }
r8044r8045
212212   t6721_state *t6721 = get_safe_token(device);
213213
214214   int data = 0xff;
215   switch (offset)
215   switch (offset)
216216   {
217217   case 1:
218218      data = t6721->state;
219219      data = 1;
220      if (!t6721->end_of_sample)
220      if (!t6721->end_of_sample)
221221      {
222222            data |= 0x41;
223            if (!t6721->busy)
223            if (!t6721->busy)
224224               data |= 0x81;
225225      }
226226      break;
src/mess/audio/ted7360.c
r8044r8045
512512   assert(device != NULL);
513513   assert(device->type == SOUND);
514514   assert(sound_get_type(device) == TED7360);
515   
515
516516   return (const ted7360_interface *) device->baseconfig().static_config;
517517}
518518
r8044r8045
12861286
12871287      if (TONE1_ON)
12881288      {
1289         if (ted7360->tone1pos <= ted7360->tone1samples / 2 || !TONE_ON)
1289         if (ted7360->tone1pos <= ted7360->tone1samples / 2 || !TONE_ON)
12901290            v += 0x2ff; // depends on the volume between sound and noise
12911291
12921292         ted7360->tone1pos++;
12931293
1294         if (ted7360->tone1pos > ted7360->tone1samples)
1294         if (ted7360->tone1pos > ted7360->tone1samples)
12951295            ted7360->tone1pos = 0;
12961296      }
12971297
r8044r8045
12991299      {
13001300         if (TONE2_ON)
13011301         {                     /*higher priority ?! */
1302            if (ted7360->tone2pos <= ted7360->tone2samples / 2 || !TONE_ON)
1302            if (ted7360->tone2pos <= ted7360->tone2samples / 2 || !TONE_ON)
13031303               v += 0x2ff;
13041304
13051305            ted7360->tone2pos++;
13061306
1307            if (ted7360->tone2pos > ted7360->tone2samples)
1307            if (ted7360->tone2pos > ted7360->tone2samples)
13081308               ted7360->tone2pos = 0;
13091309         }
13101310         else
src/mess/audio/upd1771.c
r8044r8045
1111    Ive seen mentions of a 006, 011 and 015 on part miner sites.
1212    Since the chip generates tones using embeded wavetables,
1313    it is probable other sounds are possible and were made for other embeded systems.
14    Its anyone's guess at this point in which products.
15   
14    Its anyone's guess at this point in which products.
15
1616    upd17XXX devices are typically 4bit NEC MCUs, so it wouldnt be a stretch to
17    say that this chip is part of that lot.
17    say that this chip is part of that lot.
1818    Maybe mask roms 006,011 and 015 dont generate audio at all.
1919
2020     Used pinout in the SCV:
r8044r8045
6666
6767#define LOG 0
6868
69#define MAX_PACKET_SIZE 0x8000
69#define MAX_PACKET_SIZE 0x8000
7070
7171
7272size_t g_count = 0;
r8044r8045
232232      }break;
233233
234234      case 0x1F:
235      {   
235      {
236236         //6Khz(ish) DIGI playback
237         
237
238238         //end capture
239239         if (state->packet[state->index-2] == 0xFE &&
240240            state->packet[state->index-1] == 0x00){
r8044r8045
248248      }break;
249249
250250        //garbage: wipe stack
251        default:   
251        default:
252252         state->index = 0;
253253        break;
254254    }
r8044r8045
261261
262262   //RESET upon HIGH
263263   if (state != upd1771->pc3){
264        logerror( "upd1771_pc3 change!: state = %d\n", state );
264      logerror( "upd1771_pc3 change!: state = %d\n", state );
265265      upd1771->index = 0;
266266      upd1771->packet[0]=0;
267267   }
src/mess/image.c
r8044r8045
414414               if (that_device->get_config_int(DEVINFO_INT_IMAGE_TYPE) == type)
415415                  count++;
416416            }
417           }
417        }
418418
419419         /* need to number if there is more than one device */
420420         if (count > 1)
src/mess/infomess.c
r8044r8045
115115            fprintf(out, "\t\t<ramoption>%u</ramoption>\n",  messram_parse_string(p));
116116            p += strlen(p);
117117            if (p == e)
118               break;               
118               break;
119119            p += 1;
120120         }
121121
src/mess/video/mbee.c
r8044r8045
44    video hardware
55    Juergen Buchmueller <pullmoll@t-online.de>, Dec 1999
66
7   Tests of keyboard. Start mbeeic.
7    Tests of keyboard. Start mbeeic.
88
9   1. Load ASTEROIDS PLUS, stay in attract mode, hold down spacebar,
10      it should only fire bullets. If it sometimes starts turning,
11      thrusting or using the shield, then there is a problem.
9    1. Load ASTEROIDS PLUS, stay in attract mode, hold down spacebar,
10        it should only fire bullets. If it sometimes starts turning,
11        thrusting or using the shield, then there is a problem.
1212
13   2. Load SCAVENGER and make sure it doesn't go to the next level
14      until you find the Exit.
13    2. Load SCAVENGER and make sure it doesn't go to the next level
14        until you find the Exit.
1515
16   3. At the Basic prompt, type in EDASM press enter. At the memory size
17      prompt press enter. Now, make sure the keyboard   works properly.
16    3. At the Basic prompt, type in EDASM press enter. At the memory size
17        prompt press enter. Now, make sure the keyboard works properly.
1818
1919
20   The keyboard can be accessed either by using the transparent-mode
21   registers, or by monitoring the lightpen registers, or by monitoring
22   the lightpen strobe bit in the status register.
20    The keyboard can be accessed either by using the transparent-mode
21    registers, or by monitoring the lightpen registers, or by monitoring
22    the lightpen strobe bit in the status register.
2323
24   Edasm is an example of the latter; it is therefore necessary to do a
25   keyboard scan whenever the status is read.
24    Edasm is an example of the latter; it is therefore necessary to do a
25    keyboard scan whenever the status is read.
2626
2727****************************************************************************/
2828
src/mess/video/crt9007.c
r8044r8045
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - interrupts
15   - status register
16   - reset
17   - DMA mode (currently forcing to non-DMA mode)
18   - cursor/blank skew
19   - sequential breaks
20   - interlaced mode
21   - smooth scroll
22   - page blank
23   - double height cursor
24   - row attributes
25   - pin configuration
26   - operation modes 0,4,7
27   - address modes 1,2,3
28   - light pen
29   - state saving
14    - interrupts
15    - status register
16    - reset
17    - DMA mode (currently forcing to non-DMA mode)
18    - cursor/blank skew
19    - sequential breaks
20    - interlaced mode
21    - smooth scroll
22    - page blank
23    - double height cursor
24    - row attributes
25    - pin configuration
26    - operation modes 0,4,7
27    - address modes 1,2,3
28    - light pen
29    - state saving
3030
3131*/
3232
r8044r8045
183183#define STATUS_VERTICAL_RETRACE      0x40
184184#define STATUS_LIGHT_PEN_UPDATE      0x20
185185#define STATUS_ODD_EVEN            0x04
186#define STATUS_FRAME_TIMER_OCCURRED   0x01   
186#define STATUS_FRAME_TIMER_OCCURRED   0x01
187187
188188/***************************************************************************
189189    TYPE DEFINITIONS
r8044r8045
308308static void recompute_parameters(running_device *device)
309309{
310310   crt9007_t *crt9007 = get_safe_token(device);
311   
311
312312   /* check that necessary registers have been loaded */
313313   if (!HAS_VALID_PARAMETERS) return;
314314
r8044r8045
410410      recompute_parameters(device);
411411      if (LOG) logerror("CRT9007 '%s' Characters per Horizontal Period: %u\n", device->tag(), CHARACTERS_PER_HORIZONTAL_PERIOD);
412412      break;
413   
413
414414   case 0x01:
415415      recompute_parameters(device);
416416      if (LOG) logerror("CRT9007 '%s' Characters per Data Row: %u\n", device->tag(), CHARACTERS_PER_DATA_ROW);
r8044r8045
438438
439439   case 0x06:
440440      recompute_parameters(device);
441      if (LOG)
441      if (LOG)
442442      {
443443         logerror("CRT9007 '%s' Pin Configuration: %u\n", device->tag(), PIN_CONFIGURATION);
444444         logerror("CRT9007 '%s' Cursor Skew: %u\n", device->tag(), CURSOR_SKEW);
r8044r8045
622622         int sy = (y - min_y) / SCAN_LINES_PER_DATA_ROW;
623623         int cursor_x = (sy == VERTICAL_CURSOR) ? HORIZONTAL_CURSOR : -1;
624624         UINT16 addr = TABLE_START + (sy * CHARACTERS_PER_DATA_ROW);
625//         UINT8 data = devcb_call_read8(&crt9007->in_vd_func, addr);
626         
625//          UINT8 data = devcb_call_read8(&crt9007->in_vd_func, addr);
626
627627         crt9007->draw_scanline_func(device, bitmap, cliprect, addr, sl, 0, y, crt9007->hfp, CHARACTERS_PER_DATA_ROW, cursor_x);
628628
629629         addr++;
r8044r8045
666666   crt9007->hsync_timer = timer_alloc(device->machine, hsync_tick, (void *)device);
667667
668668   /* register for state saving */
669//   state_save_register_device_item(device, 0, crt9007->);
669//  state_save_register_device_item(device, 0, crt9007->);
670670}
671671
672672/*-------------------------------------------------
r8044r8045
675675
676676static DEVICE_RESET( crt9007 )
677677{
678//   crt9007_t *crt9007 = (crt9007_t *)device->token;
678//  crt9007_t *crt9007 = (crt9007_t *)device->token;
679679}
680680
681681/*-------------------------------------------------
src/mess/video/cgc7900.c
r8044r8045
5959{
6060   /*
6161
62      bit      signal      description
63     
64       0      _VERT      vertical retrace (0=vblank)
65       1               interlace (1=first field, 0=second field)
66       2      _HG         horizontal retrace (0=hblank)
67       3      1
68       4      1
69       5      1
70       6      1
71       7      1
72       8      1
73       9      1
74      10      1
75      11      1
76      12      1
77      13      1
78      14      1
79      15      1
62        bit     signal      description
8063
81   */
64         0      _VERT       vertical retrace (0=vblank)
65         1                  interlace (1=first field, 0=second field)
66         2      _HG         horizontal retrace (0=hblank)
67         3      1
68         4      1
69         5      1
70         6      1
71         7      1
72         8      1
73         9      1
74        10      1
75        11      1
76        12      1
77        13      1
78        14      1
79        15      1
8280
81    */
82
8383   return 0xffff;
8484}
8585
r8044r8045
102102      UINT8 b = data & 0xff;
103103      UINT8 g = (data >> 8) & 0xff;
104104      UINT8 r = (data >> 16) & 0xff;
105     
105
106106      palette_set_color_rgb(machine, i + 8, r, g, b);
107107   }
108108}
r8044r8045
241241***************************************************************************/
242242
243243/*-------------------------------------------------
244   MACHINE_DRIVER( cgc7900_video )
244    MACHINE_DRIVER( cgc7900_video )
245245-------------------------------------------------*/
246246
247247MACHINE_DRIVER_START( cgc7900_video )
r8044r8045
251251    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
252252    MDRV_SCREEN_SIZE(1024, 768)
253253    MDRV_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1)
254   
254
255255   MDRV_GFXDECODE(cgc7900)
256256
257257   MDRV_PALETTE_LENGTH(8+256) /* 8 overlay colors + 256 bitmap colors */
src/mess/video/crt9007.h
r8044r8045
6868
6969   devcb_write_line      out_hs_func;
7070   devcb_write_line      out_vs_func;
71/*   
72   devcb_write_line      out_cblank_func;
73   devcb_write_line      out_vblank_func;
71/*
72    devcb_write_line        out_cblank_func;
73    devcb_write_line        out_vblank_func;
7474
75   devcb_write_line      out_vlt_func;
76   devcb_write_line      out_curs_func;
77   devcb_write_line      out_drb_func;
75    devcb_write_line        out_vlt_func;
76    devcb_write_line        out_curs_func;
77    devcb_write_line        out_drb_func;
7878
79   devcb_write_line      out_slg_func;
80   devcb_write_line      out_sld_func;
79    devcb_write_line        out_slg_func;
80    devcb_write_line        out_sld_func;
8181*/
8282   devcb_read8            in_vd_func;
8383   devcb_write8         out_vd_func;
src/mess/video/fmtowns.c
r8044r8045
356356{
357357   if(towns_mainmem_enable != 0)
358358      return messram_get_ptr(devtag_get_device(space->machine, "messram"))[offset+0xcff80];
359   
359
360360   return towns_video_cff80_r(space,offset);
361361}
362362
r8044r8045
381381{
382382   UINT8 ret = 0;
383383   UINT16 xpos,ypos;
384   
384
385385   switch(offset)
386386   {
387387      case 0x00:
388388         return towns_crtc_sel;
389389      case 0x02:
390//         logerror("CRTC: reading register %i (0x442) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]);
390//          logerror("CRTC: reading register %i (0x442) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]);
391391         if(towns_crtc_sel == 30)
392392               return 0x00;
393393         return towns_crtc_reg[towns_crtc_sel] & 0x00ff;
394394      case 0x03:
395//         logerror("CRTC: reading register %i (0x443) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]);
395//          logerror("CRTC: reading register %i (0x443) [%04x]\n",towns_crtc_sel,towns_crtc_reg[towns_crtc_sel]);
396396         if(towns_crtc_sel == 30)
397397         {
398398            // check video position
399399            xpos = video_screen_get_hpos(space->machine->primary_screen);
400400            ypos = video_screen_get_vpos(space->machine->primary_screen);
401           
401
402402            if(xpos < (towns_crtc_reg[0] & 0xfe))
403403               ret |= 0x02;
404404            if(ypos < (towns_crtc_reg[6] & 0x1f))
r8044r8045
411411               ret |= 0x40;
412412            if(ypos < towns_crtc_layerscr[1].max_y && ypos > towns_crtc_layerscr[1].min_y)
413413               ret |= 0x80;
414               
414
415415            return ret;
416416         }
417417         return (towns_crtc_reg[towns_crtc_sel] & 0xff00) >> 8;
r8044r8045
426426            towns_dpmd_flag = 0;
427427            ret |= 0x80;
428428         }
429         ret |= (towns_vblank_flag ? 0x02 : 0x00);  // TODO: figure out just what this bit is...         
429         ret |= (towns_vblank_flag ? 0x02 : 0x00);  // TODO: figure out just what this bit is...
430430         return ret;
431431      case 0x10:
432432         return towns_sprite_sel;
r8044r8045
447447         towns_crtc_sel = data;
448448         break;
449449      case 0x02:
450//         logerror("CRTC: writing register %i (0x442) [%02x]\n",towns_crtc_sel,data);
450//          logerror("CRTC: writing register %i (0x442) [%02x]\n",towns_crtc_sel,data);
451451         towns_crtc_reg[towns_crtc_sel] =
452452            (towns_crtc_reg[towns_crtc_sel] & 0xff00) | data;
453453         towns_crtc_refresh_mode(space->machine);
454454         break;
455455      case 0x03:
456//         logerror("CRTC: writing register %i (0x443) [%02x]\n",towns_crtc_sel,data);
456//          logerror("CRTC: writing register %i (0x443) [%02x]\n",towns_crtc_sel,data);
457457         towns_crtc_reg[towns_crtc_sel] =
458458            (towns_crtc_reg[towns_crtc_sel] & 0x00ff) | (data << 8);
459459         towns_crtc_refresh_mode(space->machine);
r8044r8045
539539      case 0x10:  // "sub status register"
540540         // check video position
541541         xpos = video_screen_get_hpos(space->machine->primary_screen);
542         
542
543543         if(xpos < towns_crtc_layerscr[0].max_x && xpos > towns_crtc_layerscr[0].min_x)
544544            ret |= 0x02;
545545         if(towns_vblank_flag)
r8044r8045
578578         towns_dpmd_flag = 1;
579579         break;
580580      case 0x10:
581         towns_layer_ctrl = data;   
581         towns_layer_ctrl = data;
582582         break;
583583   }
584584   //logerror("VID: wrote 0x%02x to port %04x\n",data,offset+0xfd90);
r8044r8045
14391439   }
14401440
14411441/*#ifdef SPR_DEBUG
1442   if(input_code_pressed(screen->machine,KEYCODE_O))
1443      pshift+=0x80;
1444   if(input_code_pressed(screen->machine,KEYCODE_I))
1445      pshift-=0x80;
1446   popmessage("Pixel shift = %08x",pshift);
1442    if(input_code_pressed(screen->machine,KEYCODE_O))
1443        pshift+=0x80;
1444    if(input_code_pressed(screen->machine,KEYCODE_I))
1445        pshift-=0x80;
1446    popmessage("Pixel shift = %08x",pshift);
14471447#endif*/
14481448
14491449#ifdef CRTC_REG_DISP
src/mess/video/pegasus.c
r8044r8045
11/***************************************************************************
22
3   The Aamber Pegasus uses a MCM66710P, which is functionally
4   equivalent to the MCM6571. Some code here is copied from poly88.
3    The Aamber Pegasus uses a MCM66710P, which is functionally
4    equivalent to the MCM6571. Some code here is copied from poly88.
55
6   Note that datasheet is incorrect for the number "9", line 57 below.
7   The first byte is really 0x3E rather than 0x3F, confirmed on real
8   hardware.
6    Note that datasheet is incorrect for the number "9", line 57 below.
7    The first byte is really 0x3E rather than 0x3F, confirmed on real
8    hardware.
99
1010
1111****************************************************************************/
src/mess/video/odyssey2.c
r8044r8045
310310   if ( vpos < start_vblank )
311311   {
312312      rectangle rect;
313      //int   sprite_width[4] = { 8, 8, 8, 8 };
313      //int   sprite_width[4] = { 8, 8, 8, 8 };
314314      int i;
315315
316316      control_status &= ~ 0x01;
src/mess/includes/nes.h
r8044r8045
111111   UINT8      battery_data[NES_BATTERY_SIZE];
112112
113113   /***** Mapper-related variables *****/
114   
114
115115   // common ones
116116   int        IRQ_enable, IRQ_enable_latch;
117117   UINT16     IRQ_count, IRQ_count_latch;
r8044r8045
120120   UINT8      IRQ_status;
121121   UINT8      IRQ_mode;
122122   int        mult1, mult2;
123   
123
124124   UINT8 mmc_chr_source;         // This is set at init to CHRROM or CHRRAM. a few mappers can swap between
125125                           // the two (this is done in the specific handlers).
126   
126
127127   UINT8 mmc_cmd1, mmc_cmd2;      // These represent registers where the mapper writes important values
128128   UINT8 mmc_count;            // This is used as counter in mappers like 1 and 45
129   
129
130130   int mmc_prg_base, mmc_prg_mask;   // MMC3 based multigame carts select a block of banks by using these (and then act like normal MMC3),
131131   int mmc_chr_base, mmc_chr_mask;   // while MMC3 and clones (mapper 118 & 119) simply set them as 0 and 0xff resp.
132   
132
133133   UINT8 prg_bank[4];            // Many mappers writes only some bits of the selected bank (for both PRG and CHR),
134134   UINT8 vrom_bank[16];         // hence these are handy to latch bank values.
135135
136136   UINT8 extra_bank[16];         // some MMC3 clone have 2 series of PRG/CHR banks...
137137                           // we collect them all here: first 4 elements PRG banks, then 6/8 CHR banks
138   
138
139139   /***** NES-cart related *****/
140140
141141   /* load-time cart variables which remain constant */
r8044r8045
143143   UINT8 battery;
144144   UINT16 prg_chunks;   // a recently dumped multigame cart has 256 chunks of both PRG & CHR!
145145   UINT16 chr_chunks;
146   
146
147147   UINT8 format;   // 1 = iNES, 2 = UNIF
148   
148
149149   /* system variables which don't change at run-time */
150150   UINT16 mapper;      // for iNES
151151   const char *board;   // for UNIF
r8044r8045
153153   UINT8 hard_mirroring;
154154   UINT8 slow_banking;
155155   UINT8 crc_hack;   // this is needed to detect different boards sharing the same Mappers (shame on .nes format)
156   
157   
156
157
158158   /***** FDS-floppy related *****/
159159
160160   UINT8   *fds_data;
161161   UINT8   fds_sides;
162162   UINT8   *fds_ram;
163   
163
164164   /* Variables which can change */
165165   UINT8   fds_motor_on;
166166   UINT8   fds_door_closed;
src/mess/includes/rmnimbus.h
r8044r8045
6767#define EXTERNAL_INT_MOUSE_YU   0x88
6868#define EXTERNAL_INT_MOUSE_YD   0x89
6969#define EXTERNAL_INT_MOUSE_XL   0x8A
70#define EXTERNAL_INT_MOUSE_XR   0x8B   
70#define EXTERNAL_INT_MOUSE_XR   0x8B
7171#define EXTERNAL_INT_PC8031_8C  0x8c
7272#define EXTERNAL_INT_PC8031_8E  0x8E
7373#define EXTERNAL_INT_PC8031_8F  0x8F
src/mess/messdriv.c
r8044r8045
16931693   DRIVER( z80dev )
16941694   DRIVER( pegasus )
16951695   DRIVER( pegasusm )
1696   
1696
16971697#endif /* DRIVER_RECURSIVE */
src/mess/osd/winui/messui.c
r8044r8045
849849      SoftwarePicker_AddFile(GetDlgItem(GetMainWindow(), IDC_SWLIST), utf8_filename);
850850      osd_free(utf8_filename);
851851   }
852   
852
853853   machine_config_free(config);
854854}
855855
r8044r8045
926926
927927            /* If software folder exists, use it instead */
928928            zippath_combine(&as, dst, "software");
929            if (osd_opendir(astring_c(&as)))
929            if (osd_opendir(astring_c(&as)))
930930            {
931931               osd_free(t_s);
932932               t_s = tstring_from_utf8(astring_c(&as));
r8044r8045
939939   SetupImageTypes(config, imagetypes, ARRAY_LENGTH(imagetypes), TRUE, dev);
940940   bResult = CommonFileImageDialog(t_s, GetOpenFileName, pszFilename, config, imagetypes);
941941   CleanupImageTypes(imagetypes, ARRAY_LENGTH(imagetypes));
942   
942
943943   osd_free(t_s);
944944
945945   return bResult;
r8044r8045
997997
998998         /* If software folder exists, use it instead */
999999         zippath_combine(&as, dst, "software");
1000         if (osd_opendir(astring_c(&as)))
1000         if (osd_opendir(astring_c(&as)))
10011001         {
10021002            osd_free(t_s);
10031003            t_s = tstring_from_utf8(astring_c(&as));
r8044r8045
10091009   SetupImageTypes(config, imagetypes, ARRAY_LENGTH(imagetypes), TRUE, dev);
10101010   bResult = CommonFileImageDialog(t_s, GetSaveFileName, pszFilename, config, imagetypes);
10111011   CleanupImageTypes(imagetypes, ARRAY_LENGTH(imagetypes));
1012   
1012
10131013   osd_free(t_s);
10141014
10151015   return bResult;
src/mess/osd/winui/propertiesms.c
r8044r8045
434434
435435         (void)ComboBox_InsertString(control, i, win_tstring_strdup(t_ramstring));
436436         (void)ComboBox_SetItemData(control, i, ram);
437         
437
438438         osd_free(t_ramstring);
439439      }
440440      if (config->extra_options != NULL)
r8044r8045
447447         for (j=0;j<size;j++) {
448448            if (p[j]==',') p[j]=0;
449449         }
450         
450
451451         /* try to parse each option */
452452         while(p <= e)
453453         {
r8044r8045
474474            p+= strlen(p);
475475            if (p == e)
476476               break;
477           
477
478478            p += 1;
479479         }
480480
src/mess/machine/conkort.c
r8044r8045
7272    Slow Controller
7373    ---------------
7474
75   - Z80 IN instruction needs to halt in mid air for this controller to ever work (the first data byte of disk sector is read too early)
75    - Z80 IN instruction needs to halt in mid air for this controller to ever work (the first data byte of disk sector is read too early)
7676
77      wd17xx_command_w $88 READ_SEC
78      wd17xx_data_r: (no new data) $00 (data_count 0)
79      WAIT
80      wd179x: Read Sector callback.
81      sector found! C:$00 H:$00 R:$0b N:$01
82      wd17xx_data_r: $FF (data_count 256)
83      WAIT
77        wd17xx_command_w $88 READ_SEC
78        wd17xx_data_r: (no new data) $00 (data_count 0)
79        WAIT
80        wd179x: Read Sector callback.
81        sector found! C:$00 H:$00 R:$0b N:$01
82        wd17xx_data_r: $FF (data_count 256)
83        WAIT
8484
8585    - copy protection device (sends sector header bytes to CPU? DDEN is serial clock? code checks for either $b6 or $f7)
8686
87      06F8: ld   a,$2F               ; SEEK
88      06FA: out  ($BC),a
89      06FC: push af
90      06FD: push bc
91      06FE: ld   bc,$0724
92      0701: push bc
93      0702: ld   b,$07
94      0704: rr   a
95      0706: call $073F
96      073F: DB 7E         in   a,($7E)   ; PIO PORT B
97      0741: EE 08         xor  $08      ; DDEN
98      0743: D3 7E         out  ($7E),a
99      0745: EE 08         xor  $08
100      0747: D3 7E         out  ($7E),a
101      0749: DB 7E         in   a,($7E)
102      074B: 1F            rra
103      074C: 1F            rra
104      074D: 1F            rra
105      074E: CB 11         rl   c
106      0750: 79            ld   a,c
107      0751: C9            ret
108      0709: djnz $0703         <-- jumps to middle of instruction!
109      0703: rlca
110      0704: rr   a
111      0706: call $073F
112   
87        06F8: ld   a,$2F                    ; SEEK
88        06FA: out  ($BC),a
89        06FC: push af
90        06FD: push bc
91        06FE: ld   bc,$0724
92        0701: push bc
93        0702: ld   b,$07
94        0704: rr   a
95        0706: call $073F
96        073F: DB 7E         in   a,($7E)    ; PIO PORT B
97        0741: EE 08         xor  $08        ; DDEN
98        0743: D3 7E         out  ($7E),a
99        0745: EE 08         xor  $08
100        0747: D3 7E         out  ($7E),a
101        0749: DB 7E         in   a,($7E)
102        074B: 1F            rra
103        074C: 1F            rra
104        074D: 1F            rra
105        074E: CB 11         rl   c
106        0750: 79            ld   a,c
107        0751: C9            ret
108        0709: djnz $0703            <-- jumps to middle of instruction!
109        0703: rlca
110        0704: rr   a
111        0706: call $073F
112
113113    - FD1791 HLD/HLT callbacks
114114    - DS/DD SS/DS jumpers
115115    - S1-S5 jumpers
116116
117117    Fast Controller
118118    ---------------
119   - CPU is in HALT waiting for the FDC interrupt after commands
119    - CPU is in HALT waiting for the FDC interrupt after commands
120120
121121*/
122122
r8044r8045
294294{
295295   /*
296296
297        bit     signal         description
297        bit     signal          description
298298
299299        0       SEL 0
300300        1       SEL 1
r8044r8045
321321   floppy_drive_set_ready_state(conkort->image1, 1, 1);
322322
323323   /* disk side selection */
324//   wd17xx_set_side(device, BIT(data, 4));
324//  wd17xx_set_side(device, BIT(data, 4));
325325
326326   /* wait enable */
327327   conkort->wait_enable = BIT(data, 6);
r8044r8045
606606
607607        bit     description
608608
609        0       !(_DS0 & _DS1)   single/double sided (0=SS, 1=DS)
610        1       !(_DD0 & _DD1)   single/double density (0=DS, 1=DD)
609        0       !(_DS0 & _DS1)  single/double sided (0=SS, 1=DS)
610        1       !(_DD0 & _DD1)  single/double density (0=DS, 1=DD)
611611        2       8B pin 10
612        3       FDC _DDEN      double density enable
613        4       _R/BS         radial/binary drive select
614        5       FDC HLT         head load timing
615        6       FDC _HDLD      head load
616        7       FDC IRQ         interrupt request
612        3       FDC _DDEN       double density enable
613        4       _R/BS           radial/binary drive select
614        5       FDC HLT         head load timing
615        6       FDC _HDLD       head load
616        7       FDC IRQ         interrupt request
617617
618618    */
619619
r8044r8045
622622   UINT8 data = 4;
623623
624624   /* single/double sided drive */
625//   data |= 0x01;
625//  data |= 0x01;
626626
627627   /* single/double density drive */
628628   data |= 0x02;
r8044r8045
631631   data |= 0x10;
632632
633633   /* head load */
634//   data |= wd17xx_hdld_r(device) << 6;
634//  data |= wd17xx_hdld_r(device) << 6;
635635   data |= 0x40;
636636
637637   /* FDC interrupt request */
r8044r8045
644644{
645645   /*
646646
647        bit     signal         description
647        bit     signal          description
648648
649        0       !(_DS0 & _DS1)   single/double sided (0=SS, 1=DS)
650        1       !(_DD0 & _DD1)   single/double density (0=DS, 1=DD)
649        0       !(_DS0 & _DS1)  single/double sided (0=SS, 1=DS)
650        1       !(_DD0 & _DD1)  single/double density (0=DS, 1=DD)
651651        2       8B pin 10
652        3       FDC _DDEN      double density enable
653        4       _R/BS         radial/binary drive select
654        5       FDC HLT         head load timing
655        6       FDC _HDLD      head load
656        7       FDC IRQ         interrupt request
652        3       FDC _DDEN       double density enable
653        4       _R/BS           radial/binary drive select
654        5       FDC HLT         head load timing
655        6       FDC _HDLD       head load
656        7       FDC IRQ         interrupt request
657657
658658    */
659659
r8044r8045
663663   wd17xx_dden_w(conkort->fd1791, BIT(data, 3));
664664
665665   /* head load timing */
666//   wd17xx_hlt_w(conkort->fd1791, BIT(data, 5));
666//  wd17xx_hlt_w(conkort->fd1791, BIT(data, 5));
667667}
668668
669669static Z80PIO_INTERFACE( conkort_pio_intf )
r8044r8045
689689
690690    DMA Transfer Programs
691691
692   READ DAM
693   --------
692    READ DAM
693    --------
694694    7D 45 21 05 00 C3 14 28 95 6B 02 8A CF 01 AF CF 87
695695
696   7D  transfer mode, port A -> port B, port A starting address follows, block length follows
697   45  port A starting address low byte = 45
698   21  port A starting address high byte = 21
699   05  block length low byte = 05
700   00  block length high byte = 00
696    7D  transfer mode, port A -> port B, port A starting address follows, block length follows
697    45  port A starting address low byte = 45
698    21  port A starting address high byte = 21
699    05  block length low byte = 05
700    00  block length high byte = 00
701701    C3  reset
702702    14  port A is memory, port A address increments
703703    28  port B is I/O, port B address fixed
r8044r8045
711711    CF  load
712712    87  enable DMA
713713
714   ??
715   --
714    ??
715    --
716716    C3 14 28 95 7B 02 8A CF 05 AF CF 87
717717
718718    C3  reset
r8044r8045
728728    CF  load
729729    87  enable DMA
730730
731   ??
732   --
731    ??
732    --
733733    C3 91 40 8A AB
734734
735735    C3  reset
r8044r8045
933933   slow_t *conkort = get_safe_token_slow(device);
934934
935935   conkort->cpu->reset();
936   
936
937937   conkort->cs = 0;
938938}
939939
src/mess/machine/gb.c
r8044r8045
16751675   }
16761676   else
16771677      memcpy(gb_driver_data.gb_cart, image_get_software_region(image, "rom") + load_start, filesize);
1678   
1678
16791679   gb_header = gb_driver_data.gb_cart;
16801680   gb_driver_data.ROMBank00 = 0;
16811681
r8044r8045
18301830   {
18311831      logerror("Warning loading cartridge: Checksum is wrong.");
18321832   }
1833   
1833
18341834   /* Initialize ROMMap pointers */
18351835   for (I = 0; I < gb_driver_data.ROMBanks; I++)
18361836   {
18371837      gb_driver_data.ROMMap[I] = gb_driver_data.gb_cart + (I * 0x4000);
18381838   }
1839   
1839
18401840   /*
18411841      Handle odd-sized cartridges (72,80,96 banks)
18421842      ROMBanks      ROMMask
r8044r8045
18531853      }
18541854      gb_driver_data.ROMMask = I - 1;
18551855   }
1856   
1856
18571857   /* Fill out the remaining rom bank pointers, if any. */
18581858   for ( ; I < MAX_ROMBANK; I++)
18591859   {
18601860      gb_driver_data.ROMMap[I] = gb_driver_data.ROMMap[I & gb_driver_data.ROMMask];
18611861   }
1862   
1862
18631863   /* Log cart information */
18641864   {
18651865      const char *P;
18661866      char S[50];
18671867      static const int ramsize[8] = { 0, 2, 8, 32, 128, 64, 0, 0 };
1868     
18691868
1869
18701870      strncpy (S, (char *)&gb_header[0x0134], 16);
18711871      S[16] = '\0';
18721872      logerror("Cart Information\n");
r8044r8045
22102210
22112211DEVICE_IMAGE_LOAD(megaduck_cart)
22122212{
2213   int I;
2213   int I;
22142214   UINT32 filesize;
22152215
22162216   for (I = 0; I < MAX_ROMBANK; I++)
r8044r8045
22282228      image_seterror(image, IMAGE_ERROR_UNSPECIFIED, "Invalid rom file size");
22292229      return INIT_FAIL;
22302230   }
2231   
2231
22322232   gb_driver_data.ROMBanks = filesize / 0x4000;
22332233
22342234   /* Claim memory */
src/mess/machine/99_dsk.c
r8044r8045
154154    init state of the emulator. During the normal operation, only the
155155    reset routines are used.
156156*/
157// TODO: Check that:    floppy_mon_w(w->drive, CLEAR_LINE);
157// TODO: Check that:    floppy_mon_w(w->drive, CLEAR_LINE);
158158
159159void ti99_floppy_controllers_init_all(running_machine *machine)
160160{
r8044r8045
199199   motor_on = 0;
200200
201201   ti99_set_80_track_drives(FALSE);
202   
202
203203   set_all_geometries(machine, FLOPPY_DRIVE_DS_40);
204   
204
205205   ti99_peb_set_card_handlers(0x1100, & fdc_handlers);
206206   if (fdc) {
207207      wd17xx_reset(fdc);      /* resets the fdc */
r8044r8045
329329static  READ8_HANDLER(fdc_mem_r)
330330{
331331   running_device *fdc = devtag_get_device(space->machine, "wd179x");
332   
333   /* only use the even addresses from 1ff0 to 1ff6.
334      Note that data is inverted. */
332
333   /* only use the even addresses from 1ff0 to 1ff6.
334       Note that data is inverted. */
335335   if (offset >= 0x1ff0 && (offset & 0x09)==0)
336336      return wd17xx_r(fdc, (offset >> 1)&0x03) ^ 0xff;
337337   else
r8044r8045
345345{
346346   running_device *fdc = devtag_get_device(space->machine, "wd179x");
347347
348   /* only use the even addresses from 1ff8 to 1ffe.
349      Note that data is inverted. */
348   /* only use the even addresses from 1ff8 to 1ffe.
349       Note that data is inverted. */
350350   if (offset >= 0x1ff0 && (offset & 0x09)==0x08)
351351      wd17xx_w(fdc, (offset >> 1)&0x03, data ^ 0xff);
352352}
r8044r8045
393393   motor_on = 0;
394394
395395   ti99_set_80_track_drives(FALSE);
396   
396
397397   set_all_geometries(machine, FLOPPY_DRIVE_DS_40);
398398
399399   ti99_peb_set_card_handlers(0x1100, & ccfdc_handlers);
r8044r8045
615615   motor_on = 0;
616616
617617   ti99_set_80_track_drives(FALSE);
618   
618
619619   set_all_geometries(machine, FLOPPY_DRIVE_DS_40);
620620
621621   ti99_peb_set_card_handlers(0x1100, & bwg_handlers);
r8044r8045
932932}
933933
934934/*
935   Select the HFDC hard disk unit
936   This function implements the selection logic on the PCB (outside the
937   controller chip)
938   The HDC9234 allows up to four drives to be selected by the select lines.
939   This is not enough for controlling four floppy drives and three hard
940   drives, so the user programmable outputs are used to select the floppy
941   drives. This selection happens completely outside of the controller,
942   so we must implement it here.
935    Select the HFDC hard disk unit
936    This function implements the selection logic on the PCB (outside the
937    controller chip)
938    The HDC9234 allows up to four drives to be selected by the select lines.
939    This is not enough for controlling four floppy drives and three hard
940    drives, so the user programmable outputs are used to select the floppy
941    drives. This selection happens completely outside of the controller,
942    so we must implement it here.
943943*/
944944
945945static running_device *hfdc_current_harddisk(void)
r8044r8045
948948   disk_unit = line_to_index((output1_latch>>4)&0x0f, HFDC_MAX_HARD);
949949
950950   /* The HFDC does not use disk_unit=0. The first HD has index 1. */
951/*   if (disk_unit>=0) printf("Select hard disk %d\n", disk_unit);
952   else printf("No hard disk selected\n");
951/*  if (disk_unit>=0) printf("Select hard disk %d\n", disk_unit);
952    else printf("No hard disk selected\n");
953953*/
954954   return harddisk_unit[disk_unit];
955955}
956956
957957/*
958   Select the HFDC floppy disk unit
959   This function implements the selection logic on the PCB (outside the
960   controller chip)
958    Select the HFDC floppy disk unit
959    This function implements the selection logic on the PCB (outside the
960    controller chip)
961961*/
962962
963963static running_device *hfdc_current_floppy(void)
964{   
964{
965965   int disk_unit = -1;
966966   disk_unit = line_to_index(output1_latch & 0x0f, HFDC_MAX_FLOPPY);
967967
968968   if (disk_unit<0)
969969   {
970   //   printf("No unit selected\n");
970   //  printf("No unit selected\n");
971971      return NULL;
972972   }
973973
974   // printf("Select floppy disk %d (output1=%02x)\n", index, output1_latch);   
974   // printf("Select floppy disk %d (output1=%02x)\n", index, output1_latch);
975975   return floppy_unit[disk_unit];
976}   
976}
977977
978978/*
979979    Called whenever the state of the sms9234 interrupt pin changes.
r8044r8045
10501050      if (floppy_wpt_r(drive) == CLEAR_LINE)
10511051         reply |= DS_WRPROT;
10521052
1053      /* if (image_exists(disk_img)) */ 
1053      /* if (image_exists(disk_img)) */
10541054
10551055      reply |= DS_READY;  /* Floppies don't have a READY line; line is pulled up */
10561056      reply |= DS_SKCOM;  /* Same here. */
r8044r8045
10601060      UINT8 state;
10611061      drive = hfdc_current_harddisk();
10621062      state = ti99_mfm_harddisk_status(drive);
1063      if (state & MFMHD_TRACK00)
1063      if (state & MFMHD_TRACK00)
10641064         reply |= DS_TRK00;
10651065      if (state & MFMHD_SEEKCOMP)
10661066         reply |= DS_SKCOM;
r8044r8045
10801080static UINT8 hfdc_dma_read_callback(void)
10811081{
10821082   UINT8 value = hfdc_ram[dma_address & 0x7fff];
1083   dma_address++;   
1083   dma_address++;
10841084   return value;
10851085}
10861086
r8044r8045
10931093   dma_address++;
10941094}
10951095
1096/*
1097   Preliminary MFM harddisk interface.
1096/*
1097    Preliminary MFM harddisk interface.
10981098*/
10991099static void hfdc_harddisk_get_next_id(int head, chrn_id_hd *id)
11001100{
r8044r8045
11191119{
11201120   running_device *harddisk = hfdc_current_harddisk();
11211121   if (harddisk != NULL)
1122      ti99_mfm_harddisk_write_sector(harddisk, cylinder, head, sector, buf, sector_length);   
1122      ti99_mfm_harddisk_write_sector(harddisk, cylinder, head, sector, buf, sector_length);
11231123}
11241124
11251125static void hfdc_harddisk_read_track(int head, UINT8 **buffer, int *data_count)
r8044r8045
11441144   running_device *device = devtag_get_device(machine, "smc92x4");
11451145   const char *flopname[] = {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3};
11461146   const char *hardname[] = {MFMHD_0, MFMHD_1, MFMHD_2};
1147   
1147
11481148   int i;
1149   
1149
11501150   ti99_disk_DSR = memory_region(machine, region_dsr) + offset_hfdc_dsr;
11511151   hfdc_ram = memory_region(machine, region_dsr) + offset_hfdc_ram;
11521152   hfdc_ram_offset[0] = hfdc_ram_offset[1] = hfdc_ram_offset[2] = 0;
r8044r8045
11621162
11631163   ti99_peb_set_card_handlers(0x1100, & hfdc_handlers);
11641164
1165   if ((input_port_read(machine, "DISKCTRL") & DISK_HFDC)
1166      && (input_port_read(machine, "HFDCDIP")&0x55))
1165   if ((input_port_read(machine, "DISKCTRL") & DISK_HFDC)
1166      && (input_port_read(machine, "HFDCDIP")&0x55))
11671167      ti99_set_80_track_drives(TRUE);
11681168   else
11691169      ti99_set_80_track_drives(FALSE);
1170   
1170
11711171   smc92x4_set_timing(device, input_port_read(machine, "DRVSPD"));
1172   
1172
11731173   set_all_geometries(machine, FLOPPY_DRIVE_DS_80);
11741174
1175   /* Connect floppy drives to controller. Note that *this* is the
1176      controller, not the controller chip. The pcb contains a select
1177      logic.
1178      TODO: Turn this implementation into a device so that this is
1179      correctly modelled.
1180   */
1175   /* Connect floppy drives to controller. Note that *this* is the
1176       controller, not the controller chip. The pcb contains a select
1177       logic.
1178       TODO: Turn this implementation into a device so that this is
1179       correctly modelled.
1180    */
11811181   for (i = 0; i < 4; i++)
11821182   {
11831183      if (device->owner != NULL)
r8044r8045
11851185         floppy_unit[i] = device->owner->subdevice(flopname[i]);
11861186         if (floppy_unit[i]==NULL)
11871187         {
1188            floppy_unit[i] = devtag_get_device(device->machine, flopname[i]);
1188            floppy_unit[i] = devtag_get_device(device->machine, flopname[i]);
11891189         }
11901190      }
11911191      else
11921192      {
1193         floppy_unit[i] = devtag_get_device(device->machine, flopname[i]);
1193         floppy_unit[i] = devtag_get_device(device->machine, flopname[i]);
11941194      }
11951195
1196      if (floppy_unit[i]!=NULL)
1196      if (floppy_unit[i]!=NULL)
11971197      {
11981198         floppy_drive_set_controller(floppy_unit[i], device);
1199//         floppy_drive_set_index_pulse_callback(floppy_unit[i], smc92x4_index_pulse_callback);
1199//          floppy_drive_set_index_pulse_callback(floppy_unit[i], smc92x4_index_pulse_callback);
12001200         floppy_drive_set_rpm(floppy_unit[i], 300.);
12011201      }
1202      else
1202      else
12031203      {
12041204         logerror("99_dsk: Image %s is null\n", flopname[i]);
12051205      }
r8044r8045
12111211      harddisk_unit[i] = devtag_get_device(device->machine, hardname[i-1]);
12121212   }
12131213   harddisk_unit[0] = NULL;
1214   
1214
12151215   if (device) {
12161216      smc92x4_reset(device);
12171217   }
r8044r8045
12241224   DEVCB_LINE(ti99_hfdc_dip_w),
12251225   DEVCB_HANDLER(ti99_hfdc_auxbus_out),
12261226   DEVCB_LINE(ti99_hfdc_auxbus_in),
1227   
1227
12281228   hfdc_current_floppy,
12291229   hfdc_dma_read_callback,
12301230   hfdc_dma_write_callback,
r8044r8045
12411241int mycheck = 0;
12421242
12431243/*
1244   Read disk CRU interface
1245   HFDC manual p. 44
1246   
1247   CRU Select=0
1248   CRU rel. address   Definition
1249   00         Disk controller interrupt
1250   02         Motor status
1251   04         DMA in progress
1252   
1253   Note that the cru line settings on the board do not match the
1254   description. 02 and 04 switch positions. Similarly, the dip switches
1255   for the drive configurations are not correctly enumerated in the manual.
1256   
1257   CRU Select=1
1258   CRU rel. address   Definition
1259   00         Switch 4 status \_ drive 2 config
1260   02         Switch 3 status /
1261   04         Switch 2 status \_ drive 1 config
1262   06         Switch 1 status /
1263   08         Switch 8 status \_ drive 4 config
1264   0A         Switch 7 status /
1265   0C         Switch 6 status \_ drive 3 config
1266   0E         Switch 5 status /
1267   
1268   config: 00 = 9/16/18 sectors, 40 tracks, 16 msec
1269      10 = 9/16/18 sectors, 40 tracks, 8 msec
1270      01 = 9/16/18 sectors, 80 tracks, 2 msec
1271      11 = 36 sectors, 80 tracks, 2 msec
1244    Read disk CRU interface
1245    HFDC manual p. 44
1246
1247    CRU Select=0
1248    CRU rel. address    Definition
1249    00          Disk controller interrupt
1250    02          Motor status
1251    04          DMA in progress
1252
1253    Note that the cru line settings on the board do not match the
1254    description. 02 and 04 switch positions. Similarly, the dip switches
1255    for the drive configurations are not correctly enumerated in the manual.
1256
1257    CRU Select=1
1258    CRU rel. address    Definition
1259    00          Switch 4 status \_ drive 2 config
1260    02          Switch 3 status /
1261    04          Switch 2 status \_ drive 1 config
1262    06          Switch 1 status /
1263    08          Switch 8 status \_ drive 4 config
1264    0A          Switch 7 status /
1265    0C          Switch 6 status \_ drive 3 config
1266    0E          Switch 5 status /
1267
1268    config: 00 = 9/16/18 sectors, 40 tracks, 16 msec
1269        10 = 9/16/18 sectors, 40 tracks, 8 msec
1270        01 = 9/16/18 sectors, 80 tracks, 2 msec
1271        11 = 36 sectors, 80 tracks, 2 msec
12721272*/
12731273static int hfdc_cru_r(running_machine *machine, int offset)
12741274{
r8044r8045
12791279      if (cru_sel)
12801280      {
12811281         /* DIP switches.  Logic levels are inverted (on->0, off->1).  CRU
1282         bit order is the reverse of DIP-switch order, too (dip 1 -> bit 7,
1283         dip 8 -> bit 0).
1284         
1285         MZ: 00 should not be used since there is a bug in the
1286         DSR of the HFDC which causes problems with SD disks
1287         (controller tries DD and then fails to fall back to SD) */
1288           
1282            bit order is the reverse of DIP-switch order, too (dip 1 -> bit 7,
1283            dip 8 -> bit 0).
1284
1285            MZ: 00 should not be used since there is a bug in the
1286            DSR of the HFDC which causes problems with SD disks
1287            (controller tries DD and then fails to fall back to SD) */
1288
12891289         reply = ~(input_port_read(machine, "HFDCDIP"));
1290//         printf("hfdc cru read 7-0 = %02x\n", reply);
1290//          printf("hfdc cru read 7-0 = %02x\n", reply);
12911291      }
12921292      else
12931293      {
12941294         reply = 0;
1295/*         if (hfdc_irq_state)
1296            reply |= 1;
1297         if (motor_on)
1298            reply |= 2;
1299         if (hfdc_dma_in_progress)
1300            reply |= 4;*/
1301           
1295/*          if (hfdc_irq_state)
1296                reply |= 1;
1297            if (motor_on)
1298                reply |= 2;
1299            if (hfdc_dma_in_progress)
1300                reply |= 4;*/
1301
13021302         if (hfdc_irq_state)
13031303            reply |= 0x01;
13041304         if (hfdc_dip_state)
1305            reply |= 0x02;
1305            reply |= 0x02;
13061306         if (motor_on)
13071307            reply |= 0x04;
1308//         printf("hfdc cru read 7-0 = %02x\n", reply);
1308//          printf("hfdc cru read 7-0 = %02x\n", reply);
13091309
13101310      }
13111311   }
13121312   else /* CRU bits 8+ */
13131313      reply = 0;
1314//   printf("hfdc cru read %d = %d\n", offset, reply);
1314//  printf("hfdc cru read %d = %d\n", offset, reply);
13151315
13161316   return reply;
13171317}
13181318
13191319
13201320/*
1321   Write disk CRU interface
1322   HFDC manual p. 43
1323   
1324   CRU rel. address   Definition            Active
1325   00         Device Service Routine Select      HIGH
1326   02         Reset to controller chip      LOW
1327   04         Floppy Motor on / CD0         HIGH
1328   06         ROM page select 0 / CD1
1329   08         ROM page select 1 / CRU input select
1330   12/4/6/8/A      RAM page select at 0x5400
1331   1C/E/0/2/4      RAM page select at 0x5800
1332   26/8/A/C/E      RAM page select at 0x5C00   
1333   
1334   CD0 and CD1 are Clock Divider selections for the Floppy Data Separator (FDC9216)
1321    Write disk CRU interface
1322    HFDC manual p. 43
1323
1324    CRU rel. address    Definition              Active
1325    00          Device Service Routine Select       HIGH
1326    02          Reset to controller chip        LOW
1327    04          Floppy Motor on / CD0           HIGH
1328    06          ROM page select 0 / CD1
1329    08          ROM page select 1 / CRU input select
1330    12/4/6/8/A      RAM page select at 0x5400
1331    1C/E/0/2/4      RAM page select at 0x5800
1332    26/8/A/C/E      RAM page select at 0x5C00
1333
1334    CD0 and CD1 are Clock Divider selections for the Floppy Data Separator (FDC9216)
13351335*/
13361336static void hfdc_cru_w(running_machine *machine, int offset, int data)
1337{   
1337{
13381338   switch (offset)
13391339   {
13401340   case 0:
r8044r8045
14031403         hfdc_ram_offset[(offset-9)/5] &= ~(0x400 << ((offset-9)%5));
14041404      break;
14051405   }
1406//   printf("hfdc cru write bit %d = %d\n", offset, data);
1406//  printf("hfdc cru write bit %d = %d\n", offset, data);
14071407}
14081408
14091409
14101410/*
1411   read a byte in disk DSR space
1412   HFDC manual, p. 44
1413   Memory map as seen by the 99/4A PEB
1414   
1415   0x4000 - 0x4fbf   one of four possible ROM pages
1416   0x4fc0 - 0x4fcf   tape select
1417   0x4fd0 - 0x4fdf   disk controller select
1418   0x4fe0 - 0x4fff   time chip select
1419   
1420   0x5000 - 0x53ff   static RAM page 0x10
1421   0x5400 - 0x57ff   static RAM page any of 32 pages
1422   0x5800 - 0x5bff   static RAM page any of 32 pages
1423   0x5c00 - 0x5fff   static RAM page any of 32 pages   
1411    read a byte in disk DSR space
1412    HFDC manual, p. 44
1413    Memory map as seen by the 99/4A PEB
1414
1415    0x4000 - 0x4fbf one of four possible ROM pages
1416    0x4fc0 - 0x4fcf tape select
1417    0x4fd0 - 0x4fdf disk controller select
1418    0x4fe0 - 0x4fff time chip select
1419
1420    0x5000 - 0x53ff static RAM page 0x10
1421    0x5400 - 0x57ff static RAM page any of 32 pages
1422    0x5800 - 0x5bff static RAM page any of 32 pages
1423    0x5c00 - 0x5fff static RAM page any of 32 pages
14241424*/
14251425static  READ8_HANDLER(hfdc_mem_r)
14261426{
r8044r8045
14311431      /* dsr ROM */
14321432      return ti99_disk_DSR[hfdc_rom_offset+offset];
14331433   }
1434   
1434
14351435   if (offset >= 0xfc0 && offset <= 0x0fcf)
14361436   {
14371437      /* tape controller */
r8044r8045
14431443        {
14441444                /* Disk controller. Note that the odd addresses are ignored and
14451445                   the addresses used for the write ports are also masked away
1446                   since the write operations in the ti99 system are always
1446                   since the write operations in the ti99 system are always
14471447                   accompanied by read operations before.
14481448                */
1449                if ((offset & 3) == 0x00)
1449                if ((offset & 3) == 0x00)
14501450                {
1451                     return smc92x4_r(device, (offset>>2)&1);
1451                  return smc92x4_r(device, (offset>>2)&1);
14521452                }
14531453                else return 0;
14541454        }
r8044r8045
14681468      /* ram page >08 (hfdc manual says >10) */
14691469      return hfdc_ram[0x2000+(offset-0x1000)];
14701470   }
1471   
1471
14721472   /* The remaining space is ram with mapper:
1473      1400, 1800, 1c00 are the three banks; get the pointer
1474      plus the offset within the bank
1475   */
1473       1400, 1800, 1c00 are the three banks; get the pointer
1474       plus the offset within the bank
1475    */
14761476   return hfdc_ram[hfdc_ram_offset[(offset-0x1400) >> 10] + (offset & 0x3ff)];
14771477}
14781478
r8044r8045
14891489      logerror("99_dsk: Writing to HFDC ROM ignored (access to offset %04x)\n", offset);
14901490      return;
14911491   }
1492   
1492
14931493   if (offset >= 0xfc0 && offset <= 0x0fcf)
14941494   {
14951495      /* tape controller */
r8044r8045
15021502                /* Disk controller. Note that the odd addresses are ignored. */
15031503                if ((offset & 3) == 0x02)   /* 0x0fd2 and 0x0fd6 */
15041504                {
1505                     smc92x4_w(diskcnt, (offset>>2)&1, data);
1505                  smc92x4_w(diskcnt, (offset>>2)&1, data);
15061506                }
15071507                return;
15081508        }
r8044r8045
15241524      hfdc_ram[0x2000+(offset-0x1000)] = data;
15251525      return;
15261526   }
1527   
1527
15281528   /* The remaining space is ram with mapper:
1529      1400, 1800, 1c00 are the three banks; get the pointer
1530      plus the offset within the bank
1531   */   
1532//   if ((offset&0x0f)==0) printf("\n");
1533//   printf("%02x ", data);
1534     
1529       1400, 1800, 1c00 are the three banks; get the pointer
1530       plus the offset within the bank
1531    */
1532//  if ((offset&0x0f)==0) printf("\n");
1533//  printf("%02x ", data);
1534
15351535   hfdc_ram[hfdc_ram_offset[(offset-0x1400) >> 10] + (offset & 0x3ff)] = data;
15361536}
src/mess/machine/gamecom.c
r8044r8045
734734   }
735735   else
736736      memcpy(cartridge1 + load_offset, image_get_software_region(image, "rom"), filesize);
737   
737
738738   if (filesize < 0x010000) { memcpy(cartridge1 + 0x008000, cartridge1, 0x008000); } /* ->64KB */
739739   if (filesize < 0x020000) { memcpy(cartridge1 + 0x010000, cartridge1, 0x010000); } /* ->128KB */
740740   if (filesize < 0x040000) { memcpy(cartridge1 + 0x020000, cartridge1, 0x020000); } /* ->256KB */
src/mess/machine/8530scc.c
r8044r8045
3636   IRQ_B_EXT
3737} SCCIRQType;
3838
39typedef struct
39typedef struct
4040{
4141   int txIRQEnable;
4242   int rxIRQEnable;
r8044r8045
133133   scc->IRQType = IRQ_NONE;
134134   scc->MasterIRQEnable = 0;
135135   scc->IRQV = 0;
136   
136
137137   scc8530_initchannel(scc, 0);
138138   scc8530_initchannel(scc, 1);
139139   scc8530_resetchannel(scc, 0);
r8044r8045
199199      scc->IRQType = IRQ_NONE;
200200   }
201201
202//   printf("SCC: irqstat %d, last %d\n", irqstat, scc->lastIRQStat);
203//   printf("ch0: en %d pd %d  ch1: en %d pd %d\n", scc->channel[0].txIRQEnable, scc->channel[0].txIRQPending, scc->channel[1].txIRQEnable, scc->channel[1].txIRQPending);
202//  printf("SCC: irqstat %d, last %d\n", irqstat, scc->lastIRQStat);
203//  printf("ch0: en %d pd %d  ch1: en %d pd %d\n", scc->channel[0].txIRQEnable, scc->channel[0].txIRQPending, scc->channel[1].txIRQEnable, scc->channel[1].txIRQPending);
204204
205205   // don't spam the driver with unnecessary transitions
206206   if (irqstat != scc->lastIRQStat)
r8044r8045
321321         break;
322322
323323      case 5: // Tx parameters and controls
324//         printf("ch %d TxEnable = %d [%02x]\n", ch, data & 8, data);
324//          printf("ch %d TxEnable = %d [%02x]\n", ch, data & 8, data);
325325         pChan->txEnable = data & 8;
326326         break;
327327
r8044r8045
352352               scc->IRQType = IRQ_NONE;
353353               scc->MasterIRQEnable = 0;
354354               scc->IRQV = 0;
355   
355
356356               scc8530_initchannel(scc, 0);
357357               scc8530_initchannel(scc, 1);
358358               scc8530_resetchannel(scc, 0);
r8044r8045
361361               // make sure we stop yanking the IRQ line if we were
362362               scc_updateirqs(device);
363363               break;
364               
364
365365         }
366366         break;
367367
368368      case 10:   // misc transmitter/receiver control bits
369      case 11:    // clock mode control
370      case 12:    // lower byte of baud rate gen
369      case 11:   // clock mode control
370      case 12:   // lower byte of baud rate gen
371371      case 13:   // upper byte of baud rate gen
372372         break;
373373
src/mess/machine/c2040.c
r8044r8045
1313
1414    - 2040 DOS 1 FDC rom (jumps to 104d while getting block header)
1515
16      FE70: jsr  $104D
17      104D: m6502_brk#$00
16        FE70: jsr  $104D
17        104D: m6502_brk#$00
1818
1919    - Micropolis 8x50 stepper motor is same as 4040, except it takes 4 pulses to step a track instead of 1
2020    - error/activity LEDs
src/mess/machine/c16.c
r8044r8045
483483
484484#if 0
485485// FIXME
486// in very old MESS versions, we had these handlers to enable SID writes to 0xd400.
486// in very old MESS versions, we had these handlers to enable SID writes to 0xd400.
487487// would a real SID Card allow for this? If not, this should be removed completely
488488static WRITE8_HANDLER( c16_sidcart_16k )
489489{
src/mess/machine/c1541.c
r8044r8045
210210{
211211   assert(device != NULL);
212212   assert(device->token != NULL);
213   assert((device->type == C1540) || (device->type == C1541) || (device->type == C1541C) || (device->type == C1541II) ||
213   assert((device->type == C1540) || (device->type == C1541) || (device->type == C1541C) || (device->type == C1541II) ||
214214      (device->type == SX1541) || (device->type == OC118) || (device->type == C2031));
215215   return (c1541_t *)device->token;
216216}
r8044r8045
218218INLINE c1541_config *get_safe_config(running_device *device)
219219{
220220   assert(device != NULL);
221   assert((device->type == C1540) || (device->type == C1541) || (device->type == C1541C) || (device->type == C1541II) ||
221   assert((device->type == C1540) || (device->type == C1541) || (device->type == C1541C) || (device->type == C1541II) ||
222222      (device->type == SX1541) || (device->type == OC118) || (device->type == C2031));
223223   return (c1541_config *)device->baseconfig().inline_config;
224224}
src/mess/machine/amstrad.c
r8044r8045
35643564         memcpy(chunklen, temp_copy + offset, 4);
35653565         bytes_to_read -= 4;
35663566         offset += 4;
3567         
3567
35683568         // calculate little-endian value, just to be sure
35693569         chunksize = chunklen[0] + (chunklen[1] << 8) + (chunklen[2] << 16) + (chunklen[3] << 24);
3570         
3570
35713571         if (strncmp(chunkid, "cb", 2) == 0)
35723572         {
35733573            // load chunk into RAM
r8044r8045
35803580            {
35813581               // clear RAM block
35823582               memset(mem + 0x4000 * ramblock, 0, 0x4000);
3583               
3583
35843584               // load block into ROM area
35853585               if (chunksize > 16384)
35863586                  chunksize = 16384;
src/mess/machine/wd17xx.c
r8044r8045
122122    2010-02-04 Phill Harvey-Smith
123123    - Added multiple sector write as the RM Nimbus needs it.
124124
125   2010-March-22 Curt Coder:
126   - Implemented immediate and index pulse interrupts.
125    2010-March-22 Curt Coder:
126    - Implemented immediate and index pulse interrupts.
127127
128128    TODO:
129129        - Multiple record write
r8044r8045
574574#endif
575575
576576   /* Get the size in bytes of the current track. For real hardware this
577   may vary per system in small degree, and there even for each track
578   and head, so we should not assume a fixed value here.
579   As we are using a buffered track writing, we have to find out how long
580   the track will become. The only object which can tell us is the
581   selected format.
582   */
577    may vary per system in small degree, and there even for each track
578    and head, so we should not assume a fixed value here.
579    As we are using a buffered track writing, we have to find out how long
580    the track will become. The only object which can tell us is the
581    selected format.
582    */
583583   w->data_count = 0;
584584   floppy = flopimg_get_image(w->drive);
585585   if (floppy != NULL)
r8044r8045
731731   }
732732#endif
733733   /* Determine the track size. We cannot allow different sizes in this
734   design (see above, write_track). */
734    design (see above, write_track). */
735735   w->data_count = 0;
736736   floppy = flopimg_get_image(w->drive);
737737   if (floppy != NULL)
src/mess/machine/64h156.c
r8044r8045
119119
120120static DEVICE_START( c64h156 )
121121{
122//   c64h156_t *c64h156 = get_safe_token(device);
122//  c64h156_t *c64h156 = get_safe_token(device);
123123
124124   /* allocate data timer */
125//   c64h156->bit_timer = timer_alloc(device->machine, bit_tick, (void *)device);
125//  c64h156->bit_timer = timer_alloc(device->machine, bit_tick, (void *)device);
126126
127127   /* register for state saving */
128//   state_save_register_device_item(device, 0, c64h156->);
128//  state_save_register_device_item(device, 0, c64h156->);
129129}
130130
131131/*-------------------------------------------------
src/mess/machine/64h156.h
r8044r8045
11/**********************************************************************
22
33    Commodore 64H165 Gate Array emulation
4   
5   Used in 1541B/1541C/1541-II/1571
64
5    Used in 1541B/1541C/1541-II/1571
6
77    Copyright MESS Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
99
r8044r8045
3030                    OE  19 |             | 22  ATNA
3131                 _ACCL  20 |_____________| 21  OSC
3232
33                     _____   _____
33                            _____   _____
3434                  TEST   1 |*    \_/     | 42  _BYTE
3535                   YB0   2 |             | 41  SOE
3636                   YB1   3 |             | 40  B
src/mess/machine/mac.c
r8044r8045
22122212   {
22132213      case MODEL_MAC_PORTABLE:
22142214      case MODEL_MAC_PB100:
2215//         printf("Read PM data %x\n", mac->pm_data_recv);
2216         return mac->pm_data_recv;   
2215//          printf("Read PM data %x\n", mac->pm_data_recv);
2216         return mac->pm_data_recv;
22172217
22182218      case MODEL_MAC_CLASSIC:
22192219      case MODEL_MAC_II:
r8044r8045
22572257   // portable/PB100 is pretty different
22582258   if (mac->mac_model >= MODEL_MAC_PORTABLE && mac->mac_model <= MODEL_MAC_PB100)
22592259   {
2260//      printf("Read VIA B: PM_ACK %x\n", mac->pm_ack);
2260//      printf("Read VIA B: PM_ACK %x\n", mac->pm_ack);
22612261      val = 0x80 | mac->pm_ack;   // SCC wait/request
22622262   }
22632263   else
r8044r8045
23532353      mac_enable_sound(sound, (data & 0x80) == 0);
23542354      sony_set_sel_line(fdc,(data & 0x20) >> 5);
23552355      mac->mac_drive_select = ((data & 0x10) >> 4);
2356//      printf("PM_REQ = %x, was %x\n", data & 1, mac->pm_req);
2356//      printf("PM_REQ = %x, was %x\n", data & 1, mac->pm_req);
23572357      mac->pm_req = data & 1;
23582358      return;
23592359   }
src/mess/machine/ac1.c
r8044r8045
7575{
7676   /*
7777
78      bit      description
78        bit     description
7979
80      0
81      1      RTTY receive
82      2      RTTY transmit
83      3      RTTY PTT
84      4
85      5
86      6      cassette out
87      7      cassette in
80        0
81        1       RTTY receive
82        2       RTTY transmit
83        3       RTTY PTT
84        4
85        5
86        6       cassette out
87        7       cassette in
8888
89   */
89    */
9090}
9191
9292Z80PIO_INTERFACE( ac1_z80pio_intf )
src/mess/machine/nes.c
r8044r8045
152152int nes_ppu_vidaccess( running_device *device, int address, int data )
153153{
154154   nes_state *state = (nes_state *)device->machine->driver_data;
155   
155
156156   /* TODO: this is a bit of a hack, needed to get Argus, ASO, etc to work */
157157   /* but, B-Wings, submath (j) seem to use this location differently... */
158158   if (state->chr_chunks && (address & 0x3fff) < 0x2000)
r8044r8045
259259static void nes_machine_stop( running_machine *machine )
260260{
261261   nes_state *state = (nes_state *)machine->driver_data;
262   
262
263263   /* Write out the battery file if necessary */
264264   if (state->battery)
265265      image_battery_save(state->cart, state->battery_ram, NES_BATTERY_SIZE);
r8044r8045
493493      /* Unfortunately, many .unf files have been released as .nes, so we cannot rely on extensions only */
494494      memset(magic, '\0', sizeof(magic));
495495      image_fread(image, magic, 4);
496     
496
497497      if ((magic[0] == 'N') && (magic[1] == 'E') && (magic[2] == 'S'))   /* If header starts with 'NES' it is iNES */
498498      {
499499         state->format = 1;   // we use this to select between mapper_reset / unif_reset
500         
500
501501         mapinfo = image_extrainfo(image);
502         
502
503503         if (mapinfo)
504504         {
505505            if (4 == sscanf(mapinfo,"%d %d %d %d", &mapint1, &mapint2, &mapint3, &mapint4))
r8044r8045
521521         {
522522            logerror("NES: No extrainfo found\n");
523523         }
524         
524
525525         if (!goodcrcinfo)
526526         {
527527            // image_extrainfo() resets the file position back to start.
528528            // Let's skip past the magic header once again.
529529            image_fseek(image, 4, SEEK_SET);
530           
530
531531            image_fread(image, &state->prg_chunks, 1);
532532            image_fread(image, &state->chr_chunks, 1);
533533            /* Read the first ROM option byte (offset 6) */
534534            image_fread(image, &m, 1);
535           
535
536536            /* Interpret the iNES header flags */
537537            state->mapper = (m & 0xf0) >> 4;
538538            local_options = m & 0x0f;
539           
539
540540            /* Read the second ROM option byte (offset 7) */
541541            image_fread(image, &m, 1);
542           
542
543543            /* Check for skanky headers */
544544            image_fread(image, &skank, 8);
545           
545
546546            /* If the header has junk in the unused bytes, assume the extra mapper byte is also invalid */
547547            /* We only check the first 4 unused bytes for now */
548548            for (i = 0; i < 4; i ++)
r8044r8045
554554               }
555555            }
556556            logerror("\n");
557           
557
558558            state->mapper = state->mapper | (m & 0xf0);
559559         }
560         
560
561561         state->hard_mirroring = local_options & 0x01;
562562         state->battery = local_options & 0x02;
563563         state->trainer = local_options & 0x04;
564564         state->four_screen_vram = local_options & 0x08;
565         
565
566566         if (state->battery)
567567            logerror("-- Battery found\n");
568         
568
569569         if (state->trainer)
570570            logerror("-- Trainer found\n");
571         
571
572572         if (state->four_screen_vram)
573573            logerror("-- 4-screen VRAM\n");
574         
574
575575         /* Free the regions that were allocated by the ROM loader */
576576         memory_region_free(image->machine, "maincpu");
577577         memory_region_free(image->machine, "gfx1");
578         
578
579579         /* Allocate them again with the proper size */
580580         memory_region_alloc(image->machine, "maincpu", 0x10000 + (state->prg_chunks + 1) * 0x4000, 0);
581581         if (state->chr_chunks)
582582            memory_region_alloc(image->machine, "gfx1", state->chr_chunks * 0x2000, 0);
583         
583
584584         state->rom = memory_region(image->machine, "maincpu");
585585         state->vrom = memory_region(image->machine, "gfx1");
586586         state->vram = memory_region(image->machine, "gfx2");
587587         state->wram = memory_region(image->machine, "user1");
588         
588
589589         /* Position past the header */
590590         image_fseek(image, 16, SEEK_SET);
591         
591
592592         /* Load the 0x200 byte trainer at 0x7000 if it exists */
593593         if (state->trainer)
594594            image_fread(image, &state->wram[0x1000], 0x200);
595         
595
596596         /* Read in the program chunks */
597597         if (state->prg_chunks == 1)
598598         {
r8044r8045
602602         }
603603         else
604604            image_fread(image, &state->rom[0x10000], 0x4000 * state->prg_chunks);
605         
605
606606#if SPLIT_PRG
607607         {
608608            FILE *prgout;
609609            char outname[255];
610           
610
611611            sprintf(outname, "%s.prg", image_filename(image));
612612            prgout = fopen(outname, "wb");
613613            if (prgout)
r8044r8045
619619            fclose(prgout);
620620         }
621621#endif
622         
622
623623         logerror("**\n");
624624         logerror("Mapper: %d\n", state->mapper);
625625         logerror("PRG chunks: %02x, size: %06x\n", state->prg_chunks, 0x4000 * state->prg_chunks);
626626         // printf("Mapper: %d\n", state->mapper);
627627         // printf("PRG chunks: %02x, size: %06x\n", state->prg_chunks, 0x4000 * state->prg_chunks);
628         
628
629629         /* Read in any chr chunks */
630630         if (state->chr_chunks > 0)
631631         {
r8044r8045
633633            if (state->mapper == 2)
634634               logerror("Warning: VROM has been found in VRAM-based mapper. Either the mapper is set wrong or the ROM image is incorrect.\n");
635635         }
636         
636
637637#if SPLIT_CHR
638638         {
639639            FILE *chrout;
640640            char outname[255];
641           
641
642642            sprintf(outname, "%s.chr", image_filename(image));
643643            chrout= fopen(outname, "wb");
644644            if (chrout)
r8044r8045
649649            fclose(chrout);
650650         }
651651#endif
652         
652
653653         logerror("CHR chunks: %02x, size: %06x\n", state->chr_chunks, 0x4000 * state->chr_chunks);
654654         logerror("**\n");
655655         // printf("CHR chunks: %02x, size: %06x\n", state->chr_chunks, 0x4000 * state->chr_chunks);
656656         // printf("**\n");
657         
657
658658         /* Attempt to load a battery file for this ROM. If successful, we */
659659         /* must wait until later to move it to the system memory. */
660660         if (state->battery)
661661            image_battery_load(image, state->battery_data, NES_BATTERY_SIZE, 0x00);
662         
662
663663      }
664664      else if ((magic[0] == 'U') && (magic[1] == 'N') && (magic[2] == 'I') && (magic[3] == 'F')) /* If header starts with 'UNIF' it is UNIF */
665665      {
r8044r8045
673673         UINT32 size = image_length(image);
674674         const unif *unif_board;
675675         int mapr_chunk_found = 0;
676         
676
677677         state->format = 2;   // we use this to select between mapper_reset / unif_reset
678         
678
679679         image_fread(image, &buffer, 4);
680680         unif_ver = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
681681         logerror("UNIF file found, version %d\n", unif_ver);
682         
682
683683         if (size <= 0x20)
684684         {
685685            logerror("%s only contains the UNIF header and no data.\n", image_filename(image));
686686            return INIT_FAIL;
687687         }
688         
688
689689         do
690690         {
691691            image_fseek(image, read_length, SEEK_SET);
692           
692
693693            memset(magic2, '\0', sizeof(magic2));
694694            image_fread(image, &magic2, 4);
695           
695
696696#if 0
697697            // unfortunately, the MAPR chunk is not always the first chunk (see Super 24-in-1)
698698            /* Preliminary checks: the first chunk MUST be MAPR! */
699699            if (read_length == 0x20 && ((magic2[0] != 'M') || (magic2[1] != 'A') || (magic2[2] != 'P') || (magic2[3] != 'R')))
700700               fatalerror("First chunk of data in UNIF should be [MAPR]. Check if your image has been corrupted\n");
701           
701
702702            /* Preliminary checks: multiple MAPR chunks are FORBIDDEN! */
703703            if (read_length > 0x20 && ((magic2[0] == 'M') && (magic2[1] == 'A') && (magic2[2] == 'P') && (magic2[3] == 'R')))
704704               fatalerror("UNIF should not have multiple [MAPR] chunks. Check if your image has been corrupted\n");
705705#endif
706           
706
707707            /* we first run through the whole image to find a [MAPR] chunk */
708708            /* when found, we set mapr_chunk_found=1 and we go back to load other chunks! */
709709            if (!mapr_chunk_found)
r8044r8045
714714                  logerror("[MAPR] chunk found: ");
715715                  image_fread(image, &buffer, 4);
716716                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
717                 
717
718718                  if (chunk_length <= 0x20)
719719                     image_fread(image, &unif_mapr, chunk_length);
720                 
720
721721                  unif_board = nes_unif_lookup(unif_mapr);
722722                  logerror("%s\n", unif_mapr);
723                 
723
724724                  if (unif_board == NULL)
725725                  {
726726                     fatalerror("Unsupported UNIF board %s.\n", unif_mapr);
727727                     // logerror("Unsupported UNIF board %s.\n", unif_mapr);
728728                  }
729                 
729
730730                  state->mapper = 0;   // this allows us to set up memory handlers without duplicating code (for the moment)
731731                  state->board = unif_board->board;
732732                  state->prg_chunks = unif_board->prgrom;
r8044r8045
734734                  state->battery = unif_board->wram;   // we should implement WRAM banks...
735735                  //                  state->hard_mirroring = unif_board->nt;
736736                  //                      state->four_screen_vram = ;
737                 
737
738738                  /* Free the regions that were allocated by the ROM loader */
739739                  memory_region_free(image->machine, "maincpu");
740740                  memory_region_free(image->machine, "gfx1");
741                 
741
742742                  /* Allocate them again with the proper size */
743743                  memory_region_alloc(image->machine, "maincpu", 0x10000 + (state->prg_chunks + 1) * 0x4000, 0);
744744                  if (state->chr_chunks)
745745                     memory_region_alloc(image->machine, "gfx1", state->chr_chunks * 0x2000, 0);
746                 
746
747747                  state->rom = memory_region(image->machine, "maincpu");
748748                  state->vrom = memory_region(image->machine, "gfx1");
749749                  state->vram = memory_region(image->machine, "gfx2");
750750                  state->wram = memory_region(image->machine, "user1");
751                 
751
752752                  /* for validation purposes */
753753                  prg_left = unif_board->prgrom * 0x4000;
754754                  chr_left = unif_board->chrrom * 0x2000;
755                 
755
756756                  /* now that we found the MAPR chunk, we can go back to load other chunks */
757757                  image_fseek(image, 0x20, SEEK_SET);
758758                  read_length = 0x20;
r8044r8045
762762                  logerror("Skip this chunk. We need a [MAPR] chunk before anything else.\n");
763763                  image_fread(image, &buffer, 4);
764764                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
765                 
765
766766                  read_length += (chunk_length + 8);
767767               }
768768            }
r8044r8045
776776                  logerror("[MAPR] chunk found (in the 2nd run). Already loaded.\n");
777777                  image_fread(image, &buffer, 4);
778778                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
779                 
779
780780                  read_length += (chunk_length + 8);
781781               }
782782               else if ((magic2[0] == 'R') && (magic2[1] == 'E') && (magic2[2] == 'A') && (magic2[3] == 'D'))
r8044r8045
784784                  logerror("[READ] chunk found. No support yet.\n");
785785                  image_fread(image, &buffer, 4);
786786                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
787                 
787
788788                  read_length += (chunk_length + 8);
789789               }
790790               else if ((magic2[0] == 'N') && (magic2[1] == 'A') && (magic2[2] == 'M') && (magic2[3] == 'E'))
r8044r8045
792792                  logerror("[NAME] chunk found. No support yet.\n");
793793                  image_fread(image, &buffer, 4);
794794                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
795                 
795
796796                  read_length += (chunk_length + 8);
797797               }
798798               else if ((magic2[0] == 'W') && (magic2[1] == 'R') && (magic2[2] == 'T') && (magic2[3] == 'R'))
r8044r8045
800800                  logerror("[WRTR] chunk found. No support yet.\n");
801801                  image_fread(image, &buffer, 4);
802802                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
803                 
803
804804                  read_length += (chunk_length + 8);
805805               }
806806               else if ((magic2[0] == 'T') && (magic2[1] == 'V') && (magic2[2] == 'C') && (magic2[3] == 'I'))
r8044r8045
808808                  logerror("[TVCI] chunk found. No support yet.\n");
809809                  image_fread(image, &buffer, 4);
810810                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
811                 
811
812812                  read_length += (chunk_length + 8);
813813               }
814814               else if ((magic2[0] == 'D') && (magic2[1] == 'I') && (magic2[2] == 'N') && (magic2[3] == 'F'))
r8044r8045
816816                  logerror("[DINF] chunk found. No support yet.\n");
817817                  image_fread(image, &buffer, 4);
818818                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
819                 
819
820820                  read_length += (chunk_length + 8);
821821               }
822822               else if ((magic2[0] == 'C') && (magic2[1] == 'T') && (magic2[2] == 'R') && (magic2[3] == 'L'))
r8044r8045
824824                  logerror("[CTRL] chunk found. No support yet.\n");
825825                  image_fread(image, &buffer, 4);
826826                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
827                 
827
828828                  read_length += (chunk_length + 8);
829829               }
830830               else if ((magic2[0] == 'B') && (magic2[1] == 'A') && (magic2[2] == 'T') && (magic2[3] == 'R'))
r8044r8045
832832                  logerror("[BATR] chunk found. No support yet.\n");
833833                  image_fread(image, &buffer, 4);
834834                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
835                 
835
836836                  read_length += (chunk_length + 8);
837837               }
838838               else if ((magic2[0] == 'V') && (magic2[1] == 'R') && (magic2[2] == 'O') && (magic2[3] == 'R'))
r8044r8045
840840                  logerror("[VROR] chunk found. No support yet.\n");
841841                  image_fread(image, &buffer, 4);
842842                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
843                 
843
844844                  read_length += (chunk_length + 8);
845845               }
846846               else if ((magic2[0] == 'M') && (magic2[1] == 'I') && (magic2[2] == 'R') && (magic2[3] == 'R'))
r8044r8045
848848                  logerror("[MIRR] chunk found. No support yet.\n");
849849                  image_fread(image, &buffer, 4);
850850                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
851                 
851
852852                  read_length += (chunk_length + 8);
853853               }
854854               else if ((magic2[0] == 'P') && (magic2[1] == 'C') && (magic2[2] == 'K'))
r8044r8045
856856                  logerror("[PCK%c] chunk found. No support yet.\n", magic2[3]);
857857                  image_fread(image, &buffer, 4);
858858                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
859                 
859
860860                  read_length += (chunk_length + 8);
861861               }
862862               else if ((magic2[0] == 'C') && (magic2[1] == 'C') && (magic2[2] == 'K'))
r8044r8045
864864                  logerror("[CCK%c] chunk found. No support yet.\n", magic2[3]);
865865                  image_fread(image, &buffer, 4);
866866                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
867                 
867
868868                  read_length += (chunk_length + 8);
869869               }
870870               else if ((magic2[0] == 'P') && (magic2[1] == 'R') && (magic2[2] == 'G'))
r8044r8045
872872                  logerror("[PRG%c] chunk found. ", magic2[3]);
873873                  image_fread(image, &buffer, 4);
874874                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
875                 
875
876876                  logerror("It consists of %d 16K-blocks.\n", chunk_length / 0x4000);
877877                  /* Validation */
878878                  prg_left -= chunk_length;
879879                  if (prg_left < 0)
880880                     fatalerror("PRG chunks larger than expected by board %s!\n", unif_mapr);
881                 
881
882882                  /* Read in the program chunks */
883883                  if (state->prg_chunks == 1)
884884                  {
r8044r8045
888888                  }
889889                  else
890890                     image_fread(image, &state->rom[0x10000 + prg_start], chunk_length);
891                 
891
892892                  prg_start += chunk_length;
893893                  read_length += (chunk_length + 8);
894894               }
r8044r8045
897897                  logerror("[CHR%c] chunk found. ", magic2[3]);
898898                  image_fread(image, &buffer, 4);
899899                  chunk_length = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16) | (buffer[3] << 24);
900                 
900
901901                  logerror("It consists of %d 8K-blocks.\n", chunk_length / 0x2000);
902902                  /* validation */
903903                  chr_left -= chunk_length;
904904                  if (chr_left < 0)
905905                     fatalerror("CHR chunks larger than expected by board %s!\n", unif_mapr);
906                 
906
907907                  /* Read in the vrom chunks */
908908                  image_fread(image, state->vrom + chr_start, chunk_length);
909                 
909
910910                  chr_start += chunk_length;
911911                  read_length += (chunk_length + 8);
912912               }
r8044r8045
917917               }
918918            }
919919         } while (size > read_length);
920         
920
921921         if (!mapr_chunk_found )
922922            fatalerror("UNIF should have a [MAPR] chunk to work. Check if your image has been corrupted\n");
923         
923
924924         logerror("UNIF support is only very preliminary.\n");
925925      }
926926      else
r8044r8045
952952
953953      if (chr_size)
954954         memory_region_alloc(image->machine, "gfx1", chr_size, 0);
955     
955
956956      state->rom = memory_region(image->machine, "maincpu");
957957      state->vrom = memory_region(image->machine, "gfx1");
958958      state->vram = memory_region(image->machine, "gfx2");
r8044r8045
973973      state->mapper = 4;   // this should depend on the 'feature' field of the .xml file
974974      state->battery = 0;   // presence of a battery should be read from .xml feature
975975
976      // FIXME: we need to handle the remaining variables. on the short term, we might
977      // create a table for the various mappers (based on the 'feature' value in xml),
976      // FIXME: we need to handle the remaining variables. on the short term, we might
977      // create a table for the various mappers (based on the 'feature' value in xml),
978978      // but on the long term we need to rework the whole emulation to first use the
979979      // xml list and have mappers and unif boards to fall back to particular 'feature'
980980      // values!
r8044r8045
983983      //state->hard_mirroring = ;
984984      //state->trainer = ;
985985      //state->four_screen_vram = ;
986     
986
987987      /* Attempt to load a battery file for this ROM. If successful, we */
988988      /* must wait until later to move it to the system memory. */
989989      if (state->battery)
990990         image_battery_load(image, state->battery_data, NES_BATTERY_SIZE, 0x00);
991991   }
992   
992
993993   return INIT_PASS;
994994}
995995
src/mess/machine/nes_mmc.c
r8044r8045
210210
211211WRITE8_HANDLER( nes_chr_w )
212212{
213   nes_state *state = (nes_state *)space->machine->driver_data;   
213   nes_state *state = (nes_state *)space->machine->driver_data;
214214   int bank = offset >> 10;
215215
216216   if (state->chr_map[bank].source == CHRRAM)
r8044r8045
287287WRITE8_HANDLER( nes_mid_mapper_w )
288288{
289289   nes_state *state = (nes_state *)space->machine->driver_data;
290   
290
291291   if (state->mmc_write_mid)
292292      (*state->mmc_write_mid)(space, offset, data);
293293   else if (state->mid_ram_enable)
src/mess/machine/lynx.c
r8044r8045
19451945   UINT8 *rom = memory_region(image->machine, "user1");
19461946   UINT32 size;
19471947   UINT8 header[0x40];
1948   
1948
19491949   if (image_software_entry(image) == NULL)
19501950   {
19511951      const char *filetype;
r8044r8045
20012001   {
20022002      size = image_get_software_region_length(image, "rom");
20032003
2004      /* here we assume images to be in .lnx format and to have an header.
2005       we should eventually remove them, though! */
2004      /* here we assume images to be in .lnx format and to have an header.
2005         we should eventually remove them, though! */
20062006      memcpy(header, image_get_software_region(image, "rom"), 0x40);
2007     
2007
20082008      /* Check the image */
20092009      if (lynx_verify_cart((char*)header, LYNX_CART) == IMAGE_VERIFY_FAIL)
20102010         return INIT_FAIL;
2011     
2011
20122012      /* 2008-10 FP: According to Handy source these should be page_size_bank0. Are we using
2013       it correctly in MESS? Moreover, the next two values should be page_size_bank1. We should
2014       implement this as well */
2013         it correctly in MESS? Moreover, the next two values should be page_size_bank1. We should
2014         implement this as well */
20152015      lynx_granularity = header[4] | (header[5] << 8);
2016     
2016
20172017      logerror ("%s %dkb cartridge with %dbyte granularity from %s\n",
20182018              header + 10, size / 1024, lynx_granularity, header + 42);
2019     
2019
20202020      size -= 0x40;
20212021      memcpy(rom, image_get_software_region(image, "rom") + 0x40, size);
20222022   }
src/mess/machine/geneve.c
r8044r8045
542542   offset &= 0x1fff;
543543
544544   /* Although we could have 128K boot ROM (page f0...ff), the stock
545   Geneve only has 16K. The address is incompletely decoded, so page
546   f0 is mirrored on all even pages up to fe, and f1 is mirrored on
547   f3, f5, ... ff.
548   Currently, MESS is delivered with the 16K ROM only. So for the time
549   being, we won't lose much if we mask the page bits.
550   Michael Zapf, 2008-01-23
551   */
545    Geneve only has 16K. The address is incompletely decoded, so page
546    f0 is mirrored on all even pages up to fe, and f1 is mirrored on
547    f3, f5, ... ff.
548    Currently, MESS is delivered with the 16K ROM only. So for the time
549    being, we won't lose much if we mask the page bits.
550    Michael Zapf, 2008-01-23
551    */
552552   if (page > 0xf1) page &= 0xf1;
553553
554554   switch (page)
r8044r8045
556556   case 0xf0:
557557   case 0xf1:
558558      /* Boot ROM */
559      if (input_port_read(space->machine, "BOOTROM")==BOOT_V09)
559      if (input_port_read(space->machine, "BOOTROM")==BOOT_V09)
560560         return AROM_ptr[(page-0xf0)*0x2000 + offset];
561      else
561      else
562562         return ROM_ptr[(page-0xf0)*0x2000 + offset];
563563
564564   case 0xe8:
src/mess/machine/nes_ines.c
r8044r8045
14871487      if (state->IRQ_count <= 114)
14881488      {
14891489         cpu_set_input_line(state->maincpu, M6502_IRQ_LINE, HOLD_LINE);
1490         state->IRQ_count = (0xffff - 114 + state->IRQ_count);    // wrap around the 16 bits counter
1490         state->IRQ_count = (0xffff - 114 + state->IRQ_count);   // wrap around the 16 bits counter
14911491      }
14921492      state->IRQ_count -= 114;
14931493   }
r8044r8045
16581658      else if (state->IRQ_count < 114)
16591659      {
16601660         cpu_set_input_line(state->maincpu, M6502_IRQ_LINE, HOLD_LINE);
1661         state->IRQ_count = (0xffff - 114 + state->IRQ_count);    // wrap around the 16 bits counter
1661         state->IRQ_count = (0xffff - 114 + state->IRQ_count);   // wrap around the 16 bits counter
16621662      }
16631663      else
16641664         state->IRQ_count -= 114;
src/mess/machine/ti99pcod.c
r8044r8045
116116{
117117   UINT8 reply;
118118   /* GROMs are buffered. Data is retrieved from a buffer,
119   while the buffer is replaced with the next cell
120   content. */
119    while the buffer is replaced with the next cell
120    content. */
121121   reply = pcode_GROMs.buf;
122   
122
123123   /* Get next value, put it in buffer. Note that the
124   GROM wraps at 8K boundaries. */
124    GROM wraps at 8K boundaries. */
125125   pcode_GROMs.buf = pcode_GROMs.data_ptr[pcode_GROMs.addr];
126   
126
127127   /* The program counter wraps at each GROM chip size (8K),
128   so 0x5fff + 1 = 0x4000. */
128    so 0x5fff + 1 = 0x4000. */
129129   pcode_GROMs.addr = ((pcode_GROMs.addr + 1) & 0x1FFF) | (pcode_GROMs.addr & 0xE000);
130   
130
131131   /* Reset the read and write address flipflops. */
132132   pcode_GROMs.raddr_LSB = pcode_GROMs.waddr_LSB = FALSE;
133   
133
134134   return reply;
135135}
136136
r8044r8045
265265      switch (offset)
266266      {
267267         /* GROMs only answer at even addresses. The odd addresses are
268         undefined, so we can as well just ignore these cases. */
268            undefined, so we can as well just ignore these cases. */
269269      case 0x1bfc:
270270      case 0x1bfe:
271271         reply = ti99_pcode_grom_r(space, offset);
r8044r8045
277277         break;
278278      default:
279279         /* Accesses ROM 4764 (2*4K)
280         We have two banks here which are activated according
281         to the setting of CRU bit 4
282         */
280            We have two banks here which are activated according
281            to the setting of CRU bit 4
282            */
283283         reply = (bank_select==0)? ti99_pcode_rom1[offset-0x1000] : ti99_pcode_rom2[offset-0x1000];
284284      }
285285   }
src/mess/machine/mtx.c
r8044r8045
5959{
6060   /*
6161
62      bit      description
62        bit     description
6363
64      0      P0
65      1      P1
66      2      P2
67      3      P3
68      4      R0
69      5      R1
70      6      R2
71      7      RELCPMH
64        0       P0
65        1       P1
66        2       P2
67        3       P3
68        4       R0
69        5       R1
70        6       R2
71        7       RELCPMH
7272
73   */
73    */
7474
7575   const address_space *program = cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM);
7676   running_device *messram = devtag_get_device(machine, "messram");
r8044r8045
149149{
150150   /*
151151
152      bit      description
152        bit     description
153153
154      0      BUSY
155      1      ERROR
156      2      PE
157      3      SLCT
158      4     
159      5     
160      6     
161      7     
154        0       BUSY
155        1       ERROR
156        2       PE
157        3       SLCT
158        4
159        5
160        6
161        7
162162
163   */
163    */
164164
165165   UINT8 data = 0;
166166
r8044r8045
247247   {
248248      /*
249249
250         bit      description
250            bit     description
251251
252         0      A8
253         1      A9
254         2      A10
255         3     
256         4     
257         5      attribute memory write enable
258         6      ASCII memory write enable
259         7      cycle (0=read/1=write)
252            0       A8
253            1       A9
254            2       A10
255            3
256            4
257            5       attribute memory write enable
258            6       ASCII memory write enable
259            7       cycle (0=read/1=write)
260260
261      */
261        */
262262   }
263263   else
264264   {
265265      /*
266266
267         bit      description
267            bit     description
268268
269         0      A0
270         1      A1
271         2      A2
272         3      A3
273         4      A4
274         5      A5
275         6      A6
276         7      A7
269            0       A0
270            1       A1
271            2       A2
272            3       A3
273            4       A4
274            5       A5
275            6       A6
276            7       A7
277277
278      */
278        */
279279   }
280280}
281281
r8044r8045
313313{
314314   /*
315315
316      bit      description
316        bit     description
317317
318      0     
319      1     
320      2     
321      3     
322      4     
323      5     
324      6     
325      7     
318        0
319        1
320        2
321        3
322        4
323        5
324        6
325        7
326326
327   */
327    */
328328}
329329
330330/***************************************************************************
src/mess/machine/mc6852.c
r8044r8045
99
1010/*
1111
12   TODO:
12    TODO:
1313
14   - FIFO
15   - receive
16   - transmit
17   - parity
18   - 1-sync-character mode
19   - 2-sync-character mode
20   - external sync mode
21   - interrupts
14    - FIFO
15    - receive
16    - transmit
17    - parity
18    - 1-sync-character mode
19    - 2-sync-character mode
20    - external sync mode
21    - interrupts
2222
2323*/
2424
r8044r8045
229229      if (data & C1_RX_RS)
230230      {
231231         /* When Rx Rs is set, it clears the receiver
232         control logic, sync logic, error logic, Rx Data FIFO Control,
233         Parity Error status bit, and DCD interrupt. The Receiver Shift
234         Register is set to ones.
235         */
232            control logic, sync logic, error logic, Rx Data FIFO Control,
233            Parity Error status bit, and DCD interrupt. The Receiver Shift
234            Register is set to ones.
235            */
236236
237237         if (LOG) logerror("MC6852 '%s' Receiver Reset\n", device->tag());
238238
r8044r8045
244244      if (data & C1_TX_RS)
245245      {
246246         /* When Tx Rs is set, it clears the transmitter
247         control section, Transmitter Shift Register, Tx Data FIFO
248         Control (the Tx Data FIFO can be reloaded after one E clock
249         pulse), the Transmitter Underflow status bit, and the CTS interrupt,
250         and inhibits the TDRA status bit (in the one-sync-character
251         and two-sync-character modes).*/
247            control section, Transmitter Shift Register, Tx Data FIFO
248            Control (the Tx Data FIFO can be reloaded after one E clock
249            pulse), the Transmitter Underflow status bit, and the CTS interrupt,
250            and inhibits the TDRA status bit (in the one-sync-character
251            and two-sync-character modes).*/
252252
253253         if (LOG) logerror("MC6852 '%s' Transmitter Reset\n", device->tag());
254254
r8044r8045
307307
308308/*-------------------------------------------------
309309    mc685mc6852_sm_dtr_r2_dcd_w - sync match /
310   data terminal ready
310    data terminal ready
311311-------------------------------------------------*/
312312
313313READ_LINE_DEVICE_HANDLER( mc6852_sm_dtr_r )
src/mess/machine/rmnimbus.c
r8044r8045
163163    UINT8   reg418;
164164
165165    UINT8   drq_ff;
166    UINT8   int_ff;           
166    UINT8   int_ff;
167167} nimbus_drives;
168168
169169
r8044r8045
197197UINT8 last_playmode;
198198
199199/* Mouse/Joystick */
200 
201typedef struct
200
201typedef struct
202202{
203203    UINT8   mouse_px;
204204    UINT8   mouse_py;
205   
205
206206    UINT8   mouse_x;
207207    UINT8   mouse_y;
208208    UINT8   mouse_pc;
209209    UINT8   mouse_pcx;
210210    UINT8   mouse_pcy;
211   
211
212212    UINT8   intstate_x;
213213    UINT8   intstate_y;
214   
214
215215    UINT8   reg0a4;
216   
216
217217    emu_timer   *mouse_timer;
218218} _mouse_joy_state;
219219
r8044r8045
505505        if(i186.intr.ext[intno] & EXTINT_CTRL_CASCADE)
506506            i186.intr.ext_vector[intno]=vector;
507507    }
508   
508
509509    // Turn on the requested request bit and handle interrupt
510510    i186.intr.request |= (0x010 << intno);
511511    update_interrupt_state(machine);
r8044r8045
13341334
13351335    keyboard.keyscan_timer=timer_alloc(machine, keyscan_callback, NULL);
13361336    nimbus_mouse.mouse_timer=timer_alloc(machine, mouse_callback, NULL);
1337   
1337
13381338   /* setup debug commands */
13391339   if (machine->debug_flags & DEBUG_FLAG_ENABLED)
13401340   {
r8044r8045
21942194    if(iou_reg092 & DISK_INT_ENABLE)
21952195    {
21962196        nimbus_drives.int_ff=state;
2197       
2197
21982198        if(state)
21992199            external_int(machine,0,EXTERNAL_INT_DISK);
22002200    }
r8044r8045
26732673
26742674    last_playmode=MSM5205_S48_4B;
26752675    msm5205_playmode_w(msm5205,last_playmode);
2676   
2676
26772677    ay8910_a=0;
26782678}
26792679
r8044r8045
27092709    running_device *msm5205 = devtag_get_device(space->machine, MSM5205_TAG);
27102710
27112711    msm5205_data_w(msm5205, data);
2712   
2712
27132713    // Mouse code needs a copy of this.
27142714    ay8910_a=data;
27152715}
r8044r8045
27592759{
27602760    UINT8   x = 0;
27612761    UINT8   y = 0;
2762//   int     pc=cpu_get_pc(devtag_get_device(machine,MAINCPU_TAG));
2763   
2762//  int     pc=cpu_get_pc(devtag_get_device(machine,MAINCPU_TAG));
2763
27642764    UINT8   intstate_x;
27652765    UINT8   intstate_y;
27662766    int     xint;
27672767    int     yint;
2768   
2768
27692769    _mouse_joy_state *state = &nimbus_mouse;
27702770
2771   
2771
27722772   state->reg0a4 = input_port_read(machine, MOUSE_BUTTON_TAG) | 0xC0;
27732773   x = input_port_read(machine, MOUSEX_TAG);
27742774    y = input_port_read(machine, MOUSEY_TAG);
r8044r8045
27792779    UINT8   myb;
27802780
27812781    //logerror("poll_mouse()\n");
2782
2782
27832783   if (x == state->mouse_x)
27842784   {
27852785      state->mouse_px = MOUSE_PHASE_STATIC;
r8044r8045
28132813        case MOUSE_PHASE_NEGATIVE   : state->mouse_pcx--; break;
28142814    }
28152815    state->mouse_pcx &= 0x03;
2816
2816
28172817    switch (state->mouse_py)
28182818    {
28192819        case MOUSE_PHASE_STATIC     : break;
28202820        case MOUSE_PHASE_POSITIVE   : state->mouse_pcy++; break;
28212821        case MOUSE_PHASE_NEGATIVE   : state->mouse_pcy--; break;
28222822    }
2823    state->mouse_pcy &= 0x03;
2823    state->mouse_pcy &= 0x03;
28242824
2825//   mxb = MOUSE_XYB[state->mouse_px][state->mouse_pcx]; // XB
2825//  mxb = MOUSE_XYB[state->mouse_px][state->mouse_pcx]; // XB
28262826//    mxa = MOUSE_XYA[state->mouse_px][state->mouse_pcx]; // XA
2827//   mya = MOUSE_XYA[state->mouse_py][state->mouse_pcy]; // YA
2828//   myb = MOUSE_XYB[state->mouse_py][state->mouse_pcy]; // YB
2829   
2827//  mya = MOUSE_XYA[state->mouse_py][state->mouse_pcy]; // YA
2828//  myb = MOUSE_XYB[state->mouse_py][state->mouse_pcy]; // YB
2829
28302830   mxb = MOUSE_XYB[1][state->mouse_pcx]; // XB
28312831   mxa = MOUSE_XYA[1][state->mouse_pcx]; // XA
28322832   mya = MOUSE_XYA[1][state->mouse_pcy]; // YA
28332833   myb = MOUSE_XYB[1][state->mouse_pcy]; // YB
2834
2834
28352835    if ((state->mouse_py!=MOUSE_PHASE_STATIC) || (state->mouse_px!=MOUSE_PHASE_STATIC))
28362836    {
28372837//        logerror("state->mouse_px=%02X, state->mouse_py=%02X, state->mouse_pcx=%02X, state->mouse_pcy=%02X\n",
28382838//              state->mouse_px,state->mouse_py,state->mouse_pcx,state->mouse_pcy);
2839   
2839
28402840//        logerror("mxb=%02x, mxa=%02X (mxb ^ mxa)=%02X, (ay8910_a & 0xC0)=%02X, (mxb ^ mxa) ^ ((ay8910_a & 0x80) >> 7)=%02X\n",
28412841//              mxb,mxa, (mxb ^ mxa) , (ay8910_a & 0xC0), (mxb ^ mxa) ^ ((ay8910_a & 0x40) >> 6));
28422842    }
2843   
2843
28442844    intstate_x = (mxb ^ mxa) ^ ((ay8910_a & 0x40) >> 6);
28452845    intstate_y = (myb ^ mya) ^ ((ay8910_a & 0x80) >> 7);
2846   
2846
28472847    if (MOUSE_INT_ENABLED())
28482848    {
28492849        if ((intstate_x==1) && (state->intstate_x==0))
28502850//        if (intstate_x!=state->intstate_x)
28512851        {
2852           
2852
28532853            xint=mxa ? EXTERNAL_INT_MOUSE_XR : EXTERNAL_INT_MOUSE_XL;
2854                   
2854
28552855            external_int(machine,0,xint);
2856               
2856
28572857//            logerror("Xint:%02X, mxb=%02X\n",xint,mxb);
28582858        }
28592859
r8044r8045
28612861//        if (intstate_y!=state->intstate_y)
28622862        {
28632863            yint=myb ? EXTERNAL_INT_MOUSE_YU : EXTERNAL_INT_MOUSE_YD;
2864                   
2864
28652865            external_int(machine,0,yint);
28662866//            logerror("Yint:%02X, myb=%02X\n",yint,myb);
2867        }       
2867        }
28682868    }
28692869    else
2870    {   
2870    {
28712871        state->reg0a4 &= 0xF0;
28722872        state->reg0a4 |= ( mxb & 0x01) << 3; // XB
28732873        state->reg0a4 |= (!mxb & 0x01) << 2; // XA
28742874        state->reg0a4 |= (!myb & 0x01) << 1; // YA
28752875        state->reg0a4 |= ( myb & 0x01) << 0; // YB
28762876    }
2877     
2877
28782878    state->mouse_x = x;
28792879    state->mouse_y = y;
2880       
2880
28812881    if ((state->mouse_py!=MOUSE_PHASE_STATIC) || (state->mouse_px!=MOUSE_PHASE_STATIC))
28822882    {
28832883//        logerror("pc=%05X, reg0a4=%02X, reg092=%02X, ay_a=%02X, x=%02X, y=%02X, px=%02X, py=%02X, intstate_x=%02X, intstate_y=%02X\n",
28842884//                 pc,state->reg0a4,iou_reg092,ay8910_a,state->mouse_x,state->mouse_y,state->mouse_px,state->mouse_py,intstate_x,intstate_y);
28852885    }
2886   
2886
28872887    state->intstate_x=intstate_x;
28882888    state->intstate_y=intstate_y;
28892889}
r8044r8045
29052905
29062906    */
29072907    UINT8   result;
2908//   int     pc=cpu_get_pc(devtag_get_device(space->machine,MAINCPU_TAG));
2909 
2908//  int     pc=cpu_get_pc(devtag_get_device(space->machine,MAINCPU_TAG));
2909
29102910    _mouse_joy_state *state = &nimbus_mouse;
29112911
29122912   if (input_port_read(space->machine, "config") & 0x01)
src/mess/machine/rs232.c
r8044r8045
114114   rs232->dcd = state;
115115
116116   if (LOG) logerror("RS232 '%s' DCD %u\n", device->tag(), state);
117   
117
118118   //devcb_call_write_line(&rs232->dte.out_dcd_func, state);
119119}
120120
r8044r8045
130130   rs232_t *rs232 = get_safe_token(device);
131131
132132   rs232->dtr = state;
133   
133
134134   if (LOG) logerror("RS232 '%s' DTR %u\n", device->tag(), state);
135135
136136   //devcb_call_write_line(&rs232->dce.out_dtr_func, state);
r8044r8045
148148   rs232_t *rs232 = get_safe_token(device);
149149
150150   rs232->dsr = state;
151   
151
152152   if (LOG) logerror("RS232 '%s' DSR %u\n", device->tag(), state);
153153
154154   //devcb_call_write_line(&rs232->dte.out_dsr_func, state);
r8044r8045
166166   rs232_t *rs232 = get_safe_token(device);
167167
168168   rs232->rts = state;
169   
169
170170   if (LOG) logerror("RS232 '%s' RTS %u\n", device->tag(), state);
171171
172172   //devcb_call_write_line(&rs232->dce.out_rts_func, state);
r8044r8045
186186   rs232->cts = state;
187187
188188   if (LOG) logerror("RS232 '%s' CTS %u\n", device->tag(), state);
189   
189
190190   //devcb_call_write_line(&rs232->dte.out_cts_func, state);
191191}
192192
r8044r8045
204204   rs232->ri = state;
205205
206206   if (LOG) logerror("RS232 '%s' RI %u\n", device->tag(), state);
207   
207
208208   //devcb_call_write_line(&rs232->dte.out_ri_func, state);
209209}
210210
src/mess/machine/snescart.c
r8044r8045
359359      snes_rom_size = image_length(image);
360360   else
361361      snes_rom_size = image_get_software_region_length(image, "rom");
362   
362
363363   /* Check for a header (512 bytes) */
364364   offset = 512;
365365   if (image_software_entry(image) == NULL)
r8044r8045
402402   {
403403      memcpy(temp_buffer, image_get_software_region(image, "rom") + offset, 0x40ffff);
404404   }
405   
405
406406   /* Now to determine if this is a lo-ROM, a hi-ROM or an extended lo/hi-ROM */
407407   valid_mode20 = snes_validate_infoblock(temp_buffer, 0x007fc0);
408408   valid_mode21 = snes_validate_infoblock(temp_buffer, 0x00ffc0);
r8044r8045
442442      image_fread(image, ROM, snes_rom_size - offset);
443443   else
444444      memcpy(ROM, image_get_software_region(image, "rom") + offset, snes_rom_size - offset);
445   
445
446446   if (SNES_CART_DEBUG) printf("size %08X\n", snes_rom_size - offset);
447447
448448   /* FIXME: Insert crc check here */
src/mess/machine/apple2.c
r8044r8045
187187            {
188188               rh = apple2_c1xx_r;
189189            }
190            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
190            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
191191            {   // slots 4-7
192192               rh = apple2_c4xx_r;
193193            }
r8044r8045
271271            {
272272               wh = apple2_c1xx_w;
273273            }
274            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
274            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
275275            {   // slots 4-7
276276               wh = apple2_c4xx_w;
277277            }
src/mess/machine/genesis.c
r8044r8045
12311231   sram_detected = 0;
12321232   genesis_sram_start = genesis_sram_end = 0;
12331233   has_serial_eeprom = 0;
1234   
1234
12351235   /* check if cart has battery save */
1236   
1236
12371237   /* For games using SRAM, unfortunately there are ROMs without info
1238    about it in header. The solution adopted is do the mapping anyway,
1239    then active SRAM later if the game will access it. */
1240   
1238     about it in header. The solution adopted is do the mapping anyway,
1239     then active SRAM later if the game will access it. */
1240
12411241   if (ROM[0x1b1] == 'R' && ROM[0x1b0] == 'A')
12421242   {
12431243      /* SRAM info found in header */
12441244      genesis_sram_start = (ROM[0x1b5] << 24 | ROM[0x1b4] << 16 | ROM[0x1b7] << 8 | ROM[0x1b6]);
12451245      genesis_sram_end = (ROM[0x1b9] << 24 | ROM[0x1b8] << 16 | ROM[0x1bb] << 8 | ROM[0x1ba]);
1246     
1246
12471247      if ((genesis_sram_start > genesis_sram_end) || ((genesis_sram_end - genesis_sram_start) >= 0x10000))   // we assume at most 64k of SRAM (HazeMD uses at most 64k). is this correct?
12481248         genesis_sram_end = genesis_sram_start + 0x0FFFF;
1249     
1249
12501250      /* for some games using serial EEPROM, difference between SRAM
1251      end to start is 0 or 1. Currently EEPROM is not emulated. */
1251        end to start is 0 or 1. Currently EEPROM is not emulated. */
12521252      if ((genesis_sram_end - genesis_sram_start) < 2)
12531253         has_serial_eeprom = 1;
12541254      else
r8044r8045
12601260      genesis_sram_start = 0x200000;
12611261      genesis_sram_end = genesis_sram_start + 0xffff;
12621262   }
1263   
1263
12641264   if (genesis_sram_start & 1)
12651265      genesis_sram_start -= 1;
1266   
1266
12671267   if (!(genesis_sram_end & 1))
12681268      genesis_sram_end += 1;
1269   
1269
12701270   /* calculate backup RAM location */
12711271   megadriv_backupram = (UINT16*) (ROM + (genesis_sram_start & 0x3fffff));
1272   
1272
12731273   /* Until serial EEPROM is emulated, clears one byte at beginning of
1274    backup RAM, but only if the value is 0xFFFF, to not break MLBPA Sports
1275    Talk Baseball. With this hack some games at least run (NBA Jam, Evander
1276    Holyfield's Real Deal Boxing, Greatest Heavyweights of the Ring) */
1274     backup RAM, but only if the value is 0xFFFF, to not break MLBPA Sports
1275     Talk Baseball. With this hack some games at least run (NBA Jam, Evander
1276     Holyfield's Real Deal Boxing, Greatest Heavyweights of the Ring) */
12771277   if (has_serial_eeprom && megadriv_backupram[0] == 0xffff)
12781278      megadriv_backupram[0] = 0xff00;
1279   
1279
12801280   if (sram_detected)
12811281      logerror("SRAM detected from header: starting location %X - SRAM Length %X\n", genesis_sram_start, genesis_sram_end - genesis_sram_start + 1);
1282   
1282
12831283   return INIT_PASS;
12841284}
12851285
r8044r8045
13071307   UINT16 *ROM16;
13081308   UINT32 *ROM32;
13091309   int i;
1310   
1310
13111311   if (image_software_entry(image) == NULL)
13121312   {
13131313      length = image_length(image);
r8044r8045
13261326   ROM16 = (UINT16 *) memory_region(image->machine, "gamecart");
13271327   for (i = 0; i < length; i += 2)
13281328      ROM16[i / 2] = pick_integer_be(temp_copy, i, 2);
1329   
1329
13301330   ROM32 = (UINT32 *) memory_region(image->machine, "gamecart_sh2");
13311331   for (i = 0; i < length; i += 4)
13321332      ROM32[i / 4] = pick_integer_be(temp_copy, i, 4);
1333   
1333
13341334   ROM16 = (UINT16 *) memory_region(image->machine, "maincpu");
13351335   for (i = 0x100; i < length; i += 2)
13361336      ROM16[i / 2] = pick_integer_be(temp_copy, i, 2);
1337   
1337
13381338   auto_free(image->machine, temp_copy);
13391339
13401340   return INIT_PASS;
src/mess/machine/pce.c
r8044r8045
125125      size = image_length(image);
126126   else
127127      size = image_get_software_region_length(image, "rom");
128   
128
129129   /* handle header accordingly */
130130   if ((size / 512) & 1)
131131   {
r8044r8045
148148      memcpy(ROM, image_get_software_region(image, "rom") + offset, size);
149149      extrainfo = NULL;
150150   }
151   
151
152152   if (extrainfo)
153153   {
154154      logerror("extrainfo: %s\n", extrainfo);
src/mess/machine/smc92x4.c
r8044r8045
11/*
2   HDC9224 and HDC9234 Hard and Floppy Disk Controller (HFDC)
2    HDC9224 and HDC9234 Hard and Floppy Disk Controller (HFDC)
33
4   This controller handles MFM and FM encoded floppy disks and hard disks.
5   The SMC9224 is used in some DEC systems.  The HDC9234 is used in the
6   Myarc HFDC card for the TI99/4a.  The main difference between the two
7   chips is the way the ECC bytes are computed; there are differences in
8   the way seek times are computed, too.
9   
10   References:
11   * SMC HDC9234 preliminary data book (1988)
12   
13   Michael Zapf, April 2010
4    This controller handles MFM and FM encoded floppy disks and hard disks.
5    The SMC9224 is used in some DEC systems.  The HDC9234 is used in the
6    Myarc HFDC card for the TI99/4a.  The main difference between the two
7    chips is the way the ECC bytes are computed; there are differences in
8    the way seek times are computed, too.
149
15   First version by Raphael Nabet, 2003
10    References:
11    * SMC HDC9234 preliminary data book (1988)
12
13    Michael Zapf, April 2010
14
15    First version by Raphael Nabet, 2003
1616*/
1717
1818#include "emu.h"
r8044r8045
7070#define CS_PRESDRV   0x03      /* present drive selected */
7171
7272/*
73   Definition of bits in the Mode register
73    Definition of bits in the Mode register
7474*/
7575#define MO_TYPE      0x80      /* Hard disk (1) or floppy (0) */
7676#define MO_CRCECC   0x60      /* Values for CRC/ECC handling */
r8044r8045
7979#define MO_STEPRATE   0x07      /* Step rates */
8080
8181/*
82   hfdc state structure
82    hfdc state structure
8383
84   status
85   ab7      ecc error
86   ab6      index pulse
87   ab5      seek complete
88   ab4      track 0
89   ab3      user-defined
90   ab2      write-protected
91   ab1      drive ready
92   ab0      write fault
93   
94   output1
95   ab7      drive select 3
96   ab6      drive select 2
97   ab5      drive select 1
98   ab4      drive select 0
99   ab3      programmable outputs
100   ab2      programmable outputs
101   ab1      programmable outputs
102   ab0      programmable outputs
103   
104   output2
105   ab7      drive select 3* (active low, used for tape operations)
106   ab6      reduce write current
107    ab5      step direction
108   ab4      step pulse
109   ab3      desired head 3
110   ab2      desired head 2
111   ab1      desired head 1
112   ab0      desired head 0
84    status
85    ab7     ecc error
86    ab6     index pulse
87    ab5     seek complete
88    ab4     track 0
89    ab3     user-defined
90    ab2     write-protected
91    ab1     drive ready
92    ab0     write fault
93
94    output1
95    ab7     drive select 3
96    ab6     drive select 2
97    ab5     drive select 1
98    ab4     drive select 0
99    ab3     programmable outputs
100    ab2     programmable outputs
101    ab1     programmable outputs
102    ab0     programmable outputs
103
104    output2
105    ab7     drive select 3* (active low, used for tape operations)
106    ab6     reduce write current
107    ab5     step direction
108    ab4     step pulse
109    ab3     desired head 3
110    ab2     desired head 2
111    ab1     desired head 1
112    ab0     desired head 0
113113*/
114114
115115#define OUT1_DRVSEL3   0x80
r8044r8045
125125#define OUT2_HEADSEL1   0x02
126126#define OUT2_HEADSEL0   0x01
127127
128#define DRIVE_TYPE    0x03
128#define DRIVE_TYPE   0x03
129129#define TYPE_AT    0x00
130130#define TYPE_FLOPPY    0x02  /* for testing on any floppy type */
131#define TYPE_FLOPPY8    0x02
132#define TYPE_FLOPPY5    0x03
131#define TYPE_FLOPPY8   0x02
132#define TYPE_FLOPPY5   0x03
133133
134134#define MAX_SECTOR_LEN 256
135135
136136#define FORMAT_LONG FALSE
137137
138#define ERROR    0
139#define DONE    1
138#define ERROR   0
139#define DONE   1
140140#define AGAIN   2
141141#define UNDEF   3
142142
143143typedef struct _smc92x4_state
144144{
145   devcb_resolved_write_line    out_intrq_func;      /* INT line */
146   devcb_resolved_write_line    out_dip_func;      /* DMA in progress line */
147   devcb_resolved_write8       out_auxbus_func;   /* AB0-7 lines (using S0,S1 as address) */
145   devcb_resolved_write_line   out_intrq_func;      /* INT line */
146   devcb_resolved_write_line   out_dip_func;      /* DMA in progress line */
147   devcb_resolved_write8      out_auxbus_func;   /* AB0-7 lines (using S0,S1 as address) */
148148   devcb_resolved_read_line   in_auxbus_func;      /* AB0-7 lines (only single case) */
149149
150150   UINT8 output1;      /* UDC-internal register "output1" */
151151   UINT8 output2;      /* UDC-internal register "output2" */
152   
152
153153   int   selected_drive_type;
154   /* We need to store the types, although this is not the case in the
155   real hardware. The reason is that poll_drives wants to select the drives
156   without knowing their kinds. In reality this does not matter, since we
157   only check for the seek_complete line, but in our case, floppy and
158   harddrive are pretty different, and we need to know which one to check. */
154   /* We need to store the types, although this is not the case in the
155    real hardware. The reason is that poll_drives wants to select the drives
156    without knowing their kinds. In reality this does not matter, since we
157    only check for the seek_complete line, but in our case, floppy and
158    harddrive are pretty different, and we need to know which one to check. */
159159   int   types[4];
160160   int   head_load_delay_enable;
161161   int   register_pointer;
162   
163   UINT8 register_r[12];   
164   UINT8 register_w[12];   
165162
163   UINT8 register_r[12];
164   UINT8 register_w[12];
165
166166   /* timers to delay execution/completion of commands */
167167   emu_timer *timer_data, *timer_rs, *timer_ws, *timer_seek, *timer_track;
168168
169169   /* Flag which determines whether to use realistic timing. */
170170   int use_real_timing;
171   
171
172172   /* Required to store the current iteration within restore. */
173173   int seek_count;
174   
174
175175   /* Recent command. */
176176   UINT8 command;
177   
177
178178   /* Stores the step direction. */
179179   int step_direction;
180   
180
181181   /* Stores the buffered flag. */
182182   int buffered;
183   
183
184184   /* Stores the recent id field. */
185185   chrn_id_hd recent_id;
186   
186
187187   /* Indicates whether an ID has been found. */
188188   int found_id;
189   
189
190190   /* Indicates whether we are already past the seek_id phase in read/write sector. */
191191   int after_seek;
192   
192
193193   /* Determines whether the command will be continued. */
194   int to_be_continued;   
195   
194   int to_be_continued;
195
196196   /* Pointer to interface */
197197   const smc92x4_interface *intf;
198   
198
199199} smc92x4_state;
200200
201/*
202   Step rates in microseconds for MFM. This is set in the mode register,
203   bits 0-2. Single density doubles all values.
201/*
202    Step rates in microseconds for MFM. This is set in the mode register,
203    bits 0-2. Single density doubles all values.
204204*/
205static const int step_hd[]    = { 22, 50, 100, 200, 400, 800, 1600, 3200 };
206static const int step_flop8[]    = { 218, 500, 1000, 2000, 4000, 8000, 16000, 32000 };
207static const int step_flop5[]    = { 436, 1000, 2000, 4000, 8000, 16000, 32000, 64000 };
205static const int step_hd[]   = { 22, 50, 100, 200, 400, 800, 1600, 3200 };
206static const int step_flop8[]   = { 218, 500, 1000, 2000, 4000, 8000, 16000, 32000 };
207static const int step_flop5[]   = { 436, 1000, 2000, 4000, 8000, 16000, 32000, 64000 };
208208
209/*
210   0.2 seconds for a revolution (300 rpm), +50% average waiting for index
211   hole. Should be properly done with the index hole detection; we're
212   simulating this with a timer for now.
209/*
210    0.2 seconds for a revolution (300 rpm), +50% average waiting for index
211    hole. Should be properly done with the index hole detection; we're
212    simulating this with a timer for now.
213213*/
214#define TRACKTIME_FLOPPY 300000   
215#define TRACKTIME_HD 1000   
214#define TRACKTIME_FLOPPY 300000
215#define TRACKTIME_HD 1000
216216
217217/*
218   Register names of the HDC. The left part is the set of write registers,
219   while the right part are the read registers.
218    Register names of the HDC. The left part is the set of write registers,
219    while the right part are the read registers.
220220*/
221enum
221enum
222222{
223    DMA7_0=0,
224   DMA15_8=1,
225   DMA23_16=2,
226   DESIRED_SECTOR=3,
227   DESIRED_HEAD=4,    CURRENT_HEAD=4,
228   DESIRED_CYLINDER=5,    CURRENT_CYLINDER=5,
229   SECTOR_COUNT=6,    CURRENT_IDENT=6,
230   RETRY_COUNT=7,       TEMP_STORAGE2=7,
223   DMA7_0=0,
224   DMA15_8=1,
225   DMA23_16=2,
226   DESIRED_SECTOR=3,
227   DESIRED_HEAD=4,    CURRENT_HEAD=4,
228   DESIRED_CYLINDER=5,    CURRENT_CYLINDER=5,
229   SECTOR_COUNT=6,    CURRENT_IDENT=6,
230   RETRY_COUNT=7,      TEMP_STORAGE2=7,
231231   MODE=8,       CHIP_STATUS=8,
232   INT_COMM_TERM=9,    DRIVE_STATUS=9,
233   DATA_DELAY=10,       DATA=10,
232   INT_COMM_TERM=9,   DRIVE_STATUS=9,
233   DATA_DELAY=10,      DATA=10,
234234   COMMAND=11,       INT_STATUS=11
235235};
236236
r8044r8045
319319   //assert(! (w->status & ST_DONE))
320320   smc92x4_state *w = get_safe_token(device);
321321   //printf("smc92x4 command %02x done, flags=%02x\n", w->command, flags);
322   
322
323323   w->register_r[INT_STATUS] |= ST_DONE;
324324   w->register_r[INT_STATUS] &= ~ST_TERMCOD; /* clear the previously set flags */
325325   w->register_r[INT_STATUS] |= flags;
326326
327   /* sm92x4 spec, p. 6 */   
327   /* sm92x4 spec, p. 6 */
328328   if (w->register_w[INT_COMM_TERM] & TC_INTDONE)
329329      smc92x4_set_interrupt(device);
330330}
331331
332332/*
333   Preserve previously set termination code
333    Preserve previously set termination code
334334*/
335335static void set_command_done(running_device *device)
336336{
r8044r8045
340340
341341   w->register_r[INT_STATUS] |= ST_DONE;
342342
343   /* sm92x4 spec, p. 6 */   
343   /* sm92x4 spec, p. 6 */
344344   if (w->register_w[INT_COMM_TERM] & TC_INTDONE)
345345      smc92x4_set_interrupt(device);
346346}
r8044r8045
358358}
359359
360360/*
361   Sets the DMA address on the external counter. This counter is attached
362   to the auxiliary bus on the PCB.
361    Sets the DMA address on the external counter. This counter is attached
362    to the auxiliary bus on the PCB.
363363*/
364364static void set_dma_address(running_device *device, int pos2316, int pos1508, int pos0700)
365{   
365{
366366   smc92x4_state *w = get_safe_token(device);
367367   devcb_call_write8(&w->out_auxbus_func, OUTPUT_DMA_ADDR, w->register_r[pos2316]);
368368   devcb_call_write8(&w->out_auxbus_func, OUTPUT_DMA_ADDR, w->register_r[pos1508]);
369   devcb_call_write8(&w->out_auxbus_func, OUTPUT_DMA_ADDR, w->register_r[pos0700]);   
369   devcb_call_write8(&w->out_auxbus_func, OUTPUT_DMA_ADDR, w->register_r[pos0700]);
370370}
371371
372372static void dma_add_offset(running_device *device, int offset)
r8044r8045
374374   smc92x4_state *w = get_safe_token(device);
375375   int dma_address = (w->register_w[DMA23_16]<<16) + (w->register_w[DMA15_8]<<8) + w->register_w[DMA7_0];
376376   dma_address += offset;
377   
377
378378   w->register_w[DMA23_16] = w->register_r[DMA23_16] = (dma_address & 0xff0000)>>16;
379379   w->register_w[DMA15_8]  = w->register_r[DMA15_8]  = (dma_address & 0x00ff00)>>8;
380380   w->register_w[DMA7_0]   = w->register_r[DMA7_0]   = (dma_address & 0x0000ff);
381381}
382382
383/*
384   Get the state from outside and latch it in the register.
385   There should be a bus driver on the PCB which provides the signals from
386   both the hard and floppy drives during S0=S1=0 and STB*=0 times via the
387   auxiliary bus.
383/*
384    Get the state from outside and latch it in the register.
385    There should be a bus driver on the PCB which provides the signals from
386    both the hard and floppy drives during S0=S1=0 and STB*=0 times via the
387    auxiliary bus.
388388*/
389389static void sync_status_in(running_device *device)
390390{
391391   UINT8 prev;
392392   smc92x4_state *w = get_safe_token(device);
393393
394   prev = w->register_r[DRIVE_STATUS];       
394   prev = w->register_r[DRIVE_STATUS];
395395   w->register_r[DRIVE_STATUS] = devcb_call_read_line(&w->in_auxbus_func);
396396
397397   /* Raise interrupt if ready changes. TODO: Check this more closely. */
398//   printf("disk status = %02x\n", reply);
398//  printf("disk status = %02x\n", reply);
399399   if (((w->register_r[DRIVE_STATUS] & DS_READY) != (prev & DS_READY))
400400      & (w->register_r[INT_STATUS] & ST_RDYCHNG))
401401   {
r8044r8045
404404}
405405
406406/*
407   Push the output registers over the auxiliary bus. It is expected that
408   the PCB contains latches to store the values.
407    Push the output registers over the auxiliary bus. It is expected that
408    the PCB contains latches to store the values.
409409*/
410static void sync_latches_out(running_device *device)
410static void sync_latches_out(running_device *device)
411411{
412412   smc92x4_state *w = get_safe_token(device);
413   w->output1 = (w->output1 & 0xf0) | (w->register_w[RETRY_COUNT]&0x0f);
413   w->output1 = (w->output1 & 0xf0) | (w->register_w[RETRY_COUNT]&0x0f);
414414
415415   devcb_call_write8(&w->out_auxbus_func, OUTPUT_OUTPUT1, w->output1);
416   devcb_call_write8(&w->out_auxbus_func, OUTPUT_OUTPUT2, w->output2);   
416   devcb_call_write8(&w->out_auxbus_func, OUTPUT_OUTPUT2, w->output2);
417417}
418418
419419/*************************************************************
420   Timed requests and callbacks
420    Timed requests and callbacks
421421*************************************************************/
422422#if 0
423423/* setup a timed data request - data request will be triggered in a few usecs time */
r8044r8045
425425{
426426   smc92x4_state *w = get_safe_token(device);
427427   int time = controller_set_to_single_density(device)? 128 : 32;
428   
428
429429   if (!w->use_real_timing)
430430      time = 1;
431   
431
432432   /* set new timer */
433433   timer_adjust_oneshot(w->timer_data, ATTOTIME_IN_USEC(time, 0));
434434}
r8044r8045
464464   if (w->selected_drive_type & TYPE_FLOPPY)
465465      time = (controller_set_to_single_density(device))? 30000 : 15000;
466466   else
467      time = 1000;     
467      time = 1000;
468468
469469   if (!w->use_real_timing)
470470      time = 1;
r8044r8045
473473   w->to_be_continued = TRUE;
474474}
475475
476/*
477   Set up a timed track read/write
476/*
477    Set up a timed track read/write
478478*/
479479static void smc92x4_timed_track_request(running_device *device)
480480{
481481   smc92x4_state *w = get_safe_token(device);
482482   int time = 0;
483   
483
484484   if (w->selected_drive_type & TYPE_FLOPPY)
485485      time = TRACKTIME_FLOPPY;
486486   else
487487      time = TRACKTIME_HD;
488   
488
489489   if (!w->use_real_timing)
490490      time = 1;
491491
492492   timer_adjust_oneshot(w->timer_track, ATTOTIME_IN_USEC(time), 0);
493   
493
494494   w->to_be_continued = TRUE;
495495}
496496
497/*
498   Set up a timed track seek
497/*
498    Set up a timed track seek
499499*/
500500static void smc92x4_timed_seek_request(running_device *device)
501501{
r8044r8045
504504
505505   int index = w->register_w[MODE] & MO_STEPRATE;
506506   int fm = controller_set_to_single_density(device);
507   
507
508508   /* Get seek time. */
509509   if ((w->selected_drive_type & DRIVE_TYPE) == TYPE_FLOPPY8)
510510      time = step_flop8[index];
511511
512512   else if ((w->selected_drive_type & DRIVE_TYPE) == TYPE_FLOPPY5)
513      time = step_flop5[index];     
514   else
513      time = step_flop5[index];
514   else
515515      time = step_hd[index];
516516
517   if (fm)
517   if (fm)
518518      time = time * 2;
519   
519
520520   if (!w->use_real_timing)
521521   {
522522      logerror("smc92x4 info: Disk access without delays\n");
523      time = 1;   
523      time = 1;
524524   }
525   
525
526526   timer_adjust_oneshot(w->timer_seek, ATTOTIME_IN_USEC(time), 0);
527527   w->to_be_continued = TRUE;
528528}
r8044r8045
530530#if 0
531531static TIMER_CALLBACK(smc92x4_data_callback)
532532{
533/*   running_device *device = (running_device *)ptr;
534   smc92x4_state *w = get_safe_token(device); */
533/*  running_device *device = (running_device *)ptr;
534    smc92x4_state *w = get_safe_token(device); */
535535}
536536#endif
537537
538538static TIMER_CALLBACK(smc92x4_read_sector_callback)
539539{
540540   running_device *device = (running_device *)ptr;
541   smc92x4_state *w = get_safe_token(device);
541   smc92x4_state *w = get_safe_token(device);
542542   int transfer_enabled = w->command & 0x01;
543543
544544   /* Now read the sector. */
r8044r8045
550550static TIMER_CALLBACK(smc92x4_write_sector_callback)
551551{
552552   running_device *device = (running_device *)ptr;
553   smc92x4_state *w = get_safe_token(device);
553   smc92x4_state *w = get_safe_token(device);
554554   int deldata = w->command & 0x10;
555555   int redcur =  w->command & 0x08;
556556   int precomp = w->command & 0x07;
r8044r8045
566566}
567567
568568/*
569   Callback for track access. Nothing interesting here, just used for
570   delaying.
569    Callback for track access. Nothing interesting here, just used for
570    delaying.
571571*/
572572static TIMER_CALLBACK(smc92x4_track_callback)
573573{
r8044r8045
577577}
578578
579579/*
580   Callback for seek request.
580    Callback for seek request.
581581*/
582582static TIMER_CALLBACK(smc92x4_seek_callback)
583583{
584584   running_device *device = (running_device *)ptr;
585585   smc92x4_state *w = get_safe_token(device);
586586   running_device *current_floppy = NULL;
587/*   int buffered = ((w->register_w[MODE] & MO_STEPRATE)==0); */
588/*    int buffered = (w->command & 0x01); */
587/*  int buffered = ((w->register_w[MODE] & MO_STEPRATE)==0); */
588/*  int buffered = (w->command & 0x01); */
589589
590590   if (w->selected_drive_type & TYPE_FLOPPY)
591591   {
r8044r8045
604604   else
605605   {
606606      // printf("smc92x4 step harddisk direction %d\n", w->step_direction);
607      (*w->intf->mfmhd_seek)(w->step_direction);
608   }   
607      (*w->intf->mfmhd_seek)(w->step_direction);
608   }
609609   sync_status_in(device);
610610
611611   smc92x4_process_after_callback(device);
612612}
613613
614614/*********************************************************************
615   Common functions
615    Common functions
616616*********************************************************************/
617617
618618/*
619   Calculate the ident byte from the cylinder. The specification does not
620   define idents beyond cylinder 1023, but formatting programs seem to
621   continue with 0xfd for cylinders between 1024 and 2047.
619    Calculate the ident byte from the cylinder. The specification does not
620    define idents beyond cylinder 1023, but formatting programs seem to
621    continue with 0xfd for cylinders between 1024 and 2047.
622622*/
623623UINT8 cylinder_to_ident(int cylinder)
624624{
r8044r8045
630630}
631631
632632/*
633   Calculate the offset from the ident. This is only useful for AT drives;
634   these drives cannot have more than 1024 cylinders.
633    Calculate the offset from the ident. This is only useful for AT drives;
634    these drives cannot have more than 1024 cylinders.
635635*/
636636static int ident_to_cylinder(UINT8 ident)
637637{
r8044r8045
646646}
647647
648648/*
649   Common function to set the read registers from the recently read id.
649    Common function to set the read registers from the recently read id.
650650*/
651651static void update_id_regs(running_device *device, chrn_id_hd id)
652652{
653   /* Flags for current head register. Note that the sizes are not in
654      sequence (128, 256, 512, 1024). This is only interesting for AT
655      mode. */
653   /* Flags for current head register. Note that the sizes are not in
654       sequence (128, 256, 512, 1024). This is only interesting for AT
655       mode. */
656656   UINT8 sizeflag[] = { 0x60, 0x00, 0x20, 0x40 };
657657   smc92x4_state *w = get_safe_token(device);
658658
r8044r8045
660660
661661   w->register_r[CURRENT_HEAD] = id.H & 0x0f;
662662
663   if (id.flags & BAD_SECTOR)
663   if (id.flags & BAD_SECTOR)
664664      w->register_r[CURRENT_HEAD] |= 0x80;
665665
666   if ((w->selected_drive_type & DRIVE_TYPE) == TYPE_AT)
666   if ((w->selected_drive_type & DRIVE_TYPE) == TYPE_AT)
667667      w->register_r[CURRENT_HEAD] |= sizeflag[id.N];
668668   else
669669      w->register_r[CURRENT_HEAD] |= ((id.C & 0x700)>>4);
r8044r8045
672672}
673673
674674/*
675   Common procedure: read_id_field (as described in the specification)
675    Common procedure: read_id_field (as described in the specification)
676676*/
677677static void read_id_field(running_device *device, int *steps, int *direction, chrn_id_hd *id)
678678{
r8044r8045
681681   int found = FALSE;
682682   sync_latches_out(device);
683683   sync_status_in(device);
684   
685   /* Set command termination code. The error code is set first, and
686      on success, it is cleared. */
684
685   /* Set command termination code. The error code is set first, and
686       on success, it is cleared. */
687687   w->register_r[INT_STATUS] |= ST_TC_RDIDERR;
688   
688
689689   /* Try to find an ID field. */
690690   if (w->selected_drive_type & TYPE_FLOPPY)
691691   {
r8044r8045
697697         w->register_r[CHIP_STATUS] |= CS_SYNCERR;
698698         return;
699699      }
700     
700
701701      /* Check whether image and controller are set to the same density. */
702702      if ((image_is_single_density(disk_img) && controller_set_to_single_density(device))
703703         || (!image_is_single_density(disk_img) && !controller_set_to_single_density(device))
r8044r8045
712712      }
713713      sync_status_in(device);
714714
715      if (!found)
715      if (!found)
716716      {
717717         logerror("smc92x4 error: read_id_field (floppy): sync error\n");
718718         w->register_r[CHIP_STATUS] |= CS_SYNCERR;
r8044r8045
730730         return;
731731      }
732732   }
733   
733
734734   w->register_r[CHIP_STATUS] &= ~CS_SYNCERR;
735   
735
736736   /* Update the registers. */
737737   update_id_regs(device, *id);
738   
738
739739   if (id->flags & BAD_CRC)
740740   {
741741      w->register_r[CHIP_STATUS] |= CS_CRCERR;
742742      return;
743743   }
744   
745   /* Calculate the steps. */
744
745   /* Calculate the steps. */
746746   if ((w->selected_drive_type & DRIVE_TYPE) == TYPE_AT)
747747   {
748      /* Note: the spec says CURRENT_REGISTER, but that seems wrong. */
748      /* Note: the spec says CURRENT_REGISTER, but that seems wrong. */
749749      des_cylinder = ((w->register_r[DATA] & 0x03)<<8) | w->register_w[DESIRED_CYLINDER];
750      cur_cylinder = ident_to_cylinder(w->register_r[CURRENT_IDENT]) + w->register_r[CURRENT_CYLINDER];
750      cur_cylinder = ident_to_cylinder(w->register_r[CURRENT_IDENT]) + w->register_r[CURRENT_CYLINDER];
751751   }
752752   else
753753   {
754754      des_cylinder = ((w->register_w[DESIRED_HEAD] & 0x70)<<4) | w->register_w[DESIRED_CYLINDER];
755755      cur_cylinder = ((w->register_r[CURRENT_HEAD] & 0x70)<<4) | w->register_r[CURRENT_CYLINDER];
756756   }
757     
757
758758   if (des_cylinder >= cur_cylinder)
759759   {
760760      *steps = des_cylinder - cur_cylinder;
r8044r8045
766766      *direction = -1;
767767   }
768768
769   //printf("smc92x4 seek required: %d steps\n", *steps);
770   
769   //printf("smc92x4 seek required: %d steps\n", *steps);
770
771771   w->register_r[INT_STATUS] &= ~ST_TC_RDIDERR;
772772   return;
773773}
774774
775775/*
776   Common procedure: verify (as described in the specification)
776    Common procedure: verify (as described in the specification)
777777*/
778778static int verify(running_device *device, chrn_id_hd *id, int check_sector)
779779{
r8044r8045
783783   int found = FALSE;
784784   int foundsect = FALSE;
785785   int des_cylinder = 0;
786   
787   /* Set command termination code. The error code is set first, and
788      on success, it is cleared. */
786
787   /* Set command termination code. The error code is set first, and
788       on success, it is cleared. */
789789   w->register_r[INT_STATUS] |= ST_TC_SEEKERR;
790   
790
791791   while (pass < maxtry && !foundsect)
792792   {
793793      pass++;
r8044r8045
816816            return ERROR;
817817         }
818818      }
819     
819
820820      w->register_r[CHIP_STATUS] &= ~CS_SYNCERR;
821     
821
822822      /* Compare with the desired sector ID. */
823823      if ((w->selected_drive_type & DRIVE_TYPE) == TYPE_AT)
824824      {
825         /* Note: the spec says CURRENT_CYLINDER, but that seems wrong. */
825         /* Note: the spec says CURRENT_CYLINDER, but that seems wrong. */
826826         des_cylinder = ((w->register_r[DATA] & 0x03)<<8) | w->register_w[DESIRED_CYLINDER];
827827      }
828828      else
829829      {
830830         des_cylinder = ((w->register_w[DESIRED_HEAD] & 0x70)<<4) | w->register_w[DESIRED_CYLINDER];
831831      }
832//      printf("smc92x4 check id: current = (%d,%d,%d), required = (%d,%d,%d)\n", id->C, id->H, id->R, des_cylinder, w->register_w[DESIRED_HEAD] & 0x0f, w->register_w[DESIRED_SECTOR]);
833      if ((des_cylinder == id->C)
832//      printf("smc92x4 check id: current = (%d,%d,%d), required = (%d,%d,%d)\n", id->C, id->H, id->R, des_cylinder, w->register_w[DESIRED_HEAD] & 0x0f, w->register_w[DESIRED_SECTOR]);
833      if ((des_cylinder == id->C)
834834         && ((w->register_w[DESIRED_HEAD] & 0x0f) == id->H))
835835      {
836836         if (!check_sector ||  (w->register_w[DESIRED_SECTOR] == id->R))
837837            foundsect = TRUE;
838838      }
839   }   
839   }
840840   if (!foundsect)
841841   {
842842      w->register_r[CHIP_STATUS] |= CS_COMPERR;
843843      logerror("smc92x4 error: verify: sector not found, seek error (desired cyl=%d/sec=%d, current cyl=%d/sec=%d)\n", des_cylinder, w->register_w[DESIRED_SECTOR], id->C, id->R);
844844      return ERROR;
845845   }
846   
846
847847   w->register_r[INT_STATUS] &= ~ST_TC_SEEKERR;
848848   return DONE;
849849}
850850
851851/*
852   Common procedure: data_transfer(read) (as described in the specification)
852    Common procedure: data_transfer(read) (as described in the specification)
853853*/
854854static void data_transfer_read(running_device *device, chrn_id_hd id, int transfer_enable)
855855{
856856   int i, retry, sector_len;
857857   smc92x4_state *w = get_safe_token(device);
858   running_device *current_floppy = NULL;
859   
858   running_device *current_floppy = NULL;
859
860860   int sector_data_id;
861861   UINT8 *buf;
862   
862
863863   sync_latches_out(device);
864864   sync_status_in(device);
865   
865
866866   current_floppy = (*w->intf->current_floppy)();
867867
868   /* Set command termination code. The error code is set first, and
869      on success, it is cleared. */
868   /* Set command termination code. The error code is set first, and
869       on success, it is cleared. */
870870   w->register_r[INT_STATUS] |= ST_TC_DATAERR;
871   
871
872872   /* Save the value. Note that the retry count is only in the first four
873   bits, and it is stored in one's complement. In this implementation
874   we don't work with it. */
873    bits, and it is stored in one's complement. In this implementation
874    we don't work with it. */
875875   retry = w->register_w[RETRY_COUNT];
876   
876
877877   /* We are already at the correct sector (found by the verify sequence) */
878   
878
879879   /* Find the data sync mark. Easy, we assume it has been found. */
880   
880
881881   if (id.flags & ID_FLAG_DELETED_DATA)
882882      w->register_r[CHIP_STATUS] |= CS_DELDATA;
883883   else
884884      w->register_r[CHIP_STATUS] &= ~CS_DELDATA;
885   
885
886886   /* Found. Now update the current cylinder/head registers. */
887887   update_id_regs(device, id);
888   
888
889889   /* Initiate the DMA. We assume the DMARQ is positive. */
890   w->register_r[INT_STATUS] &= ~ST_OVRUN;   
890   w->register_r[INT_STATUS] &= ~ST_OVRUN;
891891
892892   sector_len = 1 << (id.N+7);
893893   sector_data_id = id.data_id;
894   
894
895895   if (w->selected_drive_type & TYPE_FLOPPY)
896896   {
897897      buf = (UINT8 *)malloc(sector_len);
r8044r8045
903903      (*w->intf->mfmhd_read_sector)(id.C, id.H, id.R, &buf, &sector_len);
904904   }
905905   sync_status_in(device);
906   
906
907907   if (transfer_enable)
908908   {
909909      /* Copy via DMA into controller RAM. */
910910      set_dma_address(device, DMA23_16, DMA15_8, DMA7_0);
911     
911
912912      smc92x4_set_dip(device, TRUE);
913913      for (i=0; i < sector_len; i++)
914914      {
r8044r8045
922922   w->register_r[CHIP_STATUS] &= ~CS_RETREQ;
923923   w->register_r[CHIP_STATUS] &= ~CS_CRCERR;
924924   w->register_r[CHIP_STATUS] &= ~CS_ECCATT;
925   
925
926926   /* Update the DMA registers. */
927927   if (transfer_enable)
928928      dma_add_offset(device, sector_len);
r8044r8045
932932
933933   /* Clear the error bits. */
934934   w->register_r[INT_STATUS] &= ~ST_TC_DATAERR;
935   
935
936936   if (w->register_w[SECTOR_COUNT] == 0)
937937      return;
938     
938
939939   /* Else this is a multi-sector operation. */
940   w->register_w[DESIRED_SECTOR] =
941   w->register_r[DESIRED_SECTOR] =
940   w->register_w[DESIRED_SECTOR] =
941   w->register_r[DESIRED_SECTOR] =
942942      (w->register_w[DESIRED_SECTOR]+1) & 0xff;
943     
943
944944   /* Reinitialize retry count. */
945945   w->register_w[RETRY_COUNT] = retry;
946946}
947947
948948/*
949   Common procedure: data_transfer(write) (as described in the specification)
949    Common procedure: data_transfer(write) (as described in the specification)
950950*/
951951static void data_transfer_write(running_device *device, chrn_id_hd id, int deldata, int redcur, int precomp, int write_long)
952952{
r8044r8045
955955   running_device *current_floppy = NULL;
956956   UINT8 *buf;
957957   int sector_data_id;
958   
958
959959   sync_latches_out(device);
960960   sync_status_in(device);
961   
961
962962   current_floppy = (*w->intf->current_floppy)();
963   
964   /* Set command termination code. The error code is set first, and
965      on success, it is cleared. */
963
964   /* Set command termination code. The error code is set first, and
965       on success, it is cleared. */
966966   w->register_r[INT_STATUS] |= ST_TC_DATAERR;
967   
967
968968   /* Save the value. Note that the retry count is only in the first four
969   bits, and it is stored in one's complement. In this implementation
970   we don't work with it. */
969    bits, and it is stored in one's complement. In this implementation
970    we don't work with it. */
971971   retry = w->register_w[RETRY_COUNT];
972     
972
973973   /* Initiate the DMA. We assume the DMARQ is positive. */
974   w->register_r[INT_STATUS] &= ~ST_OVRUN;   
974   w->register_r[INT_STATUS] &= ~ST_OVRUN;
975975
976976   sector_len = 1 << (id.N+7);
977977   sector_data_id = id.data_id;
978   
978
979979   buf = (UINT8 *)malloc(sector_len);
980980
981981   /* Copy via DMA from controller RAM. */
982982   set_dma_address(device, DMA23_16, DMA15_8, DMA7_0);
983   
983
984984   smc92x4_set_dip(device, TRUE);
985985   for (i=0; i<sector_len; i++)
986986   {
987987      buf[i] = (*w->intf->dma_read_callback)();
988988   }
989989   smc92x4_set_dip(device, FALSE);
990   
990
991991   if (write_long)
992992   {
993993      logerror("smc92x4 write sector: Write_long not supported. Performing a normal write.\n");
994994   }
995   
995
996996   if (w->selected_drive_type & TYPE_FLOPPY)
997997   {
998998      floppy_drive_write_sector_data(current_floppy, id.H, sector_data_id, (char *) buf, sector_len, FALSE);
r8044r8045
10031003   }
10041004   free(buf);
10051005   sync_status_in(device);
1006   
1006
10071007   w->register_r[CHIP_STATUS] &= ~CS_RETREQ;
10081008   w->register_r[CHIP_STATUS] &= ~CS_CRCERR;
10091009   w->register_r[CHIP_STATUS] &= ~CS_ECCATT;
1010   
1010
10111011   /* Update the DMA registers. */
10121012   dma_add_offset(device, sector_len);
10131013
r8044r8045
10161016
10171017   /* Clear the error bits. */
10181018   w->register_r[INT_STATUS] &= ~ST_TC_DATAERR;
1019   
1019
10201020   if (w->register_w[SECTOR_COUNT] == 0)
10211021      return;
1022     
1022
10231023   /* Else this is a multi-sector operation. */
1024   w->register_w[DESIRED_SECTOR] =
1025   w->register_r[DESIRED_SECTOR] =
1024   w->register_w[DESIRED_SECTOR] =
1025   w->register_r[DESIRED_SECTOR] =
10261026      (w->register_w[DESIRED_SECTOR]+1) & 0xff;
1027     
1027
10281028   /* Reinitialize retry count. */
10291029   w->register_w[RETRY_COUNT] = retry;
10301030}
r8044r8045
10331033static void write_sectors_continue(running_device *device);
10341034
10351035/*
1036   Read sectors physical / logical. Physical means that the first, the
1037   second, the third sector appearing under the head will be read. These
1038   sectors are usually not in logical sequence. The ordering depends on
1039   the interleave pattern.
1036    Read sectors physical / logical. Physical means that the first, the
1037    second, the third sector appearing under the head will be read. These
1038    sectors are usually not in logical sequence. The ordering depends on
1039    the interleave pattern.
10401040*/
10411041static void read_write_sectors(running_device *device)
10421042{
r8044r8045
10451045   int logical = w->command & 0x04;
10461046   int implied_seek_disabled = w->command & 0x02; /* for read */
10471047   int write = (w->command & 0x80);
1048   
1048
10491049   w->after_seek = FALSE;
1050   
1050
10511051   w->to_be_continued = FALSE;
1052   
1052
10531053   if (write) /* write sectors */
10541054   {
10551055      logical = w->command & 0x20;
10561056      implied_seek_disabled = w->command & 0x40;
10571057   }
1058   
1059   if (!logical)
1058
1059   if (!logical)
10601060      implied_seek_disabled = FALSE;
1061         
1061
10621062   if (!w->found_id)
10631063   {
10641064      /* First start. */
10651065      read_id_field(device, &w->seek_count, &w->step_direction, &w->recent_id);
10661066   }
1067   
1067
10681068   if ((w->register_r[INT_STATUS] & ST_TC_DATAERR) == ST_TC_SUCCESS)
1069   {   
1069   {
10701070      w->found_id = TRUE;
10711071      /* Perform the seek for the cylinder. */
10721072      if (!implied_seek_disabled && w->seek_count > 0)
r8044r8045
10801080         else
10811081            read_sectors_continue(device);
10821082      }
1083         
1083
10841084   }
10851085   else
10861086   {
r8044r8045
11171117      {
11181118         logerror("smc92x4 error: data error during sector read: INTSTATUS=%02x\n", w->register_r[INT_STATUS]);
11191119         set_command_done(device, ST_TC_DATAERR);
1120         return;         
1120         return;
11211121      }
11221122   }
11231123
11241124   w->to_be_continued = FALSE;
1125   
1125
11261126   /* Wait for SEEK_COMPLETE. We assume the signal has appeared. */
1127   
1127
11281128   if (w->register_w[SECTOR_COUNT] > 0 /* && !(w->register_r[DRIVE_STATUS] & DS_INDEX) */)
11291129   {
11301130      /* Call the verify sequence. */
r8044r8045
11371137      }
11381138
11391139      /* For read physical, only verify the first sector. */
1140      if (!logical)
1140      if (!logical)
11411141         check_sector = FALSE;
1142     
1142
11431143      if (w->recent_id.flags & BAD_SECTOR)
11441144      {
11451145         logerror("smc92x4 error: Bad sector, seek error\n");
r8044r8045
11471147      }
11481148      else
11491149      {
1150/*      printf("smc92x4 read sectors CYL=%02x, HEA=%02x, SEC=%02x, MOD=%02x, CNT=%02x, TRY=%02x\n",
1151         w->register_w[DESIRED_CYLINDER],
1152         w->register_w[DESIRED_HEAD],
1153         w->register_w[DESIRED_SECTOR],
1154         w->register_w[MODE],
1155         w->register_w[SECTOR_COUNT],
1156         w->register_w[RETRY_COUNT]); */
1150/*      printf("smc92x4 read sectors CYL=%02x, HEA=%02x, SEC=%02x, MOD=%02x, CNT=%02x, TRY=%02x\n",
1151            w->register_w[DESIRED_CYLINDER],
1152            w->register_w[DESIRED_HEAD],
1153            w->register_w[DESIRED_SECTOR],
1154            w->register_w[MODE],
1155            w->register_w[SECTOR_COUNT],
1156            w->register_w[RETRY_COUNT]); */
11571157         smc92x4_timed_sector_read_request(device);
11581158      }
11591159   }
r8044r8045
11711171   int check_sector = TRUE; /* always check the first sector */
11721172   int state = AGAIN;
11731173   int logical = w->command & 0x20;
1174   
1174
11751175   /* Needed for the two ways of re-entry: during the seek process, and during sector write */
11761176   if (!w->after_seek)
11771177   {
r8044r8045
11911191      {
11921192         logerror("smc92x4 error: data error during sector write\n");
11931193         set_command_done(device, ST_TC_DATAERR);
1194         return;         
1194         return;
11951195      }
11961196   }
1197   
1197
11981198   w->to_be_continued = FALSE;
11991199
12001200   if ((w->register_w[RETRY_COUNT] & 0xf0)!= 0xf0)
12011201      logerror("smc92x4 warn: RETRY_COUNT in write sector should be set to 0. Ignored.\n");
12021202
1203   /* Wait for SEEK_COMPLETE. We assume the signal has appeared. */     
1203   /* Wait for SEEK_COMPLETE. We assume the signal has appeared. */
12041204   if (w->register_w[SECTOR_COUNT] > 0)
12051205   {
12061206      /* Call the verify sequence. */
r8044r8045
12121212      }
12131213
12141214      /* For write physical, only verify the first sector. */
1215      if (!logical)
1215      if (!logical)
12161216         check_sector = FALSE;
12171217
1218/*      printf("smc92x4 write sectors CYL=%02x, HEA=%02x, SEC=%02x, MOD=%02x, CNT=%02x, TRY=%02x\n",
1219         w->register_w[DESIRED_CYLINDER],
1220         w->register_w[DESIRED_HEAD],
1221         w->register_w[DESIRED_SECTOR],
1222         w->register_w[MODE],
1223         w->register_w[SECTOR_COUNT],
1224         w->register_w[RETRY_COUNT]); */
1218/*      printf("smc92x4 write sectors CYL=%02x, HEA=%02x, SEC=%02x, MOD=%02x, CNT=%02x, TRY=%02x\n",
1219            w->register_w[DESIRED_CYLINDER],
1220            w->register_w[DESIRED_HEAD],
1221            w->register_w[DESIRED_SECTOR],
1222            w->register_w[MODE],
1223            w->register_w[SECTOR_COUNT],
1224            w->register_w[RETRY_COUNT]); */
12251225      smc92x4_timed_sector_write_request(device);
12261226   }
12271227   else
r8044r8045
12321232}
12331233
12341234/*********************************************************************
1235   Command implementations
1235    Command implementations
12361236*********************************************************************/
12371237
12381238/*
r8044r8045
12411241static void restore_drive(running_device *device)
12421242{
12431243   smc92x4_state *w = get_safe_token(device);
1244   
1244
12451245   /* TODO: int_after_seek_complete required for buffered seeks */
12461246   sync_status_in(device);
12471247
r8044r8045
12511251      w->register_r[INT_STATUS] |= ST_TC_SEEKERR;
12521252      return;
12531253   }
1254   
1254
12551255   if (w->register_r[DRIVE_STATUS] & DS_TRK00)
12561256   {
12571257      w->register_r[INT_STATUS] |= ST_TC_SUCCESS;
12581258      /* Issue interrupt */
12591259      smc92x4_set_interrupt(device);
1260      return;     
1260      return;
12611261   }
12621262
12631263   w->step_direction = -1;
r8044r8045
12691269   smc92x4_state *w = get_safe_token(device);
12701270
12711271   w->seek_count++;
1272   
1272
12731273   /* Next iteration */
1274   restore_drive(device);
1274   restore_drive(device);
12751275
12761276   w->to_be_continued = FALSE;
12771277}
12781278
12791279/*
1280   Handle the step command. Note that the CURRENT_CYLINDER register is not
1281   updated (this would break the format procedure).
1280    Handle the step command. Note that the CURRENT_CYLINDER register is not
1281    updated (this would break the format procedure).
12821282*/
12831283static void step_in_out(running_device *device)
12841284{
12851285   smc92x4_state *w = get_safe_token(device);
12861286   int direction = (w->command & 0x02)? -1 : +1;
12871287   /* bit 0: 0 -> command ends after last seek pulse, 1 -> command
1288   ends when the drive asserts the seek complete pin */
1288    ends when the drive asserts the seek complete pin */
12891289   int buffered = w->command & 0x01;
1290   
1290
12911291   w->step_direction = direction;
12921292   w->buffered = buffered;
12931293
r8044r8045
13071307static void drive_select(running_device *device, int drive);
13081308
13091309/*
1310   Poll drives
1311   This command is used to find out which drive has complete a buffered
1312   seek (RESTORE, SEEK IN/OUT with BUFFERED set to one)
1310    Poll drives
1311    This command is used to find out which drive has complete a buffered
1312    seek (RESTORE, SEEK IN/OUT with BUFFERED set to one)
13131313*/
13141314static void poll_drives(running_device *device)
13151315{
r8044r8045
13171317   smc92x4_state *w = get_safe_token(device);
13181318   int i;
13191319   int flags = w->command & 0x0f;
1320   
1320
13211321/* Spec is unclear: Do we continue to poll the drives after we have checked each
13221322one for the first time? We are not interested in locking up the emulator, so
13231323we decide to poll only once. */
r8044r8045
13391339{
13401340   smc92x4_state *w = get_safe_token(device);
13411341
1342   w->output1 = (0x10 << (driveparm & 0x03)) | (w->register_w[RETRY_COUNT]&0x0f);
1342   w->output1 = (0x10 << (driveparm & 0x03)) | (w->register_w[RETRY_COUNT]&0x0f);
13431343   w->selected_drive_type = (driveparm>>2) & 0x03;
13441344   w->head_load_delay_enable = (driveparm>>4)&0x01;
1345   
1345
13461346   /* We need to store the type of the drive for the poll_drives command
1347      to be able to correctly select the device (floppy or hard disk). */
1347       to be able to correctly select the device (floppy or hard disk). */
13481348   w->types[driveparm&0x03] = w->selected_drive_type;
13491349
1350   /* Copy the DMA registers to registers CURRENT_HEAD, CURRENT_CYLINDER,
1351   and CURRENT_IDENT. This is required during formatting (p. 14) as the
1352   format command reuses the registers for formatting parameters. */
1350   /* Copy the DMA registers to registers CURRENT_HEAD, CURRENT_CYLINDER,
1351    and CURRENT_IDENT. This is required during formatting (p. 14) as the
1352    format command reuses the registers for formatting parameters. */
13531353   w->register_r[CURRENT_HEAD] = w->register_r[DMA7_0];
13541354   w->register_r[CURRENT_CYLINDER] = w->register_r[DMA15_8];
13551355   w->register_r[CURRENT_IDENT] = w->register_r[DMA23_16];
1356   
1356
13571357   sync_latches_out(device);
13581358   sync_status_in(device);
13591359}
13601360
13611361/*
1362   Command SEEK/READID
1362    Command SEEK/READID
13631363*/
13641364static void seek_read_id(running_device *device)
13651365{
13661366   smc92x4_state *w = get_safe_token(device);
13671367   int step_enable = (w->command & 0x04);
13681368   int verify_id = (w->command & 0x01);
1369   int wait = (w->command & 0x02);
1369   int wait = (w->command & 0x02);
13701370
13711371   w->to_be_continued = FALSE;
1372   
1372
13731373   if (!w->found_id)
13741374   {
13751375      /* First start. */
13761376      read_id_field(device, &w->seek_count, &w->step_direction, &w->recent_id);
13771377      w->found_id = TRUE;
13781378   }
1379   
1379
13801380   if ((w->register_r[INT_STATUS] & ST_TC_DATAERR) == ST_TC_SUCCESS)
1381   {   
1381   {
13821382      /* Perform the seek for the cylinder. */
13831383      if (step_enable && w->seek_count > 0)
13841384      {
r8044r8045
13881388      {
13891389         if (wait)
13901390            logerror("smc92x4:seed_read_id: Waiting for seek_complete not implemented.\n");
1391         
1391
13921392         if (verify_id)
13931393         {
13941394            verify(device, &w->recent_id, TRUE);
r8044r8045
14101410}
14111411
14121412/*
1413   Formats a track starting from the detection of an index mark until the
1414   detection of another index mark.
1415   The formatting is done exclusively by the controller; user programs may
1416   set parameters for gaps and interleaving.
1413    Formats a track starting from the detection of an index mark until the
1414    detection of another index mark.
1415    The formatting is done exclusively by the controller; user programs may
1416    set parameters for gaps and interleaving.
14171417
1418   1. Before starting the command, the user program must have set up a
1419   sector sequence table in the controller RAM (located on the PCB):
1420   (ident, cylinder, head, sector1, size)  (5 bytes)
1421   (ident, cylinder, head, sector2, size)
1422   (ident, cylinder, head, sector3, size)
1423   ...
1424   ident is not required for floppy FM operation. size is not required
1425   for IBM AT-compatible hard disks.
1426   
1427   2. The DMA registers must point to the beginning of the table
1428   
1429   3. DRIVE_SELECT must be executed (which moves DMA regs to CUR_HEAD ...)
1430   
1431   4. DESIRED_HEAD register must be loaded
1432   
1433   5. The following setup must be done:
1434   
1435   GAP 0 size      DMA7_0         (2s comp)
1436   GAP 1 size      DMA15_8         (2s comp)
1437   GAP 2 size      DMA23_16      (2s comp)
1438   GAP 3 size      DESIRED_SECTOR      (2s comp)
1439   Sync size      DESIRED_CYLINDER   (1s comp)
1440   Sector count      SECTOR_COUNT      (1s comp)
1441   Sector size multiple   RETRY_COUNT       (1s comp)
1418    1. Before starting the command, the user program must have set up a
1419    sector sequence table in the controller RAM (located on the PCB):
1420    (ident, cylinder, head, sector1, size)  (5 bytes)
1421    (ident, cylinder, head, sector2, size)
1422    (ident, cylinder, head, sector3, size)
1423    ...
1424    ident is not required for floppy FM operation. size is not required
1425    for IBM AT-compatible hard disks.
14421426
1443   GAP4 is variable and fills the rest of the track until the next
1444   index hole. Usually we have 247 bytes for FM and 598 for MFM.
1445   
1446   6. The step rate and density must be loaded into the MODE register
1427    2. The DMA registers must point to the beginning of the table
14471428
1448   7. The drive must be stepped to the desired track.
1429    3. DRIVE_SELECT must be executed (which moves DMA regs to CUR_HEAD ...)
14491430
1450   8. Now this command may be started.
1451   
1452   All data bytes of a sector are filled with 0xe5. The gaps will be filled
1453   with 0x4e (MFM) or 0xff (FM).
1454   
1455   To format another track, the sector id table must be updated, and steps
1456   7 and 8 must be repeated. If the DESIRED_HEAD register must be updated,
1457   the complete setup process must be done.
1458   
1459   Options: Command = 011m rppp
1460   m = set data mark (0 = set deleted)
1461   r = current (1 = reduced)
1462   ppp = precompensation (for sector size = (2^ppp) * 128; ppp<4 for floppy )   
1463   
1464   ===============
1465   
1466   One deviation from the specification: The TI-99 family uses the SDF
1467   and TDF formats. The TDF formats complies with the formats produced
1468   by the standard TI disk controller. It does not use index address marks.
1469   So we could integrate a translation in ti99_dsk when writing to disk,
1470   but when reading, how can ti99_dsk know whether to blow up the format
1471   to full length for this controller or keep it as is for the other
1472   controller? Unless someone comes up with a better idea, we implement
1473   an "undocumented" option in this controller, allowing to create a
1474   different track layout.   
1475   
1476   So there are two layouts for the floppy track:
1477   
1478   - full format, including the index address mark, according to the
1479     specification
1480     
1481   - short format without index AM which matches the PC99 format used
1482     for the TI-99 family.
1483     
1484   The formats are determined by setting the flag in the smc92x4
1485   interface structure.
1431    4. DESIRED_HEAD register must be loaded
1432
1433    5. The following setup must be done:
1434
1435    GAP 0 size      DMA7_0          (2s comp)
1436    GAP 1 size      DMA15_8         (2s comp)
1437    GAP 2 size      DMA23_16        (2s comp)
1438    GAP 3 size      DESIRED_SECTOR      (2s comp)
1439    Sync size       DESIRED_CYLINDER    (1s comp)
1440    Sector count        SECTOR_COUNT        (1s comp)
1441    Sector size multiple    RETRY_COUNT         (1s comp)
1442
1443    GAP4 is variable and fills the rest of the track until the next
1444    index hole. Usually we have 247 bytes for FM and 598 for MFM.
1445
1446    6. The step rate and density must be loaded into the MODE register
1447
1448    7. The drive must be stepped to the desired track.
1449
1450    8. Now this command may be started.
1451
1452    All data bytes of a sector are filled with 0xe5. The gaps will be filled
1453    with 0x4e (MFM) or 0xff (FM).
1454
1455    To format another track, the sector id table must be updated, and steps
1456    7 and 8 must be repeated. If the DESIRED_HEAD register must be updated,
1457    the complete setup process must be done.
1458
1459    Options: Command = 011m rppp
1460    m = set data mark (0 = set deleted)
1461    r = current (1 = reduced)
1462    ppp = precompensation (for sector size = (2^ppp) * 128; ppp<4 for floppy )
1463
1464    ===============
1465
1466    One deviation from the specification: The TI-99 family uses the SDF
1467    and TDF formats. The TDF formats complies with the formats produced
1468    by the standard TI disk controller. It does not use index address marks.
1469    So we could integrate a translation in ti99_dsk when writing to disk,
1470    but when reading, how can ti99_dsk know whether to blow up the format
1471    to full length for this controller or keep it as is for the other
1472    controller? Unless someone comes up with a better idea, we implement
1473    an "undocumented" option in this controller, allowing to create a
1474    different track layout.
1475
1476    So there are two layouts for the floppy track:
1477
1478    - full format, including the index address mark, according to the
1479      specification
1480
1481    - short format without index AM which matches the PC99 format used
1482      for the TI-99 family.
1483
1484    The formats are determined by setting the flag in the smc92x4
1485    interface structure.
14861486*/
14871487static void format_floppy_track(running_device *device, int flags)
14881488{
r8044r8045
14941494   int gap0, gap1, gap2, gap3, gap4, sync1, sync2, count, size, fm;
14951495   int gap_byte, pre_gap, crc, mark, inam;
14961496   UINT8 curr_ident, curr_cyl, curr_head, curr_sect, curr_size;
1497   
1497
14981498   int normal_data_mark = flags & 0x10;
1499   
1500   UINT8 *buffer;
15011499
1500   UINT8 *buffer;
1501
15021502   /* Determine the track size. We cannot allow different sizes in this
1503   design. */
1503    design. */
15041504   int data_count = 0;
15051505
15061506   sync_status_in(device);
1507   
1507
15081508   current_floppy = (*w->intf->current_floppy)();
15091509        floppy = flopimg_get_image(current_floppy);
15101510
15111511   if (floppy != NULL)
15121512      data_count = floppy_get_track_size(floppy, 0, 0);
1513   
1513
15141514        if (data_count==0)
15151515        {
15161516                if (controller_set_to_single_density(device))
r8044r8045
15181518                else
15191519                   data_count = TRKSIZE_DD;
15201520        }
1521       
1521
15221522        /* Build buffer */
15231523        buffer = (UINT8*)malloc(data_count);
1524       
1524
15251525   fm = controller_set_to_single_density(device);
1526   
1526
15271527   sync2 = (~w->register_w[DESIRED_CYLINDER])&0xff;
15281528   gap2 = (-w->register_w[DMA23_16])&0xff;
15291529   count = (~w->register_w[SECTOR_COUNT])&0xff;
r8044r8045
15311531   gap_byte = (fm)? 0xff : 0x4e;
15321532
15331533   if (w->intf->full_track_layout)
1534   {   
1534   {
15351535      /* Including the index AM. */
15361536      gap0 = (-w->register_w[DMA7_0])&0xff;
15371537      gap1 = (-w->register_w[DMA15_8])&0xff;
r8044r8045
15521552      sync1 = (fm)? 6 : 10;
15531553      inam = 0;
15541554   }
1555   
1555
15561556   index = 0;
15571557
15581558   mark = (fm)? 10 : 16;  /* ID/DAM + A1 + CRC */
1559   
1559
15601560   exp_size = gap0 + inam + gap1 + count*(sync1 + mark + gap2 + sync2 + size*128 + gap3) + gap4;
1561     
1561
15621562   if (exp_size != data_count)
1563      logerror("smc92x4 warn: The current track length in the image (%d) does not match the new track length (%d). Keeping the old length. This will break the image (sorry).\n", data_count, exp_size);
1564   
1563      logerror("smc92x4 warn: The current track length in the image (%d) does not match the new track length (%d). Keeping the old length. This will break the image (sorry).\n", data_count, exp_size);
1564
15651565   /* use the backup registers set up during drive_select */
1566   set_dma_address(device, CURRENT_IDENT, CURRENT_CYLINDER, CURRENT_HEAD);
1566   set_dma_address(device, CURRENT_IDENT, CURRENT_CYLINDER, CURRENT_HEAD);
15671567
15681568   memset(&buffer[index], pre_gap, gap0);
15691569   index += gap0;
r8044r8045
15761576      if (!fm)
15771577      {
15781578         memset(&buffer[index], 0xc2, 3);
1579         index += 3;         
1579         index += 3;
15801580      }
15811581      memset(&buffer[index], gap_byte, gap1);
1582      index += gap1;     
1582      index += gap1;
15831583   }
1584   
1584
15851585   /* for each sector */
15861586   for (j=0; j < count; j++)
15871587   {
r8044r8045
16271627         memset(&buffer[index], 0xa1, 3);
16281628         index += 3;
16291629      }
1630     
1630
16311631      if (normal_data_mark) buffer[index++] = 0xfb;
16321632      else buffer[index++] = 0xf8;
16331633
r8044r8045
16521652}
16531653
16541654/*
1655   Create the track layout of a MFM hard disk. Like floppy disks,
1656   MFM hard disks are interfaced on a track base, that is, we have to
1657   create a complete track layout.
1658   
1659   For more explanations see the comments to format_floppy_track.
1655    Create the track layout of a MFM hard disk. Like floppy disks,
1656    MFM hard disks are interfaced on a track base, that is, we have to
1657    create a complete track layout.
1658
1659    For more explanations see the comments to format_floppy_track.
16601660*/
16611661static void format_harddisk_track(running_device *device, int flags)
16621662{
r8044r8045
16671667
16681668   int normal_data_mark = flags & 0x10;
16691669   int data_count=0;
1670   
1671   UINT8 *buffer;
16721670
1671   UINT8 *buffer;
1672
16731673   sync_status_in(device);
1674   
1674
16751675        /* Build buffer */
16761676        gap0 = (-w->register_w[DMA7_0])&0xff;
16771677        gap1 = (-w->register_w[DMA15_8])&0xff;
r8044r8045
16841684   size = (~w->register_w[RETRY_COUNT])&0xff;
16851685
16861686   data_count = gap1 + count*(sync+12+gap2+sync+size*128+gap3)+gap4;
1687   
1687
16881688        buffer = (UINT8*)malloc(data_count);
1689   
1689
16901690   index = 0;
16911691   fm = controller_set_to_single_density(device);
16921692   gap_byte = 0x4e;
1693     
1693
16941694   /* use the backup registers set up during drive_select */
1695   set_dma_address(device, CURRENT_IDENT, CURRENT_CYLINDER, CURRENT_HEAD);
1695   set_dma_address(device, CURRENT_IDENT, CURRENT_CYLINDER, CURRENT_HEAD);
16961696
16971697   for (i=0; i < gap1; i++) buffer[index++] = gap_byte;
16981698
r8044r8045
17151715      buffer[index++] = curr_head;
17161716      buffer[index++] = curr_sect;
17171717      buffer[index++] = curr_size;
1718     
1718
17191719      /* Calculate CRC16 (5 bytes for ID) */
17201720      crc = ccitt_crc16(0xffff, &buffer[index-5], 5);
17211721      buffer[index++] = (crc>>8)&0xff;
r8044r8045
17241724      /* GAP 2 */
17251725      for (i=0; i < gap2; i++) buffer[index++] = gap_byte;
17261726      for (i=0; i < sync; i++) buffer[index++] = 0x00;
1727     
1727
17281728      buffer[index++] = 0xa1;
1729     
1729
17301730      if (normal_data_mark) buffer[index++] = 0xfb;
17311731      else buffer[index++] = 0xf8;
17321732
r8044r8045
17371737      crc = ccitt_crc16(0xffff, &buffer[index-128*size-1], 128*size+1);
17381738      buffer[index++] = (crc>>8)&0xff;
17391739      buffer[index++] = crc & 0xff;
1740     
1740
17411741      /* GAP 3 */
17421742      for (i=0; i < 3; i++) buffer[index++] = 0;  /* check that, unclear in spec */
17431743      for (i=0; i < gap3 - 3; i++) buffer[index++] = gap_byte;
17441744   }
17451745   /* GAP 4 */
17461746   for (i=0; i < gap4; i++) buffer[index++] = gap_byte;
1747               
1747
17481748   (*w->intf->mfmhd_write_track)(w->register_w[DESIRED_HEAD]&0x0f, buffer, data_count);
17491749   free(buffer);
1750   sync_status_in(device);
1750   sync_status_in(device);
17511751}
17521752
17531753/*
1754   Read a floppy track.
1755   A complete track is read at the position of the head. It reads the
1756   track from one index pulse to the next index pulse. (Note that the
1757   spec talks about "index mark" and "signal from the drive" which is
1758   a bit confusing, since the index AM is behind Gap0, the index hole
1759   is before Gap0. We should check with a real device. Also, it does not
1760   speak about the head, so we assume the head is set in the DESIRED_HEAD
1761   register.)
1762   
1763   TODO: The TDF format does not support index marks. Need to define TDF
1764   in a more flexible way. Also consider format variations.
1765   (Hint: Do a check for the standard "IBM" format. Should probably do
1766   a translation from IBM to PC99 and back. Requires to parse the track
1767   image before. Need to decide whether we generally translate to the IBM
1768   format or generally to the PC99 format between controller and format.
1769   Format is the image is always PC99.)
1754    Read a floppy track.
1755    A complete track is read at the position of the head. It reads the
1756    track from one index pulse to the next index pulse. (Note that the
1757    spec talks about "index mark" and "signal from the drive" which is
1758    a bit confusing, since the index AM is behind Gap0, the index hole
1759    is before Gap0. We should check with a real device. Also, it does not
1760    speak about the head, so we assume the head is set in the DESIRED_HEAD
1761    register.)
1762
1763    TODO: The TDF format does not support index marks. Need to define TDF
1764    in a more flexible way. Also consider format variations.
1765    (Hint: Do a check for the standard "IBM" format. Should probably do
1766    a translation from IBM to PC99 and back. Requires to parse the track
1767    image before. Need to decide whether we generally translate to the IBM
1768    format or generally to the PC99 format between controller and format.
1769    Format is the image is always PC99.)
17701770*/
17711771static void read_floppy_track(running_device *device, int transfer_only_ids)
17721772{
r8044r8045
17751775
17761776   floppy_image *floppy;
17771777   /* Determine the track size. We cannot allow different sizes in this
1778   design. */
1778    design. */
17791779   int data_count = 0;
17801780   int i;
17811781   UINT8 *buffer;
1782   
1782
17831783   sync_latches_out(device);
1784   
1784
17851785        floppy = flopimg_get_image(current_floppy);
17861786
17871787   /* Determine the track size. We cannot allow different sizes in this
1788   design. */       
1788    design. */
17891789   if (floppy != NULL)
17901790      data_count = floppy_get_track_size(floppy, 0, 0);
1791
1791
17921792        if (data_count==0)
17931793        {
17941794                if (controller_set_to_single_density(device))
r8044r8045
17961796                else
17971797                   data_count = TRKSIZE_DD;
17981798        }
1799       
1799
18001800   buffer = (UINT8*)malloc(data_count);
1801   
1801
18021802   floppy_drive_read_track_data_info_buffer( current_floppy, w->register_w[DESIRED_HEAD]&0x0f, (char *)buffer, &data_count);
18031803   sync_status_in(device);
1804   
1804
18051805   /* Transfer the buffer to the external memory. We assume the memory
1806   pointer has been set appropriately in the registers. */
1807   set_dma_address(device, DMA23_16, DMA15_8, DMA7_0);
1806    pointer has been set appropriately in the registers. */
1807   set_dma_address(device, DMA23_16, DMA15_8, DMA7_0);
18081808
18091809   if (transfer_only_ids)
18101810   {
r8044r8045
18171817      (*w->intf->dma_write_callback)(buffer[i]);
18181818   }
18191819   smc92x4_set_dip(device, FALSE);
1820   
1821   free(buffer);     
1820
1821   free(buffer);
18221822}
18231823
18241824static void read_harddisk_track(running_device *device, int transfer_only_ids)
r8044r8045
18261826   smc92x4_state *w = get_safe_token(device);
18271827
18281828   /* Determine the track size. We cannot allow different sizes in this
1829   design. */
1829    design. */
18301830   int i;
18311831   UINT8 *buffer;
18321832   int data_count=0;
18331833
18341834   sync_latches_out(device);
1835   
1836   /* buffer and data_count are allocated and set by the function. */   
1835
1836   /* buffer and data_count are allocated and set by the function. */
18371837   (*w->intf->mfmhd_read_track)(w->register_w[DESIRED_HEAD]&0x0f, &buffer, &data_count);
18381838   sync_status_in(device);
18391839
18401840   /* Transfer the buffer to the external memory. We assume the memory
1841   pointer has been set appropriately in the registers. */
1842   set_dma_address(device, DMA23_16, DMA15_8, DMA7_0);
1841    pointer has been set appropriately in the registers. */
1842   set_dma_address(device, DMA23_16, DMA15_8, DMA7_0);
18431843
18441844   if (transfer_only_ids)
18451845   {
r8044r8045
18521852      (*w->intf->dma_write_callback)(buffer[i]);
18531853   }
18541854   smc92x4_set_dip(device, FALSE);
1855   
1856   free(buffer);     
1855
1856   free(buffer);
18571857}
18581858
18591859
r8044r8045
18611861{
18621862   smc92x4_state *w = get_safe_token(device);
18631863   int transfer_only_ids = w->command & 0x01;
1864   
1864
18651865   if (w->selected_drive_type & TYPE_FLOPPY)
18661866   {
18671867      read_floppy_track(device, transfer_only_ids);
r8044r8045
18701870   {
18711871      read_harddisk_track(device, transfer_only_ids);
18721872   }
1873   
1873
18741874   smc92x4_timed_track_request(device);
18751875}
18761876
r8044r8045
18851885{
18861886   smc92x4_state *w = get_safe_token(device);
18871887   int flags = w->command & 0x1f;
1888   
1888
18891889   if (w->selected_drive_type & TYPE_FLOPPY)
18901890      format_floppy_track(device, flags);
18911891   else
r8044r8045
18981898{
18991899   smc92x4_state *w = get_safe_token(device);
19001900   w->to_be_continued = FALSE;
1901   set_command_done(device,  ST_TC_SUCCESS);   
1901   set_command_done(device,  ST_TC_SUCCESS);
19021902}
19031903
19041904/*
1905   Continue to process after callback
1905    Continue to process after callback
19061906*/
19071907static void smc92x4_process_after_callback(running_device *device)
19081908{
r8044r8045
19211921      seek_read_id_continue(device);
19221922   }
19231923   else if ((opcode >= 0x58 && opcode <= 0x59)||(opcode >= 0x5C && opcode <= 0x5f))
1924   {         
1924   {
19251925      read_sectors_continue(device);
1926   }     
1926   }
19271927   else if (opcode >= 0x5a && opcode <= 0x5b)
1928   {         
1928   {
19291929      read_track_continue(device);
1930   }     
1930   }
19311931   else if (opcode >= 0x60 && opcode <= 0x7f)
19321932   {
19331933      format_track_continue(device);
19341934   }
1935   else if (opcode >= 0x80)
1935   else if (opcode >= 0x80)
19361936   {
19371937      write_sectors_continue(device);
19381938   }
r8044r8045
19481948static void smc92x4_process_command(running_device *device, UINT8 opcode)
19491949{
19501950   smc92x4_state *w = get_safe_token(device);
1951     
1951
19521952   //logerror("smc92x4 process command %02x\n", opcode);
19531953   if (w->to_be_continued)
19541954   {
r8044r8045
19591959   w->register_r[INT_STATUS] &= ~(ST_DONE | ST_BADSECT);
19601960
19611961   /* Reset interrupt line (not explicitly mentioned in spec, but seems
1962   reasonable) */
1962    reasonable) */
19631963   smc92x4_clear_interrupt(device);
19641964   w->register_r[INT_STATUS] &= ~(ST_INTPEND | ST_RDYCHNG);
1965   
1965
19661966   w->command = opcode;
19671967   w->found_id = FALSE;
19681968   w->seek_count = 0;
1969   
1969
19701970   if (opcode == 0x00)
19711971   {
19721972      /* RESET */
r8044r8045
19891989   {
19901990      /* RESTORE DRIVE */
19911991      /* bit 0: 0 -> command ends after last seek pulse, 1 -> command
1992      ends when the drive asserts the seek complete pin */
1992        ends when the drive asserts the seek complete pin */
19931993      logerror("smc92x4 restore command %X\n", opcode);
19941994      restore_drive(device);
19951995   }
r8044r8045
20212021      /* SETREGPTR */
20222022      logerror("smc92x4 setregptr command %X\n", opcode);
20232023      w->register_pointer = opcode & 0xf;
2024      /* Spec does not say anything about the effect of setting an
2025      invalid value (only "care should be taken") */
2024      /* Spec does not say anything about the effect of setting an
2025        invalid value (only "care should be taken") */
20262026      if (w->register_pointer > 10)
20272027      {
20282028         logerror("smc92x4 error: set register pointer: Invalid register number: %d. Setting to 10.\n", w->register_pointer);
r8044r8045
20382038   else if ((opcode >= 0x58 && opcode <= 0x59)
20392039      || (opcode >= 0x5C && opcode <= 0x5f)
20402040      || (opcode >= 0x80))
2041   {         
2041   {
20422042      /* READ/WRITE SECTORS PHYSICAL/LOGICAL */
20432043      logerror("smc92x4 read/write sector command %X\n", opcode);
20442044      read_write_sectors(device);
2045   }     
2045   }
20462046   else if (opcode >= 0x5A && opcode <= 0x5b)
2047   {         
2047   {
20482048      /* READ TRACK */
20492049      logerror("smc92x4 read track command %X\n", opcode);
20502050      read_track(device);
2051   }     
2051   }
20522052   else if (opcode >= 0x60 && opcode <= 0x7f)
20532053   {
20542054      /* FORMAT TRACK */
r8044r8045
20592059   {
20602060      logerror("smc92x4 warn: Invalid command %x, ignored\n", opcode);
20612061   }
2062   
2063   if (!w->to_be_continued)
2062
2063   if (!w->to_be_continued)
20642064      set_command_done(device);
20652065}
20662066
r8044r8045
20692069****************************************************************************/
20702070
20712071/*
2072   Read a byte of data from a smc92x4 controller
2073   The address (offset) encodes the C/D* line (command and /data)
2072    Read a byte of data from a smc92x4 controller
2073    The address (offset) encodes the C/D* line (command and /data)
20742074*/
20752075READ8_DEVICE_HANDLER( smc92x4_r )
20762076{
20772077   UINT8 reply = 0;
20782078   smc92x4_state *w = get_safe_token(device);
2079   
2079
20802080   if ((offset & 1) == 0)
20812081   {
20822082      /* data register */
r8044r8045
20842084      // printf("smc92x4 register_r[%d] -> %02x\n", w->register_pointer, reply);
20852085
20862086      /* Autoincrement until DATA is reached. */
2087      if (w->register_pointer < DATA)
2087      if (w->register_pointer < DATA)
20882088         w->register_pointer++;
20892089   }
20902090   else
20912091   {
20922092      /* status register */
20932093      reply = w->register_r[INT_STATUS];
2094      /* Spec (p.3) : The interrupt pin is reset to its inactive state
2095          when the UDC interrupt status register is read. */
2094      /* Spec (p.3) : The interrupt pin is reset to its inactive state
2095             when the UDC interrupt status register is read. */
20962096      // printf("smc92x4 interrupt status read = %02x\n", reply);
20972097      smc92x4_clear_interrupt(device);
20982098      /* Clear the bits due to int status register read. */
r8044r8045
21022102}
21032103
21042104/*
2105   Write a byte to a smc99x4 controller
2106   The address (offset) encodes the C/D* line (command and /data)
2105    Write a byte to a smc99x4 controller
2106    The address (offset) encodes the C/D* line (command and /data)
21072107*/
21082108WRITE8_DEVICE_HANDLER( smc92x4_w )
21092109{
r8044r8045
21162116      // printf("smc92x4 register_w[%d] <- %X\n", w->register_pointer, data);
21172117      w->register_w[w->register_pointer] = data;
21182118
2119      /* The DMA registers and the sector register for read and
2120         write are identical. */
2121      if (w->register_pointer < DESIRED_HEAD)
2119      /* The DMA registers and the sector register for read and
2120           write are identical. */
2121      if (w->register_pointer < DESIRED_HEAD)
21222122         w->register_r[w->register_pointer] = data;
2123     
2123
21242124      /* Autoincrement until DATA is reached. */
2125      if (w->register_pointer < DATA)
2126         w->register_pointer++;     
2125      if (w->register_pointer < DATA)
2126         w->register_pointer++;
21272127   }
21282128   else
21292129   {
r8044r8045
21422142{
21432143   smc92x4_state *w = get_safe_token(device);
21442144   assert(device->baseconfig().static_config != NULL);
2145   
2145
21462146   w->intf = (const smc92x4_interface*)device->baseconfig().static_config;
21472147   devcb_resolve_write_line(&w->out_intrq_func, &w->intf->out_intrq_func, device);
21482148   devcb_resolve_write_line(&w->out_dip_func, &w->intf->out_dip_func, device);
21492149   devcb_resolve_write8(&w->out_auxbus_func, &w->intf->out_auxbus_func, device);
21502150   devcb_resolve_read_line(&w->in_auxbus_func, &w->intf->in_auxbus_func, device);
2151   
2151
21522152   /* allocate timers */
21532153   /*
2154   w->timer_data = timer_alloc(device->machine, smc92x4_data_callback, (void *)device); */
2154    w->timer_data = timer_alloc(device->machine, smc92x4_data_callback, (void *)device); */
21552155   w->timer_rs = timer_alloc(device->machine, smc92x4_read_sector_callback, (void *)device);
21562156   w->timer_ws = timer_alloc(device->machine, smc92x4_write_sector_callback, (void *)device);
21572157   w->timer_track = timer_alloc(device->machine, smc92x4_track_callback, (void *)device);
21582158   w->timer_seek = timer_alloc(device->machine, smc92x4_seek_callback, (void *)device);
2159   
2159
21602160   w->use_real_timing = TRUE;
21612161}
21622162
r8044r8045
21652165   smc92x4_state *w = get_safe_token(device);
21662166   smc92x4_clear_interrupt(device);
21672167   smc92x4_set_dip(device, FALSE);
2168   
2169   for (int i=0; i<11; i++)
2168
2169   for (int i=0; i<11; i++)
21702170      w->register_r[i] = w->register_w[i] = 0;
21712171}
21722172
r8044r8045
21782178void smc92x4_set_timing(running_device *device, int realistic)
21792179{
21802180   smc92x4_state *w = get_safe_token(device);
2181   w->use_real_timing = realistic;   
2181   w->use_real_timing = realistic;
21822182}
21832183
21842184/***************************************************************************
src/mess/machine/ti99_4x.c
r8044r8045
427427{
428428   if (gfxparm != 0)
429429      TMS9928A_configure(gfxparm);
430   
430
431431        /* Initialize all. Actually, at this point, we don't know
432432        how the switches are set. Later we use the configuration switches to
433433        determine which one to use. */
r8044r8045
436436   ti99_ide_init(machine);
437437   ti99_hsgpl_init(machine);
438438   ti99_usbsm_init(machine);
439   
439
440440   /* Find the cartslot device and cache it. This is a string search,
441   and we don't want to repeat it on each memory access. */
441    and we don't want to repeat it on each memory access. */
442442   cartslots = devtag_get_device(machine, "ti99_multicart");
443443   assert(cartslots != NULL);
444444}
r8044r8045
505505      xRAM_kind = RAM_99_4P;
506506   else
507507      xRAM_kind = input_port_read(machine, "RAM");
508   
508
509509   if (ti99_model == model_99_8)
510510      has_speech = TRUE;
511511   else
512512      has_speech = input_port_read(machine, "SPEECH");
513   
513
514514   has_ide = input_port_read(machine, "HDCTRL") & HD_IDE;
515515   has_rs232 = input_port_read(machine, "SERIAL") & SERIAL_TI;
516516
r8044r8045
518518      has_handset = input_port_read(machine, "HCI") & HCI_IR;
519519   else
520520      has_handset = FALSE;
521   
521
522522   if (ti99_model == model_99_4p)
523523      has_hsgpl = TRUE;
524524   else
r8044r8045
894894   if (! tms5220_readyq_r())
895895   {
896896      /* Weirdly enough, we are always seeing some problems even though
897      everything is working fine. */
897        everything is working fine. */
898898      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready());
899899      logerror("ti99/4a speech says aaargh!\n");
900900      logerror("(time to ready: %f -> %d)\n", time_to_ready, (int) ceil(3000000*time_to_ready));
r8044r8045
909909static WRITE16_HANDLER ( ti99_wspeech_w )
910910{
911911   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-(54+3));      /* this is just an approx. minimum, it can be much more */
912   
912
913913   #if 1
914914   /* the stupid design of the tms5220 core means that ready is cleared when
915   there are 15 bytes in FIFO.  It should be 16.  Of course, if it were the
916   case, we would need to store the value on the bus, which would be more
917   complex. */
915    there are 15 bytes in FIFO.  It should be 16.  Of course, if it were the
916    case, we would need to store the value on the bus, which would be more
917    complex. */
918918   if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
919919   {
920920      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
921921      int cycles_to_ready = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready);
922     
922
923923      logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready);
924     
924
925925      cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-cycles_to_ready);
926926      timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
927927   }
928928   #endif
929   
929
930930   tms5220_data_w(devtag_get_device(space->machine, "tms5220"), offset, (data >> 8) & 0xff);
931931}
932932
r8044r8045
934934{
935935   UINT8 reply = 0, replycart;
936936   int override_console = FALSE; /* for future extension */
937   
937
938938   if (console_GROMs.addr < 0x6000)
939939   {
940940      /* GROMs are buffered. Data is retrieved from a buffer,
941      while the buffer is replaced with the next cell
942      content. */
941        while the buffer is replaced with the next cell
942        content. */
943943      reply = console_GROMs.buf;
944     
944
945945      /* Get next value, put it in buffer. Note that the
946      GROM wraps at 8K boundaries. */
946        GROM wraps at 8K boundaries. */
947947      console_GROMs.buf = console_GROMs.data_ptr[console_GROMs.addr];
948//      printf("GROM address (cons) = %04x, offset = %04x, reply = %02x\n", console_GROMs.addr, offset, reply);
948//      printf("GROM address (cons) = %04x, offset = %04x, reply = %02x\n", console_GROMs.addr, offset, reply);
949949   }
950950
951951   /* The address pointer in the cartridge system is updated by this call.
952      We pretend to do a data read, so we mask away the address bit in the
953      offset. */
952       We pretend to do a data read, so we mask away the address bit in the
953       offset. */
954954   replycart = ti99_cartridge_grom_r(cartslots, offset&0xfffc);
955   
955
956956   if (console_GROMs.addr >= 0x6000 || override_console)
957957   {
958958      reply = replycart;
959959   }
960960
961   /* Each GROM chip has its own counter, so we update all of them even
962   when we do not access them. */
961   /* Each GROM chip has its own counter, so we update all of them even
962    when we do not access them. */
963963   /* The program counter wraps at each GROM chip size (8K),
964   so 0x5fff + 1 = 0x4000. */
964    so 0x5fff + 1 = 0x4000. */
965965   console_GROMs.addr = ((console_GROMs.addr + 1) & 0x1FFF) | (console_GROMs.addr & 0xE000);
966   
966
967967   /* Reset the read and write address flipflops. */
968968   console_GROMs.raddr_LSB = console_GROMs.waddr_LSB = FALSE;
969   
969
970970   return reply;
971971}
972972
r8044r8045
976976READ16_HANDLER ( ti99_grom_r )
977977{
978978   UINT16 reply, replycart;
979   
979
980980   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4 /*20+3*/);      /* from 4 to 23? */
981981   //  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
982   
982
983983   /* This implementation features a multislot cartridge system which
984   is based on multiple GROM base addresses. The standard base
985   is >9800 (slot 0). When we access the port >9804, we switch to
986   slot 1, >9808 is slot 2, ... >983C is slot 15. Although theoretically
987   we could address up to 256 banks, the TI operating system does not
988   check more than 16 banks.
989   Cartridges may also contain ROMs which need to be banked
990   simultaneously. We use the cartridge slot number to swap the ROM at
991   >6000, or RAM if available. I don't know whether this is the way
992   Texas Instruments envisaged it in the OS, but it is the only
993   plausible way to allow for GROM+ROM cartridges.
994   Note that some cartridges may have programming flaws which only
995   appear when the cartridge is used in a higher-numbered slot.
996   Parsec is one example which only runs in slot 0 as the
997   programmers hard-coded an access to GROM port 0. Note: This *may*
998   be worked around if we make sure that switching only occurs
999   when the address is set, not when data is read or written. But
1000   it's not clear whether this has unwanted side effects.
1001   */
1002         
984    is based on multiple GROM base addresses. The standard base
985    is >9800 (slot 0). When we access the port >9804, we switch to
986    slot 1, >9808 is slot 2, ... >983C is slot 15. Although theoretically
987    we could address up to 256 banks, the TI operating system does not
988    check more than 16 banks.
989    Cartridges may also contain ROMs which need to be banked
990    simultaneously. We use the cartridge slot number to swap the ROM at
991    >6000, or RAM if available. I don't know whether this is the way
992    Texas Instruments envisaged it in the OS, but it is the only
993    plausible way to allow for GROM+ROM cartridges.
994    Note that some cartridges may have programming flaws which only
995    appear when the cartridge is used in a higher-numbered slot.
996    Parsec is one example which only runs in slot 0 as the
997    programmers hard-coded an access to GROM port 0. Note: This *may*
998    be worked around if we make sure that switching only occurs
999    when the address is set, not when data is read or written. But
1000    it's not clear whether this has unwanted side effects.
1001    */
1002
10031003   if (offset & 1)
10041004   {   /* Read GROM address
1005      We only have one GROM program counter for the console GROMs
1006      and all cartridge GROMs in all banks(!). Hardware
1007      implementations must take this into account as well. Thus,
1008      we use a structure here in the console, rather than separate
1009      counters in each GROM chip. */
1005        We only have one GROM program counter for the console GROMs
1006        and all cartridge GROMs in all banks(!). Hardware
1007        implementations must take this into account as well. Thus,
1008        we use a structure here in the console, rather than separate
1009        counters in each GROM chip. */
10101010
10111011      /* We call the cartridge system here, but we ignore the
1012         value. This is done to sync the flags. */
1012           value. This is done to sync the flags. */
10131013      replycart = ti99_cartridge_grom_r(cartslots, (offset<<1))<<8;
1014     
1014
10151015      /* When reading, reset the hi/lo flag byte for writing.
1016      TODO: Verify this with a real machine. */
1016        TODO: Verify this with a real machine. */
10171017      console_GROMs.waddr_LSB = FALSE;
1018     
1018
10191019      /* Address reading is done in two steps; first, the high byte
1020      is transferred, then the low byte. */
1020        is transferred, then the low byte. */
10211021      if (console_GROMs.raddr_LSB)
10221022      {
10231023         /* second pass */
r8044r8045
10371037   {
10381038      /* Read GROM data */
10391039      /* Note that we shift the GROM port address to accomodate for
1040         8-bit and 16-bit systems. */
1040           8-bit and 16-bit systems. */
10411041      reply = ((UINT16)GROM_dataread(offset<<1)) << 8;
10421042   }
1043   
1043
10441044   if (hsgpl_crdena)
10451045      /* hsgpl buffers are stronger than console GROM buffers */
10461046      reply = ti99_hsgpl_gpl_r(space, offset, mem_mask);
1047   
1047
10481048   return reply;
10491049}
10501050
10511051/*
1052   GPL write
1052    GPL write
10531053*/
10541054WRITE16_HANDLER ( ti99_grom_w )
10551055{
10561056   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4/*20+3*/);      /* from 4 to 23? */
10571057   //  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
1058     
1058
10591059   if (offset & 1)
10601060   {
10611061      ti99_cartridge_grom_w(cartslots, (offset<<1), (data>>8)&0xff);
r8044r8045
10631063      /* write GROM address */
10641064      /* see comments above */
10651065      console_GROMs.raddr_LSB = FALSE;
1066         
1066
10671067      /* Implements the internal flipflop.
1068      The Editor/Assembler manuals says that the current address
1069      plus one is returned. This effect is properly emulated
1070      as we are using a read-ahead buffer.
1071      */
1068        The Editor/Assembler manuals says that the current address
1069        plus one is returned. This effect is properly emulated
1070        as we are using a read-ahead buffer.
1071        */
10721072      if (console_GROMs.waddr_LSB)
10731073      {
10741074         /* Accept low byte (2nd write) */
10751075         console_GROMs.addr = (console_GROMs.addr & 0xFF00) | ((data >> 8) & 0xFF);
1076         
1076
10771077         /* Setting the address causes a new read, putting the
1078         value into the buffer. We don't need the value here. */
1078            value into the buffer. We don't need the value here. */
10791079         GROM_dataread(offset<<1);
10801080         console_GROMs.waddr_LSB = FALSE;
10811081      }
r8044r8045
10911091      /* write GROM data */
10921092      /* the console GROMs are always affected */
10931093      /* BTW, console GROMs are never GRAMs, therefore there is no
1094      need to actually write anything, so we just read ahead
1095      TODO: There could be cartridges with GRAM, so this must be
1096      fixed.
1097      */
1094        need to actually write anything, so we just read ahead
1095        TODO: There could be cartridges with GRAM, so this must be
1096        fixed.
1097        */
10981098      GROM_dataread(offset<<1);
10991099      console_GROMs.raddr_LSB = console_GROMs.waddr_LSB = FALSE;
11001100   }
1101   
1101
11021102   if (hsgpl_crdena)
11031103      ti99_hsgpl_gpl_w(space, offset, data, mem_mask);
11041104}
r8044r8045
11781178{
11791179   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4);      /* HSGPL is located on 8-bit bus? */
11801180   //  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
1181   
1181
11821182   return /*hsgpl_crdena ?*/ ti99_hsgpl_gpl_r(space, offset, mem_mask) /*: 0*/;
11831183}
11841184
r8044r8045
11891189{
11901190   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4);      /* HSGPL is located on 8-bit bus? */
11911191   //  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
1192   
1192
11931193   /*if (hsgpl_crdena)*/
11941194   ti99_hsgpl_gpl_w(space, offset, data, mem_mask);
11951195}
r8044r8045
12061206   int page = offset >> 12;
12071207   UINT32 mapper_reg;
12081208   UINT8 reply = 0;
1209   
1209
12101210   if (ti99_8_enable_rom_and_ports)
12111211   {
12121212      /* This is only important for address access 0000-1fff and
1213      8000-9fff. Outside, the mapper mode is used. */
1213        8000-9fff. Outside, the mapper mode is used. */
12141214      if ((offset >= 0x0000) && (offset < 0x2000))
12151215      {
12161216         /* ROM */
r8044r8045
12271227            /* RAM: >8000 - >83ff */
12281228            reply = sRAM_ptr_8[offset & 0x1fff];
12291229            break;
1230           
1230
12311231         case 1:
12321232            /* >8400 - >840f: sound (cannot read)
1233            >8410 - >87ff: SRAM */
1233                >8410 - >87ff: SRAM */
12341234            if (offset >= 0x8410)
12351235               reply = sRAM_ptr_8[offset & 0x1fff];
12361236            break;
1237           
1237
12381238         case 2:
12391239            /* VDP read + mapper status */
12401240            if (offset < 0x8810)
r8044r8045
12561256               ti99_8_mapper_status = 0;
12571257            }
12581258            break;
1259           
1259
12601260         case 4:
12611261            /* speech read: >9000 */
12621262            if (! (offset & 1))
r8044r8045
12651265               reply = tms5220_status_r(devtag_get_device(space->machine, "tms5220"), 0);
12661266            }
12671267            break;
1268           
1268
12691269         case 6:
12701270            /* GROM read: >9800 */
12711271            if (! (offset & 1))
12721272               reply = ti99_grom_r8(space, offset);
12731273            break;
1274           
1274
12751275         default:
12761276            logerror("unmapped read offs=%d\n", (int) offset);
12771277            break;
r8044r8045
12791279         return reply;
12801280      }
12811281   }
1282   
1282
12831283   mapper_reg = ti99_8_mapper_regs[page];
12841284   offset = (mapper_reg + (offset & 0x0fff)) & 0x00ffffff;
1285   
1285
12861286   #if 0
12871287   /* test read protect */
12881288   if (mapper_reg & 0x20000000)
12891289      ;
1290   
1290
12911291   /* test execute protect */
12921292   if (mapper_reg & 0x40000000)
12931293      ;
12941294   #endif
1295   
1295
12961296   if (offset < 0x010000)
12971297   /* Read RAM */
12981298   reply = xRAM_ptr_8[offset];
1299   
1299
13001300   if (offset >= 0xff0000)
13011301   {
13021302      switch ((offset >> 13) & 7)
r8044r8045
13131313         /* ffe000 - ffffff: ? */
13141314         logerror("unmapped read page=%d offs=%d\n", (int) page, (int) offset);
13151315         break;
1316         
1316
13171317      case 2:
13181318         /* ff4000 - ff5fff: DSR space */
13191319         reply = ti99_8_peb_r(space, offset & 0x1fff);
13201320         break;
1321         
1321
13221322      case 3:
13231323         /* ff6000 - ff7fff: cartridge ROM space */
13241324         offset &= 0x1fff;
1325         
1325
13261326         /* We do not support hsgpl here because it is a 16 bit
1327         system. Just check the cartridges.  */
1327            system. Just check the cartridges.  */
13281328         reply = ti99_multicart8_r(multicart8, offset);
13291329         break;
1330         
1330
13311331      case 5:
13321332         /* ffa000 - ffbfff: >2000 ROM (ROM1) */
13331333         reply = ROM1_ptr_8[offset & 0x1fff];
13341334         break;
1335         
1335
13361336      case 6:
13371337         /* ffc000 - ffdfff: >6000 ROM */
13381338         reply = ROM3_ptr_8[offset & 0x1fff];
13391339         break;
13401340      }
13411341   }
1342   
1342
13431343   return reply;
13441344}
13451345
r8044r8045
14231423            if (! (offset & 1))
14241424            {
14251425               cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-48*4);      /* this is just an approx. minimum, it can be much more */
1426               
1426
14271427               /* the stupid design of the tms5220 core means that ready is cleared when
1428               there are 15 bytes in FIFO.  It should be 16.  Of course, if it were the
1429               case, we would need to store the value on the bus, which would be more
1430               complex. */
1428                    there are 15 bytes in FIFO.  It should be 16.  Of course, if it were the
1429                    case, we would need to store the value on the bus, which would be more
1430                    complex. */
14311431               if (! tms5220_readyq_r(devtag_get_device(space->machine, "tms5220")))
14321432               {
14331433                  attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
14341434                  double d = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready);
14351435                  int cycles_to_ready = ((int) (d + 3)) & ~3;
1436                 
1436
14371437                  logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready)
14381438                     , (int) cycles_to_ready);
1439                 
1439
14401440                  cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-cycles_to_ready);
14411441                  timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
14421442               }
1443               
1443
14441444               tms5220_data_w(devtag_get_device(space->machine, "tms5220"), offset, data);
14451445            }
14461446            break;
1447           
1447
14481448         case 7:
14491449            /* GPL write */
14501450            if (! (offset & 1))
14511451               ti99_grom_w8(space, offset, data);
14521452            break;
1453           
1453
14541454         default:
14551455            logerror("unmapped write offs=%d data=%d\n", (int) offset, (int) data);
14561456            break;
r8044r8045
15681568   if (handset_buflen == 1)
15691569   {
15701570      /* Unless I am missing something, the third and last nybble of the
1571      message is not acknowledged by the DSR in any way, and the first nybble
1572      of next message is not requested for either, so we need to decide on
1573      our own when we can post a new event.  Currently, we wait for 1000us
1574      after the DSR acknowledges the second nybble. */
1571        message is not acknowledged by the DSR in any way, and the first nybble
1572        of next message is not requested for either, so we need to decide on
1573        our own when we can post a new event.  Currently, we wait for 1000us
1574        after the DSR acknowledges the second nybble. */
15751575      timer_set(machine, ATTOTIME_IN_USEC(1000), NULL, 0, ti99_handset_ack_callback);
15761576   }
15771577
r8044r8045
16341634
16351635   /* read current key state */
16361636   key_buf = ( input_port_read(machine, keynames[num]) | (input_port_read(machine, keynames[num + 1]) << 16) ) >> (4*num);
1637   
1637
16381638   /* If a key was previously pressed, this key was not shift, and this key is
1639   still down, then don't change the current key press. */
1639    still down, then don't change the current key press. */
16401640   if (previous_key[num] && (previous_key[num] != 0x24)
16411641      && (key_buf & (1 << (previous_key[num] & 0x1f))))
16421642   {
r8044r8045
16471647      else
16481648      {
16491649         /* the shift modifier state has changed: we need to update the
1650         keyboard state */
1650            keyboard state */
16511651         if (key_buf & 0x0008)
16521652         {   /* shift has been pressed down */
16531653            previous_key[num] = current_key = previous_key[num] | 0x20;
r8044r8045
16581658         }
16591659         /* post message */
16601660         ti99_handset_post_message(machine, (((unsigned) current_key) << 4) | (num << 1));
1661         
1661
16621662         return TRUE;
16631663      }
1664     
1664
16651665   }
1666   
1666
16671667   current_key = 0;   /* default value if no key is down */
16681668   for (i=0; i<20; i++)
16691669   {
r8044r8045
16751675
16761676         if (current_key != 0x24)
16771677            /* If this is the shift key, any other key we may find will
1678            have higher priority; otherwise, we may exit the loop and keep
1679            the key we have just found. */
1678                have higher priority; otherwise, we may exit the loop and keep
1679                the key we have just found. */
16801680            break;
16811681      }
16821682   }
1683   
1683
16841684   if (current_key != previous_key[num])
16851685   {
16861686      previous_key[num] = current_key;
r8044r8045
17331733
17341734      /* set sign */
17351735      /* note that we set the sign if the joystick position is 0 to work
1736      around a bug in the ti99/4 ROMs */
1736        around a bug in the ti99/4 ROMs */
17371737      if (current_joy_x <= 0)
17381738      {
17391739         message |= 0x040;
r8044r8045
18121812static void mecmouse_select(int selnow, int stick1, int stick2)
18131813{
18141814   /* The Mechatronic mouse is connected to the joystick port and occupies
1815   both joystick select lines and the switch lines. From these five
1816   lines, left/right/down are used for the motion (i.e. 3 motion steps
1817   for positive and four for negative motion and one for rest),
1818   the fire line is used for the secondary mouse button, and the up
1819   line is used for the primary button.
1820   The mouse motion is delivered by the same lines for both directions;
1821   this requires swapping the axes. According to the source code of
1822   the accompanying mouse driver, the readout of the current axis is
1823   done by selecting joystick 1, then joystick 2. The axis swapping is
1824   achieved by selecting stick 1 again. When selecting stick 2, the
1825   second axis is seen on the input lines.
1826   Interrupting this sequence will lead to swapped axes. This is
1827   prevented by resetting the toggle when the mouse is deselected
1828   (neither 1 nor 2 are selected).
1829   
1830   The joystick lines are selected as follows:
1831   TI-99/4:  Stick 1: P4=1, P3=0, P2=1 (5)
1832   Stick 2: P4=1, P3=1, P2=0 (6)
1833   
1834   TI-99/4A: Stick 1: P4=1, P3=1, P2=0 (6)
1835   Stick 2: P4=1, P3=1, P2=1 (7)
1836   
1837   TI-99/8:  Stick 1: P3=1, P2=1, P1=1, P0=0 (14)
1838   Stick 2: P3=1, P2=1, P1=1, P0=1 (15)
1839   
1840   Geneve: n/a, has own mouse handling via v9938
1841   
1842   As we can only deliver at max 3 steps positive and 4 steps negative,
1843   we split the delta so that subsequent queries add up to the actual
1844   delta. That is, one delta of +10 yields a 3+3+3+1.
1845   
1846   mecmouse_x holds the current delta to be counted down for x
1847   (y accordingly)
1848   
1849   mecmouse_x_buf is the current step count reported to CRU
1850   
1851   Michael Zapf, 2008-01-22
1852   */
1815    both joystick select lines and the switch lines. From these five
1816    lines, left/right/down are used for the motion (i.e. 3 motion steps
1817    for positive and four for negative motion and one for rest),
1818    the fire line is used for the secondary mouse button, and the up
1819    line is used for the primary button.
1820    The mouse motion is delivered by the same lines for both directions;
1821    this requires swapping the axes. According to the source code of
1822    the accompanying mouse driver, the readout of the current axis is
1823    done by selecting joystick 1, then joystick 2. The axis swapping is
1824    achieved by selecting stick 1 again. When selecting stick 2, the
1825    second axis is seen on the input lines.
1826    Interrupting this sequence will lead to swapped axes. This is
1827    prevented by resetting the toggle when the mouse is deselected
1828    (neither 1 nor 2 are selected).
18531829
1830    The joystick lines are selected as follows:
1831    TI-99/4:  Stick 1: P4=1, P3=0, P2=1 (5)
1832    Stick 2: P4=1, P3=1, P2=0 (6)
1833
1834    TI-99/4A: Stick 1: P4=1, P3=1, P2=0 (6)
1835    Stick 2: P4=1, P3=1, P2=1 (7)
1836
1837    TI-99/8:  Stick 1: P3=1, P2=1, P1=1, P0=0 (14)
1838    Stick 2: P3=1, P2=1, P1=1, P0=1 (15)
1839
1840    Geneve: n/a, has own mouse handling via v9938
1841
1842    As we can only deliver at max 3 steps positive and 4 steps negative,
1843    we split the delta so that subsequent queries add up to the actual
1844    delta. That is, one delta of +10 yields a 3+3+3+1.
1845
1846    mecmouse_x holds the current delta to be counted down for x
1847    (y accordingly)
1848
1849    mecmouse_x_buf is the current step count reported to CRU
1850
1851    Michael Zapf, 2008-01-22
1852    */
1853
18541854   if (selnow==stick2) {
18551855      if (mecmouse_sel==stick1) {
18561856         if (! mecmouse_read_y)
r8044r8045
20132013   if (intreq)
20142014   {
20152015      /* On TI99, TMS9900 IC0-3 lines are not connected to TMS9901,
2016      * but hard-wired to force level 1 interrupts */
2016        * but hard-wired to force level 1 interrupts */
20172017      cputag_set_input_line_and_vector(device->machine, "maincpu", 0, ASSERT_LINE, 1);   /* interrupt it, baby */
20182018   }
20192019   else
r8044r8045
25622562}
25632563
25642564/* write CRU bit:
2565   bit0: enable/disable mapper registers in DSR space,
2566   bit1: enable/disable address mapping */
2565    bit0: enable/disable mapper registers in DSR space,
2566    bit1: enable/disable address mapping */
25672567static void sAMS_cru_w(running_machine *machine, int offset, int data)
25682568{
25692569   if (offset == 1)
r8044r8045
25872587{
25882588   cpu_adjust_icount(devtag_get_device(space->machine, "maincpu"),-4);
25892589   //  cpu_spinuntil_time(space->machine->firstcpu, ATTOTIME_IN_USEC(6));
2590   
2590
25912591   if (sAMS_mapper_on)
25922592      return xRAM_ptr[(offset&0x7ff)+sAMSlookup[(0x1000+offset)>>11]];
25932593   else
src/mess/machine/smc92x4.h
r8044r8045
33#ifndef SMC92X4
44#define SMC92X4      DEVICE_GET_INFO_NAME(smc92x4)
55
6#define INPUT_STATUS    0x00
6#define INPUT_STATUS   0x00
77#define OUTPUT_DMA_ADDR 0x01
8#define OUTPUT_OUTPUT1    0x02
9#define OUTPUT_OUTPUT2    0x03
8#define OUTPUT_OUTPUT1   0x02
9#define OUTPUT_OUTPUT2   0x03
1010
11#define MFMHD_TRACK00    0x80
11#define MFMHD_TRACK00   0x80
1212#define MFMHD_SEEKCOMP   0x40
1313#define MFMHD_WRFAULT   0x20
1414#define MFMHD_READY   0x10
1515#define MFMHD_INDEX   0x08
1616
17#define BAD_SECTOR    0x1000
17#define BAD_SECTOR   0x1000
1818#define BAD_CRC      0x2000
1919
2020/*
r8044r8045
3030#define DS_WRFAULT   0x01      /* write fault */
3131
3232/*
33   Needed to adapt to higher cylinder numbers. Floppies do not have such
34   high numbers.
33    Needed to adapt to higher cylinder numbers. Floppies do not have such
34    high numbers.
3535*/
3636typedef struct chrn_id_hd
3737{
r8044r8045
4646typedef struct _smc92x4_interface
4747{
4848   /* Disk format support. This flag allows to choose between the full
49      FM/MFM format and an abbreviated track layout. The difference results
50      from legal variations of the layout. This is not part of
51      the smc92x4 specification, but it allows to keep the image format
52      simple without too much case checking. Should be removed as soon as
53      the respective disk formats support the full format. */
49       FM/MFM format and an abbreviated track layout. The difference results
50       from legal variations of the layout. This is not part of
51       the smc92x4 specification, but it allows to keep the image format
52       simple without too much case checking. Should be removed as soon as
53       the respective disk formats support the full format. */
5454   int full_track_layout;
5555
56   /* Interrupt line. To be connected with the controller PCB. */
56   /* Interrupt line. To be connected with the controller PCB. */
5757   devcb_write_line out_intrq_func;
5858
59   /* DMA in progress line. To be connected with the controller PCB. */
59   /* DMA in progress line. To be connected with the controller PCB. */
6060   devcb_write_line out_dip_func;
6161
6262   /* Auxiliary Bus. These 8 lines need to be connected to external latches
63   and to a counter circuitry which works together with the external RAM.
64   We use the S0/S1 lines as address lines.
65   */
63    and to a counter circuitry which works together with the external RAM.
64    We use the S0/S1 lines as address lines.
65    */
6666   devcb_write8 out_auxbus_func;
67   
68   /* Auxiliary Bus. This is only used for S0=S1=0, so we need no address
69   lines and consider this line just as a line with 256 states. */
67
68   /* Auxiliary Bus. This is only used for S0=S1=0, so we need no address
69    lines and consider this line just as a line with 256 states. */
7070   devcb_read_line in_auxbus_func;
7171
7272   /* Get the currently selected floppy disk. This is determined by the
73      circuitry on the controller board, not within the controller itself.
74   */
73       circuitry on the controller board, not within the controller itself.
74    */
7575   running_device *(*current_floppy)(void);
7676
7777   /* Callback to read the contents of the external RAM via the data bus.
78      Note that the address must be set and automatically increased
79      by external circuitry. */
78       Note that the address must be set and automatically increased
79       by external circuitry. */
8080   UINT8 (*dma_read_callback)(void);
81   
81
8282   /* Callback to write the contents of the external RAM via the data bus.
83      Note that the address must be set and automatically increased
84      by external circuitry. */
83       Note that the address must be set and automatically increased
84       by external circuitry. */
8585   void (*dma_write_callback)(UINT8 data);
8686
8787   /* Preliminary MFM hard disk interface. Gets next id. */
8888   void (*mfmhd_get_next_id)(int head, chrn_id_hd *id);
8989
9090   /* Preliminary MFM hard disk interface. Performs a seek. */
91   void (*mfmhd_seek)(int direction);   
91   void (*mfmhd_seek)(int direction);
9292
9393   /* Preliminary MFM hard disk interface. Reads a sector. */
94   void (*mfmhd_read_sector)(int cylinder, int head, int sector, UINT8 **buf, int *sector_length);   
94   void (*mfmhd_read_sector)(int cylinder, int head, int sector, UINT8 **buf, int *sector_length);
9595
9696   /* Preliminary MFM hard disk interface. Writes a sector. */
97   void (*mfmhd_write_sector)(int cylinder, int head, int sector, UINT8 *buf, int sector_length);   
97   void (*mfmhd_write_sector)(int cylinder, int head, int sector, UINT8 *buf, int sector_length);
9898
9999   /* Preliminary MFM hard disk interface. Reads a track. */
100   void (*mfmhd_read_track)(int head, UINT8 **buffer, int *data_count);   
100   void (*mfmhd_read_track)(int head, UINT8 **buffer, int *data_count);
101101
102102   /* Preliminary MFM hard disk interface. Writes a track. */
103   void (*mfmhd_write_track)(int head, UINT8 *buffer, int data_count);     
103   void (*mfmhd_write_track)(int head, UINT8 *buffer, int data_count);
104104} smc92x4_interface;
105105
106106/* device interface */
r8044r8045
120120#define MDRV_SMC92X4_ADD(_tag, _intrf) \
121121   MDRV_DEVICE_ADD(_tag, SMC92X4, 0) \
122122   MDRV_DEVICE_CONFIG(_intrf)
123   
123
124124#endif
src/mess/machine/ti99_4x.h
r8044r8045
127127#endif
128128
129129/*
130   Configuration values
130    Configuration values
131131*/
132132enum
133133{
r8044r8045
146146{
147147   DISK_NONE = 0,
148148   DISK_TIFDC,
149   DISK_BWG,   
149   DISK_BWG,
150150   DISK_HFDC,
151151   DISK_CC
152152};
r8044r8045
191191
192192
193193/* Cartridge types */
194enum
194enum
195195{
196196   STANDARD,
197197   EXBAS,
src/mess/formats/nes_dsk.c
r8044r8045
4444      /* the image has no header, hence let's trust the extension and load the file */
4545      *vote = 100;
4646   }
47   
47
4848   return FLOPPY_ERROR_SUCCESS;
4949}
5050
src/mess/formats/flopimg.c
r8044r8045
744744   fmt = floppy_callbacks(floppy);
745745   if (!fmt->get_track_size)
746746      return 0;
747   
747
748748   return fmt->get_track_size(floppy, head, track);
749749}
750750
src/mess/formats/d64_dsk.c
r8044r8045
1010
1111    TODO:
1212
13   - fix MAX_ERROR_SECTORS, it is too small for d80/d82
14   - write to disk
13    - fix MAX_ERROR_SECTORS, it is too small for d80/d82
14    - write to disk
1515    - disk errors 24, 25, 26, 28, 74
1616    - variable gaps
1717
r8044r8045
266266
267267/*-------------------------------------------------
268268    get_sector_error_code - returns the error
269   code for the given sector
269    code for the given sector
270270-------------------------------------------------*/
271271
272272static int get_sector_error_code(floppy_image *floppy, int head, int dos_track, int sector)
r8044r8045
498498
499499         if (sector_error == ERROR_23)
500500            sector_checksum ^= 0xff;
501         
501
502502         /*
503503                $00      - data block ID ($07)
504504                $01-100  - 256 bytes sector data
src/mess/formats/atom_atm.c
r8044r8045
3838{
3939   /*
4040
41      The format for the .ATM files is as follows:
41        The format for the .ATM files is as follows:
4242
43      Offset Size     Description
44      ------ -------- -----------------------------------------------------------
45      0000h  16 BYTEs ATOM filename (if less than 16 BYTEs, rest is 00h bytes)
46      0010h  WORD     Start address for load
47      0012h  WORD     Execution address
48      0014h  WORD     Size of data in BYTEs
49      0016h  Size     Data
43        Offset Size     Description
44        ------ -------- -----------------------------------------------------------
45        0000h  16 BYTEs ATOM filename (if less than 16 BYTEs, rest is 00h bytes)
46        0010h  WORD     Start address for load
47        0012h  WORD     Execution address
48        0014h  WORD     Size of data in BYTEs
49        0016h  Size     Data
5050
51   */
52   
51    */
52
5353   UINT8 header[0x16] = { 0 };
5454
5555   image_fread(image, header, 0x16);
src/mess/formats/atarist_dsk.c
r8044r8045
1111
1212/*
1313
14   TODO:
14    TODO:
1515
16   - MSA format
17   - STT format
18   - DIM format
16    - MSA format
17    - STT format
18    - DIM format
1919
2020*/
2121
r8044r8045
6868
6969FLOPPY_OPTIONS_START( atarist )
7070   FLOPPY_OPTION( atarist, "st", "Atari ST floppy disk image", atarist_st_identify, atarist_st_construct, NULL )
71/*   FLOPPY_OPTION( atarist, "stt", "Atari ST floppy disk image", atarist_stt_identify, atarist_stt_construct, NULL )
72   FLOPPY_OPTION( atarist, "msa", "Atari ST floppy disk image", atarist_msa_identify, atarist_msa_construct, NULL )
73   FLOPPY_OPTION( atarist, "dim", "Atari ST floppy disk image", atarist_dim_identify, atarist_dim_construct, NULL )*/
71/*  FLOPPY_OPTION( atarist, "stt", "Atari ST floppy disk image", atarist_stt_identify, atarist_stt_construct, NULL )
72    FLOPPY_OPTION( atarist, "msa", "Atari ST floppy disk image", atarist_msa_identify, atarist_msa_construct, NULL )
73    FLOPPY_OPTION( atarist, "dim", "Atari ST floppy disk image", atarist_dim_identify, atarist_dim_construct, NULL )*/
7474FLOPPY_OPTIONS_END
src/mess/formats/atom_tap.c
r8044r8045
88
99/*
1010
11   http://beebwiki.jonripley.com/Acorn_cassette_format#Atom
11    http://beebwiki.jonripley.com/Acorn_cassette_format#Atom
1212
13   The Atom supports the System series format (as a 'nameless file') and its own format. The data consists of files separated
14   by carrier breaks and the appropriate leaders and trailers, and further subdivided into blocks separated by inter-block gaps.
15   An Atom block consists of the following sequence of bytes:
13    The Atom supports the System series format (as a 'nameless file') and its own format. The data consists of files separated
14    by carrier breaks and the appropriate leaders and trailers, and further subdivided into blocks separated by inter-block gaps.
15    An Atom block consists of the following sequence of bytes:
1616
17      Four synchronisation bytes (&2A).
18      File name (one to thirteen characters).
19      One end of file name marker byte (&0D).
20      Block flag, one byte.
21      Block number, two bytes, high byte first.
22      Data block length ? 1, one byte.
23      Execution address, two bytes, high byte first.
24      Load address, two bytes, high byte first.
25      Data, 0 to 256 bytes.
26      Checksum, one byte.
17        Four synchronisation bytes (&2A).
18        File name (one to thirteen characters).
19        One end of file name marker byte (&0D).
20        Block flag, one byte.
21        Block number, two bytes, high byte first.
22        Data block length ? 1, one byte.
23        Execution address, two bytes, high byte first.
24        Load address, two bytes, high byte first.
25        Data, 0 to 256 bytes.
26        Checksum, one byte.
2727
28   The block flag is set as follows:
28    The block flag is set as follows:
2929
30      Bit 7 is set if this block is not the last block of a file.
31      Bit 6 is set if the block contains data. If clear then the 'data block length' field is invalid.
32      Bit 5 is set if this block is not the first block of a file.
33      Bits 4 to 0 are undefined. Normally their contents are:
34      in the first block, bits 15 to 11 of the end address (=1 + the last address saved in the file);
35      in subsequent blocks, bits 6 to 2 of the previous block flag.
36   
37   The checksum is a simple sum (modulo 256) of all bytes from the start of the filename to the end of the data.
30        Bit 7 is set if this block is not the last block of a file.
31        Bit 6 is set if the block contains data. If clear then the 'data block length' field is invalid.
32        Bit 5 is set if this block is not the first block of a file.
33        Bits 4 to 0 are undefined. Normally their contents are:
34        in the first block, bits 15 to 11 of the end address (=1 + the last address saved in the file);
35        in subsequent blocks, bits 6 to 2 of the previous block flag.
3836
37    The checksum is a simple sum (modulo 256) of all bytes from the start of the filename to the end of the data.
38
3939*/
4040
4141#include "emu.h"
r8044r8045
128128    CassetteFormat atom_tap_cassette_format
129129-------------------------------------------------*/
130130
131const struct CassetteFormat atom_tap_format =
131const struct CassetteFormat atom_tap_format =
132132{
133133   "tap",
134134   atom_tap_identify,
src/mess/formats/wavfile.c
r8044r8045
282282   }
283283
284284   cassette_close(cassette);
285   
285
286286   fclose(f);
287287}
288288#endif
src/mess/formats/cbm_snqk.c
r8044r8045
11/***********************************************
2
2
33 CBM Quickloads
4
4
55 ***********************************************/
66
77#include "emu.h"
r8044r8045
1616   UINT16 address = 0;
1717   int i;
1818   const address_space *space = cpu_get_address_space(image->machine->firstcpu, ADDRESS_SPACE_PROGRAM);
19   
19
2020   if (!file_type)
2121      goto error;
22   
22
2323   if (!mame_stricmp(file_type, "prg"))
2424   {
2525      /* prg files */
r8044r8045
4848   {
4949      goto error;
5050   }
51   
51
5252   image_fread(image, &address, 2);
5353   address = LITTLE_ENDIANIZE_INT16(address);
5454   if (!mame_stricmp(file_type, "t64"))
5555      address = 2049;
5656   snapshot_size -= 2;
57   
57
5858   data = (UINT8*)malloc(snapshot_size);
5959   if (!data)
6060      goto error;
61   
61
6262   bytesread = image_fread(image, data, snapshot_size);
6363   if (bytesread != snapshot_size)
6464      goto error;
65   
65
6666   for (i = 0; i < snapshot_size; i++)
6767      memory_write_byte(space, address + i + offset, data[i]);
68   
68
6969   cbm_sethiaddress(image->machine, address + snapshot_size);
7070   free(data);
7171   return INIT_PASS;
72   
72
7373error:
7474   if (data)
7575      free(data);
r8044r8045
7979static void cbm_quick_sethiaddress( running_machine *machine, UINT16 hiaddress )
8080{
8181   const address_space *space = cpu_get_address_space(machine->firstcpu, ADDRESS_SPACE_PROGRAM);
82   
82
8383   memory_write_byte(space, 0x31, hiaddress & 0xff);
8484   memory_write_byte(space, 0x2f, hiaddress & 0xff);
8585   memory_write_byte(space, 0x2d, hiaddress & 0xff);
r8044r8045
106106static void cbm_pet_quick_sethiaddress( running_machine *machine, UINT16 hiaddress )
107107{
108108   const address_space *space = cpu_get_address_space(machine->firstcpu, ADDRESS_SPACE_PROGRAM);
109   
109
110110   memory_write_byte(space, 0x2e, hiaddress & 0xff);
111111   memory_write_byte(space, 0x2c, hiaddress & 0xff);
112112   memory_write_byte(space, 0x2a, hiaddress & 0xff);
r8044r8045
123123static void cbm_pet1_quick_sethiaddress(running_machine *machine, UINT16 hiaddress)
124124{
125125   const address_space *space = cpu_get_address_space(machine->firstcpu, ADDRESS_SPACE_PROGRAM);
126   
126
127127   memory_write_byte(space, 0x80, hiaddress & 0xff);
128128   memory_write_byte(space, 0x7e, hiaddress & 0xff);
129129   memory_write_byte(space, 0x7c, hiaddress & 0xff);
r8044r8045
140140static void cbmb_quick_sethiaddress(running_machine *machine, UINT16 hiaddress)
141141{
142142   const address_space *space = cpu_get_address_space(machine->firstcpu, ADDRESS_SPACE_PROGRAM);
143   
143
144144   memory_write_byte(space, 0xf0046, hiaddress & 0xff);
145145   memory_write_byte(space, 0xf0047, hiaddress >> 8);
146146}
r8044r8045
158158static void cbm_c65_quick_sethiaddress( running_machine *machine, UINT16 hiaddress )
159159{
160160   const address_space *space = cpu_get_address_space(machine->firstcpu, ADDRESS_SPACE_PROGRAM);
161   
161
162162   memory_write_byte(space, 0x82, hiaddress & 0xff);
163163   memory_write_byte(space, 0x83, hiaddress >> 8);
164164}
src/mess/formats/ti99_dsk.c
r8044r8045
8484#define TI99_IDAM_LENGTH 7
8585
8686/*
87   Determines whether we are using 80 track drives. This variable is
88   necessary unless we get information about the dip
89   switch settings. It is set from 99_dsk.c, currenly the only client.
87    Determines whether we are using 80 track drives. This variable is
88    necessary unless we get information about the dip
89    switch settings. It is set from 99_dsk.c, currenly the only client.
9090*/
9191static int use_80_track_drives = FALSE;
9292
r8044r8045
110110};
111111
112112/*
113   Parametrizes the format to use 80 track drives. For TI systems we
114   need to be able to emulate 40 track drives and 80 track drives.
115   This is set in the configuration, but the format has no direct access.
116   So as a preliminary solution we use this global function which sets the
117   flag. This function is called by the controllers defined in 99_dsk.
113    Parametrizes the format to use 80 track drives. For TI systems we
114    need to be able to emulate 40 track drives and 80 track drives.
115    This is set in the configuration, but the format has no direct access.
116    So as a preliminary solution we use this global function which sets the
117    flag. This function is called by the controllers defined in 99_dsk.
118118*/
119119void ti99_set_80_track_drives(int use80)
120120{
r8044r8045
645645   int imgtrack = track;
646646
647647   /* Find out if we are going to write an FM or MFM track. Caution: The
648   original TI controller is known to have a bug in the formatting
649   routine (using a MOVB instead of a MOV instruction when setting the
650   pointer to the track data), outputting false bytes at the
651   beginning of the track. So we don't rely on absolute positions
652   (neither does the controller).
653   */
648    original TI controller is known to have a bug in the formatting
649    routine (using a MOVB instead of a MOV instruction when setting the
650    pointer to the track data), outputting false bytes at the
651    beginning of the track. So we don't rely on absolute positions
652    (neither does the controller).
653    */
654654   track_image = (UINT8*)buffer;
655655
656656   if (use_80_track_drives && tag->tracks<=40)
r8044r8045
663663   gap1 = 10;
664664   gap2 = 12;
665665   is_fm = FALSE;
666   
666
667667   current_pos = find_block(track_image, 0, 100, 0x4e, leadin);
668   
668
669669   /* In case of defect formats, we continue as far as possible. This
670   may lead to sectors not being written. */
670    may lead to sectors not being written. */
671671   if (current_pos==TI99DSK_BLOCKNOTFOUND)
672672   {
673673      /* Not MFM, possibly FM image */
r8044r8045
740740         else
741741         {
742742            /* else the sector head data do not match the
743            current track and head. Ignore the sector. */
743                current track and head. Ignore the sector. */
744744            logerror("Wrong track: wtrack=%d, imgtrack=%d, whead=%d, imghead=%d\n",wtrack,imgtrack, whead,head);
745745         }
746746      }
r8044r8045
12731273   floppy_image_read(floppy, buffer, track_offset, buflen);
12741274
12751275   /* Rebuild the CRCs. PC99 did not store the CRC but put
1276   F7F7 in its place.
1277   The first CRC is at position IDAM + 5
1278   The second CRC is at position IDAM + 0x119 (FM) or +0x12d (MFM)
1279   All this is repeated for each sector in the track
1280   */
1276    F7F7 in its place.
1277    The first CRC is at position IDAM + 5
1278    The second CRC is at position IDAM + 0x119 (FM) or +0x12d (MFM)
1279    All this is repeated for each sector in the track
1280    */
12811281   if (determine_offset(tag->format, track_data, &first_idam)==FLOPPY_ERROR_SEEKERROR)
12821282      return FLOPPY_ERROR_SEEKERROR;
12831283
r8044r8045
12881288      if (byte == TI99_IDAM)
12891289      {
12901290         /* Do we have a valid CRCs already? Then this image
1291         already contains proper CRCs handling. Do not
1292         recreate them. */
1291            already contains proper CRCs handling. Do not
1292            recreate them. */
12931293         if (track_data[i+5] != 0xf7 || track_data[i+6] != 0xf7)
12941294            return FLOPPY_ERROR_SUCCESS;
12951295
r8044r8045
13481348      return err;
13491349
13501350   /* According to the TDF format, we don't need the CRC but replace it
1351   with F7F7. For now we keep it and see whether PC99 can cope with
1352   that. (Otherwise we would have to copy the const buffer). */
1351    with F7F7. For now we keep it and see whether PC99 can cope with
1352    that. (Otherwise we would have to copy the const buffer). */
13531353   floppy_image_write(floppy, buffer, offset + track_offset, buflen);
13541354   return FLOPPY_ERROR_SUCCESS;
13551355}
r8044r8045
13701370*/
13711371
13721372/*
1373   Get a sector from a track. This function takes a complete track,
1374   searches for the sector, and passes a pointer to the sector contents
1375   back.
1376   As the original TI controller creates bad bytes at the start of a track
1377   we do *not* assume a simple layout. The strategy is to search the
1378   lead-in of the track, and from this offset, step through the track
1379   in search for the sector. Since we do not have index marks (we cannot
1380   distinguish them from ordinary data, as we do not store the clock), we
1381   do not attempt to detect IDAM or DAM.
1373    Get a sector from a track. This function takes a complete track,
1374    searches for the sector, and passes a pointer to the sector contents
1375    back.
1376    As the original TI controller creates bad bytes at the start of a track
1377    we do *not* assume a simple layout. The strategy is to search the
1378    lead-in of the track, and from this offset, step through the track
1379    in search for the sector. Since we do not have index marks (we cannot
1380    distinguish them from ordinary data, as we do not store the clock), we
1381    do not attempt to detect IDAM or DAM.
13821382*/
13831383static floperr_t ti99_tdf_seek_sector_in_track(floppy_image *floppy, int head, int track, int sector, UINT8 *track_data, UINT8 **sector_data)
13841384{
r8044r8045
14571457}
14581458
14591459/*
1460   Writes a sector into the track. Note that the indexed_write method
1461   may be used instead of this method, according to the implementation
1462   of flopimg/flopdrv.
1460    Writes a sector into the track. Note that the indexed_write method
1461    may be used instead of this method, according to the implementation
1462    of flopimg/flopdrv.
14631463*/
14641464static floperr_t ti99_tdf_write_sector(floppy_image *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
14651465{
r8044r8045
17091709}
17101710
17111711/*
1712   Required for ReadAddress command. This function gets the 1st, 2nd, 3rd,
1713   sector (and so on) from the track, not sector 1, 2, 3. That is, the
1714   returned sector info depends on the interleave and the start sector.
1712    Required for ReadAddress command. This function gets the 1st, 2nd, 3rd,
1713    sector (and so on) from the track, not sector 1, 2, 3. That is, the
1714    returned sector info depends on the interleave and the start sector.
17151715*/
17161716static floperr_t ti99_tdf_get_indexed_sector_info(floppy_image *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
17171717{
src/mess/formats/cbm_snqk.h
r8044r8045
11/***********************************************
2
2
33    CBM Quickloads
4
4
55 ***********************************************/
66
77#ifndef __CBM_SNQK_H__
src/mess/formats/fdi_dsk.c
r8044r8045
119119   UINT8 minsize[3];
120120   UINT8 maxsize[3];
121121   UINT8 indexsize[3];
122//   UINT8 averagedt[averagesz];
123//   UINT8 mindata[minsize];
124//   UINT8 maxdata[maxsize];
125//   UINT8 indexdata[indexsize];
122//  UINT8 averagedt[averagesz];
123//  UINT8 mindata[minsize];
124//  UINT8 maxdata[maxsize];
125//  UINT8 indexdata[indexsize];
126126};
127127
128128/***************************************************************************
r8044r8045
160160/*
161161static UINT32 fdi_get_sector_offset(floppy_image* floppy, int head, int track, int sector)
162162{
163   return 0;
163    return 0;
164164}
165165*/
166166static floperr_t fdi_get_indexed_sector_info(floppy_image *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
r8044r8045
238238   tag->version = header.version[0];
239239   tag->tracks = pick_integer_be(header.ltrack, 0, 2) + 1;
240240   tag->heads = header.lhead + 1;
241   
241
242242   if (LOG)
243243   {
244244      logerror("FDI creator: %s\n", header.creator);
r8044r8045
279279   callbacks->get_sector_length = fdi_get_sector_length;
280280   callbacks->read_sector = fdi_read_sector;
281281   callbacks->read_indexed_sector = fdi_read_indexed_sector;
282//   callbacks->write_track = fdi_write_track;
282//  callbacks->write_track = fdi_write_track;
283283   callbacks->write_sector = fdi_write_sector;
284284   callbacks->write_indexed_sector = fdi_write_indexed_sector;
285285   callbacks->get_indexed_sector_info = fdi_get_indexed_sector_info;
src/mess/formats/trs_cmd.c
r8044r8045
3636QUICKLOAD_LOAD( trs80_cmd )
3737{
3838    const address_space *program = cpu_get_address_space(image->machine->firstcpu, ADDRESS_SPACE_PROGRAM);
39   
39
4040   UINT8 type, length;
4141   UINT8 data[0x100];
4242   UINT8 addr[2];
src/mess/drivers/jaguar.c
r8044r8045
701701      RAM[i+1] = j[2];
702702      RAM[i+2] = j[1];
703703      RAM[i+3] = j[0];
704   }
704   }
705705}
706706
707707static DRIVER_INIT( jaguar )
r8044r8045
785785      size = image_length(image);
786786
787787      /* .rom files load & run at 802000 */
788      if (!mame_stricmp(image_filetype(image), "rom"))   
788      if (!mame_stricmp(image_filetype(image), "rom"))
789789      {
790790         load_offset = 0x2000;      // fix load address
791791         cart_base[0x101]=0x802000;   // fix exec address
src/mess/drivers/ti99_8.c
r8044r8045
228228      PORT_CONFSETTING(    0x01, "TI SD Floppy Controller" )
229229      PORT_CONFSETTING(    0x02, "SNUG BwG Controller" )
230230      PORT_CONFSETTING(    0x03, "Myarc HFDC" )
231//      PORT_CONFSETTING(    0x04, "Corcomp" )
231//      PORT_CONFSETTING(    0x04, "Corcomp" )
232232
233233   PORT_START( "HDCTRL" )
234234   PORT_CONFNAME( 0x03, 0x00, "HD controller" )
235235      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
236236      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
237//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
237//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
238238   PORT_CONFNAME( 0x08, 0x00, "USB-SM card" )
239239      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
240240      PORT_CONFSETTING(    0x08, DEF_STR( On ) )
r8044r8045
243243   PORT_CONFNAME( 0x03, 0x00, "Serial/Parallel interface" )
244244      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
245245      PORT_CONFSETTING(    0x01, "TI RS-232 card" )
246   
246
247247   PORT_START( "EXTCARD" )
248248   PORT_CONFNAME( 0x01, 0x00, "HSGPL extension" )
249249      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
r8044r8045
256256   PORT_CONFNAME( 0x01, 0x00, "Mouse support" )
257257      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
258258      PORT_CONFSETTING(    0x01, "Mechatronics Mouse" )
259     
259
260260   PORT_START( "CARTSLOT" )
261261   PORT_CONFNAME( 0x07, 0x00, "Cartridge slot" )
262262      PORT_CONFSETTING(    0x00, "Auto" )
r8044r8045
264264      PORT_CONFSETTING(    0x02, "Slot 2" )
265265      PORT_CONFSETTING(    0x03, "Slot 3" )
266266      PORT_CONFSETTING(    0x04, "Slot 4" )
267//      PORT_CONFSETTING(    0x05, "GRAM Kracker" )
267//      PORT_CONFSETTING(    0x05, "GRAM Kracker" )
268268
269269   PORT_START( "HFDCDIP" )
270270   PORT_DIPNAME( 0x03, 0x02, "HFDC drive config" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 )
271271      PORT_DIPSETTING( 0x00, "40 track, 16 ms")
272272      PORT_DIPSETTING( 0x01, "40 track, 8 ms")
273273      PORT_DIPSETTING( 0x02, "80 track, 2 ms")
274      PORT_DIPSETTING( 0x03, "80 track HD, 2 ms")     
274      PORT_DIPSETTING( 0x03, "80 track HD, 2 ms")
275275
276276   PORT_START( "DRVSPD" )
277277   PORT_DIPNAME( 0x01, 0x01, "Floppy and HD speed" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 )
r8044r8045
562562   /* devices */
563563   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )
564564
565//   MDRV_IMPORT_FROM( smc92x4_hd )
565//  MDRV_IMPORT_FROM( smc92x4_hd )
566566
567567   MDRV_IDE_HARDDISK_ADD( "ide_harddisk" )
568568   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
r8044r8045
617617   /* devices */
618618   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
619619
620//   MDRV_IMPORT_FROM( smc92x4_hd )
620//  MDRV_IMPORT_FROM( smc92x4_hd )
621621
622622   MDRV_IDE_HARDDISK_ADD( "ide_harddisk" )
623623   MDRV_RTC65271_ADD("ide_rtc", ti99_clk_interrupt_callback)
src/mess/drivers/pipbug.c
r8044r8045
11/***************************************************************************
2   
2
33        pipbug
44
55        08/04/2010 Skeleton driver.
r8044r8045
1212static ADDRESS_MAP_START(pipbug_mem, ADDRESS_SPACE_PROGRAM, 8)
1313   ADDRESS_MAP_UNMAP_HIGH
1414   AM_RANGE( 0x0000, 0x03ff) AM_ROM
15   AM_RANGE( 0x0400, 0x7fff) AM_RAM   
15   AM_RANGE( 0x0400, 0x7fff) AM_RAM
1616ADDRESS_MAP_END
1717
1818static ADDRESS_MAP_START( pipbug_io , ADDRESS_SPACE_IO, 8)
19   ADDRESS_MAP_UNMAP_HIGH   
19   ADDRESS_MAP_UNMAP_HIGH
2020ADDRESS_MAP_END
2121
2222/* Input ports */
r8044r8045
2424INPUT_PORTS_END
2525
2626
27static MACHINE_RESET(pipbug)
28{   
27static MACHINE_RESET(pipbug)
28{
2929}
3030
3131static VIDEO_START( pipbug )
r8044r8045
4141    /* basic machine hardware */
4242    MDRV_CPU_ADD("maincpu",S2650, XTAL_1MHz)
4343    MDRV_CPU_PROGRAM_MAP(pipbug_mem)
44    MDRV_CPU_IO_MAP(pipbug_io)   
44    MDRV_CPU_IO_MAP(pipbug_io)
4545
4646    MDRV_MACHINE_RESET(pipbug)
47   
47
4848    /* video hardware */
4949    MDRV_SCREEN_ADD("screen", RASTER)
5050    MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
6868/* Driver */
6969
7070/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME       FLAGS */
71COMP( 1979, pipbug,  0,       0,    pipbug,    pipbug,     0,  "<unknown>",   "PIPBUG",      GAME_NOT_WORKING | GAME_NO_SOUND )
71COMP( 1979, pipbug,  0,       0,   pipbug,    pipbug,     0,  "<unknown>",   "PIPBUG",      GAME_NOT_WORKING | GAME_NO_SOUND )
7272
src/mess/drivers/x1.c
r8044r8045
877877{
878878   UINT8 *rom = memory_region(space->machine, "cart_img");
879879
880//   printf("%06x\n",rom_index[0]<<16|rom_index[1]<<8|rom_index[2]<<0);
880//  printf("%06x\n",rom_index[0]<<16|rom_index[1]<<8|rom_index[2]<<0);
881881
882882   return rom[rom_index[0]<<16|rom_index[1]<<8|rom_index[2]<<0];
883883}
r8044r8045
19581958{
19591959   { "x1kb" },
19601960   { "ctc" },
1961     { "dma" },
1961   { "dma" },
19621962//  { "sio" },
19631963   { NULL }
19641964};
src/mess/drivers/dolphin.c
r8044r8045
11/***************************************************************************
2   
2
33        dolphin
44
55        08/04/2010 Skeleton driver.
r8044r8045
1212static ADDRESS_MAP_START(dolphin_mem, ADDRESS_SPACE_PROGRAM, 8)
1313   ADDRESS_MAP_UNMAP_HIGH
1414   AM_RANGE( 0x0000, 0x00ff) AM_ROM
15   AM_RANGE( 0x0100, 0x7fff) AM_RAM   
15   AM_RANGE( 0x0100, 0x7fff) AM_RAM
1616ADDRESS_MAP_END
1717
1818static ADDRESS_MAP_START( dolphin_io , ADDRESS_SPACE_IO, 8)
r8044r8045
2424INPUT_PORTS_END
2525
2626
27static MACHINE_RESET(dolphin)
28{   
27static MACHINE_RESET(dolphin)
28{
2929}
3030
3131static VIDEO_START( dolphin )
r8044r8045
4141    /* basic machine hardware */
4242    MDRV_CPU_ADD("maincpu",S2650, XTAL_1MHz)
4343    MDRV_CPU_PROGRAM_MAP(dolphin_mem)
44    MDRV_CPU_IO_MAP(dolphin_io)   
44    MDRV_CPU_IO_MAP(dolphin_io)
4545
4646    MDRV_MACHINE_RESET(dolphin)
47   
47
4848    /* video hardware */
4949    MDRV_SCREEN_ADD("screen", RASTER)
5050    MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
6868/* Driver */
6969
7070/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY   FULLNAME       FLAGS */
71COMP( 1979, dolphin,  0,       0,    dolphin,    dolphin,     0,   "<unknown>",   "Dolphin",      GAME_NOT_WORKING | GAME_NO_SOUND )
71COMP( 1979, dolphin,  0,       0,   dolphin,   dolphin,    0,   "<unknown>",   "Dolphin",      GAME_NOT_WORKING | GAME_NO_SOUND )
7272
src/mess/drivers/radio86.c
r8044r8045
383383   MDRV_CPU_PROGRAM_MAP(radio86rom_mem)
384384
385385   MDRV_I8255A_ADD( "ppi8255_2", radio86_ppi8255_interface_2 )
386   
386
387387   MDRV_CARTSLOT_ADD("cart")
388388   MDRV_CARTSLOT_EXTENSION_LIST("bin,rom")
389389   MDRV_CARTSLOT_NOT_MANDATORY
src/mess/drivers/advision.c
r8044r8045
6464static DEVICE_IMAGE_LOAD( advision_cart )
6565{
6666   UINT32 size;
67   
67
6868   if (image_software_entry(image) == NULL)
6969   {
7070      size = image_length(image);
r8044r8045
7474         image_seterror(image, IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
7575         return INIT_FAIL;
7676      }
77     
77
7878      if (image_fread(image, memory_region(image->machine, I8048_TAG), size) != size)
7979      {
8080         image_seterror(image, IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file");
8181         return INIT_FAIL;
8282      }
83     
83
8484   }
8585   else
8686   {
src/mess/drivers/arcadia.c
r8044r8045
150150   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER )    PORT_NAME("Option")          PORT_CODE(KEYCODE_O)
151151   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SELECT )   PORT_NAME("Select")
152152//  PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER )    PORT_NAME("Reset")           PORT_CODE(KEYCODE_R)         Not implemented
153   
153
154154   PORT_START("controller1_col1")
155155   PORT_BIT( 0xf0, 0xf0, IPT_UNUSED)
156156   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_NAME("P1 Keypad 1") PORT_CODE(KEYCODE_1_PAD)
r8044r8045
466466   if (image_software_entry(image) == NULL)
467467   {
468468      size = image_length(image);
469     
469
470470      if (size > memory_region_length(image->machine, "maincpu"))
471471         size = memory_region_length(image->machine, "maincpu");
472     
472
473473      if (image_fread(image, rom, size) != size)
474474         return INIT_FAIL;
475475   }
r8044r8045
478478      size = image_get_software_region_length(image, "rom");
479479      memcpy(rom, image_get_software_region(image, "rom"), size);
480480   }
481   
481
482482   if (size > 0x1000)
483483      memmove(rom + 0x2000, rom + 0x1000, size - 0x1000);
484 
484
485485   if (size > 0x2000)
486486      memmove(rom + 0x4000, rom + 0x3000, size - 0x2000);
487487
r8044r8045
489489   // golf cartridge support
490490   // 4kbyte at 0x0000
491491   // 2kbyte at 0x4000
492   if (size <= 0x2000)
492   if (size <= 0x2000)
493493      memcpy(rom + 0x4000, rom + 0x2000, 0x1000);
494494#else
495495   /* this is a testpatch for the golf cartridge
r8044r8045
522522      { 0x20ec,0x42,0x22 }
523523   };
524524
525   for (i = 0; i < ARRAY_LENGTH(patch); i++)
525   for (i = 0; i < ARRAY_LENGTH(patch); i++)
526526   {
527527       assert(rom[patch[i].address] == patch[i].old);
528528       rom[patch[i].address] = patch[i].new;
src/mess/drivers/m20.c
r8044r8045
6262   AM_RANGE( 0x40000, 0x41fff ) AM_ROM AM_REGION("maincpu",0x10000) //mirror
6363
6464   AM_RANGE( 0x30000, 0x33fff ) AM_RAM AM_BASE(&m20_vram)//base vram
65//   AM_RANGE( 0x34000, 0x37fff ) AM_RAM //extra vram for bitmap mode
66//   AM_RANGE( 0x20000, 0x2???? ) //work RAM?
65//  AM_RANGE( 0x34000, 0x37fff ) AM_RAM //extra vram for bitmap mode
66//  AM_RANGE( 0x20000, 0x2???? ) //work RAM?
6767//
6868ADDRESS_MAP_END
6969
src/mess/drivers/spectrum.c
r8044r8045
182182------------------------
183183
184184ZX Interface 1
185   up to 8 Microdrives
186   1 RS-232 port
187   2 ZX Network ports - http://scratchpad.wikia.com/wiki/ZX_Net
185    up to 8 Microdrives
186    1 RS-232 port
187    2 ZX Network ports - http://scratchpad.wikia.com/wiki/ZX_Net
188188
189189Opus Discovery
190   up to 2 Disk drives
191   1 Centronics port
192   1 Joystick port (Kempston)
190    up to 2 Disk drives
191    1 Centronics port
192    1 Joystick port (Kempston)
193193
194194DISCiPLE Interface
195   up to 2 Disk drives
196   1 Centronics port
197   2 Joystick ports (RH: Sinclair/Kempston, LH: Sinclair)
198   2 ZX Network ports
195    up to 2 Disk drives
196    1 Centronics port
197    2 Joystick ports (RH: Sinclair/Kempston, LH: Sinclair)
198    2 ZX Network ports
199199
200200Plus D Interface
201   up to 2 Disk drives
202   1 Centronics port
201    up to 2 Disk drives
202    1 Centronics port
203203
204204Rotronics Wafadrive
205   2 "Stringy" drives
206   1 RS-232 port
207   1 Centronics port
205    2 "Stringy" drives
206    1 RS-232 port
207    1 Centronics port
208208
209209Kempston Disc Interface
210   up to 4 Disk drives (KDOS)
210    up to 4 Disk drives (KDOS)
211211
212212Beta 128 Disk Interface
213   up to 4 Disk drives (TR-DOS)
213    up to 4 Disk drives (TR-DOS)
214214
215215Philips Disc ROM
216   ???
216    ???
217217
218218----------------
219219Game controllers
220220----------------
221221
222222ZX Interface 2
223   2 Joystick ports (Sinclair)
224   1 ROM slot
223    2 Joystick ports (Sinclair)
224    1 ROM slot
225225
226226Kempston Interface
227   1 Joystick port (Kempston)
227    1 Joystick port (Kempston)
228228
229229Protek/AGF/Cursor Interface
230   1 Joystick port (Protek)
230    1 Joystick port (Protek)
231231
232232Fuller Box
233   1 Joystick port (Fuller)
234   1 G1-AY-3-8912 sound chip - the chip is identical to the one present on the 128 model,
235                               but the I/O ports are different: http://scratchpad.wikia.com/wiki/AY-3-8912(a) and
236                               http://scratchpad.wikia.com/wiki/Timex_2000_series#Sound_Chip
233    1 Joystick port (Fuller)
234    1 G1-AY-3-8912 sound chip - the chip is identical to the one present on the 128 model,
235                                but the I/O ports are different: http://scratchpad.wikia.com/wiki/AY-3-8912(a) and
236                                http://scratchpad.wikia.com/wiki/Timex_2000_series#Sound_Chip
237237
238238Mikro-Plus Interface
239   1 Joystick port (Mikrogen)
240   1 ROM slot - http://www.worldofspectrum.org/showmag.cgi?mag=Crash/Issue19/Pages/Crash1900020.jpg
239    1 Joystick port (Mikrogen)
240    1 ROM slot - http://www.worldofspectrum.org/showmag.cgi?mag=Crash/Issue19/Pages/Crash1900020.jpg
241241
242242------------
243243Misc devices
r8044r8045
255255    Speech synthesis thru allophones (SP0256-AL2)
256256
257257MGT Messenger
258    Allows connection between ZX Spectrum and SAM Coupé
258    Allows connection between ZX Spectrum and SAM Coup??
259259
260260Soft-ROM
261261    A development system board - http://www.wearmouth.demon.co.uk/softrom.htm
r8044r8045
437437static ADDRESS_MAP_START (spectrum_mem, ADDRESS_SPACE_PROGRAM, 8)
438438   AM_RANGE(0x0000, 0x3fff) AM_ROM
439439   AM_RANGE(0x4000, 0x5aff) AM_RAM AM_BASE_MEMBER(spectrum_state,video_ram)
440//   AM_RANGE(0x5b00, 0x7fff) AM_RAM
441//   AM_RANGE(0x8000, 0xffff) AM_RAM
440//  AM_RANGE(0x5b00, 0x7fff) AM_RAM
441//  AM_RANGE(0x8000, 0xffff) AM_RAM
442442ADDRESS_MAP_END
443443
444444/* ports are not decoded full.
src/mess/drivers/sg1000.c
r8044r8045
824824{
825825   UINT32 size;
826826   UINT8 *ptr = memory_region(image->machine, Z80_TAG);
827   
827
828828   if (image_software_entry(image) == NULL)
829829   {
830830      size = image_length(image);
src/mess/drivers/px8.c
r8044r8045
1010
1111/*
1212
13   TODO:
13    TODO:
1414
15   - dumps of the internal ROMs
16   - uPD7508 CPU core
17   - keyboard
18   - cassette
19   - display
20   - jumpers
21   - ROM capsule
22   - uPD7001
23   - RAM disk (64K/128K RAM, Z80, 4K ROM)
24   - modem (82C55)
25   - Multi-Unit (60K RAM, ROM capsule, modem, 82C55)
26   - attach PF-10s
15    - dumps of the internal ROMs
16    - uPD7508 CPU core
17    - keyboard
18    - cassette
19    - display
20    - jumpers
21    - ROM capsule
22    - uPD7001
23    - RAM disk (64K/128K RAM, Z80, 4K ROM)
24    - modem (82C55)
25    - Multi-Unit (60K RAM, ROM capsule, modem, 82C55)
26    - attach PF-10s
2727
2828*/
2929
r8044r8045
132132   case GAH40M_ICRL_C:
133133      /*
134134
135         bit      signal      description
135            bit     signal      description
136136
137         0      ICR0
138         1      ICR1
139         2      ICR2
140         3      ICR3
141         4      ICR4
142         5      ICR5
143         6      ICR6
144         7      ICR7
137            0       ICR0
138            1       ICR1
139            2       ICR2
140            3       ICR3
141            4       ICR4
142            5       ICR5
143            6       ICR6
144            7       ICR7
145145
146      */
146        */
147147      break;
148148
149149   case GAH40M_ICRH_C:
150150      /*
151151
152         bit      signal      description
152            bit     signal      description
153153
154         0      ICR8
155         1      ICR9
156         2      ICR10
157         3      ICR11
158         4      ICR12
159         5      ICR13
160         6      ICR14
161         7      ICR15
154            0       ICR8
155            1       ICR9
156            2       ICR10
157            3       ICR11
158            4       ICR12
159            5       ICR13
160            6       ICR14
161            7       ICR15
162162
163      */
163        */
164164      break;
165165
166166   case GAH40M_ICRL_B:
167167      /*
168168
169         bit      signal      description
169            bit     signal      description
170170
171         0      ICR0
172         1      ICR1
173         2      ICR2
174         3      ICR3
175         4      ICR4
176         5      ICR5
177         6      ICR6
178         7      ICR7
171            0       ICR0
172            1       ICR1
173            2       ICR2
174            3       ICR3
175            4       ICR4
176            5       ICR5
177            6       ICR6
178            7       ICR7
179179
180      */
180        */
181181      break;
182182
183183   case GAH40M_ICRH_B:
184184      /*
185185
186         bit      signal      description
186            bit     signal      description
187187
188         0      ICR8
189         1      ICR9
190         2      ICR10
191         3      ICR11
192         4      ICR12
193         5      ICR13
194         6      ICR14
195         7      ICR15
188            0       ICR8
189            1       ICR9
190            2       ICR10
191            3       ICR11
192            4       ICR12
193            5       ICR13
194            6       ICR14
195            7       ICR15
196196
197      */
197        */
198198      break;
199199
200200   case GAH40M_ISR:
201201      /*
202202
203         bit      signal      description
203            bit     signal      description
204204
205         0      INT0      7508 interrupt (INT 7508)
206         1      INT1      82C51 interrupt (INT 82C51)
207         2      INT2      6303 interrupt (INT 6303)
208         3      INT3      input capture flag timer (CF)
209         4      INT4      overflow flag timer (OVF)
210         5      INT5      external interrupt (INTEXT)
211         6     
212         7     
205            0       INT0        7508 interrupt (INT 7508)
206            1       INT1        82C51 interrupt (INT 82C51)
207            2       INT2        6303 interrupt (INT 6303)
208            3       INT3        input capture flag timer (CF)
209            4       INT4        overflow flag timer (OVF)
210            5       INT5        external interrupt (INTEXT)
211            6
212            7
213213
214      */
214        */
215215      break;
216216
217217   case GAH40M_STR:
218218      /*
219219
220         bit      signal      description
220            bit     signal      description
221221
222         0      _BANK0     
223         1      BRDT      barcode reader data timer
224         2      RDY         ready (SIO)
225         3      RDYSIO      SIO ready (SIO)
226         4     
227         5     
228         6     
229         7     
222            0       _BANK0
223            1       BRDT        barcode reader data timer
224            2       RDY         ready (SIO)
225            3       RDYSIO      SIO ready (SIO)
226            4
227            5
228            6
229            7
230230
231      */
231        */
232232      break;
233233
234234   case GAH40M_SIOR:
235235      /*
236236
237         bit      signal      description
237            bit     signal      description
238238
239         0      SIO0
240         1      SIO1
241         2      SIO2
242         3      SIO3
243         4      SIO4
244         5      SIO5
245         6      SIO6
246         7      SIO7
239            0       SIO0
240            1       SIO1
241            2       SIO2
242            3       SIO3
243            4       SIO4
244            5       SIO5
245            6       SIO6
246            7       SIO7
247247
248      */
248        */
249249      break;
250250
251251   case GAH40M_IVR:
252252      /*
253253
254         bit      description
254            bit     description
255255
256         0      0
257         1      vect 1
258         2      vect 2
259         3      vect 3
260         4      1
261         5      1
262         6      1
263         7      1
256            0       0
257            1       vect 1
258            2       vect 2
259            3       vect 3
260            4       1
261            5       1
262            6       1
263            7       1
264264
265      */
265        */
266266      break;
267267   }
268268
r8044r8045
282282   case GAH40M_CTLR1:
283283      /*
284284
285         bit      signal      description
285            bit     signal      description
286286
287         0      _BANK0      bank switching
288         1      BCK0      barcode mode select 0 timer (down)
289         2      BCK1      barcode mode select 1 timer (up)
290         3      SWBCD      barcode reader switch timer
291         4      BRG0      bad rate generator select 0 timer
292         5      BRG1      bad rate generator select 1 timer
293         6      BRG2      bad rate generator select 2 timer
294         7      BRG3      bad rate generator select 3 timer
287            0       _BANK0      bank switching
288            1       BCK0        barcode mode select 0 timer (down)
289            2       BCK1        barcode mode select 1 timer (up)
290            3       SWBCD       barcode reader switch timer
291            4       BRG0        bad rate generator select 0 timer
292            5       BRG1        bad rate generator select 1 timer
293            6       BRG2        bad rate generator select 2 timer
294            7       BRG3        bad rate generator select 3 timer
295295
296      */
296        */
297297
298298      state->bank0 = BIT(data, 0);
299299      bankswitch(space->machine);
r8044r8045
302302   case GAH40M_CMDR:
303303      /*
304304
305         bit      description
305            bit     description
306306
307         0      set RDYSIOFF (pulse)
308         1      reset RDYSIOFF (pulse)
309         2      reset OVF (pulse)
310         3     
311         4     
312         5     
313         6     
314         7     
307            0       set RDYSIOFF (pulse)
308            1       reset RDYSIOFF (pulse)
309            2       reset OVF (pulse)
310            3
311            4
312            5
313            6
314            7
315315
316      */
316        */
317317      break;
318318
319319   case GAH40M_CTLR2:
320320      /*
321321
322         bit      signal      description
322            bit     signal      description
323323
324         0      LED0      LED
325         1      LED1      LED
326         2      LED2      LED
327         3      SWRS      RS-232C switch
328         4      INHRS      inhibit RS-232C
329         5      AUX         external auxiliary output
330         6     
331         7     
324            0       LED0        LED
325            1       LED1        LED
326            2       LED2        LED
327            3       SWRS        RS-232C switch
328            4       INHRS       inhibit RS-232C
329            5       AUX         external auxiliary output
330            6
331            7
332332
333      */
333        */
334334
335335      output_set_value("led_0", BIT(data, 0));
336336      output_set_value("led_1", BIT(data, 1));
r8044r8045
340340   case GAH40M_IER:
341341      /*
342342
343         bit      signal      description
343            bit     signal      description
344344
345         0      IER0      INT 7508 enable
346         1      IER1      INT 82C51 enable
347         2      IER2      INT 6303 enable
348         3      IER3      INTICF enable
349         4      IER4      INTOVF enable
350         5      IER5      INTEXT enable
351         6     
352         7     
345            0       IER0        INT 7508 enable
346            1       IER1        INT 82C51 enable
347            2       IER2        INT 6303 enable
348            3       IER3        INTICF enable
349            4       IER4        INTOVF enable
350            5       IER5        INTEXT enable
351            6
352            7
353353
354      */
354        */
355355
356356      state->ier = data;
357357      break;
r8044r8045
359359   case GAH40M_SIOR:
360360      /*
361361
362         bit      signal      description
362            bit     signal      description
363363
364         0      SIO0
365         1      SIO1
366         2      SIO2
367         3      SIO3
368         4      SIO4
369         5      SIO5
370         6      SIO6
371         7      SIO7
364            0       SIO0
365            1       SIO1
366            2       SIO2
367            3       SIO3
368            4       SIO4
369            5       SIO5
370            6       SIO6
371            7       SIO7
372372
373      */
373        */
374374
375375      state->sio = data;
376376      break;
r8044r8045
421421   case 1: /* command register */
422422      /*
423423
424         bit      signal      description
424            bit     signal      description
425425
426         0      SW PR      PROM power switch
427         1      SW MCT      microcassette power switch
428         2      MTA         microcassette drive motor control signal A
429         3      MTB         microcassette drive motor control signal B
430         4      MTC         microcassette drive motor control signal C
431         5     
432         6      _FAST     
433         7      _STOP CNT   
426            0       SW PR       PROM power switch
427            1       SW MCT      microcassette power switch
428            2       MTA         microcassette drive motor control signal A
429            3       MTB         microcassette drive motor control signal B
430            4       MTC         microcassette drive motor control signal C
431            5
432            6       _FAST
433            7       _STOP CNT
434434
435      */
435        */
436436
437437      state->swpr = BIT(data, 0);
438438      break;
r8044r8045
550550static ADDRESS_MAP_START( px8_slave_mem, ADDRESS_SPACE_PROGRAM, 8 )
551551   ADDRESS_MAP_UNMAP_HIGH
552552   AM_RANGE(0x0020, 0x0023) AM_READWRITE(gah40s_r, gah40s_w)
553//   AM_RANGE(0x0024, 0x0027) AM_DEVREADWRITE(SED1320_TAG, )
553//  AM_RANGE(0x0024, 0x0027) AM_DEVREADWRITE(SED1320_TAG, )
554554   AM_RANGE(0x0028, 0x0028) AM_WRITE(gah40s_ier_w)
555555   AM_RANGE(0x8000, 0x97ff) AM_RAM AM_BASE_MEMBER(px8_state, video_ram)
556556   AM_RANGE(0x9800, 0xefff) AM_NOP
r8044r8045
563563
564564static ADDRESS_MAP_START( px8_slave_io, ADDRESS_SPACE_IO, 8 )
565565   ADDRESS_MAP_UNMAP_HIGH
566//   AM_RANGE(M6803_PORT1, M6803_PORT1)
567//   AM_RANGE(M6803_PORT2, M6803_PORT2)
568//   AM_RANGE(M6803_PORT3, M6803_PORT3)
569//   AM_RANGE(M6803_PORT4, M6803_PORT4)
566//  AM_RANGE(M6803_PORT1, M6803_PORT1)
567//  AM_RANGE(M6803_PORT2, M6803_PORT2)
568//  AM_RANGE(M6803_PORT3, M6803_PORT3)
569//  AM_RANGE(M6803_PORT4, M6803_PORT4)
570570ADDRESS_MAP_END
571571
572572/*-------------------------------------------------
r8044r8045
574574-------------------------------------------------*/
575575
576576static ADDRESS_MAP_START( px8_sub_io, ADDRESS_SPACE_IO, 8 )
577//   AM_RANGE(0x00, 0x00) AM_READWRITE()
577//  AM_RANGE(0x00, 0x00) AM_READWRITE()
578578   AM_RANGE(0x01, 0x01) AM_READ(krtn_0_3_r)
579//   AM_RANGE(0x02, 0x02) AM_WRITE()
579//  AM_RANGE(0x02, 0x02) AM_WRITE()
580580   AM_RANGE(0x03, 0x03) AM_WRITE(ksc_w)
581//   AM_RANGE(0x04, 0x04) AM_WRITE()
581//  AM_RANGE(0x04, 0x04) AM_WRITE()
582582   AM_RANGE(0x05, 0x05) AM_READ(krtn_4_7_r)
583//   AM_RANGE(0x06, 0x06) AM_READ()
584//   AM_RANGE(0x07, 0x07) AM_WRITE()
583//  AM_RANGE(0x06, 0x06) AM_READ()
584//  AM_RANGE(0x07, 0x07) AM_WRITE()
585585ADDRESS_MAP_END
586586
587587/***************************************************************************
r8044r8045
865865
866866    /* sub CPU (uPD7508) */
867867//  MDRV_CPU_ADD(UPD7508_TAG, UPD7508, 200000) /* 200 kHz */
868//   MDRV_CPU_IO_MAP(px8_sub_io)
869//   MDRV_CPU_FLAGS(CPU_DISABLE)
868//  MDRV_CPU_IO_MAP(px8_sub_io)
869//  MDRV_CPU_FLAGS(CPU_DISABLE)
870870
871871   MDRV_MACHINE_START(px8)
872872   MDRV_MACHINE_RESET(px8)
r8044r8045
937937    SYSTEM DRIVERS
938938***************************************************************************/
939939
940/*    YEAR  NAME   PARENT   COMPAT   MACHINE   INPUT   INIT   COMPANY      FULLNAME   FLAGS */
940/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    COMPANY     FULLNAME    FLAGS */
941941COMP( 1984, px8,   0,      0,      px8,   px8,   0,      "Epson",   "PX-8",      GAME_NOT_WORKING )
src/mess/drivers/phc25.c
r8044r8045
88
99/*
1010
11   http://www.geocities.jp/sanyo_phc_25/
11    http://www.geocities.jp/sanyo_phc_25/
1212
13   Z80 @ 4 MHz
14   MC6847 video
15   3x 8KB bios ROM
16   1x 4KB chargen ROM
17   16KB RAM
18   6KB video RAM
13    Z80 @ 4 MHz
14    MC6847 video
15    3x 8KB bios ROM
16    1x 4KB chargen ROM
17    16KB RAM
18    6KB video RAM
1919
2020*/
2121
2222/*
2323
24   TODO:
24    TODO:
2525
26   - MC6847 mode selection lines
27   - tune cassette trigger level
28   - accurate video timing
26    - MC6847 mode selection lines
27    - tune cassette trigger level
28    - accurate video timing
2929
3030*/
3131
r8044r8045
4444{
4545   /*
4646
47      bit      description
47        bit     description
4848
49      0     
50      1     
51      2     
52      3     
53      4      vertical sync
54      5      cassette read
55      6      centronics busy
56      7      horizontal sync
49        0
50        1
51        2
52        3
53        4       vertical sync
54        5       cassette read
55        6       centronics busy
56        7       horizontal sync
5757
58   */
58    */
5959
6060   phc25_state *state = (phc25_state *)space->machine->driver_data;
6161
r8044r8045
8080{
8181   /*
8282
83      bit      description
83        bit     description
8484
85      0      cassette output
86      1      cassette motor
87      2      MC6847 INT/EXT
88      3      centronics strobe
89      4     
90      5      MC6847
91      6      MC6847
92      7      MC6847 A/G
85        0       cassette output
86        1       cassette motor
87        2       MC6847 INT/EXT
88        3       centronics strobe
89        4
90        5       MC6847
91        6       MC6847
92        7       MC6847 A/G
9393
94   */
94    */
9595
9696   phc25_state *state = (phc25_state *)space->machine->driver_data;
9797
r8044r8045
146146   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
147147   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
148148   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
149   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))   
149   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xE2\x86\x91") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
150150   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("INS DEL") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
151151   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*')
152152   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) // unlabeled key
r8044r8045
215215   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
216216   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
217217   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
218   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
218   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
219219   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
220220   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
221221   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
r8044r8045
344344   state->cassette = devtag_get_device(machine, CASSETTE_TAG);
345345
346346   /* register for state saving */
347//   state_save_register_global(machine, state->);
347//  state_save_register_global(machine, state->);
348348}
349349
350350/* Machine Driver */
r8044r8045
371371   /* devices */
372372   MDRV_CASSETTE_ADD(CASSETTE_TAG, phc25_cassette_config)
373373   MDRV_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics)
374   
374
375375   /* internal ram */
376376   MDRV_RAM_ADD("messram")
377377   MDRV_RAM_DEFAULT_SIZE("16K")
r8044r8045
438438
439439/* Driver */
440440
441/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    COMPANY     FULLNAME         FLAGS */
441/*    YEAR  NAME    PARENT  COMPAT  MACHINE INPUT   INIT    COMPANY     FULLNAME            FLAGS */
442442COMP( 1983, phc25,   0,      0,      pal,   phc25,   0,      "Sanyo",   "PHC-25 (Europe)",   GAME_NOT_WORKING )
443443COMP( 1983, phc25j,   phc25,   0,      ntsc,   phc25j,   0,      "Sanyo",   "PHC-25 (Japan)",   GAME_NOT_WORKING )
src/mess/drivers/c16.c
r8044r8045
292292   PORT_CONFNAME( 0x01, 0x00, "SID Card Address")
293293   PORT_CONFSETTING(   0x00, "0xfd40" )
294294   PORT_CONFSETTING(   0x01, "0xfe80" )
295#if 0   
295#if 0
296296   PORT_CONFNAME( 0x02, 0x00, "Enable SID writes to 0xd400")
297297   PORT_CONFSETTING(   0x00, DEF_STR( No ) )
298298   PORT_CONFSETTING(   0x02, DEF_STR( Yes ) )
r8044r8045
307307   PORT_CONFNAME( 0x01, 0x00, "SID Card Address")
308308   PORT_CONFSETTING(   0x00, "0xfd40" )
309309   PORT_CONFSETTING(   0x01, "0xfe80" )
310#if 0   
310#if 0
311311   PORT_CONFNAME( 0x02, 0x00, "Enable SID writes to 0xd400")
312312   PORT_CONFSETTING(   0x00, DEF_STR( No ) )
313313   PORT_CONFSETTING(   0x02, DEF_STR( Yes ) )
r8044r8045
374374{
375375   int i;
376376
377   for (i = 0; i < sizeof(ted7360_palette) / 3; i++)
377   for (i = 0; i < sizeof(ted7360_palette) / 3; i++)
378378      palette_set_color_rgb(machine, i, ted7360_palette[i * 3], ted7360_palette[i * 3 + 1], ted7360_palette[i * 3 + 2]);
379379}
380380
src/mess/drivers/chaos.c
r8044r8045
11/***************************************************************************
2   
2
33        chaos
44
55        08/04/2010 Skeleton driver.
r8044r8045
2525INPUT_PORTS_END
2626
2727
28static MACHINE_RESET(chaos)
29{   
28static MACHINE_RESET(chaos)
29{
3030}
3131
3232static VIDEO_START( chaos )
r8044r8045
4242    /* basic machine hardware */
4343    MDRV_CPU_ADD("maincpu",S2650, XTAL_1MHz)
4444    MDRV_CPU_PROGRAM_MAP(chaos_mem)
45    MDRV_CPU_IO_MAP(chaos_io)   
45    MDRV_CPU_IO_MAP(chaos_io)
4646
4747    MDRV_MACHINE_RESET(chaos)
48   
48
4949    /* video hardware */
5050    MDRV_SCREEN_ADD("screen", RASTER)
5151    MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
7272/* Driver */
7373
7474/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY   FULLNAME       FLAGS */
75COMP( 1983, chaos,  0,       0,    chaos,       chaos,     0,       "<unknown>",   "Chaos 2",      GAME_NOT_WORKING | GAME_NO_SOUND )
75COMP( 1983, chaos,  0,       0,    chaos,      chaos,    0,      "<unknown>",   "Chaos 2",      GAME_NOT_WORKING | GAME_NO_SOUND )
7676
src/mess/drivers/at.c
r8044r8045
964964   ROM_LOAD16_BYTE( "cpu-card_27c256_016.rom", 0xf0001, 0x8000, CRC(bc3924d6) SHA1(596be415e6c2bc4ff30a187f146664531565712c))
965965   ROM_LOAD16_BYTE( "video-card_573rf6( 2764)_040.rom", 0xc0001, 0x2000, CRC(a3ece315) SHA1(e800e11c3b1b6fcaf41bfb7d4058a9d34fdd2b3f))
966966   ROM_LOAD16_BYTE( "video-card_573rf6( 2764)_041.rom", 0xc0000, 0x2000, CRC(b0a2ba7f) SHA1(c8160e8bc97cd391558f1dddd3fd3ec4a19d030c))
967   
967
968968   ROM_REGION(0x08100, "gfx1", 0)
969969   ROM_LOAD("cga.chr",     0x00000, 0x01000, CRC(42009069) SHA1(ed08559ce2d7f97f68b9f540bddad5b6295294dd))
970970
971971   ROM_REGION(0x50000, "gfx2", ROMREGION_ERASE00)
972   
972
973973   /* 8042 keyboard controller */
974974   ROM_REGION( 0x0800, "kbdc8042", 0 )
975975   ROM_LOAD("1503033.bin", 0x0000, 0x0800, CRC(5a81c0d2) SHA1(0100f8789fb4de74706ae7f9473a12ec2b9bd729))
src/mess/drivers/cgc7900.c
r8044r8045
11/***************************************************************************
2   
2
33        Chromatics CGC 7900
44
55        05/04/2010 Skeleton driver.
r8044r8045
88
99/*
1010
11   TODO:
11    TODO:
1212
13   - does not boot
14   - interrupts
15   - vsync interrupt
16   - map ROM to 000000-000007 at boot
17   - floppy
18   - bitmap display
19   - Z mode read/write
20   - color status write
21   - bitmap roll
22   - overlay roll
23   - keyboard
24   - joystick
25   - light pen
26   - memory parity
27   - sync
28   - disk DMA
29   - PIO DMA
30   - serial port controller
31   - HVG
32   - OMTI Series 10 SCSI controller (8" Winchester HD)
13    - does not boot
14    - interrupts
15    - vsync interrupt
16    - map ROM to 000000-000007 at boot
17    - floppy
18    - bitmap display
19    - Z mode read/write
20    - color status write
21    - bitmap roll
22    - overlay roll
23    - keyboard
24    - joystick
25    - light pen
26    - memory parity
27    - sync
28    - disk DMA
29    - PIO DMA
30    - serial port controller
31    - HVG
32    - OMTI Series 10 SCSI controller (8" Winchester HD)
3333
3434*/
3535
r8044r8045
8181{
8282   /*
8383
84      bit      description
85     
86       0      key data bit 0
87       1      key data bit 1
88       2      key data bit 2
89       3      key data bit 3
90       4      key data bit 4
91       5      key data bit 5
92       6      key data bit 6
93       7      key data bit 7
94       8      SHIFT key
95       9      CTRL key
96      10      M1 key
97      11      M2 key
98      12     
99      13     
100      14     
101      15     
84        bit     description
10285
103   */
86         0      key data bit 0
87         1      key data bit 1
88         2      key data bit 2
89         3      key data bit 3
90         4      key data bit 4
91         5      key data bit 5
92         6      key data bit 6
93         7      key data bit 7
94         8      SHIFT key
95         9      CTRL key
96        10      M1 key
97        11      M2 key
98        12
99        13
100        14
101        15
104102
103    */
104
105105   return 0;
106106}
107107
r8044r8045
113113{
114114   /*
115115
116      bit      description
117     
118       0      LED select bit 0
119       1      LED select bit 1
120       2      LED select bit 2
121       3      LED select bit 3
122       4      LED select bit 4
123       5     
124       6     
125       7      LED switch (1=on, 0=off)
126       8     
127       9     
128      10     
129      11     
130      12     
131      13     
132      14     
133      15     
116        bit     description
134117
135   */
118         0      LED select bit 0
119         1      LED select bit 1
120         2      LED select bit 2
121         3      LED select bit 3
122         4      LED select bit 4
123         5
124         6
125         7      LED switch (1=on, 0=off)
126         8
127         9
128        10
129        11
130        12
131        13
132        14
133        15
134
135    */
136136}
137137
138138/*-------------------------------------------------
r8044r8045
143143{
144144   /*
145145
146      bit      description
147     
148       0      real time clock
149       1      RS-449 Tx ready
150       2      BINT 2
151       3      RS-232 Tx ready
152       4      disk
153       5      BINT 3
154       6      bezel keys
155       7      keyboard
156       8      RS-449 Rx ready
157       9      light pen
158      10      BINT 4
159      11      joystick
160      12      vertical retrace
161      13      BINT 5
162      14      BINT 1
163      15      RS-232 Rx ready
146        bit     description
164147
165   */
148         0      real time clock
149         1      RS-449 Tx ready
150         2      BINT 2
151         3      RS-232 Tx ready
152         4      disk
153         5      BINT 3
154         6      bezel keys
155         7      keyboard
156         8      RS-449 Rx ready
157         9      light pen
158        10      BINT 4
159        11      joystick
160        12      vertical retrace
161        13      BINT 5
162        14      BINT 1
163        15      RS-232 Rx ready
166164
165    */
166
167167   cgc7900_state *state = (cgc7900_state *)space->machine->driver_data;
168168
169169   state->int_mask = data;
r8044r8045
193193{
194194   /*
195195
196      bit      signal      description
197     
198       0      _I/O      input/output
199       1      _REQ      request
200       2      _BSY      busy
201       3      C/_D      control/data
202       4      _MSG      message
203       5      _RDY      ready
204       6     
205       7     
206       8     
207       9     
208      10     
209      11     
210      12     
211      13     
212      14     
213      15     
196        bit     signal      description
214197
215   */
198         0      _I/O        input/output
199         1      _REQ        request
200         2      _BSY        busy
201         3      C/_D        control/data
202         4      _MSG        message
203         5      _RDY        ready
204         6
205         7
206         8
207         9
208        10
209        11
210        12
211        13
212        14
213        15
216214
215    */
216
217217   return 0xffff - 0x04;
218218}
219219
r8044r8045
236236static ADDRESS_MAP_START( cgc7900_mem, ADDRESS_SPACE_PROGRAM, 16 )
237237   ADDRESS_MAP_UNMAP_HIGH
238238   AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_BASE(&chrom_ram)
239   AM_RANGE(0x800000, 0x80ffff) AM_ROM AM_REGION(M68000_TAG, 0)   
239   AM_RANGE(0x800000, 0x80ffff) AM_ROM AM_REGION(M68000_TAG, 0)
240240   AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cgc7900_z_mode_r, cgc7900_z_mode_w)
241241   AM_RANGE(0xc00000, 0xdfffff) AM_RAM AM_BASE_MEMBER(cgc7900_state, plane_ram)
242242   AM_RANGE(0xe00000, 0xe1ffff) AM_WRITE(cgc7900_color_status_w)
243//   AM_RANGE(0xe20000, 0xe23fff) Raster Processor
243//  AM_RANGE(0xe20000, 0xe23fff) Raster Processor
244244   AM_RANGE(0xe30000, 0xe303ff) AM_RAM AM_BASE_MEMBER(cgc7900_state, clut_ram)
245245   AM_RANGE(0xe38000, 0xe3bfff) AM_RAM AM_BASE_MEMBER(cgc7900_state, overlay_ram)
246246   AM_RANGE(0xe40000, 0xe40001) AM_RAM AM_BASE_MEMBER(cgc7900_state, roll_bitmap)
r8044r8045
256256   AM_RANGE(0xe40018, 0xe40019) AM_RAM AM_BASE_MEMBER(cgc7900_state, color_status_bg)
257257   AM_RANGE(0xe4001a, 0xe4001b) AM_RAM AM_BASE_MEMBER(cgc7900_state, roll_overlay)
258258   AM_RANGE(0xe4001c, 0xe40fff) AM_RAM
259//   AM_RANGE(0xefc440, 0xefc441) HVG Load X
260//   AM_RANGE(0xefc442, 0xefc443) HVG Load Y
261//   AM_RANGE(0xefc444, 0xefc445) HVG Load dX
262//   AM_RANGE(0xefc446, 0xefc447) HVG Load dY
263//   AM_RANGE(0xefc448, 0xefc449) HVG Load Pixel Color
264//   AM_RANGE(0xefc44a, 0xefc44b) HVG Load Trip
259//  AM_RANGE(0xefc440, 0xefc441) HVG Load X
260//  AM_RANGE(0xefc442, 0xefc443) HVG Load Y
261//  AM_RANGE(0xefc444, 0xefc445) HVG Load dX
262//  AM_RANGE(0xefc446, 0xefc447) HVG Load dY
263//  AM_RANGE(0xefc448, 0xefc449) HVG Load Pixel Color
264//  AM_RANGE(0xefc44a, 0xefc44b) HVG Load Trip
265265   AM_RANGE(0xff8000, 0xff8001) AM_DEVREADWRITE8(INS8251_0_TAG, msm8251_data_r, msm8251_data_w, 0xff00)
266266   AM_RANGE(0xff8002, 0xff8003) AM_DEVREADWRITE8(INS8251_0_TAG, msm8251_status_r, msm8251_control_w, 0xff00)
267267   AM_RANGE(0xff8040, 0xff8041) AM_DEVREADWRITE8(INS8251_1_TAG, msm8251_data_r, msm8251_data_w, 0xff00)
268268   AM_RANGE(0xff8042, 0xff8043) AM_DEVREADWRITE8(INS8251_1_TAG, msm8251_status_r, msm8251_control_w, 0xff00)
269269   AM_RANGE(0xff8080, 0xff8081) AM_READWRITE(keyboard_r, keyboard_w)
270//   AM_RANGE(0xff80c6, 0xff80c7) Joystick X axis
271//   AM_RANGE(0xff80ca, 0xff80cb) Joystick Y axis
272//   AM_RANGE(0xff80cc, 0xff80cd) Joystick Z axis
270//  AM_RANGE(0xff80c6, 0xff80c7) Joystick X axis
271//  AM_RANGE(0xff80ca, 0xff80cb) Joystick Y axis
272//  AM_RANGE(0xff80cc, 0xff80cd) Joystick Z axis
273273   AM_RANGE(0xff8100, 0xff8101) AM_READWRITE(disk_data_r, disk_data_w)
274274   AM_RANGE(0xff8120, 0xff8121) AM_READWRITE(disk_status_r, disk_command_w)
275275   AM_RANGE(0xff8140, 0xff8141) AM_READ_PORT("BEZEL")
276//   AM_RANGE(0xff8180, 0xff8181) AM_DEVWRITE8(K1135A_TAG, k1135a_w, 0xff00) Baud rate generator
277//   AM_RANGE(0xff81c0, 0xff81ff) AM_DEVREADWRITE8(MM58167_TAG, mm58167_r, mm58167_w, 0xff00)
276//  AM_RANGE(0xff8180, 0xff8181) AM_DEVWRITE8(K1135A_TAG, k1135a_w, 0xff00) Baud rate generator
277//  AM_RANGE(0xff81c0, 0xff81ff) AM_DEVREADWRITE8(MM58167_TAG, mm58167_r, mm58167_w, 0xff00)
278278   AM_RANGE(0xff8200, 0xff8201) AM_WRITE(interrupt_mask_w)
279//   AM_RANGE(0xff8240, 0xff8241) Light Pen enable
280//   AM_RANGE(0xff8242, 0xff8243) Light Pen X value
281//   AM_RANGE(0xff8244, 0xff8245) Light Pen Y value
282//   AM_RANGE(0xff8246, 0xff8247) Buffer memory parity check
283//   AM_RANGE(0xff8248, 0xff8249) Buffer memory parity set/reset
279//  AM_RANGE(0xff8240, 0xff8241) Light Pen enable
280//  AM_RANGE(0xff8242, 0xff8243) Light Pen X value
281//  AM_RANGE(0xff8244, 0xff8245) Light Pen Y value
282//  AM_RANGE(0xff8246, 0xff8247) Buffer memory parity check
283//  AM_RANGE(0xff8248, 0xff8249) Buffer memory parity set/reset
284284   AM_RANGE(0xff824a, 0xff824b) AM_READ(cgc7900_sync_r)
285285   AM_RANGE(0xff83c0, 0xff83c1) AM_DEVWRITE8(AY8910_TAG, ay8910_address_w, 0xff00)
286286   AM_RANGE(0xff83c2, 0xff83c3) AM_DEVREAD8(AY8910_TAG, ay8910_r, 0xff00)
287287   AM_RANGE(0xff83c4, 0xff83c5) AM_DEVWRITE8(AY8910_TAG, ay8910_data_w, 0xff00)
288//   AM_RANGE(0xff8500, 0xff8501) Disk DMA Command Register
289//   AM_RANGE(0xff8502, 0xff8503) Disk DMA Address Register
290//   AM_RANGE(0xff8507, 0xff8507) Disk DMA Control/Status Register
288//  AM_RANGE(0xff8500, 0xff8501) Disk DMA Command Register
289//  AM_RANGE(0xff8502, 0xff8503) Disk DMA Address Register
290//  AM_RANGE(0xff8507, 0xff8507) Disk DMA Control/Status Register
291291ADDRESS_MAP_END
292292
293293/*-------------------------------------------------
r8044r8045
303303-------------------------------------------------*/
304304
305305static ADDRESS_MAP_START( keyboard_io, ADDRESS_SPACE_IO, 8 )
306/*   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1)
307   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2)
308   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1)
309   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS)*/
306/*  AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1)
307    AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2)
308    AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1)
309    AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS)*/
310310ADDRESS_MAP_END
311311
312312/***************************************************************************
r8044r8045
404404    MACHINE_RESET( cgc7900 )
405405-------------------------------------------------*/
406406
407static MACHINE_RESET(cgc7900)
407static MACHINE_RESET(cgc7900)
408408{
409409   UINT8* user1 = memory_region(machine, M68000_TAG);
410410
r8044r8045
428428    MDRV_CPU_ADD(M68000_TAG, M68000, XTAL_28_48MHz/4)
429429    MDRV_CPU_PROGRAM_MAP(cgc7900_mem)
430430
431/*   MDRV_CPU_ADD(I8035_TAG, I8035, 1000000)
431/*  MDRV_CPU_ADD(I8035_TAG, I8035, 1000000)
432432    MDRV_CPU_PROGRAM_MAP(keyboard_mem)
433   MDRV_CPU_IO_MAP(keyboard_io)*/
433    MDRV_CPU_IO_MAP(keyboard_io)*/
434434
435/*   MDRV_CPU_ADD(AM2910_TAG, AM2910, XTAL_17_36MHz)
435/*  MDRV_CPU_ADD(AM2910_TAG, AM2910, XTAL_17_36MHz)
436436    MDRV_CPU_PROGRAM_MAP(omti10_mem)*/
437437
438438   MDRV_MACHINE_START(cgc7900)
439439    MDRV_MACHINE_RESET(cgc7900)
440   
440
441441    /* video hardware */
442442   MDRV_IMPORT_FROM(cgc7900_video)
443443
r8044r8045
471471   ROM_LOAD16_BYTE( "210258 80ak even b2f6 mon 1.3.ue15",                  0xa000, 0x1000, CRC(ec5a1250) SHA1(ffef73d35f172ac610b35bdf729d51eb6f9346ba) )
472472   ROM_LOAD16_BYTE( "210259 80ak odd cd66 mon 1.3.uf15",                  0xa001, 0x1000, CRC(61eb43c6) SHA1(baaae0b787798147da453aac1f815589ea4ed921) )
473473   ROM_LOAD16_BYTE( "210244 80c even ce40 dos 1.6b.ue13",                  0xc000, 0x1000, CRC(3b64e4cb) SHA1(71b28d160b101ea6165e602ff1c54272b7b30ece) )
474   ROM_LOAD16_BYTE( "210245 80c odd 1ac3 dos 1.6b.uf13",                  0xc001, 0x1000, CRC(0b6539ca) SHA1(d49e6d3307e5d634a412fd80b59492f31e29f7e0) )     
474   ROM_LOAD16_BYTE( "210245 80c odd 1ac3 dos 1.6b.uf13",                  0xc001, 0x1000, CRC(0b6539ca) SHA1(d49e6d3307e5d634a412fd80b59492f31e29f7e0) )
475475   ROM_LOAD16_BYTE( "210290 idris even rel3 sum 0cce.ue12",               0xe000, 0x1000, CRC(07065772) SHA1(620ea5d55021e5c38efc010722ddbd852cd49e39) )
476476   ROM_LOAD16_BYTE( "210291 idris odd rel3 sum 5d11.uf12",                  0xe001, 0x1000, CRC(d81b30da) SHA1(228f9b4e39d430ce4aaa81ea63f4516a51e6d001) )
477477
478478   ROM_REGION( 0x800, "i8035", 0 )
479479   ROM_LOAD( "keyboard controller i8035", 0x0000, 0x0800, NO_DUMP )
480   
480
481481   ROM_REGION( 0x800, "gfx1", 0 )
482482   ROM_LOAD( "norm chrset 4b40.ua13",   0x0000, 0x0400, CRC(55eb7b87) SHA1(768cea80597e7396d9e26f8cd09e6b480a526fce) )
483483   ROM_LOAD( "alt 46a7.ua14",         0x0400, 0x0400, CRC(be22b7e4) SHA1(83ef252c7fab33b4d3821a3049b89d044df35de8) )
r8044r8045
503503    SYSTEM DRIVERS
504504***************************************************************************/
505505
506/*    YEAR  NAME      PARENT  COMPAT   MACHINE      INPUT      INIT   COMPANY         FULLNAME   FLAGS */
506/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    COMPANY         FULLNAME    FLAGS */
507507COMP( 1980, cgc7900,   0,      0,      cgc7900,   cgc7900,   0,      "Chromatics",   "CGC 7900",   GAME_NOT_WORKING)
src/mess/drivers/z80dev.c
r8044r8045
11/***************************************************************************
2   
2
33        Z80 dev board (uknown)
4     
5      http://retro.hansotten.nl/index.php?page=z80-dev-kit
64
5        http://retro.hansotten.nl/index.php?page=z80-dev-kit
6
77        23/04/2010 Skeleton driver.
88
99****************************************************************************/
r8044r8045
2626INPUT_PORTS_END
2727
2828
29static MACHINE_RESET(z80dev)
30{   
29static MACHINE_RESET(z80dev)
30{
3131}
3232
3333static VIDEO_START( z80dev )
r8044r8045
4343    /* basic machine hardware */
4444    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
4545    MDRV_CPU_PROGRAM_MAP(z80dev_mem)
46    MDRV_CPU_IO_MAP(z80dev_io)   
46    MDRV_CPU_IO_MAP(z80dev_io)
4747
4848    MDRV_MACHINE_RESET(z80dev)
49   
49
5050    /* video hardware */
5151    MDRV_SCREEN_ADD("screen", RASTER)
5252    MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
7070/* Driver */
7171
7272/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME       FLAGS */
73COMP( 198?, z80dev,  0,       0,    z80dev,    z80dev,     0,  "<unknown>",   "Z80 dev board",      GAME_NOT_WORKING | GAME_NO_SOUND)
73COMP( 198?, z80dev,  0,       0,   z80dev,    z80dev,     0,  "<unknown>",   "Z80 dev board",      GAME_NOT_WORKING | GAME_NO_SOUND)
7474
src/mess/drivers/abc80x.c
r8044r8045
936936
937937static ABCBUS_DAISY( abc802_abcbus_daisy )
938938{
939//   { LUXOR_55_21046_ABCBUS("abc830") }, won't boot with this enabled
939//  { LUXOR_55_21046_ABCBUS("abc830") }, won't boot with this enabled
940940   { NULL }
941941};
942942
src/mess/drivers/fmtowns.c
r8044r8045
5050 * 0x0200-0f: Floppy controller (MB8877A)
5151 * 0x0400   : Video / CRTC (unknown)
5252 * 0x0404   : Disable VRAM, CMOS, memory-mapped I/O (everything in low memory except the BIOS)
53 * 0x0440-5f: Video / CRTC
53 * 0x0440-5f: Video / CRTC
5454 * 0x0480 RW: bit 1 = disable BIOS ROM
55 * 0x04c0-cf: CD-ROM controller
55 * 0x04c0-cf: CD-ROM controller
5656 * 0x04d5   : Sound mute
5757 * 0x04d8   : YM3438 control port A / status
5858 * 0x04da   : YM3438 data port A / status
r8044r8045
789789   if((porttype & 0x0f) == 0x01)
790790   {
791791      extra1 = input_port_read(space->machine,"joy1_ex");
792   
792
793793      if(towns_pad_mask & 0x10)
794794         ret |= (input_port_read(space->machine,"joy1") & 0x3f) | 0x00000040;
795795      else
796796         ret |= (input_port_read(space->machine,"joy1") & 0x0f) | 0x00000030;
797   
797
798798      if(extra1 & 0x01) // Run button = left+right
799799         ret &= ~0x0000000c;
800800      if(extra1 & 0x02) // Select button = up+down
801801         ret &= ~0x00000003;
802   
802
803803      if((extra1 & 0x10) && (towns_pad_mask & 0x01))
804804         ret &= ~0x00000010;
805805      if((extra1 & 0x20) && (towns_pad_mask & 0x02))
r8044r8045
813813         ret |= ((input_port_read(space->machine,"joy2") & 0x3f) << 16) | 0x00400000;
814814      else
815815         ret |= ((input_port_read(space->machine,"joy2") & 0x0f) << 16) | 0x00300000;
816   
816
817817      if(extra2 & 0x01)
818818         ret &= ~0x000c0000;
819819      if(extra2 & 0x02)
r8044r8045
846846            if(towns_mouse_output < MOUSE_Y_LOW)
847847               ret |= 0x0000000f;
848848      }
849     
849
850850      // button states are always visible
851851      state = input_port_read(space->machine,"mouse1");
852852      if(!(state & 0x01))
r8044r8045
855855         ret |= 0x00000020;
856856      if(towns_pad_mask & 0x10)
857857         ret |= 0x00000040;
858   }
858   }
859859   if((porttype & 0xf0) == 0x20)  // mouse
860860   {
861861      switch(towns_mouse_output)
r8044r8045
878878            if(towns_mouse_output < MOUSE_Y_LOW)
879879               ret |= 0x000f0000;
880880      }
881     
881
882882      // button states are always visible
883883      state = input_port_read(space->machine,"mouse1");
884884      if(!(state & 0x01))
r8044r8045
887887         ret |= 0x00200000;
888888      if(towns_pad_mask & 0x20)
889889         ret |= 0x00400000;
890   }
891   
890   }
891
892892   return ret;
893893}
894894
r8044r8045
897897   static UINT8 prev;
898898   static UINT8 prev_x,prev_y;
899899   UINT8 current_x,current_y;
900   UINT32 type = input_port_read(space->machine,"ctrltype");
901   
900   UINT32 type = input_port_read(space->machine,"ctrltype");
901
902902   if(ACCESSING_BITS_16_23)
903903   {
904904      towns_pad_mask = (data & 0x00ff0000) >> 16;
r8044r8045
20942094    PORT_BIT(0x00000020,IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2) PORT_CATEGORY(21)
20952095    PORT_BIT(0x00000040,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CATEGORY(21)
20962096    PORT_BIT(0x00000080,IP_ACTIVE_HIGH, IPT_UNUSED) PORT_CATEGORY(21)
2097   
2097
20982098  PORT_START("mouse1")  // buttons
2099     PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1)
2099   PORT_BIT( 0x00000001, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Left mouse button") PORT_CODE(MOUSECODE_BUTTON1)
21002100   PORT_BIT( 0x00000002, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Right mouse button") PORT_CODE(MOUSECODE_BUTTON2)
2101     
2101
21022102  PORT_START("mouse2")  // X-axis
21032103   PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
21042104
src/mess/drivers/mz2500.c
r8044r8045
22
33    Sharp MZ-2500 (c) 1985 Sharp Corporation
44
5   preliminary driver by Angelo Salese
5    preliminary driver by Angelo Salese
66
77    memory map:
88
r8044r8045
1818
1919    start-up vblank irq is rst $28 (0xef), this system has mixed im 0 and im 2 (!)
2020
21   after some time, clear work ram [$919] to 0 ... something to do with irqs?
21    after some time, clear work ram [$919] to 0 ... something to do with irqs?
2222
23   currently emulation speed crawls a lot when you use the debugger,
24   comment out lines 983/984 of emu/memory.c for the time being.
23    currently emulation speed crawls a lot when you use the debugger,
24    comment out lines 983/984 of emu/memory.c for the time being.
2525
2626****************************************************************************/
2727
r8044r8045
5353{
5454   UINT8 *vram = memory_region(screen->machine, "maincpu");
5555   int x,y,count;
56//   gfx_element *gfx;// = screen->machine->gfx[0];
56//  gfx_element *gfx;// = screen->machine->gfx[0];
5757
5858   count = 0x70000;
5959
r8044r8045
208208
209209static WRITE8_HANDLER( mz2500_bank_data_w )
210210{
211//   UINT8 *ROM = memory_region(space->machine, "maincpu");
212//   static const char *const bank_name[] = { "bank0", "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7" };
211//  UINT8 *ROM = memory_region(space->machine, "maincpu");
212//  static const char *const bank_name[] = { "bank0", "bank1", "bank2", "bank3", "bank4", "bank5", "bank6", "bank7" };
213213
214214   bank_val[bank_addr] = data & 0x3f;
215215
216//   if((data*2) >= 0x70)
217//   printf("%s %02x\n",bank_name[bank_addr],bank_val[bank_addr]*2);
216//  if((data*2) >= 0x70)
217//  printf("%s %02x\n",bank_name[bank_addr],bank_val[bank_addr]*2);
218218
219//   memory_set_bankptr(space->machine, bank_name[bank_addr], &ROM[bank_val[bank_addr]*0x2000]);
219//  memory_set_bankptr(space->machine, bank_name[bank_addr], &ROM[bank_val[bank_addr]*0x2000]);
220220
221221   bank_addr++;
222222   bank_addr&=7;
r8044r8045
259259{
260260   irq_sel = data;
261261   // FIXME: bit 0-3 are irq masks?
262//   printf("%02x\n",irq_sel);
262//  printf("%02x\n",irq_sel);
263263}
264264
265265static WRITE8_HANDLER( mz2500_irq_data_w )
r8044r8045
392392
393393static WRITE8_HANDLER( mz2500_rom_w )
394394{
395//   printf("%02x\n",data);
395//  printf("%02x\n",data);
396396   rom_index = (data << 8) | (rom_index & 0xff00ff);
397397   //printf("%02x\n",data);
398398}
399399
400400static ADDRESS_MAP_START(mz2500_io, ADDRESS_SPACE_IO, 8)
401401   ADDRESS_MAP_GLOBAL_MASK(0xff)
402//   AM_RANGE(0x60, 0x63) AM_WRITE(w3100a_w)
403//   AM_RANGE(0x63, 0x63) AM_READ(w3100a_r)
404//   AM_RANGE(0xa0, 0xa3) AM_READWRITE(sio_r,sio_w)
405//   AM_RANGE(0xa4, 0xa5) AM_READWRITE(sasi_r, sasi_w)
402//  AM_RANGE(0x60, 0x63) AM_WRITE(w3100a_w)
403//  AM_RANGE(0x63, 0x63) AM_READ(w3100a_r)
404//  AM_RANGE(0xa0, 0xa3) AM_READWRITE(sio_r,sio_w)
405//  AM_RANGE(0xa4, 0xa5) AM_READWRITE(sasi_r, sasi_w)
406406   AM_RANGE(0xa8, 0xa8) AM_WRITE(mz2500_rom_w)
407407   AM_RANGE(0xa9, 0xa9) AM_READ(mz2500_rom_r)
408//   AM_RANGE(0xac, 0xad) AM_WRITE(emm_w)
409//   AM_RANGE(0xad, 0xad) AM_READ(emm_r)
410//   AM_RANGE(0xae, 0xae) AM_WRITE(crtc_w)
411//   AM_RANGE(0xb0, 0xb3) AM_READWRITE(sio_r,sio_w)
408//  AM_RANGE(0xac, 0xad) AM_WRITE(emm_w)
409//  AM_RANGE(0xad, 0xad) AM_READ(emm_r)
410//  AM_RANGE(0xae, 0xae) AM_WRITE(crtc_w)
411//  AM_RANGE(0xb0, 0xb3) AM_READWRITE(sio_r,sio_w)
412412   AM_RANGE(0xb4, 0xb4) AM_READWRITE(mz2500_bank_addr_r,mz2500_bank_addr_w)
413413   AM_RANGE(0xb5, 0xb5) AM_READWRITE(mz2500_bank_data_r,mz2500_bank_data_w)
414//    AM_RANGE(0xb8, 0xb9) AM_READWRITE(kanji_r,kanji_w)
415//   AM_RANGE(0xbc, 0xbd) AM_READWRITE(crtc_r,crtc_w)
414//  AM_RANGE(0xb8, 0xb9) AM_READWRITE(kanji_r,kanji_w)
415//  AM_RANGE(0xbc, 0xbd) AM_READWRITE(crtc_r,crtc_w)
416416   AM_RANGE(0xc6, 0xc6) AM_WRITE(mz2500_irq_sel_w)
417417   AM_RANGE(0xc7, 0xc7) AM_WRITE(mz2500_irq_data_w)
418418   AM_RANGE(0xc8, 0xc9) AM_DEVREADWRITE("ym", ym2203_r, ym2203_w)
419//   AM_RANGE(0xca, 0xca) AM_READWRITE(voice_r,voice_w)
420//   AM_RANGE(0xcc, 0xcc) AM_READWRITE(calendar_r,calendar_w)
421//   AM_RANGE(0xce, 0xce) AM_WRITE(mz2500_dictionary_bank_w)
419//  AM_RANGE(0xca, 0xca) AM_READWRITE(voice_r,voice_w)
420//  AM_RANGE(0xcc, 0xcc) AM_READWRITE(calendar_r,calendar_w)
421//  AM_RANGE(0xce, 0xce) AM_WRITE(mz2500_dictionary_bank_w)
422422   AM_RANGE(0xcf, 0xcf) AM_WRITE(mz2500_kanji_bank_w)
423423   AM_RANGE(0xd8, 0xdb) AM_DEVREADWRITE("mb8877a", wd17xx_r, wd17xx_w)
424424   AM_RANGE(0xdc, 0xdd) AM_WRITE(mz2500_fdc_w)
425425   AM_RANGE(0xe0, 0xe1) AM_DEVREADWRITE("z80pio_0", z80pio_c_r, z80pio_c_w)
426426   AM_RANGE(0xe2, 0xe3) AM_DEVREADWRITE("z80pio_0", z80pio_d_r, z80pio_d_w)
427//   AM_RANGE(0xe4, 0xe7) AM_READWRITE(pit_r,pit_w)
427//  AM_RANGE(0xe4, 0xe7) AM_READWRITE(pit_r,pit_w)
428428   AM_RANGE(0xe8, 0xe9) AM_DEVREADWRITE("z80pio_1", z80pio_c_r, z80pio_c_w)
429429   AM_RANGE(0xea, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_d_r, z80pio_d_w)
430//   AM_RANGE(0xef, 0xef) AM_READWRITE(joystick_r,joystick_w)
431//   AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w)
430//  AM_RANGE(0xef, 0xef) AM_READWRITE(joystick_r,joystick_w)
431//  AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w)
432432   AM_RANGE(0xf4, 0xf7) AM_READ(mz2500_crtc_r) AM_WRITE(mz2500_crtc_w)
433//   AM_RANGE(0xf8, 0xf9) AM_READWRITE(extrom_r,extrom_w)
433//  AM_RANGE(0xf8, 0xf9) AM_READWRITE(extrom_r,extrom_w)
434434ADDRESS_MAP_END
435435
436436/* Input ports */
r8044r8045
504504   bank_val[6] = 0x06;
505505   bank_val[7] = 0x07;
506506
507/*   memory_set_bankptr(machine, "bank0", &ROM[bank_val[0]*0x2000]);
508   memory_set_bankptr(machine, "bank1", &ROM[bank_val[1]*0x2000]);
509   memory_set_bankptr(machine, "bank2", &ROM[bank_val[2]*0x2000]);
510   memory_set_bankptr(machine, "bank3", &ROM[bank_val[3]*0x2000]);
511   memory_set_bankptr(machine, "bank4", &ROM[bank_val[4]*0x2000]);
512   memory_set_bankptr(machine, "bank5", &ROM[bank_val[5]*0x2000]);
513   memory_set_bankptr(machine, "bank6", &ROM[bank_val[6]*0x2000]);
514   memory_set_bankptr(machine, "bank7", &ROM[bank_val[7]*0x2000]);*/
507/*  memory_set_bankptr(machine, "bank0", &ROM[bank_val[0]*0x2000]);
508    memory_set_bankptr(machine, "bank1", &ROM[bank_val[1]*0x2000]);
509    memory_set_bankptr(machine, "bank2", &ROM[bank_val[2]*0x2000]);
510    memory_set_bankptr(machine, "bank3", &ROM[bank_val[3]*0x2000]);
511    memory_set_bankptr(machine, "bank4", &ROM[bank_val[4]*0x2000]);
512    memory_set_bankptr(machine, "bank5", &ROM[bank_val[5]*0x2000]);
513    memory_set_bankptr(machine, "bank6", &ROM[bank_val[6]*0x2000]);
514    memory_set_bankptr(machine, "bank7", &ROM[bank_val[7]*0x2000]);*/
515515
516516   irq_vector[0] = 0xef; /* RST 28h - vblank */
517517
r8044r8045
573573
574574static WRITE8_DEVICE_HANDLER( mz2500_pio1_porta_w )
575575{
576//   printf("%02x\n",data);
576//  printf("%02x\n",data);
577577   text_col_size = (data & 0x20) ? 80 : 40;
578578}
579579
r8044r8045
672672   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
673673   MDRV_SCREEN_RAW_PARAMS(XTAL_17_73447MHz/2, 568, 0, 40*8, 312, 0, 25*8)
674674   MDRV_PALETTE_LENGTH(256*2)
675//   MDRV_PALETTE_INIT(black_and_white)
675//  MDRV_PALETTE_INIT(black_and_white)
676676
677677   MDRV_GFXDECODE(mz2500)
678678
src/mess/drivers/gmaster.c
r8044r8045
220220static DEVICE_IMAGE_LOAD( gmaster_cart )
221221{
222222   UINT32 size;
223   
223
224224   if (image_software_entry(image) == NULL)
225225   {
226226      size = image_length(image);
227     
227
228228      if (size > (memory_region_length(image->machine, "maincpu") - 0x8000))
229229      {
230230         image_seterror(image, IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
231231         return INIT_FAIL;
232232      }
233     
233
234234      if (image_fread(image, memory_region(image->machine, "maincpu") + 0x8000, size) != size)
235235      {
236236         image_seterror(image, IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file");
237237         return INIT_FAIL;
238238      }
239     
239
240240   }
241241   else
242242   {
src/mess/drivers/vboy.c
r8044r8045
44
55    12/05/2009 Skeleton driver.
66
7    Great info at http://www.goliathindustries.com/vb/
7    Great info at http://www.goliathindustries.com/vb/
88    and http://www.vr32.de/modules/dokuwiki/doku.php?
99
1010****************************************************************************/
r8044r8045
673673{
674674   UINT32 size;
675675   UINT8 *ptr = memory_region(image->machine, "user1");
676   
676
677677   if (image_software_entry(image) == NULL)
678678   {
679679      size = image_length(image);
r8044r8045
685685      size = image_get_software_region_length(image, "rom");
686686      memcpy(ptr, image_get_software_region(image, "rom"), size);
687687   }
688   
688
689689   return INIT_PASS;
690690}
691691
src/mess/drivers/interact.c
r8044r8045
33        Interact Family Computer
44
55        12/05/2009 Skeleton driver - Micko
6   31/05/2009 Added notes - Robbbert
6    31/05/2009 Added notes - Robbbert
77
88    This was made by Interact Company of Ann Arbor, Michigan. However,
99    just after launch, the company collapsed. The liquidator, Protecto,
src/mess/drivers/tandy2k.c
r8044r8045
88
99/*
1010
11   TODO:
11    TODO:
1212
13   - 80186
14   - CRT9007
15   - keyboard ROM
16   - hires graphics board
17   - floppy 720K DSQD
18   - DMA
19   - WD1010
20   - hard disk
21   - mouse
22   - save state
13    - 80186
14    - CRT9007
15    - keyboard ROM
16    - hires graphics board
17    - floppy 720K DSQD
18    - DMA
19    - WD1010
20    - hard disk
21    - mouse
22    - save state
2323
2424*/
2525
r8044r8045
5151{
5252   /*
5353
54      bit      signal      description
54        bit     signal      description
5555
56      0               RS-232 ring indicator
57      1               RS-232 carrier detect
58      2
59      3
60      4
61      5
62      6
63      7      _ACLOW
56        0                   RS-232 ring indicator
57        1                   RS-232 carrier detect
58        2
59        3
60        4
61        5
62        6
63        7       _ACLOW
6464
65   */
65    */
6666
6767   return 0x80;
6868}
r8044r8045
7171{
7272   /*
7373
74      bit      signal      description
74        bit     signal      description
7575
76      0      KBEN      keyboard enable
77      1      EXTCLK      external baud rate clock
78      2      SPKRGATE   enable periodic speaker output
79      3      SPKRDATA   direct output to speaker
80      4      RFRQGATE   enable refresh and baud rate clocks
81      5      _FDCRESET   reset 8272
82      6      TMRIN0      enable 80186 timer 0
83      7      TMRIN1      enable 80186 timer 1
76        0       KBEN        keyboard enable
77        1       EXTCLK      external baud rate clock
78        2       SPKRGATE    enable periodic speaker output
79        3       SPKRDATA    direct output to speaker
80        4       RFRQGATE    enable refresh and baud rate clocks
81        5       _FDCRESET   reset 8272
82        6       TMRIN0      enable 80186 timer 0
83        7       TMRIN1      enable 80186 timer 1
8484
85   */
85    */
8686
8787   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
8888
r8044r8045
115115{
116116   /*
117117
118      bit      description
118        bit     description
119119
120      0      DMA channel 0 enable
121      1      DMA channel 1 enable
122      2      DMA channel 2 enable
123      3      DMA channel 3 enable
124      4      DMA channel 0 select
125      5      DMA channel 1 select
126      6      DMA channel 2 select
127      7      DMA channel 3 select
120        0       DMA channel 0 enable
121        1       DMA channel 1 enable
122        2       DMA channel 2 enable
123        3       DMA channel 3 enable
124        4       DMA channel 0 select
125        5       DMA channel 1 select
126        6       DMA channel 2 select
127        7       DMA channel 3 select
128128
129   */
129    */
130130
131131   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
132132
r8044r8045
168168{
169169   /*
170170
171      bit      signal      description
171        bit     signal      description
172172
173      8      A15         A15 of video access
174      9      A16         A16 of video access
175      10      A17         A17 of video access
176      11      A18         A18 of video access
177      12      A19         A19 of video access
178      13      CLKSPD      clock speed (0 = 22.4 MHz, 1 = 28 MHz)
179      14      CLKCNT      dots/char (0 = 10 [800x400], 1 = 8 [640x400])
180      15      VIDOUTS      selects the video source for display on monochrome monitor
173        8       A15         A15 of video access
174        9       A16         A16 of video access
175        10      A17         A17 of video access
176        11      A18         A18 of video access
177        12      A19         A19 of video access
178        13      CLKSPD      clock speed (0 = 22.4 MHz, 1 = 28 MHz)
179        14      CLKCNT      dots/char (0 = 10 [800x400], 1 = 8 [640x400])
180        15      VIDOUTS     selects the video source for display on monochrome monitor
181181
182   */
182    */
183183
184184   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
185185
r8044r8045
202202{
203203   /*
204204
205      bit      description
205        bit     description
206206
207      0      X0
208      1      X1
209      2      X2
210      3      X3
211      4      X4
212      5      X5
213      6      X6
214      7      X7
207        0       X0
208        1       X1
209        2       X2
210        3       X3
211        4       X4
212        5       X5
213        6       X6
214        7       X7
215215
216   */
216    */
217217
218218   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
219219
r8044r8045
239239{
240240   /*
241241
242      bit      description
242        bit     description
243243
244      0      Y0
245      1      Y1
246      2      Y2
247      3      Y3
248      4      Y4
249      5      Y5
250      6      Y6
251      7      Y7
244        0       Y0
245        1       Y1
246        2       Y2
247        3       Y3
248        4       Y4
249        5       Y5
250        6       Y6
251        7       Y7
252252
253   */
253    */
254254
255255   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
256256
r8044r8045
262262{
263263   /*
264264
265      bit      description
265        bit     description
266266
267      0      Y8
268      1      Y9
269      2      Y10
270      3      Y11
271      4      LED 2
272      5      LED 1
273      6
274      7
267        0       Y8
268        1       Y9
269        2       Y10
270        3       Y11
271        4       LED 2
272        5       LED 1
273        6
274        7
275275
276   */
276    */
277277
278278   tandy2k_state *state = (tandy2k_state *)space->machine->driver_data;
279279
r8044r8045
285285
286286static ADDRESS_MAP_START( tandy2k_mem, ADDRESS_SPACE_PROGRAM, 16 )
287287   ADDRESS_MAP_UNMAP_HIGH
288//   AM_RANGE(0x00000, 0xdffff) AM_RAM
289//   AM_RANGE(0xe0000, 0xf7fff) AM_RAM // hires graphics
288//  AM_RANGE(0x00000, 0xdffff) AM_RAM
289//  AM_RANGE(0xe0000, 0xf7fff) AM_RAM // hires graphics
290290   AM_RANGE(0xf8000, 0xfbfff) AM_RAM AM_BASE_MEMBER(tandy2k_state, char_ram)
291291   AM_RANGE(0xfc000, 0xfdfff) AM_MIRROR(0x2000) AM_ROM AM_REGION(I80186_TAG, 0)
292292ADDRESS_MAP_END
r8044r8045
306306   AM_RANGE(0x00080, 0x00081) AM_DEVREADWRITE8(I8272A_TAG, upd765_dack_r, upd765_dack_w, 0x00ff)
307307   AM_RANGE(0x00100, 0x0017f) AM_DEVREADWRITE8(CRT9007_TAG, crt9007_r, crt9007_w, 0x00ff)
308308   AM_RANGE(0x00100, 0x0017f) AM_WRITE8(addr_ctrl_w, 0xff00)
309//   AM_RANGE(0x00180, 0x00180) AM_READ8(hires_status_r, 0x00ff)
310//   AM_RANGE(0x00180, 0x001bf) AM_WRITE(hires_palette_w)
311//   AM_RANGE(0x001a0, 0x001a0) AM_READ8(hires_plane_w, 0x00ff)
312//   AM_RANGE(0x0ff00, 0x0ffff) AM_READWRITE(i186_internal_port_r, i186_internal_port_w)
309//  AM_RANGE(0x00180, 0x00180) AM_READ8(hires_status_r, 0x00ff)
310//  AM_RANGE(0x00180, 0x001bf) AM_WRITE(hires_palette_w)
311//  AM_RANGE(0x001a0, 0x001a0) AM_READ8(hires_plane_w, 0x00ff)
312//  AM_RANGE(0x0ff00, 0x0ffff) AM_READWRITE(i186_internal_port_r, i186_internal_port_w)
313313ADDRESS_MAP_END
314314
315315static ADDRESS_MAP_START( tandy2k_hd_io, ADDRESS_SPACE_IO, 16 )
316316   AM_IMPORT_FROM(tandy2k_io)
317//   AM_RANGE(0x000e0, 0x000ff) AM_WRITE8(hdc_dack_w, 0x00ff)
318//   AM_RANGE(0x0026c, 0x0026d) AM_DEVREADWRITE8(WD1010_TAG, hdc_reset_r, hdc_reset_w, 0x00ff)
319//   AM_RANGE(0x0026e, 0x0027f) AM_DEVREADWRITE8(WD1010_TAG, wd1010_r, wd1010_w, 0x00ff)
317//  AM_RANGE(0x000e0, 0x000ff) AM_WRITE8(hdc_dack_w, 0x00ff)
318//  AM_RANGE(0x0026c, 0x0026d) AM_DEVREADWRITE8(WD1010_TAG, hdc_reset_r, hdc_reset_w, 0x00ff)
319//  AM_RANGE(0x0026e, 0x0027f) AM_DEVREADWRITE8(WD1010_TAG, wd1010_r, wd1010_w, 0x00ff)
320320ADDRESS_MAP_END
321321
322322static ADDRESS_MAP_START( keyboard_io, ADDRESS_SPACE_IO, 8 )
r8044r8045
590590{
591591   /*
592592
593      bit      signal         description
593        bit     signal          description
594594
595      0      LPRIN0         auxiliary input 0
596      1      LPRIN1         auxiliary input 1
597      2      LPRIN2         auxiliary input 2
598      3      _LPRACK         acknowledge
599      4      _LPRFLT         fault
600      5      _LPRSEL         select
601      6      LPRPAEM         paper empty
602      7      LPRBSY         busy
595        0       LPRIN0          auxiliary input 0
596        1       LPRIN1          auxiliary input 1
597        2       LPRIN2          auxiliary input 2
598        3       _LPRACK         acknowledge
599        4       _LPRFLT         fault
600        5       _LPRSEL         select
601        6       LPRPAEM         paper empty
602        7       LPRBSY          busy
603603
604   */
604    */
605605
606606   tandy2k_state *state = (tandy2k_state *)device->machine->driver_data;
607607
r8044r8045
643643{
644644   /*
645645
646      bit      signal         description
646        bit     signal          description
647647
648      0                  port A direction
649      1                  port B input select bit 0
650      2                  port B input select bit 1
651      3      LPRINT13      interrupt
652      4      STROBE IN
653      5      INBUFFULL
654      6      _LPRACK
655      7      _LPRDATSTB
648        0                       port A direction
649        1                       port B input select bit 0
650        2                       port B input select bit 1
651        3       LPRINT13        interrupt
652        4       STROBE IN
653        5       INBUFFULL
654        6       _LPRACK
655        7       _LPRDATSTB
656656
657   */
657    */
658658
659659   tandy2k_state *state = (tandy2k_state *)device->machine->driver_data;
660660
r8044r8045
682682
683683/*
684684
685   IR0      MEMINT00
686   IR1      TMOINT01
687   IR2      SERINT02
688   IR3      BUSINT03
689   IR4      FLDINT04
690   IR5      BUSINT05
691   IR6      HDCINT06
692   IR7      BUSINT07
685    IR0     MEMINT00
686    IR1     TMOINT01
687    IR2     SERINT02
688    IR3     BUSINT03
689    IR4     FLDINT04
690    IR5     BUSINT05
691    IR6     HDCINT06
692    IR7     BUSINT07
693693
694694*/
695695
r8044r8045
700700
701701/*
702702
703   IR0      KBDINT10
704   IR1      VIDINT11
705   IR2      RATINT12
706   IR3      LPRINT13
707   IR4      MCPINT14
708   IR5      MEMINT15
709   IR6      DMEINT16
710   IR7      BUSINT17
703    IR0     KBDINT10
704    IR1     VIDINT11
705    IR2     RATINT12
706    IR3     LPRINT13
707    IR4     MCPINT14
708    IR5     MEMINT15
709    IR6     DMEINT16
710    IR7     BUSINT17
711711
712712*/
713713
r8044r8045
785785   rom[0x1f17] = 0x90;
786786
787787   /* register for state saving */
788//   state_save_register_global(machine, state->);
788//  state_save_register_global(machine, state->);
789789}
790790
791791static MACHINE_RESET( tandy2k )
r8044r8045
802802    MDRV_CPU_PROGRAM_MAP(tandy2k_mem)
803803    MDRV_CPU_IO_MAP(tandy2k_io)
804804
805//   MDRV_CPU_ADD(I8048_TAG, I8048, 1000000) // ?
806//   MDRV_CPU_IO_MAP(keyboard_io)
805//  MDRV_CPU_ADD(I8048_TAG, I8048, 1000000) // ?
806//  MDRV_CPU_IO_MAP(keyboard_io)
807807
808808    MDRV_MACHINE_START(tandy2k)
809809    MDRV_MACHINE_RESET(tandy2k)
r8044r8045
869869
870870/* System Drivers */
871871
872/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT    COMPANY                 FULLNAME      FLAGS */
872/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT    COMPANY                 FULLNAME        FLAGS */
873873COMP( 1983, tandy2k,   0,         0,      tandy2k,   tandy2k,   0,      "Tandy Radio Shack",   "Tandy 2000",   GAME_NOT_WORKING)
874874COMP( 1983, tandy2khd,   tandy2k,   0,      tandy2k_hd,   tandy2k,   0,      "Tandy Radio Shack",   "Tandy 2000HD",   GAME_NOT_WORKING)
src/mess/drivers/vidbrain.c
r8044r8045
22
33    VideoBrain FamilyComputer
44
5   http://www.atariprotos.com/othersystems/videobrain/videobrain.htm
6   http://www.seanriddle.com/vbinfo.html
7   http://www.seanriddle.com/videobrain.html
5    http://www.atariprotos.com/othersystems/videobrain/videobrain.htm
6    http://www.seanriddle.com/vbinfo.html
7    http://www.seanriddle.com/videobrain.html
88
99    07/04/2009 Skeleton driver.
1010
r8044r8045
1212
1313/*
1414
15   TODO:
15    TODO:
1616
17   - SMI 3853
18   - colors
19   - low resolution mode
20   - discrete sound
21   - joystick scan timer 555
22   - reset on cartridge eject
23   - expander 1 (cassette, RS-232)
24   - expander 2 (modem)
17    - SMI 3853
18    - colors
19    - low resolution mode
20    - discrete sound
21    - joystick scan timer 555
22    - reset on cartridge eject
23    - expander 1 (cassette, RS-232)
24    - expander 2 (modem)
2525
2626*/
2727
r8044r8045
7373   case 0xf7:
7474      /*
7575
76         bit      description
76            bit     description
7777
78         0     
79         1     
80         2     
81         3     
82         4      keyboard column 8
83         5     
84         6     
85         7     
78            0
79            1
80            2
81            3
82            4       keyboard column 8
83            5
84            6
85            7
8686
87      */
87        */
8888
8989      state->uv201_31 = BIT(data, 4);
9090      break;
r8044r8045
103103{
104104   /*
105105
106      bit      description
106        bit     description
107107
108      0      keyboard column 0, sound data 0
109      1      keyboard column 1, sound data 1
110      2      keyboard column 2
111      3      keyboard column 3
112      4      keyboard column 4
113      5      keyboard column 5
114      6      keyboard column 6
115      7      keyboard column 7
108        0       keyboard column 0, sound data 0
109        1       keyboard column 1, sound data 1
110        2       keyboard column 2
111        3       keyboard column 3
112        4       keyboard column 4
113        5       keyboard column 5
114        6       keyboard column 6
115        7       keyboard column 7
116116
117   */
117    */
118118
119119   vidbrain_state *state = (vidbrain_state *)space->machine->driver_data;
120120
r8044r8045
129129{
130130   /*
131131
132      bit      description
132        bit     description
133133
134      0      keyboard row 0
135      1      keyboard row 1
136      2      keyboard row 2
137      3      keyboard row 3
138      4     
139      5     
140      6     
141      7     
134        0       keyboard row 0
135        1       keyboard row 1
136        2       keyboard row 2
137        3       keyboard row 3
138        4
139        5
140        6
141        7
142142
143   */
143    */
144144
145145   vidbrain_state *state = (vidbrain_state *)space->machine->driver_data;
146146
r8044r8045
167167{
168168   /*
169169
170      bit      description
170        bit     description
171171
172      0     
173      1     
174      2     
175      3     
176      4      sound clock
177      5     
178      6     
179      7      joystick enable
172        0
173        1
174        2
175        3
176        4       sound clock
177        5
178        6
179        7       joystick enable
180180
181   */
181    */
182182
183183   vidbrain_state *state = (vidbrain_state *)space->machine->driver_data;
184184
r8044r8045
337337
338338static PALETTE_INIT( vidbrain )
339339{
340   palette_set_color_rgb(machine,  0, 0x00, 0x00, 0x00 ); //
340   palette_set_color_rgb(machine,  0, 0x00, 0x00, 0x00 ); //
341341   palette_set_color_rgb(machine,  1, 0xff, 0x00, 0x00 ); // red
342   palette_set_color_rgb(machine,  2, 0x00, 0xff, 0x00 ); //
343   palette_set_color_rgb(machine,  3, 0xff, 0xff, 0x00 ); //
342   palette_set_color_rgb(machine,  2, 0x00, 0xff, 0x00 ); //
343   palette_set_color_rgb(machine,  3, 0xff, 0xff, 0x00 ); //
344344   palette_set_color_rgb(machine,  4, 0x00, 0x00, 0xff ); // blue
345   palette_set_color_rgb(machine,  5, 0xff, 0x00, 0xff ); //
346   palette_set_color_rgb(machine,  6, 0x00, 0xff, 0xff ); //
347   palette_set_color_rgb(machine,  7, 0xff, 0xff, 0xff ); //
345   palette_set_color_rgb(machine,  5, 0xff, 0x00, 0xff ); //
346   palette_set_color_rgb(machine,  6, 0x00, 0xff, 0xff ); //
347   palette_set_color_rgb(machine,  7, 0xff, 0xff, 0xff ); //
348348
349   palette_set_color_rgb(machine,  8, 0x00, 0x00, 0x00 ); //
349   palette_set_color_rgb(machine,  8, 0x00, 0x00, 0x00 ); //
350350   palette_set_color_rgb(machine,  9, 0x80, 0x00, 0x00 ); // red
351   palette_set_color_rgb(machine, 10, 0x00, 0x80, 0x00 ); //
352   palette_set_color_rgb(machine, 11, 0x80, 0x80, 0x00 ); //
351   palette_set_color_rgb(machine, 10, 0x00, 0x80, 0x00 ); //
352   palette_set_color_rgb(machine, 11, 0x80, 0x80, 0x00 ); //
353353   palette_set_color_rgb(machine, 12, 0x00, 0x00, 0x80 ); // blue
354   palette_set_color_rgb(machine, 13, 0x80, 0x00, 0x80 ); //
355   palette_set_color_rgb(machine, 14, 0x00, 0x80, 0x80 ); //
356   palette_set_color_rgb(machine, 15, 0x80, 0x80, 0x80 ); //
354   palette_set_color_rgb(machine, 13, 0x80, 0x00, 0x80 ); //
355   palette_set_color_rgb(machine, 14, 0x00, 0x80, 0x80 ); //
356   palette_set_color_rgb(machine, 15, 0x80, 0x80, 0x80 ); //
357357}
358358
359359/*-------------------------------------------------
r8044r8045
448448};
449449
450450/*-------------------------------------------------
451   cart loading (+ software list)
451    cart loading (+ software list)
452452 -------------------------------------------------*/
453453
454454static DEVICE_IMAGE_LOAD( vidbrain_cart )
455455{
456456   UINT32 size;
457457   UINT8 *ptr = memory_region(image->machine, F3850_TAG) + 0x1000;
458   
458
459459   if (image_software_entry(image) == NULL)
460460   {
461461      size = image_length(image);
r8044r8045
467467      size = image_get_software_region_length(image, "rom");
468468      memcpy(ptr, image_get_software_region(image, "rom"), size);
469469   }
470   
470
471471   return INIT_PASS;
472472}
473473
r8044r8045
565565    SYSTEM DRIVERS
566566***************************************************************************/
567567
568/*    YEAR  NAME      PARENT   COMPAT   MACHINE      INPUT      INIT   COMPANY                     FULLNAME                  FLAGS */
568/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT    COMPANY                         FULLNAME                        FLAGS */
569569COMP( 1977, vidbrain,   0,      0,      vidbrain,   vidbrain,   0,      "VideoBrain Computer Company",   "VideoBrain FamilyComputer",   GAME_NOT_WORKING | GAME_NO_SOUND )
src/mess/drivers/wswan.c
r8044r8045
112112   }
113113}
114114
115static PALETTE_INIT( wscolor )
115static PALETTE_INIT( wscolor )
116116{
117117   int i;
118   for (i = 0; i < 4096; i++)
118   for (i = 0; i < 4096; i++)
119119   {
120120      int r = (i & 0x0f00) >> 8;
121121      int g = (i & 0x00f0) >> 4;
src/mess/drivers/trs80m2.c
r8044r8045
1010
1111    TODO:
1212
13   - TRSDOS does not accept any date
14   - CP/M does halts after typing EX
15   - wd17xx.c thinks the drive is always ready
13    - TRSDOS does not accept any date
14    - CP/M does halts after typing EX
15    - wd17xx.c thinks the drive is always ready
1616    - keyboard CPU ROM
1717    - graphics board
1818
r8044r8045
10511051   MDRV_IMPORT_FROM(trs80m2)
10521052
10531053   /* basic machine hardware */
1054//   MDRV_CPU_ADD(M68000_TAG, M68000, 6000000)
1055//   MDRV_CPU_PROGRAM_MAP(m68000_mem)
1054//  MDRV_CPU_ADD(M68000_TAG, M68000, 6000000)
1055//  MDRV_CPU_PROGRAM_MAP(m68000_mem)
10561056
10571057   /* video hardware */
10581058   MDRV_PALETTE_INIT(monochrome_green)
src/mess/drivers/pv1000.c
r8044r8045
173173{
174174   UINT8 *cart = memory_region(image->machine, "cart");
175175   UINT32 size;
176   
176
177177   if (image_software_entry(image) == NULL)
178178      size = image_length(image);
179179   else
180180      size = image_get_software_region_length(image, "rom");
181   
182181
182
183183   if (size != 0x2000 && size != 0x4000)
184184   {
185185      image_seterror(image, IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size");
r8044r8045
196196   }
197197   else
198198      memcpy(cart, image_get_software_region(image, "rom"), size);
199     
200199
200
201201   /* Mirror 8KB rom */
202202   if (size == 0x2000)
203203      memcpy(cart + 0x2000, cart, 0x2000);
src/mess/drivers/ngp.c
r8044r8045
677677      filesize = image_get_software_region_length(image, "rom");
678678      memcpy(memory_region(image->machine, "cart"), image_get_software_region(image, "rom"), filesize);
679679   }
680   
680
681681   state->flash_chip[0].manufacturer_id = 0x98;
682682   switch( filesize )
683683   {
src/mess/drivers/nes.c
r8044r8045
234234   MDRV_CARTSLOT_ADD("cart")
235235   MDRV_CARTSLOT_EXTENSION_LIST("nes,unf")
236236   MDRV_CARTSLOT_MANDATORY
237//   MDRV_CARTSLOT_INTERFACE("nes_cart")
237//  MDRV_CARTSLOT_INTERFACE("nes_cart")
238238   MDRV_CARTSLOT_LOAD(nes_cart)
239239   MDRV_CARTSLOT_PARTIALHASH(nes_partialhash)
240//   MDRV_SOFTWARE_LIST_ADD("nes")
240//  MDRV_SOFTWARE_LIST_ADD("nes")
241241MACHINE_DRIVER_END
242242
243243static MACHINE_DRIVER_START( nespal )
src/mess/drivers/pv9234.c
r8044r8045
8080/* Driver */
8181
8282/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME       FLAGS */
83COMP( 1997, pv9234,  0,       0,    pv9234,   pv9234,    0,        "Scientific Atlanta",   "PowerVu D9234",      GAME_NOT_WORKING | GAME_NO_SOUND)
83COMP( 1997, pv9234,  0,       0,   pv9234,   pv9234,    0,        "Scientific Atlanta",   "PowerVu D9234",      GAME_NOT_WORKING | GAME_NO_SOUND)
8484
src/mess/drivers/vt240.c
r8044r8045
11/***************************************************************************
2   
2
33        DEC VT240
44
55        31/03/2010 Skeleton driver.
r8044r8045
2929INPUT_PORTS_END
3030
3131
32static MACHINE_RESET(vt240)
33{   
32static MACHINE_RESET(vt240)
33{
3434}
3535
3636static VIDEO_START( vt240 )
r8044r8045
4646   /* basic machine hardware */
4747   MDRV_CPU_ADD("maincpu", 8085A, XTAL_16MHz / 4)
4848   MDRV_CPU_PROGRAM_MAP(vt240_mem)
49   MDRV_CPU_IO_MAP(vt240_io)   
49   MDRV_CPU_IO_MAP(vt240_io)
5050
5151   MDRV_MACHINE_RESET(vt240)
52   
52
5353   /* video hardware */
5454   MDRV_SCREEN_ADD("screen", RASTER)
5555   MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
7474   ROM_REGION( 0x20000, "subcpu", ROMREGION_ERASEFF )
7575   ROM_LOAD16_BYTE( "029.bin", 0x00000, 0x8000, CRC(4a6db217) SHA1(47637325609ea19ffab61fe31e2700d72fa50729))
7676   ROM_LOAD16_BYTE( "031.bin", 0x00001, 0x8000, CRC(47129579) SHA1(39de9e2e26f90c5da5e72a09ff361c1a94b9008a))
77   
78   ROM_LOAD16_BYTE( "030.bin", 0x10000, 0x8000, CRC(05fd7b75) SHA1(2ad8c14e76accfa1b9b8748c58e9ebbc28844a47))   
77
78   ROM_LOAD16_BYTE( "030.bin", 0x10000, 0x8000, CRC(05fd7b75) SHA1(2ad8c14e76accfa1b9b8748c58e9ebbc28844a47))
7979   ROM_LOAD16_BYTE( "032.bin", 0x10001, 0x8000, CRC(e81d93c4) SHA1(982412a7a6e65d6f6b4f66bd093e54ee16f31384))
8080ROM_END
8181
r8044r8045
8484/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    CONFIG COMPANY   FULLNAME       FLAGS */
8585//COMP( 1983, vt240,  0,       0,   vt220,  vt220,   0,          "DEC",   "VT240",      GAME_NOT_WORKING | GAME_NO_SOUND)
8686//COMP( 1983, vt241,  0,       0,   vt220,  vt220,   0,          "DEC",   "VT241",      GAME_NOT_WORKING | GAME_NO_SOUND)
87COMP( 1983, mc7105,  0,       0,    vt240,    vt240,     0,           "Elektronika",   "MC7105",      GAME_NOT_WORKING | GAME_NO_SOUND)
87COMP( 1983, mc7105,  0,       0,   vt240,   vt240,    0,        "Elektronika",   "MC7105",      GAME_NOT_WORKING | GAME_NO_SOUND)
8888
src/mess/drivers/dc.c
r8044r8045
4646{
4747   if (cpu_get_pc(space->cpu)==0xc0ba52a)
4848      cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(2500));
49   //   cpu_spinuntil_int(space->cpu);
49   //  cpu_spinuntil_int(space->cpu);
5050
5151   return dc_ram[0x2303b0/8];
5252}
r8044r8045
5555{
5656   if (cpu_get_pc(space->cpu)==0xc0bac62)
5757      cpu_spinuntil_time(space->cpu, ATTOTIME_IN_USEC(2500));
58   //   cpu_spinuntil_int(space->cpu);
58   //  cpu_spinuntil_int(space->cpu);
5959
6060   return dc_ram[0x2302f8/8];
6161}
src/mess/drivers/pasogo.c
r8044r8045
523523      size = image_get_software_region_length(image, "rom");
524524      memcpy(user, image_get_software_region(image, "rom"), size);
525525   }
526   
526
527527   return INIT_PASS;
528528}
529529
src/mess/drivers/sys2900.c
r8044r8045
44
55    12/05/2009 Skeleton driver.
66
7   The system contains 4 S100 boards, 2 8" floppies, enormous power supply,
8   1/4" thick mother board, 4 RS232 I/F boards, and an Australian made
9   "Computer Patch Board".
10   The S100 boards that make up the unit are:
11         CPU board - Model CPC2810 Rev D
12               The board has a Z80A CPU, CTC, PIO, DART and SIO.
13               U16 (24 pin) is missing (boot EPROM?).
14               It has a lot of jumpers and an 8 way DIP switch.
15         Memory board - Model HDM2800 Rev B
16               This contains 18 4164's and a lot of logic.
17               Again, a lot of jumpers, and several banks of links.
18               Also contains 2 Motorola chips I cannot identify,
19               MC3480P (24 pin) and MC3242AP (28 pin).
20               (I have searched the Motorola site and the Chip
21                Directory; nothing even close.)
22         Disk Controller board - Model FDC2800 Rev D
23               This board is damaged. The small voltage regulators
24               for +/- 12V have been fried.
25               Also, 3 sockets are empty - U1 and U38 (16 pin)
26               appear to be spares, and U10 (14 pin).
27         8 port Serial I/O board - Model INO2808 Rev C
28               Room for 8 8251 USART's.
29               I have traced out this board and managed to get it
30               working in another S100 system.
31   The "Computer Patch Board" seems to provide some sort of watch dog
32   facility.
7    The system contains 4 S100 boards, 2 8" floppies, enormous power supply,
8    1/4" thick mother board, 4 RS232 I/F boards, and an Australian made
9    "Computer Patch Board".
10    The S100 boards that make up the unit are:
11            CPU board - Model CPC2810 Rev D
12                    The board has a Z80A CPU, CTC, PIO, DART and SIO.
13                    U16 (24 pin) is missing (boot EPROM?).
14                    It has a lot of jumpers and an 8 way DIP switch.
15            Memory board - Model HDM2800 Rev B
16                    This contains 18 4164's and a lot of logic.
17                    Again, a lot of jumpers, and several banks of links.
18                    Also contains 2 Motorola chips I cannot identify,
19                    MC3480P (24 pin) and MC3242AP (28 pin).
20                    (I have searched the Motorola site and the Chip
21                     Directory; nothing even close.)
22            Disk Controller board - Model FDC2800 Rev D
23                    This board is damaged. The small voltage regulators
24                    for +/- 12V have been fried.
25                    Also, 3 sockets are empty - U1 and U38 (16 pin)
26                    appear to be spares, and U10 (14 pin).
27            8 port Serial I/O board - Model INO2808 Rev C
28                    Room for 8 8251 USART's.
29                    I have traced out this board and managed to get it
30                    working in another S100 system.
31    The "Computer Patch Board" seems to provide some sort of watch dog
32    facility.
3333
3434****************************************************************************/
3535
src/mess/drivers/lynx.c
r8044r8045
162162
163163   if (image_fread(image, data, length) != length)
164164   {
165      free(data);   
165      free(data);
166166      return INIT_FAIL;
167167   }
168168
src/mess/drivers/n64.c
r8044r8045
115115      length = image_get_software_region_length(image, "rom");
116116      memcpy(cart, image_get_software_region(image, "rom"), length);
117117   }
118   
118
119119   if (cart[0] == 0x37 && cart[1] == 0x80)
120120   {
121121      for (i = 0; i < length; i += 4)
src/mess/drivers/geneve.c
r8044r8045
266266      PORT_CONFSETTING(    0x01, "TI SD Floppy Controller" )
267267      PORT_CONFSETTING(    0x02, "SNUG BwG Controller" )
268268      PORT_CONFSETTING(    0x03, "Myarc HFDC" )
269//      PORT_CONFSETTING(    0x04, "Corcomp" )
269//      PORT_CONFSETTING(    0x04, "Corcomp" )
270270
271271   PORT_START( "HDCTRL" )
272272   PORT_CONFNAME( 0x03, 0x00, "HD controller" )
273273      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
274274      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
275//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
275//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
276276   PORT_CONFNAME( 0x08, 0x00, "USB-SM card" )
277277      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
278278      PORT_CONFSETTING(    0x08, DEF_STR( On ) )
r8044r8045
288288      PORT_DIPSETTING( 0xaa, "40 track, 8 ms")
289289      PORT_DIPSETTING( 0x55, "80 track, 2 ms")
290290      PORT_DIPSETTING( 0xff, "80 track HD, 2 ms")
291     
291
292292   PORT_START( "DRVSPD" )
293293   PORT_DIPNAME( 0x01, 0x01, "Floppy and HD speed" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 )
294294      PORT_DIPSETTING( 0x00, "No delay")
295295      PORT_DIPSETTING( 0x01, "Realistic")
296         
296
297297   PORT_START("JOY")   /* col 1: "wired handset 1" (= joystick 1) */
298298      PORT_BIT(0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP/*, "(1UP)", CODE_NONE, OSD_JOY_UP*/) PORT_PLAYER(1)
299299      PORT_BIT(0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN/*, "(1DOWN)", CODE_NONE, OSD_JOY_DOWN, 0*/) PORT_PLAYER(1)
src/mess/drivers/victor9k.c
r8044r8045
22
33    Victor 9000
44
5   - very exciting hardware, disk controller is a direct descendant
6     of the Commodore drives (designed by Chuck Peddle)
5    - very exciting hardware, disk controller is a direct descendant
6      of the Commodore drives (designed by Chuck Peddle)
77
88    Skeleton driver
99
r8044r8045
1111
1212/*
1313
14   TODO:
14    TODO:
1515
16   - floppy 8048
17   - keyboard
18   - add HD46505S variant to mc6845.c
19   - hires graphics
20   - character attributes
21   - brightness/contrast
22   - MC6852
23   - codec sound
16    - floppy 8048
17    - keyboard
18    - add HD46505S variant to mc6845.c
19    - hires graphics
20    - character attributes
21    - brightness/contrast
22    - MC6852
23    - codec sound
2424
2525*/
2626
r8044r8045
4343/* Memory Maps */
4444
4545static ADDRESS_MAP_START( victor9k_mem, ADDRESS_SPACE_PROGRAM, 8 )
46//   AM_RANGE(0x00000, 0xdffff) AM_RAM
46//  AM_RANGE(0x00000, 0xdffff) AM_RAM
4747   AM_RANGE(0xe0000, 0xe0001) AM_DEVREADWRITE(I8259A_TAG, pic8259_r, pic8259_w)
4848   AM_RANGE(0xe0020, 0xe0023) AM_DEVREADWRITE(I8253_TAG, pit8253_r, pit8253_w)
4949   AM_RANGE(0xe0040, 0xe0043) AM_DEVREADWRITE(UPD7201_TAG, upd7201_cd_ba_r, upd7201_cd_ba_w)
r8044r8045
192192
193193/*
194194
195   pin      signal      description
195    pin     signal      description
196196
197   IR0      SYN         sync detect
198   IR1      COMM      serial communications (7201)
199   IR2      TIMER      8253 timer
200   IR3      PARALLEL   all 6522 IRQ (including disk)
201   IR4      IR4         expansion IR4
202   IR5      IR5         expansion IR5
203   IR6      KBINT      keyboard data ready
204   IR7      VINT      vertical sync or nonspecific interrupt
197    IR0     SYN         sync detect
198    IR1     COMM        serial communications (7201)
199    IR2     TIMER       8253 timer
200    IR3     PARALLEL    all 6522 IRQ (including disk)
201    IR4     IR4         expansion IR4
202    IR5     IR5         expansion IR5
203    IR6     KBINT       keyboard data ready
204    IR7     VINT        vertical sync or nonspecific interrupt
205205
206206*/
207207
r8044r8045
676676        PB0     L1MS0
677677        PB1     L1MS1
678678        PB2     L1MS2
679        PB3      L1MS3
679        PB3     L1MS3
680680        PB4     ST1A
681681        PB5     ST1B
682682        PB6     ST1C
r8044r8045
10061006   MDRV_CPU_ADD(I8048_TAG, I8048, XTAL_30MHz/6)
10071007   MDRV_CPU_IO_MAP(floppy_io)
10081008
1009//   MDRV_CPU_ADD(I8022_TAG, I8022, 100000)
1010//   MDRV_CPU_IO_MAP(keyboard_io)
1009//  MDRV_CPU_ADD(I8022_TAG, I8022, 100000)
1010//  MDRV_CPU_IO_MAP(keyboard_io)
10111011
10121012   MDRV_MACHINE_START(victor9k)
10131013
r8044r8045
10761076
10771077/* System Drivers */
10781078
1079/*    YEAR  NAME      PARENT  COMPAT  MACHINE   INPUT     INIT  COMPANY                  FULLNAME      FLAGS */
1079/*    YEAR  NAME      PARENT  COMPAT  MACHINE   INPUT     INIT  COMPANY                     FULLNAME        FLAGS */
10801080COMP( 1982, victor9k, 0,      0,      victor9k, victor9k, 0,    "Victor Business Products", "Victor 9000",   GAME_NOT_WORKING )
src/mess/drivers/instruct.c
r8044r8045
11/***************************************************************************
2   
2
33        instruct
44
55        08/04/2010 Skeleton driver.
r8044r8045
1212static ADDRESS_MAP_START(instruct_mem, ADDRESS_SPACE_PROGRAM, 8)
1313   ADDRESS_MAP_UNMAP_HIGH
1414   AM_RANGE( 0x0000, 0x07ff) AM_ROM
15   AM_RANGE( 0x0800, 0x7fff) AM_RAM   
15   AM_RANGE( 0x0800, 0x7fff) AM_RAM
1616ADDRESS_MAP_END
1717
1818static ADDRESS_MAP_START( instruct_io , ADDRESS_SPACE_IO, 8)
r8044r8045
2424INPUT_PORTS_END
2525
2626
27static MACHINE_RESET(instruct)
28{   
27static MACHINE_RESET(instruct)
28{
2929}
3030
3131static VIDEO_START( instruct )
r8044r8045
4141    /* basic machine hardware */
4242    MDRV_CPU_ADD("maincpu",S2650, XTAL_1MHz)
4343    MDRV_CPU_PROGRAM_MAP(instruct_mem)
44    MDRV_CPU_IO_MAP(instruct_io)   
44    MDRV_CPU_IO_MAP(instruct_io)
4545
4646    MDRV_MACHINE_RESET(instruct)
47   
47
4848    /* video hardware */
4949    MDRV_SCREEN_ADD("screen", RASTER)
5050    MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
6868/* Driver */
6969
7070/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME       FLAGS */
71COMP( 1978, instruct,  0,       0,    instruct,    instruct,     0,  "Signetics",   "Signetics Instructor 50",      GAME_NOT_WORKING | GAME_NO_SOUND )
71COMP( 1978, instruct,  0,       0,   instruct,   instruct,    0,  "Signetics",   "Signetics Instructor 50",      GAME_NOT_WORKING | GAME_NO_SOUND )
7272
src/mess/drivers/alesis.c
r8044r8045
11/***************************************************************************
2   
2
33    Alesis HR-16 and SR-16 drum machines
44
55    06/04/2010 Skeleton driver.
r8044r8045
3636INPUT_PORTS_END
3737
3838
39static MACHINE_RESET(alesis)
40{   
39static MACHINE_RESET(alesis)
40{
4141}
4242
4343static VIDEO_START( alesis )
r8044r8045
5353   /* basic machine hardware */
5454   MDRV_CPU_ADD("maincpu",I8031, XTAL_12MHz)
5555   MDRV_CPU_PROGRAM_MAP(hr16_mem)
56   MDRV_CPU_IO_MAP(hr16_io)   
56   MDRV_CPU_IO_MAP(hr16_io)
5757
5858   MDRV_MACHINE_RESET(alesis)
59   
59
6060   /* video hardware */
6161   MDRV_SCREEN_ADD("screen", RASTER)
6262   MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
7575   /* basic machine hardware */
7676   MDRV_CPU_ADD("maincpu",I8031, XTAL_12MHz)
7777   MDRV_CPU_PROGRAM_MAP(sr16_mem)
78   MDRV_CPU_IO_MAP(sr16_io)   
78   MDRV_CPU_IO_MAP(sr16_io)
7979
8080   MDRV_MACHINE_RESET(alesis)
81   
81
8282   /* video hardware */
8383   MDRV_SCREEN_ADD("screen", RASTER)
8484   MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
109109ROM_END
110110
111111ROM_START( hr16b )
112   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )   
112   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
113113
114114   ROM_REGION( 0x10000, "user1", ROMREGION_ERASEFF )
115115   // version 2.00
r8044r8045
127127
128128   ROM_REGION( 0x100000, "sounddata", ROMREGION_ERASEFF )
129129   ROM_LOAD( "sr16.u5", 0x00000, 0x80000, CRC(8bb25cfa) SHA1(273ad59d017b54a7e8d5e1ec61c8cd807a0e4af3))
130   ROM_LOAD( "sr16.u6", 0x80000, 0x80000, CRC(6da96987) SHA1(3ec8627d440bc73841e1408a19def09a8b0b77f7))   
130   ROM_LOAD( "sr16.u6", 0x80000, 0x80000, CRC(6da96987) SHA1(3ec8627d440bc73841e1408a19def09a8b0b77f7))
131131ROM_END
132132
133133
src/mess/drivers/atom.c
r8044r8045
5454    The atom driver in MESS uses the original memory area.
5555
5656
57   http://www.xs4all.nl/~fjkraan/comp/atom/index.html
57    http://www.xs4all.nl/~fjkraan/comp/atom/index.html
5858
5959***************************************************************************/
6060
6161/*
6262
63   TODO:
63    TODO:
6464
65   - ERROR repeats ad infinitum
66   - display should be monochrome
67   - ram expansion
68   - tap files
69   - mouse
70   - move eprom box roms to software list
71   - color card
72   - CP/M card
73   - speech synthesis card (SPO256 connected to VIA)
65    - ERROR repeats ad infinitum
66    - display should be monochrome
67    - ram expansion
68    - tap files
69    - mouse
70    - move eprom box roms to software list
71    - color card
72    - CP/M card
73    - speech synthesis card (SPO256 connected to VIA)
7474
7575*/
7676
r8044r8045
327327{
328328   /*
329329
330      bit      description
330        bit     description
331331
332      0      keyboard column 0
333      1      keyboard column 1
334      2      keyboard column 2
335      3      keyboard column 3
336      4      MC6847 A/G
337      5      MC6847 GM0
338      6      MC6847 GM1
339      7      MC6847 GM2
332        0       keyboard column 0
333        1       keyboard column 1
334        2       keyboard column 2
335        3       keyboard column 3
336        4       MC6847 A/G
337        5       MC6847 GM0
338        6       MC6847 GM1
339        7       MC6847 GM2
340340
341   */
341    */
342342
343343   atom_state *state = (atom_state *)device->machine->driver_data;
344344
r8044r8045
356356{
357357   /*
358358
359      bit      description
359        bit     description
360360
361      0      keyboard row 0
362      1      keyboard row 1
363      2      keyboard row 2
364      3      keyboard row 3
365      4      keyboard row 4
366      5      keyboard row 5
367      6      keyboard CTRL
368      7      keyboard SFT
361        0       keyboard row 0
362        1       keyboard row 1
363        2       keyboard row 2
364        3       keyboard row 3
365        4       keyboard row 4
366        5       keyboard row 5
367        6       keyboard CTRL
368        7       keyboard SFT
369369
370   */
370    */
371371
372372   atom_state *state = (atom_state *)device->machine->driver_data;
373373   UINT8 data = 0xff;
r8044r8045
395395{
396396   /*
397397
398      bit      description
398        bit     description
399399
400      0      O/P 1, cassette output 0
401      1      O/P 2, cassette output 1
402      2      O/P 3, speaker output
403      3      O/P 4, MC6847 CSS
404      4      2400 Hz input
405      5      cassette input
406      6      keyboard RPT
407      7      MC6847 FS
400        0       O/P 1, cassette output 0
401        1       O/P 2, cassette output 1
402        2       O/P 3, speaker output
403        3       O/P 4, MC6847 CSS
404        4       2400 Hz input
405        5       cassette input
406        6       keyboard RPT
407        7       MC6847 FS
408408
409   */
409    */
410410
411411   atom_state *state = (atom_state *)device->machine->driver_data;
412412
r8044r8045
431431{
432432   /*
433433
434      bit      description
434        bit     description
435435
436      0      O/P 1, cassette output 0
437      1      O/P 2, cassette output 1
438      2      O/P 3, speaker output
439      3      O/P 4, MC6847 CSS
440      4      2400 Hz input
441      5      cassette input
442      6      keyboard RPT
443      7      MC6847 FS
436        0       O/P 1, cassette output 0
437        1       O/P 2, cassette output 1
438        2       O/P 3, speaker output
439        3       O/P 4, MC6847 CSS
440        4       2400 Hz input
441        5       cassette input
442        6       keyboard RPT
443        7       MC6847 FS
444444
445   */
445    */
446446
447447   atom_state *state = (atom_state *)device->machine->driver_data;
448448
r8044r8045
798798   ROM_CONTINUE(          0x3000, 0x1000 )
799799   ROM_LOAD( "afloat.ic21", 0x1000, 0x1000, CRC(81d86af7) SHA1(ebcde5b36cb3a3344567cbba4c7b9fde015f4802) )
800800   ROM_LOAD( "dosrom.u15",  0x2000, 0x1000, CRC(c431a9b7) SHA1(71ea0a4b8d9c3caf9718fc7cc279f4306a23b39c) )
801   
801
802802   ROM_REGION( 0x10000, "a000", 0 )
803803   ROM_CART_LOAD( "rom0", 0x0000, 0x1000, ROM_MIRROR )
804804   ROM_CART_LOAD( "rom1", 0x1000, 0x1000, ROM_MIRROR )
src/mess/drivers/elektor.c
r8044r8045
11/***************************************************************************
2   
2
33        elektor
44
55        08/04/2010 Skeleton driver.
r8044r8045
1212static ADDRESS_MAP_START(elektor_mem, ADDRESS_SPACE_PROGRAM, 8)
1313   ADDRESS_MAP_UNMAP_HIGH
1414   AM_RANGE( 0x0000, 0x07ff) AM_ROM
15   AM_RANGE( 0x0800, 0x7fff) AM_RAM   
15   AM_RANGE( 0x0800, 0x7fff) AM_RAM
1616ADDRESS_MAP_END
1717
1818static ADDRESS_MAP_START( elektor_io , ADDRESS_SPACE_IO, 8)
r8044r8045
2424INPUT_PORTS_END
2525
2626
27static MACHINE_RESET(elektor)
28{   
27static MACHINE_RESET(elektor)
28{
2929}
3030
3131static VIDEO_START( elektor )
r8044r8045
4141    /* basic machine hardware */
4242    MDRV_CPU_ADD("maincpu",S2650, XTAL_1MHz)
4343    MDRV_CPU_PROGRAM_MAP(elektor_mem)
44    MDRV_CPU_IO_MAP(elektor_io)   
44    MDRV_CPU_IO_MAP(elektor_io)
4545
4646    MDRV_MACHINE_RESET(elektor)
47   
47
4848    /* video hardware */
4949    MDRV_SCREEN_ADD("screen", RASTER)
5050    MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
6868/* Driver */
6969
7070/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY   FULLNAME       FLAGS */
71COMP( 1979, elektor,  0,       0,    elektor,    elektor,     0,   "Elektor",   "Elektor TV Games Computer",      GAME_NOT_WORKING | GAME_NO_SOUND )
71COMP( 1979, elektor,  0,       0,   elektor,   elektor,    0,   "Elektor",   "Elektor TV Games Computer",      GAME_NOT_WORKING | GAME_NO_SOUND )
7272
src/mess/drivers/dm7000.c
r8044r8045
11/***************************************************************************
2   
2
33        Dream Multimedia Dreambox 7000/5620/500
44
55        20/03/2010 Skeleton driver.
66
7     
8   DM7000 -    CPU STB04500 at 252 MHz
9            RAM   64MB
10            Flash 8MB
11            1 x DVB-S
12            1 x IDE interface
13            1 x Common Interface (CI)
14            1 x Compact flash
15            2 x Smart card reader
16            1 x USB
17            1 x RS232
18            1 x LAN 100Mbit/s
19            1 x LCD display
20           
21   DM56x0 -    CPU STB04500 at 252 MHz
22            RAM   64MB
23            Flash 8MB
24            1 x DVB-S
25            2 x Common Interface (CI)
26            1 x Smart card reader
27            1 x LAN 100Mbit/s (just on 5620)
28            1 x LCD display
29           
30   DM500 -    CPU STBx25xx at 252 MHz
31            RAM   96MB
32            Flash 32MB
33            1 x DVB-S
34            1 x Smart card reader
35            1 x LAN 100Mbit/s             
36           
7
8    DM7000 -    CPU STB04500 at 252 MHz
9                RAM 64MB
10                Flash 8MB
11                1 x DVB-S
12                1 x IDE interface
13                1 x Common Interface (CI)
14                1 x Compact flash
15                2 x Smart card reader
16                1 x USB
17                1 x RS232
18                1 x LAN 100Mbit/s
19                1 x LCD display
20
21    DM56x0 -    CPU STB04500 at 252 MHz
22                RAM 64MB
23                Flash 8MB
24                1 x DVB-S
25                2 x Common Interface (CI)
26                1 x Smart card reader
27                1 x LAN 100Mbit/s (just on 5620)
28                1 x LCD display
29
30    DM500 -     CPU STBx25xx at 252 MHz
31                RAM 96MB
32                Flash 32MB
33                1 x DVB-S
34                1 x Smart card reader
35                1 x LAN 100Mbit/s
36
3737****************************************************************************/
3838
3939#include "emu.h"
r8044r8045
5858 400d 000x   modem
5959*/
6060static ADDRESS_MAP_START( dm7000_mem, ADDRESS_SPACE_PROGRAM, 32 )
61   ADDRESS_MAP_UNMAP_HIGH   
61   ADDRESS_MAP_UNMAP_HIGH
6262   AM_RANGE(0x00000000, 0x01ffffff) AM_RAM   // RAM page 0 - 32MB
6363   AM_RANGE(0x20000000, 0x21ffffff) AM_RAM // RAM page 1 - 32MB
6464   AM_RANGE(0xfffe0000, 0xffffffff) AM_ROM AM_REGION("user1",0)
r8044r8045
6969INPUT_PORTS_END
7070
7171
72static MACHINE_RESET(dm7000)
73{   
72static MACHINE_RESET(dm7000)
73{
7474}
7575
7676static VIDEO_START( dm7000 )
r8044r8045
8888    MDRV_CPU_PROGRAM_MAP(dm7000_mem)
8989
9090    MDRV_MACHINE_RESET(dm7000)
91   
91
9292    /* video hardware */
9393    MDRV_SCREEN_ADD("screen", RASTER)
9494    MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
124124/* Driver */
125125
126126/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY   FULLNAME       FLAGS */
127COMP( 2003, dm7000,  0,       0,    dm7000,    dm7000,     0,   "Dream Multimedia",   "Dreambox 7000",      GAME_NOT_WORKING | GAME_NO_SOUND)
128COMP( 2004, dm5620,  dm7000,  0,    dm7000,    dm7000,     0,   "Dream Multimedia",   "Dreambox 5620",      GAME_NOT_WORKING | GAME_NO_SOUND)
129COMP( 2006, dm500,   dm7000,  0,    dm7000,    dm7000,     0,   "Dream Multimedia",   "Dreambox 500",         GAME_NOT_WORKING | GAME_NO_SOUND)
127COMP( 2003, dm7000,  0,       0,   dm7000,    dm7000,     0,   "Dream Multimedia",   "Dreambox 7000",      GAME_NOT_WORKING | GAME_NO_SOUND)
128COMP( 2004, dm5620,  dm7000,  0,   dm7000,    dm7000,     0,   "Dream Multimedia",   "Dreambox 5620",      GAME_NOT_WORKING | GAME_NO_SOUND)
129COMP( 2006, dm500,   dm7000,  0,   dm7000,    dm7000,     0,   "Dream Multimedia",   "Dreambox 500",         GAME_NOT_WORKING | GAME_NO_SOUND)
130130
src/mess/drivers/snes.c
r8044r8045
8080ADDRESS_MAP_END
8181
8282static ADDRESS_MAP_START( spc_map, ADDRESS_SPACE_PROGRAM, 8)
83   AM_RANGE(0x0000, 0x00ef) AM_DEVREADWRITE("spc700", spc_ram_r, spc_ram_w)      /* lower 32k ram */
84   AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE("spc700", spc_io_r, spc_io_w)      /* spc io */
83   AM_RANGE(0x0000, 0x00ef) AM_DEVREADWRITE("spc700", spc_ram_r, spc_ram_w)   /* lower 32k ram */
84   AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE("spc700", spc_io_r, spc_io_w)     /* spc io */
8585   AM_RANGE(0x0100, 0xffff) AM_DEVWRITE("spc700", spc_ram_100_w)
8686   AM_RANGE(0x0100, 0xffbf) AM_DEVREAD("spc700", spc_ram_100_r)
8787   AM_RANGE(0xffc0, 0xffff) AM_DEVREAD("spc700", spc_ipl_r)
r8044r8045
279279   PORT_CATEGORY_ITEM(  0x01, "Gamepad",      11 )
280280   PORT_CATEGORY_ITEM(  0x02, "Mouse",         12 )
281281   PORT_CATEGORY_ITEM(  0x03, "Superscope",      13 )
282//   PORT_CATEGORY_ITEM(  0x04, "Justfier",      14 )
283//   PORT_CATEGORY_ITEM(  0x05, "Multitap",      15 )
282//  PORT_CATEGORY_ITEM(  0x04, "Justfier",      14 )
283//  PORT_CATEGORY_ITEM(  0x05, "Multitap",      15 )
284284   PORT_CATEGORY_CLASS( 0xf0, 0x10, "P2 Controller")
285285   PORT_CATEGORY_ITEM(  0x00, "Unconnected",      20 )
286286   PORT_CATEGORY_ITEM(  0x10, "Gamepad",      21 )
287287   PORT_CATEGORY_ITEM(  0x20, "Mouse",         22 )
288288   PORT_CATEGORY_ITEM(  0x30, "Superscope",      23 )
289//   PORT_CATEGORY_ITEM(  0x40, "Justfier",      24 )
290//   PORT_CATEGORY_ITEM(  0x50, "Multitap",      25 )
289//  PORT_CATEGORY_ITEM(  0x40, "Justfier",      24 )
290//  PORT_CATEGORY_ITEM(  0x50, "Multitap",      25 )
291291
292292   PORT_INCLUDE(snes_joypads)
293293   PORT_INCLUDE(snes_mouse)
r8044r8045
514514      state->scope[port].pause_lock = 0;
515515
516516   /* If we have pressed fire or cursor and we are on-screen and SuperScope is in Port2, then latch video signal.
517   Notice that we only latch Port2 because its IOBit pin is connected to bit7 of the IO Port, while Port1 has
518   IOBit pin connected to bit6 of the IO Port, and the latter is not detected by the H/V Counters. In other
519   words, you can connect SuperScope to Port1, but there is no way SNES could detect its on-screen position */
517    Notice that we only latch Port2 because its IOBit pin is connected to bit7 of the IO Port, while Port1 has
518    IOBit pin connected to bit6 of the IO Port, and the latter is not detected by the H/V Counters. In other
519    words, you can connect SuperScope to Port1, but there is no way SNES could detect its on-screen position */
520520   if ((state->scope[port].buttons & 0xc0) && !(state->scope[port].buttons & 0x02) && port == 1)
521521      snes_gun_latch(machine, state->scope[port].x, state->scope[port].y);
522522
src/mess/drivers/hec2hrp.c
r8044r8045
77        Hector MX40c
88        Hector MX80c
99
10   These machines can load and run cassettes for the interact / hector1.
11   hec2hr - press 2 then 1
12   hec2hrp - press 2 then 1
13   hec2hrx - press 5 then 1
14   hec2mx40 - press 5 then 1
15   hec2mx80 - not compatible
16   victor - press R then L
10    These machines can load and run cassettes for the interact / hector1.
11    hec2hr - press 2 then 1
12    hec2hrp - press 2 then 1
13    hec2hrx - press 5 then 1
14    hec2mx40 - press 5 then 1
15    hec2mx80 - not compatible
16    victor - press R then L
1717
1818        12/05/2009 Skeleton driver - Micko
1919
src/mess/drivers/cd2650.c
r8044r8045
11/***************************************************************************
2   
2
33        cd2650
44
55        08/04/2010 Skeleton driver.
r8044r8045
1212static ADDRESS_MAP_START(cd2650_mem, ADDRESS_SPACE_PROGRAM, 8)
1313   ADDRESS_MAP_UNMAP_HIGH
1414   AM_RANGE( 0x0000, 0x03ff) AM_ROM
15   AM_RANGE( 0x0400, 0x7fff) AM_RAM   
15   AM_RANGE( 0x0400, 0x7fff) AM_RAM
1616ADDRESS_MAP_END
1717
1818static ADDRESS_MAP_START( cd2650_io , ADDRESS_SPACE_IO, 8)
r8044r8045
2424INPUT_PORTS_END
2525
2626
27static MACHINE_RESET(cd2650)
28{   
27static MACHINE_RESET(cd2650)
28{
2929}
3030
3131static VIDEO_START( cd2650 )
r8044r8045
4141    /* basic machine hardware */
4242    MDRV_CPU_ADD("maincpu",S2650, XTAL_1MHz)
4343    MDRV_CPU_PROGRAM_MAP(cd2650_mem)
44    MDRV_CPU_IO_MAP(cd2650_io)   
44    MDRV_CPU_IO_MAP(cd2650_io)
4545
4646    MDRV_MACHINE_RESET(cd2650)
47   
47
4848    /* video hardware */
4949    MDRV_SCREEN_ADD("screen", RASTER)
5050    MDRV_SCREEN_REFRESH_RATE(50)
r8044r8045
6868/* Driver */
6969
7070/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT     COMPANY   FULLNAME       FLAGS */
71COMP( 1977, cd2650,  0,       0,    cd2650,    cd2650,     0,   "Central Data",   "CD 2650",      GAME_NOT_WORKING | GAME_NO_SOUND )
71COMP( 1977, cd2650,  0,       0,   cd2650,    cd2650,     0,   "Central Data",   "CD 2650",      GAME_NOT_WORKING | GAME_NO_SOUND )
7272
src/mess/drivers/pegasus.c
r8044r8045
11/***************************************************************************
2   
3   Aamber Pegasus computer (New Zealand)
42
5   http://web.mac.com/lord_philip/aamber_pegasus/Aamber_Pegasus.html
3    Aamber Pegasus computer (New Zealand)
64
7   Each copy of the monitor rom was made for an individual machine.
8   The early bios versions checked that it was running on that
9   particular computer.
5    http://web.mac.com/lord_philip/aamber_pegasus/Aamber_Pegasus.html
106
11   This computer has no sound.
7    Each copy of the monitor rom was made for an individual machine.
8    The early bios versions checked that it was running on that
9    particular computer.
1210
13   The usual way of loading a new rom was to plug it into the board.
14   We have replaced this with cartslots, to save having to recompile
15   whenever a new rom is found. Single rom programs will usually work in
16   any slot (if it is going to work at all). A working rom will appear
17   in the menu. Press the first letter to run it.
11    This computer has no sound.
1812
19   If a machine language program is loaded via cassette, do it in the
20   Monitor (L command), when loaded press Enter, and it will be in the
21   menu.
13    The usual way of loading a new rom was to plug it into the board.
14    We have replaced this with cartslots, to save having to recompile
15    whenever a new rom is found. Single rom programs will usually work in
16    any slot (if it is going to work at all). A working rom will appear
17    in the menu. Press the first letter to run it.
2218
23   Basic cassettes are loaded in the usual way, that is, start Basic,
24   type LOAD, press Enter. When done, RUN or LIST as needed.
19    If a machine language program is loaded via cassette, do it in the
20    Monitor (L command), when loaded press Enter, and it will be in the
21    menu.
2522
26   TO DO:
27   - Identify which rom slots the multi-rom programs should be fitted to.
28   - Work on the other non-working programs
23    Basic cassettes are loaded in the usual way, that is, start Basic,
24    type LOAD, press Enter. When done, RUN or LIST as needed.
2925
26    TO DO:
27    - Identify which rom slots the multi-rom programs should be fitted to.
28    - Work on the other non-working programs
29
3030****************************************************************************/
3131
3232#include "emu.h"
r8044r8045
7272
7373static WRITE8_DEVICE_HANDLER( pegasus_controls )
7474{
75/*   d0,d2 - not emulated
76   d0 - Blank - Video blanking
77   d1 - Char - select character rom or ram
78   d2 - Page - enables writing to video ram
79   d3 - Asc - Select which half of the keyboard to read
75/*  d0,d2 - not emulated
76    d0 - Blank - Video blanking
77    d1 - Char - select character rom or ram
78    d2 - Page - enables writing to video ram
79    d3 - Asc - Select which half of the keyboard to read
8080*/
8181
8282   pegasus_control_bits = data;
r8044r8045
105105
106106static WRITE8_HANDLER( pegasus_pcg_w )
107107{
108//   if (pegasus_control_bits & 2)
108//  if (pegasus_control_bits & 2)
109109   {
110110      UINT8 code = pegasus_video_ram[offset] & 0x7f;
111111      FNT[(code << 4) | (~pegasus_kbd_row & 15)] = data;
r8044r8045
271271};
272272
273273/* An encrypted single rom starts with 02, decrypted with 20. Not sure what
274   multipart roms will have. */
274    multipart roms will have. */
275275static void pegasus_decrypt_rom( running_machine *machine, UINT16 addr )
276276{
277277   UINT8 b, *ROM = memory_region(machine, "maincpu");
r8044r8045
424424/* Driver */
425425
426426/*    YEAR  NAME    PARENT  COMPAT   MACHINE    INPUT    INIT    COMPANY   FULLNAME       FLAGS */
427COMP( 1981, pegasus,  0,     0,      pegasus,    pegasus, pegasus, "Technosys",   "Aamber Pegasus", GAME_NO_SOUND_HW )
428COMP( 1981, pegasusm, pegasus, 0,    pegasusm,    pegasus, pegasus, "Technosys",   "Aamber Pegasus with RAM expansion unit", GAME_NO_SOUND_HW )
427COMP( 1981, pegasus,  0,     0,      pegasus,   pegasus, pegasus, "Technosys",   "Aamber Pegasus", GAME_NO_SOUND_HW )
428COMP( 1981, pegasusm, pegasus, 0,    pegasusm,   pegasus, pegasus, "Technosys",   "Aamber Pegasus with RAM expansion unit", GAME_NO_SOUND_HW )
429429
src/mess/drivers/mtx.c
r8044r8045
1010
1111    TODO:
1212
13   - cassette
14   - cartridges
15   - SDX/FDX floppy
16   - HDX hard disk
17   - HRX high resolution graphics
18   - CBM (all RAM) mode
19   - "Silicon" disks
20   - Multi Effect Video Wall
13    - cassette
14    - cartridges
15    - SDX/FDX floppy
16    - HDX hard disk
17    - HRX high resolution graphics
18    - CBM (all RAM) mode
19    - "Silicon" disks
20    - Multi Effect Video Wall
2121
2222*/
2323
r8044r8045
6363   AM_RANGE(0x04, 0x04) AM_DEVREADWRITE(CENTRONICS_TAG, mtx_prt_r, centronics_data_w)
6464   AM_RANGE(0x05, 0x05) AM_READWRITE(mtx_key_lo_r, mtx_sense_w)
6565   AM_RANGE(0x06, 0x06) AM_READWRITE(mtx_key_hi_r, mtx_sound_latch_w)
66//   AM_RANGE(0x07, 0x07) PIO
66//  AM_RANGE(0x07, 0x07) PIO
6767   AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_r, z80ctc_w)
6868   AM_RANGE(0x30, 0x31) AM_WRITE(hrx_address_w)
6969   AM_RANGE(0x32, 0x32) AM_READWRITE(hrx_data_r, hrx_data_w)
7070   AM_RANGE(0x33, 0x33) AM_READWRITE(hrx_attr_r, hrx_attr_w)
71//   AM_RANGE(0x38, 0x38) AM_DEVWRITE(MC6845_TAG, mc6845_address_w)
72//   AM_RANGE(0x39, 0x39) AM_DEVWRITE(MC6845_TAG, mc6845_register_r, mc6845_register_w)
73/*   AM_RANGE(0x40, 0x43) AM_DEVREADWRITE(FD1791_TAG, wd17xx_r, wd17xx_w)
74   AM_RANGE(0x44, 0x44) AM_READWRITE(fdx_status_r, fdx_control_w)
75   AM_RANGE(0x45, 0x45) AM_WRITE(fdx_drv_sel_w)
76   AM_RANGE(0x46, 0x46) AM_WRITE(fdx_dma_lo_w)
77   AM_RANGE(0x47, 0x47) AM_WRITE(fdx_dma_hi_w)*/
71//  AM_RANGE(0x38, 0x38) AM_DEVWRITE(MC6845_TAG, mc6845_address_w)
72//  AM_RANGE(0x39, 0x39) AM_DEVWRITE(MC6845_TAG, mc6845_register_r, mc6845_register_w)
73/*  AM_RANGE(0x40, 0x43) AM_DEVREADWRITE(FD1791_TAG, wd17xx_r, wd17xx_w)
74    AM_RANGE(0x44, 0x44) AM_READWRITE(fdx_status_r, fdx_control_w)
75    AM_RANGE(0x45, 0x45) AM_WRITE(fdx_drv_sel_w)
76    AM_RANGE(0x46, 0x46) AM_WRITE(fdx_dma_lo_w)
77    AM_RANGE(0x47, 0x47) AM_WRITE(fdx_dma_hi_w)*/
7878ADDRESS_MAP_END
7979
8080/*-------------------------------------------------
src/mess/drivers/intv.c
r8044r8045
178178
179179   PORT_START("IN3") /* Left Player Controller Starts Here */
180180
181   PORT_START("IN4")
181   PORT_START("IN4")
182182
183   PORT_START("IN5")
183   PORT_START("IN5")
184184INPUT_PORTS_END
185185
186186/*
src/mess/drivers/special.c
r8044r8045
591591/* Driver */
592592
593593/*    YEAR  NAME        PARENT  COMPAT   MACHINE    INPUT       INIT        COMPANY              FULLNAME       FLAGS */
594COMP( 1985, special,    0,     0,      special,   special,   special,    "<unknown>",              "Specialist",      0)
595COMP( 1985, specialm,   special,0,      special,   special,   special,    "<unknown>",              "Specialist M",      0)
596COMP( 1985, specialp,   special,0,      specialp,   specialp,   special,    "<unknown>",              "Specialist + hires graph",      0)
597COMP( 1985, lik,       special,0,      special,   lik,      special,    "<unknown>",              "Lik",            0)
598COMP( 1985, specimx,   special,0,      specimx,   specimx,   0,         "<unknown>",              "Specialist MX",   0)
599COMP( 1994, erik,      special,0,      erik,      special,   erik,      "<unknown>",              "Erik",   0)
594COMP( 1985, special,    0,     0,      special,   special,   special,    "<unknown>",             "Specialist",      0)
595COMP( 1985, specialm,   special,0,      special,   special,   special,    "<unknown>",             "Specialist M",      0)
596COMP( 1985, specialp,   special,0,      specialp,   specialp,   special,    "<unknown>",             "Specialist + hires graph",      0)
597COMP( 1985, lik,       special,0,      special,   lik,      special,    "<unknown>",             "Lik",            0)
598COMP( 1985, specimx,   special,0,      specimx,   specimx,   0,         "<unknown>",             "Specialist MX",   0)
599COMP( 1994, erik,      special,0,      erik,      special,   erik,      "<unknown>",             "Erik",   0)
src/mess/drivers/scv.c
r8044r8045
393393
394394      Only tree 'bins' of values are obviously captured
395395       25 ish
396      330 ish
396      330 ish
397397      520 ish.
398398
399399      Quamtizing/scaling/rounding between 0 and 255 we thus get:
400400
401   */
401    */
402402   palette_set_color_rgb( machine,   0,   0,   0, 155);
403403   palette_set_color_rgb( machine,   1,   0,   0,   0);
404404   palette_set_color_rgb( machine,   2,   0,   0, 255);
src/mess/drivers/rmnimbus.c
r8044r8045
243243   //PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6")    PORT_CODE(KEYCODE_6_PAD)        PORT_CHAR('6')
244244   //PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+")    PORT_CODE(KEYCODE_PLUS_PAD)     PORT_CHAR('+')
245245    //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1")    PORT_CODE(KEYCODE_1_PAD)        PORT_CHAR('1')
246   
246
247247   PORT_START(JOYSTICK0_TAG)
248248   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_PLAYER(1) PORT_8WAY // XB
249249   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_PLAYER(1) PORT_8WAY // XA
r8044r8045
253253   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
254254
255255    PORT_START(MOUSE_BUTTON_TAG)  /* Mouse buttons */
256      PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Button 2") PORT_CODE(MOUSECODE_BUTTON2)
257      PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CODE(MOUSECODE_BUTTON1)
256   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Button 2") PORT_CODE(MOUSECODE_BUTTON2)
257   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CODE(MOUSECODE_BUTTON1)
258258
259259   PORT_START(MOUSEX_TAG) /* Mouse - X AXIS */
260260   PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
r8044r8045
350350   MDRV_SOUND_CONFIG(msm5205_config)
351351
352352   MDRV_SOUND_ROUTE(ALL_OUTPUTS, MONO_TAG, 0.75)
353   
354   
353
354
355355MACHINE_DRIVER_END
356356
357357
src/mess/drivers/ut88.c
r8044r8045
239239/* Driver */
240240
241241/*    YEAR  NAME       PARENT   COMPAT  MACHINE     INPUT       INIT        COMPANY   FULLNAME       FLAGS */
242COMP( 1989, ut88mini,  0,      0,      ut88mini,   ut88mini,   ut88mini,   "<unknown>",        "UT-88 mini",    GAME_NO_SOUND)
243COMP( 1989, ut88,      ut88mini,0,      ut88,      ut88,      ut88,      "<unknown>",        "UT-88",       0)
242COMP( 1989, ut88mini,  0,      0,      ut88mini,   ut88mini,   ut88mini,   "<unknown>",       "UT-88 mini",    GAME_NO_SOUND)
243COMP( 1989, ut88,      ut88mini,0,      ut88,      ut88,      ut88,      "<unknown>",       "UT-88",       0)
src/mess/drivers/svision.c
r8044r8045
461461   UINT32 size;
462462   UINT8 *temp_copy;
463463   int mirror, i;
464   
464
465465   if (image_software_entry(image) == NULL)
466466   {
467467      size = image_length(image);
r8044r8045
473473         auto_free(image->machine, temp_copy);
474474         return INIT_FAIL;
475475      }
476     
476
477477      if (image_fread(image, temp_copy, size) != size)
478478      {
479479         image_seterror(image, IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file");
src/mess/drivers/c64.c
r8044r8045
903903   ROMX_LOAD( "jiffydos sx64.ud3", 0x12000, 0x2000, CRC(2b5a88f5) SHA1(942c2150123dc30f40b3df6086132ef0a3c43948), ROM_BIOS(2) )
904904   ROM_SYSTEM_BIOS(2, "1541flash", "1541 FLASH!" )
905905   ROMX_LOAD( "1541 flash.ud3", 0x12000, 0x2000, CRC(0a1c9b85) SHA1(0bfcaab0ae453b663a6e01cd59a9764805419e00), ROM_BIOS(3) )
906   
906
907907   ROM_LOAD( "901225-01.ud1", 0x14000, 0x1000, CRC(ec4272ee) SHA1(adc7c31e18c7c7413d54802ef2f4193da14711aa) )
908908
909909   ROM_REGION( 0x80000, "cart", ROMREGION_ERASE00 )
src/mess/drivers/genesis.c
r8044r8045
450450
451451ROM_START( 32x )
452452   ROM_REGION16_BE( 0x400000, "gamecart", ROMREGION_ERASE00 ) /* 68000 Code */
453//   ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR)
453//  ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR)
454454
455455   ROM_REGION32_BE( 0x400000, "gamecart_sh2", ROMREGION_ERASE00 ) /* Copy for the SH2 */
456//   ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR)
456//  ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR)
457457
458458   ROM_REGION16_BE( 0x400000, "32x_68k_bios", 0 ) /* 68000 Code */
459459   ROM_LOAD( "32x_g_bios.bin", 0x000000,  0x000100, CRC(5c12eae8) SHA1(dbebd76a448447cb6e524ac3cb0fd19fc065d944) )
460460
461461   ROM_REGION16_BE( 0x400000, "maincpu", ROMREGION_ERASE00 )
462462   // temp, rom should only be visible here when one of the regs is set, tempo needs it
463//   ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR)
463//  ROM_CART_LOAD("cart", 0x000000, 0x400000, ROM_NOMIRROR)
464464   ROM_COPY( "32x_68k_bios", 0x0, 0x0, 0x100)
465465
466466   ROM_REGION( 0x400000, "32x_master_sh2", 0 ) /* SH2 Code */
src/mess/drivers/swtpc.c
r8044r8045
44
55        10/12/2009 Skeleton driver.
66
7      http://www.swtpc.com/mholley/swtpc_6800.htm
7        http://www.swtpc.com/mholley/swtpc_6800.htm
88
99****************************************************************************/
1010
src/mess/drivers/ti99_4p.c
r8044r8045
115115      PORT_CONFSETTING(    0x01, "TI SD Floppy Controller" )
116116      PORT_CONFSETTING(    0x02, "SNUG BwG Controller" )
117117      PORT_CONFSETTING(    0x03, "Myarc HFDC" )
118//      PORT_CONFSETTING(    0x04, "Corcomp" )
118//      PORT_CONFSETTING(    0x04, "Corcomp" )
119119
120120   PORT_START( "HDCTRL" )
121121   PORT_CONFNAME( 0x03, 0x00, "HD controller" )
122122      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
123123      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
124//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
124//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
125125   PORT_CONFNAME( 0x08, 0x00, "USB-SM card" )
126126      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
127127      PORT_CONFSETTING(    0x08, DEF_STR( On ) )
r8044r8045
130130   PORT_CONFNAME( 0x03, 0x00, "Serial/Parallel interface" )
131131      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
132132      PORT_CONFSETTING(    0x01, "TI RS-232 card" )
133   
133
134134   PORT_START( "EXTCARD" )
135135   PORT_CONFNAME( 0x02, 0x00, "P-Code card" )
136136      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
r8044r8045
146146      PORT_DIPSETTING( 0x00, "40 track, 16 ms")
147147      PORT_DIPSETTING( 0xaa, "40 track, 8 ms")
148148      PORT_DIPSETTING( 0x55, "80 track, 2 ms")
149      PORT_DIPSETTING( 0xff, "80 track HD, 2 ms")     
149      PORT_DIPSETTING( 0xff, "80 track HD, 2 ms")
150150
151151   PORT_START( "DRVSPD" )
152152   PORT_DIPNAME( 0x01, 0x01, "Floppy and HD speed" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 )
src/mess/drivers/pc.c
r8044r8045
25622562
25632563   /* europc */
25642564   ROM_LOAD("50145", 0xf8000, 0x8000, CRC(1775a11d)) // V2.07
2565//   ROM_LOAD("eurobios.bin", 0xf8000, 0x8000, CRC(52185223)) scrap
2565//  ROM_LOAD("eurobios.bin", 0xf8000, 0x8000, CRC(52185223)) scrap
25662566   /* cga, hercules character set */
25672567   ROM_LOAD("50146", 0x00000, 0x02000, CRC(1305dcf5)) //D1.0
25682568
r8044r8045
29382938           and trace-marked "|||CIM0286 ECA2466 // 94V-O" on the back.
29392939    */
29402940//  ROM_REGION(0x4000,"gfx2", 0)
2941//     ROM_LOAD("1504161.u11", 0x00000, 0x2000, CRC(d9246cf5) SHA1(2eaed495893a4e6649b04d10dada7b5ef4abd140)) /* silkscreen: "AMI 8613MAJ // 9591-041 // S2364B // 1504161 // PHILIPPINES" - Purpose: Pixels 0 thru 7 of built-in 3270 terminal font*/
2942//     ROM_LOAD("1504162.u26", 0x02000, 0x2000, CRC(59e1dc32) SHA1(337b5cced203345a5acfb02532d6b5f526902ee7)) /* silkscreen: "AMI 8607MAH // 9591-042 // S2364B // 1504162 // PHILIPPINES" - Purpose: Pixel 8 of built-in 3270 terminal font*/
2941//      ROM_LOAD("1504161.u11", 0x00000, 0x2000, CRC(d9246cf5) SHA1(2eaed495893a4e6649b04d10dada7b5ef4abd140)) /* silkscreen: "AMI 8613MAJ // 9591-041 // S2364B // 1504161 // PHILIPPINES" - Purpose: Pixels 0 thru 7 of built-in 3270 terminal font*/
2942//      ROM_LOAD("1504162.u26", 0x02000, 0x2000, CRC(59e1dc32) SHA1(337b5cced203345a5acfb02532d6b5f526902ee7)) /* silkscreen: "AMI 8607MAH // 9591-042 // S2364B // 1504162 // PHILIPPINES" - Purpose: Pixel 8 of built-in 3270 terminal font*/
29432943ROM_END
29442944
29452945
r8044r8045
29682968            V1.2:5EA8       V1.2:A058
29692969*/
29702970ROM_START( pc200 )
2971//   ROM_REGION(0x100000,"maincpu", 0)
2971//  ROM_REGION(0x100000,"maincpu", 0)
29722972   ROM_REGION16_LE(0x100000,"maincpu", 0)
29732973   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
29742974   // special bios at 0xe0000 !?
r8044r8045
29852985
29862986
29872987ROM_START( pc20 )
2988//   ROM_REGION(0x100000,"maincpu", 0)
2988//  ROM_REGION(0x100000,"maincpu", 0)
29892989   ROM_REGION16_LE(0x100000,"maincpu", 0)
29902990   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
29912991
r8044r8045
30023002
30033003
30043004ROM_START( ppc512 )
3005//   ROM_REGION(0x100000,"maincpu", 0)
3005//  ROM_REGION(0x100000,"maincpu", 0)
30063006   ROM_REGION16_LE(0x100000,"maincpu", 0)
30073007   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
30083008   // special bios at 0xe0000 !?
r8044r8045
30153015
30163016
30173017ROM_START( ppc640 )
3018//   ROM_REGION(0x100000,"maincpu", 0)
3018//  ROM_REGION(0x100000,"maincpu", 0)
30193019   ROM_REGION16_LE(0x100000,"maincpu", 0)
30203020   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
30213021   // special bios at 0xe0000 !?
r8044r8045
30283028
30293029
30303030ROM_START( pc1512 )
3031//   ROM_REGION(0x100000,"maincpu", 0)
3031//  ROM_REGION(0x100000,"maincpu", 0)
30323032   ROM_REGION16_LE(0x100000,"maincpu", 0)
30333033   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
30343034   ROM_LOAD16_BYTE("40044.v1", 0xfc001, 0x2000, CRC(668fcc94) SHA1(74002f5cc542df442eec9e2e7a18db3598d8c482)) // v1
r8044r8045
30393039
30403040
30413041ROM_START( pc1512v2 )
3042//   ROM_REGION(0x100000,"maincpu", 0)
3042//  ROM_REGION(0x100000,"maincpu", 0)
30433043   ROM_REGION16_LE(0x100000,"maincpu", 0)
30443044   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
30453045   ROM_LOAD16_BYTE("40043.v2", 0xfc001, 0x2000, CRC(d2d4d2de) SHA1(c376fd1ad23025081ae16c7949e88eea7f56e1bb)) // v2
r8044r8045
30503050
30513051
30523052ROM_START( pc1640 )
3053//   ROM_REGION(0x100000,"maincpu", 0)
3053//  ROM_REGION(0x100000,"maincpu", 0)
30543054   ROM_REGION16_LE(0x100000,"maincpu", 0)
30553055   ROM_LOAD("40100", 0xc0000, 0x8000, CRC(d2d1f1ae) SHA1(98302006ee38a17c09bd75504cc18c0649174e33)) /* Internal Graphics Adapter ROM */
30563056   ROM_LOAD("wdbios.rom",  0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) /* WDC IDE Superbios 2.0 (06/28/89) Expansion Rom C8000-C9FFF  */
src/mess/drivers/ti99_4x.c
r8044r8045
127127      PORT_CONFSETTING(    0x01, "TI SD Floppy Controller" )
128128      PORT_CONFSETTING(    0x02, "SNUG BwG Controller" )
129129      PORT_CONFSETTING(    0x03, "Myarc HFDC" )
130//      PORT_CONFSETTING(    0x04, "Corcomp" )
130//      PORT_CONFSETTING(    0x04, "Corcomp" )
131131
132132   PORT_START( "HDCTRL" )
133133   PORT_CONFNAME( 0x03, 0x00, "HD controller" )
134134      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
135135      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
136//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
136//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
137137   PORT_CONFNAME( 0x04, 0x00, "USB-SM card" )
138138      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
139139      PORT_CONFSETTING(    0x04, DEF_STR( On ) )
r8044r8045
142142   PORT_CONFNAME( 0x03, 0x00, "Serial/Parallel interface" )
143143      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
144144      PORT_CONFSETTING(    0x01, "TI RS-232 card" )
145   
145
146146   PORT_START( "EXTCARD" )
147147   PORT_CONFNAME( 0x01, 0x00, "HSGPL extension" )
148148      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
r8044r8045
155155   PORT_CONFNAME( 0x01, 0x00, "Mouse support" )
156156      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
157157      PORT_CONFSETTING(    0x01, "Mechatronics Mouse" )
158     
158
159159   PORT_START( "CARTSLOT" )
160160   PORT_CONFNAME( 0x07, 0x00, "Cartridge slot" )
161161      PORT_CONFSETTING(    0x00, "Auto" )
r8044r8045
163163      PORT_CONFSETTING(    0x02, "Slot 2" )
164164      PORT_CONFSETTING(    0x03, "Slot 3" )
165165      PORT_CONFSETTING(    0x04, "Slot 4" )
166//      PORT_CONFSETTING(    0x05, "GRAM Kracker" )
166//      PORT_CONFSETTING(    0x05, "GRAM Kracker" )
167167
168168   PORT_START( "HFDCDIP" )
169169   PORT_DIPNAME( 0xff, 0x55, "HFDC drive config" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 )
170170      PORT_DIPSETTING( 0x00, "40 track, 16 ms")
171171      PORT_DIPSETTING( 0xaa, "40 track, 8 ms")
172172      PORT_DIPSETTING( 0x55, "80 track, 2 ms")
173      PORT_DIPSETTING( 0xff, "80 track HD, 2 ms")     
173      PORT_DIPSETTING( 0xff, "80 track HD, 2 ms")
174174
175175   PORT_START( "DRVSPD" )
176176   PORT_DIPNAME( 0x01, 0x01, "Floppy and HD speed" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 )
r8044r8045
300300      PORT_CONFSETTING(    0x01, "TI SD Floppy Controller" )
301301      PORT_CONFSETTING(    0x02, "SNUG BwG Controller" )
302302      PORT_CONFSETTING(    0x03, "Myarc HFDC" )
303//      PORT_CONFSETTING(    0x04, "Corcomp" )
303//      PORT_CONFSETTING(    0x04, "Corcomp" )
304304
305305   PORT_START( "HDCTRL" )
306306   PORT_CONFNAME( 0x03, 0x00, "HD controller" )
307307      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
308308      PORT_CONFSETTING(    0x01, "Nouspikel IDE Controller" )
309//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
309//      PORT_CONFSETTING(    0x02, "WHTech SCSI Controller" )
310310   PORT_CONFNAME( 0x08, 0x00, "USB-SM card" )
311311      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
312312      PORT_CONFSETTING(    0x08, DEF_STR( On ) )
r8044r8045
315315   PORT_CONFNAME( 0x03, 0x00, "Serial/Parallel interface" )
316316      PORT_CONFSETTING(    0x00, DEF_STR( None ) )
317317      PORT_CONFSETTING(    0x01, "TI RS-232 card" )
318   
318
319319   PORT_START( "EXTCARD" )
320320   PORT_CONFNAME( 0x01, 0x00, "HSGPL extension" )
321321      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
r8044r8045
330330      PORT_CONFSETTING(    0x01, "Mechatronics Mouse" )
331331   PORT_CONFNAME( 0x04, 0x00, "IR Handset" )
332332      PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
333      PORT_CONFSETTING(    0x04, DEF_STR( On ) )   
334     
333      PORT_CONFSETTING(    0x04, DEF_STR( On ) )
334
335335   PORT_START( "CARTSLOT" )
336336   PORT_CONFNAME( 0x07, 0x00, "Cartridge slot" )
337337      PORT_CONFSETTING(    0x00, "Auto" )
r8044r8045
339339      PORT_CONFSETTING(    0x02, "Slot 2" )
340340      PORT_CONFSETTING(    0x03, "Slot 3" )
341341      PORT_CONFSETTING(    0x04, "Slot 4" )
342//      PORT_CONFSETTING(    0x05, "GRAM Kracker" )
342//      PORT_CONFSETTING(    0x05, "GRAM Kracker" )
343343
344344   PORT_START( "HFDCDIP" )
345345   PORT_DIPNAME( 0xff, 0x55, "HFDC drive config" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 )
346346      PORT_DIPSETTING( 0x00, "40 track, 16 ms")
347347      PORT_DIPSETTING( 0xaa, "40 track, 8 ms")
348348      PORT_DIPSETTING( 0x55, "80 track, 2 ms")
349      PORT_DIPSETTING( 0xff, "80 track HD, 2 ms")     
349      PORT_DIPSETTING( 0xff, "80 track HD, 2 ms")
350350
351351   PORT_START( "DRVSPD" )
352352   PORT_DIPNAME( 0x01, 0x01, "Floppy and HD speed" ) PORT_CONDITION( "DISKCTRL", 0x07, PORTCOND_EQUALS, 0x03 )
353353      PORT_DIPSETTING( 0x00, "No delay")
354354      PORT_DIPSETTING( 0x01, "Realistic")
355     
355
356356   /* 3 ports for mouse */
357357   PORT_START("MOUSEX") /* Mouse - X AXIS */
358358      PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
r8044r8045
719719
720720   MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config)
721721   MDRV_MFMHD_3_DRIVES_ADD()
722   
722
723723   MDRV_TI99_CARTRIDGE_ADD("ti99_multicart")
724724
725725   MDRV_SMARTMEDIA_ADD("smartmedia")
r8044r8045
888888
889889   MDRV_SMARTMEDIA_ADD("smartmedia")
890890
891   MDRV_TI99_4_RS232_CARD_ADD("rs232")   
891   MDRV_TI99_4_RS232_CARD_ADD("rs232")
892892MACHINE_DRIVER_END
893893
894894
r8044r8045
943943   /* to be moved to controller */
944944   MDRV_WD179X_ADD("wd179x", ti99_wd17xx_interface )
945945   MDRV_SMC92X4_ADD("smc92x4", ti99_smc92x4_interface )
946   
946
947947   MDRV_FLOPPY_4_DRIVES_ADD(ti99_4_floppy_config)
948948   MDRV_MFMHD_3_DRIVES_ADD()
949949
src/mess/drivers/pk8020.c
r8044r8045
284284/* Driver */
285285
286286/*    YEAR  NAME    PARENT  COMPAT  MACHINE     INPUT       INIT     COMPANY                  FULLNAME   FLAGS */
287COMP( 1987, korvet,  0,     0,   pk8020,    pk8020,    0,       "<unknown>", "PK8020 Korvet",    0)
287COMP( 1987, korvet,  0,     0,   pk8020,    pk8020,    0,       "<unknown>", "PK8020 Korvet",    0)
288288COMP( 1987, neiva,   korvet,    0,   pk8020,    pk8020,    0,       "<unknown>", "PK8020 Neiva",    0)
289289COMP( 1987, kontur,  korvet,    0,   pk8020,    pk8020,    0,       "<unknown>", "PK8020 Kontur",    0)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team