---====--- File : FTP.DOC Date : 08/05/1991 From : Richard C Holmes. C/O SME Systems 22 Queen Street Mitcham Vic. 3132 Australia Phn +(61) (03) 874-3666 BBS +(61) (03) 873-5204 To Whom It May Concern (CP/M users) The following 5 programs are hereby placed into the public domain for free usage with the sole restriction that the authors name, Richard C Holmes, and company copyright messages are not changed. In other words, we wrote the programs and are happy to anyone who wants to use them to do so as long as we are remembered! There shall be no fee charged for this software by any third party or company or department. This software is free to the end user. ASMLIB A source library of assembler routines put together to assist in writing programs in 8080 and TDL version Z80 assembler. Assemble with RMAC or uss the source for your own reasons. The main reason (for me) for writing this library was to provide a configurable set of screen driver codes (ie cursor address, half intensity etc etc). This was done by putting a key-code at the start of the table of attribute codes which another program searches for and patches directly. So, you can patch programs written with ASMLIB to suit most terminals. Other functions in the library such as a simple time delay, CRC generator, cursor addressing and message printing make ASMLIB cute and simple to use. FP A screen oriented file patcher. Does a neat job of patching in ascii or hex and has a host of options etc. PROM150 A premium program for programming EPROMS on SME Systems (bet you never heard of us!) or S.D. Systems Prom100 cards. If you are this far into eprom programming then you should be able to figure out that for the 2764 and bigger eproms you need an adaptor. Contact me for a circuit diagram etc. SETUP A program that directly patches (wow!) the screen driver codes in .COM files that use the ASMLIB program. This program should be accompanied by a (small?) data base of available screen setup codes which can be edited and added to etc. TATT A program to TEST setup and ASMLIB screen drivers. PS. If anyone out there is doing development work on a CP/M system for the '64180 chip and uses RMAC then I have my own source for another library of functions including interrupt redirection etc. This is intended for embedded systems only. ---====--- ASMLIB Distribution Disk ------------------------ The files supplied on this disk are all documented in the ASMLIB manual. If you care to read this little file then you can get a quick idea of what you have got. The library asmlib.rel The ASMLIB library file. Take care of this. Demonstration Programs tatt.asm Tests many of the screen functions (test attributes). tasm.asm Tests some of the ASMLIB functions. bugs.asm Drops characters on random positions on the screen (simple). sbcmon.asm SBC-800 port monitor program. Monitors an 8255. Easily mod'ed. rn.asm Both 8 and 16 bit random number test program. testall.asm Hardware test program for some of SME Systems boards. teatall.hlp Text help file used by testall. Moudule Source code prolog.asm ASMLIB prolog module source code. hlp.asm Help screen module source. smepli.asm PL/I-80 support routines module. Only the beginning. screen.asm ASMLIB screen function module source code. setatt.asm ASMLIB screen attributes module source code. cpmio.asm Standard CP/M I/O driver module. cpmmpc.asm Standard CP/M and MPC-6 I/O driver module. sbc800io.asm Standard SBC-800 I/O driver module source code. sbcmpc.asm SBC-800 and MPC-6 I/O driver module. atod.asm Analogue to digital card interface software. clock.asm Real time clock interface module. token.asm Token processor module. ASMLIB Support Submit files libasm.sub Generates a new library from a source code disk .REL files. makeasm.sub Assembles the source code disk into .REL files. modlib.sub Will substitute a single module in the library. addlib.sub Adds a module to the library. Utilities Using ASMLIB setup.asm Patches an application program to suit a terminal type. setup.hlp Text help file for setup. This is a handy guide for the user. term.dat Data file for terminal defintions used by setup. term.ovl Text file to help setting out terminal function codes. fp.asm A highly interactive file display and patch progra. Excellent. fp.pc Pseudo code sketch of FP used for design of the program. ~~~~~~~~~~~~~~~~~~~~ NOTES: ------ Where appropriate, the relevant executable .COM files are supplied along with their source code. These files may use hardware dependant code so the user will have to use either SETUP to configure for a terminal and/or modify the some of the source code modules. A look inside the ASMLIB manual may reveal what has to be done. Try the index. The files supplied on this disk in addition to the ASMLIB are for user convenience. The demonstration programs are provided for the user to show what can be done quickly and easliy using the library approach to programming. Also they show how one programmer comes to grips with programming problems. None of the programs exhibit any bugs to the writers knowledge and all the rough edges have beed removed to the writers satisfaction. If a bug or rough edge is observed then please inform the supplier of ASMLIB and a fix may be forthcoming. ASMLIB has been devised as a productivity tool which aims at generating better programs more quickly that any other method yet devised. To this end, the demonstration programs presented look to be VERY LARGE. They are. Look a bit more closely at them and you will probably see that the main cause for this is the copious amount of messages, help, and general user friendliness that has been attempted to be built into them. After all, what good is a program that has no messages for the user. The messages and general text in some programs can approach 30% of total code size, but the pro- grams are USEABLE. R.C.H. 31/12/83 ---====--- Added by J.V.J.B. (Henry Brancik, June 15, 1991): The following is excerpt (a very short one) from 140 page ASMLIB Manual: ----------------------------------------------------------------------- The usage: ASMLIB is totally compatible with the Digital Research linker and libra- rian (LINK and LIB) programs. Some (probably total) compatibility exists with the Microsoft products also, but this has not been thoroughly checked. The author of the ASMLIB, Richard C. Holmes, likes Digital Reserch products better. The assembly is very simple. The Digital Research RMAC assembler is used. The following is an example of assembly of a file called MYJUNK.ASM: A>RMAC MYJUNK The linking process is simple, too. The following example links MYJUNK to ASMLIB and causes only those modules that are referenced to be included (the [S] switch): A>LINK MYJUNK,ASMLIB [S] The following example links MYJUNK2 to ASMLIB and sets the data storage areas to XXXX (in hex): A>LINK MYJUNK2,ASMLIB [S,DXXXX] The following example links MYJUNK3 to ASMLIB, sets the data storage areas to XXXX (in hex) and runs (loads) at address YYYY(in hex): A>LINK MYJUNK3,ASMLIB [S,LYYYY,DXXXX] The LIB program is used to list, add, delete and replace modules in the ASMLIB library. The following example lists all the modules in the ASMLIB: A>LIB ASMLIB.REL[M] The following example will display all the publics in the ASMLIB: A>LIB ASMLIB.REL[P] The following is an example of replacement of CPMIO module with MYOI module in the ASMLIB: A>LIB ASMLIB.REL=ASMLIB.REL The LIB program is a little strict about spaces and brackets in the command line. The submit files supplied with the library were used to create ASMLIB and are expected to be used to perform modifications. All the submit files expect the source of the modification (addition) on drive B. The submit file ADDLIB.SUB is used to add a module. The following is an exam- ple of adding MYMOD module to ASMLIB: A>SUBMIT ADDLIB MYMOD The submit file MODLIB.SUB is used to substitute (replace) module of the same name. The following is an example of replacment of MYMOD module already in the ASMLIB by a modified module MYMOD (on drive B and of the same name): A>SUBMIT MODLIB MYMOD It should be noted that all module names must be unique in the first SIX letters. This is imposed by the librarian and linker programs which only use the first six letters in their searches. A new library can be generated from source code files supplied: A>SUBMIT MAKEASM $PZSZ <-- Re-assemble. This is SLOW. A>SUBMIT LIBASM <-- Re-link. Quite fast. ---====--- Simple test program: ------------------- Type the following in a file (EXAMPLE.ASM): ; ; This program clears the screen, prints a message and quits. ; extrn prolog,dispatch,clear,inline,coe ; call prolog ; set up stack call clear ; clears the screen call inline ; print the message jmp quit ; all done db 0dh,0ah.'This is a simple test$' ; end Then assemble it: A>RMAC EXAMPLE $PZSZ file EXAMPLE.REL is created. Then link it: A>LINK EXAMPLE,ASMLIB [S] and finally run it: A>EXAMPLE ---====--- ASMLIB Functions Summary ------------------------ Miscellaneous Functions: PROLOG Initialize ASMLIB and set up stack etc. QUIT Exit program back to CP/M directly. VERSION Return the version of ASMLIB. CLKRD Read real time clock to memory. CLKWR Set the real time clock from memory. CHKRNG Range check that D <= A <= E. CHKTBL Range check via a table of values and addresses. FORMIN Display a menu and read data into screen fields. MON A useful diagnostic monitor. ATODIN Read an analogue to digital channel. PORTSET Send a table of bytes to a digital port. DELAY Delay a number of milliseconds. CLRCRC Clear the current checksum. ADDCRC Add the accumulator to the current checksum. GETCRC Return the current checksum. RANDINIT Initialize random number generator. RAND8 Return an 8 bit random number. RAND16 Return a 16 bit random number. RANDP16 Return a positive (15 bit) random number. RAMBPT Test memory with a 'barber-pole' test. RAMWBT Test memory with a 'walking bit' test. GETYORN Get a 'Y' or a 'N' from the console. Screen Functions: TNAME Return the address of the terminal name string. IONUM Return the number of the I/O driver module. PSTRING Print a string to the console. INLINE Print a string following the call instruction. XYPSTRING Is the PSTRING routine with embedded cursor setup. XYINLINE Is the INLINE routine with embedded cursor setup. PCOUNT Print a string of (B) characters to the console. PMENU Print a menu to the console with cursor setups. PSTR Print a character a number of times. CLEAR Clear the screen. CLEOL Clear to end of line. CLEOP Clear to end of page. BELL Ring the console bell. CURSOR Set the screen cursor position. SETXY Use 2 memory bytes for cursor address setup. CRLF Send a carriage return and line feed to the screen. ECHOLST Echo all screen output to the list device. LISTOUT Send all output to the list device. CONSOUT Re-select the screen as output device. USERIO Load addresses of custom I/O drivers. DISPATCH Send a character to output device(s). COE Send the accumulator to the screen. LOE Send the accumulator to the list device. LST Get the printers' output status. FLUSHLOE Flush the line printer buffer. CIE Get a character from the console. CST Set the console status. CBUFF Read the console into a console buffer. SETATT Set or clear console visual attributes. Numeric printing: LZB Leading zero blank for numeric output. BLZB Blank fill leading zero blank (right justify) for numeric output. CLZB Character fill leading zero blank (right justify) for numeric output. NOLZB Disable any LZB functions. PHACC Print the accumulator as a HEX number. PDACC Print the accumulator as a DECIMAL number. PHDE Print DE as a HEX number. PDDE Print DE as a DECIMAL number. PSHDE Print DE as a signed HEX number. PSDDE Print DE as a signed DECIMAL number. Conversions: ATOASCII Convert HEX accumulator to ascii in HL. ATOHEX Convert ascii accumulator to HEX. ASCBCD Convert ascii string to a BCD number. ASCHEX Convert ascii string to a HEX number. HEXASC Convert HEX number to ascii string. HEXBCD Convert from HEX into BCD. BCDHEX Convert from BCD into HEX. NIBASC Convert low nibble of A into ascii in A. IHHL Input HEX number into HL from the console. IDHL Input a DECIMAL number into HL from the console. COMP2S Convert DE into a 2's complement number into HL. CAPS Convert accumulator to capitals. CAPSBUF Convert a CP/M console buffer to capitals. Maths functions: MULDH Multiply DE by HL. HL = result, overflow in DE. DIVDH Divide DE by HL. HL = result, reminder in DE. SQRT Take the square root of DE into HL. SIGNADD Signed add HL to DE. SGNSUB Signed subtract HL from DE. COMDH Compare HL to DE. Zero if equal, carry if DE > HL. Character string functions: CONSTR Concatenate two character strings. CMPSTR Compare two strings. POSSTR Find a substring in a string. CPYSTR Copy a substring from a string. DELSTR Delete a substring from a string. INSSTR Insert a substring into a string. CAPSTR Capitalize a string. PRNSTR Print a character string. BUFSTR Move a console buffer into a string. STRBUF Move a string into a console buffer. ELBSTR Eliminate leading blanks from a string. ETBSTR Eliminate trailing blanks from a string. DEFDEL Define token delimiters. GETTOK Get the first token from a string. TABSCR Search a table of strings for a string. Speciality functions and utilities: HLP Help file indexing and display manager. SETUP .COM Terminal installation utility. FP .COM File display and patcher utility. SMEPLI PL/1-80 assembly language speciality interface. TESTALL .COM Hardware test program. TATT .COM Terminal attribute test program. TASM .COM Test of ASMLIB routines in general. RN .COM Random number generator test program. ---====--- Dependances of functions and modules. ===================================== Some of the routines in ASMLIB depend on other routines (subroutines) and for this reason it is necessary to declare the required routines as external when writing a program. The following table lists all routines in ASMLIB and the modules (files) they are in and also all the dependant routines. Function Module Dependances Code/Data ------------------------------------------------------------------------- ADDCRC CRC ASCBCD ASCBCD CAPS 046/02 ATOASC ATOASC NIBASC 00F/00 ATODIN ATOD 03C/00 ATOHEX ATOHEX CAPS 01B/00 BCDHEX BCDHEX 02D/00 BELL SCREEN DISPATCH, COE 0AA/00 BLZB SETLZB PROLOG BUFSTR BUFSTR 00D/00 CAPS CAPS 008/00 CAPSBUF CAPSBUF 010/00 CAPSTR CAPSTR CAPS 00C/00 CBBUFF CBUFF CIE, COE CHKRNG CHKRNG 02F/00 CHKTBL CHKRNG CIE CPMIO CLEAR SCREEN COE CLEOL SCREEN COE CLEOP SCREEN CLKRD CLOCK 083/00 CLKWR CLOCK CLP CLP * ** CLRCRC CRC 02D/02 CLZB SETLZB PROLOG CPMSTR CMPSTR 023/02 COE CPMIO COMHD COMHD 00A/00 COMP2S SMATH 014/00 CONSOUT SWITCHIO PROLOG CONSTR CONSTR 052/05 CPYSTR CPYSTR 049/02 CRLF SCREEN COE, DISPATCH CST CPMIO CUROFF SCREEN COE CURON SCREEN COE CURSOR SCREEN COE DEFTOK TOKEN GETTOK, DELSTR, CMPSTR DELAY DELAY 015/00 DELSTR DELSTR 03D/01 DISPATCH DISPATCH PROLOG, COE, CIE, LOE DIVDH DIVDH 038/00 ECHOLST SWITCHIO PROLOG 00D/00 ELBSTR EBLSTR DELSTR 03E/01 ETBSTR EBLSTR DELSTR FLUSHHLOE DISPATCH PROLOG FORMIN FORMIN CIE, COE 18A/10 GETCRC CRC GETTOK TOKEN DELSTR, CMPSTR GETYORN GETYORN CIE, COE, DISPATCH HEXASC HEXASC ATOASC 013/00 HEXBCD HEXNCD 02D/00 HLP HLP * ** IDHL IHL CPBUFF, COE, CIE IHHL IHL CPBUFF, COE, CIE 080/0D INLINE INLINE DISPATCH 00D/00 INSSTR INSSTR 05A/01 IONUM CPMIO LISTOUT SWITCHIO PROLOG, LOE LOE CPMIO LST CPMIO LZB SETLZB PROLOG 071/01 MON MON CIE, COE, CST, CLKRD, CLKWR 58E/33 MULDH MULDH 02D/00 NIBASC PACC NOLZB SETLZB PROLOG PCOUNT PCOUNT DISPATCH 00A/00 PDACC PACC DISPATCH, PROLOG, SETLZB, HEXBCD PDDE PDE PDACC PHACC PACC DISPATCH, PROLOG, SETLZB 046/00 PHDE PDE PHACC 048/00 PMENU PMENU DISPATCH, XYPSTRING 009/00 PORTSET PORTSET 010/00 POSSTR POSSTR 047/07 PRNSTR PRNSTR PCOUNT 008/00 PROLOG PROLOG 01E/91 PSDDE PSNG PDDE PSHDE PSNG PHDE 01D/00 PSTR PSTR DISPATCH 008/00 PSTRING PSTRING DISPATCH 00C/00 QUIT PROLOG PROLOG RAMBPT RAMBPT 0B4/00 RAMWBT RAMWBT 056/00 RANDINIT RANDOM RAND8 RANDOM RANDP16 RANDOM RAND8 RAND16 RANDOM RAND8 SETATT SETATT COE 08E/01 SETXY SCREEN COE SGNADD SMATH SGNSUB SMATH SQRT SQRT 039/00 STRBUF STRBUF 00E/00 TABSCR TABSCR CMPSTR, DELSTR TNAME SCREEN USERIO SWITCHIO PROLOG VERSION PROLOG XYINLINE XYPRINT DISPATCH, SETXY XYPSTRING XYPRINT DISPATCH, SETXY 024/00 ---====--- J.V.J.B., June 25, 1991