Hacker News new | ask | show | jobs
by rahimnathwani 908 days ago
IIRC BBC BASIC let you choose the renumber increment, but the ZX Spectrum didn't.
1 comments

For approved choices :)

> AUTO10,1000

Silly

> _

Wow I just tried this out on an Electron emulator. It seems like the second parameter for RENUMBER is limited to a byte (255).

The first parameter is weird, though: if you put in a number that's too large, the system reports a syntax error. 10000,255 works, but 50000,255 doesn't.

Isn't it because the line number is 16-bit unsigned int?
Great clue. Thanks!

RENUMBER takes maximum parameters of 32767 and 255.

But line numbers wrap! So if you do RENUMBER 32767,1 then your line numbers will go:

  32767
  0
  1
  2
  ...
This is even more interesting, 32767 is the max signed 16-bit int. And it wouldn't wrap to 0 after that for sure.

Btw does it allow 0? Amstrad's BASIC does not (oficially).

I no longer have an Acorn Electron, but using ElkJS (https://elkjs.azurewebsites.net/) I did:

  >0 REM
  >10 REM
  >RENUMBER 32767,1
  >LIST
  32767 REM
  0 REM
  >0 REM
  >LIST
      0 REM
  32767 REM
      0 REM