main.CPUClock=1777777
main.Caption="Ириша"

CPU : K580wm80a {
  debug=cas
  mem=mm
  port[04-05]=kbd.keycode
  port[06-07]=comport.data
  port[08-0B]=mtim.data
  port[0C-0F]=intctl.data
  port[10-13]=sys.data
  port[14]=extrom.stream
  port[24]=win1.~pagemask
  port[25]=win2.~pagemask
  port[26]=win3.~pagemask
  port[27]=win4.~pagemask
  port[30-33]=dsk.data
  port[34-37]=dsk.data
  port[38]=port38
  port[39]=port39
  port[D8]=vid.mode
  port[D9]=vid.color
  port[DA]=vid.page
  int=intctl.int
}

mem1 : Memory {
  size=10000
}

mem2 : Memory {
  size=80000
  frame[0].size=20000
}

bios : Memory {
  rom="Irisha\irisha.rom"
}

fddrom : Memory {
  rom="Irisha\irisha20.bin"
}

extrom : Memory {
  rom="Irisha\extra.rom"
}

kbd : Keyboard {
  vk.xlat[0][25-28]="1A1C191D"
}

comport : K580ww51 {
}

mtim : K580wi53 {
  clock[0].rate=1
  clock[1].rate=1/100
  clock[2].rate=1
  gate[0].value=1
  gate[1].value=1
  gate[2]=sys.portA[5]
}

intctl : K580wn59 {
  irq[0]=mtim.out[1]
  irq[1]=kbd.irq
}

mmregB : MemMap2 {
  map[0]=00
  map[1]=40
}

sys : K580ww55 {
  portB[0-6]=mmregB
  portB[7]=kbd.pressed
  portC[2-3]=mm.page
  portC[7]=mmregB.offset
}

port39 : Register {
  write[0-1]=mem2.frame[0].page
  read[7]=0
}

win1 : MemMap {
  map[0][0000-3FFF]=dummy
  map[1][0000-3FFF]=romdisk
  map[2][0000-3FFF]=mem2.frame[0][00000]
  map[3][0000-3FFF]=mem2.frame[0][10000]
  map[4][0000-3FFF]=fddrom
}

win2 : MemMap {
  map[0][0000-3FFF]=dummy
  map[1][0000-3FFF]=romdisk
  map[2][0000-3FFF]=mem2.frame[0][04000]
  map[3][0000-3FFF]=mem2.frame[0][14000]
  map[4][0000-3FFF]=fddrom
}

win3 : MemMap {
  map[0][0000-3FFF]=dummy
  map[1][0000-3FFF]=romdisk
  map[2][0000-3FFF]=mem2.frame[0][08000]
  map[3][0000-3FFF]=mem2.frame[0][18000]
  map[4][0000-3FFF]=fddrom
}

win4 : MemMap {
  map[0][0000-3FFF]=dummy
  map[1][0000-3FFF]=romdisk
  map[2][0000-3FFF]=mem2.frame[0][0C000]
  map[3][0000-3FFF]=mem2.frame[0][1C000]
  map[4][0000-3FFF]=fddrom
}

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

vid : Irisha-Video {
  mem=mem1[C000]
}

beep : beep {
  input=sys.portA[4]
  input[0]=mtim.out[2]
}

port38 : Register {
  read[3-7]=05
  write[0]=dsk.drive
  write[2]=dsk.side
}

dsk : KR1818wg93 {
  image[0].file="Irisha\disk.cpm"
  image[0].geometry=80C2H9S512
  image[1].geometry=80C2H9S512
  drive[0].tooltip="B:"
  drive[1].tooltip="D:"
  vdpb="2400040F0067017F00C00020000000"
  vdgm="2H80C9S512"
}

cas : tape-recorder {
  record=sys.portA[7]
  playback=comport.dsr
  tproc[0676-0683]=rk
  tproc[0676-0683].check=C5F50100000B78B1
  tproc[068F-06B9]=rk
  tproc[068F-06B9].check=B7F53E02D3072100
  tproc[0703-075C]=rk
  tproc[0703-075C].check=F33E0ED3133E02D3
  biproc[075E-07A8]=ir
  biproc[075E-07A8].check=3ABEFF57CDF107D8
  boproc[06BA-06D9]=ir
  boproc[06BA-06D9].check=212628F57DD6026F
}
