aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-01-30 08:58:48 +0100
committerDimitri Sokolyuk <demon@dim13.org>2018-01-30 08:58:48 +0100
commitf686063b66c97fa65e556c8c56b9beadc6b35eca (patch)
treeb123a092700d6894b54c14ff61f6b251be7ab574
parent736fbaeaba9c57b2f624a42808fc524f306b1591 (diff)
cleanup
-rw-r--r--core.go18
-rw-r--r--core_test.go2
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)