Can someone try some simple 6522 VIA queries for me on a real BBC?

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by scarybeasts » Sun Nov 25, 2018 10:04 am

Hey,

I'm writing a new BBC emulator as a side project to see how fast emulation can go (spoiler: about 8Ghz worth of 6502 on my 2Ghz Intel laptop so far).

The initial focus was speed, better gaming keyboard and sound responsiveness and just fun really but I'm starting to develop an obsession with accuracy. It's interesting to see where the existing main emulators differ. One place they differ is in the initial state of many things, including the 6522 VIA chip. This actually matters because MOS 1.2 doesn't initialize all of the 6522 registers, and some games later depend on the state of these registers being a certain way.

Short story: what do these BASIC commands return on a real BBC, after power on?

PRINT ?&FE60
PRINT ?&FE61
PRINT ?&FE62
PRINT ?&FE63
?&FE62 = 255
?&FE63 = 255
PRINT ?&FE60
PRINT ?&FE61

Long story: jsbeeb and b-em differ on the handling here. You can see different responses in some of the above commands, although others are the same because MOS initializes some but not all of those registers.
As a consequence, jsbeeb can't run Snapper (it hangs at game start after drawing the level but before drawing PacMan, uh, I mean Snapper). b-em runs Snapper but I'm not convinced that's because its 6522 handling is correct. I think both may be wrong and I'd be happy to report when I know for sure.

(Longer term, I think I may need to get my hands on a real beeb. The complication is that I live in SF Bay Area and I have no idea if 1980s British tech blows up when plugged into 110V / 60Hz.)


Cheers
Chris

User avatar
flaxcottage
Posts: 3674
Joined: Thu Dec 13, 2012 8:46 pm
Location: Derbyshire
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by flaxcottage » Sun Nov 25, 2018 10:35 am

Using my B+ with OS2.00 I get these values. I don't have a model B connected at the moment. The B+ plays Pacman perfectly OK, though.

&FE60=107
&FE61=0
&FE62=159
&FE63=255

After the pokes
&FE60=11
&FE61=0
- John

Image

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by scarybeasts » Sun Nov 25, 2018 11:10 am

Thanks John.

Looks like something exotic is going on with that B+, those &FE60 / &FE62 values are all over the shop for a cold boot. An emulated B+ in b-em doesn't give values anywhere near as interesting. Maybe some non-default ROMs are peripherals are connected?

Assuming MOS 2.0 sets up the printer port (user VIA port B) the same as MOS 1.2, this does suggest that the default ORB value is 0x00.

I'd love to see what a vanilla model B / MOS 1.2 says about this all.


Cheers
Chris

User avatar
1024MAK
Posts: 9052
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by 1024MAK » Sun Nov 25, 2018 11:24 am

On a BBC B with nothing attached to either the printer port or the user port, I get these results after a switch on:
PRINT ?&FE60 returns 255
PRINT ?&FE61 returns 0
PRINT ?&FE62 returns 0
PRINT ?&FE63 returns 255
?&FE62 = 255
?&FE63 = 255
PRINT ?&FE60 returns 0
PRINT ?&FE61 returns 0

Mark

User avatar
1024MAK
Posts: 9052
Joined: Mon Apr 18, 2011 4:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by 1024MAK » Sun Nov 25, 2018 11:30 am

scarybeasts wrote:
Sun Nov 25, 2018 10:04 am
(Longer term, I think I may need to get my hands on a real beeb. The complication is that I live in SF Bay Area and I have no idea if 1980s British tech blows up when plugged into 110V / 60Hz.)
There is a very simple modification that enables a standard Beeb PSU to run on a 110V/120V AC mains supply. Just one link wire needs soldering in. This can be done at the same time that capacitors C1, C2 and C9 are replaced with new ones (recommended unless you like a smoking Beeb).

Mark
Last edited by 1024MAK on Sun Nov 25, 2018 11:33 am, edited 1 time in total.


User avatar
Pernod
Posts: 1570
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by Pernod » Sun Nov 25, 2018 11:49 am

Here's the values from my B with 8271 and a few ROMs installed, all original 80's greatness, nothing modern.
PRINT ?&FE60 returns 255
PRINT ?&FE61 returns 0
PRINT ?&FE62 returns 0
PRINT ?&FE63 returns 255
?&FE62 = 255
?&FE63 = 255
PRINT ?&FE60 returns 0
PRINT ?&FE61 returns 0

Edit: MAME also behaves as above.
Last edited by Pernod on Sun Nov 25, 2018 11:52 am, edited 1 time in total.
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
SarahWalker
Posts: 1179
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by SarahWalker » Sun Nov 25, 2018 12:07 pm

scarybeasts wrote:
Sun Nov 25, 2018 10:04 am
Long story: jsbeeb and b-em differ on the handling here. You can see different responses in some of the above commands, although others are the same because MOS initializes some but not all of those registers.
As a consequence, jsbeeb can't run Snapper (it hangs at game start after drawing the level but before drawing PacMan, uh, I mean Snapper). b-em runs Snapper but I'm not convinced that's because its 6522 handling is correct. I think both may be wrong and I'd be happy to report when I know for sure.
From memory, Snapper sets bit 7 of the ACR to output timer 1 status on PB7, then polls port B for timing, hanging if it never changes. I'm surprised it doesn't work on jsbeeb; Snapper is one of the first 'gotcha' cases you run into writing a Beeb emulator.

dp11
Posts: 946
Joined: Sun Aug 12, 2012 8:47 pm
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by dp11 » Sun Nov 25, 2018 12:23 pm

scarybeasts wrote:
Sun Nov 25, 2018 10:04 am
I'm writing a new BBC emulator as a side project to see how fast emulation can go (spoiler: about 8Ghz worth of 6502 on my 2Ghz Intel laptop so far).
Are you JITing?

Does the core pass the Dorman tests ?

Can you run the CLOCKSP benchmark program ?

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by scarybeasts » Sun Nov 25, 2018 12:26 pm

Thank you very much Mark and Nigel.

Those values from a vanilla BBC were what I expected: the output register is initialized to zero, as is the data direction register (which means all inputs).

jsbeeb initializes the values correctly to zero (quoting a 1977 data sheet no less, see [1]). But Snapper doesn't work because it has incorrect PB7 handling when ACR7 is enabled.

b-em incorrectly initializes the values to 0xFF. Snapper does work, despite incorrect PB7 handling when ACR7 is enabled, because of the incorrect initialization.
(Note that jsbeeb's 6522 code appears to be a logical copy of b-em.)

beebem is interesting. DDRA / DDRB are correctly initialized to all inputs, but ORA / ORB are incorrectly initialized to 0xFF. It's handling of PB7 when ACR7 is enabled looks closer to correct but I think it still might be off. It's good enough to run Snapper no matter whether DDRB is 0 or 0xFF.

Something like MAME appears to have a 6522 emulation that behaves closer to what I expect is correct. See [2].

I'll see if I can rustle up a BASIC program that will pass on a real BBC but fail in these emulators.


Cheers
Chris

[1] - http://archive.6502.org/datasheets/mos_ ... v_1977.pdf
[2] - https://github.com/mamedev/mame/blob/ma ... 522via.cpp

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by scarybeasts » Sun Nov 25, 2018 12:38 pm

Hi Sarah,

Yes I did crash into this gotcha :) Snapper is indeed running one of the 6522 timers in the mode where it is expected to toggle a bit (PB7) every time the timer expires.

Interestingly, the PB7 output bit toggling is expected to be observable even if the 6522 data direction is set to all inputs. You can see that b-em doesn't emulate that correctly if you do something like:

./b-em -disc ~/Downloads/Acornsoft/Snapper-v1.ssd
(In BASIC):
REM Set user VIA DDRB to all inputs
?&FE62=0
CH."LOAD"

beebem does handle this case; note that ?&FE62 is already 0 in beebem because it initializes DDRB to 0 which I believe is correct.


Cheers
Chris

User avatar
flaxcottage
Posts: 3674
Joined: Thu Dec 13, 2012 8:46 pm
Location: Derbyshire
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by flaxcottage » Sun Nov 25, 2018 2:30 pm

scarybeasts wrote:
Sun Nov 25, 2018 11:10 am
Thanks John.

Looks like something exotic is going on with that B+, those &FE60 / &FE62 values are all over the shop for a cold boot. An emulated B+ in b-em doesn't give values anywhere near as interesting. Maybe some non-default ROMs are peripherals are connected?

Assuming MOS 2.0 sets up the printer port (user VIA port B) the same as MOS 1.2, this does suggest that the default ORB value is 0x00.

I'd love to see what a vanilla model B / MOS 1.2 says about this all.


Cheers
Chris
Ah, yes. I'm running MMC on it. All my beebs do, so I'll be of no help at all. Sorry.
- John

Image

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by scarybeasts » Sun Nov 25, 2018 11:07 pm

dp11 wrote:
Sun Nov 25, 2018 12:23 pm
scarybeasts wrote:
Sun Nov 25, 2018 10:04 am
I'm writing a new BBC emulator as a side project to see how fast emulation can go (spoiler: about 8Ghz worth of 6502 on my 2Ghz Intel laptop so far).
cas

Are you JITing?

Does the core pass the Dorman tests ?

Can you run the CLOCKSP benchmark program ?
Yes, it's a 6502 -> x64 JIT that is loosely basic block based.
I haven't run the Dorman tests; current capability is "good enough" or more specifically "good enough to run Exile" :-) I'm not familiar with the Dorman tests but it sounds like they test opcode accuracy in isolation. All of the tough cases and bugs so far in the JIT have been different: a) optimizations across sequences of opcodes and particularly b) maintaining speed and accuracy in the presence of self-modifying 6502 code (really fun problem) and c) hardware registers.

Thanks for the CLOCKSP pointer. My current default timing model is to run the 6502 as fast as possible while coarsely clocking the 6522 timers and vsync to real wall time, so the measurement will indeed test raw 6502 speed.
Screenshot in JIT mode attached, looks like ~6Ghz combined average. That's similar to my Galaforce test case (8Ghz) so I can believe the numbers, although interestingly the test takes a long time to run. For reference, a simple C based interpreter is hitting 310Mhz and a hand-coded asm interpreter loop gets about 1352Mhz.
bbc_clocksp_jit.png
Cheers
Chris

dp11
Posts: 946
Joined: Sun Aug 12, 2012 8:47 pm
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by dp11 » Mon Nov 26, 2018 12:22 am

Thats very good. The C based 6502 in the PiTube direct is much slow. Hand optimised 6502 on a 1GHz ARM is about 290MHz

I bet the self modifying code makes things fun :) thats why i haven't gone down the JIT route

ClockSP adjusts its run time depending on how fast the machine is. Does JITing stop the internal timers while the optimiser is running ? if so it might well adjust the run time.

I would be interest in having a play with your emulator if there is somewhere I can download it.

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by scarybeasts » Mon Nov 26, 2018 1:36 am

scarybeasts wrote:
Sun Nov 25, 2018 12:26 pm
Thank you very much Mark and Nigel.
Mark or Nigel, if it's not an imposition, I wonder if you'd be able to run the attached test case on a real vanilla beeb after cold boot? All of jsbeeb, b-em and beebem disagree and I bet a real beeb will disagree some more :)

beebem is closest to correct -- the line that helps Snapper work correctly is "IN PB7 L: 127".

The unknown this test case will resolve is whether output pulses on PB7 modify the output register or whether it's an overlay of an separate bit of internal state. Then we all update our emulators to be more accurate :)

Attachments
- test.ssd, contains BASIC file "TEST".
- Screenshot of program text in b-em.
- Screenshot of beebem results, which are the strongest out of the emulators I have installed. (I need to install MAME).


Cheers
Chris
bem_source.png
beebem_timing.png
Attachments
test.ssd
(100 KiB) Downloaded 13 times

User avatar
Pernod
Posts: 1570
Joined: Fri Jun 08, 2012 10:01 pm
Location: Croydon, UK
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by Pernod » Mon Nov 26, 2018 2:03 am

scarybeasts wrote:
Mon Nov 26, 2018 1:36 am
Mark or Nigel, if it's not an imposition, I wonder if you'd be able to run the attached test case on a real vanilla beeb after cold boot? All of jsbeeb, b-em and beebem disagree and I bet a real beeb will disagree some more :)
Here you go, real Beeb on the left and MAME on the right.
20181126_015627.jpg
- Nigel

BBC Model B: ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, BeebZIF, etc.

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by scarybeasts » Mon Nov 26, 2018 3:45 am

dp11 wrote:
Mon Nov 26, 2018 12:22 am
Thats very good. The C based 6502 in the PiTube direct is much slow. Hand optimised 6502 on a 1GHz ARM is about 290MHz

I bet the self modifying code makes things fun :) thats why i haven't gone down the JIT route

ClockSP adjusts its run time depending on how fast the machine is. Does JITing stop the internal timers while the optimiser is running ? if so it might well adjust the run time.

I would be interest in having a play with your emulator if there is somewhere I can download it.
I totally plan to release the code when it's a bit less messy. I'm embarrassed by the state of a few items right now. I might also write some blog post notes about how JIT + self-modifying works and some of the challenges.

The speed numbers may dip a little when I fix some remaining inaccuracies but I think the design is functional so these numbers are ballpark of what can be expected. I'll re-run CLOCKSP when running the 6522 counters at virtual speed works correctly. To answer the question though, the time taken to compile 6502 -> x64 is included in the benchmark speed.


Cheers
Chris

User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by scarybeasts » Mon Nov 26, 2018 5:48 am

Pernod wrote:
Mon Nov 26, 2018 2:03 am
Here you go, real Beeb on the left and MAME on the right.
20181126_015627.jpg
Thanks Nigel! So now we all know how 6522 VIAs behave in this instance, and how to get Snapper to work properly.
Also, MAME gets some form of trophy for having better 6522 emulation than the dedicated BBC emulators.


Cheers
Chris

User avatar
tricky
Posts: 3601
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by tricky » Mon Nov 26, 2018 8:28 am

This is a great project and I look forward to the 6845 chapter, especially what is happening in the VLSI one.
Are you checking b2? It is currently in active development.

Coeus
Posts: 1314
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by Coeus » Mon Nov 26, 2018 2:07 pm

scarybeasts wrote:
Mon Nov 26, 2018 5:48 am
el! So now we all know how 6522 VIAs behave in this instance, and how to get Snapper to work properly.
Also, MAME gets some form of trophy for having better 6522 emulation than the dedicated BBC emulators.
That is no surprise to me. MAME takes the approach of trying to emulate individual components, like the 6522, completely and correctly. Then, when it is required to emulate a new system it is a case of "wiring up" the components in software in much the same way you would in hardware. According to the website, as well as easing the process of adding new machines, this forms a kind of documentation as to how things really worked.

With other emulators there is not usually such a strong policy and the only aim on which everyone is agreed is to create something that is accurate enough to run the software for the machine concerned. Some people take the "warts and all" approach, others "do the minimum". As an example, it seems quite some effort has been put into B-Em to get the video emulation accurate as this affects many games, but until I implemented the Music 4000 emulation, the 6522 emulation in B-Em didn't emulate the shift register mode of the 6522 at all. Presumably, up until then, nothing had tried to use it.


User avatar
scarybeasts
Posts: 141
Joined: Tue Feb 06, 2018 7:44 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by scarybeasts » Tue Nov 27, 2018 2:00 am

tricky wrote:
Mon Nov 26, 2018 8:28 am
This is a great project and I look forward to the 6845 chapter, especially what is happening in the VLSI one.
Are you checking b2? It is currently in active development.
Oh, I am vaguely terrified of the 6845, not sure how strongly I'll bat for accuracy there. In terms of what's observable to 6502 code, most of the 6845 is read-only. If we discount the light pen feedback, the main (only?) observable is the vsync interrupt timing.


Cheers
Chris

User avatar
tricky
Posts: 3601
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by tricky » Tue Nov 27, 2018 8:19 am

Yes, I didn't think that it was very important to a flat out CPU sim.

tom_seddon
Posts: 312
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by tom_seddon » Tue Nov 27, 2018 1:23 pm

This project sounds amazing. I'm really looking forward to trying it out, and even more looking forward to looking at the source!

b2 also suffered from the T1 issue, but it did sort-of do the right thing provided DDRB bit 7 was always an input, so Snapper-V1 happened to work, by accident, in most cases. Now fixed.

--Tom

P.S. Looks like Planetoid might be doing something similar.

Code: Select all

25113821  112f: lda #$80                 A=80 X=80 Y=14 S=ef P=NvdizC (D=80)
25113823  1131: sta $fe6b                A=80 X=80 Y=14 S=ef P=NvdizC (D=80)
...

Code: Select all

25139599  156f: jmp $165d                A=06 X=0c Y=10 S=ef P=nvdizC (D=0c)
25139602  165d: jsr $113b                A=06 X=0c Y=10 S=ed P=nvdizC (D=15)
25139608  113b: bit $fe60                A=06 X=0c Y=10 S=ed P=nVdizC (D=7f)
25139613  113e: rts                      A=06 X=0c Y=10 S=ef P=nVdizC (D=11)
25139619  1660: bpl $165d                A=06 X=0c Y=10 S=ef P=nVdizC (D=01)
25139622  165d: jsr $113b                A=06 X=0c Y=10 S=ed P=nVdizC (D=16)
25139628  113b: bit $fe60                A=06 X=0c Y=10 S=ed P=nVdizC (D=7f)
25139633  113e: rts                      A=06 X=0c Y=10 S=ef P=nVdizC (D=11)
25139639  1660: bpl $165d                A=06 X=0c Y=10 S=ef P=nVdizC (D=01)
[etc., etc.]
Last edited by tom_seddon on Tue Nov 27, 2018 1:28 pm, edited 2 times in total.

Coeus
Posts: 1314
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by Coeus » Tue Nov 27, 2018 1:50 pm

tom_seddon wrote:
Tue Nov 27, 2018 1:23 pm
...b2 also suffered from the T1 issue, but it did sort-of do the right thing provided DDRB bit 7 was always an input, so Snapper-V1 happened to work, by accident, in most cases. Now fixed.
Interesting. My understanding of the test case from earlier in the thread running on a real machine is that this is only supposed to work when the DDDR has bit 7 as an input.

I don't know how this is implemented on silicon but it seems to work as if there is an extra bit due to the timer that is fed to the output pin independent of the state of the DDDR and not through the ODR. That means if one reads the port when PB7 is set as an output you would get the value from the ODR which does not change, whereas when configured as an input that bit would correspond to the output being placed on PB7 by the timer, unless some external device was driving that pin more strongly in the other direction. Although I don't think either of these games depend on it, that probably also means this timer-driven PB7 should be subject to the same live/latched behaviour as any other input pin.

Coeus
Posts: 1314
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by Coeus » Tue Nov 27, 2018 1:56 pm

scarybeasts wrote:
Tue Nov 27, 2018 2:00 am
Oh, I am vaguely terrified of the 6845, not sure how strongly I'll bat for accuracy there. In terms of what's observable to 6502 code, most of the 6845 is read-only. If we discount the light pen feedback, the main (only?) observable is the vsync interrupt timing.
Also memory address generation and the relationship between that and vsync.

The data sheet describes the effects of the various register on the assumption that they are programmed up for the desired display mode and then left alone, much the way the BBC MOS does for the standard display modes, but some games re-program these registers as the display progresses so we then get into such complexities as to what happens if one of the limit (total) registers gets changed from above the current count to below it or vice versa and other such subtleties.

tom_seddon
Posts: 312
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by tom_seddon » Tue Nov 27, 2018 2:36 pm

Coeus wrote:
Tue Nov 27, 2018 1:50 pm
My understanding of the test case from earlier in the thread running on a real machine is that this is only supposed to work when the DDDR has bit 7 as an input.

I don't know how this is implemented on silicon but it seems to work as if there is an extra bit due to the timer that is fed to the output pin independent of the state of the DDDR and not through the ODR. That means if one reads the port when PB7 is set as an output you would get the value from the ODR which does not change, whereas when configured as an input that bit would correspond to the output being placed on PB7 by the timer, unless some external device was driving that pin more strongly in the other direction. Although I don't think either of these games depend on it, that probably also means this timer-driven PB7 should be subject to the same live/latched behaviour as any other input pin.
It seems to work if PB7 is an output too, even though this is supposed to read ORB rather than the pin levels. Modify the test program by adding 91?&FE62=255 (port B all outputs) and you'll see PB7 low when read on line 130 (before T1 expiry) and high at line 170 (after T1 expiry).

The MAME 6522 code merges inputs and outputs according to DDRB, then adds the T1 value on top regardless: https://github.com/mamedev/mame/blob/b6 ... a.cpp#L518

I did try to see whether latching made a difference, but I couldn't get it working at all in my quick test with a few wires connected to the user port. MAME does imply the T1 output is latched, though: https://github.com/mamedev/mame/blob/b6 ... .cpp#L1050

(I may have another go with my tests when I've got half an hour to be a bit more organised about it...)

--Tom
Last edited by tom_seddon on Tue Nov 27, 2018 2:37 pm, edited 1 time in total.

User avatar
Rich Talbot-Watkins
Posts: 1512
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by Rich Talbot-Watkins » Tue Nov 27, 2018 3:24 pm

If I remember correctly, there's a subtle difference between how Port A and Port B work too (one of them latches the inputs or something). I can't remember if I implemented it in jsbeeb now, but I know B-Em doesn't handle them distinctly.

User avatar
SarahWalker
Posts: 1179
Joined: Fri Jan 14, 2005 3:56 pm
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by SarahWalker » Tue Nov 27, 2018 4:46 pm

Latching's supported on both ports, via CA1/CB1 and enabled/disabled by bits 0 and 1 of the ACR. You may be thinking of handshaking? Port A can be accessed without handshaking (via &FExF), while port B can't.

tom_seddon
Posts: 312
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: Can someone try some simple 6522 VIA queries for me on a real BBC?

Post by tom_seddon » Tue Nov 27, 2018 5:24 pm

Maybe Rich means the thing whereby when you read port A you get pin values or latched pin values (and DDRA plays no role - it's controlled entirely by latching enable/disable), and when you read pin B you get pin values (for output bits) or ORB/latched pin values (for input bits).

--Tom

Post Reply