
;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[vdmgrfileinfo]
name    = "NEOGEO POCKET"
version = 0.01


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[module]
window       = window("NEOGEO POCKET", 16, 16, 160, 152, 1)
viewwindow   = window("SPR/SC/PTN/COL", -16, 16, 576, 344, 0)
fftwindow    = window("FFT/Wave",       -16, 16, 440, 240, 0)
clockgen     = clockgen(6144000)
cpu0         = tmp95c061bfg(1)
cpu0_adrsdec = addressdec(24, 16)
cpu0_ram     = memory(0, 0, 0x04000, 16, rw, 0)
cpu1         = z80(2)
cpu1_adrsdec = addressdec(16, 8)
cpu1_ram     = memory(cpu0_ram, 0x3000, 0x1000, 8, rw, 0)
rtc          = rtc(1991)
neogeopocket = neogeopocket()
fftwave      = fftwave()
bitmap       = bitmap("resource/fftwave.bmp")
menu_open    = menu($16425)
menu_type    = menu($20, "NEOGEO POCKET COLOR(&C)", "NEOGEO POCKET(&M)", -, $32)
assembler    = assembler(0)
filereader   = filereader(1)
filesel_open = filesel(open|reset|history, $10, "ngc;ngp;zip", filereader.bin, neogeopocket.flashrom.download, 0x080000, 0x400000)
filesel_asm  = filesel(open|reset|history, $19, "asm;s",       assembler.asm,  neogeopocket.flashrom.download, 0x080000, 0x400000)


;////////////////////////////////////////////////////////////////
;//                                                              
;////////////////////////////////////////////////////////////////
[init]
cpu0.AM  = 0
cpu0.P90 = 0xffffff


;////////////////////////////////////////////////////////////////
;//                                                              
;////////////////////////////////////////////////////////////////
[assign]
menu_open(0)                                        = filesel_open
menu_open(0)                                        = filesel_asm
neogeopocket.menu                                   = menu_type.menu
cpu0_adrsdec.addressbus(0x000080,0x000080,0x00007f) = neogeopocket.tlcs-900h.io
cpu0_adrsdec.addressbus(0x004000,0x004000,0x003fff) = cpu0_ram.addressbus
cpu0_adrsdec.addressbus(0x008000,0x004000,0x003fff) = neogeopocket.image.addressbus
cpu0_adrsdec.addressbus(0xff0000,0x010000,0x00ffff) = neogeopocket.tlcs-900h.rom
cpu0.CS0                                            = neogeopocket.flashrom.CS0
cpu0.CS1                                            = neogeopocket.flashrom.CS1
cpu0.EXCS                                           = cpu0_adrsdec.addressbus
cpu0./NMI                                           = neogeopocket.tlcs-900h./NMI
cpu0.PA1                                            = neogeopocket.image./HSYNC
cpu0.PB0                                            = neogeopocket.image./VSYNC
cpu0.PB1                                            = neogeopocket.tlcs-900h./INT5
cpu1_adrsdec.addressbus(0x0000,0x1000,0x0fff)       = cpu1_ram.addressbus
cpu1_adrsdec.addressbus(0x4000,0xc000,0xffff)       = neogeopocket.z80.memory
cpu1.memory                                         = cpu1_adrsdec.addressbus
cpu1.io                                             = neogeopocket.z80.io
cpu1./RESET                                         = neogeopocket.z80./RESET
cpu1./NMI                                           = neogeopocket.z80./NMI
cpu1./INT                                           = neogeopocket.z80./INT
neogeopocket.rtc.regs                               = rtc.regs
neogeopocket.tlcs-900h.fc                           = cpu0.fc
neogeopocket.tlcs-900h.prescaler                    = cpu0.prescaler
neogeopocket.tlcs-900h.TO3                          = cpu0.PA3
neogeopocket.tlcs-900h.ram                          = cpu0_ram.addressbus
neogeopocket.input                                  = window.input
neogeopocket.window                                 = window.window
neogeopocket.view.window                            = viewwindow.window
fftwindow.image                                     = bitmap.imagegen
fftwave.window                                      = fftwindow.window
fftwave.sound                                       = neogeopocket.soundgen
window.image                                        = neogeopocket.imagegen
window.sound                                        = fftwave.soundgen
viewwindow.image                                    = neogeopocket.view.imagegen


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


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[setup]
vdmgr = autorun()
vdmgr = clockgen( clockgen.clk )
vdmgr = menu(file,  menu_open)
vdmgr = menu(setup, menu_type)
vdmgr = cpuctrl("TLCS-900H", cpu0.cpuctrl)
vdmgr = registerctrl("TLCS-900H", cpu0.registerctrl)
vdmgr = registerctrl("Z80", cpu1.registerctrl)
vdmgr = memoryctrl("TLCS-900H", cpu0.memoryctrl)


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[selectfile]
neogeopocket.ngpbios = "NEOGEO POCKET BIOS",       "bios/ngpbios.rom"
neogeopocket.ngcbios = "NEOGEO POCKET COLOR BIOS", "bios/ngcbios.rom"


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[save]
state = neogeopocket.state
state = fftwindow.state
state = viewwindow.state
image = neogeopocket.image


;////////////////////////////////////////////////////////////////
;////////////////////////////////////////////////////////////////
[keyconfig]
key0 = 0xc8, $100
key1 = 0xd0, $101
key2 = 0xcb, $102
key3 = 0xcd, $103
key4 = 0x2c, $104
key5 = 0x2d, $105
key6 = 0x2a, $106
