mirror of
https://github.com/ivanizag/izapple2.git
synced 2025-04-14 06:37:25 +00:00
some cleaning
This commit is contained in:
parent
723eb116e7
commit
0598a8a393
@ -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()
|
||||
|
@ -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
|
||||
}
|
@ -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)
|
||||
}
|
||||
|
@ -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{
|
||||
"<internal>/BASE64A_D0.BIN",
|
||||
|
@ -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 {
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 = "<internal>/Apple Disk II 13 Sector Interface Card ROM P5 - 341-0009.bin"
|
||||
// Buggy sequencer not need for 13 sectors disks to work
|
||||
//P6RomFile = "<internal>/Apple Disk II 13 Sector Interface Card ROM P6 - 341-0010.bin"
|
||||
// P6RomFile = "<internal>/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
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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++
|
||||
|
@ -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
|
||||
|
@ -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})
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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++
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 (
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ func main() {
|
||||
case "clearkeys":
|
||||
fe.clearKeyQueue()
|
||||
|
||||
//Screen related commands
|
||||
// Screen related commands
|
||||
case "text":
|
||||
fmt.Print(izapple2.DumpTextModeAnsi(a))
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
8
romX.go
8
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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
4
setup.go
4
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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user