Lawrence Livermore Lab "floating point package for 8080" updates This document last updated Oct 18 2006 Herb Johnson can be found as: http://retrotechnology.com/roche/lllfp_update.txt Background: ----------- Sometime in Sept 2006, someone posted in comp.os.cpm that they were interested in 8080 assembler code for floating point arithmetic. "French Luser" took an interest and found a printed copy of the Lawrence Livermore Lab "floating point package", and endeavored to recreate an ASM file from it. He became more interested in his METHODS of recovering source code from printed listings, than in the resulting actual code. Discussion occurred accordingly. French Luser wrote: > (Charles "Restless" Richmond triumphally announced, while I was > busy recreating the source code of LLLPPP, that he had found the > source code of LLLPPP. Unfortunately, a comparaison of both > files show that the one he found (in the Volume 2 of the > Software Library of the CP/M User's Group, containing the source > code of LLLBASIC) is, in fact, 59 bytes shorter -- the square > root routine is missing. If you prefer octal, use it.) Roche has not posted his regenerated source listing, or the square root routine. But in mid-OCt 2006, he provided his source to me (see below). At this point, there are THREE Web-accessable versions of the Lawrence Livermore Labs floating point package; and one version provided privately by Roche: 1) http://www.retroarchive.org/cpm/cdrom/SIMTEL/CPMUG/CPMUG002.ARK I'll call this the "CPMUG02 file". It contains the LLL floating point code, a LLL Tiny BASIC, and a Star Trek in that BASIC. 2) PDF of LLNL document listing and describing that file at: http://www.llnl.gov/tid/lof/documents/pdf/171286.pdf as UCRL-51940, "Floating-Point Package for Intel 8008 and 8080 Microprocessors" by Michael D. Maples Lawrence Livermore Laboratory, University of California/Livermore, California 94550, October 24, 1975 I'll call this "LLNL listing" or "LLNL document". 3) http://www.retroarchive.org/cpm/cdrom/SIMTEL/CPMUG/CPMUG010.ARK I'll call this the "CPMUG10 file". It contains the LLL floating point code, a LLL Tiny BASIC, and a monitor. It's described as an update to the version in CPMUG02. Thanks to "Bill" for posting in comp.os.cpm that this was available. On or about Sept 28th, I took time to compare CPMUG02 version and the LLNL document in a rough fashion. I found that the LLNL listing included the square root routine; the CPMUG02 file did not. But there are OTHER differences between the two, but I don't have time to make exhaustive checks. ON OCt 2nd, I made a rough check between the CPMUG02 and CPMUG10 versions of the FP software. 4) The file LLLFPODT.ASM from Roche, his version of the LLNL listing with the square root routine added and other changes not described to me. So I've created the following files on my Web site: 1) http://retrotechnology.com/roche/lllfp_update.txt (If you are reading this online, THIS is the "update" document.) That's the differences I found so far. It includes the lost SQRT routine from the LLNL document; and differences between the PDF, CPMUG02 and CPMUG10 floating point files. 2) http://retrotechnology.com/roche/LLLFP02.ASM That's the LLLFP.ASM file extracted from the CPMUG #2 archive as referenced above. NO CHANGES, AS ORIGINAL. 3) http://retrotechnology.com/roche/lllfp_roche.txt This is Emmanuel Roche (AKA French Luser)'s transscript of the contents of the LLNL document, less the source code. Thanks to Mr Roche for transcribing it. 4) http://retrotechnology.com/roche/LLLFP10.ASM That's the LLLFP.ASM file extracted from the CPMUG #10 archive as referenced above. NO CHANGES, AS ORIGINAL. 5) http://retrotechnology.com/roche/LLLBASIC10.DOC That's the LLLBASIC.DOC file extracted from the CPMUG #10 archive as referenced above. NO CHANGES, AS ORIGINAL. It describes the relationship between the BASIC package, the FP package and the changes from CPMUG02. 6) http://retrotechnology.com/roche/lllfp_roche.asm That's Emmanuel Roche's file he calls "LLLFPODT.ASM". This is his version of the LLNL floating point code as he has typed in and edited, with square root routine included, possibly other changes. Anyone wants to determine other differences besides the ones I noted, can email them to me, at "hjohnson@retrotechnology.com". I'll update this "update" document accordingly. Emmanuel Roche AKA French Luser can look at the update and check his work as well. Someone else MIGHT want to scour the Web and other CPMUG archives, to see if other "updates" were issued to this #2 disk to at the least include the square root routine, and/or other items. (Thanks to "Bill" for finding the CPMUG010 update.) Also, someone might read the other LLNL files and docs in the CPMUG disks, see what is needed from them to use the FP package seperately. Sorry I don't have time for more work. But as a courtesy, if asked I'll ZIP the two CPMUG archives and email them to anyone who wants to WORK on them. (otherwise you can find an unARK program and extract them yourself.) Herb Johnson Oct 18 2006 ----------------------------------------------- Herb Johnson, Oct 2 2006 Comparison of CPMUG002 LLNL floating point code vs CPMUG010 LLNL floating point code --------------------------------------------------------------------------- This is a comparison of CPMUG002 file of LLL floating point code obtained as .ARK file from: http://www.retroarchive.org/cpm/cdrom/SIMTEL/CPMUG/CPMUG002.ARK Referenced below as "CPMUG02 file"; Versus CPMUG010 file of LLL floating point code obtained as .ARK file from: http://www.retroarchive.org/cpm/cdrom/SIMTEL/CPMUG/CPMUG010.ARK Referenced below as "CPMUG10 file". 1) The text heading of both files are the same, in terms of dates and changes listed and names. The first "org", ORG 110000Q from the CPMUG002 code, is commented out in the CPMUG010 code. Before and after that ORG in the CPMUG010 code are tables, as follows below. The "euates for relocated packages" are new in CPMUG010, as is the "CPM EQU 5". The commented out equates in CPMUG010 as below are originally in use in CPMUG002. MINCH and MAXCH are in use in both files. [snip, code above common to both CPMUG02 and CPMUG10] ; ////OTHER CHANGES ARE NOTED BY ** ; ////MODIFIED BY FRANK OLKEN 6/28/75 ; ; [following code from CPMUG010] ;###S ; EQUATES FOR RELOCATED PACKAGES ORG 10DDH INTERP: EQU 0100H FPTBL: EQU 1774H IOJUMP: EQU 1900H CONIN: EQU IOJUMP+4 STATUS: EQU IOJUMP+0AH INP: EQU FPTBL+33H OUTR: EQU FPTBL+36H OUTL: EQU INTERP+7D9H INL: EQU INTERP+996H ; ORG 110000Q ; CPM: EQU 5 ;CONIN EQU 404Q ; JMP TABLE LOCATION OF CONSOLE INP. ;STATUS EQU 412Q ; JMP TABLE LOC. FOR STATUS PORT INPUT ;OUTR EQU 113775Q ;LINK TO BASIC ;OUTL EQU 103726Q ;INL EQU 104623Q ;INP EQU 113772Q ;LINK TO BASIC ;###E [code the same in both afterward] MINCH EQU 300Q ;MINIMUM CHARACTERISTIC WITH SIGN EXTENDED MAXCH EQU 077Q ;MAXIMUM CHARACTERISTIC WITH SIGN EXTENDED ; ; ;****************************************************** ; //// DIVIDE SUBROUTINE ;****************************************************** ; [end of snip] 2) Most of the code appears to be unchanged between CPMUG02 and CPMUG10. This was ROUGHLY determined by visual examination to look for an added or deleted line of code. Neither file has the square root routine from the LLNL PDF listing. 3) At the end of the both sets of code there is a JMP table, "linkages to Floating Point Routines". In the CPMUG010 code, the ORG is 1774H; the previous ORG of 113707Q is commented out. ------------------------------------------ Herb Johnson, Sept 29-30 2006 Comparison of CPMUG002 LLNL floating point code vs PDF copy of LLNL document of code. --------------------------------------------------------------------------- This is a comparison of CPMUG002 file of LLL floating point code obtained as .ARK file from: http://www.retroarchive.org/cpm/cdrom/SIMTEL/CPMUG/CPMUG002.ARK Referenced below as "CPMUG02 file"; Versus PDF of LLNL document listing and describing that file at: http://www.llnl.gov/tid/lof/documents/pdf/171286.pdf as UCRL-51940, Floating Point Package for 8008 and 8080... Michael D Maples Oct 24 1975. Referenced below as "LLNL listing". 1) SQRT routing missing from CPMUG02 file ----------------------------------------- From the source listing in the LLNL document, there is in that document the listing for the square root subroutine which is NOT in the CPMUG002 archive of that program. Placement of the DSQRT routine in the CPMUG02 ASM file is as follows: [snip of CPMUG02 file] ; SUBROUTINE BCTL ; MOVES BPTR CHAR TO LPTR CHAR ; DESTROYSE BCTL: MOV E,L ;LPTR TO E MOV L,B ;BPTR TO L INR L ;BPTR \2 INR L ;/***TP INR L ;TO L MOV A,M ;BPTR CHAR TO A MOV L,E ;LPTR TO L INR L ;LPTR \2 INR L ;TO L INR L ;/***TP MOV M,A ;STORE BPTR CHAR IN LPTR CHAR MOV L,E ;LPTR TO L RET **********square root routine DSQRT goes here ****************** ; ;****************************************************** ; //// 5 DIGIT FLOATING PT. OUTPUT ;****************************************************** ; [snip of CPMUG02 file] The square root routine as typed from the LLL document is as follows: ; ;****************************************************** ; ///SQUARE ROOT ; *************** ; THE L REG PTS TO THE TO BE ; OPERATED ON. ; THE B REG PTS TO THE LOC WHERE ; THE RESULT IS TO BE STORED ; THE C REG PTS TO 17(10) SCRATCH ; AREA. ; WHERE: ; C = INTERATION COUNT ; C+1 = L REG ; C+2 = B REG ; C+3 TO C+6 = INTRL REG 1 ; C+7 TO C+10 = INTRL REG 2 ; C+11 TO C+14 = INTRL REG 3 ; C15 = ;****************************************************** DSQRT: MOV A,L ;STORE L IN MOV L,C ;2ND WRD SCRTCH MVI M,0 ;INITIALIZE ITER COUNT INR L MOV M,A INR L ;STR B IN 3RD MOV M,B ;WRD OF SCRTCH INR L ;SET C TO INTRL MOV C,L ;REG I MOV L,A ; SET L PRT AT MOV A,H ;SET REGS FOR COPY CALL COPY ; CPY TC INTRL REG1 CALL GCHR ;PUT CHR IN A MOV B,A ;MAKE COPY ANI 200Q ;OK NEG JNZ ERSQ MOV A,B ANI 100Q ;OK NEG EXP MOV A,B JZ EPOS RAR ;DIV BY 2 ANI 177Q ORI 100Q ;SET SIGN BIT MOV M,A ;SAVE 1ST APPROX JMP AGN4 EPOS: RAR ;DIV BY 2 ANI 177Q MOV M,A ;SAVE IST APPROX AGN4: MOV L,C ;SET REGS MOV A,C ;TO COPY 1ST ADI 4 ;APPROX MOV C,A ;INTOO INTRL REG 2 MOV A,H ;FRM INTRL REG1 CALL COPY MOV A,C SUI 4 ;MULTIPLY INTRL REG 1 MOV L,A MOV B,C ;TIME INTRL REG2 ADI 10Q ;PLASE RESULT IN MOV C,A ;INMTRL REG 3 CALL LMUL MOV A,C SUI 10Q ;COPY ORG INTO MOV C,A ;INTRL REG 1 SUI 2 MOV L,A MOV L,M MOV A,H CALL COPY MOV A,C ADI 10Q ;ADD INTRL MOV L,A ;REG3 OT MOV B,C ;INTRL REG1 ADI 4 ;ANS TO INTRL MOV C,A ;REG3 CALL LADD MOV A,L SUI 4 ;DIV INTRL REG 3 MOV B,A ;BY INTRL REG 2 SUI 4 ;PUT ANSR IN INTRL MOV c,A ;REG1 CALL LDIV CALL GCHR SUI 1 ANI 177Q MOV M,A MOV A,C SUI 3 ;C PTS TO INTRL REG 1 MOV L,A ;GET INTR MOV B,M ;COUNT NOW INCR INR B MOV M,B MOV A,B CPI 5 ;IF = 5 RTN ANS JNZ AGN4 ;OTERHWISE CONT MOV L,C ALDN: DCR L ;COPY ANS INTO MOV C,M ;LOC REQUESTED INR L MOV A,H CALL COPY RET ERSQ: MOV L,C CALL WZER ;WRITE A FLOATING ZERO JMP ALDN ; ; ; [end] 2) Other changes: noted with ****'s ------------------------------------------------ a) an added call to CVRT in LLNL listing: [snip of CPMUG02 file] CVRT: CALL ZCHK ;CHECK FOR NEW ZERO JNZ NNZRO ;NOT ZERO INR C ;IT WAS, OFFSET C BY 2 INR C MOV L,C CALL WZER ;WRITE ZERO call sign ;send space on pos zero (**** from LLNL listing) INR L ;PNT TO DECIMAL EXPONENT [snip of CPMUG02 file] [end] b) The ERR program from the LLNL printed listing is; ERR: MVI a, 277Q ;error in input CALL OUTR ;send a ?(space) MVI A, 240Q CALL OUTR ;output space JMP PRMT ;go prompt user and restart versus the ERR from the LLL CPMUG02 file: ERR: STC ;ERROR FLAG RET ;AND RETURN [end] c) an added operation to the end of SAVEN routine in CPMUG02 file [snip of CPMUG02 file] SAVEN: MOV A,C ;/PUT NUMBER IN (L) ADI 15Q ;/GET ADD OF L MOV L,A MOV E,M ;/GET L OF RESULT MOV L,E ;/POINT L AT (L) INR L ;/SET TO 2ND WORD TO SAVE C MOV M,C ;/SAVE C IN (L) +1 SINCE IT WILL BE DESTROYED MOV L,C ;/SET UP TO CALL COPY MOV C,E ;/NOW L&C SET MOV A,H ;/RAM TO RAM COPY CALL COPY ;/COPY TO L MOV C,A ;/(L)+1 RETURNED HERE SO SET AS C ORA A ;MAKE SURE CY=0 (NO ERROR) ***not in LLNL listing RET ;/NOW EVERYTHING HUNKY-DORRY GETN: MOV A,C ;/GET DIGIT [snip of CPMUG02 file] [end] d) additional code in the CPMUG02 file which is NOT in the LLL PDF listing: [snip of CPMUG02 file] ZROIT: MOV L,C ;/ZERO NUMBER XRA A MOV M,A ;/***TP INR L ;/***TP MOV M,A INR L MOV M,A INR L ;/NOW SET SIGN TO + MOV M,A RET ;/DONE ;*** end of LLNL listing ;***code below not in LLL PDF listing ;***not referenced in any code above ; CONTAIN LOW BYTE OF TWO BYTE VALUE. RETURNS CY=1 IF ; BC>DE, CY=0 IF BC