@name = "ПК-01 Львов"

# Файл справки
@HELP_FILE = lvov/lvov.html

# Основное ПЗУ
@ROM = "lvov/lvov.rom"

# Тактовая частота
@FREQUENCY = 2222222



######## Window ########

EmuWindow window
window.caption = @name

# Default window size for window.windowStyle = fixed (default = 800, 600)
#window.defaultWindowSize = 768, 512
window.defaultWindowSize = 800, 600

# Window style: autosize, resizable, fixed, fullscreen (default = autosise)
window.windowStyle = autosize
#window.windowStyle = resizable

# Window scaling option: 1x, 2x, 3x, 4x, 5x, fit, bestFit (default = bestFit)
window.frameScale = 2x

# Window fields mixing: none, mix, average, interlace, scanline (default = none)
#window.fieldsMixing = mix

# Image smoothing / post-processing: nearest, bilinear, sharp, custom (default = sharp)
window.smoothing = sharp

# Custom image shader: "shader name" or none (default = none)
#window.shader = crt-hyllian

# Convert image to grayscale
#window.desaturate = yes

# Aspect correction (default = no)
#window.aspectCorrection = yes

# Wide screen (16:9): yes, no, custom (default = no)
window.wideScreen = no

# Gray window background (default: no)
#window.grayBackground = yes

# Screen format for window.wideScreen = custom
window.customScreenFormat = 1.111



######## Platform ########

platform.helpFile = @HELP_FILE

# Code page: rk, koi8 (default = rk)
platform.codePage = rk

# Fast reset
platform.fastReset = yes
platform.fastResetCpuTicks = 12300000


Ram ram0 = 0x4000
Ram ram1 = 0x4000
Ram ram2 = 0x4000

@RAM_TAG = 1

ram0.tag = @RAM_TAG
ram1.tag = @RAM_TAG
ram2.tag = @RAM_TAG

Ram videoRam = 0x4000

ram0.tag = @RAM_TAG
ram1.tag = @RAM_TAG
ram2.tag = @RAM_TAG
videoRam.tag = @RAM_TAG

Rom rom = @ROM, 0x4000

AddrSpace addrSpace0
addrSpace0.range = &ram2,     0x0000, 0x3FFF
addrSpace0.range = &videoRam, 0x4000, 0x7FFF
addrSpace0.range = &ram2,     0x8000, 0xBFFF
addrSpace0.range = &rom,      0xC000, 0xFFFF

AddrSpace addrSpace1
addrSpace1.range = &ram0,     0x0000, 0x3FFF
addrSpace1.range = &ram1,     0x4000, 0x7FFF
addrSpace1.range = &ram2,     0x8000, 0xBFFF
addrSpace1.range = &rom,      0xC000, 0xFFFF

AddrSpaceMapper addrSpace = 2
addrSpace.page = 0, &addrSpace0
addrSpace.page = 1, &addrSpace1

LvovRenderer crtRenderer
crtRenderer.screenMemory = &videoRam

LvovCore core
core.window = &window
core.crtRenderer = &crtRenderer

Ppi8255 ppi1
Ppi8255 ppi2

GeneralSoundSource beepSoundSource

GeneralSoundSource tapeSoundSource
#tapeSoundSource.muted = yes

LvovPpi8255Circuit1 ppiCircuit1
ppiCircuit1.renderer = &crtRenderer
ppiCircuit1.tapeSoundSource = &tapeSoundSource
ppiCircuit1.beepSoundSource = &beepSoundSource
ppiCircuit1.mapper = &addrSpace
ppi1.circuit = &ppiCircuit1

LvovKbdLayout kbdLayout
kbdLayout.layout = smart

LvovKeyboard keyboard

LvovPpi8255Circuit2 ppiCircuit2
ppiCircuit2.lvovKeyboard = &keyboard
ppi2.circuit = &ppiCircuit2

AddrSpace ioAddrSpace
ioAddrSpace.addrMask = 0x13
ioAddrSpace.range = &ppi1, 0x00, 0x03
ioAddrSpace.range = &ppi2, 0x10, 0x13

Cpu8080 cpu

cpu.frequency = @FREQUENCY
cpu.startAddr = 0xC000
cpu.addrSpace = &addrSpace
cpu.ioAddrSpace = &ioAddrSpace
cpu.core = &core

LvovCpuWaits cpuWaits
cpu.cpuWaits = &cpuWaits

LvovCpuCycleWaits cpuCycleWaits
cpu.cpuCycleWaits = &cpuCycleWaits



######## File I/O ########

TapeRedirector msxTapeOutFile
msxTapeOutFile.mode = "w"
msxTapeOutFile.filter = "Файлы Львова (*.lvt)|*.lvt|Cas-файлы MSX (*.cas)|*.cas|Все файлы (*.*)|*"
msxTapeOutFile.timeout = 6000

TapeRedirector msxTapeInFile
msxTapeInFile.mode = "r"
msxTapeInFile.filter = "Файлы Львова (*.lvt)|*.lvt;*.LVT|Все файлы Львова (*.lv?)|*.lv?;*.LV?|Cas-файлы MSX (*.cas)|*.cas;*.CAS|Все файлы (*.*)|*"
#msxTapeInFile.timeout = 3000

LvovFileLoader loader
loader.skipTicks = 15000000
loader.addrSpace = &addrSpace1
loader.videoAddrSpace = &videoRam
loader.ioAddrSpace = &ioAddrSpace
loader.filter = "Файлы Львова (*.lvt;*.sav)|*.lvt;*.LVT;*.sav;*.SAV|Все файлы Львова (*.lv?;*.sav)|*.lv?;*.LV?;*.sav;*.SAV|Cas-файлы MSX (*.cas)|*.cas;*.CAS|Все файлы (*.*)|*"
loader.tapeRedirector = &msxTapeInFile
loader.allowMultiblock = yes

MsxTapeOutHook tapeOutHook = 0xE437
tapeOutHook.tapeRedirector = &msxTapeOutFile
cpu.addHook = &tapeOutHook

MsxTapeOutHeaderHook tapeOutHeaderHook = 0xE42B
tapeOutHeaderHook.tapeRedirector = &msxTapeOutFile
cpu.addHook = &tapeOutHeaderHook

MsxTapeInHook tapeInHook = 0xE4BE
tapeInHook.tapeRedirector = &msxTapeInFile
tapeInHook.lvovFix = yes
cpu.addHook = &tapeInHook

MsxTapeInHeaderHook tapeInHeaderHook = 0xE4D0
tapeInHeaderHook.tapeRedirector = &msxTapeInFile
cpu.addHook = &tapeInHeaderHook

CloseFileHook closeFileHook = 0xE800
closeFileHook.addTapeRedirector = &msxTapeInFile
closeFileHook.addTapeRedirector = &msxTapeOutFile
cpu.addHook = &closeFileHook

EmuObjectGroup tapeGrp
tapeGrp.addItem = &tapeOutHook
tapeGrp.addItem = &tapeInHook
tapeGrp.addItem = &tapeOutHeaderHook
tapeGrp.addItem = &tapeInHeaderHook
tapeGrp.addItem = &closeFileHook


ifndef QT
  include "lvov/lvov_wx.inc"
endif
