★ APPLICATIONS ★ PROGRAMMATION ★ WITH A VIEW ★ |
ROM - With a View (Amstrad Computer User) | Applications Programmation |
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$) Here's the DATA statement in Z80 mnemonics. LD C,&00 ; Address of the ROM wewant to look at 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) 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 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 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 Here are the ROM reading DATA statements in mnemonic form: Reading the LOWER ROM DI ;Disable any interrupts Reading the UPPER ROM DI ;Disable any interrupts
|