perm filename IOSER.DIF[10X,AIL] blob
sn#263529 filedate 1977-02-14 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 **** File 1) IOSER.TNX[10X,AIL], Page 51 line 5
C00041 ENDMK
C⊗;
**** File 1) IOSER.TNX[10X,AIL], Page 51 line 5
1) DEFINE CHARROU < CHARIN,SINI,INPUT,LREALIN,LREALSCAN,REALIN,REALSCAN,INTIN,INTSCAN,CHAROUT,OUT,LINOUT,RCHPTR,SCHPTR >
1) DEFINE UTILROU < FINIO >
**** File 2) IOSER.OLD[10X,AIL], Page 51 line 5
2) DEFINE CHARROU < CHARIN,SINI,INPUT,REALIN,REALSCAN,INTIN,INTSCAN,CHAROUT,OUT,LINOUT,RCHPTR,SCHPTR >
2) DEFINE UTILROU < FINIO >
***************
**** File 1) IOSER.TNX[10X,AIL], Page 67 line 8
1) PUSHJ P,SAVE
1) PUSHJ P,NUMIN ;SET UP TO GET CHARS FROM CHANNEL
1) PUSHJ P,RLNIN ;GOBBLE A REAL NUMBER
1) SNGL A,A
1) INRETA: MOVEM A,RACS+A(USER)
1) INRET: SKIPE BRCHAR(CDB) ;USER WANTS BREAK CHARACTER?
1) MOVEM D,@BRCHAR(CDB) ;FIX UP BREAK CHARACTER
1) SOS IOBP(CDB) ;BACK UP TO GET IT NEXT TIME
1) FOR II←1,4 <
1) IBP IOBP(CDB)>
1) AOS IOCNT(CDB)
1) MOVE LPSA,X22 ;GET RID OF CHANNEL AND RET. WD
1) JRST RESTR
1) HERE (REALSCAN)
1) PUSHJ P,SAVE
1) PUSHJ P,STRIN ;SET UP TO GET CHARS FROM A STRING
1) PUSHJ P,RLNIN
1) SNGL A,A
1) STRRTA: MOVEM A,RACS+A(USER)
1) STRRET:
1) HRRZ X,-2(P)
1) SOJ CDB, ;BACK UP BYTE POINTER
1) FOR II←1,4<
1) IBP CDB>
1) MOVEM CDB,(X)
1) AOJ CHNL,
1) HRRM CHNL,-1(X)
1) MOVEM Z,@-1(P) ;STORE BREAK CHARACTER
1) MOVE LPSA,X33 ;GET RID OF BRK VAR, STR ADDR
1) JRST RESTR
1) FNDDIG: ;FIND DIGIT OR DECIMAL POINT, KEEP TRACK OF SIGN
1) EXCH A,(P) ;FIRST PUT "GET NEXT CHAR" INSTR ON STACK
1) PUSH P,A ;AHEAD OF RETURN WORD
1) FNDDI1: XCT -1(P) ;GET NEXT CHAR
1) CAIL D,"0"
1) CAILE D,"9"
1) CAIN D,"."
1) POPJ P,
1) CAIN D,"-"
1) TLOA FF,NUMNEG
1) TLZ FF,NUMNEG ;SIGN MUST IMMEDIATELY PRECEDE NUMBER
1) JRST FNDDI1
1) RLNIN:
1) SETZ FF, ;ZERO FLAGS
1) PUSHJ P,FNDDIG
1) PUSHJ P,GETNUM ;TRY FOR AN INTEGER
1) CAIE D,"."
1) TRZA C,-1 ;NO DIGITS AFTER DEC PT.
1) PUSHJ P,GETN1D ;FINISH UP FRACTION
1) EXCH C,(P) ;DIGIT COUNTS ↔ NXTCHR INSTR
1) PUSH P,X ;PARTIAL RESULT
1) PUSH P,Y
1) PUSH P,FF ;FLAGS
1) PUSH P,C ;NXTCHR INSTR
1) SETZ FF, ;EXPONENT FLAGS
1) CAIE D,"@"
1) CAIN D,"E"
1) JRST [XCT (P) ;EAT A CHAR
1) CAIE D,"@"
1) CAIN D,"E"
1) RLNIN2: XCT (P) ;ALLOW FOR TWO OF THESE
1) CAIN D,"-"
1) TLOA FF,NUMNEG
1) CAIN D,"+"
1) XCT (P) ;PAST SIGN
1) PUSHJ P,GETNUM ;RECURSE FOR EXPONENT
1) PUSHJ P,TZMUL ;GET EXPONENT AS AN INTEGER
1) JUMPN C,RLNIN1
1) ERR <NUMIN: Improper exponent>,1 ;NO DIGITS APPEARED
1) JRST RLNIN1
1) ]
1) CAIN D,"D"
1) JRST RLNIN2
1) SETZB X,Y ;EXPONENT IS ZERO
1) SETZ C, ;AND THERE WERE NO DIGITS IN IT
1) RLNIN1:
1) MOVEI Z,(D) ;SAVE BRCHAR
1) SUB P,X11 ;GET RID OF NXTCHR INSTR
1) TLNN FF,NUMNEG
1) SKIPA D,Y ;LOW WD OF EXPONENT
1) MOVN D,Y ;EXPONENT WAS NEG
1) POP P,FF ;FLAGS OF FRACTION
1) ;-2(P): FRACTION DIGIT COUNTS
1) ;-1(P), -0(P): FRACTION
1) TLNN C,-1 ;IF ANY TRAILING ZEROES LEFT, A WHOPPING BIG EXP.
1) SKIPE X ;HIGH PART HAD BETTER BE ZERO
1) JRST [SUB P,X33 ;WIPE OUT FRACTION AND DIGIT COUNTS
1) JRST DFSERR] ;AND COMPLAIN
1) POP P,Y ;FRACTION PART
1) POP P,X
1) POP P,C ;DIGIT COUNTS OF FRACTON
1) JRST DFSC
1)
1) HEREFK(LREALIN,LREA.IN)
1) PUSHJ P,SAVE
1) PUSHJ P,NUMIN
1) PUSHJ P,RLNIN
1) DMOVEM A,RACS+A(USER)
1) JRST INRET
1) HEREFK(LREALSCAN,LREA.SCAN)
1) PUSHJ P,SAVE
1) PUSHJ P,STRIN
1) PUSHJ P,RLNIN
1) DMOVEM A,RACS+A(USER)
1) JRST STRRET
1) DSCR INTEGER←INTIN(CHANNEL NUMBER);
**** File 2) IOSER.OLD[10X,AIL], Page 67 line 10
2) PUSHJ P,SAVE
2) PUSHJ P,NUMIN; GET NUMBER IN A AND TEN EXPONENT IN C
2) MOVE LPSA,X22
2) JRST REALFN
2) DSCR REAL←REALSCAN(@"STRING");
2) CAL SAIL
2) ⊗
2) HERE (REALSCAN)
2) PUSHJ P,SAVE
2) PUSHJ P,STRIN
2) MOVE LPSA,X33
2) REALFN: SETZ D,; POS SIGN
2) JUMPE A,ADON
2) JUMPG A,FPOS
2) SETO D,; NUMBER NEGATIVE
2) MOVNS A
2) FPOS: ;WE NOW HAVE A POSITIVE NUMBER IN A WITH SIGN IN D
2) JFFO A,.+1; NUMBER OF LEADING ZEROS IN B
2) ASH A,-1(B); BIT0=0, BIT1=1
2) MOVN X,B; BIN EXPONENT -2
2) JUMPE C,FLO; IF TEN EXPONENT ZERO THEN FINISH
2) JUMPL C,FNEG
2) CAIL C,100; CHECK BOUND OF EXPOENT
2) JRST ERROV1
2) SETZ Y,
2) JRST TEST
2) FNEG: MOVNS C
2) CAIL C,100
2) JRST ERROV1
2) MOVEI Y,6
2) TEST: TRNE C,1; DEPENDING ON LOW ORDER BIT OF EXP
2) JRST MULT; EITHER MULTIPLY
2) NEXT: ASH C,-1; OR DON'T.
2) AOJA Y,TEST; INDEX INTO MULTIPLIER TABLE
2) MULT: ADD X,.CH.(Y); EXPONENT
2) MUL A,.MT.(Y) ;MULTIPLY AND NORMALIZE
2) TLNE A,200000
2) JRST DTEST
2) ASHC A,1
2) SOJA X,.+1
2) DTEST: SOJG C,NEXT
2) FLO: IDIVI A,1B18
2) FSC A,255
2) FSC B,234
2) FADR A,B
2) SKIPE D
2) MOVNS A
2) FSC A,(X); SCALE
2) JRST ALLDON
2) SUBTTL INTIN INTEGER NUMBER INPUT ROUTINE LOU PAUL
2) COMMENT ⊗Intin, Intscan ⊗
2) DSCR INTEGER←INTIN(CHANNEL NUMBER);
***************
**** File 1) IOSER.TNX[10X,AIL], Page 67 line 122
1) PUSHJ P,SAVE
1) PUSHJ P,NUMIN
1) PUSHJ P,RLNIN
1) SNGL A,A
1) PUSHJ P,RFIX
1) JRST INRETA
1) RFIX: ;SIGN(A)*FLOOR(ABS(A)+0.5)
1) KI10< JUMPL A,.+3
1) FIXR A,A
1) POPJ P,
1) MOVN A,A
1) FIXR A,A
1) MOVN A,A
1) POPJ P,
1) >;KI10
1) NOKI10< JUMPL A,.+4
1) FADRI A,(0.5) ;SORRY, 166 !
1) FIX A,A
1) POPJ P,
1) MOVN A,A
1) FADRI A,(0.5)
1) FIX A,A
1) MOVN A,A
1) POPJ P,
1) >;NOKI10
1) DSCR INTEGER←INTSCAN("STRING");
**** File 2) IOSER.OLD[10X,AIL], Page 68 line 8
2) ;INTEGER NUMBER INPUT ROUTINE RETURNS VALUE IN A
2) ;USES NUMIN TO PERFORM FREE FIELD SCAN
2) PUSHJ P,SAVE
2) PUSHJ P,NUMIN; GET NUMBER IN A, TEN EXPONENT IN C
2) MOVE LPSA,X22
2) JRST INTFN
2) DSCR INTEGER←INTSCAN("STRING");
***************
**** File 1) IOSER.TNX[10X,AIL], Page 67 line 153
1) PUSHJ P,SAVE
1) PUSHJ P,STRIN
1) PUSHJ P,RLNIN
1) SNGL A,A
1) PUSHJ P,RFIX
1) JRST STRRTA
1) ;NUMIN -- CONTD.
**** File 2) IOSER.OLD[10X,AIL], Page 68 line 21
2) PUSHJ P,SAVE
2) PUSHJ P,STRIN
2) MOVE LPSA,X33
2) INTFN: JUMPE A,ADON
2) JUMPE C,ADON
2) JUMPL C,DIVOUT; IF EXPONENT NEG WE WILL DIVIDE
2) CAIL C,13
2) JRST ERROV1
2) IMUL A,.TEN.(C)
2) JRST ALLDON
2) DIVOUT: MOVNS C
2) CAIL C,13
2) JRST [SETZ A,
2) JRST ADON ]
2) MOVE C,.TEN.(C)
2) IDIV A,C
2) ASH C,-1
2) CAML B,C; ROUND POSITIVELY
2) AOJA A,ALLDON
2) MOVNS B
2) CAML B,C
2) SOJ A,
2) ALLDON: JOV ERROV1; CHECK FOR OVERFLOW
2) ADON: MOVEM A,RACS+1(USER)
2) JRST RESTR
2) ERROV1: PUSHJ P,ERROV
2) JRST ADON
2) SUBTTL FREE FIELD NUMBER SCANNER LOU PAUL
2) DSCR NUMIN
2) DES THE COMMON ROUTINE USED BY REALIN, REALSCAN, INTIN, ETC.
2) ⊗
2) ;NUMIN PERFORMS A FREE FIELD READ AND RETURNS THE MOST SIGNIFICIANT
2) ;PART OF THE NUMBER IN A AND THE APPROPIATE TENS EXPONENT IN C
2) ;TAKING CARE OF LEADING ZEROS AND TRUNCATION ETC.
2) ;SCANNING IS ACCORDING TO THE FOLLOWING BNF
2) ;<NUMBER>::=<DEL><SIGN><NUM><DEL>
2) ;<NUM> ::=<NO>|<NO><EXP>|<EXP>
2) ;<NO> ::=<INTEGER>|<INTEGER>.|
2) ; <INTEGER>.<INTEGER>|.<INTEGER>
2) ;<INTEGER>::=<DIGIT>|<INTEGER><DIGIT>
2) ;<EXP> ::=E<SIGN><INTEGER>|@<SIGN><INTEGER>
2) ;<DIGIT>::=0|1|2|3|4|5|6|7|8|9
2) ;<SIGN> ::=+|-|<EMPTY>
2) ;NULL AND CARR. RET. ARE IGNORED.
2) ;SCANNING IS FACILITATED BY A CHARACTER CLASS TABLE "TAB" AND
2) ;TWO MACROS AHEAD AND ASTERN. THE LEFT HALF OF THE 200+1 WORD TABLE
2) ;CONTAINS -1 IF NOT A DIGIT AND THE VALUE OF THE DIGIT IF IT IS A DIGIT
2) ;THE RIGHT HALF CONTAINS -1 IF A DIGIT AND THE CLASS NUMBER IF NOT.
2) ;CLASS 0 NULL, CARR RET, NOTHING
2) ;CLASS 1 .
2) ;CLASS 2 -
2) ;CLASS 3 +
2) ;CLASS 4 @,E
2) ;CLASS 5 ANY OTHER CHARACETR
2) ;CLASS 6 END OF FILE
2) ;TAB(200) IS USED FOR FND OF FILE
2) ;MACRO AHEAD IS USED FOR FORWARD SCANNING, ASTERN FOR SCANNING
2) ;THE STACK CONSISTING OF AC Y WHICH HAS CLASS SYMBOLS SHIFTED INTO IT.
2) DEFINE AHEAD(DIG,POINT,MINUS,PLUS,E,CHA,EOF)<
2) HRRE X,TAB(D)
2) JRST @.+2(X)
2) JUMP DIG
2) JRST .-4
2) JUMP POINT
2) JUMP MINUS
2) JUMP PLUS
2) JUMP E
2) JUMP CHA
2) JUMP EOF>
2) DEFINE ASTERN(NULL,POINT,MINUS,PLUS,E,CHA)<
2) SETZ X,
2) LSHC X,3
2) JRST @.+1(X)
2) JUMP NULL
2) JUMP POINT
2) JUMP MINUS
2) JUMP PLUS
2) JUMP E
2) JUMP CHA
2) JUMP CHA>
2) ;NUMIN -- CONTD.
***************
**** File 1) IOSER.TNX[10X,AIL], Page 68 line 13
1) MOVE LPSA,[JSP A,NCH]
1) MOVEI Z,1 ;FOR LINE NUMBER TEST
1) POPJ P,
1) PUSHJ P,SCAN
1) ; READ A CHARACTER FROM INPUT FILE -- FOR SCAN.
**** File 2) IOSER.OLD[10X,AIL], Page 70 line 13
2) MOVE LPSA,[JSP X,NCH]
2) MOVEI Z,1 ;FOR LINE NUMBER TEST
2) PUSHJ P,SCAN
2) SKIPE BRCHAR(CDB) ;USER WANTS BREAK CHARACTER?
2) MOVEM D,@BRCHAR(CDB) ;FIX UP BREAK CHARACTER
2) SOS IOBP(CDB) ;BACK UP TO GET IT NEXT TIME
2) FOR II←1,4 <
2) IBP IOBP(CDB)>
2) AOS IOCNT(CDB)
2) POPJ P,
2) ; READ A CHARACTER FROM INPUT FILE -- FOR SCAN.
***************
**** File 1) IOSER.TNX[10X,AIL], Page 68 line 26
1) JRST (A) ;NO RETURN
1) CAIN D,12 ;LINE FEED?
**** File 2) IOSER.OLD[10X,AIL], Page 70 line 32
2) JRST (X) ;NO RETURN
2) CAIN D,12 ;LINE FEED?
***************
**** File 1) IOSER.TNX[10X,AIL], Page 68 line 30
1) JRST (A) ;NOPE, NOTHING
1) SKIPE PAGNUM(CDB)
**** File 2) IOSER.OLD[10X,AIL], Page 70 line 36
2) JRST (X) ;NOPE, NOTHING
2) SKIPE PAGNUM(CDB)
***************
**** File 1) IOSER.TNX[10X,AIL], Page 68 line 35
1) JRST (A); RETURN
1) NCH7: MOVEI D,200 ;EOF OR DATA ERROR.
1) JRST (A)
1) NCH5: SKIPE SOSNUM(CDB) ;WANT SETPL STUFF?
**** File 2) IOSER.OLD[10X,AIL], Page 70 line 41
2) JRST (X); RETURN
2) NCH7: MOVEI D,200 ;EOF OR DATA ERROR.
2) JRST (X)
2) NCH5: SKIPE SOSNUM(CDB) ;WANT SETPL STUFF?
***************
**** File 1) IOSER.TNX[10X,AIL], Page 68 line 60
1) STRIN:
1) MOVE A,[JSP A,NCHA]
1) HRRZ CHNL,-3(P) ;ADDR OF WD2
1) MOVE CDB,(CHNL) ;BP
1) HRRZ CHNL,-1(CHNL) ;LENGTH
1) POPJ P,
1) ;READ A CHARACTER ROUTINE FOR STRINGS.
1) NCHA: SOJL CHNL,NCH7
1) ILDB D,CDB
1) CAIN D,15
1) JRST NCHA ;IGNORE CR
1) JUMPE D,NCHA ;AND NUL
1) JRST (A)
1) ;LNUMIN NUMBER INPUT
1) COMMENT ⊗
1) These routines form a character-string
1) to number conversion package. GETNUM eats characters one at a time
1) until a non-digit is eaten; GETNUM then returns intermediate information
1) which can be used by the other routines.
1) GETNU1 is the routine to call
1) after GETNUM when a decimal point is seen and you eventually want a floating
1) point number.
1) GETNUM: -1(P) instruction to XCT, gets next character in D
1) (P) return word
1) D first digit
1) result: as in GETNU1
1) GETNU1: X,Y double length partial integer result
1) -1(P) instruction to XCT, gets next character in D
1) (P) return word
1) C # trailing zeroes ,, power of 10 scale factor
1) D first digit
1) result: X,Y double length partial integer result
1) (P) instructin to XCT, gets next character in D
1) FF flags (sign, overflow)
1) C # trailing zeroes ,, scale factor + # digits since then
1) D break character
1) MAKINT: X,Y double length partial integer result
1) (P) return word
1) FF sign flag
1) C # trailing zeroes ,, junk
1) result: A integer value
1) DFSC:
1) X,Y double length partial integer result
1) (P) return word
1) FF flags
1) C # trailing zeroes ,, # digits since decimal point
1) D exponent
1) result: A,B floating point value
1) AC USAGE:
1) FF flags
1) A,B double temp return word for JSP NCH
1) C #tz ,, # digits
1) D char
1) X,Y double integer partial result
1) Z 1 (for testing line numbers)
1) CHNL channel number, or # chars left in string
1) CDB channel data block addr, or bp to string
1) RF res.
1) LPSA scale factor for DMUL gen.temp.
1) TEMP gen. temp.
1) USER res.
1) SP res.
1) P res.
1) ⊗
1) ;GETNUM GETNU1
1) NUMNEG←←400000
1) EXPNEG←←200000
1) GETNUC: XCT -1(P) ;GET A CHAR FIRST
1) GETNUM:
1) SETZB X,Y ;INITIAL RESULT
1) SETZ C, ;DIGIT COUNTS
1) JRST GETNU1
1) GETN1D: TRZA C,-1 ;NUMBER OF DIGITS SINCE DEC. PT IS ZERO
1) GETN1E: AOBJN C,.+1 ;A TRAILING ZERO
1) GETN1C: XCT -1(P) ;GET NEXT CHAR
1) GETNU1: CAIL D,"0"
1) CAILE D,"9"
1) POPJ P, ;NOT DIGIT
1) SUBI D,"0" ;CONVERT TO DIGIT NOW
1) JUMPE D,GETN1E ;A TRAILING ZERO
1) ADDI C,1 ;ANOTHER DIGIT
1) TLNE C,-1 ;WERE THERE TRAILING ZEROES BEFORE IT?
1) PUSHJ P,TZMUL ;YES
1) PUSHJ P,M10ADD ;MULT BY =10 AND ADD D
1) JRST GETN1C
1) TZMUL: HLRZ TEMP,C ;# TRAILING ZEROES
1) JUMPE TEMP,CPOPJ ;QUIT IF NONE
1) MOVEI C,(C) ;WILL BE NONE IF WE FINISH WITHOUT OVERFLOW
1) CAIN TEMP,(C)
1) JRST CPOPJ ;TRAILERS WERE ALSO LEADERS!
1) MOVEI LPSA,(D) ;SAVE DIGIT
1) SETZ D,
1) PUSHJ P,M10ADD ;ADJUST VALUE TO ACCOUNT FOR TRAILING ZEROES
1) SOJG TEMP,.-2
1) MOVEI D,(LPSA) ;RESTORE D
1) POPJ P,
1) M10ADD:
1) MOVE A,Y ;LOW HALF
1) MULI A,=10
1) TLO A+1,400000 ;PREVENT OVERFLOW
1) ADDI A+1,(D) ;ADD NEW DIGIT
1) TLZN A+1,400000 ;WOULD THERE HAVE BEEN AN OVERFLOW?
1) ADDI A,1 ;YES. (THIS CAN'T OVERFLOW; A WAS AT MOST 9)
1) MOVE D,X ;HIGH HALF
1) IMULI D,=10
1) JOV [ADD C,X11 ;PRETEND WE HAD A TRAILING ZERO
1) SOJA C,CPOPJ]
1) TLO D,400000 ;PREVENT OVERFLOW
1) ADDI D,(A) ;CARRY IN FROM LOW HALF
1) TLZN D,400000 ;WOULD THERE HAVE BEEN AN OVERFLOW?
1) JRST @.-4 ;YES
1) MOVEM A+1,Y ;STORE LOW HALF
1) MOVEM D,X ;AND HIGH HALF
1) CPOPJ: POPJ P,
1) ;DFSC
1) ; FF NUMNEG FLAG
1) ; C # TRAILING ZEROES,, # DIGITS SINCE DECIMAL PT.
1) ; D EXPONENT
1) ; X,Y FRACTION
1) DFSC:
1) MOVE A,X ;BEGIN CONVERTING TO PURE FRACTION
1) JFFO A,DFSC1
1) MOVE A,X+1 ;HIGH WD WAS ZERO
1) JFFO A,.+1
1) ADDI A+1,=35
1) DFSC1: MOVEI LPSA,-1(A+1) ;# OF PLACES TO SHIFT (REMEMBER SIGN BIT)
1) ASHC X,(LPSA) ;MAKE INTO PURE FRACTION
1) SUBI LPSA,=70
1) MOVN LPSA,LPSA ;EXPONENT OF 2 OF FRACTION
1)
1) ;***** SOMETHING FISHY HERE. CONSIDER 12345.98@3
1) SUBI D,(C) ;DIGITS SINCE DECIMAL POINT DECREASE THE EXPONENT
1) HLRZ C,C
1) ADDI D,(C) ;BUT TRAILING ZEROES DONT COUNT
1) JUMPE D,DFSC2 ;EXPONENT OF 10 IS ZERO
1) JUMPG D,DFSC3
1) TLO FF,EXPNEG ;EXPONENT WAS NEG
1) MOVN D,D
1) SKIPA TEMP,[EXP.M1,,FR.M1] ;USE THIS TABLE SINCE EXP WAS NEG
1) DFSC3: MOVE TEMP,[EXP.P1,,FR.P1] ;EXP WAS POS
1) TRNE D,777700 ;CHECK EXPONENT RANGE
1) JRST DFSERR
1) TRNE D,40 ;E+-32 INVOLVED?
1) TLNE FF,EXPNEG ;YES. TOO BAD IF E-48
1) JRST MULOOP ;OK
1) TRNE D,20 ;E-48 ?
1) JRST DFSERR
1) MULOOP: TRZE D,1 ;SHOULD WE MULTIPLY?
1) PUSHJ P,DMUL.. ;YES
1) JUMPE D,DFSC2
1) ASH D,-1 ;NEXT BIT INTO POSITION
1) AOBJN TEMP,.+1 ;ADD 1 TO LH
1) AOJA TEMP,MULOOP ;AND 2 TO RH
1) DFSC2:
1) KI10< DMOVE A,X >;KI10
1) NOKI10< MOVE A,X
1) MOVE A+1,X+1 >;NOKI10
1) ASHC A,-8 ;MAKE ROOM FOR EXPONENT
1) FSC A,200(LPSA) ;INSERT IT
1) JFOV DFSERR
1) DFSC4:
1) KI10< TLNE FF,NUMNEG
1) DMOVN A,A
1) POPJ P,
1) >;KI10
1) NOKI10< TLNN FF,NUMNEG
1) POPJ P,
1) SETCA A, ;ONES COMPLEMENT OF HIGH WORD
1) MOVN A+1,A+1 ;TWOS COMPLEMENT OF LOW WORD
1) TLZ A+1,400000 ;FORCE SIGN BIT OFF
1) JUMPN A+1,CPOPJ ;IF LOW SIGNIFICANCE, DONE
1) AOJA A,CPOPJ ;OTHERWISE TWOS COMPLEMENT OF HIGH WORD
1) >;NOKI10
1) DFSERR: ERR <NUMIN: Exponent range exceeded>,1
1) SETOB A,A+1
1) TLNN FF,EXPNEG
1) TLZA A,400000 ;EXPONENT WAS POS, GIVE AN INFINITY
1) SETZB A,A+1 ;EXPONENT WAS NEG, GIVE ZERO
1) JRST DFSC4 ;OF RIGHT SIGN
1) ;DMUL..
1) ;MULTIPLY TWO DOUBLE-LENGTH PURE FRACTIONS. ONE IS (TEMP), OTHER IS X,Y PAIR
1) ;RETURN DOUBLE-LENGTH RESULT IN X,Y
1) ;SCALE FACTOR KEPT IN LPSA
1) DMUL..:
1) NOKL10< PUSH P,X ;SAVE HIGH
1) SETZM X ;1ST WORD, FINAL PRODUCT
1) MOVE A,(TEMP) ;HIGH
1) MULM A,Y ;* LOW
1) ;IGNORING 3RD WORDS: 8 EXPONENT BITS TO BURN
1) MOVE A,1(TEMP) ;LOW
1) MUL A,(P) ;* HIGH
1) TLO A,400000 ;PREVENT OVERFLOWS
1) ADD A,Y ;ADD 2ND WORDS
1) TLZN A,400000 ;WOULD THERE HAVE BEEN AN OVERFLOW?
1) AOS X ;YES, DO CARRY (SETS X TO 1)
1) MOVEM A,Y ;STORE LOW RESULT
1) POP P,A ;HIGH
1) MUL A,(TEMP) ;* HIGH
1) TLO A+1,400000 ;PREVENT OVERFLOW
1) ADD A+1,Y ;COLLECT 2ND WORD
1) TLZN A+1,400000 ;WOULD THERE HAVE BEEN AN OVERFLOW?
1) ADDI A,1 ;YES
1) ADD A,X ;COLLECT 1ST WORD (THIS CAN'T OVERFLOW)
1) >;NOKL10
1) KL10<
1) DMOVE A,X
1) DMOVEM A+2,X
1) DMUL A,(TEMP)
1) DMOVE A+2,X
1) >;KL10
1) TLNE A,(1B1) ;NORMALIZED FRACTION?
1) JRST .+3 ;YES
1) ASHC A,1 ;NO, SHIFT OVER
1) SUBI LPSA,1 ;AND ADJUST EXPONENT
1) MOVS TEMP,TEMP ;COLLECT EXPONENT CHANGES
1) ADD LPSA,(TEMP)
1) MOVS TEMP,TEMP
1) MOVEM A,X ;STORE RESULT SO FAR
1) MOVEM A+1,Y
1) POPJ P,
1) FR.P1: 240000,,0 ;10↑1 PURE FRACTION PART
1) 0
1) 310000,,0 ;10↑2
1) 0
1) 234200,,0 ;10↑4
1) 0
1) 276570,,200000 ;10↑8
1) 0
1) 216067,,446770 ;10↑16
1) 040000,,0
1) 235613,,266501 ;10↑32
1) 133413,,263574
1) EXP.P1: 4 ;POWER OF 2 EXPONENT PART
1) 7
**** File 2) IOSER.OLD[10X,AIL], Page 70 line 66
2) STRIN: MOVE LPSA,[JSP X,NCHA]
2) HRRZ Z,-3(P)
2) HRRZ Z,-1(Z)
2) HRRZS -3(P) ;SO CAN INDIRECT THROUGH IT.
2) PUSHJ P,SCAN
2) HRRZ X,-3(P)
2) SOS (X) ;BACK UP BYTE POINTER
2) FOR II←1,4<
2) IBP (X)>
2) AOJ Z,
2) HRRM Z,-1(X)
2) MOVEM D,@-2(P) ;STORE BREAK CHARACTER
2) POPJ P,
2) ;READ A CHARACTER ROUTINE FOR STRINGS.
2) NCHA: SOJL Z,NCH7
2) ILDB D,@-4(P)
2) JRST (X)
2) ;SCAN (CALLED BY NUMIN AND STRIN)
2) SCAN: JOV .+1
2) SETO TEMP, ;FLAG REGISTER.
2) SETZ Y,
2) SETZB A,C; NUMBER EXPOENT
2) MORE: XCT LPSA; THIS GETS A CHARACTER IN D,200 IF FO EOF
2) AHEAD(DIG1,STACK,STACK,STACK,STACK,STACK,DONE)
2) STACK: LSHC X,-3; PUSH SYMBOL ONTO STACK "AC Y"
2) JRST MORE
2) DIG1: SETZ TEMP,; FLAG REG.
2) ASTERN(INT1,FRA1,SIG1,SIG2,EXP1,INT1)
2) SIG1: TRO TEMP,4; NEGATIVE SIGN
2) SIG2: ASTERN(INT1,ERR2,ERR5,ERR5,EXP1,INT1)
2) EXP1: MOVEI A,1
2) ASTERN(EXP2,ERR2,SIG3,SIG4,ERR1,EXP2)
2) SIG3: MOVNS A
2) SIG4: ASTERN(EXP2,ERR2,ERR5,ERR5,ERR1,EXP2)
2) FRA1: TRO TEMP,1; DECIMAL POINT
2) SOJ C,
2) ASTERN(INT1,ERR2,SIG5,SIG6,ERR1,INT1)
2) SIG5: TRO TEMP,4; NEGATIVE SIGN
2) SIG6: ASTERN(INT1,ERR2,ERR5,ERR5,ERR1,INT1)
2) EXP2: HLRE FF,TAB(D); FIRST DIGIT
2) EXP5: XCT LPSA; GET NEXT CHARACTER
2) EXP9: HLRE B,TAB(D)
2) JUMPL B,EEXP; NEGATIVE IF NOT A DIGIT
2) IMULI FF,12
2) ADD FF,B
2) JRST EXP5
2) XCT LPSA
2) ;;#QD# SEE DONE5: BELOW
2) ;;#XR# ! JFR 10-31-76/2-8-77 TREAT SIGNS AFTER EXPONENT JUST LIKE OTHER CHARS
2) EEXP: AHEAD(EXP9,ERR2,EN,EN,ERR1,EN,EN)
2) EN: TRNE TEMP,4; SIGN OF EXPONENT
2) MOVNS FF
2) ADD C,FF; FIX UP EXPONENT
2) JOV ERR3
2) ;#QD# CHANGE ALL 'ERR5'S IN AHEAD MACROS DO 'DONE5'S, TO AVOID SNARFING EXTRA
2) ;SIGNS ..... RFS 12-15-73 (TWO PLACES BELOW AND ONE ABOVE ALSO)
2) DONE5:
2) DONE: ANDI D,177
2) JUMPGE TEMP,.+2
2) SETO D,
2) POPJ P,
2) INT1: HLRE A,TAB(D); FIRST DIGIT
2) TRNE TEMP,4
2) MOVNS A; NEGATE IF NECESSARY
2) INT2: XCT LPSA; GET NEXT CHARACTER
2) INT5: HLRE B,TAB(D)
2) JUMPL B,EON; NEGATIVE IF NOT A NUMBER
2) TRNE TEMP,1; IF PASSED DECIMAL POINT THEN DEC EXP BY ONE
2) SOJ C,
2) TRNE TEMP,2; IF ENOUGH DIGITS THEN INC EXP BY ONE
2) INT3: AOJA C,INT2
2) MOVE X,A
2) IMULI A,12
2) ;;%##% RHT/JFR 2-8-77 ! HAVE TO TRAP THESE OVERFLOWS RIGHT AWAY
2) JOV INT4
2) TRNE TEMP,4; NEGATE DIGIT IS SIGN NEGATIVE
2) MOVNS B
2) ADD A,B
2) JOV INT4; CHECK FOR OVERFLOW
2) JRST INT2; IF SO USE LAST VALUE
2) INT4: TRO TEMP,2
2) MOVE A,X
2) ;;%##% USED TO BE JRST INT3 /JFR 2-8-77
2) AOJA C,INT2
2) XCT LPSA
2) EON: AHEAD(INT5,DP1,DONE,DONE,EXP6,DONE,DONE)
2) DP1: TROE TEMP,1
2) JRST ERR2
2) XCT LPSA
2) ;#QD# (SEE DONE5: ABOVE)
2) AHEAD(INT5,ERR2,DONE5,DONE5,EXP6,DONE,DONE)
2) EXP6: SETZ TEMP,
2) XCT LPSA
2) AHEAD(EXP2,ERR2,EXP7,EXP8,ERR1,ERR1,ERR1)
2) EXP7: TRO TEMP,4
2) EXP8: XCT LPSA
2) ;#QD# (SEE DONE5: ABOVE)
2) AHEAD(EXP2,ERR2,DONE5,DONE5,ERR1,ERR1,ERR1)
2) ERR1: ERR(<NUMIN: IMPROPER EXPONENT>,1,RZ)
2) ERR2: ERR(<NUMIN: MISPLACED DECIMAL POINT>,1,RZ)
2) ERR3: ERR(<NUMIN: EXPONENT OUT OF BOUND>,1,RZ)
2) ERR5: ERR(<NUMIN: MISPLACED SIGN>,1,RZ)
2) ERROV: ERR(<NUMIN: NUMBER OUT OF BOUND>,1,RZ)
2) NUMBAD: ERR<NUMIN: Illegal JFN, byte-size or mode>
2) POPJ P,
2) BEGIN NUMTBL
2) ↑NUMTBL:JRST DOSETCI ;0 -- XNULL
2) MOVE CHNL,1 ;1 -- XICHAR
2) JRST .COSCI ;2 -- XOCHAR
2) JRST .WISCI ;3 -- XIWORD
2) JRST .WOSCI ;4 -- XOWORD
2) MOVE CHNL,1 ;5 -- XCICHAR
2) REPEAT 2,<JRST NUMBAD> ;6,7
2) MOVE CHNL,1 ;10 -- XBYTE7
2) MOVE CHNL,1 ;11 -- XDICHAR
2) REPEAT 2,<JRST NUMBAD> ;12,13
2) DOSETCI:
2) PUSHJ P,SETCI
2) JRST NUMSIM
2)
2) .COSCI: PUSHJ P,COSCI
2) JRST NUMSIM
2) .WISCI: PUSHJ P,WISCI
2) JRST NUMSIM
2) .WOSCI: PUSHJ P,WOSCI
2) JRST NUMSIM
2) BEND NUMTBL
2) NUMINP: PUSHJ P,DOINP
2) JRST NCH ;BUFFERED INPUT
2) JRST NCH1.1 ;7-BIT
2) JRST NCH7 ;EOF OR ERROR
2) RZ: SETZ A,
2) JRST DONE
2) ; Character table for SCAN (Realscan,Intscan,Realin,Intin)
2) TAB: FOR A IN (0,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,0,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) ;#QC# MAKE 32 (CONTROL Z) IGNORED
2) FOR A IN (5,5,0,5,5,5,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,3,5,2,1,5)<XWD -1,A
2) >
2) FOR A IN (0,1,2,3,4,5,6,7,10,11)<XWD A,-1
2) >
2) FOR A IN (5,5,5,5,5,5)<XWD -1,A
2) >
2) ;;%DY% ! GJA/JFR 1-13-77 MAKE "E" EQUIVALENT TO "@"
2) FOR A IN (4,5,5,5,5,4,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) FOR A IN (5,5,5,5,5,5,5,5)<XWD -1,A
2) >
2) XWD -1,6
2) ENDCOM(NUM)
2) COMPIL(TBB,<.CH.,.TEN.,.MT.>,,<TABLES FOR L PAUL'S ROUTINES>)
2) DSCR DATA TABLES FOR REALIN, INTSCAN, ETC.
2) ⊗
2) ↑↑.CH.: 4
2) 7
***************
**** File 1) IOSER.TNX[10X,AIL], Page 69 line 245
1) FR.M1: 314631,,463146 ;10↑-1
1) 146314,,631463
1) 243656,,050753 ;10↑-2
1) 205075,,314217
1) 321556,,135307 ;10↑-4
1) 020626,,245364
1) 253630,,734214 ;10↑-8
1) 043034,,737425
1) 346453,,122766 ;10↑-16
1) 042336,,053314
1) 317542,,172552 ;10↑-32
1) 051631,,227215
1) EXP.M1: -3
1) -6
1) -15
1) -32
1) -65
1) -152
1) BEGIN NUMTBL
1) ↑NUMTBL:JRST DOSETCI ;0 -- XNULL
1) MOVE CHNL,1 ;1 -- XICHAR
1) JRST .COSCI ;2 -- XOCHAR
1) JRST .WISCI ;3 -- XIWORD
1) JRST .WOSCI ;4 -- XOWORD
1) MOVE CHNL,1 ;5 -- XCICHAR
1) REPEAT 2,<JRST NUMBAD> ;6,7
1) MOVE CHNL,1 ;10 -- XBYTE7
1) MOVE CHNL,1 ;11 -- XDICHAR
1) REPEAT 2,<JRST NUMBAD> ;12,13
1) DOSETCI:
1) PUSHJ P,SETCI
1) JRST NUMSIM
1)
1) .COSCI: PUSHJ P,COSCI
1) JRST NUMSIM
1) .WISCI: PUSHJ P,WISCI
1) JRST NUMSIM
1) .WOSCI: PUSHJ P,WOSCI
1) JRST NUMSIM
1) BEND NUMTBL
1) NUMINP: PUSHJ P,DOINP
1) JRST NCH ;BUFFERED INPUT
1) JRST NCH1.1 ;7-BIT
1) JRST NCH7 ;EOF OR ERROR
1) RZ: SETZ A,
1) JRST DONE
1) IFN ALWAYS,<BEND NUMIN>
1) COMPIL(TBB,<.CH.,.TEN.,.MT.>,,<TABLES FOR L PAUL'S ROUTINES>)
1) DSCR DATA TABLES FOR REALIN, INTSCAN, ETC.
1) ⊗
1) ↑↑.CH.: 4
1) 7
1) 16
1) 33
1) 66
1) 153
1) 777777777775
**** File 2) IOSER.OLD[10X,AIL], Page 73 line 10
2) 777777777775
***************