
;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[vdmgrfileinfo]
name    = "MSX"
version = 0.01


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[module]
mainwindow      = window("MSX",               16,  16, 256, 192, 1)
viewwindow      = window("NAME/SPR/PTN/COL", -16,  16, 512, 256, 0)
fftwindow       = window("FFT/Wave",         -16, 312, 440, 240, 0)
drecwindow      = window("Data Recorder",     16,  64, 352,  80, 0)
filereader      = filereader(0)
clockgen        = clockgen(10738635)
cpu             = z80(3)
io_adrsdec      = addressdec(8, 8)
msx             = msx()
i8255           = i8255()
i8255_pindec_pc = pindec()
vdp             = tms9918()
fftwave         = fftwave()
bitmap          = bitmap("resource/fftwave.bmp")
datarecorder    = datarecorder()
ay-3-8910       = ay-3-8910(1789773)
buzzer          = buzzer()
scc1            = scc(3579545)
scc2            = scc(3579545)
menu_cslot1     = menu($20, $16425, $23, -, $24, "ASCII8KB", "ASCII8KB+SRAM8KB", "ASCII16KB", "KONAMI4", "KONAMI5", "R-TYPE", "HYDLIDE2")
menu_cslot2     = menu($21, $22,    $23, -, $24, "ASCII8KB", "ASCII8KB+SRAM8KB", "ASCII16KB", "KONAMI4", "KONAMI5", "R-TYPE", "HYDLIDE2")
menu_disp       = menu($25, $26, $32, $27)
menu_datarec    = menu($28, $29, $30, $31)
filereader      = filereader(1)
assembler       = assembler(0)
filesel_open1   = filesel(open|reset|history, $10, "rom;zip", filereader.bin, msx.cslot1.download, 0x0010, 0x100000)
filesel_asm     = filesel(open|reset|history, $19, "asm;s",   assembler.asm,  msx.cslot1.download, 0x0000, 0x100000)
filesel_open2   = filesel(open|reset,         $10, "rom;zip", filereader.bin, msx.cslot2.download, 0x0010, 0x100000)
filesel_openwav = filesel(open|history,       $11, "wav;zip")
filesel_savewav = filesel(save,               $11, "wav")
filesel_instape = filesel(open|save,          $11, "wav;zip")


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[init]
cpu.WAIT.M1       = 1
cpu.WAIT.IO       = 1
fftwave.ch1.level = 100
fftwave.ch2.level = 80
fftwave.ch3.level = 80
fftwave.ch4.level = 80
datarecorder.file = "resource/datarecorder.bmp"


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[assign]
menu_cslot1(1)                        = filesel_open1
menu_cslot1(1)                        = filesel_asm
menu_cslot2(1)                        = filesel_open2
menu_datarec(1)                       = filesel_openwav
menu_datarec(2)                       = filesel_savewav
datarecorder.filesel                  = filesel_instape
datarecorder.window                   = drecwindow.window
datarecorder.menu                     = menu_datarec.menu
io_adrsdec.addressbus(0x98,0x02,0x01) = vdp.addressbus
io_adrsdec.addressbus(0xa0,0x04,0x03) = ay-3-8910.DA
io_adrsdec.addressbus(0xa8,0x04,0x03) = i8255.addressbus
msx.keyboard.select0                  = i8255_pindec_pc.pin0
msx.keyboard.select1                  = i8255_pindec_pc.pin1
msx.keyboard.select2                  = i8255_pindec_pc.pin2
msx.keyboard.select3                  = i8255_pindec_pc.pin3
datarecorder.input                    = i8255_pindec_pc.pin5
buzzer.pin                            = i8255_pindec_pc.pin7
i8255.PA                              = msx.slot.select
i8255.PB                              = msx.keyboard.matrix
i8255.PC                              = i8255_pindec_pc.addressbus
msx.datarecorder.input                = datarecorder.output
ay-3-8910.IOA                         = msx.IOA
ay-3-8910.IOB                         = msx.IOB
cpu.memory                            = msx.addressbus
cpu.io                                = io_adrsdec.addressbus
;#cpu./NMI                              = nmi.out
cpu./INT                              = vdp./INT
fftwindow.image                       = bitmap.imagegen
fftwave.window                        = fftwindow.window
fftwave.ch1.soundgen                  = buzzer.soundgen
fftwave.ch2.soundgen                  = ay-3-8910.soundgen
fftwave.ch3.soundgen                  = scc1.soundgen
fftwave.ch4.soundgen                  = scc2.soundgen
msx.cslot1.menu                       = menu_cslot1.menu
msx.cslot2.menu                       = menu_cslot2.menu
msx.scc1.addressbus                   = scc1.addressbus
msx.scc2.addressbus                   = scc2.addressbus
msx.input                             = mainwindow.input
mainwindow.image                      = vdp.imagegen
mainwindow.sound                      = fftwave.soundgen
viewwindow.image                      = vdp.view.imagegen
drecwindow.image                      = datarecorder.imagegen
vdp.menu                              = menu_disp.menu
vdp.window                            = mainwindow.window
vdp.view.window                       = viewwindow.window


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[reset]


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[setup]
vdmgr = clockgen(clockgen.clk)
vdmgr = menu(file,  menu_cslot1)
vdmgr = menu(file,  menu_cslot2)
vdmgr = menu(file,  menu_datarec)
vdmgr = menu(setup, menu_disp)
vdmgr = cpuctrl("Z80", cpu.cpuctrl)
vdmgr = registerctrl("Z80", cpu.registerctrl)
vdmgr = registerctrl("VDP", vdp.registerctrl)
vdmgr = memoryctrl("Z80", cpu.memoryctrl)
vdmgr = memoryctrl("VDP", vdp.memoryctrl)


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[save]
state = vdp.state
state = viewwindow.state
state = fftwindow.state
state = drecwindow.state
image = msx.image


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[selectfile]
msx.bios = "BIOS", "bios/cbios_main_msx1_jp.rom"


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[keyconfig]
key0  = 0xc8, $100
key1  = 0xd0, $101
key2  = 0xcb, $102
key3  = 0xcd, $103
key4  = 0x2c, $104
key5  = 0x2d, $105
key6  = 0x00, $106
key7  = 0x00, $107
key8  = 0x00, $108
key9  = 0x00, $109
key10 = 0x00, $110
key11 = 0x00, $111
key12 = 0x3b, "F1/F6"
key13 = 0x3c, "F2/F7"
key14 = 0x3d, "F3/F8"
key15 = 0x3e, "F4/F9"
key16 = 0x3f, "F5/F10"
key17 = 0xc5, "STOP"
key18 = 0xc7, "HOME"
key19 = 0xcf, "SELECT"
key20 = 0xd2, "INS"
key21 = 0xd3, "DEL"
key22 = 0x01, "ESC"
key23 = 0x0f, "TAB"
key24 = 0x1d, "CTRL"
key25 = 0x2a, "L SHIFT"
key26 = 0x36, "R SHIFT"
key27 = 0x0e, "BS"
key28 = 0x1c, "RETURN"
key29 = 0x7b, $112
key30 = 0x3a, "CAPS LOCK"
key31 = 0x38, "GRAPH"
key32 = 0x39, "SPACE"
key33 = 0xcb, "LEFT"
key34 = 0xcd, "RIGHT"
key35 = 0xc8, "UP"
key36 = 0xd0, "DOWN"
key37 = 0x02, "1"
key38 = 0x03, "2"
key39 = 0x04, "3"
key40 = 0x05, "4"
key41 = 0x06, "5"
key42 = 0x07, "6"
key43 = 0x08, "7"
key44 = 0x09, "8"
key45 = 0x0a, "9"
key46 = 0x0b, "0"
key47 = 0x0c, "-"
key48 = 0x90, "^"
key49 = 0x7d, "\"
key50 = 0x10, "Q"
key51 = 0x11, "W"
key52 = 0x12, "E"
key53 = 0x13, "R"
key54 = 0x14, "T"
key55 = 0x15, "Y"
key56 = 0x16, "U"
key57 = 0x17, "I"
key58 = 0x18, "O"
key59 = 0x19, "P"
key60 = 0x91, "@"
key61 = 0x1a, "["
key62 = 0x1e, "A"
key63 = 0x1f, "S"
key64 = 0x20, "D"
key65 = 0x21, "F"
key66 = 0x22, "G"
key67 = 0x23, "H"
key68 = 0x24, "J"
key69 = 0x25, "K"
key70 = 0x26, "L"
key71 = 0x27, ";"
key72 = 0x92, ":"
key73 = 0x1b, "]"
key74 = 0x2c, "Z"
key75 = 0x2d, "X"
key76 = 0x2e, "C"
key77 = 0x2f, "V"
key78 = 0x30, "B"
key79 = 0x31, "N"
key80 = 0x32, "M"
key81 = 0x33, ","
key82 = 0x34, "."
key83 = 0x35, "/"
key84 = 0x2b, "_"
