Bar-CPM to execute a file (The Amstrad User)Applications Disque
★ 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 ★ 

Many readers have asked whether it is possible to run a file by issuing the |CPM command. As if that weren't enough of a challenge, others have requested a routine that runs a Basic file when you type |CPM. After several late nights this is the result:

When you type |CPM much of the system is shut down: interupts disabled sound output stopped, external roms disabled and memory from &100 to the beginning of the Basic variable area filled with zero-bytes. The surprising thing is that most of Basic's variables and the firmware remain intact. Then the contents of track 0, sector &41, load in at location &100 - the boot sector. A jump to this address follows.

With this knowledge it should be a simple matter to write a routine that executes from &100 and resides on the boot sector. The tricky part is loading and running a Basic file from machine-code. This is the shortest and simplest method I could think of:

Basic starts at &170

Problems arise when trying to load and run Basic files. As there are three versions of Basic the first thing to do is discern which version you're using. Simple. CALL &B915 will return the ROM version in the H register.

I found it possible to load and run Basic programs on the 464 with no strings attached using the |CPM command. The 664 and 6128 are a different kettle of fish: locations &AE00 to &AE70 hold crucial data concerning the Basic file. These are reset when |CPM is entered. If you follow these steps then all will work correctly:

  • load the Basic file you wish to run when you issue the |CPM command
  • save the file "BASVARS",B,&AE00,&70
  • enter the assembly listing
  • save the object code by using the Basic listing
  • make sure the Basic file you wish to run from |CPM is called "MENU.BAS"

Below is the Basic program that will save the object code (as long as it's loaded at &6000) onto the boot sector:

10 DATA 21,19,40, CD, D4,BC,22,1A, 40
20 DATA 79,32,1C,40,21,00,60,11,00
30 DATA 00, 0E, 41,DF, 1A, 40,C9,85,00
40 DATA 00,00,00
50 FOR t=&4000 TO &401D
60 READ a$: POKE t,VAL("&"+a$)
70 NEXT: CALL &4000


★ PUBLISHER: The Amstrad User (Australia)
★ YEAR: 1987
★ CONFIG: ???
★ AUTHOR(S): ???

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