Skip to content

Instantly share code, notes, and snippets.

@leiradel
Created January 31, 2021 22:44
Show Gist options
  • Save leiradel/237207852703d0671cc42f5449ada3cf to your computer and use it in GitHub Desktop.
Save leiradel/237207852703d0671cc42f5449ada3cf to your computer and use it in GitHub Desktop.
Lua script for the 48K Libretro core in HC
local hc = require 'hc'
hc.control:addConsole('ZX Spectrum (Chips)', {
onConsoleLoaded = function()
local path = hc.config:getCoresPath() .. 'zx48k_libretro.' .. hc.soExtension
hc.control:loadCore(path)
end,
onGameLoaded = function()
local map = hc.config:getMemoryMap()
local blocks = {}
hc.logger:info('Adding memory region for System RAM')
for _, desc in pairs(map) do
blocks[#blocks + 1] = {desc.pointer, desc.start, desc.length}
hc.logger:info(' %p, %x, %d', desc.pointer, desc.start, desc.length)
end
hc.memory:addRegion('System RAM', false, table.unpack(blocks))
end
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment