main.CPUClock=1777777
main.Caption="Àïîãåé ÁÊ-01Ö + SD ATMega8 (alemorf)"

CPU : K580wm80a {
  debug=cas
  mem=mm
  pc=F800
  port.maptomem=1
}

mem1 : Memory {
  size=EC00
}

font : Memory {
  rom="symgen.bin"
}

fntmap : MemMap {
  map[0][000-3FF]=font[2000]
  map[1][000-3FF]=font[2400]
  page=cpu.int
}

bios : Memory {
  rom="Apogee\Apogee.rom"
}

tim : K580wi53 {
  clock[0].rate=1/1
  clock[1].rate=1/1
  clock[2].rate=1/1
  gate[0].value=1
  gate[1].value=1
  gate[2].value=1
}

sys : K580ww55 {
  portA=kbd.~mask
  portB=kbd.~data
  portC[0]=cas.record
  portC[4]=cas.playback
  portC[5-7]=kbd.~data2
}

romdisk : SD-Mega {
  root="Apogee"
  boot="Apogee\BOOT\BOOT.RK"
  s0="@44 @40 (@00|@20 @00 {40 on 42 42 (s1|s2|s3|s4|s5|s6|s7|s8|s9|xx) xx off})*"
  s1="0041 run:BOOT\SDBIOS.RK sub1"
  s2="0142 01 45 4D 55 20 42 32 4D 20 56 20 31 2E 30 31 20 20"
  s3="0242 xx ins 41 run sub1"
  s4="0342 xx ins r0xx r1xx (45/43 dir xx outs:14)*"
  s5="0442 r0xx xx ins 43 open"
  s6="0542 r4xx r0xx r1xx r2xx r3xx 43 seek r0 r1 r2 r3"
  s7="0642 r0xx r1xx (4F/44 rblk r0 r1 xx read 44|)"
  s8="0742 r0xx r1xx 46 r0 r1 43 xx write 43"
  s9="0842 xx ins 46 xx xx ins:1 43 rename"
  sub1="47 read:4 r1 r0 (4F/44 rblk:4000 r0 r1 xx read)*"
}

app : K580ww55 {
  portA=romdisk.data
  portB[0-6]=romdisk.addr
}

crt : K580wg75 {
  mode=3
  dma=dma[2]
  font=fntmap
  ~rbg=crt.ggh
}

dma : K580wt57 {
  mem=mem1
}

mm : MemMap {
  map[0][0000-EBFF]=mem1[0000]
  map[0][EC00-ECFF]=tim.data
  map[0][ED00-EDFF]=sys.data
  map[0][EE00-EEFF]=app.data
  map[0][EF00-EFFF]=crt.data
  map[0][F000-F0FF].wo=dma.data
  map[0][F000-FFFF].ro=bios[0000]
}

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

beep : beep {
  input[0]=tim.out[0]
  input[1]=tim.out[1]
  input[2]=tim.out[2]
}

cas : tape-recorder {
  biproc[FB98-FCA4]=rk
  boproc[FC46-FCA4]=rk
}
