Previous 15994 Revisions Next

r1402 Sunday 9th December, 2007 at 23:36:58 UTC by Nathan Woods
[TI99] Fixed fatal regressions introduced a few releases ago. [Michael Zapf]
[docs]messnew.txt
[src/mess/devices]mflopimg.c mflopimg.h
[src/mess/drivers]geneve.c ti99_4x.c
[src/mess/includes]geneve.h
[src/mess/machine]994x_ser.c 994x_ser.h 99_dsk.c 99_dsk.h 99_hsgpl.c 99_hsgpl.h 99_ide.c 99_ide.h 99_peb.c 99_peb.h 99_usbsm.c 99_usbsm.h geneve.c ti99_4x.c ti99_4x.h tms9902.c tms9902.h

src/mess/devices/mflopimg.c
r1401r1402
1111#include "image.h"
1212#include "devices/flopdrv.h"
1313
14
15
16/***************************************************************************
17    CONSTANTS
18***************************************************************************/
19
1420#define FLOPPY_TAG      "floptag"
1521#define LOG_FLOPPY      0
1622
17struct mess_flopimg
23
24
25/***************************************************************************
26    TYPE DEFINITIONS
27***************************************************************************/
28
29typedef struct _mess_flopimg mess_flopimg;
30struct _mess_flopimg
1831{
1932   floppy_image *floppy;
2033   int track;
r1401r1402
2235   int (*tracktranslate_proc)(mess_image *image, floppy_image *floppy, int physical_track);
2336};
2437
25struct floppy_error_map
38
39
40typedef struct _floppy_error_map floppy_error_map;
41struct _floppy_error_map
2642{
2743   floperr_t ferr;
2844   image_error_t ierr;
2945   const char *message;
3046};
3147
32static const struct floppy_error_map errmap[] =
48
49
50/***************************************************************************
51    GLOBAL VARIABLES
52***************************************************************************/
53
54static const floppy_error_map errmap[] =
3355{
3456   { FLOPPY_ERROR_SUCCESS,         IMAGE_ERROR_SUCCESS },
3557   { FLOPPY_ERROR_INTERNAL,      IMAGE_ERROR_INTERNAL },
r1401r1402
3860   { FLOPPY_ERROR_INVALIDIMAGE,   IMAGE_ERROR_INVALIDIMAGE }
3961};
4062
63static int flopimg_keep_geometry;   /* hack for TI-99 - please fix when possible */
4164
42static struct mess_flopimg *get_flopimg(mess_image *image)
65
66
67/***************************************************************************
68    IMPLEMENTATION
69***************************************************************************/
70
71static mess_flopimg *get_flopimg(mess_image *image)
4372{
44   return (struct mess_flopimg *) image_lookuptag(image, FLOPPY_TAG);
73   return (mess_flopimg *) image_lookuptag(image, FLOPPY_TAG);
4574}
4675
4776
r1401r1402
5584
5685static void flopimg_seek_callback(mess_image *image, int physical_track)
5786{
58   struct mess_flopimg *flopimg;
87   mess_flopimg *flopimg;
5988
6089   flopimg = get_flopimg(image);
6190   if (!flopimg || !flopimg->floppy)
r1401r1402
72101
73102static int flopimg_get_sectors_per_track(mess_image *image, int side)
74103{
75   struct mess_flopimg *flopimg;
104   mess_flopimg *flopimg;
76105   floperr_t err;
77106   int sector_count;
78107
r1401r1402
90119
91120static void flopimg_get_id_callback(mess_image *image, chrn_id *id, int id_index, int side)
92121{
93   struct mess_flopimg *flopimg;
122   mess_flopimg *flopimg;
94123   int cylinder, sector, N;
95124   UINT32 sector_length;
96125   
r1401r1402
125154
126155static void flopimg_read_sector_data_into_buffer(mess_image *image, int side, int index1, char *ptr, int length)
127156{
128   struct mess_flopimg *flopimg;
157   mess_flopimg *flopimg;
129158
130159   flopimg = get_flopimg(image);
131160   if (!flopimg || !flopimg->floppy)
r1401r1402
141170
142171static void flopimg_write_sector_data_from_buffer(mess_image *image, int side, int index1, const char *ptr, int length,int ddam)
143172{
144   struct mess_flopimg *flopimg;
173   mess_flopimg *flopimg;
145174
146175   flopimg = get_flopimg(image);
147176   if (!flopimg || !flopimg->floppy)
r1401r1402
157186
158187static void flopimg_read_track_data_info_buffer(mess_image *image, int side, void *ptr, int *length)
159188{
160   struct mess_flopimg *flopimg;
189   mess_flopimg *flopimg;
161190
162191   flopimg = get_flopimg(image);
163192   if (!flopimg || !flopimg->floppy)
r1401r1402
170199
171200static void flopimg_write_track_data_info_buffer(mess_image *image, int side, const void *ptr, int *length)
172201{
173   struct mess_flopimg *flopimg;
202   mess_flopimg *flopimg;
174203
175204   flopimg = get_flopimg(image);
176205   if (!flopimg || !flopimg->floppy)
r1401r1402
234263
235264static int device_init_floppy(mess_image *image)
236265{
237   if (!image_alloctag(image, FLOPPY_TAG, sizeof(struct mess_flopimg)))
266    flopimg_keep_geometry = FALSE;
267    if (!image_alloctag(image, FLOPPY_TAG, sizeof(mess_flopimg)))
238268      return INIT_FAIL;
239269   return floppy_drive_init(image, &mess_floppy_interface);
240270}
r1401r1402
244274static int internal_floppy_device_load(mess_image *image, int create_format, option_resolution *create_args)
245275{
246276   floperr_t err;
247   struct mess_flopimg *flopimg;
277   mess_flopimg *flopimg;
248278   const struct IODevice *dev;
249279   const struct FloppyFormat *floppy_options;
250280   int floppy_flags, i;
r1401r1402
276306   }
277307
278308   /* if we can get head and track counts, then set the geometry accordingly */
279   if (floppy_callbacks(flopimg->floppy)->get_heads_per_disk
309   if (!flopimg_keep_geometry
310            && floppy_callbacks(flopimg->floppy)->get_heads_per_disk
280311      && floppy_callbacks(flopimg->floppy)->get_tracks_per_disk)
281312   {
282313      floppy_drive_set_geometry_absolute(image,
r1401r1402
312343
313344static void device_unload_floppy(mess_image *image)
314345{
315   struct mess_flopimg *flopimg;
346   mess_flopimg *flopimg;
316347   flopimg = image_lookuptag(image, FLOPPY_TAG);
317348
318349   /* if we have one of our hacky unload procs, call it */
r1401r1402
333364
334365void floppy_install_unload_proc(mess_image *image, void (*proc)(mess_image *image))
335366{
336   struct mess_flopimg *flopimg;
367   mess_flopimg *flopimg;
337368   flopimg = image_lookuptag(image, FLOPPY_TAG);
338369   flopimg->unload_proc = proc;
339370}
r1401r1402
342373
343374void floppy_install_tracktranslate_proc(mess_image *image, int (*proc)(mess_image *image, floppy_image *floppy, int physical_track))
344375{
345   struct mess_flopimg *flopimg;
376   mess_flopimg *flopimg;
346377   flopimg = image_lookuptag(image, FLOPPY_TAG);
347378   flopimg->tracktranslate_proc = proc;
348379}
349380
350381
382/************
383 *  Another hack for ti99: Drive track count may differ from medium track count.
384 *  It is possible to insert a 40 track medium in an 80 track drive; the TI
385 *  controllers read the track count from sector 0 and automatically
386 *  apply double steps. Setting the track count of the drive to the medium
387 *  track count will lead to unreachable tracks.
388 *  This function is called from 99_dsk.c to switch off the lines in
389 *  internal_floppy_device_load which set the drive geometry to the medium
390 *  geometry.
391 *************/
392void floppy_keep_drive_geometry(void)
393{
394   assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call floppy_keep_drive_geometry at init time!");
395   flopimg_keep_geometry = TRUE;
396}
351397
398
399
352400/*************************************
353401 *
354402 *   Device specification function
src/mess/devices/mflopimg.h
r1401r1402
2727/* hack for TI99; replace this when we think of something better */
2828void floppy_install_tracktranslate_proc(mess_image *image, int (*proc)(mess_image *image, floppy_image *floppy, int physical_track));
2929
30/* another hack for TI99: Drive track count may differ from medium track count. */
31void floppy_keep_drive_geometry(void);
32
3033#endif /* MFLOPIMG_H */
src/mess/includes/geneve.h
r1401r1402
3232DRIVER_INIT( genmod );
3333
3434MACHINE_START( geneve );
35MACHINE_RESET( geneve );
3536
3637VIDEO_START( geneve );
3738void geneve_hblank_interrupt(void);
src/mess/machine/99_dsk.c
r1401r1402
267267   int success;
268268   floperr_t err;
269269
270        /* Prevents internal_floppy_device_load (mflopimg) to set the drive
271           geometry to the medium geometry. TI disk controllers determine the
272           number of tracks from a field in sector 0, and if the medium has
273           40 tracks but the drive has 80, the DSR ROM automatically
274           double-steps the tracks.
275        */
276        floppy_keep_drive_geometry();
277
270278   geometry1 = floppy_create_tag(floppy, TI99DSK_TAG, sizeof(*geometry1));
271279
272280   ti99_guess_geometry(floppy, geometry1, NULL, &success);
r1401r1402
362370*/
363371void ti99_fdc_init(void)
364372{
373   wd17xx_init(WD_TYPE_179X, fdc_callback, NULL);      /* initialize the floppy disk controller */
374   ti99_install_tracktranslate_procs();
375   motor_on_timer = timer_alloc(motor_on_timer_callback, NULL);
376   use_80_track_drives = FALSE;
377}
378
379/*
380   Reset fdc card, set up handlers
381*/
382void ti99_fdc_reset(void)
383{
365384   ti99_disk_DSR = memory_region(region_dsr) + offset_fdc_dsr;
366
367385   DSEL = 0;
368386   DSKnum = -1;
369387   DSKside = 0;
370388
371389   DVENA = 0;
372390   motor_on = 0;
373   motor_on_timer = timer_alloc(motor_on_timer_callback, NULL);
374
375391   ti99_peb_set_card_handlers(0x1100, & fdc_handlers);
376
377   wd17xx_init(WD_TYPE_179X, fdc_callback, NULL);      /* initialize the floppy disk controller */
392   wd17xx_reset();      /* resets the fdc */
378393   wd17xx_set_density(DEN_FM_LO);
379
380   use_80_track_drives = FALSE;
381
382   ti99_install_tracktranslate_procs();
383394}
384395
385396
r1401r1402
627638*/
628639void ti99_ccfdc_init(void)
629640{
641   wd17xx_init(WD_TYPE_179X, fdc_callback, NULL);      /* initialize the floppy disk controller */
642   motor_on_timer = timer_alloc(motor_on_timer_callback, NULL);
643   ti99_install_tracktranslate_procs();
644   use_80_track_drives = FALSE;
645}
646
647void ti99_ccfdc_reset(void)
648{
630649   ti99_disk_DSR = memory_region(region_dsr) + offset_ccfdc_dsr;
631
632650   DSEL = 0;
633651   DSKnum = -1;
634652   DSKside = 0;
635653
636654   DVENA = 0;
637655   motor_on = 0;
638   motor_on_timer = timer_alloc(motor_on_timer_callback, NULL);
639656
640657   ti99_peb_set_card_handlers(0x1100, & ccfdc_handlers);
641658
642   wd17xx_init(WD_TYPE_179X, fdc_callback, NULL);      /* initialize the floppy disk controller */
659   wd17xx_reset();      /* initialize the floppy disk controller */
643660   wd17xx_set_density(DEN_MFM_LO);
661}
644662
645663
646   use_80_track_drives = FALSE;
647664
648   ti99_install_tracktranslate_procs();
649}
650
651
652665/*
653666   Read disk CRU interface
654667
r1401r1402
842855*/
843856void ti99_bwg_init(void)
844857{
858   wd17xx_init(WD_TYPE_179X, fdc_callback, NULL);      /* initialize the floppy disk controller */
859   mm58274c_init(1, 1);   /* initialize the RTC */
860   motor_on_timer = timer_alloc(motor_on_timer_callback, NULL);
861   ti99_install_tracktranslate_procs();
862   use_80_track_drives = FALSE;
863}
864
865void ti99_bwg_reset(void)
866{
845867   ti99_disk_DSR = memory_region(region_dsr) + offset_bwg_dsr;
846   bwg_ram = memory_region(region_dsr) + offset_bwg_ram;
868        bwg_ram = memory_region(region_dsr) + offset_bwg_ram;
847869   bwg_ram_offset = 0;
848870   bwg_rom_offset = 0;
849871   bwg_rtc_enable = 0;
r1401r1402
854876
855877   DVENA = 0;
856878   motor_on = 0;
857   motor_on_timer = timer_alloc(motor_on_timer_callback, NULL);
858
859879   ti99_peb_set_card_handlers(0x1100, & bwg_handlers);
860880
861   wd17xx_init(WD_TYPE_179X, fdc_callback, NULL);      /* initialize the floppy disk controller */
881   wd17xx_reset();      /* initialize the floppy disk controller */
862882   wd17xx_set_density(DEN_MFM_LO);
863
864
865   mm58274c_init(1, 1);   /* initialize the RTC */
866
867   use_80_track_drives = FALSE;
868
869   ti99_install_tracktranslate_procs();
870883}
871884
872
873885/*
874886   Read disk CRU interface
875887
r1401r1402
12361248*/
12371249void ti99_hfdc_init(void)
12381250{
1251   /* initialize the floppy disk controller */
1252   smc92x4_init(0, & hfdc_intf);
1253   mm58274c_init(1, 1);   /* initialize the RTC */
1254   motor_on_timer = timer_alloc(motor_on_timer_callback, NULL);
1255   ti99_install_tracktranslate_procs();
1256   use_80_track_drives = TRUE;
1257}
1258
1259
1260void ti99_hfdc_reset(void)
1261{
12391262   ti99_disk_DSR = memory_region(region_dsr) + offset_hfdc_dsr;
12401263   hfdc_ram = memory_region(region_dsr) + offset_hfdc_ram;
12411264   hfdc_ram_offset[0] = hfdc_ram_offset[1] = hfdc_ram_offset[2] = 0;
r1401r1402
12481271
12491272   DVENA = 0;
12501273   motor_on = 0;
1251   motor_on_timer = timer_alloc(motor_on_timer_callback, NULL);
12521274
12531275   ti99_peb_set_card_handlers(0x1100, & hfdc_handlers);
12541276
1255   /* initialize the floppy disk controller */
1256   smc92x4_init(0, & hfdc_intf);
1257
1258   mm58274c_init(1, 1);   /* initialize the RTC */
1259
1260   use_80_track_drives = TRUE;
1261
1262   ti99_install_tracktranslate_procs();
1277   smc92x4_reset(0);
12631278}
12641279
12651280
r1401r1402
12691284static int hfdc_cru_r(int offset)
12701285{
12711286   int reply;
1272
12731287   switch (offset)
12741288   {
12751289   case 0:
src/mess/machine/99_dsk.h
r1401r1402
11FLOPPY_OPTIONS_EXTERN(ti99);
22
33void ti99_fdc_init(void);
4void ti99_fdc_reset(void);
45#if HAS_99CCFDC
56void ti99_ccfdc_init(void);
7void ti99_ccfdc_reset(void);
68#endif
79void ti99_bwg_init(void);
10void ti99_bwg_reset(void);
811void ti99_hfdc_init(void);
12void ti99_hfdc_reset(void);
src/mess/machine/geneve.c
r1401r1402
200200   /*has_genmod = TRUE;*/
201201}
202202
203
204203MACHINE_START( geneve )
205204{
205       tms9901_init(0, & tms9901reset_param_ti99);
206
207        /* Initialize all. Actually, at this point, we don't know
208           how the switches are set. Later we use the configuration switches to
209           determine which one to use. */
210   ti99_peb_init();
211        ti99_fdc_init();
212#if HAS_99CCFDC
213   ti99_ccfdc_init();
214#endif
215   ti99_bwg_init();
216   ti99_hfdc_init();
217        ti99_ide_init();
218        ti99_rs232_init();
219   ti99_usbsm_init();
220   mm58274c_init(0, 1);
221   add_exit_callback(machine, machine_stop_geneve);
222}
223
224MACHINE_RESET( geneve )
225{
206226   mode_flags = /*0*/mf_mapmode;
207227   /* initialize page lookup */
208228   memset(page_lookup, 0, sizeof(page_lookup));
r1401r1402
219239   cartridge_page = 0;
220240
221241   /* init tms9901 */
222   tms9901_init(0, & tms9901reset_param_ti99);
242       tms9901_reset(0);
223243
224244   v9938_reset();
225245
226   mm58274c_init(0, 1);
227
228246   /* clear keyboard interface state (probably overkill, but can't harm) */
229247   JoySel = 0;
230248   KeyQueueHead = KeyQueueLen = 0;
r1401r1402
247265   has_usb_sm = (readinputport(input_port_config) >> config_usbsm_bit) & config_usbsm_mask;
248266
249267   /* set up optional expansion hardware */
250   ti99_peb_init(0, inta_callback, intb_callback);
268   ti99_peb_reset(0, inta_callback, intb_callback);
251269
252270   if (has_speech)
253271   {
r1401r1402
259277   switch (fdc_kind)
260278   {
261279   case fdc_kind_TI:
262      ti99_fdc_init();
280      ti99_fdc_reset();
263281      break;
264282#if HAS_99CCFDC
265283   case fdc_kind_CC:
266      ti99_ccfdc_init();
284      ti99_ccfdc_reset();
267285      break;
268286#endif
269287   case fdc_kind_BwG:
270      ti99_bwg_init();
288      ti99_bwg_reset();
271289      break;
272290   case fdc_kind_hfdc:
273      ti99_hfdc_init();
291      ti99_hfdc_reset();
274292      break;
275293   case fdc_kind_none:
276294      break;
r1401r1402
278296
279297   if (has_ide)
280298   {
281      ti99_ide_init(TRUE);
299      ti99_ide_reset(TRUE);
282300      ti99_ide_load_memcard();
283301   }
284302
285303   if (has_rs232)
286      ti99_rs232_init();
304      ti99_rs232_reset();
287305
288306   if (has_usb_sm)
289      ti99_usbsm_init(TRUE);
290
291   add_exit_callback(machine, machine_stop_geneve);
307      ti99_usbsm_reset(TRUE);
292308}
293309
294310static void machine_stop_geneve(running_machine *machine)
src/mess/machine/99_usbsm.c
r1401r1402
7070static int tms9995_mode;
7171
7272/*
73   Initilaizes USB-SmartMedia card, set up handlers
74*/
75void ti99_usbsm_init() {
76   ti99_usbsm_RAM = auto_malloc(0x100000);
77}
78
79/*
7380   Reset USB-SmartMedia card, set up handlers
7481*/
75int ti99_usbsm_init(int in_tms9995_mode)
82int ti99_usbsm_reset(int in_tms9995_mode)
7683{
77   ti99_usbsm_RAM = auto_malloc(0x100000);
7884   if (strataflash_init(0))
7985      return 1;
8086   if (smartmedia_machine_init(0))
src/mess/machine/99_usbsm.h
r1401r1402
22DEVICE_LOAD( ti99_sm );
33DEVICE_UNLOAD( ti99_sm );*/
44
5int ti99_usbsm_init(int in_tms9995_mode);
5void ti99_usbsm_init(void);
6int ti99_usbsm_reset(int in_tms9995_mode);
src/mess/machine/99_ide.c
r1401r1402
102102}
103103
104104/*
105   Reset ide card, set up handlers
105   Initializes the ide card, set up handlers
106106*/
107void ti99_ide_init(int in_tms9995_mode)
107void ti99_ide_init()
108108{
109109   rtc65271_init(memory_region(region_dsr) + offset_ide_ram2, clk_interrupt_callback);
110
111110   ti99_ide_RAM = memory_region(region_dsr) + offset_ide_ram;
111}
112112
113/*
114   Reset ide card, set up handlers
115*/
116void ti99_ide_reset(int in_tms9995_mode)
117{
113118   ti99_peb_set_card_handlers(0x1000, & ide_handlers);
114119
115120   cur_page = 0;
src/mess/machine/99_ide.h
r1401r1402
33
44void ti99_ide_harddisk_getinfo(const device_class *devclass, UINT32 state, union devinfo *info);
55
6void ti99_ide_init(int in_tms9995_mode);
6void ti99_ide_init(void);
7void ti99_ide_reset(int in_tms9995_mode);
src/mess/machine/99_peb.c
r1401r1402
167167
168168
169169/*
170   Initializes the expansion card handlers
171
172*/
173void ti99_peb_init()
174{
175   memset(expansion_ports, 0, sizeof(expansion_ports));
176   memset(ti99_4p_expansion_ports, 0, sizeof(ti99_4p_expansion_ports));
177}
178
179
180/*
170181   Resets the expansion card handlers
171182
172183   in_has_16bit_peb: TRUE if we are using the snug sgcpu 99/4p 16-bit
r1401r1402
176187   in_intb_callback: callback called when the state of INTB changes (may be
177188      NULL)
178189*/
179void ti99_peb_init(int in_has_16bit_peb, void (*in_inta_callback)(int state), void (*in_intb_callback)(int state))
190void ti99_peb_reset(int in_has_16bit_peb, void (*in_inta_callback)(int state), void (*in_intb_callback)(int state))
180191{
181   memset(expansion_ports, 0, sizeof(expansion_ports));
182   memset(ti99_4p_expansion_ports, 0, sizeof(ti99_4p_expansion_ports));
183
184192   has_16bit_peb = in_has_16bit_peb;
185193   inta_callback = in_inta_callback;
186194   intb_callback = in_intb_callback;
r1401r1402
471479
472480   if (active_card != -1)
473481   {
474      handler = expansion_ports[active_card].mem_read;
482            handler = expansion_ports[active_card].mem_read;
475483      if (handler)
476484         reply = (*handler)(offset);
477485   }
src/mess/machine/tms9902.c
r1401r1402
111111   prototypes
112112*/
113113
114static void reset(int which);
115114static void field_interrupts(int which);
116115static TIMER_CALLBACK(decrementer_callback);
117116static void set_rts(int which, int state);
r1401r1402
138137
139138   tms9902[which].timer = timer_alloc(decrementer_callback, NULL);
140139
141   reset(which);
140   tms9902_reset(which);
142141}
143142
144143
r1401r1402
151150   }
152151}
153152
154static void reset(int which)
153void tms9902_reset(int which)
155154{
156155   /*  disable all interrupts */
157156   tms9902[which].DSCENB = 0;
r1401r1402
611610      break;
612611
613612   case 0x1F:   /* RESET */
614      reset(which);
613      tms9902_reset(which);
615614      break;
616615   }
617616}
src/mess/machine/99_peb.h
r1401r1402
5353   intb_ieee488_bit = 7-1
5454};
5555
56void ti99_peb_init(int in_has_16bit_peb, void (*in_inta_callback)(int state), void (*in_intb_callback)(int state));
56void ti99_peb_init(void);
57void ti99_peb_reset(int in_has_16bit_peb, void (*in_inta_callback)(int state), void (*in_intb_callback)(int state));
5758
5859void ti99_peb_set_card_handlers(int cru_base, const ti99_peb_card_handlers_t *handler);
5960void ti99_peb_set_16bit_card_handlers(int cru_base, const ti99_peb_16bit_card_handlers_t *handler);
src/mess/machine/tms9902.h
r1401r1402
99
1010
1111void tms9902_init(int which, const tms9902reset_param *param);
12void tms9902_reset(int which);
1213void tms9902_cleanup(int which);
1314
1415void tms9902_set_cts(int which, int state);
src/mess/machine/99_hsgpl.c
r1401r1402
248248}
249249
250250/*
251   Reset hsgpl card, set up handlers
251   Initialize hsgpl card, set up handlers
252252*/
253253void ti99_hsgpl_init(void)
254254{
255255   hsgpl.GRAM_ptr = memory_region(region_hsgpl) + offset_hsgpl_gram;
256256   hsgpl.RAM6_ptr = memory_region(region_hsgpl) + offset_hsgpl_ram6;
257   hsgpl.addr = 0;
258   hsgpl.raddr_LSB = 0;
259   hsgpl.waddr_LSB = 0;
260   hsgpl.cur_port = 0;
261   hsgpl.cur_bank = 0;
262   hsgpl.cru_reg = 0;
263   set_hsgpl_crdena(/*0*/1);
264257
265258   at29c040a_init_data_ptr(feeprom_grom0, memory_region(region_hsgpl) + offset_hsgpl_grom);
266259   at29c040a_init(feeprom_grom0);
r1401r1402
270263   at29c040a_init(feeprom_rom6);
271264   at29c040a_init_data_ptr(feeprom_dsr, memory_region(region_hsgpl) + offset_hsgpl_dsr);
272265   at29c040a_init(feeprom_dsr);
266}
273267
268/*
269   Reset hsgpl card
270*/
271void ti99_hsgpl_reset(void)
272{
273   hsgpl.addr = 0;
274   hsgpl.raddr_LSB = 0;
275   hsgpl.waddr_LSB = 0;
276   hsgpl.cur_port = 0;
277   hsgpl.cur_bank = 0;
278   hsgpl.cru_reg = 0;
279   set_hsgpl_crdena(/*0*/1);
280
274281   ti99_peb_set_card_handlers(0x1b00, & hsgpl_handlers);
275282}
276283
r1401r1402
309316   int port;
310317   int reply;
311318
312
313319   //activecpu_adjust_icount(-4);
314320
315321   port = hsgpl.cur_port = (offset & 0x1FE) >> 1;
src/mess/machine/99_hsgpl.h
r1401r1402
44int ti99_hsgpl_save_memcard(void);
55
66void ti99_hsgpl_init(void);
7void ti99_hsgpl_reset(void);
78
89READ16_HANDLER ( ti99_hsgpl_gpl_r );
910WRITE16_HANDLER ( ti99_hsgpl_gpl_w );
src/mess/machine/ti99_4x.c
r1401r1402
7272#include "devices/harddriv.h"   /* for device_init_mess_hd() */
7373#include "smc92x4.h"   /* for smc92x4_hd_load()/smc92x4_hd_unload() */
7474
75
7675/* prototypes */
7776static READ16_HANDLER ( ti99_rspeech_r );
7877static WRITE16_HANDLER ( ti99_wspeech_w );
r1401r1402
10099static void ti99_audio_gate(int offset, int data);
101100static void ti99_CS_output(int offset, int data);
102101
103static void ti99_8_internal_dsr_init(void);
102static void ti99_8_internal_dsr_reset(void);
104103
105static void ti99_4p_internal_dsr_init(void);
104static void ti99_4p_internal_dsr_reset(void);
106105static void ti99_TIxram_init(void);
107106static void ti99_sAMSxram_init(void);
108107static void ti99_4p_mapper_init(void);
109108static void ti99_myarcxram_init(void);
110static void ti99_evpc_init(void);
109static void ti99_evpc_reset(void);
111110
111static void ti99_common_init(const TMS9928a_interface *intf);
112
113
112114/*
113115   pointer to extended RAM area
114116*/
r1401r1402
667669
668670MACHINE_START( ti99_4_60hz )
669671{
670   TMS9928A_configure(&tms9918_interface);
672    ti99_common_init(&tms9918_interface);
671673}
672674
673675static const TMS9928a_interface tms9929_interface =
r1401r1402
680682
681683MACHINE_START( ti99_4_50hz )
682684{
683   TMS9928A_configure(&tms9929_interface);
685    ti99_common_init(&tms9929_interface);
684686}
685687
686688static const TMS9928a_interface tms9918a_interface =
r1401r1402
693695
694696MACHINE_START( ti99_4a_60hz )
695697{
696   TMS9928A_configure(&tms9918a_interface);
698    ti99_common_init(&tms9918a_interface);
697699}
698700
699701static const TMS9928a_interface tms9929a_interface =
r1401r1402
706708
707709MACHINE_START( ti99_4a_50hz )
708710{
709   TMS9928A_configure(&tms9929a_interface);
711    ti99_common_init(&tms9929a_interface);
710712}
711713
714MACHINE_START( ti99_4ev_60hz)
715{
716   tms9901_init(0, & tms9901reset_param_ti99_4x);
717       ti99_peb_init();
718        ti99_fdc_init();
719#if HAS_99CCFDC
720   ti99_ccfdc_init();
721#endif
722   ti99_bwg_init();
723   ti99_hfdc_init();
724        ti99_ide_init();
725        ti99_rs232_init();
726   ti99_hsgpl_init();
727   ti99_usbsm_init();
728}
729
730static void ti99_common_init(const TMS9928a_interface *gfxparm) {
731
732   tms9901_init(0, & tms9901reset_param_ti99_4x);
733
734   TMS9928A_configure(gfxparm);
735           
736        /* Initialize all. Actually, at this point, we don't know
737           how the switches are set. Later we use the configuration switches to
738           determine which one to use. */
739   ti99_peb_init();
740        ti99_fdc_init();
741#if HAS_99CCFDC
742   ti99_ccfdc_init();
743#endif
744   ti99_bwg_init();
745   ti99_hfdc_init();
746        ti99_ide_init();
747        ti99_rs232_init();
748   ti99_hsgpl_init();
749   ti99_usbsm_init();
750}
751
752
712753/*
713754   ti99_init_machine(); called before ti99_load_rom...
714755*/
r1401r1402
744785   }
745786
746787   /* init tms9901 */
747   if (ti99_model == model_99_8)
748      tms9901_init(0, & tms9901reset_param_ti99_8);
749   else
750      tms9901_init(0, & tms9901reset_param_ti99_4x);
788        tms9901_reset(0);
789   
790   if (!has_evpc) TMS9928A_reset();
791        else v9938_reset();
751792
752   if (! has_evpc)
753      TMS9928A_reset();
754   if (has_evpc)
755      v9938_reset();
756
757793   /* clear keyboard interface state (probably overkill, but can't harm) */
758794   KeyCol = 0;
759795   AlphaLockLine = 0;
r1401r1402
784820   has_usb_sm = (readinputport(input_port_config) >> config_usbsm_bit) & config_usbsm_mask;
785821
786822   /* set up optional expansion hardware */
787   ti99_peb_init(ti99_model == model_99_4p, tms9901_set_int1, NULL);
823   ti99_peb_reset(ti99_model == model_99_4p, tms9901_set_int1, NULL);
788824
789825   if (ti99_model == model_99_8)
790      ti99_8_internal_dsr_init();
826      ti99_8_internal_dsr_reset();
791827
792828   if (ti99_model == model_99_4p)
793      ti99_4p_internal_dsr_init();
829      ti99_4p_internal_dsr_reset();
794830
795   if (has_speech)
831        if (has_speech)
796832   {
797833      spchroms_interface speech_intf = { region_speech_rom };
798834
r1401r1402
819855   {
820856   case xRAM_kind_none:
821857   default:
822      /* reset mem handler to none */
823858      memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, ti99_nop_8_r);
824859      memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2000, 0x3fff, 0, 0, ti99_nop_8_w);
825860      memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0xa000, 0xffff, 0, 0, ti99_nop_8_r);
r1401r1402
841876      ti99_myarcxram_init();
842877      break;
843878   case xRAM_kind_99_8:
844      /* nothing needs to be done */
845879      break;
846880   }
847881
848882   switch (fdc_kind)
849883   {
850884   case fdc_kind_TI:
851      ti99_fdc_init();
885      ti99_fdc_reset();
852886      break;
853887#if HAS_99CCFDC
854888   case fdc_kind_CC:
855      ti99_ccfdc_init();
889      ti99_ccfdc_reset();
856890      break;
857891#endif
858892   case fdc_kind_BwG:
859      ti99_bwg_init();
893      ti99_bwg_reset();
860894      break;
861895   case fdc_kind_hfdc:
862      ti99_hfdc_init();
896      ti99_hfdc_reset();
863897      break;
864898   case fdc_kind_none:
865899      break;
866900   }
867901
868   if (has_ide)
869   {
870      ti99_ide_init(ti99_model == model_99_8);
902   if (has_ide) {
903      ti99_ide_reset(ti99_model == model_99_8);
871904      ti99_ide_load_memcard();
872905   }
873906
874907   if (has_rs232)
875      ti99_rs232_init();
908      ti99_rs232_reset();
876909
877   if (has_hsgpl)
878   {
879      ti99_hsgpl_init();
880      ti99_hsgpl_load_memcard();
910   if (has_hsgpl)   {
911            ti99_hsgpl_reset();
912            ti99_hsgpl_load_memcard();
881913   }
882914   else
883915      hsgpl_crdena = 0;
884916
885917   if (has_usb_sm)
886      ti99_usbsm_init(ti99_model == model_99_8);
918      ti99_usbsm_reset(ti99_model == model_99_8);
887919
888920   if (has_evpc)
889      ti99_evpc_init();
921      ti99_evpc_reset();
890922
891923   /* initialize mechatronics mouse */
892924   mecmouse_sel = 0;
r1401r1402
24062438
24072439
24082440/* set up handlers, and set initial state */
2409static void ti99_8_internal_dsr_init(void)
2441static void ti99_8_internal_dsr_reset(void)
24102442{
24112443   ti99_8_internal_DSR = memory_region(REGION_CPU1) + offset_rom0_8 + 0x4000;
24122444
r1401r1402
24632495
24642496
24652497/* set up handlers, and set initial state */
2466static void ti99_4p_internal_dsr_init(void)
2498static void ti99_4p_internal_dsr_reset(void)
24672499{
24682500   ti99_4p_internal_DSR = (UINT16 *) (memory_region(REGION_CPU1) + offset_rom4_4p);
24692501   ti99_4p_internal_ROM6 = (UINT16 *) (memory_region(REGION_CPU1) + offset_rom6_4p);
r1401r1402
30003032/*
30013033   Reset evpc card, set up handlers
30023034*/
3003static void ti99_evpc_init(void)
3035static void ti99_evpc_reset(void)
30043036{
30053037   ti99_evpc_DSR = memory_region(region_dsr) + offset_evpc_dsr;
30063038
src/mess/machine/ti99_4x.h
r1401r1402
156156MACHINE_START( ti99_4_50hz );
157157MACHINE_START( ti99_4a_60hz );
158158MACHINE_START( ti99_4a_50hz );
159MACHINE_START( ti99_4ev_60hz );
159160MACHINE_RESET( ti99 );
160161
161162DEVICE_LOAD( ti99_cassette );
src/mess/machine/994x_ser.c
r1401r1402
158158}
159159
160160/*
161   Reset rs232 card, set up handlers
161   Initializes rs232 card, set up handlers
162162*/
163163void ti99_rs232_init(void)
164164{
165165   rs232_DSR = memory_region(region_dsr) + offset_rs232_dsr;
166   tms9902_init(0, &tms9902_params);
167   tms9902_init(1, &tms9902_params);
168}
166169
170/*
171   Reset rs232 card, set up handlers
172*/
173void ti99_rs232_reset(void)
174{
175   rs232_DSR = memory_region(region_dsr) + offset_rs232_dsr;
176
167177   ti99_peb_set_card_handlers(0x1300, & rs232_handlers);
168178
169179   pio_direction = 0;
r1401r1402
173183   cts1 = 0;
174184   cts2 = 0;
175185   led = 0;
176
177   tms9902_init(0, &tms9902_params);
178   tms9902_init(1, &tms9902_params);
186   tms9902_reset(0);
187   tms9902_reset(1);
179188}
180189
181190/*
src/mess/machine/994x_ser.h
r1401r1402
55DEVICE_UNLOAD( ti99_4_rs232 );
66
77void ti99_rs232_init(void);
8void ti99_rs232_reset(void);
89void ti99_rs232_cleanup(void);
src/mess/drivers/geneve.c
r1401r1402
463463   /*MDRV_INTERLEAVE(interleave)*/
464464
465465   MDRV_MACHINE_START( geneve )
466
466        MDRV_MACHINE_RESET( geneve )
467       
467468   /* video hardware */
468469   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
469470   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
src/mess/drivers/ti99_4x.c
r1401r1402
649649   MDRV_SCREEN_REFRESH_RATE(60)   /* or 50Hz */
650650   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
651651
652        MDRV_MACHINE_START( ti99_4ev_60hz )
652653   MDRV_MACHINE_RESET( ti99 )
653654
654655   /* video hardware */
docs/messnew.txt
r1401r1402
1616
1717- [SYM1] Fixed bug #1442.  [Dirk Best]
1818
19- [TI99] Fixed fatal regressions introduced a few releases ago.  [Michael Zapf]
20
1921- [X68000] Improved video timing.  [Barry Rodewald]
2022
2123

Previous 15994 Revisions Next


© 1998-2018 The MESS Team