main.CPUClock=1777778Hz
main.Caption="ÒÈÀ-ÌÖ-1"

CPU : K580wm80a {
  mem=mm
  port[40-7F]=vid.sprites
  port[A0-AF]=vid.palette
  port[BE]=vid.ctl
  port[C0-C3]=tim0.data
  port[D0-D3]=sys.data
  port[D4-D7]=tim1.data
  port[DA]=tim1ctl
}

mem1 : Memory {
  size=2000
}

bios : Memory {
  rom = "TIA-MC\konek.tia"
  romselect="Change ROM"
  romfiles="TIA-MC ROM files (*.tia)|*.tia"
}

mm : MemMap {
  map[0][0000-DFFF].ro=bios[8000]
  map[0][B000-B7FF].wo=vid.vram
  map[0][E000-FFFF]=mem1
}

sys : K580ww55 {
  portA[1]=kbd.key[0]
  portA[5]=kbd.key[1]
  portB[1]=kbd.key[2]
  portB[5]=kbd.key[3]
  portB[7]=kbd.key[4]
  portC[4]=kbd.key[5]
  portC[5]=kbd.key[6]
  portC[6]=kbd.key[7]
  portC[7]=vid.vrtc
}

tim0 : K580wi53 {
  clock[0].rate=1/1
  clock[1].rate=1/1
  clock[2].rate=1/1
  gate[0]=tim1.out[0]
  gate[1]=tim1.out[1]
  gate[2]=tim1.out[2]
}

tim1 : K580wi53 {
  clock[0].rate=9/800
  clock[1].rate=9/800
  clock[2].rate=9/800
}

tim1ctl : register {
  write[0]=tim1.gate[0]
  write[1]=tim1.gate[1]
  write[2]=tim1.gate[2]
}

kbd : Keyboard {
  layout="TIA-MC\layout.kbd"
}

vid : tiamc-video {
  spmem=bios
}

beep : beep {
  input[0]=tim0.out[0]
  input[1]=tim0.out[1]
  input[2]=tim0.out[2]
}
