Previous 15994 Revisions Next

r6324 Saturday 7th November, 2009 at 15:36:52 UTC by Wilbert Pol
[TI85_SER] Implemented proper selection of ti-85/ti-86 support.
[src/mess/formats]ti85_ser.c

src/mess/formats/ti85_ser.c
r6323r6324
112112INLINE ti85serial_state *get_token(const device_config *device)
113113{
114114   assert(device != NULL);
115   assert(device->type == TI85SERIAL);
115   assert((device->type == TI85SERIAL) || (device->type == TI86SERIAL));
116116   return (ti85serial_state *) device->token;
117117}
118118
r6323r6324
314314}
315315
316316
317static int ti85_convert_file_data_to_serial_stream (const device_config *device, const UINT8* file_data, unsigned int file_size, ti85_serial_data*  serial_data, char* calc_type)
317static int ti85_convert_file_data_to_serial_stream (const device_config *device, const UINT8* file_data, unsigned int file_size, ti85_serial_data*  serial_data)
318318{
319319   ti85serial_state *ti85serial = get_token( device );
320320   UINT16 i;
r6323r6324
325325   UINT8* temp_data_to_convert = NULL;
326326   UINT16 checksum;
327327
328   if (!strncmp(calc_type, "ti85", 4))
328   if (device->type == TI85SERIAL)
329329      if (strncmp((char *) file_data, (char *) ti85_file_signature, 11))
330330         return 0;
331   if (!strncmp(calc_type, "ti86", 4))
331   if (device->type == TI86SERIAL)
332332      if (strncmp((char *) file_data, (char *) ti86_file_signature, 11))
333333         return 0;
334334
r6323r6324
417417         }
418418         serial_data->variables[i].header_size = (10+ti85_entries[i].name_size)*8;
419419
420         if (!strncmp(calc_type, "ti85", 4))
420         if (device->type == TI85SERIAL)
421421            temp_data_to_convert[0] = 0x05;   //PC to TI-85
422         if (!strncmp(calc_type, "ti86", 4))
422         if (device->type == TI86SERIAL)
423423            temp_data_to_convert[0] = 0x06;   //PC to TI-86
424424         temp_data_to_convert[1] = 0x06;   //header
425425         temp_data_to_convert[2] = (4+ti85_entries[i].name_size)&0x00ff;
r6323r6324
443443         free (ti85_entries);
444444         return 0;
445445      }
446      if (!strncmp(calc_type, "ti85", 4))
446      if (device->type == TI85SERIAL)
447447         ti85_convert_data_to_stream(ti85_pc_ok_packet, TI85_PC_OK_PACKET_SIZE, serial_data->variables[i].ok);
448      if (!strncmp(calc_type, "ti86", 4))
448      if (device->type == TI86SERIAL)
449449         ti85_convert_data_to_stream(ti86_pc_ok_packet, TI85_PC_OK_PACKET_SIZE, serial_data->variables[i].ok);
450450      serial_data->variables[i].ok_size = TI85_PC_OK_PACKET_SIZE*8;
451451
r6323r6324
465465      }
466466      serial_data->variables[i].data_size = (6+ti85_entries[i].data_size)*8;
467467
468      if (!strncmp(calc_type, "ti85", 4))
468      if (device->type == TI85SERIAL)
469469         temp_data_to_convert[0] = 0x05;   //PC to TI-85
470      if (!strncmp(calc_type, "ti86", 4))
470      if (device->type == TI86SERIAL)
471471         temp_data_to_convert[0] = 0x06;   //PC to TI-86
472472      temp_data_to_convert[1] = 0x15;   //data
473473      temp_data_to_convert[2] = (ti85_entries[i].data_size)&0x00ff;
r6323r6324
491491      free (ti85_entries);
492492      return 0;
493493   }
494   if (!strncmp(calc_type, "ti85", 4))
494   if (device->type == TI85SERIAL)
495495      ti85_convert_data_to_stream(ti85_pc_end_packet, TI85_PC_END_PACKET_SIZE, serial_data->end);
496   if (!strncmp(calc_type, "ti86", 4))
496   if (device->type == TI86SERIAL)
497497      ti85_convert_data_to_stream(ti86_pc_end_packet, TI85_PC_END_PACKET_SIZE, serial_data->end);
498498   serial_data->end_size = TI85_PC_END_PACKET_SIZE*8;
499499
r6323r6324
12781278   ti85serial->receive_data_counter = 0;
12791279   ti85serial->send_data_counter = 0;
12801280   ti85_free_serial_data_memory(device);
1281//   ti85_PCR = 0xc0;
12821281   ti85serial->red_in = 0;
12831282   ti85serial->white_in = 0;
12841283   ti85serial->red_out = 1;
r6323r6324
13101309      file_data = auto_alloc_array(image->machine, UINT8, file_size);
13111310      image_fread(image, file_data, file_size);
13121311
1313      if(!ti85_convert_file_data_to_serial_stream(image, file_data, file_size, &ti85serial->stream, (char*)image->machine->gamedrv->name))
1312      if(!ti85_convert_file_data_to_serial_stream(image, file_data, file_size, &ti85serial->stream))
13141313      {
13151314         ti85_free_serial_stream (&ti85serial->stream);
13161315         return INIT_FAIL;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team