monome / teletype

monome eurorack module
GNU General Public License v2.0
195 stars 82 forks source link

Bug with O? #37

Closed samdoshi closed 8 years ago

samdoshi commented 8 years ago

On a freshly booted up Teletype...

O        prints 1
O 0
O        prints 1

The docs indicate that it should return a 0. Want me to fix it?

tehn commented 8 years ago

certainly. perhaps the increment is happening before return?

On Tue, Apr 12, 2016 at 9:57 AM, Sam Doshi notifications@github.com wrote:

On a freshly booted up Teletype...

O prints 1 O 0 O prints 1

The docs indicate that it should return a 0. Want me to fix it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/monome/teletype/issues/37

samdoshi commented 8 years ago

It is, I just wanted to check which was wrong, the docs or the implementation.

How do you feel about renaming O.DIR to O.INC to indicate that it can have values other that -1 and 1?

I'll update the changelog if I make the change.

tehn commented 8 years ago

INC makes more sense, agreed.

i think post-increment is also more understandable.

On Tue, Apr 12, 2016 at 10:14 AM, Sam Doshi notifications@github.com wrote:

It is, I just wanted to check which was wrong, the docs or the implementation.

How do you feel about renaming O.DIR to O.INC to indicate that it can have values other that -1 and 1?

I'll update the changelog if I make the change.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/monome/teletype/issues/37#issuecomment-208926317

samdoshi commented 8 years ago

Also spotted that FLIP was using V_O:

static void v_FLIP() {
    if (left || top == 0) {
        push(tele_vars[V_O].v);
        tele_vars[V_O].v = (tele_vars[V_O].v == 0);
    }
    else {
        tele_vars[V_O].v = (pop() != 0);
    }
}
tehn commented 8 years ago

good catch!

On Tue, Apr 12, 2016 at 10:27 AM, Sam Doshi notifications@github.com wrote:

Also spotted that FLIP was using V_O:

static void v_FLIP() { if (left || top == 0) { push(tele_vars[V_O].v); tele_vars[V_O].v = (tele_vars[V_O].v == 0); } else { tele_vars[V_O].v = (pop() != 0); } }

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/monome/teletype/issues/37#issuecomment-208933778

samdoshi commented 8 years ago

FLIP fixed https://github.com/samdoshi/teletype/commit/048559fa91ec6a3f4f80cdad239373586880bc4e

samdoshi commented 8 years ago

O fixed https://github.com/samdoshi/teletype/commit/06b79a3923376af12dcd176b8d9d34961eba9fef

samdoshi commented 8 years ago

O.DIR renamed to O.INC https://github.com/samdoshi/teletype/commit/a757a0c7b497fab5a0e8e47675d4fbd2615e0557

That's everything on this ticket, so I'm closing it

samdoshi commented 8 years ago

Have also updated DRUNK to follow the same semantics (as per the docs)

DRUNK changes by -1, 0, or 1 upon each read, saving its state. Setting DRUNK will give it a new value for the next read, and drunkedness will continue on from there with subsequent reads.

https://github.com/samdoshi/teletype/commit/f720fced47edc762f5b656e49ddf08d8d1835ded