x16emu -keybuf flag, like in VICE

If you have feature requests, this is the place to post them. Please note your idea may already be something we have already discussed and decided against, or something we are working on privately, and we cannot be held responsible for any similarities in such instance. Whilst we cannot respond to every suggestion, your idea will be read and responded to where possible. Thank you for your input!
Post Reply
pzembrod
Posts: 94
Joined: Sat Aug 29, 2020 9:21 pm

x16emu -keybuf flag, like in VICE

Post 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

Fnord42
Posts: 74
Joined: Fri Aug 14, 2020 8:56 am

x16emu -keybuf flag, like in VICE

Post 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!

pzembrod
Posts: 94
Joined: Sat Aug 29, 2020 9:21 pm

x16emu -keybuf flag, like in VICE

Post 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.

 

pzembrod
Posts: 94
Joined: Sat Aug 29, 2020 9:21 pm

x16emu -keybuf flag, like in VICE

Post 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.

Post Reply