Remarks: One-Liners
From Maze
(Difference between revisions)
| Line 1: | Line 1: | ||
| − | One-liners such as 10Print are curt, minimal BASIC programs written to illustrate, imitate, or express an idea. Due to their brevity, they must often exploit resources which exist in the underlying platform. For example, 10Print relies on graphical images called PETSCII contained in the ROMs of the Commodore computers. The single line of code itself contains no data pertaining to the curvature or pixels comprising the / and \ images, it merely uses the numbers 205.5 and .5 to refer to characters number 205 and 206. Therefore 10Print relies on the existence block graphics sets. | + | One-liners such as 10Print are curt, minimal BASIC programs written to illustrate, represent, and express ideas. Due to their brevity, they must often exploit resources which exist in the underlying platform. For example, 10Print relies on graphical images called PETSCII contained in the ROMs of the Commodore computers. The single line of code itself contains no data pertaining to the curves or pixels comprising the / and \ images. 10Print merely uses the numbers 205.5 and .5 to refer to characters number 205 and 206. Those two numbers are indexes into the "block graphics set" which the 8-bit home computers used to draw simple graphics. This feature, common to the Commodore video display hardware and many other platforms, but not the original Dartmouth BASIC system, kept the program very short. |
| + | |||
| + | *Icicle Storm | ||
| − | Block graphics sets - including the non-typographic / and \ symbols used in 10Print - have collectively produced a vocabulary capable of representing emotions, stick-figures, balance sheets, graphical window systems. In one-liners, sometimes symbols are interpreted as the subject of the story. For example, in this variation on 10Print, one of the slanted symbols represents an icicle. | + | Block graphics sets - such as the non-typographic / and \ symbols used in 10Print - have collectively allowed a non-alphabetic visual vocabulary to flourish, one capable of representing emotions, stick-figures, space travel, balance sheets, graphical window systems. |
| + | |||
| + | In one-liners, sometimes symbols are interpreted as the subject of the story. For example, in this variation on 10Print, one of the slanted symbols is reinvoked, this time to represent an icicle, an illusion which takes some imagination and relies on the default color scheme of the BASIC environment (light blue ice crystals against a dark, foreboding azure, dusk sky) and a synthetic interpretation of movement: | ||
| + | |||
| + | 10 poke 1024+rnd(1)*1000,78: goto 10 | ||
| + | |||
| + | Icicle Storm relies on the RND command as well as "screen memory," the grid-shaped arrangement of memory locations which corresponds to the PETSCII graphics as they appear on a monitor. | ||
| + | |||
| + | Part of the impression of movement and space-filling are features inherent to the medium. Specifically, the slow, ruthless instantiation of symbolic icicles mimics the dynamics of a mounting storm because the computer can not draw them fast enough to fill the screen instantly. For narrative purposes, it would be possible to <em>slow down</em> the drawing, but not (without resorting to extra-BASIC code execution or upgraded hardware) to speed it up. In a similar way to Icicle Storm's window gradually filling with frozen snow, 10Print presents a cinematic representation of an experience. The pace of that experience islinked to the slow and steady synthesis of their ultimate images. | ||
| + | |||
| + | This one-line simulation may represent the accumulating energy of a storm, but it will never, like a real storm, die out and warm up. After completely filling the screen, the action ceases, so the one-liner can only tell one part of a story. | ||
| + | |||
| + | In a slight variation of the program, Alphabet On Screen: | ||
| + | |||
| + | 10 poke 1024 + rnd(1)*1000,1+rnd(1)*26: goto 10 | ||
| − | *Icicle Storm | + | *Windy Day in Chicago |
| − | 10 poke 1024+rnd(0)*1000,78: goto 10 | ||
| − | In addition to relying upon the existence of the graphics in operating system, this one-liner also relies on the default colors of the BASIC environemnt to be light blue on dark blue: | + | In addition to using external graphics to maintain brevity, BASIC one-liners tend to rely on the random number generator command RND. In Icicle Storm, the unpredictable nature of the random number generator emulates the natural physical process of precipitation. |
| − | The impression of movement and space-filling are inherent features of the platform. Specifically, the slow, ruthless instantiation of symbolic icicles mimics the dynamics of a mounting storm because the computer can not draw them fast enough to fill the screen instantly. The unpredictable nature of the random number generator sufficiently represents the natural movement of precipitation that with a slightly hint in the title, the image is ready to be interpreted. Although the one-line simulation represents the accumulating energy of a storm well, it will never, like a real storm, die out and warm up. After completely filling the screen, the action ceases, so the one-liner can only tell one part of a story. | + | This random nature can be combined with another hardware feature of the Commodore 64, the VIC-2 chip. Together they create the following example which exploits the side-scrolling video chip inside the Commodore 64: |
| − | |||
| − | The following example, exploits the side-scrolling video chip inside the Commodore 64 | ||
| − | |||
| − | *Windy Day in Chicago | ||
10 poke 53248+22,int(192+4+3*sin((time*3.456+rnd(1)*.5))): goto 10 | 10 poke 53248+22,int(192+4+3*sin((time*3.456+rnd(1)*.5))): goto 10 | ||
| − | Commodore 64 users have experienced so many different system crashes that they can be aesthetically categorized. For example, the following one-liner: | + | *Random SID Tones |
| − | *Snowcrash - do not use on real Commodore 64 | + | As noted elsewhere, the BASIC included with the Commodore 64 included no specific commands such as PLOT and SOUND for controlling the video and sound hardware. As a result, simple sound programs, such as an audio equivalent of 10Print, which plays a juxtaposition of alternating tones balanced evenly between two opposing piano notes is much longer than one line. This is partially because, as seen in line 20, the program must supply or perform its own calculations to create, the additional data pertaining to the desired note. It is not possible, as in the case of 10Print, and other one-liners like Icicle Storm, to supply an index into a reserve of information. |
| − | 10 poke 53248+24,timeand255: goto 10 | ||
| − | Also, this one-liner imitates a particular set of crashes, those involving complex writes to the video hardware, which took place often. | + | 10 poke 54296,15:poke 54277,190:poke 54278,248 |
| − | *Crashes I Have Known and Loved. | + | |
| − | 10 poke 53248+17,(time/10)and255: goto 10 | + | 20 a(0)=17:a(1)=37:a(2)=21:a(3)=76 |
| + | |||
| + | 30 q=int(.3+rnd(1)*1):print q;:poke 54273,a(q*2):poke54272,a(q*2+1) | ||
| + | |||
| + | 40 poke 54276,17:for t=1to75:next:poke 54276,16:for t=1to150:next | ||
| + | |||
| + | 50 goto 20 | ||
| − | These one-liners make good use of the print and poke commands. We know that PRINT was inherited from the earliest Dartmouth BASIC implementation. Did Bill Gates invent the POKE command? | ||
| − | *Random SID Tones | + | Another way to go about probing the capabilities of complex chips like the Commodore 64's VIC-II and SID registers is to simply write random values to them. IN THE CASE OF THE VIDEO CHIP THIS MAY BE UNSAFE. According to the Programmer's Reference Manual certain values must not be altered, but you may safely try it in an emulator. |
| − | 10 poke 54272 + rnd(1)*25,rnd(1)*256:goto 10 | ||
| − | *Alphabet on screen | + | Randomize VIC-II (video chip) |
| − | 10 poke 1024 + rnd(1)*1000,64+rnd(1)*26: goto 10 | + | 10 poke 53248+rnd(0)*46,rnd(0)*256: goto 10 |
| − | *Crazy VIC-II | + | Random SID (sound chip) |
| − | 10 poke 53248+rnd(0)*46,rnd(0)*256: goto 10 | + | 10 poke 54272 + (0*ti+(rnd(1)*25)),(rnd(1)*256)and255:goto 10 |
| − | |||
| − | *Nutty VIC-II | ||
| − | 10 poke 53248+24,rnd(0)*256: goto 10 | ||
| − | |||
| − | *Everything Random | ||
| − | 10 poke 1024+rnd(0)*1000,78 | ||
| − | |||
| − | 20 poke 53248+24,timeand255 | ||
| − | |||
| − | 30 poke 53248+17,(time/10)and255 | ||
| − | |||
| − | 40 poke 53248+22,(time/9)and255 | ||
| − | |||
| − | 50 poke 54272 + rnd(0)*25,rnd(0)*256 | ||
| − | |||
| − | 60 poke 1024 + rnd(0)*1000,rnd(0)*256 | ||
| − | |||
| − | 70 goto 10 | ||
