main.CPUClock=2400KHz
main.Caption="Îêåàí-240"

CPU : K580wm80a {
  mem=mm
  port[00-1F]=ppa00.data
  port[20-23]=ppa20.data
  port[40-5F]=ppa40.data
  port[60-7F]=tim.data
  port[80-81]=intctl.data
  port[A0-A1]=comport.data
  port[C0-DF]=ppaC0.data
  port[E0-FF]=ppaE0.data
  int=intctl.int
}

mem : Memory {
  size=20000
  frame[0].size=8000
  frame[1].size=10000
}

cpm : Memory {
  rom="Okean240\cpm80.bin"
}

bios : Memory {
  rom="Okean240\monitor.bin"
}

mm : MemMap {
  map[0][0000-7FFF]=mem.frame[0]
  map[0][8000-BFFF]=mem.frame[1][8000]
  map[0][C000-DFFF]=cpm
  map[0][E000-FFFF]=bios
  map[1][0000-7FFF]=mem.frame[0]
  map[1][8000-FFFF]=mem.frame[1][8000]
  map[2][0000-DFFF]=bios
  map[2][E000-FFFF]=bios
  map[3][0000-DFFF]=bios
  map[3][E000-FFFF]=bios
  initpage=3
}

tim : K580wi53 {
  clock[0].rate=5/8
  clock[1].rate=5/8
  gate[0].value=1
  gate[1].value=1
  features=1
}

intctl : K580wn59 {
  irq[0]=kbd.irq2
  irq[1]=kbd.irq
  irq[4]=tim.out[0]
}

comport : K580ww51 {
}

ppa20 : K580ww55 {
}

ppa40 : K580ww55 {
  portA=kbd.keycode
  portB[2]=cas.playback
  portB[5]=kbd.key[58]
  portB[6]=kbd.key[59]
  portC[7]=kbd.ack
}

ppaC0 : K580ww55 {
  portA=vid.scroll.y
  portB[0-3]=mem.frame[0].page
  portB[1-3]=mem.frame[1].page
  portB[4-5]=mm.page
  portC=vid.scroll.x
}

ppaE0 : K580ww55 {
  portB[0-2]=vid.palette
  portB[3-5]=vid.bkcolor
  portB[6]=vid.mode
  portB[7]=vid.page
  portC[0-2]=cas.record
}

kbd : Keyboard {
  layout="Okean240\layout.kbd"
  irqkey2=5A
  maxrow=11
}

vid : okean-video {
  page[0]=mem[C000]
  page[1]=mem[4000]
}

cas : tape-recorder {
  outvalue=0/20
  difffilter=1
}

beep : beep {
  input=ppaE0.portC[3]
}
