Better usage info

This commit is contained in:
Ivan Izaguirre 2024-02-08 22:17:14 +01:00
parent 3a6b8648a6
commit 9178372942
15 changed files with 51 additions and 23 deletions

View File

@ -56,7 +56,7 @@ type CardBrainBoard struct {
func newCardBrainBoardBuilder() *cardBuilder {
return &cardBuilder{
name: "Brain Board",
description: "Firmware card for Apple. It has two ROM banks",
description: "Firmware card. It has two ROM banks",
defaultParams: &[]paramSpec{
{"rom", "ROM file to load", "<internal>/wozaniam_integer.rom"},
{"dips", "DIP switches, leftmost is DIP 1", "1-011010"},

View File

@ -52,7 +52,7 @@ const noForceBank = -1
func newCardBrainBoardIIBuilder() *cardBuilder {
return &cardBuilder{
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{
{"rom", "ROM file to load", "<internal>/ApplesoftInteger.BIN"},
{"dip2", "Use the upper half of the ROM", "true"},

View File

@ -6,6 +6,7 @@ import (
"strings"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
type paramSpec struct {
@ -60,7 +61,9 @@ func getCardFactory() map[string]*cardBuilder {
}
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) {

View File

@ -48,7 +48,7 @@ type cardDan2ControllerSlot struct {
func newCardDan2ControllerBuilder() *cardBuilder {
return &cardBuilder{
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{
{"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", ""},

View File

@ -29,7 +29,7 @@ type CardFastChip struct {
func newCardFastChipBuilder() *cardBuilder {
return &cardBuilder{
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) {
return &CardFastChip{}, nil
},

View File

@ -50,7 +50,7 @@ type CardMemoryExpansion struct {
func newCardMemoryExpansionBuilder() *cardBuilder {
return &cardBuilder{
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{
{"size", "RAM of the card, can be 256, 512, 768 or 1024", "1024"},
},

View File

@ -36,7 +36,7 @@ type CardMouse struct {
func newCardMouseBuilder() *cardBuilder {
return &cardBuilder{
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{
{"trace", "Trace accesses to the card", "false"},
},

View File

@ -32,7 +32,7 @@ type MultiRomCard struct {
func newMultiRomCardBuilder() *cardBuilder {
return &cardBuilder{
name: "MultiROM",
description: "Multiple Image ROM card.",
description: "Multiple Image ROM card",
defaultParams: &[]paramSpec{
{"rom", "ROM file to load", "<internal>/MultiRom(SP boot)-Prog aid-28C256.BIN"},
{"basic", "Bank for D000 to F7FF", "1"},

View File

@ -22,7 +22,7 @@ type CardParallelPrinter struct {
func newCardParallelPrinterBuilder() *cardBuilder {
return &cardBuilder{
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{
{"file", "File to store the printed code", "printer.out"},
{"ascii", "Remove the 7 bit. Useful for normal text printing, but breaks graphics printing ", "false"},

View File

@ -19,7 +19,7 @@ type CardSaturn struct {
func newCardSaturnBuilder() *cardBuilder {
return &cardBuilder{
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) {
return &CardSaturn{}, nil
},

View File

@ -68,7 +68,7 @@ type CardSwyft struct {
func newCardSwyftBuilder() *cardBuilder {
return &cardBuilder{
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,
buildFunc: func(params map[string]string) (Card, error) {
var c CardSwyft
@ -85,6 +85,10 @@ func newCardSwyftBuilder() *cardBuilder {
}
func (c *CardSwyft) assign(a *Apple2, slot int) {
if slot != 3 {
panic("SwyftCard must be installed in slot 3")
}
c.addCardSoftSwitchRW(0, func() uint8 {
a.mmu.inhibitROM(c)
c.bank2 = false

View File

@ -16,7 +16,7 @@ type CardVidHD struct {
func newCardVidHDBuilder() *cardBuilder {
return &cardBuilder{
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) {
var c CardVidHD
c.loadRom(buildVidHDRom())

View File

@ -1,4 +1,4 @@
name: Apple IIe
name: Apple //e
parent: _base
board: 2e
cpu: 65c02

View File

@ -175,6 +175,7 @@ func (c *configurationModels) availableModels() []string {
models = append(models, name)
}
}
slices.Sort(models)
return models
}
@ -246,18 +247,29 @@ func getConfigurationFromCommandLine() (*configuration, string, error) {
}
flag.Usage = func() {
availableModels := strings.Join(configurationModels.availableModels(), ", ")
availableCards := strings.Join(availableCards(), ", ")
availableTracers := strings.Join(availableTracers(), ", ")
out := flag.CommandLine.Output()
fmt.Fprintf(out, "Usage: %s [file]\n", os.Args[0])
fmt.Fprintf(out, " file\n")
fmt.Fprintf(out, " path to image to use on the boot device\n")
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, "The available tracers are: %s.\n", availableTracers)
fmt.Fprintf(out, "\nThe available pre configured models are:\n")
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()

View File

@ -5,6 +5,7 @@ import (
"strings"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
type executionTracer interface {
@ -19,7 +20,13 @@ type traceBuilder struct {
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["mos"] = &traceBuilder{
@ -71,11 +78,13 @@ func buildTracerFactory() map[string]*traceBuilder {
}
func availableTracers() []string {
return maps.Keys(buildTracerFactory())
names := maps.Keys(getTracerFactory())
slices.Sort(names)
return names
}
func setupTracers(a *Apple2, paramString string) error {
tracerFactory := buildTracerFactory()
tracerFactory := getTracerFactory()
tracerNames := splitConfigurationString(paramString, ',')
for _, tracer := range tracerNames {
tracer = strings.ToLower(strings.TrimSpace(tracer))