Robert C. Arp, Jr. 278-1 San Tomas Aquino Rd Campbell, Ca 95008 (408)370-9039 June 30, 1989 Program: ARP_FUNC.PRG Version 1.001 This is a LSR program that establishes user defined trap. It may be be executed from the desktop, but you may prefer to copy it to the AUTO folder of the boot partition of your hard disk or boot floppy disk so that it will execute automatically during boot. The program installs trap #4 as a multi-function trap. For example, the first two functions provide string printing functions for printers and files that is similar to the GEMDOS print line function. Function # Function Performed 0 Prints a null terminated string to the parallel port. 1 Prints a null terminated string to a file. Other functions will be added in later versions. The custom trap expects the first value placed on the stack to have been a pointer to the null terminated string to be written; the second value to have been a word length external device number for function 0, or a file handle for function 1; and the third value to be the word length function number. The contents of all registers used by the custom trap are preserved. Invocation Format: pea string_add ; Location where null terminated string is stored. move.w #dev_num, -(sp) ; Device to which the string is to be written. move.w #function, -(sp) ; ARP_FUNC function invoked. trap #4 ; ARP_FUNC call. addq #8, sp ; Reposition stack pointer. where the dev_num is specified as follows: If function = 0, then device number 0 = PRN = Parallel port. If function = 1, then device number = file handle. The assembly source for this program is being uploaded as ARPFUNCS.ARC. You can download that file if you are interested in the listing. The program used to test ARP_FUNC.PRG is being uploaded as AFUNCTST.ARC and its assembly source is being uploaded as AFUNTSTS.ARC The program was designed on a MEGA2 that has been upgraded to four megabytes of memory. Also, the developer TOS 1.4 proms are in the machine. I mention this in case there are problems. Please don't hesitate to contact me if you want to declare any problems with my material. Sincerely, Bob Arp