APPLICATIONSPROGRAMMATION ★ Inside Arnold ★

Inside Arnold|Popular Computing Weekly)Applications Programmation
★ 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 ★ 

Take a peek inside the depths of the Amstrad ROM with Colin Harris from Nemesis Software.

It is interesting to note that although the CPC 464 has been readily available since July, the reports of 'bugs'have been very few. Indeed the only mention I recall is the absence of an explanation of the operator 'Mod'in the Handbook, but that doesn't really count. The traditional welcome to a new computer is the 'bug' report. Is the absence of these some kind of dubious acolade for the Amstrad? Notably, however, there has been more than one complaint that owners are unable to nose through the Operating System, more simply the ROM.

The ROM in the CPC464 is split into two sections. One section of 16K occupies addresses 0-3FFF(HEX) almost, anyway. The upper ROM occupies C000-FFFF(HEX). and in doing so overlays the screen RAM. The lower ROM overlays part of the user RAM. This arrangement with clever switching releases the maximum possible area to user Ram during Basic operations. It is because of this that the ROM seems to be inaccessible to the Basic user. There is a one line program for the Dragon to produce a Hex or Character Dump of the ROM No such simple method will work with the Amstrad.

In complete contrast to other computer manufacturers, Amstrad have made a wealth of information available to the user. The Complete ROM Disassembly of Micro X is often the eagerly awaited independent publication appearing long after the introduction of the computer. Amstrad's The Complete Firmware Specification (Ref. Soft 158), was available, in theory at least, from day one. This publication fully explains all the routines in the ROM that one could possibly want to use, and more! In here are the routines that will enable the Assembler Programmer to solve the problem. Obtusely enough, if you have a halfway decent Assembler package, you will not need a program to produce a Hex or Character dump; the Assembler/Disassembler probably has it built-in. In any case a Disassembly of the ROM is of much greater value. Nevertheless, to assemble this program gives one useful experience of the Amstrad's ROM routines and this of course leads to a Basic program to enter the code. Listing B is the assembly list. Listing A is the program for those without an assembler.

Listing A — The Basic Program

Type in the Basic program exactly as listed, paying special attention to the Hex numbers. The letters 'a to f which are used in the hex system are shown in lower case, as this way one is less likely to confuse B with 8. etc. Having entered it make a copy on tape before running it. If all is well the program will Poke the code into reserved Ram, and the screen will invite you to Call the program. If you have made an error in entering the data, you will have to check it and rectify the error. Check first that each data statement (the last has 11 only) contains 32 sets of hex numbers. When you have located your error(s!) re-save the program and try again. Now see the notes on using the program. The machine code program can now be saved to tape by: Save "HILOROM", B, 41656, 971, 42001.

Call 42001 executes the program. Define a key to do this as in Line 30 of the Basic program.

Program Notes

  • Line 26 sets Ramtop.
  • Line 36 defines the numeric keypad dot to call the machine-code program.
  • Lines 46-76 convert the hex numbers read from data to a form that is poked into the reserved RAM. Also a checksum is generated to virtually ensure that only a correct entry is offered to run.
  • Line 106 holds the message from Line 90 on the screen for long enough to be read, then the Basic program self-destructs, leaving the machine-code in reserved memory.
  • Lines 116 to 410 contain the data representing the machine code.

Listing B — the Assembler Listing The assembly listing was not written to be a model of assembly programming, nor to be the most efficient method or even a structured method. It was written to investigate the use of ROM routines and as such it is worth examination. It undoubtedly will extend to a full blown monitor. If you attempt this you will discover that the Concise Firmware Specification has everything you need

Program Notes

  • Lines 5-256 define the text for a simple menu and label some ROM routines for the program proper.
  • Lines 260-880 place menu to screen using colours and pass to Line 1680 (Holdup). Holdup awaits input and then passes control to the appropriate routine. You should be able to follow from there the routines for outputring the hex-dump and character dump. Note the highlighting of Ascu-characters in the dump, by use of colour changes. The ROM routines used (with their official names) are:
    • #BB5A Txt Output — Outputs a character or control code to the text VDU.
    • #BB18 Km Wait Key — Waits for next key from the keyboard.
    • #BB1B Km Read Key — As #BB18 but doesn't wait
    • #BB90 Txt Set Pen — Set ink tor writing colours.
    • #B900 K1 U ROM Enable - Turn on the-Upper ROM.
    • #B903 K1 U ROM Disable —Turn off the Upper Rom
    • #B906 K1 ROM Enable — Turn on the Lower ROM.
    • #B909 K1 L Torn Disable —Turn off the Lower ROM.
    • #BB75 Txt Set Cursor Set cursor position
    • #BB7E Txt Cur Disable —Disallow cursor display.
    • #BB5D Txt Wr Char Wnte a character to the screen—control codes are printed and not obeyed.
    • #BB03 Km Reset — Reset key manage, clear all buffers, restore standard key expansions and indirections


Using the Program

When initiated the program offers a Menu. First press Caps Lock and then press the letter corresponding to the memory you wish to examine.
L will be in the hex and character dump of Low ROM from address 0 (it actually starts somewhat later) to #3FFF. It will stop at the end and return to Menu. H will similarly deal with the High ROM ending at #FFFF. R deals with all Ram up to #BFFF (the memory that follows is the default screen memory).

Enter will stop the display to allow closer inspection. Also whilst 'stopped'you have the option to rapidly advance the memory display in increments of 256-bytes by pressing I When the indicator reaches the desired address press C to continue. Alternately E will return to Basic or 0 will return
Menu. Enter will resume display and scroll.

Screen Display

From left to right the screen display consists of: Hex Address; eight hex values (the first corresponds to the Hex Addr. The remainder correspond to the previous address plus 1).
These are then followed by the character representation of the hex values. The next line increments the address by 8 and so on.
The hex dump is interesting, as it displays text embedded in the operating system. In Low ROM you will discover after the titles some strange names Schneider for example. Even Arnold, the pet name for the machine, is mentioned. High ROM lists all the error codes. Well, have a look and see!
Potentially the Hex-dump can be very useful. Look for C9 (this is a return instruction) — the codes following this may well be the start of a useful sub-routine.

Within the bounds of a small article and one simple program, many points will go unmentioned — much will be oversimplified.
I hope to have given you a new slant to your machine without incurring too many 'tuts tuts'from those that know more, and those that know better!

PopularComputingWeekly841206

★ PUBLISHER: POPULAR COMPUTING WEEKLY
★ YEAR: 1984
★ AUTHOR: Colin Harris

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 948 millisecondes et consultée 738 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.