mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-06-10 06:29:30 +00:00
Better usage info
This commit is contained in:
parent
3a6b8648a6
commit
9178372942
|
@ -56,7 +56,7 @@ type CardBrainBoard struct {
|
||||||
func newCardBrainBoardBuilder() *cardBuilder {
|
func newCardBrainBoardBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "Brain Board",
|
name: "Brain Board",
|
||||||
description: "Firmware card for Apple. It has two ROM banks",
|
description: "Firmware card. It has two ROM banks",
|
||||||
defaultParams: &[]paramSpec{
|
defaultParams: &[]paramSpec{
|
||||||
{"rom", "ROM file to load", "<internal>/wozaniam_integer.rom"},
|
{"rom", "ROM file to load", "<internal>/wozaniam_integer.rom"},
|
||||||
{"dips", "DIP switches, leftmost is DIP 1", "1-011010"},
|
{"dips", "DIP switches, leftmost is DIP 1", "1-011010"},
|
||||||
|
|
|
@ -52,7 +52,7 @@ const noForceBank = -1
|
||||||
func newCardBrainBoardIIBuilder() *cardBuilder {
|
func newCardBrainBoardIIBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "Brain Board II",
|
name: "Brain Board II",
|
||||||
description: "Firmware card for Apple II. It has ROM banks and can be used to boot wozaniam, Integer BASIC or other çustom ROMs.",
|
description: "Firmware card. It has up to four ROM banks",
|
||||||
defaultParams: &[]paramSpec{
|
defaultParams: &[]paramSpec{
|
||||||
{"rom", "ROM file to load", "<internal>/ApplesoftInteger.BIN"},
|
{"rom", "ROM file to load", "<internal>/ApplesoftInteger.BIN"},
|
||||||
{"dip2", "Use the upper half of the ROM", "true"},
|
{"dip2", "Use the upper half of the ROM", "true"},
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
|
"golang.org/x/exp/slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
type paramSpec struct {
|
type paramSpec struct {
|
||||||
|
@ -60,7 +61,9 @@ func getCardFactory() map[string]*cardBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
func availableCards() []string {
|
func availableCards() []string {
|
||||||
return maps.Keys(getCardFactory())
|
names := maps.Keys(getCardFactory())
|
||||||
|
slices.Sort(names)
|
||||||
|
return names
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupCard(a *Apple2, slot int, paramString string) (Card, error) {
|
func setupCard(a *Apple2, slot int, paramString string) (Card, error) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ type cardDan2ControllerSlot struct {
|
||||||
func newCardDan2ControllerBuilder() *cardBuilder {
|
func newCardDan2ControllerBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "Dan ][ Controller card",
|
name: "Dan ][ Controller card",
|
||||||
description: "Apple II Peripheral Card that Interfaces to a ATMEGA328P for SD card storage.",
|
description: "Apple II Peripheral Card that Interfaces to a ATMEGA328P for SD card storage",
|
||||||
defaultParams: &[]paramSpec{
|
defaultParams: &[]paramSpec{
|
||||||
{"improved", "Emulate improved firmware from ThorstenBr", "true"},
|
{"improved", "Emulate improved firmware from ThorstenBr", "true"},
|
||||||
{"slot1", "Image in slot 1. File for raw device, folder for fs mode using files as BLKDEV0x.PO", ""},
|
{"slot1", "Image in slot 1. File for raw device, folder for fs mode using files as BLKDEV0x.PO", ""},
|
||||||
|
|
|
@ -29,7 +29,7 @@ type CardFastChip struct {
|
||||||
func newCardFastChipBuilder() *cardBuilder {
|
func newCardFastChipBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "FASTChip IIe Card - limited",
|
name: "FASTChip IIe Card - limited",
|
||||||
description: "Accelerator card for Apple IIe. Limited support.",
|
description: "Accelerator card for Apple IIe (limited support)",
|
||||||
buildFunc: func(params map[string]string) (Card, error) {
|
buildFunc: func(params map[string]string) (Card, error) {
|
||||||
return &CardFastChip{}, nil
|
return &CardFastChip{}, nil
|
||||||
},
|
},
|
||||||
|
|
|
@ -50,7 +50,7 @@ type CardMemoryExpansion struct {
|
||||||
func newCardMemoryExpansionBuilder() *cardBuilder {
|
func newCardMemoryExpansionBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "Memory Expansion Card",
|
name: "Memory Expansion Card",
|
||||||
description: "Memory expansion card. It can be configured to have 256KB, 512KB, 768KB or 1MB.",
|
description: "Memory expansion card",
|
||||||
defaultParams: &[]paramSpec{
|
defaultParams: &[]paramSpec{
|
||||||
{"size", "RAM of the card, can be 256, 512, 768 or 1024", "1024"},
|
{"size", "RAM of the card, can be 256, 512, 768 or 1024", "1024"},
|
||||||
},
|
},
|
||||||
|
|
|
@ -36,7 +36,7 @@ type CardMouse struct {
|
||||||
func newCardMouseBuilder() *cardBuilder {
|
func newCardMouseBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "Mouse Card",
|
name: "Mouse Card",
|
||||||
description: "Mouse card implementation. Does not emulate a real card, only the firmware behaviour.",
|
description: "Mouse card implementation, does not emulate a real card, only the firmware behaviour",
|
||||||
defaultParams: &[]paramSpec{
|
defaultParams: &[]paramSpec{
|
||||||
{"trace", "Trace accesses to the card", "false"},
|
{"trace", "Trace accesses to the card", "false"},
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,7 +32,7 @@ type MultiRomCard struct {
|
||||||
func newMultiRomCardBuilder() *cardBuilder {
|
func newMultiRomCardBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "MultiROM",
|
name: "MultiROM",
|
||||||
description: "Multiple Image ROM card.",
|
description: "Multiple Image ROM card",
|
||||||
defaultParams: &[]paramSpec{
|
defaultParams: &[]paramSpec{
|
||||||
{"rom", "ROM file to load", "<internal>/MultiRom(SP boot)-Prog aid-28C256.BIN"},
|
{"rom", "ROM file to load", "<internal>/MultiRom(SP boot)-Prog aid-28C256.BIN"},
|
||||||
{"basic", "Bank for D000 to F7FF", "1"},
|
{"basic", "Bank for D000 to F7FF", "1"},
|
||||||
|
|
|
@ -22,7 +22,7 @@ type CardParallelPrinter struct {
|
||||||
func newCardParallelPrinterBuilder() *cardBuilder {
|
func newCardParallelPrinterBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "Parallel Printer Interface",
|
name: "Parallel Printer Interface",
|
||||||
description: "Card to dump to a file what would be printed to a parallel printer.",
|
description: "Card to dump to a file what would be printed to a parallel printer",
|
||||||
defaultParams: &[]paramSpec{
|
defaultParams: &[]paramSpec{
|
||||||
{"file", "File to store the printed code", "printer.out"},
|
{"file", "File to store the printed code", "printer.out"},
|
||||||
{"ascii", "Remove the 7 bit. Useful for normal text printing, but breaks graphics printing ", "false"},
|
{"ascii", "Remove the 7 bit. Useful for normal text printing, but breaks graphics printing ", "false"},
|
||||||
|
|
|
@ -19,7 +19,7 @@ type CardSaturn struct {
|
||||||
func newCardSaturnBuilder() *cardBuilder {
|
func newCardSaturnBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "Saturn 128KB Ram Card",
|
name: "Saturn 128KB Ram Card",
|
||||||
description: "RAM card with 128Kb. It's like 8 language cards.",
|
description: "RAM card with 128Kb, it's like 8 language cards",
|
||||||
buildFunc: func(params map[string]string) (Card, error) {
|
buildFunc: func(params map[string]string) (Card, error) {
|
||||||
return &CardSaturn{}, nil
|
return &CardSaturn{}, nil
|
||||||
},
|
},
|
||||||
|
|
|
@ -68,7 +68,7 @@ type CardSwyft struct {
|
||||||
func newCardSwyftBuilder() *cardBuilder {
|
func newCardSwyftBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "SwyftCard",
|
name: "SwyftCard",
|
||||||
description: "Card with the ROM needed to run the Swyftcard word processing system. Must run on slot 3 only on Apple IIe.",
|
description: "Card with the ROM needed to run the Swyftcard word processing system",
|
||||||
requiresIIe: true,
|
requiresIIe: true,
|
||||||
buildFunc: func(params map[string]string) (Card, error) {
|
buildFunc: func(params map[string]string) (Card, error) {
|
||||||
var c CardSwyft
|
var c CardSwyft
|
||||||
|
@ -85,6 +85,10 @@ func newCardSwyftBuilder() *cardBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CardSwyft) assign(a *Apple2, slot int) {
|
func (c *CardSwyft) assign(a *Apple2, slot int) {
|
||||||
|
if slot != 3 {
|
||||||
|
panic("SwyftCard must be installed in slot 3")
|
||||||
|
}
|
||||||
|
|
||||||
c.addCardSoftSwitchRW(0, func() uint8 {
|
c.addCardSoftSwitchRW(0, func() uint8 {
|
||||||
a.mmu.inhibitROM(c)
|
a.mmu.inhibitROM(c)
|
||||||
c.bank2 = false
|
c.bank2 = false
|
||||||
|
|
|
@ -16,7 +16,7 @@ type CardVidHD struct {
|
||||||
func newCardVidHDBuilder() *cardBuilder {
|
func newCardVidHDBuilder() *cardBuilder {
|
||||||
return &cardBuilder{
|
return &cardBuilder{
|
||||||
name: "VidHD Card - limited",
|
name: "VidHD Card - limited",
|
||||||
description: "Firmware signature of the VidHD card to trick Total Replay to use the GS modes.",
|
description: "Firmware signature of the VidHD card to trick Total Replay to use the SHR mode",
|
||||||
buildFunc: func(params map[string]string) (Card, error) {
|
buildFunc: func(params map[string]string) (Card, error) {
|
||||||
var c CardVidHD
|
var c CardVidHD
|
||||||
c.loadRom(buildVidHDRom())
|
c.loadRom(buildVidHDRom())
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name: Apple IIe
|
name: Apple //e
|
||||||
parent: _base
|
parent: _base
|
||||||
board: 2e
|
board: 2e
|
||||||
cpu: 65c02
|
cpu: 65c02
|
||||||
|
|
|
@ -175,6 +175,7 @@ func (c *configurationModels) availableModels() []string {
|
||||||
models = append(models, name)
|
models = append(models, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
slices.Sort(models)
|
||||||
return models
|
return models
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,18 +247,29 @@ func getConfigurationFromCommandLine() (*configuration, string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
flag.Usage = func() {
|
flag.Usage = func() {
|
||||||
availableModels := strings.Join(configurationModels.availableModels(), ", ")
|
|
||||||
availableCards := strings.Join(availableCards(), ", ")
|
|
||||||
availableTracers := strings.Join(availableTracers(), ", ")
|
|
||||||
|
|
||||||
out := flag.CommandLine.Output()
|
out := flag.CommandLine.Output()
|
||||||
fmt.Fprintf(out, "Usage: %s [file]\n", os.Args[0])
|
fmt.Fprintf(out, "Usage: %s [file]\n", os.Args[0])
|
||||||
fmt.Fprintf(out, " file\n")
|
fmt.Fprintf(out, " file\n")
|
||||||
fmt.Fprintf(out, " path to image to use on the boot device\n")
|
fmt.Fprintf(out, " path to image to use on the boot device\n")
|
||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
fmt.Fprintf(out, "\nThe available pre configured models are: %s.\n", availableModels)
|
|
||||||
fmt.Fprintf(out, "The available cards are: %s.\n", availableCards)
|
fmt.Fprintf(out, "\nThe available pre configured models are:\n")
|
||||||
fmt.Fprintf(out, "The available tracers are: %s.\n", availableTracers)
|
for _, model := range configurationModels.availableModels() {
|
||||||
|
config, _ := configurationModels.getFromModel(model)
|
||||||
|
fmt.Fprintf(out, " %s: %s\n", model, config.get(confName))
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Fprintf(out, "\nThe available cards are:\n")
|
||||||
|
for _, card := range availableCards() {
|
||||||
|
builder := getCardFactory()[card]
|
||||||
|
fmt.Fprintf(out, " %s: %s\n", card, builder.description)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Fprintf(out, "\nThe available tracers are:\n")
|
||||||
|
for _, tracer := range availableTracers() {
|
||||||
|
builder := getTracerFactory()[tracer]
|
||||||
|
fmt.Fprintf(out, " %s: %s\n", tracer, builder.description)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
|
"golang.org/x/exp/slices"
|
||||||
)
|
)
|
||||||
|
|
||||||
type executionTracer interface {
|
type executionTracer interface {
|
||||||
|
@ -19,7 +20,13 @@ type traceBuilder struct {
|
||||||
connectFunc func(a *Apple2)
|
connectFunc func(a *Apple2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildTracerFactory() map[string]*traceBuilder {
|
var traceFactory map[string]*traceBuilder
|
||||||
|
|
||||||
|
func getTracerFactory() map[string]*traceBuilder {
|
||||||
|
if traceFactory != nil {
|
||||||
|
return traceFactory
|
||||||
|
}
|
||||||
|
|
||||||
tracerFactory := make(map[string]*traceBuilder)
|
tracerFactory := make(map[string]*traceBuilder)
|
||||||
|
|
||||||
tracerFactory["mos"] = &traceBuilder{
|
tracerFactory["mos"] = &traceBuilder{
|
||||||
|
@ -71,11 +78,13 @@ func buildTracerFactory() map[string]*traceBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
func availableTracers() []string {
|
func availableTracers() []string {
|
||||||
return maps.Keys(buildTracerFactory())
|
names := maps.Keys(getTracerFactory())
|
||||||
|
slices.Sort(names)
|
||||||
|
return names
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupTracers(a *Apple2, paramString string) error {
|
func setupTracers(a *Apple2, paramString string) error {
|
||||||
tracerFactory := buildTracerFactory()
|
tracerFactory := getTracerFactory()
|
||||||
tracerNames := splitConfigurationString(paramString, ',')
|
tracerNames := splitConfigurationString(paramString, ',')
|
||||||
for _, tracer := range tracerNames {
|
for _, tracer := range tracerNames {
|
||||||
tracer = strings.ToLower(strings.TrimSpace(tracer))
|
tracer = strings.ToLower(strings.TrimSpace(tracer))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user