As an educated guess, it sounds like you're trying to run bios.lua directly, as opposed to running it within a Lua coroutine. CC sticks it within one so that the one VM can run one copy for each active system in the world - your emulator will presumably only handle
one system at a time, but bios.lua expects to be running within a coroutine regardless.
In psuedocode (you may not even be using Lua for this directly):
local myCoroutine = coroutine.create(loadfile("bios.lua"))
local ok, requestedEvent = coroutine.resume(myCoroutine)
while coroutine.status(myCoroutine) ~= "dead" do
-- Generate an event, put its parameters into a table called eg "myEvent".
-- If you have nothing to generate an event with (eg the user hasn't typed anything, no timers have expired, yadda yadda,
-- ... then pause here until you do.
if not requestedEvent or requestedEvent == myEvent[1] then
ok, requestedEvent = coroutine.resume(myCoroutine, unpack(myEvent))
end
end
-- End emulation, system has stopped.
Assuming you're already familiar with coroutines, it may still be worth reading chapter four onwards of
this. If it doesn't make sense, then you may instead be better off reading the whole thing.