Difference between revisions of "Programming:Unlocking a protected basic file"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(Created page with 'You can protect a basic program by saving it with save"filename",p You can still '''run"''' a protected basic file, but can't '''load"''' and list it. There is a way to unlo…')
 
Line 5: Line 5:
 
You can still '''run"''' a protected basic file, but can't '''load"''' and list it.
 
You can still '''run"''' a protected basic file, but can't '''load"''' and list it.
  
There is a way to unlock these basic files. This only works on a CPC 464 (real machine or emulator).
+
That is, after LOADing, the program is automatically deleted when returning to the BASIC prompt. Same applies when stopping a RUNning program via ESC key.
 +
 
 +
== CPC464 Workaround ==
 +
 
 +
There is a way to unlock these basic files. This only works on a CPC 464 (real machine or emulator). The used addresses are 464-only (AC01h..AC02h=BASIC RAM, C064h..C090h=BASIC ROM).
  
 
Type this:
 
Type this:
Line 17: Line 21:
  
 
Now you can '''list''' this program.
 
Now you can '''list''' this program.
 +
 +
== CPC664/6128 Workaround ==
 +
 +
Below installs a resident Fast Ticker handler at BE00h. It resets the "protected file flag" once every 300Hz.
 +
10 FOR i=&BE00 TO &BE0F: READ a$: POKE i,VAL("&"+a$): NEXT
 +
20 CALL &BE00: NEW
 +
30 DATA 21,10,be,11,0b,be,06,81,c3,e0,bc,af,32,2c,ae,c9
 +
In the 664/6128/Plus, that flag is at AE2Ch. For the 464, it would need to be changed to AE45h, or, use the simplier POKE AC0Xh method on CPC464.

Revision as of 07:21, 15 April 2010

You can protect a basic program by saving it with

save"filename",p

You can still run" a protected basic file, but can't load" and list it.

That is, after LOADing, the program is automatically deleted when returning to the BASIC prompt. Same applies when stopping a RUNning program via ESC key.

CPC464 Workaround

There is a way to unlock these basic files. This only works on a CPC 464 (real machine or emulator). The used addresses are 464-only (AC01h..AC02h=BASIC RAM, C064h..C090h=BASIC ROM).

Type this:

poke &ac02,&90
poke &ac03,&c0
poke &ac01,&c3

then load" the protected basic file. Done.

Now you can list this program.

CPC664/6128 Workaround

Below installs a resident Fast Ticker handler at BE00h. It resets the "protected file flag" once every 300Hz.

10 FOR i=&BE00 TO &BE0F: READ a$: POKE i,VAL("&"+a$): NEXT
20 CALL &BE00: NEW
30 DATA 21,10,be,11,0b,be,06,81,c3,e0,bc,af,32,2c,ae,c9

In the 664/6128/Plus, that flag is at AE2Ch. For the 464, it would need to be changed to AE45h, or, use the simplier POKE AC0Xh method on CPC464.