main.CPUClock=1778KHz
main.Caption="Микроша"

CPU : K580wm80a {
  debug=cas
  mem=mm
  pc=F800
  port.maptomem=1
}

mem1 : Memory {
  size=8000
}

font : Memory {
  rom="symgen.bin"
}

bios : Memory {
  rom="Mikrosha\monmikr.dat"
}

sys : K580ww55 {
  portA=kbd.~data
  portB=kbd.~mask
  portC[0]=cas.record
  portC[4]=cas.playback
  portC[5-7]=kbd.~data2
}

app : K580ww55 {
  portB[7]=fontmap.page
}

fontmap : MemMap {
  map[0][000-3FF]=font[0C00]
  map[1][000-3FF]=font[2800]
}

crt : K580wg75 {
  dma=dma[2]
  font=fontmap
}

tim : K580wi53 {
  clock[0].rate=1/1
  clock[1].rate=1/1
  clock[2].rate=1/1
  gate[0].value=1
  gate[1].value=1
  gate[2]=sys.portC[2]
}

dma : K580wt57 {
  mem=mem1
  hrq=CPU.hold
}

mm : MemMap {
  map[0][0000-7FFF]=mem1[0000]
  map[0][8000-BFFF]=CPU.state
  map[0][C000-C7FF]=sys.data
  map[0][C800-CFFF]=app.data
  map[0][D000-D7FF]=crt.data
  map[0][D800-DFFF]=tim.data
  map[0][E000-F7FF]=CPU.state
  map[0][F800-FFFF].wo=dma.data
  map[0][F800-FFFF].ro=bios[0000]
}

kbd : Keyboard {
  layout="Mikrosha\layout.kbd"
}

beep : beep {
  input=tim.out[2]
  gate=sys.portC[1]
}

cas : tape-recorder {
  biproc[FC0D-FD0A]=rk
  boproc[FCAB-FD0A]=rk
  tproc[F89A-FCAB]=rk
  tproc[FD0A-F89D]=rk
  bps=700
}
