Remarks: One-Liners
From Maze
(Difference between revisions)
| Line 1: | Line 1: | ||
| − | One-liners such as 10 PRINT 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, 10 PRINT 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. | + | One-liners such as 10 PRINT are curt, minimal BASIC programs written to illustrate, represent, and express ideas. This remarks examine three one-liners which make use of the RND function in BASIC on the Commodore 64. |
| + | |||
| + | Due to their brevity, one-liners must often exploit resources which exist in the underlying platform. For example, 10 PRINT 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 | *Icicle Storm | ||
| Line 5: | Line 7: | ||
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. | 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 10 PRINT, 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: | + | In one-liners, sometimes symbols represent subject in a story. For example, in the variation on 10 PRINT below, one of the slanted symbols is reinvoked to represent an icicle. |
10 poke 1024+rnd(1)*1000,78: goto 10 | 10 poke 1024+rnd(1)*1000,78: goto 10 | ||
| + | This illusion takes some imagination and relies on the default color scheme of the BASIC environment: light blue ice crystals against a dark, foreboding azure, sky at late dusk. | ||
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. | 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. | + | Part of the impression of movement and space-filling are features inherent to the medium of BASIC on the Commodore 64. Specifically, the slow, ruthless instantiation of 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 to speed it up (without resorting to extra-BASIC code execution or upgraded hardware). In a similar way to Icicle Storm's window gradually filling with frozen snow, 10 PRINT presents a cinematic representation of an experience. The pace of that experience is linked to the slow and steady synthesis of their final output images. |
| + | |||
| + | This, too, depends upon the physical interpretation of the program's output, what the PRINT command actually does in real-life. On older systems, it | ||
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. | 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 | ||
| Line 31: | Line 32: | ||
*Random SID Tones | *Random SID Tones | ||
| − | 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 10 PRINT, 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 10 PRINT, and other one-liners like Icicle Storm, to supply an index into a reserve of information. | + | 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 are generally longer than one line. For example, the program below is an audio equivalent of 10 PRINT which plays a juxtaposition of alternating tones balanced evenly between two opposing piano notes. |
| − | 10 poke 54296,15:poke 54277,190:poke 54278,248 | + | 5 s=54272 |
| + | |||
| + | 10 poke s+24,15:poke s+5,190:poke s+6,248 | ||
20 a(0)=17:a(1)=37:a(2)=21:a(3)=76 | 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) | + | 30 q=int(.5+rnd(1)*1):poke s+1,a(q*2):pokes,a(q*2+1) |
| − | 40 poke 54276,17:for t=1to75:next:poke 54276,16:for t=1to150:next | + | 40 poke s+4,17:fort=1to75:next:poke s+4,16:fort=1to150:next |
| − | 50 goto 20 | + | 50 goto 30 |
| + | |||
| + | This program can not be squished into one line for for many reasons. For example, as seen in line 20, the program must supply or perform its own calculations to create the descriptive data pertaining to the desired note. It is not possible, as in the case of 10 PRINT, and other one-liners like Icicle Storm, to supply an index into a reserve of information. | ||
