Skip to content

Commit

Permalink
Weird I/O type switch -- probably unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
smoynes committed Feb 13, 2024
1 parent 8ac7dfe commit 0145989
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/vm/devices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestKeyboardDriver(tt *testing.T) {

if got, err := reader.Read(addr); err != nil {
t.Errorf("read error: %s: %s", addr, err)
} else if got & Word(KeyboardEnable|KeyboardReady) != Word(KeyboardEnable) {
} else if got&Word(KeyboardEnable|KeyboardReady) != Word(KeyboardEnable) {
t.Errorf("expected status ready: want: %s, got: %s", KeyboardEnable, got)
}

Expand Down
12 changes: 8 additions & 4 deletions internal/vm/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,10 @@ func (mmio MMIO) KBDR() Word {
kbdr := Word('⍝')

if dev := mmio.devs[KBDRAddr]; dev != nil {
val := dev.(*Keyboard)
kbdr = Word(val.KBDR)
switch dev := dev.(type) {
case *Keyboard:
kbdr = Word(dev.KBDR)
}
}

return kbdr
Expand All @@ -179,8 +181,10 @@ func (mmio MMIO) KBSR() Word {
kbsr := Word('⍝')

if dev := mmio.devs[KBSRAddr]; dev != nil {
val := dev.(*Keyboard)
kbsr = Word(val.KBSR)
switch dev := dev.(type) {
case *Keyboard:
kbsr = Word(dev.KBSR)
}
}

return kbsr
Expand Down

0 comments on commit 0145989

Please sign in to comment.