|★ CODING ★ A BIT BOTHER ★|
|Divers - a Bit Bother|
Why should a program work on an English CPC but not on the same model in Australia? Peter Campbell explains.
Recently I was shown a program, written in Basic, which functioned correctly on CPC6128s in England. but not in Australia, improbable as it sounds! The program had been carefully tested in England and behaved perfectly. However, when asked to do a printout in Australia, the program responded that the printer was not on line, even though it was!
Examination of the program showed that the following test had been used to verify that the printer was on line:
IF INP(&F500)<>30 THEN
If the condition wasn't met. it was assumed that the printer was off line and a message was printed to that effect. The program then aborted the printout.
IN SEARCH OF A SOLUTION
When the author of the program was asked why it wouldn't work, he was mystified and said that the test was a standard one and widely used in English software. Intrigued. I set out to find, first, a solution to the problem and. second, an explanation of why my test worked and his didn't.
I tested the input port using INP(&F500) and found that my Panasonic printer returned *24* and not '30' when ready. When off line it returned '88'. A test of an Epson printer gave the same values. Surely our printers are the same as those in the UK? In a Newsletter, issued in March 1987 by the Southside Amstrad Club (now the Amstrad and PC User Group of Logan). I found a program which used a different test:
IF INP(&F500) AMD 64)<>0 THEN
I tried substituting this test and. sure enough, it worked, but what did it mean? ANDing '24' or '30' with '64' gives a result of '0'. while '88' AND '64' gives a result '64'. Which means that a '0' result means the printer is on line and '64' means it is not. It still doesn't really explain what is going on though.
In searching for why different results were obtained in different countries, when CPC6128s were connected to identical printers. I consulted The Ins and Outs of the Amstrad CPC 464 (Don Thomasson. Melbourne House Publishers. 1984) and found that the test was reading Port B of the parallel peripheral interface (p. 18). Further information was obtained from the firmware manual (Soft 158. Amsoft. 1984. App 12.7).
In Basic, the state of the printer can be determined by reading this input port, using the expression INP(&F500). However, the byte read from this port contains considerably more information than just the state of the printer. Lei's look at what makes up. The eight bits are used as shown in Figure 1 The shaded area of the diagram provides the answer to the mvsteiy. A combination of four Unks is used to tailor the CPC computers for specific markets. If 60Ilz television standard applies, then LK4 is filled. The operating system ROM contains eight possible names (not including 'Arnold'). These are 'Amstrad', 'Orion', 'Schneider'. 'Awa', 'Solavox', 'Saisho', Triumph', and 'Isp'. Just which the computer uses when it signs on depends on what combination of LK1, LK2 and LK3 links are fitted
When tlie CPCs were first marketed in Australia Ihey were handled by AWA-Thorn, who gave some ' consideration lo marketing them under the AWA label, and I have seen a photo of a prototyne ma chine wearing AWA livery on its case. However they eventually settled for Amstrad badging with the name AWA (mis-spelled 'Awa'') being shown on the screen when the computer was turned on. The 'Awa' name was retained by Mitsubishi Electric AWA but was changed to 'Amstrad'when the company took over the distribution of Amstrad products in Australia This Involved leaving out LK1 and LK2. which had been fitted to bring up the 'Awa' name.
The information on which links are titled in 'Awa' CPCs can be read from the '24' which was obtained by the test. Here's how. '24' when converted to a binary number is 11000 (or 00011000 if we show all eight bits). The bits arc numbered 0-7 from right to left, Thus:
bit 0 = 0
CPCrulez[Content Management System] v8.7-desktop/cache
L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.