/ BASIC User Overlay / A user overlay is a PAL8 program that can be called by BASIC. The overlay / uses 3 blocks (6 pages) of memory starting at 03400. All user overlays / must reside on the system device. / The standard calling sequence is as follows: / / X$ = CAL$("FILE.EX",#) / | | | / | | - Number passed to overlay / | - Filename of the User Overlay / - Literal containing information being passed back from overlay / - If data being passed back > 18 character X$ must be Dimensioned / / Part 2 of this example shows how to retrieve the number and return it to X$. / / If you wish to pass string data as well as a number then the following / applies. / / To activate string ability BASIC.OV must be patched. / LOC 35430 from 5600 to 5270. / / *** The file name used in the CAL command MUST HAVE an extension. / If no extension exists the text string will be used as part of the overlay / name, thus causing an error in the file name lookup routine. / / The format with the patch is as follows: / / X$ = CAL$("FILNAME.EXTEXT STRING GOES HERE",#) / | | | / | | - Number passed to overlay / | - No space between filename and text / - Literal containing information being passed back from overlay / - If data being passed back > 18 character X$ must be Dimensioned / / Part one of this example handles the string information. / Pointers into the Basic Run Time System (BRTS) SACXR=10 / Auto index for SAC XR3=13 / Auto index for user code XR4=14 XR5=15 SACLEN=32 / Contains length of SAC TEMP1=63 / Contains 12 bit # passed by BASIC SAVCHR=104 / Character save buffer PSACM1=145 / Pointer to SAC - 1 SSMODE=212 / Set interpreter to string mode PCH=1204 / Print a character to the console terminal / Call with character in AC GCH=1242 / Get a character from the console terminal / 7 bit masked character left in SAVCHR / If CTRL C or TRAP character found will not return CTCCHK=1252 / Look for ^C and TRAP character / If found will not return. ERROR=1400 / Address for call to error overlay / Does not reutrn. Uses JMS address for error # PSWAP=2071 / Monitor swap must execute in even intervals / Monitor resides in High Field. Must be swapped / to field 0 before calling system handler, and / swapped back before returning to BASIC / Page zero constants used by the Basic Run Time System K4=106 / Contains 4 O10=177 / Contains 10 O15=144 / Contains 15 O17=175 / Contains 17 KESC=111 / Contains 33 O40=157 / Contains 40 K60=107 / Contains 60 KSEMI=73 / Contains 73 O77=127 / Contains 77 KBRACK=110 / Contains 133 IOMASK=62 / Contains 177 O200=171 / Contains 200 O377=174 / Contains 377 O7400=176 / Contains 7400 O7700=126 / Contains 7700 / Equates used by program AC7777=CLL CLA CMA R3L=7014 // // User overlay starts here // *3400 / Block 1 of 3 START, SKP CLA / Init AC JMS ERROR / Call ERROR overlay and indicate to the BASIC / system that an error was generated in the / User Overlay area. JMS address is used to calculate / the error number. BASIC will not return here. /////////////////// / Start of part 1 / /////////////////// // // Process text passed by CAL routine // PART1, TAD SACLEN / Reset pointers to first character after filename SNA / If saclen = 0 no text JMP PART2 TAD (-1 DCA SACLEN AC7777 TAD SACXR DCA SACXR PART1A, TAD SACLEN / Check SAC to see if any data is left SNA CLA JMP PART2 / No more text, now process number passed CDF 10 / SAC buffer resides in field 1 TAD I SACXR / Get next character in SAC buffer CDF / Reset data field JMS PCH / Print character on screen using BASIC ISZ SACLEN / Update saclen count NOP / Will skip JMP PART1A / Loop until all of text has been processed /////////////////// / End of part 1 / /////////////////// /////////////////// / Start of part 2 / /////////////////// // // Process number passed by CAL routine // PART2, TAD PSACM1 / Init pointer to SAC buffer DCA SACXR TAD TEMP1 / Get number passed by CAL command R3L / And send it back to literal used for CAL command AND (7 / Mask out one octal number TAD K60 / Convert it to an ASCII character JMS SACPUT / and store it in SAC TAD TEMP1 / Repeat until for all four numbers BSW AND (7 TAD K60 JMS SACPUT TAD TEMP1 RTR RAR AND (7 TAD K60 JMS SACPUT TAD TEMP1 AND (7 TAD K60 JMS SACPUT / Set SAC to number of characters sent SETLEN, TAD SACXR / Get number of characters printed CIA TAD PSACM1 / Current number of character inserted into SAC DCA SACLEN / Number of characters already in SAC JMP SSMODE / Return to BASIC SACPUT, 0 / Store ASCII character passed in SAC buffer CDF 10 / Change data field to where SAC resides DCA I SACXR / Store the character in the SAC buffer CDF / Set data field back JMP I SACPUT / Return to caller ///////////////// / End of part 2 / ///////////////// PAGE / Zero out the remainder of the 6 pages of overlay space ZBLOCK 200 PAGE ZBLOCK 200 / Block 2 of 3 PAGE ZBLOCK 200 PAGE ZBLOCK 200 / Block 3 of 3 PAGE ZBLOCK 200 $