80-Bus News

  

May–June 1984, Volume 3, Issue 3











Page 24 of 51











Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    92

FBEC 77         RESEED: LD      (HL),A          ; Re-seed random numbers
FBED 2B                 DEC     HL
FBEE 77                 LD      (HL),A
FBEF 2B                 DEC     HL
FBF0 77                 LD      (HL),A
FBF1 C3C7FB             JP      RND1            ; Return RND seed

FBF4 68B14668   RNDTAB: DEFB    068H,0B1H,046H,068H     ; Table used by RND
FBF8 99E99269           DEFB    099H,0E9H,092H,069H
FBFC 10D17568           DEFB    010H,0D1H,075H,068H

FC00 214AFC     COS:    LD      HL,HALFPI       ; Point to PI/2
FC03 CDBEF5             CALL    ADDPHL          ; Add it to PPREG
FC06 CD44F8     SIN:    CALL    STAKFP          ; Put angle on stack
FC09 014983             LD      BC,8349H        ; BCDE = 2 PI
FC0C 11DB0F             LD      DE,0FDBH
FC0F CD54F8             CALL    FPBCDE          ; Move 2 PI to FPREG
FC12 C1                 POP     BC              ; Restore angle
FC13 D1                 POP     DE
FC14 CD69F7             CALL    DVBCDE          ; Divide angle by 2 PI
FC17 CD44F8             CALL    STAKFP          ; Put it on stack
FC1A CDE6F8             CALL    INT             ; Get INT of result
FC1D C1                 POP     BC              ; Restore number
FC1E D1                 POP     DE
FC1F CDCAF5             CALL    SUBCDE          ; Make it 0 <= value < 1
FC22 214EFC             LD      HL,QUARTR       ; Point to 0.25
FC25 CDC4F5             CALL    SUBPHL          ; Subtract value from 0.25
FC28 CD13F8             CALL    TSTSGN          ; Test sign of value
FC2B 37                 SCF                     ; Flag positive
FC2C F236FC             JP      P,SIN1          ; Positive - Ok
FC2F CDBBF5             CALL    ROUND           ; Add 0.5 to value
FC32 CD13F8             CALL    TSTSGN          ; Test sign of value
FC35 B7                 OR      A               ; Flag negative
FC36 F5         SIN1:   PUSH    AF              ; Save sign
FC37 F43CF8             CALL    P,INVSGN        ; Negate value if positive
FC3A 214EFC             LD      HL,QUARTR       ; Point to 0.25
FC3D CDBEF5             CALL    ADDPHL          ; Add 0.25 to value
FC40 F1                 POP     AF              ; Restore sign
FC41 D43CF8             CALL    NC,INVSGN       ; Negative - Make positive
FC44 2152FC             LD      HL,SINTAB       ; Coefficient table
FC47 C35BFB             JP      SUMSER          ; Evaluate sum of series

FC4A DB0F4981   HALFPI: DEFB    0DBH,00FH,049H,081H     ; 1.5708 (PI/2)

FC4E 0000007F   QUARTR: DEFB    000H,000H,000H,07FH     ; 0.25

FC52 05         SINTAB: DEFB    5                       ; Table used by SIN
FC53 BAD71E86           DEFB    0BAH,0D7H,01EH,086H     ; 39.711
FC57 64269987           DEFB    064H,026H,099H,087H     ;-76.575
FC5B 58342387           DEFB    058H,034H,023H,087H     ; 81.602
FC5F E05DA586           DEFB    0E0H,05DH,0A5H,086H     ;-41.342
FC63 DA0F4983           DEFB    0DAH,00FH,049H,083H     ;  6.2832
Dis-assembly of NASCOM ROM BASIC Ver 4.7                PAGE    93

FC67 CD44F8     TAN:    CALL    STAKFP          ; Put angle on stack
FC6A CD06FC             CALL    SIN             ; Get SIN of angle
FC6D C1                 POP     BC              ; Restore angle
FC6E E1                 POP     HL
FC6F CD44F8             CALL    STAKFP          ; Save SIN of angle
FC72 EB                 EX      DE,HL           ; BCDE = Angle
FC73 CD54F8             CALL    FPBCDE          ; Angle to FPREG
FC76 CD00FC             CALL    COS             ; Get COS of angle
FC79 C367F7             JP      DIV             ; TAN = SIN / COS

FC7C CD13F8     ATN:    CALL    TSTSGN          ; Test sign of value
FC7F FCA7FA             CALL    M,NEGAFT        ; Negate result after if -ve
FC82 FC3CF8             CALL    M,INVSGN        ; Negate value if -ve
FC85 3AE710             LD      A,(FPEXP)       ; Get exponent
FC88 FE81               CP      81H             ; Number less than 1?
FC8A DA99FC             JP      C,ATN1          ; Yes - Get arc tangnt
FC8D 010081             LD      BC,8100H        ; BCDE = 1
FC90 51                 LD      D,C
FC91 59                 LD      E,C
FC92 CD69F7             CALL    DVBCDE          ; Get reciprocal of number
FC95 21C4F5             LD      HL,SUBPHL       ; Sub angle from PI/2
FC98 E5                 PUSH    HL              ; Save for angle > 1
FC99 21A3FC     ATN1:   LD      HL,ATNTAB       ; Coefficient table
FC9C CD5BFB             CALL    SUMSER          ; Evaluate sum of series
FC9F 214AFC             LD      HL,HALFPI       ; PI/2 - angle in case > 1
FCA2 C9                 RET                     ; Number > 1 - Sub from PI/2

FCA3 09         ATNTAB: DEFB    9                       ; Table used by ATN
FCA4 4AD73B78           DEFB    04AH,0D7H,03BH,078H     ; 1/17
FCA8 026E847B           DEFB    002H,06EH,084H,07BH     ;-1/15
FCAC FEC12F7C           DEFB    0FEH,0C1H,02FH,07CH     ; 1/13
FCB0 74319A7D           DEFB    074H,031H,09AH,07DH     ;-1/11
FCB4 843D5A7D           DEFB    084H,03DH,05AH,07DH     ; 1/9
FCB8 C87F917E           DEFB    0C8H,07FH,091H,07EH     ;-1/7
FCBC E4BB4C7E           DEFB    0E4H,0BBH,04CH,07EH     ; 1/5
FCC0 6CAAAA7F           DEFB    06CH,0AAH,0AAH,07FH     ;-1/3
FCC4 00000081           DEFB    000H,000H,000H,081H     ; 1/1

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

NASCOM ROM BASIC source code is available in ASM and LST file format.











Page 24 of 51