main.CPUClock=1777777Hz
main.Caption="ÀÐÌ-ØÊ Áàøêèðèÿ"

CPU : K580wm80a {
  debug=cas
  mem=mm
  port[00-01]=trap
  port[02-03]=intctl.data
  port[04]=mm.page
  port[05]=trap
  port[06-07]=com.data
  port[08-0B]=tim.data
  port[0C-0F]=sys.data
  port[10-7F]=trap
  port[80-FF]=trap
  int=intctl.int
}

mem1 : Memory {
  size=10000
}

bios : Memory {
  rom="B2M\b1bios.rom"
}

basic : Memory {
  rom="B2M\b1basic.rom"
}

font : Memory {
  rom="B2M\b1font.rom"
}

trap : MemMap2 {
  map[00].offset=1
  map[00]=trapd
  map[01]=trap
  map[02-03]=trap
  map[04-07]=trap
  map[08-0F]=trap
  map[10-1F]=trap
  map[20-3F]=trap
  map[40-7F]=trap
}

trapd : Decoder {
}

intctl : K580wn59 {
  irq[0]=trapd.addr
  irq[1]=tim.out[2]
  autoreset=0
}

com : K580ww51 {
}

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

sys : K580ww55 {
  portA=kbd.keycode
  portB[4]=kbd.pressed
  portB[F]=cas.playback
  portC[2]=beep.input
  portC[2]=cas.record
}

mm : MemMap {
  map[0][0000-1FFF]=bios
  map[0][2000-DFFF]=mem1[2000]
  map[0][E000-FFFF]=bios

  map[1][0000-FFFF]=mem1
  map[2][0000-FFFF]=mem1
  map[3][0000-FFFF]=mem1
  map[4][0000-FFFF]=mem1

  map[5][0000-DFFF]=mem1
  map[5][E000-FFFF]=bios

  map[6][0000-FFFF]=mem1

  map[7][0000-9FFF]=mem1
  map[7][A000-BFFF]=basic
  map[7][C000-DFFF]=mem1[C000]
  map[7][E000-FFFF]=bios
}

kbd : Keyboard {
}

vid :  Text-Video {
  font=font
  mem=mem1[D800]
  mem2=0
  height=18
}

beep : beep {
}

cas : tape-recorder {
  toproc[E9A8-E9D5]=b1
  boproc[E9D6-EA1C]=b1
  tiproc[EA28-EA53]=b1
  biproc[EA54-EA99]=b1
  filter="Data files (*.rkb)|*.rkb"
  ext="rkb"
}
