@NAME = "Eureka"

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

# Основное ПЗУ и адреса перехвата
@ROM = "eureka/spec_m2.rom"
@ROM_LEN = 0x1000
@ROM_END = 0xCFFF

@SYS_ROM = "eureka/eureka.rom"

@C806_ADDR = 0xC377
@C80C_ADDR = 0xC3D0
@C803_ADDR = 0xC337
@F806_ADDR = 0x8AC7
@F80C_ADDR = 0x8558
@F803_ADDR = 0x8760
@READ_BYTE_ADDR = 0xF8A3

# Файл настроек
@OPT_FILE = "eureka/eureka.opt"

######## 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.frameScale = bestFit

# 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 = 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

Ram ram = 0x9000
Ram videoRam = 0x3000

Rom rom = @ROM, @ROM_LEN
Rom sysRom = @SYS_ROM, 0x200

Ppi8255 ppi

AddrSpace addrSpace
addrSpace.range = &ram,      0x0000, 0x8FFF
addrSpace.range = &videoRam, 0x9000, 0xBFFF
addrSpace.range = &rom,      0xC000, @ROM_END
addrSpace.range = &sysRom,   0xF800, 0xF9FF
addrSpace.range = &ppi,      0xFF00, 0xFFFF

EurekaRenderer crtRenderer
crtRenderer.videoRam = &videoRam

GeneralSoundSource beepSoundSource

EurekaCore core
core.window = &window
core.crtRenderer = &crtRenderer
core.beepSoundSource = &beepSoundSource

Cpu8080 cpu
cpu.frequency = 2000000
cpu.startAddr = 0xF800
cpu.addrSpace = &addrSpace
cpu.core = &core

GeneralSoundSource tapeSoundSource
#tapeSoundSource.muted = yes
GeneralSoundSource beepSoundSource2

SpecKbdLayout kbdLayout
SpecKeyboard keyboard
keyboard.matrix = "eureka"

EurekaPpi8255Circuit ppiCircuit = "eureka/romdisk.bin"
#SpecPpi8255Circuit ppiCircuit
ppiCircuit.specKeyboard = &keyboard
ppiCircuit.crtRenderer = &crtRenderer
ppiCircuit.tapeSoundSource = &tapeSoundSource
ppiCircuit.beepSoundSource = &beepSoundSource2

ppi.circuit = &ppiCircuit



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

TapeRedirector tapeInFile
tapeInFile.mode = "r"
tapeInFile.filter = "Файлы Эврики (*.rke)|*.rke;*.RKE|Файлы Специалиста (*.rks)|*.rks;*.RKS|Файлы RK-совместимых ПК (*.rk?)|*.rk;*.rk?;*.RK;*.RK?|Все файлы (*.*)|*"

TapeRedirector tapeOutFile
tapeOutFile.mode = "w"
tapeOutFile.filter = "Файлы Эврики(*.rke)|*.rke|Файлы Специалиста (*.rks)|*.rks|Файлы RK-совместимых ПК (*.rk)|*.rk|Все файлы (*.*)|*"

RkFileLoader loader
loader.addrSpace = &addrSpace
loader.filter = "Файлы Эврики (*.rke)|*.rke;*.RKE|Файлы RK-совместимых ПК (*.rk?)|*.rk;*.rk?;*.RK;*.RK?|Все файлы (*.*)|*"
loader.tapeRedirector = &tapeInFile
loader.allowMultiblock = yes

RkTapeOutHook tapeOutHook = @C80C_ADDR
tapeOutHook.outReg = A
tapeOutHook.tapeRedirector = &tapeOutFile
cpu.addHook = &tapeOutHook

RkTapeOutHook tapeOutHook2 = @F80C_ADDR
tapeOutHook2.signature = E5F5C52AB78F
tapeOutHook2.tapeRedirector = &tapeOutFile
cpu.addHook = &tapeOutHook2

RkTapeInHook tapeInHook = @C806_ADDR
tapeInHook.tapeRedirector = &tapeInFile
cpu.addHook = &tapeInHook

RkTapeInHook tapeInHook2 = @F806_ADDR
tapeInHook2.signature = E5D5C557CDDD
tapeInHook2.tapeRedirector = &tapeInFile
cpu.addHook = &tapeInHook2

RkTapeInHook tapeInHookLoader = @READ_BYTE_ADDR
tapeInHookLoader.tapeRedirector = &tapeInFile
tapeInHookLoader.suspendAfterResetForMs = 200
cpu.addHook = &tapeInHookLoader

CloseFileHook closeFileHook = @C803_ADDR
closeFileHook.addTapeRedirector = &tapeInFile
closeFileHook.addTapeRedirector = &tapeOutFile
cpu.addHook = &closeFileHook

CloseFileHook closeFileHook2 = @F803_ADDR
closeFileHook2.signature = E5D5C53E0232
closeFileHook2.addTapeRedirector = &tapeInFile
closeFileHook2.addTapeRedirector = &tapeOutFile
cpu.addHook = &closeFileHook2

EmuObjectGroup tapeGrp
tapeGrp.addItem = &tapeOutHook
tapeGrp.addItem = &tapeOutHook2
tapeGrp.addItem = &tapeInHook
tapeGrp.addItem = &tapeInHook2
tapeGrp.addItem = &tapeInHookLoader
tapeGrp.addItem = &closeFileHook
tapeGrp.addItem = &closeFileHook2
tapeGrp.enabled = yes



######## Include Saved Options ########

include @OPT_FILE



######## Configuration Window ########

ConfigTab configTab = @NAME
configTab.optFileName = @OPT_FILE

#window.frameScale
ConfigRadioSelector scaleSelector = &window, frameScale, "Масштабирование"
scaleSelector.addItem = 1x, "1x"
scaleSelector.addItem = 2x, "2x"
scaleSelector.addItem = 3x, "3x"
scaleSelector.addItem = 4x, "4x"
scaleSelector.addItem = 5x, "5x"
scaleSelector.addItem = fit, "Растянуть во все окно"
scaleSelector.addItem = bestFit, "Растянуть с целым коэффициентом"
configTab.addControl = 1, &scaleSelector

#window.windowStyle
ConfigRadioSelector styleSelector = &window, windowStyle, "Размер окна"
styleSelector.addItem = autosize, "Автоматически подстраивать"
styleSelector.addItem = resizable, "Изменяемый пользователем"
styleSelector.addItem = fixed, "Фиксированный"
configTab.addControl = 1, &styleSelector

#window.fieldsMixing
ConfigRadioSelector mixSelector = &window, fieldsMixing, "Смешивание полукадров"
mixSelector.addItem = none, "Выкл."
mixSelector.addItem = scanline, "Имитация линий растра"
configTab.addControl = 1, &mixSelector

#window.smoothing
ConfigRadioSelector smSelector = &window, smoothing, "Сглаживание"
smSelector.addItem = nearest, "Выкл."
smSelector.addItem = bilinear, "Билинейное"
smSelector.addItem = sharp, "Границы пикселей (рекомендуется)"
configTab.addControl = 1, &smSelector

#window.aspectCorrection
ConfigRadioSelector arSelector = &window, aspectCorrection, "Учитывать Aspect Ratio"
arSelector.addItem = no, "Нет (1:1)"
arSelector.addItem = yes, "Оригинальный AR"
configTab.addControl = 2, &arSelector

#window.wideScreen
ConfigRadioSelector wsSelector = &window, wideScreen, "Формат экрана"
wsSelector.addItem = no, "4:3"
wsSelector.addItem = yes, "16:9"
wsSelector.addItem = custom, "Пользовательский"
configTab.addControl = 2, &wsSelector

#crtRenderer.visibleArea
ConfigRadioSelector cropSelector = &crtRenderer, visibleArea, "Отображать реальный бордюр"
cropSelector.addItem = no, "Нет"
cropSelector.addItem = yes, "Да"
configTab.addControl = 2, &cropSelector

#kbdLayout.layout
ConfigRadioSelector laSelector = &kbdLayout, layout, "Раскладка клавиатуры"
laSelector.addItem = qwerty, "Qwerty"
laSelector.addItem = jcuken, "Йцукен"
laSelector.addItem = smart, "«Умная» раскладка"
configTab.addControl = 2, &laSelector

#kayboard.matrix
ConfigRadioSelector kbdSelector = &keyboard, matrix, "Тип клавиатуры"
kbdSelector.addItem = original, "Оригинальная"
kbdSelector.addItem = ramfos, "RAMFOS"
kbdSelector.addItem = eureka, "Eureka"
kbdSelector.addItem = lik, "Lik"
configTab.addControl = 2, &kbdSelector

ConfigRadioSelector tapeSelector = &tapeGrp, enabled, "Перехват магнитофона"
tapeSelector.addItem = yes, "Вкл."
tapeSelector.addItem = no, "Выкл."
configTab.addControl = 3, &tapeSelector

ConfigRadioSelector tapeSuspendSelector = &tapeInHookLoader, suspendAfterResetForMs, "Подавлять открытие файла после сброса"
tapeSuspendSelector.addItem = 200, "Вкл."
tapeSuspendSelector.addItem = 0, "Выкл."
configTab.addControl = 3, &tapeSuspendSelector

loader.allowMultiblock = yes
ConfigRadioSelector multiblockSelector = &loader, allowMultiblock, "Мультиблочная загрузка"
multiblockSelector.addItem = yes, "Вкл."
multiblockSelector.addItem = no, "Выкл."
configTab.addControl = 3, &multiblockSelector

#platform.codePage
ConfigRadioSelector codePageSelector = &platform, codePage, "Таблица символов отладчика"
codePageSelector.addItem = rk, "РК-86"
codePageSelector.addItem = koi8, "КОИ-8"
configTab.addControl = 3, &codePageSelector
