File DECBASE

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

[DECBASE
[KERNAL ROUTINES FOR
[DECIMAL ARITHMETIC
[#1B-ADDR BUFFER AREA OF LENGTH 3*[1L+2]
[1L=#DIGITS [OCTAL]
[SET 1B,1L AT END OF THIS MANUSCRIPT
[DEFAULT VALUES:
[1B=2000  1L=10
[INITIALIZATION
#1N ADAi
 -6001
STC 1 [ARG PTR
SETi7
1B [RESULT BUFFER
SETi10
-1L [#DIGITS
STA 7 [CLEAR 1B
LDAi1
BSEi
 4000
STC 2 [ARG1
LDAi1
BSEi
 4000
STC 3 [ARG2
LDA 2
ROL 1
SCR 1
STC p+61 [EXP1
LDA 3 [ARG2
JMP 0
[ERROR: DIVIDE BY ZERO
 ADD p+4+2 [4000
STA
1B+1 [FORCE ERROR FOR 0|0
STC p+53 [FORCE EXP OVERFLOW
[EXIT
 LDAi1
BSEi
 4000
STC 3
SETi7
1B
SET i10
-1L
ADD 10
SCR 1
STC 11
LDA 7
AZEi
 JMP p+7
LDAi
  1
ADM
 p+31   [RESULT EXP
LDA 7
AZEi [SKIP
[FIND FIRST NONZERO DIGIT
 LDAi7
AZE
 JMP p+23
ADA i
 -1
ADM
 p+20    [RESULT EXP
XSKi10
 JMP p-10
[ZERO RESULT
LDAi
2000
STA 3
CLR
STAi3
XSKi11
 JMP p-2
 LDA i
 6001
ADD 1
STC p+1
RETURN
[
 LDAi
  0   [RESULT EXP
SCR 12
AZEi
 JMP p+5
APOi
 JMP p-22
CLR
HLT [ERROR
[
 ADD p-10  [RESULT EXP
AZEi
 CLR
BCLi
 4000
ADA i
 RESULT SIGN
STA 3
LDA 7
AZEi  [SKIP
 LDAi7
STHi3
XSKi10
 APO
JMP p+11
LDAi7
STHi3
XSKi10
 APO [SKIP
JMP p+4+2
XSKi11
 JMP p-13 [NEXT 2 DIGITS
JMP p-44  [RETURN
 CLR
STHi3
XSKi11
 JMP p-57+3
JMP p-51 [RETURN
[BOOKKEEPING
 12
1L=10
1B=2000
[END DECBASE
[JAN 8|15|69



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