Page 1 of 1

6522 - VIA

Posted: Thu Jun 23, 2016 1:59 pm
by Symoon
I'm starting this topic about the 6522, which as I'm a hardware lamer, always seems complicated for me to understand even with its data sheet.

Ok, so: I'm reading the IFR byte to check if there was a signal transition on CB1.
The question is: does reading it automatically reset the flag, or do I have to do a specific operation to reset it? (seem like LDA#0300 could reset it, but I'm not sure it's mandatory?)

Re: 6522 - VIA

Posted: Thu Jun 23, 2016 5:13 pm
by Dbug
The VIA has always been my archenemy on the Oric, most of my VIA related code is either copied from the Atmos rom, or was from Jonathan.

Re: 6522 - VIA

Posted: Thu Jun 23, 2016 7:03 pm
by polluks
It's mandatory.

Code: Select all

      REG 13 -- INTERRUPT FLAG REGISTER
+-+-+-+-+-+-+-+-+
|7|6|5|4|3|2|1|0|             SET BY                    CLEARED BY
+++++++++++++++++    +-----------------------+------------------------------+
 | | | | | | | +--CA2+ CA2 ACTIVE EDGE       | READ OR WRITE REG 1 (ORA)°   |
 | | | | | | |       +-----------------------+------------------------------+
 | | | | | | +--CA1--+ CA1 ACTIVE EDGE       | READ OR WRITE REG 1 (ORA)    |
 | | | | | |         +-----------------------+------------------------------+
 | | | | | +SHIFT REG+ COMPLETE 8 SHIFTS     | READ OR WRITE SHIFT REG      |
 | | | | |           +-----------------------+------------------------------+
 | | | | +-CB2-------+ CB2 ACTIVE EDGE       | READ OR WRITE ORB°           |
 | | | |             +-----------------------+------------------------------+
 | | | +-CB1---------+ CB1 ACTIVE EDGE       | READ OR WRITE ORB            |
 | | |               +-----------------------+------------------------------+
 | | +-TIMER 2-------+ TIME-OUT OF T2        | READ T2 LOW OR WRITE T2 HIGH |
 | |                 +-----------------------+------------------------------+
 | +-TIMER 1---------+ TIME-OUT OF T1        | READ T1 LOW OR WRITE T1 HIGH |
 |                   +-----------------------+------------------------------+
 +-IRQ---------------+ ANY ENABLED INTERRUPT | CLEAR ALL INTERRUPTS         |
                     +-----------------------+------------------------------+
http://unusedino.de/ec64/technical/misc ... a6522.html

Re: 6522 - VIA

Posted: Thu Jun 23, 2016 8:17 pm
by Symoon
Thanks a lot! It was written clearly but I never found it in the doc, my bad :-/

Now thanks to tests I found that resetting timer 2 low-byte is achieved by putting FF in the high-byte of the counter.
Oh well, newbie ranting I suppose - that thing seems magical but it probably takes quite a while to master ;)

Re: 6522 - VIA

Posted: Sat Jun 25, 2016 12:40 pm
by Godzil
Symoon wrote:Thanks a lot! It was written clearly but I never found it in the doc, my bad :-/

Now thanks to tests I found that resetting timer 2 low-byte is achieved by putting FF in the high-byte of the counter.
Oh well, newbie ranting I suppose - that thing seems magical but it probably takes quite a while to master ;)
The 6522 is clearly not a simple beast to handle, don't worry about not understanding all of it's possibilities.