Nascom
ROM
BASIC
Dis–Assembled
PART 6
By Carl Lloyd–Parker
Dis-assembly of NASCOM ROM BASIC Ver 4.7 PAGE 77
F75B CD44F8 DIV10: CALL STAKFP ; Save FPREG on stack
F75E 012084 LD BC,8420H ; BCDE = 10.
F761 110000 LD DE,0000H
F764 CD54F8 CALL FPBCDE ; Move 10 to FPREG
F767 C1 DIV: POP BC ; Get number from stack
F768 D1 POP DE
F769 CD13F8 DVBCDE: CALL TSTSGN ; Test sign of FPREG
F76C CAB0E3 JP Z,DZERR ; Error if division by zero
F76F 2EFF LD L,-1 ; Flag subtract exponents
F771 CDD1F7 CALL ADDEXP ; Subtract exponents
F774 34 INC (HL) ; Add 2 to exponent to adjust
F775 34 INC (HL)
F776 2B DEC HL ; Point to MSB
F777 7E LD A,(HL) ; Get MSB of dividend
F778 321210 LD (DIV3),A ; Save for subtraction
F77B 2B DEC HL
F77C 7E LD A,(HL) ; Get NMSB of dividend
F77D 320E10 LD (DIV2),A ; Save for subtraction
F780 2B DEC HL
F781 7E LD A,(HL) ; Get MSB of dividend
F782 320A10 LD (DIV1),A ; Save for subtraction
F785 41 LD B,C ; Get MSB
F786 EB EX DE,HL ; NMSB,LSB to HL
F787 AF XOR A
F788 4F LD C,A ; Clear MSB of quotient
F789 57 LD D,A ; Clear NMSB of quotient
F78A 5F LD E,A ; Clear LSB of quotient
F78B 321510 LD (DIV4),A ; Clear overflow count
F78E E5 DIVLP: PUSH HL ; Save divisor
F78F C5 PUSH BC
F790 7D LD A,L ; Get LSB of number
F791 CD0910 CALL DIVSUP ; Subt' divisor from dividend
F794 DE00 SBC A,0 ; Count for overflows
F796 3F CCF
F797 D2A1F7 JP NC,RESDIV ; Restore divisor if borrow
F79A 321510 LD (DIV4),A ; Re-save overflow count
F79D F1 POP AF ; Scrap divisor
F79E F1 POP AF
F79F 37 SCF ; Set carry to
F7A0 D2 DEFB (JP NC,nn) ; Skip "POP BC" and "POP HL"