Rom - With a View (Amstrad Computer User)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 ★ 

Master Nick Hutton takes a walk around the internals of the CPC.  

Have you ever wondered exactly what is in your CPC? Unlike most of the more expensive computers, the Operating System or BASIC of the CPC is waiting for you when you switch on. There is no need to insert a Boot disk every time you power up, so the BASIC must be on a chip or ROM.

Wouldn't it be interesting to see just what is on that chip?, oh well in that case I won't bother.

No seriously, it can be very helpful to see how the ROM is made up. Still don't believe me? Have a look at this:

10 FOR t=&9000 to &900A: READ A$:POKE t, VAL ("&"+a$) 
20 NEXT: CALL &9000: a-PEEK (&900A): PRINT a
30 DATA 0e, 00, cd, 15, b9,7c, 32,0a, 90, c9,00

Here's the DATA statement in Z80 mnemonics.

LD C,&00 ; Address of the ROM wewant to look at
CALL & B915 ;The ROM routine which does the checking up
LD A,Hs ;Hold the version number in A, not the type number
LD (&900A),A ;Insert the version number at &900A
RET ;Back to BASIC

This short program will print a 0 to the screen if your machine is a 464, a 1 if it is a 664, and a 2 if it is a 6128. how does it know? It checks up on the ROM to see which version is installed. The outcome of the check is a couple of numbers generated by the ROM routine at &B915. We then extract the version number, this number is poked into location &900A A simple peek will then give the ROM version number.

This is just one example, but being able to look at the ROM often comes in handy. My program will allow you to view the contents of ROM in either ASCII (text) or Hexidecimal (numerical) format.

To put the program to proper use you must first understand a little about how the ROM is arranged in the Amstrad. Basically it is split into two parts.

1. The Lower ROM, which contains the various control routines, maths routines and handles character generation. It is also home to the Kernel and Jumpblock among other important routines. The Lower ROM is the heart of the machine.

2. The Upper ROM. This section of ROM contains the BASIC interpreter and keyword handling routines, for example the address &C8CB holds the "ON BREAK" routine. This part of ROM could be termed as the brain of your machine.

By the way CPC ROMS come in three flavours:

464 40009 (bon)
664 or 40022 (savourex)
6128 or 40025 (delicieux)

Now you know about ROMS I'll move on to the workings of my listing. Like my previous programming efforts you are given a menu to choose from. It isn't quite "a la carte" but it beats typing in separate commands yourself.

Option 1 allows you to specify where the piece of ROM being viewed will appear. At the prompt "Enter Output Device" you are asked by the program where to put all the information it is about to read. Enter 0 if you want it to appear on screen or 8 if you want the contents of ROM to be directed to printer. Please ensure that option 1 is set before you start to look at the ROM as my program assumes the information should go to the screen if no value is specified.

Option 2 is the first of the actual ROM dumping routines and it displays the contents of the Lower ROM in ASCII format.The Lower ROM actually starts
at &0000 and finishes at &3FFF. If at any point during the reading of ROM you wish to stop the program then just press ESCAPE twice and run the listing again. Remember to reselect option 1 if you want to change the output from screen before choosing another option. Option 2 will be helpful if you are looking for a message located in the Lower ROM, like the "Welcome" or copyrite text.

Option 3 lets you look at the same area of memory but presents the data in Hexidecimal format.

Option 4 will show you the Upper ROM in ASCII format. This subroutine could be useful if you are looking for the position in memory of a particular BASIC keyword or routine. The Upper ROM begins at &C000 and finishes at &FFFF in memory.

As with the other ROM dumping routines this one can be displayed in either ASCII or Hexidecimal (option 5) format.

Selecting number 6 from the menu will reset the computer and subsequently all programs in memory will be lost.

As it stands the program can dump the contents of ROM to either screen or printer, but with a little effort and the addition of a few "OPENOUT" and
"PRINT#9" commands it is possible to put the contents of ROM onto Disk, or Tape, if you so wish.

I have included a short list of useful calls which should come in handy in many a BASIC program. Also you will find the data statements used in the program in their original form (mnemonic).

I hope you'll find investigating the ROM interesting, and who knows, perhaps even useful!

List of useful firmware calls:

Calling these addresses-will have the following effect.

&BB18 ;Wait for a key to be pressed
&BBFF ;Reset INK, MODE and BORDER colours
&BCB6 ;Kills all sound immediately
&BCB9 ;Restarts the sound again
&BC14 ;Clears the screen
&BC6E ;Turns the tape motor on
&BC71 ;Turns the tape motor off

Here are the ROM reading DATA statements in mnemonic form:

Reading the LOWER ROM

DI ;Disable any interrupts
CALL &B906 ;We want to look at the LOWER ROM
LD HL,&0000 ;Where it starts
LD DE,&6000 ;A running total, connected with the LDIR bit
LD BC,&3FFF ;How much do we want to read
LDIR ;Keep reading until we've finished
RET ;Back to BASIC

Reading the UPPER ROM

DI ;Disable any interrupts
CALL &B900 ;We want to look at the UPPER ROM
LD HL,&C000 ;Where it starts
LD DE,&6000 A running total, connected with the LDIR bit
LD BC,&3FFF ;How much we want to read
LDIR ;Keep reading until we're finished
RET ;Back to BASIC

ACU #9007

★ YEAR: 1990

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