APPLICATIONSDIVERS ★ REEL-TO-REEL ROM (MAKE ROM COPY) ★

REEL-to-REEL ROM (make ROM COPY)Applications Divers
★ 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 ★ 

A short program allowing you to copy your CPC464 's ROM to tape -written by Peter Paton

Many Amstrad users have come up with routines for Peeking the Rom's in the CPC464. This short program takes the idea one step further, in that it also saves a memory image of the ROM on cassette.
It is not possible to Peek the Rom's directly from Basic for reasons which are beyond the scope of this short article; suffice it to say that we must resort to a small machine code routine which enables the ROM to be Peeked, and creates a memory image in lower Ram where it can be accessed easily.
On first running the program you will be presented with an option to copy either the upper or lower ROM. Selection is made by pressing either 'U' or 'L' in either upper or lower case. The memory image of the ROM takes only a second or so to produce, and a suitable message is displayed to tell you that this has been completed.

You will then be instructed to insert a blank cassette and press the Play & Rec keys on the cassette unit, and then any key to make the tape copy. This saves eight blocks of code which are named Upper ROM or Lower ROM depending on which you are copying.
The machine code routine employs one of the many advanced features of the Z80 CPU, the Ldir instruction, and works as follows (see Listing One).
Ldir takes the contents of the address held in the HL registers and places the byte in the address held in the DE registers. Both HL and DE are then incremented, and the value held in the BC registers is then decremented. This sequence continues until the value of the BC registers becomes zero.
This is one of the best ways of demonstrating the speed with which machine code is able to copy an entire 16k block of code, and the economy of code as it all takes just 18 bytes .

As for the rest of the program goes (Listing Two), I have tried to make use of some of the easier features of Amstrad Basic, particularly those which help to make screen layout neat and tidy, especially the Locate command and the control characters 18 and 20. Chr$(18) clears the current screen line from the cursor position to the right hand edge of the window, and Chr$(20) clears from the cursor position to the end of the window. These can be used to good effect for removing screen messages and prompts which are no longer needed. I have also used Chr$(24) which prints a message in reverse field for highlighting.
In Line 140 I have used the INSTR function, another powerful Basic command which enables the detection of a sub-string within a longer string. In this case it detects the position of either U or L in answer to the first prompt, and directs the program to the proper Data statement in order to select the right machine code routine.

One of the more convenient features of Amstrad Basic is the ability to convert lower case letters to upper case with the Upper$ function (sadly missing in many machines.) As used in Line 90 it will accept both upper and lower case in answer to the prompt.

For those who are not familiar with the method of saving a block of memory to cassette see Line 260:

Save "!"+ t$,b,5000,16384

This will save a block of code with the filename held in t$ starting at address 5000 decimal, and 16384 (16K) bytes long. The exclamation mark after the Save turns off the regular Amstrad cassette messages, and so allows me to use my own messages in Lines 190-200. If you use this in your own programs you must remember that it does not wait for a key to be pressed either, consequently if you don't start the cassette in time you may miss saving the first pan of the file, (however, line 210 takes care of this problem).

Once the Rom's have been copied to the cassette by this programme you will be able to examine them under a disassembler. Remember though when you are looking at the code, that it is not in its rightful place, so an instruction to jump to a specific address should actually be given an offset according to which ROM image you are looking at, and the address at which the code was loaded into the disassembler. For example, if you are examining an image of the lower Rom, and you have loaded the code at address #5000, then when you look at address #5000 you are actually looking at address #0000.

Program Notes:

30-120 Select the ROM to be copied (Upper or Lower)
140 Select the appropriate machine code routine
150-160 Print message to confirm that a ROM has been copied
170-270 Save ROM image to cassette (Fast speed used)
290-320 Option to re-run and copy other ROM
340-370 Poke machine code into Ram and CALL it
380 Return to main program after copying ROM
390-440 DATA containing the machine code routine


The CALL &BB18 instruction in Line 210 halts program execution until any key has been pressed.
In order to load the machine code into Ram it is necessary to lower the top of useable RAM, this is however reset to its usual value when you select the option to quit the program.
This is one of those rare programs which, at least in theory, get used only once. However, knowing the peculiarities of the Amstrad cassette unit, I would not advise you to throw it away. You never know when the dreaded Read Eroor will strike again!

Listing One

CALL #B900 ; Enable the UPPER ROM to be accessed.
LD BC,#4000 ; Load the BC register pair with the block ength
LD HL,#C000 ; Load the HL register pair with the start address
LD DE,#1383 ; Load the DE register pair with the destination
LDIR
CALL #B903 ; Disable the UPPER ROM

Popular Computing Weekly 85-01-31

★ PUBLISHER: Popular Computing Weekly
★ YEAR: 1984
★ CONFIG: ???
★ LiCENCE: LISTING
★ LANGAGE: ???
★ AUTHOR: Peter Paton

★ AMSTRAD CPC ★ DOWNLOAD ★

File:
» Reel-to-Reel  ROM    ENGLISHDATE: 2016-08-02
DL: 252
TYPE: ZIP
SiZE: 4Ko
NOTE: Extended DSK/40 Cyls
.HFE: Χ

Type-in/Listing:
» Reel-to-Reel  ROM    ENGLISH    LISTINGDATE: 2011-07-18
DL: 136
TYPE: image
SiZE: 233Ko
NOTE: w855*h1132

Dump cassette:
» Reel-to-Reel  ROM    ENGLISHDATE: 2016-07-29
DL: 237
TYPE: ZIP
SiZE: 3Ko
NOTE: Uploaded by Anonymous ;
.HFE: Χ

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

Lien(s):
» Coding » Création d'une ROM sur CPC (Masterglob)
» Coding » De port en port : Programmation directe du clavier (Micro-Mag)
» Coding » A Guide to EPROMs on the CPC (4/4)
» Coding » De port en port : Programmation du contrôleur de disquettes à travers les ports [2/2] - Formatages de Pistes (Micro-Mag)
» Coding Src's » Dump ROM Multiface II (Grimware)
» Coding » L'assembleur en Douceur (4/x) : Etude des différentes bases par l'hexadécimal et le B.C.D. (Micro-Mag)
Je participe au site:
» Vous avez des infos personnel, des fichiers que nous ne possédons pas concernent ce programme ?
» 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.7-desktop/c
Page créée en 233 millisecondes et consultée 2674 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.