Пример #1
0
CoolString& strcpy (CoolString& s, const char *c) {
  s.length = strlen (c);                // Determine length of character string
  if (s.size <= s.length)               // If not enough memory allocated
    update_memory (s);                  // Adjust/update memory if necessary
  strcpy (s.str, c);                    // Else just copy new string value
  return s;                             // Return CoolString reference
}
Пример #2
0
Boolean CoolString::replace (const char* c, long start, long end) {
  if (start<0 || start > this->length || end<0  // Boundary check
      || end > this->length || end<=start)      // out of bounds, failure
    return(FALSE); 
  long len=strlen(c);                   // length of c
  long delta = len - end + start;       // find overall change in length
  this->length += delta;                // set new length
  if (this->size <= this->length)       // If not enough allocated memory
    update_memory (*this);              // Adjust/update memory if necessary
  long ind;
  if (delta > 0) {                                // If replacement is bigger
    for (ind=this->length; start+len<=ind; ind--) // than chacters replaced
      this->str[ind] = this->str[ind-delta];
  }
  else if (delta < 0) {                 // Replacement is shorter
    char* st = this->str + start + len;
    char* ptr = this->str + end;
    char* end = this->str + this->length;
    while (st<=end) *st++ = *ptr++;
  }
  { char* ptr = this->str+start;
    char ch;
    while ((ch = *c++) != END_OF_STRING) // replace characters
      *ptr++ = ch;
  }
  return(TRUE);
}
Пример #3
0
void lviv_state::setup_snapshot(uint8_t * data)
{
	/* Set registers */
	uint8_t lo = data[0x14112] & 0x0ff;
	uint8_t hi = data[0x14111] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_BC, (hi << 8) | lo);
	lo = data[0x14114] & 0x0ff;
	hi = data[0x14113] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_DE, (hi << 8) | lo);
	lo = data[0x14116] & 0x0ff;
	hi = data[0x14115] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_HL, (hi << 8) | lo);
	lo = data[0x14118] & 0x0ff;
	hi = data[0x14117] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_AF, (hi << 8) | lo);
	lo = data[0x14119] & 0x0ff;
	hi = data[0x1411a] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_SP, (hi << 8) | lo);
	lo = data[0x1411b] & 0x0ff;
	hi = data[0x1411c] & 0x0ff;
	m_maincpu->set_state_int(i8080_cpu_device::I8085_PC, (hi << 8) | lo);

	/* Memory dump */
	memcpy (m_ram->pointer(), data+0x0011, 0xc000);
	memcpy (m_ram->pointer()+0xc000, data+0x10011, 0x4000);

	/* Ports */
	m_ppi_port_outputs[0][0] = data[0x14011+0xc0];
	m_ppi_port_outputs[0][1] = data[0x14011+0xc1];
	update_palette(m_ppi_port_outputs[0][1]&0x7f);
	m_ppi_port_outputs[0][2] = data[0x14011+0xc2];
	update_memory();
}
Пример #4
0
void pmd85_state::machine_reset()
{
	int i, j;

	/* checking for Rom Module */
	switch (m_model)
	{
		case PMD85_1:
		case PMD85_2A:
		case PMD85_3:
		case C2717:
			m_rom_module_present = (machine().root_device().ioport("DSW0")->read() & 0x01) ? 1 : 0;
			break;
		case ALFA:
		case MATO:
			break;
	}

	for (i = 0; i < 4; i++)
		for (j = 0; j < 3; j++)
			m_ppi_port_outputs[i][j] = 0;

	/* memory initialization */
	memset(machine().device<ram_device>(RAM_TAG)->pointer(), 0, sizeof(unsigned char)*0x10000);
	m_pmd853_memory_mapping = 1;
	m_startup_mem_map = 1;
	update_memory(machine());

	machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(pmd85_state::setup_machine_state),this));

	machine().device("maincpu")->memory().space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(pmd85_state::pmd85_opbaseoverride), this));
}
Пример #5
0
void sam6883_device::set_bank_offset(int bank, offs_t offset)
{
	if (m_banks[bank].m_memory_offset != offset)
	{
		m_banks[bank].m_memory_offset = offset;
		update_memory();
	}
}
Пример #6
0
CoolString& strcat (CoolString& s1, const CoolString& s2) {
  long start_length = s1.length;
  s1.length += s2.length;               // Determine length of new string
  if (s1.size <= s1.length)             // If not enough allocated memory
    update_memory (s1);                 // Adjust/update memory if necessary
  strcpy (s1.str+start_length, s2.str); // Concat characters   
  return s1;                            // Return CoolString
}
Пример #7
0
CoolString& strcat (CoolString& s, const char* c) {
  long start_length = s.length;         // Find initial string length
  s.length += strlen (c);               // Determine length of new string
  if (s.size <= s.length)               // If not enough allocated memory
    update_memory (s);                  // Adjust/update memory if necessary
  strcpy (s.str+start_length, c);       // Concatenate characters   
  return s;                             // Return CoolString
}
Пример #8
0
CoolString& strcat (CoolString& s, char c) {
  s.length += 1;                        // Determine length of new string
  if (s.size <= s.length)               // If not enough allocated memory
    update_memory (s);                  // Adjust/update memory if necessary
  s.str[s.length-1] = c;                // Append new character
  s.str[s.length] = END_OF_STRING;      // END_OF_STRING terminator
  return s;                             // Return CoolString
}
Пример #9
0
Boolean CoolString::insert (const char* ins, long start) {
  if (start<0 || start>this->length) return(FALSE);  // Boundary check
  long len=strlen(ins);                 // length of char*
  this->length += len;                  // Determine length of new string
  if (this->size <= this->length)       // If not enough allocated memory
    update_memory (*this);              // Adjust/update memory if necessary
  register char* ptr = this->str;
  register char* st = ptr + start;
  register char* end = ptr + this->length;
  for (ptr = end - len; ptr >= st;)             // Make space for ins
    *end-- = *ptr--;
  for (end = st+len; st < end; *st++ = *ins++); // Insert ins into that
  return(TRUE);                         // Insert worked
}
Пример #10
0
CoolString& strncat (CoolString& s1, const CoolString& s2, int n) {
#if ERROR_CHECKING
  if (n < 0) {                          // If invalid length specified
    printf ("CoolString::strncat(): Negative length %d.\n", n);
    exit (1);
  }
#endif
  long start_length = s1.length;        // Find initial string length
  s1.length += n;                       // Determine length of new string
  if (s1.size <= s1.length)             // If not enough allocated memory
    update_memory (s1);                 // Adjust/update memory if necessary
  strncpy (s1.str+start_length, s2.str, size_t(n)); // Concat chars 
  return s1;                            // Return CoolString
}
Пример #11
0
CoolString& strncpy(CoolString& s, const char* source, long length) {
#if ERROR_CHECKING
  if (length < 0) {                     // Boundary check
    printf ("CoolString::strncpy(): Negative length %d.\n", length);
    exit (1);
  }
#endif
  s.length = length;                    // Set new string length
  if (s.size <= length) {               // If not enough allocated memory
    if (s.str && s.str != Empty_String_g)
        *s.str = END_OF_STRING;         // Don't copy old string
    update_memory (s);                  // Adjust/update memory if necessary
  }
  char* p = s.str;
  while (length-- > 0)                  // Copy source into string
    *p++ = *source++;
  *p = END_OF_STRING;                   // set the end byte
  return s;
}
Пример #12
0
void sam6883_device::update_state(void)
{
	update_memory();
	update_cpu_clock();
}