summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-01-08 22:27:36 +0100
committerDimitri Sokolyuk <demon@dim13.org>2017-01-08 22:27:36 +0100
commit50f17622517a7d1757fb345e3a57ef5dfc5b9e4d (patch)
tree51708b862f049f9e3006b41a3604cbf87f42cfd4
parentd2bf26f62f27386cb82655d01c8f9ceb975b1447 (diff)
Cleanup
-rw-r--r--tek.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/tek.go b/tek.go
index ba92b5b..010ed56 100644
--- a/tek.go
+++ b/tek.go
@@ -78,12 +78,12 @@ func (o *Out) Dim() (w, h int) {
// Table 13-5 Rules for Sending Short Address
// Bytes Changed Bytes Sent
-// High Y Extra Low Y High X Low X
+// High Y Extra Low Y High X Low X
// High Y Yes No No No Yes
+// Extra No Yes Yes No Yes
// Low Y No No Yes No Yes
// High X No No Yes Yes Yes
// Low X No No No No Yes
-// Extra No Yes Yes No Yes
// Ref: http://www.vt100.net/docs/vt3xx-gp/chapter13.html
@@ -92,27 +92,32 @@ func (o *Out) Plot(x, y int) {
y = limit(y, o.height)
hy := byte(y>>7) & 0x1f
+ eb := (byte(y&3) << 2) | byte(x&3)
ly := byte(y>>2) & 0x1f
hx := byte(x>>7) & 0x1f
lx := byte(x>>2) & 0x1f
- eb := (byte(y&3) << 2) | byte(x&3)
if hy != o.hy {
o.writeByte(hy | 0x20)
}
+
if eb != o.eb {
o.writeByte(eb | 0x60)
}
- if eb != o.eb || ly != o.ly || hx != o.hx {
+
+ if ly != o.ly || eb != o.eb || hx != o.hx {
o.writeByte(ly | 0x60)
}
+
if hx != o.hx {
o.writeByte(hx | 0x20)
}
+
o.writeByte(lx | 0x40)
- o.hx = hx
+
o.hy = hy
- o.lx = lx
- o.ly = ly
o.eb = eb
+ o.ly = ly
+ o.hx = hx
+ o.lx = lx
}