Compare commits

..

No commits in common. "cb355a17cd8f8a0e04dc7b5d9d5957587f158ba9" and "a4ad599056d555df9e18700a530688a4b6245d12" have entirely different histories.

6 changed files with 24 additions and 49 deletions

View File

@ -257,7 +257,7 @@ The available tracers are:
mli: Trace ProDOS MLI calls
mos: Trace MOS calls with Applecorn skipping terminal IO
mosfull: Trace MOS calls with Applecorn
panicss: Panic on unimplemented softswitches
panicSS: Panic on unimplemented softswitches
ss: Trace sotfswiches calls
ssreg: Trace sotfswiches registrations
ucsd: Trace UCSD system calls

View File

@ -28,7 +28,6 @@ const noCardName = "empty"
var commonParams = []paramSpec{
{"trace", "Enable debug messages", "false"},
{"tracess", "Trace softswitches", "false"},
{"panicss", "Panic on unimplemented softswitches", "false"},
}
var cardFactory map[string]*cardBuilder
@ -119,14 +118,11 @@ func setupCard(a *Apple2, slot int, paramString string) (Card, error) {
}
// Common parameters
if paramsGetBool(finalParams, "tracess") {
traceSS := paramsGetBool(finalParams, "tracess")
if traceSS {
a.io.traceSlot(slot)
}
if paramsGetBool(finalParams, "panicss") {
a.io.panicNotImplementedSlot(slot)
}
debug := paramsGetBool(finalParams, "trace")
card.setName(builder.name)

View File

@ -82,7 +82,7 @@ The available tracers are:
mli: Trace ProDOS MLI calls
mos: Trace MOS calls with Applecorn skipping terminal IO
mosfull: Trace MOS calls with Applecorn
panicss: Panic on unimplemented softswitches
panicSS: Panic on unimplemented softswitches
ss: Trace sotfswiches calls
ssreg: Trace sotfswiches registrations
ucsd: Trace UCSD system calls

View File

@ -5,20 +5,20 @@ import (
)
type ioC0Page struct {
softSwitchesR [256]softSwitchR
softSwitchesW [256]softSwitchW
softSwitchesRName [256]string
softSwitchesWName [256]string
softSwitchesData [128]uint8
keyboard KeyboardProvider
speaker SpeakerProvider
paddlesStrobeCycle uint64
joysticks JoysticksProvider
mouse MouseProvider
apple2 *Apple2
traceMask uint16 // A bit for each 16 softswitches
panicMask uint16 // A bit for each 16 softswitches
traceRegistrations bool
softSwitchesR [256]softSwitchR
softSwitchesW [256]softSwitchW
softSwitchesRName [256]string
softSwitchesWName [256]string
softSwitchesData [128]uint8
keyboard KeyboardProvider
speaker SpeakerProvider
paddlesStrobeCycle uint64
joysticks JoysticksProvider
mouse MouseProvider
apple2 *Apple2
traceMask uint16 // A bit for each 16 softswitches
traceRegistrations bool
panicNotImplemented bool
}
type softSwitchR func() uint8
@ -65,10 +65,7 @@ func (p *ioC0Page) setTrace(trace bool) {
func (p *ioC0Page) traceSlot(slot int) {
p.traceMask |= 1 << (8 + slot)
}
func (p *ioC0Page) panicNotImplementedSlot(slot int) {
p.panicMask |= 1 << (8 + slot)
fmt.Printf("Slot %v traced %04x\n", slot, p.traceMask)
}
func (p *ioC0Page) setTraceRegistrations(traceRegistrations bool) {
@ -76,11 +73,7 @@ func (p *ioC0Page) setTraceRegistrations(traceRegistrations bool) {
}
func (p *ioC0Page) setPanicNotImplemented(value bool) {
if value {
p.panicMask = 0xffff
} else {
p.panicMask = 0x0000
}
p.panicNotImplemented = value
}
func (p *ioC0Page) addSoftSwitchRW(address uint8, ss softSwitchR, name string) {
@ -132,12 +125,6 @@ func (p *ioC0Page) isTraced(address uint16) bool {
(p.traceMask&(1<<(ss>>4))) != 0
}
func (p *ioC0Page) isPanicNotImplemented(address uint16) bool {
ss := address & 0xff
return ss != 0xc068 && // Ignore known IIGS softswitch
(p.panicMask&(1<<(ss>>4))) != 0
}
func (p *ioC0Page) peek(address uint16) uint8 {
pageAddress := uint8(address)
ss := p.softSwitchesR[pageAddress]
@ -145,7 +132,7 @@ func (p *ioC0Page) peek(address uint16) uint8 {
if p.isTraced(address) {
fmt.Printf("Unknown softswitch on read to $%04x\n", address)
}
if p.isPanicNotImplemented(address) {
if p.panicNotImplemented {
panic(fmt.Sprintf("Unknown softswitch on read to $%04x", address))
}
return 0
@ -165,7 +152,7 @@ func (p *ioC0Page) poke(address uint16, value uint8) {
if p.isTraced(address) {
fmt.Printf("Unknown softswitch on write $%02x to $%04x\n", value, address)
}
if p.isPanicNotImplemented(address) {
if p.panicNotImplemented {
panic(fmt.Sprintf("Unknown softswitch on write to $%04x", address))
}
return

View File

@ -39,14 +39,6 @@ func LoadResource(filename string) ([]uint8, bool, error) {
filename = filename[1 : len(filename)-1]
}
// Expand the tilde if prefixed by it
if strings.HasPrefix(filename, "~") {
home, err := os.UserHomeDir()
if err == nil {
filename = home + filename[1:]
}
}
var writeable bool
var file io.Reader
if isInternalResource(filename) {

View File

@ -64,8 +64,8 @@ func getTracerFactory() map[string]*traceBuilder {
description: "Trace sotfswiches registrations",
connectFunc: func(a *Apple2) { a.io.setTraceRegistrations(true) },
}
tracerFactory["panicss"] = &traceBuilder{
name: "panicss",
tracerFactory["panicSS"] = &traceBuilder{
name: "panicSS",
description: "Panic on unimplemented softswitches",
connectFunc: func(a *Apple2) { a.io.setPanicNotImplemented(true) },
}