indigodarkwolf / box16

A fork of the official X16 emulator, converted to C++20 and with a bunch of features tweaked and added.
MIT License
41 stars 18 forks source link

Add the three emulator debug registers to write characters to the console (+ add clock snapshot behavior too) #103

Closed irmen closed 1 year ago

irmen commented 1 year ago

Mimics recent additions to x16emu.

2 notes:

mooinglemur commented 1 year ago

I don't know why x16emu goes through the trouble of converting a character before actually printing it? (print_iso8859_15_char) Just putchar'ing it to the console works fine?

This converts the byte (X16's ISO format) to UTF-8 for display on the console, assuming the console's encoding is expecting UTF-8.

irmen commented 1 year ago

ok I don't know how to do that in box16, I couldn't find a routine like this in the source code and was reluctant to just copy the whole .c file

mooinglemur commented 1 year ago

In x16-emu, this routine is also used to convert filenames for hostfs, as well as for -echo in iso mode. Box16 appears to have the function available in the iso mode of -echo, see hypercalls.cpp

indigodarkwolf commented 1 year ago

Yes, I suppose it would make sense to pull the implementation out of there (see lines 331-355) and put it in its own function, perhaps as "print_petscii" in unicode.cpp/.h or something, so it can be called from either the hypercall hook or the memory register.

irmen commented 1 year ago

There was actually already an existing print_iso8859_15_char function in unicode.cpp already. Don't know why my initial search didn't find it.