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

View File

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

View File

@ -185,6 +185,9 @@ func readWrite(address uint16, isRead bool) bool {
DriveState.Phase = uint8(phase) DriveState.Phase = uint8(phase)
MakeTrackData(DriveState.ArmPosition) MakeTrackData(DriveState.ArmPosition)
if audio.ClickWhenDriveHeadMoves {
audio.Click()
}
} }
return true 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) { func RunUntilBreakPoint(t *testing.T, breakAddress uint16, seconds int, showInstructions bool, message string) {
fmt.Printf("Running until %#04x: %s \n", breakAddress, message) fmt.Printf("Running until %#04x: %s \n", breakAddress, message)
system.FrameCycles = 0 system.FrameCycles = 0
system.LastAudioCycles = 0
exitAtBreak := false exitAtBreak := false
disableFirmwareWait := false disableFirmwareWait := false
cpu.Run(showInstructions, &breakAddress, exitAtBreak, disableFirmwareWait, uint64(system.CpuFrequency*seconds)) cpu.Run(showInstructions, &breakAddress, exitAtBreak, disableFirmwareWait, uint64(system.CpuFrequency*seconds))