It is currently Mon Oct 20, 2014 5:49 pm

All times are UTC [ DST ]




 Page 1 of 1 [ 11 posts ] 
Author Message
PostPosted: Thu Dec 13, 2007 5:40 am 

Joined: Mon Jan 03, 2005 2:38 am
Posts: 369
So I've been looking at using the Break Key intercept. As I understand it, you put #&4C (i.e. the JMP instruction value) at &0287, then the lo-addr of your routine at &0288 and the hi-addr at &0289. Then, after a *FX200,3 (disable Esc; clear on Break) and pressing the Break key, your custom intercept routine should be called.

Except I haven't seen it happen. The routine is not called, and a normal break reset occurs. The second page seems to be cleared to 0.

(BTW, my routine was a simple 'jump to self' infinite loop, just to see would I get an expected hang - but it didn't happen.)

.
What am I missing?
:?


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Dec 13, 2007 9:17 am 

Joined: Sun Aug 07, 2005 8:29 pm
Posts: 293
Location: Notts, England
Seems to work OK here.

I did :

P%=&2000
[JMP &2000
?&287=&4C
?&288=0
?&289=&20
*FX200,3

Pressing break clears the screen and goes into an infinite loop as expected.

This was tested using BeebEm3 in Model B mode but I don't see why it shouldn't work on a real machine or in Master 128 mode.

Tell us more about how you tried it and what code you were using.

Jon.


Last edited by g7jjf on Thu Dec 13, 2007 9:22 am, edited 1 time in total.

Offline
 Profile  
 
 Post subject:
PostPosted: Thu Dec 13, 2007 9:21 am 

Joined: Sun Aug 07, 2005 8:29 pm
Posts: 293
Location: Notts, England
Except of course, when I actually try it in Master 128 mode, it doesn't work.

I guess you don't need the *FX200, 3 as this appears to clear all memory in Master 128 mode, including resetting the break vector and clearing out the break intercept code.

So, just miss out the *FX200,3 and pressing break then runs the intercept code as expected.

Jon.


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Dec 13, 2007 9:29 am 
User avatar

Joined: Wed Aug 24, 2005 1:13 pm
Posts: 2128
Location: Back of beyond
Jon just beat me to it, yes I tried a quick example that just printed out the letter A. Worked fine, code was loaded at &3000 and was

lda #65
jsr &ffee
rts

The rts needs to be changed if you don't want it to go back into the normal break routine. In this example it prints an A out before the Acorn Boot message.

Then just typed
?&287=&4c
?&288=0
?&289=&30

and pressed break. Ran it in BeebEm but effects should be the same on real Beeb.

I have a sneaking suspicion that you've forget to do those addresses as hex ! i.e. I reckon you've typed

?287=4C

Least that's my guess :)


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Dec 13, 2007 11:14 am 
User avatar

Joined: Thu Jan 13, 2005 6:20 pm
Posts: 595
Location: Málaga, Spain
Try this little program:
Code:
  10 P%=&900
  20 [OPT2:LDA&70:STA&202:LDA&71:STA&203
  30 BRK:EQUB1:EQUS"Break":BRK:]
  40 !&70=!&202
  50 ?&287=&4C:?&288=0:?&289=9
  60 ON ERROR
  70 REPEAT PRINT"Hello ";:UNTIL INKEY-99
  80 ?&287=0


It makes the Break key generate an error, just like the Escape key, which can then be trapped by ON ERROR in a Basic program. Muhahaha, no breaking out of the program!

(unless you press Space)


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Dec 13, 2007 3:29 pm 
User avatar

Joined: Sun Jan 02, 2005 10:51 pm
Posts: 557
Location: London, UK
If there are still problems you could try *FX 247,76 *FX 248,<lsb> *FX 249,<msb> as the memory locations may be in a different place on the Master? Just a thought.

--G


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Dec 13, 2007 4:06 pm 
User avatar

Joined: Thu Jan 13, 2005 6:20 pm
Posts: 595
Location: Málaga, Spain
No, it's ok, they're in the same place on a Master too.

But *FX 200,3 is a bad thing used in conjunction with the Break intercept - on a Master, as Jon said, memory's cleared before the Break intercept is tested, so it has no effect at all. On OS 1.20, the Beeb will hang on reset, regardless of what code it's pointed to.


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Dec 13, 2007 8:18 pm 

Joined: Sun Apr 16, 2006 5:51 pm
Posts: 239
Location: England
Rich-TW

can you explain please why I can't put code in the low-stack area on a BBC Micro and do the *fx200,3 thing with break intercept? why won't this run?

The soft reset code in the ROM skips the stack on such a reset :)
Thanks.


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 11:33 am 
User avatar

Joined: Thu Jan 13, 2005 6:20 pm
Posts: 595
Location: Málaga, Spain
ghbearman wrote:
Rich-TW

can you explain please why I can't put code in the low-stack area on a BBC Micro and do the *fx200,3 thing with break intercept? why won't this run?

The soft reset code in the ROM skips the stack on such a reset :)
Thanks.


It works fine for me in OS 1.20:

Code:
>P%=&150:[OPT2:LDA#42:JMP&FFEE
>?&287=&4C
>?&288=&50
>?&289=1
>*FX 200,3

[break]

*
BBC Computer 32K

*Acorn DFS

BASIC

>


It could be that using &100 is not safe as paged ROMs sometimes copy code there to execute errors (via BRK). Maybe DFS or something is doing that. But putting code at &150 seems fine (if a little dangerous!)


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 4:40 pm 

Joined: Sun Apr 16, 2006 5:51 pm
Posts: 239
Location: England
hmm, sounds like an idea for my protection system....


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Dec 15, 2007 6:31 pm 

Joined: Mon Jan 03, 2005 2:38 am
Posts: 369
BTW, I originally tried this on B-em, and BeebEm using OS1.2 and using OS2.00 (B+), without success. I must recheck where I assembled the code when I get home - I was pretty sure I put it away from the pages that the OS clears with its FX200 loop routine.

.

.

Furthermore, my MAIN intention was to simply enhance the memory-clearing effect on 'Break' for a B Plus machine, since the standard O.S. routine only clears certain pages in main ram. The shadow screen ram and special sideways ram remains untouched by pressing the 'Break' key. Easy to remedy (if I could get the break key vector to work [and with the fx200 stuff], that is!)


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

phpBB skin developed by: John Olson
Powered by phpBB® Forum Software © phpBB Group