Added optional click when drive head moves

Very primitive but kind of entertaining.
This commit is contained in:
Will Angenent 2018-05-19 10:55:41 +01:00
parent bdcf3e0db7
commit c26b44c686
4 changed files with 12 additions and 4 deletions

View File

@ -68,6 +68,7 @@ func main() {
breakAddressString := flag.String("break", "", "Break on address")
mute := flag.Bool("mute", false, "Mute sound")
diskImage := flag.String("image", "", "Disk Image")
clickWhenDriveHeadMoves := flag.Bool("drive-head-click", false, "Click speaker when drive head moves")
flag.Parse()
breakAddress = utils.DecodeCmdLineAddress(breakAddressString)
@ -88,6 +89,7 @@ func main() {
video.Init()
audio.InitEbiten()
audio.Mute = *mute
audio.ClickWhenDriveHeadMoves = *clickWhenDriveHeadMoves
system.Init()
cpu.Reset()

View File

@ -8,10 +8,11 @@ import (
)
var (
audioContext *ebiten_audio.Context
player *ebiten_audio.Player
firstAudio bool
Mute bool
audioContext *ebiten_audio.Context
player *ebiten_audio.Player
firstAudio bool
Mute bool
ClickWhenDriveHeadMoves bool
)
type stream struct{}
@ -62,6 +63,7 @@ func (s *stream) Close() error {
func InitEbiten() {
firstAudio = true
Mute = false
ClickWhenDriveHeadMoves = false
var err error
audioContext, err = ebiten_audio.NewContext(system.AudioSampleRate)

View File

@ -185,6 +185,9 @@ func readWrite(address uint16, isRead bool) bool {
DriveState.Phase = uint8(phase)
MakeTrackData(DriveState.ArmPosition)
if audio.ClickWhenDriveHeadMoves {
audio.Click()
}
}
return true

View File

@ -52,6 +52,7 @@ func DecodeCmdLineAddress(s *string) (result *uint16) {
func RunUntilBreakPoint(t *testing.T, breakAddress uint16, seconds int, showInstructions bool, message string) {
fmt.Printf("Running until %#04x: %s \n", breakAddress, message)
system.FrameCycles = 0
system.LastAudioCycles = 0
exitAtBreak := false
disableFirmwareWait := false
cpu.Run(showInstructions, &breakAddress, exitAtBreak, disableFirmwareWait, uint64(system.CpuFrequency*seconds))