|
Post by Jeff Ledger on Jun 5, 2006 11:40:33 GMT -5
Jim Butterfield gave a great speech on "how not to program" and "the things everyone already knew." I didn't have a pen handy to record notes from this speech, but a few of the highlights I found were cool included how to insert indentions into my BASIC code for easier readability.
How to insert spaces....
10[SHIFT-SPACE] REM
Another thing he demonstrated was the ability to use reserved keywords as variables. Strange, but it works.
10 IF TH[C=-GRAPHIC]EN = 0 THEN PRINT "WORKED"
It looks strange when you list it, but oddly enough it works.
Kudos to the VICE team, these are also supported in emulation.
Anyone got some BASIC weirdness up their sleeves?
Jeff
|
|
|
Post by Jim Lawless on Jun 5, 2006 21:29:31 GMT -5
Enter this program exactly as shown 10 PRINT 10 20 PRINT 20 30 PRINT 30
Then type the following in from the READY prompt POKE 2051,40 POKE 2060,30 POKE 2069,20
LIST
Look funky?
Now, run it.
Jim Lawless
|
|
|
Post by Pinacolada on Jun 6, 2006 21:49:37 GMT -5
Seems like there were programming challenges in magazines on how to make self-listing programs, without including a line that had LIST in it. Not that I know how.
|
|
|
Post by Golan Klinger on Jun 6, 2006 23:20:40 GMT -5
Seems like there were programming challenges in magazines on how to make self-listing programs, without including a line that had LIST in it. Not that I know how. What you're talking about is called a "quine" (see www.madore.org/~david/computers/quine.html for more information) and they represent a rather interesting programming challenge. Try this: 100 DATA "B$='DATA '+CHR$(34) 110 DATA "FOR J= 100 TO 260 STEP 10 120 DATA "READ A$ 130 DATA "PRINT J;B$;A$ 140 DATA "IF J<> 180 THEN 260 150 DATA "RESTORE 160 DATA "B$=' ' 170 DATA "NEXT J 180 DATA "END 190 B$='DATA '+CHR$(34) 200 FOR J= 100 TO 260 STEP 10 210 READ A$ 220 PRINT J;B$;A$ 230 IF J<> 180 THEN 260 240 RESTORE 250 B$=' ' 260 NEXT J Pointless but cool, eh?
|
|
|
Post by Jim Lawless on Jun 7, 2006 20:03:04 GMT -5
You mean like this? 10 DEF FN DEEK(X)=PEEK(X)+256*PEEK(X+1) 20 A=2049 30 IFFNDEEK(A)=0 THEN END 40 A=A+2 50 PRINT FNDEEK(A);:A=A+2 60 T=PEEK(A) 70 IF T=0 THEN PRINT:A=A+1:GOTO 30 80 IF T>127 THEN GOSUB 1000:A=A+1:GOTO 60 90 PRINT CHR$(T);:A=A+1:GOTO 60 100 END 1000 P=41118 1010 C=128 1020 IF T=C THEN 1060 1030 IF PEEK(P)<128 THEN P=P+1:GOTO 1030 1040 C=C+1:P=P+1:GOTO 1020 1050 PRINT CHR$(PEEK(P)); =P+1 1060 IFPEEK(P)<128 THEN 1050 1070 PRINT CHR$(PEEK(P)-128); 1080 RETURN The above program won't handle graphical characters. ( I don't look for quote mode. ) Other than that, you should be able to add whatever code to the tail end or some other innocuous spot and it should show up in the listing. The above technique is sloooooooooooooow.... so, be patient. Jim Lawless
|
|
|
Post by xlar54 on Jun 8, 2006 1:10:08 GMT -5
ooooooooooooooooooooooooooooooooow. I actually started to read that website about quines. owwwwwwwwwwwwwwwwwwwwwwwww. please dont do that anymore.
|
|
|
Post by Robin Harbron on Jun 8, 2006 9:14:47 GMT -5
The Shift-Space trick for indentations is cool, I remember that one from RUN or Transactor way back when. The indents disappear when you edit the line, however, so another method is to put colons before the line to pad it out. It's uglier, but also less hackish, and very editable.
|
|