Live data from Hacker News

10 REM"_(C2SLFF4

beej.us

11–20 of 52 posts

Re: 10 REM"_(C2SLFF4

#12

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!

And in assembler and machine code before that!

I'm persuaded that just about every language is "homoiconic" and that _bicameral syntax_ is the actually-interesting thing about Lisps : https://parentheticallyspeaking.org/articles/bicameral-not-h...

Re: 10 REM"_(C2SLFF4

#13
post #7

This is exactly how we used to do machine code on the Sinclair ZX81, too, where there was no way to declare a block of memory as "off limits" to BASIC, and no DATA statements like in the later (and much bigger) ZX Spectrum BASIC. Then you'd do "RANDOMISE USR 16514" to start it. Actually USR was interesting because it would pass back the contents of BC when your machine code routine returned to BASIC.

I managed to get that easter egg into libvirt - it listens on ports 16509 and 16514 ( https://libvirt.org/remote.html ).

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

Re: 10 REM"_(C2SLFF4

#15

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.

Because I started in that era, I sometimes think that’s why I was motivated to learn synthetic programming for the HP 41, write the first disassembler for the HP 48SX’s ROM, why I wrote jailbreak software on the iPhone before the App Store existed. Tiny limited environments most resemble where I first coded.

Re: 10 REM"_(C2SLFF4

#16
Hmm, based on the (handwritten!) notes on Table F-2 in http://bitsavers.informatik.uni-stuttgart.de/pdf/exidy/DP500..., it looks like pressing Graphic+key would allow you to enter BASIC tokens from 0x80 to 0xBF, while pressing Graphic+Shift+key would allow you to access 0xC0 to 0xC6. By inference, it seems like Graphic+Shift+key should allow access to the entire 0xC0 to 0xFF space, but most of those keys are undocumented.

Based on this, I wonder if it's worth trying the following:

    10 REM [Graphic+Shift+=] [_] [(] [Graphic+Shift+NumpadPlus] [2] [Graphic+Shift+NumpadEquals] [Graphic+Shift+Numpad6] [Graphic+Shift+0]
Note that you'll probably need an emulator with accurate keyboard emulation - or a real device - in order to type these in. However, with the emulator from http://www.liaquay.co.uk/sorcerer, I was able to confirm that Graphic+Shift+0 produced 201 (rendered as F4), and Graphic+Shift+= produced 255 (rendered as S), so I think this approach will work.

Re: 10 REM"_(C2SLFF4

#17

Hmm, based on the (handwritten!) notes on Table F-2 in http://bitsavers.informatik.uni-stuttgart.de/pdf/exidy/DP500... , it looks like pressing Graphic+key would allow you to enter BASIC tokens from 0x80 to 0xBF, while pressing Graphic+Shift+key would allow you to access 0xC0 to 0xC6. By inference, it seems like Graphic+Shift+key should allow access to the entire 0xC0 to 0xFF space, but most of those keys are undocum…

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'
  148 0x94 b'WAIT'
  149 0x95 b'DEF'
  150 0x96 b'POKE'
  151 0x97 b'PRINT'
  152 0x98 b'CONT'
  153 0x99 b'LIST'
  154 0x9a b'CLEAR'
  155 0x9b b'CLOAD'
  156 0x9c b'CSAVE'
  157 0x9d b'NEW'
  158 0x9e b'TAB('
  159 0x9f b'TO'
  160 0xa0 b'FN'
  161 0xa1 b'SPC('
  162 0xa2 b'THEN'
  163 0xa3 b'NOT'
  164 0xa4 b'STEP'
  165 0xa5 b'+'
  166 0xa6 b'-'
  167 0xa7 b'*'
  168 0xa8 b'/'
  169 0xa9 b'^'
  170 0xaa b'AND'
  171 0xab b'OR'
  172 0xac b'>'
  173 0xad b'='
  174 0xae b'
This is based on a simple decoding of the token table starting at 0xf6 in the BASIC ROM; it matches the observed output for 201, 247, 252, and 255 so I expect that it is generally correct. Indeed, with `10 REMX; POKE 474, 249; LIST` in the emulator, I get `10 REMLNFSNRGODFCOVOMULBSDD/0IDTMOSLSSTCNUFMO` printed out, which further confirms this decoding.

Re: 10 REM"_(C2SLFF4

#18

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!

“code is data and data is code” is a fact of computing. What LISP does is to make it an official feature of the language and provide nice abstraction for it. A lot of languages want you to use some cumbersome reflection library, a dangerous eval function, or a crippled macro mechanism. With LISP, you just use the language mechanism in order to write code that process code.

Re: 10 REM"_(C2SLFF4

#19
back when the Apple II / Applesoft BASIC twitter bot was a thing similar techniques were the best way to inject assembly language into a BASIC program, though we quickly learned there were more compact ways than REM to get a line ignored.

Some examples here, as sadly the apple2twitter bot shut down and deleted their account a while ago.

http://deater.net/weave/vmwprod/appleiibot/part7.html

Re: 10 REM"_(C2SLFF4

#20

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!

BASIC is older than most people realize, but it's still half a decade younger than Lisp.
Post reply on HN