No Break please, just a space...

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
1024MAK
Posts: 5118
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

No Break please, just a space...

Post by 1024MAK »

No doubt, if it is possible, the answer is out there. It's just that I have not found it (yet) :mrgreen:
Having blagged a nice third party replacement keyboard, with a nice (proper) large space bar, the question is:-
How do I stop the BASIC program from those <damn it I just brushed the space bar, again :twisted: > unwanted breaks into me program? :?:

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: No Break please, just a space...

Post by sirmorris »

Usually the only way is to have a pure machine code app. I realise this is utter craziness for most programs.

The truth is that the BASIC interpreter checks for break; there's no way to get around this.

it may be possible to add a hack to the ZXpand overlay which requires shift-space to break?

C
gozzo
Posts: 452
Joined: Fri Jul 08, 2011 8:52 pm

Re: No Break please, just a space...

Post by gozzo »

The only way I can think of doing it at the moment is to 'patch' the break(space) detect code in the ROM - I think it was a silly idea to use the space key as break, I'd have preferred to use the EDIT or FUNCTION also as break. I'll have a look into it to see if it's possible to make a reasonably easy plug-in unit to stick on the expansion slot..certainly fairly easy to patch the whole ROM out, and an alternative in(apart from the character patterns)
gozzo
Posts: 452
Joined: Fri Jul 08, 2011 8:52 pm

Re: No Break please, just a space...

Post by gozzo »

According to the disassembly listing of the zx81 rom, the break detect code is from 0F46 to 0f4A, being
LD A,7F
IN A,(FE)
RRA

when break(space) is pressed, carry is reset, but if not pressed is set. So I was thinking if the RRA is changed to SCF (set carry) carry will always be set and break would not be detected!?
After a bit of thinking I have come up with a POSSIBLE (not tested!) way of patching out the rom at the RRA point and replacing it with a SCF ,see the circuit attached - excuse the untidiness as it was hand drawn and photographed on my mobile. No doubt it could be simplified/improved (will look into it further) but it's a start!
Attachments
disbreak.JPG
(383.13 KiB) Downloaded 2352 times
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: No Break please, just a space...

Post by Andy Rea »

I love it :D

Been a while since i sat down with a bunch of 74xx's but i reckon it should simplyfy somewhat.

Andy
what's that Smell.... smells like fresh flux and solder fumes...
sirmorris
Posts: 2811
Joined: Thu May 08, 2008 5:45 pm

Re: No Break please, just a space...

Post by sirmorris »

If ZXpand is present the fix is very simple; there's a little space free just about the right size for an additional key-press test. The simplest fix is to take SHIFT into account also. SHIFT-BREAK = BREAK.

I expect you have the ability to program EPROMs, Mark? If so there's a new ZXpand firmware about to hit the burner. You could be a beta tester if you like :D

Gozzo - I'm not trying to rain on your parade - your solution is very smart :D Those with ZXpand simply now have two options..!
User avatar
Math123
Posts: 44
Joined: Sun May 11, 2008 11:14 pm
Location: Germany Wuppertal
Contact:

Re: No Break please, just a space...

Post by Math123 »

Hi guys,
inspired by this I tried to implement a function like OnError.
It works good but I saw that its not as easy to disable the BREAK with software (as long as there is the original ROM in the machine).
Description of the program follows...

Example showing the interface:

Code: Select all

   0 REM ONERROR ...

 100 CLEAR
 110 LET ONERROR=16514
 120 REM ONERROR GOTO 9990
 130 PRINT USR ONERROR,9990
 140 LET A=1/0
 150 PRINT B
 160 REM ONERROR OFF
 170 PRINT USR ONERROR,0
 180 LET A=1/0
 190 PRINT B
 200 STOP

9990 REM ERRORHANDLER
9991 LET NUMBER=PEEK 16434
9992 LET LINE=PEEK 16427+256*PEEK 16428
9991 PRINT "ERROR ";NUMBER;" IN ";LINE
9992 REM GOTO THE FOLLOWING LINE
9992 GOTO LINE+1
Calculator which does not stop on wrong input:

Code: Select all

   0 REM ONERROR ...
   1 PRINT USR 16514,200

 100 INPUT A
 110 SCROLL
 120 PRINT A
 130 GOTO 100

 200 SCROLL
 210 PRINT "ERROR"
 220 RUN
But there are still some minor drawbacks. ;)
Attachments
onerror.p
(1.2 KiB) Downloaded 252 times
User avatar
1024MAK
Posts: 5118
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: No Break please, just a space...

Post by 1024MAK »

Wow!

Some of you have been busy while I have been occupied elsewhere (and not enjoying my Dell laptop dying that I was using as my main surfing aid, but that's another story).

I do like the ideas, so thank you everyone :D .

And I do have a ZXpand and a EPROM programmer (that uses one of my still functional computers) and may well give that a go :D Thanks Mr C.

As I only have one ZXp, but a number of ZX81's, and I have a stash of 74xxx and 74LSxxx logic chips, I may well explore Gozzo's idea as well :D

I did however think of a simple hardware solution: as the keyboard has some spare keys, it would not take much effort to wire one of these key switches in series with the Space/Break key. The only problem would be remembering to press two keys to get a space :lol:

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
gozzo
Posts: 452
Joined: Fri Jul 08, 2011 8:52 pm

Re: No Break please, just a space...

Post by gozzo »

Another possible circuit - using an EPROM as an address decoder(not sure if that would work, but don't see why not) - only 2 chips needed plus a few other parts!
Attachments
disbreak2.JPG
(410.46 KiB) Downloaded 2241 times
gozzo
Posts: 452
Joined: Fri Jul 08, 2011 8:52 pm

Re: No Break please, just a space...

Post by gozzo »

Also have a circuit idea for a 'POKE' switchable version (poke 16417(supposedly unused system variable),128 or higher to disable break, 127 or lower to enable) will post pic soon! I may actually try this one!
Post Reply