Live data from Hacker News

10 REM"_(C2SLFF4

beej.us

41–50 of 52 posts

Re: 10 REM"_(C2SLFF4

#41
post #34

Earlier quoted context omitted.

At the base of it, the TM is an abstraction built with sets and relations. Just like most computers are merely signals flowing around a circuit that get generated from other physical phenomena and will be transformed to other physical phenomenas. You can't hack around physical laws, or ignore the axiomatical rules in mathematics. The code that is not data are those things. Everything else is data.

You are redefining both the term "code" and the term "data" in ways that I don't think most people would agree with - and more importantly, in ways that make it impossible to talk about von Neumann architecture.

Because code and data as well as the von Neumann architecture are derived things, not fundamental stuff. The Turing Machine and Lambda Calculus are pure invention thats are logically sound. Almost everything else is downstream of that.

By the time you get to programming language like C and LISP, and software like vim or firefox, everything is abstracted away and the only limits are self-imposed (or imposed by others that have done the work). They are not laws of nature.

So yes there’s a definition of code and data. But for the Turing machine, there’s only the tape and its content.

Re: 10 REM"_(C2SLFF4

#42
post #34

Earlier quoted context omitted.

You are redefining both the term "code" and the term "data" in ways that I don't think most people would agree with - and more importantly, in ways that make it impossible to talk about von Neumann architecture.

Because code and data as well as the von Neumann architecture are derived things, not fundamental stuff. The Turing Machine and Lambda Calculus are pure invention thats are logically sound. Almost everything else is downstream of that. By the time you get to programming language like C and LISP, and software like vim or firefox, everything is abstracted away and the only limits are self-imposed (or imposed by others…

The pure logical concept of a Turing machine is a tuple of states, symbols and a transition function. These all very much do exist, and they're very much not written on the tape. So no, there isn't "only the tape and its content".

I do not agree data is a derived term in computation theory. Code, maybe I can be convinced. But absolutely not data.

Re: 10 REM"_(C2SLFF4

#43

It always feels a bit like lost magic. But at the same time, it's also something that was only enabled by the very high determinism of these old home systems. The design relies on having fixed RAM locations, no multiprocessing, etc. Incredible to find out that typing the paper program would not have worked, though. And in such a disappointing way no less.

It always feels a bit like lost magic. I sometimes wonder if there is still a lot of that magic in the tech world, but were so used to having everything abstracted away from us in multiple layers that we've lost the ability to look for it. I think about the TLA hackers who do seemingly impossible things. Surely they must operate on this level.

I work in "lowest level" kernel development, and we're certainly operating at that layer. As for those kind of hacky solutions, we do try to avoid them, because they are, well, hacky, and therefore often hard to understand, easy to break, etc... but it does happen. Especially in prototyping, were usually anything goes to make something work initially.

Re: 10 REM"_(C2SLFF4

#44

See this is why I never understood LISP people proudly proclaiming that “code is data and data is code”… we were doing this in BASIC for decades already!

Lisp predates BASIC. And ITS too.

Re: 10 REM"_(C2SLFF4

#45

> Would this work on other platforms, I wonder? Or would they just freak out? Someone else can give it a try on the Commodore 64 or something. I don't remember seeing this on Commodore 64 too much. Most type-in hybrid BASIC-machine language programs would have numerous DATA statements with opcodes and a loop to READ and POKE them (typically in the tape buffer area somewhere in the fist 2K of RAM or in the 4K area at…

The technique of putting machine code behind a REM was common in the Microbee (another Z80 machine). Often used for sound effects in games as the standard PLAY basic statement only did tones.

Re: 10 REM"_(C2SLFF4

#46
post #31

Earlier quoted context omitted.

Bonus: Here's what all of the tokens >= 0x80 render as, including the corrupt ones: 128 0x80 b'END' 129 0x81 b'FOR' 130 0x82 b'NEXT' 131 0x83 b'DATA' 132 0x84 b'BYE' 133 0x85 b'INPUT' 134 0x86 b'DIM' 135 0x87 b'READ' 136 0x88 b'LET' 137 0x89 b'GOTO' 138 0x8a b'RUN' 139 0x8b b'IF' 140 0x8c b'RESTORE' 141 0x8d b'GOSUB' 142 0x8e b'RETURN' 143 0x8f b'REM' 144 0x90 b'STOP' 145 0x91 b'OUT' 146 0x92 b'ON' 147 0x93 b'NULL' 1…

Excellent!! Mind if I add all this into to the post with credit?

Yes, I'd be happy if you did so! I tried adding a reply but since I don't yet have a Mastodon account (hopefully soon to be resolved), I resorted to just posting here instead.

Here's the decode script I used to produce the table above:

  rom = open('exsb1.dat', 'rb').read()
  ptr =  0xf6
  for i in range(128, 256):
      out = bytearray([rom[ptr] - 0x80])
      while rom[ptr+1] 
The format of the tokens packed into the BASIC ROM is quite simple: the first byte in each token is ORed with 0x80 and the tokens are concatenated without any other separators. Tokens end when the next byte has 0x80 set (indicating the start of the next token).

Re: 10 REM"_(C2SLFF4

#47
post #21

See this is why I never understood LISP people proudly proclaiming that “code is data and data is code”… we were doing this in BASIC for decades already!

The thing is in Lisp, data with a nice structure that you can easily work with is evaluatable as code; and all the code that runs has a nice structure and is easy to work with! You cannot easily manipulate and transform BASIC programs from within BASIC, and you cannot easily do anything in machine code. But maybe this is part of what Gerald Sussman was talking about when he called Lisp a "low level language": like ma…

Lisp shares with Forth a great feature, you only need to implement a few building blocks in Assembly, and then everything else can be built from them.

Too many get lost in the concept that using something like C is the only way to build languages.

Re: 10 REM"_(C2SLFF4

#48
post #35

That's why some computer mags started introducing tools to type in programs without ambiguities. Here's a recent example I made: an Amstrad CPC program that's both valid BASIC and machine code at the same time, and running it both ways (RUN or CALL &170 -- loading address of the BASIC program) produce the same output: https://github.com/ssg/yello

> That's why some computer mags started introducing tools to type in programs without ambiguities.

Yes, typing long magazine listings was already laborious but then you had the extra challenge of figuring out why it wouldn't run due to a typo (or, worse, a misprint). When magazines started adding checksums and a couple lines of BASIC to calculate them, it was happy day!

Re: 10 REM"_(C2SLFF4

#49
post #22

Earlier quoted context omitted.

Sorry, I’m lost after looking at that page. Can you explain your comment?

Libvirt listens on ports 16509 and 16514 out of the box, in reference to ZX81 BASIC where the program starts at (address) 16509 and the first byte in a REM statement (commonly used to store machine code) is 16514.

LOL! Sorry I didn’t get the reference until now. Haha nice :)
Post reply on HN