From 0598a8a39349a80a9ac63e32bb9d36a83c4ec550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Izaguirre?= Date: Mon, 29 Jul 2024 18:07:24 +0200 Subject: [PATCH] some cleaning --- apple2Run.go | 4 ++-- boardAppleII.go => boardApple2.go | 18 ++++++++---------- boardApple2e.go | 10 +++++----- boardBase64a.go | 9 --------- boardBasis108.go | 1 + cardBuilder.go | 2 +- cardDan2Controller.go | 7 +++---- cardDisk2DriveStepper.go | 6 +++--- cardDisk2Sequencer.go | 7 +++---- cardInOut.go | 6 +++--- cardLanguage.go | 2 +- cardMouse.go | 3 +-- cardParallelPrinter.go | 2 +- cardProDOSRomCard3.go | 2 +- cardProDOSRomDrive.go | 2 +- cardSaturn.go | 4 ++-- command.go | 4 ++-- component/mc6845.go | 2 +- component/microPD1990ac.go | 27 ++++++++++++++------------- e2e_woz_test.go | 2 +- frontend/a2fyne/fyneKeyboard.go | 6 +++--- frontend/a2fyne/main.go | 8 ++++---- frontend/a2fyne/toolbar.go | 4 ++-- frontend/a2sdl/sdlJoysticks.go | 16 ++++++++-------- frontend/headless/main.go | 2 +- fujinet/json.go | 10 +++++----- memoryManager.go | 22 +++++++++++----------- noSlotClockDS1216.go | 18 +++++++++--------- romX.go | 8 ++++---- screen/loRes.go | 2 +- screen/snapshots.go | 2 +- screen/text.go | 4 +--- screen/textToAnsi.go | 6 +++--- setup.go | 4 ++-- smartPortFujinetNetwork.go | 6 +++--- storage/disketteNib.go | 2 +- storage/disketteNibTimed.go | 2 +- storage/disketteWoz.go | 4 ++-- storage/fileWoz.go | 10 +++++----- traceProDOS.go | 4 ++-- 40 files changed, 123 insertions(+), 137 deletions(-) rename boardAppleII.go => boardApple2.go (95%) diff --git a/apple2Run.go b/apple2Run.go index 0db2d22..67522ae 100644 --- a/apple2Run.go +++ b/apple2Run.go @@ -36,8 +36,8 @@ func (a *Apple2) Start(paused bool) { if !a.paused { for i := 0; i < cpuSpinLoops; i++ { // Conditional tracing - //pc, _ := a.cpu.GetPCAndSP() - //a.cpu.SetTrace(pc >= 0xc700 && pc < 0xc800) + // pc, _ := a.cpu.GetPCAndSP() + // a.cpu.SetTrace(pc >= 0xc700 && pc < 0xc800) // Execution a.cpu.ExecuteInstruction() diff --git a/boardAppleII.go b/boardApple2.go similarity index 95% rename from boardAppleII.go rename to boardApple2.go index 7c85a6e..e30b30d 100644 --- a/boardAppleII.go +++ b/boardApple2.go @@ -12,14 +12,14 @@ const ( ioFlagAnnunciator2 uint8 = 0x5c ioFlagAnnunciator3 uint8 = 0x5e - //ioDataCassette uint8 = 0x60 - //ioFlagButton0 uint8 = 0x61 - //ioFlagButton1 uint8 = 0x62 - //ioFlagButton2 uint8 = 0x63 - //ioDataPaddle0 uint8 = 0x64 - //ioDataPaddle1 uint8 = 0x65 - //ioDataPaddle2 uint8 = 0x66 - //ioDataPaddle3 uint8 = 0x67 + // ioDataCassette uint8 = 0x60 + // ioFlagButton0 uint8 = 0x61 + // ioFlagButton1 uint8 = 0x62 + // ioFlagButton2 uint8 = 0x63 + // ioDataPaddle0 uint8 = 0x64 + // ioDataPaddle1 uint8 = 0x65 + // ioDataPaddle2 uint8 = 0x66 + // ioDataPaddle3 uint8 = 0x67 // Not real softSwitches. Using the numbers to store the flags somewhere. ioFlagRGBCardActive uint8 = 0x7d @@ -136,7 +136,6 @@ func buildKeySoftSwitch(io *ioC0Page) softSwitchR { } } value := io.softSwitchesData[ioDataKeyboard] - //fmt.Printf("Key $%02x, %v\n", value, strobed) return value } } @@ -144,7 +143,6 @@ func buildKeySoftSwitch(io *ioC0Page) softSwitchR { func buildStrobeKeyboardSoftSwitch(io *ioC0Page) softSwitchR { return func() uint8 { result := io.softSwitchesData[ioDataKeyboard] - //fmt.Printf("Strobe $%02x\n", result) io.softSwitchesData[ioDataKeyboard] &^= 1 << 7 return result } diff --git a/boardApple2e.go b/boardApple2e.go index fd18aaa..e0bb1ed 100644 --- a/boardApple2e.go +++ b/boardApple2e.go @@ -57,11 +57,11 @@ func addApple2ESoftSwitches(io *ioC0Page) { return ssOff }, "VERTBLANK") - //io.softSwitchesData[ioFlagAltChar] = ssOn // Not sure about this. + // io.softSwitchesData[ioFlagAltChar] = ssOn // Not sure about this. } -func addSoftSwitchesMmu(io *ioC0Page, addressClear uint8, addressSet uint8, AddressGet uint8, flag *bool, name string) { +func addSoftSwitchesMmu(io *ioC0Page, addressClear uint8, addressSet uint8, addressGet uint8, flag *bool, name string) { io.addSoftSwitchW(addressClear, func(uint8) { *flag = false }, name+"OFF") @@ -70,12 +70,12 @@ func addSoftSwitchesMmu(io *ioC0Page, addressClear uint8, addressSet uint8, Addr *flag = true }, name+"ON") - io.addSoftSwitchR(AddressGet, func() uint8 { + io.addSoftSwitchR(addressGet, func() uint8 { return ssFromBool(*flag) }, name) } -func addSoftSwitchesIou(io *ioC0Page, addressClear uint8, addressSet uint8, AddressGet uint8, ioFlag uint8, name string) { +func addSoftSwitchesIou(io *ioC0Page, addressClear uint8, addressSet uint8, addressGet uint8, ioFlag uint8, name string) { io.addSoftSwitchW(addressClear, func(uint8) { io.softSwitchesData[ioFlag] = ssOff }, name+"OFF") @@ -84,7 +84,7 @@ func addSoftSwitchesIou(io *ioC0Page, addressClear uint8, addressSet uint8, Addr io.softSwitchesData[ioFlag] = ssOn }, name+"ON") - io.addSoftSwitchR(AddressGet, func() uint8 { + io.addSoftSwitchR(addressGet, func() uint8 { return io.softSwitchesData[ioFlag] }, name) } diff --git a/boardBase64a.go b/boardBase64a.go index 231c8b5..9b56b29 100644 --- a/boardBase64a.go +++ b/boardBase64a.go @@ -4,15 +4,6 @@ package izapple2 Copam BASE64A adaptation. */ -const ( - // There are 6 ROM chips. Each can have 4Kb or 8Kb. They can fill - // 2 or 4 banks with 2kb windows. - base64aRomBankSize = 12 * 1024 - base64aRomBankCount = 4 - base64aRomWindowSize = 2 * 1024 - base64aRomChipCount = 6 -) - func loadBase64aRom(a *Apple2) error { return loadMultiPageRom(a, []string{ "/BASE64A_D0.BIN", diff --git a/boardBasis108.go b/boardBasis108.go index 7e15075..2837429 100644 --- a/boardBasis108.go +++ b/boardBasis108.go @@ -56,6 +56,7 @@ func (v *videoBasis108) GetCurrentVideoMode() uint32 { isTextMode := v.a.io.isSoftSwitchActive(ioFlagText) isHiResMode := v.a.io.isSoftSwitchActive(ioFlagHiRes) + if isTextMode { mode |= screen.VideoText80 } else if isHiResMode { diff --git a/cardBuilder.go b/cardBuilder.go index f4e81ba..d97ac79 100644 --- a/cardBuilder.go +++ b/cardBuilder.go @@ -54,7 +54,7 @@ func getCardFactory() map[string]*cardBuilder { cardFactory["parallel"] = newCardParallelPrinterBuilder() cardFactory["prodosromdrive"] = newCardProDOSRomDriveBuilder() cardFactory["prodosromcard3"] = newCardProDOSRomCard3Builder() - //cardFactory["prodosnvramdrive"] = newCardProDOSNVRAMDriveBuilder() + // cardFactory["prodosnvramdrive"] = newCardProDOSNVRAMDriveBuilder() cardFactory["saturn"] = newCardSaturnBuilder() cardFactory["smartport"] = newCardSmartPortStorageBuilder() cardFactory["swyftcard"] = newCardSwyftBuilder() diff --git a/cardDan2Controller.go b/cardDan2Controller.go index ab3eeca..2ac14cc 100644 --- a/cardDan2Controller.go +++ b/cardDan2Controller.go @@ -135,10 +135,9 @@ func (c *CardDan2Controller) writeSoftSwitch(address uint8, data uint8) { c.portC |= uint8(1) << bit } c.romCsxx.setPage((c.portC & 0x07) | ((c.portB << 4) & 0xf0)) - } else { - if data != 0xfa { - c.tracef("Not supported status %v, it must be 0xfa\n", data) - } + } else if data != 0xfa { + c.tracef("Not supported status %v, it must be 0xfa\n", data) + /* Sets the 8255 with status 0xfa, 1111_1010: 1: set mode 11: port A mode 2 diff --git a/cardDisk2DriveStepper.go b/cardDisk2DriveStepper.go index 48e3201..458fd83 100644 --- a/cardDisk2DriveStepper.go +++ b/cardDisk2DriveStepper.go @@ -46,7 +46,7 @@ var cogPositions = []int{ func moveDriveStepper(phases uint8, prevStep int) int { - //fmt.Printf("magnets: 0x%x\n", phases) + // fmt.Printf("magnets: 0x%x\n", phases) cogPosition := cogPositions[phases] if cogPosition == undefinedPosition { @@ -57,7 +57,7 @@ func moveDriveStepper(phases uint8, prevStep int) int { prevPosition := prevStep % stepsPerGroup // Direction, step in the current group of magnets. delta := cogPosition - prevPosition if delta < 0 { - delta = delta + stepsPerGroup + delta += stepsPerGroup } var nextStep int @@ -78,6 +78,6 @@ func moveDriveStepper(phases uint8, prevStep int) int { } } - //fmt.Printf("[DiskII] 1/4 track: %03d %vO\n", nextStep, strings.Repeat(" ", nextStep)) + // fmt.Printf("[DiskII] 1/4 track: %03d %vO\n", nextStep, strings.Repeat(" ", nextStep)) return nextStep } diff --git a/cardDisk2Sequencer.go b/cardDisk2Sequencer.go index cc4aff7..46da0e2 100644 --- a/cardDisk2Sequencer.go +++ b/cardDisk2Sequencer.go @@ -41,7 +41,6 @@ type CardDisk2Sequencer struct { // Shared methods between both versions on the Disk II card type cardDisk2Shared interface { - //insertDiskette(drive int, ...) setTrackTracer(tt trackTracer) } @@ -91,7 +90,7 @@ func newCardDisk2SequencerBuilder() *cardBuilder { if c.sectors13 { P5RomFile = "/Apple Disk II 13 Sector Interface Card ROM P5 - 341-0009.bin" // Buggy sequencer not need for 13 sectors disks to work - //P6RomFile = "/Apple Disk II 13 Sector Interface Card ROM P6 - 341-0010.bin" + // P6RomFile = "/Apple Disk II 13 Sector Interface Card ROM P6 - 341-0010.bin" } err := c.loadRomFromResource(P5RomFile, cardRomSimple) @@ -308,7 +307,7 @@ func (c *CardDisk2Sequencer) step(data uint8, firstStep bool) bool { c.register = (c.register << 1) | ((inst >> 2) & 1) case 2: // Shift right bringing wProt - c.register = c.register >> 1 + c.register >>= 1 if wProt { c.register |= 0x80 } @@ -327,7 +326,7 @@ func (c *CardDisk2Sequencer) step(data uint8, firstStep bool) bool { } } - //fmt.Printf("[D2SEQ] Step. seq:%x inst:%x next:%x reg:%02x\n", + // fmt.Printf("[D2SEQ] Step. seq:%x inst:%x next:%x reg:%02x\n", // c.sequence, inst, next, c.register) c.sequence = next diff --git a/cardInOut.go b/cardInOut.go index 7eecb11..122b368 100644 --- a/cardInOut.go +++ b/cardInOut.go @@ -48,11 +48,11 @@ func (c *CardInOut) assign(a *Apple2, slot int) { if value&0x7f == 10 { value = 13 + 0x80 } - //fmt.Printf("[cardInOut] Read access to softswith 0x%x for slot %v, value %x.\n", 0, slot, value) + // fmt.Printf("[cardInOut] Read access to softswith 0x%x for slot %v, value %x.\n", 0, slot, value) return value }, "INOUTR") c.addCardSoftSwitchW(1, func(value uint8) { - //fmt.Printf("[cardInOut] Write access to softswith 0x%x for slot %v, value 0x%x: %v, %v.\n", 1, slot, value, value&0x7f, string(value&0x7f)) + // fmt.Printf("[cardInOut] Write access to softswith 0x%x for slot %v, value 0x%x: %v, %v.\n", 1, slot, value, value&0x7f, string(value&0x7f)) if value&0x7f == 13 { fmt.Printf("\n") } else { @@ -62,7 +62,7 @@ func (c *CardInOut) assign(a *Apple2, slot int) { }, "INOUTW") data := buildBaseInOutRom(slot) - c.romCsxx = newMemoryRangeROM(0xC200, data[:], "InOUt card") + c.romCsxx = newMemoryRangeROM(0xC200, data, "InOUt card") c.cardBase.assign(a, slot) } diff --git a/cardLanguage.go b/cardLanguage.go index 6f849de..5fc34d2 100644 --- a/cardLanguage.go +++ b/cardLanguage.go @@ -103,7 +103,7 @@ func (c *CardLanguage) ssAction(ss uint8, write bool) { c.readState = false c.writeState = lcWriteDisabled case 3: - //RAM read, RAM write + // RAM read, RAM write c.readState = true if !write { c.writeState++ diff --git a/cardMouse.go b/cardMouse.go index b048336..533378d 100644 --- a/cardMouse.go +++ b/cardMouse.go @@ -244,7 +244,7 @@ func (c *CardMouse) assign(a *Apple2, slot int) { }, "TIMEDATEMOUSE") data := buildBaseInOutRom(slot) - c.romCsxx = newMemoryRangeROM(0xC200, data[:], "Mouse card") + c.romCsxx = newMemoryRangeROM(0xC200, data, "Mouse card") // Identification as a mouse card // From Technical Note Misc #8, "Pascal 1.1 Firmware Protocol ID Bytes": @@ -253,7 +253,6 @@ func (c *CardMouse) assign(a *Apple2, slot int) { data[0x0b] = 0x01 data[0x0c] = 0x20 // From "AppleMouse // User's Manual", Appendix B: - //data[0x0c] = 0x20 data[0xfb] = 0xd6 // Set 8 entrypoints to sofstwitches 2 to 1f diff --git a/cardParallelPrinter.go b/cardParallelPrinter.go index 4ae3ed7..036c0ab 100644 --- a/cardParallelPrinter.go +++ b/cardParallelPrinter.go @@ -60,7 +60,7 @@ func (c *CardParallelPrinter) assign(a *Apple2, slot int) { func (c *CardParallelPrinter) printByte(value uint8) { if c.ascii { // As text the MSB has to be removed, but if done, graphics modes won't work - value = value & 0x7f // Remove the MSB bit + value &= 0x7f // Remove the MSB bit } c.file.Write([]byte{value}) } diff --git a/cardProDOSRomCard3.go b/cardProDOSRomCard3.go index 304ad63..a72e92f 100644 --- a/cardProDOSRomCard3.go +++ b/cardProDOSRomCard3.go @@ -114,7 +114,7 @@ func (c *CardProDOSRomCard3) translateAddress(address uint16) int { offset := address - 0xC800 pageAddress := int(c.bank&0x7FF) * 0x0800 - //fmt.Printf("CardProDOSRomCard3.translateAddress: address=%04X, bank=%04X, offset=%04X, pageAddress=%08X\n", address, c.bank, offset, pageAddress) + // fmt.Printf("CardProDOSRomCard3.translateAddress: address=%04X, bank=%04X, offset=%04X, pageAddress=%08X\n", address, c.bank, offset, pageAddress) return pageAddress + int(offset) } diff --git a/cardProDOSRomDrive.go b/cardProDOSRomDrive.go index 552f848..bd0ba83 100644 --- a/cardProDOSRomDrive.go +++ b/cardProDOSRomDrive.go @@ -27,7 +27,7 @@ func newCardProDOSRomDriveBuilder() *cardBuilder { name: "ProDOS ROM Drive", description: "A bootable 1 MB solid state disk by Terence Boldt", defaultParams: &[]paramSpec{ - //{"image", "ROM image with the ProDOS volume", "https://github.com/tjboldt/ProDOS-ROM-Drive/raw/v4.0/Firmware/GamesWithFirmware.po"}, + // {"image", "ROM image with the ProDOS volume", "https://github.com/tjboldt/ProDOS-ROM-Drive/raw/v4.0/Firmware/GamesWithFirmware.po"}, {"image", "ROM image with the ProDOS volume", "https://github.com/Alex-Kw/ProDOS-ROM-Drive-Images/raw/main/ProDOS_2.4.3_TJ.po"}, }, buildFunc: func(params map[string]string) (Card, error) { diff --git a/cardSaturn.go b/cardSaturn.go index fc8f009..d2d40f0 100644 --- a/cardSaturn.go +++ b/cardSaturn.go @@ -70,7 +70,7 @@ func (c *CardSaturn) ssAction(ss uint8) { c.readState = false c.writeState = lcWriteDisabled case 3: - //RAM read, RAM write + // RAM read, RAM write c.altBank = false c.readState = true c.writeState++ @@ -98,7 +98,7 @@ func (c *CardSaturn) ssAction(ss uint8) { c.readState = false c.writeState = lcWriteDisabled case 11: - //RAM read, RAM write + // RAM read, RAM write c.altBank = true c.readState = true c.writeState++ diff --git a/command.go b/command.go index 223d47c..c66f8fd 100644 --- a/command.go +++ b/command.go @@ -70,10 +70,10 @@ func (a *Apple2) executeCommand(command command) { switch command.getId() { case CommandToggleSpeed: if a.cycleDurationNs == 0 { - //fmt.Println("Slow") + // fmt.Println("Slow") a.cycleDurationNs = 1000.0 / CPUClockMhz } else { - //fmt.Println("Fast") + // fmt.Println("Fast") a.cycleDurationNs = 0 } case CommandShowSpeed: diff --git a/component/mc6845.go b/component/mc6845.go index 0957eb9..2025a05 100644 --- a/component/mc6845.go +++ b/component/mc6845.go @@ -35,7 +35,7 @@ func (m *MC6845) Write(rs bool, value uint8) { } else if m.sel <= 15 { // R0 to R15 are writable m.reg[m.sel] = value - //fmt.Printf("Set %v to %v\n", m.sel, value) + // fmt.Printf("Set %v to %v\n", m.sel, value) } } diff --git a/component/microPD1990ac.go b/component/microPD1990ac.go index 4309834..83a7464 100644 --- a/component/microPD1990ac.go +++ b/component/microPD1990ac.go @@ -5,21 +5,22 @@ import ( ) /* - microPD1990ac Serial I/O Calendar Clock IC - See: - https://www.semiee.com/file/backup/NEC-D1990.pdf +microPD1990ac Serial I/O Calendar Clock IC +See: - Used by the ThunderClock+ real time clock card. + https://www.semiee.com/file/backup/NEC-D1990.pdf - The 40 bit register has 5 bytes (10 nibbles): - byte 4: - month, binary from 1 to 12 - day of week, BCD 0 to 6 - byte 3: day of month, BCD 1 to 31 - byte 2: hour, BCD 0 to 23 - byte 1: minute, BCD 0 to 59 - byte 0: seconds, BCD 0 to 59 +Used by the ThunderClock+ real time clock card. +The 40 bit register has 5 bytes (10 nibbles): + + byte 4: + month, binary from 1 to 12 + day of week, BCD 0 to 6 + byte 3: day of month, BCD 1 to 31 + byte 2: hour, BCD 0 to 23 + byte 1: minute, BCD 0 to 59 + byte 0: seconds, BCD 0 to 59 */ type MicroPD1990ac struct { clock bool // CLK state @@ -55,7 +56,7 @@ func (m *MicroPD1990ac) In(clock bool, strobe bool, command uint8, dataIn bool) m.loadTime() default: // Ignore unknown commands (like set time) - //panic(fmt.Sprintf("PD1990ac command %v not implemented.", m.command)) + // panic(fmt.Sprintf("PD1990ac command %v not implemented.", m.command)) } } diff --git a/e2e_woz_test.go b/e2e_woz_test.go index 1abf041..6c98967 100644 --- a/e2e_woz_test.go +++ b/e2e_woz_test.go @@ -38,7 +38,7 @@ func testWoz(t *testing.T, sequencer bool, file string, expectedTracks []int, cy t.Errorf("Quarter tracks, expected %#v, got %#v", expectedTracks, tt.quarterTracks) } - //t.Errorf("Cycles: %d vs %d", at.a.cpu.GetCycles(), cycleLimit) + // t.Errorf("Cycles: %d vs %d", at.a.cpu.GetCycles(), cycleLimit) } const ( diff --git a/frontend/a2fyne/fyneKeyboard.go b/frontend/a2fyne/fyneKeyboard.go index 5544756..966e2a1 100644 --- a/frontend/a2fyne/fyneKeyboard.go +++ b/frontend/a2fyne/fyneKeyboard.go @@ -74,7 +74,7 @@ func (k *keyboard) putKey(keyEvent *fyne.KeyEvent) { */ // Keys with control are not generating events in putKey() - //ctrl := k.controlLeft || k.controlRight + // ctrl := k.controlLeft || k.controlRight result := uint8(0) switch keyEvent.Name { @@ -127,14 +127,14 @@ func (k *keyboard) putKey(keyEvent *fyne.KeyEvent) { case fyne.KeyF11: k.s.a.SendCommand(izapple2.CommandToggleCPUTrace) case fyne.KeyF12: - //case fyne.KeyPrintScreen: + // case fyne.KeyPrintScreen: err := screen.SaveSnapshot(k.s.a.GetVideoSource(), k.s.screenMode, "snapshot.png") if err != nil { fmt.Printf("Error saving snapshoot: %v.\n.", err) } else { fmt.Println("Saving snapshot") } - //case fyne.KeyPause: + // case fyne.KeyPause: // k.s.a.SendCommand(izapple2.CommandPauseUnpause) } diff --git a/frontend/a2fyne/main.go b/frontend/a2fyne/main.go index fadc73a..7398681 100644 --- a/frontend/a2fyne/main.go +++ b/frontend/a2fyne/main.go @@ -123,21 +123,21 @@ func registerKeyboardEvents(s *state) { // Events canvas.SetOnTypedKey(func(ke *fyne.KeyEvent) { - //fmt.Printf("Event: %v\n", ke.Name) + // fmt.Printf("Event: %v\n", ke.Name) kp.putKey(ke) }) canvas.SetOnTypedRune(func(ch rune) { - //fmt.Printf("Rune: %v\n", ch) + // fmt.Printf("Rune: %v\n", ch) kp.putRune(ch) }) if deskCanvas, ok := canvas.(desktop.Canvas); ok { deskCanvas.SetOnKeyDown(func(ke *fyne.KeyEvent) { kp.putKeyAction(ke, true) - //fmt.Printf("Event down: %v\n", ke.Name) + // fmt.Printf("Event down: %v\n", ke.Name) }) deskCanvas.SetOnKeyUp(func(ke *fyne.KeyEvent) { kp.putKeyAction(ke, false) - //fmt.Printf("Event up: %v\n", ke.Name) + // fmt.Printf("Event up: %v\n", ke.Name) }) } } diff --git a/frontend/a2fyne/toolbar.go b/frontend/a2fyne/toolbar.go index f72f340..9dd95c9 100644 --- a/frontend/a2fyne/toolbar.go +++ b/frontend/a2fyne/toolbar.go @@ -52,8 +52,8 @@ func buildToolbar(s *state) *widget.Toolbar { s.a.SetForceCaps(!s.a.IsForceCaps()) s.win.SetTitle(s.DefaultTitle()) })) - //tb.Append(widget.NewToolbarSeparator()) - //tb.Append(newToolbarDisk("S6D1") + // tb.Append(widget.NewToolbarSeparator()) + // tb.Append(newToolbarDisk("S6D1") tb.Append(widget.NewToolbarSpacer()) tb.Append(widget.NewToolbarAction( theme.ViewFullScreenIcon(), diff --git a/frontend/a2sdl/sdlJoysticks.go b/frontend/a2sdl/sdlJoysticks.go index 75b04b6..2f0065a 100644 --- a/frontend/a2sdl/sdlJoysticks.go +++ b/frontend/a2sdl/sdlJoysticks.go @@ -56,7 +56,7 @@ func newSDLJoysticks(useMouseAlt bool) *sdlJoysticks { } // To enter Apple IIe on self test mode - //j.keys[1] = true + // j.keys[1] = true return &j } @@ -94,8 +94,8 @@ func mouseToJoyCentered(x int32, w int32) uint8 { func (j *sdlJoysticks) putMouseMotionEvent(e *sdl.MouseMotionEvent, width int32, height int32) { if j.useMouse { // The mouse moves on all the window - //j.paddle[0] = mouseToJoyFull(e.X, width) - //j.paddle[1] = mouseToJoyFull(e.Y, height) + // j.paddle[0] = mouseToJoyFull(e.X, width) + // j.paddle[1] = mouseToJoyFull(e.Y, height) // The mouse moves around the center of the window j.paddle[0] = mouseToJoyCentered(e.X, width) @@ -106,11 +106,11 @@ func (j *sdlJoysticks) putMouseMotionEvent(e *sdl.MouseMotionEvent, width int32, func (j *sdlJoysticks) putMouseButtonEvent(e *sdl.MouseButtonEvent) { pressed := e.State == sdl.PRESSED switch e.Button { - case 1: //BUTTON_LEFT + case 1: // BUTTON_LEFT j.mousebuttons[0] = pressed - case 3: //BUTTON_RIGHT + case 3: // BUTTON_RIGHT j.mousebuttons[1] = pressed - case 2: //BUTTON_MIDDLE + case 2: // BUTTON_MIDDLE j.mousebuttons[2] = pressed } } @@ -129,8 +129,8 @@ func (j *sdlJoysticks) putKey(keyEvent *sdl.KeyboardEvent) { j.keys[0] = pressed case sdl.K_RALT: j.keys[1] = pressed - //case sdl.K_LGUI: - // j.keys[2] = pressed + // case sdl.K_LGUI: + // j.keys[2] = pressed } } diff --git a/frontend/headless/main.go b/frontend/headless/main.go index 09143c1..08c3ff5 100644 --- a/frontend/headless/main.go +++ b/frontend/headless/main.go @@ -91,7 +91,7 @@ func main() { case "clearkeys": fe.clearKeyQueue() - //Screen related commands + // Screen related commands case "text": fmt.Print(izapple2.DumpTextModeAnsi(a)) diff --git a/fujinet/json.go b/fujinet/json.go index d303440..d20959e 100644 --- a/fujinet/json.go +++ b/fujinet/json.go @@ -88,12 +88,12 @@ func getJsonValue(data any) []uint8 { return []uint8("FALSE") } case float64: - //if math.Floor(v) == v { // As done in FNJSON__getValue() - // It's an integer + // if math.Floor(v) == v { // As done in FNJSON__getValue() + // It's an integer return []uint8(strconv.Itoa(int(v))) - //} else { - // return []uint8(fmt.Sprintf("%.10f", v)) - //} + // } else { + // return []uint8(fmt.Sprintf("%.10f", v)) + // } case string: return []uint8(v) case []any: diff --git a/memoryManager.go b/memoryManager.go index 9c474fc..619d182 100644 --- a/memoryManager.go +++ b/memoryManager.go @@ -12,7 +12,7 @@ type memoryManager struct { physicalMainRAM memoryRangeHandler // 0x0000 to 0xbfff, Up to 48 Kb // Slots area: 0xc000 to 0xcfff - cardsROM [8]memoryHandler //0xcs00 to 0xcSff. 256 bytes for each card + cardsROM [8]memoryHandler // 0xcs00 to 0xcSff. 256 bytes for each card cardsROMExtra [8]memoryHandler // 0xc800 to 0xcfff. 2048 bytes for each card // Upper area ROM: 0xc000 to 0xffff (or 0xd000 to 0xffff on the II+) @@ -241,9 +241,9 @@ func (mmu *memoryManager) Peek(address uint16) uint8 { return uint8(address) // Or some random number } value := mh.peek(address) - //if address >= 0xc400 && address < 0xc500 { - // fmt.Printf("[MMU] Peek at %04x: %02x\n", address, value) - //} + // if address >= 0xc400 && address < 0xc500 { + // fmt.Printf("[MMU] Peek at %04x: %02x\n", address, value) + // } return value } @@ -268,9 +268,9 @@ func (mmu *memoryManager) PeekCode(address uint16) uint8 { } value := mh.peek(address) - //if address >= 0xc400 && address < 0xc500 { - // fmt.Printf("[MMU] PeekCode at %04x: %02x\n", address, value) - //} + // if address >= 0xc400 && address < 0xc500 { + // fmt.Printf("[MMU] PeekCode at %04x: %02x\n", address, value) + // } return value } @@ -288,9 +288,9 @@ func (mmu *memoryManager) Poke(address uint16, value uint8) { mh.poke(address, value) } - //if address >= 0x0036 && address <= 0x0039 { - // fmt.Printf("[MMU] Poke at %04x: %02x\n", address, value) - //} + // if address >= 0x0036 && address <= 0x0039 { + // fmt.Printf("[MMU] Poke at %04x: %02x\n", address, value) + // } } // Memory initialization @@ -339,7 +339,7 @@ func (mmu *memoryManager) setLanguageRAM(readActive bool, writeActive bool, altB } func (mmu *memoryManager) setLanguageRAMActiveBlock(block uint8) { - block = block % uint8(len(mmu.physicalLangRAM)) + block %= uint8(len(mmu.physicalLangRAM)) mmu.lcSelectedBlock = block } diff --git a/noSlotClockDS1216.go b/noSlotClockDS1216.go index 20d72b8..bd1d729 100644 --- a/noSlotClockDS1216.go +++ b/noSlotClockDS1216.go @@ -37,14 +37,14 @@ type noSlotClockDS1216 struct { } var nscBitPattern = [64]bool{ - true, false, true, false, false, false, true, true, //C5 - false, true, false, true, true, true, false, false, //3A - true, true, false, false, false, true, false, true, //A3 - false, false, true, true, true, false, true, false, //5C - true, false, true, false, false, false, true, true, //C5 - false, true, false, true, true, true, false, false, //3A - true, true, false, false, false, true, false, true, //A3 - false, false, true, true, true, false, true, false, //5C + true, false, true, false, false, false, true, true, // C5 + false, true, false, true, true, true, false, false, // 3A + true, true, false, false, false, true, false, true, // A3 + false, false, true, true, true, false, true, false, // 5C + true, false, true, false, false, false, true, true, // C5 + false, true, false, true, true, true, false, false, // 3A + true, true, false, false, false, true, false, true, // A3 + false, false, true, true, true, false, true, false, // 5C } const ( @@ -166,7 +166,7 @@ func (nsc *noSlotClockDS1216) loadTime() { // Bits 4 and 5 of the day register are used to control the RST and oscillator // functions. These bits are shipped from the factory set to logic 1. - register += 0x0 //0x3, but zero on read. + register += 0x0 // 0x3, but zero on read. register <<= 4 register += uint64(now.Weekday()) + 1 register <<= 4 diff --git a/romX.go b/romX.go index 27201de..e392686 100644 --- a/romX.go +++ b/romX.go @@ -49,10 +49,10 @@ const ( romXPlusSetTextBankBaseAddress = uint16(0xcfd0) // Unknown - //romXFirmwareMark0Address = uint16(0xdffe) - //romXFirmwareMark0Value = uint8(0x4a) - //romXFirmwareMark1Address = uint16(0xdfff) - //romXFirmwareMark1Value = uint8(0xcd) + // romXFirmwareMark0Address = uint16(0xdffe) + // romXFirmwareMark0Value = uint8(0x4a) + // romXFirmwareMark1Address = uint16(0xdfff) + // romXFirmwareMark1Value = uint8(0xcd) romXceSelectTempBank = uint16(0xf850) romXceSelectMainBank = uint16(0xf851) diff --git a/screen/loRes.go b/screen/loRes.go index 8234ef7..bac4fc6 100644 --- a/screen/loRes.go +++ b/screen/loRes.go @@ -74,7 +74,7 @@ func renderGr(data []uint8, isDoubleResMode bool, light color.Color) *image.RGBA if isDoubleResMode && ((c % 2) == 0) { // See "Understanding the Apple II", page 8-44 // Even blocks color are rotated left one bit - offset = offset + 3 // Equivalent to -1 + offset += 3 // Equivalent to -1 } // Insert the pixelWidth pixels required diff --git a/screen/snapshots.go b/screen/snapshots.go index 19989d7..fa69f81 100644 --- a/screen/snapshots.go +++ b/screen/snapshots.go @@ -19,7 +19,7 @@ const ( ScreenModeGreen = iota // ScreenModePlain to render in color with filled areas ScreenModePlain - //ScreenModeNTSC shows spaces between pixels + // ScreenModeNTSC shows spaces between pixels ScreenModeNTSC ) diff --git a/screen/text.go b/screen/text.go index df8fec0..c5b2681 100644 --- a/screen/text.go +++ b/screen/text.go @@ -39,9 +39,7 @@ func getText80FromMemory(vs VideoSource, isSecondPage bool, hasAltOrder bool) [] text40ColumnsAlt := getTextFromMemory(vs, isSecondPage, true) if hasAltOrder { - tmp := text40ColumnsAlt - text40ColumnsAlt = text40Columns - text40Columns = tmp + text40ColumnsAlt, text40Columns = text40Columns, text40ColumnsAlt } // Merge the two 40 cols to return 80 cols diff --git a/screen/textToAnsi.go b/screen/textToAnsi.go index 389adab..4272498 100644 --- a/screen/textToAnsi.go +++ b/screen/textToAnsi.go @@ -56,14 +56,14 @@ func textMemoryByteToString(value uint8, isAltCharSet bool, supportsLowercase bo } // Move blocks - value = value & 0x7f + value &= 0x7f if !supportsLowercase { // No lowercase - value = value & 0x3f + value &= 0x3f } if isFlash || isInverse && !isAltCharSet { // No flash or inverse lowercase - value = value & 0x3f + value &= 0x3f } if value < 0x20 { // Control is Uppercase diff --git a/setup.go b/setup.go index 8150a36..75772cb 100644 --- a/setup.go +++ b/setup.go @@ -86,8 +86,8 @@ func configure(configuration *configuration) (*Apple2, error) { mods := strings.Split(configuration.get(confMods), ",") for _, mod := range mods { switch strings.TrimSpace(mod) { - //case "shift": - // setupShiftedKeyboard(a) + // case "shift": + // setupShiftedKeyboard(a) case "four-colors": // This removes the mod to have 6 colors sent by Wozniak to Byte // magazine. See: https://archive.org/details/byte-magazine-1979-06/page/n67/mode/2up?view=theater diff --git a/smartPortFujinetNetwork.go b/smartPortFujinetNetwork.go index 1c60f5c..b920ef8 100644 --- a/smartPortFujinetNetwork.go +++ b/smartPortFujinetNetwork.go @@ -29,7 +29,7 @@ type SmartPortFujinetNetwork struct { jsonData *fujinet.FnJson data []uint8 - //connected uint8 + // connected uint8 } // NewSmartPortFujinetNetwork creates a new fujinet device @@ -180,12 +180,12 @@ func (d *SmartPortFujinetNetwork) controlOpen(method uint8, translation uint8, r urlParsed, err := url.Parse(rawUrl) if err != nil { d.errorCode = fujinet.NetworkErrorInvalidDeviceSpec - d.statusByte = 4 //client_error + d.statusByte = 4 // client_error } d.protocol, d.errorCode = fujinet.InstantiateProtocol(urlParsed, method) if d.protocol == nil { - d.statusByte = 4 //client_error + d.statusByte = 4 // client_error return } diff --git a/storage/disketteNib.go b/storage/disketteNib.go index 598ff3b..8c18a57 100644 --- a/storage/disketteNib.go +++ b/storage/disketteNib.go @@ -22,7 +22,7 @@ func (d *disketteNib) Read(quarterTrack int, cycle uint64) uint8 { track := d.nib.track[quarterTrack/4] value := track[d.position] d.position = (d.position + 1) % nibBytesPerTrack - //fmt.Printf("%v, %v, %v, %x\n", 0, 0, d.position, uint8(value)) + // fmt.Printf("%v, %v, %v, %x\n", 0, 0, d.position, uint8(value)) return value } diff --git a/storage/disketteNibTimed.go b/storage/disketteNibTimed.go index a330a26..7625cd5 100644 --- a/storage/disketteNibTimed.go +++ b/storage/disketteNibTimed.go @@ -31,7 +31,7 @@ func (d *disketteNibTimed) Read(quarterTrack int, cycle uint64) uint8 { } value := track[bytePosition] value >>= shift - //fmt.Printf("%v, %v, %v, %x\n", bitPosition, shift, bytePosition, uint8(value)) + // fmt.Printf("%v, %v, %v, %x\n", bitPosition, shift, bytePosition, uint8(value)) return value } diff --git a/storage/disketteWoz.go b/storage/disketteWoz.go index aac1a60..4de2216 100644 --- a/storage/disketteWoz.go +++ b/storage/disketteWoz.go @@ -71,7 +71,7 @@ func (d *disketteWoz) Read(quarterTrack int, cycle uint64) uint8 { d.latch = (d.latch << 1) + bit if d.latch >= 0x80 { // Valid byte, store value a bit longer and clear the internal latch - //fmt.Printf("Valid 0x%.2x\n", d.latch) + // fmt.Printf("Valid 0x%.2x\n", d.latch) d.visibleLatch = d.latch d.visibleLatchCountDown = 1 d.latch = 0 @@ -84,7 +84,7 @@ func (d *disketteWoz) Read(quarterTrack int, cycle uint64) uint8 { } } - //fmt.Printf("Visible: 0x%.2x, latch: 0x%.2x, bits: %v, cycles: %v\n", d.visibleLatch, d.latch, deltaBits, cycle-d.cycle) + // fmt.Printf("Visible: 0x%.2x, latch: 0x%.2x, bits: %v, cycles: %v\n", d.visibleLatch, d.latch, deltaBits, cycle-d.cycle) // Update the internal last cycle without losing the remainder not processed d.cycle += deltaBits * cyclesPerBit diff --git a/storage/fileWoz.go b/storage/fileWoz.go index 7016116..2576ff8 100644 --- a/storage/fileWoz.go +++ b/storage/fileWoz.go @@ -168,7 +168,7 @@ func NewFileWoz(data []uint8) (*FileWoz, error) { chunks[id] = data[i:iNext] i = iNext - //fmt.Printf("Chunk %v, size %v - %v\n", id, chunkHeader.Size, len(chunks[id])) + // fmt.Printf("Chunk %v, size %v - %v\n", id, chunkHeader.Size, len(chunks[id])) } // Read the INFO chunk @@ -193,7 +193,7 @@ func NewFileWoz(data []uint8) (*FileWoz, error) { parts := strings.Split(entry, "\t") if len(parts) >= 2 { f.meta[parts[0]] = parts[1] - //fmt.Printf("*** %v: %v\n", parts[0], parts[1]) + // fmt.Printf("*** %v: %v\n", parts[0], parts[1]) } } } @@ -231,7 +231,7 @@ func NewFileWoz(data []uint8) (*FileWoz, error) { dataPos := woz2TrackBlockSize*(int(trackHeader.StartingBlock)-woz2FirstTrackBlock) + woz2TrackBitsOffset dataSize := woz2TrackBlockSize * int(trackHeader.BlockCount) - //fmt.Printf("@%v %v:%v (%v) of %v\n", trackHeader.StartingBlock, dataPos, dataPos+dataSize, dataSize, len(tracksData)) + // fmt.Printf("@%v %v:%v (%v) of %v\n", trackHeader.StartingBlock, dataPos, dataPos+dataSize, dataSize, len(tracksData)) f.tracks[i].data = tracksData[dataPos : dataPos+dataSize] } } @@ -293,6 +293,6 @@ func (f *FileWoz) dump() { } } - //nibs := f.dumpTrackAsNib(0) - //fmt.Printf(" Zero track: {%v} %x\n", len(nibs), nibs) + // nibs := f.dumpTrackAsNib(0) + // fmt.Printf(" Zero track: {%v} %x\n", len(nibs), nibs) } diff --git a/traceProDOS.go b/traceProDOS.go index 884f6c7..e66ed04 100644 --- a/traceProDOS.go +++ b/traceProDOS.go @@ -57,11 +57,11 @@ func (t *traceProDOS) inspect() { t.dumpMLICall() t.refreshDeviceDrives() t.callPending = true - //t.a.cpu.SetTrace(true) + // t.a.cpu.SetTrace(true) } else if t.callPending && pc == t.returnAddress { t.dumpMLIReturn() t.callPending = false - //t.a.cpu.SetTrace(false) + // t.a.cpu.SetTrace(false) } else if pc == biAddress { t.dumpBIExec() } else if /*t.callPending &&*/ t.isDriverAddress(pc) {