Page 1 of 1

Disable Break key from within a BASIC program

Posted: Sun Nov 14, 2010 2:00 am
by zephyr
Here is a routine to disable the BREAK key from within a Dragon BASIC program. The machine code routine is position independent, and compatible with all versions of DragonDOS, SuperDOS, DOSPlus, and DeltaDOS.

Code: Select all

10 'BREAK KEY DISABLE V1.0
20 'FOR THE DRAGON 32/64
30 'BY STEPHEN J WOOLHAM
40 '***************************
50 'BASIC EXAMPLE PROGRAM
60 '***************************
70 CLEAR200,32689
80 DATA 30,8D,0,26,BC,1,6B,27,20,B6,1,6A,A7,8D,0,1E,FC,1,6B,ED,8D,0,18,86,7E,B7,1,6A,BF,1,6B,30,8D,0,1A,B7,1,9A,BF,1,9B,39,D,6F,27,3,39,39,39,32,62,F,70,BD,B5,38,81,3,27,F9,39,32,62,1C,AF,8D,3,7E,84,A6,BD,BB,E5,27,2,97,87,39
90 FOR I=32690 TO 32767:READ MC$:X=VAL("&H"+MC$):CSUM=CSUM+X:POKEI,X:NEXT
100 IF CSUM<>7212 THEN CLS:PRINT"ERROR IN DATA LINE":END
110 EXEC32690

Code: Select all

10 'BREAK KEY DISABLE V1.0
20 'FOR THE DRAGON 32/64
30 'BY STEPHEN J WOOLHAM
40 '***************************
50 'BASIC EXAMPLE PROGRAM #2
60 '***************************
70 CLEAR200,32689
80 MC$="308D0026BC016B2720B6016AA78D001EFC016BED8D0018867EB7016ABF016B308D001AB7019ABF019B390D6F270339393932620F70BDB538810327F93932621CAF8D037E84A6BDBBE52702978739"
90 X=1:FOR I=32690TO32767:POKE I,VAL("&H"+MID$(MC$,X,2)):X=X+2:NEXT
100 EXEC32690

Re: Disable Break key from within a BASIC program

Posted: Sun Nov 14, 2010 4:04 pm
by zephyr
Here's an alternative method which restarts the BASIC program every time Break is pressed. The machine code routine is position independent.

Code: Select all

10 'BREAK-RUN V1.0
20 'FOR THE DRAGON 32/64
30 'BY STEPHEN J WOOLHAM
40 '***************************
50 'BASIC EXAMPLE PROGRAM
60 '***************************
70 START=1004
80 MC$="8C82F62609BD841FBD83ED7E849F39"
90 X=1:FOR I=START TO START+14:POKE I,VAL("&H"+MID$(MC$,X,2)):X=X+2:NEXT
100 POKE408,VAL("&H"+LEFT$(HEX$(START),LEN(HEX$(START))-2))
110 POKE409,VAL("&H"+RIGHT$(HEX$(START),2))
120 '
130 'POKE 407,126 TO ENABLE 
140 'POKE 407,57 TO DISABLE
150 '
160 POKE407,126 

Re: Disable Break key from within a BASIC program

Posted: Sun Nov 14, 2010 6:20 pm
by sixxie
All these snippets would be incredibly useful to someone wanting to write something in BASIC and just needing those little extras - are you collecting them somewhere other than this thread? Somewhere linkable?

Re: Disable Break key from within a BASIC program

Posted: Sun Nov 14, 2010 7:57 pm
by zephyr
I agree, but all these snippets are exclusive to this forum ATM. All are welcome to archive them elsewhere though.

Regards,
Steve

Re: Disable Break key from within a BASIC program

Posted: Sun Nov 14, 2010 9:38 pm
by Alastair
Perhaps we could have a programming section on the wiki.

Re: Disable Break key from within a BASIC program

Posted: Mon Nov 15, 2010 10:45 am
by zephyr
I would prefer a tech hints/tips type section added to the forum.

Re: Disable Break key from within a BASIC program

Posted: Tue Nov 16, 2010 9:27 am
by admin
Your wish has been granted ! :-)

Re: Disable Break key from within a BASIC program

Posted: Tue Nov 16, 2010 9:39 pm
by zephyr
Thanks Simon! 8-) I have duplicated this, and other relevant topics from the other forums.

Regards,
Steve