Page 1 of 1

Latin_o2i

Posted: Sun Jun 15, 2014 9:17 pm
by seppe
I present you a simple implementation of the Western Latin font by including a small (3K) file with a precompiled routine.
To print text in Western Latin, the included routine must be called instead of the syscall function 4, using the same parameters.
Please look at the "PrintLatin.asm" example application to see the simplicity of it.

Notes:

- when assembling the example, you must adjust the paths of the includes.
- the file-suffix (o2i) stands for "object to include"
- the routine uses 6K stack space
- the routine is written in Mas (Modern assembly, a language still to be published, black box for now)
- to properly print accents, latin font characters are printed one pixel lower then the system font

I could add the option to use the system font if the user-language is Russian or implement code pages according the country.
Next to implement is a function to get a keyboard key with dead key handling.
Maybe then comes underlined text, Input fields, textbox, ... etc.

I would like your opinion on this approach (while waiting for the implementation of unicode).

Re: Latin_o2i

Posted: Sun Jun 15, 2014 9:43 pm
by hidnplayr
Interesting approach. And your font + routine is quite small, kudos!
Tried to use the routine in IRCC (IRC client) and noted that your procedure destroys registers, unlike mcall 4
Placing a pusha/popa around 'call prl' fixed the problems offcourse.

I'm not really waiting for 'a new language' but you seem to know your stuff. I'm curious.

PS: The actual printing of western text in IRCC failed because the built in UTF8 routine recodes to CP866 instead of 1252 :(

Re: Latin_o2i

Posted: Mon Jun 16, 2014 11:16 am
by seppe
hidnplayr wrote:your procedure destroys registers, unlike mcall 4
Sorry ..I fixed it. I added a surrounding pusha/popa to the routine and updated the file.
hidnplayr wrote: printing of western text in IRCC fails because the built in UTF8 routine recodes to CP866 instead of 1252 :(
I can improve Latin_o2i to accept and print utf8 for both CP866 (Russian) and CP1252 (Latin).
Utf8, deadkeys, KB layouts, ... What shall i do first? :?:

Re: Latin_o2i

Posted: Wed Jun 18, 2014 2:32 am
by hidnplayr
It's alive!

Re: Latin_o2i

Posted: Wed Jun 18, 2014 1:17 pm
by seppe
Bravo! Well done. :wink:
Now I will add a function to Latin_o2i to handle dead codes.
Soon to come . . .

Re: Latin_o2i

Posted: Thu Jun 19, 2014 9:02 am
by seppe
I present a second version of the "latin_o2i" routine in which I added deadkey handling.
To get a key, call the "latin" routine with eax=2 instead of the syscall 2 function.
An additional parameter (ebx) must point to a 12 byte structure (three 32-bit variables).
On return, eax contains the same result as the syscall 2 function, and the variables contain:
var 1 returns the ascii code, or 0 for deadkey, 1 if the controlkey is down, 2 for hotkey
var 2 contains the control key flags (see syscall 66,3).
var 3 is used by the latin routine to store the ascii code of the pending dead-key.
Please look at the "PrintLatin.asm" example application to understand the simplicity of it all.
PrintLatin version 2
PrintLatin.jpg (8.35 KiB)
PrintLatin version 2 Viewed 4930 times
Notes:

- the routine works for all countries that use the Western Latin font for keyboard symbols. :D
- keyboard mode should be set to normal (the default)
- I did not (yet) test hotkeys

The latin routine applies simple "Typewriter" rules:
A dead-key that does not match a valid combination is lost.
To print a deadkey by itself, it must be pressed twice.

Use the AltNumkey method to enter any ascii code :D (see http://symbolcodes.tlt.psu.edu/accents/codealt.html for details)

I intent to make an application similar to Zkey for Latin keyboards.
I intent to make a map for Spanish keyboard, . . .
I will post a new topic on "printable keycodes".
On positive feedback, I'll publish a Fasm version of the latin_o2i routine.