Skip to content

Commit

Permalink
Dan ][ Controller card
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanizag committed Jan 29, 2024
1 parent f0f8d64 commit 18c0779
Show file tree
Hide file tree
Showing 9 changed files with 447 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ Portable emulator of an Apple II+ or //e. Written in Go.
- No Slot Clock based on the DS1216
- Videx Videoterm 80 column card with the Videx Soft Video Switch (Apple ][+ only)
- SwyftCard (Apple //e only)
- Brain Board
- Brain Board II
- MultiROM card
- Dan ][ Controller card
- Useful cards not emulating a real card
- Bootable SmartPort / ProDOS card with the following smartport devices:
- Block device (hard disks)
Expand Down
2 changes: 1 addition & 1 deletion apple2Run.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (a *Apple2) Start(paused bool) {
for i := 0; i < cpuSpinLoops; i++ {
// Conditional tracing
//pc, _ := a.cpu.GetPCAndSP()
//a.cpu.SetTrace(pc >= 0x7f0 && pc < 0x0820)
//a.cpu.SetTrace(pc >= 0xc75e && pc < 0xc800)

// Execution
a.cpu.ExecuteInstruction()
Expand Down
20 changes: 19 additions & 1 deletion cardBase.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ type Card interface {
assign(a *Apple2, slot int)
reset()

setName(name string)
setDebug(debug bool)
GetName() string
GetInfo() map[string]string
}

type cardBase struct {
a *Apple2
name string
romCsxx memoryHandler
trace bool
romCsxx *memoryRangeROM
romC8xx memoryHandler
romCxxx memoryHandler

Expand All @@ -28,6 +31,10 @@ type cardBase struct {
_sswName [16]string
}

func (c *cardBase) setName(name string) {
c.name = name
}

func (c *cardBase) GetName() string {
return c.name
}
Expand All @@ -36,6 +43,10 @@ func (c *cardBase) GetInfo() map[string]string {
return nil
}

func (c *cardBase) setDebug(debug bool) {
c.trace = debug
}

func (c *cardBase) reset() {
// nothing
}
Expand Down Expand Up @@ -143,3 +154,10 @@ func (c *cardBase) addCardSoftSwitches(sss softSwitches, name string) {
}, fmt.Sprintf("%v%XW", name, address))
}
}

func (c *cardBase) tracef(format string, args ...interface{}) {
if c.trace {
prefixedFormat := fmt.Sprintf("[%s] %v", c.name, format)
fmt.Printf(prefixedFormat, args...)
}
}
11 changes: 5 additions & 6 deletions cardBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type cardBuilder struct {
const noCardName = "empty"

var commonParams = []paramSpec{
{"debug", "Enable debug messages", "false"},
{"tracess", "Trace softswitches", "false"},
}

Expand All @@ -37,7 +38,7 @@ func getCardFactory() map[string]*cardBuilder {
cardFactory = make(map[string]*cardBuilder)
cardFactory["brainboard"] = newCardBrainBoardBuilder()
cardFactory["brainboard2"] = newCardBrainBoardIIBuilder()
//cardFactory["dan2sd"] = newCardDan2ControllerBuilder()
cardFactory["dan2sd"] = newCardDan2ControllerBuilder()
cardFactory["diskii"] = newCardDisk2Builder()
cardFactory["diskiiseq"] = newCardDisk2SequencerBuilder()
cardFactory["fastchip"] = newCardFastChipBuilder()
Expand Down Expand Up @@ -117,14 +118,12 @@ func setupCard(a *Apple2, slot int, paramString string) (Card, error) {
a.io.traceSlot(slot)
}

cardBase, ok := card.(*cardBase)
if err == nil && ok {
cardBase.name = builder.name
}
debug := paramsGetBool(finalParams, "debug")

card.setName(builder.name)
card.setDebug(debug)
card.assign(a, slot)
a.cards[slot] = card

return card, err
}

Expand Down
Loading

0 comments on commit 18c0779

Please sign in to comment.