-- Drive the modelled LK401 keyboard and VSXXX-AA mouse from MAME's host input -- ports, so the acceptance test "does the cursor move / do keystrokes register" -- can be observed deterministically. -- -- VT1200_SKIP_LEVEL1=1 \ -- VT1200_DUMP_FRAMES=4400,4700,5000 VT1200_DUMP_DIR=/tmp/opencode \ -- vt1200 ... -autoboot_script harness/mame/input_inject.lua -- -- Between INJ_MOUSE_FROM and INJ_MOUSE_TO the mouse is walked 16 units/frame; -- the keyboard presses and releases 'A' at INJ_KEY_FRAME. local machine = manager.machine local ports = machine.ioport.ports local mouse_x = ports[":mouse:MOUSE_X"].fields["Mouse X"] local key_a = ports[":lk401:K26"].fields["A"] local INJ_MOUSE_FROM = 4400 local INJ_MOUSE_TO = 4700 local INJ_KEY_FRAME = 4450 local INJ_KEY_FRAMES = 20 local frames = 0 local mx = 0 local key_down = false emu.register_frame_done(function() frames = frames + 1 if frames >= INJ_MOUSE_FROM and frames <= INJ_MOUSE_TO then mx = (mx + 32) % 256 mouse_x:set_value(mx) end if frames == INJ_KEY_FRAME then key_a:set_value(1) key_down = true print(string.format("inject: frame %d press A", frames)) end if key_down and frames == INJ_KEY_FRAME + INJ_KEY_FRAMES then key_a:set_value(0) key_down = false print(string.format("inject: frame %d release A", frames)) end if frames >= INJ_MOUSE_TO + 500 then machine:exit() end end, "vt1200-input-inject")