the new from Japan is now usable in Europe
The Kanji characters are the more complex characters of Hiragana characters which are printed above these Kanji characters on many packages of Japanese games. The Katakana characters are used by Japanese to phonetically write English words. Usually names are written in Katakana characters as well. Hiragana characters are mostly used to create sentences, but the actual translation procedure is unknown to me, so let’s keep that to the experts okay? This article just explains the use of both the Kanji screens and PUT KANJI. The Kanji rom is accessible using machine language, so some example sources are implemented.
After selecting a Kanji screen the keyboard will take the Japanese layout, which is the reason for the confusing non-japanese keyboards. With MSX-DOS 2.20 this was made very clear and there are converted MSX2+ computer which have a reprogrammed version in eprom which let you keep the original keyboard layout. Officially the Kanji rom was designed for the Japanse market which explains the Japanese keyboard layout. MSX-DOS 2.20-Kanji enabled clearing the screen with just a simple CLS. However, the official version of Kanji rom only _CLS enables clearing the screen. A normal CLS would simply give an error. Using _PALETTE(C,R,G,B) even colours can be changed in the Kanji screen. The result is 100% equal to COLOR=(C,R,G,B), but this would mess up part of the screen.
Kanji string manipulation
Some commands need more explanation and examples in order to show the exact result. It’s necessary that you should try some things yourself in order to understand it all. Japanese characters kan be viewed if the appropriate support for this is installed or else you would see some meaningless characters.
_KNJ(A$,B$) converts the Jis code to a string which can be used to put the character actually on the Kanji screen. In the Japanese manuals all characters are put in Jis code, which is the standard code for every Japanese computer system to display the correct character without its own translation method because of incompatibility. The Jis code is the standard for the Japanese Kanji and all conversions should go through the Jis code. The Jis code itself is put in B$ and the result will come in A$. As an example let’s take Jis code “4B62”. If we want to put this character on the screen, we should do _KNJ(A$, "4B62") and the characters to put the Kanji character onto the screen is put in A$. The character itself on MSX looks like this:
This Kanji character can be converted back to a Jis code using _JIS(B$,A$) and B$ will have the string “4B62”. Using _SJIS(C$,A$) will result in the hexadecimal values of the character codes you should print to the screen to display that character: “9682”. In this case the character codes are &H96 and &H82. Printing these codes to a Kanji screen would result in the display of the Kanji character. Also a nice feature (and used a lot) is converting a string from Ank string to Kanji string, which results in double width characters on the screen. Less used is the conversion from Kanji string to Ank string (in somehow a less perfect way, as there are many more characters in the Kanji rom and conversion to Ank string is done with just 256 characters).
If we want for us readble text (converted from an Ank string to a Kanji string) printed in double width on a Kanji screen, then use the statement _AKCNV(A$,"Hello") and when printing A$ to the Kanji screen. the text will be printed in double width as the Kanji characters are 16 pixels wide in stead of 8 pixels and on the Kanji screen two positions are used for one character for this purpose. If we want to convert this Kanji string back to an Ank string the statement _KACNV(B$,A$) and the result is that B$ contains the normal “Hello” (in both Ank and Kanji screens). The Katakana and Hiragana characters are smoother after converting from an Ank string to Kanji string, because the Ank characters are 8×8 pixels and Kanji characters are 16×16 pixels which are located in a seperate rom: the Jis rom.
Using _KEXT(A$,B$,A) it’s possible to filter all characters of a given type A from B$ to A$. It’s possible to combine Ank-type and Kanji-type characters in a single string. If A=0 then all Ank-type characters would be filtered out from B$ into A$ and if A=1 then all Kanji-type characters would be filtered out from B$ into A$. After this, the length of the string can be determined using _KLEN(A,A$) for a particular purpose. You can get the type of a character within a string with _KTYPE or you can select a particular part out of it using _KMID. Before using one of those statements, you should get the length of the string first as A=LEN(A$) will give a different value than _KLEN(A,A$) when it contains Kanji-type characters.
_KTYPE(A,A$,B) can determine the type of a selected character. The result A will contain the type of character in A$ on position B. Use _KLEN before using _KTYPE to stay within the actual length of the string, without getting an error. When A=0, the pointed character is Ank-type or A=1 when it points to a Kanji-type character. _KMID(A$,B$,A,B) gets the selected part of the string. _KMID detects character-types and reacts accordingly. Use _KLEN to determine the length of the string.
The key combinations GRAPH-SELECT and CTRL-SPACE reveal some nice functions. If there is a difference between these two key combinations, I don’t know what it exactly is. Both key combinations disable this function. On the last line a cursor is positioned where japanese characters are entered using phonetic speech (which is called Romaji) and results in hiragana characters. Ouside of this function (and the Kanji screens) entering Romaji can be entered using SHIFT-KANA and CAPS-LOCK acts as a toggle between Hiragana characters (CAPS-LOCK off) and Katakana characters (CAPS-LOCK on).
While entering text there are some keys with special functions. The cursor keys left and right enable browsing within the typed text. Cursor keys up and down or the space bar enable brwosing through a selection of Hiragana to Kanji converted possibilities. The RETURN-key tranfers the text to the actual screen from the cursor position. The KANA-key toggles phonetic speech entry (Romaji) and direct Hiragana entry. F1 toggles entry using our alphabet, F2 converts input to Kanji typed Katakana, F3 converts input to Ank-typed Katakana.
Kanji in machine language
The PUT KANJI statement
PUT KANJI [STEP] [(X-coordinate,Y-coordinate)], <Jis code> [,<Color>] [,<Logical operation>] [,<Printmode>]
Like most graphical commands the optional "STEP" is used to do a relative positioning. Between the brackets the (with STEP relative) coordinates for the character are located. <Jis code> is expected and describes the character to print. Like all Jis codes in this article are in hexadecimal notation the same notation is kept here as well. So if you want to print Jis code “4B62” the Jis code is to be entered like &H4B62 (just for our easy reading and quick reference) in PUT KANJI. <Color> depends on the number of colors for that graphical screen. Like most graphical commands the <Logical operation> is printed in alphanumeric format. At default the <Logical operation> is PSET.
<Printmode> needs some more explanation. There are 3 printmodes (0 to 2) and the table explains most of them:
Printmode 0 displays the complete Kanji character on the active screen page. This is the defaultmode and is mostly used when there is no interlace necessary. Printmode 1 displays the even lines on the active page. To combine both even and odd lines to the full character the even lines are to be printed on the even numbered page and the odd lines on the odd numbered page using interlace. Remember: screen pages 0 and 1 are connected and screen pages 2 and 3 are connected too. These two examples show the usage of PUT KANJI in Basic. The first example shows the use of printmode 0, the second example print the same text using printmodes 1 and 2:
The examples above read the Jis code from the DATA statement. It’s easier to use the Kanji rom. As described earlier it’s possible to convert from Ank-type to Kanji-type and to get the Jis code per character to print using PUT KANJI. The statements used are: _AKCNV, _JIS, _KLEN and _KMID. The examples would be like this after changing some of the code:
PUT KANJI in machine language
The routine KANJI actually does the PUT KANJI thing. The settings are done (color, logic operation and printmode). SET PAGE and interlace control can be removed with printmode 0. Adjusting the source for printmode 0 is not that hard. Choosing the source with interlace above the non-interlace is done because the non-interlace version can be easily extracted from this one.