main.CPUClock=2MHz
main.Caption="MC2721"

CPU : K580wm80a {
  mem=mm
  port[E0-E3]=tim.data
  port[E4-E5]=ww79.data
  port[E6-E7]=ww79.data
  port[F0-F3]=prn.data
  port[F4-F7]=app.data
  port[F8-FB]=com.data
  port[FC-FD]=intctl.data
  port[FE-FF]=intctl.data
  int=intctl.int
}

bios : Memory {
  rom="Calc\MC2721.bin"
}

mem1 : Memory {
  size=800
}

mm : MemMap {
  map[0][0000-17FF]=bios
  map[0][1800-1FFF]=mem1
}

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
}

com : K580ww51 {
}

intctl : K580wn59 {
  irq[0]=ww79.irq
  irq[1]=tim.out[0]
}

prn : K580ww55 {
}

app : K580ww55 {
}

kbd : Keyboard {
  layout="Calc\MC2721.kbd"
}

kbdreg : Register {
  write[0-2]=kbd.mask
}

dspmux : MemMap2 {
  map[00-FF]=vid.pins
}

ww79 : K580ww79 {
  scan=dspmux.offset
  scan=kbdreg
  ret=kbd.~idata
  display=dspmux
}

vid : Indicator {
  maskbitmap="Calc\calc.bmp"
  background[0]="Calc\MC2721-0.gif"
  background[1]="Calc\MC2721-1.gif"
  pin[0-38].point=18,9,23,0,8
  pin[1-39].point=24,18,23,0,8
  pin[2-3A].point=24,32,23,0,8
  pin[3-3B].point=18,40,23,0,8
  pin[4-3C].point=11,32,23,0,8
  pin[5-3D].point=11,18,23,0,8
  pin[6-3E].point=18,24,23,0,8
  pin[7-3F].point=29,40,23,0,8
}
