/usr/share/hatari/hconsole/example.py is in hatari 1.7.0-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #! /usr/bin/python
#
# This is an example of scripting hatari using hconsole
#
# Run with (using correct EmuTOS path):
# PATH=../../build/src/:$PATH ./example.py --tos etos512k.img
# Or if Hatari and hconsole are installed to the system:
# /usr/share/hatari/hconsole/example.py --tos etos512k.img
import hconsole, os, sys
# path for this script
path = os.path.dirname(sys.argv[0])
# current work directory
cwd = os.path.abspath(os.path.curdir)
# shortcuts to hconsole stuff
main = hconsole.Main()
code = hconsole.Scancode
# execute commands from external file in current directory
main.script(path + "/example-commands")
# define shortcut functions for entering specific key presses
def backspace():
main.run("keypress %s" % code.Backspace)
def enter():
main.run("keypress %s" % code.Return)
# loop removing some of previously script output
for i in range(25):
backspace()
enter()
# output some text to EmuTOS console in a loop
for i in range(3):
main.run("text echo Welcome to 'hconsole'")
enter()
# ask Hatari debugger to parse breakpoint etc commands from file
main.run("parse %s/example-debugger" % path)
# hit a Getdrv() breakpoint when EmuTOS prompt is redrawn
enter()
# wait few secs and kill Hatari
main.run("sleep 3")
main.run("kill")
|