<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Mon, 12 Feb 1996 20:40:39 +0000 (GMT)
From   : James Fidell <james@...>
Subject: Re: That System VIA

Tom Seddon wrote:

> I handle IRQs by having a variable called 'IntRequests'. Every time a
> device (ie the system VIA) wants an interrupt, it sets its registers
> appropriately, and increments this variable. This is used by the 6502
> emulator: every X cycles, or after every instruction, the processor checks
> this variable, and if it's greater than 0 (and the I flag is clear) it
> services one interrupt, decrements the variable, and continues. 
> 
> Is this correct?! It seems to be the way both XBeeb and BeebEm do it. 

Remember that you must also clear the BRK flag in the copy of the status
register pushed onto the stack as part of processing the IRQ.

> Should I let the interrupts from the VIA pile up? I've added an 
> 'interrupts outstanding' indicator to the disassembly output, and when 
> BASIC starts (after a long period of OS initialisation with I set) there 
> are 20 interrupts outstanding. Is this normal? It implies that BASIC is 
> taking 20 seconds to start up (20 t1 countdowns) which is odd... or am I 
> missing something? (It wouldn't surprise me)

The reason I count the outstanding number of interrupts is so that I
know if there are remaining interrupts to be processed without ever
having to check all the status registers etc. once one interrupt has been
cleared -- effectively I'm just counting the number of things that are
pulling the CPUs IRQ input low.  In that sense it seems a reasonable
emulation of the way the hardware works, though I'm not sure that it's
the most efficient way to do it.

James.

-- 
 "Yield to temptation --             | Work: james@...          
  it may not pass your way again"    | Play: james@...                 
                                     | http://www.OiT.co.uk/~james/
        - Lazarus Long               |              James Fidell



<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>