CODING ★ HIDDEN VIRTUES (COMPUTING TODAY) ★

Hidden Virtues (Computing Today)
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

The Amstrad CPC464 has had nothing but favourable reviews. However, we've found out just a little bit more about the subtleties of this machine since we reviewed it in October '84.

When a new microcomputer appears on the market, everyone wants to get their sticky fingers on the keyboard and try it out. Is it just another run-of-the-mill device, or has it got some special virtue to commend it? Unfortunately, the answer may not be obvious at once. The apparent value of a new machine depends heavily on the nature of the documentation. If a given facility is not mentioned in the user guide, it may be difficult to guess that the facility exists.

A case in point is the AMSTRAD CPC464. In the October issue of Computing Today there was a thoroughgoing review of the machine as it then appeared. The conclusions were favourable, and no doubt encouraged a number of people to take a closer look.

Then further documentation surfaced, and that revealed the machine in an entirely new light. Yes, it was a nice machine for the BASIC user, but it was now seen to be much more than that. Some of its potential is yet to be realised in full, but there is quite enough to be going on with.

SIDEWAYS ROMs

Just for starters, there is the provision for attaching 'sideways ROMs' via the extension bus. The AMSTRAD CPC464 uses an ingenious system of memory expansion. All available memory addresses are used for 64K of RAM, but the top and bottom quarters of the address range are shared with 16K blocks of ROM, giving an apparent memory size of 96K.
The top 16K of the RAM is devoted to screen memory, and an area below this holds code copied from ROM into RAM so that it is always available for immediate use. In the 0000-0040 address range ROM and RAM hold the same code, though some bytes in this area may be patched by the user to put special code in RAM.

With such an arrangement, it is essential to have means for switching banks and jumping to a given location simultaneously, or effectively so. The CPC464 provides this by creating what are really extensions to the Z80 instruction set. For example, a code sequence CF XX XX is given a special meaning analogous to the C3 XX XX format. The latter performs a simple j ump to the location defined by XX XX, but the CF code — used in the CPC464 — does rather more.

Suppose the full call is CF 1B 88. This looks like an access to address 88IB, but the two top bits of the address are stripped away, and access is to 08IB. This is in the area occupied by the lower ROM and the bottom quarter of RAM, so the system needs to know which is required. Those two top bits give the answer. If bit 14 is a 1, the lower ROM is disabled, else enabled, and bit 15 similarly controls the upper ROM. The desired object is achieved: the jump address and the relevant ROM state are implemented simultaneously, to all intents and purposes.

There is no need, by the way, to worry about the ROMs when writing to memory, because written data always goes to RAM. It is therefore printer, eliminating any that might produce undesirable effects. This can arise, for example, when a data stream contains VDU control codes that would mean something different to the printer in use. All that is needed is a change of the entry jump so that it accesses user code, that code performing the necessary vetting process, and then calling the original routine. Small wonder that those in the know have been calling the CPC464 'Hacker's Delight'!

Once again, it would not be feasible to go into full detail here, but the temptation to cite some examples is too strong to be resisted; possible to write to screen memory at any time. To maintain a constant flow of data to the screen, the necessary accesses to screen memory are interlaced with ROM accesses.

So this sets up a nice system which achieves an apparent 50% increase in memory size with minimum hassle. But the system goes further. The lower ROM holds the operating system, while the upper ROM is the 'language' ROM, usually a BASIC interpreter. In theory, up to 251 alternative ROMs, each of 16K, can be switched in to replace the normal upper ROM. These sideways ROMs are not contained within the main unit, but are accessed through the extension bus. They can be entered by another 'pseudo op-code', known as FAR CALL. It takes the form DF XX XX YY. XX XX defines the entry address, YY can select a particular ROM or change the ROM state to enable or disable the upper and lower ROMs.

It would be impossible to go into all the aspects of this system here, but enough has been said to show that the CPC464 is something of a wolf in sheep's clothing.

PATCHABLE JUMPS

The extra documentation also revealed a massive list of more than 200 operating system calls, each one accessed by a link set in RAM. It is therefore possible to patch these calls to introduce user code. This has many uses. For example, it is sometimes desirable to vet the character codes passed to a possible to write to screen memory at any time. To maintain a constant flow of data to the screen, the necessary accesses to screen memory are interlaced with ROM accesses.

So this sets up a nice system which achieves an apparent 50% increase in memory size with minimum hassle. But the system goes further. The lower ROM holds the operating system, while the upper ROM is the 'language' ROM, usually a BASIC interpreter. In theory, up to 251 alternative ROMs, each of 16K, can be switched in to replace the normal upper ROM. These sideways ROMs are not contained within the main unit, but are accessed through the extension bus. They can be entered by another 'pseudo op-code', known as FAR CALL. It takes the form DF XX XX YY. XX XX defines the entry address, YY can select a particular ROM or change the ROM state to enable or disable the upper and lower ROMs.

It would be impossible to go into all the aspects of this system here, but enough has been said to show that the CPC464 is something of a wolf in sheep's clothing.

PATCHABLE JUMPS

The extra documentation also revealed a massive list of more than 200 operating system calls, each one accessed by a link set in RAM. It is therefore possible to patch these calls to introduce user code. This has many uses. For example, it is sometimes desirable to vet the character codes passed to a printer, eliminating any that might produce undesirable effects. This can arise, for example, when a data stream contains VDU control codes that would mean something different to the printer in use. All that is needed is a change of the entry jump so that it accesses user code, that code performing the necessary vetting process, and then calling the original routine. Small wonder that those in the know have been calling the CPC464 'Hacker's Delight'!

Once again, it would not be feasible to go into full detail here, but the temptation to cite some examples is too strong to be resisted;

A call to B900 will enable the upper ROM, returning the previous ROM state in the A register. A call to B906 will perform a similar service for the lower ROM.

A call to B903 will similarly disable the upper ROM, while a call to B909 will disable the lower ROM. Again, the previous ROM state is returned in A.

A call to B90C, with A set to the value produced by the calls described above, will restore the previous ROM state.

A call to BC7A will reset the Sound Manager and the sound chip. That can be very handy on occasion! If you find the BASIC sound control system tedious, and you know how to control the AY -3-8910 sound chip, you need a call to BD34 with A holding the number of the register you want to set and C holding the data you want to send.

DEVPAC

To make full use of these facilities, you really need an assembler, a disassembler and a monitor. Lo and behold, AMSOFT can supply your needs, with a Hisoft DEVPAC adapted to the CPC464. We have not been able to try this out in full, but the associated manual makes us impatient to do so.

It will be evident by now that the CPC464 is really a machine for the machine code enthusiast, while remaining quite docile enough for a beginner. This highlights a difficult problem facing manufacturers. Should they aim their design at one market or the other? This is perhaps more a question of documentation and advertisement than of the actual hardware. Many apparently quite simple machines have a lot of hidden virtues, which are sometimes put to good use by professional programmers, while the actual users remain blissfully unaware of the complications they are calling up. Those who sell the machines may well have even less understanding of the hidden parts, and the machines must first be sold to people like that, before the general public have a chance to make a decision.

Had the CPC464 been offered as a 'Hacker's Special', it might never have reached the public at all. Yet it is being snapped up mainly by experienced users, rather than first-timers. Printer cables have been more in demand than printers, suggesting that many buyers have printers already.

The 'Concise Firmware Specification', an AMSOFT publication, will also be in great demand once its existence becomes known. Of daunting size, it lists all the operating system facilities and explains the working of various parts of the system, using a professional format and a presentation that would by no means disgrace a minicomputer manufacturer.

There is also the BASIC Reference Manual, which describes and specifies the BASIC system in more formal terms — and more completely — than does the User Instructions book.

Even more documentation is on the way, but that is still in the pipeline, and not for the public gaze as yet.

As its full capabilities emerge, the CPC464 looks more and more like the prototype of the micro of the future. The hardware is incredibly economical, and the main virtues stem from the firmware. That is more likely to produce good results than complicated hardware systems backed by slapdash software.

Bill Horne , Computing Today

★ YEAR: 1985
★ AUTHOR: Bill Horne
 

★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Coding » Clefs pour Amstrad 2 : 10 - Cpm22 Carte Memoire
» Coding » Clefs pour Amstrad 2 : 10 - Cpm22 Organisation Memoire
» Coding » Les Notions en Mémoires
» Coding » Structure de la mémoire écran de l'Amstrad CPC par ANTIBUG
» Coding » Memory Addresses of Amstrad CP/M
» Coding » La page pédagogique d'hebdogiciel 127: La Memoire
Je participe au site:

» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.732-desktop/c
Page créée en 278 millisecondes et consultée 416 fois

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.