80-Bus News

  

January-February 1984, Volume 3, Issue 1











Page 34 of 55











Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    75

F6A1 C609       SHRITE: ADD     A,8+1           ; Adjust count
F6A3 6F                 LD      L,A             ; Save bits to shift
F6A4 AF         SHRLP:  XOR     A               ; Flag for all done
F6A5 2D                 DEC     L               ; All shifting done?
F6A6 C8                 RET     Z               ; Yes - Return
F6A7 79                 LD      A,C             ; Get MSB
F6A8 1F         SHRT1:  RRA                     ; Shift it right
F6A9 4F                 LD      C,A             ; Re-save
F6AA 7A                 LD      A,D             ; Get NMSB
F6AB 1F                 RRA                     ; Shift right with last bit
F6AC 57                 LD      D,A             ; Re-save it
F6AD 7B                 LD      A,E             ; Get LSB
F6AE 1F                 RRA                     ; Shift right with last bit
F6AF 5F                 LD      E,A             ; Re-save it
F6B0 78                 LD      A,B             ; Get underflow
F6B1 1F                 RRA                     ; Shift right with last bit
F6B2 47                 LD      B,A             ; Re-save underflow
F6B3 C3A4F6             JP      SHRLP           ; More bits to do

F6B6 00000081   UNITY:  DEFB    000H,000H,000H,081H     ; 1.00000

F6BA 03         LOGTAB: DEFB    3                       ; Table used by LOG
F6BB AA561980           DEFB    0AAH,056H,019H,080H     ; 0.59898
F6BF F1227680           DEFB    0F1H,022H,076H,080H     ; 0.96147
F6C3 45AA3882           DEFB    045H,0AAH,038H,082H     ; 2.88539

F6C7 CD13F8     LOG:    CALL    TSTSGN          ; Test sign of value
F6CA B7                 OR      A
F6CB EAA0E9             JP      PE,FCERR        ; ?FC Error if <= zero
F6CE 21E710             LD      HL,FPEXP        ; Point to exponent
F6D1 7E                 LD      A,(HL)          ; Get exponent
F6D2 013580             LD      BC,8035H        ; BCDE = SQR(1/2)
F6D5 11F304             LD      DE,04F3H
F6D8 90                 SUB     B               ; Scale value to be < 1
F6D9 F5                 PUSH    AF              ; Save scale factor
F6DA 70                 LD      (HL),B          ; Save new exponent
F6DB D5                 PUSH    DE              ; Save SQR(1/2)
F6DC C5                 PUSH    BC
F6DD CDCDF5             CALL    FPADD           ; Add SQR(1/2) to value
F6E0 C1                 POP     BC              ; Restore SQR(1/2)
F6E1 D1                 POP     DE
F6E2 04                 INC     B               ; Make it SQR(2)
F6E3 CD69F7             CALL    DVBCDE          ; Divide by SQR(2)
F6E6 21B6F6             LD      HL,UNITY        ; Point to 1.
F6E9 CDC4F5             CALL    SUBPHL          ; Subtract FPREG from 1
F6EC 21BAF6             LD      HL,LOGTAB       ; Coefficient table
F6EF CD5BFB             CALL    SUMSER          ; Evaluate sum of series
F6F2 018080             LD      BC,8080H        ; BCDE = -0.5
F6F5 110000             LD      DE,0000H
F6F8 CDCDF5             CALL    FPADD           ; Subtract 0.5 from FPREG
F6FB F1                 POP     AF              ; Restore scale factor
F6FC CD8EF9             CALL    RSCALE          ; Re-scale number
F6FF 013180     MULLN2: LD      BC,8031H        ; BCDE = Ln(2)
F702 111872             LD      DE,7218H
F705 21                 DEFB    (LD HL,nn)      ; Skip "POP BC" and "POP DE"

Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    76

F706 C1         MULT:   POP     BC              ; Get number from stack
F707 D1                 POP     DE
F708 CD13F8     FPMULT: CALL    TSTSGN          ; Test sign of FPREG
F70B C8                 RET     Z               ; Return zero if zero
F70C 2E00               LD      L,0             ; Flag add exponents
F70E CDD1F7             CALL    ADDEXP          ; Add exponents
F711 79                 LD      A,C             ; Get MSB of multiplier
F712 32F610             LD      (MULVAL),A      ; Save MSB of multiplier
F715 EB                 EX      DE,HL
F716 22F710             LD      (MULVAL+1),HL   ; Save rest of multiplier
F719 010000             LD      BC,0            ; Partial product (BCDE) = zero
F71C 50                 LD      D,B
F71D 58                 LD      E,B
F71E 211EF6             LD      HL,BNORM        ; Address of normalise
F721 E5                 PUSH    HL              ; Save for return
F722 212AF7             LD      HL,MULT8        ; Address of 8 bit multiply
F725 E5                 PUSH    HL              ; Save for NMSB,MSB
F726 E5                 PUSH    HL              ;
F727 21E410             LD      HL,FPREG        ; Point to number
F72A 7E         MULT8:  LD      A,(HL)          ; Get LSB of number
F72B 23                 INC     HL              ; Point to NMSB
F72C B7                 OR      A               ; Test LSB
F72D CA56F7             JP      Z,BYTSFT        ; Zero - shift to next byte
F730 E5                 PUSH    HL              ; Save address of number
F731 2E08               LD      L,8             ; 8 bits to multiply by
F733 1F         MUL8LP: RRA                     ; Shift LSB right
F734 67                 LD      H,A             ; Save LSB
F735 79                 LD      A,C             ; Get MSB
F736 D244F7             JP      NC,NOMADD       ; Bit was zero - Don't add
F739 E5                 PUSH    HL              ; Save LSB and count
F73A 2AF710             LD      HL,(MULVAL+1)   ; Get LSB and NMSB
F73D 19                 ADD     HL,DE           ; Add NMSB and LSB
F73E EB                 EX      DE,HL           ; Leave sum in DE
F73F E1                 POP     HL              ; Restore MSB and count
F740 3AF610             LD      A,(MULVAL)      ; Get MSB of multiplier
F743 89                 ADC     A,C             ; Add MSB
F744 1F         NOMADD: RRA                     ; Shift MSB right
F745 4F                 LD      C,A             ; Re-save MSB
F746 7A                 LD      A,D             ; Get NMSB
F747 1F                 RRA                     ; Shift NMSB right
F748 57                 LD      D,A             ; Re-save NMSB
F749 7B                 LD      A,E             ; Get LSB
F74A 1F                 RRA                     ; Shift LSB right
F74B 5F                 LD      E,A             ; Re-save LSB
F74C 78                 LD      A,B             ; Get VLSB
F74D 1F                 RRA                     ; Shift VLSB right
F74E 47                 LD      B,A             ; Re-save VLSB
F74F 2D                 DEC     L               ; Count bits multiplied
F750 7C                 LD      A,H             ; Get LSB of multiplier
F751 C233F7             JP      NZ,MUL8LP       ; More - Do it
F754 E1         POPHRT: POP     HL              ; Restore address of number
F755 C9                 RET

F756 43         BYTSFT: LD      B,E             ; Shift partial product left
F757 5A                 LD      E,D
F758 51                 LD      D,C
F759 4F                 LD      C,A
F75A C9                 RET


This is an OCR’d version of the scanned page and likely contains recognition errors.











Page 34 of 55