From f686063b66c97fa65e556c8c56b9beadc6b35eca Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 30 Jan 2018 08:58:48 +0100 Subject: cleanup --- core.go | 18 +++++++++--------- core_test.go | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core.go b/core.go index 21bdf11..8e33280 100644 --- a/core.go +++ b/core.go @@ -21,16 +21,16 @@ type Console interface { // Core of J1 Forth CPU type Core struct { - memory [memSize]uint16 // 0..0x3fff main memory, 0x4000 .. 0x7fff mem-mapped i/o - pc uint16 // 13 bit - st0 uint16 // top of data stack - d, r stack // data and return stacks - tty Console // console i/o + memory [memSize]uint16 // 0..0x3fff main memory, 0x4000 .. 0x7fff mem-mapped i/o + pc uint16 // 13 bit + st0 uint16 // top of data stack + d, r stack // data and return stacks + console Console // console i/o } // New core with console i/o func New(con Console) *Core { - return &Core{tty: con} + return &Core{console: con} } // Reset VM @@ -69,7 +69,7 @@ func (c *Core) writeAt(addr, value uint16) error { } switch addr { case 0xf000: // key - c.tty.Write(value) + c.console.Write(value) case 0xf002: // bye return errStop } @@ -82,9 +82,9 @@ func (c *Core) readAt(addr uint16) uint16 { } switch addr { case 0xf000: // tx! - return c.tty.Read() + return c.console.Read() case 0xf001: // ?rx - return c.tty.Len() + return c.console.Len() } return 0 } diff --git a/core_test.go b/core_test.go index 68229be..ab4e05a 100644 --- a/core_test.go +++ b/core_test.go @@ -20,7 +20,7 @@ func cmp(t *testing.T, got, want Core) { t.Errorf("rsp: got %0.4X, want %0.4X", got.r.sp, want.r.sp) } if got.d.data != want.d.data { - t.Errorf("d:stack: got %0.4X, want %0.4X", got.d.data, want.d.data) + t.Errorf("dstack: got %0.4X, want %0.4X", got.d.data, want.d.data) } if got.r.data != want.r.data { t.Errorf("rstack: got %0.4X, want %0.4X", got.r.data, want.r.data) -- cgit v1.2.3