<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Mon, 27 Feb 2006 19:32:49 +0000
From   : Richard Gellman <splodge@...>
Subject: Re: SHELIA and the VIA's

You're gonna hate hearing this, but its both at the same time :)

There are two VIAs inside a BBC Micro, the System VIA at &FE40, and the 
User VIA at &FE60.

Each VIA has 16 registers, numbered 0 to F. The wiring on a BBC maps 
these in to be &FE40 to &FE4F, and &FE60 to &FE6F. However, bit 4 in the 
address bus is ignored when selecting one of the VIAs, so it causes the 
VIA to appear AGAIN 16 bytes later in repitition. Thusly:

&FE40 - &FE4F   System VIA, reg. 0 - F
&FE50 - &FE5F   System VIA, reg. 0 - F
&FE60 - &FE6F   User VIA, reg. 0 - F
&FE70 - &FE7F   User VIA, reg. 0 - F

Now I have in paper form the 6522 Datasheet that covers everything, but 
I seem to have misplaced the electronic copy it came from. I got it from 
the internet so some googling of "6522 datasheet" should find the list 
of registers and usage for you.

&FE79 is register &9 of the User VIA, which corresponds to Timer 2 High 
Order Counter (High byte of a 16bit timer). The program appears to be 
using a very precise timing loop to achieve something (normally calling 
the system functions to retrieve the system timer is good enough) - this 
is usually the sort of thing done to do unusual screen modes or 
high-speed audio.

-- Richard


BBC Micro wrote:

>Hi again, I've been looking at the AUG and getting
>confused...Page 397 tells us that the VIA's are
>&FE40-&FE7F. The next chapter tells us that VIA-B is
>&FE60-&FE6F.
>
>I'm having trouble tying up the memory locations with
>the registers/ports on the VIA can anyone give a list
>from &FE40-&FE7F? I only found the Electron one on the
>internet search.
>
>I've dissasembled Castle Quest (with 6502dis) and
>looking at the VIA calls. &FE79? Joystick/Timer?
>
>This was the one of the pieces of code:-
>
>$2cfc: a5 32            LDA $32
>$2cfe: 38               SEC
>$2cff: ed 79 fe         SBC $fe79
>$2d02: c9 3b            CMP #$3b
>$2d04: 30 01            BMI .M5s2
>$2d06: 60               RTS
>
>.M5s2: 4a               Yada, yada...
>
>
>   
>   
>           
>___________________________________________________________ 
>Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail
http://uk.messenger.yahoo.com
>
>  
>
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>