Alternative to Poke 23659,0 to prevent a 'break in' to a Basic Program.

Good morning everyone,

My memory fails me these days but in the early days of programming I used to use Poke 23659,0 as a crude way of offering some sort of program protection.

I then recall using a new way which rendered the 'Break' capabilities ineffective and didn't end up crashing the program in a 'Break-in' attempt.

I recall using wither 1 or 2 lines of the order;
Poke xxxxx, Peek yyyyy (sorry to be so vague)

I wish that I had kept on to my old notebooks !!

I would appreciate any help and ideas thank you :)

Comments

  • 23613 , 0 but that just makes it reset.

    I suspect you want to just 'turn break off' yes ?
    jonathan wrote: »
    Easy enough to do in 48K BASIC:

    LET a=256*PEEK 23614+PEEK 23613-2
    POKE 23614,INT (a/256)
    POKE 23613,a-(256*PEEK 23614)

    Trouble is, it doesn't work in 128K mode.

    I've seen some programs that appear to use a small bit of machine code to do something similar, adventure games written in Basic seem likely candidates for this.
  • Thank you for your reply. You are correct that I was looking to turn break off.

    I have located the line that I used to include in my programs and it renders the break function inoperable.

    POKE 23613, PEEK 23730-5

    Thank you again for answering.
  • I still remember POKE 23659,0, one of those that's stuck in the long term memory.

    IIRC you couldn't use CLS in your program if you'd done it..?
  • edited March 2018
    Morkin wrote: »
    I still remember POKE 23659,0, one of those that's stuck in the long term memory.

    IIRC you couldn't use CLS in your program if you'd done it..?

    Yes anything similar to that as it interferes with the display a bit.

    To quote from a Spectrum Computing magazine article actually:
    This system variable contains the number of lines in the lower section of the screen, normally used for INPUTs, error reports and so on. Normally this would be a two, except for when a long INPUT prompt is displayed, etc. If a value of zero is POKEd in, normally to attempt to clear this unused part so that we can use the whole 24 lines of the screen, the computer crashes.

    However, this can be done within a few restrictions. These are that we must ensure the lower part of the screen is restored to normal before any use is made of this - so to break out of a program would be somewhat catastrophic! Also, errors generated within the course of a program will have the same effect since the error report would have to be printed out. Here is a short listing to demonstrate the use of line 22 and 23 on the screen.

    Unfortunately, it only works for PRINT or PRINT TAB as we cannot use PLOT down here and PRINT AT will only work down to line 22. The screen is restored to normal by POKE 23659,2 within the program.

    10 POKE 23659,0
    20 FOR A=0 TO 23
    30 PRINT A
    40 NEXT A
    50 PAUSE 0
    60 POKE 23659,2


    To demonstrate what can go wrong, let us generate an error by adding this line to the program:

    45 PRINT error

    Oops!!! If you just want to PRINT on the bottom two lines it is usually better to use PRINT #1; "text" which works just as well if not better, without such a risk of causing a system crash. If you POKE a value greater than two into DF_SZ the upper screen will become smaller than normal. So after POKE 23569,Y the upper screen would be 24-Y rows down and would scroll when the PRINT position got to or beyond 24-Y,0.

    This program shows how a part screen scroll can be maintained with DF_SZ and SCR_CT. Here, random numbers appear and scroll up the top 14 lines of the screen only.

    10 POKE 23692,0: POKE 23659,10
    20 PRINT RND
    30 GO TO 10

    Hope that helps and not causes more confusion!

    I do not see a personal need to use it (as I have seen) for something like this:

    23659 , 0
    AT 22,0 ; "whatever"
    23659 ,2

    When you can do a

    PRINT #0 ; AT 0,0; "whatever"

    or should that be #1 hmm.
    Post edited by spider on
Sign In or Register to comment.