2020-10-03 23:38:26 +02:00
|
|
|
package izapple2
|
2019-05-18 23:40:59 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
/*
|
|
|
|
Logger card. It never existed, I use it to trace accesses to the card.
|
|
|
|
*/
|
|
|
|
|
2020-10-14 21:54:51 +02:00
|
|
|
// CardLogger is a fake card to log soft switch invocations
|
|
|
|
type CardLogger struct {
|
2019-05-18 23:40:59 +02:00
|
|
|
cardBase
|
|
|
|
}
|
|
|
|
|
2020-10-14 21:54:51 +02:00
|
|
|
// NewCardLogger creates a new VidHD card
|
|
|
|
func NewCardLogger() *CardLogger {
|
|
|
|
var c CardLogger
|
|
|
|
c.name = "Softswitch log card"
|
|
|
|
return &c
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *CardLogger) assign(a *Apple2, slot int) {
|
2019-10-21 00:00:42 +02:00
|
|
|
for i := uint8(0x0); i <= 0xf; i++ {
|
2019-05-18 23:40:59 +02:00
|
|
|
iCopy := i
|
2019-10-21 00:00:42 +02:00
|
|
|
c.addCardSoftSwitchR(i, func(*ioC0Page) uint8 {
|
2019-05-18 23:40:59 +02:00
|
|
|
fmt.Printf("[cardLogger] Read access to softswith 0x%x for slot %v.\n", iCopy, slot)
|
|
|
|
return 0
|
2019-10-21 00:00:42 +02:00
|
|
|
}, "LOGGERR")
|
|
|
|
c.addCardSoftSwitchW(i, func(_ *ioC0Page, value uint8) {
|
2019-05-18 23:40:59 +02:00
|
|
|
fmt.Printf("[cardLogger] Write access to softswith 0x%x for slot %v, value 0x%v.\n", iCopy, slot, value)
|
2019-10-21 00:00:42 +02:00
|
|
|
}, "LOGGERW")
|
2019-05-18 23:40:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
c.cardBase.assign(a, slot)
|
|
|
|
}
|