Get the latest tech news
Go, PET, Let Hen - Curious adventures in (Commodore) BASIC tokenizing
Curious adventures in (Commodore) BASIC tokenizing.
This has consequences for runtime performance, since, for any jumps, like with GOTO and GOSUB, the interpreter has to pick up at the very beginning of this list to search forward for an entry with a matching line number. This should be worth a brief contemplation: in a byte-size subtraction, it doesn’t matter, which of the two operands has the sign-bit set and which one not:(0x80+ x)- x ≡ x-(0x80+ x) ≡ 0x80.Since there is no carry involved to propagate the sign, this is essentially an XOR operation. As far as the keyword search code is concerned, any such premature matching of the terminating difference of 0x80 is just a side effect of the subtraction working either way, regardless of which of the two compared bytes has the sign-bit set.
Or read this on Hacker News