<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 22 Sep 2002 16:29:35 +0100
From   : Sprow <info@...>
Subject: Re: BBC B with edge-connectors instead of IDC connectors?

In article <KNEEJIOPPHNNBHBMMGACGEDJCDAA.r.gellman@...>,
   Richard Gellman <r.gellman@...> wrote:
> [unimportant info deleted]

> >>As FE30 is readonly,any interrupt routine which feels it necessary to
> jiggle
> >>the ROMs around reads and stacks F4.On exit from the interrupt handler it
> >>pulls and writes to *both* F4 and FE30,hence my comment about writing to
> F4
> >>*first* and not bothering to disable IRQs,
> >
> >Yes, but oftentimes it's 'not bothering' that causes the most
> >obscure of crashes. ?&F4 is simply meant to reflect the contents
> >of ROMSEL *at all times*, even during interrupts. You simply do
> >not, and should not, know what is being done in any interrupt
> >routines that happen to run while you're switching ROMs.

[paste in JK's answer]

> Depends. One possible scenario is that the interrupt handler
> needs to access the ROM that was selected when the interrupt
> occurred and needs to do so by explicitly switching to it at
> some point (which may be, e.g., if executes partially in a
> sideways ROM itself, or if it needs to access other ROMs).
> It will access the wrong ROM since ?&F4 has already been
> updated and no longer corresponds to the actual ROMSEL.

In this situation it knows which ROM was paged in when the interrupt went
off since it's still selected by virtue of the foreground task not yet
poking FE30.If it then wants to swap ROMs reading F4 and stacking it then
restoring both F4 and FE30 as I suggest will still work fine.

> Point of note on ROMSEL: Someone said it was read only. Well um, ROMSEL is 
> a select register, so it can never be read only :)

Doh! Readonly,writeonly,such an easy mistake.

> But my point was that
> interestingly, on the Model B it seems to be _write_ only, i.e. it CANT be
> read at all. You can read it on a Master 128 though.

It is write only on the beeb (reads undefined),and read/write on the Master
since the top bit has gained new meaning and assorted parts of the VDU
drivers need to be able to stack and test bit 7.

> And to finish off, there is a section in the more technical part of the
> Master 128 Reference Manual (Part 1)

[snip]

> which specifically states to disable
> interrupts before doing anything, and to re-enable them when you're done.

That's only relevant for routines doing read/modify/write operations to bit
7 as the copy at F4 doesn't get similarly updated - it still contains the 4
bit ROM number.Rather cunning on Acorn's behalf I think,
Sprow.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>