Graphics fun with the Epson HX-20. Allen Munro.
The Epson HX-20 notebook computer offers many impressive features, including 10X32 dot graphics. During my first few days with the HX-20, I decided to write a sheet program to produce a constantly changing graphics display on the liquid crystal display (LCD). During occasional dull moments during the annual meeting of the Linguistic Society of America, I unobstrusively entered, debugged, and modified the program while seated in a back row of one of the meeting rooms. It was an exhilarating experience to touch-type in silence on a full-size, full stroke, QWERTY keyboard without relying on a bulky monitor or access to an electrical outlet.
Figures 1 and 2 are sample screen displays from the output. These figures don't convey the charm of the program, which constantly changes the graphics display in a manner that suggests the movement of two twirling rods in three dimensions. These figures were printed using the integral Epson dot matrix printer, which considerably compresses the LCD graphics. No programming was required to produce the printed screen dumps. The user need only type CTRL PF2 to copy screen displays from the output.
Many users enjoy waiting for the screen to produce an interesting graphic, printing it, allowing the display to change to another interesting graphic, printing that, and so on. The printed tape produced is an extended graphic that takes on qualities different from the sum of its parts. Some printouts, such as that shown in Figure 3, are reminiscent of the ink-blots used in Rorschach projective tests.
The program appears in Listing 1. Lines 130 and 140 provide a randomization seed, using the day of the week and the "seconds" value of the real time clock at the time the program is run.
MAXLNS is the number of lines that the program displays at one time. When it is time to generate the MAXLNS+ 1th line, the first one is erased first. The arrays LOLIM and HILIM are the minimum and maximum coordinate values that the ends of the plotted lines can take on.
The two-dimensional array ALN is an array of the coordinate values of the end points of all the lines that can be displayed at one time. The values of the coordinates of the first line are randomly selected in lines 210-240.
The main body of the program is given in lines 300 to 550. This portion repeates indefinitely, that is, until the user interrupts it with the BREAK key. The oldest line on the screen is erased, and a new line is generated. (In fact, the line has a bilaterally symmetric counterpart which is also erased, and a corresponding new line is drawn. In this discussion, these mirror-image lines are not referred to further. The instructions for their erasure and production follow immediately after the line drawing commands for the first line of the pair.) To draw a new line, its starting and ending coordinates must first be determined. This is done by adding a STEPSZ (stepsize) to each of the four values that specify the endpoints of the previous line. A given set of STEPSZ values is used for only NUMSZ times (5-20), and then a new set of STEPSZ increments for the coordinates is chosen. The subroutine in lines 570-620 is responsible for setting the four STEPSZ values and the next NUMSZ.
To appreciate how the program works in detail, type it into your HX-20 and enjoy it, then try TRACE mode to follow program flow during execution. Enjoy the graphics capabilities of the most impressive portable computer yet.