READ THIS FIRST - BEFORE USE. CALL TINCMP AS FOLLOWS: TINCMP MACROFILE,OUTPUTFILE,INPUTFILE MACROFILE: THE MACROS TO BE USED AS TEMPLATES AND INSTRUCTIONS OUTPUTFILE: THE OUTPUT OF TINCMP INPUTFILE: THE INPUT TO BE EXPANDED BY TINCMP REFERENCE FOR THIS STUFF: PIDGIN - A SYSTEMS PROGRAMMING LANGUAGE BY WM. A. GALE DOCTOR DOBBS JOURNAL #57 JULY 1981 STAGE2 8080 IMPLEMENTATION (SUPERB!) DICK CURTISS CP/MUG VOLUME 51 IMPLEMENTING SOFTWARE FOR NON-NUMERIC APPLICATIONS WM. M. WAITE PRENTICE-HALL, INC. ENGLEWOOD CLIFFS, NJ 1973 ISBN 0-13-451898-5 (ABOUT $25) AN 8080 IMPLEMENTATION OF PIDGIN TO BE PUBLISHED IN DR DOBBS SUBMITTED NOVEMBER 1981 A. L. BENDER, M.D. CONTENTS OF TINCMP DISK: FILE CONTENTS -------------------------------------------------------------- MACROS.PGN THE MACRO FILE USED TO TRANSLATE PIDGIN TO 8080 ASSEMBLER CODE PIDGIN.S2M THE MACRO FILE USED TO TRANSLATE PIDGIN TO 8080 ASSEMBLER CODE WHEN BOOTSTRAPPING FROM STAGE2 (THESE ARE STAGE2 MACROS) TINCMP.PGN THE TINCMP COMPILER SOURCE CODE IN PIDGIN. TINCMP.MAC THE OUTPUT OF TINCMP WHEN TRANSLATING TINCMP WRITTEN IN PIDGIN USING TINCMP. TINCMP.REL THE REL FILE FROM ASSEMBLING ABOVE FILE. TINCMP.COM TINCMP COMMAND FILE. STAGE2.COM STAGE2 MACRO PROCESSOR WRITTEN IN FLUB BY DICK CURTISS AND DISTRIBUTED HERE WITH HIS PERMISSION. IOCMPLX.ASM THE I/O SUBROUTINES FOR PIDGIN INCLUDING THE CP/M FILE CONTROL I/O INTERFACE ROUTINE WRNXT.ASM CONSOLE READ/WRITE ROUTINES FOR PIDGIN UNDER CP/M. SYSTEM.ASM THE CP/M DEFINITIONS FOR PIDGIN. ALSO CONTAINS THE UNIVERSAL LOAD DE FROM M (LDEM) ROUTINE PIDMATH.ASM 16 BIT INTEGER ARITHMETIC ROUTINES WRITTEN BY DICK CURTISS. SLIGHTLY MODIFIED TO BE USED WITH PIDGIN. PIDGINLB.REL RELOCATABLE LIBRARY OF WRNXT,SYSTEM AND PIDMATH. TINTEST THRU TINTEST6 TEST ROUTINES FOR TINCMP. USE IF YOU DESIGN YOUR OWN MACROS. WC.PGN WORD COUNTER. USED AS A TEST PROGRAM TO CHECK THE TINCMP COMPILER. SUMMARY FOR STAGE2: STAGE2 IS DOCUMENTED IN CPM/UG LIBRARY VOLUME 51. PLEASE READ THAT DOCUMENTATION IF YOU NEED DETAILED INSTRUCTIONS. YOU SHOULD ALSO BUY WAITE'S BOOK. THIS IS A WELL WRITTEN, BUT COMPLEX SUBJECT AND IS NOT CASUAL BED-TIME READING. YOU WILL NEED TO READ AND PROBABLY RE-READ EACH TOPIC SEVERAL TIMES TO MAKE SENSE OUT OF THINGS. STAGE2 PRODUCES AN OUTPUT FILE FROM ONE OR MORE INPUT FILES. IF YOU WANT TO REGENERATE TINCMP.MAC FROM TINCMP.PGN YOU WILL NEED TO DO SEVERAL THINGS. ONE IS TO INSERT A SPACE IN FRONT OF EACH TINCMP.PGN LINE WHICH STARTS WITH A NON-SPACE OR TAB. INSERT A SPACE BETWEEN BEGINMAIN AND ( IN THE SOURCE OR FIX THE S2M MACRO NEXT, INSERT SPACES BEWEEN PACK AND ( AND UNPACK AND ( OR FIX THE MACRO. INSERT A FINIS STATEMENT AT THE END OF TINCMP.PGN. IF YOU CAN AVOID IT, DON'T GO BACK TO STAGE2. JUST FIX THE TINCMP MACRO FILE MACROS.PGN. STARTING OVER WITH STAGE2 CAN GET THE RESULTING COMPILER MESSED UP AND INTRODUCE ERRORS WHICH ARE QUITE DIFFICULT TO FIND. TO ASSEMBLE A NEW TINCMP WITH STAGE2: A>STAGE2 TINCMP.MAC,CON=PIDGIN.S2M,TINCMP.PGN THIS PUTS THE BAD STATEMENTS OUT ON THE CONSOLE. I REALLY CAN'T SEE WHAT THIS WILL BUY YOU BUT YOU CAN USE IT IF YOU WANT. WORKING WITH TINCMP CAN GET TO BE A DRAG SO IF YOU MAKE A SUBMIT FILE THINGS WILL BE EASIER: 1. COMPILATION AND ASSEMBLY TAKE ABOUT 5-7 MINUTES. 2. TYPE-IN OF COMMANDS IS ERROR-PRONE BECAUSE OF THE NUMBER OF FILES USED. 3. THERE ARE FEWER ERRORS WHEN FILES ARE SUBMITTED. SUGGESTED SUBMIT FILE: A>SUBMIT TINSUB TINCMP MACROS.PGN,$1.ASM,$1.PGN M80 ,=$1.ASM L80 $1,IOCMPLX,PIDGINLB/S,$1/N,/E STAGE2 HAS MANY OTHER USES. CONSULTING DICK CURTISS' FILES WILL GIVE YOU SOME IDEA OF HOW POWERFUL STAGE2 IS. UNLIKE TINCMP IT HAS BRANCH AND TEST INSTRUCTIONS. WAITE'S BOOK IS A GOOD EXAMPLE OF HOW PRAGMATIC AND THEORETICAL MATERIAL CAN BE PRESENTED. TO PUT TOGETHER A TINCMP COMPILER FOR SPECIAL PURPOSES: 1. IF YOU DON'T HAVE M-80 OR RMAC: YOU NEED TO MERGE THE FOLLOWING: TINCMP.MAC IOCMPLX.ASM PIDMATH.ASM WRNXT.ASM SYSTEM.ASM REMOVE ALL EXTRN AND ENTRY STATEMENTS AS WELL AS DSEG, CSEG AND COMMON STATEMENTS. REMOVE THE EXTERNAL PROCEDURE, LOCAL VARIABLE, ENDLOCAL STATEMENTS FROM MACROS.PGN REASSEMBLE - GOOD LUCK! YOU WILL NEED TO CHANGE ALL OF THE MACROS TOO. YOU WILL REALLY NEED THE GOOD LUCK FOR THIS. 2. IF YOU HAVE RMAC YOU NEED TO CHANGE THE ENTRY STATEMENTS TO PUBLIC IN ALL LIBRARY MODULES (IOCMPLX,WRNXT,PIDMATH,SYSTEM) 3. IF YOU ARE NOT DARING AND HAVE AN ORG 100H SYSTEM YOU CAN JUST LOAD THE COM FILE TINCMP AND USE IT. 4. IF YOU HAVE M-80: USE L80 TO LINK PIDGINLB INTO IOCMPLX AND TINCMP. PIDGINLB IS A LIBRARY OF WRNXT,SYSTEM AND PIDMATH 5. IF RUNNING MP/M SYSTEM DEFINES ?BOOT,?BDOS,?TBUF FOR CP/M AND YOU WILL NEED TO CHANGE THIS. 6. IF RUNNING CP/M 2.2 EVERYTHING IS COOL. I DIDN'T TEST THIS WITH CP/M 1.4 BUT I DIDN'T USE ANY WIERD CALLS SO IT SHOULD WORK OK. THE FCB'S ARE ALL 36 BYTES LONG. 7. IN THIS VERSION ALL FILES MUST BE DECLARED IN THE CONTROL STATEMENT AND ONLY THE ASSOCIATE FCB N WITH I$$ WORKS. 8. ?ENDING WASN'T TESTED THROUGHLY. 9. IOCMPLX IS REALLY WRITTEN FOR A Z-80 AND IF YOU HAVE ONE IT SHOULD BE RECODED. 10: AS SUPPLIED, THE TINCMP COMPILER IS THE ACTUAL OUTPUT OF THE PIDGIN VERSION OF TINCMP AS SUPPLIED ON FILE TINCMP.PGN 11: IF YOU WANT TO RESTART THE PROCESS LOTS OF LUCK YOU CAN GET A COPY OF TINCMP'S MOTHER STAGE2 IN CP/MUG VOL 51. 12: IF YOU HAVE A Z-80 OR THE CDL ASSEMBLER YOU CAN CHANGE THE MACROS IN MACROS.PGN TO USE THEM. 13: NOTE! NONE OF THE CODE IS OPTIMIZED. YOU CAN SAVE ABOUT 20-40% SPACE IN THE CSEG SEGMENTS BY HAND OPTIMIZING THE ASSEMBLY LANGUAGE IN TINCMP.MAC 14: IF YOU HAVE PROBLEMS YOU CAN WRITE TO ME: A. L. BENDER, M. D. C/O NEUROLOGICAL SERVICES INC. 336 CENTER AVE WESTWOOD NJ 07675 201-664-4882 15: THE MATERIAL HEREIN IS COPYRIGHTED (C) 1981. MATERIAL IS PRESENTED FOR YOUR PRIVATE, NON-COMMERCIAL USE. SOME OF THIS MATERIAL IS COPYRIGHT BY DICK CURTISS AND IS REPRODUCED HERE BY HIS WRITTEN PERMISSION (PIDMATH) AND TINCMP IS COPYRIGHT BY WM GALE. THE REPRODUCTION OF THIS MATERIAL IN THIS LOCATION DOES NOT IMPLY ANY RIGHTS TO FURTHER PUBLISH, DISTRIBUTE, USE OR SELL ANY MATERIAL HEREIN PRESENTED. BOTH WM GALE AND DICK CURTISS RETAIN ALL COPYRIGHT TO THEIR MATERIAL. I RETAIN THE COPYRIGHT TO ALL MODIFICATIONS TO TINCMP AND TO THE CP/M VERSION OF TINCMP. ALTERING THE PROGRAMS BY HAND-OPTIMIZATION DOES NOT ALTER COPYRIGHT PROTECTION NOR DOES EXTENSION VOID THE RIGHTS OF PREVIOUS COPYRIGHT HOLDERS. PERMISSION FOR COMMERCIAL USE MUST BE OBTAINED FROM THE COPYRIGHT OWNERS INDIVIDUALLY.