main.CPUClock=2500KHz
main.Caption="Корвет 1.1"

CPU : K580wm80a {
  mem=mm
  int=intctl.int
  port.maptomem=1
}

mem1 : Memory {
  size=10000
}

rom : Memory {
  rom = "Korvet\korvet11.rom"
}

font : Memory {
  rom = "Korvet\korvet2.fnt"
  frame[0].size=1000
} 

extrom : Memory {
  rom="Korvet\extern.rom"
  romselect="Change external ROM"
  romfiles="ROM files (*.rom)|*.rom"
}

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

rgsys1 : K580ww55 {
  portA[2-6]=mm.page
}

sys : MemMap2 {
  map[7F]=rgsys1.data
  map[BF]=vid.color
  map[FB]=vid.lut
}

tim : K580wi53 {
  clock[0].rate=4/5
  clock[1].rate=4/5
  clock[2].rate=1/A4
  gate[0].value=1
  gate[1].value=1
  gate[2]=vid.svbl
}

com1 : K580ww51 {
}

lan : K580ww51 {
}

ppa1 : K580ww55 {
  portA[1]=vid.vrtc
  portA[3]=vid.attr
  portA[C-F]=lan.netid
  portB[0]=dsk.drive[0].on
  portB[1]=dsk.drive[1].on
  portB[2]=dsk.drive[2].on
  portB[3]=dsk.drive[3].on
  portB[4]=dsk.side
  portC[0-1]=vid.page
  portC[2]=font.frame[0].page
  portC[3]=vid.widechar
  portC[4-5]=vid.attrmask
  portC[6-7]=mmgraph.page
}

ppa2 : K580ww55 {
}

ppa3 : K580ww55 {
  portA=extrom.data
  portB=extrom.lsb
  portC=extrom.msb
}

intctl : K580wn59 {
  irq[0]=ppa2.portC[7]
  irq[3]=lan.irq
  irq[4]=vid.irq
  irq[5]=tim.out[2]
}

app : MemMap2 {
  map[00-03]=tim.data
  map[08-0B]=ppa3.data
  map[10-11]=com1.data
  map[18-1B]=dsk.data
  map[20-21]=lan.data
  map[28-29]=intctl.data
  map[30-33]=ppa2.data
  map[38-3B]=ppa1.data
}

mmgraph : MemMap {
  map[0][0000-3FFF]=vid.page[0]
  map[1][0000-3FFF]=vid.page[1]
  map[2][0000-3FFF]=vid.page[2]
  map[3][0000-3FFF]=vid.page[3]
}

mm : MemMap {
  map[00][0000-37FF]=rom[0000]
  map[00][3800-39FF]=kbd.mem
  map[00][3A00-3AFF]=sys
  map[00][3B00-3BFF]=app
  map[00][3C00-3FFF]=vid.txt
  map[00][4000-FFFF]=mem1[4000]

  map[01][0000-1FFF]=rom[0000]
  map[01][2000-FFFF]=mem1[2000]

  map[02][0000-3FFF]=rom[0000]
  map[02][4000-FFFF]=mem1[4000]

  map[03][0000-FFFF]=mem1[0000]

  map[04][0000-1FFF]=rom[0000]
  map[04][2000-F7FF]=mem1[2000]
  map[04][F800-F9FF]=kbd.mem
  map[04][FA00-FAFF]=sys
  map[04][FB00-FBFF]=app
  map[04][FC00-FFFF]=vid.txt

  map[05][0000-1FFF]=rom[0000]
  map[05][2000-F7FF]=mem1[2000]
  map[05][F800-F9FF]=kbd.mem
  map[05][FA00-FAFF]=sys
  map[05][FB00-FBFF]=app
  map[05][FC00-FFFF]=vid.txt

  map[06][0000-3FFF]=rom[0000]
  map[06][4000-F7FF]=mem1[4000]
  map[06][F800-F9FF]=kbd.mem
  map[06][FA00-FAFF]=sys
  map[06][FB00-FBFF]=app
  map[06][FC00-FFFF]=vid.txt

  map[07][0000-F7FF]=mem1[0000]
  map[07][F800-F9FF]=kbd.mem
  map[07][FA00-FAFF]=sys
  map[07][FB00-FBFF]=app
  map[07][FC00-FFFF]=vid.txt

  map[08][0000-37FF]=rom[0000]
  map[08][3800-39FF]=kbd.mem
  map[08][3A00-3AFF]=sys
  map[08][3B00-3BFF]=app
  map[08][3C00-3FFF]=vid.txt
  map[08][4000-BFFF]=mem1[4000]
  map[08][C000-FFFF]=mmgraph

  map[09][0000-1FFF]=rom[0000]
  map[09][2000-BFFF]=mem1[2000]
  map[09][C000-FFFF]=mmgraph

  map[0A][0000-3FFF]=rom[0000]
  map[0A][4000-BFFF]=mem1[4000]
  map[0A][C000-FFFF]=mmgraph

  map[0B][0000-BFFF]=mem1[0000]
  map[0B][C000-FFFF]=mmgraph

  map[0C][0000-1FFF]=rom[0000]
  map[0C][2000-3FFF]=mem1[2000]
  map[0C][4000-7FFF]=mmgraph
  map[0C][8000-FDFF]=mem1[8000]
  map[0C][FE00-FEFF]=app
  map[0C][FF00-FFFF]=sys

  map[0D][0000-1FFF]=rom[0000]
  map[0D][2000-3FFF]=mem1[2000]
  map[0D][4000-7FFF]=mmgraph
  map[0D][8000-FDFF]=mem1[8000]
  map[0D][FE00-FEFF]=app
  map[0D][FF00-FFFF]=sys

  map[0E][0000-3FFF]=rom[0000]
  map[0E][4000-7FFF]=mmgraph
  map[0E][8000-FDFF]=mem1[8000]
  map[0E][FE00-FEFF]=app
  map[0E][FF00-FFFF]=sys

  map[0F][0000-3FFF]=mem1[0000]
  map[0F][4000-7FFF]=mmgraph
  map[0F][8000-FDFF]=mem1[8000]
  map[0F][FE00-FEFF]=app
  map[0F][FF00-FFFF]=sys

  map[10][0000-5FFF]=rom[0000]
  map[10][6000-F7FF]=mem1[6000]
  map[10][F800-F9FF]=kbd.mem
  map[10][FA00-FAFF]=sys
  map[10][FB00-FBFF]=app
  map[10][FC00-FFFF]=vid.txt

  map[11][0000-1FFF]=rom[0000]
  map[11][2000-F7FF]=mem1[2000]
  map[11][F800-F9FF]=kbd.mem
  map[11][FA00-FAFF]=sys
  map[11][FB00-FBFF]=app
  map[11][FC00-FFFF]=vid.txt

  map[12][0000-3FFF]=rom[0000]
  map[12][4000-F7FF]=mem1[4000]
  map[12][F800-F9FF]=kbd.mem
  map[12][FA00-FAFF]=sys
  map[12][FB00-FBFF]=app
  map[12][FC00-FFFF]=vid.txt

  map[13][0000-F7FF]=mem1[0000]
  map[13][F800-F9FF]=kbd.mem
  map[13][FA00-FAFF]=sys
  map[13][FB00-FBFF]=app
  map[13][FC00-FFFF]=vid.txt

  map[14][0000-5FFF]=rom[0000]
  map[14][6000-FDFF]=mem1[6000]
  map[14][FE00-FEFF]=app
  map[14][FF00-FFFF]=sys

  map[15][0000-1FFF]=rom[0000]
  map[15][2000-FDFF]=mem1[2000]
  map[15][FE00-FEFF]=app
  map[15][FF00-FFFF]=sys

  map[16][0000-3FFF]=rom[0000]
  map[16][4000-FDFF]=mem1[4000]
  map[16][FE00-FEFF]=app
  map[16][FF00-FFFF]=sys

  map[17][0000-FDFF]=mem1[0000]
  map[17][FE00-FEFF]=app
  map[17][FF00-FFFF]=sys

  map[18][0000-5FFF]=rom[0000]
  map[18][6000-BEFF]=mem1[6000]
  map[18][BF00-BFFF]=sys
  map[18][C000-FFFF]=mmgraph

  map[19][0000-1FFF]=rom[0000]
  map[19][2000-BEFF]=mem1[2000]
  map[19][BF00-BFFF]=sys
  map[19][C000-FFFF]=mmgraph

  map[1A][0000-3FFF]=rom[0000]
  map[1A][4000-BEFF]=mem1[4000]
  map[1A][BF00-BFFF]=sys
  map[1A][C000-FFFF]=mmgraph

  map[1B][0000-BEFF]=mem1[0000]
  map[1B][BF00-BFFF]=sys
  map[1B][C000-FFFF]=mmgraph

  map[1C][0000-5FFF]=rom[0000]
  map[1C][6000-BFFF]=mem1[6000]
  map[1C][C000-FFFF]=mmgraph

  map[1D][0000-1FFF]=rom[0000]
  map[1D][2000-BFFF]=mem1[2000]
  map[1D][C000-FFFF]=mmgraph

  map[1E][0000-3FFF]=rom[0000]
  map[1E][4000-BFFF]=mem1[4000]
  map[1E][C000-FFFF]=mmgraph

  map[1F][0000-BFFF]=mem1[0000]
  map[1F][C000-FFFF]=mmgraph
}

vid : korvet-video {
  font=font.frame[0]
}

dsk : KR1818wg93 {
  ext=kdi
  image[0].file="Korvet\disk.kdi"
  image[1].file="Korvet\disk2.kdi"
  image[2].file="Korvet\disk3.kdi"
  image[3].file="Korvet\disk4.kdi"
  drive.count=4
  vdpb="2800040F008A017F00C00020000200"
}

beep : beep {
  gate=ppa2.portC[3]
  input=tim.out[0]
}
