Browse Source

fix OC bugs, mark off 0.1.1

tags/0.1.1^2
Adrian Siekierka 1 year ago
parent
commit
0786c52e9a
5 changed files with 46 additions and 22 deletions
  1. 3
    1
      changelog.txt
  2. 9
    8
      emu_core.lua
  3. 9
    8
      emu_core_pre.lua
  4. 10
    5
      platform_oc.lua
  5. 15
    0
      table_ocpalette.lua

+ 3
- 1
changelog.txt View File

@@ -2,12 +2,14 @@
- add partial 80186 emulation, with "-arch" parameter to select
- add stubbed opcodes for non-present 8087 FPU
- add support for less common floppy disk image sizes
- fix backspace/down arrow key mappings in curses mode
- fix commonly used 8086/80186 CPU detection methods
- fix crash in comms.lua
- improve PIT emulation
- make BIOS ROM memory utilize "reduced memory mode"
- minor speed bump (+5%)
- [Curses] fix backspace/down arrow key mappings
- [OpenComputers] fix beeper support
- [OpenComputers] fix Tier 2 GPU support

0.1.0:
- add "lunatic86.lua" as a simple CLI wrapper with arguments

+ 9
- 8
emu_core.lua View File

@@ -2120,14 +2120,6 @@ local function upd_tick(cv)

upd_count(last_clock)

-- handle pc speaker
if (kbd_get_spkr_latch() & 0x03) == 0x03 then
local pch = pit_channel(3)
if (pch.mode == 2 or pch.mode == 3) and (pch.reload_set_lo and pch.reload_set_hi) then
local freq = (pit_osc_freq * 1000000) / pch.reload
platform_beep(freq)
end
end
-- handle video
video_update()
keyboard_update()
@@ -2140,6 +2132,15 @@ local function upd_tick(cv)
platform_sleep(0)
-- end
end
--cv = os.clock()
-- handle pc speaker
if (kbd_get_spkr_latch() & 0x03) == 0x03 then
local pch = pit_channel(3)
if (pch.mode == 2 or pch.mode == 3 or pch.mode == 6 or pch.mode == 7) and (pch.reload_set_lo and pch.reload_set_hi) then
local freq = (pit_osc_freq * 1000000) / pch.reload
platform_beep(freq, 0.05)
end
end
clock = cv
end


+ 9
- 8
emu_core_pre.lua View File

@@ -2135,14 +2135,6 @@ local function upd_tick(cv)
end
end
#endif
-- handle pc speaker
if (kbd_get_spkr_latch() & 0x03) == 0x03 then
local pch = pit_channel(3)
if (pch.mode == 2 or pch.mode == 3) and (pch.reload_set_lo and pch.reload_set_hi) then
local freq = (pit_osc_freq * 1000000) / pch.reload
platform_beep(freq)
end
end
-- handle video
video_update()
keyboard_update()
@@ -2155,6 +2147,15 @@ local function upd_tick(cv)
platform_sleep(0)
-- end
end
--cv = os.clock()
-- handle pc speaker
if (kbd_get_spkr_latch() & 0x03) == 0x03 then
local pch = pit_channel(3)
if (pch.mode == 2 or pch.mode == 3 or pch.mode == 6 or pch.mode == 7) and (pch.reload_set_lo and pch.reload_set_hi) then
local freq = (pit_osc_freq * 1000000) / pch.reload
platform_beep(freq, 0.05)
end
end
clock = cv
end


+ 10
- 5
platform_oc.lua View File

@@ -4,14 +4,19 @@ local unicode = require("unicode")
local keyboard = require("keyboard")
local computer = require("computer")
local gpu = component.gpu
if gpu.getDepth() < 4 then
error("Tier 2 or above GPU card required!")
end

local cp437_trans = require("table_cp437")
local oc_palette = require("table_ocpalette")
dofile("kbdmaps.lua")

local beeper = nil
if #component.list("beep") > 0 then
beeper = component.beep
end
local beeper_count = 0

for a,b in component.list("beep") do beeper_count = beeper_count + 1 end
if beeper_count > 0 then beeper = component.beep end

local qdr = {}
for i=0,255 do
@@ -30,11 +35,11 @@ function emu_debug(s)
return false
end

function platform_beep(freq)
function platform_beep(freq, time)
freq = math.floor(freq)
if freq < 20 then freq = 20
elseif freq > 2000 then freq = 2000 end
if beeper then beeper.beep({[freq]=0.05}) end
if beeper then beeper.beep({[freq]=(time or 0.05)}) end
end

function platform_sleep(t)

+ 15
- 0
table_ocpalette.lua View File

@@ -1,5 +1,12 @@
oc_palette = {}

local pc_16_colors = {
0x000000, 0x0000AA, 0x00AA00, 0x00AAAA,
0xAA0000, 0xAA00AA, 0xAA5500, 0xAAAAAA,
0x555555, 0x5555FF, 0x55FF55, 0x55FFFF,
0xFF5555, 0xFF55FF, 0xFFFF55, 0xFFFFFF
}

for i=0,255 do
if (i < 16) then
oc_palette[i] = (i * 15) << 16 | (i * 15) << 8 | (i * 15)
@@ -12,4 +19,12 @@ for i=0,255 do
end
end

local component = require("component")
local gpu = component.gpu

for i=0,15 do
oc_palette[i] = pc_16_colors[i+1]
gpu.setPaletteColor(i, oc_palette[i])
end

return oc_palette

Loading…
Cancel
Save