blob: f5a2ecf61c822f13a652358cf8a26ead8b5b77d1 (
plain) (
tree)
|
|
* 1.3.2 Ex. 14. Work in progress...
ORIG 0
Y CON 0 Y is stored here.
G CON 0 G will get stored here.
C CON 0 C will get stored here.
X CON 0 X will get stored here.
Z CON 0 Z will get stored here.
D CON 0 D will get stored here.
E CON 0 E will get stored here.
N CON 0 N will get stored here.
MNTH ALF "MARCH"
ALF "APRIL"
POUT ALF " 23 "
ALF "MARCH"
ALF ", 20"
ALF "28 "
ORIG 1000
START ENT2 1950
LOOP CMP2 =2000=
JG STOP
ST2 0
JMP DOE
INC2 1
JMP LOOP
STOP HLT
* Date of Easter routine. Assumes Y is in address 0.
* Routine using registers A, X and I1.
DOE STJ J2
ENT1 0 Clear reg. I1.
ENTA 0 Clear reg. A.
LDX Y Compute G.
ENTA 0
DIV =19=
INCX 1
STX G
ENTA 0 Compute C.
LDX Y
DIV =100=
INCA 1
STA C
ENTA 3 Compute X.
MUL C
DIV =4=
DECA 12
STA X
ENTA 8 Compute Z.
MUL C
INCX 5
DIV =25=
DECA 5
STA Z
ENTA 5 Compute D.
MUL Y
DIV =4=
SUB X
DECA 10
STA D
ENTA 11 Compute E.
MUL G
INCX 20
SLC 5 Move value to reg. A from reg. X.
ADD Z
SUB X
SRC 5 Move value to reg. X from reg. A.
DIV =30=
CMPX =24= Compare E with 24.
JE INCRE
CMPX =25= Compare E with 25.
JNE STRE
LD1 G
CMP1 =11=
JLE STRE
INCRE INCX 1 Increment E by 1.
STRE STX E
ENTA 44 Compute N.
SUB E
CMPA =21=
JGE STRN
INCA 30
STRN STA N
LDA D Penultimate step.
ADD N
SRC 5 Move value to reg. X from reg. A.
ENTA 0 Clear reg. A
DIV =-7=
SLC 5 Move value to reg. X from reg. X
ADD =7=
ADD N
ENTX 0 Clear reg. X.
CMPA =31=
JLE DAY
SUB =31=
ENT1 1 Means month is April.
DAY CHAR
SRC 5 Build and store DD
SLA 3
SRA 3
STA POUT(3:4)
YEAR LDA Y
CHAR
SLC 3
SLA 2 Build and store higher YYY
SRA 2
STA POUT+2(3:5)
SLC 2 Build and store lower YY
SLA 3
SRA 3
STA POUT+3(1:2)
MONTH LDA MNTH,1
STA POUT+1
OUT POUT(18) Write to line printer
J2 JMP *
END START
|