mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-05-29 03:41:31 +00:00
Command line arguments
This commit is contained in:
parent
9ab4e449b8
commit
05355749f3
|
@ -13,16 +13,18 @@ type Apple2 struct {
|
||||||
io *ioC0Page
|
io *ioC0Page
|
||||||
cards []cardBase
|
cards []cardBase
|
||||||
isApple2e bool
|
isApple2e bool
|
||||||
|
panicSS bool
|
||||||
activeSlot int // Slot that has the addressing 0xc800 to 0ccfff
|
activeSlot int // Slot that has the addressing 0xc800 to 0ccfff
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewApple2 instantiates an apple2
|
// NewApple2 instantiates an apple2
|
||||||
func NewApple2(romFile string) *Apple2 {
|
func NewApple2(romFile string, panicSS bool) *Apple2 {
|
||||||
var a Apple2
|
var a Apple2
|
||||||
a.mmu = newMemoryManager(&a)
|
a.mmu = newMemoryManager(&a)
|
||||||
a.cpu = core6502.NewNMOS6502(a.mmu)
|
a.cpu = core6502.NewNMOS6502(a.mmu)
|
||||||
a.loadRom(romFile)
|
a.loadRom(romFile)
|
||||||
a.mmu.resetPaging()
|
a.mmu.resetPaging()
|
||||||
|
a.panicSS = panicSS
|
||||||
|
|
||||||
// Set the io in 0xc000
|
// Set the io in 0xc000
|
||||||
a.io = newIoC0Page(&a)
|
a.io = newIoC0Page(&a)
|
||||||
|
|
|
@ -72,10 +72,11 @@ func (p *ioC0Page) Peek(address uint8) uint8 {
|
||||||
//fmt.Printf("Peek on $C0%02x ", address)
|
//fmt.Printf("Peek on $C0%02x ", address)
|
||||||
ss := p.softSwitchesR[address]
|
ss := p.softSwitchesR[address]
|
||||||
if ss == nil {
|
if ss == nil {
|
||||||
//panic(fmt.Sprintf("Unknown softswitch on read to 0xC0%02x", address))
|
if p.apple2.panicSS {
|
||||||
|
panic(fmt.Sprintf("Unknown softswitch on read to 0xC0%02x", address))
|
||||||
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return ss(p)
|
return ss(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +84,9 @@ func (p *ioC0Page) Poke(address uint8, value uint8) {
|
||||||
//fmt.Printf("Poke on $C0%02x with %02x ", address, value)
|
//fmt.Printf("Poke on $C0%02x with %02x ", address, value)
|
||||||
ss := p.softSwitchesW[address]
|
ss := p.softSwitchesW[address]
|
||||||
if ss == nil {
|
if ss == nil {
|
||||||
//panic(fmt.Sprintf("Unknown softswitch on write to 0xC0%02x", address))
|
if p.apple2.panicSS {
|
||||||
|
panic(fmt.Sprintf("Unknown softswitch on write to 0xC0%02x", address))
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ss(p, value)
|
ss(p, value)
|
||||||
|
|
38
main.go
38
main.go
|
@ -1,22 +1,46 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"go6502/apple2"
|
"go6502/apple2"
|
||||||
"go6502/apple2sdl"
|
"go6502/apple2sdl"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
romFile := flag.String(
|
||||||
|
"rom",
|
||||||
|
"apple2/romdumps/Apple2_Plus.rom",
|
||||||
|
"main rom file")
|
||||||
|
disk2RomFile := flag.String(
|
||||||
|
"diskRom",
|
||||||
|
"apple2/romdumps/DISK2.rom",
|
||||||
|
"rom file for the disk drive controller")
|
||||||
|
diskImage := flag.String(
|
||||||
|
"disk",
|
||||||
|
"../dos33.dsk",
|
||||||
|
"file to load on the first disk drive")
|
||||||
|
useSdl := flag.Bool(
|
||||||
|
"sdl",
|
||||||
|
true,
|
||||||
|
"use SDL")
|
||||||
|
panicSS := flag.Bool(
|
||||||
|
"panicss",
|
||||||
|
false,
|
||||||
|
"panic if a not implemented softwtich is used")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
//romFile := "apple2/romdumps/Apple2.rom"
|
//romFile := "apple2/romdumps/Apple2.rom"
|
||||||
romFile := "apple2/romdumps/Apple2_Plus.rom"
|
//romFile := "apple2/romdumps/Apple2_Plus.rom"
|
||||||
//romFile := "apple2/romdumps/Apple2e.rom"
|
//romFile := "apple2/romdumps/Apple2e.rom"
|
||||||
disk2RomFile := "apple2/romdumps/DISK2.rom"
|
//disk2RomFile := "apple2/romdumps/DISK2.rom"
|
||||||
diskImage := "../dos33.dsk"
|
//diskImage := "../dos33.dsk"
|
||||||
|
//diskImage := "../Apex II - Apple II Diagnostic (v4.7-1986).DSK"
|
||||||
|
//diskImage := "../A2Diag.v4.1.SDK"
|
||||||
|
|
||||||
log := false
|
log := false
|
||||||
sdl := true
|
a := apple2.NewApple2(*romFile, *panicSS)
|
||||||
a := apple2.NewApple2(romFile)
|
a.AddDisk2(*disk2RomFile, *diskImage)
|
||||||
a.AddDisk2(disk2RomFile, diskImage)
|
if *useSdl {
|
||||||
if sdl {
|
|
||||||
apple2sdl.SDLRun(a)
|
apple2sdl.SDLRun(a)
|
||||||
} else {
|
} else {
|
||||||
a.Run(log, true)
|
a.Run(log, true)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user