CPCWiki forum

General Category => Programming => Topic started by: ssg on 00:52, 16 August 20

Title: A novel way to protect BASIC programs on CPC464
Post by: ssg on 00:52, 16 August 20
This is something I discovered myself while brute forcing everything in BASIC interpreter back in the 80's, so I think nobody else had known it before me.

You probably know how a program listing is shown only with its first line:


LIST
10 'CRACKED BY SSG
Ready


That's done by fiddling with the line length bytes of the first line (&170, &171). That was well known back then.

My technique was to add a REM line with Ctrl+F and add another dummy line, because Ctrl+F caused skipping the next line.


10 'CRACKED BY SSG
20 '✓
30 'Dummy line
40 ' Some secret code


Normally it lists fully, but after you ran the program once this is what you'd see:


10 'CRACKED BY SSG
20 '✓


AFAIK, it only worked with BASIC 1.0 though. And you had to make sure that you'll never need to access the code again because it was hard to recover from (you had to find that byte and overwrite it).

Another interesting side effect of this was that if you wrote '✓ directly, it would run the program. Magic! :)

What I want to know is if this technique was already discovered by someone else before 1989. Otherwise, I'd like to call dibs! :)
Title: Re: A novel way to protect BASIC programs on CPC464
Post by: Johnny Olsen on 11:23, 16 August 20
I've never heard of that ctrl + f trick, but it's an easy way to remove the line length on the next line.
Congratulations with DIBS.  :)
Title: Re: A novel way to protect BASIC programs on CPC464
Post by: ssg on 22:31, 17 August 20
I've never heard of that ctrl + f trick, but it's an easy way to remove the line length on the next line. Congratulations with DIBS.  :)

Yay! :)
Title: Re: A novel way to protect BASIC programs on CPC464
Post by: GUNHED on 02:46, 18 August 20
Remember that an similar thing was used to autorun programs after a CAT command. However it needed a slight ROM patch. Similar, but not the same technique IIRC.  :)
Title: Re: A novel way to protect BASIC programs on CPC464
Post by: Gryzor on 14:18, 18 August 20
Send it in to AA :D
Title: Re: A novel way to protect BASIC programs on CPC464
Post by: TotO on 14:47, 18 August 20
I do remember to have see some protected commercial BASIC "loader" with some control chars into the listing, but not sure about the real usage.