Not NSD - Copyright 1986, by Lee D. Rimar So ZBasic - Copyright 1986, by ZEDCOR, Inc. Dumb (distribute free, but with all notices intact!) Terminal Program for: KAYPRO CP/M computer with any external modem What is NSD: NSD is a simple terminal program for Kaypro computers. I wrote it for a limited purpose, so it has strange functions not found in other programs. Though written for my Kaypro, it should easily adapt to other computers. See comments under "Programmer's Notes" below. NSD was composed and debugged with a DEMO version of ZBasic, the compiler sold by ZEDCOR, Inc. They distribute the demo version FREE, to advertise their fine product. Look for ZBASDEMO.LBR on many RCP/Ms. NSD runs under the demo version -- but when you see how good ZBasic is, you'll want to buy the full version. How to start NSD: 1> From CP/M's A> prompt, run ZBasic. 2> In ZBasic, select (E) for Edit Mode. 3> At the ZBasic Ready prompt, type: LOAD NSD and hit return. 4> When it's done loading, and you get another "Ready" message, type: RUN and hit return. ZBasic will take about 5 seconds to compile the program in memory. You'll get the NSD sign-on message, and a prompt to "Hit any Key... " If you have the full (commercial) version of ZBasic, you may also compile NSD to a stand-alone .COM file. See your ZBasic manual for details. How to use NSD: Commands in NSD are given by hitting the ESCape key, and following it with a command key. The very few commands are: ESC- B Sets the Baud rate. Supports 300, 600, 1200, 2400 baud. To keep keystrokes to a minimum, you don't have to type the zeros; you set 1200 just by typing 12. ESC- E Sets "Echo Mode" ON or OFF. With echo OFF, NSD expects the system you're connected with to "echo" the characters you type. Most BBSs do this; use "Echo ON" only if the other system doesn't. You'll know that's the case if you type but don't see anything on your screen. ESC- Turns the "line feed filter" ON or OFF. With the filter ON, line feeds are stripped out of the data stream wherever they occur, and are added after carriage returns. With it OFF, line feeds are passed "as is" both locally and remote. ESC- W Turns "Word Wrap" ON or OFF. When it's OFF, local and remote data is accepted "as is." When it's ON, any SPACE character received after character 65 on a line is converted into a carriage return. This keeps you from having to hit RETURN. See comments under "Why I wrote NSD." ESC- T Transmits a text file. NSD prompts with: "File? " -- Enter the name of the file you want to send, or just hit RETURN to cancel the command. "Slow? " -- Enter a number to slow down the speed the text goes out. Just hitting return will send text as fast as it can be read from the disk. Some BBS programs can't handle that. The delay is measured by 1/1000 second. Enter 100 to delay each character 1/10 second. Text files go out "as-is;" the line feed filter and word wrap are not used. I may change this in a later version. ESC- Q Quits from NSD. If you're running directly under ZBasic, you will return to ZBasic's "Ready" prompt. If you've compiled the program to a That's the entire command set. If you type an invalid command key after hitting ESCape, it's just ignored; you'll have to hit ESCape again to give the correct command. If you need to send out an ESC to the other computer, hit ESCape twice (only the second one goes out). Why I wrote NSD: I normally use MEX, Ron Fowler's excellent Modem Executive. But I often use PC-Pursuit to "chat" with friends in other cities. For various reasons, MEX is clumsy and slow for this. I use NSD for such chats. Word-wrap, echo mode, and the line feed filter were written with that in mind. The "switches" for these options are short 2-key sequences to make set-up easy. That's the idea behind NSD. It's very terse; messages are kept to a minimum. Commands are short and few. It makes the program very easy to use. For me, at least... One oddity you may notice: If the cursor is on the first character of a line, NSD "swallows" backspaces. This was done to compensate for a bug in one of my friend's terminal program -- if you try to backspace past the beginning of a line, the whole system crashes! Sick, eh? So we set up character echo to be handled by NSD, and her system never sees a disastrous backspace in column 0. Programmer's Notes And Other Quirks: ZBasic will LIST and LLIST the program somewhat differently than I typed it. Apostrophes expand to "REM," and question marks (?) expand to PRINT. Also, various loops and conditional structures are displayed with indentation. If you SAVE the program from ZBasic, the expansions stay, but the indentations don't. One oddity I don't understand: If you save the program in token form (SAVE NSD) the resulting disk file is LARGER than if you save it as Ascii (SAVE +NSD). But an Ascii saved version LOADSs a LOT slower. The full version of ZBasic has support for serial ports; they are treated similar to random files. The demo version doesn't offer such nicieties, so I addressed the Kaypro's serial ports with INP and OUT statements. That's really the only "Kaypro Specific" part of NSD. If you re-write the modem routines, NSD should run on just about anything. That's a nice feature of ZBasic, programs code is portable between all versions: CP/M, MS-DOS, APPLE and MACINTOSH, and TRS-80. To adapt NSD to another computer, change these routines: LONG FN CheckRemote Checks the serial port to see if there's a character waiting. If so, it puts the character in A$, and the Ascii value of the character in integer variable A. Otherwise, it returns A$="" and A=0. LONG FN Sendout Sends the value in integer variable A out the serial port, and waits until the port returns Clear To Send. "Set Registers" A bunch of OUT statements to initialize the Kaypro's Z80 SIO. It initializes the serial port for 8 bit data, 1 stop bit, no parity. I used Richard Walker's "UARTKPRO.DOC" file for reference on this. This file is available on many RCP/Ms. "Set Baud" Subroutine for setting the baud rate. The initial definition section of the program includes an integer variable Rate. This is only used to set the baud rate when you start the program, no other variable is affected by this routine. "Disconnect" Subroutine to disconnect the modem by dropping the DTR signal. Again, my reference source was UARTKPRO.DOC. That's all the specific Kaypro stuff. The keyboard is checked with a simple INKEY$, so it doesn't have to be changed. If you have the full version of ZBasic and use built-in serial I/O routines, the resulting source program should be portable to ANY system. I think. Haven't tried it myself, I just have this Kaypro. I do not consider this an "optimum" program. I wrote it in about four hours one evening when I had nothing else to do. It doesn't have "bells and whistles" -- it doesn't even have XMODEM support! But it does what I need it to do. Hope you find it useful or at least interesting Later . . . Lee David Rimar -eof-