-1- AN IMAGE PROCESSING SYSTEM FOR ANALYZING FLUID SHEAR STRESSED ENDOTHELIUM by William Ivan Ogilvie 1- SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS OF THE DEGREE OF BACHELOR OF SCIENCE AT THE MASSACHUSETTS INSTITUTE OF TECHNOLOGY MAY 1981 William Ivan Ogilvie 1981 @ The author grants to M.I.T. permission to reproduce and to distribute copies of this thesis in whole or in part. Signature of Author., -. .... - ....... ...... . Department of Electri al Engineering Certified..................... ................. /1C. Forbes D qey/ Jr. Thesis Supe vi6 r Accepted by ....... , ... . ... .. .; .... ................... Irch RF Professor David Adler, Chairman, MASSACHUSETTS INSTITUTE Departmental Committee on Theses OF TECHNOLOGY AUG 25 1981 UBRAUIES , -2- AN IMAGE PROCESSING SYSTEM FOR ANALYZING FLUID SHEAR STRESSED ENDOTHELIUM by WILLIAM IVAN OGILVIE Submitted to the Department of Electrical Engineering and Computer Science on May 22, 1981 in partial fulfillment of the requirements for the degree of Bachelor of Science. ABSTRACT Vascular endothelium, when it is subjected to fluid shear stress, adopts an elongated shape in the direction of fluid flow. The morpho- logical response of vascular endothelium, to shear stress, is being studied to better understand the role that shear stress has in arterial diseases. This thesis describes a computer system for analysing these effects. A high resolution camera is used to store an image of endothelium into computer memory, where it can be analyzed directly. Thesis Supervisor: Title: C. Forbes Dewey, Jr. Professor -3- ACKNOWLEDGEMENTS To all the people who have helped me with this project, I express my gratitude. To my advisor, Professor C. Forbes Dewey, I am most indebted. His enthusiasm and confidence in my capabilities could not have been more motivating. My appreciation also goes to Steve Bussolari, Ken Kalamuck, and Judy Steciak, for their friendly encouragement. To Professor Berthold K.P. Horne, and other faculty members of the Department of Electrical Engineering and Computer Science, I offer my humble thanks for the knowledge they have imparted to me. And to my parents and family, whose patience, support, and guidance have helped me grow with each step, I am most grateful. -4- TABLE OF CONTENTS Abstract ............. ........................... 0 Acknowledgements .............. OO•OOO• OOO0000 List of Figures ............... •OOOO0• .. . .. Introduction.................. . . .0 Data Acquisition From Images.. 9 . . 13 O0••O00 .. 0 . . Hardware Components of The Sys tem The Camera and its Interface.. 17 21 oooooo••ooo OOOO0 ooooooooooo ........... Software Design Issues......... •o OO0•O .. Image Storage Considerations.. •O•O0 .. 0 .. a 0 0 oooooo . . . . . . . . . . 0 28 30 ooooooooooo ........... Edge Detection................ 0 36 oooooeoooo• a........... Miscellaneous Routines......... 0 51 ooooooooooo .. Conclusion .................... 27 o ooo••oooooo •OOO0 .. Pixel Addressing.............. 5 6 •gO•O•• .. 3 0 . . . . 54 ooooooooooo a. 0 . . . . Bibliography.................. 58 Appendix A - The Program........................... 59 -5- LIST OF FIGURES 1. Vascular Endothelium 7 2. Line Drawing of Shear Stress Apparatus 9 3. Effect of Shear Stress on Endothelium 10 4. Apple II Graphics Screen Tables 18 5. Pixel Addressing 31 6. Graphics Line and Ray Pattern 40 7. Dynamic Window Positioning 42 8. Filling in a Gap 44 9. Problems with Sharp Edges 45 10. Resolving Sharp Edges 46 11. Angular Segments 47 12. Examples 1,2 of Edge Detection 49 13. Examples 3,4 of Edge Detection 50 14. Image Transformations 53 15. Table (3) of CALLable Routines 56 16. Table (4) of Keystroke Commands 57 -6- INTRODUCTION Vascular endothelial cells line the interior of blood vessels, where they are subjected to shear stress from the flow of blood. The magnitude of this shear stress is known to vary widely from one region of an artery to another. Since arterial diseases appear to be most prevalent in regions of high shear stress, some researchers have developed hypotheses that propose a causal relationship between fluid shear stress and the development of arterial diseases. A consistently observed effect of fluid shear stress on vascular endothelium is the alignment of cells with the direction of blood flow. When the flow changes, the cells re-orient themselves to the new direction. A photomicrograph of cells that have not been subjected to fluid shear stress is shown in Fig. 1. This characteristic of vascular endothelium, when it is subjected to fluid shear stress, is the subject of a -7- Figure 1: Vascular Endothelium -8- collaborative study by the Fluid Mechanics Laboratory of the Massachusetts Institute of Technology, and the Vascular Pathophysiology Laboratory of the Peter Bent Brigham Hospital. The purpose of this research is to quantify the response of vascular endothelium to shear stress. This is done by analyzing the shapes of cells that nave been subjected to a known, controlled shear stress. An apparatus for producing controlled shear stress on in vitro tissue was developed by Bussolari (1). As is indicated in Fig. 2, tissue cultures are placed in the lower plate, and the two plates are brought together, until the fluid in the lower plate completely wets the upper plate. A variable speed motor is magnetically coupled to the upper plate; which in turn drives the fluid. Shear stresses over the full range that are observed in vivo can be produced with this apparatus on in vitro specimens. Figure 3 shows the effect of 48 Hrs. of shear stress on a sample. -9- Figure 2: Line drawing of shear stress apparatus. For testing, the plate is raised until contact is made with the apex of the rotating cone. -10- Fig. la: Pnotomicrograph of incubator control endotielial specimen at 48h (mag. 100X). Fig lb: Photomicrograph of endothelial specimen 2 exposed to 8 dynes/cm for 48h (mag. 100X) -11- The method used to analyze the effects of fluid shear stress was to fit the call shapes to an ellipse. York (2) wrote a computer program to do this calculation on a set of data points that describe a cell's shape. The program was written in Basic, and ran on a Tektronix 4051 computer. A plotter pen was used to trace out the outline of a cell, with a photomicrograph as a guide. At regular intervals, the pen's position could be transmitted to the computer. Qualitative measurements can be done on vascular endothelium to investigate the effects of fluid shear stress, by applying York's method to cells that have been subjected to controlled shear stress in the apparatus designed by Bussolari. Small numbers of cells can be analyzed from photomicrographs, but the procedure is not suitable for collecting a large data base. A faster, and more direct way of acquiring position values to describe the cell's shape is needed. -12- This thesis describes an alternative method of acquiring the data points. A video camera is used to load an image of the cells into a computer's memory. Image processing programs analyze each cell, and return sets of data points to the ellipse-fit program. This method is fast, and it frees the operator from having to enter each data point. -13- DATA ACQUISITION FROM IMAGES The cell shape analysis program described in York's thesis (2) was adapted to run on the Apple II computer that was dedicated to this project. The Apple is a versatile unit that, in size and appearance, resembles a portable typewriter. Like a typewriter, it has a built-in keyboard that is arranged in the usual fashion. However, it doesn't print, and requires a video monitor for listing programs or displaying graphics. Programs can be written by entering statements with the keyboard. Basic programs, such as the cell shape analysis program, are interpreted by a Basic interpreter program that is stored in read only memory (ROM). Two floppy disk drives, for permanent storage of programs and data, a printer, and a graphics tablet are also connected to the Apple. Cell shapes can be input to the program using a graphics tablet. By tracing out a cell outline on -14- this tablet with a stylus, the operator can enter a set of coordinates about the perimeter of the cell. The program uses these coordinates to do an ellipse fit to For a large number of cells, this process the cell. is time-consuming. A more automated and controllable method of data input to the best-fit ellipse program is needed. Each photomicrograph of endothelium can contain several cells (e.g. Fig. 1). With the use of a video camera, the complete image can be stored directly in memory. The shape of each cell can be determined once an image of sufficient resolution is available in memory. If this method is largely automatic, the data acquisition process will be faster and more controlled. Once an image is in memory, it can be modified and analyzed by programs the operator selects. Extraneous artifacts, which would be noise to a shape detection program, can be removed and desireable features enhanced. -15- In this regard, there are two ways of performing operations to a stored image. The operator can, interactively, do a series of small changes to the image, while observing the effect on a graphics display, or he can run a program that requires no operator input. These two classes of programs are, respectively, interactive and task programs. Many of the operations that have to be done on an image are quite involved, and would be very time consuming to do in Basic. Thus it is necessary to write these routines in the base level language of the computer. The speed advantage that comes from writing these programs in assembly language comes at a cost in complexity and difficulty of programming. Despite these apparent difficulties, an assembly language program once written, can be interfaced to a Basic program quite easily. This is important, because Basic supports disk operations, is a versatile supervisor program language, and is the environment of the cell analysis program. -16- An assembly language program can be linked to Basic with a CALL statement. This statement results in a jump to the memory location to which the operand of the instruction points. All information necessary for the continuation of the Basic program is stored, and the computer begins executing code at the call routine entry point. From this assembly code program, a subroutine return instruction (RTS) will transfer control back to the Basic program. Because the assembly language program can modify any area of memory, it can return data by over-writing a Basic program data area. This method has the advantage that two operating environments are available to the user. In the Basic program, statistical, and algebraic operations can be done on data that is extracted from images in the graphics environment. The assembly language image processing routines are selectable from Basic, and always return the user to it. -17- HARDWARE COMPONENTS OF THE SYSTEM The Apple II is a micro-processor based system with several built in features. It has circuitry for displaying text or graphics on a video monitor, and comes with an integral typewriter-like keyboard. A joystick, which can be used to move a cursor around on the screen, plugs into the mother board inside the case. Each of these devices requires a minimal amount of support software. For most applications, a monitor software package, written in ROM, provides the necessary support. This is particularly true for the keyboard input and text displays on the video monitor. However, high-level graphics functions are not supported. Four memory areas are referred to as screen pages. At any time, one of these areas is used as a storage area for the video display. The location, and display characteristics of these screen pages are described in table 1. -18- Figure 4: Apple II graphics screen tables. Table 1: Screen Video Display Memory Ranges Page Text/Lo-Res Hi-Res Begins at: Ends at: Hex Decimal Primary $400 1024 $ 7FF 2047 Secondary $800 2048 $BFF 3071 Primary $2000 8192 $3FFF 16383 Secondary $4000 16384 $5FFF 24575 Table 2: Screen Soft Switches Location: Description: Hex Decimal $C050 49232 -16304 Display a GRAPHICS mode $C051 49233 -16303 Display a TEXT Mode $C052 49234 -16302 Display all TEXT or GRAPHICS $C053 $C054 49235 49236 -16301 -16300 Mix TEXT and a GRAPHICS mode Display the Primary page (Page 1) $C056 49238 -16298 Display LO-RES GRAPHICS mode $C057 49239 -16297 Display HI-RES GRAPHICS mode -19- A program can switch between display modes by addressing certain memory locations. These addresses are referred to as soft switches. the memory locations, and the graphics modes that they enable are shown in table 2. Other devices can be incorporated into the system by plugging an interface printed circuit board into the I/O slots on the motherboard of the Apple. A single interface board powers two cable-connected floppy disk drives, and another board drives a printer. The interface boards each have a ROM that contains the coding for the device drivers. This memory area is enabled, and is directly executed by the Apple's microprocessor when the peripherial device is operated. The Apple II uses a 6502 microprocessor chip, which is manufactured by Advanced Micro Devices. The device has an 8 bit wide data bus, but can address 64 Kbytes of memory. -20- There is one accumulator and two index registers. The first 256 locations are referred to as the basepage. these locations are used as indirect pointers to other locations. The X register is used to index through a base-page pointer table, while the Y register can be used to index through the effective address area. Each addressing mode has its uses, and since there are only a few base-page locations left for user programs, careful choices have to be made. -21- THE CAM4ERA AND ITS INTERFACE The Hamamatsu camera is designed to be operated The unit consists under the control of a computer. of a compact camera, connected by a thick cable to a controller chassis. It is interfaced to the computer with an interface board that plugs into a slot in the controller. This board is connected with a cable to an interface Doard in the Apple II. Its best performance is in subdued lignt, and it can be damaged if it is aimed at bright sunlight. An aperture adjustment on the lens, and a red warning LED against are the only protection can also damage the vidicon, anywhere near it. this. Photo flashes and should not be used When the camera is not in use, the lens assembly should be unscrewed, and the flat aluminium cap screwed in its place; to protect the vidicon from high light levels and flying debri. The camera's image space consists of a 1024 X 256 frame of 8 bit pixels. With interlacing, the vertical -22- resolution can be increased to 512 or 1024 lines. When this feature is selected, subsequent frames are snifted vertically, and 1 or 3 extra horizontal lines appear between the original, non-interlaced ones. Although this is beyond the resolution capabilities of most video monitors, an image processing computer program can make full use of it. The camera scans a complete frame in 1/60 Sec., Dut the analog to digital convertor (A/D) is not fast enough to digitize each sequential pixel in the video signal. The video signal has a bandwidth of 15 MHz., while the A/D has a maximum conversion rate of 40 KHz. A norizontal scan line intersects with a vertical sample line at each point that a conversion is done. The controller can be programmed to start a conversion at any X address. Successive vertical conversions in either direction can occur automatically, or by explicit computer commands to the controller. It responds to set-up commands that can be used to put it in a auto-decrement or auto-increment mode for X addressing -23- As each pixel in a vertical line is converted, the byte is stored in a buffer, or I/O memory area. This array of intensity bytes can be transmitted to the host computer after the entire line has been When the I/O transfer takes place, the converted. X address is automatically incremented or decremented, if eitner auto-increment or auto-decrement were selected by set-up commands. Otherwise, the next sequence of conversions are done on the same vertical line. When interlacing is selected, two or four I/O transfers take place before the line X address is changed. Thus, every second or fourth pixel intensity value is transmitted in each array, and two or four arrays have to be merged to obtain a correctly ordered line. The Hamamatsu camera interfaces to the Apple II with an IEEE-488 interface board. This interfacing standard was established as a common interface protocol for computer equipment. (3) Several devices can be plugged in to the common GPIB bus and controlled individually by the computer. In one sense, it is like an extension of -24- the Apple I/O bus. Each device has a primary address, and may have several secondary addresses that are used for selecting a device, and a function of that device. When the computer issues a system reset command, a common reset line goes active, and each device is put in an initial, known state. This Listener state, as it is referred to in the literature, (3,4) enables the devices to receive valid set-up commands when their primary addresses are sent over the bus. Other addresses, and invalid set-up commands are ignored. Each set-up command is preceded by a secondary address, and consists of a sequence of ASCII characters. A set-up command can be sent to a device to make The device then transmits the contents it a Talker. of its buffer to the computer, and reverts back to the Listener state. Tne advantage of this protocol is, that as much as is possible, way. all devices are handled in a consistent Tnis frees the programmer from having to concern himself with hardware aspects of pripherial devices when writing a program. -25- The data transferred after each Talk command consists of sequential intensity values from the 256 point vertical line. The camera controller reloads its buffer during each frame, and can transmit it during the frame blanking interval. (.75 mS.) This assumes that the call routine, that is executed by the the code stored in ROM on the interface board, can retreive the data and store it in memory in that amount of time. Otherwise, the maximum throughput, as set by the vertical line conversion, would not be realizeable. However, without even considering the timing requirements of all the I/O code, it is clear that this throughput cannot be realized; because four cycles of the 1 MHz. processor clock are required to load each of the 256 bytes in memory. This is true for both interlaced, as well as non-interlaced modes; only the scaling factors change. Each line transfer takes two frame periods. ITo transfer a complete, non-interlaced frame to the Apple takes 31 seconds. Not all of this information can be -26- used by the Apple II. The minimum image set of the camera is 256 Kbytes; but the Apple only has 16 Kbytes of graphics memory. Clearly some pruning of information has to take place. intelligent This would decrease the time required to load an image into memory. -27- SOFTWARE DESIGN ISSUES There are several issues involved in the design of an image processing system. Trade-offs have to be made between image resolution and program space, because there is never enough memory to fulfill all the requirements of both. Image processing operations often consist of a few primative functions that are done to every pixel. To speed up iterative programs, programmers will resort to in-line coding techniques that expand loops into straight line sections of code; with no backwards jumps. This approach can greatly increase the memory requirements of a program, and should be used sparingly when memory is at a premium. A better method is to use fast algorithms when at all possible -28- IMAGE STORAGE CONSIDERATIONS An issue of primary importance, at the outset of this project, was how much memory to allocate Any useful adaption of the for memory storage. camera to established Apple conventions requires that part of the camera's image space be mapped to the Apple's graphics area. This is essentially the only free area of memory that is large and contiguous, and the image should be at least partly visible to tne operator. Two bits of pixel gray scale is adequate for the microscope images, and there are, conveniently, two identical high resolution graphics screen pages. Set-up instructions to the camera allow the user to start a series of vertical scans at any X-coordinate position. The software routine which concatenates each intensity value, and stores a two bit value in the two screen pages, will use whatever block of 192 bytes is selected. Effectively, this reduces the -29- I/O transfer by 1/4. This means that it takes 8 Sec. to load an image in the Apple's memory. By convention, the primary page pixels have a weight of 2, and the secondary page pixels a weight of 1. This method guarantees that any part of the camera's image space can be used to fill the 280 X 192 pixel Apple high resolution screen pages. can only be displayed indiviaually. The screens However, it is not important for the operator to be able to see the gray scale image, because a common purpose of most image processing operations is to simplify a binary image. Much information is lost in the process, but the object is to isolate one feature of the image. -30- PIXEL ADDRESSING As shown in Fig. 5, seven pixels are packed in each byte. Along a horizontal line, there is a quasi-ordering of pixels in memory. It takes three bytes to isolate any one pixel; two address bytes, and a mask byte. Along a vertical line, there is no discernable order to the addresses. Because of this, address calculation involves the addition of several quantities, depending on what vertical section, box, or line the pixel is in. Even with table look-ups, as is used in the program, this is a slow calculation. It is often possible to program entirely with fast address squencing. In this way, a pixel address is continually modified as the cursor single steps in the vertical or horizontal direction. This is a useful technique for single moves, but is unworkable for general step sizes. However, when single step address recalculation is used most of the time, screen operations run quickly. -31- Figure 5: Pixel addressing in the High resolution graphics screen of the Apple II. COLUMN B 02.0304045070o 44090cOPCEMOFIO/'14t/CZ 1710 110A /CWIELF'22 P a2 zY-27 Js00 $ 2 e8 J 2 I GO 2 980 $ 22 00 $23 90 $ 2300 2 290 $ 23efO i 2200 $ .23 D1 MASK oG'oe AN ADDRESS IS FORMED Ill I II BY ADDING A ROW, COLUMN AND BOX NUMBER $ ceeIIIIII LINES IN EACH BOX £ / e I I I I000 I II I111 IJI I szI/ee L IlIIIII s /c o0 02 GOf I 08 1II nIii 10 20 48 01 -32- Two routines, NEXTX and NEXTY modify the cursor address and mask bytes. If the accumulator is positive, when one of these routines is entered, then the cursor is moved one position to the right A negative accumulator has or one position down. the opposite result. The Y register returns 80 (hex) if the operation places the cursor at a screen edge, or tries to place the cursor past an edge. This convention is maintained throughout the cursor move routines. There are two locations for cursor addresses in the base page, and two mask byte locations in tne program data area. These bytes are usually addressed with the X register index instructions. Tne X register is 0 or 2, depending on which set of bytes is being accessed. To prevent indexing errors, the X register is not used for anything else. This technique allows a single routine , such as NEXTX or NEXTY. to operate on two cursor addresses independently. -33- The address and mask bytes are not sufficient description of a pixel location for all operations. Since this representation is not monotonic with the position of pixels, displacements can not be easily calculated, and the joystick output does not map to it well. For this, and other reasons, a dual system of position representation is used. Besides the address and mask bytes, two X-coordinate bytes, and one Y-coordinate byte are used to form a position representation that is monotonic. Two bytes are required for the X-position because there are 280 locations in the X direction, and a single byte can address no more than 256. To facilitate fast table look-ups of actual pixel addresses, HIGHBYTE(X) = LOWBYTE(X) has a range of mod 70 . Thus, the high X byte 0 to 3, and the low X byte has a range of 0 to 45 (hex). In the listing, they are called TXEXT and TXPOS, respectively. the left edge of the screen. They are both zero at -34- Similarly, the Y-coordinate byte has a range of 0 to BF (hex), in the listing. and is referred to as TYPOS It is zero at the top of the screen. Although this places the origin at the top left corner of the screen, the data that is sent to Basic is normalized to a more acceptable coordinate system that places the origin at the lower left corner of the screen. The routines FINDX and FINDY are used to convert these coordinate bytes to a set of address and mask bytes. Absolute moves, such as are required to support the joystick, are done by calculating a new cursor address from the coordinate representation. These three coordinate bytes (TXEXT, TYPOS, TXPOS) are an output from the joystick service routine, which is called PUTPOS in the listing. Relative moves, as required by the key-stroke cursor commands, use two other routines: XMOVE, and YMOVE. The accumulator contents are added to the respective coordinate values, when one of these routines is called. The two routines already mentioned, FINDX, and FINDY, are used to calculate the actual address. -35- Address calculation from the monotonic coordinate bytes a priori updates the address and mask bytes as well. A necessary side-effect of address recalculation is therefore the update of coordinate bytes. The overall effect is an addressing system that is optimal for speed, and conceptually clean. It is a good basis to build higher level image processing routines on. -36- EDGE DETECTION Microscope images of endothelium are noisy and show many artifacts from slide preparation. For example, in Fig. 1, there are missing edges, changes in lightness along edges, and adjacent areas of similar brightness that are not part of an edge. The Hamamatsu camera can be used to bit threshold an image. This produces a binary image that has only two values of illumination. Each point that was brighter than some reference level becomes white, and all others black. Bit thresholding an image, such as the one in Fig. 1, will not enhance the signal to noise level. This can only be done by some operation that recognizes edges. Since it is a prerequisite to edge detection, this enhancement, if needed, has to be done by the operator. processing There are available, in the present image software package, ways of doing this. "brushes" can be enabled, to modify either large, or small areas of the image; under cursor control. Two -37- The little brush writes a value location under the cursor's centre. in the pixel For example, if the operator enabled this feature with a "P2" command, the secondary page pixel will be zero'd, and the primary page pixel will be set to one. The big brush is similar, except that all pixels under the cursor are modified. These work for both cursor placement modes. The cursor could be used to trace out an outline of a cell, in order to acquire points about its perimeter. However, there is no improvement in this method over other, earlier ones. A much more interesting approach is to have the program automatically search for the edge of a cell. These edges are distinct enough, even with two bits of gray scale, and "brush" work can be used to eliminate unwanted artifacts, and to make edges continuous. -38- One approach to edge detection would be to place the cursor on an edge, and have it "climb along the ridge", until it returned to the starting point. A sequence of evenly-spaced position values, derived from this operation, is sufficient edge definition. However, there has to be a more systematic criteria for determining where the edge is, and how the program should follow it. Among the problems with this first approach to edge detection are: 1) The edges have to be continuous 2) Intersections cause problems 3) Inward pointing wall fragments conflict with any method for 2. 4) Thick edges cause the program to hang-up by: i circling within a thick region ii unevenly spaced positions iii not recognizing its return -39- These problems all result from the inability of the program to recognize that it a closed curve. dealing with is Since cells always have edges that are closed curves, it seems reasonable to include this factor as an integral part of the algorithm. The method which was used successfully to recognize cell shapes anticipates a cell that is oughly circular. With the cursor in a cell's centre, a series of radial rays are generated that cross the cell wall at some region. Each individual line is produced Dy a sequence of horizontal and vertical steps, as Fig. 6a illustrates. These lines are not drawn on the screen, but if they were, the pattern would look like Fig. 6b. As each ray is extended, the distance from the centre is continually, and very accurately updated. Pixel values are integrated, and a double byte accumulation of the product of each pixel value, and its distance from the centre, is done. _ _____I____ 1;I I__~r_~ 1~_ _ 0 ___ __~~ -~C~II~-OC -m__--C~ 00 eeo Ob I -40- 0 0 @0* Y - step = 3 X-step =4 Figure 6a: A straight line as it is formed on the graphics screen Figure 6b: Ray pattern of edge search program __-1--- --~i~- -41- When the line ends, the position of greatest luminance is calculated from these two sums. The calculated position is very close to the perceived location of the cell wall. Although the accumulated product term is two bytes, an overflow can occur on a long ray. This happens when the accumulated sum exceeds 65,536. A typical scenerio for this is a line over 200 units long, that passes through a bright region. To eliminate this problem, and to speed up the position acquisition, a narrow tracking window is used. length is between -W and +W. In Fig. 7, the window These distances, from C, are calculated from the last ray's intersection with the cell edge. Since there will usually be no large discontinuities along the edge, this method permits the use of a small window, and tracks the edge quite well. When no luminance is found, within the bounds of the window, one more dot is fudged, using the centre of window position as a good approximation. The window length is doubled, in anticipation of another miss, and the next ray is not fudged. -42- Figure 7: Dynamic window positioning -43- Figure 8 illustrates this use of the previous edge location to fill a gap. Subsequent rays cannot continue this pattern, since it would lead to inaccuracies. It is, nevertheless, a good featurelecause it offers a good solution to the miss problem with diffuse edges. Since the window is dynamically centered about the edge, noise averages out. To improve the chances of locking back in on an edge, once it has been lost, the window length is doubled after each miss. However, this does not always guarantee that the edge will be found immediately. In Fig. 9, the sharp transition at the top results in a series of misses. The first ray, after the apex, is a miss; but it is filled in. The next ray is also a miss, despite the larger window. This can be corrected by placing the cursor closer to the apex. Figure 10 illustrates how this solves the problem, by placing the sample points closer together. The full 360 degree sweep can't be used, because the lower sharp edge will cause misses. Instead, angular segments, as shown in Fig. 11, are used. -44- MISSES FUDGED Figure 8: Filling in a gap ZA/ APEX -2W1~ Figure 9: Problems with sharp edges (D FH- Ti) (D H (D L- LQ* En.5. #see.tea 0 D M -il------ --i--;-;i;;-__~--=--~- s~- - -s- -- - --r~__-_ .~__-__a --~----- 1;-m--^--- _----i~ 1 -47- Fig. Ila: Top edge-detection angular segment, used with tne "TG" command. Fig. llb: Bottom segment the reverse Side angular segments, used with "SG". -48- Messages are displayed, according to the status of an operation. After each search, a message If most is printed stating the number of misses. attempts fail, another message appears telling the operator to re-position the cursor. When the buffer is filled up, a message appears, offering the operator two choices. The buffer can be re-initialized, or the set of position values can be written in a Basic data area. Each set of three coordinate bytes is reduced to a normalized X,Y pair of bytes. With this system, cell shapes can be acquired and transferred to Basic very quickly. It takes about 5 Sec. to acquire a well-spaced set of 64 data points. It is very accurate, with most of the points coinciding with the perceived location of the wall. This is illustrated by the actual photographs in Fig. 12 and Fig. 13. A maximum of 255 data points can be transferred to Basic this way. than adequate for most purposes. This is more _I _~___ _^_I ___ ~~_ _ _Ib~ _D_ __~ 4~~~__ ~_~1____1_1_~ __1______~ -49- Fig. 12a: Fig. 12b: Edge detected with a TG and a MG command. Edge detected with MG command. -50- Fig. 13a: Fig. 13b: Edge detected with TG, BG, SG, and MG. Ecige detected with several of eaclh command. -51- MISCELLANEOUS ROUTINES Two task routines can De used to erase the graphics pages. In the listing, they are referred to as PBLANX and SBLANX. They run very quickly, because there is no need to address individual pixels, and the order that pixels are turned off doesn't matter. Four programs are available for doing two-dimensional smoothing. Three, or five adjacent pixels are averaged on a line, and the centre pi el, at each step along the line is assigned that average value. has slightly different characteristics. Each routine They are called SMI, SM2, SM3, and SM4. Two programs perform a two dimensional dervative across the screen. zero. Negative derivatives are set to This program could be more useful if more gray scale were available. EDGEDO transforms a solid, light against dark background image to a line image of the same scene. It is useful for converting images to a fcormat that the edge detection program can use. -52- Each of these routines is a TASK program, that is CALL'd from the Basic environment. Except for the screen blanking programs, they all use a program for doing an ordered scan of the screen. This program, SCAN, will do any of four screen scan patterns, and continually updates a set of pixel values that are local to the current position of the cursor. A sequence of operations can be done to an image with these programs, to transform it to a different type of image that might have some information more accessable. Such a sequence is shown in Fig. 14. Il 3 1 I I -53- Fig. 14a: Original noisy binary image. Fig. 14b: Smoothed with SM2. Fig. 14c: Interiors removed by edgedo. I -- -54- CONCLUSION The image processing software resides in a free area of memory immediately following the screen pages. Basic calls to image processing routines have the following syntax: CALL (exp) ; where exp is a decimal number, not greater than 65,536, and corresponding to an entry point. There are nine entry points to different task routines, and one entry point to an interactive routine. Tne reason why they were not all combined in one large interactive program, is to minimize the danger of accidental image erasure. These programs have already been discussed, but they are summarized again in table 3. The interactive program has several keystroke commands. They are all described in table 4. The image processing system is designed to make the best use of system resources and operator interaction. A relatively simple algorithm is used to detect edges, but it is quite reliable and fast. -55- This system was designed with a modular structure that simplifies later expansion. It is only necessary for a programmer to satisfy the input requirements of each module, and the precedence of module operations to add other high-level operations. The software listing that follows (Appendix A) is thoroughly commented, and provides a concise guide to the program's structure. is my hope that others will find it a useful source of knowledge of' the program and of assembly methods. It -56- Table of CALLable routines Figure 15: CALL ADDRESS NAME START 24576 PURPOSE Main interactive program, detects edges, draws on screens, EDGEDO 24579 two cursor modes Task program, removes interior of binary image on primary page, leaving only edge. SM1-SM4 24582,24585,24587,24590 Task routines, do twodimensional smoothing LAPLA1, LAPLA2 24593,24596 Task routines, do derivative in both directions, zero neg. derivative PBLANX,SBLANX 24599,24602 Task routines, clear the primary, or secondary screens -57- Figure 16: Table of Key-Stroke Commands KEY CODE OPERATION PERFORMED J...............enable joystick to control cursor H..............enable key-stroke commands to move cursor U ............. move up D .............. move down R .............move right L ............. move left decimal places, if in key mode decimal places, if in key mode decimal places, if in key mode decimal places, if in key mode esc..............return to Basic sp sp.............return to Basic sp P ............. write sp @ ....... ...... write , should be less than 4, to screen a t cursor *cursor to screen, Big Brush sp E..............turn off both brushes MG ....... ....... 360 degree sweep for cell edge TG............... 270 degree sweep, centred at top BG................. 270 degree sweep, centred at bottom SG................ two 90 degree sweeps, on either side $.................flush buffer X.................transfer buffer to Basic, and exit Zo................ display secondary screen zl. ............... display primary screen -58- BIBLIOGRAPHY 1) Bussolari, Steven R. An Apparatus For Subjecting Vascular Endothelium to Controlled Fluid Shear Stress IN VITRO, S.M. Thesis, M.I.T., 2) M.E., May , 1980. York, David P. A Method For Quantifying Cellular Alignment of Vascular Endothelium Subjected to Fluid Shear Stress, S.B. Thesis, M.I.T.,M.E., June, 1980. 3) ANSI/IEEE, IEEE Standard Digital Interface for Programmable Instrumentation, std 488-1978 IEEE Inc., 345 East 47th N.Y. 4)Hamamatsu, M999-04 General Purpose Interface Bus (GPIB) Manual. -59- APPENDIX A THE PROGRAM LISTING -60,C. , I .. T 2 EP-'Z 7 EPZ $9 EPZ $-!9 3 4 5 STAX BUFF 61 JOYSTK STRI NG EPPZ sG 8 i0 HTB ~BUPr EPZ $CE 11 ORG $60021 -3 6000 6003 4C0-6E 6006 42C-6E JPi ST-ART J.iP i3 6009 4C:4B6E 600C G00F 6012 6015 6018 60i8 4C626E 4C6E 4C986E 4CBr3:6E 4C2264C2769 ti,;E 60 601F GSO 6020 60 602! 60 ADeoco 8DiC: 18 6980 26 2'3 2-' QUES JMP SBLI4141 :.. i lE -DER .L :-, _PR 7I aRY SCREE. SECONDORY SCREEN BL.NOX R i..iT UE - :i-: ;RTS To, RE i7 YTHIS ROTL TNE POLLS KEYBOPR-! SCLEAR SiGN BIT '.- BNE FOGO JSR TYIN 45, 7T4E LDA 4.C:1000 STA $C0 ! CHP OxitT .BNE NOTOUT JSR OUTSET ISC T 4 :-.- GOTO OTHER TESTS YES , GET PNOTE- FER: TEr ;NO, NOT r ANOTHER s.CE! ;GOOD, SOMETHING E E ;GOOD-BYE NOTOUT CHP ii$0 SNE NPPINT T 7 SR PAINT 54 .1_ 6049 D006 604 4C:5860 204Ei63 ii044 JiF-,P F'iiO NP4INT C:H-9 $C5 BNE NERs-SE JSR ERASE .jHP FOO 6051 CSCO -055 206263 6058 60 INTERiLCTihiE POG. i".--InT T'G ,i Bi :. RY - -AGE EDGE E-. ..: -. .Sv-,OOTH ROUTINES ; i-i IDC 40 4 05-3 D003 F~i9S ;e.-.RY ir'- _LPPLA JhP .= 3 603A 6030 603F 68041 l' -;±STPI Se- RJSR RTS 43 6059 R'9 IH:N±L - -DR~ .S a: . ' PO ;IT-O .O"STIC E..PSE PPGE PDDRESS BASIC STRING POINTER GES .. STAp'RT ADDRESS gOR h~-ESS POINTER inR HESSAGES -CHFRACTER 279 6033 209960 6036 C900 6038 D003 6044 4C5860-. 6047 C5 .- CURSOR ,,DRESS :E-O, S imp S- M12 JMP 6033 1 1i2.,5 . - 203362 C9DO DO@&. 2036863 DRES-- JrP 15 8022 6022 6022 20 .0. 6025 60 60:26 6026 6029 602C 6020 -SOR . 55 -56 57 59 NERPSE CMP i$C@ BNE FOO JSR BLOTS F, CD ,u RTS .-- ;i ' .... •,. LI772 BRUSh ,.R BRUSHES FFbH I--F A ri.z r TI OFF"? -61- 1 JS.' JSI 4 - 5T pIOF1- 4 ~-C:050i IQ 6065 207(ES4Z 6068 604 60&i Pi- 606 20E-6 ;ST PRTMHPRY PI.-.-. CO MARSES jSqp 64 - C051-f ;TX PQ If GO1 ft- S:-: Pi- E fT -- *, -J E-7 E-4. 7 E tff-4 I 0-. '4 i3 6-76 HODEtft T4ETET 4-;7 -ii jT4Y ON 4 -i E -iziE:LES PRIMPRY Pl :iGE PID4C LrDP STA P&Lj i__t RTS 6! LED! LDA SD-I;7 60-,- -*0015,; STP PGFLPI-:! ;--T :ft ;:P Lt-3 PR '-4-.. P MCR RTE 1 6-.83 60 ft-t.'- jSR fi- 60-4j PD-LI 6-7 90 x?T S r..ft 60LI$f 8 16D 3F7 608C 6 _yis ftt*lft-:ft-. 1 __iE 2 6_D JSR I Q7 0EF 6090I JSP., -t;:*:--..:-i;: miT57_:'- F7- - -17 60F J i: 'SR El 1~-S.. I ;V7 ~ EOD9 I ~1t 6@9 ft.. ft f-TEP 4f f.fL~f UMF TWi Ci DI G T -7:Z; T MCI T~ QW: ~~~T -~~W 7~' LDY USIP .-i *,R HULT C'TP T E fKEtH DIGI.T~-at .23q T YP I i-4 AND 01P C i cc: P (DC: FITES ,,ifftf WO DIGITIS~~ f 62 6084 121 60B4 A07000 GOB7 BIl0 GOBOFOOB 606B EE3772 GOBE D00F7 60C0 EE3672 60C3 4CB7660 60C6 0AD3672 60C9 1008 60CB A900 GOCD 803872 60D0 80D3772 60D3 60 60D 600D4 123 124 125 126 127 128 129 130 131 .122 133 134 135 136 1371 138 i39 140 141 GOD4 60D4 -.i 4a 6OD4 205980 60D7 200961 800A A980 6'0DC 804672 6ODF 8D4272 60E2 803072 60E5 A04272 6OE8 3003 60EA 4C2260 60E0 A200 60EF 207761 60F2 20386 60F5 202660 6OF8 804572 6OFB 209861 60FE AD4072 6101 10E2 6103 206863 6106 4CE560 6109 6109 8109 202E61 81OC AD0272 61OF 8519 6111 P000372 6114 851 Q 6116 AD3670 8119 85F6 6118 0AD3770 G811IE 85D07 6120 94 6122 8510 6124 A9C:0 8126 851E *8;a; I-.A *.-:- 804j7 6120 60 612E 612E a- 142 143 144 145 146 147 148 149 150 151 152 153 15 155 156 15il 158 159 GETPOS LDA $C070 GET C:OUiNTER GOING WHERE LOP (JOYSTK) ,Y -READ NUMEER BED FINALE ;PALREADY ZERO ??! iNC TEMP2 ;NO, BUMP COUNTERS BNE I N C WHERE OUERFLOW? INC TEMP1 ;BUM1P NEXT BYTE J.HP WHERE FINALE LDA TEMPi BPL GETRID ;NO NEGATIUE NUMBERS PLEASE LD[4 #$0 ;ZERO THE WORKS STA TEMP1 TEMP2 RTS iET STR GETRID RTS I START JSR INIT LORD#t8o STA PSOURC. STA OFLA STA BLTFLG LOPS __~ INIT 172 173 174 175 177 17 179 180 1i81 LID FLAPG BPL DRAW LOPS .JSR JMP LOPS 162 163 i69 170 171 STAYIN BASIC #$0 PLACES XORCUR QUES CHMND J'R TNPLC: CURGOI I 66 187 ~LDA OFLA l.-_.UIN 6MI .JHP STAYIN LOx JSR JSR JSR STA i60 !65 JSR LITE JSR LDP STA LOP STA LOA STA LDA STA LOA STA LOP STO BUFSET STi1 STAX STi+! STAX+! HESTPE 1TAB MESTOB+i HTAB+1 4464 JOYSTK #$C0 ,JORT<+1 STA PFRG RTS ;TURN ON THE LITES >READY, ACT!ON, PROLL-EM. AND SET FLAGS ;EXIT FLG N-EGTED ;NO BRUSHES ;HAD ENOUGH? ;NO, DO MORE ;EXIT TO BASIC ;USE FIRST PIXEL ADDRESS ;GET THE CURSOR 1POSITION ;00 A CURSOR ;POLL FOR A COMMAND ;SAOUE IT FOR A RAINY DAY ;COMMAND INTERPRETER ;ANY BRUSHES ON? ;NO "'R ... O MAE DAMAGE SiETUIP POSITION BUFFER ;CURSOR ADDRESS -STAX SMESSAGESPOINTERS :SETUP JOYSTICK BASE PAig :,I USS OC. -63-v 51E 81 1 1 t5 I inf ~F!STTii* 'M4~y I- EL4 iR. T QT 6131, 8Dt -rTY. j-1, 6142 f' 8D-if G 149 7i~ T~T!17 .i 7 i1 4A 1 71 Ri4)L41 614 11-1 14,ri-415* P-0 8i. Ifni~ - wi I --#' .! I" t-p -c ~± L C4 iL-- 81h4 S,FI7 ,~ ~i ~±1. L L' i7 T Fe - TYP I ii93f-I hi61 7 FT' ~- -r 7- hL~4-I 4-f- I-I7W IN I -. jf:4-" GII Ni i444 F- 4*JH *** T 7 Fi LL- iI hi 4-F1491 j 1h 1- 7 AV'j ti 6 4i ~ I~~Ctk 4 ~.. Vn4-i4 RTS: " 'Fi - t4* -- 4'"- 1 -- k -64- 61 ;E-t .196 619B 243 24E :'45 804172 246 C905 247 248 0009 249 2090D60 202962 250 4CB261 251 252 CsC4 000E 253 54 209060 804372 255 256 A980 804472 258 4C2262 259 CgCC 260 D000 2aqnRR 283 61C4 20292,. 61C7 4CD161 265 264 61CA C9O2 61CC 000E 61CE 209060 6101 804372 2.7. 268 125 61D4 P900 6106 804472 269 6109 4C 2262 619 619E 61A0 61A2 61A5 81A8 61AB 61P0 61AF 61B2 6165 81B7 6186 61BD 61EF 6!C! 61DC A000 G10E 8C4172 61E1 C9D4 61E3 D0Ei3 61E5 61E8 61EA 61EC 61EF 61F1 61F3 61FG 61F8 61FA 81FD 81FF 6201 6204 6207 620A 4C3762 C9C2 0003 4C99i62 C9CD 0003 4CBE2 C903 0003 4CD62 C99B 009 203362 207 60 4C22 2 CS04 620C 000 620E 202Eb1 6211 4C22B2 6214 C9D8 8216 0003 6218 4C7263 6:218 CSDA 6210 6-'_ 0003 EE! '3tF 6222 6225 6228 6229 202C63 207760 20386B 60 INPLAC STA MFLAG CMP X$05• gNE NOTUP iJSR TWODIG JSR DONEG JiP FH|lROUT NOTUP CP . .SET 'LAS FOR S ='I 1 Q*flrp ilUROR i;CSRP HOUE wa ; T JL iP TI'CE ;TAKE .NEG;T i'E_ ,: TO 0 i p ;LI-UiE FL-iS SET FOR FOUe -4 pt- : IOR -- " 5NF NfTD WN JSR TWHODIG HOROUIT STA HIOUE LEBA #$4-80 ST: AQ.. S j . If--C .SAUF nT sTFNC .. PF NOPlE = T 1 .J.*iP FULSR NOTDWN CHP *iCC BNE NOTiLFT JSR TW00iG .JSR DOI 2E_ TIUE DiSTiANCE TO GO LEFT . i-iP SI DOUT NOTLFT CHP #$4I02 2,.= .NE NOTRHT .JSR TWODIG SIDOUT STA HOUE ST6 A:<i S JHP FULSC R NOTRHT 27! 272. 273 274 275 276 NOTOP 277 27.E4 279 NOTBOT 280 281 282 NOTHID 284 285 286 287 288 r-0.#$0 STY MFL AG CMP #$D4 ;CLEAR HOUE FLAG, OR ;CURSOCR WON'T STOP >"'" IS F,"R TO EDGE SC N BNE NOTOP JMP TOPRAY - 7' CM P BNE .:HP CHP BE JHP NOTSID CrMP BNE $-CD NOTHID HMI R A 4#-03 NOTS D SI DRY .OR T SCAN'4 RfT~nL EDGE r- gJ."-~ ! J CH-P -C:2 3NE NIOTBOT JHP EOTRfItY . S'' -4 -- . '_ .n.~- *$9 TLRT S TF Si C NOTBAS JSR OUTSET FLSCR JH.,Pl 290 293 292 293 294 295 295 27 29 NOTBAS C HP #4 NE NOTF-1 1 JSR: UFET _N' FULSCR NOTBUF CMP BNE ._iM NOTX:FR C-M.P BNE 44E8 NOTXFR XPER'=OR FiULSCR; FULSCR jR HF1 F 3013021 NHOFO .303 .JSR XOCRCUR RTS S Tu QI T 1a.t- ifCtI FI :7 R PSiNSU - .4 .. .- T SREEN ;DCO TiE CURSEOR r4, F .. ,' r 1_!1 1 i HT PWY -65- G229 6229 6229 622C 622E 622F 6232 3"5 803672 A900 38 R ED3672 60 6233 6233 8E4272 623 S 306 p -3'07 OONE STP TEMPt .; S.UE 310i LDA #40 SEC SBC TEP_. ;i-iT 308 309 6237 313 OUTSET STX OFLA RTS 317 TOPRAY. CNEC;K .. . ,, K -Pi r- 1, N-4FO0 At~4 -:Eo 623C FO7 JSRI "23E C9C7 6240 DOE3 CP r$-7- 6242 203868 6245 A9 07 6247 F801772 624C i 42 624C 80 872 624F 2015E8 5 6252 205662 62-55 6'0 NCHEX i • NE NOFO,9 JSR itj i-I MORCUR 3i9 STA LOR STP .JSR JSR 3233 A .4 32 329 QUID =$4 LO!UI![ DOLOOP H iSSES 6259 206062 625C 203868 625F R0 6260 AD3F72 6263 3001 GO 209530 209560 AD3E72 10 C6 A009 6273 20601 6276 60 6277 A[OF72 627A 3018 627C 2091i60 00 6281 20884 6284 20950 209960 209560 209560 209560 2 C9F3 6294 00C 6296 4C8162 6299 6299 S 5b6 33i 3 JSR .3,_0.7 .7,.R JSR 325 HISHES XORCURp RTS- ,,, " 'i.. 1 tIISMES LD F;13*-;8Hi -,,.. ,, ,,. DO. MES LS DO.HES JSR LF JSR LF 32597 LOA CFLAB BPL NOSHO 34-3 350 !cY iti9 3.51 . 'R PEEP RTS NOSHO LFORP~TS 4 34 7 4. 3557 CI I HOSTN JSR NUMBA 3,i8 3579 350 60hESG JSP FOS; T.P.fi JSR LF : CHRAj. T-, ;ONL'Y 9 "6" ABORT, I y O-Rk'.S HERE_, ALLO: .S 1 CUR-S I S iTOO FR i ' OF CU RSOR EU1IDENCE ;-GE-T RID ;:START E-RE. TS No :"40WPPPTP -. . . . - - Y=$C w T 25 DEGREES .0u CLOCK-.iSE SCN _PR iNT HISSES ;PRINT tR-* PIHISSES HE CUSRSO NOTE- 3247 3._2 1 .3.3. •_ T T H ISS c~. *,a11 L.,1 ._,..., _ -. .j . j; 6256 20388 203 825G T tTS =3 0 6256 6287 628A 628D 6290 6290 E OUT FL G SENDS TO BASIC . ,623, 201C63 23Cf -3 627F ;POSIT"I- 3.5 3A6 6237 6265 8268 6269 626C 626F b271 NEGTIUE OF NL; BER RTS 60 8237 -UBE CURSOR DiSCiPLIN HiNTiNED SCREEN r .---R.-4E C C r ;YES, DO pESSGE NO, GO AwAY-4y GET RID OF EARL' I ER STUF - JSR TYPIN 355 •JSR LF 357 .,2, 3_8 359 JSR LF SElER CULL PINT B.AT ;A FE, -UFER FULL -,ESSAGE ,.-ITSES. OR# 9 L."T -; PRTNT NUHBER OF HITSSES no- ' MISSES" ~~ a_ R.T OPERATOR TO TYPE .OR JSP LF RTS MIOSTN I OY *SC JMP GOmESG *" 'EPOSITiON CURSOR" HESSQaGE -66- 6299 ~ C63 629C C080 3_5 36 829E 0007 387 368 369 370 6240 CSC7 62A2 F003 62A4 4C252 62P7 2038868 371 62P AS 03 372 82AC 801772 62'F 900 6281 801872 6284 201565 8287 20566882 376 377 6" 6289 628B 378 379 6288 b 626B 38! 8288 20iC63 382 62BE C080 62CO El00 383 38 62C2 C9C7 385 2C4 0F 62C 4C2562 386 387 82C9 203868 388 62CE 80i772 6201 907 6203 801872 8208 201585 6209 205662 62DC 60 620D 2M LO 393 394 395 396 . 6200 201C63 62E0 CC7 62E2 F017 1 62E4 C080 398 399 40 HIDRAY 62FE 803072 6301 A903 413 6303 801772 8 'vi04 6308 0-"0 630B 201565 630E AD7372 4!4 415 82FB ADOF72 417 48 TI JSR iL 00 >GET~I OF CURSOR ;DO FROi 45 DEGREES i 1.35 DEGREESY CLOCKWISE .SPHEPS BEFORE HIDGO CMI $C7 BED wi :.CAG iMP .JSR XORCUR LDA #$0 STA QU ID LDA #$.7 STA JSR DOLOOP JSR HISSES RTS Ur-L LimRS :-. Rat of " ;STPRT PT THE 6EGl-NIN-l ;I-4D CONT.4INUE ;UNTIL YOU PEPC - T?-E EF-D THEN STOP ° Si ORA.Y JSR INCHEX CHP # C7 B.ED SIOGO CPY 4$80 DGO SBN tSI JP SIDG NOFO0 JSR XORCIIJR i ifI IfLOR F7 STO LD STR JSR LDA QUiD 44$ LO40iD LO' DO-ULTS STA TEMP5 STA QUI:if LOR 4$ ;;BLA...: TUT CU-RSOR ;FIRST 225 DEGREES ;!35 DEGREES S..j.. iE OSE FIRS!, HISSES ;THEN DO 45 DEGR EES TO0 Q15 S TA . ..I. -~ULT. .JSR FjOLOjOP LFi TEM 5 8312 600 72 .841 4:0 R315 8Ei 2 421 STA 6318 205662 631 60 422 423 JSR HISSES RTS 631C 425 __1 " " ENE H I DGO 402 03 40 405 406 407 408 409 410 411 41- r4-LY9 CPY O!1 S2E6 '710 7 62E8 4C2562 62EB 203b6 62EE 907 82F0 801772 62F3 900 82F5 801872 62F8 201565 j$3 ST, UID LDP #$0 STA LO U!D .JSR DOLOOP JSR MISSES RTS 389 390i 391 -2 62CC Q900 US0 AEAETS PLERSE BEQ BOTGO j NOFOO "tP 373 37 375 620D - BOTRAY JSR INCHEX CPY 4#$80 BNE BOTGO CHP #$Ct7 -p -p DEGREES -6b-7- 4-l T s ~~~~~~4 -- 6321 E C13 ;T~rT 4* 1 I$-4it i4 ci REGt I i T H ~ WT -N __. ti-rP I; IF fREFE 14F QT iFL4~ T"E iRlf FTE _ : I GCIDj 4:; F3C 4 44' I L4~ i T-4y F;ii.44 -FI N,- W 4.j 4' 4=;'&-- L44 6343 P Tnt 291-73 TA 6;345 E:FF3R7 ~ilL4 R LFI- + -T F4F F; 63%5 D440;7 J,4T 6;359 AT3F? 6 a9c R, P j DL T N TE RT l TP~I e SE Q i~~ 4 F,: 3;R21Q iTI; 7lT El :E1Ei i i 4 4m 2±_ Th__L ~ ~ yf.- 2! _0 T7 6 36q 7 -4 p-A,- -,~% T C ! ._'" Wi F .4ST S_9 L 1 TS ys~~~; TN -68- 4 3..-,2 2.---R E E,_ 488 489 491.- 6372 6._372 632 A 6372 6.375 203868 A56F BFEP JSR -RnE 40-E CURSOR XORCu LDiA STR!NG 491 1: -4 LiC . . .. = ZTtOR:. S.i . . . pE . S-,.; R--,. T ._ -, " . . FT 9AETB.-"_ . .. . . -p 492 ADC i FE 493 49;i 495 LOR. .:TF-,TNG+ ! 6~ 3 E4 E$i.C 18 8377 69FE 6.378 637A 8.5F,1-# .-I' 46 63E 91 2 1 DC ?-12 497498 500.- HOMbER FSTT .-P:-' sJSR 7CriZ' "'-irf4 E0, 6393 20 T0 I2 JR TEM" LOYT AC3772 20C263 2. 04wn 20E18 :-EE3 BOTTO LD0 @:FF STA COUNT J:E E8: r- 8507 8380 @1F1 6382 i72 63,94 ,806 6.387 637C 201iD8 A-20t3C 2 EP2f 638D .3A0 803;72 6398 639.-9 639C 639F 32 T .:;TRT 41 501 503 57 508 v ..SR -_Ni. JSR t-i-R. j R T E-1-- STr INC CO-U,DEC 1TC.,4 511! i..-7--_, 5NL!"_A f ia tHM '.THEN GET <t-. ; e- .- '- EOPtI BYTE,. _S 1. ~Ifl - fl- ; -:. ITI O i -,t-4FiFAS; N9 STRING STORE' OF RWTH:oF STRINF S'ETOR:E ..;GET -OR9X::POS :-:AtE IEs E%-N I --DE::X EUET N _tCOUNTER 0,0'j T #EM i.T. -i2 513 635 CES272 63A8 EE6i72 636B 83A90 83AF 6.381 6384 7-, ' 8386 63B9 83BC 63BE 00DF 99FF A21.30 2E 3 AYFF 20EE63 EE6172 515 54 FPILL •!LL 517 505 F,'R----- EF. L n i 450 LE STPU SH LDpiSR#.R INC C.4COUNT FILL 9NE 5:2i 522 RETU!RN TO 9:ASIC JSR OUTSERTS SET -U -OR STA T E"-. :2 G;SE T T :-:-E0S -i =;27 -: 6 CD 63C2 63C._2 63C2 6.-:C 803772 63C 2 AE9 63C:A 3AS 63CB 0L0' L: 63CD F1.37 5:;_= AN ( '..CO=,:,... 550 .=;, i F,.-.2- 63DB E-.DiE072:- 83 EI20 63E1i 63E1 63 1 _<P,'.E 0 BE f:ONLOP 540 .;-,R ! :-IE 547 :- NORH #AEMN NOr-1 P PDC OEY4 08 N-<',!il ,4.46 N LDA TER p 2 541 542 543 544 545 TO SH-:-S 7, 4 .5- ,." 63CF !8 63 5 AA 630703772 830 38 MEN, f 4 - jtmme, ,"--",-- 63D0 6946 6302 88_,. 6303 D€,.. '' JS-:R SCT-PUS:.-; DOEF 20G332 w3C1 1.4 N S; OF -, R E.'hI~ L'T'' $ *-; BTrCT .;jNE Tf-. OS, F-, . BEASE PAqGE OFFSET RTS TO GE O T TilTE r. H .. -69- 63E1 63E1 63Ei 63E1 ASC0 550 551 63E3 38 552 5991 63E4 83E7 63E8 63E8 63ED En3672 i8 553 605F72 555 54-9 A200 60 YCONU SE: SBI 557 558 63EE 63EE 559 560 561 562 S3EE 8106 h-,63FO 8506 63F2 38 564 63F 56 567 568 TEMP1 CLC 10C *k.0Si LDX i.0 RTS 556 E, - LOR #$C0 ;INUERT Y COORDINATF SO THAT ;IT LOOX NORHAL !E: ORIGIN KIT LLHS., LARGE Y AT TOP NORCiALIZE WITH SMPLLEST ;UALUE FOR TYPOS ;NO i .1 E51 63F5 9506 63F7 8002 * ,i 63F9 9D607 63FB 60 63FC T F iTrO f THl S' T STA ( DDRL1rX LDA ADDRL.Isx ;GET BASE-PsGE IDEXED ;LOnW PRT OF ADDRESS SBC 45$i ;DECREMENT IT BY ONE STA ADDRLL.X BCS STOUiT ;CARRY CLER? BORROW DEC ADDRisx ;FROM HIGH DRESS B YTE RTS -p 569 577 5,72 573 574 63FC 63FC -p 63FC 83FF 209560 209560 6402 209560 6405 PAO3F72 6408 300 i F,-' 583 640D 85CE 64i0 BiO6 6412 85C 6414 C 5-8 .-51 588 582 6415 BiD 61L- 585 .. L 6417 803672 641A A000 641C 1iCE 64!E 808!72 6421 C-9 h . L-;~ h427 .. 6428 6426 6420 8430 6432 DOMSG 584 585 586 -40F C 6422 81CE 6424 2080 JSRI- LF LF JSR 579 58i 640A 60S 64068 640B R4OiR!D $ CEG172 D05 CE3672 F006 209580 592 8438 60 643C 643 LDA PGFLAG BHI DOMSG ;PAGE, BECAUSE THEY LOO* RTS ;LiE GARBCAGE ( = CiY a GET. ESSAGE TAi F POINTER LOF (MTAB:~;SET UP MESSFAGE fiO.RESSES STA MBUF iNY LEA (HT0)NY HiGH ORDER ADDRESS STA HBUF+ IN9 -i TP-m L -' LD STA LDY P.LIN 1E LFA 3B),Y (HT TEMPI1 #$0 (MHBUF),Y .GET LINE COUNT (MBUF), Y CHqR -;GET Q CH RA:TER STA COUN T 594 595 iNY PRINT 597 598 600 AF1 6435; 4CIC: 8438 207360 ;ET RID OF OLD STUFF i-i-' 576577 58,16% 5.78 LOA JSR INY DEC BNE DEC BE@ JSR COUNT PRINT TEMPI MSOUT LF .JPP.LIFE 604 605 606 607 R¢-1 MSOUT -p -F JSR HAFON RTS PRINT IT ON H SCREEN iLF E, P INDEX FDECREMENT CHORPC.ER CUUN! >LiNE DONE ? DECREMENT LINE COUNT ETEP ETS . GET OUTTA HERE 4 LIE LNE ;TU ANOTHER LINE ,TURN ON TEXT WINDOW op -7060._ PUTPOS LDA Ch-.r. AD04572 SJSR COMQN ," 610 2014E81 TXA 611 8 LISR 612 4A TAX 613 AA JSR GETH 207964 614 615 LDA TE.",P2 AD3772 STA T'XPOS- X 9D5272 617 TEMPI LODA 903672 STA T::EXTX 9D4P72 618 6i9 CMP $2 C.' 2 BPL LATE 620 1000D CHP A$ 82! C901 622 BEQ LATER F006 207564 623 JSR TIMER JSR TIMER 207564 624 207564 625 LATER JSRT MER JSR TI ER 207564 626 LATE JSR GETY 208Ai64&4 627 LDA TEMP2 6468 A03772 646E 904E72 629 STO TYPOS,X 630 6471 8P TX ASL 6472 O TrX 6473 AQ E32 RTS 6474 60 633 6.4 TITHER INY k475 Cs8 1. ENEF T IHER 6476 DOFD RTS 6478 60 bt 6479 635 636 6479 637 S38 839 GET"X LOY 4$0 6479 P0000 G40 TYQ 6478 98 641 SEC 647C 38 6470 E908 b42 SBC #$8 STA TEM-P2 647F 803772 E;43 644 6482 A9FF LDi $FF STA TE-P1 644 803672 645 6487 2080 8.8 JSR GETPOS 648A Aq00 LDA #$10 6 .1 648C AC3672 iOY TEMP1 STA TEMPi _4 8F 803672 LORA TEMP2 6492 AD3772 650 JSR DUDE 6495 20DF64 R5 652 CPY 5 6498 c0000@ EQ HURRY 449C FOiC 653 654 CLC 649C 18 6490 6980 655 649F 20DF64 JSR DDE CLC 657 6i4Z2 18 AOC #$80 64P3 6980 659 JSR DUDE 64-5 20F64 64P8 AC3672 660 HURRY LDY TEMP.I CPY #$4 64-8 C004 64P0 3007 BMI FINE 643C 643F 6442 6443 6444 6445 6448 6448 644E 6451 6494 6456 6458 645A 645C 645F 6462 6465 6468 ;GET COjMMND THAT WHS TYPED IN ;WHAT CURSOR MODE? ;SAME AS OIU 3 ;GET X POSITION OF CURSOR 3 ;LOAD POSITION UALUES Y ;w4iT FOR H4FDWARE TO SETTLE 30 GET Y POSITION - ONE BYTE S kE Y POSITION UALUE YSfiE AS 'MUL ° TiMEOciT ROUTINE ;CURSOR ADDRESS OFFSET ON BASE PG ;SET UP COUNT LOCATIONS ;SO THAT EDGE OF SCREEN CAN ;BE P.CCESSED 3 3 NUMBER IN TEMP1 ANO TEHP2 >ZERO TEMP ! iSAUE OUERFLOW OF COUNT ;PLiT P ;PUT LO BYTE IN ACCUMU LATOR ;COMPUTE MHODULO $45 9T P !., RMII. G TPOS . ,AS ::I 5HATE TO DIU~IDE INTO $BP- 0 ;TNTCE TO GET FULL X POSITION 3 >CHEC+ POR OUT OF BOUNDS .; 66i5 6463 8C3672 6486 803772 6489 60 648A G4E-A STY TE P1i 68 667 F888 669 FINE STA TEhP2 RTS .CONUERTED X UALUES IN TEHP1 ;AND TEP2 -71- in 4t-;~ ii ~,, 'hS Y T : PG, T;FI AgRIS; I; 1;4. - -E ;, ft:iTT N i R ;: I- Ffi b N~i T 61 8DI~ IT#§ LTIA TE*' -i4T~~ I-. P84F44 4 H* t Y P-FLn-TU 1 t I-. 6 4C5 SF437-72 I.- W~ 4TT- TYPOlS HP 2 TN T -1 .1- R4F1;: * *~iz1 PFtc ~r4 If P1 b *-~ * -44 P I.- b TFfl&.U!: I4 k.. j TI j l N t-i-i-i~i i:,PI it", h 64E6 E -1mG 64E E --TEi72 8-H 8 EfNF: PS.LT J 64FF N * 42* I 64E F6 -p '.1,-.. I- *r~ N'- 4HiS -~~~'--~~~ R I- F fR T g HfiiT I-i -'I. -4A * ,X. y--J *-1 i ;t.- --7 ~~'1 L 'iJY : -P E-,51- ~L4N- '41h '-I 5 clV4 _i 1-4 Q=-9iR1 SI E,5i 8- n.9 'p-I T W-fL -;~I ~ ,, 0-1-T ~ ES~F i- ES T A r-*:N Iv ~ C U: Cli lijTP~r I ON -7273 6515 6518 6510 6520 6522 6525 SPUE CURENT . I DOLOOP JSR PSQU 6515 202068 6518 AD3E72 LDR iC:FiLAG . IS t IEL ADD.RESr!ITN 8LUFER F1U L 734 BPL kJ0 735 7-36 660 737. 7 35 JMP FINISH STA DUD ;SET UP' DATA: 738 739 ST 6528 A9FO ;NO NTSSES YET T ;INITIA' WINDOW 652A 8DOB72 740 6520 A97F C INDO1 l$7F INO2 1003 4CA865 900 803172 8DOF72 LDA #$0 FiULTS 741 STA LOA 652F 8D00C72 742 STA 20F965 20PC65 8C1072 205668 744 NEWPIE JSR GETDIR JSR GETRR 6532 6535 6538 653B 653E A01772 6541 AC C72 6546 C008 6548 D014 654A CE1C72 6540 CEIC72 6550 18 6551 6901 6553 2907 6555 801772 6558 6558 655E 655F 6561 EE1C72 4C3265 18 6901 4A 6562 290i 6564 F00E 6566 890870 6569 8010I72 85_6_C 891070 656F 8D1F72 6572 000C 6574 B91070 6577 8010D72 657A 890870 6570 801F72 6580 20965 6583 6586 6589 658C 658F 6592 6594 6596 6597 6594 892070 801172 891870 8D1272 P01772 2901 FOI4 C8 4CS8.R65 88 8598 8C1C72 559E 20088 5; 2 iZ 5 854 F0ii 65P6 D093 65P8 206568 65AB 60 745 74 747 748 749 750 751 752 STY -'OFF, . PIESEC JSR PEEK LDOA QUD LDY R9OFF 8MI NEXSEC CPY S$8 BNE DORAY DEC R~YOFF DEC YOFF P i53 NEXSEC CLC DO IT N.0, 8.giE TS LARGE W ;> LGET I T IRECT w nnON Ni USING HLF PQU.DRONT ORD ,::FOU i 'T - T OFFSET T-i I TLN TA.FBL R,ESTOTE :prD -, -c, .HCL= ,_.UADOaNT LiNE NUFER I N SERODEET TEN~ DO T0 NEXT NEXT SEMENT >" "? -<0 f'E.INT ALL SET, -R'P T-R. .GET SE FOR NEXT TA ,. ADC :li i AND $7 STAQ UID NC R.YOFF 3 754 755 75G 7e 5 ° '7= ONCE MORE, NITH PSSiON 759 -JMP NEWPIE 760- DORAY 762 CLC ADC "$i 2 TEST FOR EUEN OR ODD SEG. LSR AND :01 .0O0 SEGHENT, LOAFJ STEPS BEL Y'-CRD LOR MST R_,'STR MSTEP LOR Y'STQ!R,Y S.:TA. YSTE p BNE t7BULi-'P ;SA-E AS A .JUND4 .... l.. , 4;i LDW YSTR!Y.. Et..EN SEGMEN-, D STE-n. STA5T XSTEP 7 t'21 763 764 7574 =, 7C; 791 77 788 789 770 779 YXORD 782 774 775 776 777 778 779 780 78 782 QBUMP JSR ZSLL L0D FSTEPY ST LO STEP LT ISTEP-. :SE-T fOR STRT 0F L ._ STP XISTEP LDA QUD QNF1 - BEQ RAYDEC BNE PIESEC FINISH JSR PRESTO RTS i . Y S R" YOFF GO TNG? .UI - - DEC-:REMENTiNG FOR EUE I NCREMENT ING FOR 000 Q!Ui INY •JHP RADL:; 784. RQYOEC DEY 785 RYGO STY P'4AYO F 787 788 789 790 791 _P GET HYPOTENUSE E&YTES *T. rERUR DIS;TAN:. HiTH LINE., __ FD CENTRE OF MASS TEST F ALL SEGMENTS RE rirt#.E NO, DO0 NEXT SEGENT ;POP ADDRESSES 7 -73 Rthtfi4F 0I~ 0-I R ODD QUIDt R~ 5 J,1C lj . .77 EkJ-, i-,71 k a-~ t-77 E,5YC- RF T1I ~t-I- i.r r--:1 4.'1 7 f-i =-FL1: I L4 YLO.'D0 E'151 ~ f-f-'11II4*D __~~~ Yf_ iY *s; 2 ~ .1. SH . D MDJ N 4i. Ti -L. RiTS 1.P-4 75h j - ~ ~ ..- .t. iniY 1y772 5-P -. L-*4.4 -Iq f:Q4 Sr TQ ID LETE P-- STEP Cj ONT Y-S:TFP YRl - PT'; -, n~4 R4 *Tf Elf iTY 6 R -- 4. i; Cj i.4 1 tC-1 -S:j YDTRP Ll :-,h:- .1144 1 ,FIN- T' ...... R44 R-46 . f JN!-0T C 44 I1 Fi. 1 FrT T fIN 3 sN~ TP'i P nIPPfTIONS -74- 1 6E. I.-.38 6h00 6610 6613 8616 6619 6G1C 8OE7: 2 9900 80972 800872 800772 , 8D1372 80E72 900B72 661F 622 6625 t;28 6628 6620 662F 8632 6634 668837 663A~ 801472 00C72 801572 20437 C08O F20 20387 30F4 208-68SD3672 A 56638 663C 863F 6642 6645 6648 649 i8. 600772 8D0772 203867 20P0RC 18 800972 9003 EE0872 01072 C0i572' 30CC 854 858 STA MSS STA OFRPCT 84-3 LOA 56g Eg;F72, 66f9 _ 5_ 668 PSFF -60800F72 6670 A0@P72 6673 18 6674 600872 6677 3002 6679 A900 POINTS JSR CPY BE! jSR 955 869 72 A"E0072 600C72 800C72 60 800072 887 88 890 89!0 LC L-4$.--4 i wH-r -L .I4. T PDC n INANC_:E k IM -RTiON OI.fIER k-NOi-4, PFOST Ti.I INCREMENT HIGH BYTE CARY SET -° . ENO OF wINO ?uW.. OUiNC:E FION K7 ;Ne, ,;iS SLi "-ERi, OF Li TINANCE (kSS) IS, ± it tts- L::-_. r- HOLE IN IS .SULP THE M!SS COUNTER IT GOTTEN RELLY B HS ;DON T LET T TROLL ,OUER -8 II ? ' E-CALCUL.1QTE WTNON PFLACEMENT : - 1 8FI NEGiN NEGWIN ST4 OL-y O-&E POS T-N tUSELAST THERE CELL C. Nl r-. IIfzw 892 .1ri-iS 11 iNO1 LDA NHIDTH ,4 "CC ADC NI NDC2 ST 89 90 NDiMY2 TSETTSET STi TR4IEL I OP iNOT1 L: ! T'T i S L i ,E, S lNEEHNiLE SPATCH ;.H4 iIRST HIISS fN ;P I. p . ST i- 912 TNQT - 41'44TT 6693 8007 na6698 803172 F0C 6698 4 hf; L '4i POINTS hIASS LD ST4 FiLTS OONQ 88 -NU-iL N iXCAR -im" ' DI STAN ENOPT 8NE NONZER LDA DUD TSE T ' BNE a -NfkE INC FOULTS 8--E 000bi LOR ..$FF 88-. 8'-5 894 iN Y REGISTER OF PTIX ELS STiT FISTTJNR FFI r IXEL N-T--O 4 REA.1; h-.jI I.: ,C-,Tfs RBYTF Si '-t OP P'.ODUCTS ADD TFO LFiN :YTE DC NUMLO STA CC INC NIXCPR LDA CHP 88i 882 ICCU-RTE GET CLC CFI N f EUERY-THING FIRST. >HIT THE EOGE OF THE SCREEN '? WT BEAT Y.OUJR HEA AGAiNSTi P LL TO ;CALCULATE DiST.pNCE >LAST STEP, NEGOTiME OUT OF N:OWk ;GET LUMINANCE UALUE, 0 - 3 i-4TE JSR ,JSR GETDiS MLL 890 85 881 876 883 8C4 87 8788 8S-J0 P _SU MA--SS CTf I I [00 A STE '= MULTIPLICANf CiL. 8677 88 R74 8s27 873 8 4 '-'1 985 6680 600872 6690 38 "OINTS JSR GETt.AL STW TEH ! 875 86 C.M ;HATNTAINTS HESURE-MENT O.JER H N0if <EXPECTED NF CiLCULATES ;H0UNfStDENS ITY I NOUIS . I VLOCdT I OiN OF . RPYPNT 4480 CMPINO GETDIS . 8I H-'-' CifLC:LaT;-' -4N iN.TE.AT LiE, ;.Y FITIDTNG SUM OF LMIN-iNCE INTO iE SU Oii- PRODUCTS TERM STAI ENDPT 8934 667, 667E 6682 6685 6688 6689 INTFJDI STP LDA OPFSET SNDOU 858 959 Nr- 4j DRIHNiG ,THE LUMINANCE ALONG LiNE ALSO PCCUN:LATES P SU0 OF ; LU MI NANCE*O iSTONCE STP REFUND P00772 003C AD3i72 nF023 y NU45 STP NRi S- 664C 8D0972- 892 664F 6651 6654 6657 665 665C 665F 6661 6664 iDA =$6 895 857 wv -: I CM : TT ~E. 0i 0ES;I7T NIT--: - . ST .i.SDO ST SETP BEg! SETUP E fR. r ;SC:IP C.i CQI .UT -ITSS IS kISS UlTTINITS AlREPDY -7566.0 c0-972 914 66A0 20E36 66A3 AD03172 9 15 916 6-6P 917 8D00072 66P9 ADOB72 66C 8D01472 66AF A900 6661 8DOE72 66B4 205668 6687 200965 66BA 204367 666D 203867 66C0 30F8 66C2 CD0D72 66C5 30F3 918 919 920 921 922 92.5 924 925 926 927 928 66C7 2088867 929 66CA 6GCD 66CE 66D!01 6604 66D0 930 93 932 933 934 935 936 937 938 939 940 94" 942 943 944 945 946 947 948 949 6609 6606 660C 660F 66E2 GGE3 6GE6 66E9 66EC 66EF 66F1 66F4 66F7 66FA ADOD72 38 ED0872 803672 A920 800C72 P908 38 ED03672 8D@00872 60 8D2E72 20CF6C 8D307'2 AC0872 F029 A03172 8D2F72 201E67 CE0872 66FD gFFF 6702 6705 6708 670P 6700 6710 6713 6714 6717 671A 671D 871E 950 DOFR '02E72 95i NONZER LOY N, Ni 0 JSR LDA STA SETUP LDA STA LDA STA JSR JSR GETLOC JSR JSR BIGDIU DUD TRAJEL WINDO! OFFSET U10 REFUN0 PEEK ZS-..LL RPYPNT GETDIS BMI GET LOC CHP BMI OOTTER JSR LOA TRAiEL GETLOC , SLAUDOT TRAVEL iN'Oi1 TEMP U$20 WIND02 #$8 SEC SBC STA RTS BiGDi STP JSR TEMPI WINDO1 DGSR DIUT WO STA L DY BEQ LOA STA DIVLOP JSR DEC REH NUMHI DIVEND DUD TENOUD PARDIUV NUHHi ;TRAUEL HOLDS DISTANCE FROM START ;OF WINDOW WHERE LUM. DENSITY IS ;GET WINDOW DISTANCE FRO CURSOR .RFi;NO IS APPROX. HYPOTENUSE ;RESTORE CURSOR ADDRESS ,6ET LINE PARAMETERS ALONG IINE UNTIl WINDOW ;IS HIT, THEN COUNT TRAUtEL !S DISTANCE ALONG LINE = TRAVEL ;NO, DO SOE MORE ;ADDRESS IS HALL ADRESS ,fOUE ;SO IT IS CENTRED BOULIT WALL - ;FDOES A TwO BYTE DIUIDE JA=DIUISOR, Y=DIIDEND ;SPUE REMAINDOER ;iS HIGH BYTE = 0 ;SAUE IUISOR FROM iP ;IUI FE ;DIWIDE INTO HIGH BYTE=1 DUSR CLC 571 972 973 974 OCAPTN HNP DIULiOP LD AC3072 CC2272 3010 20C6F0 bu02r"2 802F72 803172 60 00i F..iT7IE TO GET EXPECT ;OF MAXIMUM LUMINOUIS DENSITY RECALC UL ATE WINDOW4 SBC STA LDA STA LOR LOY REM 952? CPY DUSR 953 954 BMI DIUVEND DiUTAO jSR 955 STA REM 803072 956 LDA DUD 0AD3172 957 CLC 958 18 PDC TEhDD 602F72 959 STA DUD 803172 90 AD03072 961 DIUEND LDA RE RTS 60 962 983 964 OFF FT!E I PARD IV LOY .$F LDE DUSR JSR DiUTNO SEE: 67340CF6 6720 AD2E72 965 d723 20CF 6726 3 667 C 968 ADC 6727 "D3072 968 PWN i-4UF REM i, 8720 803072 672E 6731 6734 6737 i DC TEMODJL. STA TEhOUD STA DUO RTS AREMAINDER LARGER THAN DIVISOR? .=YESDIVTF6 THEN-r- TOOl' ;REMAINDER OF THiTS DIUiDE A FRACT. ISUM DIVIDES S ,SC=F IN FUf .r.INTAIN ESTABLISHED CO -WUENT I'ITF -S DIUISOR j7NiTFST, BUT IT INTO CARRY 4ORX F -F B S > ,-,I . ION -76- 8738 6738 975 97G 6738 8738 738 977 978 979 6738 6736 673C 673F 01472 18 600E72 801072 8742 60 980 98 982 983 984 6743 6743 6743 A1E72 674 FO2E 8748 A01972 6748 200069 R74E C080 F. 6750 F10 6752 CEI1E72 6755 0018 6_57 A01F72 675A 8D2072 8750 AD01972 6760 2000D69 6763 C080 6765 F008 6787 P01F72 985 98G. 987 988 RAYPNT LOA XFRACT BEQ FIRST 989 LrDA 'OIR 990 JSR NE-TX 991 CPY #$80 992 BEQ RAIYFN 9-3 DEC MFRACT 994 D:P '%-19t IN 9C5 RAYF BNE qqR LO YSTEPT 997 STP LDg YFRACT MOIR 998 JSR NEXTX 99S CPY $80 1i000 101 0 BEQ RAIYFIN 1002 LDA YST EP CHP ,-STEP 1003 9i04 BPL OFFiNC 1005 RAYFIN INC REFUNOD 1006 LOA OFFSET RTS 1007 1008 YFIRST LDA YIR 1. JSR NEFTY rpy ±$80 1010I 676. CDi172 8780 676F 8772 6775 6776 6779 877C 102E EEOE72 0D1472 0 AO!A72 20548A C080 677E FOEF 1011 6780 CE2072 6783 0OE 8785 A01DD72 6788 801E72 678B 1ADIA72 678E 20546A 8791 C080 6793 FODP 8795 AD010D72 6798 C:DiF72 879B 3002 6790 0AD1172 870AO 18 67Ai 6D137,2 7A4 8D1372 67A7 AD1 272 7AA 6D1472 SG7 T1 47 102 1013 1014 1045 1016 1017 1018 140 1020 1021 1022 1023 10 24 125 1026 1027 I028 2' hfF G780 A:9FF GF82 4C0F67 765 800E72 87B8 6788 1930 1i 10321 1933 !034 6788 1035 I GETOIS LODA OFFSET CALCULATE APPROXIMATE -STANCE CL ADC REpUND STA D!ST'N' RTS ;RE iNTTS OPPROtXIMATION TO ;DISTANCE ALONG HYPOTENUSE hOUES ALONG THE LINE ;HNEN YSTEP IS DONE. MFRACT >iS ZERO 1iS-NGi STEP !N X DIRECTION ;HIT EDGE OF SCREEN? . OECREMENT STEP COUNTER ;TlL RAE TA sA CHTNGE DQTA BASE FOR Y STEPS ;. r-4 OR1NRS TO TESF STEP LINES ;H!! EDGE OF SCREEN? ; ;-NEW HYPOTENUSE UALU E? ;REAL DISTANCE IUPDATEO EUERY TWO' ;CORNERS ;APPROXIHATp nFISTANCE ALONG HYPOT. ;DISTANCE FROM CURSOR TO LAST ;HYPOTENUSE CALCULATION 30O Y STEP BEQ RAYF!N . EC YFRCT BNE RAYFIN ILO" ISTEP STA XFRACT ,LD_ YDIR JSR NEXTY CPY #$80 BEQ RAYFIN LDA MSTEP CHP YSTEP RHI RQYFIN OFFINC LDA LOSTEP AD0: OFRAE:T STA OFRACT L. A HISTEP ADC OFPSET STA OFP-,E T LOR =$:-= STA REFUND JHP RAYFIN ;YECREMENT Y STEP COUNTER ;ADD UP tDISTANCEi ;USING TWO BYTE SuM, LOH iBYTE IS A FRACTION., ;HYPOTENUSE IS GIUEN AS A ;THO BYTE, FRACTION AND ;INTEGER QUGNTIT ONLY INTEGE PQR T OF TCALCULATION ;i 1- HLL.UL. T I ON -77- 6788 6788 678E 67C1 67C4 67C7 67CA 67CCO 6700 6702 20376C 1036 805272 201268 B 4E72 201268 BD4A72 201268 EE6272 0005 A080 1037 1038 11039 1040 1041 1042 1043 1044 1045 6704 SC3E72 046 6707 B04f72 1047 SAUDOT 67FB 4P 67FC 67FF 6802 6803 6806 6808 803972 BD4E72 4 CD3972 1006 BD4E72 6808 805F72 SUOUT INC ITCNT ;BUM P BNE SUUTT 3 BUFF R FULL? HOLDS 256 SETS LOP TEXTX CHP REXT XBYTE 'NP YBYTF LOA TXPOSX CMP XPOS BPL YBYTE STP YPOS COMP 3 6812 6812 6812 A000 BUSH 6814 9118 1075 6816 E618 1C07-6 6818 0002 681A E61C i81C 60 1177 1078 1079 68D10 6810 681D 180 080 182 $ 6810 6810 A000 681FPA51 183 1@584 3 JSR :MUL ;PUSH ADDRESS ON POSITION BUFFER BNE BSOIUT iNC BSOUT BOP RTS UFFI+1 IFY @$O LO BUFF 188 189 BCS BGET DEC :_U ;POP ADDRESS OFF POSITION BUFFER ;CO:MPLEMENT OF PUSH ROUTINE t1 LRT tSE F;: FITS 1095 1096 3 ;RESTORE-NORMAL INDEX LiY #$0 STA (81UFF) Y !NC BUFF SEC SBC #$1 STA BUFF 1094 ,STIL L LOCI*ING RTS 72 1073 1074 682D 6820 N LO YP.OS LSR STP.TEMP LDA TYPOSX LSR CMP TEMP4 BPL COMP LDA TYPOSX 107 1093 ;STILL L 3 STA XPOS YBYTE 6812 6820 ;FIND THE SMALLEST X AND Y ;POSITIONS FOR NORHALIZiNG STA XPOS 067 682D IOT COUNT inq TXPCSpX I170 6826 8002 3 BEQ XBYTE BPL YBYTE STA NE:T 6812 6821 38 6822 E01 6824 8518 ;ON THE CELL STAX STY CFLA 1060 5 !086 87 JSR BUSH LOY #$80 1061 1062 13 1064. 1065 1066 G80E 20386C 1068 !069 6811 60 iN1,EX"S FOR POSITION U.ILUES ;PUSH POSITION UjLUES JSR BUSH 67DF 1017 1050 67E1 805E72 1051 7E4 805272 1052 67ED BD05272 1055 67F0 CD6072 1056 1057 67F3 1003 67F5 806072 1058 67F8 AD05F72 1059 OIUT LOP TXPOS.X LOA TYPOSX JSR BUSH LOA TXEXT,X 670A CD5E72 1048 1049 6700 F00E 67E7 8D607 1953 4CF867 I7EA 1054 67EP 41-irI:7I11 .JSR -78- PSUiE 6820 20376C: LOA JSR LORP JSR iDP JSR JSR LOP JSR LDA JSR LOP JSR 6830 804A72 6833 6836 6839 683C 683F 208E68 BD4FE72 208E68 805272 208E68 8842 20386C 6845 e5 7 6847 208E68 1102 1i97 i .i99 i98 1100 1102 i103 1104 1105 E506 1108 684C 208E88 !i109 684F 0BD5672 1127 li3 6852 208E68 1132 684 6855 60 T<EXTX PUSH TYPOSX PUSH TXPOSX PUSH XHUL ADDRHX PUSH ADDRLiX PUSH MASK,X PUSH 688E 688E 888E 6890 6892 6894 6896 6898 A000 9119 E8i9 0002 E6iA E60 6899 6899 6899 A0000 6898 A519 i-- -4VIM 68A2 68A4 888 68P8 8002 E61A 8119 6@ F RTS 1i12 F 6856 11136 JSR PRESTO PEEK 6856 2068588 1114 LOY #$6 6859 A006 !16+ INCLOP INC STAR 11IF; 8858 E819 BNE DECY 6850 0002 STYX+! 885F E81A 1147 1ii8DECY DEY 6861 88 11 I.1 iNCLOP 6862 DOF7 WE RTS 6864 6O ii !1120 8865. tR $ 1123 6865 PRESTO JSR POP 8865 20'9988 1154 STA MASKX 6888 905672 1255 JSR POP 8868 209968 1126 i1-.7 12,S A 00RLi,X ST 686E 9506 1135 ii!9 JSR POP 6870 2099 88 !1128 1129 STA ADDRHi, , 6873 9507 JSR X OIU 6875 20376C !1130 JSRF P OP 6878 20996 1i.1i !132 STA TXPOS.X 8878 905272 ii33 JSR POP 687E 209968 1 134 ST4a TYPOSX 8881 904E72 1135 JSR POP 8884 209968 1136 STA TXEXT ,X 6887 904q72 ii 37 88A 203BAC: 1138 6880 60 =SGk.E ROUTINE FOR CURSOR AORESS, ;PUSHES EUERYTHING ON CURSOR STAX -pp .F ; CRT -FECT -S# ADDRESSESI IRES P IOF BUT DOESN'T >CAN BE CALLEO ANY NUMBER OF TIMES ;POPS THE ADDRESSES. Nl POSITION ;WORDS OFF OF THE ST*4 F F ;iCHANGES STA+ POINTER Y F E RTS 1139 11i40 I14 114 k C"C'',,DI PUSH FPOITNTER , * 143 1144 i145 11 48 1147 1 148 11 49 !150 LD~Y PSOUT IT P, POP 4.Va IT4 (STI)> INC STX NS PSOuiT INC STX+1 1152 RTS LDY LOR 4$ STAM 119k 1i 54 11i55 !1156 PGET i1i57 8CS PGET INC STAX+i LOR (STAX).9RTS SBC $1i ,RETRTU I ANDI,RESET POITNTFR -79- 158 159I i1 68P9 160 161 162 163 164 881 [4E7 ,1 1 165 68A9 689 i !6 i .6HA9 I! 68A9 i 68F9 Ii167 68A9 68A9 A00! C4672 68C8 68AE 99.-72 I1 168 6881 AD4E72 i 169 6884 994E72 ! 170 6887 CA05272 1 S171i 68BA8995272 1 172 !7.3 1 6880 60 1 174 68E 688E i 175 1 17A 8BE i 688E i177 7R !1178 688E A900 6BCO 803672 i Li79 !i80 68D3 9507 68C5 803772 I 184 6808 20E188 1182 68CB 0E3672 1183 8SCEr03772 1184 6801 4960 1186 3803 9507 i187 6805 20E168 6808 A03772 6808 9507 6800 AD3672 1190 68E0 68EI 60 1192 68E1 1193 1 194 68El 1i95 68E I SSA--4 GETUAL p - PTa N PTRANS LOY LDY TXEXT -p LOP -p 1197 1198 68E3 305672 1199 68E6 F003 68E8 EE3672 1200 1201 68E8 60 68EC 1202 1203 6BEC STA TXPOS. LEA STA IA STA JSR ASL LODA #$0 TEMPI AOiDDRHI! V.. TEM-P2 REAO TEMP1I TEMP2 ,GETUAL READS THE TWO GRAPHICS ;SCREENS AND FINDES THE PiEL ;INTENSITY UALUE ;ZERO INTENSITY p ;GET HIGH PART OF PIXEL ADDRESS ;SAVE iT REAj PRHIMARY PAGEF ;SHIFT PiEL UAJLUE, WEIGHT OF 2 XOR 4$60 .STA JSR LDA STA LOP RTS READ 0SECONOARY PAGE ADDRESS ADDRH!zX READ TEMP2 ADDRHi X TEMP1 LDA (ADDRL1,x) ;READ SECONDARY PAGE ,PI:EL INTENSITY VALUE ;GET PIXEL P-0 ITS NEIGHBORS YISOLATE PiEL .1 BEQ BLCX !NC TEMPi RTS -iS IT ZERO? ;NO, INCFREMENT VALUE COUNTER -p 12C-4 EC " 68EC 68EC 68EC 68EC 68EF 68F1 68F4 68F6 88FS 68FB 68FE 6901 6904 T''-OX-rI ry~STA THEXT,Y TYPOSY LDA TYPOS TXPOS RTS 68E1 886 41s5F. PAie RRE! ;TRANSFERS POSITION WORDS ;FROM 0 INDEX LOCATIONS ;TO 1!iNDEX LOCATIONS, ;SAVES CALCULATIONS TIME 1205 1206 1207 803672 1208 1209 8507 803772 1211 sc 4960 1211 9507 200769 1213 P03772 2007 9 1215 A03772 121 6 1217 9507 12i8 6906 60 -pU~ STP LDA STA .OR STA TEPI AODRH1,X TEMP2 #$60 CSR HT TE LOA JSR LDA STA RTS ;SAUE INTENSITY UALUE ;CALCULATE SECONDARY PAGE ADDRESS YDDxis TEP2 WRITE TEMP2 AODRH1,X .;aRTEL-4E GHT 1 BIT ;iRITE HEIGHT 2 BIT ;RESTORE AODRESS I. 0 'Z,' 0 I-LL-L: Z: LL l , .2 0 (f.!,Li. I-. j C ,1:: .. .. J CL. ' -if -s FC .a ... ::: F- C IL .. '.H"': :' I-- .1"% ,f # : - 3% 9% 3% g .:.. 3I9 oll1, I9 3a g 3ot 3s, 3% 3%s* s 3I , o 3% 3O pgo i:n J.1 3 33933% 9% % 39 3 , cx.I a:*,00 I 3I # "_J % 3% 33 % 9 ,v- (3J , rn .. ,,i r, .-. ,::o :r e:..I r, r l,: m I'9 th: OJ J .J N9.J ,J N ro -.s'F6 Lri'Irc iro i:,r.*' 3 . O.J.. J37.J ,' I '7.(3J N J I ..,:,. .I -r ..... .-r 1 4'4* -"3.f" r* -- 31 .'.4 4:::: 939 9%v 3% 39 . 39 9% 9% 9% 4 4 I 4 4 4N N :,, .I1O O J9. 9- I ,. 9d ,.-4 -' ',t " -"," I -I 1 ' ' -... I "" .. .,( 3 .LO'- F - I(.. (. :'.1:C oi I.L Zz: z r C E,, .. ~3~3i 33~33.3 ... IT i '.: , , . Lit' '.I' ,:.I,.£ ,., " i •r- -,.,I 1 ci: .- . 4t'' r-I (.. (:ii::1y 2 : (j- cc (Xi 3%cc '- r ef.i ':'-,s:-J..4. "r-'I CL:] - .2: cx: $1% % 9% 9% 3%i -. r . Cr l. E G 'i '' iS ,:,,S , ,3::.,: 3 , T. ,T , £CO '.I' 3I' C"IC t C0 ... ."': _I T-. Ci r s :r ,*::: 9. o N ] I -.1 '.., r .. I (34 7 73.3f5 '1.1 .I,' r'I.(' ''I p~'r11-. Lf'.,,S ~ 9% a ': C D cr c1:(::IT I I': I - ' Ci : CICl . .C ' 2 cc1 (i Ti Z'i C.,"i 4"L.j.: 1 ': 1 1l CI :4:C:.1:'... ,:I : c: I N:j O .. ,: ' n cf£ ,i 3..:C I-,,*.-I *SI X ...' '.. F. C: a ' ( c:s ... :c 1i. .. , C :c C:C c: (ai: ,:, C, fr - . X9 I.. 939 I3 7: .zJ X ".. ,.', '2.::'.1. ,Fr'I.." ::,: ::.:::II.-j . L--- :. 93, *Z:: -.< oL .'1 '2'1 " .: ...... - 1.3.1 1..I 3%-, 9%, 39: , it I.' r":I 3% 3% 3*~~~I I. g-o LgI ,1Y0 , :S-1 :r',J 3 is,3 1% 1~~-~~ U.l. -.01. a--' iZ: c. it,11.1o FZ: F-n I-.' Li.., fi..;< 7_ 11. 'O3-i 3% .-.. IU... 0 L: ,..:l a: L'L i '2: >. C,I'-" I±2L.I U-1(j " 3%l 339 W Cc, LL. co 3m 9%n ,,, 9%l 9%, 333 LL Cl a T I' i-i :C' .I I L-IJ "' I. I.. : L.JJ ... I .I tc :l L ...,l - I1J _'1-.J Li: cci ttL ii ,..I .J a..l -' C'. i3 . O,J .. ..: . ,, p'.l* .*.4N-I .'..rI (3.I -1 r*.I.-. -r-4~...-r-I-i ..r 3l-P4 .-- .93 -r4 v3 I .I -"-,Ic ..lr. C r3 733 ,%. a(. 0 :' :t N 9.l r%.. N . LLLL i 1. 1 ,I- I *!5) 3'f IS i ', ' 11, , Is a . 9 UI i.y It113 -4 'Zr' f5I 3I( It' 3 C1 IS5 D a.. 1 L.1.. 1M .3 0 0 C'Ti CI 'a:2 . CCO aT4 '2 i-] L 1s' ut ' c.I:1:C1 cI:i CO aCO CIL L w Ij 1,. No '.-N 0(.- '. N 4..N. N..r,-.. r-- N (... ' a'..:I 0 C..) - .3. . UC.. ' U3 S '. 4 ' c'1 C10 'a: '2. '5' '79.3 91 ,Si: .9 - i-4 1-4 . -3-q V.. 'r ,r-: 13 ." 4 . 4 1" i , 79. ,7. ' ,7J .7.I'79:, (: 0 ..I .%,1 .3 c mr rI,'), r:r, ri 1, 1 1OJ ,.J oJf I 0 ' .3 (N a. 'j, "., '.. Il1 I'341I 31079. ( 1..TI", . '(.0 (. ,. (,%j I(IX ".J3 .i 1r Cr T, ( 1 C :, '.7 1:7.1:'113 7':' '.3.I Cr 1' 7. " ' i 1. 'i. . ' il IrI I7. :t' i3r3 7.I17.:7 1 r. rt i i. 7i. 3,.1 '(- c1.c'"0 C:i ' .l : is, f' ' C 'Zr' a.' Cl 373o'i 3. . l 37D'7,C 17.Cr' 'Zr 'Cl',,Z ,0'C(C(D I' Cc'(i r' r (ia 'Zr aC Ccl(( l i:. '.:' (,I ,CLI ',I ,t (i C, . .3 i..(34 i.i ,,. N :.c' L94( :o " Cr',; . G.. Li IS3 is'.1 ii -81- TPT 1 -021 692 jP t-4 1Y i-I i O ;~5UuN~0? RLTC-4 TO ;RnOTnHi RIG3HT CORNER 41iF_7L1 LTA 1 4L -4 44_ 1 .R - D5 EsF 6 95~ E-;R'. 1 2 i -7-C .~9 4 n L 'S iDIi.;I 1-2 1 i"-14 T PC', L4I i 69J3E3 E495 E _e,72 12 b~I !L4 :i:t l Q, 43T TYPOS fulI t -a41 ,jj.4 R ~e. 1r - ? Il~i 174' 199 7FR ~li:c i En HPi _QY PCQRT :I~ MF.4 TN im4 ±I RI H;~~ 1-: 7 D AS &LEB i;P .C LclvT~fl-, EY TFS i-i I fc75jv A 90-312,;_!;9i4 Aci7 QDRESS WI R E_. Pf HPR nlir4I L E;i@44 1 ,e- 1707 13 IM2;6 69 S P- 2I4-6 69 1 1 . ~ I.,M1WT Fl.JO Ti-.. 4-0 LW 11 =_1 L 4TiIIr _1-A, LIP..ra 4,-.FF. a ~ - N +-oTS. ~ 6994 Pi- T IPh~4 r-: 6E, A I D 04 I ;SzLL L'4-Y HiI 7 -- tf '. 6 A19 A R1337 mn- E,9 1GCC pt4~ 3, -_-'P 1 l4 1a:7 nfa"4 I .4.:jj l-* 41 H. om; ;oEiT3 N..EX:T 1 INR S;TQ.RT QnrFiRs s n F ;LHI !nToc, *~P i:TS i- jx\TY f aP -y Bi-T -4' 44i4~ IN4 T -4i T 6c~ 9_9 4 TW nRS, CH IT SLPS- DaR:$ 1 MIiJEI OIL 141~FY BF HtCl)E2 -4 -8269DO 1i341 69D0 1342 6900 8900 6903 6906 69D8 6908 G9DD 69E0 803672 AD03672 303F 1E5672 3018 20376C FE5272 1343 1344 1345 1346 1347 1348 1349 1350 NEXTX 89E6 C946 89E8 3008 1352 1353 69EA 69EC 69EF 69F2 69F5 69F7 69F8 9FP 69FC 1354 1355 135 1357 A900 90D5272 FE4A72 2038C 0000 60 B506 297?F C927 UNDER BMI JSR INC LDO CMP XOUT OER STA INC JSR LOY RTS LDA A4rD CHP AODRL *$7F *.27 6000 C94F7 1364 R ChP #$4F BEQ FTPDO CHP #077 BEQ FTPO 6P14 P080@ 6A16 601 1373 1374 6I17 5E5672 1375 P1 9020 6A1C 850 GAE 297F 13 76 1.7 1378 6A20 6A22 6.24 64-26 6P28 1379 13-R0 1381 1382 1383 C900 FOil C928 FOOD C950 8A2Q FOE FTPi LRGS BACJ 6P35 436 6P39 A3C 603F -042 1389 1390 1391 1392 1393 38 3E5672 4C146A 20376C DE5272 10'E 139a *$i MASKX ADDRLi , UNDER MASK, : #$80 MASKX MUNDFER 90DRLiM . 4$7F #$0 STPD CHP . $28 nEC PDDRLI 6_2C FI 6i 1385 13 , 6A2E AS40 6A30 905672 1387 138 LOP STA INC BNE LSR LOY RTS LSR BCC LOA AND CMP BEG BEQ STPFD CMP #$50 BEQ STFPD 178 6A33 000-7 STPO MUNDER LD9 #$.ip, STA MASK.,X BNE HIUNDER SEC ROL HASK,X J;-fP LRGS JSR '- I , XPOSX OEC T BPL MnUT •STA 6053 60 1401 .ZERO IT ;AND !NCREt-ENT .EXTENS!ON OF X ;pESTO,'IE I I-X ;EDGE OF SCREEN NOT FOUND -ET iLW PORT OF ADDRESS ;BECAUSEP£ HTS IS TWF P PT .THAT CHANGES HITH X P ;TEST TO FIN WHAT UETICALP ;BLOC* IS BEING ADDRESSED Y 2 ;NOT AT THE ENO OF A LINE ;SO BUMP THE LOW PART OF ;ADDRESS ;END OF LINE ;SET FLAG .;SHIFT TO RIGHT TO TO LET 1OUE ;CA:RRY SET MEANS OUT OF ADDRESS 2 I ;TEST FOR BEGINNING OF LINE .AT EACH BLOC* ; ;-NOT AT ENw OF LI NE, DECREMENT ;LOW PQRT OF _DE r-NEW WORD 1S ; -.. MRS+. ?? $ ;RESTORE HAS* AND SET iERROR LAG _FI "<LiP PO SITION BYTES T:'".OS-X .':: 8A49 0E4072 1397 6A4C 1004 398 GA4E 20386C 1399 1400 6A51 P080 ; TEST FOR OUT OF RANGE TYPOSX TH.EY'T,• XMHUL #$0 BEQ FTPD 135 1366 1367 1368 1369 1370 1371 1372 ;SHIFTED IN TO SIGN, NEXT AODR Tn.. ;BUMP X POSTTION BYTE ;POSTIONI . LDA #$0 1363 FOOD C97: F009 0901 9D5672 F606 DOCC 5E5672 2 OUER XDIU TXPOS,x TXPOSX #$4 89FE F0!1 6A02 6A04 606 4408 GA0A 6AOD 60F 6A11 ;SET SIGN FLAG ;NEGATI VtiE STEP E;MI 'TOUT 1358 1359 1360 13681 1362 _;.SAUE STEP DIRECTION TEMPi TEMPl B.,C.J .S t-.... rSL H.SK, X I05272 1351 69E3 STO LOP BMI Y BPL XOUT HUL JSR LOY #$80 RTS ;THESE INSTRUCTIONS PRE ETRANEOUS & NEEDLESSLY ; EXTRPNEOUS~ & NEEF"_ESSLY ERBOUS UERBOUJS -83- 14i;;1? 14119 P- F4Ft R: -I TF44 __ 11- ___ 1 1 OR 1; ;TI -~nF 'M4 T~p L BI E.~ p ti % N -TEST 14 17 - ii FflIR iI- - 4 fn t- Lil ;l:-' L AE TE-i:" I~f T CF THE i i4 r-ff-i j-, I.. tii PD $: 17IrT Fi SCw c.T.i nT.- in RB FT r C.11 4 ' 7, 6W78 iR 7 'M7. P7 R C.A84 ii- ,;F:-r T FiN *~ 1C E.4R A 8-E -i-i Try.-r. 49 T1-4 Fi 474 4 i -,6, t-:t-±.14 6APR-FI R C-.P3 TO -- I4 I±M.4 47 1 4F SECTh LDP- T-r';~1 FLCJJD .Ti- TEHPI LLD4 Tt-f F2 ;4!Fi 01- 145 I$iFi -CFT ~NR1-- I 1.447 --- SQ1 I T. 1493 6!PEO FF4i7-2 145=8 ZsB: 1499i 6AF3ici InR IH LOY #$0: , -3--, 6AC3A -- 1 ' f jT~ F"ir:C TB @I9R 6P -,R 143 4: 6FS1 D PL 434- - Rc A3-79 o i-* n-. &P 7 5 AID3_ 4tn I ffqF,~l _ _ ~!t ~ TFINF BT tYT TB f- -84- 6AC8 6AC6 1464 14465 6ACG 6PC6 6IAC6 RACF 6AC6 146E 14678 1466 1489 1470 6AC6 B507 G6AC8 ACBE 6ACC 6ACE 8AD1 1471 ;BACK OES THE NEGATIUE Y9 STEP ;IT IS THE COMPLEMENT OF LINER ;AND MOUFES CURSOR UP BACK 803772 1472 A8 1473 8506 1474 8D3672 1475 29CO 1476 6AD3 0010 1477 6AD5 6AD7 6A09 ADC EADE GEO 6AE2 F C020 0000 A03672 293F C928 19003 A080 6AE4 60 GP4E5 1478 1479 1480 1481 1482 1483 1484 1485 03772 1486 86AE8 38 1487 6E9 E904 1488 6AEB AS A.EC 2920 8AEE F004 1489 1490 1491 6FO 98 1492 6APF LINEX 6PF7 18 68-.F8 691C ADDRH!,X TEMP2 SILE QODRESSES, BECAUSE THEY LO T ;WILL BE MODIFIED 1 F ADDRLX TEMP1 #$CO , LINEX #$20 LINEX TEMPI #$3F #$28 L INEX #$80 TEMP2 - ;IRST TEST FOR LAST LINE TOP LINE ADDRESS GET LOT PTDRESS - YTOP LINE, ;i.E CAN'T GO ANY FURTHER IP ALINE IN A BOX BY SUBTRACTING $4 #$4 TcY 4C1F6B 1493 6.F4 A03772 1494 LDA STA TPY LDA STA AND BNE CPY BNE LOP AND CHP BPL LOY RTS LOA SEC SBC BLOCK 1495 1496 AND4#$20 BEQ BLOCK TYA JHP BLOADS .._ LONG AS ITS NOT LESS THAN 20 ;TEST FOR SIZE LOP TEMP2 ;HOUE UP TO NEXT BOX CLC . ADC #$iC STA TEMP? 6AFA 803772 1497 ; MOVE 1S DONE OERTUE NEXT BOX AODRESS JS90~E IT T LOA TEMPI AF1D AD3672 1498 6800 38 6B01 E980 8803 803772 6806 0AD3772 88 9 E900 6808803772 1499 1500 1501 1502 1503 1504 GBBE C93B 6818 0018 1505 1506 6812 6815 6817 6B18 A33672 100B 38 E928 1507 1508 1522 1510 LDA TEMPI BPL BLOADO SEC B1A E13 GBIF 6622 6B25 6627 1E21 GB2C 882F 6832 6B35 6837 6B38 803672 ASI3F 803772 A03772 9507 A03672 En1 20376C DE4E72 20386C 000 60 1511 1512 1513 1514 1515 1516 !517 15if 1519 1520 1521 1522 1523 STA TEMP1I LDA 4$3P BLOADS STA TEMP2 SEC SBC STA LOA SBC STA CHP 01!X L1 #$80 .TEMP1 TEMP2 #$0 TEMP2 #$38 BNE BLr D SBC #$28 BLOAO STORE NEW @DRESS DRT OF EVERESS ;IT CHANGES BY $e@ OUER ;EPCH BOX ;8ORROW FROM4 LOW BYTE ;USED UP TwIS OX? ;NO. GOOD ADDRESSES F ;GO TO NEXT SECTION ;NE HiGH OPDRESS LOA TEMP2 STA ADDRH1,X LOA TEHMPi ;S4:UIE PODIRESSES 4104 ADDRL1,14 JSR KID i FEC TYPOS.X JSR XMUL UPDATE POSITION WORD LOY #$0 ;.iJUST IN CASE RTS F -85I I - 8B38 -838 6838 GB38 683E 8841 6844 G848 6848 B4A 684D GB4F 8852 8854 6B57 8859 6858 203F6C 8D3072 202068 AD3072 C904 1011 A9FO 8RD2872 AS0F 802C72 A900 802072 FOll P9900 8D2872 685E Ae9FE 6860 8863 6865 668 6B6P 686B 6B6E 8870 6873 8B78 6879 6B7A 687C 6B7E 6880 6882 8D272 A901 8D2D72 A904 18 CD3072 F0@E 2E272 2E2C72 2E2072 18 6901 00fEC C93 F029 1015 6884 A qF 9 6B8G 6889 6BSE 888 6880 8890 6893 6896 204360 C080 - : FO!E 20826C A02872 20EGR66 4CAB8B 6899 R907 6B9B 689E 6800 6E 2 6BA5 6A BAB 6E2PE 6BBI1 6884 6896 w -- . 1525 20436D CeBQ F0O09 20826C AD2072 20E668 205668 1526 1527 1528 1529 15z"''9 1530 1531 1532 1533 1534 1535 1536 1537 XORCUR JSR LOCFTE STA JSR LOA CMP BPL LOA iiF SECOND 4t0 THIRD 60O.0 FIRST i.FE SECOND #$1 THIRD #$4 REM BED FIN 1549 ROL FI R.ST 159w' FIN 5E 15 1559 1560 1561 15b*--2" 1563 158365 1566 DONT 1567 NXWRD 19~ 1568 159~ REM PSAUFE REM #$4 BIGGER #$Fe STA FIRST LOA STA LOP STA BED 1 5 3-1 BIGGER LOA 1538 1539 1540 STA LDA 1541 STA 1542 LOA 1543 1544 STP 1545 LOA 1546 GOAHD CLC CMP 1547 1551 1552 1553 1554 155 I C..C, 1556 1557 ROL ROL C:LC ADrC BNE CHP BEQ BPL LD .JSR CPY BEQ JSR 1573 PAD2C72 1574 20E66B 1575 A90! 1576 8D2-72 1577 T CURSOR LOC. ;GET ADDRESSES FROM POSITION BYTES ;SAVE REMAINDER FOR MPS* DERIUATN ;SAVE ADDRESSES ANDO POSITION BYTES SLDA JSR JMP LOA JSR .yN CPY BEQ JSR JSR NOMOU JSR LDA JSR YSTUFF LDAP STA TIO TABLE LOOXI UIPS ET -OR'ING WORDS FOR HORIZONTAL ;PART OF CURSOR ;G0 AND SHIFT THEM, CCORDNG T REM ;OTHER SET OF XOR'INGi WOROS ;CLEAR CARRY BIT SO IT DOESN'T GET ;SHITED ;EUEN THOUGH ONE IS #$I1 GOPAID ;jUMP AL4AYS ±$3 NOMOk NWRO #$F9 EMOUE :a80 NOMOU XFiNDI FIRST RD 'OR NOMOU #$7 -HOUE 4?Mthi #$S80 NOOU FIk ;SHIFT COUNTER INCREMENT TO REM ;AHERE IS THE .URSOR., IN RELPTION ;TO A PIXEL IN A BYTE? S ;MOUE SEUEN POSITIONS TO THE LEFT ;HiT EDGE OF SCREEN? ,GET ADDRESSES, POSITION BYTES DIDDLED ;WERE ORIZONTAL PRT I CURSOR ;O LEFT ;NO NEED TO RECALCULATE AORESSES ;HMOVE TO RIGHT SEUEN POSITIONS ;00 RIGHT PART O CURSOR FIRST IORWRD PEEK SECOND MOR RO 41 UECTOR STA t.-ECTOR JSR UERT JSR PRESTO RTS QLWAYS ZERO ;AND TWO SOMETIMES PRE >RESTORE CENTRE ADDRESS ;O THE IMMEDIATE PIXELS AROUN ;THE CURSOR CENTRE ;NOW FOR THE UERTI CAL PART ,POSITIUE UEC.fTOR FOR MOUE DOWN PGOPING eEC1 8D2A72 1581 68C4 20CB68 1582 8BC7 206588 1583 68CA R0 1584 TN ;COUNTEi UiP TO REH // SHIFT COUNT/ ;SHIFT THEN ALL TOGETER SECOND THIRD iDA THITRD 157 I572 CiU; + O ES TH; O CU ;BY MOR'ING A. CROSS NiSOP ;POP AODRESSES, MODIFY STPX POINT. -86RBCB GBCB 1585 1586 8BCB 66CB 1587 1588 8BCB 1589 6BCB GBCD 6B00 GB03 GBD606 G8808 GBDA GD800 6BE0 6BE3 68E5 88E8 68E8 6BEG A9FD 8D6172 A02A72 20546A C080 FOOB 05672 20E889 EE6172 00E 60 $ S 1590 UERT 1591 1592 YCURS 1593 1594 1595 1596 1597 15986 1599 1600 FINCUR 1801 1602 F 1603 XORWRD 297F 6BE8 803672 1604 RBEB AD3D72 1605 6BEE 3003 1606AR GBFO 4C046C 1607 E8F3 B507 1608 GBF5 803772 1809 6BF8 4960 CONT. LOP 4$FO STA COUNT ;NEGATIUE TNHREPP LOPDA UECTOR JSR NEXTY ;k-ECTOFR iTS EITHER POS. OR NEG. ;DEPENDING ON DIRECTION ;OUT OF BOUNDS? CPY #$480 BEG FINCUR LOA MASKrX JSR ;o ORWRO INC COUNT W PIEL ;BUMP COUNTER PNE pYCURS RTS AND #$7F ;NO SIGN BITS PLEASE, WE HAUE NO LSA BLTFL ;CI: O STA TEMP! BmI CONT. JHP BLTWRD LDA PDDRHiXI iUR Ti.u F~DOIN BLOITTO? JUST BORING CURSOR ;YEAH, LETS ORA4w SOME PORNO -RE ;NO, LE ;DO BOTH SCREENS STA TEMP2 XOR 110 $60 JSR xORIT GBFA 201886C 1611 6BFD A0377f2 1612 GC00 201BGC 1613 LODA TEMP2 >GET SECOND PAGE AODRESS ;DO CURSOR PART ;GT PRMIRY PAGE ADDRESS JSR XORIT RTS ;D0 THAT CURSOR 6C04 A03872 1617 LDA BRUSH 6C07 ;WHAT COMBINATION OF SCREENfS? STA TEMP3 6C03 60 GCO4 GC04 1614 1615 116 83872 -8-- COA 8507 1619 LOR ADDRH!,X 6COC 8 303772 1620 6COF 4960 1621 6C11 20256C 1622 -p GC14 AD-3772 1823 6C17 20256C 1624 CIA 860 1825 6Ci GCIB 1626 1827 6CIB CD10 6C1F 6C22 9507 1628 A108 1629 403672 1s3 8108 R1631 6C24 0 6C25 MOR JSR LDA JSR RTS #$60 BLITZ TEMP2 BLITZ LDP XTCi MOR STA RTS (ADDRLi .' ;GET PIXEL O ITS NEIGHBORS TFI-HP TEMPi ;XOR WITH CURSOR PART (ADDRL1,X) ;RENRITE TO SCREEN DRAN OR ERASE, ;RESTORE PTRI.RYR S OPPOSEDPo TO XOR DORESS -p MSTORE HIGH PART OF ADDRESS 163 1-34 6C25 9507 l1635 6C27 A106 1636 1- 6C29 0D3872 1w37 BLITZ STP OFDRH,I.X LDA (ADDRLi.) ORA TEMPI1 POR TENPI IC3i 4D3672 16, 6C34 8106 6C36 60 8C37 6C37 SC37 SAE SORT OF 'nDRESS MANIPULATION STA TEP2 1841 1642 1643 1644 1.845 STORE H GH PART OF ADDRESS ;OR IjNCURSOR PORT.Y RITES!T ;ERAE WHER 3S ,RI........ TT E.,,_._, E .. Ri.MU .MNY WHAT SETpTE 'DO-i ;ERASE WAS WRITTEN STOREX STA (ADDRLIX) ;WRITE IT PLL TO SCREEN RTS -87- aC37 6C37 6C37 6C37 8A 6C38 44P 6C39 AP 6C3A 6 0 6C38B 6C38 8A 6C30 OR AR 6C3D GC3E 60 6C3E GC3F 6C3F BC3F 1646 1647 3 .3 1649 1650 1651 !652 1653. 1654 1655 1656 1657 i658 1659 XOIU TXA LSR TAX RTS ;SETS X-RPTSTER INDEX TO POSITION ;BYTES, HAS UALUE 0i,1 XMHUL TM ;SETS X-REGISTER INDEX TO ADDRESS QSL ;BYTES, HAS UALUE 0,2 TX RTS i66 1662 LOCATE LOCATE 6C3F 20E466C 6C42 20826C 1663 JSR XF RTS 6C45 60 1664 6C48 1665 6C46 1666 1676C46 6C4 1666 3 6C46 17i 6C4G. 1670 6C46 3I GC46 8A t.C TER 1671 YF IN GC47 4A LSR 1672 TAY 6C48 Q8 1673 174 6C49 A420 1875 SLODP #$20 1876 GC46 9507 STA ADDRH1X I 6C40 894E72 1677 LDPA TYPOS,Y 6C50 18 1678 CLCLL 6C51 2P ROAI 1679 ROL 6C52 2A. 6C53 803672 STA TEMP1 1680 ROL 6C56 2 1685 6C57 2903 HND #$3 TAY 6C59 A8 LOR TENP1 6C5A AD3672 ROL 6C50 244 i D TEMPI 6C5E 2E3772 I E,P"7 ROL 6C61 2A. ROL TEMP2 6C62 2E3772 4$80 AND 6C65 2980 11689 697 6C67 192870 I685 ORA YSTRL,Y 1790 STA XTEP X 6CG6. 905772 1692 6C60D A03772 LOA TEMP2 1694 I1780 84 6C70 2903 AND #$3 1695 6C72 18 C:LC !696 AD.F ADDRHi! : GC73 75A7 1697 6C75 9507 1697 STA A DRH1 .? 1688 6C77 AD03672 1698 LOA TEMPI 11699 -E-.17 6C7A 291C AND #$1C 1700 6C7C 18 CLC _ 6C82 9507 6082 6C82 i703 1704 1705 1706 STA ADD :HI,.:: RTS ;GET AODRESSES FROM BOTH CALCULATN ;ROUTINESHAUE TO P' CALLED N ;THIS ORDER, OR THERES TROUBLE ;BECAUSE XTEHPX ISN'T PASSED ;+- YFIND-DOES A PARTIAL TABLE ** ;-* LOO*-UP OF ADDRESSES, USING ;YPOS ;THIS SHOULD BE A CALL TO XDIU 3 ,;PRIMARY PAGE IS BASE CURSOR AODDR. 3 ;ROTATE TO GET SECTION , O.1.3 3 Q.=iui TLESP ROL'S, ;THIS IS S PCT. .!, C-' _.. HERE IT IS ;PUT SECTION # IN Y REGISTER ;GET BOX ANO LINE IN BOX F >TH IS 1. n CDiRpSS PODD X POSITION ASE PART- O ;LOW ADDRESS BYTE, ;DIUIDEO BY 7 TO GET LOW ADDRESS 3 ;LINE NUMBER COMING UP 3 3 ;SSPUE ADDRESS ;BOX NUMBER NOG ;AOD BOX NUMBER ADREqSS PRT 3 3 f 1T -88- hiS 1707 - hiS hi :H.- 170c', 6C82 6082 V709 $ 17 11 $ GC82 1 T Q 171 G E.C82 fR-i XF w=i; 1714 6h i 32 1720 E.CS82 SA K,-3 4P 6:84 As- 1721 172I LSR TAY-LDP TXPOSY 171 6C85 B95272 SRC 20D:rC I 71- 6CSB 8D3672 6C8E 6C91 6C93 6C94 B94P72 2903 AS PD3172 6C97 18 0 -.- lJSR D 107 ij TE STP ...., -.-= LDA T-EXT,& ND 4 1725 1726 1727 172- $3 TAY LOR DUD 1729 ;-~-~- .FiND ;+ PART OF THE ADDRESS, CLCULTES TNHE LOW USING ...; TEXT_- is-F;-R"rY..... AND TXPOS -P ;TWI SHOULD BE XD!tU FD IDE N ;ET X4 POST iTION -Y-TF ;-IT BY SEVEN TO GET RADDRESS DISP. ;REMAINDER IS USED TO DO fiASX ;USED FOR P TABLE GRAD BUT THERE ARE NO1, NOT NECESSARY0 ; 5 EXTRA BITS HERE TO USE LATER ;GET ADDRESS DISPLACEMEN_DDLEL3 BASE 792B70 1730 7D5772 172 9506 AC3672 172 B92F70 6CA6 9D5672 172 i *i:-'" 172 GCA9 AD3672 1736 6CAC 60 1731 1732 GCAD GCAD 173 GCAD 1735 1736 GCAD 1737 1738 !739 6CAD 6098 -CSB 6C9E 6AO 6CA3 .- i C iTr1 ADDRL .:: LDY LDA STA LFA RTS TEMP HSK.NY MASK, .TEMP ! AIDDRESS ;.DD BASE ADDRESS FROM Y LOCATE THATS IT FOR THE ADDRESS FOLX .NO FOR , T-E fS:-:x ;JUST GET IT, THPTS ALL VA&E IT .;**HAVE TO RETURN REHA:INDER FOR ;CURSOR PROGRP .: 6CAD 6CAD 1 74:7 1744 6CAD 1746 1745 -747 _w*w 1748 6CAD 6CBO CB3 6CB5 6CB7 6CBA 6CBD 6CBF 6CC1 6CC2 6CC5 6CC7 _D3372 PD3372 F019 P900 8C3072 AC3072 FOOF A008 OA 2E3372 9004 18 61CE EYE, 6CCC iF3 6CCE 60 6CCF 6CCF GCCF 1749 1750 1751 i752 1753 175 1755 1756 1757 175E 1759 1760 17-;i 1762 1767 1764 1765 1766 1767 MULT STA 4OD DULT P4.S a- 8 MULTIPLY ;ABOUT AS FAST AS YOU CAN DO IT LDA MOD BE-a--HONE LDQ STY REr HLOOP LOY RE BEQ MDONE LD Y # :ASL ROL BCC SET UP PPOPETERS FIRST, $0 HO: i DjE C F CHEX FOR ANY ZEROS,_ ;PRODUCT IN 1 REGISTER ;ROLL OFF A BIT A CHEX FOR H 0 0 iCOULD SPfEED IT I -- : DEC E-EP T ,-;E MLOOP RTS EXITS TIdi. ;ON LY 8 SHIFTS, THATS WHY !TS FAST F-C LE hDO-4E CfUSEp ;WE'LL RtEALLY BE GOING LTER! ,THATS IT -89- 6CCF SCCF GCCF 1766 !7G9 1770 ECCF ;CCF 6CCF 8C3572 6CD2 4CE 16C 6CD5 803572 6OD8 P9OP 1771 1772 GCeDA n5 1778 ' .7 ;-~- S S S 177 1775 1776 1777 6CDC 803572 1779 1780 6CDF P907 RCEI 803272 1781 6CE4 803472 1782 6CE7 0E3472 1783 OITHO T NI &'R .JMP Fi~iOEFI DIUO10 ST 6CF4 Af3572 1788 1789 GDOA 6DC G600F 6010 6013 6O15 38 1805 1806 bLL 13 602F 8n !72 6032 l03472 6035 CO3272 6038 10E7 ID 1ik1 811 i82 1813 r 181 BEQ ZEROP CHP ISR BPL SLOY STY RTS CHP .Mi SHFT #$0 DUO RELT DIGIT JMP SHPT DIGIT SEi LO CLC P-IT 1815 1820 821 160 3 1823 124 P043 1825 6043 1826 6043 6043 1827 1828 ;RESLIT IS USED TL!CE HERE ETERFS ;SECT UP PR "r-- r. I UT IT WOR PE.RHPS SOIWEO E CON i .-r-UE Ti IS SECTiON OF -ODE TO -Q*E IT FAST ;ZERO DIUPNr, GET OUTTQ HEREP .COMPARE DIUIDEND TO DIVISOR .IFR DIVISOR IS LRGER, QUOTTIENT ;IS ZERO, REHMAINDOER = DIUIDN ;'PST EXIT ST BIT S T ;START iAT ;AND SHINFT RI GHT NE'-'T STsEh QFAST ;SM.LL N UMBERS DIUTOE ;GET SET-UP FOP FAST ON MUD M ;SjSUCCESS IUE APPROXI HOTI ;OSR IS SHIFTE ;A EGISTER AFTER EPCH SUBTRCT 7EROP S p.7 p S > i, 'S RPENQINER OF E_-H rnC MD ;,nF. .FfrI iaC STA DUD ;MODIFY nu., plND BIT CJRRYS ;HI..E TO BE OOE ;1!S IT H TRUE REiAINFER NO"? LO. RESLT CFHP FSR ROR OT-RT ;",IFT p BD43 6D43 UI DE DUI - 1 _SOME 01UI!SOR i:aND NUMBER TO BE S-C DSR STA RESLT 603P 6E3272 I 6030 4E3372 1817 6043 6D43 6042 IUI DE .OE 7 OECIiPL DIUIDE ;IS IT NEGrTIUE OR ZERO? ASL MOD P03172 1809 7 $4 = 10 DECI:L, IF YOU FORGOT SJUMP TO STA HOD LODA NUMBER ASL RESLT QSL DSR 1802 1803 1804 ED3272 1807 80D472 1'O 602B 6 D2:'' 18 6D2LC SHFT 1801 0E3472 6018 0E3272 6018 0E3372 6DIE 4C1060 6021 6D22 6025 028 POS 1796 3000 nDOES 10 DECIMAL DITUIDE ;OUD IS THIE QUOT iENT ;BIET POSITION BYTE .JHP NPrI OP P000 1797 803172 1798 60 1799 C003472 1800 SUE NLUMBER TO BE ITUI DEDO ;A-REGISTER WAS OIUISOR STA 0UF; LOZ #$i I NC D . SEC O-R SC: RCFC 38 1791 6CFO ED3272 1792 6000 4CF7 C 17 93 6008 1006 eIT +. NEGLOP BPL POS SCF9 EE31 7 27 1794 6003 FO30 6D005 CD3272 1795 NUMBER _ER FDP i*I4k 49$A LOA BNE DII!DE DIU7 STA NUMBER LDP #$7 DIVI DE STA DSR STA RESLT T :SL RESLT LOP 4$0 GCEF A901 1786 GCFI 803372 1787 6CF7 100A 1ULL POSITIE EITF4WT ;++ T0UIDE RF OUT INES SOI.E HRDW I RED ;FOR CERTQIN DIVISORS PPROXI HTILO-N ;USES SU:CF:STIU TIEGATUE MUU--ERS iU.ERYTNTi,; RTGHNT LSR mOD ;THATS RIGHT, BCC BIT. 3y L.L RTS N;" RIGHT! -906043 829 6043 1830 MOVE 1832 XMOUE 1833 1834 1835 i83.t 1837 1838 1839 1840 1841 1842 1843 1844 6043 803672 1831 6048 D8047 6048 6049 604C 6040 6i4F 6052 D6053 6D8055 6058 GD5B 605C 8A 4A A B04A72 AS 2907 S904A72 98 29F8 804972 805272 18 603672 6D5F 2E3672 1845 6082 8084 6066 D6088 8832 C948 301E 38 1846 1847 1848 1849 6069 E946 1850 6070 3006 1853 1854 38 E94 1855 FE4A72 BC4A72 C@04 3007 1856 1857 1858 1859 1862 1883 186 1865 1866 1867 6093 0A 8094 AA 1888 1869 6095 60 6D098 CS90 1870 1871 6098 3003 1872 6D09A 4f8660 1873 6090 809E 60P@ 8DA2 60P5 18 894 6 !06 DE4A72 18 860A8 8948 1874 1875 1876 1877 1878 ir879 608 DE4P72 1880 8OAB 1809 1881 GOAD 900 1882 8092 AAA 7 i883 8094 4C8660 -487 6DB7 6087 !885 1886 1887 1888 6187 1889 I-S LODA TXEXT.X TY N #$7 STA TXEXTTA TYnA STA MODE CLC RlDC TEfHP1I ROL TEM 1 BCS NEGPn INC TSEXTX CHP 4:t46 BMI REST SEC SBC #$48 INC TEXT,X .LOY TXEXTX BMI GONE DEC TXEXT.rX LOY #$80 LOA #$45 NEGAD CALL XFIND NEXT ;AND TXPOS,-X.. .;AND OUT EXTRO BITS, IN QCASE THEY ;PRE BEING USED..THEY AREN'T NOW ;GET X EXTENSION ;mOiFIE IS WACTUALLY T-HE EXTRA BITS ;AD UP XPOS ANOD0ISTANCE SRTN NS PIT SET? ;PIGHT BE P SIGN O WALL BrNGING IF-E TXPOS OUERFLOWED ;NO , EUERYTHINGS DONE DI UTI DE OUT $46 ;BUHMP X EXTENSION ;IS IT STILL >$46 ? ;CAN'T BE TOO BIG ;LET'S SEE WHAT DO.PMGE HAS BEEN DN , 0=< TXEXT =< 3 ;ITS snn ;HIT THE RIGHT SIDE OF SCREEN ;STAY THERE, NO WRAP PRO UND ;AE HOPE!! STA TXPOSX LOA TXEXTX ORA MODE STA TXEXTX ;USEI ESS STUFF, ASL TAX ;SfE CMP 4$0 BMI NRSLT ;GRONG BACWORDS STORE THE POSITION RYTES AS ALWAYS ZERO MXHUI NMP GONE NRSLT CFiLC QOC #$48 PL FIX DEC TEXT,X HRDSHIP CASES, LAQST ;CHPNCE TO PROUE TPHEiSELUF CLL. ArOC #$46 FIX IN LOA TXPOS,, CPY #$4 GONE UQLUE AND #$F SBC 4$46 REST FSTQNCF AND DIDDLES TEX . :T, SR TAX* BMI GONE SECr DE4P72 I860 P080 1861 A945 905272 B0472 004972 49.72 8A STA TEMP1 TXA CHP w$46 606B FE4A72 1851 606E C946 1852 6072 8073 6075 6078 6078 6070 6D7F 8082 6084 6086 6089 6D808C 608F 6092 -J ;'- ;AC.CUHULArTOR, DEC T-EXTX BPL GONE LEW *S8 ;HITTING LEFT SIDE? 1. STR T. ENT.,?: LDY 4580 JMP tGONE ;** YMOVE DIDDLES TYPOSX -916087 8 2 1889 6-0B7 8D3672 1890 YMOUE 6DBA 8A 6DBB 4A 6DBC AA TXI 18916 1892 1893 6DBD BD4E72 1894 60CO 803772 1895 6DC3 A000 1896 1897 6DC 6D03672 1898 60C9 2E3772 1899 60CC 900C 1900 GDCE 2E3772 1901 GD001 9021 600D3 2E3672 1902 iA 6D800D6 B015 6008 9026 6DDA 2E3672 1906 190? 6000DDD 900E 1908 CDOF C900 190 9 60E1 100A 1910 6DE3 A900 STA TEMPI I LSR TAX LDA TYPOS.X STA TEhP2 LDY #$0 1911 GDE? 9D4E72 1912 G6DEA B04E72 1913 6BED 904E72 1914 6DF@ 8A 6DF 6D0F2 6DF3 6DF4 6DF7 60F8 6DFA G6DFB 6DFO 6DFE OA PA 1915 6E00 A:CO 6E02 A080 6EO4 DOE7 6EO6 ADC TEMP1 ROL TEP2 BCC MEDM ROL TEMP2 BCC SAFE2 ROL TEMP1 MEDHM 192 1928 1929 - TEST MODIFIES T6iS OES Q TEST OR ;OUT OF RANGE COMBOS ;BY TESTING SIGN BITS IN A OF SHIFTS PND ;FAST SEQUENCEf ;CC, BCS INSTRUCTIONS BCS OUT2 BCC OIUT3 ROL TEMPI BCC OUT2 S.FEI OUTO OUT 1 OUT2 CHP #$0 BPL OULT2 LDA #$0 LOY #$80 STA TYPOSpX LDA TYPOS,X STA TYPOSX TXA ASL 1916 19171 192 18 60 1919 904E72 1922 2A 1921 90F0 1922 192 1 2A 90ED 1929 1921 2A 1922 FOEA ;SUE IT BECAUSE; o 6DC5 18; 60E5 A080 -+ V;k .F DITIFCEFS TYPOSX ;SAUE DISTENCE BYTE NEGAT!UE TYPOS HMEANS OUT OF RNG ;iS n! P iT T S-TnF ;SET FL1AG -UMMY LO"D, FOR NEXT I!-NST. STORE YPOSITiON- MiL ;SAME AS Xm TAX RTS SPFE2 STA TYPOS,:: ROL BCC OUT1 OUT3 ROL BC OiUT ROL BE: OU Ti LDA #$C0 LOY #$80 BNE OUT2 ICL "REST" ;CHEX FOR BOTTOM OF SCREEN ":N FiE nnLEn WITH BiG DIST NCERnBOTTOM OF SCREEN LOD NEIT PROGRPF-H SEGMENT BLOAD REST ;CONL-tT'.%. i RTNCRY THGE TO ;Ai LNE IMAGE BY HITTING EDGES 6EO6 205960 EDGEDO JSR LITE 6E19 1.2'--i 6EOB 202769 6E@E A903 51 4 6EI0 8D2372 6E13 P96 5 lb7 6E15 802172 6E18 190! 6EIA 20C96E 8 9 LOX #$0 JSR LDA STA LDA STA LDA SBLANK #$3 PROCED #$60 PP:GE #$!0 JSR SCAN 6EIO A 90i ;TURN ON SCREEN ;i:;PQR SECONDARY SCREEN ;FUNC:TI ON WORD FOR EDGE ;S.TORED IN PROCED P RE !Fr:rONRp sPAGE SET FOR DOING -ESGO ES T.ER E O- E O ;O N E+--T i1O LEFT TO RIGHT AND DOWN SCAN ;DOING EDGE S S VOU G0 13 JSR MERGE ;L0 FIDN AINO TO RIGHT 6E28 60 14 15 JSR DPR RTS ;GOTO TEXT & BASIC 6E2C 16 2E25 20D26F 6E28 2069G60 ;MERGE SECONDPRY ;UAMOOSE PRIMARY ON PRIH -92- SE2C 205960 !7 6E2F 6E31 6E32 6E35 19 20 A200 8A 802372 20C96E 18 SM1 21 6E38 A90i 22 6E3A 20C96E 23 6E3D ASSO9 GE3F 20C98E '-, 24 25 6E42 ASFF 26 27 28 29 30 6E44 20C96E 6E47 206960 8E4A 60 6E46 6E4B 205960 31 JSR SCAN JSR SCAN 48 8E62 6E65 6E67 8E68 6EGB GE6E 42 43 6E82 SM2 JSR LOX LDA STA TA JSR LOA JSR JSR RTS LITE #$0 ~ Ll-e LLl t ;TURN ON GRAPHICS f fLNCFQ. 4#$1 00, o FROCED'E LEF T -'O 00 N .AND R IGHT SCAN SCAN #$1 SCAN OAR nOTO RNE OF FIUE -,rCP.TPI, R!IGHT AND DON.N SCAN 41 20590 A200 8A 802372 20C96E A901 6E70 20C96E 3 SH3 JSR LITE LDX #$0 TA JSR SCAN LOPA #$1 45 46 47 48 50 6E7D A-FFT 53 JSR SCAN Lnp .$FF 6E7F 20C96E 6E82 206960 54 55 56 57 58 59 60 61 A901 802372 A980 20C96E 6E85 60 6E86 8E86 205960 6E89 A900 6E86 AA 6E8C 8D2372 6E8F 20C9tE 8E92 A901 6E94 20C9'6E 6E97 206960 6ESA 60 6E9B 6E9B 2059-90 6E9E A200 8EPO A902 SEQ2 802372 "p 20CE 1E57 6EAA A90i 6EAC 20C96E 6EAF 206960 6EB2 60 ..E,-A THREE 00JACENT PIXELS .STA PROCED 1.1. 4. JSR SCAN LODA #$I STA LDA PROCED $ 8E73 8E75 6E78 GE7A ".AN TO LEFT SCAN RTS 37 6E5E 206960 . UP SCAN JSR DAR A" 8E61 60 .;IiO DO'WN ANO RIGHT SCAN ;On RIGHT TO LEFT QAN 35 38 39 LEFT TO -00RIGHT AND DOWN SCAN LDA #$E-Ei 6E50 A901 802372 8A 20C9SE A901 20C96E .TURXI ON SCREn-4 !L ;AER GE THREE ADJ,-_ENT 'N JSR SCAN LOA #$1 6E4E A200 6E52 8E55 8E56 8E59 8E58 JSR LITE LDX #$0 TXA STA PROCED 49 t," 63 64 65 68 67 68 69 70 71 72 74 75 76 77 OUER ALL SCAN HODES JSR SCAN JSR DAR RTS 3 SM 4 JSR IDA TAN ST JSR LD9 JSR JSR RTS LITE #$0 R.ERP PROCErOD SCAN $1 SCAN DAR T TE INj ELS DTWO SC6N HODES PTE OO DER!URT!UE OUER TNO SCANS LAPLA1 JSR LITE LDX #$0 LOA #$2 LOA SCAN JSR *52 LDA SCAN JSR 44$! JSR ODAR RTS J p -p -93- .... 7T 1, T iFQTU T T- - PFRfllFD CTA: 6EBG Q494 1 iNT -$1 6ECBi A9 -0 ?iSF1Q:i 9 : 6EB ~-9E '-4 6EO!-0A-i DL6 C22 i4 94E -4; IF:4;4 M4iH-r Tq 1 -$9 3~~;~ REEF -1 1. H7 L~~ I S I H..11.11 I~i-4 S I- J_'I-~ RiFET~ 0i-i1 T R :-, 1 : t-: =IrI 4 AH-I -2 PhI STP 11.1 1 -1 . 1 .;I4 i t. - J -t .. .F1 .Fj .... ..... I 1--t I 4.i~- I LOA-4 VEDr H1 IIT ~1 S-TQ._ RFP 11/1-4 jF1D4 44F- f- i IQ p-I 1~1 j j. j EDP RF 1 8 _5 44 *t-:~' T~- p 149 iI A .1~*- 4 4 I~' 41 L 11-' _~ * 11- N- *1 6EF3 2 _BiE -1 1'~ L41 +-1. LE J,;~ 1 ~-IL EiNND -' E rliiI '-4 1 L_Ml 4- *',4-1 _i .L 1 ~3L 17 1 i~ 14TS 1 T -4 -94- .4g ~Fs-~FPf~;TTF 3 3- 6D h$ PTP 0,- Li-"'- 141 GETTING' RI~D 144c -p -p ~1 iRF F4- 37 I-4- L-4 T- r1 H iS L -4TF CI ; F : rih h J4 iTN1 , i :-14 iiaPT _C---_L EF.f L4I S L-- 6F5S 2E-1EC'6181' I K- TPtR & ~''~ 14 i-~ .i~iE TN Fir TP -p RF-9 6277 6F 7,1 '1 C f2 L4. I-- b~ 4 .jL .F47E 6E42 15 Sbt * r-1 FLr Pn 4T -T4 phi4 rNP P" 'T~ -#- L4- ft 19'7 TjICTTHR LZ F ~F~-~TT~iI 6F8~4 3 T'- P f-- Elir: E.6 i .7 .- - -g ~g -i: -pT PT t-;7 -95- cm 13FP9 - t: LEl- 'T D_- Ir-bt4t .17 :. T'-- - L4IT ~~fr4-. EFJ-jE 4-4 Tn ~-4 ir...- SF 9E 2@fiFD-.- 6 F A3 8 LF'22T PHrEjAS RT S GFiiG GE 6FA37 6H9- A9 ' 2 0I64F ki?10 Wi4 InP Q F f_ f- Lij i-.fW ' j.4 i -43 kI-Hil 0-3 4.4iI;P 4.i. Elf:I E-i.1 44 lW- TTI RTC 20i4F6,_- I3FC3 -IQ 6FCE 93~ 1GFD; L I ;. PI" -E iH 1 Q,.i I T 7.1 I 3IX #S4 7 0FED. T lt'..-. 1 :F tcF.F F li7 -41. FWF1 I F'-. r- -. P P-- " L4--- 4 T. '-.3' P , 3L4-.1 ;7 -967000 FFI1 263 XUECT HEX FF0I81FF 7003 7i@i4 F30 ; O 264 YUECT HEX FF F0101 ; 265 XSTAIR HEX 05030201010 7010 060403 286 YSTAIR HEX 06040302040 81020 7013 820408 7016 1020 7018 070503 267 ISTEP HEX 07050302040 268 FSTEP HEX A00070ACOF2 7007 01 7008 050302 10181 7008 018101 700E 01810 70F !F 701B 020407 701E OF1F 7020 A00070 02010 7023 ACOF20 7026 2010 7028 002850 7028 00@014 269 YSTRL HEX 002850 270 XSTR HEX 0008141E 702E IE 702F 010204 271 MSK HEX 01020408102 040 7032 081020 7035 40 7036 3870 7038 4770 703A 05 7038 E970 703D 06 703E 9F71 7040 01 972 '2 MESTAB ADR MESSsE 273 HESSGE POR 274 275 7044 OF71 7046 02 7047 1IEAOA -"5. 7043 02 HEx 06 27R 277 278 279 280 281i 282 7041 A87! iESSi HEX 05 ACDR HESS2 HEX 01 ADR MESS HEX 02 ESSi I t*ES ADR HESS5 E-X 02 STTR " CO COe S BEGIN WITH A SPACE" 704A AOC3CF 704 7050 7053 7056 7059 705C 705F 78062 7065 COCDC1 CEC403 A0C2C5 C7CSCE APD7C9 0.4_ .8 CIPAiD3 DOCIC3 C5 7066 1480 284 STR "H KEY-STR OKE CURSOR" 7069 PAICDC5 708C DADD3 706F 0412CF 7072 CBC5,O 7075 030502 7078 03CFD2 7078 25CDC7 LL EDGE/ SG 787E AC:C9 7081 CEC: .4-O 7084 CGD5CC 7087 CCAOC5 708A C4C7C5 •.5 i- I, STR " I ,S_ ., E. DI-- FINTK PB FiU -97- -IT9C .4 r4 0 S F CFC 5 DN 70'Pl '864C 2' PEDG3E/ 6FJ FII4FI RflTT0s T TP ILTG FTDO EDG3 '70A4 Qat-cqC 70-A 7 CEIC4'sg 70 E4CFDO 70 AD W5i: 7@EB3 C7fCRiF 706i3 IAIAThC2 7A@B9 C9CEC4 70BC~ P'O2CF 7OC2 COPIOfl 74OC5 C4CC:9 FEf 70DF: 70D7 - I-. A ~~F'-- P41 I FF 7RDD, sO-"ii' 7@Efl CEC4AA 7OE3 Cr2_E'5CC 7ESE CiGfl9Fi ::R 7OE9 1D41iCE E I-IO'E C -if-iwpf i 70EFC TR qIS$ -i' F9FeWj- 70EF 013D4E1 7OF2 FCBF.!= 7OF5 PAiC~l-F 70F8 D6.C A. 714 C 1 - f7117 IR-QA-QOS3FT 7117 Fin 712s F;, - 7119 CFi4Fi7 71 1C- CDFC4 7118 C:F5,C r1E 7126 np i 22Q8T "KEY-STROK -987147 A0407 714 CFr:CT4 7140 7150 7153 7156_ 7159 715C C9:7CS 04039 ;i0_-C CFD6C5 AeC4CF 07DfCE 715E 20A0.0 292 NO DIGITS:) MOUE RIGHT 71D1 AO El STR " R (T 7164 A0029 7!7 180407 FI- CFAOC4 fF:4 71.4 7160 CSEEC7C9 7170 D04039 7173 AOAOCD 7176 CFD6iC5 717--9 ADn:-,r: 717C C7C8D4 :2'3 P717F IFAeA 44O DIGI TS) krOUEiLEF T!" 7182 ...... 7185 A 'C C LOJ 7188 AB04407 718B CFOiC4 718E C9C7C9 7191 04D3A9 7194 Ap.A-.-: 7197 CFOD3C5 STR " 719A P@CCC5 7190 719F 71i2 7! 7!A8 CD4 08.P_'294 CD:F: -5 i5AAAA 295 HESS3 STR " E3SS MESS4 STR H!.R:C; " * B" BUFFE 7 14i +Q 71AE C2D:7181 CC5D2 7184 0,F5 71B7 C-CCAO 71EAPOPPAP. 71B0 AA 71BE 20A7A-4 296 "X! SE-DS TO BASIC" STR "'$ Ci EARS 71C4 CCF:C.51 71C7 0203t0 71CA P04-01 71CD A70 '7 71 A0D03C75 7103 CEC4D3 7106 0OO4CF 71D9 A C2C 1 710C 03CC~ 710 r 1." CF:CF ..... 71E5 71E8 71EB 71EE 71F0 C7C50AO C4C504 C5C304 C5C4 II1D2C5 298 H. BRc- -r, STR "REPOSITION -997!F9 CFCERO 71F0 C30502 71FF D3CFO2 7202 6373 299 ST1 ;DR X:TS 7204 8383 300 BUF1 ADR BIGBUF1 7206 00 7207 00 301 302 MASS HEx 00 HEX 8 7208 00 7209 00 303 304 NUMHI NUMLO HEX 00 HE 00 720 OP 7208 00 305 306 1fIDTH HE 7A INDOI HEx - 720C 00 7200 00 307 308 WINO02 NHEX 00 TRAVEL HE O- 720E 00 720F 00 310 FAULTS 7210 00 311 DISTN HEN 7211 7212 7213 7214 7215 7216 7217 312 313 314 315 316 317 318 LOSTEP HISTEP OFRACT OFFSET ENOPT QUAO QUID 309 00 00 00 00 00 00 00 319 7218 00 7219 00 721 00 7218 00 320 321 322 721C 00 7. REF UNO HEx 00 2C 'HEX I0 D ENr 0 'HEX HEX HEX HEX HEX HEX XDIR YDIR 0 00 00 00 00 HEX 00 HEX i0 HEX 00iI STEPS HEX RQYOFF HEX- LQUID C0PI 721D 00 721E 00 324 325 XSTEP HEX IO XFRACT HEr 1- 721F 00 326 YSTEP HEX 00 7220 7221 7222 7223 7224 7225 7226 00 00 00 00I 00 0 00 327 328 329 30 331 332 333 YFRACT PAGE EULER PROCED PI1EL PIXEL PTIEL2 HEX 00 HER 0 HEX 00$ H- 00-i HEX 00 : E s-i HEX Ou 7227 @8 334 PI 7228 00 7229 00 722A 00 7228 00 722C 00 7220D 00 722E 00 722F 00 335 336 337 338 33 9 340 341 342 PIXEL4 MOUMOD UECTOR FIRST SFCONO THIRD DUSR TEMD-i HENX 00 HE X HEX- 00 HEX 00 Et 00 HEN HE- 00 HEX 00 7230 00 7231 88 3 43 3- RE DUD HEX 0 3248 .3 4 NUMBER Nt 00 7236 0-8 7235 7236 880 351 34 74- TEMP1 N4E12 T '-HP I 723TE 90 352 345 7232 00 7235 00 7235 P'0 .E- 351 -4 EL3 Ht OSR Mtn 1. HEN 00 -- TEt-i 3 TEMP4 HEX 00 HE Mt-.k C Cil -. HE- II 00 353 TEMPS EX O 7238 00 354 BRUSH HEX O0 723C 00 7230 0 355 356 FLAG HE- 0S BLTFLG HEX -I 723 -100- 723E 00 357 723F 7240 7241 7242 7243 358 00 00 00 i00 10 7244 00 7245 72-4.8 00 7247 10 360 381 363 384 CFLAG HEX 00 PGFLA6 HE,'-' 00 PFLA HEX 00 uiFLWG HE 00i F~LS MOUE AMI!S CHMND PSOURC MOUX:- HEX 00 HEX HEN HEN:HE;:HEN 0 0 00 00 00 7248 ' 00 367 Q'-' 724 00 1A4E 152 370 T.'E T -.. S 4 TYPOS DFS i T.-'F n FSf 4 7256 00 1PSE 725E 00 725F 00 7280 00 7261 372 373 374 375 378 00 7262 00 2863 2C63 7E. 2C I~ G 31 C 379 380 381 MOU. HDE. MASK 'TE P WE'..-T YPOS XPOS COUNT ITCNT i' HE%-. 4. HE 00 HEX 00 U -7 HEN 00 HE 0HE.-0 HEX 00 00 HE.'.--: IFS $100 B i6RiF DFS $!100 6..ATS MITLibraries Document Services Room 14-0551 77 Massachusetts Avenue Cambridge, MA 02139 Ph: 617.253.5668 Fax: 617.253.1690 Email: docs@mit.edu http://Iibraries.mit.edu/docs DISCLAIMER OF QUALITY Due to the condition of the original material, there are unavoidable effort possible to i-h We have11..made every flaws in this reproduction. w ' th e T y o ua re d is sa -i fi a rl W^ provide you with the best copy available. If you are dissatisfied with this product and find it unusable, please contact Document Services as soon as possible. Thank you. Some pages inthe original document contain text That runs off the edge of the page.