main.CPUClock=3579545
main.Caption="MSX2 + FDD + MSXDOS2"

cpu : z80 {
  mem=mm
  int[FF]=vid.irq
  port[98-9B]=vid.data
  port[A0]=AY.regno
  port[A1]=AY.data
  port[A2]=AY.data
  port[A8-AB]=sys.data
  port[B4]=rtc.regno
  port[B5]=rtc.data
  port[FC]=mem1.frame[0].page
  port[FD]=mem1.frame[1].page
  port[FE]=mem1.frame[2].page
  port[FF]=mem1.frame[3].page
}

bios : Memory {
  rom="MSX\msx2.rom"
}

extrom : Memory {
  rom="MSX\msx2ext.rom"
}

fddrom : Memory {
  rom="MSX\disk.rom"
}

msxdos2 : rom-mapper {
  rom="MSX\msxdos22.rom"
  default=3FFF,3,0,0,0
}

fdd : KR1818wg93 {
  image[0].file="MSX\test.dsk"
  image[0].geometry=80C2H9S512
  image[1].geometry=80C2H9S512
  drive[0].tooltip="A:"
  drive[1].tooltip="B:"
  ext="dsk"
}

fddsel : register {
  write[0]=fdd.drive[0].~on
  write[0]=fdd.drive[1].on
}

fddreg : register {
  read[7]=fdd.drq
  read[6]=fdd.irq
}

fddport : MemMap2 {
  map[00-F7]=fddrom[3F00]
  map[F8-FB]=fdd.data
  map[FC]=fdd.side
  map[FD]=fddsel
  map[FF].ro=fddreg.~data
}

fddmap : MemMap {
  map[0][0000-3EFF]=fddrom
  map[0][3F00-3FFF]=fddport
}

slotA : rom-mapper {
  romdb="MSX\msxromdb.xml"
  romselect="Slot A"
  romfiles="ROM files (*.rom)|*.rom"
  Ascii16=3FFF,F,4000,E,1
  Ascii16.ctl=6000,C,1,E800
  Ascii8=1FFF,1F,4000,D,3
  Ascii8.ctl=6000,B,3,E000
  GenericKonami=1FFF,F,4000,D,3,9000
  Konami=1FFF,F,4000,D,3,9000
  KonamiSCC=1FFF,F,4000,D,3
  KonamiSCC.ctl=5000,D,3,9800
}

mem1 : Memory {
  size=20000
  frame[0].size=4000
  frame[1].size=4000
  frame[2].size=4000
  frame[3].size=4000
}

sys : K580ww55 {
  portA=mm.slotctl
  portB=kbd.~idata
  portC[0-3]=kbd.mask
  portC[7]=AY.input
}

slot3 : MSX-MemMap {
  slot[0][1]=msxdos2
  slot[1][0]=extrom
  slot[1][1]=fddmap
  slot[2][0]=mem1.frame[0]
  slot[2][1]=mem1.frame[1]
  slot[2][2]=mem1.frame[2]
  slot[2][3]=mem1.frame[3]
  slotctl=FFFF
}

mm : MSX-MemMap {
  slot[0]=bios
  slot[1]=slotA
  slot[2]=slotB
  slot[3]=slot3
}

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

vid : v9938 {
}

AY : AY-3-8910 {
  freq=1/2
}

rtc : RP5C01 {
}
