Ejemplo n.º 1
0
Archivo: cmpm.c Proyecto: lokedhs/ostis
static void cmpm_b(struct cpu *cpu, WORD op)
{
  int rx,ry;
  BYTE s,d,r;
  
  rx = (op&0xe00)>>9;
  ry = op&0x7;
  
  s = bus_read_byte(cpu->a[ry]);
  if(ry == 7)
    cpu->a[ry] += 2;
  else
    cpu->a[ry] += 1;
  d = bus_read_byte(cpu->a[rx]);
  if(rx == 7)
    cpu->a[rx] += 2;
  else
    cpu->a[rx] += 1;
  r = d-s;
  
  ADD_CYCLE(12);
  cpu_set_flags_cmp(cpu, s&0x80, d&0x80, r&0x80, r);
}
Ejemplo n.º 2
0
Archivo: subx.c Proyecto: nocrew/ostis
static void subx_b(struct cpu *cpu, WORD op)
{
  BYTE s,d,r;

  int rx,ry;

  rx = (op&0xe00)>>9;
  ry = op&0x7;

  if(op&0x8) {
    if(ry == 7)
      cpu->a[ry] -= 2;
    else
      cpu->a[ry] -= 1;
    s = bus_read_byte(cpu->a[ry]);
    if(rx == 7)
      cpu->a[rx] -= 2;
    else
      cpu->a[rx] -= 1;
    d = bus_read_byte(cpu->a[rx]);
    r = d-s;
    if(CHKX) r -= 1;
    cpu_prefetch();
    bus_write_byte(cpu->a[rx], r);
    ADD_CYCLE(18);
  } else {
    s = cpu->d[ry]&0xff;
    d = cpu->d[rx]&0xff;
    r = d-s;
    if(CHKX) r -= 1;
    cpu->d[rx] = (cpu->d[rx]&0xffffff00)|r;
    ADD_CYCLE(4);
  }

  cpu_set_flags_subx(cpu, s&0x80, d&0x80, r&0x80, r);
}
Ejemplo n.º 3
0
static void movep(struct cpu *cpu, WORD op)
{
  LONG d,a;
  int dr,ar;

  ENTER;

  ar = op&0x7;
  dr = (op&0xe00)>>9;
  a = bus_read_word(cpu->pc);
  if(a&0x8000) a |= 0xffff0000;
  a += cpu->a[ar];
  cpu->pc += 2;
    
  switch((op&0xc0)>>6) {
  case 0:
    d = (bus_read_byte(a)<<8)|bus_read_byte(a+2);
    cpu->d[dr] = (cpu->d[dr]&0xffff0000)|(d&0xffff);
    ADD_CYCLE(16);
    return;
  case 1:
    d = ((bus_read_byte(a)<<24)|
	 (bus_read_byte(a+2)<<16)|
	 (bus_read_byte(a+4)<<8)|
	 (bus_read_byte(a+6)));
    cpu->d[dr] = d;
    ADD_CYCLE(24);
    return;
  case 2:
    d = cpu->d[dr]&0xffff;
    cpu_prefetch();
    bus_write_byte(a, (BYTE)((d&0xff00)>>8));
    bus_write_byte(a+2, (BYTE)((d&0xff)));
    ADD_CYCLE(16);
    return;
  case 3:
    d = cpu->d[dr];
    cpu_prefetch();
    bus_write_byte(a, (BYTE)((d&0xff000000)>>24));
    bus_write_byte(a+2, (BYTE)((d&0xff0000)>>16));
    bus_write_byte(a+4, (BYTE)((d&0xff00)>>8));
    bus_write_byte(a+6, (BYTE)((d&0xff)));
    ADD_CYCLE(24);
    return;
  }
}
Ejemplo n.º 4
0
static int write_sector(struct floppy *fl, int track, int side, int sector, LONG addr, int count)
{
  struct floppy_st *image = fl->image_data;
  int pos,i,j;

  if(!fl->inserted) return FLOPPY_ERROR;
  if(!fl->filename) return FLOPPY_ERROR;

  if(sector < 1) sector = 1;

  pos = track * (fl->sides+1) * fl->sectors * SECSIZE;
  pos += (sector-1) * SECSIZE;
  pos += side * fl->sectors * SECSIZE;

  for(i=0;i<count;i++) {
    if((pos+i*SECSIZE) >= (image->raw_data_size-SECSIZE)) return FLOPPY_ERROR;
    for(j=0;j<SECSIZE;j++) {
      image->raw_data[pos+i*SECSIZE+j] = bus_read_byte(addr+i*SECSIZE+j);
    }
    save_file(fl, pos+i*SECSIZE);
  }
  return FLOPPY_OK;
}