Browse Source

add command line arguments, precompiled emu_core.lua

tags/0.1.0
asie 1 year ago
parent
commit
f2260aee71
7 changed files with 2047 additions and 13 deletions
  1. 0
    1
      .gitignore
  2. 0
    3
      config_disks.lua
  3. 0
    4
      disks.lua
  4. 1990
    0
      emu_core.lua
  5. 1
    1
      emu_core_pre.lua
  6. 52
    2
      lunatic86.lua
  7. 4
    2
      platform_oc.lua

+ 0
- 1
.gitignore View File

@@ -1,2 +1 @@
emu_core.lua
images/*

+ 0
- 3
config_disks.lua View File

@@ -41,10 +41,3 @@ end
-- potentially allowing for some degree of hotswapping.

-- disk_init(disk_finder("disk.img"), 0x00)

disk_init("images/sv86-1440.img", 0x00)


+ 0
- 4
disks.lua View File

@@ -296,7 +296,3 @@ function disk_boot(id)
CPU["regs"][3] = 0x0000 | id
CPU["regs"][5] = 0x8000
end

dofile("config_disks.lua")

disk_boot(0x00)

+ 1990
- 0
emu_core.lua
File diff suppressed because it is too large
View File


+ 1
- 1
emu_core_pre.lua View File

@@ -1,6 +1,6 @@
// #define DEBUG_IO
// #define DEBUG_INTRS
#define DEBUG_IPS
// #define DEBUG_IPS
// #define DEBUG_MEM_UNINITIALIZED
local ram_640k = {}
local io_ports = {}

+ 52
- 2
lunatic86.lua View File

@@ -1,3 +1,8 @@
local args = {...}
local argp = {}

local drive_map = {["a"]=0x00,["b"]=0x01,["c"]=0x80,["d"]=0x81,["e"]=0x82,["f"]=0x83}

function has_module(m)
res = pcall(function()
require(m)
@@ -7,9 +12,46 @@ end

local is_opencomputers = has_module("component")

reduced_memory_mode = 3
if (1<<62) == 0 then reduced_memory_mode = 2 end
-- defaults
argp["boot"] = "a"
argp["mempack"] = 0

if is_opencomputers then
argp["mempack"] = 3
if (1<<62) == 0 then argp["mempack"] = 2 end
end

for i=1,#args do
local a = args[i]
if a:sub(1,1) == "-" then
local key = a:sub(2)
local value = ((i + 1) <= #args) and args[i + 1] or "-"
if value:sub(1,1) == "-" then
argp[key] = true
else
i = i + 1
argp[key] = value
end
end
end

if argp["h"] or argp["help"] then
print("lunatic86")
print("Usage: lunatic86 [args]")
print(" -boot [drive] Boot from the given drive: a, b, c, d, e, f")
print(" -[drive] [filename] Initialize a given drive letter from a specified file")
print(" -mempack [0,1,2,3] Set the memory packing level. 0 is fastest; 3 requires")
print(" 64-bit Lua and is about 10% slower; 2 requires only")
print(" 32-bit Lua but is a few percent slower still.")
os.exit()
end

if argp[argp["boot"]] == nil then
print("Error: Did not find file for boot drive!")
os.exit()
end

reduced_memory_mode = math.floor(tonumber(argp["mempack"]))
memory_preallocate = false

if is_opencomputers then
@@ -19,6 +61,14 @@ else
end
dofile("emu_core.lua")

for dk,did in pairs(drive_map) do
if argp[dk] then
disk_init(argp[dk],did)
end
end

disk_boot(drive_map[argp["boot"]])

xpcall(function()
emu_execute()
end, function(err)

+ 4
- 2
platform_oc.lua View File

@@ -8,8 +8,10 @@ local cp437_trans = require("table_cp437")
local oc_palette = require("table_ocpalette")
dofile("kbdmaps.lua")

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

local qdr = {}
for i=0,255 do

Loading…
Cancel
Save