on the o MICRO INK P.o. Box 6502 Amherst, New Hampshire 03031 MICRO on the 051 Technical Editor: Kerry Lourash Contributing authors: Michael J. Alport, Matt Asay, Lester Cain, David Cantrell, Leo Jankowski, Rolf Johannesen, Michael J. Keryan, John Krout, Kerry Lourash, Collin Macauley, Jeff Macauley, Michael M. Mahoney, Yasuo Morishita, Earl Morris, John S. Seybold, Charles L. Stanford, Terry Terrance, Richard L. Trethewey. Copyrigbt © 1983 by MICRO INK P.O. Box 6502 Amherst, New Hampshire 03031 All rights reserved. MICRO on the OSI is intended for the private use of its purchasers and reproduction by any means is prohibited. Use of information herein is for the single-end use of purchaser and any other use is expressly prohibited. All programs herein are distributed in an "as is" basis without warranty of any kind whatsoever. MICRO on the OSI ISBN: 0·938222·12·0 jj Table of Contents Warm Start Under OS-650 ..... . ........................ . . ............ 5 by Richard L. Trethewey Delete .... . ........................... ..... . . .. .. . . . . . ............ 9 by Earl Morris and Yasuo Morishita Two Fixes for ROM BASIC .................. . ...... .. .. .... .. .. ..... . 13 by Earl Morris Getting BASIC to Behave with OS-650 ....... . ................ .. ....... 15 by Richard L. Trethewey PRINTAT ........................................................ 23 by Matt Asay Line Editor for OSI 540 Board ..............•...•...................... 31 by Earl Morris Auto Line Numbers for OSI Disk BASIC .... . ............... . ........... 37 by Lester Cain Autonumber Plus for Cursor Control ........ . ........ . . . .............. . 43 by Kerry Lourash ON ERROR GOTO for OSI ROM BASIC ....... . ........ .. •............. 49 by Earl Morris and Kerry Lourash Cross-Reference Generator for OSI BASIC-in-ROM ..... ........ .......... 55 by fohn Krout Extended 051 BASIC . . ..... ..... .. , . , . , ............ . . . . . .... ... . ... . 65 by Collin Macauley and feft Macauley BASIC STEP and TRACE ......................................... ... 77 by Richard L. Trethewey Extended Trace ...................... . .....................•.•..... 83 by Kerry Lourash Symbol Table Lister. ................. ... .. . ........................ 93 by Rolf fohannesen Smart Lister .. ............. . ............. ..... .. .. . .............. . 10S by Kerry Lourash Surchange ..... ....... , . , .......... . ................. ....... .... . 109 by Kerry Lourash An Improved Breakpoint Utility .............•....................... 125 by fohn S. Seybold Polled Keyboard for CIP/ Superboard .................................. 133 f. by Michael Alport Something for Nothing .. ....... , ........... ....... . . .... . . . . ...... . 139 by Leo fankowski Saving Time with Your CIP ...... . ............•..................... 143 by fohn S. Seybold Extended I/O Processor ............................................ 149 by Michael f' Keryan Enhanced Video for CIP .................. . ......................... 163 by David Cantrell and Terry Terrance Programmable Reverse Video ............................... ........ . 169 by Charles L. Stanford OSI C1/C2 ROM BASIC Memory Map .................. . . . ........... 179 by Michael M. Mahoney __ • • • L-____________________________ U~ ~ Warm Start Under OS·65D 5 a r m S t a r t U n d e r 0 5 - 6 5 0 by Richard Trethewey L. 0 5-650 users have had to live with the fact that you can't warm start 05-650. So if your pro gram suddenly locks up or (with a pre-19Bl vintage 051 system) if you accidentally touch the < BREAK> key while typing in your program, you have to start over. Most of the time this problem only means re typing a few lines of code. But if you're like me and prone to program ming " on the fly" without periodi cally saving to disk, it could mean hours of work lost. In this article I will show you a way recover that to lost time with a minimum of effort. Usually when you touch the <BREAK> key while in BASIC, you can recover your program by entering the monitor ROM by pressing " M" and then " G" (for GO) . This can warm start BASIC, but not completely. At this point you can neither run your program nor save it to disk . If all has gone well so far, you can LIST your program to the indirect file and re-boot the system and recover it. This method doesn't always work and does no good if you're using the Assembler/ Editor and not BASIC. Also, when you re boot the system, the BEXEC* program writes directly over your old pro gram . Therein lies the key to our success. If the BEXEC. program isn't called into memory, your old program will remain pretty much intact unless you turn off your system. 05-650 uses a slick method to run the BEXEC. automatically when you boot up . On cold start, the input flag is set for memory input and the memory pointers are set to the command 'RUN"BEXEC*/I " which is called into memory with the rest of OS-65D . Also on cold starting, BASIC checks the I/ O flags to see if a console device has been selected. If so, it 6 MICRO on the OSI says' 'Hello, " tells you how much memory you have, and awaits instruc tions. Should this not be the case, BASIC runs the BEXEC' or executes whatever other instruction was stored on disk. Our task, then, is to change the I/O flags on cold start. My suggestion for having a reliable method of recovering your pro grams involves the use of the TRACK 0 Read/ Write utility. If you have never used this program, I strongly advise you to consult your manual before proceeding. The prompts in that program are very terse; without further explanation, you won't know what's happening. To begin, make a duplicate of any OS-650 diskette . If you used the copier program from track 1 (track 13 on mini-floppies) the TRACK 0 utility is still in memory . If you didn't, call it into memory now. Enter "GO 0200" at the "A·" prompt and select #2 from the menu displayed. Now enter "R4200". This will call the contents of track 0 to memory location $4200. Type "E" for exit and at the" A." prompt type "RE M" to enter the monitor ROM . Now enter" .4321/". The slash at the end of that sequence puts the monitor in the data entry mode so you can change memory . Now type "02 <RETURN >02.". The period puts you back in the addressing mode. Now type "2547G". You should see the "A'" prompt again. Note that the 02's above should be 01's on serial systems because you are setting the I/ 0 flags to your console device number on cold start. Run the TRACK 0 utility again by typing "GO 0200" and again select option 2 from the menu. This time, however, you are going to write track o and the instructions are a little more complicated than before . Enter the command "W420012200,8". This makes the changes current on the disk. When you boot the disk it won't run the BEXEC. anymore but will start up BASIC as if you had entered " BA" at the "A'" prompt . To recover a program press <BREAK>, if you haven't already . Press " M" to enter the monitor ROM and enter" .3A79" for all sizes of OS- 650 V3 .3. If you are running 3.2 enter" .3 179" on 8-inch systems and ".3279" on 5 \4 -inch systems instead of the above. This is where the file header starts. The file header holds the addresses of where your program starts and ends. This information may not be current if you have altered your program since it was stored on disk, but that won't matter. You need to record the next eight bytes for later so write down the number displayed after the address. Press the" / " key and a <RETURN>. Now write down the number for the next location. Copy down the information through address $1180. Put the diskette just made in the "A" drive and boot it up. BASIC should say "Hello", etc., and " OK" . Type "EXIT" and "RE M" as before. Press" .3A79" lor your system's header address as described above) and then the "/" key . Replace the eight bytes of infor- Warm Start Under OS·6SD 7 mation that you copied down by entering the numbers, followed by a <RETURN>. Now type" .2547G" and you're back at the "A'" prompt. Type "RE BA" to re-enter BASIC. If the file you are working on is an assembly program, instead of typing "RE M" at the "OK" prompt from BASIC, type "AS" first to invoke the assembler and then "RE M". Replace the eight bytes as de scribed above and type "RE A" instead of "RE BA". List the program to the indirect file . Under BASIC this is done with "LIST < SHIFT> 'K' ". With the assembler it's "P<SHIFT>'K' ". Now clear the workspace with a "NEW" or "I" and then enter a < CTRL > 'X'. This will reload the entire program into the workspace and update the resident language. Your program is now intact and you can run it andlor save it to disk. The special recovery disk just made does not need to be devoted to this single purpose. It is still a standard OS-650 disk and you can put whatever you like on it. As you can see, this technique doesn't really cost anything and could save quite a bit of time and effort. • • Delete 9 D e l e t e by Earl Morris and Yasuo Morishita N ormally only a single line of BASIC can be deleted by typing in the line number followed by a car riage return. This is tedious if a large block of lines must be removed; for example, when programs are merged or a utility program is run with another program also in memory. The "DELETE" program creates a USR routine that is called by Z = USR (first line)(last line) All the lines of BASIC with line numbers inside the specified range are then deleted. When OSI ROM BASIC is called to delete a single line, two major routines are used. The code at $A2A2 finds the line to be deleted and then shrinks the program by the number of bytes found in the of- fending line. Another routine at $A31C is responsible for refixing the pointers that rechain each line to the next. Unfortunately these routines are not written as subroutines and therefore cannot be used by "outside" programs. However, the DELETE program copies these routines from ROM into RAM and creates the needed subroutine. The main line DELETE program accepts the first line to be deleted and calls the copied ROM routine to do the work. Then the line pointers are used to find the line number of the next BASIC line. This is checked for end-of-program and to see if it exceeds the upper limit for deleting. Then the copied routines are called again and the process is repeated until completed. Lines are still deleted one at a time, but the computer, rather than your busy fingers , is doing the work. The BASIC program listed here will create the DELETE program on page two below the start of BASIC program space. This memory is nor mally unused in OSI machines . If you are using this space, then the delete program can be relocated by changing the value of "M" in line 14.
Description: