File DIVSUB

Directory of image this file is from
This file as a plain text file

*20
/DIVSUB
/SUBROUTINE
/DIVIDES A SIGNED 23 BIT NO.
/BY A SIGNED 11 BIT NO.
/MARK STEIN
/DEC
Q3,	 CLR 
/FORM RETURN
	ADD  0
	STC  Q6
	ADD  Q1
/DETERMINE
/QUOTIENT SIGN
	BCO 
	Q4
	STC  Q5
	ADD  Q4
	AZE  I 
/REJECT 0 DIV
	HLT 
	APO 
	JMP  .+2
/MAKE DIVIS NEG
	COM 
	ADA  I 
	1
	STA 
	Q6+6
	STC  Q4
	ADD  Q1
	APO  I 
	JMP  .+6
/MAKE DIVID POS
	COM 
	STC  Q1
	ADD  Q2
	COM 
	STC  Q2
/RESET ROT CTR
	SET  I  1
	1763
	CLR 
	ADD  Q2
/INITIAL ROT
	ROL  I  1
	STC  Q2
	ADD  Q1
	ROL  I  1
	STC  Q1
	LDA 
	Q5
	ROL  I  1
Q7,	 LDA 
	Q2
	ROL  I  1
	STC  Q2
	XSK  I  1
	JMP  Q6+1
/ENOUGH ROT
	ADD  Q2
	APO  I 
	JMP  .+5
	COM 
	ADA  I 
	4000
	STC  Q2
Q6,	0	/EXIT
/SUCCESSIVE
/SUBTRACT LOOP
	ADD  Q1
/ROT H-ORDER
/DIVID.
	ROL  I  1
	STA 
	Q1
	LAM  I 
	0
	452
/DIVISIBLE--
/STORE REMAIND
	STC  Q1
/NOT DIVISIBLE
	LDA 
	Q4
	STC  .-5
	JMP  Q7
Q5,	 0
/END DIVSUB
/
/
$SP DIVSUB,1
STC  Q1
	ADD  Q2
	COM 
	STC  Q2
/RESET ROT CTR
	SET  I  1
	1763
	CLR 
	ADD  Q2
/INITIAL ROT
	ROL  I  1
	STC  Q2
	ADD  Q1
	ROL  I  1
	STC  Q1
	LDA 
	Q5
	ROL  I  1
Q7



Feel free to contact me, David Gesswein djg@pdp8online.com with any questions, comments on the web site, or if you have related equipment, documentation, software etc. you are willing to part with.  I am interested in anything PDP-8 related, computers, peripherals used with them, DEC or third party, or documentation. 

PDP-8 Home Page   PDP-8 Site Map   PDP-8 Site Search