-- lib-check.lua -- read the M8 native-library gate marker words. -- -- The driver writes five words at 018A8000 + n*0x20: -- 0: (int)(1.5 + 2.5) == 4 (flib FD$ADD + FD$DTOI) -- 1: (int)(1.5 * 2.5) == 3 (flib FD$MUL + FD$DTOI) -- 2: isascii('A') != 0 (rts.lib _isascii) -- 3: isascii(0xC8) == 0 (rts.lib _isascii) -- 4: 0x4C494231 ("LIB1" sentinel) dofile(os.getenv("M4_LOADER_LUA")) local ENDF = tonumber(os.getenv("LOADER_END") or "3400") local frames = 0 local checked = false emu.register_frame_done(function() frames = frames + 1 if frames == ENDF - 1 and not checked then checked = true local prog = manager.machine.devices[':maincpu'].spaces['program'] local got = {} for i = 0, 4 do got[i] = prog:read_u32(0x018A8000 + i * 0x20) end print(string.format("M8 LIB: sum=%d product=%d asciiA=%d asciiC8=%d sentinel=%08X", got[0], got[1], got[2], got[3], got[4])) if got[0] == 4 and got[1] == 3 and got[2] ~= 0 and got[3] == 0 and got[4] == 0x4C494231 then print("M8 LIB MAME: PASS") else print("M8 LIB MAME: FAIL (want 4 3 nonzero 0 4C494231)") end end end, "m8-lib-check")