hyc@math.lsa.umich.edu (Howard Chu) (01/17/90)
In article <16669@cc.usu.edu> SLSW2@cc.usu.edu (Roger Ivie) writes: >I used to have fun poking a Commodore PET basic program so that the >only lines that LISTed were ones that were not the target of a GOTO. >These had to be contained in the linked list because the interpreter had >to be able to search for them; but sequentially executed statements could >be left out of the list because it just kept going and didn't search for >the next line. > >Unfortunately, I soon discovered that you couldn't SAVE a program this way. >When you LOADed it back, the links were restored. :( I did this with Data General DG BASIC on an Eclipse running AOS 4.xx. Funstuff. The trick then was that it used 16 bits to represent the line number, but only let you enter numbers up to 9999. I sat up one night figuring out the tokenization method, and wrote a program that would read a saved BASIC file, alter all the line numbers, (GOTOs and GOSUBs as well, of course) and voom - the lines vanished. Unfortunately, a simple RENUMBER command would correct the situation. But, there was a way around that as well - made one of the first of the illegally numbered lines a GOTO xxxx where xxxx didn't exist. Then renumber would just choke and give up. I guess I'd just heard of synthetic programming on the HP-41 back then, so I played with everything available, in great detail. The same trick in Applesoft would give you lines that could be listed but couldn't be deleted. Great for copyright notices. I was pretty fond of the DG BASIC trick, tho. Wrote an entire Adventure game, using overlays & all kinds of tricks to fit into 32K core. The listing only had 10 lines of REMs, the code was nowhere to be seen. I was well pleased with myself. }-) One of the other neat tricks was to set the length of a line to be zero, then the interpreter's program counter never advanced, and you'd get an infinite loop. You could set the high bit too, getting negative offsets. Really wonderfully fast GOTOs, but you had to count bytes pretty carefully, and it made your listings pretty Strange and Wonderful. (Keep a hand on the Escape key...) -- -=- PrayerMail: Send 100Mbits to holyghost@father.son[127.0.0.1] and You Too can have a Personal Electronic Relationship with God!