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")
|
rom file for the disk drive controller (default "<internal>/DISK2.rom")
|
||||||
-diskb string
|
-diskb string
|
||||||
file to load on the second disk drive
|
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
|
-fastChipSlot int
|
||||||
slot for the FASTChip accelerator card, -1 for none (default 3)
|
slot for the FASTChip accelerator card, -1 for none (default 3)
|
||||||
-forceCaps
|
-forceCaps
|
||||||
@ -259,6 +263,8 @@ Only valid on SDL mode
|
|||||||
dump to the console the sofswitches calls
|
dump to the console the sofswitches calls
|
||||||
-traceSSReg
|
-traceSSReg
|
||||||
dump to the console the sofswitch registrations
|
dump to the console the sofswitch registrations
|
||||||
|
-traceTracks
|
||||||
|
dump to the console the disk tracks changes
|
||||||
-vidHDSlot int
|
-vidHDSlot int
|
||||||
slot for the VidHD card, only for //e models. -1 for none (default 2)
|
slot for the VidHD card, only for //e models. -1 for none (default 2)
|
||||||
-videxCardSlot int
|
-videxCardSlot int
|
||||||
|
@ -24,6 +24,14 @@ func MainApple() *Apple2 {
|
|||||||
"diskb",
|
"diskb",
|
||||||
"",
|
"",
|
||||||
"file to load on the second disk drive")
|
"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(
|
hardDiskImage := flag.String(
|
||||||
"hd",
|
"hd",
|
||||||
"",
|
"",
|
||||||
@ -136,6 +144,10 @@ func MainApple() *Apple2 {
|
|||||||
"traceSP",
|
"traceSP",
|
||||||
false,
|
false,
|
||||||
"dump to the console the smarport commands")
|
"dump to the console the smarport commands")
|
||||||
|
traceTracks := flag.Bool(
|
||||||
|
"traceTracks",
|
||||||
|
false,
|
||||||
|
"dump to the console the disk tracks changes")
|
||||||
model := flag.String(
|
model := flag.String(
|
||||||
"model",
|
"model",
|
||||||
"2enh",
|
"2enh",
|
||||||
@ -267,11 +279,28 @@ func MainApple() *Apple2 {
|
|||||||
a.AddSwyftCard()
|
a.AddSwyftCard()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var trackTracer trackTracer
|
||||||
|
if *traceTracks {
|
||||||
|
trackTracer = makeTrackTracerLogger()
|
||||||
|
}
|
||||||
|
|
||||||
if *smartPortImage != "" {
|
if *smartPortImage != "" {
|
||||||
err := a.AddSmartPortDisk(5, *smartPortImage, *traceHD, *traceSP)
|
err := a.AddSmartPortDisk(5, *smartPortImage, *traceHD, *traceSP)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
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 {
|
if *fujinetSlot >= 0 {
|
||||||
@ -283,12 +312,12 @@ func MainApple() *Apple2 {
|
|||||||
}
|
}
|
||||||
if *disk2Slot > 0 {
|
if *disk2Slot > 0 {
|
||||||
if *sequencerDisk2 {
|
if *sequencerDisk2 {
|
||||||
err := a.AddDisk2Sequencer(*disk2Slot, diskImageFinal, *diskBImage, nil)
|
err := a.AddDisk2Sequencer(*disk2Slot, diskImageFinal, *diskBImage, trackTracer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err := a.AddDisk2(*disk2Slot, diskImageFinal, *diskBImage, nil)
|
err := a.AddDisk2(*disk2Slot, diskImageFinal, *diskBImage, trackTracer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -94,20 +94,19 @@ func (c *CardDisk2) assign(a *Apple2, slot int) {
|
|||||||
drive.trackStep = moveDriveStepper(drive.phases, drive.trackStep)
|
drive.trackStep = moveDriveStepper(drive.phases, drive.trackStep)
|
||||||
|
|
||||||
if c.trackTracer != nil {
|
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
|
return c.dataLatch // All even addresses return the last dataLatch
|
||||||
}, fmt.Sprintf("PHASE%vOFF", phase))
|
}, fmt.Sprintf("PHASE%vOFF", phase))
|
||||||
|
|
||||||
c.addCardSoftSwitchR((phase<<1)+1, func() uint8 {
|
c.addCardSoftSwitchR((phase<<1)+1, func() uint8 { // Update magnets and position
|
||||||
// Update magnets and position
|
|
||||||
drive := &c.drive[c.selected]
|
drive := &c.drive[c.selected]
|
||||||
drive.phases |= (1 << phase)
|
drive.phases |= (1 << phase)
|
||||||
drive.trackStep = moveDriveStepper(drive.phases, drive.trackStep)
|
drive.trackStep = moveDriveStepper(drive.phases, drive.trackStep)
|
||||||
|
|
||||||
if c.trackTracer != nil {
|
if c.trackTracer != nil {
|
||||||
c.trackTracer.traceTrack(drive.trackStep)
|
c.trackTracer.traceTrack(drive.trackStep, slot, c.selected)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
@ -178,14 +178,14 @@ func (c *CardDisk2Sequencer) step(data uint8, firstStep bool) bool {
|
|||||||
q1 := c.q[1]
|
q1 := c.q[1]
|
||||||
q2 := c.q[2]
|
q2 := c.q[2]
|
||||||
q3 := c.q[3]
|
q3 := c.q[3]
|
||||||
c.drive[0].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.drive[1].moveHead(q0, q1, q2, q3, c.trackTracer, c.slot, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The reading from the drive is converted to a pulse detecting
|
The reading from the drive is converted to a pulse detecting
|
||||||
changes using Q3 and Q4 of the flip flop, combined with
|
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
|
The woz format provides the pulse directly and we won't emulate
|
||||||
this detection.
|
this detection.
|
||||||
*/
|
*/
|
||||||
|
@ -48,7 +48,7 @@ func (d *cardDisk2SequencerDrive) enable(enabled bool) {
|
|||||||
d.enabled = enabled
|
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 {
|
if !d.enabled {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ func (d *cardDisk2SequencerDrive) moveHead(q0, q1, q2, q3 bool, trackTracer trac
|
|||||||
d.currentQuarterTrack = moveDriveStepper(phases, d.currentQuarterTrack)
|
d.currentQuarterTrack = moveDriveStepper(phases, d.currentQuarterTrack)
|
||||||
|
|
||||||
if trackTracer != nil {
|
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) {
|
if unit < len(a.removableMediaDrives) {
|
||||||
return a.removableMediaDrives[unit].insertDiskette(path)
|
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
|
package izapple2
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
type trackTracer interface {
|
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 {
|
type trackTracerSummary struct {
|
||||||
quarterTracks []int
|
quarterTracks []int
|
||||||
}
|
}
|
||||||
@ -14,7 +31,7 @@ func makeTrackTracerSummary() *trackTracerSummary {
|
|||||||
return &tt
|
return &tt
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tt *trackTracerSummary) traceTrack(quarterTrack int) {
|
func (tt *trackTracerSummary) traceTrack(quarterTrack int, _slot int, _drive int) {
|
||||||
if tt == nil {
|
if tt == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user