| |
TWW
Registered: Jul 2009 Posts: 545 |
Reading C1531 Mouse from both ports
In the C64 & C128, the SID POT lines are connected to both joystick ports. A 4066 analog switch is used to switch the POT lines between the two ports based on one of the keyboard scan lines. This means that the normal keyscan interrupt temporarily affects the values returned in the POT registers. Therefore, in order to perform reliable conversions, the POT lines must be connected to the mouse for a period >1.6 millisecond before the value in the POT register is valid.
I tried reading the POTs as follows:
lda #$80 // select Joyport #2
sta $dc00
waste 512 cycles
lda $d419
-doshit
lda $d41a
-doshit
lda #$40 // select Joyport #1
sta $dc00
waste 512 cycles
lda $d419
-doshit
lda $d41a
-doshit
rts
From the referance manual:
DC00 56320 Data Port A (Keyboard, Joystick, Paddles, Light-Pen)
7-0 Write Keyboard Column Values for Keyboard Scan
7-6 Read Paddles on Port A / B (01 = Port A, 10 = Port B)
4 Joystick A Fire Button: 1 = Fire
3-2 Paddle Fire Buttons
3-0 Joystick A Direction (0-15)
On both vice & ccs64 this gives funny readings. Have I gotten this all wrong or is it simply not emulated good enough?
-TWW |
|
| |
TWW
Registered: Jul 2009 Posts: 545 |
Let me rephrase:
I am currently working on a IO-Driver which automatically detects if it's a mouse or a joystick (Or even two mice or joysticks or combination mouse & joystick) and at the same time handles the Keyboard in a 'correct' manner. But I am limited to working with emus and hence the nag...
IF a routine looks as follows:
(DDR's set to default)
:IRQInit
irq:
lda $d419 // Read PotX
sta $0400
lda $d41a // Read PotY
sta $0401
pla
tax
pla
tay
pla
rti
In VICE I get readings regardless of which mouse port i "plug" the c1531 mouse into while on CCS64 it will only react if I "plug" the mouse into Port #1 (which is the way it should be if I understand the documentation correctly).
However the mouse emulation on CCS64 messes up the bits (ASL them) for some strage reason (as mentioned in another post)..
Conclution: Mouse emulation is flawed on both emulators.
IMO: The POT input should be flip-flopped between port A or Port B depending on the 2 MSBs of $dc00 (#$40 or #$80). And Mouse buttons should be read from Bit #5 & 1 of the corresponding port.
Are there someone who has any experience regarding this or perhaps the chance to test this on a real C64 ad a C1531 mouse (I will happily provide some "test-software" if you need it)...
|
| |
JackAsser
Registered: Jun 2002 Posts: 2014 |
I came to the same conclusion for my mouse driver in Eye of the Beholder. More over, VICE only send the mouse buttons to port 1, but port values to both iirc. Or something like that... :) It was a while ago I coded it so my memory isn't exactly fresh. |
| |
zyga Account closed
Registered: Mar 2009 Posts: 6 |
Long time ago, I've found strange behavior in 2 versions of Lemmings (crack) on real machine (C128DCR).
While this game supports mouse1531 in proportional mode and cursor moves smoothly, mouse buttons doesn't have any effect !
Instead of it, joystick button in opposite port works well !
But it seems little uncomfortable to move cursor by mouse, and click by joystick :) Of course joystick emulation mode was working as expected.
I don't know if this is crack "feature", my machine failure (although AmicaPaint an Geos works fine), or bug in game itself. |
| |
enthusi
Registered: May 2004 Posts: 677 |
I noticed the x/y and button issue between port 1/2 in vice.
Confuses people in ManiacMansion Gold sometimes.
I can run a test-prg on real thing with 1351 if needed.
Joy+mouse in MM was a mess. In the end I decided to add the 'mouse toggle' key (for numerous reasons).
|
| |
Nafcom
Registered: Apr 2002 Posts: 588 |
Quote: Long time ago, I've found strange behavior in 2 versions of Lemmings (crack) on real machine (C128DCR).
While this game supports mouse1531 in proportional mode and cursor moves smoothly, mouse buttons doesn't have any effect !
Instead of it, joystick button in opposite port works well !
But it seems little uncomfortable to move cursor by mouse, and click by joystick :) Of course joystick emulation mode was working as expected.
I don't know if this is crack "feature", my machine failure (although AmicaPaint an Geos works fine), or bug in game itself.
I own the original version of Lemmings, in fact the buttons of the Commmodore 1531 mouse do work, (all port 1 only).
And I have tried it with different 1531 mice clones but no chance, there the movements do not work
(I have tried a CMD SmartMouse and a Scantronik mouse). So it only works wth the originals even though claimed to be 100% compatible clones.
Tried on different C64s, too. |
| |
zyga Account closed
Registered: Mar 2009 Posts: 6 |
I have had original 1531 (original Commodore box with Geos driver and book), but Lemmings was not original.
Sadly, I do not have this C128DCR nor 1531 anymore... |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Quote: I noticed the x/y and button issue between port 1/2 in vice.
Confuses people in ManiacMansion Gold sometimes.
I can run a test-prg on real thing with 1351 if needed.
Joy+mouse in MM was a mess. In the end I decided to add the 'mouse toggle' key (for numerous reasons).
Alright. I'll send you a .prg file and I am very curious what you find out
aspect of my code might be screwed too so I hope we can come up with a full-good solution which works on the real thing the nag the emu-people untill they get it right :)
brgds! |
| |
rattus Account closed
Registered: Oct 2002 Posts: 14 |
Not really related, but Interpaint version with support for amiga mouse works like a charm with amiga mouse... Everyone has 1 amiga mouse stored somewhere, so... :) |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Update:
Tested under hoxs64 emu but couldn't figgure out how to enable c1351 mouse emulation..... |
| |
enthusi
Registered: May 2004 Posts: 677 |
TWW, thx - will test today and post here. cool |
... 3 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 - Next |