| |
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 |
|
... 3 posts hidden. Click here to view all posts.... |
| |
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 |
| |
enthusi
Registered: May 2004 Posts: 677 |
TWW,
c1351 in port2:
CARRY becomes set
ACC becomes %11111111
movement caused 'change' in $fe,$ff
both buttons have no effect
port1:
CARRY clear
ACC %00111111
movements show in $fc (green?!),$fd
left button: Y-REg = %10000000
right button: Y-REg = %01000000
PADDLES:
one plug, 2 paddles
@port2: change in $fe,$ff
button - nothing
Same for both paddels
@port1:
change in $fc,$fd
button changes Y to %1000000
for both paddles!
ACC and CARRY same as for mouse depending on port-connection.
Hope, this helps :)
Would be nicer to have an actual pointer in your test-code as well.
And why is the irq that unstable?
No SEI?
RESTORE changes $fb at least...
Cheers,
enthusi
|
| |
TWW
Registered: Jul 2009 Posts: 545 |
Quote: TWW,
c1351 in port2:
CARRY becomes set
ACC becomes %11111111
movement caused 'change' in $fe,$ff
both buttons have no effect
port1:
CARRY clear
ACC %00111111
movements show in $fc (green?!),$fd
left button: Y-REg = %10000000
right button: Y-REg = %01000000
PADDLES:
one plug, 2 paddles
@port2: change in $fe,$ff
button - nothing
Same for both paddels
@port1:
change in $fc,$fd
button changes Y to %1000000
for both paddles!
ACC and CARRY same as for mouse depending on port-connection.
Hope, this helps :)
Would be nicer to have an actual pointer in your test-code as well.
And why is the irq that unstable?
No SEI?
RESTORE changes $fb at least...
Cheers,
enthusi
Interesting...
The change you are experiencing on $fc, fd, fe & ff is the X & Y change in signed byte from the 2 ports (Meaning bit #7 = 1 means negative direcition change and 0 means positive direction change(for the mice)). AFAICT this is then working as it should do. I'll include a "pointer" to check this properly and make you happpy at the same time aswell ;]
The green you get is a confirmed detection of mouse in Port #1 (However I have not made that for port #2 yet so i'll include that in next driver ^^) However it is strange that the Carry isn't set in this case but then again I need to re-evaluate my code here a little bit...
LMB/RMB from mouse-port #2 should be shown in the 2 MSB of the Accumulator so I need to re-think that one aswell...
plan:
Recode known bugs and map up $dc00 while reading mousebuttons from port #2 to figgure out what is going on there. Also I'll add more green depending on detection or not :) and ofcourse the pointer (I'll set up different collours aswell depending on Mouse port #1 or 2^^)
If we can make this SW work properly I'll upload it here as a "test-program" which emu-ppl and other with real HW can use for testing purposes AND hopefully it can also serve as a standard IO driver for those who don't want to use the KERNA/EL.
Ignore IRQ/NMI stuff as this isn't set up to do nothing except call the routine each frame and display data.
Thanx for your prompt response and Hopefully I'll have something new to try during the weekend.
cheers TWW/CTR |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Alright A new version is ready. I have uploaded it here on CSDB: C1351 Mouse Driver / Test Software
Eagerly awaiting test results C",)
TWW/CTR |
Previous - 1 | 2 - Next |