Skip to content

Commit

Permalink
Control Panel DA: Fix overflowing paddle reads. Fixes #173
Browse files Browse the repository at this point in the history
  • Loading branch information
inexorabletash committed Dec 29, 2019
1 parent 6c34fbe commit af2e0ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 11 additions & 4 deletions desk.acc/control.panel.s
Expand Up @@ -1504,19 +1504,26 @@ pdl3: .byte 0
;; Let any previous timer reset (but don't wait forever)
ldy #0
: dey
nop ; Empirically, 4 NOPs are needed here.
nop ; https://github.com/a2stuff/a2d/issues/173
nop
nop
beq :+
lda PADDL0,x
bmi :-

;; Read paddle
: lda PTRIG
ldy #0
nop
;; Apple IIe Tech Note #6 - The Apple II Paddle Circuits
;; http://www.1000bit.it/support/manuali/apple/technotes/aiie/tn.aiie.06.html
: lda PTRIG ; Trigger paddles
ldy #0 ; Init counter
nop ; ... and wait for first count
nop
: lda PADDL0,X
: lda PADDL0,X ; 11 microsecond loop
bpl done
iny
bne :-
dey ; handle overflow
done: rts
.endproc

Expand Down
2 changes: 2 additions & 0 deletions mgtk/mgtk.s
Expand Up @@ -4623,6 +4623,8 @@ savesize: .res 2
bit subid
bvs :+

;; Apple IIc Tech Note #1 - Mouse Differences on IIe and IIc
;; http://www.1000bit.it/support/manuali/apple/technotes/aiic/tn.aiic.1.html
lda #2 ; default scaling for IIc/IIc+
sta mouse_scale_x
lda #1
Expand Down

0 comments on commit af2e0ad

Please sign in to comment.