Page 1 of 1

x16emu -keybuf flag, like in VICE

Posted: Tue Nov 10, 2020 10:11 pm
by pzembrod

I would like to propose a -keybuf flag, similar to the one in VICE, that injects further text into the keyboard buffer after loading and running a program with -prg/-bas and -run.

Background/reason: I'm currently working on an X16 port of the C64/C16 flavour of VolksForth (https://github.com/forth-ev/VolksForth). I am using VICE and now x16emu in automated build and test scripts, where I need this flag to initiate a build or test procedure after loading and starting a FolksForth binary. See https://github.com/pzembrod/VolksForth/blob/x16-390/6502/C64/emulator/run-in-x16emu.sh#L41 and https://github.com/pzembrod/VolksForth/blob/x16-390/6502/C64/Makefile#L134 for how this is used.

I have an implementation proposal of this flag in https://github.com/pzembrod/x16-emulator/blob/master/main.c and would be happy to send a pull request.

Cheers

Philip


x16emu -keybuf flag, like in VICE

Posted: Sun Nov 22, 2020 10:53 am
by Fnord42

I might be wrong, but isn't that exactly what the -bas flag does?

A quick test shows that a .bas file with the contents:

10 INPUT "WHAT IS YOUR NAME";N$

20 PRINT "HELLO, ";N$;"!"

RUN

JOHN DOE


does in fact result in:

grafik.png.b9f9ced2f944c3089e4994b9415b837b.png

 

I'm not sure how well this works together with -prg and -run, but you could probably just start your text file with

LOAD "MYPROG.PRG"

RUN


as a workaround.

Hope this helps!


x16emu -keybuf flag, like in VICE

Posted: Sun Nov 22, 2020 3:43 pm
by pzembrod

Ah, I see how the same might be achievable with the -bas flag.

The difference is that -bas takes its input from a file whereas -keybuf takes its input from the command line.

And my sample implementation works such that the additional keystrokes work with a BASIC program "typed" via -bas as well as with any program loaded via -prg. The added keystrokes are just appended after the RUN into the keyboard buffer, in the two appropriate places in the code.

I'll try out how the integration into make files would look if I used the LOAD+RUN+<myinput> workaround in a file via the -bas flag that you suggest. I would consider it more of a workaround, though. One difference in the first place between -prg and LOAD would be (I guess) that -prg takes its input from the host file system whereas with LOAD the tested program would need to be in the mounted sdcard image - which is doable, of course.

 


x16emu -keybuf flag, like in VICE

Posted: Sun Dec 20, 2020 11:58 pm
by pzembrod

Took me a while, but I finally got around to try your script file suggestion, and it works, and more nicely than I had anticipated.

Especially it is actually easier to convert keystrokes from ASCII to PETSCII if they live in a file than if they live in shell variables, so I suggest closing this feature request.