Previous 15994 Revisions Next

r2659 Sunday 18th May, 2008 at 16:48:01 UTC by Curt Coder
[COMX35] Used program_read/write_byte in quickload.
[src/mess/machine]comx35.c

src/mess/machine/comx35.c
r2658r2659
602602   image_fread(image, ptr, count);
603603}
604604 
605static void write_memory(UINT16 addr, UINT8 data)
606{
607   UINT8 *ptr = (UINT8 *) memory_get_write_ptr(0, ADDRESS_SPACE_PROGRAM, addr);
608 
609   ptr[0] = data;
610}
611 
612static UINT8 read_memory(UINT16 addr)
613{
614   UINT8 *ptr = (UINT8 *) memory_get_read_ptr(0, ADDRESS_SPACE_PROGRAM, addr);
615 
616   return ptr[0];
617}
618 
619605QUICKLOAD_LOAD( comx35 )
620606{
621607   UINT8 header[16] = {0};
r2658r2659
741727         image_fread(image, header, 2);
742728 
743729         array_length = (header[0] << 8) | header[1];
744         start_array = (read_memory(0x4295) << 8) | read_memory(0x4296);
730         start_array = (program_read_byte(0x4295) << 8) | program_read_byte(0x4296);
745731         end_array = start_array + (size - 7);
746732 
747         write_memory(0x4299, end_array >> 8);
748         write_memory(0x429a, end_array & 0xff);
733         program_write_byte(0x4299, end_array >> 8);
734         program_write_byte(0x429a, end_array & 0xff);
749735         
750736         start_string = start_array + array_length;
751737 
752         write_memory(0x4292, start_string >> 8);
753         write_memory(0x4293, start_string & 0xff);
738         program_write_byte(0x4292, start_string >> 8);
739         program_write_byte(0x4293, start_string & 0xff);
754740 
755741         image_fread_memory(image, start_array, size);
756742      }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team