How did Apple ][ basic programs protect against listing?











up vote
1
down vote

favorite












I seem to recall from my high-school days that certain Apple ][ programs protected themselves from being listed and therefore modified.



If you tried to do it, the machine would simply reboot.



How did they achieve this, and can it be bypassed to get at the code?










share|improve this question


















  • 1




    Mind to explain why you write a question when you already seam to know the answer?
    – Raffzahn
    6 hours ago






  • 3




    @Raffzahn, because that's actually accepted practice and has been for quite a while (I suggest you have a read of retrocomputing.stackexchange.com/help/self-answer) - the idea of SE is to create a repository of good questions and answers for future searchers, not just to get your immediate problems solved. It appears that you yourself have taken advantage of this (retrocomputing.stackexchange.com/questions/6006/…) so I'm unsure why you think that makes it a bad question..
    – paxdiablo
    6 hours ago








  • 2




    In addition, as you extended the comment, yes, I did answer my own question but if you take a closer look, I didn't do so to answer a fake question, but I waited about three month and then published my own findings during that time. The question is still open for a real answer. As before, research does help before typing.
    – Raffzahn
    5 hours ago






  • 1




    There are no personal attacks here, I'm calling out your behaviour and how it differs from accepted practice. If you see that as personal, that's on you. I would do the same to Atwood, Spolsky or Jon Skeet :-) Have the last word if you wish, I think the best thing I can do is move on.
    – paxdiablo
    5 hours ago








  • 2




    I think I need a drink after reading this...
    – manassehkatz
    5 hours ago















up vote
1
down vote

favorite












I seem to recall from my high-school days that certain Apple ][ programs protected themselves from being listed and therefore modified.



If you tried to do it, the machine would simply reboot.



How did they achieve this, and can it be bypassed to get at the code?










share|improve this question


















  • 1




    Mind to explain why you write a question when you already seam to know the answer?
    – Raffzahn
    6 hours ago






  • 3




    @Raffzahn, because that's actually accepted practice and has been for quite a while (I suggest you have a read of retrocomputing.stackexchange.com/help/self-answer) - the idea of SE is to create a repository of good questions and answers for future searchers, not just to get your immediate problems solved. It appears that you yourself have taken advantage of this (retrocomputing.stackexchange.com/questions/6006/…) so I'm unsure why you think that makes it a bad question..
    – paxdiablo
    6 hours ago








  • 2




    In addition, as you extended the comment, yes, I did answer my own question but if you take a closer look, I didn't do so to answer a fake question, but I waited about three month and then published my own findings during that time. The question is still open for a real answer. As before, research does help before typing.
    – Raffzahn
    5 hours ago






  • 1




    There are no personal attacks here, I'm calling out your behaviour and how it differs from accepted practice. If you see that as personal, that's on you. I would do the same to Atwood, Spolsky or Jon Skeet :-) Have the last word if you wish, I think the best thing I can do is move on.
    – paxdiablo
    5 hours ago








  • 2




    I think I need a drink after reading this...
    – manassehkatz
    5 hours ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I seem to recall from my high-school days that certain Apple ][ programs protected themselves from being listed and therefore modified.



If you tried to do it, the machine would simply reboot.



How did they achieve this, and can it be bypassed to get at the code?










share|improve this question













I seem to recall from my high-school days that certain Apple ][ programs protected themselves from being listed and therefore modified.



If you tried to do it, the machine would simply reboot.



How did they achieve this, and can it be bypassed to get at the code?







apple-ii copy-protection






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 6 hours ago









paxdiablo

1,088730




1,088730








  • 1




    Mind to explain why you write a question when you already seam to know the answer?
    – Raffzahn
    6 hours ago






  • 3




    @Raffzahn, because that's actually accepted practice and has been for quite a while (I suggest you have a read of retrocomputing.stackexchange.com/help/self-answer) - the idea of SE is to create a repository of good questions and answers for future searchers, not just to get your immediate problems solved. It appears that you yourself have taken advantage of this (retrocomputing.stackexchange.com/questions/6006/…) so I'm unsure why you think that makes it a bad question..
    – paxdiablo
    6 hours ago








  • 2




    In addition, as you extended the comment, yes, I did answer my own question but if you take a closer look, I didn't do so to answer a fake question, but I waited about three month and then published my own findings during that time. The question is still open for a real answer. As before, research does help before typing.
    – Raffzahn
    5 hours ago






  • 1




    There are no personal attacks here, I'm calling out your behaviour and how it differs from accepted practice. If you see that as personal, that's on you. I would do the same to Atwood, Spolsky or Jon Skeet :-) Have the last word if you wish, I think the best thing I can do is move on.
    – paxdiablo
    5 hours ago








  • 2




    I think I need a drink after reading this...
    – manassehkatz
    5 hours ago














  • 1




    Mind to explain why you write a question when you already seam to know the answer?
    – Raffzahn
    6 hours ago






  • 3




    @Raffzahn, because that's actually accepted practice and has been for quite a while (I suggest you have a read of retrocomputing.stackexchange.com/help/self-answer) - the idea of SE is to create a repository of good questions and answers for future searchers, not just to get your immediate problems solved. It appears that you yourself have taken advantage of this (retrocomputing.stackexchange.com/questions/6006/…) so I'm unsure why you think that makes it a bad question..
    – paxdiablo
    6 hours ago








  • 2




    In addition, as you extended the comment, yes, I did answer my own question but if you take a closer look, I didn't do so to answer a fake question, but I waited about three month and then published my own findings during that time. The question is still open for a real answer. As before, research does help before typing.
    – Raffzahn
    5 hours ago






  • 1




    There are no personal attacks here, I'm calling out your behaviour and how it differs from accepted practice. If you see that as personal, that's on you. I would do the same to Atwood, Spolsky or Jon Skeet :-) Have the last word if you wish, I think the best thing I can do is move on.
    – paxdiablo
    5 hours ago








  • 2




    I think I need a drink after reading this...
    – manassehkatz
    5 hours ago








1




1




Mind to explain why you write a question when you already seam to know the answer?
– Raffzahn
6 hours ago




Mind to explain why you write a question when you already seam to know the answer?
– Raffzahn
6 hours ago




3




3




@Raffzahn, because that's actually accepted practice and has been for quite a while (I suggest you have a read of retrocomputing.stackexchange.com/help/self-answer) - the idea of SE is to create a repository of good questions and answers for future searchers, not just to get your immediate problems solved. It appears that you yourself have taken advantage of this (retrocomputing.stackexchange.com/questions/6006/…) so I'm unsure why you think that makes it a bad question..
– paxdiablo
6 hours ago






@Raffzahn, because that's actually accepted practice and has been for quite a while (I suggest you have a read of retrocomputing.stackexchange.com/help/self-answer) - the idea of SE is to create a repository of good questions and answers for future searchers, not just to get your immediate problems solved. It appears that you yourself have taken advantage of this (retrocomputing.stackexchange.com/questions/6006/…) so I'm unsure why you think that makes it a bad question..
– paxdiablo
6 hours ago






2




2




In addition, as you extended the comment, yes, I did answer my own question but if you take a closer look, I didn't do so to answer a fake question, but I waited about three month and then published my own findings during that time. The question is still open for a real answer. As before, research does help before typing.
– Raffzahn
5 hours ago




In addition, as you extended the comment, yes, I did answer my own question but if you take a closer look, I didn't do so to answer a fake question, but I waited about three month and then published my own findings during that time. The question is still open for a real answer. As before, research does help before typing.
– Raffzahn
5 hours ago




1




1




There are no personal attacks here, I'm calling out your behaviour and how it differs from accepted practice. If you see that as personal, that's on you. I would do the same to Atwood, Spolsky or Jon Skeet :-) Have the last word if you wish, I think the best thing I can do is move on.
– paxdiablo
5 hours ago






There are no personal attacks here, I'm calling out your behaviour and how it differs from accepted practice. If you see that as personal, that's on you. I would do the same to Atwood, Spolsky or Jon Skeet :-) Have the last word if you wish, I think the best thing I can do is move on.
– paxdiablo
5 hours ago






2




2




I think I need a drink after reading this...
– manassehkatz
5 hours ago




I think I need a drink after reading this...
– manassehkatz
5 hours ago










2 Answers
2






active

oldest

votes

















up vote
4
down vote













One way was to place an in-line reboot command into the actual listing.



Apple ][ DOS had a feature that would monitor the output stream and, if it found a special character, the rest of the line would be treated as a command. This character was a CTRL-D, meaning you could get a disk listing from your program with something like:



PRINT CHR$(4);"CATALOG"


You could also use the slot activation command IN#6 which would generally reboot the machine, assuming your disk controller was in slot 6 (it usually was).



But, of course, that would only work with a print command if you were running your program. For protecting against someone listing it, an extra layer of trickery was required.



You would create a line at the start of your program:



10 REM XIN#6


and then use POKE 99999, 4 to change the X into a CTRL-D, adjusting the 99999 to point to the actual X character of course.



After that, an attempt to LIST the program would result in the machine rebooting. So this is probably something you wanted to do once development was done, just before shipping :-)



In order to bypass it, it's a simple matter of working out the errant line and just deleting it. In the case above, that would be acheived by just entering the stand-alone:



10


on the command line and, voila, the program is unprotected. To stop this, some developers started numbering the programs with less "normal" line numbers such as 2718. However, since the line numbers are stored in memory as well, you could PEEK at the program to work out what the first line number was, and then delete that one.






share|improve this answer





















  • My recollection is that you could simply type the control-D as part of the input line. No need for poking about. One could list a program without processing such things by typing :PR#0 with a colon before it to ensure it's processed as a BASIC command rather than a DOS one.
    – supercat
    4 hours ago


















up vote
0
down vote













IIRC, there were lots of variations to implement this scheme. Besides embedding characters in the listing that would reboot, or clear the screen every so often, a particular one I remember worked roughly like this:



The listing only consisted of a single CALL. The internal structure of the BASIC rogram was carefully changed so the listing was stopped there, but there was a lot of stuff after this single command. This call would be to an embedded machine program somewhere in the BASIC listing, which would re-arrange the structure to make the whole program visible, and also register itself with some hooks to make it invisible again. You could defeat this protection by disassembling the machine code and running part of it. Or even by pressing RESET or something at a proper time, I forgot the details.



Not all BASIC programs that consisted of a single CALL were like this. There were also pure machine programs which disguised itself as BASIC programs in this way for some reason I never understood.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "648"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f8364%2fhow-did-apple-basic-programs-protect-against-listing%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    4
    down vote













    One way was to place an in-line reboot command into the actual listing.



    Apple ][ DOS had a feature that would monitor the output stream and, if it found a special character, the rest of the line would be treated as a command. This character was a CTRL-D, meaning you could get a disk listing from your program with something like:



    PRINT CHR$(4);"CATALOG"


    You could also use the slot activation command IN#6 which would generally reboot the machine, assuming your disk controller was in slot 6 (it usually was).



    But, of course, that would only work with a print command if you were running your program. For protecting against someone listing it, an extra layer of trickery was required.



    You would create a line at the start of your program:



    10 REM XIN#6


    and then use POKE 99999, 4 to change the X into a CTRL-D, adjusting the 99999 to point to the actual X character of course.



    After that, an attempt to LIST the program would result in the machine rebooting. So this is probably something you wanted to do once development was done, just before shipping :-)



    In order to bypass it, it's a simple matter of working out the errant line and just deleting it. In the case above, that would be acheived by just entering the stand-alone:



    10


    on the command line and, voila, the program is unprotected. To stop this, some developers started numbering the programs with less "normal" line numbers such as 2718. However, since the line numbers are stored in memory as well, you could PEEK at the program to work out what the first line number was, and then delete that one.






    share|improve this answer





















    • My recollection is that you could simply type the control-D as part of the input line. No need for poking about. One could list a program without processing such things by typing :PR#0 with a colon before it to ensure it's processed as a BASIC command rather than a DOS one.
      – supercat
      4 hours ago















    up vote
    4
    down vote













    One way was to place an in-line reboot command into the actual listing.



    Apple ][ DOS had a feature that would monitor the output stream and, if it found a special character, the rest of the line would be treated as a command. This character was a CTRL-D, meaning you could get a disk listing from your program with something like:



    PRINT CHR$(4);"CATALOG"


    You could also use the slot activation command IN#6 which would generally reboot the machine, assuming your disk controller was in slot 6 (it usually was).



    But, of course, that would only work with a print command if you were running your program. For protecting against someone listing it, an extra layer of trickery was required.



    You would create a line at the start of your program:



    10 REM XIN#6


    and then use POKE 99999, 4 to change the X into a CTRL-D, adjusting the 99999 to point to the actual X character of course.



    After that, an attempt to LIST the program would result in the machine rebooting. So this is probably something you wanted to do once development was done, just before shipping :-)



    In order to bypass it, it's a simple matter of working out the errant line and just deleting it. In the case above, that would be acheived by just entering the stand-alone:



    10


    on the command line and, voila, the program is unprotected. To stop this, some developers started numbering the programs with less "normal" line numbers such as 2718. However, since the line numbers are stored in memory as well, you could PEEK at the program to work out what the first line number was, and then delete that one.






    share|improve this answer





















    • My recollection is that you could simply type the control-D as part of the input line. No need for poking about. One could list a program without processing such things by typing :PR#0 with a colon before it to ensure it's processed as a BASIC command rather than a DOS one.
      – supercat
      4 hours ago













    up vote
    4
    down vote










    up vote
    4
    down vote









    One way was to place an in-line reboot command into the actual listing.



    Apple ][ DOS had a feature that would monitor the output stream and, if it found a special character, the rest of the line would be treated as a command. This character was a CTRL-D, meaning you could get a disk listing from your program with something like:



    PRINT CHR$(4);"CATALOG"


    You could also use the slot activation command IN#6 which would generally reboot the machine, assuming your disk controller was in slot 6 (it usually was).



    But, of course, that would only work with a print command if you were running your program. For protecting against someone listing it, an extra layer of trickery was required.



    You would create a line at the start of your program:



    10 REM XIN#6


    and then use POKE 99999, 4 to change the X into a CTRL-D, adjusting the 99999 to point to the actual X character of course.



    After that, an attempt to LIST the program would result in the machine rebooting. So this is probably something you wanted to do once development was done, just before shipping :-)



    In order to bypass it, it's a simple matter of working out the errant line and just deleting it. In the case above, that would be acheived by just entering the stand-alone:



    10


    on the command line and, voila, the program is unprotected. To stop this, some developers started numbering the programs with less "normal" line numbers such as 2718. However, since the line numbers are stored in memory as well, you could PEEK at the program to work out what the first line number was, and then delete that one.






    share|improve this answer












    One way was to place an in-line reboot command into the actual listing.



    Apple ][ DOS had a feature that would monitor the output stream and, if it found a special character, the rest of the line would be treated as a command. This character was a CTRL-D, meaning you could get a disk listing from your program with something like:



    PRINT CHR$(4);"CATALOG"


    You could also use the slot activation command IN#6 which would generally reboot the machine, assuming your disk controller was in slot 6 (it usually was).



    But, of course, that would only work with a print command if you were running your program. For protecting against someone listing it, an extra layer of trickery was required.



    You would create a line at the start of your program:



    10 REM XIN#6


    and then use POKE 99999, 4 to change the X into a CTRL-D, adjusting the 99999 to point to the actual X character of course.



    After that, an attempt to LIST the program would result in the machine rebooting. So this is probably something you wanted to do once development was done, just before shipping :-)



    In order to bypass it, it's a simple matter of working out the errant line and just deleting it. In the case above, that would be acheived by just entering the stand-alone:



    10


    on the command line and, voila, the program is unprotected. To stop this, some developers started numbering the programs with less "normal" line numbers such as 2718. However, since the line numbers are stored in memory as well, you could PEEK at the program to work out what the first line number was, and then delete that one.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 6 hours ago









    paxdiablo

    1,088730




    1,088730












    • My recollection is that you could simply type the control-D as part of the input line. No need for poking about. One could list a program without processing such things by typing :PR#0 with a colon before it to ensure it's processed as a BASIC command rather than a DOS one.
      – supercat
      4 hours ago


















    • My recollection is that you could simply type the control-D as part of the input line. No need for poking about. One could list a program without processing such things by typing :PR#0 with a colon before it to ensure it's processed as a BASIC command rather than a DOS one.
      – supercat
      4 hours ago
















    My recollection is that you could simply type the control-D as part of the input line. No need for poking about. One could list a program without processing such things by typing :PR#0 with a colon before it to ensure it's processed as a BASIC command rather than a DOS one.
    – supercat
    4 hours ago




    My recollection is that you could simply type the control-D as part of the input line. No need for poking about. One could list a program without processing such things by typing :PR#0 with a colon before it to ensure it's processed as a BASIC command rather than a DOS one.
    – supercat
    4 hours ago










    up vote
    0
    down vote













    IIRC, there were lots of variations to implement this scheme. Besides embedding characters in the listing that would reboot, or clear the screen every so often, a particular one I remember worked roughly like this:



    The listing only consisted of a single CALL. The internal structure of the BASIC rogram was carefully changed so the listing was stopped there, but there was a lot of stuff after this single command. This call would be to an embedded machine program somewhere in the BASIC listing, which would re-arrange the structure to make the whole program visible, and also register itself with some hooks to make it invisible again. You could defeat this protection by disassembling the machine code and running part of it. Or even by pressing RESET or something at a proper time, I forgot the details.



    Not all BASIC programs that consisted of a single CALL were like this. There were also pure machine programs which disguised itself as BASIC programs in this way for some reason I never understood.






    share|improve this answer

























      up vote
      0
      down vote













      IIRC, there were lots of variations to implement this scheme. Besides embedding characters in the listing that would reboot, or clear the screen every so often, a particular one I remember worked roughly like this:



      The listing only consisted of a single CALL. The internal structure of the BASIC rogram was carefully changed so the listing was stopped there, but there was a lot of stuff after this single command. This call would be to an embedded machine program somewhere in the BASIC listing, which would re-arrange the structure to make the whole program visible, and also register itself with some hooks to make it invisible again. You could defeat this protection by disassembling the machine code and running part of it. Or even by pressing RESET or something at a proper time, I forgot the details.



      Not all BASIC programs that consisted of a single CALL were like this. There were also pure machine programs which disguised itself as BASIC programs in this way for some reason I never understood.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        IIRC, there were lots of variations to implement this scheme. Besides embedding characters in the listing that would reboot, or clear the screen every so often, a particular one I remember worked roughly like this:



        The listing only consisted of a single CALL. The internal structure of the BASIC rogram was carefully changed so the listing was stopped there, but there was a lot of stuff after this single command. This call would be to an embedded machine program somewhere in the BASIC listing, which would re-arrange the structure to make the whole program visible, and also register itself with some hooks to make it invisible again. You could defeat this protection by disassembling the machine code and running part of it. Or even by pressing RESET or something at a proper time, I forgot the details.



        Not all BASIC programs that consisted of a single CALL were like this. There were also pure machine programs which disguised itself as BASIC programs in this way for some reason I never understood.






        share|improve this answer












        IIRC, there were lots of variations to implement this scheme. Besides embedding characters in the listing that would reboot, or clear the screen every so often, a particular one I remember worked roughly like this:



        The listing only consisted of a single CALL. The internal structure of the BASIC rogram was carefully changed so the listing was stopped there, but there was a lot of stuff after this single command. This call would be to an embedded machine program somewhere in the BASIC listing, which would re-arrange the structure to make the whole program visible, and also register itself with some hooks to make it invisible again. You could defeat this protection by disassembling the machine code and running part of it. Or even by pressing RESET or something at a proper time, I forgot the details.



        Not all BASIC programs that consisted of a single CALL were like this. There were also pure machine programs which disguised itself as BASIC programs in this way for some reason I never understood.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 14 mins ago









        dirkt

        8,26812344




        8,26812344






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fretrocomputing.stackexchange.com%2fquestions%2f8364%2fhow-did-apple-basic-programs-protect-against-listing%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks