@name = "Башкирия-2М"

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

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

# Тактовая частота
@FREQUENCY = 2000000 #1777777
@PIT_FREQUENCY = 2000000


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

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


Ram ram0 = 0x10000
Ram ram1 = 0x10000
Rom rom = @ROM, 0x2000

Bashkiria2mKbdLayout kbdLayout
kbdLayout.layout = smart

Bashkiria2mKeyboard keyboard

Bashkiria2mKbdMem kbdmem
kbdmem.kbd = &keyboard

AddrSpace addrSpace0
addrSpace0.range = &ram0,     0x0000, 0xDFFF
addrSpace0.range = &rom,      0xE000, 0xFFFF

AddrSpace addrSpace1
addrSpace1.range = &ram0,     0x0000, 0xDFFF
addrSpace1.range = &rom,      0xE000, 0xFFFF

AddrSpace addrSpace2
addrSpace2.range = &ram0,     0x0000, 0x27FF
addrSpace2.range = &kbdmem,   0x2800, 0x2FFF
addrSpace2.range = &ram1,     0x3000, 0x6FFF, 0x0000
addrSpace2.range = &ram0,     0x7000, 0xDFFF, 0x7000
addrSpace2.range = &rom,      0xE000, 0xFFFF

AddrSpace addrSpace3
addrSpace3.range = &ram0,     0x0000, 0x27FF
addrSpace3.range = &kbdmem,   0x2800, 0x2FFF
addrSpace3.range = &ram1,     0x3000, 0x6FFF, 0x4000
addrSpace3.range = &ram0,     0x7000, 0xDFFF, 0x7000
addrSpace3.range = &rom,      0xE000, 0xFFFF

AddrSpace addrSpace4
addrSpace4.range = &ram0,     0x0000, 0x27FF
addrSpace4.range = &kbdmem,   0x2800, 0x2FFF
addrSpace4.range = &ram1,     0x3000, 0x6FFF, 0x8000
addrSpace4.range = &ram0,     0x7000, 0xDFFF, 0x7000
addrSpace4.range = &rom,      0xE000, 0xFFFF

AddrSpace addrSpace5
addrSpace5.range = &ram0,     0x0000, 0x27FF
addrSpace5.range = &kbdmem,   0x2800, 0x2FFF
addrSpace5.range = &ram1,     0x3000, 0x6FFF, 0xC000
addrSpace5.range = &ram0,     0x7000, 0xDFFF, 0x7000
addrSpace5.range = &rom,      0xE000, 0xFFFF

AddrSpace addrSpace6
addrSpace6.range = &ram0,     0x0000, 0xFFFF

AddrSpace addrSpace7
addrSpace7.range = &rom,      0x0000, 0x1FFF
addrSpace7.range = &rom,      0x2000, 0x3FFF
addrSpace7.range = &rom,      0x4000, 0x5FFF
addrSpace7.range = &rom,      0x6000, 0x7FFF
addrSpace7.range = &rom,      0x8000, 0x9FFF
addrSpace7.range = &rom,      0xA000, 0xBFFF
addrSpace7.range = &rom,      0xC000, 0xDFFF
addrSpace7.range = &rom,      0xE000, 0xFFFF

AddrSpaceMapper addrSpace = 8
addrSpace.page = 0, &addrSpace0
addrSpace.page = 1, &addrSpace1
addrSpace.page = 2, &addrSpace2
addrSpace.page = 3, &addrSpace3
addrSpace.page = 4, &addrSpace4
addrSpace.page = 5, &addrSpace5
addrSpace.page = 6, &addrSpace6
addrSpace.page = 7, &addrSpace7

Bashkiria2mRenderer crtRenderer
crtRenderer.visibleArea = yes
crtRenderer.screenMemory = &ram1

Bashkiria2mPalette crtPalette
crtPalette.crtRenderer = &crtRenderer

Bashkiria2mCore core
core.window = &window
core.crtRenderer = &crtRenderer

Ppi8255 ppi1
Ppi8255 ppi2

Pit8253 pit
pit.frequency = @PIT_FREQUENCY

Pic8259 pic
core.pic = &pic
core.pit = &pit

Pit8253Helper pitHelper

pit.core = 2, &core
pit.helper = 2, &pitHelper


#GeneralSoundSource beepSoundSource

Bashkiria2mPpi8255Circuit1 ppiCircuit1
ppiCircuit1.renderer = &crtRenderer
ppiCircuit1.mapper = &addrSpace
ppi1.circuit = &ppiCircuit1

Bashkiria2mPpi8255Circuit2 ppiCircuit2
ppi2.circuit = &ppiCircuit2

Bashkiria2mPit8253SoundSource pitSoundSource
pitSoundSource.pit = &pit

Bashkiria2mSpi8251 spi
spi.soundSource = &pitSoundSource

Fdc1793 fdc
ppiCircuit2.fdc = &fdc

AddrSpace ioAddrSpace
ioAddrSpace.addrMask = 0x1F
ioAddrSpace.range = &pit,        0x00, 0x03
ioAddrSpace.range = &ppi2,       0x04, 0x07
ioAddrSpace.range = &ppi1,       0x08, 0x0B
ioAddrSpace.range = &crtPalette, 0x10, 0x13
ioAddrSpace.range = &pic,        0x14, 0x15
ioAddrSpace.range = &spi,        0x18, 0x19
ioAddrSpace.range = &fdc,        0x1C, 0x1F

Cpu8080 cpu

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

FdImage diskA = 80, 2, 5, 1024
diskA.label = A
diskA.filter = "Образы дисков Башкирия-2М (*.cpm)|*.cpm;*.CPM|Все файлы (*.*)|*"
#diskA.fileName = "bashkiria/DISK2.CPM"

FdImage diskB = 80, 2, 5, 1024
diskB.label = B
diskA.filter = "Образы дисков Башкирия-2М (*.cpm)|*.cpm;*.CPM|Все файлы (*.*)|*"

fdc.fdImage = 0, &diskA
fdc.fdImage = 1, &diskB

ifndef QT
  include "bashkiria/bashkiria2m_wx.inc"
endif
