Disable Break key from within a BASIC program

A place to discuss everything Dragon related that doesn't fall into the other categories.
Post Reply
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Disable Break key from within a BASIC program

Post 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
Last edited by zephyr on Mon Nov 29, 2010 2:01 pm, edited 1 time in total.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Disable Break key from within a BASIC program

Post 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 
sixxie
Posts: 1348
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: Disable Break key from within a BASIC program

Post 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?
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Disable Break key from within a BASIC program

Post by zephyr »

I agree, but all these snippets are exclusive to this forum ATM. All are welcome to archive them elsewhere though.

Regards,
Steve
Alastair
Posts: 669
Joined: Fri Jul 18, 2008 11:33 pm

Re: Disable Break key from within a BASIC program

Post by Alastair »

Perhaps we could have a programming section on the wiki.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Disable Break key from within a BASIC program

Post by zephyr »

I would prefer a tech hints/tips type section added to the forum.
admin
Site Admin
Posts: 410
Joined: Thu Jul 17, 2008 10:22 pm

Re: Disable Break key from within a BASIC program

Post by admin »

Your wish has been granted ! :-)
Simon Hardy
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Disable Break key from within a BASIC program

Post by zephyr »

Thanks Simon! 8-) I have duplicated this, and other relevant topics from the other forums.

Regards,
Steve
Post Reply