Revealing a Forgotten Chinese Compute History: Stone MS-240x Typewriter (1): Background

Wed 09 September 2020

While typewriters for European languages was available since the 1800s, Chinese typewriter was always hard to build. In the late 80s in PR China, a company, Stone Company (四通公司), in coordination with Mitsui & Co., Ltd, released a series of revolutionary Chinese typewriters. It was adequately priced, user friendly, and from a n engineer's point of view, a masterpiece in engineering.

With help of Mr Wang Jizhi (王缉志), the Chief Scientist at Stone Co and inventor of Stone Chinese typewriter, I was able to obtain some technical documentation on the original Stone typewriter. This series of article discusses about the background, the technical details, and the long term effects of the revolutionary typewriter.

Background

CJK computing is hard. Depending which standard to take, there are 4800 (常用國字標準字體表 / List of Frequently used National Character Standard Font) or 4400 (常用漢字表 / List of Jōyō Kanji) or 3500 (通用规范汉字表 / List of Commonly Used Standard Chinese Characters) frequently used characters. Considering not-so-frequently-used-but-necessary characters, we'll be looking at something around 10k characters.

As we know, there're only 7 bits in ASCII, which means it can hold up to 127 characters. The reason being 7 bits? To reduce cost. Apparently, ASCII is not enough to support anything that's not English. Pioneers in Japan opted to use 8 bit encoding (JIS X 0201) to allow Katakana -- well, that's better than nothing. Unfortunately, Kanji or even Hiragana are not available.

To solve this problem, a very large amount of internal encodings was released by multiple companies and government entities. But there're one common thing -- all characters were encoded with multiple bytes (2 or 4, depending on amount of characters to support).

Another problem is CJK font. With so many characters to support and display, font is a big problem. If we use 12x12 pixels to display each CJK character, it would take a whopping amount of 18 bytes of space! For an entire set of Chinese characters included in GB2312, it will take around 122 KB of space. In the 70s or 80s, memory are extremely expensive. The IBM PC comes with just 64KB of RAM and 64 KB of ROM and costs 1565 USD in 1981. Remember, PR China was still in extreme poverty, and take home pay for an average teacher is just 30 RMB (10 USD) per month. Nobody wants to use 13 years worth of salary to buy a IBM PC yet _still_ can't use your language! A solution must be made!

Well, the solution back then was hardware based. Mask ROM is a really good solution to store large amount of data in the 80s. With a specifically built, IBM PC compatible display adapter, the display adapter is able to display CJK characters if the screen is in text mode. However, the add-on card is not cheap, as it retails at around 2000 USD, more expensive than a PC!

The most common use of computers in the 80s is word processing. Businesses and government entities literally just buy the computers for typesetting, and schools buy them to print stuff on mimeograph wax papers for the students. So, naturally, the 80-20 rule kicks in: if 80% of the users are just buying the computers for typesetting and printing, why buy an expensive PC, an expensive add-on card, and a printer, why not just release a Chinese typewriter?

Well, the answer is, there were Chinese typewriters already, but they all suck.

Most typewriters are imported from Japan and have a built-in thermal printer. Not a good choice in China, as thermal papers has to be imported. Also, thermal paper are just not good for archival purposes. Besides that, you can't use thermal printer to print on wax papers.

Some other typewriters are not user friendly, and some of them have fonts not suitable for use in China. This might be a surprise to non-CJK users, but the reality is, different culture sometimes use different variants to write the same character, and while still perfectly readable by other Chinese character using cultures, it feels foreign and strange.

So here comes the Stone Chinese Typewriter, a typewriter that's very user friendly, with localized Chinese fonts, a 24 pin dot matrix printer, and more importantly, only costs around 13500 RMB in total (~ 3k USD), almost 1/5 the price for a complete set of Chinese computer.

Some interesting fact on the manufacturing process: the electrical boards and parts was imported from Japan costing around 6000 RMB. When arrived at Beijing, SOTEC (Stone Office Terminal Equipment Co, a subsidiary of Stone Co) assembles the machine, put the EPROM containing the software in, and performs QA checks. The machine will then be sold to the Office Automation Department of Stone Co at 9000 RMB. The OA department sells the machine to dealers across the country at around 11000 RMB. The total BOM cost is at around 50% of the retail price, much higher than the standard rate of 30% in consumer electronics industry such as TV sets.

Technical Overview

I'm not going to talk a whole lot about technical details in this article. This will come later when I finish writing the emulator for the typewriter. However, I'd still like to share some high level overview on the machine itself.

The original MS-2400 typewriter is actually a computer. This should not be a surprise to anyone, as you really needed a serious computer to perform word processing tasks.

The hardware was designed by ALPS Electric in Japan, and all software was architectured by Mr Wang Jizhi and designed by himself with a small team.

NEC V20, an Intel 8088 clone, is the heart of the system. However, this is not a IBM PC clone. The similarity with PC really stops here, as BIOS, IO devices, and even the keyboard are not PC compatible. Heck, even the PIT are not compatible!

This machine featured 64 KB of RAM, 64 KB of EPROM for BIOS and word processor, 576 KB Chinese Character Generator (2 * 256 KB, 1 * 128 KB mask ROM), a 32 KB Chinese dictionary (not for looking up words, but for converting keystrokes to Chinese characters, later commonly known as Input Method), and another optional 32 KB Chinese dictionary for secondary input method.

There are no video output capability for MS-2400. The display is a 240x64 LCD controlled by OKI MSM6255 LCD controller.

There's also a Ni-Cd battery in the machine, which could back up the memory for around 30 days.

To support the printer and keyboard, there are 4 timers with 3 modes (including NMI). The printer can print up to 20 characters per second.

The external memory is audio cassette. It has standard 3.5 mm audio jacks to interface with an external recording device.

The OS

No, there are no OS. The BIOS itself is the OS. As the machine is not designed to run any PC OS, ALPS simply implemented everything as software interrupts. As the BIOS is mapped to the fixed F000:8000 address, all programs can just execute in place, saving precious memory. Even the Chinese font loading feature was done in the BIOS itself, so that user program (the word processor itself) don't have to worry anything about the hardware at all.

Development

The development of word processor software was done on an IBM PC. Mr Shimadzu from ALPS Electric provided Mr Wang a BIOS routine reference manual, and Mr Wang first implemented the same BIOS routine on an IBM PC.

From there, all the development work are much easier, as the dev team can simply stay in China and develop everything locally to save cost on travel. Remember, China was still poor, and you just can't afford to have an entire team to stay in Japan for months.

Memory Maps

All the flash memory are hard wired to the processor. This enables execution in place. All the software are in the flash memory, as there're no easy way to use external programs. The only external storage interface is a 1200bps audio interface.

Interrupts as API

This shouldn't be a surprise as well. After all, we're talking about a real mode x86 machine. The interrupts itself is the "stable API", and different team members would solely rely on interrupts to call each other's subroutines.

Event Driven

The word processing software itself is event driven. The machine is just looping forever, waiting for a hardware interrupt to come, and the request will be dispatched by the ISR.

In the next chapter, we'll be discussing about the disassembled BIOS of the machine. Stay tuned!

Comments