main.CPUClock=4MHz
main.Caption="Erik"

CPU : Z80 {
  debug=cas
  mem=mm
  port[F1]=memcfg
  port[F2]=vid.color
  port[F3]=dskcfg
  port[F4-F7]=dsk.data
}

mem1 : Memory {
  size=10000
}

bios : Memory {
  rom="Specialist\Erik\erik.bin"
}

memcfg : Register {
  write[0-1]=win1.page
  write[2-3]=win2.page
  write[4-5]=win3.page
  write[6-7]=win4.page
}

win1 : MemMap {
  map[0][0000-3FFF]=bios[0000]
  map[1][0000-3FFF]=mem1[0000]
  map[2][0000-3FFF]=x
  map[3][0000-3FFF]=x
}

win2 : MemMap {
  map[0][0000-3FFF]=bios[4000]
  map[1][0000-3FFF]=mem1[4000]
  map[2][0000-3FFF]=x
  map[3][0000-3FFF]=x
}

win3 : MemMap {
  map[0][0000-3FFF]=bios[8000]
  map[1][0000-3FFF]=mem1[8000]
  map[2][0000-3FFF]=x
  map[3][0000-3FFF]=x
}

win4 : MemMap {
  map[0][0000-37FF]=bios[C000]
  map[0][3800-3FFF]=sys.data
  map[1][0000-3FFF]=mem1[C000]
  map[2][0000-3FFF]=x
  map[3][0000-3FFF]=x
}

sys : K580ww55 {
  portA=kbd.row
  portB[0]=cas.playback
  portB[1]=kbd.shift
  portB[2-7]=kbd.col
  portC[0-3]=kbd.row2
  portC[7]=cas.record
}

mm : MemMap {
  map[0][0000-3FFF]=win1
  map[0][4000-7FFF]=win2
  map[0][8000-BFFF]=win3
  map[0][C000-FFFF]=win4
}

kbd : Specialist-Keyboard {
  layout="Specialist\layout.kbd"
}

vid : Specialist-Video {
  mem.r=mem1[9000]
  mem.g=mem1[D000]
  erik.palette="5050 707070 707070"
}

dskcfg : Register {
  write[0]=dsk.side
  write[1]=dsk.drive
}

dsk : KR1818wg93 {
  ext="img"
  image[0].file="Specialist\Erik\disk.img"
}

beep : beep {
  input=sys.portC[5]
}

cas : tape-recorder {
  biproc[C377-C3C8]=rk
  boproc[C3D0-C3F4]=sp
}
