Previous 15994 Revisions Next

r4911 Tuesday 2nd June, 2009 at 02:30:02 UTC by MooglyGuy
Added driver for Manchester Small-Scale Experimental Machine, "Baby", the first digital stored-program computer (1948). Currently runs all known SSEM programs. [MooglyGuy]
[src/emu/cpu]cpu.mak
[src/emu/cpu/ssem]ssem.c* ssem.h* ssemdasm.c*
[src/mess]image.c image.h mess.mak messdriv.c
[src/mess/drivers]ssem.c*

src/emu/cpu/cpu.mak
r4910r4911
719719
720720
721721#-------------------------------------------------
722# Manchester Small-Scale Experimental Machine
723#-------------------------------------------------
724
725ifneq ($(filter SSEM,$(CPUS)),)
726OBJDIRS += $(CPUOBJ)/ssem
727CPUOBJS += $(CPUOBJ)/ssem/ssem.o
728DBGOBJS += $(CPUOBJ)/ssem/ssemdasm.o
729endif
730
731$(CPUOBJ)/ssem/ssem.o:   $(CPUSRC)/ssem/ssem.c \
732         $(CPUSRC)/ssem/ssem.h
733
734
735
736#-------------------------------------------------
722737# Microchip PIC16C5x
723738#-------------------------------------------------
724739
src/emu/cpu/ssem/ssem.c
r0r4911
1/*
2    Manchester Small-Scale Experimental Machine (SSEM) emulator
3
4    Written by MooglyGuy
5*/
6
7#include "cpuintrf.h"
8#include "debugger.h"
9#include "ssem.h"
10
11#define SSEM_DISASM_ON_UNIMPL           0
12#define SSEM_DUMP_MEM_ON_UNIMPL         0
13
14typedef struct _ssem_state ssem_state;
15struct _ssem_state
16{
17    UINT32 pc;
18    UINT32 a;
19    UINT32 halt;
20
21    const device_config *device;
22    const address_space *program;
23    int icount;
24};
25
26INLINE ssem_state *get_safe_token(const device_config *device)
27{
28    assert(device != NULL);
29    assert(device->token != NULL);
30    assert(device->type == CPU);
31    assert(cpu_get_type(device) == CPU_SSEM);
32    return (ssem_state *)device->token;
33}
34
35#define INSTR       ((op >> 13) & 7)
36#define ADDR        (op & 0x1f)
37
38/*****************************************************************************/
39
40// The SSEM stores its data, visually, with the leftmost bit corresponding to the least significant bit.
41// The de facto snapshot format for other SSEM simulators stores the data physically in that format as well.
42// Therefore, in MESS, every 32-bit word has its bits reversed, too, and as a result the values must be
43// un-reversed before being used.
44INLINE UINT32 reverse(UINT32 v)
45{
46    // Taken from http://www-graphics.stanford.edu/~seander/bithacks.html#ReverseParallel
47    // swap odd and even bits
48    v = ((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1);
49    // swap consecutive pairs
50    v = ((v >> 2) & 0x33333333) | ((v & 0x33333333) << 2);
51    // swap nibbles ...
52    v = ((v >> 4) & 0x0F0F0F0F) | ((v & 0x0F0F0F0F) << 4);
53    // swap bytes
54    v = ((v >> 8) & 0x00FF00FF) | ((v & 0x00FF00FF) << 8);
55    // swap 2-byte long pairs
56    v = ( v >> 16             ) | ( v               << 16);
57
58    return v;
59}
60
61static void unimplemented_opcode(ssem_state *cpustate, UINT32 op)
62{
63    if((cpustate->device->machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
64    {
65        char string[200];
66        ssem_dasm_one(string, cpustate->pc-1, op);
67        mame_printf_debug("%08X: %s\n", cpustate->pc-1, string);
68    }
69
70#if SSEM_DISASM_ON_UNIMPL
71    {
72        char string[200] = { 0 };
73        UINT32 i = 0;
74        FILE *disasm = fopen("ssemdasm.txt", "wt");
75
76        if(disasm)
77        {
78            for(i = 0; i < 0x20; i++)
79            {
80                UINT32 opcode = reverse(READ32(i));
81                ssem_dasm_one(string, i, opcode);
82                fprintf(dasm, "%02X: %08X    %s\n", i, opcode, string);
83            }
84
85            fclose(dasm);
86        }
87    }
88#endif
89#if SSEM_DUMP_MEM_ON_UNIMPL
90    {
91        UINT32 i = 0;
92        FILE *store = fopen("ssemmem.bin", "wb");
93
94        if(store)
95        {
96            for( i = 0; i < 0x80; i++ )
97            {
98                fputc(memory_read_byte_32be(cpustate->program, i), store);
99            }
100            fclose(store);
101        }
102    }
103#endif
104
105    fatalerror("SSEM: unknown opcode %d (%08X) at %d\n", reverse(op) & 7, reverse(op), cpustate->pc);
106}
107
108/*****************************************************************************/
109
110INLINE UINT32 READ32(ssem_state *cpustate, UINT32 address)
111{
112    UINT32 v = 0;
113    // The MAME core does not have a good way of specifying a minimum datum size that is more than
114    // 8 bits in width.  The minimum datum width on the SSEM is 32 bits, so we need to quadruple
115    // the address value to get the appropriate byte index.
116    address <<= 2;
117
118    v |= memory_read_byte(cpustate->program, address + 0) << 24;
119    v |= memory_read_byte(cpustate->program, address + 1) << 16;
120    v |= memory_read_byte(cpustate->program, address + 2) <<  8;
121    v |= memory_read_byte(cpustate->program, address + 3) <<  0;
122
123    return reverse(v);
124}
125
126INLINE void WRITE32(ssem_state *cpustate, UINT32 address, UINT32 data)
127{
128    UINT32 v = reverse(data);
129
130    // The MAME core does not have a good way of specifying a minimum datum size that is more than
131    // 8 bits in width.  The minimum datum width on the SSEM is 32 bits, so we need to quadruple
132    // the address value to get the appropriate byte index.
133    address <<= 2;
134
135    memory_write_byte(cpustate->program, address + 0, (v >> 24) & 0x000000ff);
136    memory_write_byte(cpustate->program, address + 1, (v >> 16) & 0x000000ff);
137    memory_write_byte(cpustate->program, address + 2, (v >>  8) & 0x000000ff);
138    memory_write_byte(cpustate->program, address + 3, (v >>  0) & 0x000000ff);
139    return;
140}
141
142/*****************************************************************************/
143
144static CPU_INIT( ssem )
145{
146    ssem_state *cpustate = get_safe_token(device);
147    cpustate->pc = 1;
148    cpustate->a = 0;
149    cpustate->halt = 0;
150
151    cpustate->device = device;
152    cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
153}
154
155static CPU_EXIT( ssem )
156{
157}
158
159static CPU_RESET( ssem )
160{
161    ssem_state *cpustate = get_safe_token(device);
162
163    cpustate->pc = 1;
164    cpustate->a = 0;
165    cpustate->halt = 0;
166}
167
168static CPU_EXECUTE( ssem )
169{
170    ssem_state *cpustate = get_safe_token(device);
171    UINT32 op;
172
173    cpustate->icount = cycles;
174
175    cpustate->pc &= 0x1f;
176
177    while (cpustate->icount > 0)
178    {
179        debugger_instruction_hook(device, cpustate->pc);
180
181        op = READ32(cpustate, cpustate->pc);
182
183        if( !cpustate->halt )
184        {
185            cpustate->pc++;
186        }
187        else
188        {
189            op = 7;
190        }
191
192        switch (INSTR)
193        {
194            case 0:
195                // JMP: Move the value at the specified address into the Program Counter.
196                cpustate->pc = READ32(cpustate, ADDR) + 1;
197                break;
198            case 1:
199                // JRP: Add the value at the specified address to the Program Counter.
200                cpustate->pc += (INT32)READ32(cpustate, ADDR);
201                break;
202            case 2:
203                // LDN: Load the accumulator with the two's-complement negation of the value at the specified address.
204                cpustate->a = (UINT32)(0 - (INT32)READ32(cpustate, ADDR));
205                break;
206            case 3:
207                // STO: Store the value in the accumulator at the specified address.
208                WRITE32(cpustate, ADDR, cpustate->a);
209                break;
210            case 4:
211            case 5:
212                // SUB: Subtract the value at the specified address from the accumulator.
213                cpustate->a -= READ32(cpustate, ADDR);
214                break;
215            case 6:
216                // CMP: If the accumulator is less than zero, skip the next opcode.
217                if((INT32)(cpustate->a) < 0)
218                {
219                    cpustate->pc++;
220                }
221                break;
222            case 7:
223                // STP: Halt the computer.
224                cpustate->halt = 1;
225                break;
226            default:
227                // This is impossible, but it's better to be safe than sorry.
228                unimplemented_opcode(cpustate, op);
229        }
230
231        --cpustate->icount;
232    }
233
234    return cycles - cpustate->icount;
235}
236
237/*****************************************************************************/
238
239static CPU_DISASSEMBLE( ssem )
240{
241    UINT32 op = (*(UINT8 *)(opram + 0) << 24) |
242                (*(UINT8 *)(opram + 1) << 16) |
243                (*(UINT8 *)(opram + 2) <<  8) |
244                (*(UINT8 *)(opram + 3) <<  0);
245    return ssem_dasm_one(buffer, pc, op);
246}
247
248/*****************************************************************************/
249
250static CPU_SET_INFO( ssem )
251{
252    ssem_state *cpustate = get_safe_token(device);
253
254    switch (state)
255    {
256        /* --- the following bits of info are set as 64-bit signed integers --- */
257        case CPUINFO_INT_PC:
258        case CPUINFO_INT_REGISTER + SSEM_PC:            cpustate->pc = info->i;         break;
259        case CPUINFO_INT_REGISTER + SSEM_A:             cpustate->a = info->i;          break;
260        case CPUINFO_INT_REGISTER + SSEM_HALT:          cpustate->halt = info->i;       break;
261    }
262}
263
264CPU_GET_INFO( ssem )
265{
266    ssem_state *cpustate = (device != NULL && device->token != NULL) ? get_safe_token(device) : NULL;
267
268    switch(state)
269    {
270        /* --- the following bits of info are returned as 64-bit signed integers --- */
271        case CPUINFO_INT_CONTEXT_SIZE:          info->i = sizeof(ssem_state);   break;
272        case CPUINFO_INT_INPUT_LINES:           info->i = 0;                    break;
273        case CPUINFO_INT_DEFAULT_IRQ_VECTOR:    info->i = 0;                    break;
274        case CPUINFO_INT_ENDIANNESS:            info->i = ENDIANNESS_LITTLE;    break;
275        case CPUINFO_INT_CLOCK_MULTIPLIER:      info->i = 1;                    break;
276        case CPUINFO_INT_CLOCK_DIVIDER:         info->i = 1;                    break;
277        case CPUINFO_INT_MIN_INSTRUCTION_BYTES: info->i = 4;                    break;
278        case CPUINFO_INT_MAX_INSTRUCTION_BYTES: info->i = 4;                    break;
279        case CPUINFO_INT_MIN_CYCLES:            info->i = 1;                    break;
280        case CPUINFO_INT_MAX_CYCLES:            info->i = 1;                    break;
281
282        case CPUINFO_INT_DATABUS_WIDTH_PROGRAM: info->i = 8;                    break;
283        case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;                   break;
284        case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;                    break;
285        case CPUINFO_INT_DATABUS_WIDTH_DATA:    info->i = 0;                    break;
286        case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;                    break;
287        case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;                    break;
288        case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;                    break;
289        case CPUINFO_INT_ADDRBUS_WIDTH_IO:      info->i = 0;                    break;
290        case CPUINFO_INT_ADDRBUS_SHIFT_IO:      info->i = 0;                    break;
291
292        case CPUINFO_INT_PC:    /* intentional fallthrough */
293        case CPUINFO_INT_REGISTER + SSEM_PC:    info->i = cpustate->pc << 2;    break;
294        case CPUINFO_INT_REGISTER + SSEM_A:     info->i = cpustate->a;          break;
295        case CPUINFO_INT_REGISTER + SSEM_HALT:  info->i = cpustate->halt;       break;
296
297        /* --- the following bits of info are returned as pointers to data or functions --- */
298        case CPUINFO_FCT_SET_INFO:              info->setinfo = CPU_SET_INFO_NAME(ssem);        break;
299        case CPUINFO_FCT_INIT:                  info->init = CPU_INIT_NAME(ssem);               break;
300        case CPUINFO_FCT_RESET:                 info->reset = CPU_RESET_NAME(ssem);             break;
301        case CPUINFO_FCT_EXIT:                  info->exit = CPU_EXIT_NAME(ssem);               break;
302        case CPUINFO_FCT_EXECUTE:               info->execute = CPU_EXECUTE_NAME(ssem);         break;
303        case CPUINFO_FCT_BURN:                  info->burn = NULL;                              break;
304        case CPUINFO_FCT_DISASSEMBLE:           info->disassemble = CPU_DISASSEMBLE_NAME(ssem); break;
305        case CPUINFO_PTR_INSTRUCTION_COUNTER:   info->icount = &cpustate->icount;               break;
306
307        /* --- the following bits of info are returned as NULL-terminated strings --- */
308        case CPUINFO_STR_NAME:                          strcpy(info->s, "SSEM");                break;
309        case CPUINFO_STR_CORE_FAMILY:                   strcpy(info->s, "SSEM");                break;
310        case CPUINFO_STR_CORE_VERSION:                  strcpy(info->s, "1.0");                 break;
311        case CPUINFO_STR_CORE_FILE:                     strcpy(info->s, __FILE__);              break;
312        case CPUINFO_STR_CORE_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
313
314        case CPUINFO_STR_FLAGS:                         strcpy(info->s, " ");                   break;
315
316        case CPUINFO_STR_REGISTER + SSEM_PC:            sprintf(info->s, "PC: %08X", cpustate->pc);     break;
317        case CPUINFO_STR_REGISTER + SSEM_A:             sprintf(info->s, "A: %08X", cpustate->a);       break;
318        case CPUINFO_STR_REGISTER + SSEM_HALT:          sprintf(info->s, "HALT: %d", cpustate->halt);   break;
319    }
320}
src/emu/cpu/ssem/ssem.h
r0r4911
1#pragma once
2
3#ifndef __SSEM_H__
4#define __SSEM_H__
5
6enum
7{
8    SSEM_PC = 1,
9    SSEM_A,
10    SSEM_HALT,
11};
12
13CPU_GET_INFO( ssem );
14#define CPU_SSEM CPU_GET_INFO_NAME( ssem )
15
16extern offs_t ssem_dasm_one(char *buffer, offs_t pc, UINT32 op);
17
18#endif /* __SSEM_H__ */
src/emu/cpu/ssem/ssemdasm.c
r0r4911
1/*
2    Manchester Small-Scale Experimental Machine (SSEM) disassembler
3
4    Written by MooglyGuy
5*/
6
7#include "cpuintrf.h"
8#include <stdarg.h>
9
10static char *output;
11
12static void ATTR_PRINTF(1,2) print(const char *fmt, ...)
13{
14    va_list vl;
15
16    va_start(vl, fmt);
17    output += vsprintf(output, fmt, vl);
18    va_end(vl);
19}
20
21INLINE UINT32 reverse(UINT32 v)
22{
23    // Taken from http://www-graphics.stanford.edu/~seander/bithacks.html#ReverseParallel
24    // swap odd and even bits
25    v = ((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1);
26    // swap consecutive pairs
27    v = ((v >> 2) & 0x33333333) | ((v & 0x33333333) << 2);
28    // swap nibbles ...
29    v = ((v >> 4) & 0x0F0F0F0F) | ((v & 0x0F0F0F0F) << 4);
30    // swap bytes
31    v = ((v >> 8) & 0x00FF00FF) | ((v & 0x00FF00FF) << 8);
32    // swap 2-byte long pairs
33    v = ( v >> 16             ) | ( v               << 16);
34
35    return v;
36}
37
38offs_t ssem_dasm_one(char *buffer, offs_t pc, UINT32 op)
39{
40    UINT8 instr = (reverse(op) >> 13) & 7;
41    UINT8 addr = reverse(op) & 0x1f;
42
43    output = buffer;
44
45    switch (instr)
46    {
47        case 0: // JMP S
48            print("JMP %d", addr);
49            break;
50        case 1: // JRP S
51            print("JRP %d", addr);
52            break;
53        case 2: // LDN S
54            print("LDN %d", addr);
55            break;
56        case 3: // STO S
57            print("STO %d", addr);
58            break;
59        case 4: // SUB S
60        case 5:
61            print("SUB %d", addr);
62            break;
63        case 6: // CMP
64            print("CMP");
65            break;
66        case 7: // STP
67            print("STP");
68            break;
69        default:
70            print("???");
71            break;
72    }
73
74    return 4 | DASMFLAG_SUPPORTED;
75}
src/mess/image.c
r4910r4911
11/****************************************************************************
22
3   image.c
3    image.c
44
5   Code for handling devices/software images
5    Code for handling devices/software images
66
7   The UI can call image_load and image_unload to associate and disassociate
8   with disk images on disk.  In fact, devices that unmount on their own (like
9   Mac floppy drives) may call this from within a driver.
7    The UI can call image_load and image_unload to associate and disassociate
8    with disk images on disk.  In fact, devices that unmount on their own (like
9    Mac floppy drives) may call this from within a driver.
1010
1111****************************************************************************/
1212
r4910r4911
3333typedef struct _image_slot_data image_slot_data;
3434struct _image_slot_data
3535{
36   /* variables that persist across image mounts */
37   object_pool *mempool;
38   const device_config *dev;
39   image_device_info info;
36    /* variables that persist across image mounts */
37    object_pool *mempool;
38    const device_config *dev;
39    image_device_info info;
4040
41   /* creation info */
42   const option_guide *create_option_guide;
43   image_device_format *formatlist;
41    /* creation info */
42    const option_guide *create_option_guide;
43    image_device_format *formatlist;
4444
45   /* callbacks */
46   device_image_load_func load;
47   device_image_create_func create;
48   device_image_unload_func unload;
49   device_image_verify_func verify;
45    /* callbacks */
46    device_image_load_func load;
47    device_image_create_func create;
48    device_image_unload_func unload;
49    device_image_verify_func verify;
5050
51   /* error related info */
52   image_error_t err;
53   char *err_message;
51    /* error related info */
52    image_error_t err;
53    char *err_message;
5454
55   /* variables that are only non-zero when an image is mounted */
56   core_file *file;
57   astring *name;
58   char *dir;
59   char *hash;
60   char *basename_noext;
55    /* variables that are only non-zero when an image is mounted */
56    core_file *file;
57    astring *name;
58    char *dir;
59    char *hash;
60    char *basename_noext;
6161
62   /* flags */
63   unsigned int writeable : 1;
64   unsigned int created : 1;
65   unsigned int is_loading : 1;
62    /* flags */
63    unsigned int writeable : 1;
64    unsigned int created : 1;
65    unsigned int is_loading : 1;
6666
67   /* info read from the hash file */
68   char *longname;
69   char *manufacturer;
70   char *year;
71   char *playable;
72   char *pcb;
73   char *extrainfo;
67    /* info read from the hash file */
68    char *longname;
69    char *manufacturer;
70    char *year;
71    char *playable;
72    char *pcb;
73    char *extrainfo;
7474
75   /* working directory; persists across mounts */
76   astring *working_directory;
75    /* working directory; persists across mounts */
76    astring *working_directory;
7777
78   /* special - used when creating */
79   int create_format;
80   option_resolution *create_args;
78    /* special - used when creating */
79    int create_format;
80    option_resolution *create_args;
8181
82   /* pointer */
83   void *ptr;
82    /* pointer */
83    void *ptr;
8484};
8585
8686
8787
8888struct _images_private
8989{
90   int slot_count;
91   image_slot_data slots[1];
90    int slot_count;
91    image_slot_data slots[1];
9292};
9393
9494
r4910r4911
110110
111111/*-------------------------------------------------
112112    device_get_info_int_offline - return an integer
113   state value from an allocated device; can be
114   called offline
113    state value from an allocated device; can be
114    called offline
115115-------------------------------------------------*/
116116
117117INLINE INT64 device_get_info_int_offline(const device_config *device, UINT32 state)
118118{
119   deviceinfo info;
119    deviceinfo info;
120120
121   assert(device != NULL);
122   assert(device->type != NULL);
123   assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
121    assert(device != NULL);
122    assert(device->type != NULL);
123    assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
124124
125   /* retrieve the value */
126   info.i = 0;
127   (*device->type)(device, state, &info);
128   return info.i;
125    /* retrieve the value */
126    info.i = 0;
127    (*device->type)(device, state, &info);
128    return info.i;
129129}
130130
131131
132132
133133/*-------------------------------------------------
134134    device_get_info_fct_offline - return an integer
135   state value from an allocated device; can be
136   called offline
135    state value from an allocated device; can be
136    called offline
137137-------------------------------------------------*/
138138
139139INLINE genf *device_get_info_fct_offline(const device_config *device, UINT32 state)
140140{
141   deviceinfo info;
141    deviceinfo info;
142142
143   assert(device != NULL);
144   assert(device->type != NULL);
145   assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
143    assert(device != NULL);
144    assert(device->type != NULL);
145    assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
146146
147   /* retrieve the value */
148   info.f = 0;
149   (*device->type)(device, state, &info);
150   return info.f;
147    /* retrieve the value */
148    info.f = 0;
149    (*device->type)(device, state, &info);
150    return info.f;
151151}
152152
153153
r4910r4911
162162
163163static void memory_error(const char *message)
164164{
165   fatalerror("%s", message);
165    fatalerror("%s", message);
166166}
167167
168168
r4910r4911
173173
174174void image_init(running_machine *machine)
175175{
176   int count, indx, format_count, i;
177   const device_config *dev;
178   size_t private_size;
179   image_slot_data *slot;
180   image_device_format **formatptr;
181   image_device_format *format;
176    int count, indx, format_count, i;
177    const device_config *dev;
178    size_t private_size;
179    image_slot_data *slot;
180    image_device_format **formatptr;
181    image_device_format *format;
182182
183   /* sanity checks */
184   assert(DEVINFO_FCT_IMAGE_FIRST > DEVINFO_FCT_FIRST);
185   assert(DEVINFO_FCT_IMAGE_LAST < DEVINFO_FCT_DEVICE_SPECIFIC);
183    /* sanity checks */
184    assert(DEVINFO_FCT_IMAGE_FIRST > DEVINFO_FCT_FIRST);
185    assert(DEVINFO_FCT_IMAGE_LAST < DEVINFO_FCT_DEVICE_SPECIFIC);
186186
187   /* first count all images, and identify multiply defined devices */
188   count = image_device_count(machine->config);
187    /* first count all images, and identify multiply defined devices */
188    count = image_device_count(machine->config);
189189
190   /* allocate the private structure */
191   private_size = sizeof(*machine->images_data) + ((count - 1)
192      * sizeof(machine->images_data->slots[0]));
193   machine->images_data = (images_private *) auto_alloc_array_clear(machine, char, private_size);
194   memset(machine->images_data, '\0', private_size);
190    /* allocate the private structure */
191    private_size = sizeof(*machine->images_data) + ((count - 1)
192        * sizeof(machine->images_data->slots[0]));
193    machine->images_data = (images_private *) auto_alloc_array_clear(machine, char, private_size);
194    memset(machine->images_data, '\0', private_size);
195195
196   /* some setup */
197   machine->images_data->slot_count = count;
196    /* some setup */
197    machine->images_data->slot_count = count;
198198
199   /* initialize the devices */
200   indx = 0;
201   for (dev = image_device_first(machine->config); dev != NULL; dev = image_device_next(dev))
202   {
203      slot = &machine->images_data->slots[indx];
199    /* initialize the devices */
200    indx = 0;
201    for (dev = image_device_first(machine->config); dev != NULL; dev = image_device_next(dev))
202    {
203        slot = &machine->images_data->slots[indx];
204204
205      /* create a memory pool, and allocated strings */
206      slot->mempool = pool_alloc(memory_error);
207      slot->name = astring_alloc();
208      slot->working_directory = astring_alloc();
205        /* create a memory pool, and allocated strings */
206        slot->mempool = pool_alloc(memory_error);
207        slot->name = astring_alloc();
208        slot->working_directory = astring_alloc();
209209
210      /* clear error message */
211      slot->err_message = NULL;
210        /* clear error message */
211        slot->err_message = NULL;
212212
213      /* setup the device */
214      slot->dev = dev;
215      slot->info = image_device_getinfo(machine->config, dev);
213        /* setup the device */
214        slot->dev = dev;
215        slot->info = image_device_getinfo(machine->config, dev);
216216
217      /* callbacks */
218      slot->load = (device_image_load_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_LOAD);
219      slot->create = (device_image_create_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_CREATE);
220      slot->unload = (device_image_unload_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_UNLOAD);
221      slot->verify = (device_image_verify_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_VERIFY);
217        /* callbacks */
218        slot->load = (device_image_load_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_LOAD);
219        slot->create = (device_image_create_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_CREATE);
220        slot->unload = (device_image_unload_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_UNLOAD);
221        slot->verify = (device_image_verify_func) device_get_info_fct(slot->dev, DEVINFO_FCT_IMAGE_VERIFY);
222222
223      /* creation option guide */
224      slot->create_option_guide = (const option_guide *) device_get_info_ptr(slot->dev, DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE);
223        /* creation option guide */
224        slot->create_option_guide = (const option_guide *) device_get_info_ptr(slot->dev, DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE);
225225
226      /* creation formats */
227      format_count = device_get_info_int(slot->dev, DEVINFO_INT_IMAGE_CREATE_OPTCOUNT);
228      formatptr = &slot->formatlist;
229      for (i = 0; i < format_count; i++)
230      {
231         /* allocate a new format */
232         format = auto_alloc_clear(machine, image_device_format);
226        /* creation formats */
227        format_count = device_get_info_int(slot->dev, DEVINFO_INT_IMAGE_CREATE_OPTCOUNT);
228        formatptr = &slot->formatlist;
229        for (i = 0; i < format_count; i++)
230        {
231            /* allocate a new format */
232            format = auto_alloc_clear(machine, image_device_format);
233233
234         /* populate it */
235         format->index      = i;
236         format->name      = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTNAME + i));
237         format->description   = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTDESC + i));
238         format->extensions   = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i));
239         format->optspec      = device_get_info_ptr(slot->dev, DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i);
234            /* populate it */
235            format->index       = i;
236            format->name        = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTNAME + i));
237            format->description = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTDESC + i));
238            format->extensions  = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i));
239            format->optspec     = device_get_info_ptr(slot->dev, DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i);
240240
241         /* and append it to the list */
242         *formatptr = format;
243         formatptr = &format->next;
244      }
241            /* and append it to the list */
242            *formatptr = format;
243            formatptr = &format->next;
244        }
245245
246      indx++;
247   }
246        indx++;
247    }
248248}
249249
250250
251251
252252/*-------------------------------------------------
253253    image_unload_all - unload all images and
254   extract options
254    extract options
255255-------------------------------------------------*/
256256
257257void image_unload_all(running_machine *machine)
258258{
259   int i;
260   image_slot_data *slot;
259    int i;
260    image_slot_data *slot;
261261
262   if (machine->images_data != NULL)
263   {
264      /* extract the options */
265      mess_options_extract(machine);
262    if (machine->images_data != NULL)
263    {
264        /* extract the options */
265        mess_options_extract(machine);
266266
267      for (i = 0; i < machine->images_data->slot_count; i++)
268      {
269         /* identify the image slot */
270         slot = &machine->images_data->slots[i];
267        for (i = 0; i < machine->images_data->slot_count; i++)
268        {
269            /* identify the image slot */
270            slot = &machine->images_data->slots[i];
271271
272         /* unload this image */
273         image_unload_internal(slot);
272            /* unload this image */
273            image_unload_internal(slot);
274274
275         /* free the memory pool */
276         pool_free(slot->mempool);
277         slot->mempool = NULL;
275            /* free the memory pool */
276            pool_free(slot->mempool);
277            slot->mempool = NULL;
278278
279         /* free the allocated strings */
280         astring_free(slot->name);
281         astring_free(slot->working_directory);
282         slot->name = NULL;
283         slot->working_directory = NULL;
284      }
279            /* free the allocated strings */
280            astring_free(slot->name);
281            astring_free(slot->working_directory);
282            slot->name = NULL;
283            slot->working_directory = NULL;
284        }
285285
286      machine->images_data = NULL;
287   }
286        machine->images_data = NULL;
287    }
288288}
289289
290290
r4910r4911
295295
296296/*-------------------------------------------------
297297    is_image_device - determines if a particular
298   device supports images or not
298    device supports images or not
299299-------------------------------------------------*/
300300
301301static int is_image_device(const device_config *device)
302302{
303   return (device->type == MESS_DEVICE)
304      || (device_get_info_int_offline(device, DEVINFO_INT_IMAGE_READABLE) != 0)
305      || (device_get_info_int_offline(device, DEVINFO_INT_IMAGE_WRITEABLE) != 0);
303    return (device->type == MESS_DEVICE)
304        || (device_get_info_int_offline(device, DEVINFO_INT_IMAGE_READABLE) != 0)
305        || (device_get_info_int_offline(device, DEVINFO_INT_IMAGE_WRITEABLE) != 0);
306306}
307307
308308
309309
310310/*-------------------------------------------------
311311    image_device_first - return the first device in
312   the list that supports images
312    the list that supports images
313313-------------------------------------------------*/
314314
315315const device_config *image_device_first(const machine_config *config)
316316{
317   const device_config *device = device_list_first(config->devicelist, DEVICE_TYPE_WILDCARD);
318   while((device != NULL) && !is_image_device(device))
319   {
320      device = device_list_next(device, DEVICE_TYPE_WILDCARD);
321   }
322   return device;   
317    const device_config *device = device_list_first(config->devicelist, DEVICE_TYPE_WILDCARD);
318    while((device != NULL) && !is_image_device(device))
319    {
320        device = device_list_next(device, DEVICE_TYPE_WILDCARD);
321    }
322    return device;
323323}
324324
325325
326326
327327/*-------------------------------------------------
328328    image_device_next - return the next device in
329   the list that supports images
329    the list that supports images
330330-------------------------------------------------*/
331331
332332const device_config *image_device_next(const device_config *prevdevice)
333333{
334   const device_config *device = device_list_next(prevdevice, DEVICE_TYPE_WILDCARD);
335   while((device != NULL) && !is_image_device(device))
336   {
337      device = device_list_next(device, DEVICE_TYPE_WILDCARD);
338   }
339   return device;   
334    const device_config *device = device_list_next(prevdevice, DEVICE_TYPE_WILDCARD);
335    while((device != NULL) && !is_image_device(device))
336    {
337        device = device_list_next(device, DEVICE_TYPE_WILDCARD);
338    }
339    return device;
340340}
341341
342342
343343
344344/*-------------------------------------------------
345345    image_device_count - counts the number of
346   devices that support images
346    devices that support images
347347-------------------------------------------------*/
348348
349349int image_device_count(const machine_config *config)
350350{
351   int count = 0;
352   const device_config *device;
353   for (device = image_device_first(config); device != NULL; device = image_device_next(device))
354   {
355      count++;
356   }
357   return count;
351    int count = 0;
352    const device_config *device;
353    for (device = image_device_first(config); device != NULL; device = image_device_next(device))
354    {
355        count++;
356    }
357    return count;
358358}
359359
360360
r4910r4911
365365
366366/*-------------------------------------------------
367367    get_device_name - retrieves the name of a
368   device
368    device
369369-------------------------------------------------*/
370370
371371static void get_device_name(const device_config *device, char *buffer, size_t buffer_len)
372372{
373   const char *name = NULL;
374   device_get_name_func get_name;
375   
376   if (name == NULL)
377   {
378      /* first try a get_name function */
379      get_name = (device_get_name_func) device_get_info_fct_offline(device, DEVINFO_FCT_GET_NAME);
380      if (get_name != NULL)
381         name = get_name(device, buffer, buffer_len);
382   }
373    const char *name = NULL;
374    device_get_name_func get_name;
383375
384   if (name == NULL)
385   {
386      /* next try DEVINFO_STR_NAME */
387      name = device_get_info_string(device, DEVINFO_STR_NAME);
388   }
376    if (name == NULL)
377    {
378        /* first try a get_name function */
379        get_name = (device_get_name_func) device_get_info_fct_offline(device, DEVINFO_FCT_GET_NAME);
380        if (get_name != NULL)
381            name = get_name(device, buffer, buffer_len);
382    }
389383
390   /* make sure that the name is put into the buffer */
391   if (name != buffer)
392      snprintf(buffer, buffer_len, "%s", (name != NULL) ? name : "");
384    if (name == NULL)
385    {
386        /* next try DEVINFO_STR_NAME */
387        name = device_get_info_string(device, DEVINFO_STR_NAME);
388    }
389
390    /* make sure that the name is put into the buffer */
391    if (name != buffer)
392        snprintf(buffer, buffer_len, "%s", (name != NULL) ? name : "");
393393}
394394
395395
396396
397397/*-------------------------------------------------
398398    get_device_file_extensions - retrieves the file
399   extensions used by a device
399    extensions used by a device
400400-------------------------------------------------*/
401401
402402static void get_device_file_extensions(const device_config *device,
403   char *buffer, size_t buffer_len)
403    char *buffer, size_t buffer_len)
404404{
405   const char *file_extensions;
406   char *s;
405    const char *file_extensions;
406    char *s;
407407
408   /* be pedantic - we need room for a string list */
409   assert(buffer_len > 0);
410   buffer_len--;
408    /* be pedantic - we need room for a string list */
409    assert(buffer_len > 0);
410    buffer_len--;
411411
412   /* copy the string */
413   file_extensions = device_get_info_string(device, DEVINFO_STR_IMAGE_FILE_EXTENSIONS);
414   snprintf(buffer, buffer_len, "%s", (file_extensions != NULL) ? file_extensions : "");
412    /* copy the string */
413    file_extensions = device_get_info_string(device, DEVINFO_STR_IMAGE_FILE_EXTENSIONS);
414    snprintf(buffer, buffer_len, "%s", (file_extensions != NULL) ? file_extensions : "");
415415
416   /* convert the comma delimited list to a NUL delimited list */
417   s = buffer;
418   while((s = strchr(s, ',')) != NULL)
419      *(s++) = '\0';
416    /* convert the comma delimited list to a NUL delimited list */
417    s = buffer;
418    while((s = strchr(s, ',')) != NULL)
419        *(s++) = '\0';
420420}
421421
422422
423423
424424/*-------------------------------------------------
425425    get_device_instance_name - retrieves the device
426   instance name or brief instance name
426    instance name or brief instance name
427427-------------------------------------------------*/
428428
429429static void get_device_instance_name(const machine_config *config, const device_config *device,
430   char *buffer, size_t buffer_len, iodevice_t type, UINT32 state, const char *(*get_dev_typename)(iodevice_t))
430    char *buffer, size_t buffer_len, iodevice_t type, UINT32 state, const char *(*get_dev_typename)(iodevice_t))
431431{
432   const char *result;
433   const device_config *that_device;
434   int count, index;
432    const char *result;
433    const device_config *that_device;
434    int count, index;
435435
436   /* retrieve info about the device instance */
437   result = device_get_info_string(device, state);
438   if ((result != NULL) && (result[0] != '\0'))
439   {
440      /* we got info directly */
441      snprintf(buffer, buffer_len, "%s", result);
442   }
443   else
444   {
445      /* not specified? default to device names based on the device type */
446      result = get_dev_typename(type);
436    /* retrieve info about the device instance */
437    result = device_get_info_string(device, state);
438    if ((result != NULL) && (result[0] != '\0'))
439    {
440        /* we got info directly */
441        snprintf(buffer, buffer_len, "%s", result);
442    }
443    else
444    {
445        /* not specified? default to device names based on the device type */
446        result = get_dev_typename(type);
447447
448      /* are there multiple devices of the same type */
449      count = 0;
450      index = -1;
451      for (that_device = image_device_first(config); that_device != NULL; that_device = image_device_next(that_device))
452      {
453         if (device == that_device)
454            index = count;
455         if (device_get_info_int_offline(that_device, DEVINFO_INT_IMAGE_TYPE) == type)
456            count++;
457      }
448        /* are there multiple devices of the same type */
449        count = 0;
450        index = -1;
451        for (that_device = image_device_first(config); that_device != NULL; that_device = image_device_next(that_device))
452        {
453            if (device == that_device)
454                index = count;
455            if (device_get_info_int_offline(that_device, DEVINFO_INT_IMAGE_TYPE) == type)
456                count++;
457        }
458458
459      /* need to number if there is more than one device */
460      if (count > 1)
461         snprintf(buffer, buffer_len, "%s%d", result, index + 1);
462      else
463         snprintf(buffer, buffer_len, "%s", result);
464   }
459        /* need to number if there is more than one device */
460        if (count > 1)
461            snprintf(buffer, buffer_len, "%s%d", result, index + 1);
462        else
463            snprintf(buffer, buffer_len, "%s", result);
464    }
465465}
466466
467467
468468
469469/*-------------------------------------------------
470470    image_device_getinfo - returns info on a device;
471   can be called by front end code
471    can be called by front end code
472472-------------------------------------------------*/
473473
474474image_device_info image_device_getinfo(const machine_config *config, const device_config *device)
475475{
476   const device_config *this_device;
477   image_device_info info;
478   int found;
476    const device_config *this_device;
477    image_device_info info;
478    int found;
479479
480   /* sanity checks */
481   assert((device->machine == NULL) || (device->machine->config == config));
482   if (device->machine == NULL)
483   {
484      found = FALSE;
485      for (this_device = image_device_first(config); this_device != NULL; this_device = image_device_next(this_device))
486      {
487         if (this_device == device)
488            found = TRUE;
489      }
490      assert(found);
491   }
480    /* sanity checks */
481    assert((device->machine == NULL) || (device->machine->config == config));
482    if (device->machine == NULL)
483    {
484        found = FALSE;
485        for (this_device = image_device_first(config); this_device != NULL; this_device = image_device_next(this_device))
486        {
487            if (this_device == device)
488                found = TRUE;
489        }
490        assert(found);
491    }
492492
493   /* clear return value */
494   memset(&info, 0, sizeof(info));
493    /* clear return value */
494    memset(&info, 0, sizeof(info));
495495
496   /* retrieve type */
497   info.type = (iodevice_t) (int) device_get_info_int_offline(device, DEVINFO_INT_IMAGE_TYPE);
496    /* retrieve type */
497    info.type = (iodevice_t) (int) device_get_info_int_offline(device, DEVINFO_INT_IMAGE_TYPE);
498498
499   /* retrieve flags */
500   info.readable = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_READABLE) ? 1 : 0;
501   info.writeable = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_WRITEABLE) ? 1 : 0;
502   info.creatable = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_CREATABLE) ? 1 : 0;
503   info.must_be_loaded = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_MUST_BE_LOADED) ? 1 : 0;
504   info.reset_on_load = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_RESET_ON_LOAD) ? 1 : 0;
505   info.has_partial_hash = device_get_info_fct_offline(device, DEVINFO_FCT_IMAGE_PARTIAL_HASH) ? 1 : 0;
499    /* retrieve flags */
500    info.readable = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_READABLE) ? 1 : 0;
501    info.writeable = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_WRITEABLE) ? 1 : 0;
502    info.creatable = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_CREATABLE) ? 1 : 0;
503    info.must_be_loaded = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_MUST_BE_LOADED) ? 1 : 0;
504    info.reset_on_load = device_get_info_int_offline(device, DEVINFO_INT_IMAGE_RESET_ON_LOAD) ? 1 : 0;
505    info.has_partial_hash = device_get_info_fct_offline(device, DEVINFO_FCT_IMAGE_PARTIAL_HASH) ? 1 : 0;
506506
507   /* retrieve name */
508   get_device_name(device, info.name, ARRAY_LENGTH(info.name));
507    /* retrieve name */
508    get_device_name(device, info.name, ARRAY_LENGTH(info.name));
509509
510   /* retrieve file extensions */
511   get_device_file_extensions(device, info.file_extensions, ARRAY_LENGTH(info.file_extensions));
510    /* retrieve file extensions */
511    get_device_file_extensions(device, info.file_extensions, ARRAY_LENGTH(info.file_extensions));
512512
513   /* retrieve instance name */
514   get_device_instance_name(config, device, info.instance_name, ARRAY_LENGTH(info.instance_name),
515      info.type, DEVINFO_STR_IMAGE_INSTANCE_NAME, device_typename);
513    /* retrieve instance name */
514    get_device_instance_name(config, device, info.instance_name, ARRAY_LENGTH(info.instance_name),
515        info.type, DEVINFO_STR_IMAGE_INSTANCE_NAME, device_typename);
516516
517   /* retrieve brief instance name */
518   get_device_instance_name(config, device, info.brief_instance_name, ARRAY_LENGTH(info.brief_instance_name),
519      info.type, DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME, device_brieftypename);
517    /* retrieve brief instance name */
518    get_device_instance_name(config, device, info.brief_instance_name, ARRAY_LENGTH(info.brief_instance_name),
519        info.type, DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME, device_brieftypename);
520520
521   return info;
521    return info;
522522}
523523
524524
525525
526526/*-------------------------------------------------
527527    image_device_uses_file_extension - checks to
528   see if a particular devices uses a certain
529   file extension
528    see if a particular devices uses a certain
529    file extension
530530-------------------------------------------------*/
531531
532532int image_device_uses_file_extension(const device_config *device, const char *file_extension)
533533{
534   int result = FALSE;
535   const char *s;
536   char file_extension_list[256];
537   
538   /* skip initial period, if present */
539   if (file_extension[0] == '.')
540      file_extension++;
534    int result = FALSE;
535    const char *s;
536    char file_extension_list[256];
541537
542   /* retrieve file extension list */
543   get_device_file_extensions(device, file_extension_list, ARRAY_LENGTH(file_extension_list));
538    /* skip initial period, if present */
539    if (file_extension[0] == '.')
540        file_extension++;
544541
545   /* find the extensions */
546   s = file_extension_list;
547   while(!result && (*s != '\0'))
548   {
549      if (!mame_stricmp(s, file_extension))
550      {
551         result = TRUE;
552         break;
553      }
554      s += strlen(s) + 1;
555   }
556   return result;
542    /* retrieve file extension list */
543    get_device_file_extensions(device, file_extension_list, ARRAY_LENGTH(file_extension_list));
544
545    /* find the extensions */
546    s = file_extension_list;
547    while(!result && (*s != '\0'))
548    {
549        if (!mame_stricmp(s, file_extension))
550        {
551            result = TRUE;
552            break;
553        }
554        s += strlen(s) + 1;
555    }
556    return result;
557557}
558558
559559
560560
561561/*-------------------------------------------------
562562    image_device_compute_hash - compute a hash,
563   using this device's partial hash if appropriate
563    using this device's partial hash if appropriate
564564-------------------------------------------------*/
565565
566566void image_device_compute_hash(char *dest, const device_config *device,
567   const void *data, size_t length, unsigned int functions)
567    const void *data, size_t length, unsigned int functions)
568568{
569   device_image_partialhash_func partialhash;
569    device_image_partialhash_func partialhash;
570570
571   /* retrieve the partial hash func */
572   partialhash = (device_image_partialhash_func) device_get_info_fct_offline(device, DEVINFO_FCT_IMAGE_PARTIAL_HASH);
571    /* retrieve the partial hash func */
572    partialhash = (device_image_partialhash_func) device_get_info_fct_offline(device, DEVINFO_FCT_IMAGE_PARTIAL_HASH);
573573
574   /* compute the hash */
575   if (partialhash != NULL)
576      partialhash(dest, data, length, functions);
577   else
578      hash_compute(dest, data, length, functions);
574    /* compute the hash */
575    if (partialhash != NULL)
576        partialhash(dest, data, length, functions);
577    else
578        hash_compute(dest, data, length, functions);
579579}
580580
581581
r4910r4911
586586
587587/*-------------------------------------------------
588588    image_device_get_creation_option_guide - accesses
589   the creation option guide
589    the creation option guide
590590-------------------------------------------------*/
591591
592592const option_guide *image_device_get_creation_option_guide(const device_config *device)
593593{
594   image_slot_data *slot = find_image_slot(device);
595   return slot->create_option_guide;
594    image_slot_data *slot = find_image_slot(device);
595    return slot->create_option_guide;
596596}
597597
598598
599599
600600/*-------------------------------------------------
601601    image_device_get_creatable_formats - accesses
602   the image formats available for image creation
602    the image formats available for image creation
603603-------------------------------------------------*/
604604
605605const image_device_format *image_device_get_creatable_formats(const device_config *device)
606606{
607   image_slot_data *slot = find_image_slot(device);
608   return slot->formatlist;
607    image_slot_data *slot = find_image_slot(device);
608    return slot->formatlist;
609609}
610610
611611
612612
613613/*-------------------------------------------------
614614    image_device_get_indexed_creatable_format -
615   accesses a specific image format available for
616   image creation by index
615    accesses a specific image format available for
616    image creation by index
617617-------------------------------------------------*/
618618
619619const image_device_format *image_device_get_indexed_creatable_format(const device_config *device, int index)
620620{
621   const image_device_format *format = image_device_get_creatable_formats(device);
622   while(index-- && (format != NULL))
623      format = format->next;
624   return format;
621    const image_device_format *format = image_device_get_creatable_formats(device);
622    while(index-- && (format != NULL))
623        format = format->next;
624    return format;
625625}
626626
627627
628628
629629/*-------------------------------------------------
630630    image_device_get_named_creatable_format -
631   accesses a specific image format available for
632   image creation by name
631    accesses a specific image format available for
632    image creation by name
633633-------------------------------------------------*/
634634
635635const image_device_format *image_device_get_named_creatable_format(const device_config *device, const char *format_name)
636636{
637   const image_device_format *format = image_device_get_creatable_formats(device);
638   while((format != NULL) && strcmp(format->name, format_name))
639      format = format->next;
640   return format;
637    const image_device_format *format = image_device_get_creatable_formats(device);
638    while((format != NULL) && strcmp(format->name, format_name))
639        format = format->next;
640    return format;
641641}
642642
643643
r4910r4911
648648
649649/*-------------------------------------------------
650650    set_image_filename - specifies the filename of
651   an image
651    an image
652652-------------------------------------------------*/
653653
654654static image_error_t set_image_filename(image_slot_data *image, const char *filename)
655655{
656   astring_cpyc(image->name, filename);
657   zippath_parent(image->working_directory, filename);
658   return IMAGE_ERROR_SUCCESS;
656    astring_cpyc(image->name, filename);
657    zippath_parent(image->working_directory, filename);
658    return IMAGE_ERROR_SUCCESS;
659659}
660660
661661
662662
663663/*-------------------------------------------------
664664    is_loaded - quick check to determine whether an
665   image is loaded
665    image is loaded
666666-------------------------------------------------*/
667667
668668static int is_loaded(image_slot_data *image)
669669{
670   return (image->file != NULL) || (image->ptr != NULL);
670    return (image->file != NULL) || (image->ptr != NULL);
671671}
672672
673673
674674
675675/*-------------------------------------------------
676676    load_image_by_path - loads an image with a
677   specific path
677    specific path
678678-------------------------------------------------*/
679679
680680static image_error_t load_image_by_path(image_slot_data *image, UINT32 open_flags, const char *path)
681681{
682   file_error filerr = FILERR_NOT_FOUND;
683   image_error_t err = IMAGE_ERROR_FILENOTFOUND;
684   astring *revised_path = astring_alloc();
682    file_error filerr = FILERR_NOT_FOUND;
683    image_error_t err = IMAGE_ERROR_FILENOTFOUND;
684    astring *revised_path = astring_alloc();
685685
686   /* attempt to read the file */
687   filerr = zippath_fopen(path, open_flags, &image->file, revised_path);
686    /* attempt to read the file */
687    filerr = zippath_fopen(path, open_flags, &image->file, revised_path);
688688
689   /* did the open succeed? */
690   switch(filerr)
691   {
692      case FILERR_NONE:
693         /* success! */
694         image->writeable = (open_flags & OPEN_FLAG_WRITE) ? 1 : 0;
695         image->created = (open_flags & OPEN_FLAG_CREATE) ? 1 : 0;
696         err = IMAGE_ERROR_SUCCESS;
697         break;
689    /* did the open succeed? */
690    switch(filerr)
691    {
692        case FILERR_NONE:
693            /* success! */
694            image->writeable = (open_flags & OPEN_FLAG_WRITE) ? 1 : 0;
695            image->created = (open_flags & OPEN_FLAG_CREATE) ? 1 : 0;
696            err = IMAGE_ERROR_SUCCESS;
697            break;
698698
699      case FILERR_NOT_FOUND:
700      case FILERR_ACCESS_DENIED:
701         /* file not found (or otherwise cannot open); continue */
702         err = IMAGE_ERROR_FILENOTFOUND;
703         break;
699        case FILERR_NOT_FOUND:
700        case FILERR_ACCESS_DENIED:
701            /* file not found (or otherwise cannot open); continue */
702            err = IMAGE_ERROR_FILENOTFOUND;
703            break;
704704
705      case FILERR_OUT_OF_MEMORY:
706         /* out of memory */
707         err = IMAGE_ERROR_OUTOFMEMORY;
708         break;
705        case FILERR_OUT_OF_MEMORY:
706            /* out of memory */
707            err = IMAGE_ERROR_OUTOFMEMORY;
708            break;
709709
710      case FILERR_ALREADY_OPEN:
711         /* this shouldn't happen */
712         err = IMAGE_ERROR_ALREADYOPEN;
713         break;
710        case FILERR_ALREADY_OPEN:
711            /* this shouldn't happen */
712            err = IMAGE_ERROR_ALREADYOPEN;
713            break;
714714
715      case FILERR_FAILURE:
716      case FILERR_TOO_MANY_FILES:
717      case FILERR_INVALID_DATA:
718      default:
719         /* other errors */
720         err = IMAGE_ERROR_INTERNAL;
721         break;
722   }
715        case FILERR_FAILURE:
716        case FILERR_TOO_MANY_FILES:
717        case FILERR_INVALID_DATA:
718        default:
719            /* other errors */
720            err = IMAGE_ERROR_INTERNAL;
721            break;
722    }
723723
724   /* if successful, set the file name */
725   if (filerr == FILERR_NONE)
726      set_image_filename(image, astring_c(revised_path));
724    /* if successful, set the file name */
725    if (filerr == FILERR_NONE)
726        set_image_filename(image, astring_c(revised_path));
727727
728   astring_free(revised_path);
729   return err;
728    astring_free(revised_path);
729    return err;
730730}
731731
732732
733733
734734/*-------------------------------------------------
735735    determine_open_plan - determines which open
736   flags to use, and in what order
736    flags to use, and in what order
737737-------------------------------------------------*/
738738
739739static void determine_open_plan(image_slot_data *image, int is_create, UINT32 *open_plan)
740740{
741   int i = 0;
741    int i = 0;
742742
743   /* emit flags */
744   if (!is_create && image->info.readable && image->info.writeable)
745      open_plan[i++] = OPEN_FLAG_READ | OPEN_FLAG_WRITE;
746   if (!is_create && !image->info.readable && image->info.writeable)
747      open_plan[i++] = OPEN_FLAG_WRITE;
748   if (!is_create && image->info.readable)
749      open_plan[i++] = OPEN_FLAG_READ;
750   if (image->info.writeable && image->info.creatable)
751      open_plan[i++] = OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE;
752   open_plan[i] = 0;
743    /* emit flags */
744    if (!is_create && image->info.readable && image->info.writeable)
745        open_plan[i++] = OPEN_FLAG_READ | OPEN_FLAG_WRITE;
746    if (!is_create && !image->info.readable && image->info.writeable)
747        open_plan[i++] = OPEN_FLAG_WRITE;
748    if (!is_create && image->info.readable)
749        open_plan[i++] = OPEN_FLAG_READ;
750    if (image->info.writeable && image->info.creatable)
751        open_plan[i++] = OPEN_FLAG_READ | OPEN_FLAG_WRITE | OPEN_FLAG_CREATE;
752    open_plan[i] = 0;
753753}
754754
755755
756756
757757/*-------------------------------------------------
758758    find_image_slot - locates the slot for an
759   image
759    image
760760-------------------------------------------------*/
761761
762762static image_slot_data *find_image_slot(const device_config *image)
763763{
764   int i;
765   images_private *images_data = image->machine->images_data;
764    int i;
765    images_private *images_data = image->machine->images_data;
766766
767   for (i = 0; i < images_data->slot_count; i++)
768   {
769      if (images_data->slots[i].dev == image)
770      {
771         return &images_data->slots[i];
772      }
773   }
774   return NULL;
767    for (i = 0; i < images_data->slot_count; i++)
768    {
769        if (images_data->slots[i].dev == image)
770        {
771            return &images_data->slots[i];
772        }
773    }
774    return NULL;
775775}
776776
777777
r4910r4911
781781-------------------------------------------------*/
782782
783783static int image_load_internal(const device_config *image, const char *path,
784   int is_create, int create_format, option_resolution *create_args)
784    int is_create, int create_format, option_resolution *create_args)
785785{
786   running_machine *machine = image->machine;
787   image_error_t err;
788   const void *buffer;
789   UINT32 open_plan[4];
790   int i;
791   image_slot_data *slot = find_image_slot(image);
786    running_machine *machine = image->machine;
787    image_error_t err;
788    const void *buffer;
789    UINT32 open_plan[4];
790    int i;
791    image_slot_data *slot = find_image_slot(image);
792792
793   /* sanity checks */
794   assert_always(image != NULL, "image_load(): image is NULL");
795   assert_always(path != NULL, "image_load(): path is NULL");
793    /* sanity checks */
794    assert_always(image != NULL, "image_load(): image is NULL");
795    assert_always(path != NULL, "image_load(): path is NULL");
796796
797   /* first unload the image */
798   image_unload(image);
797    /* first unload the image */
798    image_unload(image);
799799
800   /* clear any possible error messages */
801   image_clear_error(slot);
800    /* clear any possible error messages */
801    image_clear_error(slot);
802802
803   /* we are now loading */
804   slot->is_loading = 1;
803    /* we are now loading */
804    slot->is_loading = 1;
805805
806   /* record the filename */
807   slot->err = set_image_filename(slot, path);
808   if (slot->err)
809      goto done;
806    /* record the filename */
807    slot->err = set_image_filename(slot, path);
808    if (slot->err)
809        goto done;
810810
811   /* do we need to reset the CPU? */
812   if ((attotime_compare(timer_get_time(machine), attotime_zero) > 0) && slot->info.reset_on_load)
813      mame_schedule_hard_reset(machine);
811    /* do we need to reset the CPU? */
812    if ((attotime_compare(timer_get_time(machine), attotime_zero) > 0) && slot->info.reset_on_load)
813        mame_schedule_hard_reset(machine);
814814
815   /* determine open plan */
816   determine_open_plan(slot, is_create, open_plan);
815    /* determine open plan */
816    determine_open_plan(slot, is_create, open_plan);
817817
818   /* attempt to open the file in various ways */
819   for (i = 0; !slot->file && open_plan[i]; i++)
820   {
821      /* open the file */
822      slot->err = load_image_by_path(slot, open_plan[i], path);
823      if (slot->err && (slot->err != IMAGE_ERROR_FILENOTFOUND))
824         goto done;
825   }
818    /* attempt to open the file in various ways */
819    for (i = 0; !slot->file && open_plan[i]; i++)
820    {
821        /* open the file */
822        slot->err = load_image_by_path(slot, open_plan[i], path);
823        if (slot->err && (slot->err != IMAGE_ERROR_FILENOTFOUND))
824            goto done;
825    }
826826
827   /* did we fail to find the file? */
828   if (!is_loaded(slot))
829   {
830      slot->err = IMAGE_ERROR_FILENOTFOUND;
831      goto done;
832   }
827    /* did we fail to find the file? */
828    if (!is_loaded(slot))
829    {
830        slot->err = IMAGE_ERROR_FILENOTFOUND;
831        goto done;
832    }
833833
834   /* if applicable, call device verify */
835   if ((slot->verify != NULL) && !image_has_been_created(image))
836   {
837      /* access the memory */
838      buffer = image_ptr(image);
839      if (!buffer)
840      {
841         slot->err = IMAGE_ERROR_OUTOFMEMORY;
842         goto done;
843      }
834    /* if applicable, call device verify */
835    if ((slot->verify != NULL) && !image_has_been_created(image))
836    {
837        /* access the memory */
838        buffer = image_ptr(image);
839        if (!buffer)
840        {
841            slot->err = IMAGE_ERROR_OUTOFMEMORY;
842            goto done;
843        }
844844
845      /* verify the file */
846      err = (*slot->verify)(buffer, core_fsize(slot->file));
847      if (err)
848      {
849         slot->err = IMAGE_ERROR_INVALIDIMAGE;
850         goto done;
851      }
852   }
845        /* verify the file */
846        err = (*slot->verify)(buffer, core_fsize(slot->file));
847        if (err)
848        {
849            slot->err = IMAGE_ERROR_INVALIDIMAGE;
850            goto done;
851        }
852    }
853853
854   /* call device load or create */
855   if (image->token != NULL)
856   {
857      slot->create_format = create_format;
858      slot->create_args = create_args;
854    /* call device load or create */
855    if (image->token != NULL)
856    {
857        slot->create_format = create_format;
858        slot->create_args = create_args;
859859
860      err = image_finish_load(image);
861      if (err)
862         goto done;
863   }
860        err = image_finish_load(image);
861        if (err)
862            goto done;
863    }
864864
865   /* success! */
865    /* success! */
866866
867867done:
868   if (slot->err)
869      image_clear(slot);
870   return slot->err ? INIT_FAIL : INIT_PASS;
868    if (slot->err)
869        image_clear(slot);
870    return slot->err ? INIT_FAIL : INIT_PASS;
871871}
872872
873873
r4910r4911
878878
879879int image_load(const device_config *image, const char *path)
880880{
881   return image_load_internal(image, path, FALSE, 0, NULL);
881    return image_load_internal(image, path, FALSE, 0, NULL);
882882}
883883
884884
885885
886886/*-------------------------------------------------
887887    image_finish_load - special call - only use
888   from core
888    from core
889889-------------------------------------------------*/
890890
891891int image_finish_load(const device_config *device)
892892{
893   int err = INIT_PASS;
893    int err = INIT_PASS;
894894
895   image_slot_data *slot = find_image_slot(device);
895    image_slot_data *slot = find_image_slot(device);
896896
897   if (slot->is_loading)
898   {
899      if (image_has_been_created(device) && (slot->create != NULL))
900      {
901         err = (*slot->create)(device, slot->create_format, slot->create_args);
902         if (err)
903         {
904            if (!slot->err)
905               slot->err = IMAGE_ERROR_UNSPECIFIED;
906         }
907      }
908      else if (slot->load != NULL)
909      {
910         /* using device load */
911         err = (*slot->load)(device);
912         if (err)
913         {
914            if (!slot->err)
915               slot->err = IMAGE_ERROR_UNSPECIFIED;
916         }
917      }
918   }
897    if (slot->is_loading)
898    {
899        if (image_has_been_created(device) && (slot->create != NULL))
900        {
901            err = (*slot->create)(device, slot->create_format, slot->create_args);
902            if (err)
903            {
904                if (!slot->err)
905                    slot->err = IMAGE_ERROR_UNSPECIFIED;
906            }
907        }
908        else if (slot->load != NULL)
909        {
910            /* using device load */
911            err = (*slot->load)(device);
912            if (err)
913            {
914                if (!slot->err)
915                    slot->err = IMAGE_ERROR_UNSPECIFIED;
916            }
917        }
918    }
919919
920   slot->is_loading = 0;
921   slot->create_format = 0;
922   slot->create_args = NULL;
923   return err;
920    slot->is_loading = 0;
921    slot->create_format = 0;
922    slot->create_args = NULL;
923    return err;
924924}
925925
926926
r4910r4911
931931
932932int image_create(const device_config *image, const char *path, const image_device_format *create_format, option_resolution *create_args)
933933{
934   int format_index = (create_format != NULL) ? create_format->index : 0;
935   return image_load_internal(image, path, TRUE, format_index, create_args);
934    int format_index = (create_format != NULL) ? create_format->index : 0;
935    return image_load_internal(image, path, TRUE, format_index, create_args);
936936}
937937
938938
939939
940940/*-------------------------------------------------
941941    image_clear - clear all internal data pertaining
942   to an image
942    to an image
943943-------------------------------------------------*/
944944
945945static void image_clear(image_slot_data *image)
946946{
947   if (image->file)
948   {
949      core_fclose(image->file);
950      image->file = NULL;
951   }
947    if (image->file)
948    {
949        core_fclose(image->file);
950        image->file = NULL;
951    }
952952
953   astring_cpyc(image->name, "");
953    astring_cpyc(image->name, "");
954954
955   image->writeable = 0;
956   image->created = 0;
957   image->is_loading = 0;
958   image->dir = NULL;
959   image->hash = NULL;
960   image->longname = NULL;
961   image->manufacturer = NULL;
962   image->year = NULL;
963   image->playable = NULL;
964   image->extrainfo = NULL;
965   image->basename_noext = NULL;
966   image->ptr = NULL;
955    image->writeable = 0;
956    image->created = 0;
957    image->is_loading = 0;
958    image->dir = NULL;
959    image->hash = NULL;
960    image->longname = NULL;
961    image->manufacturer = NULL;
962    image->year = NULL;
963    image->playable = NULL;
964    image->extrainfo = NULL;
965    image->basename_noext = NULL;
966    image->ptr = NULL;
967967}
968968
969969
970970
971971/*-------------------------------------------------
972972    image_unload_internal - internal call to unload
973   images
973    images
974974-------------------------------------------------*/
975975
976976static void image_unload_internal(image_slot_data *slot)
977977{
978   /* is there an actual image loaded? */
979   if (is_loaded(slot))
980   {
981      /* call the unload function */
982      if (slot->unload != NULL)
983         slot->unload(slot->dev);
984   }
978    /* is there an actual image loaded? */
979    if (is_loaded(slot))
980    {
981        /* call the unload function */
982        if (slot->unload != NULL)
983            slot->unload(slot->dev);
984    }
985985
986   image_clear(slot);
987   image_clear_error(slot);
986    image_clear(slot);
987    image_clear_error(slot);
988988}
989989
990990
r4910r4911
995995
996996void image_unload(const device_config *image)
997997{
998   image_slot_data *slot = find_image_slot(image);
999   image_unload_internal(slot);
998    image_slot_data *slot = find_image_slot(image);
999    image_unload_internal(slot);
10001000}
10011001
10021002
r4910r4911
10071007
10081008/*-------------------------------------------------
10091009    image_clear_error - clear out any specified
1010   error
1010    error
10111011-------------------------------------------------*/
10121012
10131013static void image_clear_error(image_slot_data *image)
10141014{
1015   image->err = IMAGE_ERROR_SUCCESS;
1016   if (image->err_message != NULL)
1017   {
1018      image_freeptr(image->dev, image->err_message);
1019      image->err_message = NULL;
1020   }
1015    image->err = IMAGE_ERROR_SUCCESS;
1016    if (image->err_message != NULL)
1017    {
1018        image_freeptr(image->dev, image->err_message);
1019        image->err_message = NULL;
1020    }
10211021}
10221022
10231023
10241024
10251025/*-------------------------------------------------
10261026    image_error - returns the error text for an image
1027   error
1027    error
10281028-------------------------------------------------*/
10291029
10301030const char *image_error(const device_config *image)
10311031{
1032   static const char *const messages[] =
1033   {
1034      NULL,
1035      "Internal error",
1036      "Unsupported operation",
1037      "Out of memory",
1038      "File not found",
1039      "Invalid image",
1040      "File already open",
1041      "Unspecified error"
1042   };
1032    static const char *const messages[] =
1033    {
1034        NULL,
1035        "Internal error",
1036        "Unsupported operation",
1037        "Out of memory",
1038        "File not found",
1039        "Invalid image",
1040        "File already open",
1041        "Unspecified error"
1042    };
10431043
1044   image_slot_data *slot = find_image_slot(image);
1045   return slot->err_message ? slot->err_message : messages[slot->err];
1044    image_slot_data *slot = find_image_slot(image);
1045    return slot->err_message ? slot->err_message : messages[slot->err];
10461046}
10471047
10481048
r4910r4911
10531053
10541054void image_seterror(const device_config *image, image_error_t err, const char *message)
10551055{
1056   image_slot_data *slot = find_image_slot(image);
1056    image_slot_data *slot = find_image_slot(image);
10571057
1058   image_clear_error(slot);
1059   slot->err = err;
1060   if (message != NULL)
1061   {
1062      slot->err_message = image_strdup(image, message);
1063   }
1058    image_clear_error(slot);
1059    slot->err = err;
1060    if (message != NULL)
1061    {
1062        slot->err_message = image_strdup(image, message);
1063    }
10641064}
10651065
10661066
10671067
10681068/*-------------------------------------------------
10691069    image_message - used to display a message while
1070   loading
1070    loading
10711071-------------------------------------------------*/
10721072
10731073void image_message(const device_config *device, const char *format, ...)
10741074{
1075   image_slot_data *slot;
1076   va_list args;
1077   char buffer[256];
1075    image_slot_data *slot;
1076    va_list args;
1077    char buffer[256];
10781078
1079   /* sanity checks */
1080   slot = find_image_slot(device);
1081   assert(is_loaded(slot) || slot->is_loading);
1079    /* sanity checks */
1080    slot = find_image_slot(device);
1081    assert(is_loaded(slot) || slot->is_loading);
10821082
1083   /* format the message */
1084   va_start(args, format);
1085   vsnprintf(buffer, ARRAY_LENGTH(buffer), format, args);
1086   va_end(args);
1083    /* format the message */
1084    va_start(args, format);
1085    vsnprintf(buffer, ARRAY_LENGTH(buffer), format, args);
1086    va_end(args);
10871087
1088   /* display the popup for a standard amount of time */
1089   ui_popup_time(5, "%s: %s",
1090      image_basename(device),
1091      buffer);
1088    /* display the popup for a standard amount of time */
1089    ui_popup_time(5, "%s: %s",
1090        image_basename(device),
1091        buffer);
10921092}
10931093
10941094
r4910r4911
11021102
11031103static int read_hash_config(const char *sysname, image_slot_data *image)
11041104{
1105   hash_file *hashfile = NULL;
1106   const hash_info *info = NULL;
1105    hash_file *hashfile = NULL;
1106    const hash_info *info = NULL;
11071107
1108   /* open the hash file */
1109   hashfile = hashfile_open(sysname, FALSE, NULL);
1110   if (!hashfile)
1111      goto done;
1108    /* open the hash file */
1109    hashfile = hashfile_open(sysname, FALSE, NULL);
1110    if (!hashfile)
1111        goto done;
11121112
1113   /* look up this entry in the hash file */
1114   info = hashfile_lookup(hashfile, image->hash);
1115   if (!info)
1116      goto done;
1113    /* look up this entry in the hash file */
1114    info = hashfile_lookup(hashfile, image->hash);
1115    if (!info)
1116        goto done;
11171117
1118   /* copy the relevant entries */
1119   image->longname      = info->longname      ? image_strdup(image->dev, info->longname)      : NULL;
1120   image->manufacturer   = info->manufacturer   ? image_strdup(image->dev, info->manufacturer)   : NULL;
1121   image->year         = info->year         ? image_strdup(image->dev, info->year)         : NULL;
1122   image->playable      = info->playable      ? image_strdup(image->dev, info->playable)      : NULL;
1123   image->pcb         = info->pcb            ? image_strdup(image->dev, info->pcb)         : NULL;
1124   image->extrainfo   = info->extrainfo      ? image_strdup(image->dev, info->extrainfo)      : NULL;
1118    /* copy the relevant entries */
1119    image->longname     = info->longname        ? image_strdup(image->dev, info->longname)      : NULL;
1120    image->manufacturer = info->manufacturer    ? image_strdup(image->dev, info->manufacturer)  : NULL;
1121    image->year         = info->year            ? image_strdup(image->dev, info->year)          : NULL;
1122    image->playable     = info->playable        ? image_strdup(image->dev, info->playable)      : NULL;
1123    image->pcb          = info->pcb             ? image_strdup(image->dev, info->pcb)           : NULL;
1124    image->extrainfo    = info->extrainfo       ? image_strdup(image->dev, info->extrainfo)     : NULL;
11251125
11261126done:
1127   if (hashfile != NULL)
1128      hashfile_close(hashfile);
1129   return !hashfile || !info;
1127    if (hashfile != NULL)
1128        hashfile_close(hashfile);
1129    return !hashfile || !info;
11301130}
11311131
11321132
11331133
11341134static void run_hash(const device_config *image,
1135   void (*partialhash)(char *, const unsigned char *, unsigned long, unsigned int),
1136   char *dest, unsigned int hash_functions)
1135    void (*partialhash)(char *, const unsigned char *, unsigned long, unsigned int),
1136    char *dest, unsigned int hash_functions)
11371137{
1138   UINT32 size;
1139   UINT8 *buf = NULL;
1138    UINT32 size;
1139    UINT8 *buf = NULL;
11401140
1141   *dest = '\0';
1142   size = (UINT32) image_length(image);
1141    *dest = '\0';
1142    size = (UINT32) image_length(image);
11431143
1144   buf = alloc_array_or_die(UINT8, size);
1144    buf = alloc_array_or_die(UINT8, size);
11451145
1146   /* read the file */
1147   image_fseek(image, 0, SEEK_SET);
1148   image_fread(image, buf, size);
1146    /* read the file */
1147    image_fseek(image, 0, SEEK_SET);
1148    image_fread(image, buf, size);
11491149
1150   if (partialhash)
1151      partialhash(dest, buf, size, hash_functions);
1152   else
1153      hash_compute(dest, buf, size, hash_functions);
1150    if (partialhash)
1151        partialhash(dest, buf, size, hash_functions);
1152    else
1153        hash_compute(dest, buf, size, hash_functions);
11541154
1155   /* cleanup */
1156   free(buf);
1157   image_fseek(image, 0, SEEK_SET);
1155    /* cleanup */
1156    free(buf);
1157    image_fseek(image, 0, SEEK_SET);
11581158}
11591159
11601160
11611161
11621162static int image_checkhash(image_slot_data *image)
11631163{
1164   const game_driver *drv;
1165   char hash_string[HASH_BUF_SIZE];
1166   device_image_partialhash_func partialhash;
1167   int rc;
1164    const game_driver *drv;
1165    char hash_string[HASH_BUF_SIZE];
1166    device_image_partialhash_func partialhash;
1167    int rc;
11681168
1169   /* this call should not be made when the image is not loaded */
1170   assert(is_loaded(image));
1169    /* this call should not be made when the image is not loaded */
1170    assert(is_loaded(image));
11711171
1172   /* only calculate CRC if it hasn't been calculated, and the open_mode is read only */
1173   if (!image->hash && !image->writeable && !image->created)
1174   {
1175      /* do not cause a linear read of 600 megs please */
1176      /* TODO: use SHA/MD5 in the CHD header as the hash */
1177      if (image->info.type == IO_CDROM)
1178         return FALSE;
1172    /* only calculate CRC if it hasn't been calculated, and the open_mode is read only */
1173    if (!image->hash && !image->writeable && !image->created)
1174    {
1175        /* do not cause a linear read of 600 megs please */
1176        /* TODO: use SHA/MD5 in the CHD header as the hash */
1177        if (image->info.type == IO_CDROM)
1178            return FALSE;
11791179
1180      /* retrieve the partial hash func */
1181      partialhash = (device_image_partialhash_func) device_get_info_fct_offline(image->dev, DEVINFO_FCT_IMAGE_PARTIAL_HASH);
1180        /* retrieve the partial hash func */
1181        partialhash = (device_image_partialhash_func) device_get_info_fct_offline(image->dev, DEVINFO_FCT_IMAGE_PARTIAL_HASH);
11821182
1183      run_hash(image->dev, partialhash, hash_string, HASH_CRC | HASH_MD5 | HASH_SHA1);
1183        run_hash(image->dev, partialhash, hash_string, HASH_CRC | HASH_MD5 | HASH_SHA1);
11841184
1185      image->hash = image_strdup(image->dev, hash_string);
1185        image->hash = image_strdup(image->dev, hash_string);
11861186
1187      /* now read the hash file */
1188      drv = image->dev->machine->gamedrv;
1189      do
1190      {
1191         rc = read_hash_config(drv->name, image);
1192         drv = mess_next_compatible_driver(drv);
1193      }
1194      while(rc && (drv != NULL));
1195   }
1196   return TRUE;
1187        /* now read the hash file */
1188        drv = image->dev->machine->gamedrv;
1189        do
1190        {
1191            rc = read_hash_config(drv->name, image);
1192            drv = mess_next_compatible_driver(drv);
1193        }
1194        while(rc && (drv != NULL));
1195    }
1196    return TRUE;
11971197}
11981198
11991199
r4910r4911
12101210
12111211int image_exists(const device_config *image)
12121212{
1213   return image_filename(image) != NULL;
1213    return image_filename(image) != NULL;
12141214}
12151215
12161216
r4910r4911
12211221
12221222int image_slotexists(const device_config *image)
12231223{
1224   return TRUE;
1224    return TRUE;
12251225}
12261226
12271227
r4910r4911
12321232
12331233const char *image_filename(const device_config *image)
12341234{
1235   image_slot_data *slot = find_image_slot(image);
1236   const char *name = astring_c(slot->name);
1237   return (name[0] != '\0') ? name : NULL;
1235    image_slot_data *slot = find_image_slot(image);
1236    const char *name = astring_c(slot->name);
1237    return (name[0] != '\0') ? name : NULL;
12381238}
12391239
12401240
r4910r4911
12451245
12461246const char *image_basename(const device_config *image)
12471247{
1248   return osd_basename((char *) image_filename(image));
1248    return osd_basename((char *) image_filename(image));
12491249}
12501250
12511251
r4910r4911
12561256
12571257const char *image_basename_noext(const device_config *image)
12581258{
1259   const char *s;
1260   char *ext;
1261   image_slot_data *slot = find_image_slot(image);
1259    const char *s;
1260    char *ext;
1261    image_slot_data *slot = find_image_slot(image);
12621262
1263   if (!slot->basename_noext)
1264   {
1265      s = image_basename(image);
1266      if (s)
1267      {
1268         slot->basename_noext = image_strdup(image, s);
1269         ext = strrchr(slot->basename_noext, '.');
1270         if (ext)
1271            *ext = '\0';
1272      }
1273   }
1274   return slot->basename_noext;
1263    if (!slot->basename_noext)
1264    {
1265        s = image_basename(image);
1266        if (s)
1267        {
1268            slot->basename_noext = image_strdup(image, s);
1269            ext = strrchr(slot->basename_noext, '.');
1270            if (ext)
1271                *ext = '\0';
1272        }
1273    }
1274    return slot->basename_noext;
12751275}
12761276
12771277
r4910r4911
12821282
12831283const char *image_filetype(const device_config *image)
12841284{
1285   const char *s;
1286   s = image_filename(image);
1287   if (s != NULL)
1288      s = strrchr(s, '.');
1289   return s ? s+1 : NULL;
1285    const char *s;
1286    s = image_filename(image);
1287    if (s != NULL)
1288        s = strrchr(s, '.');
1289    return s ? s+1 : NULL;
12901290}
12911291
12921292
r4910r4911
12971297
12981298const char *image_filedir(const device_config *image)
12991299{
1300   image_slot_data *slot = find_image_slot(image);
1301   return slot->dir;
1300    image_slot_data *slot = find_image_slot(image);
1301    return slot->dir;
13021302}
13031303
13041304
r4910r4911
13091309
13101310core_file *image_core_file(const device_config *image)
13111311{
1312   image_slot_data *slot = find_image_slot(image);
1313   return slot->file;
1312    image_slot_data *slot = find_image_slot(image);
1313    return slot->file;
13141314}
13151315
13161316
r4910r4911
13211321
13221322const char *image_typename_id(const device_config *image)
13231323{
1324   static char buffer[64];
1325   get_device_name(image, buffer, ARRAY_LENGTH(buffer));
1326   return buffer;
1324    static char buffer[64];
1325    get_device_name(image, buffer, ARRAY_LENGTH(buffer));
1326    return buffer;
13271327}
13281328
13291329
r4910r4911
13341334
13351335static void check_for_file(image_slot_data *image)
13361336{
1337   assert_always(image->file != NULL, "Illegal operation on unmounted image");
1337    assert_always(image->file != NULL, "Illegal operation on unmounted image");
13381338}
13391339
13401340
r4910r4911
13451345
13461346UINT64 image_length(const device_config *image)
13471347{
1348   image_slot_data *slot = find_image_slot(image);
1349   check_for_file(slot);
1350   return core_fsize(slot->file);
1348    image_slot_data *slot = find_image_slot(image);
1349    check_for_file(slot);
1350    return core_fsize(slot->file);
13511351}
13521352
13531353
r4910r4911
13581358
13591359const char *image_hash(const device_config *image)
13601360{
1361   image_slot_data *slot = find_image_slot(image);
1362   image_checkhash(slot);
1363   return slot->hash;
1361    image_slot_data *slot = find_image_slot(image);
1362    image_checkhash(slot);
1363    return slot->hash;
13641364}
13651365
13661366
r4910r4911
13711371
13721372UINT32 image_crc(const device_config *image)
13731373{
1374   const char *hash_string;
1375   UINT32 crc = 0;
1374    const char *hash_string;
1375    UINT32 crc = 0;
13761376
1377   hash_string = image_hash(image);
1378   if (hash_string != NULL)
1379      crc = hash_data_extract_crc32(hash_string);
1377    hash_string = image_hash(image);
1378    if (hash_string != NULL)
1379        crc = hash_data_extract_crc32(hash_string);
13801380
1381   return crc;
1381    return crc;
13821382}
13831383
13841384
r4910r4911
13891389
13901390int image_is_writable(const device_config *image)
13911391{
1392   image_slot_data *slot = find_image_slot(image);
1393   return slot->writeable;
1392    image_slot_data *slot = find_image_slot(image);
1393    return slot->writeable;
13941394}
13951395
13961396
r4910r4911
14011401
14021402int image_has_been_created(const device_config *image)
14031403{
1404   image_slot_data *slot = find_image_slot(image);
1405   return slot->created;
1404    image_slot_data *slot = find_image_slot(image);
1405    return slot->created;
14061406}
14071407
14081408
r4910r4911
14131413
14141414void image_make_readonly(const device_config *image)
14151415{
1416   image_slot_data *slot = find_image_slot(image);
1417   slot->writeable = 0;
1416    image_slot_data *slot = find_image_slot(image);
1417    slot->writeable = 0;
14181418}
14191419
14201420
r4910r4911
14251425
14261426UINT32 image_fread(const device_config *image, void *buffer, UINT32 length)
14271427{
1428   image_slot_data *slot = find_image_slot(image);
1429   check_for_file(slot);
1430   return core_fread(slot->file, buffer, length);
1428    image_slot_data *slot = find_image_slot(image);
1429    check_for_file(slot);
1430    return core_fread(slot->file, buffer, length);
14311431}
14321432
14331433
r4910r4911
14381438
14391439UINT32 image_fwrite(const device_config *image, const void *buffer, UINT32 length)
14401440{
1441   image_slot_data *slot = find_image_slot(image);
1442   check_for_file(slot);
1443   return core_fwrite(slot->file, buffer, length);
1441    image_slot_data *slot = find_image_slot(image);
1442    check_for_file(slot);
1443    return core_fwrite(slot->file, buffer, length);
14441444}
14451445
14461446
r4910r4911
14511451
14521452int image_fseek(const device_config *image, INT64 offset, int whence)
14531453{
1454   image_slot_data *slot = find_image_slot(image);
1455   check_for_file(slot);
1456   return core_fseek(slot->file, offset, whence);
1454    image_slot_data *slot = find_image_slot(image);
1455    check_for_file(slot);
1456    return core_fseek(slot->file, offset, whence);
14571457}
14581458
14591459
r4910r4911
14641464
14651465UINT64 image_ftell(const device_config *image)
14661466{
1467   image_slot_data *slot = find_image_slot(image);
1468   check_for_file(slot);
1469   return core_ftell(slot->file);
1467    image_slot_data *slot = find_image_slot(image);
1468    check_for_file(slot);
1469    return core_ftell(slot->file);
14701470}
14711471
14721472
r4910r4911
14771477
14781478int image_fgetc(const device_config *image)
14791479{
1480   char ch;
1481   if (image_fread(image, &ch, 1) != 1)
1482      ch = '\0';
1483   return ch;
1480    char ch;
1481    if (image_fread(image, &ch, 1) != 1)
1482        ch = '\0';
1483    return ch;
14841484}
14851485
14861486
14871487
14881488/*-------------------------------------------------
1489    image_fgets
1490-------------------------------------------------*/
1491
1492char *image_fgets(const device_config *image, char *buffer, UINT32 length)
1493{
1494    image_slot_data *slot = find_image_slot(image);
1495    check_for_file(slot);
1496    return core_fgets(buffer, length, slot->file);
1497}
1498
1499
1500
1501/*-------------------------------------------------
14891502    image_feof
14901503-------------------------------------------------*/
14911504
14921505int image_feof(const device_config *image)
14931506{
1494   image_slot_data *slot = find_image_slot(image);
1495   check_for_file(slot);
1496   return core_feof(slot->file);
1507    image_slot_data *slot = find_image_slot(image);
1508    check_for_file(slot);
1509    return core_feof(slot->file);
14971510}
14981511
14991512
r4910r4911
15041517
15051518void *image_ptr(const device_config *image)
15061519{
1507   image_slot_data *slot = find_image_slot(image);
1508   check_for_file(slot);
1509   return (void *) core_fbuffer(slot->file);
1520    image_slot_data *slot = find_image_slot(image);
1521    check_for_file(slot);
1522    return (void *) core_fbuffer(slot->file);
15101523}
15111524
15121525
r4910r4911
15171530
15181531/*-------------------------------------------------
15191532    try_change_working_directory - tries to change
1520   the working directory, but only if the directory
1521   actually exists
1533    the working directory, but only if the directory
1534    actually exists
15221535-------------------------------------------------*/
15231536
15241537static int try_change_working_directory(image_slot_data *image, const char *subdir)
15251538{
1526   osd_directory *directory;
1527   const osd_directory_entry *entry;
1528   int success = FALSE;
1529   int done = FALSE;
1539    osd_directory *directory;
1540    const osd_directory_entry *entry;
1541    int success = FALSE;
1542    int done = FALSE;
15301543
1531   directory = osd_opendir(astring_c(image->working_directory));
1532   if (directory != NULL)
1533   {
1534      while(!done && (entry = osd_readdir(directory)) != NULL)
1535      {
1536         if (!mame_stricmp(subdir, entry->name))
1537         {
1538            done = TRUE;
1539            success = entry->type == ENTTYPE_DIR;
1540         }
1541      }
1544    directory = osd_opendir(astring_c(image->working_directory));
1545    if (directory != NULL)
1546    {
1547        while(!done && (entry = osd_readdir(directory)) != NULL)
1548        {
1549            if (!mame_stricmp(subdir, entry->name))
1550            {
1551                done = TRUE;
1552                success = entry->type == ENTTYPE_DIR;
1553            }
1554        }
15421555
1543      osd_closedir(directory);
1544   }
1556        osd_closedir(directory);
1557    }
15451558
1546   /* did we successfully identify the directory? */
1547   if (success)
1548      zippath_combine(image->working_directory, astring_c(image->working_directory), subdir);
1559    /* did we successfully identify the directory? */
1560    if (success)
1561        zippath_combine(image->working_directory, astring_c(image->working_directory), subdir);
15491562
1550   return success;
1563    return success;
15511564}
15521565
15531566
15541567
15551568/*-------------------------------------------------
15561569    setup_working_directory - sets up the working
1557   directory according to a few defaults
1570    directory according to a few defaults
15581571-------------------------------------------------*/
15591572
15601573static void setup_working_directory(image_slot_data *image)
15611574{
1562   char mess_directory[1024];
1563   const game_driver *gamedrv;
1575    char mess_directory[1024];
1576    const game_driver *gamedrv;
15641577
1565   /* first set up the working directory to be the MESS directory */
1566   osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory));
1567   astring_cpyc(image->working_directory, mess_directory);
1578    /* first set up the working directory to be the MESS directory */
1579    osd_get_emulator_directory(mess_directory, ARRAY_LENGTH(mess_directory));
1580    astring_cpyc(image->working_directory, mess_directory);
15681581
1569   /* now try browsing down to "software" */
1570   if (try_change_working_directory(image, "software"))
1571   {
1572      /* now down to a directory for this computer */
1573      gamedrv = image->dev->machine->gamedrv;
1574      while(gamedrv && !try_change_working_directory(image, gamedrv->name))
1575      {
1576         gamedrv = mess_next_compatible_driver(gamedrv);
1577      }
1578   }
1582    /* now try browsing down to "software" */
1583    if (try_change_working_directory(image, "software"))
1584    {
1585        /* now down to a directory for this computer */
1586        gamedrv = image->dev->machine->gamedrv;
1587        while(gamedrv && !try_change_working_directory(image, gamedrv->name))
1588        {
1589            gamedrv = mess_next_compatible_driver(gamedrv);
1590        }
1591    }
15791592}
15801593
15811594
15821595
15831596/*-------------------------------------------------
15841597    image_working_directory - returns the working
1585   directory to use for this image; this is
1586   valid even if not mounted
1598    directory to use for this image; this is
1599    valid even if not mounted
15871600-------------------------------------------------*/
15881601
15891602const char *image_working_directory(const device_config *image)
15901603{
1591   image_slot_data *slot = find_image_slot(image);
1604    image_slot_data *slot = find_image_slot(image);
15921605
1593   /* check to see if we've never initialized the working directory */
1594   if (astring_len(slot->working_directory) == 0)
1595      setup_working_directory(slot);
1606    /* check to see if we've never initialized the working directory */
1607    if (astring_len(slot->working_directory) == 0)
1608        setup_working_directory(slot);
15961609
1597   return astring_c(slot->working_directory);
1610    return astring_c(slot->working_directory);
15981611}
15991612
16001613
16011614
16021615/*-------------------------------------------------
16031616    image_set_working_directory - sets the working
1604   directory to use for this image
1617    directory to use for this image
16051618-------------------------------------------------*/
16061619
16071620void image_set_working_directory(const device_config *image, const char *working_directory)
16081621{
1609   image_slot_data *slot = find_image_slot(image);
1610   astring_cpyc(slot->working_directory, (working_directory != NULL) ? working_directory : "");
1622    image_slot_data *slot = find_image_slot(image);
1623    astring_cpyc(slot->working_directory, (working_directory != NULL) ? working_directory : "");
16111624}
16121625
16131626
r4910r4911
16221635
16231636void *image_malloc(const device_config *image, size_t size)
16241637{
1625   return image_realloc(image, NULL, size);
1638    return image_realloc(image, NULL, size);
16261639}
16271640
16281641
16291642
16301643void *image_realloc(const device_config *image, void *ptr, size_t size)
16311644{
1632   image_slot_data *slot = find_image_slot(image);
1645    image_slot_data *slot = find_image_slot(image);
16331646
1634   /* sanity checks */
1635   assert(is_loaded(slot) || slot->is_loading);
1647    /* sanity checks */
1648    assert(is_loaded(slot) || slot->is_loading);
16361649
1637   return pool_realloc(slot->mempool, ptr, size);
1650    return pool_realloc(slot->mempool, ptr, size);
16381651}
16391652
16401653
16411654
16421655char *image_strdup(const device_config *image, const char *src)
16431656{
1644   image_slot_data *slot = find_image_slot(image);
1657    image_slot_data *slot = find_image_slot(image);
16451658
1646   /* sanity checks */
1647   assert(is_loaded(slot) || slot->is_loading);
1659    /* sanity checks */
1660    assert(is_loaded(slot) || slot->is_loading);
16481661
1649   return pool_strdup(slot->mempool, src);
1662    return pool_strdup(slot->mempool, src);
16501663}
16511664
16521665
16531666
16541667void image_freeptr(const device_config *image, void *ptr)
16551668{
1656   /* should really do something better here */
1657   image_realloc(image, ptr, 0);
1669    /* should really do something better here */
1670    image_realloc(image, ptr, 0);
16581671}
16591672
16601673
r4910r4911
16721685
16731686const char *image_longname(const device_config *device)
16741687{
1675   image_slot_data *slot = find_image_slot(device);
1676   image_checkhash(slot);
1677   return slot->longname;
1688    image_slot_data *slot = find_image_slot(device);
1689    image_checkhash(slot);
1690    return slot->longname;
16781691}
16791692
16801693
r4910r4911
16851698
16861699const char *image_manufacturer(const device_config *device)
16871700{
1688   image_slot_data *slot = find_image_slot(device);
1689   image_checkhash(slot);
1690   return slot->manufacturer;
1701    image_slot_data *slot = find_image_slot(device);
1702    image_checkhash(slot);
1703    return slot->manufacturer;
16911704}
16921705
16931706
r4910r4911
16981711
16991712const char *image_year(const device_config *device)
17001713{
1701   image_slot_data *slot = find_image_slot(device);
1702   image_checkhash(slot);
1703   return slot->year;
1714    image_slot_data *slot = find_image_slot(device);
1715    image_checkhash(slot);
1716    return slot->year;
17041717}
17051718
17061719
r4910r4911
17111724
17121725const char *image_playable(const device_config *device)
17131726{
1714   image_slot_data *slot = find_image_slot(device);
1715   image_checkhash(slot);
1716   return slot->playable;
1727    image_slot_data *slot = find_image_slot(device);
1728    image_checkhash(slot);
1729    return slot->playable;
17171730}
17181731
17191732
r4910r4911
17241737
17251738const char *image_pcb(const device_config *device)
17261739{
1727   image_slot_data *slot = find_image_slot(device);
1728   image_checkhash(slot);
1729   return slot->pcb;
1740    image_slot_data *slot = find_image_slot(device);
1741    image_checkhash(slot);
1742    return slot->pcb;
17301743}
17311744
17321745
r4910r4911
17371750
17381751const char *image_extrainfo(const device_config *device)
17391752{
1740   image_slot_data *slot = find_image_slot(device);
1741   image_checkhash(slot);
1742   return slot->extrainfo;
1753    image_slot_data *slot = find_image_slot(device);
1754    image_checkhash(slot);
1755    return slot->extrainfo;
17431756}
17441757
17451758
r4910r4911
17531766
17541767/*-------------------------------------------------
17551768    open_battery_file_by_name - opens the battery backed
1756   NVRAM file for an image
1769    NVRAM file for an image
17571770-------------------------------------------------*/
17581771
17591772static file_error open_battery_file_by_name(const char *filename, UINT32 openflags, mame_file **file)
17601773{
1761   file_error filerr;
1762   filerr = mame_fopen(SEARCHPATH_NVRAM, filename, openflags, file);
1763   return filerr;
1774    file_error filerr;
1775    filerr = mame_fopen(SEARCHPATH_NVRAM, filename, openflags, file);
1776    return filerr;
17641777}
17651778
17661779/*-------------------------------------------------
17671780    image_battery_load_by_name - retrieves the battery
1768   backed RAM for an image. A filename may be supplied
1769   to the function.
1781    backed RAM for an image. A filename may be supplied
1782    to the function.
17701783-------------------------------------------------*/
17711784
17721785void image_battery_load_by_name(const char *filename, void *buffer, int length)
17731786{
1774   file_error filerr;
1775   mame_file *file;
1776   int bytes_read = 0;
1787    file_error filerr;
1788    mame_file *file;
1789    int bytes_read = 0;
17771790
1778   assert_always(buffer && (length > 0), "Must specify sensical buffer/length");
1791    assert_always(buffer && (length > 0), "Must specify sensical buffer/length");
17791792
1780   /* try to open the battery file and read it in, if possible */
1781   filerr = open_battery_file_by_name(filename, OPEN_FLAG_READ, &file);
1782   if (filerr == FILERR_NONE)
1783   {
1784      bytes_read = mame_fread(file, buffer, length);
1785      mame_fclose(file);
1786   }
1793    /* try to open the battery file and read it in, if possible */
1794    filerr = open_battery_file_by_name(filename, OPEN_FLAG_READ, &file);
1795    if (filerr == FILERR_NONE)
1796    {
1797        bytes_read = mame_fread(file, buffer, length);
1798        mame_fclose(file);
1799    }
17871800
1788   /* fill remaining bytes (if necessary) */
1789   memset(((char *) buffer) + bytes_read, '\0', length - bytes_read);
1801    /* fill remaining bytes (if necessary) */
1802    memset(((char *) buffer) + bytes_read, '\0', length - bytes_read);
17901803}
17911804
17921805
17931806/*-------------------------------------------------
17941807    image_battery_load - retrieves the battery
1795   backed RAM for an image. The file name is
1796   created from the machine driver name and the
1797   image name.
1808    backed RAM for an image. The file name is
1809    created from the machine driver name and the
1810    image name.
17981811-------------------------------------------------*/
17991812
18001813void image_battery_load(const device_config *image, void *buffer, int length)
18011814{
1802   char *basename_noext;
1803   astring *fname;
1815    char *basename_noext;
1816    astring *fname;
18041817
1805   basename_noext = strip_extension(image_basename(image));
1806   if (!basename_noext)
1807      fatalerror("FILERR_OUT_OF_MEMORY");
1818    basename_noext = strip_extension(image_basename(image));
1819    if (!basename_noext)
1820        fatalerror("FILERR_OUT_OF_MEMORY");
18081821
1809   fname = astring_assemble_4(astring_alloc(), image->machine->gamedrv->name, PATH_SEPARATOR, basename_noext, ".nv");
1822    fname = astring_assemble_4(astring_alloc(), image->machine->gamedrv->name, PATH_SEPARATOR, basename_noext, ".nv");
18101823
1811   image_battery_load_by_name(astring_c(fname), buffer, length);
1812   astring_free(fname);
1813   free(basename_noext);
1824    image_battery_load_by_name(astring_c(fname), buffer, length);
1825    astring_free(fname);
1826    free(basename_noext);
18141827}
18151828
18161829
18171830/*-------------------------------------------------
18181831    image_battery_save_by_name - stores the battery
1819   backed RAM for an image. A filename may be supplied
1820   to the function.
1832    backed RAM for an image. A filename may be supplied
1833    to the function.
18211834-------------------------------------------------*/
18221835void image_battery_save_by_name(const char *filename, const void *buffer, int length)
18231836{
1824   file_error filerr;
1825   mame_file *file;
1837    file_error filerr;
1838    mame_file *file;
18261839
1827   assert_always(buffer && (length > 0), "Must specify sensical buffer/length");
1840    assert_always(buffer && (length > 0), "Must specify sensical buffer/length");
18281841
1829   /* try to open the battery file and write it out, if possible */
1830   filerr = open_battery_file_by_name(filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
1831   if (filerr == FILERR_NONE)
1832   {
1833      mame_fwrite(file, buffer, length);
1834      mame_fclose(file);
1835   }
1842    /* try to open the battery file and write it out, if possible */
1843    filerr = open_battery_file_by_name(filename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS, &file);
1844    if (filerr == FILERR_NONE)
1845    {
1846        mame_fwrite(file, buffer, length);
1847        mame_fclose(file);
1848    }
18361849}
18371850
18381851/*-------------------------------------------------
18391852    image_battery_save - stores the battery
1840   backed RAM for an image. The file name is
1841   created from the machine driver name and the
1842   image name.
1853    backed RAM for an image. The file name is
1854    created from the machine driver name and the
1855    image name.
18431856-------------------------------------------------*/
18441857
18451858void image_battery_save(const device_config *image, const void *buffer, int length)
18461859{
1847   astring *fname;
1848   char *basename_noext;
1860    astring *fname;
1861    char *basename_noext;
18491862
1850   basename_noext = strip_extension(image_basename(image));
1851   if (!basename_noext)
1852      fatalerror("FILERR_OUT_OF_MEMORY");
1863    basename_noext = strip_extension(image_basename(image));
1864    if (!basename_noext)
1865        fatalerror("FILERR_OUT_OF_MEMORY");
18531866
1854   fname = astring_assemble_4(astring_alloc(), image->machine->gamedrv->name, PATH_SEPARATOR, basename_noext, ".nv");
1867    fname = astring_assemble_4(astring_alloc(), image->machine->gamedrv->name, PATH_SEPARATOR, basename_noext, ".nv");
18551868
1856   image_battery_save_by_name(astring_c(fname), buffer, length);
1857   astring_free(fname);
1858   free(basename_noext);
1869    image_battery_save_by_name(astring_c(fname), buffer, length);
1870    astring_free(fname);
1871    free(basename_noext);
18591872}
18601873
18611874
r4910r4911
18681881
18691882int image_absolute_index(const device_config *image)
18701883{
1871   image_slot_data *slot = find_image_slot(image);
1872   return slot - image->machine->images_data->slots;
1884    image_slot_data *slot = find_image_slot(image);
1885    return slot - image->machine->images_data->slots;
18731886}
18741887
18751888
18761889
18771890const device_config *image_from_absolute_index(running_machine *machine, int absolute_index)
18781891{
1879   return machine->images_data->slots[absolute_index].dev;
1892    return machine->images_data->slots[absolute_index].dev;
18801893}
src/mess/image.h
r4910r4911
11/****************************************************************************
22
3   image.h
3    image.h
44
5   Code for handling devices/software images
5    Code for handling devices/software images
66
77****************************************************************************/
88
r4910r4911
2222    CONSTANTS
2323***************************************************************************/
2424
25#define DEVINFO_CREATE_OPTMAX   32
25#define DEVINFO_CREATE_OPTMAX   32
2626
2727
2828
r4910r4911
4141
4242typedef enum
4343{
44   /* List of all supported devices.  Refer to the device by these names only */
45   IO_UNKNOWN,
46   IO_CARTSLOT,   /*  1 - Cartridge Port, as found on most console and on some computers */
47   IO_FLOPPY,      /*  2 - Floppy Disk unit */
48   IO_HARDDISK,   /*  3 - Hard Disk unit */
49   IO_CYLINDER,   /*  4 - Magnetically-Coated Cylinder */
50   IO_CASSETTE,   /*  5 - Cassette Recorder (common on early home computers) */
51   IO_PUNCHCARD,   /*  6 - Card Puncher/Reader */
52   IO_PUNCHTAPE,   /*  7 - Tape Puncher/Reader (reels instead of punchcards) */
53   IO_PRINTER,      /*  8 - Printer device */
54   IO_SERIAL,      /*  9 - Generic Serial Port */
55   IO_PARALLEL,    /* 10 - Generic Parallel Port */
56   IO_SNAPSHOT,   /* 11 - Complete 'snapshot' of the state of the computer */
57   IO_QUICKLOAD,   /* 12 - Allow to load program/data into memory, without matching any actual device */
58   IO_MEMCARD,      /* 13 - Memory card */
59   IO_CDROM,      /* 14 - optical CD-ROM disc */
60   IO_COUNT      /* 15 - Total Number of IO_devices for searching */
44    /* List of all supported devices.  Refer to the device by these names only */
45    IO_UNKNOWN,
46    IO_CARTSLOT,    /*  1 - Cartridge Port, as found on most console and on some computers */
47    IO_FLOPPY,      /*  2 - Floppy Disk unit */
48    IO_HARDDISK,    /*  3 - Hard Disk unit */
49    IO_CYLINDER,    /*  4 - Magnetically-Coated Cylinder */
50    IO_CASSETTE,    /*  5 - Cassette Recorder (common on early home computers) */
51    IO_PUNCHCARD,   /*  6 - Card Puncher/Reader */
52    IO_PUNCHTAPE,   /*  7 - Tape Puncher/Reader (reels instead of punchcards) */
53    IO_PRINTER,     /*  8 - Printer device */
54    IO_SERIAL,      /*  9 - Generic Serial Port */
55    IO_PARALLEL,    /* 10 - Generic Parallel Port */
56    IO_SNAPSHOT,    /* 11 - Complete 'snapshot' of the state of the computer */
57    IO_QUICKLOAD,   /* 12 - Allow to load program/data into memory, without matching any actual device */
58    IO_MEMCARD,     /* 13 - Memory card */
59    IO_CDROM,       /* 14 - optical CD-ROM disc */
60    IO_COUNT        /* 15 - Total Number of IO_devices for searching */
6161} iodevice_t;
6262
6363
6464
6565typedef enum
6666{
67   IMAGE_ERROR_SUCCESS,
68   IMAGE_ERROR_INTERNAL,
69   IMAGE_ERROR_UNSUPPORTED,
70   IMAGE_ERROR_OUTOFMEMORY,
71   IMAGE_ERROR_FILENOTFOUND,
72   IMAGE_ERROR_INVALIDIMAGE,
73   IMAGE_ERROR_ALREADYOPEN,
74   IMAGE_ERROR_UNSPECIFIED
67    IMAGE_ERROR_SUCCESS,
68    IMAGE_ERROR_INTERNAL,
69    IMAGE_ERROR_UNSUPPORTED,
70    IMAGE_ERROR_OUTOFMEMORY,
71    IMAGE_ERROR_FILENOTFOUND,
72    IMAGE_ERROR_INVALIDIMAGE,
73    IMAGE_ERROR_ALREADYOPEN,
74    IMAGE_ERROR_UNSPECIFIED
7575} image_error_t;
7676
7777typedef struct _image_device_info image_device_info;
7878struct _image_device_info
7979{
80   iodevice_t type : 8;
81   unsigned int readable : 1;
82   unsigned int writeable : 1;
83   unsigned int creatable : 1;
84   unsigned int must_be_loaded : 1;
85   unsigned int reset_on_load : 1;
86   unsigned int has_partial_hash : 1;
87   char name[62];
88   char file_extensions[32];
89   char instance_name[32];
90   char brief_instance_name[16];
80    iodevice_t type : 8;
81    unsigned int readable : 1;
82    unsigned int writeable : 1;
83    unsigned int creatable : 1;
84    unsigned int must_be_loaded : 1;
85    unsigned int reset_on_load : 1;
86    unsigned int has_partial_hash : 1;
87    char name[62];
88    char file_extensions[32];
89    char instance_name[32];
90    char brief_instance_name[16];
9191};
9292
9393typedef struct _image_device_format image_device_format;
9494struct _image_device_format
9595{
96   image_device_format *next;
97   int index;
98   const char *name;
99   const char *description;
100   const char *extensions;
101   const char *optspec;
96    image_device_format *next;
97    int index;
98    const char *name;
99    const char *description;
100    const char *extensions;
101    const char *optspec;
102102};
103103
104104struct _images_private;
r4910r4911
108108/* state constants specific for mountable images */
109109enum
110110{
111   /* --- the following bits of info are returned as integers --- */
112   DEVINFO_INT_IMAGE_FIRST = DEVINFO_INT_FIRST + 0x7000,
113   DEVINFO_INT_IMAGE_TYPE,
114   DEVINFO_INT_IMAGE_READABLE,
115   DEVINFO_INT_IMAGE_WRITEABLE,
116   DEVINFO_INT_IMAGE_CREATABLE,
117   DEVINFO_INT_IMAGE_MUST_BE_LOADED,
118   DEVINFO_INT_IMAGE_RESET_ON_LOAD,
119   DEVINFO_INT_IMAGE_CREATE_OPTCOUNT,
120   DEVINFO_INT_IMAGE_LAST = DEVINFO_INT_IMAGE_FIRST + 0x0fff,
111    /* --- the following bits of info are returned as integers --- */
112    DEVINFO_INT_IMAGE_FIRST = DEVINFO_INT_FIRST + 0x7000,
113    DEVINFO_INT_IMAGE_TYPE,
114    DEVINFO_INT_IMAGE_READABLE,
115    DEVINFO_INT_IMAGE_WRITEABLE,
116    DEVINFO_INT_IMAGE_CREATABLE,
117    DEVINFO_INT_IMAGE_MUST_BE_LOADED,
118    DEVINFO_INT_IMAGE_RESET_ON_LOAD,
119    DEVINFO_INT_IMAGE_CREATE_OPTCOUNT,
120    DEVINFO_INT_IMAGE_LAST = DEVINFO_INT_IMAGE_FIRST + 0x0fff,
121121
122   /* --- the following bits of info are returned as pointers --- */
123   DEVINFO_PTR_IMAGE_FIRST = DEVINFO_PTR_FIRST + 0x7000,
124   DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE,
125   DEVINFO_PTR_IMAGE_CREATE_OPTSPEC,
122    /* --- the following bits of info are returned as pointers --- */
123    DEVINFO_PTR_IMAGE_FIRST = DEVINFO_PTR_FIRST + 0x7000,
124    DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE,
125    DEVINFO_PTR_IMAGE_CREATE_OPTSPEC,
126126
127   /* --- the following bits of info are returned as pointers to functions --- */
128   DEVINFO_FCT_IMAGE_FIRST = DEVINFO_FCT_FIRST + 0x7000,
129   DEVINFO_FCT_IMAGE_LOAD,                              /* R/O: device_image_load_func */
130   DEVINFO_FCT_IMAGE_CREATE,                           /* R/O: device_image_create_func */
131   DEVINFO_FCT_IMAGE_UNLOAD,                           /* R/O: device_image_unload_func */
132   DEVINFO_FCT_IMAGE_VERIFY,                           /* R/O: device_image_verify_func */
133   DEVINFO_FCT_DISPLAY,                              /* R/O: device_display_func */
134   DEVINFO_FCT_IMAGE_PARTIAL_HASH,                        /* R/O: device_image_partialhash_func */
135   DEVINFO_FCT_GET_NAME,                              /* R/O: device_get_name_func */
136   DEVINFO_FCT_GET_IMAGE_DEVICES,                        /* R/O: device_get_image_devices_func */
137   DEVINFO_FCT_IMAGE_LAST = DEVINFO_FCT_FIRST + 0x0fff,
127    /* --- the following bits of info are returned as pointers to functions --- */
128    DEVINFO_FCT_IMAGE_FIRST = DEVINFO_FCT_FIRST + 0x7000,
129    DEVINFO_FCT_IMAGE_LOAD,                                     /* R/O: device_image_load_func */
130    DEVINFO_FCT_IMAGE_CREATE,                                   /* R/O: device_image_create_func */
131    DEVINFO_FCT_IMAGE_UNLOAD,                                   /* R/O: device_image_unload_func */
132    DEVINFO_FCT_IMAGE_VERIFY,                                   /* R/O: device_image_verify_func */
133    DEVINFO_FCT_DISPLAY,                                        /* R/O: device_display_func */
134    DEVINFO_FCT_IMAGE_PARTIAL_HASH,                             /* R/O: device_image_partialhash_func */
135    DEVINFO_FCT_GET_NAME,                                       /* R/O: device_get_name_func */
136    DEVINFO_FCT_GET_IMAGE_DEVICES,                              /* R/O: device_get_image_devices_func */
137    DEVINFO_FCT_IMAGE_LAST = DEVINFO_FCT_FIRST + 0x0fff,
138138
139   /* --- the following bits of info are returned as NULL-terminated strings --- */
140   DEVINFO_STR_IMAGE_FIRST = DEVINFO_STR_FIRST + 0x7000,
141   DEVINFO_STR_IMAGE_FILE_EXTENSIONS,
142   DEVINFO_STR_IMAGE_INSTANCE_NAME,
143   DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME,
144   DEVINFO_STR_IMAGE_CREATE_OPTNAME,
145   DEVINFO_STR_IMAGE_CREATE_OPTDESC = DEVINFO_STR_IMAGE_CREATE_OPTNAME + DEVINFO_CREATE_OPTMAX,
146   DEVINFO_STR_IMAGE_CREATE_OPTEXTS = DEVINFO_STR_IMAGE_CREATE_OPTDESC + DEVINFO_CREATE_OPTMAX,
147   DEVINFO_STR_IMAGE_LAST = DEVINFO_STR_IMAGE_FIRST + 0x0fff
139    /* --- the following bits of info are returned as NULL-terminated strings --- */
140    DEVINFO_STR_IMAGE_FIRST = DEVINFO_STR_FIRST + 0x7000,
141    DEVINFO_STR_IMAGE_FILE_EXTENSIONS,
142    DEVINFO_STR_IMAGE_INSTANCE_NAME,
143    DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME,
144    DEVINFO_STR_IMAGE_CREATE_OPTNAME,
145    DEVINFO_STR_IMAGE_CREATE_OPTDESC = DEVINFO_STR_IMAGE_CREATE_OPTNAME + DEVINFO_CREATE_OPTMAX,
146    DEVINFO_STR_IMAGE_CREATE_OPTEXTS = DEVINFO_STR_IMAGE_CREATE_OPTDESC + DEVINFO_CREATE_OPTMAX,
147    DEVINFO_STR_IMAGE_LAST = DEVINFO_STR_IMAGE_FIRST + 0x0fff
148148};
149149
150150
r4910r4911
182182
183183/* compute a hash, using this device's partial hash if appropriate */
184184void image_device_compute_hash(char *dest, const device_config *device,
185   const void *data, size_t length, unsigned int functions);
185    const void *data, size_t length, unsigned int functions);
186186
187187/* ----- creation formats ----- */
188188
r4910r4911
258258int image_fseek(const device_config *image, INT64 offset, int whence);
259259UINT64 image_ftell(const device_config *image);
260260int image_fgetc(const device_config *image);
261char *image_fgets(const device_config *image, char *s, UINT32 length);
261262int image_feof(const device_config *image);
262263
263264void *image_ptr(const device_config *image);
r4910r4911
324325  Macros for declaring device callbacks
325326****************************************************************************/
326327
327#define DEVICE_IMAGE_LOAD_NAME(name)      device_load_##name
328#define DEVICE_IMAGE_LOAD(name)            int DEVICE_IMAGE_LOAD_NAME(name)(const device_config *image)
328#define DEVICE_IMAGE_LOAD_NAME(name)        device_load_##name
329#define DEVICE_IMAGE_LOAD(name)             int DEVICE_IMAGE_LOAD_NAME(name)(const device_config *image)
329330
330#define DEVICE_IMAGE_CREATE_NAME(name)      device_create_##name
331#define DEVICE_IMAGE_CREATE(name)         int DEVICE_IMAGE_CREATE_NAME(name)(const device_config *image, int create_format, option_resolution *create_args)
331#define DEVICE_IMAGE_CREATE_NAME(name)      device_create_##name
332#define DEVICE_IMAGE_CREATE(name)           int DEVICE_IMAGE_CREATE_NAME(name)(const device_config *image, int create_format, option_resolution *create_args)
332333
333#define DEVICE_IMAGE_UNLOAD_NAME(name)      device_unload_##name
334#define DEVICE_IMAGE_UNLOAD(name)         void DEVICE_IMAGE_UNLOAD_NAME(name)(const device_config *image)
334#define DEVICE_IMAGE_UNLOAD_NAME(name)      device_unload_##name
335#define DEVICE_IMAGE_UNLOAD(name)           void DEVICE_IMAGE_UNLOAD_NAME(name)(const device_config *image)
335336
336#define DEVICE_GET_NAME_NAME(name)         device_get_name_##name
337#define DEVICE_GET_NAME(name)            const char *DEVICE_GET_NAME_NAME(name)(const device_config *device, char *buffer, size_t buffer_length)
337#define DEVICE_GET_NAME_NAME(name)          device_get_name_##name
338#define DEVICE_GET_NAME(name)               const char *DEVICE_GET_NAME_NAME(name)(const device_config *device, char *buffer, size_t buffer_length)
338339
339#define DEVICE_GET_IMAGE_DEVICES_NAME(name)   device_get_image_devices_##name
340#define DEVICE_GET_IMAGE_DEVICES(name)      void DEVICE_GET_IMAGE_DEVICES_NAME(name)(const device_config *device, device_config **listheadptr)
340#define DEVICE_GET_IMAGE_DEVICES_NAME(name) device_get_image_devices_##name
341#define DEVICE_GET_IMAGE_DEVICES(name)      void DEVICE_GET_IMAGE_DEVICES_NAME(name)(const device_config *device, device_config **listheadptr)
341342
342343#endif /* __IMAGE_H__ */
src/mess/messdriv.c
r4910r4911
3636
3737/****************CONSOLES****************************************************/
3838
39   /* 3DO */
40   DRIVER( 3do )      /* 3DO consoles                              */
41   DRIVER( 3do_pal )
39    /* 3DO */
40    DRIVER( 3do )       /* 3DO consoles                                     */
41    DRIVER( 3do_pal )
4242
43   /* ATARI */
44   DRIVER( a2600 )      /* Atari 2600                              */
45   DRIVER( a2600p )   /* Atari 2600 PAL                           */
46   DRIVER( a5200 )      /* Atari 5200                              */
47   DRIVER( a7800 )      /* Atari 7800 NTSC                           */
48   DRIVER( a7800p )   /* Atari 7800 PAL                           */
49   DRIVER( lynx )      /* Atari Lynx Handheld                        */
50   DRIVER( lynx2 )      /* Atari Lynx II Handheld redesigned, no additions   */
51   DRIVER( jaguar )   /* Atari Jaguar                              */
52   DRIVER( jaguarcd )   /* Atari Jaguar CD                           */
43    /* ATARI */
44    DRIVER( a2600 )     /* Atari 2600                                       */
45    DRIVER( a2600p )    /* Atari 2600 PAL                                   */
46    DRIVER( a5200 )     /* Atari 5200                                       */
47    DRIVER( a7800 )     /* Atari 7800 NTSC                                  */
48    DRIVER( a7800p )    /* Atari 7800 PAL                                   */
49    DRIVER( lynx )      /* Atari Lynx Handheld                              */
50    DRIVER( lynx2 )     /* Atari Lynx II Handheld redesigned, no additions  */
51    DRIVER( jaguar )    /* Atari Jaguar                                     */
52    DRIVER( jaguarcd )  /* Atari Jaguar CD                                  */
5353
54   /* NINTENDO */
55   DRIVER( nes )      /* Nintendo Entertainment System               */
56   DRIVER( nespal )   /* Nintendo Entertainment System               */
57   DRIVER( m82 )      /* Nintendo M82 Display Unit                  */
58   DRIVER( famicom )
59   DRIVER( famitwin )   /* Sharp Famicom Twin System                  */
60   DRIVER( drpcjr )   /* Bung Doctor PC Jr                        */
61   DRIVER( dendy )      /* Dendy Classic russian famiclone               */
62   DRIVER( gameboy )   /* Nintendo Game Boy Handheld                  */
63   DRIVER( supergb )   /* Nintendo Super Game Boy SNES Cartridge         */
64   DRIVER( gbpocket )   /* Nintendo Game Boy Pocket Handheld            */
65   DRIVER( gblight )   /* Nintendo Game Boy Light Handheld            */
66   DRIVER( gbcolor )   /* Nintendo Game Boy Color Handheld               */
67   DRIVER( snes )      /* Nintendo Super Nintendo NTSC                  */
68   DRIVER( snespal )   /* Nintendo Super Nintendo PAL                  */
69   DRIVER( sfcbox )   /* Nintendo Super Famicom Box                  */
70   DRIVER( n64 )      /* Nintendo N64                              */
71   DRIVER( pokemini )   /* Nintendo Pokemon Mini                     */
54    /* NINTENDO */
55    DRIVER( nes )       /* Nintendo Entertainment System                    */
56    DRIVER( nespal )    /* Nintendo Entertainment System                    */
57    DRIVER( m82 )       /* Nintendo M82 Display Unit                        */
58    DRIVER( famicom )
59    DRIVER( famitwin )  /* Sharp Famicom Twin System                        */
60    DRIVER( drpcjr )    /* Bung Doctor PC Jr                                */
61    DRIVER( dendy )     /* Dendy Classic russian famiclone                  */
62    DRIVER( gameboy )   /* Nintendo Game Boy Handheld                       */
63    DRIVER( supergb )   /* Nintendo Super Game Boy SNES Cartridge           */
64    DRIVER( gbpocket )  /* Nintendo Game Boy Pocket Handheld                */
65    DRIVER( gblight )   /* Nintendo Game Boy Light Handheld             */
66    DRIVER( gbcolor )   /* Nintendo Game Boy Color Handheld                 */
67    DRIVER( snes )      /* Nintendo Super Nintendo NTSC                     */
68    DRIVER( snespal )   /* Nintendo Super Nintendo PAL                      */
69    DRIVER( sfcbox )    /* Nintendo Super Famicom Box                       */
70    DRIVER( n64 )       /* Nintendo N64                                     */
71    DRIVER( pokemini )  /* Nintendo Pokemon Mini                            */
7272
73   DRIVER( megaduck )   /* Megaduck                                 */
73    DRIVER( megaduck )  /* Megaduck                                         */
7474
75   /* SEGA */
76   DRIVER( sg1000 )   /* Sega SG-1000 (Japan)                        */
77   DRIVER( sg1000m2 )   /* Sega SG-1000 Mark II (Japan)                  */
78   DRIVER( sc3000 )   /* Sega SC-3000 (Japan)                        */
79   DRIVER( sc3000h )   /* Sega SC-3000H (Japan)                     */
80   DRIVER( sf7000 )   /* Sega SC-3000 w/ SF-7000 (Japan)               */
81//   DRIVER( omv1000 )   /* Tsukuda Original Othello Multivision   FG-1000      */
82//   DRIVER( omv2000 )   /* Tsukuda Original Othello Multivision   FG-2000      */
75    /* SEGA */
76    DRIVER( sg1000 )    /* Sega SG-1000 (Japan)                             */
77    DRIVER( sg1000m2 )  /* Sega SG-1000 Mark II (Japan)                     */
78    DRIVER( sc3000 )    /* Sega SC-3000 (Japan)                             */
79    DRIVER( sc3000h )   /* Sega SC-3000H (Japan)                            */
80    DRIVER( sf7000 )    /* Sega SC-3000 w/ SF-7000 (Japan)                  */
81//  DRIVER( omv1000 )   /* Tsukuda Original Othello Multivision FG-1000     */
82//  DRIVER( omv2000 )   /* Tsukuda Original Othello Multivision FG-2000     */
8383
84   DRIVER( gamegear )   /* Sega GameGear                           */
85   DRIVER( gamegeaj )   /* Sega GameGear (Japan)                     */
86   DRIVER( sms )      /* Sega Master System II (NTSC)                  */
87   DRIVER( sms1 )      /* Sega Master System I (NTSC)                  */
88   DRIVER( sms1pal )   /* Sega Master System I (PAL)                  */
89   DRIVER( smspal )   /* Sega Master System II (PAL)                  */
90   DRIVER( smsj )      /* Sega Master System (Japan) with FM Chip         */
91   DRIVER( sg1000m3 )   /* Sega SG-1000 Mark III (Japan)               */
92   DRIVER( sms2kr )   /* Samsung Gam*Boy II (Korea)                  */
93   DRIVER( smssdisp )   /* Sega Master System Store Display Unit         */
84    DRIVER( gamegear )  /* Sega GameGear                                    */
85    DRIVER( gamegeaj )  /* Sega GameGear (Japan)                            */
86    DRIVER( sms )       /* Sega Master System II (NTSC)                     */
87    DRIVER( sms1 )      /* Sega Master System I (NTSC)                      */
88    DRIVER( sms1pal )   /* Sega Master System I (PAL)                       */
89    DRIVER( smspal )    /* Sega Master System II (PAL)                      */
90    DRIVER( smsj )      /* Sega Master System (Japan) with FM Chip          */
91    DRIVER( sg1000m3 )  /* Sega SG-1000 Mark III (Japan)                    */
92    DRIVER( sms2kr )    /* Samsung Gam*Boy II (Korea)                       */
93    DRIVER( smssdisp )  /* Sega Master System Store Display Unit            */
9494
95   DRIVER( megadrij )   /* 1988 Sega Mega Drive (Japan)                  */
96   DRIVER( genesis )   /* 1989 Sega Genesis (USA)                     */
97   DRIVER( gensvp )   /* 1993 Sega Genesis (USA w/SVP chip)            */
98   DRIVER( megadriv )   /* 1990 Sega Mega Drive (Europe)               */
99   DRIVER( pico )      /* 1994 Sega Pico (Europe)                     */
100   DRIVER( picou )      /* 1994 Sega Pico (USA)                        */
101   DRIVER( picoj )      /* 1993 Sega Pico (Japan)                     */
102   DRIVER( megacd )   /* 1993 Sega Mega-CD (Europe)                  */
103   DRIVER( megacdj )   /* 1991 Sega Mega-CD (Japan)                  */
104   DRIVER( segacd )   /* 1992 Sega Sega CD (USA)                     */
105   DRIVER( 32x )      /* 1994 Sega 32X (USA)                        */
106   DRIVER( 32x_scd )   /* 1994 Sega Sega CD (USA w/32X addon)            */
95    DRIVER( megadrij )  /* 1988 Sega Mega Drive (Japan)                     */
96    DRIVER( genesis )   /* 1989 Sega Genesis (USA)                          */
97    DRIVER( gensvp )    /* 1993 Sega Genesis (USA w/SVP chip)               */
98    DRIVER( megadriv )  /* 1990 Sega Mega Drive (Europe)                    */
99    DRIVER( pico )      /* 1994 Sega Pico (Europe)                          */
100    DRIVER( picou )     /* 1994 Sega Pico (USA)                             */
101    DRIVER( picoj )     /* 1993 Sega Pico (Japan)                           */
102    DRIVER( megacd )    /* 1993 Sega Mega-CD (Europe)                       */
103    DRIVER( megacdj )   /* 1991 Sega Mega-CD (Japan)                        */
104    DRIVER( segacd )    /* 1992 Sega Sega CD (USA)                          */
105    DRIVER( 32x )       /* 1994 Sega 32X (USA)                              */
106    DRIVER( 32x_scd )   /* 1994 Sega Sega CD (USA w/32X addon)              */
107107
108   DRIVER( saturnjp )   /* 1994 Sega Saturn (Japan)                     */
109   DRIVER( saturn )   /* 1995 Sega Saturn (USA)                     */
110   DRIVER( saturneu )   /* 1995 Sega Saturn (Europe)                  */
111   DRIVER( vsaturn )   /* JVC V-Saturn                              */
112   DRIVER( hisaturn )   /* Hitachi HiSaturn                           */
108    DRIVER( saturnjp )  /* 1994 Sega Saturn (Japan)                         */
109    DRIVER( saturn )    /* 1995 Sega Saturn (USA)                           */
110    DRIVER( saturneu )  /* 1995 Sega Saturn (Europe)                        */
111    DRIVER( vsaturn )   /* JVC V-Saturn                                     */
112    DRIVER( hisaturn )  /* Hitachi HiSaturn                                 */
113113
114   DRIVER( dcjp )      /* 1998 Sega Dreamcast (Japan) */
115   DRIVER( dc )      /* 1999 Sega Dreamcast (USA) */
116   DRIVER( dceu )      /* 1999 Sega Dreamcast (Europe) */
117   DRIVER( dcdev )      /* 1998 Sega HKT-0120 Sega Dreamcast Development Box */
114    DRIVER( dcjp )      /* 1998 Sega Dreamcast (Japan) */
115    DRIVER( dc )        /* 1999 Sega Dreamcast (USA) */
116    DRIVER( dceu )      /* 1999 Sega Dreamcast (Europe) */
117    DRIVER( dcdev )     /* 1998 Sega HKT-0120 Sega Dreamcast Development Box */
118118
119   /* Sony */
120   DRIVER( psj )      /* 1994 Sony PlayStation (Japan)               */
121   DRIVER( psu )      /* 1995 Sony PlayStation (USA)                  */
122   DRIVER( pse )      /* 1995 Sony PlayStation (Europe)               */
123   DRIVER( psa )      /* 1995 Sony PlayStation (Asia-Pacific)            */
124   DRIVER( pockstat )   /* 1999 Sony PocketStation                     */
119    /* Sony */
120    DRIVER( psj )       /* 1994 Sony PlayStation (Japan)                    */
121    DRIVER( psu )       /* 1995 Sony PlayStation (USA)                      */
122    DRIVER( pse )       /* 1995 Sony PlayStation (Europe)                   */
123    DRIVER( psa )       /* 1995 Sony PlayStation (Asia-Pacific)             */
124    DRIVER( pockstat )  /* 1999 Sony PocketStation                          */
125125
126   /* BALLY */
127   DRIVER( astrocde )   /* Bally Astrocade                           */
128   DRIVER( astrocdw )   /* Bally Astrocade (white case)                  */
126    /* BALLY */
127    DRIVER( astrocde )  /* Bally Astrocade                                  */
128    DRIVER( astrocdw )  /* Bally Astrocade (white case)                     */
129129
130   /* RCA */
131   DRIVER( vip )      /* 1977 Cosmac VIP VP-711                     */
132   DRIVER( vp111 )      /* 1977 Cosmac VIP VP-111                     */
133   DRIVER( studio2 )   /* 1977 Studio II                           */
134   DRIVER( visicom )
135//   DRIVER( mpt02s )
136//   DRIVER( mpt02h )
137//   DRIVER( mtc9016 )   /* 1978 Mustang 9016 Telespiel Computer            */
138//   DRIVER( shmc1200 )
130    /* RCA */
131    DRIVER( vip )       /* 1977 Cosmac VIP VP-711                           */
132    DRIVER( vp111 )     /* 1977 Cosmac VIP VP-111                           */
133    DRIVER( studio2 )   /* 1977 Studio II                                   */
134    DRIVER( visicom )
135//  DRIVER( mpt02s )
136//  DRIVER( mpt02h )
137//  DRIVER( mtc9016 )   /* 1978 Mustang 9016 Telespiel Computer             */
138//  DRIVER( shmc1200 )
139139
140   /* FAIRCHILD */
141   DRIVER( channelf )   /* Fairchild Channel F VES - 1976               */
142   DRIVER( sabavdpl )  /* SABA Videoplay - 1977 (PAL)                      */
143   DRIVER( luxorves )  /* Luxor Video Entertainment System (PAL)           */
144   DRIVER( channlf2 )  /* Fairchild Channel F II - 1978                    */
145   DRIVER( sabavpl2 )   /* SABA Videoplay 2 (PAL)                           */
146   DRIVER( luxorvec )  /* Luxor Video Entertainment Computer (PAL)         */
147   DRIVER( itttelma )  /* ITT Tele-Match Processor (PAL)                   */
148   DRIVER( ingtelma )  /* Ingelen Tele-Match Processor (PAL)               */
140    /* FAIRCHILD */
141    DRIVER( channelf )  /* Fairchild Channel F VES - 1976                   */
142    DRIVER( sabavdpl )  /* SABA Videoplay - 1977 (PAL)                      */
143    DRIVER( luxorves )  /* Luxor Video Entertainment System (PAL)           */
144    DRIVER( channlf2 )  /* Fairchild Channel F II - 1978                    */
145    DRIVER( sabavpl2 )  /* SABA Videoplay 2 (PAL)                           */
146    DRIVER( luxorvec )  /* Luxor Video Entertainment Computer (PAL)         */
147    DRIVER( itttelma )  /* ITT Tele-Match Processor (PAL)                   */
148    DRIVER( ingtelma )  /* Ingelen Tele-Match Processor (PAL)               */
149149
150   /* COLECO */
151   DRIVER( coleco )   /* ColecoVision (Original BIOS)                  */
152   DRIVER( colecoa )   /* ColecoVision (Thick Characters)               */
153   DRIVER( colecob )   /* Spectravideo SVI-603 Coleco Game Adapter         */
154   DRIVER( czz50 )      /* Bit Corporation Chuang Zao Zhe 50            */
155   DRIVER( dina )      /* Telegames Dina                           */
156   DRIVER( prsarcde )   /* Telegames Personal Arcade                  */
157   DRIVER( adam )      /* Coleco Adam                              */
150    /* COLECO */
151    DRIVER( coleco )    /* ColecoVision (Original BIOS)                     */
152    DRIVER( colecoa )   /* ColecoVision (Thick Characters)                  */
153    DRIVER( colecob )   /* Spectravideo SVI-603 Coleco Game Adapter         */
154    DRIVER( czz50 )     /* Bit Corporation Chuang Zao Zhe 50                */
155    DRIVER( dina )      /* Telegames Dina                                   */
156    DRIVER( prsarcde )  /* Telegames Personal Arcade                        */
157    DRIVER( adam )      /* Coleco Adam                                      */
158158
159   /* NEC */
160   DRIVER( pce )      /* PC/Engine NEC 1987-1993                     */
161   DRIVER( tg16 )      /* Turbo Grafix-16  NEC 1989-1993               */
162   DRIVER( sgx )      /* SuperGrafX NEC 1989                        */
163   DRIVER( pcfx )      /* PC-FX NEC 1994                           */
159    /* NEC */
160    DRIVER( pce )       /* PC/Engine NEC 1987-1993                          */
161    DRIVER( tg16 )      /* Turbo Grafix-16  NEC 1989-1993                   */
162    DRIVER( sgx )       /* SuperGrafX NEC 1989                              */
163    DRIVER( pcfx )      /* PC-FX NEC 1994                                   */
164164
165   DRIVER( arcadia )   /* Emerson Arcadia 2001                        */
166   DRIVER( vcg )      /* Palladium Video-Computer-Game               */
165    DRIVER( arcadia )   /* Emerson Arcadia 2001                             */
166    DRIVER( vcg )       /* Palladium Video-Computer-Game                    */
167167
168   /* GCE */
169   DRIVER( vectrex )   /* General Consumer Electric Vectrex - 1982-1984   */
170                  /* (aka Milton-Bradley Vectrex)                  */
171   DRIVER( raaspec )   /* RA+A Spectrum - Modified Vectrex               */
168    /* GCE */
169    DRIVER( vectrex )   /* General Consumer Electric Vectrex - 1982-1984    */
170                        /* (aka Milton-Bradley Vectrex)                     */
171    DRIVER( raaspec )   /* RA+A Spectrum - Modified Vectrex                 */
172172
173   /* MATTEL */
174   DRIVER( intv )      /* Mattel Intellivision - 1979 AKA INTV            */
175   DRIVER( intvsrs )   /* Intellivision (Sears License) - 19??            */
173    /* MATTEL */
174    DRIVER( intv )      /* Mattel Intellivision - 1979 AKA INTV             */
175    DRIVER( intvsrs )   /* Intellivision (Sears License) - 19??             */
176176
177   /* ENTEX */
178   DRIVER( advision )   /* Adventurevision                           */
177    /* ENTEX */
178    DRIVER( advision )  /* Adventurevision                                  */
179179
180   /* CAPCOM */
181   DRIVER( sfach )      /* CPS Changer (Street Fighter Alpha)            */
182   DRIVER( sfzbch )   /* CPS Changer (Street Fighter ZERO Brazil)         */
183   DRIVER( sfzch )      /* CPS Changer (Street Fighter ZERO)            */
184   DRIVER( wofch )      /* CPS Changer (Tenchi Wo Kurau II)               */
180    /* CAPCOM */
181    DRIVER( sfach )     /* CPS Changer (Street Fighter Alpha)               */
182    DRIVER( sfzbch )    /* CPS Changer (Street Fighter ZERO Brazil)         */
183    DRIVER( sfzch )     /* CPS Changer (Street Fighter ZERO)                */
184    DRIVER( wofch )     /* CPS Changer (Tenchi Wo Kurau II)                 */
185185
186   /* MAGNAVOX */
187   DRIVER( odyssey2 )   /* Magnavox Odyssey 2 - 1978-1983               */
186    /* MAGNAVOX */
187    DRIVER( odyssey2 )  /* Magnavox Odyssey 2 - 1978-1983                   */
188188
189   /* Hartung, Watara, ...*/
190   DRIVER( gmaster )   /* Hartung Gamemaster                         */
189    /* Hartung, Watara, ...*/
190    DRIVER( gmaster )   /* Hartung Gamemaster                               */
191191
192   /* WATARA */
193   DRIVER( svision )   /* Supervision Handheld                        */
194   DRIVER( svisions )
195   DRIVER( svisionp )
196   DRIVER( svisionn )
197   DRIVER( tvlinkp )
192    /* WATARA */
193    DRIVER( svision )   /* Supervision Handheld                             */
194    DRIVER( svisions )
195    DRIVER( svisionp )
196    DRIVER( svisionn )
197    DRIVER( tvlinkp )
198198
199   /* INTERTON */
200   DRIVER( vc4000 )   /* Interton vc4000                           */
199    /* INTERTON */
200    DRIVER( vc4000 )    /* Interton vc4000                                  */
201201
202   /* BANDAI */
203   DRIVER( wswan )      /* Bandai WonderSwan Handheld                  */
204   DRIVER( wscolor )   /* Bandai WonderSwan Color Handheld               */
202    /* BANDAI */
203    DRIVER( wswan )     /* Bandai WonderSwan Handheld                       */
204    DRIVER( wscolor )   /* Bandai WonderSwan Color Handheld                 */
205205
206   /* EPOCH */
207   DRIVER( gamepock )   /* Epoch Game Pocket Computer                  */
206    /* EPOCH */
207    DRIVER( gamepock )  /* Epoch Game Pocket Computer                       */
208208
209   /* KOEI */
210   DRIVER( pasogo )   /* KOEI PasoGo                              */
209    /* KOEI */
210    DRIVER( pasogo )    /* KOEI PasoGo                                      */
211211
212   /* SNK */
213   DRIVER( ngp )      /* NeoGeo Pocket                           */
214   DRIVER( ngpc )      /* NeoGeo Pocket Color                        */
215   DRIVER( aes )      /* NeoGeo AES                              */
216   DRIVER( neocd )      /* NeoGeo CD                              */
217   DRIVER( neocdz )   /* NeoGeo CDZ                              */
212    /* SNK */
213    DRIVER( ngp )       /* NeoGeo Pocket                                    */
214    DRIVER( ngpc )      /* NeoGeo Pocket Color                              */
215    DRIVER( aes )       /* NeoGeo AES                                       */
216    DRIVER( neocd )     /* NeoGeo CD                                        */
217    DRIVER( neocdz )    /* NeoGeo CDZ                                       */
218218
219   /* Philips */
220   DRIVER( cdi )      /* Philips CD-i                              */
219    /* Philips */
220    DRIVER( cdi )       /* Philips CD-i                                     */
221221
222222/****************COMPUTERS***************************************************/
223223    /* ACORN */
224   DRIVER( acrnsys1 )   /* 1979 Acorn System 1 (Microcomputer Kit)         */
225   DRIVER( atom )      /* 1979 Acorn Atom                           */
226   DRIVER( atomeb )   /* 1979 Acorn Atom                           */
227   DRIVER( bbca )      /* 1981 BBC Micro Model A                     */
228   DRIVER( bbcb )      /* 1981 BBC Micro Model B                     */
229   DRIVER( bbcbp )      /* 198? BBC Micro Model B+ 64K                  */
230   DRIVER( bbcbp128 )   /* 198? BBC Micro Model B+ 128K                  */
231   DRIVER( bbcm)      /* 198? BBC Master                           */
232   DRIVER( bbcbc )      /* 1985 BBC Bridge Companion                  */
233   DRIVER( electron )   /* 1983 Acorn Electron                        */
234   DRIVER( a310 )      /* 1988 Acorn Archimedes 310                  */
235   DRIVER( a6809 )
224    DRIVER( acrnsys1 )  /* 1979 Acorn System 1 (Microcomputer Kit)          */
225    DRIVER( atom )      /* 1979 Acorn Atom                                  */
226    DRIVER( atomeb )    /* 1979 Acorn Atom                                  */
227    DRIVER( bbca )      /* 1981 BBC Micro Model A                           */
228    DRIVER( bbcb )      /* 1981 BBC Micro Model B                           */
229    DRIVER( bbcbp )     /* 198? BBC Micro Model B+ 64K                      */
230    DRIVER( bbcbp128 )  /* 198? BBC Micro Model B+ 128K                     */
231    DRIVER( bbcm)       /* 198? BBC Master                                  */
232    DRIVER( bbcbc )     /* 1985 BBC Bridge Companion                        */
233    DRIVER( electron )  /* 1983 Acorn Electron                              */
234    DRIVER( a310 )      /* 1988 Acorn Archimedes 310                        */
235    DRIVER( a6809 )
236236
237   /* CAMBRIDGE COMPUTERS */
238   DRIVER( z88 )      /*                                       */
237    /* CAMBRIDGE COMPUTERS */
238    DRIVER( z88 )       /*                                                  */
239239
240   /* AMSTRAD */
241   DRIVER( cpc464 )   /* Amstrad (Schneider in Germany) 1984            */
242   DRIVER( cpc664 )   /* Amstrad (Schneider in Germany) 1985            */
243   DRIVER( cpc6128 )   /* Amstrad (Schneider in Germany) 1985            */
244   DRIVER( cpc6128s )   /* Amstrad (Schneider in Germany) 1985            */
245   DRIVER( cpc6128f )   /* Amstrad (Schneider in Germany) 1985 (AZERTY)      */
246   DRIVER( cpc464p )   /* Amstrad CPC464  Plus - 1990                  */
247   DRIVER( cpc6128p )   /* Amstrad CPC6128 Plus - 1990                  */
248   DRIVER( gx4000 )   /* Amstrad GX4000 - 1990                     */
249   DRIVER( kccomp )   /* VEB KC compact                           */
250   DRIVER( al520ex )   /* Patisonic Aleste 520EX (1993)               */
251   DRIVER( pcw8256 )   /* 198? PCW8256                              */
252   DRIVER( pcw8512 )   /* 198? PCW8512                              */
253   DRIVER( pcw9256 )   /* 198? PCW9256                              */
254   DRIVER( pcw9512 )   /* 198? PCW9512 (+)                           */
255   DRIVER( pcw10 )    /* 198? PCW10                              */
256   DRIVER( pcw16 )      /* 1995 PCW16                              */
257   DRIVER( nc100 )      /* 1992 NC100                              */
258   DRIVER( nc150 )      /* 1992 NC150                              */
259   DRIVER( nc200 )      /* 1993 NC200                              */
240    /* AMSTRAD */
241    DRIVER( cpc464 )    /* Amstrad (Schneider in Germany) 1984              */
242    DRIVER( cpc664 )    /* Amstrad (Schneider in Germany) 1985              */
243    DRIVER( cpc6128 )   /* Amstrad (Schneider in Germany) 1985              */
244    DRIVER( cpc6128s )  /* Amstrad (Schneider in Germany) 1985              */
245    DRIVER( cpc6128f )  /* Amstrad (Schneider in Germany) 1985 (AZERTY)     */
246    DRIVER( cpc464p )   /* Amstrad CPC464  Plus - 1990                      */
247    DRIVER( cpc6128p )  /* Amstrad CPC6128 Plus - 1990                      */
248    DRIVER( gx4000 )    /* Amstrad GX4000 - 1990                            */
249    DRIVER( kccomp )    /* VEB KC compact                                   */
250    DRIVER( al520ex )   /* Patisonic Aleste 520EX (1993)                    */
251    DRIVER( pcw8256 )   /* 198? PCW8256                                     */
252    DRIVER( pcw8512 )   /* 198? PCW8512                                     */
253    DRIVER( pcw9256 )   /* 198? PCW9256                                     */
254    DRIVER( pcw9512 )   /* 198? PCW9512 (+)                                 */
255    DRIVER( pcw10 )     /* 198? PCW10                                       */
256    DRIVER( pcw16 )     /* 1995 PCW16                                       */
257    DRIVER( nc100 )     /* 1992 NC100                                       */
258    DRIVER( nc150 )     /* 1992 NC150                                       */
259    DRIVER( nc200 )     /* 1993 NC200                                       */
260260
261   /* APPLE */
262   DRIVER( apple1 )   /* Jul 1976 Apple 1                           */
263   DRIVER( apple2 )   /* Apr 1977 Apple ][                        */
264   DRIVER( apple2p )   /* Jun 1979 Apple ][+                        */
265   DRIVER( prav82 )   /* Pravetz 82                              */
266   DRIVER( prav8m )   /* Pravetz 8M                              */
267   DRIVER( apple2jp )   /* ??? ???? Apple ][j+                        */
268   DRIVER( apple2e )   /* Jan 1983 Apple //e                        */
269   DRIVER( mprof3 )   /* Microprofessor III                        */
270   DRIVER( apple2ee )   /* Mar 1985 Apple //e Enhanced                  */
271   DRIVER( apple2ep )   /* Jan 1987 Apple //e Platinum                  */
272   DRIVER( apple2c )   /* Apr 1984 Apple //c                        */
273   DRIVER( prav8c )   /* Pravetz 8C                        */
274   DRIVER( apple2c0 )   /* ??? 1985 Apple //c (3.5 ROM)                  */
275   DRIVER( apple2c3 )   /* Sep 1986 Apple //c (Original Mem. Exp.)         */
276   DRIVER( apple2c4 )   /* ??? 198? Apple //c (rev 4)                  */
277   DRIVER( apple2cp )   /* Sep 1988 Apple //c+                        */
278   DRIVER( apple2gsr0 )   /* Sep 1986 Apple IIgs ROM00               */
279   DRIVER( apple2gsr1 )   /* Sep 1987 Apple IIgs ROM01               */
280   DRIVER( apple2gs )   /* Aug 1989 Apple IIgs ROM03                  */
281   DRIVER( apple2gsr3p )   /* ??? 198? Apple IIgs ROM03 prototype         */
282   DRIVER( apple2gsr3lp )   /* ??? 1989 Apple IIgs ROM03 late? prototype   */
283   DRIVER( apple3 )   /* May 1980 Apple ///                        */
284               /* Dec 1983 Apple ///+                        */
285   DRIVER( ace100 )   /* ??? 1982 Franklin Ace 100                  */
286   DRIVER( laser128 )   /* ??? 1987 Laser 128                        */
287   DRIVER( las128ex )   /* ??? 1987 Laser 128 EX                     */
288   DRIVER( las3000 )   /* ??? 1983 Laser 3000                        */
289   DRIVER( ivelultr )   /* Ivasim Ivel Ultra                        */
290   DRIVER( agat7 )      /* Agat-7                                 */
291   DRIVER( agat9 )      /* Agat-9                                 */
261    /* APPLE */
262    DRIVER( apple1 )    /* Jul 1976 Apple 1                                 */
263    DRIVER( apple2 )    /* Apr 1977 Apple ][                                */
264    DRIVER( apple2p )   /* Jun 1979 Apple ][+                               */
265    DRIVER( prav82 )    /* Pravetz 82                                       */
266    DRIVER( prav8m )    /* Pravetz 8M                                       */
267    DRIVER( apple2jp )  /* ??? ???? Apple ][j+                              */
268    DRIVER( apple2e )   /* Jan 1983 Apple //e                               */
269    DRIVER( mprof3 )    /* Microprofessor III                               */
270    DRIVER( apple2ee )  /* Mar 1985 Apple //e Enhanced                      */
271    DRIVER( apple2ep )  /* Jan 1987 Apple //e Platinum                      */
272    DRIVER( apple2c )   /* Apr 1984 Apple //c                               */
273    DRIVER( prav8c )    /* Pravetz 8C                               */
274    DRIVER( apple2c0 )  /* ??? 1985 Apple //c (3.5 ROM)                     */
275    DRIVER( apple2c3 )  /* Sep 1986 Apple //c (Original Mem. Exp.)          */
276    DRIVER( apple2c4 )  /* ??? 198? Apple //c (rev 4)                       */
277    DRIVER( apple2cp )  /* Sep 1988 Apple //c+                              */
278    DRIVER( apple2gsr0 )    /* Sep 1986 Apple IIgs ROM00                    */
279    DRIVER( apple2gsr1 )    /* Sep 1987 Apple IIgs ROM01                    */
280    DRIVER( apple2gs )  /* Aug 1989 Apple IIgs ROM03                        */
281    DRIVER( apple2gsr3p )   /* ??? 198? Apple IIgs ROM03 prototype          */
282    DRIVER( apple2gsr3lp )  /* ??? 1989 Apple IIgs ROM03 late? prototype    */
283    DRIVER( apple3 )    /* May 1980 Apple ///                               */
284                    /* Dec 1983 Apple ///+                              */
285    DRIVER( ace100 )    /* ??? 1982 Franklin Ace 100                        */
286    DRIVER( laser128 )  /* ??? 1987 Laser 128                               */
287    DRIVER( las128ex )  /* ??? 1987 Laser 128 EX                            */
288    DRIVER( las3000 )   /* ??? 1983 Laser 3000                              */
289    DRIVER( ivelultr )  /* Ivasim Ivel Ultra                                */
290    DRIVER( agat7 )     /* Agat-7                                           */
291    DRIVER( agat9 )     /* Agat-9                                           */
292292
293293/*
294 * Lisa              January          1983
295 * Lisa 2              January          1984
296 * Macintosh XL        January          1985
294 * Lisa                  January             1983
295 * Lisa 2                January             1984
296 * Macintosh XL          January             1985
297297 */
298   DRIVER( lisa )      /* 1983 Apple Lisa                           */
299   DRIVER( lisa2 )      /* 1984 Apple Lisa 2                        */
300   DRIVER( lisa210 )   /* 1984 Apple Lisa 2/10                        */
301   DRIVER( macxl )      /* 1985 Apple Macintosh XL                     */
298    DRIVER( lisa )      /* 1983 Apple Lisa                                  */
299    DRIVER( lisa2 )     /* 1984 Apple Lisa 2                                */
300    DRIVER( lisa210 )   /* 1984 Apple Lisa 2/10                             */
301    DRIVER( macxl )     /* 1985 Apple Macintosh XL                          */
302302/*
303 * Macintosh         January            1984
304 * Macintosh 512k      July?            1984
305 * Macintosh 512ke      April            1986
306 * Macintosh Plus      January            1986
307 * Macintosh SE         March            1987
308 * Macintosh II         March            1987
303 * Macintosh            January             1984
304 * Macintosh 512k       July?               1984
305 * Macintosh 512ke      April               1986
306 * Macintosh Plus       January             1986
307 * Macintosh SE         March               1987
308 * Macintosh II         March               1987
309309 */
310    DRIVER( mac128k )   /* 1984 Apple Macintosh                        */
311   DRIVER( mac512k )   /* 1985 Apple Macintosh 512k                  */
312   DRIVER( mac512ke )   /* 1986 Apple Macintosh 512ke                  */
313   DRIVER( macplus )   /* 1986 Apple Macintosh Plus                  */
314   DRIVER( macse )      /* 1987 Apple Macintosh SE                     */
315   DRIVER( macclasc )   /* 1990 Apple Macintosh Classic                  */
316//   DRIVER( maclc )      /* 1990 Apple Macintosh LC                     */
310    DRIVER( mac128k )   /* 1984 Apple Macintosh                             */
311    DRIVER( mac512k )   /* 1985 Apple Macintosh 512k                        */
312    DRIVER( mac512ke )  /* 1986 Apple Macintosh 512ke                       */
313    DRIVER( macplus )   /* 1986 Apple Macintosh Plus                        */
314    DRIVER( macse )     /* 1987 Apple Macintosh SE                          */
315    DRIVER( macclasc )  /* 1990 Apple Macintosh Classic                     */
316//  DRIVER( maclc )     /* 1990 Apple Macintosh LC                          */
317317
318   /* ATARI */
319   DRIVER( a400 )      /* 1979 Atari 400                           */
320   DRIVER( a400pal )   /* 1979 Atari 400 PAL                        */
321   DRIVER( a800 )      /* 1979 Atari 800                           */
322   DRIVER( a800pal )   /* 1979 Atari 800 PAL                        */
323   DRIVER( a1200xl )   /* 1982 Atari 1200 XL                        */
324   DRIVER( a600xl )   /* 1983 Atari 600 XL                        */
325   DRIVER( a800xl )   /* 1983 Atari 800 XL                        */
326   DRIVER( a65xe )      /* 1986 Atari 65 XE (XL Extended)               */
327   DRIVER( a65xea )   /* 1986? Atari 65 XE Arabic                     */
328   DRIVER( a130xe )   /* 1986 Atari 130 XE                        */
329   DRIVER( a800xe )   /* 1986 Atari 800 XE                        */
330   DRIVER( xegs )      /* 1987 Atari XE Game System                  */
331   DRIVER( atarist )   /* Atari ST                                 */
332   DRIVER( megast )   /* Atari Mega ST                           */
333//   DRIVER( stacy )      /* Atari STacy                              */
334   DRIVER( atariste )   /* Atari STe                              */
335   DRIVER( stbook )   /* Atari STBook                              */
336   DRIVER( megaste )   /* Atari Mega STe                           */
337//   DRIVER( stpad )      /* Atari STPad (prototype)                     */
338//   DRIVER( tt030 )      /* Atari TT030                              */
339//   DRIVER( fx1 )      /* Atari FX-1 (prototype)                     */
340//   DRIVER( falcon )   /* Atari Falcon030                           */
341//   DRIVER( falcon40 )   /* Atari Falcon040 (prototype)                  */
318    /* ATARI */
319    DRIVER( a400 )      /* 1979 Atari 400                                   */
320    DRIVER( a400pal )   /* 1979 Atari 400 PAL                               */
321    DRIVER( a800 )      /* 1979 Atari 800                                   */
322    DRIVER( a800pal )   /* 1979 Atari 800 PAL                               */
323    DRIVER( a1200xl )   /* 1982 Atari 1200 XL                               */
324    DRIVER( a600xl )    /* 1983 Atari 600 XL                                */
325    DRIVER( a800xl )    /* 1983 Atari 800 XL                                */
326    DRIVER( a65xe )     /* 1986 Atari 65 XE (XL Extended)                   */
327    DRIVER( a65xea )    /* 1986? Atari 65 XE Arabic                         */
328    DRIVER( a130xe )    /* 1986 Atari 130 XE                                */
329    DRIVER( a800xe )    /* 1986 Atari 800 XE                                */
330    DRIVER( xegs )      /* 1987 Atari XE Game System                        */
331    DRIVER( atarist )   /* Atari ST                                         */
332    DRIVER( megast )    /* Atari Mega ST                                    */
333//  DRIVER( stacy )     /* Atari STacy                                      */
334    DRIVER( atariste )  /* Atari STe                                        */
335    DRIVER( stbook )    /* Atari STBook                                     */
336    DRIVER( megaste )   /* Atari Mega STe                                   */
337//  DRIVER( stpad )     /* Atari STPad (prototype)                          */
338//  DRIVER( tt030 )     /* Atari TT030                                      */
339//  DRIVER( fx1 )       /* Atari FX-1 (prototype)                           */
340//  DRIVER( falcon )    /* Atari Falcon030                                  */
341//  DRIVER( falcon40 )  /* Atari Falcon040 (prototype)                      */
342342
343   /* COMMODORE */
344   DRIVER( kim1 )      /* Commodore (MOS) KIM-1 1975                  */
345   DRIVER( sym1 )      /* Synertek SYM-1                           */
346   DRIVER( aim65 )      /* Rockwell AIM65                           */
343    /* COMMODORE */
344    DRIVER( kim1 )      /* Commodore (MOS) KIM-1 1975                       */
345    DRIVER( sym1 )      /* Synertek SYM-1                                   */
346    DRIVER( aim65 )     /* Rockwell AIM65                                   */
347347
348   DRIVER( pet2001 )   /* PET 2001                                 */
349   DRIVER( pet2001n )   /* PET 2001-N                              */
350   DRIVER( pet2001b )   /* PET 2001-B                              */
351   DRIVER( cbm30 )      /* CBM 30xx                                 */
352   DRIVER( cbm30b )   /* CBM 30xx (Business keyboard)                  */
353   DRIVER( cbm30nor )   /* CBM 30xx (Norway, Business keyboard)            */
354   DRIVER( pet40on )   /* PET 40xx (Basic 4, no CRTC, Normal keyboard)      */
355   DRIVER( pet40ob )   /* PET 40xx (Basic 4, no CRTC, Business keyboard)   */
356   DRIVER( pet40n )   /* PET 40xx (Basic 4, CRTC 60Hz, 40 columns)      */
357   DRIVER( pet40b )   /* PET 40xx (Basic 4, CRTC 60Hz, 80 columns)      */
358   DRIVER( cbm40o )   /* CBM 40xx (Basic 4, no CRTC, Normal keyboard)      */
359   DRIVER( cbm40ob )   /* CBM 40xx (Basic 4, no CRTC, Business keyboard)   */
360   DRIVER( cbm40n )   /* CBM 40xx (Basic 4, CRTC 50Hz, 40 columns)      */
361   DRIVER( cbm40b )   /* CBM 40xx (Basic 4, CRTC 50Hz, 80 columns)      */
362   DRIVER( pet80 )      /* PET 80xx (Basic 4, CRTC 60Hz, 80 columns)      */
363   DRIVER( cbm80 )      /* CBM 80xx (Basic 4, CRTC 50Hz, 80 columns)      */
364   DRIVER( cbm80ger )   /* CBM 80xx (Germany, Basic 4, CRTC 50Hz, 80 cols)   */
365   DRIVER( cbm80hun )   /* CBM 80xx (Hungary, Basic 4, CRTC 50Hz, 80 cols)   */
366   DRIVER( cbm80swe )   /* CBM 80xx (Sweden, Basic 4, CRTC 50Hz, 80 cols)   */
367   DRIVER( cbm8296 )   /* CBM 8296 (Basic 4, CRTC 50Hz, 80 columns)      */
368   DRIVER( cbm8296d )   /* CBM 8296D                              */
369   DRIVER( superpet )   /* SuperPET                                 */
370   DRIVER( sp9000 )   /* CBM SP9000 / MiniMainFrame 9000               */
371   DRIVER( mmf9000s )   /* MiniMainFrame 9000 (Sweden)                  */
348    DRIVER( pet2001 )   /* PET 2001                                         */
349    DRIVER( pet2001n )  /* PET 2001-N                                       */
350    DRIVER( pet2001b )  /* PET 2001-B                                       */
351    DRIVER( cbm30 )     /* CBM 30xx                                         */
352    DRIVER( cbm30b )    /* CBM 30xx (Business keyboard)                     */
353    DRIVER( cbm30nor )  /* CBM 30xx (Norway, Business keyboard)             */
354    DRIVER( pet40on )   /* PET 40xx (Basic 4, no CRTC, Normal keyboard)     */
355    DRIVER( pet40ob )   /* PET 40xx (Basic 4, no CRTC, Business keyboard)   */
356    DRIVER( pet40n )    /* PET 40xx (Basic 4, CRTC 60Hz, 40 columns)        */
357    DRIVER( pet40b )    /* PET 40xx (Basic 4, CRTC 60Hz, 80 columns)        */
358    DRIVER( cbm40o )    /* CBM 40xx (Basic 4, no CRTC, Normal keyboard)     */
359    DRIVER( cbm40ob )   /* CBM 40xx (Basic 4, no CRTC, Business keyboard)   */
360    DRIVER( cbm40n )    /* CBM 40xx (Basic 4, CRTC 50Hz, 40 columns)        */
361    DRIVER( cbm40b )    /* CBM 40xx (Basic 4, CRTC 50Hz, 80 columns)        */
362    DRIVER( pet80 )     /* PET 80xx (Basic 4, CRTC 60Hz, 80 columns)        */
363    DRIVER( cbm80 )     /* CBM 80xx (Basic 4, CRTC 50Hz, 80 columns)        */
364    DRIVER( cbm80ger )  /* CBM 80xx (Germany, Basic 4, CRTC 50Hz, 80 cols)  */
365    DRIVER( cbm80hun )  /* CBM 80xx (Hungary, Basic 4, CRTC 50Hz, 80 cols)  */
366    DRIVER( cbm80swe )  /* CBM 80xx (Sweden, Basic 4, CRTC 50Hz, 80 cols)   */
367    DRIVER( cbm8296 )   /* CBM 8296 (Basic 4, CRTC 50Hz, 80 columns)        */
368    DRIVER( cbm8296d )  /* CBM 8296D                                        */
369    DRIVER( superpet )  /* SuperPET                                         */
370    DRIVER( sp9000 )    /* CBM SP9000 / MiniMainFrame 9000                  */
371    DRIVER( mmf9000s )  /* MiniMainFrame 9000 (Sweden)                      */
372372
373   DRIVER( vic1001 )   /* Commodore VIC-1001 (Japan)                  */
374   DRIVER( vic20 )      /* Commodore VIC 20 (NTSC)                     */
375   DRIVER( vic20cr )   /* Commodore VIC 20CR (NTSC)                  */
376   DRIVER( vic20i )   /* Commodore VIC 20 (NTSC, IEEE488 Interface)      */
377   DRIVER( vic20v )   /* Commodore VIC 20 (NTSC, VC1540)               */
378   DRIVER( vic20pal )   /* Commodore VIC 20 (PAL)                     */
379   DRIVER( vic20crp )   /* Commodore VIC 20CR (PAL)                     */
380   DRIVER( vic20plv )   /* Commodore VIC 20 (PAL, VC1540)               */
381   DRIVER( vc20 )      /* Commodore VIC 20 (PAL, Germany)               */
382   DRIVER( vc20v )      /* Commodore VIC 20 (PAL, VC1540)               */
383   DRIVER( vic20swe )   /* Commodore VIC 20 (Swedish Expanson Kit)         */
373    DRIVER( vic1001 )   /* Commodore VIC-1001 (Japan)                       */
374    DRIVER( vic20 )     /* Commodore VIC 20 (NTSC)                          */
375    DRIVER( vic20cr )   /* Commodore VIC 20CR (NTSC)                        */
376    DRIVER( vic20i )    /* Commodore VIC 20 (NTSC, IEEE488 Interface)       */
377    DRIVER( vic20v )    /* Commodore VIC 20 (NTSC, VC1540)                  */
378    DRIVER( vic20pal )  /* Commodore VIC 20 (PAL)                           */
379    DRIVER( vic20crp )  /* Commodore VIC 20CR (PAL)                         */
380    DRIVER( vic20plv )  /* Commodore VIC 20 (PAL, VC1540)                   */
381    DRIVER( vc20 )      /* Commodore VIC 20 (PAL, Germany)                  */
382    DRIVER( vc20v )     /* Commodore VIC 20 (PAL, VC1540)                   */
383    DRIVER( vic20swe )  /* Commodore VIC 20 (Swedish Expanson Kit)          */
384384
385   DRIVER( max )      /* Commodore Max Machine (Japan)               */
386   DRIVER( c64 )      /* Commodore 64 (NTSC)                        */
387   DRIVER( c64pal )   /* Commodore 64 (PAL)                        */
388   DRIVER( c64jpn )   /* Commodore 64 (Japan)                        */
389   DRIVER( c64swe )   /* Commodore 64 (Sweden)                     */
390   DRIVER( vic64s )   /* Commodore VIC 64S (Sweden)                  */
391   DRIVER( pet64 )      /* Commodore PET 64                           */
392   DRIVER( cbm4064 )   /* Commodore CBM 4064                        */
393   DRIVER( edu64 )      /* Commodore Educator 64                     */
394   DRIVER( sx64 )      /* Commodore SX-64 Executive Machine (PAL)         */
395   DRIVER( vip64 )      /* Commodore VIP64 (SX64, PAL, Swedish)            */
396//   DRIVER( dx64 )      /* Commodore DX-64 - Prototype                  */
397   DRIVER( c64c )      /* Commodore 64C (NTSC)                        */
398   DRIVER( c64cpal )   /* Commodore 64C (PAL)                        */
399   DRIVER( c64g )      /* Commodore 64G (PAL)                        */
400   DRIVER( c64gs )      /* Commodore 64 Games System                  */
385    DRIVER( max )       /* Commodore Max Machine (Japan)                    */
386    DRIVER( c64 )       /* Commodore 64 (NTSC)                              */
387    DRIVER( c64pal )    /* Commodore 64 (PAL)                               */
388    DRIVER( c64jpn )    /* Commodore 64 (Japan)                             */
389    DRIVER( c64swe )    /* Commodore 64 (Sweden)                            */
390    DRIVER( vic64s )    /* Commodore VIC 64S (Sweden)                       */
391    DRIVER( pet64 )     /* Commodore PET 64                                 */
392    DRIVER( cbm4064 )   /* Commodore CBM 4064                               */
393    DRIVER( edu64 )     /* Commodore Educator 64                            */
394    DRIVER( sx64 )      /* Commodore SX-64 Executive Machine (PAL)          */
395    DRIVER( vip64 )     /* Commodore VIP64 (SX64, PAL, Swedish)             */
396//  DRIVER( dx64 )      /* Commodore DX-64 - Prototype                      */
397    DRIVER( c64c )      /* Commodore 64C (NTSC)                             */
398    DRIVER( c64cpal )   /* Commodore 64C (PAL)                              */
399    DRIVER( c64g )      /* Commodore 64G (PAL)                              */
400    DRIVER( c64gs )     /* Commodore 64 Games System                        */
401401
402   DRIVER( b500 )      /* Commodore B500                           */
403   DRIVER( b128 )      /* Commodore B128                           */
404   DRIVER( b256 )      /* Commodore B256                           */
405   DRIVER( cbm610 )   /* Commodore CBM 610                        */
406   DRIVER( cbm620 )   /* Commodore CBM 620                        */
407   DRIVER( cbm620hu )   /* Commodore CBM 620 (Hungary)                  */
408   DRIVER( b128hp )   /* Commodore B128HP                           */
409   DRIVER( b256hp )   /* Commodore B256HP                           */
410   DRIVER( bx256hp )   /* Commodore BX256HP                        */
411   DRIVER( cbm710 )   /* Commodore CBM 710                        */
412   DRIVER( cbm720 )   /* Commodore CBM 720                        */
413   DRIVER( cbm720se )   /* Commodore CBM 720 (Sweden / Finland)            */
414   DRIVER( p500 )      /* Commodore P500 (proto, a.k.a. C128-40, PET-II)   */
402    DRIVER( b500 )      /* Commodore B500                                   */
403    DRIVER( b128 )      /* Commodore B128                                   */
404    DRIVER( b256 )      /* Commodore B256                                   */
405    DRIVER( cbm610 )    /* Commodore CBM 610                                */
406    DRIVER( cbm620 )    /* Commodore CBM 620                                */
407    DRIVER( cbm620hu )  /* Commodore CBM 620 (Hungary)                      */
408    DRIVER( b128hp )    /* Commodore B128HP                                 */
409    DRIVER( b256hp )    /* Commodore B256HP                                 */
410    DRIVER( bx256hp )   /* Commodore BX256HP                                */
411    DRIVER( cbm710 )    /* Commodore CBM 710                                */
412    DRIVER( cbm720 )    /* Commodore CBM 720                                */
413    DRIVER( cbm720se )  /* Commodore CBM 720 (Sweden / Finland)             */
414    DRIVER( p500 )      /* Commodore P500 (proto, a.k.a. C128-40, PET-II)   */
415415
416   DRIVER( c16 )      /* Commodore 16                              */
417   DRIVER( c16c )      /* Commodore 16  c1551                        */
418   DRIVER( c16v )      /* Commodore 16  vc1541                        */
419   DRIVER( c16hun )   /* Commodore 16 Novotrade (Hungarian Character Set)   */
420   DRIVER( c116 )      /* Commodore 116                           */
421   DRIVER( c116c )      /* Commodore 116  c1551                        */
422   DRIVER( c116v )      /* Commodore 116  vc1541                     */
423   DRIVER( plus4 )      /* Commodore +4                              */
424   DRIVER( plus4c )   /* Commodore +4  c1551                        */
425   DRIVER( plus4v )   /* Commodore +4  vc1541                        */
426   DRIVER( c232 )      /* Commodore 232 - Prototype                  */
427   DRIVER( c264 )      /* Commodore 264 - Prototype                  */
428   DRIVER( c364 )      /* Commodore V364 - Prototype                  */
416    DRIVER( c16 )       /* Commodore 16                                     */
417    DRIVER( c16c )      /* Commodore 16  c1551                              */
418    DRIVER( c16v )      /* Commodore 16  vc1541                             */
419    DRIVER( c16hun )    /* Commodore 16 Novotrade (Hungarian Character Set) */
420    DRIVER( c116 )      /* Commodore 116                                    */
421    DRIVER( c116c )     /* Commodore 116  c1551                             */
422    DRIVER( c116v )     /* Commodore 116  vc1541                            */
423    DRIVER( plus4 )     /* Commodore +4                                     */
424    DRIVER( plus4c )    /* Commodore +4  c1551                              */
425    DRIVER( plus4v )    /* Commodore +4  vc1541                             */
426    DRIVER( c232 )      /* Commodore 232 - Prototype                        */
427    DRIVER( c264 )      /* Commodore 264 - Prototype                        */
428    DRIVER( c364 )      /* Commodore V364 - Prototype                       */
429429
430   DRIVER( c128 )      /* Commodore 128 - NTSC                        */
431   DRIVER( c128cr )   /* Commodore 128CR - NTSC (proto?)               */
432   DRIVER( c128sfi )   /* Commodore 128 - PAL (Swedish / Finnish)         */
433   DRIVER( c128fino )   /* Commodore 128 - PAL (Finnish, Unconfirmed dumps)   */
434   DRIVER( c128fra )   /* Commodore 128 - PAL (French)                  */
435   DRIVER( c128ger )   /* Commodore 128 - PAL (German)                  */
436   DRIVER( c128nor )   /* Commodore 128 - PAL (Norwegian)               */
437   DRIVER( c128d )      /* Commodore 128D - PAL                        */
438   DRIVER( c128dpr )   /* Commodore 128D - NTSC (proto)               */
439   DRIVER( c128dcr )   /* Commodore 128DCR - NTSC                     */
440   DRIVER( c128drde )   /* Commodore 128DCR - PAL (German)               */
441   DRIVER( c128drit )   /* Commodore 128DCR - PAL (Italian)               */
442   DRIVER( c128drsw )   /* Commodore 128DCR - PAL (Swedish)               */
443   DRIVER( c128d81 )   /* Commodore 128D/81                        */
430    DRIVER( c128 )      /* Commodore 128 - NTSC                             */
431    DRIVER( c128cr )    /* Commodore 128CR - NTSC (proto?)                  */
432    DRIVER( c128sfi )   /* Commodore 128 - PAL (Swedish / Finnish)          */
433    DRIVER( c128fino )  /* Commodore 128 - PAL (Finnish, Unconfirmed dumps) */
434    DRIVER( c128fra )   /* Commodore 128 - PAL (French)                     */
435    DRIVER( c128ger )   /* Commodore 128 - PAL (German)                     */
436    DRIVER( c128nor )   /* Commodore 128 - PAL (Norwegian)                  */
437    DRIVER( c128d )     /* Commodore 128D - PAL                             */
438    DRIVER( c128dpr )   /* Commodore 128D - NTSC (proto)                    */
439    DRIVER( c128dcr )   /* Commodore 128DCR - NTSC                          */
440    DRIVER( c128drde )  /* Commodore 128DCR - PAL (German)                  */
441    DRIVER( c128drit )  /* Commodore 128DCR - PAL (Italian)                 */
442    DRIVER( c128drsw )  /* Commodore 128DCR - PAL (Swedish)                 */
443    DRIVER( c128d81 )   /* Commodore 128D/81                                */
444444
445   DRIVER( a500n )      /* Commodore Amiga 500 - NTSC                  */
446   DRIVER( a500p )      /* Commodore Amiga 500 - PAL                  */
447   DRIVER( a1000n )   /* Commodore Amiga 1000 - NTSC                  */
448   DRIVER( a1000p )   /* Commodore Amiga 1000 - PAL                  */
449   DRIVER( cdtv )      /* Commodore CDTV                           */
450   DRIVER( a1200n )   /* Commodore Amiga 1200 - NTSC                  */
451   DRIVER( a1200p )   /* Commodore Amiga 1200 - PAL                  */
452   DRIVER( cd32 )      /* Commodore Amiga CD32                        */
445    DRIVER( a500n )     /* Commodore Amiga 500 - NTSC                       */
446    DRIVER( a500p )     /* Commodore Amiga 500 - PAL                        */
447    DRIVER( a1000n )    /* Commodore Amiga 1000 - NTSC                      */
448    DRIVER( a1000p )    /* Commodore Amiga 1000 - PAL                       */
449    DRIVER( cdtv )      /* Commodore CDTV                                   */
450    DRIVER( a1200n )    /* Commodore Amiga 1200 - NTSC                      */
451    DRIVER( a1200p )    /* Commodore Amiga 1200 - PAL                       */
452    DRIVER( cd32 )      /* Commodore Amiga CD32                             */
453453
454   DRIVER( c65 )      /* 1991 C65 / C64DX (Prototype, NTSC)            */
455   DRIVER( c64dx )      /* 1991 C65 / C64DX (Prototype, German PAL)         */
454    DRIVER( c65 )       /* 1991 C65 / C64DX (Prototype, NTSC)               */
455    DRIVER( c64dx )     /* 1991 C65 / C64DX (Prototype, German PAL)         */
456456
457   /* EPSON */
458   DRIVER( px4 )      /* 1985 Epson PX-4                           */
459   DRIVER( px4p )      /* 1985 Epson PX-4+                           */
460   DRIVER( px8 )
461   DRIVER( qx10 )
457    /* EPSON */
458    DRIVER( px4 )       /* 1985 Epson PX-4                                  */
459    DRIVER( px4p )      /* 1985 Epson PX-4+                                 */
460    DRIVER( px8 )
461    DRIVER( qx10 )
462462
463   /* IBM PC & Clones */
464   DRIVER( ibm5150 )   /* 1981   IBM 5150                           */
465   DRIVER( dgone )      /* 1984 Data General/One */
466   DRIVER( pcmda )      /* 1987 PC with MDA                           */
467   DRIVER( pcherc )   /* 1987 PC with Hercules (for testing hercules)      */
468   DRIVER( pc )      /* 1987 PC with CGA                           */
469   DRIVER( bondwell )   /* 1985   Bondwell (CGA)                        */
470   DRIVER( europc )   /* 1988   Schneider Euro PC (CGA or Hercules)         */
463    /* IBM PC & Clones */
464    DRIVER( ibm5150 )   /* 1981 IBM 5150                                    */
465    DRIVER( dgone )     /* 1984 Data General/One */
466    DRIVER( pcmda )     /* 1987 PC with MDA                                 */
467    DRIVER( pcherc )    /* 1987 PC with Hercules (for testing hercules)     */
468    DRIVER( pc )        /* 1987 PC with CGA                                 */
469    DRIVER( bondwell )  /* 1985 Bondwell (CGA)                              */
470    DRIVER( europc )    /* 1988 Schneider Euro PC (CGA or Hercules)         */
471471
472   /* pc junior */
473   DRIVER( ibmpcjr )   /* 1984 IBM PC Jr                           */
474   DRIVER( t1000hx )   /* 1987 Tandy 1000HX (similiar to PCJr)            */
475   DRIVER( t1000sx )   /* 1987 Tandy 1000SX (similiar to PCJr)            */
472    /* pc junior */
473    DRIVER( ibmpcjr )   /* 1984 IBM PC Jr                                   */
474    DRIVER( t1000hx )   /* 1987 Tandy 1000HX (similiar to PCJr)             */
475    DRIVER( t1000sx )   /* 1987 Tandy 1000SX (similiar to PCJr)             */
476476
477   /* xt */
478   DRIVER( ibm5160 )   /* 1982   IBM XT 5160                           */
479   DRIVER( ibm5162 )   /* 1986 IBM XT 5162 (XT w/80286)               */
480   DRIVER( pc200 )      /* 1988 Sinclair PC200                        */
481   DRIVER( pc20 )      /* 1988 Amstrad PC20                        */
482   DRIVER( ppc512 )   /* 1987 Amstrad PPC512                        */
483   DRIVER( ppc640 )   /* 1987 Amstrad PPC640                        */
484   DRIVER( pc1512 )   /* 1986 Amstrad PC1512 v1 (CGA compatible)         */
485   DRIVER( pc1512v2 )   /* 1986 Amstrad PC1512 v2 (CGA compatible)         */
486   DRIVER( pc1640 )   /* 1987 Amstrad PC1640 (EGA compatible)            */
477    /* xt */
478    DRIVER( ibm5160 )   /* 1982 IBM XT 5160                                 */
479    DRIVER( ibm5162 )   /* 1986 IBM XT 5162 (XT w/80286)                    */
480    DRIVER( pc200 )     /* 1988 Sinclair PC200                              */
481    DRIVER( pc20 )      /* 1988 Amstrad PC20                                */
482    DRIVER( ppc512 )    /* 1987 Amstrad PPC512                              */
483    DRIVER( ppc640 )    /* 1987 Amstrad PPC640                              */
484    DRIVER( pc1512 )    /* 1986 Amstrad PC1512 v1 (CGA compatible)          */
485    DRIVER( pc1512v2 )  /* 1986 Amstrad PC1512 v2 (CGA compatible)          */
486    DRIVER( pc1640 )    /* 1987 Amstrad PC1640 (EGA compatible)             */
487487
488   DRIVER( xtvga )      /* 198? PC-XT (VGA, MF2 Keyboard)               */
488    DRIVER( xtvga )     /* 198? PC-XT (VGA, MF2 Keyboard)                   */
489489
490   /* at */
491   DRIVER( ibm5170 )   /* 1984 IBM PC/AT 5170, original 6 MHz model      */
492   DRIVER( ibm5170a )   /* 1985   IBM PC/AT 5170, enhanced 8 MHz model      */
493   DRIVER( i8530286 )   /* 1988 IBM PS2 Model 30 286 (VGA)               */
494   DRIVER( at )      /* 1987 AMI Bios and Diagnostics               */
495   DRIVER( atvga )      /* 19?? AT VGA                              */
496   DRIVER( neat )      /* 1989   New Enhanced AT chipset, AMI BIOS         */
497   DRIVER( at386 )      /* 19?? IBM AT 386                           */
498   DRIVER( at486 )      /* 19?? IBM AT 486                           */
499   DRIVER( at586 )      /* 19?? AT 586                              */
490    /* at */
491    DRIVER( ibm5170 )   /* 1984 IBM PC/AT 5170, original 6 MHz model        */
492    DRIVER( ibm5170a )  /* 1985 IBM PC/AT 5170, enhanced 8 MHz model        */
493    DRIVER( i8530286 )  /* 1988 IBM PS2 Model 30 286 (VGA)                  */
494    DRIVER( at )        /* 1987 AMI Bios and Diagnostics                    */
495    DRIVER( atvga )     /* 19?? AT VGA                                      */
496    DRIVER( neat )      /* 1989 New Enhanced AT chipset, AMI BIOS           */
497    DRIVER( at386 )     /* 19?? IBM AT 386                                  */
498    DRIVER( at486 )     /* 19?? IBM AT 486                                  */
499    DRIVER( at586 )     /* 19?? AT 586                                      */
500500
501   /* PALM */
502   DRIVER( pilot1k )   /* Pilot 1000 */
503   DRIVER( pilot5k )   /* Pilot 5000 */
504   DRIVER( palmpers )   /* Palm Pilot Personal */
505   DRIVER( palmpro )   /* Palm Pilot Professional */
506   DRIVER( palmiii )   /* Palm III */
507   DRIVER( palmiiic)   /* Palm IIIc */
508   DRIVER( palmv )      /* Palm V */
509   DRIVER( palmvx )      /* Palm Vx */
510   DRIVER( palmm100 )   /* Palm m100 */
511   DRIVER( palmm130 )   /* Palm m130 */
512   DRIVER( palmm505 )   /* Palm m505 */
513   DRIVER( palmm515 )   /* Palm m515 */
514   DRIVER( visor )      /* Palm Visor Edge */
515   DRIVER( spt1500 )   /* Symbol SPT 1500 */
516   DRIVER( spt1700 )   /* Symbol SPT 1700 */
517   DRIVER( spt1740 )   /* Symbol SPT 1740 */
518   
501    /* PALM */
502    DRIVER( pilot1k )   /* Pilot 1000 */
503    DRIVER( pilot5k )   /* Pilot 5000 */
504    DRIVER( palmpers )  /* Palm Pilot Personal */
505    DRIVER( palmpro )   /* Palm Pilot Professional */
506    DRIVER( palmiii )   /* Palm III */
507    DRIVER( palmiiic)   /* Palm IIIc */
508    DRIVER( palmv )     /* Palm V */
509    DRIVER( palmvx )    /* Palm Vx */
510    DRIVER( palmm100 )  /* Palm m100 */
511    DRIVER( palmm130 )  /* Palm m130 */
512    DRIVER( palmm505 )  /* Palm m505 */
513    DRIVER( palmm515 )  /* Palm m515 */
514    DRIVER( visor )     /* Palm Visor Edge */
515    DRIVER( spt1500 )   /* Symbol SPT 1500 */
516    DRIVER( spt1700 )   /* Symbol SPT 1700 */
517    DRIVER( spt1740 )   /* Symbol SPT 1740 */
519518
520   /* OSBORNE */
521   DRIVER( osborne1 )   /* 1981 Osborne-1                           */
522519
523   /* SINCLAIR RESEARCH */
524   DRIVER( zx80 )      /* 1980 Sinclair ZX-80                        */
525   DRIVER( zx81 )      /* 1981 Sinclair ZX-81                        */
526   DRIVER( ts1000 )   /* 1982 Timex Sinclair 1000                     */
527   DRIVER( ts1500 )   /* Timex Sinclair 1500                        */
528   DRIVER( ringo470 )   /* Ringo 470                              */
529   DRIVER( pc8300 )   /* Your Computer - PC8300                     */
530   DRIVER( pow3000 )   /* Creon Enterprises - Power 3000               */
531   DRIVER( lambda )   /* Lambda 8300                              */
532   DRIVER( tk85 )      /* Microdigital TK85                         */
520    /* OSBORNE */
521    DRIVER( osborne1 )  /* 1981 Osborne-1                                   */
533522
534   DRIVER( spectrum )/* 1982 ZX Spectrum                           */
535   DRIVER( spec80k ) /* 1987 ZX Spectrum 80k                     */
536   DRIVER( specide ) /* 1995 ZX Spectrum IDE                     */
537   DRIVER( inves )      /* 1986 Inves Spectrum 48K+                     */
538   DRIVER( tk90x )      /* 1985 TK90x Color Computer                  */
539   DRIVER( tk95 )      /* 1986 TK95 Color Computer                     */
540   DRIVER( tc2048 )   /* 198? TC2048                              */
541   DRIVER( ts2068 )   /* 1983 TS2068                              */
542   DRIVER( uk2086 )   /* 1986 UK2086                              */
523    /* SINCLAIR RESEARCH */
524    DRIVER( zx80 )      /* 1980 Sinclair ZX-80                              */
525    DRIVER( zx81 )      /* 1981 Sinclair ZX-81                              */
526    DRIVER( ts1000 )    /* 1982 Timex Sinclair 1000                         */
527    DRIVER( ts1500 )    /* Timex Sinclair 1500                              */
528    DRIVER( ringo470 )  /* Ringo 470                                        */
529    DRIVER( pc8300 )    /* Your Computer - PC8300                           */
530    DRIVER( pow3000 )   /* Creon Enterprises - Power 3000                   */
531    DRIVER( lambda )    /* Lambda 8300                                      */
532    DRIVER( tk85 )      /* Microdigital TK85                                */
543533
544   DRIVER( spec128 )     /* 1986 ZX Spectrum 128                        */
545   DRIVER( specpls2 )   /* 1986 ZX Spectrum +2                        */
546   DRIVER( specpl2a )   /* 1987 ZX Spectrum +2a                        */
547   DRIVER( specpls3 )   /* 1987 ZX Spectrum +3                        */
548   DRIVER( specpl3e )   /* 2000 ZX Spectrum +3e                        */
549   DRIVER( sp3e8bit )   /* 2002 ZX Spectrum +3e   8bit IDE         */
550   DRIVER( sp3ezcf )     /* 2002 ZX Spectrum +3e   ZXCF               */
551   DRIVER( sp3eata )     /* 2002 ZX Spectrum +3e   ZXATASP           */
552   DRIVER( scorpion )
553   DRIVER( pentagon )
534    DRIVER( spectrum )/* 1982 ZX Spectrum                                   */
535    DRIVER( spec80k ) /* 1987 ZX Spectrum 80k                           */
536    DRIVER( specide ) /* 1995 ZX Spectrum IDE                           */
537    DRIVER( inves )     /* 1986 Inves Spectrum 48K+                         */
538    DRIVER( tk90x )     /* 1985 TK90x Color Computer                        */
539    DRIVER( tk95 )      /* 1986 TK95 Color Computer                         */
540    DRIVER( tc2048 )    /* 198? TC2048                                      */
541    DRIVER( ts2068 )    /* 1983 TS2068                                      */
542    DRIVER( uk2086 )    /* 1986 UK2086                                      */
554543
555   DRIVER( ql )      /* 1984 Sinclair QL   (UK)                     */
556   DRIVER( ql_us )      /* 1984 Sinclair QL   (USA)                     */
557   DRIVER( ql_es )      /* 1984 Sinclair QL   (Spain)                     */
558   DRIVER( ql_fr )      /* 1984 Sinclair QL   (France)                  */
559   DRIVER( ql_de )      /* 1984 Sinclair QL   (Germany)                  */
560   DRIVER( ql_it )      /* 1984 Sinclair QL   (Italy)                     */
561   DRIVER( ql_se )      /* 1984 Sinclair QL   (Sweden)                  */
562   DRIVER( ql_dk )      /* 1984 Sinclair QL   (Denmark)                  */
563   DRIVER( ql_gr )      /* 1984 Sinclair QL   (Greece)                  */
564//   DRIVER( tonto )
565//   DRIVER( megaopd )
544    DRIVER( spec128 )     /* 1986 ZX Spectrum 128                               */
545    DRIVER( specpls2 )  /* 1986 ZX Spectrum +2                              */
546    DRIVER( specpl2a )  /* 1987 ZX Spectrum +2a                             */
547    DRIVER( specpls3 )  /* 1987 ZX Spectrum +3                              */
548    DRIVER( specpl3e )  /* 2000 ZX Spectrum +3e                             */
549    DRIVER( sp3e8bit )  /* 2002 ZX Spectrum +3e 8bit IDE            */
550    DRIVER( sp3ezcf )   /* 2002 ZX Spectrum +3e ZXCF                */
551    DRIVER( sp3eata )   /* 2002 ZX Spectrum +3e ZXATASP             */
552    DRIVER( scorpion )
553    DRIVER( pentagon )
566554
567   /* SHARP */
568   DRIVER( pc1245 )   /* Pocket Computer 1245                        */
569   DRIVER( pc1250 )   /* Pocket Computer 1250                        */
570   DRIVER( pc1251 )   /* Pocket Computer 1251                        */
571   DRIVER( pc1255 )   /* Pocket Computer 1255                        */
572   DRIVER( trs80pc3 )   /* Tandy TRS80 PC-3                           */
573   DRIVER( pc1260 )   /* Pocket Computer 1260                        */
574   DRIVER( pc1261 )   /* Pocket Computer 1261                        */
575   DRIVER( pc1401 )   /* Pocket Computer 1401                        */
576   DRIVER( pc1402 )   /* Pocket Computer 1402                        */
577   DRIVER( pc1350 )   /* Pocket Computer 1350                        */
578   DRIVER( pc1403 )   /* Pocket Computer 1403                        */
579   DRIVER( pc1403h )   /* Pocket Computer 1403H                     */
555    DRIVER( ql )        /* 1984 Sinclair QL (UK)                            */
556    DRIVER( ql_us )     /* 1984 Sinclair QL (USA)                           */
557    DRIVER( ql_es )     /* 1984 Sinclair QL (Spain)                         */
558    DRIVER( ql_fr )     /* 1984 Sinclair QL (France)                        */
559    DRIVER( ql_de )     /* 1984 Sinclair QL (Germany)                       */
560    DRIVER( ql_it )     /* 1984 Sinclair QL (Italy)                         */
561    DRIVER( ql_se )     /* 1984 Sinclair QL (Sweden)                        */
562    DRIVER( ql_dk )     /* 1984 Sinclair QL (Denmark)                       */
563    DRIVER( ql_gr )     /* 1984 Sinclair QL (Greece)                        */
564//  DRIVER( tonto )
565//  DRIVER( megaopd )
580566
581   DRIVER( mz700 )      /* 1982 Sharp MZ700                           */
582   DRIVER( mz700j )   /* 1982 Sharp MZ700 Japan                     */
583   DRIVER( mz800 )      /* 1984 Sharp MZ800                           */
584   DRIVER( mz1500 )   /* 1984 Sharp MZ1500                        */
585   DRIVER( mz2500 )   /* 1985 Sharp MZ2500                        */
567    /* SHARP */
568    DRIVER( pc1245 )    /* Pocket Computer 1245                             */
569    DRIVER( pc1250 )    /* Pocket Computer 1250                             */
570    DRIVER( pc1251 )    /* Pocket Computer 1251                             */
571    DRIVER( pc1255 )    /* Pocket Computer 1255                             */
572    DRIVER( trs80pc3 )  /* Tandy TRS80 PC-3                                 */
573    DRIVER( pc1260 )    /* Pocket Computer 1260                             */
574    DRIVER( pc1261 )    /* Pocket Computer 1261                             */
575    DRIVER( pc1401 )    /* Pocket Computer 1401                             */
576    DRIVER( pc1402 )    /* Pocket Computer 1402                             */
577    DRIVER( pc1350 )    /* Pocket Computer 1350                             */
578    DRIVER( pc1403 )    /* Pocket Computer 1403                             */
579    DRIVER( pc1403h )   /* Pocket Computer 1403H                            */
586580
587   DRIVER( mz80kj )   /* 1979 Sharp MZ80K                           */
588   DRIVER( mz80k )      /* 1979 Sharp MZ80K                           */
589   DRIVER( mz80a )      /* 1982 Sharp MZ80A                           */
590   DRIVER( mz80b )      /* 1981 Sharp MZ80B                           */
581    DRIVER( mz700 )     /* 1982 Sharp MZ700                                 */
582    DRIVER( mz700j )    /* 1982 Sharp MZ700 Japan                           */
583    DRIVER( mz800 )     /* 1984 Sharp MZ800                                 */
584    DRIVER( mz1500 )    /* 1984 Sharp MZ1500                                */
585    DRIVER( mz2500 )    /* 1985 Sharp MZ2500                                */
591586
592   DRIVER( x1 )      /* 1982 Sharp X1                           */
593   DRIVER( x1ck )      /* 1984 Sharp X1Ck                           */
594   DRIVER( x1turbo )   /* 1984 Sharp X1 Turbo                        */
595   DRIVER( x1turboz )   /* 1986 Sharp X1 TurboZ                        */
587    DRIVER( mz80kj )    /* 1979 Sharp MZ80K                                 */
588    DRIVER( mz80k )     /* 1979 Sharp MZ80K                                 */
589    DRIVER( mz80a )     /* 1982 Sharp MZ80A                                 */
590    DRIVER( mz80b )     /* 1981 Sharp MZ80B                                 */
596591
597   DRIVER( x68000 )   /* Sharp X68000 (1987)                        */
592    DRIVER( x1 )        /* 1982 Sharp X1                                    */
593    DRIVER( x1ck )      /* 1984 Sharp X1Ck                                  */
594    DRIVER( x1turbo )   /* 1984 Sharp X1 Turbo                              */
595    DRIVER( x1turboz )  /* 1986 Sharp X1 TurboZ                             */
598596
599   /* SILICON GRAPHICS */
600   DRIVER( ip204415 )   /* IP20 Indigo2                              */
601   DRIVER( ip225015 )
602   DRIVER( ip224613 )
603   DRIVER( ip244415 )
597    DRIVER( x68000 )    /* Sharp X68000 (1987)                              */
604598
605   /* TEXAS INSTRUMENTS */
606   DRIVER( ti990_10 )   /* 1975 TI 990/10                           */
607   DRIVER( ti990_4 )   /* 1976 TI 990/4                           */
608   DRIVER( 990189 )   /* 1978 TM 990/189                           */
609   DRIVER( 990189v )   /* 1980 TM 990/189 with Color Video Board         */
599    /* SILICON GRAPHICS */
600    DRIVER( ip204415 )  /* IP20 Indigo2                                     */
601    DRIVER( ip225015 )
602    DRIVER( ip224613 )
603    DRIVER( ip244415 )
610604
611   DRIVER( ti99_224 )   /* 1983 TI 99/2 (24kb ROMs)                     */
612   DRIVER( ti99_232 )   /* 1983 TI 99/2 (32kb ROMs)                     */
613   DRIVER( ti99_4 )   /* 1979 TI-99/4                              */
614   DRIVER( ti99_4e )   /* 1980 TI-99/4 with 50Hz video                  */
615   DRIVER( ti99_4a )   /* 1981 TI-99/4A                           */
616   DRIVER( ti99_4ae )   /* 1981 TI-99/4A with 50Hz video               */
617   DRIVER( ti99_4ev)   /* 1994 TI-99/4A with EVPC video card            */
618   DRIVER( ti99_8 )   /* 1983 TI-99/8                              */
619   DRIVER( ti99_8e )   /* 1983 TI-99/8 with 50Hz video                  */
605    /* TEXAS INSTRUMENTS */
606    DRIVER( ti990_10 )  /* 1975 TI 990/10                                   */
607    DRIVER( ti990_4 )   /* 1976 TI 990/4                                    */
608    DRIVER( 990189 )    /* 1978 TM 990/189                                  */
609    DRIVER( 990189v )   /* 1980 TM 990/189 with Color Video Board           */
620610
621   /* TI 99 clones */
622   DRIVER( tutor)      /* 1983? Tomy Tutor                           */
623   DRIVER( geneve )   /* 1987? Myarc Geneve 9640                     */
624   DRIVER( genmod )   /* 199?? Myarc Geneve 9640                     */
625   DRIVER( ti99_4p )   /* 1996 SNUG 99/4P (a.k.a. SGCPU)               */
611    DRIVER( ti99_224 )  /* 1983 TI 99/2 (24kb ROMs)                         */
612    DRIVER( ti99_232 )  /* 1983 TI 99/2 (32kb ROMs)                         */
613    DRIVER( ti99_4 )    /* 1979 TI-99/4                                     */
614    DRIVER( ti99_4e )   /* 1980 TI-99/4 with 50Hz video                     */
615    DRIVER( ti99_4a )   /* 1981 TI-99/4A                                    */
616    DRIVER( ti99_4ae )  /* 1981 TI-99/4A with 50Hz video                    */
617    DRIVER( ti99_4ev)   /* 1994 TI-99/4A with EVPC video card               */
618    DRIVER( ti99_8 )    /* 1983 TI-99/8                                     */
619    DRIVER( ti99_8e )   /* 1983 TI-99/8 with 50Hz video                     */
626620
627   DRIVER( avigo )      /*                                       */
621    /* TI 99 clones */
622    DRIVER( tutor)      /* 1983? Tomy Tutor                                 */
623    DRIVER( geneve )    /* 1987? Myarc Geneve 9640                          */
624    DRIVER( genmod )    /* 199?? Myarc Geneve 9640                          */
625    DRIVER( ti99_4p )   /* 1996 SNUG 99/4P (a.k.a. SGCPU)                   */
628626
629   /* TEXAS INSTRUMENTS CALCULATORS */
630   DRIVER( ti73 )      /* 1990 TI-73                               */
631   DRIVER( ti81 )      /* 1990 TI-81 (Z80 2 MHz)                     */
632   DRIVER( ti85 )      /* 1992 TI-85 (Z80 6 MHz)                     */
633   DRIVER( ti82 )      /* 1993 TI-82 (Z80 6 MHz)                     */
634   DRIVER( ti83 )      /* 1996 TI-83 (Z80 6 MHz)                     */
635   DRIVER( ti86 )      /* 1997 TI-86 (Z80 6 MHz)                     */
636   DRIVER( ti83p )      /* 1999 TI-83 Plus (Z80 6 MHz)                  */
637   DRIVER( ti83pse )   /* 2001 TI-83 Plus Silver Edition               */
638//   DRIVER( ti84p )      /* 2004 TI-84 Plus                           */
639   DRIVER( ti84pse )   /* 2004 TI-84 Plus Silver Edition               */
640   DRIVER( ti89 )      /* 1998 TI-89                               */
641   DRIVER( ti92 )      /* 1995 TI-92                               */
642   DRIVER( ti92p )      /* 1999 TI-92 Plus                           */
627    DRIVER( avigo )     /*                                                  */
643628
644   /* NEC */
629    /* TEXAS INSTRUMENTS CALCULATORS */
630    DRIVER( ti73 )      /* 1990 TI-73                                       */
631    DRIVER( ti81 )      /* 1990 TI-81 (Z80 2 MHz)                           */
632    DRIVER( ti85 )      /* 1992 TI-85 (Z80 6 MHz)                           */
633    DRIVER( ti82 )      /* 1993 TI-82 (Z80 6 MHz)                           */
634    DRIVER( ti83 )      /* 1996 TI-83 (Z80 6 MHz)                           */
635    DRIVER( ti86 )      /* 1997 TI-86 (Z80 6 MHz)                           */
636    DRIVER( ti83p )     /* 1999 TI-83 Plus (Z80 6 MHz)                      */
637    DRIVER( ti83pse )   /* 2001 TI-83 Plus Silver Edition                   */
638//  DRIVER( ti84p )     /* 2004 TI-84 Plus                                  */
639    DRIVER( ti84pse )   /* 2004 TI-84 Plus Silver Edition                   */
640    DRIVER( ti89 )      /* 1998 TI-89                                       */
641    DRIVER( ti92 )      /* 1995 TI-92                                       */
642    DRIVER( ti92p )     /* 1999 TI-92 Plus                                  */
643
644    /* NEC */
645645    DRIVER( pc6001 )
646   DRIVER( pc6001a )
647   DRIVER( pc6001m2 )
648   DRIVER( pc6001sr )
649   DRIVER( pc6600 )
650   DRIVER( pc6600sr )
651   DRIVER( pc8001 )   /* PC-8001                                 */
652   DRIVER( pc8001m2 )   /* PC-8001mkII                              */
653   DRIVER( pc8801 )   /* PC-8801                                 */
654   DRIVER( pc88m2 )   /* PC-8801mkII (Low res display, VSYNC 15 kHz)      */
655   DRIVER( pc88m2sl )   /* PC-8801mkIISR (Low res display, VSYNC 15 kHz)   */
656   DRIVER( pc88m2sh )   /* PC-8801mkIISR (High res display, VSYNC 24 kHz)   */
657   DRIVER( pc88m2fr )   /* PC-8801mkIIFR (High res display, VSYNC 24 kHz)   */
658   DRIVER( pc88m2mr )   /* PC-8801mkIIMR (High res display, VSYNC 24 kHz)   */
659   DRIVER( pc8801mh )   /* PC-8801MH (High res display, VSYNC 24 kHz)      */
660   DRIVER( pc8801fa )   /* PC-8801FA (High res display, VSYNC 24 kHz)      */
661   DRIVER( pc8801ma )   /* PC-8801MA (High res display, VSYNC 24 kHz)      */
662   DRIVER( pc8801ma2 )   /* PC-8801MA2 (High res display, VSYNC 24 kHz)      */
663   DRIVER( pc8801mc )   /* PC-8801MC (High res display, VSYNC 24 kHz)      */
664   DRIVER( pc88va )   /* PC-88 VA                                 */
665   DRIVER( pc9801 )   /* PC-9801                                 */
666   DRIVER( pc9821 )   /* PC-9821                                 */
646    DRIVER( pc6001a )
647    DRIVER( pc6001m2 )
648    DRIVER( pc6001sr )
649    DRIVER( pc6600 )
650    DRIVER( pc6600sr )
651    DRIVER( pc8001 )    /* PC-8001                                          */
652    DRIVER( pc8001m2 )  /* PC-8001mkII                                      */
653    DRIVER( pc8801 )    /* PC-8801                                          */
654    DRIVER( pc88m2 )    /* PC-8801mkII (Low res display, VSYNC 15 kHz)      */
655    DRIVER( pc88m2sl )  /* PC-8801mkIISR (Low res display, VSYNC 15 kHz)    */
656    DRIVER( pc88m2sh )  /* PC-8801mkIISR (High res display, VSYNC 24 kHz)   */
657    DRIVER( pc88m2fr )  /* PC-8801mkIIFR (High res display, VSYNC 24 kHz)   */
658    DRIVER( pc88m2mr )  /* PC-8801mkIIMR (High res display, VSYNC 24 kHz)   */
659    DRIVER( pc8801mh )  /* PC-8801MH (High res display, VSYNC 24 kHz)       */
660    DRIVER( pc8801fa )  /* PC-8801FA (High res display, VSYNC 24 kHz)       */
661    DRIVER( pc8801ma )  /* PC-8801MA (High res display, VSYNC 24 kHz)       */
662    DRIVER( pc8801ma2 ) /* PC-8801MA2 (High res display, VSYNC 24 kHz)      */
663    DRIVER( pc8801mc )  /* PC-8801MC (High res display, VSYNC 24 kHz)       */
664    DRIVER( pc88va )    /* PC-88 VA                                         */
665    DRIVER( pc9801 )    /* PC-9801                                          */
666    DRIVER( pc9821 )    /* PC-9821                                          */
667667
668   /* CANTAB */
669   DRIVER( jupiter )   /* Jupiter Ace                              */
668    /* CANTAB */
669    DRIVER( jupiter )   /* Jupiter Ace                                      */
670670
671   /* SORD */
672   DRIVER( sordm5 )
673   DRIVER( srdm5fd5 )
671    /* SORD */
672    DRIVER( sordm5 )
673    DRIVER( srdm5fd5 )
674674
675   /* APF Electronics Inc. */
676   DRIVER( apfm1000 )
677   DRIVER( apfimag )
675    /* APF Electronics Inc. */
676    DRIVER( apfm1000 )
677    DRIVER( apfimag )
678678
679   /* Tatung */
680   DRIVER( einstein )
681   DRIVER( einstei2 )
679    /* Tatung */
680    DRIVER( einstein )
681    DRIVER( einstei2 )
682682
683   /* INTELLIGENT SOFTWARE */
684   DRIVER( ep64 )      /* Enterprise 64                           */
685   DRIVER( ep128 )      /* Enterprise 128                           */
686   DRIVER( phc64 )      /* Hegener & Glaser Mephisto PHC 64               */
683    /* INTELLIGENT SOFTWARE */
684    DRIVER( ep64 )      /* Enterprise 64                                    */
685    DRIVER( ep128 )     /* Enterprise 128                                   */
686    DRIVER( phc64 )     /* Hegener & Glaser Mephisto PHC 64                 */
687687
688   /* NON LINEAR SYSTEMS */
689   DRIVER( kaypro2x )   /* Kaypro 2 - 2/84 */
690   DRIVER( kayproii )   /* Kaypro II - 2/83 */
691   DRIVER( kaypro4 )   /* Kaypro 4 - 4/83 */
692   DRIVER( kaypro10 )   /* Kaypro 10 */
693   DRIVER( omni2 )      /* Omni II */
688    /* NON LINEAR SYSTEMS */
689    DRIVER( kaypro2x )  /* Kaypro 2 - 2/84 */
690    DRIVER( kayproii )  /* Kaypro II - 2/83 */
691    DRIVER( kaypro4 )   /* Kaypro 4 - 4/83 */
692    DRIVER( kaypro10 )  /* Kaypro 10 */
693    DRIVER( omni2 )     /* Omni II */
694694
695   /* VEB MIKROELEKTRONIK */
696   /* KC compact is partial CPC compatible */
697   DRIVER( kc85_4 )   /* VEB KC 85/4                              */
698   DRIVER( kc85_3 )   /* VEB KC 85/3                              */
699   DRIVER( kc85_4d )   /* VEB KC 85/4 with disk interface               */
700   DRIVER( mc8020 )   /* MC 80.2x                                 */
701   DRIVER( mc8030 )   /* MC 80.3x                                 */
695    /* VEB MIKROELEKTRONIK */
696    /* KC compact is partial CPC compatible */
697    DRIVER( kc85_4 )    /* VEB KC 85/4                                      */
698    DRIVER( kc85_3 )    /* VEB KC 85/3                                      */
699    DRIVER( kc85_4d )   /* VEB KC 85/4 with disk interface                  */
700    DRIVER( mc8020 )    /* MC 80.2x                                         */
701    DRIVER( mc8030 )    /* MC 80.3x                                         */
702702
703703
704   /* MICROBEE SYSTEMS */
705   DRIVER( mbee )      /* Microbee 16 Standard or Plus                  */
706   DRIVER( mbeeic )   /* Microbee 32 IC                           */
707   DRIVER( mbeepc )   /* Microbee 32 PC                           */
708   DRIVER( mbeepc85 )   /* Microbee 32 PC85                           */
709   DRIVER( mbeeppc )   /* Microbee 32 PPC85                           */
710   DRIVER( mbee56 )   /* Microbee 56K (CP/M)                        */
711   DRIVER( mbee64 )   /* Microbee 64K (CP/M)                        */
704    /* MICROBEE SYSTEMS */
705    DRIVER( mbee )      /* Microbee 16 Standard or Plus                     */
706    DRIVER( mbeeic )    /* Microbee 32 IC                                   */
707    DRIVER( mbeepc )    /* Microbee 32 PC                                   */
708    DRIVER( mbeepc85 )  /* Microbee 32 PC85                                 */
709    DRIVER( mbeeppc )   /* Microbee 32 PPC85                                    */
710    DRIVER( mbee56 )    /* Microbee 56K (CP/M)                              */
711    DRIVER( mbee64 )    /* Microbee 64K (CP/M)                              */
712712
713   /* TANDY RADIO SHACK */
714   DRIVER( trs80 )      /* TRS-80 Model I - Level I BASIC               */
715   DRIVER( trs80l2 )   /* TRS-80 Model I - Level II BASIC               */
716   DRIVER( sys80 )      /* EACA System 80                           */
717   DRIVER( lnw80 )      /* LNW Research LNW-80                        */
718   DRIVER( trs80m3 )   /* TRS-80 Model III - Radio Shack/Tandy            */
719   DRIVER( trs80m4 )
720   DRIVER( trs80m4p )
721   DRIVER( ht1080z ) /* Hradstechnika Szvetkezet HT-1080Z */
722   DRIVER( ht1080z2 ) /* Hradstechnika Szvetkezet HT-1080Z Series II */
723   DRIVER( ht108064 ) /* Hradstechnika Szvetkezet HT-1080Z/64 */
724   DRIVER( radionic )   /* Radionic */
713    /* TANDY RADIO SHACK */
714    DRIVER( trs80 )     /* TRS-80 Model I - Level I BASIC                   */
715    DRIVER( trs80l2 )   /* TRS-80 Model I - Level II BASIC                  */
716    DRIVER( sys80 )     /* EACA System 80                                   */
717    DRIVER( lnw80 )     /* LNW Research LNW-80                              */
718    DRIVER( trs80m3 )   /* TRS-80 Model III - Radio Shack/Tandy             */
719    DRIVER( trs80m4 )
720    DRIVER( trs80m4p )
721    DRIVER( ht1080z ) /* Hradstechnika Szvetkezet HT-1080Z */
722    DRIVER( ht1080z2 ) /* Hradstechnika Szvetkezet HT-1080Z Series II */
723    DRIVER( ht108064 ) /* Hradstechnika Szvetkezet HT-1080Z/64 */
724    DRIVER( radionic )  /* Radionic */
725725
726   DRIVER( coco )      /* Color Computer                           */
727   DRIVER( cocoe )      /* Color Computer (Extended BASIC 1.0)            */
728   DRIVER( coco2 )      /* Color Computer 2                           */
729   DRIVER( coco2b )   /* Color Computer 2B (uses M6847T1 video chip)      */
730   DRIVER( coco3 )      /* Color Computer 3 (NTSC)                     */
731   DRIVER( coco3p )   /* Color Computer 3 (PAL)                     */
732   DRIVER( coco3h )   /* Hacked Color Computer 3 (6309)               */
733   DRIVER( dragon32 )   /* Dragon 32                              */
734   DRIVER( dragon64 )   /* Dragon 64                              */
735   DRIVER( d64plus )   /* Dragon 64 + Compusense Plus addon            */
736   DRIVER( dgnalpha )   /* Dragon Alpha                              */
737   DRIVER( dgnbeta )   /* Dragon Beta                              */
738   DRIVER( tanodr64 )   /* Tano Dragon 64 (NTSC)                     */
739   DRIVER( cp400 )      /* Prologica CP400                           */
740   DRIVER( mc10 )      /* MC-10                                 */
741   DRIVER( alice )      /* Matra & Hachette Ordinateur Alice            */
726    DRIVER( coco )      /* Color Computer                                   */
727    DRIVER( cocoe )     /* Color Computer (Extended BASIC 1.0)              */
728    DRIVER( coco2 )     /* Color Computer 2                                 */
729    DRIVER( coco2b )    /* Color Computer 2B (uses M6847T1 video chip)      */
730    DRIVER( coco3 )     /* Color Computer 3 (NTSC)                          */
731    DRIVER( coco3p )    /* Color Computer 3 (PAL)                           */
732    DRIVER( coco3h )    /* Hacked Color Computer 3 (6309)                   */
733    DRIVER( dragon32 )  /* Dragon 32                                        */
734    DRIVER( dragon64 )  /* Dragon 64                                        */
735    DRIVER( d64plus )   /* Dragon 64 + Compusense Plus addon                */
736    DRIVER( dgnalpha )  /* Dragon Alpha                                     */
737    DRIVER( dgnbeta )   /* Dragon Beta                                      */
738    DRIVER( tanodr64 )  /* Tano Dragon 64 (NTSC)                            */
739    DRIVER( cp400 )     /* Prologica CP400                                  */
740    DRIVER( mc10 )      /* MC-10                                            */
741    DRIVER( alice )     /* Matra & Hachette Ordinateur Alice                */
742742
743   /* EACA */
744   DRIVER( cgenie )   /* Colour Genie EG2000                        */
745   /* system 80 trs80 compatible */
743    /* EACA */
744    DRIVER( cgenie )    /* Colour Genie EG2000                              */
745    /* system 80 trs80 compatible */
746746
747   /* VIDEO TECHNOLOGY  */
748   DRIVER( crvision )   /* 1981 creatiVision                        */
749   DRIVER( fnvision )   /* 1983 FunVision                           */
750   DRIVER( crvisioj )
751   DRIVER( wizzard )
752   DRIVER( rameses )
753   DRIVER( vz2000 )
754   DRIVER( crvisio2 )
755   DRIVER( laser110 )   /* 1983 Laser 110                           */
756   DRIVER( las110de )   /* 1983 Sanyo Laser 110 (Germany)               */
757   DRIVER( laser200 )   /* 1983 Laser 200 (color version of 110)         */
758//   DRIVER( vz200de )   /* 1983 VZ-200 (Germany)                     */
759   DRIVER( fellow )   /* 1983 Salora Fellow (Finland)                */
760   DRIVER( tx8000 )   /* 1983 Texet TX-8000 (U.K.)                  */
761   DRIVER( laser210 )   /* 1984 Laser 210 (200 with more memory)         */
762   DRIVER( las210de )   /* 1984 Sanyo Laser 210 (Germany)               */
763   DRIVER( vz200 )      /* 1984 Dick Smith Electronics VZ-200            */
764   DRIVER( laser310 )   /* 1984 Laser 310 (210 with diff. keyboard and RAM)   */
765   DRIVER( vz300 )      /* 1984 Dick Smith Electronics VZ-300            */
766   DRIVER( laser350 )   /* 1984? Laser 350                           */
767   DRIVER( laser500 )   /* 1984? Laser 500                           */
768   DRIVER( laser700 )   /* 1984? Laser 700                           */
769   DRIVER( socrates )   /* 1988 Socrates Educational Video System */
770   DRIVER( socratfc )   /* 1988 Socrates SAITOUT */
747    /* VIDEO TECHNOLOGY  */
748    DRIVER( crvision )  /* 1981 creatiVision                                */
749    DRIVER( fnvision )  /* 1983 FunVision                                   */
750    DRIVER( crvisioj )
751    DRIVER( wizzard )
752    DRIVER( rameses )
753    DRIVER( vz2000 )
754    DRIVER( crvisio2 )
755    DRIVER( laser110 )  /* 1983 Laser 110                                   */
756    DRIVER( las110de )  /* 1983 Sanyo Laser 110 (Germany)                   */
757    DRIVER( laser200 )  /* 1983 Laser 200 (color version of 110)            */
758//  DRIVER( vz200de )   /* 1983 VZ-200 (Germany)                            */
759    DRIVER( fellow )    /* 1983 Salora Fellow (Finland)                     */
760    DRIVER( tx8000 )    /* 1983 Texet TX-8000 (U.K.)                        */
761    DRIVER( laser210 )  /* 1984 Laser 210 (200 with more memory)            */
762    DRIVER( las210de )  /* 1984 Sanyo Laser 210 (Germany)                   */
763    DRIVER( vz200 )     /* 1984 Dick Smith Electronics VZ-200               */
764    DRIVER( laser310 )  /* 1984 Laser 310 (210 with diff. keyboard and RAM) */
765    DRIVER( vz300 )     /* 1984 Dick Smith Electronics VZ-300               */
766    DRIVER( laser350 )  /* 1984? Laser 350                                  */
767    DRIVER( laser500 )  /* 1984? Laser 500                                  */
768    DRIVER( laser700 )  /* 1984? Laser 700                                  */
769    DRIVER( socrates )  /* 1988 Socrates Educational Video System */
770    DRIVER( socratfc )  /* 1988 Socrates SAITOUT */
771771
772   /* TANGERINE */
773   DRIVER( microtan )   /* 1979 Microtan 65                           */
772    /* TANGERINE */
773    DRIVER( microtan )  /* 1979 Microtan 65                                 */
774774
775   DRIVER( oric1 )      /* 1983 Oric 1                              */
776   DRIVER( orica )      /* 1984 Oric Atmos                           */
777   DRIVER( prav8d )   /* 1985 Pravetz 8D                           */
778   DRIVER( prav8dd )   /* 1989 Pravetz 8D (Disk ROM)                  */
779   DRIVER( telstrat )   /* ??? Oric Telestrat/Stratos                  */
775    DRIVER( oric1 )     /* 1983 Oric 1                                      */
776    DRIVER( orica )     /* 1984 Oric Atmos                                  */
777    DRIVER( prav8d )    /* 1985 Pravetz 8D                                  */
778    DRIVER( prav8dd )   /* 1989 Pravetz 8D (Disk ROM)                       */
779    DRIVER( telstrat )  /* ??? Oric Telestrat/Stratos                       */
780780
781   /* PHILIPS */
782   DRIVER( p2000t )   /* 1980 P2000T                              */
783   DRIVER( p2000m )   /* 1980 P2000M                              */
784   DRIVER( videopac )   /* 1979 Videopac G7000/C52                     */
785   DRIVER( g7400 )      /* 1983 Videopac Plus G7400                     */
786   DRIVER( vg5k )      /* 1984 VG-5000                              */
781    /* PHILIPS */
782    DRIVER( p2000t )    /* 1980 P2000T                                      */
783    DRIVER( p2000m )    /* 1980 P2000M                                      */
784    DRIVER( videopac )  /* 1979 Videopac G7000/C52                          */
785    DRIVER( g7400 )     /* 1983 Videopac Plus G7400                         */
786    DRIVER( vg5k )      /* 1984 VG-5000                                     */
787787
788   /* COMPUKIT */
789   DRIVER( uk101 )
788    /* COMPUKIT */
789    DRIVER( uk101 )
790790
791   /* OHIO SCIENTIFIC */
792   DRIVER( sb2m600b )
793   DRIVER( c1p )
794   DRIVER( c1pmf )
791    /* OHIO SCIENTIFIC */
792    DRIVER( sb2m600b )
793    DRIVER( c1p )
794    DRIVER( c1pmf )
795795
796   /* ASCII & MICROSOFT */
797   DRIVER( msx )      /* 1983 MSX                               */
798   DRIVER( ax170 )
799   DRIVER( canonv10 )
800   DRIVER( canonv20 )
801   DRIVER( dpc100 )   /* 1984 MSX Korea                           */
802   DRIVER( dpc180 )   /* 1984 MSX Korea                           */
803   DRIVER( dpc200 )   /* 1984 MSX Korea                           */
804   DRIVER( gsfc200 )
805   DRIVER( expert10 )   /* 1983 MSX Brazil                           */
806   DRIVER( expert11 )   /* 1984 MSX Brazil                           */
807   DRIVER( expert13 )   /* 1984 MSX Brazil                           */
808   DRIVER( expertdp )   /* 1985 MSX Brazil                           */
809   DRIVER( expertpl )   /* 1984 MSX Brazil                           */
810   DRIVER( jvchc7gb )
811   DRIVER( mlf80 )
812   DRIVER( mlfx1 )
813   DRIVER( cf1200 )   /* 1984 MSX Japan                           */
814   DRIVER( cf2000 )   /* 1983 MSX Japan                           */
815   DRIVER( cf2700 )   /* 1984 MSX Japan                           */
816   DRIVER( cf3000 )   /* 1984 MSX Japan                           */
817   DRIVER( cf3300 )   /* 1985 MSX Japan                           */
818   DRIVER( fs1300 )   /* 1985 MSX Japan                           */
819   DRIVER( fs4000 )   /* 1985 MSX Japan                           */
820   DRIVER( nms801 )
821   DRIVER( vg8000 )
822   DRIVER( vg8010 )
823   DRIVER( vg8010f )
824   DRIVER( vg802000 )
825   DRIVER( vg802020 )   /* 1985 MSX                                 */
826   DRIVER( piopx7 )
827   DRIVER( mpc100 )
828   DRIVER( hotbit11 )   /* 1985 MSX Brazil                           */
829   DRIVER( hotbit12 )   /* 1985 MSX   Brazil                           */
830   DRIVER( hotbi13b )   /* 1985 MSX   Brazil                           */
831   DRIVER( hotbi13p )   /* 1985 MSX   Brazil                           */
832   DRIVER( hotbit20 )   /* 1986 MSX2 Brazil                           */
833   DRIVER( hb10p )
834   DRIVER( hb20p )
835   DRIVER( hb201 )      /* 1985 MSX Japan                           */
836   DRIVER( hb201p )   /* 1985 MSX                                 */
837   DRIVER( hb501p )   /* 1984 MSX                                 */
838   DRIVER( hb55d )      /* 1983 MSX Germany                           */
839   DRIVER( hb55p )      /* 1983 MSX                                 */
840   DRIVER( hb75d )      /* 1983 MSX Germany                           */
841   DRIVER( hb75p )      /* 1983 MSX                                 */
842   DRIVER( svi728 )   /* 1985 MSX                                 */
843   DRIVER( svi738 )   /* 1985 MSX                                 */
844   DRIVER( svi738sw )   /* 1985 MSX                                 */
845   DRIVER( tadpc200 )
846   DRIVER( tadpc20a )
847   DRIVER( hx10 )      /* 1984 MSX                                 */
848   DRIVER( hx10s )      /* 1984 MSX                                 */
849   DRIVER( hx20 )      /* 1984 MSX                                 */
850   DRIVER( cx5m )
851   DRIVER( cx5m128 )
852   DRIVER( cx5m2 )
853   DRIVER( yis303 )
854   DRIVER( yis503 )
855   DRIVER( yis503ii )
856   DRIVER( y503iir )
857   DRIVER( y503iir2 )
858   DRIVER( yis503m )
859   DRIVER( yc64 )
860   DRIVER( bruc100 )
796    /* ASCII & MICROSOFT */
797    DRIVER( msx )       /* 1983 MSX                                         */
798    DRIVER( ax170 )
799    DRIVER( canonv10 )
800    DRIVER( canonv20 )
801    DRIVER( dpc100 )    /* 1984 MSX Korea                                   */
802    DRIVER( dpc180 )    /* 1984 MSX Korea                                   */
803    DRIVER( dpc200 )    /* 1984 MSX Korea                                   */
804    DRIVER( gsfc200 )
805    DRIVER( expert10 )  /* 1983 MSX Brazil                                  */
806    DRIVER( expert11 )  /* 1984 MSX Brazil                                  */
807    DRIVER( expert13 )  /* 1984 MSX Brazil                                  */
808    DRIVER( expertdp )  /* 1985 MSX Brazil                                  */
809    DRIVER( expertpl )  /* 1984 MSX Brazil                                  */
810    DRIVER( jvchc7gb )
811    DRIVER( mlf80 )
812    DRIVER( mlfx1 )
813    DRIVER( cf1200 )    /* 1984 MSX Japan                                   */
814    DRIVER( cf2000 )    /* 1983 MSX Japan                                   */
815    DRIVER( cf2700 )    /* 1984 MSX Japan                                   */
816    DRIVER( cf3000 )    /* 1984 MSX Japan                                   */
817    DRIVER( cf3300 )    /* 1985 MSX Japan                                   */
818    DRIVER( fs1300 )    /* 1985 MSX Japan                                   */
819    DRIVER( fs4000 )    /* 1985 MSX Japan                                   */
820    DRIVER( nms801 )
821    DRIVER( vg8000 )
822    DRIVER( vg8010 )
823    DRIVER( vg8010f )
824    DRIVER( vg802000 )
825    DRIVER( vg802020 )  /* 1985 MSX                                         */
826    DRIVER( piopx7 )
827    DRIVER( mpc100 )
828    DRIVER( hotbit11 )  /* 1985 MSX Brazil                                  */
829    DRIVER( hotbit12 )  /* 1985 MSX Brazil                                  */
830    DRIVER( hotbi13b )  /* 1985 MSX Brazil                                  */
831    DRIVER( hotbi13p )  /* 1985 MSX Brazil                                  */
832    DRIVER( hotbit20 )  /* 1986 MSX2 Brazil                                 */
833    DRIVER( hb10p )
834    DRIVER( hb20p )
835    DRIVER( hb201 )     /* 1985 MSX Japan                                   */
836    DRIVER( hb201p )    /* 1985 MSX                                         */
837    DRIVER( hb501p )    /* 1984 MSX                                         */
838    DRIVER( hb55d )     /* 1983 MSX Germany                                 */
839    DRIVER( hb55p )     /* 1983 MSX                                         */
840    DRIVER( hb75d )     /* 1983 MSX Germany                                 */
841    DRIVER( hb75p )     /* 1983 MSX                                         */
842    DRIVER( svi728 )    /* 1985 MSX                                         */
843    DRIVER( svi738 )    /* 1985 MSX                                         */
844    DRIVER( svi738sw )  /* 1985 MSX                                         */
845    DRIVER( tadpc200 )
846    DRIVER( tadpc20a )
847    DRIVER( hx10 )      /* 1984 MSX                                         */
848    DRIVER( hx10s )     /* 1984 MSX                                         */
849    DRIVER( hx20 )      /* 1984 MSX                                         */
850    DRIVER( cx5m )
851    DRIVER( cx5m128 )
852    DRIVER( cx5m2 )
853    DRIVER( yis303 )
854    DRIVER( yis503 )
855    DRIVER( yis503ii )
856    DRIVER( y503iir )
857    DRIVER( y503iir2 )
858    DRIVER( yis503m )
859    DRIVER( yc64 )
860    DRIVER( bruc100 )
861861
862862
863   DRIVER( msx2 )      /* 1985 MSX2                              */
864   DRIVER( ax350 )
865   DRIVER( ax370 )
866   DRIVER( hbf9p )      /* 1985 MSX2                              */
867   DRIVER( hbf9s )      /* 1985 MSX2                              */
868   DRIVER( hbf500p )   /* 1985 MSX2                              */
869   DRIVER( hbf700d )   /* 1985 MSX2 Germany                        */
870   DRIVER( hbf700f )   /* 1985 MSX2                   */
871   DRIVER( hbf700p )   /* 1985 MSX2                              */
872   DRIVER( hbf700s )   /* 1985 MSX2 Spain                           */
873   DRIVER( hbg900ap )   /* 1986 MSX2                              */
874   DRIVER( hbg900p )   /* 1986 MSX2                              */
875   DRIVER( nms8220 )   /* 1986 MSX2                              */
876   DRIVER( nms8220a )   /* 1986 MSX2                              */
877   DRIVER( vg8230 )   /* 1986 MSX2                              */
878   DRIVER( vg8235 )   /* 1986 MSX2                              */
879   DRIVER( vg8235f)   /* 1986 MSX2                              */
880   DRIVER( vg8240)   /* 1986 MSX2                              */
881   DRIVER( nms8245 )   /* 1986 MSX2                              */
882   DRIVER( nms8245f)   /* 1986 MSX2                              */
883   DRIVER( nms8250 )   /* 1986 MSX2                              */
884   DRIVER( nms8255 )   /* 1986 MSX2                              */
885   DRIVER( nms8280 )   /* 1986 MSX2                              */
886   DRIVER( nms8280g)   /* 1986 MSX2                              */
887   DRIVER( tpc310)     /* 1986 MSX2                              */
888   DRIVER( hx23)       /* 1986 MSX2                              */
889   DRIVER( hx23f)     /* 1986 MSX2                              */
890   DRIVER( cx7m)       /* 1986 MSX2                              */
891   DRIVER( cx7m128)   /* 1986 MSX2                              */
892   DRIVER( fs5500 )   /* 1985 MSX2 Japan                           */
893   DRIVER( fs4500 )   /* 1986 MSX2 Japan                           */
894   DRIVER( fs4700 )   /* 1986 MSX2 Japan                           */
895   DRIVER( fs5000 )   /* 1986 MSX2 Japan                           */
896   DRIVER( fs4600 )   /* 1986 MSX2 Japan                           */
897   DRIVER( fsa1 )      /* 1986 MSX2 Japan                           */
898   DRIVER( fsa1a )      /* 1986 MSX2 Japan                           */
899   DRIVER( fsa1mk2 )   /* 1987 MSX2 Japan                           */
900   DRIVER( fsa1f )      /* 1987 MSX2 Japan                           */
901   DRIVER( fsa1fm )   /* 1988 MSX2 Japan                           */
902   DRIVER( hbf500 )   /* 1986 MSX2 Japan                           */
903   DRIVER( hbf900 )   /* 1986 MSX2 Japan                           */
904   DRIVER( hbf900a )   /* 1986 MSX2 Japan                           */
905   DRIVER( hbf1 )      /* 1986 MSX2 Japan                           */
906   DRIVER( hbf12 )      /* 1987 MSX2 Japan                           */
907   DRIVER( hbf1xd )   /* 1987 MSX2 Japan                           */
908   DRIVER( hbf1xdm2 )   /* 1988 MSX2 Japan                           */
909   DRIVER( phc23 )      /* 1986 MSX2 Japan                           */
910   DRIVER( cpc300 )   /* 1986 MSX2 Korea                           */
911   DRIVER( cpc300e )   /* 1986 MSX2 Korea                           */
912   DRIVER( cpc400 )   /* 1986 MSX2 Korea                           */
913   DRIVER( cpc400s )   /* 1986 MSX2 Korea                           */
914   DRIVER( expert20 )/* 1986 MSX2 Korea                           */
863    DRIVER( msx2 )      /* 1985 MSX2                                        */
864    DRIVER( ax350 )
865    DRIVER( ax370 )
866    DRIVER( hbf9p )     /* 1985 MSX2                                        */
867    DRIVER( hbf9s )     /* 1985 MSX2                                        */
868    DRIVER( hbf500p )   /* 1985 MSX2                                        */
869    DRIVER( hbf700d )   /* 1985 MSX2 Germany                                */
870    DRIVER( hbf700f )   /* 1985 MSX2                        */
871    DRIVER( hbf700p )   /* 1985 MSX2                                        */
872    DRIVER( hbf700s )   /* 1985 MSX2 Spain                                  */
873    DRIVER( hbg900ap )  /* 1986 MSX2                                        */
874    DRIVER( hbg900p )   /* 1986 MSX2                                        */
875    DRIVER( nms8220 )   /* 1986 MSX2                                        */
876    DRIVER( nms8220a )  /* 1986 MSX2                                        */
877    DRIVER( vg8230 )    /* 1986 MSX2                                        */
878    DRIVER( vg8235 )    /* 1986 MSX2                                        */
879    DRIVER( vg8235f)    /* 1986 MSX2                                        */
880    DRIVER( vg8240) /* 1986 MSX2                                        */
881    DRIVER( nms8245 )   /* 1986 MSX2                                        */
882    DRIVER( nms8245f)   /* 1986 MSX2                                        */
883    DRIVER( nms8250 )   /* 1986 MSX2                                        */
884    DRIVER( nms8255 )   /* 1986 MSX2                                        */
885    DRIVER( nms8280 )   /* 1986 MSX2                                        */
886    DRIVER( nms8280g)   /* 1986 MSX2                                        */
887    DRIVER( tpc310)   /* 1986 MSX2                                      */
888    DRIVER( hx23)       /* 1986 MSX2                                        */
889    DRIVER( hx23f)    /* 1986 MSX2                                      */
890    DRIVER( cx7m)       /* 1986 MSX2                                        */
891    DRIVER( cx7m128)    /* 1986 MSX2                                        */
892    DRIVER( fs5500 )    /* 1985 MSX2 Japan                                  */
893    DRIVER( fs4500 )    /* 1986 MSX2 Japan                                  */
894    DRIVER( fs4700 )    /* 1986 MSX2 Japan                                  */
895    DRIVER( fs5000 )    /* 1986 MSX2 Japan                                  */
896    DRIVER( fs4600 )    /* 1986 MSX2 Japan                                  */
897    DRIVER( fsa1 )      /* 1986 MSX2 Japan                                  */
898    DRIVER( fsa1a )     /* 1986 MSX2 Japan                                  */
899    DRIVER( fsa1mk2 )   /* 1987 MSX2 Japan                                  */
900    DRIVER( fsa1f )     /* 1987 MSX2 Japan                                  */
901    DRIVER( fsa1fm )    /* 1988 MSX2 Japan                                  */
902    DRIVER( hbf500 )    /* 1986 MSX2 Japan                                  */
903    DRIVER( hbf900 )    /* 1986 MSX2 Japan                                  */
904    DRIVER( hbf900a )   /* 1986 MSX2 Japan                                  */
905    DRIVER( hbf1 )      /* 1986 MSX2 Japan                                  */
906    DRIVER( hbf12 )     /* 1987 MSX2 Japan                                  */
907    DRIVER( hbf1xd )    /* 1987 MSX2 Japan                                  */
908    DRIVER( hbf1xdm2 )  /* 1988 MSX2 Japan                                  */
909    DRIVER( phc23 )     /* 1986 MSX2 Japan                                  */
910    DRIVER( cpc300 )    /* 1986 MSX2 Korea                                  */
911    DRIVER( cpc300e )   /* 1986 MSX2 Korea                                  */
912    DRIVER( cpc400 )    /* 1986 MSX2 Korea                                  */
913    DRIVER( cpc400s )   /* 1986 MSX2 Korea                                  */
914    DRIVER( expert20 )/* 1986 MSX2 Korea                                    */
915915
916   DRIVER( msx2p )      /* 1988 MSX2+ Japan                           */
917   DRIVER( fsa1fx )   /* 1988 MSX2+ Japan                           */
918   DRIVER( fsa1wx )   /* 1988 MSX2+ Japan                           */
919   DRIVER( fsa1wxa )   /* 1988 MSX2+ Japan                           */
920   DRIVER( fsa1wsx )   /* 1989 MSX2+ Japan                           */
921   DRIVER( hbf1xdj )   /* 1988 MSX2+ Japan                           */
922   DRIVER( hbf1xv )   /* 1989 MSX2+ Japan                           */
923   DRIVER( phc70fd )   /* 1988 MSX2+ Japan                           */
924   DRIVER( phc70fd2 )   /* 1988 MSX2+ Japan                           */
925   DRIVER( phc35j )   /* 1989 MSX2+ Japan                           */
916    DRIVER( msx2p )     /* 1988 MSX2+ Japan                                 */
917    DRIVER( fsa1fx )    /* 1988 MSX2+ Japan                                 */
918    DRIVER( fsa1wx )    /* 1988 MSX2+ Japan                                 */
919    DRIVER( fsa1wxa )   /* 1988 MSX2+ Japan                                 */
920    DRIVER( fsa1wsx )   /* 1989 MSX2+ Japan                                 */
921    DRIVER( hbf1xdj )   /* 1988 MSX2+ Japan                                 */
922    DRIVER( hbf1xv )    /* 1989 MSX2+ Japan                                 */
923    DRIVER( phc70fd )   /* 1988 MSX2+ Japan                                 */
924    DRIVER( phc70fd2 )  /* 1988 MSX2+ Japan                                 */
925    DRIVER( phc35j )    /* 1989 MSX2+ Japan                                 */
926926
927927
928   /* NASCOM MICROCOMPUTERS */
929   DRIVER( nascom1 )   /* 1978 Nascom 1                           */
930   DRIVER( nascom2 )   /* 1979 Nascom 2                           */
928    /* NASCOM MICROCOMPUTERS */
929    DRIVER( nascom1 )   /* 1978 Nascom 1                                    */
930    DRIVER( nascom2 )   /* 1979 Nascom 2                                    */
931931
932   /* MILES GORDON TECHNOLOGY */
933   DRIVER( samcoupe )   /* 1989 Sam Coupe                           */
932    /* MILES GORDON TECHNOLOGY */
933    DRIVER( samcoupe )  /* 1989 Sam Coupe                                   */
934934
935   /* MOTOROLA */
936   DRIVER( mekd2 )      /* 1977 Motorola Evaluation Kit                  */
935    /* MOTOROLA */
936    DRIVER( mekd2 )     /* 1977 Motorola Evaluation Kit                     */
937937
938   /* DEC */
939   DRIVER( pdp1 )      /* 1961 DEC PDP1                           */
938    /* DEC */
939    DRIVER( pdp1 )      /* 1961 DEC PDP1                                    */
940940
941   /* MEMOTECH */
942   DRIVER( mtx512 )   /* 1983 Memotech MTX 512                     */
943   DRIVER( mtx500 )   /* 1983 Memotech MTX 500                     */
944   DRIVER( rs128 )      /* 1984 Memotech RS 128                        */
941    /* MEMOTECH */
942    DRIVER( mtx512 )    /* 1983 Memotech MTX 512                            */
943    DRIVER( mtx500 )    /* 1983 Memotech MTX 500                            */
944    DRIVER( rs128 )     /* 1984 Memotech RS 128                             */
945945
946   /* MATTEL */
947   DRIVER( intvkbd )   /* 1981 - Mattel Intellivision Keyboard Component   */
948                  /* (Test marketed, later recalled)               */
949   DRIVER( aquarius )   /* 1983 Aquarius                           */
950//   DRIVER( aquariu2 )   /* 1984 Aquarius II                           */
946    /* MATTEL */
947    DRIVER( intvkbd )   /* 1981 - Mattel Intellivision Keyboard Component   */
948                        /* (Test marketed, later recalled)                  */
949    DRIVER( aquarius )  /* 1983 Aquarius                                    */
950//  DRIVER( aquariu2 )  /* 1984 Aquarius II                                 */
951951
952   /*EXIDY INC */
953   DRIVER( exidy )      /* Sorcerer                                 */
954   DRIVER( exidyd )   /* Sorcerer (cassette only)                        */
952    /*EXIDY INC */
953    DRIVER( exidy )     /* Sorcerer                                         */
954    DRIVER( exidyd )    /* Sorcerer (cassette only)                             */
955955
956   /* GALAKSIJA */
957   DRIVER( galaxy )
958   DRIVER( galaxyp )
956    /* GALAKSIJA */
957    DRIVER( galaxy )
958    DRIVER( galaxyp )
959959
960   /* Lviv/L'vov */
961   DRIVER( lviv )      /* Lviv/L'vov                              */
960    /* Lviv/L'vov */
961    DRIVER( lviv )      /* Lviv/L'vov                                       */
962962
963   /* Tesla */
964   DRIVER( pmd851 )   /* PMD-85.1                                 */
965   DRIVER( pmd852 )   /* PMD-85.2                                 */
966   DRIVER( pmd852a )   /* PMD-85.2A                              */
967   DRIVER( pmd852b )   /* PMD-85.2B                              */
968   DRIVER( pmd853 )   /* PMD-85.3                                 */
963    /* Tesla */
964    DRIVER( pmd851 )    /* PMD-85.1                                         */
965    DRIVER( pmd852 )    /* PMD-85.2                                         */
966    DRIVER( pmd852a )   /* PMD-85.2A                                        */
967    DRIVER( pmd852b )   /* PMD-85.2B                                        */
968    DRIVER( pmd853 )    /* PMD-85.3                                         */
969969
970   /* Didaktik */
971   DRIVER( alfa )      /* Alfa (PMD-85.1 clone)                     */
970    /* Didaktik */
971    DRIVER( alfa )      /* Alfa (PMD-85.1 clone)                            */
972972
973   /* Statny */
974   DRIVER( mato )      /* Mato (PMD-85.2 clone)                     */
973    /* Statny */
974    DRIVER( mato )      /* Mato (PMD-85.2 clone)                            */
975975
976   /* Zbrojovka Brno */
977   DRIVER( c2717 )      /* Consul 2717 (PMD-85.2 clone)            */
976    /* Zbrojovka Brno */
977    DRIVER( c2717 )     /* Consul 2717 (PMD-85.2 clone)             */
978978
979   /* Microkey */
980   DRIVER( primoa32 )   /* Primo A-32                              */
981   DRIVER( primoa48 )   /* Primo A-48                              */
982   DRIVER( primoa64 )   /* Primo A-64                              */
983   DRIVER( primob32 )   /* Primo B-32                              */
984   DRIVER( primob48 )   /* Primo B-48                              */
985   DRIVER( primob64 )   /* Primo B-64                              */
986   DRIVER( primoc64 )   /* Primo C-64                              */
979    /* Microkey */
980    DRIVER( primoa32 )  /* Primo A-32                                       */
981    DRIVER( primoa48 )  /* Primo A-48                                       */
982    DRIVER( primoa64 )  /* Primo A-64                                       */
983    DRIVER( primob32 )  /* Primo B-32                                       */
984    DRIVER( primob48 )  /* Primo B-48                                       */
985    DRIVER( primob64 )  /* Primo B-64                                       */
986    DRIVER( primoc64 )  /* Primo C-64                                       */
987987
988   /* Team Concepts */
989   /* CPU not known, else should be easy, look into drivers/comquest.c */
990   DRIVER( comquest )   /* Comquest Plus German                        */
988    /* Team Concepts */
989    /* CPU not known, else should be easy, look into drivers/comquest.c */
990    DRIVER( comquest )  /* Comquest Plus German                             */
991991
992   /* Hewlett Packard */
993   DRIVER( hp38g )
994   DRIVER( hp39g )
995   DRIVER( hp48s )      /* HP 48S */
996   DRIVER( hp48sx )   /* HP 48SX */
997   DRIVER( hp48g )      /* HP 48G */
998   DRIVER( hp48gx )   /* HP 48GX */
999   DRIVER( hp48gp )        /* HP 48G+ */
1000   DRIVER( hp49g )
992    /* Hewlett Packard */
993    DRIVER( hp38g )
994    DRIVER( hp39g )
995    DRIVER( hp48s )     /* HP 48S */
996    DRIVER( hp48sx )    /* HP 48SX */
997    DRIVER( hp48g )     /* HP 48G */
998    DRIVER( hp48gx )    /* HP 48GX */
999    DRIVER( hp48gp )        /* HP 48G+ */
1000    DRIVER( hp49g )
10011001
1002   /* SpectraVideo */
1003   DRIVER( svi318 )   /* SVI-318 (PAL)                           */
1004   DRIVER( svi318n )   /* SVI-318 (NTSC)                           */
1005   DRIVER( svi328 )   /* SVI-328 (PAL)                           */
1006   DRIVER( svi328n )   /* SVI-328 (NTSC)                           */
1007   DRIVER( sv328p80 )   /* SVI-328 (PAL) + SVI-806 80 column card         */
1008   DRIVER( sv328n80 )   /* SVI-328 (NTSC) + SVI-806 80 column card         */
1002    /* SpectraVideo */
1003    DRIVER( svi318 )    /* SVI-318 (PAL)                                    */
1004    DRIVER( svi318n )   /* SVI-318 (NTSC)                                   */
1005    DRIVER( svi328 )    /* SVI-328 (PAL)                                    */
1006    DRIVER( svi328n )   /* SVI-328 (NTSC)                                   */
1007    DRIVER( sv328p80 )  /* SVI-328 (PAL) + SVI-806 80 column card           */
1008    DRIVER( sv328n80 )  /* SVI-328 (NTSC) + SVI-806 80 column card          */
10091009
1010   /* Andrew Donald Booth (this is the name of the designer, not a company) */
1011//   DRIVER( apexc53 )   /* 1951(?) APEXC: All-Purpose Electronic X-ray Computer */
1012   DRIVER( apexc )      /* 1955(?) APEXC: All-Purpose Electronic X-ray Computer */
1010    /* Andrew Donald Booth (this is the name of the designer, not a company) */
1011//  DRIVER( apexc53 )   /* 1951(?) APEXC: All-Purpose Electronic X-ray Computer */
1012    DRIVER( apexc )     /* 1955(?) APEXC: All-Purpose Electronic X-ray Computer */
10131013
1014   /* Corvus */
1015   DRIVER(concept)      /* 1982 Corvus Concept                        */
1014    /* Corvus */
1015    DRIVER(concept)     /* 1982 Corvus Concept                              */
10161016
1017   /* DAI */
1018   DRIVER(dai)         /* DAI                                    */
1017    /* DAI */
1018    DRIVER(dai)         /* DAI                                              */
10191019
1020   /* Telenova */
1021   DRIVER(compis)      /* 1985 Telenova Compis                        */
1020    /* Telenova */
1021    DRIVER(compis)      /* 1985 Telenova Compis                             */
10221022
1023   /* Multitech */
1024   DRIVER(mpf1)      /* 1979 Multitech Micro Professor 1               */
1025   DRIVER(mpf1b)      /* 1979 Multitech Micro Professor 1B            */
1023    /* Multitech */
1024    DRIVER(mpf1)        /* 1979 Multitech Micro Professor 1                 */
1025    DRIVER(mpf1b)       /* 1979 Multitech Micro Professor 1B                */
10261026
1027   /* Telercas Oy */
1028//   DRIVER(tmc1800)
1029   DRIVER(tmc2000)
1030   DRIVER(tmc2000e)
1031//   DRIVER(tmc600s1)
1032   DRIVER(tmc600s2)
1027    /* Telercas Oy */
1028//  DRIVER(tmc1800)
1029    DRIVER(tmc2000)
1030    DRIVER(tmc2000e)
1031//  DRIVER(tmc600s1)
1032    DRIVER(tmc600s2)
10331033
1034   /* OSCOM Oy */
1035//   DRIVER(osc1000b)
1036   DRIVER(oscnano)
1034    /* OSCOM Oy */
1035//  DRIVER(osc1000b)
1036    DRIVER(oscnano)
10371037
1038   /* MIT */
1039   DRIVER( tx0_64kw )   /* April 1956 MIT TX-0 (64kw RAM)               */
1040   DRIVER( tx0_8kw )   /* 1962 MIT TX-0 (8kw RAM)                     */
1038    /* MIT */
1039    DRIVER( tx0_64kw )  /* April 1956 MIT TX-0 (64kw RAM)                   */
1040    DRIVER( tx0_8kw )   /* 1962 MIT TX-0 (8kw RAM)                          */
10411041
1042   /* Luxor Datorer AB */
1043   DRIVER( abc80 )
1044//   DRIVER( abc80h )
1045   DRIVER( abc802 )
1046   DRIVER( abc800m )
1047   DRIVER( abc800c )
1048   DRIVER( abc806 )
1042    /* Luxor Datorer AB */
1043    DRIVER( abc80 )
1044//  DRIVER( abc80h )
1045    DRIVER( abc802 )
1046    DRIVER( abc800m )
1047    DRIVER( abc800c )
1048    DRIVER( abc806 )
10491049
1050   /* Be Incorporated */
1051   DRIVER( bebox )      /* BeBox Dual603-66                           */
1052   DRIVER( bebox2 )   /* BeBox Dual603-133                        */
1050    /* Be Incorporated */
1051    DRIVER( bebox )     /* BeBox Dual603-66                                 */
1052    DRIVER( bebox2 )    /* BeBox Dual603-133                                */
10531053
1054   /* Tiger Electronics */
1055   DRIVER( gamecom )   /* Tiger Game.com                           */
1054    /* Tiger Electronics */
1055    DRIVER( gamecom )   /* Tiger Game.com                                   */
10561056
1057   /* Thomson */
1058   DRIVER( t9000 )      /* 1980 Thomson T9000 (TO7 prototype)            */
1059   DRIVER( to7 )      /* 1982 Thomson TO7                           */
1060   DRIVER( to770 )      /* 1984 Thomson TO7/70                        */
1061   DRIVER( to770a )   /* 198? Thomson TO7/70 arabic version            */
1062   DRIVER( mo5 )      /* 1984 Thomson MO5                           */
1063   DRIVER( mo5e )      /* 1986 Thomson MO5E (export version)            */
1064   DRIVER( to9 )      /* 1985 Thomson T09                           */
1065   DRIVER( to8 )      /* 1986 Thomson T08                           */
1066   DRIVER( to8d )      /* 1987 Thomson T08D                        */
1067   DRIVER( to9p )      /* 1986 Thomson T09+                        */
1068   DRIVER( mo6 )      /* 1986 Thomson MO6                           */
1069   DRIVER( mo5nr )      /* 1986 Thomson MO5 NR                        */
1070   DRIVER( pro128 )   /* 1986 Olivetti Prodest PC 128                  */
1057    /* Thomson */
1058    DRIVER( t9000 )     /* 1980 Thomson T9000 (TO7 prototype)               */
1059    DRIVER( to7 )       /* 1982 Thomson TO7                                 */
1060    DRIVER( to770 )     /* 1984 Thomson TO7/70                              */
1061    DRIVER( to770a )    /* 198? Thomson TO7/70 arabic version               */
1062    DRIVER( mo5 )       /* 1984 Thomson MO5                                 */
1063    DRIVER( mo5e )      /* 1986 Thomson MO5E (export version)               */
1064    DRIVER( to9 )       /* 1985 Thomson T09                                 */
1065    DRIVER( to8 )       /* 1986 Thomson T08                                 */
1066    DRIVER( to8d )      /* 1987 Thomson T08D                                */
1067    DRIVER( to9p )      /* 1986 Thomson T09+                                */
1068    DRIVER( mo6 )       /* 1986 Thomson MO6                                 */
1069    DRIVER( mo5nr )     /* 1986 Thomson MO5 NR                              */
1070    DRIVER( pro128 )    /* 1986 Olivetti Prodest PC 128                     */
10711071
1072   /* Cybiko, Inc. */
1073   DRIVER( cybikov1 )   /* Cybiko Wireless Intertainment System - Classic V1 */
1074   DRIVER( cybikov2 )   /* Cybiko Wireless Intertainment System - Classic V2 */
1075   DRIVER( cybikoxt )   /* Cybiko Wireless Intertainment System - Xtreme     */
1072    /* Cybiko, Inc. */
1073    DRIVER( cybikov1 )  /* Cybiko Wireless Intertainment System - Classic V1 */
1074    DRIVER( cybikov2 )  /* Cybiko Wireless Intertainment System - Classic V2 */
1075    DRIVER( cybikoxt )  /* Cybiko Wireless Intertainment System - Xtreme     */
10761076
1077   /* Dick Smith */
1078   DRIVER( super80 )
1079   DRIVER( super80d )
1080   DRIVER( super80e )
1081   DRIVER( super80m )
1082   DRIVER( super80r )
1083   DRIVER( super80v )
1077    /* Dick Smith */
1078    DRIVER( super80 )
1079    DRIVER( super80d )
1080    DRIVER( super80e )
1081    DRIVER( super80m )
1082    DRIVER( super80r )
1083    DRIVER( super80v )
10841084
1085   /* Galeb */
1086   DRIVER( galeb )
1085    /* Galeb */
1086    DRIVER( galeb )
10871087
1088   /* Orao */
1089   DRIVER( orao )
1090   DRIVER( orao103 )
1088    /* Orao */
1089    DRIVER( orao )
1090    DRIVER( orao103 )
10911091
1092   /* UT-88 */
1093   DRIVER( ut88 )
1094   DRIVER( ut88mini )
1092    /* UT-88 */
1093    DRIVER( ut88 )
1094    DRIVER( ut88mini )
10951095
1096   /* Mikro-80 */
1097   DRIVER( mikro80 )
1098   DRIVER( radio99 )
1096    /* Mikro-80 */
1097    DRIVER( mikro80 )
1098    DRIVER( radio99 )
10991099
1100   /* Specialist */
1101   DRIVER( special )
1102   DRIVER( specialp )
1103   DRIVER( lik )
1104   DRIVER( erik )
1105   DRIVER( specimx )
1100    /* Specialist */
1101    DRIVER( special )
1102    DRIVER( specialp )
1103    DRIVER( lik )
1104    DRIVER( erik )
1105    DRIVER( specimx )
11061106
1107   /* Orion */
1108   DRIVER( orion128 )
1109   DRIVER( orionms )
1110   DRIVER( orionz80 )
1111   DRIVER( orionide )
1112   DRIVER( orionzms )
1113   DRIVER( orionidm )
1114   DRIVER( orionpro )
1107    /* Orion */
1108    DRIVER( orion128 )
1109    DRIVER( orionms )
1110    DRIVER( orionz80 )
1111    DRIVER( orionide )
1112    DRIVER( orionzms )
1113    DRIVER( orionidm )
1114    DRIVER( orionpro )
11151115
1116   /* BK */
1117   DRIVER( bk0010 )
1118   DRIVER( bk001001 )
1119   DRIVER( bk0010fd )
1120   DRIVER( bk0011m )
1116    /* BK */
1117    DRIVER( bk0010 )
1118    DRIVER( bk001001 )
1119    DRIVER( bk0010fd )
1120    DRIVER( bk0011m )
11211121
1122   /* Bashkiria-2M */
1123   DRIVER( b2m )
1124   DRIVER( b2mrom )
1122    /* Bashkiria-2M */
1123    DRIVER( b2m )
1124    DRIVER( b2mrom )
11251125
1126   /* Radio-86RK */
1127   DRIVER( radio86 )
1128   DRIVER( radio16 )
1129   DRIVER( radio4k )
1130   DRIVER( rk7007 )
1131   DRIVER( rk700716 )
1132   DRIVER( radiorom )
1133   DRIVER( radioram )
1134   DRIVER( spektr01 )
1135   DRIVER( apogee )
1136   DRIVER( mikrosha )
1137   DRIVER( partner )
1126    /* Radio-86RK */
1127    DRIVER( radio86 )
1128    DRIVER( radio16 )
1129    DRIVER( radio4k )
1130    DRIVER( rk7007 )
1131    DRIVER( rk700716 )
1132    DRIVER( radiorom )
1133    DRIVER( radioram )
1134    DRIVER( spektr01 )
1135    DRIVER( apogee )
1136    DRIVER( mikrosha )
1137    DRIVER( partner )
11381138
1139     /* Homelab */
1140   DRIVER (homelab2)
1141   DRIVER (homelab3)
1142   DRIVER (homelab4)
1143   DRIVER (brailab4)
1139    /* Homelab */
1140    DRIVER (homelab2)
1141    DRIVER (homelab3)
1142    DRIVER (homelab4)
1143    DRIVER (brailab4)
11441144
1145   /* Irisha */
1146   DRIVER (irisha)
1145    /* Irisha */
1146    DRIVER (irisha)
11471147
1148   /* PK-8020 */
1149   DRIVER (korvet)
1148    /* PK-8020 */
1149    DRIVER (korvet)
11501150
1151   /* Vector-06c */
1152   DRIVER (vector06)
1151    /* Vector-06c */
1152    DRIVER (vector06)
11531153
1154   /* Robotron 1715 */
1155   DRIVER (rt1715)
1156   DRIVER (rt1715w)
1157   
1158   /* Z1013 */
1159   DRIVER (z1013)
1160   DRIVER (z1013a2)
1161   DRIVER (z1013k76)
1162   DRIVER (z1013s60)
1163   DRIVER (z1013k69)
1164   
1165   /* LLC */
1166   DRIVER (llc1)
1167   DRIVER (llc2)
1154    /* Robotron 1715 */
1155    DRIVER (rt1715)
1156    DRIVER (rt1715w)
11681157
1169   /* PP-01 */
1170   DRIVER (pp01)
1158    /* Z1013 */
1159    DRIVER (z1013)
1160    DRIVER (z1013a2)
1161    DRIVER (z1013k76)
1162    DRIVER (z1013s60)
1163    DRIVER (z1013k69)
11711164
1172   /* Ondra */
1173   DRIVER (ondrat)
1174   DRIVER (ondrav)
1165    /* LLC */
1166    DRIVER (llc1)
1167    DRIVER (llc2)
11751168
1176   /* SAPI-1 */
1177   DRIVER (sapi1)
1169    /* PP-01 */
1170    DRIVER (pp01)
11781171
1172    /* Ondra */
1173    DRIVER (ondrat)
1174    DRIVER (ondrav)
1175
1176    /* SAPI-1 */
1177    DRIVER (sapi1)
1178
11791179  /* Spectrum clones */
11801180
11811181  /* ICE-Felix */
1182   DRIVER( hc85 )    /* 1985 HC-85                                */
1183   DRIVER( hc90 )    /* 1990 HC-90                                */
1184   DRIVER( hc91 )    /* 1991 HC-91                                */
1185   DRIVER( hc128 )   /* 1991 HC-128                             */
1186   DRIVER( hc2000 )  /* 1992 HC-2000                             */
1182    DRIVER( hc85 )    /* 1985 HC-85                                       */
1183    DRIVER( hc90 )    /* 1990 HC-90                                       */
1184    DRIVER( hc91 )    /* 1991 HC-91                                       */
1185    DRIVER( hc128 )   /* 1991 HC-128                                      */
1186    DRIVER( hc2000 )  /* 1992 HC-2000                                     */
11871187
1188   DRIVER( cip01 )   /* 1987 CIP-01                             */
1189   DRIVER( cip03 )   /* 1988 CIP-03                             */
1190   DRIVER( jet )     /* 1990 JET                                */
1188    DRIVER( cip01 )   /* 1987 CIP-01                                      */
1189    DRIVER( cip03 )   /* 1988 CIP-03                                      */
1190    DRIVER( jet )     /* 1990 JET                                         */
11911191
11921192  /* Didaktik Skalica */
1193   DRIVER( dgama87)  /* 1987 Didaktik Gama 87          */
1194   DRIVER( dgama88)  /* 1988 Didaktik Gama 88          */
1195   DRIVER( dgama89)  /* 1989 Didaktik Gama 89          */
1196   DRIVER( didakt90) /* 1990 Didaktik Skalica 90       */
1197   DRIVER( didakm91) /* 1991 Didaktik M 91             */
1198   DRIVER( didaktk)  /* 1992 Didaktik Kompakt          */
1199   DRIVER( didakm93) /* 1993 Didaktik M 93             */
1193    DRIVER( dgama87)  /* 1987 Didaktik Gama 87          */
1194    DRIVER( dgama88)  /* 1988 Didaktik Gama 88          */
1195    DRIVER( dgama89)  /* 1989 Didaktik Gama 89          */
1196    DRIVER( didakt90) /* 1990 Didaktik Skalica 90       */
1197    DRIVER( didakm91) /* 1991 Didaktik M 91             */
1198    DRIVER( didaktk)  /* 1992 Didaktik Kompakt          */
1199    DRIVER( didakm93) /* 1993 Didaktik M 93             */
12001200
1201   DRIVER( mistrum ) /* 1988 Mistrum                              */
1201    DRIVER( mistrum ) /* 1988 Mistrum                                       */
12021202
1203   /* Russian clones */
1204   DRIVER( blitz )     /* 1990 Blic                     */
1205   DRIVER( byte )      /* 1990 Byte                     */
1206   DRIVER( orizon )    /* 199? Orizon-Micro             */
1207   DRIVER( quorum48 )  /* 1993 Kvorum 48K               */
1208   DRIVER( magic6 )    /* 1993 Magic 6                  */
1209   DRIVER( compani1 )  /* 1990 Kompanion 1              */
1203    /* Russian clones */
1204    DRIVER( blitz )     /* 1990 Blic                     */
1205    DRIVER( byte )      /* 1990 Byte                     */
1206    DRIVER( orizon )    /* 199? Orizon-Micro             */
1207    DRIVER( quorum48 )  /* 1993 Kvorum 48K               */
1208    DRIVER( magic6 )    /* 1993 Magic 6                  */
1209    DRIVER( compani1 )  /* 1990 Kompanion 1              */
12101210
1211   /* Kramer */
1212   DRIVER(kramermc)    /* 1987 Kramer MC             */
1211    /* Kramer */
1212    DRIVER(kramermc)    /* 1987 Kramer MC                */
12131213
1214   /* AC1 */
1215   DRIVER(ac1)    /* 1984 Amateurcomputer AC1            */
1216   DRIVER(ac1_32)    /* 1984 Amateurcomputer AC1 (32 lines)   */
1217   DRIVER(ac1scch) /* 1984 Amateurcomputer AC1 SCCH      */
1214    /* AC1 */
1215    DRIVER(ac1)     /* 1984 Amateurcomputer AC1             */
1216    DRIVER(ac1_32)  /* 1984 Amateurcomputer AC1 (32 lines)  */
1217    DRIVER(ac1scch) /* 1984 Amateurcomputer AC1 SCCH        */
12181218
1219   DRIVER( pcm )   /* PC/M Mugler                      */
1220   
1221   /* DEC VT100 */
1222   DRIVER(vt100)
1223   
1224   /* Ei Nis */
1225   DRIVER(pecom64)
1219    DRIVER( pcm )   /* PC/M Mugler                          */
12261220
1227   /* Samsung SPC-1000 */
1228   DRIVER(spc1000)
1221    /* DEC VT100 */
1222    DRIVER(vt100)
12291223
1230   /* PolyMorphic Systems */
1231   DRIVER( poly88 )
1232   DRIVER( poly8813 )
1233     
1234   /* Bondwell */
1235   DRIVER( bw2 )
1224    /* Ei Nis */
1225    DRIVER(pecom64)
12361226
1237   /* Exeltel */
1238   DRIVER( exl100 )
1239//   DRIVER( exeltel )
1227    /* Samsung SPC-1000 */
1228    DRIVER(spc1000)
12401229
1241   /* Comx World Operations Ltd */
1242   DRIVER( comx35p )
1243   DRIVER( comx35n )
1244//   DRIVER( comxpl80 )
1230    /* PolyMorphic Systems */
1231    DRIVER( poly88 )
1232    DRIVER( poly8813 )
12451233
1246   /* Grundy Business Systems Ltd */
1247   DRIVER( newbrain )
1248   DRIVER( newbraie )
1249   DRIVER( newbraia )
1250   DRIVER( newbraim )
1234    /* Bondwell */
1235    DRIVER( bw2 )
12511236
1252   /* Nokia Data */
1253   DRIVER( mm1m6 )
1254   DRIVER( mm1m7 )
1237    /* Exeltel */
1238    DRIVER( exl100 )
1239//  DRIVER( exeltel )
12551240
1256   /* Nuova Elettronica */
1257   DRIVER( z80ne )         /* 1980 - Z80NE */
1258   DRIVER( z80net )      /* 1980 - Z80NE + LX388 Video Interface */
1259   DRIVER( z80netb )      /* 1980 - Z80NE + LX388 Video Interface + 16Kb BASIC */
1241    /* Comx World Operations Ltd */
1242    DRIVER( comx35p )
1243    DRIVER( comx35n )
1244//  DRIVER( comxpl80 )
12601245
1261   /* Talking Electronics Magazine */
1262   DRIVER( tec1 )         /* Talking Electronics Computer */
1246    /* Grundy Business Systems Ltd */
1247    DRIVER( newbrain )
1248    DRIVER( newbraie )
1249    DRIVER( newbraia )
1250    DRIVER( newbraim )
12631251
1264   /* Kyocera (and clones) */
1265   DRIVER( kc85 )
1266   DRIVER( olivm10 )   
1267//   DRIVER( olivm10m )   
1268   DRIVER( trsm100 )
1269   DRIVER( tandy102 )
1270   DRIVER( tandy200 )
1271//   DRIVER( npc8201 )
1272   DRIVER( npc8201a )
1273//   DRIVER( npc8300 )
1274//   DRIVER( pc8401 )
1275   DRIVER( pc8500 )
1252    /* Nokia Data */
1253    DRIVER( mm1m6 )
1254    DRIVER( mm1m7 )
12761255
1277   /* Nakajima manufactured eletronic typewriters */
1278   DRIVER( drwrt200 )   /* 199? NTS DreamWriter T200                         */
1279   DRIVER( drwrt400 )   /* 1996 NTS DreamWriter T400                         */
1280   DRIVER( wales210 )   /* 199? Walther ES-210 (German)                      */
1281   DRIVER( dator3k )   /* 199? Dator 3000 (Spanish)                         */
1256    /* Nuova Elettronica */
1257    DRIVER( z80ne )         /* 1980 - Z80NE */
1258    DRIVER( z80net )        /* 1980 - Z80NE + LX388 Video Interface */
1259    DRIVER( z80netb )       /* 1980 - Z80NE + LX388 Video Interface + 16Kb BASIC */
12821260
1283   /* Fujitsu */
1284   DRIVER( fm7 )
1285   DRIVER( fm77av )
1286   DRIVER( fm7740sx )
1287   DRIVER( fmtowns )   /* 1989 Fujitsu FM-Towns */
1288   DRIVER( fmtownsa )
1289   DRIVER( fmtmarty )  /* 1993 Fujitsu FM-Towns Marty */
1261    /* Talking Electronics Magazine */
1262    DRIVER( tec1 )          /* Talking Electronics Computer */
12901263
1291   /* Camputers */
1292   DRIVER( camplynx )
1293   DRIVER( camply96 )
1294   DRIVER( camply128 )
1264    /* Kyocera (and clones) */
1265    DRIVER( kc85 )
1266    DRIVER( olivm10 )
1267//  DRIVER( olivm10m )
1268    DRIVER( trsm100 )
1269    DRIVER( tandy102 )
1270    DRIVER( tandy200 )
1271//  DRIVER( npc8201 )
1272    DRIVER( npc8201a )
1273//  DRIVER( npc8300 )
1274//  DRIVER( pc8401 )
1275    DRIVER( pc8500 )
12951276
1296   /* Votrax */
1297   DRIVER( votrtnt ) /* 1980 Votrax Type-'N-Talk */
1298   DRIVER( votrpss ) /* 1982 Votrax Personal Speech System */
1277    /* Nakajima manufactured eletronic typewriters */
1278    DRIVER( drwrt200 )  /* 199? NTS DreamWriter T200                         */
1279    DRIVER( drwrt400 )  /* 1996 NTS DreamWriter T400                         */
1280    DRIVER( wales210 )  /* 199? Walther ES-210 (German)                      */
1281    DRIVER( dator3k )   /* 199? Dator 3000 (Spanish)                         */
12991282
1283    /* Fujitsu */
1284    DRIVER( fm7 )
1285    DRIVER( fm77av )
1286    DRIVER( fm7740sx )
1287    DRIVER( fmtowns )   /* 1989 Fujitsu FM-Towns */
1288    DRIVER( fmtownsa )
1289    DRIVER( fmtmarty )  /* 1993 Fujitsu FM-Towns Marty */
1290
1291    /* Camputers */
1292    DRIVER( camplynx )
1293    DRIVER( camply96 )
1294    DRIVER( camply128 )
1295
1296    /* Votrax */
1297    DRIVER( votrtnt ) /* 1980 Votrax Type-'N-Talk */
1298    DRIVER( votrpss ) /* 1982 Votrax Personal Speech System */
1299
13001300/****************Games*******************************************************/
1301   /* Computer Electronic */
1302   DRIVER( mk1 )      /* Chess Champion MK I                        */
1303   /* Quelle International */
1304   DRIVER( mk2 )      /* Chess Champion MK II                        */
1301    /* Computer Electronic */
1302    DRIVER( mk1 )       /* Chess Champion MK I                              */
1303    /* Quelle International */
1304    DRIVER( mk2 )       /* Chess Champion MK II                             */
13051305
1306   /* Novag */
1307   DRIVER( ssystem3 )   /* Chess Champion Super System III / MK III         */
1306    /* Novag */
1307    DRIVER( ssystem3 )  /* Chess Champion Super System III / MK III         */
13081308
1309   /* Hegener & Glaser Munich */
1310//   DRIVER( mephisto )   /* Mephisto                                 */
1311   DRIVER( mm4 )      /* Mephisto 4                              */
1312   DRIVER( mm5 )      /* Mephisto 5.1 ROM                           */
1313   DRIVER( mm50 )      /* Mephisto 5.0 ROM                           */
1314   DRIVER( rebel5 )      /* Mephisto 5                           */
1315   DRIVER( glasgow )      /* Glasgow                              */
1316   DRIVER( amsterd )      /* Amsterdam                           */
1317   DRIVER( dallas )      /* Dallas                              */
1318   DRIVER( dallas16 )      /* Dallas                              */
1319   DRIVER( dallas32 )      /* Dallas                              */
1320   DRIVER( roma )         /* Roma                                 */
1321   DRIVER( roma32 )      /* Roma                                 */
1309    /* Hegener & Glaser Munich */
1310//  DRIVER( mephisto )  /* Mephisto                                         */
1311    DRIVER( mm4 )       /* Mephisto 4                                       */
1312    DRIVER( mm5 )       /* Mephisto 5.1 ROM                                 */
1313    DRIVER( mm50 )      /* Mephisto 5.0 ROM                                 */
1314    DRIVER( rebel5 )        /* Mephisto 5                                   */
1315    DRIVER( glasgow )       /* Glasgow                                      */
1316    DRIVER( amsterd )       /* Amsterdam                                    */
1317    DRIVER( dallas )        /* Dallas                                       */
1318    DRIVER( dallas16 )      /* Dallas                                       */
1319    DRIVER( dallas32 )      /* Dallas                                       */
1320    DRIVER( roma )          /* Roma                                         */
1321    DRIVER( roma32 )        /* Roma                                         */
13221322
13231323/*********** Misc ***********************************************************/
13241324
1325   DRIVER( ex800 )
1325    DRIVER( ex800 )
1326    DRIVER( ssem ) /* Manchester Small-Scale Experimental Machine, "Baby" */
13261327
13271328/*********** To sort (mostly skeleton drivers) ******************************/
13281329
1329   DRIVER( a5105 )
1330   DRIVER( bcs3 )
1331   DRIVER( bcs3a )
1332   DRIVER( bcs3b )
1333   DRIVER( bcs3c )
1334   DRIVER( bob85 )
1335   DRIVER( c80 )
1336   DRIVER( mc1000 )
1337   DRIVER( vk100 )
1338   DRIVER( d6809 )
1339   DRIVER( mk90 )
1340   DRIVER( elwro800 )
1341   DRIVER( fk1 )
1342   DRIVER( et3400 )
1343   DRIVER( huebler )
1344   DRIVER( interact )
1345   DRIVER( sc80 )
1346   DRIVER( lc80 )
1347   DRIVER( jr200 )
1348   DRIVER( h8 )
1349   DRIVER( h19 )
1350   DRIVER( h89 )
1351   DRIVER( hec2hrp )
1352   DRIVER( hec2hrx )
1353   DRIVER( hector1 )
1354   DRIVER( poly880 )
1355   DRIVER( sc1 )
1356   DRIVER( sc2 )
1357   DRIVER( chessmst )
1358   DRIVER( sys2900 )
1359   DRIVER( pmi80 )
1360   DRIVER( tiki100 )
1361   DRIVER( vcs80 )
1362   DRIVER( v1050 )
1363   DRIVER( xerox820 )
1364   DRIVER( xor100 )
1365   DRIVER( iq151 )
1366   DRIVER( ply601 )
1367   DRIVER( ply601a )
1368   DRIVER( m20 )
1369   DRIVER( m40 )
1370   DRIVER( nanos )
1371   DRIVER( a5120 )
1372   DRIVER( a5130 )
1373   DRIVER( beehive )   
1374   DRIVER( uts20 )   
1375   DRIVER( uknc )   
1376   DRIVER( zx97)
1377   DRIVER( x07)
1378   DRIVER( vesta)
1379   DRIVER( hobby)
1380   DRIVER( unior)
1381   DRIVER( vec1200)
1382   DRIVER( pk6128c)     
1330    DRIVER( a5105 )
1331    DRIVER( bcs3 )
1332    DRIVER( bcs3a )
1333    DRIVER( bcs3b )
1334    DRIVER( bcs3c )
1335    DRIVER( bob85 )
1336    DRIVER( c80 )
1337    DRIVER( mc1000 )
1338    DRIVER( vk100 )
1339    DRIVER( d6809 )
1340    DRIVER( mk90 )
1341    DRIVER( elwro800 )
1342    DRIVER( fk1 )
1343    DRIVER( et3400 )
1344    DRIVER( huebler )
1345    DRIVER( interact )
1346    DRIVER( sc80 )
1347    DRIVER( lc80 )
1348    DRIVER( jr200 )
1349    DRIVER( h8 )
1350    DRIVER( h19 )
1351    DRIVER( h89 )
1352    DRIVER( hec2hrp )
1353    DRIVER( hec2hrx )
1354    DRIVER( hector1 )
1355    DRIVER( poly880 )
1356    DRIVER( sc1 )
1357    DRIVER( sc2 )
1358    DRIVER( chessmst )
1359    DRIVER( sys2900 )
1360    DRIVER( pmi80 )
1361    DRIVER( tiki100 )
1362    DRIVER( vcs80 )
1363    DRIVER( v1050 )
1364    DRIVER( xerox820 )
1365    DRIVER( xor100 )
1366    DRIVER( iq151 )
1367    DRIVER( ply601 )
1368    DRIVER( ply601a )
1369    DRIVER( m20 )
1370    DRIVER( m40 )
1371    DRIVER( nanos )
1372    DRIVER( a5120 )
1373    DRIVER( a5130 )
1374    DRIVER( beehive )
1375    DRIVER( uts20 )
1376    DRIVER( uknc )
1377    DRIVER( zx97)
1378    DRIVER( x07)
1379    DRIVER( vesta)
1380    DRIVER( hobby)
1381    DRIVER( unior)
1382    DRIVER( vec1200)
1383    DRIVER( pk6128c)
13831384
13841385#endif /* DRIVER_RECURSIVE */
src/mess/mess.mak
r4910r4911
119119CPUS += TMS7000
120120CPUS += SM8500
121121CPUS += MINX
122CPUS += SSEM
122123
123124
124125
r4910r4911
299300   $(MESSOBJ)/magnavox.a \
300301   $(MESSOBJ)/mbee.a \
301302   $(MESSOBJ)/mc10.a \
303   $(MESSOBJ)/mchester.a \
302304   $(MESSOBJ)/memotech.a \
303305   $(MESSOBJ)/mephisto.a \
304306   $(MESSOBJ)/mikro80.a \
r4910r4911
589591   $(MESS_MACHINE)/mc10.o      \
590592   $(MESS_DRIVERS)/mc10.o      \
591593
594$(MESSOBJ)/mchester.a:   \
595   $(MESS_DRIVERS)/ssem.o      \
596   
592597$(MESSOBJ)/dgn_beta.a:   \
593598   $(MESS_MACHINE)/dgn_beta.o   \
594599   $(MESS_VIDEO)/dgn_beta.o   \
src/mess/drivers/ssem.c
r0r4911
1/*
2    Manchester Small-Scale Experimental Machine (SSEM)
3
4    Driver by MooglyGuy
5*/
6
7#include "driver.h"
8#include "cpu/ssem/ssem.h"
9#include "devices/cartslot.h"
10#include <stdarg.h>
11
12static UINT8 *store;
13static UINT8 store_line = 0;
14
15/****************************************************\
16* General helper functions                           *
17\****************************************************/
18
19// The SSEM stores its data, visually, with the leftmost bit corresponding to the least significant bit.
20// The de facto snapshot format for other SSEM simulators stores the data physically in that format as well.
21// Therefore, in MESS, every 32-bit word has its bits reversed, too, and as a result the values must be
22// un-reversed before being used.
23INLINE UINT32 reverse(UINT32 v)
24{
25    // Taken from http://www-graphics.stanford.edu/~seander/bithacks.html#ReverseParallel
26    // swap odd and even bits
27    v = ((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1);
28    // swap consecutive pairs
29    v = ((v >> 2) & 0x33333333) | ((v & 0x33333333) << 2);
30    // swap nibbles ...
31    v = ((v >> 4) & 0x0F0F0F0F) | ((v & 0x0F0F0F0F) << 4);
32    // swap bytes
33    v = ((v >> 8) & 0x00FF00FF) | ((v & 0x00FF00FF) << 8);
34    // swap 2-byte long pairs
35    v = ( v >> 16             ) | ( v               << 16);
36
37    return v;
38}
39
40/****************************************************\
41* Address map                                        *
42\****************************************************/
43
44static ADDRESS_MAP_START( ssem_map, ADDRESS_SPACE_PROGRAM, 8 )
45    AM_RANGE(0x00, 0x7f) AM_RAM AM_BASE(&store)// Primary store
46ADDRESS_MAP_END
47
48/****************************************************\
49* Input ports and front panel handling               *
50\****************************************************/
51
52enum
53{
54    // Bit-edit buttons
55    PANEL_BIT0,  PANEL_BIT1,  PANEL_BIT2,  PANEL_BIT3,  PANEL_BIT4,  PANEL_BIT5,  PANEL_BIT6,  PANEL_BIT7,
56    PANEL_BIT8,  PANEL_BIT9,  PANEL_BIT10, PANEL_BIT11, PANEL_BIT12, PANEL_BIT13, PANEL_BIT14, PANEL_BIT15,
57    PANEL_BIT16, PANEL_BIT17, PANEL_BIT18, PANEL_BIT19, PANEL_BIT20, PANEL_BIT21, PANEL_BIT22, PANEL_BIT23,
58    PANEL_BIT24, PANEL_BIT25, PANEL_BIT26, PANEL_BIT27, PANEL_BIT28, PANEL_BIT29, PANEL_BIT30, PANEL_BIT31,
59
60    // Page up, page down
61    PANEL_PGUP, PANEL_PGDN,
62
63    // Line up, line down
64    PANEL_LNUP, PANEL_LNDN,
65
66    // Halt
67    PANEL_HALT,
68};
69
70static INPUT_CHANGED( panel_check )
71{
72    UINT8 edit0_state = input_port_read(field->port->machine, "EDIT0");
73    UINT8 edit1_state = input_port_read(field->port->machine, "EDIT1");
74    UINT8 edit2_state = input_port_read(field->port->machine, "EDIT2");
75    UINT8 edit3_state = input_port_read(field->port->machine, "EDIT3");
76    UINT8 misc_state = input_port_read(field->port->machine, "MISC");
77    const device_config *ssem_cpu = devtag_get_device(field->port->machine, "maincpu");
78
79    switch( (int)(FPTR)param )
80    {
81        case PANEL_BIT0:
82            if(edit0_state & 0x01) store[(store_line << 2) | 0] ^= 0x80;
83            break;
84        case PANEL_BIT1:
85            if(edit0_state & 0x02) store[(store_line << 2) | 0] ^= 0x40;
86            break;
87        case PANEL_BIT2:
88            if(edit0_state & 0x04) store[(store_line << 2) | 0] ^= 0x20;
89            break;
90        case PANEL_BIT3:
91            if(edit0_state & 0x08) store[(store_line << 2) | 0] ^= 0x10;
92            break;
93        case PANEL_BIT4:
94            if(edit0_state & 0x10) store[(store_line << 2) | 0] ^= 0x08;
95            break;
96        case PANEL_BIT5:
97            if(edit0_state & 0x20) store[(store_line << 2) | 0] ^= 0x04;
98            break;
99        case PANEL_BIT6:
100            if(edit0_state & 0x40) store[(store_line << 2) | 0] ^= 0x02;
101            break;
102        case PANEL_BIT7:
103            if(edit0_state & 0x80) store[(store_line << 2) | 0] ^= 0x01;
104            break;
105        case PANEL_BIT8:
106            if(edit1_state & 0x01) store[(store_line << 2) | 1] ^= 0x80;
107            break;
108        case PANEL_BIT9:
109            if(edit1_state & 0x02) store[(store_line << 2) | 1] ^= 0x40;
110            break;
111        case PANEL_BIT10:
112            if(edit1_state & 0x04) store[(store_line << 2) | 1] ^= 0x20;
113            break;
114        case PANEL_BIT11:
115            if(edit1_state & 0x08) store[(store_line << 2) | 1] ^= 0x10;
116            break;
117        case PANEL_BIT12:
118            if(edit1_state & 0x10) store[(store_line << 2) | 1] ^= 0x08;
119            break;
120        case PANEL_BIT13:
121            if(edit1_state & 0x20) store[(store_line << 2) | 1] ^= 0x04;
122            break;
123        case PANEL_BIT14:
124            if(edit1_state & 0x40) store[(store_line << 2) | 1] ^= 0x02;
125            break;
126        case PANEL_BIT15:
127            if(edit1_state & 0x80) store[(store_line << 2) | 1] ^= 0x01;
128            break;
129        case PANEL_BIT16:
130            if(edit2_state & 0x01) store[(store_line << 2) | 2] ^= 0x80;
131            break;
132        case PANEL_BIT17:
133            if(edit2_state & 0x02) store[(store_line << 2) | 2] ^= 0x40;
134            break;
135        case PANEL_BIT18:
136            if(edit2_state & 0x04) store[(store_line << 2) | 2] ^= 0x20;
137            break;
138        case PANEL_BIT19:
139            if(edit2_state & 0x08) store[(store_line << 2) | 2] ^= 0x10;
140            break;
141        case PANEL_BIT20:
142            if(edit2_state & 0x10) store[(store_line << 2) | 2] ^= 0x08;
143            break;
144        case PANEL_BIT21:
145            if(edit2_state & 0x20) store[(store_line << 2) | 2] ^= 0x04;
146            break;
147        case PANEL_BIT22:
148            if(edit2_state & 0x40) store[(store_line << 2) | 2] ^= 0x02;
149            break;
150        case PANEL_BIT23:
151            if(edit2_state & 0x80) store[(store_line << 2) | 2] ^= 0x01;
152            break;
153        case PANEL_BIT24:
154            if(edit3_state & 0x01) store[(store_line << 2) | 3] ^= 0x80;
155            break;
156        case PANEL_BIT25:
157            if(edit3_state & 0x02) store[(store_line << 2) | 3] ^= 0x40;
158            break;
159        case PANEL_BIT26:
160            if(edit3_state & 0x04) store[(store_line << 2) | 3] ^= 0x20;
161            break;
162        case PANEL_BIT27:
163            if(edit3_state & 0x08) store[(store_line << 2) | 3] ^= 0x10;
164            break;
165        case PANEL_BIT28:
166            if(edit3_state & 0x10) store[(store_line << 2) | 3] ^= 0x08;
167            break;
168        case PANEL_BIT29:
169            if(edit3_state & 0x20) store[(store_line << 2) | 3] ^= 0x04;
170            break;
171        case PANEL_BIT30:
172            if(edit3_state & 0x40) store[(store_line << 2) | 3] ^= 0x02;
173            break;
174        case PANEL_BIT31:
175            if(edit3_state & 0x80) store[(store_line << 2) | 3] ^= 0x01;
176            break;
177        case PANEL_LNUP:
178            if(misc_state & 0x01)
179            {
180                store_line--;
181            }
182            break;
183        case PANEL_LNDN:
184            if(misc_state & 0x02)
185            {
186                store_line++;
187            }
188            break;
189        case PANEL_HALT:
190            if(misc_state & 0x04)
191            {
192                cpu_set_reg(ssem_cpu, SSEM_HALT, 1 - cpu_get_reg(ssem_cpu, SSEM_HALT));
193            }
194            break;
195    }
196}
197
198static INPUT_PORTS_START( ssem )
199    PORT_START("EDIT0")
200        PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 0")     PORT_CODE(KEYCODE_1) PORT_CHANGED(panel_check, (void*)PANEL_BIT0)
201        PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 1")     PORT_CODE(KEYCODE_2) PORT_CHANGED(panel_check, (void*)PANEL_BIT1)
202        PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 2")     PORT_CODE(KEYCODE_3) PORT_CHANGED(panel_check, (void*)PANEL_BIT2)
203        PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 3")     PORT_CODE(KEYCODE_4) PORT_CHANGED(panel_check, (void*)PANEL_BIT3)
204        PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 4")     PORT_CODE(KEYCODE_5) PORT_CHANGED(panel_check, (void*)PANEL_BIT4)
205        PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 5")     PORT_CODE(KEYCODE_6) PORT_CHANGED(panel_check, (void*)PANEL_BIT5)
206        PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 6")     PORT_CODE(KEYCODE_7) PORT_CHANGED(panel_check, (void*)PANEL_BIT6)
207        PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 7")     PORT_CODE(KEYCODE_8) PORT_CHANGED(panel_check, (void*)PANEL_BIT7)
208
209    PORT_START("EDIT1")
210        PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 8")     PORT_CODE(KEYCODE_Q) PORT_CHANGED(panel_check, (void*)PANEL_BIT8)
211        PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 9")     PORT_CODE(KEYCODE_W) PORT_CHANGED(panel_check, (void*)PANEL_BIT9)
212        PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 10")    PORT_CODE(KEYCODE_E) PORT_CHANGED(panel_check, (void*)PANEL_BIT10)
213        PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 11")    PORT_CODE(KEYCODE_R) PORT_CHANGED(panel_check, (void*)PANEL_BIT11)
214        PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 12")    PORT_CODE(KEYCODE_T) PORT_CHANGED(panel_check, (void*)PANEL_BIT12)
215        PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 13")    PORT_CODE(KEYCODE_Y) PORT_CHANGED(panel_check, (void*)PANEL_BIT13)
216        PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 14")    PORT_CODE(KEYCODE_U) PORT_CHANGED(panel_check, (void*)PANEL_BIT14)
217        PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 15")    PORT_CODE(KEYCODE_I) PORT_CHANGED(panel_check, (void*)PANEL_BIT15)
218
219    PORT_START("EDIT2")
220        PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 16")    PORT_CODE(KEYCODE_A) PORT_CHANGED(panel_check, (void*)PANEL_BIT16)
221        PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 17")    PORT_CODE(KEYCODE_S) PORT_CHANGED(panel_check, (void*)PANEL_BIT17)
222        PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 18")    PORT_CODE(KEYCODE_D) PORT_CHANGED(panel_check, (void*)PANEL_BIT18)
223        PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 19")    PORT_CODE(KEYCODE_F) PORT_CHANGED(panel_check, (void*)PANEL_BIT19)
224        PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 20")    PORT_CODE(KEYCODE_G) PORT_CHANGED(panel_check, (void*)PANEL_BIT20)
225        PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 21")    PORT_CODE(KEYCODE_H) PORT_CHANGED(panel_check, (void*)PANEL_BIT21)
226        PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 22")    PORT_CODE(KEYCODE_J) PORT_CHANGED(panel_check, (void*)PANEL_BIT22)
227        PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 23")    PORT_CODE(KEYCODE_K) PORT_CHANGED(panel_check, (void*)PANEL_BIT23)
228
229    PORT_START("EDIT3")
230        PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 24")    PORT_CODE(KEYCODE_Z) PORT_CHANGED(panel_check, (void*)PANEL_BIT24)
231        PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 25")    PORT_CODE(KEYCODE_X) PORT_CHANGED(panel_check, (void*)PANEL_BIT25)
232        PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 26")    PORT_CODE(KEYCODE_C) PORT_CHANGED(panel_check, (void*)PANEL_BIT26)
233        PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 27")    PORT_CODE(KEYCODE_V) PORT_CHANGED(panel_check, (void*)PANEL_BIT27)
234        PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 28")    PORT_CODE(KEYCODE_B) PORT_CHANGED(panel_check, (void*)PANEL_BIT28)
235        PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 29")    PORT_CODE(KEYCODE_N) PORT_CHANGED(panel_check, (void*)PANEL_BIT29)
236        PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 30")    PORT_CODE(KEYCODE_M) PORT_CHANGED(panel_check, (void*)PANEL_BIT30)
237        PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Bit 31")    PORT_CODE(KEYCODE_COMMA) PORT_CHANGED(panel_check, (void*)PANEL_BIT31)
238
239    PORT_START("MISC")
240        PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Line Up")   PORT_CODE(KEYCODE_UP)   PORT_CHANGED(panel_check, (void*)PANEL_LNUP)
241        PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Line Down") PORT_CODE(KEYCODE_DOWN) PORT_CHANGED(panel_check, (void*)PANEL_LNDN)
242        PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Halt") PORT_CHANGED(panel_check, (void*)PANEL_HALT)
243        PORT_BIT(0xf8, IP_ACTIVE_HIGH, IPT_UNUSED)
244INPUT_PORTS_END
245
246/****************************************************\
247* Video hardware                                     *
248\****************************************************/
249
250static const UINT8 char_glyphs[0x80][8] =
251{
252    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
253    { 0x00, 0x00, 0x10, 0x38, 0x10, 0x00, 0x00, 0x00 },
254    { 0x38, 0x7c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x00 },
255    { 0xff, 0xff, 0xef, 0xc7, 0xef, 0xff, 0xff, 0xff },
256    { 0xc7, 0x83, 0x01, 0x01, 0x01, 0x83, 0xc7, 0xff },
257    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
258    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
259    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
260    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
261    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
262    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
263    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
264    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
265    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
266    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
267    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
268    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
269    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
270    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
271    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
272    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
273    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
274    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
275    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
276    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
277    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
278    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
279    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
280    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
281    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
282    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
283    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
284    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
285    { 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00 },
286    { 0x66, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00 },
287    { 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00 },
288    { 0x18, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x18, 0x00 },
289    { 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00 },
290    { 0x78, 0xcc, 0x78, 0x70, 0xce, 0xcc, 0x7e, 0x00 },
291    { 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 },
292    { 0x0c, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00 },
293    { 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00 },
294    { 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00 },
295    { 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00 },
296    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30 },
297    { 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00 },
298    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00 },
299    { 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x00 },
300    { 0x3c, 0x66, 0x76, 0x7e, 0x6e, 0x66, 0x3c, 0x00 },
301    { 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 },
302    { 0x3c, 0x66, 0x06, 0x0c, 0x30, 0x60, 0x7e, 0x00 },
303    { 0x3c, 0x66, 0x06, 0x0c, 0x06, 0x66, 0x3c, 0x00 },
304    { 0x66, 0x66, 0x66, 0x7e, 0x06, 0x06, 0x06, 0x00 },
305    { 0x7e, 0x60, 0x7c, 0x06, 0x06, 0x66, 0x3c, 0x00 },
306    { 0x3c, 0x66, 0x60, 0x7c, 0x66, 0x66, 0x3c, 0x00 },
307    { 0x7e, 0x66, 0x06, 0x0c, 0x18, 0x18, 0x18, 0x00 },
308    { 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00 },
309    { 0x3c, 0x66, 0x66, 0x3e, 0x06, 0x66, 0x3c, 0x00 },
310    { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00 },
311    { 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30 },
312    { 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00 },
313    { 0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00 },
314    { 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00 },
315    { 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00 },
316    { 0x3c, 0x66, 0x6e, 0x6e, 0x60, 0x66, 0x3c, 0x00 },
317    { 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 },
318    { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00 },
319    { 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00 },
320    { 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00 },
321    { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7e, 0x00 },
322    { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00 },
323    { 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3c, 0x00 },
324    { 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 },
325    { 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 },
326    { 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
327    { 0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00 },
328    { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00 },
329    { 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00 },
330    { 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x66, 0x00 },
331    { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 },
332    { 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00 },
333    { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x06 },
334    { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x00 },
335    { 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00 },
336    { 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 },
337    { 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 },
338    { 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00 },
339    { 0xc6, 0xc6, 0xd6, 0xfe, 0xfe, 0xee, 0xc6, 0x00 },
340    { 0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00 },
341    { 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00 },
342    { 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00 },
343    { 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00 },
344    { 0x80, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00 },
345    { 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00 },
346    { 0x10, 0x38, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00 },
347    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f },
348    { 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 },
349    { 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 },
350    { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00 },
351    { 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00 },
352    { 0x7c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00 },
353    { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7e, 0x00 },
354    { 0x7e, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00 },
355    { 0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3c, 0x00 },
356    { 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00 },
357    { 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 },
358    { 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00 },
359    { 0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00 },
360    { 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00 },
361    { 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00 },
362    { 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x66, 0x00 },
363    { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 },
364    { 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00 },
365    { 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x06 },
366    { 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x00 },
367    { 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00 },
368    { 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 },
369    { 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00 },
370    { 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00 },
371    { 0xc6, 0xc6, 0xd6, 0xfe, 0xfe, 0xee, 0xc6, 0x00 },
372    { 0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00 },
373    { 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00 },
374    { 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00 },
375    { 0x0c, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0c, 0x00 },
376    { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00 },
377    { 0x30, 0x18, 0x18, 0x0c, 0x18, 0x18, 0x30, 0x00 },
378    { 0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00 },
379    { 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff },
380};
381
382static void glyph_print(running_machine *machine, bitmap_t *bitmap, INT32 x, INT32 y, const char *msg, ...)
383{
384    va_list arg_list;
385    char buf[32768];
386    INT32 index = 0;
387    const device_config *screen = video_screen_first(machine->config);
388    rectangle visarea = *video_screen_get_visible_area(screen);
389
390    va_start( arg_list, msg );
391    vsprintf( buf, msg, arg_list );
392    va_end( arg_list );
393
394    for(index = 0; index < strlen(buf) && index < 32768; index++)
395    {
396        UINT8 cur = (UINT8)buf[index];
397        if(cur < 0x80)
398        {
399            INT32 line = 0;
400            for(line = 0; line < 8; line++)
401            {
402                UINT32 *d = BITMAP_ADDR32(bitmap, y + line, 0);
403                INT32 bit = 0;
404                for(bit = 0; bit < 8; bit++)
405                {
406                    if(char_glyphs[cur][line] & (1 << (7 - bit)))
407                    {
408                        d[x+bit] = 0xffffffff;
409                    }
410                    else
411                    {
412                        d[x+bit] = 0;
413                    }
414                }
415            }
416        }
417
418        x += 8;
419        if(x >= visarea.max_x)
420        {
421            x = 0;
422            y += 8;
423            if(y >= visarea.max_y)
424            {
425                y = 0;
426            }
427        }
428    }
429}
430
431static VIDEO_UPDATE( ssem )
432{
433    UINT32 line = 0;
434    const device_config *ssem_cpu = devtag_get_device(screen->machine, "maincpu");
435    UINT32 accum = cpu_get_reg(ssem_cpu, SSEM_A);
436    UINT32 bit = 0;
437    UINT32 word = 0;
438
439    for(line = 0; line < 32; line++)
440    {
441        word = (store[(line << 2) | 0] << 24) |
442               (store[(line << 2) | 1] << 16) |
443               (store[(line << 2) | 2] <<  8) |
444               (store[(line << 2) | 3] <<  0);
445        for(bit = 0; bit < 32; bit++)
446        {
447            if(word & (1 << (31 - bit)))
448            {
449                glyph_print(screen->machine, bitmap, bit << 3, line << 3, "%c", line == store_line ? 4 : 2);
450            }
451            else
452            {
453                glyph_print(screen->machine, bitmap, bit << 3, line << 3, "%c", line == store_line ? 3 : 1);
454            }
455        }
456    }
457
458    for(bit = 0; bit < 32; bit++)
459    {
460        if(accum & (1 << bit))
461        {
462            glyph_print(screen->machine, bitmap, bit << 3, 264, "%c", 2);
463        }
464        else
465        {
466            glyph_print(screen->machine, bitmap, bit << 3, 264, "%c", 1);
467        }
468    }
469
470    word = reverse((store[(store_line << 2) | 0] << 24) |
471                   (store[(store_line << 2) | 1] << 16) |
472                   (store[(store_line << 2) | 2] <<  8) |
473                   (store[(store_line << 2) | 3] <<  0));
474    glyph_print(screen->machine, bitmap, 0, 272, "LINE:%02d  VALUE:%08x  HALT:%d", store_line, word, cpu_get_reg(ssem_cpu, SSEM_HALT));
475    return 0;
476}
477
478/****************************************************\
479* Image helper functions                             *
480\****************************************************/
481
482static void strlower(char *buf)
483{
484    if(buf)
485    {
486        int i = 0;
487        for(i = 0; i < strlen(buf); i++)
488        {
489            if(buf[i] >= 'A' && buf[i] <= 'Z')
490            {
491                buf[i] |= 0x20;
492            }
493        }
494    }
495}
496
497/****************************************************\
498* Image loading                                      *
499\****************************************************/
500
501static DEVICE_IMAGE_LOAD(ssem_store)
502{
503    const char* image_name = image_filename(image);
504    char image_ext[5] = { 0 };
505    char image_line[100] = { 0 };
506    char token_buf[100] = { 0 };
507    int num_lines = 0;
508    int i = 0;
509
510    // Isolate file extension and convert to lower-case
511    memcpy(image_ext, image_name + (strlen(image_name) - 4), 5);
512    strlower(image_ext);
513
514    image_fgets(image, image_line, 99);
515    sscanf(image_line, "%d", &num_lines);
516
517    if(num_lines)
518    {
519        for(i = 0; i < num_lines; i++)
520        {
521            UINT32 line = 0;
522            image_fgets(image, image_line, 99);
523
524            // Isolate and convert 4-digit decimal address
525            memcpy(token_buf, image_line, 4);
526            token_buf[4] = '\0';
527            sscanf(token_buf, "%04d", &line);
528
529            if(strcmp(image_ext, ".snp") == 0)
530            {
531                UINT32 word = 0;
532                int b = 0;
533
534                // Parse a line such as: 0000:00000110101001000100000100000100
535                for(b = 0; b < 32; b++)
536                {
537                    if(image_line[5 + b] == '1')
538                    {
539                        word |= 1 << (31 - b);
540                    }
541                }
542
543                store[(line << 2) + 0] = (word >> 24) & 0x000000ff;
544                store[(line << 2) + 1] = (word >> 16) & 0x000000ff;
545                store[(line << 2) + 2] = (word >>  8) & 0x000000ff;
546                store[(line << 2) + 3] = (word >>  0) & 0x000000ff;
547            }
548            else if(strcmp(image_ext, ".asm") == 0)
549            {
550                char op_buf[4] = { 0 };
551                INT32 value = 0;
552                UINT32 unsigned_value = 0;
553                UINT32 word = 0;
554
555                // Isolate the opcode and convert to lower-case
556                memcpy(op_buf, image_line + 5, 3);
557                op_buf[3] = '\0';
558                strlower(op_buf);
559
560                // Isolate the value
561                sscanf(image_line + 9, "%d", &value);
562                unsigned_value = reverse((UINT32)value);
563
564                if(strcmp(op_buf, "num") == 0)
565                {
566                    word = unsigned_value;
567                }
568                else if(strcmp(op_buf, "jmp") == 0)
569                {
570                    word = 0x00000000 | unsigned_value ;
571                }
572                else if(strcmp(op_buf, "jrp") == 0)
573                {
574                    word = 0x00040000 | unsigned_value;
575                }
576                else if(strcmp(op_buf, "ldn") == 0)
577                {
578                    word = 0x00020000 | unsigned_value;
579                }
580                else if(strcmp(op_buf, "sto") == 0)
581                {
582                    word = 0x00060000 | unsigned_value;
583                }
584                else if(strcmp(op_buf, "sub") == 0)
585                {
586                    word = 0x00010000 | unsigned_value;
587                }
588                else if(strcmp(op_buf, "cmp") == 0)
589                {
590                    word = 0x00030000 | unsigned_value;
591                }
592                else if(strcmp(op_buf, "stp") == 0)
593                {
594                    word = 0x00070000 | unsigned_value;
595                }
596
597                store[(line << 2) + 0] = (word >> 24) & 0x000000ff;
598                store[(line << 2) + 1] = (word >> 16) & 0x000000ff;
599                store[(line << 2) + 2] = (word >>  8) & 0x000000ff;
600                store[(line << 2) + 3] = (word >>  0) & 0x000000ff;
601            }
602        }
603    }
604
605    return INIT_PASS;
606}
607
608/****************************************************\
609* Machine definition                                 *
610\****************************************************/
611
612static MACHINE_RESET( ssem )
613{
614    store_line = 0;
615}
616
617static MACHINE_DRIVER_START( ssem )
618    /* basic machine hardware */
619    MDRV_CPU_ADD("maincpu", SSEM, 700)
620    MDRV_CPU_PROGRAM_MAP(ssem_map)
621
622    MDRV_MACHINE_RESET(ssem)
623
624    /* video hardware */
625    MDRV_SCREEN_ADD("screen", RASTER)
626    MDRV_SCREEN_REFRESH_RATE(50)
627    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
628    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
629    MDRV_SCREEN_SIZE(256, 280)
630    MDRV_SCREEN_VISIBLE_AREA(0, 255, 0, 279)
631    MDRV_PALETTE_LENGTH(2)
632    MDRV_PALETTE_INIT(black_and_white)
633
634    MDRV_VIDEO_START(generic_bitmapped)
635    MDRV_VIDEO_UPDATE(ssem)
636
637    /* cartridge */
638    MDRV_CARTSLOT_ADD("cart")
639    MDRV_CARTSLOT_EXTENSION_LIST("snp,asm")
640    MDRV_CARTSLOT_MANDATORY
641    MDRV_CARTSLOT_LOAD(ssem_store)
642MACHINE_DRIVER_END
643
644ROM_START( ssem )
645    ROM_REGION( 0x80, "maincpu",0 )  /* Main Store */
646    ROM_FILL( 0x0000, 0x80, 0x00 )
647ROM_END
648
649/*   YEAR      NAME    PARENT    COMPAT   MACHINE     INPUT      INIT    CONFIG   COMPANY                   FULLNAME */
650COMP(1948,     ssem,        0,        0,     ssem,     ssem,        0,        0,  "Manchester University", "Small-Scale Experimental Machine (SSEM), 'Baby'", GAME_NO_SOUND )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team