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.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of pet

pet

Photo of Commodore

Commodore

Photo of hen

hen

Related news:

News photo

Commodore acquired for a 'low seven figure' price – CEO from retro community

News photo

Group of investors represented by YouTuber Perifractic buys Commodore

News photo

Petlibro’s new smart camera uses AI to describe your pet’s movements, and it’s adorable