main.CPUClock=3500KHz
main.Caption="ZX Spectrum 48"
main.ff.speed=20
main.ff.keymask[9]=1

cpu : z80 {
  debug=cas
  mem=mm
  int[FF]=vid.irq
  port[FD]=portFD
  port[FE]=sys.data[0]
}

portFD : MemMap2 {
  offset=cpu.port.msb
  map[BE-BF].wo=AY.data
  map[FE-FF].ro=AY.data
  map[FE-FF].wo=AY.regno
}

bios : Memory {
  rom="ZX\ZXSpectrum48.rom"
}

mem1 : Memory {
  size=C000
}

mm : MemMap {
  map[0][0000-3FFF]=bios[0000]
  map[0][4000-FFFF]=mem1[0000]
}

sys : K580ww55 {
}

kbd : Keyboard {
  layout="ZX\layout.kbd"
  ~mask=cpu.port.msb
  ~data=sys.portA
  irqkey=49
  irq=cpu.nmi
}

vid : zxspec-video {
  mem[0]=mem1[0000]
  border=sys.portA[0-2]
}

cas : tape-recorder {
  playback=sys.portA[6]
  record=sys.portA[3]
  filter="ZX Spectrum files (*.tzx;*.tap)|*.tzx;*.tap"
  ext="tzx"
  iproc[0562-05E0]=zx
  oproc[04C2-053E]=zx
}

AY : AY-3-8910 {
  freq=1773400
  input=sys.portA[4]
}
