Fixing lint warnings

This commit is contained in:
Iván Izaguirre 2021-08-05 21:12:52 +02:00
parent faf97dcdc9
commit 3de2c9dc1a
13 changed files with 34 additions and 44 deletions

View File

@ -84,7 +84,7 @@ func (a *Apple2) LoadRom(filename string) error {
size := len(data) size := len(data)
if size != apple2RomSize && size != apple2eRomSize { if size != apple2RomSize && size != apple2eRomSize {
return errors.New("Rom size not supported") return errors.New("rom size not supported")
} }
romBase := 0x10000 - size romBase := 0x10000 - size
@ -218,7 +218,7 @@ func (a *Apple2) AddRomX() {
func (a *Apple2) AddNoSlotClockInCard(slot int) error { func (a *Apple2) AddNoSlotClockInCard(slot int) error {
cardRom := a.mmu.cardsROM[slot] cardRom := a.mmu.cardsROM[slot]
if cardRom == nil { if cardRom == nil {
return errors.New("No ROM available on the slot to add a no slot clock") return errors.New("no ROM available on the slot to add a no slot clock")
} }
nsc := newNoSlotClockDS1216(a, cardRom) nsc := newNoSlotClockDS1216(a, cardRom)
a.mmu.cardsROM[slot] = nsc a.mmu.cardsROM[slot] = nsc

View File

@ -41,16 +41,6 @@ type cardDisk2Drive struct {
tracksStep int // Stepmotor for tracks position. 4 steps per track tracksStep int // Stepmotor for tracks position. 4 steps per track
} }
const (
maxHalfTrack = 68
diskBitCycle = 4 // There is a dataLatch bit transferred every 4 cycles
diskLatchReadCycles = 7 // Loaded data is available for a little more than 7ns
diskWriteByteCycle = 32 // Load data to write every 32 cycles
diskWriteSelfSyncCycle = 40 // Save $FF every 40 cycles. Self sync is 10 bits: 1111 1111 00
diskMotorStartMs = 150 // Time with the disk spinning to get full speed
)
// NewCardDisk2 creates a new CardDisk2 // NewCardDisk2 creates a new CardDisk2
func NewCardDisk2() *CardDisk2 { func NewCardDisk2() *CardDisk2 {
var c CardDisk2 var c CardDisk2
@ -217,9 +207,11 @@ func (c *CardDisk2) processQ6Q7(in uint8) {
} }
} }
if c.dataLatch >= 0x80 { /*
//fmt.Printf("Datalacth: 0x%.2x in cycle %v\n", c.dataLatch, c.a.cpu.GetCycles()) if c.dataLatch >= 0x80 {
} fmt.Printf("Datalach: 0x%.2x in cycle %v\n", c.dataLatch, c.a.cpu.GetCycles())
}
*/
} }
func (d *cardDisk2Drive) insertDiskette(name string, dt storage.Diskette) { func (d *cardDisk2Drive) insertDiskette(name string, dt storage.Diskette) {

View File

@ -32,10 +32,10 @@ func (d *cardDisk2SequencerDrive) insertDiskette(filename string) error {
// Discard not supported features // Discard not supported features
if f.Info.DiskType != 1 { if f.Info.DiskType != 1 {
return errors.New("Only 5.25 disks are supported") return errors.New("only 5.25 disks are supported")
} }
if f.Info.BootSectorFormat == 2 { // Info not available in WOZ 1.0 if f.Info.BootSectorFormat == 2 { // Info not available in WOZ 1.0
return errors.New("Woz 13 sector disks are not supported") return errors.New("woz 13 sector disks are not supported")
} }
d.data = f d.data = f

View File

@ -91,8 +91,6 @@ func (c *CardMouse) readMouse() (uint16, uint16, bool) {
return xTrans, yTrans, pressed return xTrans, yTrans, pressed
} }
const mouseReponse = "10,10,+4\n"
func (c *CardMouse) assign(a *Apple2, slot int) { func (c *CardMouse) assign(a *Apple2, slot int) {
c.addCardSoftSwitchR(0, func(*ioC0Page) uint8 { c.addCardSoftSwitchR(0, func(*ioC0Page) uint8 {
if c.iOut == 0 { if c.iOut == 0 {

View File

@ -53,7 +53,7 @@ func (c *CardVidex) loadCharacterMap(filename string) error {
} }
size := len(bytes) size := len(bytes)
if size < 0x800 { if size < 0x800 {
return errors.New("Character ROM size not supported for Videx") return errors.New("character ROM size not supported for Videx")
} }
c.charGen = bytes c.charGen = bytes
return nil return nil

View File

@ -50,7 +50,7 @@ func (cg *CharacterGenerator) load(filename string) error {
} }
size := len(bytes) size := len(bytes)
if size < charGenPageSize { if size < charGenPageSize {
return errors.New("Character ROM size not supported") return errors.New("character ROM size not supported")
} }
cg.data = bytes cg.data = bytes
return nil return nil

View File

@ -69,13 +69,15 @@ func (m *MicroPD1990ac) In(clock bool, strobe bool, command uint8, dataIn bool)
} }
func (m *MicroPD1990ac) Out() bool { func (m *MicroPD1990ac) Out() bool {
if m.command == mpd1990commandRegHold { /*
//panic("Output on RegHold should be a 1Hz signal. Not implemented.") if m.command == mpd1990commandRegHold {
} panic("Output on RegHold should be a 1Hz signal. Not implemented.")
}
if m.command == mpd1990commandTimeRead { if m.command == mpd1990commandTimeRead {
//panic("Output on RegHold should be a 512Hz signal with LSB. Not implemented.") panic("Output on RegHold should be a 512Hz signal with LSB. Not implemented.")
} }
*/
// Return the LSB of the register shift // Return the LSB of the register shift
return (m.register & 1) == 1 return (m.register & 1) == 1

View File

@ -79,10 +79,6 @@ func (j *sdlJoysticks) putButtonEvent(e *sdl.JoyButtonEvent) {
j.button[uint8(e.Which)*2+(e.Button%2)] = (e.State != 0) j.button[uint8(e.Which)*2+(e.Button%2)] = (e.State != 0)
} }
func mouseToJoyFull(x int32, w int32) uint8 {
return uint8(256 * x / (w + 1))
}
func mouseToJoyCentered(x int32, w int32) uint8 { func mouseToJoyCentered(x int32, w int32) uint8 {
r := x - (w / 2) + 127 r := x - (w / 2) + 127
if r >= 255 { if r >= 255 {

View File

@ -52,6 +52,7 @@ func (m *memoryRangeROM) poke(address uint16, value uint8) {
// Ignore // Ignore
} }
//lint:ignore U1000 this is used to write debug code
func identifyMemory(m memoryHandler) string { func identifyMemory(m memoryHandler) string {
ram, ok := m.(*memoryRange) ram, ok := m.(*memoryRange)
if ok { if ok {

View File

@ -12,14 +12,14 @@ const (
ioFlagAnnunciator2 uint8 = 0x5c ioFlagAnnunciator2 uint8 = 0x5c
ioFlagAnnunciator3 uint8 = 0x5e ioFlagAnnunciator3 uint8 = 0x5e
ioDataCassette uint8 = 0x60 //ioDataCassette uint8 = 0x60
ioFlagButton0 uint8 = 0x61 //ioFlagButton0 uint8 = 0x61
ioFlagButton1 uint8 = 0x62 //ioFlagButton1 uint8 = 0x62
ioFlagButton2 uint8 = 0x63 //ioFlagButton2 uint8 = 0x63
ioDataPaddle0 uint8 = 0x64 //ioDataPaddle0 uint8 = 0x64
ioDataPaddle1 uint8 = 0x65 //ioDataPaddle1 uint8 = 0x65
ioDataPaddle2 uint8 = 0x66 //ioDataPaddle2 uint8 = 0x66
ioDataPaddle3 uint8 = 0x67 //ioDataPaddle3 uint8 = 0x67
// Not real softSwitches. Using the numbers to store the flags somewhere. // Not real softSwitches. Using the numbers to store the flags somewhere.
ioFlagRGBCardActive uint8 = 0x7d ioFlagRGBCardActive uint8 = 0x7d

View File

@ -19,7 +19,6 @@ type traceApplecorn struct {
skipConsole bool skipConsole bool
osbyteNames [256]string osbyteNames [256]string
call mosCallData call mosCallData
lastDepth int
wasInKernel bool wasInKernel bool
} }
@ -107,7 +106,7 @@ func (t *traceApplecorn) inspect() {
s = fmt.Sprintf("OSNWRCH(A=%02x, '%v')", regA, ch) s = fmt.Sprintf("OSNWRCH(A=%02x, '%v')", regA, ch)
skip = t.skipConsole skip = t.skipConsole
case 0xffcb: case 0xffcb:
s = fmt.Sprintf("OSNRDCH()") s = "OSNRDCH()"
skip = t.skipConsole skip = t.skipConsole
case 0xffce: case 0xffce:
s = "OSFIND(?)" s = "OSFIND(?)"
@ -125,17 +124,17 @@ func (t *traceApplecorn) inspect() {
filename := t.getTerminatedString(filenameAddress, 0x0d) filename := t.getTerminatedString(filenameAddress, 0x0d)
s = fmt.Sprintf("OSFILE(A=%02x,FILE=%s)", regA, filename) s = fmt.Sprintf("OSFILE(A=%02x,FILE=%s)", regA, filename)
case 0xffe0: case 0xffe0:
s = fmt.Sprintf("OSRDCH()") s = "OSRDCH()"
skip = t.skipConsole skip = t.skipConsole
case 0xffe3: // This fallbacks to OSWRCH case 0xffe3: // This fallbacks to OSWRCH
s = "OSASCI(?)" s = "OSASCI(?)"
skip = t.skipConsole skip = t.skipConsole
case 0xffe7: // This fallbacks to OSWRCH case 0xffe7: // This fallbacks to OSWRCH
s = fmt.Sprintf("OSNEWL()") s = "OSNEWL()"
skip = t.skipConsole skip = t.skipConsole
case 0xffec: // This fallbacks to OSWRCH case 0xffec: // This fallbacks to OSWRCH
skip = t.skipConsole skip = t.skipConsole
s = fmt.Sprintf("OSNECR()") s = "OSNECR()"
case 0xffee: case 0xffee:
ch := "" ch := ""
if regA >= 0x20 && regA < 0x7f { if regA >= 0x20 && regA < 0x7f {

View File

@ -103,6 +103,7 @@ func (t *tracePascal) inspect() {
See http://www.bitsavers.org/pdf/softech/softechPascalIV_intArch1981.pdf See http://www.bitsavers.org/pdf/softech/softechPascalIV_intArch1981.pdf
page 106 page 106
*/ */
//lint:ignore U1000 unused but stays as reference
func (t *tracePascal) inspectPerArchitectureGuide() { func (t *tracePascal) inspectPerArchitectureGuide() {
bios := uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldL)) + bios := uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldL)) +
uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldH))<<8 uint16(t.a.mmu.physicalMainRAM.peek(pascalJvabfoldH))<<8

View File

@ -217,6 +217,7 @@ func (t *traceProDOS) dumpDriverCall() {
fmt.Printf("\n Prodos driver $%04x command %02x-%s on unit $%x, block %v to $%04x ==> ", pc, command, commandName, unit, block, address) fmt.Printf("\n Prodos driver $%04x command %02x-%s on unit $%x, block %v to $%04x ==> ", pc, command, commandName, unit, block, address)
} }
//lint:ignore U1000 unused but stays as reference
func (t *traceProDOS) dumpDevices() { func (t *traceProDOS) dumpDevices() {
// Active disk devices // Active disk devices