mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-12-26 20:29:50 +00:00
Support for 4 disks on the command line. Support tyo trace track changes.
This commit is contained in:
parent
63e3e8b80b
commit
8ea72357d5
@ -199,6 +199,10 @@ Only valid on SDL mode
|
||||
rom file for the disk drive controller (default "<internal>/DISK2.rom")
|
||||
-diskb string
|
||||
file to load on the second disk drive
|
||||
-diskc string
|
||||
file to load on the third disk drive, slot 5
|
||||
-diskd string
|
||||
file to load on the fourth disk drive, slot 5
|
||||
-fastChipSlot int
|
||||
slot for the FASTChip accelerator card, -1 for none (default 3)
|
||||
-forceCaps
|
||||
@ -259,6 +263,8 @@ Only valid on SDL mode
|
||||
dump to the console the sofswitches calls
|
||||
-traceSSReg
|
||||
dump to the console the sofswitch registrations
|
||||
-traceTracks
|
||||
dump to the console the disk tracks changes
|
||||
-vidHDSlot int
|
||||
slot for the VidHD card, only for //e models. -1 for none (default 2)
|
||||
-videxCardSlot int
|
||||
|
@ -24,6 +24,14 @@ func MainApple() *Apple2 {
|
||||
"diskb",
|
||||
"",
|
||||
"file to load on the second disk drive")
|
||||
diskCImage := flag.String(
|
||||
"diskc",
|
||||
"",
|
||||
"file to load on the third disk drive, slot 5")
|
||||
diskDImage := flag.String(
|
||||
"diskd",
|
||||
"",
|
||||
"file to load on the fourth disk drive, slot 5")
|
||||
hardDiskImage := flag.String(
|
||||
"hd",
|
||||
"",
|
||||
@ -136,6 +144,10 @@ func MainApple() *Apple2 {
|
||||
"traceSP",
|
||||
false,
|
||||
"dump to the console the smarport commands")
|
||||
traceTracks := flag.Bool(
|
||||
"traceTracks",
|
||||
false,
|
||||
"dump to the console the disk tracks changes")
|
||||
model := flag.String(
|
||||
"model",
|
||||
"2enh",
|
||||
@ -267,11 +279,28 @@ func MainApple() *Apple2 {
|
||||
a.AddSwyftCard()
|
||||
}
|
||||
|
||||
var trackTracer trackTracer
|
||||
if *traceTracks {
|
||||
trackTracer = makeTrackTracerLogger()
|
||||
}
|
||||
|
||||
if *smartPortImage != "" {
|
||||
err := a.AddSmartPortDisk(5, *smartPortImage, *traceHD, *traceSP)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else if *diskCImage != "" || *diskDImage != "" {
|
||||
if *sequencerDisk2 {
|
||||
err := a.AddDisk2Sequencer(5, *diskCImage, *diskDImage, trackTracer)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
err := a.AddDisk2(5, *diskCImage, *diskDImage, trackTracer)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if *fujinetSlot >= 0 {
|
||||
@ -283,12 +312,12 @@ func MainApple() *Apple2 {
|
||||
}
|
||||
if *disk2Slot > 0 {
|
||||
if *sequencerDisk2 {
|
||||
err := a.AddDisk2Sequencer(*disk2Slot, diskImageFinal, *diskBImage, nil)
|
||||
err := a.AddDisk2Sequencer(*disk2Slot, diskImageFinal, *diskBImage, trackTracer)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
err := a.AddDisk2(*disk2Slot, diskImageFinal, *diskBImage, nil)
|
||||
err := a.AddDisk2(*disk2Slot, diskImageFinal, *diskBImage, trackTracer)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -94,20 +94,19 @@ func (c *CardDisk2) assign(a *Apple2, slot int) {
|
||||
drive.trackStep = moveDriveStepper(drive.phases, drive.trackStep)
|
||||
|
||||
if c.trackTracer != nil {
|
||||
c.trackTracer.traceTrack(drive.trackStep)
|
||||
c.trackTracer.traceTrack(drive.trackStep, c.slot, c.selected)
|
||||
}
|
||||
|
||||
return c.dataLatch // All even addresses return the last dataLatch
|
||||
}, fmt.Sprintf("PHASE%vOFF", phase))
|
||||
|
||||
c.addCardSoftSwitchR((phase<<1)+1, func() uint8 {
|
||||
// Update magnets and position
|
||||
c.addCardSoftSwitchR((phase<<1)+1, func() uint8 { // Update magnets and position
|
||||
drive := &c.drive[c.selected]
|
||||
drive.phases |= (1 << phase)
|
||||
drive.trackStep = moveDriveStepper(drive.phases, drive.trackStep)
|
||||
|
||||
if c.trackTracer != nil {
|
||||
c.trackTracer.traceTrack(drive.trackStep)
|
||||
c.trackTracer.traceTrack(drive.trackStep, slot, c.selected)
|
||||
}
|
||||
|
||||
return 0
|
||||
|
@ -178,14 +178,14 @@ func (c *CardDisk2Sequencer) step(data uint8, firstStep bool) bool {
|
||||
q1 := c.q[1]
|
||||
q2 := c.q[2]
|
||||
q3 := c.q[3]
|
||||
c.drive[0].moveHead(q0, q1, q2, q3, c.trackTracer)
|
||||
c.drive[1].moveHead(q0, q1, q2, q3, c.trackTracer)
|
||||
c.drive[0].moveHead(q0, q1, q2, q3, c.trackTracer, c.slot, 0)
|
||||
c.drive[1].moveHead(q0, q1, q2, q3, c.trackTracer, c.slot, 1)
|
||||
}
|
||||
|
||||
/*
|
||||
The reading from the drive is converted to a pulse detecting
|
||||
changes using Q3 and Q4 of the flip flop, combined with
|
||||
the last quarter of the 74LS132 NAND.
|
||||
the last quarter of the 74LS132 NAND.∫
|
||||
The woz format provides the pulse directly and we won't emulate
|
||||
this detection.
|
||||
*/
|
||||
|
@ -48,7 +48,7 @@ func (d *cardDisk2SequencerDrive) enable(enabled bool) {
|
||||
d.enabled = enabled
|
||||
}
|
||||
|
||||
func (d *cardDisk2SequencerDrive) moveHead(q0, q1, q2, q3 bool, trackTracer trackTracer) {
|
||||
func (d *cardDisk2SequencerDrive) moveHead(q0, q1, q2, q3 bool, trackTracer trackTracer, slot int, driveNumber int) {
|
||||
if !d.enabled {
|
||||
return
|
||||
}
|
||||
@ -60,7 +60,7 @@ func (d *cardDisk2SequencerDrive) moveHead(q0, q1, q2, q3 bool, trackTracer trac
|
||||
d.currentQuarterTrack = moveDriveStepper(phases, d.currentQuarterTrack)
|
||||
|
||||
if trackTracer != nil {
|
||||
trackTracer.traceTrack(d.currentQuarterTrack)
|
||||
trackTracer.traceTrack(d.currentQuarterTrack, slot, driveNumber)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,5 +102,5 @@ func (a *Apple2) changeDisk(unit int, path string) error {
|
||||
if unit < len(a.removableMediaDrives) {
|
||||
return a.removableMediaDrives[unit].insertDiskette(path)
|
||||
}
|
||||
return fmt.Errorf("Unit %v not defined", unit)
|
||||
return fmt.Errorf("unit %v not defined", unit)
|
||||
}
|
||||
|
@ -1,9 +1,26 @@
|
||||
package izapple2
|
||||
|
||||
import "fmt"
|
||||
|
||||
type trackTracer interface {
|
||||
traceTrack(quarterTrack int)
|
||||
traceTrack(quarterTrack int, slot int, drive int)
|
||||
}
|
||||
|
||||
// ///////////////
|
||||
// TrackTracerLogger is a track tracer that logs to the console
|
||||
type trackTracerLogger struct {
|
||||
}
|
||||
|
||||
func makeTrackTracerLogger() *trackTracerLogger {
|
||||
return &trackTracerLogger{}
|
||||
}
|
||||
|
||||
func (tt *trackTracerLogger) traceTrack(quarterTrack int, slot int, drive int) {
|
||||
fmt.Printf("Slot %v, drive %v, track %v\n", slot, drive, quarterTrack)
|
||||
}
|
||||
|
||||
// ///////////////
|
||||
// TrackTracerSummary is a track tracer that stores the track changes
|
||||
type trackTracerSummary struct {
|
||||
quarterTracks []int
|
||||
}
|
||||
@ -14,7 +31,7 @@ func makeTrackTracerSummary() *trackTracerSummary {
|
||||
return &tt
|
||||
}
|
||||
|
||||
func (tt *trackTracerSummary) traceTrack(quarterTrack int) {
|
||||
func (tt *trackTracerSummary) traceTrack(quarterTrack int, _slot int, _drive int) {
|
||||
if tt == nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user