From fe72071245de1193a6ca6036d4e9e268756027f4 Mon Sep 17 00:00:00 2001 From: Ivan Izaguirre Date: Tue, 1 Sep 2020 17:46:30 +0200 Subject: [PATCH] Support no slot clock installed on any card ROM --- README.md | 2 ++ apple2Setup.go | 11 +++++++++++ apple2main.go | 14 ++++++++++---- noSlotClockDS1216.go | 4 ++-- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4bfbadb..f8e4b1d 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,8 @@ Only valid on SDL mode set base model. Models available 2plus, 2e, 2enh, base64a (default "2enh") -mono emulate a green phosphor monitor instead of a NTSC color TV. Use F6 to toggle. + -nsc int + add a DS1216 No-Slot-Clock on the main ROM (use 0) or a slot ROM. -1 for none (default -1) -panicSS panic if a not implemented softswitch is used -profile diff --git a/apple2Setup.go b/apple2Setup.go index 321b8bd..570fe8e 100644 --- a/apple2Setup.go +++ b/apple2Setup.go @@ -190,6 +190,17 @@ func (a *Apple2) AddNoSlotClock() { a.mmu.physicalROM[0] = nsc } +// AddNoSlotClockInCard inserts a DS1215 no slot clock under a card ROM +func (a *Apple2) AddNoSlotClockInCard(slot int) error { + cardRom := a.mmu.cardsROM[slot] + if cardRom == nil { + return errors.New("No ROM available on the slot to add a no slot clock") + } + nsc := newNoSlotClockDS1216(a, cardRom) + a.mmu.cardsROM[slot] = nsc + return nil +} + // AddCardLogger inserts a fake card that logs accesses func (a *Apple2) AddCardLogger(slot int) { a.insertCard(&cardLogger{}, slot) diff --git a/apple2main.go b/apple2main.go index 8a4daa4..1fad0ca 100644 --- a/apple2main.go +++ b/apple2main.go @@ -81,10 +81,10 @@ func MainApple() *Apple2 { "thunderClockCardSlot", 4, "slot for the ThunderClock Plus card. -1 for none") - nsc := flag.Bool( + nsc := flag.Int( "nsc", - false, - "add a DS1216 No-Slot-Clock") + -1, + "add a DS1216 No-Slot-Clock on the main ROM (use 0) or a slot ROM. -1 for none") mono := flag.Bool( "mono", false, @@ -290,8 +290,14 @@ func MainApple() *Apple2 { a.AddRGBCard() } - if *nsc { + if *nsc == 0 { a.AddNoSlotClock() + } else if *nsc > 0 { + err := a.AddNoSlotClockInCard(*nsc) + if err != nil { + panic(err) + } + } //a.AddCardInOut(2) diff --git a/noSlotClockDS1216.go b/noSlotClockDS1216.go index eabe00d..c1b35fd 100644 --- a/noSlotClockDS1216.go +++ b/noSlotClockDS1216.go @@ -21,9 +21,9 @@ delegate to the replaced memoryHandler when needed. On the Apple IIe it is usually installed under the ROM CD (under CF on later models). Similar for the Apple IIc. It is usually not compatible with the ROMs of the Apple II+, but could be installed in a card with 28 pins ROM, -working on different addresses. We will install it under the main ROM for all models. +working on different addresses. We will install it under the main ROM for all models or under a card ROM. -Actually software looks like it only uses: 0xC300, 0xC301 and 0xC304 +Actually software looks like it uses: 0xCs00, 0xCs01 and 0xCs04, usually slot 3 */ type noSlotClockDS1216 struct {