80-Bus News

  

March–April 1984 · Volume 3 · Issue 2

Page 25 of 51
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    80

F838 CD13F8     ABS:    CALL    TSTSGN          ; Test sign of FPREG
F83B F0                 RET     P               ; Return if positive
F83C 21E610     INVSGN: LD      HL,FPREG+2      ; Point to MSB
F83F 7E                 LD      A,(HL)          ; Get sign of mantissa
F840 EE80               XOR     80H             ; Invert sign of mantissa
F842 77                 LD      (HL),A          ; Re-save sign of mantissa
F843 C9                 RET

F844 EB         STAKFP: EX      DE,HL           ; Save code string address
F845 2AE410             LD      HL,(FPREG)      ; LSB,NLSB of FPREG
F848 E3                 EX      (SP),HL         ; Stack them,get return
F849 E5                 PUSH    HL              ; Re-save return
F84A 2AE610             LD      HL,(FPREG+2)    ; MSB and exponent of FPREG
F84D E3                 EX      (SP),HL         ; Stack them,get return
F84E E5                 PUSH    HL              ; Re-save return
F84F EB                 EX      DE,HL           ; Restore code string address
F850 C9                 RET

F851 CD62F8     PHLTFP: CALL    LOADFP          ; Number at HL to BCDE
F854 EB         FPBCDE: EX      DE,HL           ; Save code string address
F855 22E410             LD      (FPREG),HL      ; Save LSB,NLSB of number
F858 60                 LD      H,B             ; Exponent of number
F859 69                 LD      L,C             ; MSB of number
F85A 22E610             LD      (FPREG+2),HL    ; Save MSB and exponent
F85D EB                 EX      DE,HL           ; Restore code string address
F85E C9                 RET

F85F 21E410     BCDEFP: LD      HL,FPREG        ; Point to FPREG
F862 5E         LOADFP: LD      E,(HL)          ; Get LSB of number
F863 23                 INC     HL
F864 56                 LD      D,(HL)          ; Get NMSB of number
F865 23                 INC     HL
F866 4E                 LD      C,(HL)          ; Get MSB of number
F867 23                 INC     HL
F868 46                 LD      B,(HL)          ; Get exponent of number
F869 23         INCHL:  INC     HL              ; Used for conditional "INC HL"
F86A C9                 RET

F86B 11E410     FPTHL:  LD      DE,FPREG        ; Point to FPREG
F86E 0604       DETHL4: LD      B,4             ; 4 bytes to move
F870 1A         DETHLB: LD      A,(DE)          ; Get source
F871 77                 LD      (HL),A          ; Save destination
F872 13                 INC     DE              ; Next source
F873 23                 INC     HL              ; Next destination
F874 05                 DEC     B               ; Count bytes
F875 C270F8             JP      NZ,DETHLB       ; Loop if more
F878 C9                 RET
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    81

F879 21E610     SIGNS:  LD      HL,FPREG+2      ; Point to MSB of FPREG
F87C 7E                 LD      A,(HL)          ; Get MSB
F87D 07                 RLCA                    ; Old sign to carry
F87E 37                 SCF                     ; Set MSBit
F87F 1F                 RRA                     ; Set MSBit of MSB
F880 77                 LD      (HL),A          ; Save new MSB
F881 3F                 CCF                     ; Complement sign
F882 1F                 RRA                     ; Old sign to carry
F883 23                 INC     HL
F884 23                 INC     HL
F885 77                 LD      (HL),A          ; Set sign of result
F886 79                 LD      A,C             ; Get MSB
F887 07                 RLCA                    ; Old sign to carry
F888 37                 SCF                     ; Set MSBit
F889 1F                 RRA                     ; Set MSBit of MSB
F88A 4F                 LD      C,A             ; Save MSB
F88B 1F                 RRA
F88C AE                 XOR     (HL)            ; New sign of result
F88D C9                 RET

F88E 78         CMPNUM: LD      A,B             ; Get exponent of number
F88F B7                 OR      A
F890 CA13F8             JP      Z,TSTSGN        ; Zero - Test sign of FPREG
F893 211CF8             LD      HL,RETREL       ; Return relation routine
F896 E5                 PUSH    HL              ; Save for return
F897 CD13F8             CALL    TSTSGN          ; Test sign of FPREG
F89A 79                 LD      A,C             ; Get MSB of number
F89B C8                 RET     Z               ; FPREG zero - Number's MSB
F89C 21E610             LD      HL,FPREG+2      ; MSB of FPREG
F89F AE                 XOR     (HL)            ; Combine signs
F8A0 79                 LD      A,C             ; Get MSB of number
F8A1 F8                 RET     M               ; Exit if signs different
F8A2 CDA8F8             CALL    CMPFP           ; Compare FP numbers
F8A5 1F                 RRA                     ; Get carry to sign
F8A6 A9                 XOR     C               ; Combine with MSB of number
F8A7 C9                 RET

F8A8 23         CMPFP:  INC     HL              ; Point to exponent
F8A9 78                 LD      A,B             ; Get exponent
F8AA BE                 CP      (HL)            ; Compare exponents
F8AB C0                 RET     NZ              ; Different
F8AC 2B                 DEC     HL              ; Point to MBS
F8AD 79                 LD      A,C             ; Get MSB
F8AE BE                 CP      (HL)            ; Compare MSBs
F8AF C0                 RET     NZ              ; Different
F8B0 2B                 DEC     HL              ; Point to NMSB
F8B1 7A                 LD      A,D             ; Get NMSB
F8B2 BE                 CP      (HL)            ; Compare NMSBs
F8B3 C0                 RET     NZ              ; Different
F8B4 2B                 DEC     HL              ; Point to LSB
F8B5 7B                 LD      A,E             ; Get LSB
F8B6 96                 SUB     (HL)            ; Compare LSBs
F8B7 C0                 RET     NZ              ; Different
F8B8 E1                 POP     HL              ; Drop RETurn
F8B9 E1                 POP     HL              ; Drop another RETurn
F8BA C9                 RET

NASCOM ROM BASIC dis-assembled is available in ASM and LST file format.

Page 25 of 51