mirror of
https://github.com/ivanizag/izapple2.git
synced 2025-01-09 04:31:51 +00:00
Properly emulate no joysticks available
This commit is contained in:
parent
74e0cc4768
commit
fd13326367
@ -38,7 +38,7 @@ type SpeakerProvider interface {
|
|||||||
// JoysticksProvider declares de the joysticks
|
// JoysticksProvider declares de the joysticks
|
||||||
type JoysticksProvider interface {
|
type JoysticksProvider interface {
|
||||||
ReadButton(i int) bool
|
ReadButton(i int) bool
|
||||||
ReadPaddle(i int) uint8
|
ReadPaddle(i int) (uint8, bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://www.kreativekorp.com/miscpages/a2info/iomemory.shtml
|
// See https://www.kreativekorp.com/miscpages/a2info/iomemory.shtml
|
||||||
|
@ -154,9 +154,12 @@ const paddleToCyclesFactor = 11
|
|||||||
func getPaddleSoftSwitch(i int) softSwitchR {
|
func getPaddleSoftSwitch(i int) softSwitchR {
|
||||||
return func(io *ioC0Page) uint8 {
|
return func(io *ioC0Page) uint8 {
|
||||||
if io.joysticks == nil {
|
if io.joysticks == nil {
|
||||||
return 127
|
return 255 // Capacitors never discharge if there is not joystick
|
||||||
|
}
|
||||||
|
reading, hasData := io.joysticks.ReadPaddle(i)
|
||||||
|
if !hasData {
|
||||||
|
return 255 // Capacitors never discharge if there is not joystick
|
||||||
}
|
}
|
||||||
reading := io.joysticks.ReadPaddle(i)
|
|
||||||
cyclesNeeded := uint64(reading) * paddleToCyclesFactor
|
cyclesNeeded := uint64(reading) * paddleToCyclesFactor
|
||||||
cyclesElapsed := io.apple2.cpu.GetCycles() - io.paddlesStrobeCycle
|
cyclesElapsed := io.apple2.cpu.GetCycles() - io.paddlesStrobeCycle
|
||||||
if cyclesElapsed < cyclesNeeded {
|
if cyclesElapsed < cyclesNeeded {
|
||||||
|
Loading…
Reference in New Issue
Block a user