CODINGROM ★ A Guide to EPROMs on the CPC with Ian Neill - Part. 4 ★

A Guide to EPROMs on the CPC (4/4)
★ 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 ★ 

I'm back! Not content with boring you with technical mumbo-jumbo for the past lot of months, I'm back with yet more. In this issue I will describe how to put a BASIC program, with tachine code, into an EPROM. As I created this EPROM, for Dick Hornsby in London, I thought "cake notes, there's an article in this". So here it is.

This is a problem you will never encounter if you are putting stand alone programs into EPROMS. However it must be "fixed" in any BASIC or machine code programs that have to go into the EPROM.

Watch out for BASIC loaders that load in a binary file that contains RSX's. The RSX's must still be "logged-on" by calling the machine code. In a case like that, only the bit of program that loads the RSX's from disc should be removed.

The EPROM loader copies all the programs in a multi-program program to RAM, but only RUNs the main program.

How to RUN a BASIC program from machine code? This is a fairly fundamental requirement, and isn't nearly as simple as RUNning a machine code program. Essentially what we have to do is copy the program to RAM, set up some of BASICS variables, and then convince BASIC that "RUN" was typed. This is how to do it:

;I did not write all of this code - I
;put it together from other programs
;I found lost of the details and
;explanations in the Print-Out
;Firmware Guide

ld hl,basstart ;BASIC program start address in the EPROM
ld de,&0170 ;ALL BASIC start here
ld bc,baslength ;Length BASIC program
ldir ;Copy from EPROM to RAM DE will contain the address of the 1st location after the end of the BASIC program
ld (&ae66),de ;Addr end BASIC prog *
ld (&ae68),de ;Addr start variables and DEF FN's area *
ld (&ae6a),de ;Addr of start of ;arrays area *
ld (&ae6c),de ;Addr strt free space *
ld hl,basrunner ;Routine to RUN BASIC progran must be copied to RAM
ld de,&0060 ;Safe place to put code
ldir ;Copy it to RAM

;Any machine code files needed by the BASIC would be copied to RAM here

jp &0060 ; jump to BASIC prog RUNner


basrunner ld c,&00 ;Point to ROM 0
call &b90f ;Enable the ROM at position 0 (BASIC)
ld hl,&00b0 ;Put &00b0 in register HL - why?
ld (hl),&00 ;Store &00 in the addr pointed to by HL why?
jp &ea78 ;Where BASIC's RUN command is stored in the BASIC ROM

* These addresses are for the 664 and 6128 - of course the 464 is different. For the 464 use the following:

ld (&ae83),de ;Addr end BASIC prog
ld (&ae85),de ;Addr start variables and DEF FN's area
ld (&ae87),de ;Addr start arrays area ld (&ae87),de ;Addr start free space

I have no idea what addresses to use on the plus machines.

This address is for the 6128 only.

For the 464 use the following:

jp &e9bd ;Where BASIC's RUN command ;is stored in the BASIC ROM

For the 664 use the following:

jp &ea7d ;Where BASIC's RUN command ;is stored in the BASIC ROM

I have no idea what address the plus machines use.

The "basrunner" routine oust be copied to RAM. This is because it enables another ROM and juips to a location in it. If the routine stayed in RON it would disable itself in mid-flight!


Figure 8 is the ROM loader for programs a, b and c. This is similar in appearance (except for the BASIC RUNning bits) to the DOSCOPY ROM loader of the last article.

Towards the end you will see the references ("LABELS") to where the BASIC and machine code programs are stored, and to the final length of the EPROM image. Take a note of the assembled values of these labels.

(This code was written using MAXAM, so the "DUMP" command at the end will cause all labels etc. to be displayed.)


We have quite a few things to be put in the EPROM - the ROM loader code, and the three programs.

So far the info we have gathered for our programs is:

Load StartLengthROM add

The overall EPROM length is &2f1c

Using this info we can write a stall BASIC program to build the image in RAM and then save the whole lot to disc. The final image on disc is the one sent to an EPROM programmer and blown into an EPROM. The following listing is the BASIC EPROM Builder that I used:

10 'Hornsby EPROM builder
20 MEMORY &3fff :'The image will be built from addr &4000
30 LOAD"hornsby.bin",&4000 :'The ROM loader code (what figure 8 assembled into)
40 |LOAD"c.bas",&415e:' Note,"|LOAD" is a UTOPIA command
50 |LOAD"d3.bas",&4dbb
60 LOAD"discode.bin",&5b1c
70 SAVE"hornsby.rom",b,&4000,&2f1c, &c006
80 END


1. "|LOAD" is a UTOPIA command which will load any file, even BASIC, to any location.

2. The file addresses are &8000 less than what they vill be in the EPROM. This is because we are building the image at &4000, which it &8000 less than &C000 (where the EPROM will eventually live).


Nothing! Unless I get requests for follow-up articles this is the last one on EPROMs. Good luck.....

This is not as bad as it may sound because there just isn't a lot left to talk about concerning EPROMs - unless you start getting specific. I am willing to put a few tore articles together tackling specific EPSON related projects - I already have a RAMROM project, among others, brewing (all on a very slow backburner). Let me know if you want to see things like this in print.


If you have any problems do contact me



★ AUTHOR: Ian Neill

Page précédente : A Guide to EPROMs on the CPC (3/4)

» WACCI103-A  Guide  to  EPROMs  on  the  CPC    LISTINGDATE: 2021-02-02
DL: 56 fois
SIZE: 101Ko
NOTE: 1 page/PDFlib v1.6

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

» Coding Src's » Disassembly of AMSDOS ROM
» Coding » Clefs1 29 Adr Hirom 464
» Coding » Wacci CRTC (1/2)
» Coding » A Guide to EPROMs on the CPC (3/4)
» Coding » Clefs1 55 - Annexes - Adresses Principales De La Rom Superieure du CPC664
» Coding » Adresses principales de la ROM inférieure CPC 6128
Je participe au site:
» Pour ce titre nous ne disposons de fichier executable sur CPC, alors si vous avez ça dans vos cartons ou vous désirez usé vos petit doigts boudinés sur votre clavier faites le nous savoir.
» Vous avez des infos personnel ?
» 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 678 millisecondes et consultée 320 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.