nickerso@dalcsug.UUCP (Scott William Nickerson) (01/13/88)
The following utility program is presented for the C-64 computer although versions for the 128 and VIC can be easily derived. A common problem when writing interactive programs which require that instructions or other text be output for the user is that the print statements must be carefully arranged so that words will not be broken at the edge of the screen. This can be time consuming and if a minor change must be made to some text it can affect the alignment of several other lines of output. This program is very brief but provides the user with a very useful alternative to this situation. No new commands are required as the whole routine is wedged into the normal print vector of the machine. Run-Stop-Restore will remove the wedge and a simple SYS will put it back in place. Begin by loading the short BASIC program below which will POKE the ML routine in place. This may be included as a subroutine in your application or you may use a monitor to save the resulting object code and just load it from your other programs. *** THE PROGRAM *** 1000 data173,66,253,141,196,192,173,67 1010 data253,141,197,192,169,46,141,38 1020 data3,169,192,141,39,3,169,0 1030 data141,195,192,96,173,66,253,141 1040 data38,3,173,67,253,141,39,3 1050 data169,0,141,195,192,96,142,191 1060 data192,140,192,192,141,193,192,172 1070 data195,192,153,198,192,238,195,192 1080 data201,13,240,16,204,194,192,240 1090 data53,174,191,192,172,192,192,173 1100 data193,192,24,96,174,195,192,202 1110 data240,11,32,113,192,173,195,192 1120 data205,194,192,240,5,169,13,32 1130 data188,192,169,0,141,195,192,240 1140 data216,162,0,189,198,192,32,188 1150 data192,232,136,208,246,96,201,32 1160 data208,6,32,113,192,76,106,192 1170 data136,185,198,192,201,32,240,9 1180 data136,208,246,172,194,192,200,208 1190 data233,140,195,192,32,113,192,169 1200 data13,32,188,192,162,0,172,195 1210 data192,200,185,198,192,157,198,192 1220 data232,204,194,192,208,243,142,195 1230 data192,76,73,192,108,196,192,255 1240 data1,13,40,0 1250 forad=49152to49347 1260 readx:pokead,x 1270 next 1280 rem to activate use sys 49152 1290 rem to remove use sys 49180 N.B. - you may wish to use some kind of "dynamic keyboard" technique to enter this program as a text file rather than typing it in. To activate the wedge use SYS49152 in your program. This will be required to cause all subsequent output to be buffered. By calling SYS49180 you can remove the wedge so that the PRINT statement will behave normally. Any characters which are printed are not output immediately but rather they are stored in a buffer. When a carriage return is received or the buffer becomes full the line will be output. This routine will also work if the output is being directed to the printer or the disk. Since anything you print is placed in a buffer make sure you empty it by sending a carriage return or a SHIFT-carriage return at the end of any output message. Below is a short BASIC program and the output that would result as viewed on a 40 column screen: 10 PRINT"THIS IS A TEST OF THE SCREEN FORMATTING WEDGE PROGRAM. NOTICE "; 20 PRINT"THAT THE USER DOES NOT HAVE TO WORRY ABOUT WHERE WORDS END AS "; 30 PRINT"THE PROGRAM WILL FORMAT ALL OUTPUT AND LEAVE NO BROKEN WORDS TO "; 40 PRINT"WRAP AROUND THE SCREEN. THE RESULT IS VERY READABLE OUTPUT WITH "; 50 PRINT"NO TIME WASTED IN PROGRAMMING." This is how it would appear if run without the wedge: THIS IS A TEST OF THE SCREEN FORMATTING WEDGE PROGRAM. NOTICE THAT THE USER DOE S NOT HAVE TO WORRY ABOUT WHERE WORDS EN D AS THE PROGRAM WILL FORMAT ALL OUTPUT AND LEAVE NO BROKEN WORDS TO WRAP AROUND THE SCREEN. THE RESULT IS VERY READABL E OUTPUT WITH NO TIME WASTED IN PROGRAMM ING. This is how it would appear with the wedge: THIS IS A TEST OF THE SCREEN FORMATTING WEDGE PROGRAM. NOTICE THAT THE USER DOES NOT HAVE TO WORRY ABOUT WHERE WORDS END AS THE PROGRAM WILL FORMAT ALL OUTPUT AND LEAVE NO BROKEN WORDS TO WRAP AROUND THE SCREEN. THE RESULT IS VERY READABLE OUTPUT WITH NO TIME WASTED IN PROGRAMMING. The program as is works on a 64 but can be easily converted for use on a 128 or VIC. Questions or comments welcome through mail.