CORRECTED THE CURSOR POSITIONING CODE
The positioning of the cursor is now correct for all tab movement situations. I also tested the cursor positioning supporting a left margin set to a column past 1. Simulation on Wokwi.com demonstrated that the right margin and left margin support are working properly.
RETESTING ON THE 1130 IS A SUCCESS
In addition to testing the cursor positioning from tab movements, I also verified the behavior when the left and right margins are set bigger than 1 and less than 120. I was pretty happy with the results of the testing. The emulator has passed all my tests and works as intended.
The only 1052 functionality that is not working in this version is support for overtyping to form composite characters as that depends on a capability in the terminal emulator that will be connected over the USB cable to my emulator. That wasn't an original design goal.
ADDING ENHANCEMENT TO COMBINE 'INK' WHEN CHARACTERS ARE OVERTYPED
Currently, the 88 APL typeball characters all print correctly but when the APL/1130 system outputs a compound character, the last typeball character is all that shows on the screen, the previous character that was printed and then backspaced over is no longer visible.
I wrote a simple program to send one of these sequences - a quad character, a backspace, and then a quote character. Some information on the internet suggests that Putty, the terminal emulator I am using, does properly deal with graphemes combining characters in this way. I tested it.
It did not work. Further investigation revealed that I had to emit a special Unicode character called the zero width joiner (ZWJ) to make Putty overlay the two characters. This is instead of the backspace character I would have issued. My emulator program won't know in advance when it gets a character such as quad whether it will subsequently receive a backspace and then another character that combines to form a grapheme.
I could just send the ZWJ instead of a backspace, which will give the correct behavior to paper typing as long as the next character sent is not another movement command. For example, three backspaces in a row should overtype on the character a few back in the stream, not on the immediate prior printed character. In fact, Putty will swallow the next character if it sees ZWJ which does cause problems if a grapheme is not the intended result.
All of this will require some additional logic in my emulator to work this out. I could buffer the characters that are sent on a line, then use it to update a position when backspacing. I first let the bs move back to a given column, setting a special mode. I update the column and move the cursor based on the movements within that saved line buffer.
When a printable character arrives during the special mode, retype the original that was in the given column, followed by ZWJ and then the new character. Any movement that leaves the line will turn off the special mode. Also, if the original character in a column that we backspaced to was a space, we just reissue the space.
The advantage of the code above is that the user does see the effect of the backspace movements immediately, then sees the output as it would have existed on paper if typing with the real 1052 console printer. This works properly for all 1130 operations that try to overstrike a column with multiple characters, such as obscuring an entered password field or placing asterisk over O characters as part of the 1052 diagnostic to check how well the typewriter registers at each column.
No comments:
Post a Comment