ZX81 Collection - Tapes

Index
0
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Back to Home Money Manager < > Listing (7 of 8)
0001   0000             .TITLE YEARLY FINANCE 
0002   0000             ;**********************************************************"*************
0003   0000             ;
0004   0000             ;
0005   0000             ;			ZX81 YEARLY FINANCE
0006   0000             ;
0007   0000             ;
0008   0000             ;************************************************************************
0009   0000             
0010   0000             			
0011   0000             ;************************************************************************
0012   0000             ;
0013   0000             ;			THESE ARE ADDRESSES IN THE ZX81 ROM AND RAM
0014   0000             ;
0015   0000             ;************************************************************************			
0016   0000             PTOKEN:		.EQU	094BH
0017   0000             PNTA:		.EQU	0010H
0018   0000             SCANNER:	.EQU	02BBH
0019   0000             DECODE:		.EQU	07BDH
0020   0000             DFCC:		.EQU	16398
0021   0000             SLOW:		.EQU	0F2BH
0022   0000             FAST:		.EQU	0F23H   
0023   0000             COPY:		.EQU	0869H
0024   0000             CSAVE:		.EQU	02FCH
0025   0000             DFILE:		.EQU	16396
0026   0000             SPOSNL:		.EQU	16441
0027   0000             SPOSNH:		.EQU	16442
0028   0000             
0029   4082             	        .ORG	16514			;START OF REM STATEMENT
0030   4082             ;************************************************************************
0031   4082             ;
0032   4082             ;			THIS IS THE COPUWRITE DISPLAY I WAS ASKED
0033   4082             ;			TO REMOVE BY THE PUBLISHER.
0034   4082             ;
0035   4082             ;************************************************************************
0036   4082             
0037   4082             	;CALL	CLS			;CLEAR SCREEN
0038   4082             	;LD	HL,MSG30		;DISPLAY COPYRIGHT TEXT
0039   4082             	;LD	DE,0A07H		;...LINE 10, CHAR 08
0040   4082             	;CALL	PNTAT
0041   4082             	;CALL	DELAY
0042   4082             	;LD	HL,FLAGA		;ClEAR FLAG
0043   4082             	;LD	(HL),00
0044   4082             ;	END OF COPYWRITE DISPLAY CODE
0045   4082             ;
0046   4082             ;************************************************************************
0047   4082             FINANCE:
0048   4082 CD 23 41    	CALL	CLS			;CLEAR SCREEN
0049   4085 11 04 01    	LD	DE,0104H		;POSITION DISPLY
0050   4088 21 7A 4A    	LD	HL,MSG1			;'YEARLY FINANCE'   ECT.
0051   408B CD 4A 41    	CALL	PNTAT		;PRINT SDRING
0052   408E 11 04 12    	LD	DE,1204H		;POSITION DISPLAY
0053   4091 21 10 4B    	LD	HL,MSG2			;'SELECTION ?
0054   4094 CD 4A 41    	CALL	PNTAT
0055   4097 06 01       	LD	B,1				;GET ONE CHAR
0056   4099 CD F7 40    	CALL	GETSTG		;GET A SELECTION
0057   409C 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS POINTER OF CHAR
0058   409F 2B          	DEC	HL				;POINTAT ONE ENTERED
0059   40A0 7E          	LD	A,(HL)			;GET CHAR
0060   40A1 FE 1D       	CP	1DH				;IS IT < 1 ?
0061   40A3 38 DD       	JR	C,FINANCE		;YES ERROR
0062   40A5 FE 24       	CP	24H				;IS IT > 7 ?
0063   40A7 30 D9       	JR	NC,FINANCE
0064   40A9 21 B8 40    	LD	HL,VTAB			;BUILD A OFFSET IN TO THE VECTOR TABLE
0065   40AC 06 00       	LD	B,0
0066   40AE D6 1D       	SUB	1DH				;MAKE IT BINARY- 1
0067   40B0 87          	ADD	A,A				;* 2
0068   40B1 4F          	LD	C,A			  	;BC --> OFFSET * 2
0069   40B2 09          	ADD	HL,BC			;HL --> ADDRESS OF VECTOR
0070   40B3 4E          	LD	C,(HL)			;GET ADDRESS OF ROUTINE
0071   40B4 23          	INC	HL
0072   40B5 46          	LD	B,(HL)			;BC = ADDRESS OF ROUTINE
0073   40B6 C5          	PUSH	BC			;PUT IT ON THE STACK
0074   40B7 C9          	RET					;AND GO TO IT
0075   40B8             VTAB:
0076   40B8 3C 46       	.WORD	STATEMENT
0077   40BA F8 46       	.WORD	UPDATE
0078   40BC 30 48       	.WORD	YEARLY
0079   40BE AB 48       	.WORD	CLMNTH
0080   40C0 09 49       	.WORD	CLYEAR
0081   40C2 67 49       	.WORD	SAVE
0082   40C4 9C 49       	.WORD	CHCAT
TASM Z80 Assembler.               finance.asm                      page 1
YEARLY FINANCE 

0083   40C6             .EJECT
0084   40C6             ;************************************************************************
0085   40C6             ;
0086   40C6             ;	GETKEY:	GET A KEY INTO THE ACCUM TEST FOR N/L (76H)
0087   40C6             ;	IAND CHANGE IT TO 122 DECIMAL. THIS ROUTINE
0088   40C6             ;		BLINKS THE CHAR AT (DFCC) FOR A CURSOR.
0089   40C6             ;
0090   40C6             ;************************************************************************
0091   40C6              
0092   40C6             GETKEY:
0093   40C6 E5          	PUSH	HL
0094   40C7 C5          	PUSH	BC
0095   40C8 D5          	PUSH	DE
0096   40C9             GET1:
0097   40C9 CD BB 02    	CALL	SCANNER		;IN ZX81 ROM
0098   40CC 2C          	INC	L				;A KEY PRESSED ?
0099   40CD 20 FA       	JR	NZ,GET1			;NO WAIT
0100   40CF             GET2:
0101   40CF 2A 0E 40    	LD	HL,(DFCC)		;FIIP VIDEO ON CURSOR
0102   40D2 7E          	LD	A,(HL)
0103   40D3 C6 80       	ADD	A,80H
0104   40D5 77          	LD	(HL),A
0105   40D6 CD BB 02    	CALL	SCANNER		;SCAN KEYBOARD
0106   40D9 44          	LD	B,H				;SAVE ADDRESS OF KEY
0107   40DA 4D          	LD	C,L
0108   40DB 2C          	INC	L				;A KEY PRESSED ?
0109   40DC 28 F1       	JR	Z,GET2			;NO WAIT
0110   40DE 2A 0E 40    	LD	HL,(DFCC)		;PUT CURSOR BCK TO ORIGINAL
0111   40E1 7E          	LD	A,(HL)
0112   40E2 CB BE       	RES	7,(HL)
0113   40E4 CD BD 07    	CALL	DECODE		;YES DECODE IT
0114   40E7 7E          	LD	A,(HL)			;GET CHAR CODE
0115   40E8 6F          	LD	L,A				;CAN'T PUT A 76H IN A REM
0116   40E9 2B          	DEC	HL
0117   40EA 3E 75       	LD	A,117			;TEST FOR N/L
0118   40EC BD          	CP	L
0119   40ED 20 02       	JR	NZ,GET3			;NO SKIP
0120   40EF 2E 79       	LD	L,122-1			;YES SET UP THE CODE CHANGE
0121   40F1             GET3:
0122   40F1 23          	INC	HL
0123   40F2 7D          	LD	A,L
0124   40F3 D1          	POP	DE
0125   40F4 C1          	POP	BC
0126   40F5 E1          	POP	HL
0127   40F6 C9          	RET
TASM Z80 Assembler.               finance.asm                      page 2
YEARLY FINANCE 

0128   40F7             .EJECT
0129   40F7             ;***********************************************************************
0130   40F7             ;
0131   40F7             ;	GET STRANG:	INPUT A STRING INTO THE DISTLAY BUFFER
0132   40F7             ;			STARTING AT (DFCC) FOR A LENGTH ORDERED
0133   40F7             ;			BY THE 'B' REG.
0134   40F7             ;
0135   40F7             ;************************************************************************
0136   40F7              
0137   40F7             GETSTG:
0138   40F7 E5          	PUSH	HL
0139   40F8 D5          	PUSH	DE
0140   40F9 F5          	PUSH	AF
0141   40FA C5          	PUSH	BC
0142   40FB 48          	LD	C,B				;SAVE LENGTH
0143   40FC             STG1:
0144   40FC CD C6 40    	CALL	GETKEY		;FETCH A KEY
0145   40FF 28 1A       	JR	Z,STG3			;EXIT N/L
0146   4101 FE 77       	CP	119				;BS ?
0147   4103 28 0A       	JR	Z,STG2			;YES HANDEL IT
0148   4105 05          	DEC	B				;SEE IF LAST
0149   4106 04          	INC	B
0150   4107 28 F3       	JR	Z,STG1			;YES DON'T DO IT
0151   4109 CD D1 41    	CALL	PNTCHR		;DO PRINT IT
0152   410C 05          	DEC	B				;LOG IT
0153   410D 18 ED       	JR	STG1			;AND GET ANOTHER
0154   410F             STG2:
0155   410F 79          	LD	A,C				;GET ORIGINAL COUNT
0156   4110 B8          	CP	B				;AT THE FIRST ?
0157   4111 28 E9       	JR	Z,STG1			;YES FORGET IT
0158   4113 3E 77       	LD	A,119			;BS CHAR
0159   4115 CD D1 41    	CALL	PNTCHR		;PRINT IT
0160   4118 04          	INC	B				;ADJUST COUNT
0161   4119 18 E1       	JR	STG1			;AND GET ANOTHER
0162   411B             STG3:
0163   411B 79          	LD	A,C				;GET ORIGINAL COUNT
0164   411C 90          	SUB	B				;MAKE # DONE
0165   411D C1          	POP	BC				;RESTORE REG C
0166   411E 47          	LD	B,A				;PUT COUNT IN B
0167   411F F1          	POP	AF
0168   4120 D1          	POP	DE
0169   4121 E1          	POP	HL
0170   4122 C9          	RET					;AND EXIT
TASM Z80 Assembler.               finance.asm                      page 3
YEARLY FINANCE 

0171   4123             .EJECT
0172   4123             ;***********************************************************************
0173   4123             ;
0174   4123             ;	CLEAR SCREEN: WILL CLEIR THE SCREEN AND RESET THE CURSOR TO HOME.
0175   4123             ;
0176   4123             ;***********************************************************************
0177   4123              
0178   4123             CLS:
0179   4123 E5          	PUSH	HL
0180   4124 D5          	PUSH	DE
0181   4125 C5          	PUSH	BC
0182   4126 2A 0C 40    	LD	HL,(DFILE)		;POINT TO START OF D_FILE
0183   4129 23          	INC	HL
0184   412A 22 0E 40    	LD	(DFCC),HL		;SET DF_CC
0185   412D 36 00       	LD	(HL),00			;PUT IN A SPACE
0186   412F E5          	PUSH	HL
0187   4130 D1          	POP	DE				;PUT DE AT D_FILE+1
0188   4131 13          	INC	DE
0189   4132 01 1F 00    	LD	BC,31			;FILL FIRST LINE
0190   4135 ED B0       	LDIR
0191   4137 13          	INC	DE				;BUMP PAST EOL
0192   4138 2A 0E 40    	LD	HL,(DFCC)		;BACK TO THE START
0193   413B 01 F7 02    	LD	BC,33*23		;REST OF D_FILE
0194   413E ED B0       	LDIR				;FILL THEM
0195   4140 21 21 18    	LD	HL,1821H		;INIT S_POS
0196   4143 22 39 40    	LD	(SPOSNL),HL
0197   4146 C1          	POP	BC
0198   4147 D1          	POP	DE
0199   4148 E1          	POP	HL
0200   4149 C9          	RET
0201   414A             	
0202   414A             ;***********************************************************************
0203   414A             ;
0204   414A             ;				DELAY ROUTINE USED IN THE COPYWRITE DISPLAY CODE
0205   414A             ;				REMOVED WHEN THE PUBLISHER REQUESTED THE;
0206   414A             ;				COPYWRITE DISPLAY BE REMOVED;
0207   414A             ;************************************************************************
0208   414A              ;DELAY:
0209   414A              ;	LD	BC,00
0210   414A              ;DEL1:
0211   414A              ;	DJNZ	DEL1
0212   414A              ;	DEC	C
0213   414A              ;	JR	NZ,DEL1
0214   414A              ;	RET
0215   414A              ;		END OF DELAY ROUTINE
TASM Z80 Assembler.               finance.asm                      page 4
YEARLY FINANCE 

0216   414A             .EJECT
0217   414A             ;************************************************************************
0218   414A             ;;	PRINT AT:	ENTER	HL --> STRING OF ZASC TERMINATED BY 60H
0219   414A             ;				DE --> LINE CHAR ADDRESS ON SCREEN
0220   414A             ;				       1203H = LINE 12 CHAR 03
0221   414A             ;
0222   414A             ;************************************************************************
0223   414A              
0224   414A             PNTAT:
0225   414A EB          	EX	DE,HL			;PUT LINE & CHAR IN HL
0226   414B CD E4 41    	CALL	POSNER		;MOVE CURSOR
0227   414E EB          	EX	DE,HL
0228   414F             PNTSTG:
0229   414F E5          	PUSH	HL
0230   4150 D5          	PUSH	DE
0231   4151 C5          	PUSH	BC
0232   4152 F5          	PUSH	AF
0233   4153             PNT1:
0234   4153 7E          	LD	A,(HL)			;GET CHAR TO PRINT
0235   4154 FE 60       	CP	60H				;IS TERMINATOR ?
0236   4156 20 05       	JR	NZ,PNT2			;NO PRINT IT
0237   4158 F1          	POP	AF
0238   4159 C1          	POP	BC				;ELSE EXIT
0239   415A D1          	POP	DE
0240   415B E1          	POP	HL
0241   415C C9          	RET
0242   415D             PNT2:
0243   415D FE 7A       	CP	122				;N/L ?
0244   415F 28 1D       	JR	Z,NL			;YES DO IT
0245   4161 FE 77       	CP	119				;BS ?
0246   4163 28 32       	JR	Z,BS			;YES DO IT
0247   4165 FE 40       	CP	40H				;SINGLE CHAR ?
0248   4167 38 12       	JR	C,SINGLE		;YES
0249   4169 FE 43       	CP	43H				;TOKEN =
0250   416B 38 08       	JR	C,TOKEN			;YES
0251   416D FE 7F       	CP	7FH				;ILLEGAL ?
0252   416F 38 07       	JR	C,NEXT			;YES SKIP IT
0253   4171 FE C0       	CP	0C0H			;SINGLE CHAR ?
0254   4173 38 06       	JR	C,SINGLE		;YES
TASM Z80 Assembler.               finance.asm                      page 5
YEARLY FINANCE 

0255   4175             .EJECT
0256   4175             
0257   4175             TOKEN:
0258   4175 CD 4B 09    	CALL	PTOKEN		;PRINT TOKEN (IN ZX83 ROM)
0259   4178             NEXT:
0260   4178 23          	INC	HL				;POINT TO NEXT CHAR
0261   4179 18 D8       	JR	PNT1			;AND LOOP
0262   417B             SINGLE:
0263   417B D7          	RST	10H				;PRINT A REG (IN ZX81 ROM) PNTA: AT RESTART 10H
0264   417C 18 FA       	JR	NEXT			;AND DO NEXT ONE
0265   417E             NL:
0266   417E 3A 3A 40    	LD	A,(SPOSNH)		;GET LINE #
0267   4181 FE 02       	CP	2				;IS IT THE LAST LINE
0268   4183 28 F3       	JR	Z,NEXT			;YES DON'T DO IT
0269   4185 3E 75       	LD	A,75H	
0270   4187 3C          	INC	A				;CANNOT PUT A 76H IN A REM STATEMENT
0271   4188 E5          	PUSH	HL			;SAVE TEXT ADDRESS
0272   4189 2A 0E 40    	LD	HL,(DFCC)		;CHAR ADDRESS OF NEXT
0273   418C 01 21 00    	LD	BC,33			;FULL LINE
0274   418F ED B1       	CPIR				;FIND IT
0275   4191 22 0E 40    	LD	(DFCC),HL		;UPDATE POINTER
0276   4194 E1          	POP	HL
0277   4195 18 E1       	JR	NEXT			;GET NEXT ONE
TASM Z80 Assembler.               finance.asm                      page 6
YEARLY FINANCE 

0278   4197             .EJECT
0279   4197             BS:
0280   4197 E5          	PUSH	HL			;SAVE TEXT ADDRESS
0281   4198 2A 39 40    	LD	HL,(SPOSNL)		;LINE AND CHAR
0282   419B C5          	PUSH	BC
0283   419C 01 33 22    	LD	BC,2233H		;FIRST LINE AND CHAR
0284   419F B7          	OR	A
0285   41A0 ED 42       	SBC	HL,BC			;SEE IF THE SAME
0286   41A2 C1          	POP	BC
0287   41A3 20 03       	JR	NZ,BS1			;NO CONTINUE
0288   41A5 E1          	POP	HL
0289   41A6 18 D0       	JR	NEXT			;YES CONTINUE
0290   41A8             BS1:
0291   41A8 2A 0E 40    	LD	HL,(DFCC)		;ADDRESS OF NEXT CHAR
0292   41AB 2B          	DEC	HL				;POINT TO LAST
0293   41AC 22 0E 40    	LD	(DFCC),HL		;UPDATE ADDRESS
0294   41AF 3E 75       	LD	A,75H			;IF IT'S A N/L
0295   41B1 3C          	INC	A				;CANNOT PUT A 76H IN A REM STATEMENT
0296   41B2 BE          	CP	(HL)			;THEN
0297   41B3 20 10       	JR	NZ,BS2
0298   41B5 2B          	DEC	HL				;BACK ONE MORE
0299   41B6 22 0E 40    	LD	(DFCC),HL
0300   41B9 3A 3A 40    	LD	A,(SPOSNH)		;INC LINE #
0301   41BC 3C          	INC	A
0302   41BD 32 3A 40    	LD	(SPOSNH),A
0303   41C0 3E FF       	LD	A,-1			;AND UPDATE CHAR #
0304   41C2 32 39 40    	LD	(SPOSNL),A
0305   41C5             BS2:
0306   41C5 3A 39 40    	LD	A,(SPOSNL)		;BUMP CHAR COUNT
0307   41C8 3C          	INC	A
0308   41C9 32 39 40    	LD	(SPOSNL),A
0309   41CC 36 00       	LD	(HL),00			;INSERT A SPACE IN THE DISPLAY BUFFER
0310   41CE E1          	POP	HL
0311   41CF 18 A7       	JR	NEXT
TASM Z80 Assembler.               finance.asm                      page 7
YEARLY FINANCE 

0312   41D1             .EJECT
0313   41D1             ;************************************************************************
0314   41D1             ;
0315   41D1             ;	PRINT CHAR IN THE 'A' REG AT THE POSITION IN (DFCC)
0316   41D1             ;
0317   41D1             ;************************************************************************
0318   41D1             PNTCHR:
0319   41D1 E5          	PUSH	HL
0320   41D2 D5          	PUSH	DE
0321   41D3 C5          	PUSH	BC
0322   41D4 F5          	PUSH	AF
0323   41D5 21 E1 4C    	LD	HL,CHBUF+1		;DUMMY UP A STRING
0324   41D8 36 60       	LD	(HL),60H		;WITH A TERMINATOR
0325   41DA 2B          	DEC	HL
0326   41DB 77          	LD	(HL),A			;PUT IN THE CHAR
0327   41DC CD 4F 41    	CALL	PNTSTG		;AND PRINT IT
0328   41DF F1          	POP	AF
0329   41E0 C1          	POP	BC
0330   41E1 D1          	POP	DE
0331   41E2 E1          	POP	HL
0332   41E3 C9          	RET
0333   41E4             ;************************************************************************
0334   41E4             ;
0335   41E4             ;	POSITIONER: POSITION CURSOR AT HL 120;H --> LINE 12 CHAR 03
0336   41E4             ;
0337   41E4             ;******(*****************************************************************
0338   41E4             POSNER:
0339   41E4 F5          	PUSH	AF
0340   41E5 D5          	PUSH	DE
0341   41E6 C5          	PUSH	BC
0342   41E7 E5          	PUSH	HL
0343   41E8 3E 18       	LD	A,24			;UPDATE S_POSN
0344   41EA 94          	SUB	H
0345   41EB 32 3A 40    	LD	(SPOSNH),A
0346   41EE 3E 21       	LD	A,33
0347   41F0 95          	SUB	L
0348   41F1 32 39 40    	LD	(SPOSNL),A
0349   41F4 44          	LD	B,H				;GET LINE #
0350   41F5 2A 0C 40    	LD	HL,(DFILE)		;GET ADDRESS OF DFILE
0351   41F8 23          	INC	HL				;SKIP 1'ST EOL
0352   41F9 11 21 00    	LD	DE,33			;# OF CHARS IN A LINE
0353   41FC 78          	LD	A,B				;IF ZERO SKIP
0354   41FD B7          	OR	A
0355   41FE 28 03       	JR	Z,POS2
0356   4200             POS1:
0357   4200 19          	ADD	HL,DE			;PUT IN CHARS IN	
0358   4201 10 FD       	DJNZ	POS1		;FOR B TIMES
0359   4203             POS2:
0360   4203 D1          	POP	DE				;GET CHAR POINTER
0361   4204 D5          	PUSH	DE
0362   4205 16 00       	LD	D,0
0363   4207 19          	ADD	HL,DE			;AND ADD THEM IN
0364   4208 22 0E 40    	LD	(DFCC),HL		;UPDATE ADDRESS OF NEXT
0365   420B E1          	POP	HL
0366   420C C1          	POP	BC
0367   420D D1          	POP	DE
0368   420E F1          	POP	AF
0369   420F C9          	RET
TASM Z80 Assembler.               finance.asm                      page 8
YEARLY FINANCE 

0370   4210             .EJECT
0371   4210             ;************************************************************************
0372   4210             ;
0373   4210             ;	BLANK LINE:	FROM HL 1203H --> BLANK LILE 12 FROM CHAR 03
0374   4210             ;
0375   4210             ;*********+**************************************************************
0376   4210              
0377   4210             BLNKLN:					;BLANK A LINE FROM HL
0378   4210 E5          	PUSH	HL
0379   4211 C5          	PUSH	BC
0380   4212 D5          	PUSH	DE
0381   4213 F5          	PUSH	AF
0382   4214 3E 20       	LD	A,32			;MAX CHAR TO BLANK
0383   4216 95          	SUB	L				;NUMBER TO DO
0384   4217 38 11       	JR	C,BLEXIT		;TOO MANY EXIT
0385   4219 4F          	LD	C,A				;COUNT IN BC
0386   421A 06 00       	LD	B,0            
0387   421C CD E4 41    	CALL	POSNER		;POSITMON DISPLAY
0388   421F 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS
0389   4222 36 00       	LD	(HL),00			;INSERT FIRT BLANK
0390   4224 E5          	PUSH	HL			;ADDRESS + 1 IN DE
0391   4225 D1          	POP	DE
0392   4226 13          	INC	DE
0393   4227 0B          	DEC	BC				;ADJUST COUNT
0394   4228 ED B0       	LDIR				;BLANK IT
0395   422A             BLEXIT:
0396   422A F1          	POP	AF
0397   422B D1          	POP	DE
0398   422C C1          	POP	BC
0399   422D E1          	POP	HL
0400   422E C9          	RET
TASM Z80 Assembler.               finance.asm                      page 9
YEARLY FINANCE 

0401   422F             .EJECT
0402   422F             ;************************************************************************
0403   422F             ;
0404   422F             ;	GET MONTH 1 TO 12
0405   422F             ;		RESULT IS STORED IN (MONTH) BINARY 0 --> 11
0406   422F             ;
0407   422F             ;************************************************************************
0408   422F              
0409   422F             GTMNTH:
0410   422F C5          	PUSH	BC
0411   4230 E5          	PUSH	HL
0412   4231 D5          	PUSH	DE
0413   4232 21 D1 4C    	LD	HL,FLAGA		;RESET QUIT FLAG
0414   4235 CB 86       	RES	0,(HL)
0415   4237             GMN1:
0416   4237 21 03 12    	LD	HL,1203H		;PRE BLANK LINE INCASE OF ERROR
0417   423A CD 10 42    	CALL	BLNKLN
0418   423D 11 03 12    	LD	DE,1203H		;PUT UP MESSAGE
0419   4240 21 1C 4B    	LD	HL,MSG3			;'INPUT MONTH 1 TO 12 '
0420   4243 CD 4A 41    	CALL	PNTAT
0421   4246 06 02       	LD	B,2				;FETCH 2 CHARS
0422   4248 CD F7 40    	CALL	GETSTG
0423   424B 21 18 12    	LD	HL,1218H		;POINT TO RESPONSE
0424   424E CD E4 41    	CALL	POSNER
0425   4251 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS OF RESPONSE
0426   4254 04          	INC	B				;ZERO IS ILLEGAL
0427   4255 05          	DEC	B
0428   4256 28 DF       	JR	Z,GMN1
0429   4258 7E          	LD	A,(HL)			;GET CHAR
0430   4259 FE 36       	CP	54				;IS IT 'Q' ?
0431   425B 20 07       	JR	NZ,GMN2			;NO CONTINE
0432   425D 21 D1 4C    	LD	HL,FLAGA		;ELSE SET QUIT FLAG
0433   4260 CB C6       	SET	0,(HL)
0434   4262 18 1B       	JR	GMN4			;AND EXIT
0435   4264             GMN2:
0436   4264 05          	DEC	B				;ONE CHAR
0437   4265 28 0D       	JR	Z,GMN3			;YES
0438   4267 05          	DEC	B				;MAKE B ZERO
0439   4268 7E          	LD	A,(HL)			;NO GET TEN'S DIGIT
0440   4269 23          	INC	HL				;POINT TO UNITS
0441   426A D6 1B       	SUB	1BH				;MAKE IT BINARY +1
0442   426C 3D          	DEC	A				;IF ZERO
0443   426D 28 05       	JR	Z,GMN3			;GO DO UNITS
0444   426F 3D          	DEC	A				;IF NOT 1 THEN ERROR
0445   4270 20 C5       	JR	NZ,GMN1
0446   4272 06 0A       	LD	B,10			;SET TENS DIGIT
0447   4274             GMN3:
0448   4274 7E          	LD	A,(HL)			;GET UNITS
0449   4275 D6 1D       	SUB	29				;MAKE BINARY - 1 TO COUNT FROM ZERO
0450   4277 80          	ADD	A,B				;ADD IN TENS DIGIT
0451   4278 FE 0C       	CP	12				;MUST BE 0 --> 11
0452   427A 30 BB       	JR	NC,GMN1			;ILLEGAL
0453   427C 32 D3 4C    	LD	(MONTH),A		;PUT NEW MONTH AWAY
TASM Z80 Assembler.               finance.asm                      page 10
YEARLY FINANCE 

0454   427F             .EJECT
0455   427F             GMN4:
0456   427F 21 03 12    	LD	HL,1203H		;BLANK LINE TO QUIT
0457   4282 CD 10 42    	CALL	BLNKLN
0458   4285 D1          	POP	DE
0459   4286 E1          	POP	HL	
0460   4287 C1          	POP	BC
0461   4288 C9          	RET
0462   4289             ;***********************************************************************
0463   4289             ;
0464   4289             ;	COMPARE:	ENTER	HL
0465   4289             ;			       		DE
0466   4289             ;				
0467   4289             ;				EXIT WITH ZERO FLAG SET IF EQUAL
0468   4289             ;
0469   4289             ;************************************************************************
0470   4289              
0471   4289             COMP:
0472   4289 C5          	PUSH	BC
0473   428A E5          	PUSH	HL
0474   428B D5          	PUSH	DE
0475   428C EB          	EX	DE,HL			;SWAP POINTERS
0476   428D             COM1:
0477   428D 1A          	LD	A,(DE)			;GET FIRST CHAR
0478   428E BE          	CP	(HL)			;BOMPARE THEM
0479   428F 20 04       	JR	NZ,COM2			;DIFFERANT EXIT
0480   4291 23          	INC	HL
0481   4292 13          	INC	DE
0482   4293 10 F8       	DJNZ	COM1		;LOOP
0483   4295             COM2:
0484   4295 D1          	POP	DE
0485   4296 E1          	POP	HL
0486   4297 C1          	POP	BC
0487   4298 C9          	RET
TASM Z80 Assembler.               finance.asm                      page 11
YEARLY FINANCE 

0488   4299             .EJECT
0489   4299             ;*****************+******************************************************
0490   4299             ;
0491   4299             ;	BCD PRINTER		$NNNNNNNNN
0492   4299             ;		ENTER HL -->	5 BYTE BCD FIELD 1'ST BYTE = '$' OR '-'
0493   4299             ;		     DE -->	DEST OF ZASCII
0494   4299             ;
0495   4299             ;*************************************"**********************************
0496   4299              
0497   4299             BCPNT6:					;PRINT SIX DIGIS
0498   4299 7E          	LD	A,(HL)			;GET '$' OR '-'
0499   429A 12          	LD	(DE),A			;PUT IT AWAY
0500   429B 13          	INC	DE				;BUMP TO NEXT
0501   429C 23          	INC	HL				;PASS ONE BYTE UP FOR 6 DIGITS
0502   429D 23          	INC	HL
0503   429E C5          	PUSH	BC			;SAVE BC
0504   429F 06 04       	LD	B,4				;4 DIGITS BEFORE '.'
0505   42A1 18 07       	JR	BC1				;GO DO IT
0506   42A3             BCPNT8:					;PRINT EIGHT DIGITS
0507   42A3 7E          	LD	A,(HL)			;GET '$' OP '-'
0508   42A4 12          	LD	(DE),A			;PRINT IT
0509   42A5 13          	INC	DE				;BUMP POiNTER
0510   42A6 23          	INC	HL				;BUMP PAST IT
0511   42A7 C5          	PUSH	BC			;SAVE BC
0512   42A8 06 06       	LD	B,6				;6 DIGITS BEFORE '.'
0513   42AA             BC1:
0514   42AA 0E 01       	LD	C,1				;SURPRESS LEADING ZEROS
0515   42AC CD BC 42    	CALL	PNTBBT		;PRINT BEFORE '.'
0516   42AF 3E 1B       	LD	A,1BH			;ZASCII FOR '.'
0517   42B1 12          	LD	(DE),A			;INSERT DECIMAL POINT
0518   42B2 13          	INC	DE
0519   42B3 0E 00       	LD	C,0				;PRINT LEADING ZEROS
0520   42B5 06 02       	LD	B,2				;PRINT TWO DIGITS	
0521   42B7 CD BC 42    	CALL	PNTBBT
0522   42BA C1          	POP	BC
0523   42BB C9          	RET					;EXIT
0524   42BC             PNTBBT:
0525   42BC CB 40       	BIT	0,B				;ARE WE DOING A ODD #
0526   42BE 28 02       	JR	Z,BBT1			;NO CONDINE
0527   42C0 ED 6F       	RLD					;YES START WITH LOW NIBBLE
0528   42C2             BBT1:
0529   42C2 ED 6F       	RLD					;GET BCD DATA
0530   42C4 E6 0F       	AND	0FH				;JUST THE LSN
0531   42C6 20 04       	JR	NZ,BBT2			;SKIP IF NOT ZERO
0532   42C8 CB 41       	BIT	0,C				;SURPRESSING LEADING ZEROS ?
0533   42CA 20 04       	JR	NZ,BBT3			;NO SKIP
0534   42CC             BBT2:
0535   42CC C6 1C       	ADD	A,1CH			;MAKE IT ZASCII
0536   42CE CB 81       	RES	0,C				;STOP SURPRESSION OF ZEROS
0537   42D0             BBT3:
0538   42D0 12          	LD	(DE),A			;PUT IN CHAR
0539   42D1 B7          	OR	A				;WAS IT A SPACE ?
0540   42D2 28 02       	JR	Z,BBT4			;YES NO NEED TO RESET
0541   42D4 D6 1C       	SUB	1CH				;RESET TO BINARY
TASM Z80 Assembler.               finance.asm                      page 12
YEARLY FINANCE 

0542   42D6             .EJECT
0543   42D6             BBT4:
0544   42D6 CB 40       	BIT	0,B				;ODD BYTE
0545   42D8 28 03       	JR	Z,BBT5			;YES SKIP
0546   42DA ED 6F       	RLD					;RESTORE MEMORY
0547   42DC 23          	INC	HL				;BUMP ADDRESS
0548   42DD             BBT5:
0549   42DD 13          	INC	DE				;BUMP DESTINATION
0550   42DE 10 E2       	DJNZ	BBT1		;AND LOOP
0551   42E0 C9          	RET					;DONE EXIT
0552   42E1             ;************************************************************************
0553   42E1             ;
0554   42E1             ;		BCD ADDER 4 BYTES 8 DIGITS
0555   42E1             ;
0556   42E1             ;			ENTER	HL  
0557   42E1             ;			 $     +DE
0558   42E1             ;				--
0559   42E1             ;				
0560   42E1             ;
0561   42E1             ;************************************************************************
0562   42E1              
0563   42E1             BCDADD:
0564   42E1 C5          	PUSH	BC
0565   42E2 01 03 00    	LD	BC,3			;OFFSET TO LSB
0566   42E5 09          	ADD	HL,BC
0567   42E6 EB          	EX	DE,HL			;SWAP POINTERS
0568   42E7 09          	ADD	HL,BC
0569   42E8 06 04       	LD	B,4				;ADD FOUR BYTES
0570   42EA B7          	OR	A				;RESET CARRY FGR FIRST PASS
0571   42EB             BCDA1:
0572   42EB 4E          	LD	C,(HL)			;GET TWO DIGITS
0573   42EC 1A          	LD	A,(DE)			;FETCH OTHER TWO
0574   42ED 89          	ADC	A,C				;ADD THEM TOGETHER
0575   42EE 27          	DAA					;ADJUST FOR BCD
0576   42EF 12          	LD	(DE),A			;UPDATE
0577   42F0 1B          	DEC	DE				;MOVE POINTERS
0578   42F1 2B          	DEC	HL
0579   42F2 10 F7       	DJNZ	BCDA1		;LOOP
0580   42F4 23          	INC	HL				;RESTORE POINTERS
0581   42F5 13          	INC	DE
0582   42F6 EB          	EX	DE,HL			;TO ORIGINAL
0583   42F7 C1          	POP	BC
0584   42F8 C9          	RET
TASM Z80 Assembler.               finance.asm                      page 13
YEARLY FINANCE 

0585   42F9             .EJECT
0586   42F9             ;************************************************************************
0587   42F9             ;
0588   42F9             ;	BCD SUBTRACT 4 BYTES 8 DIGITS
0589   42F9             ;
0590   42F9             ;		ENTER	HL
0591   42F9             ;		       -DE
0592   42F9             ;			
0593   42F9             ;		
0594   42F9             ;
0595   42F9             ;************************************************************************
0596   42F9              
0597   42F9             BCDSUB:
0598   42F9 C5          	PUSH	BC
0599   42FA 01 03 00    	LD	BC,3			;OFFSET TO LSB
0600   42FD 09          	ADD	HL,BC	
0601   42FE EB          	EX	DE,HL
0602   42FF 09          	ADD	HL,BC
0603   4300 06 04       	LD	B,4				;DO FOUR BYTES 8 DIGITS
0604   4302 B7          	OR	A				;RESET CARRY FOR FIRST PASS
0605   4303             BCDS1:
0606   4303 4E          	LD	C,(HL)			;GET FIRST TWO DIGITS
0607   4304 1A          	LD	A,(DE)			;GET ORTER TWO
0608   4305 99          	SBC	A,C				;DO THE SUBTRACT
0609   4306 27          	DAA					;ADJUST FOR DECIMAL
0610   4307 12          	LD	(DE),A			;PUT ANSWER AWAY
0611   4308 2B          	DEC	HL				;MOVE POINTERS
0612   4309 1B          	DEC	DE
0613   430A 10 F7       	DJNZ	BCDS1		;LOOP
0614   430C 23          	INC	HL				;RESTORE REG'S
0615   430D 13          	INC	DE	
0616   430E EB          	EX	DE,HL
0617   430F C1          	POP	BC
0618   4310 C9          	RET
TASM Z80 Assembler.               finance.asm                      page 14
YEARLY FINANCE 

0619   4311             .EJECT
0620   4311             ;************************************************************************
0621   4311             ;
0622   4311             ;	SUMER		SUMS 2 FIVE BYTE BCD FIELDS
0623   4311             ;			FIRST BYTE IS SIGN BYTE I.E. '$' = PULS
0624   4311             ;			'-' = MINUS.
0625   4311             ;
0626   4311             ;		ENTER	HL	-->	ONE 5 BYTE FIELD
0627   4311             ;		 + OR - DE  -->	SECOND FIELD
0628   4311             ;			
0629   4311             ;			HL	-->	RESULT
0630   4311             ;
0631   4311             ;************************************************************************
0632   4311             SUMR:
0633   4311 E5          	PUSH	HL
0634   4312 D5          	PUSH	DE
0635   4313 C5          	PUSH	BC
0636   4314 F5          	PUSH	AF
0637   4315 1A          	LD	A,(DE)			;IF SIGNS AZE THE SAME
0638   4316 BE          	CP	(HL)
0639   4317 23          	INC	HL				;POINT TO BCD
0640   4318 13          	INC	DE
0641   4319 20 05       	JR	NZ,SUMDIF
0642   431B CD E1 42    	CALL	BCDADD		;AND ADD THEM
0643   431E 18 22       	JR	SUMR2			;EXIT
0644   4320             SUMDIF:
0645   4320 06 04       	LD	B,4				;IF SOURCE < DEST THEN
0646   4322 CD 89 42    	CALL	COMP
0647   4325 30 18       	JR	NC,SUMSUB		;JUST SUBTRACT
0648   4327 1B          	DEC	DE				;ELSE SWAP THEM USING A TMMP BUFFER
0649   4328 2B          	DEC	HL				;SO AS NOT TO DESTROY THE SOURCE
0650   4329 D5          	PUSH	DE			;SAVE SOURCE ADDRESS
0651   432A E5          	PUSH	HL			;AND DEST ADDRESS
0652   432B 11 7E 51    	LD	DE,BCTEMP		;MOVE DEST TO TEMP BUFF
0653   432E 01 05 00    	LD	BC,05
0654   4331 ED B0       	LDIR
0655   4333 D1          	POP	DE				;AND SOURCE TO DEST
0656   4334 E1          	POP	HL
0657   4335 D5          	PUSH	DE			;SAVE DEST ADDRESS
0658   4336 0E 05       	LD	C,05
0659   4338 ED B0       	LDIR
0660   433A E1          	POP	HL				;GET DEST ADDRESS
0661   433B 23          	INC	HL				;BACK TO BCD
0662   433C 11 7F 51    	LD	DE,BCTEMP+1		;SOURCE ALSO
0663   433F             SUMSUB:
0664   433F CD F9 42    	CALL	BCDSUB		;NOW SUBTRACT THEM
0665   4342             SUMR2:					;CAT3 IS OUT OF RANGE FOR SUMDIF - 1
0666   4342 18 5C       	JR	CAT3
TASM Z80 Assembler.               finance.asm                      page 15
YEARLY FINANCE 

0667   4344             .EJECT
0668   4344             ;***********************************************************************
0669   4344             ;
0670   4344             ;	CATEGORY PRINTER & FORMATTER ROUTINE
0671   4344             ;	JUST CALL IT AND WATCH IT'S SMOKE.
0672   4344             ;
0673   4344             ;************************************************************************
0674   4344             CATPNT:
0675   4344 E5          	PUSH	HL
0676   4345 D5          	PUSH	DE
0677   4346 C5          	PUSH	BC
0678   4347 F5          	PUSH	AF
0679   4348 21 33 51    	LD	HL,CATTXT		;INIT LEFT SOURCE TEXT
0680   434B 22 DE 4C    	LD	(SW00),HL		;LOOK AT FORMAT TO SEE LEFT & RIGHT
0681   434E 21 56 51    	LD	HL,CATTXT+(7*5)	;RIGHT STARTS AT CATEGORY #?
0682   4351 22 E0 4C    	LD	(CHBUF),HL		;INIT RIGHT SIDE START
0683   4354 21 02 05    	LD	HL,0502H		;POSITION DISPLAY
0684   4357 CD E4 41    	CALL	POSNER
0685   435A 0E 1D       	LD	C,29			;ZASCII '1'
0686   435C 06 07       	LD	B,7				;14 CATEGORIES 2 PER LINE
0687   435E 2A 0E 40    	LD	HL,(DFCC)		;GET A DISPLAY ADDRESS
0688   4361             CAT1:
0689   4361 71          	LD	(HL),C			;STUFF LEFT # NEVER > 7
0690   4362 23          	INC	HL
0691   4363 36 14       	LD	(HL),20			;NOW A '='
0692   4365 23          	INC	HL
0693   4366 EB          	EX	DE,HL			;DISPLAY POINTER IN DE
0694   4367 2A DE 4C    	LD	HL,(SW00)		;GET LEFT SORCE
0695   436A C5          	PUSH	BC			;SAVE COUNT & #
0696   436B 01 05 00    	LD	BC,5			;NUMBER TO MOVE
0697   436E ED B0       	LDIR				;PUT EM iN
0698   4370 22 DE 4C    	LD	(SW00),HL		;UPDATE LEFT SIDE ADDRESS
0699   4373 EB          	EX	DE,HL			;HL --> FISPLAY BUFFER
0700   4374 01 06 00    	LD	BC,06			;MOVE TO RHGHT SIDE
0701   4377 09          	ADD	HL,BC			;HL --> TO RIGHT SIDE
0702   4378 C1          	POP	BC				;GET COUNT & # BACK
0703   4379 3E 07       	LD	A,7				;NUMBER ON TIIS SIDE IS C + 7
0704   437B 81          	ADD	A,C
0705   437C FE 26       	CP	38				;OVER 9?
0706   437E 38 06       	JR	C,CAT2			;NO SKIP
0707   4380 2B          	DEC	HL				;YES INSERT 10'S DIGIT
0708   4381 36 1D       	LD	(HL),29			;'1'
0709   4383 23          	INC	HL
0710   4384 D6 0A       	SUB	10				;REG A IS UNITS
0711   4386             CAT2:
0712   4386 77          	LD	(HL),A			;PUT IN UNITS
0713   4387 23          	INC	HL				;TEXT GOES HERE
0714   4388 36 14       	LD	(HL),20			;AFTER THE '='
0715   438A 23          	INC	HL
0716   438B EB          	EX	DE,HL			;DE --> DISPLAY BUFFER
0717   438C 2A E0 4C    	LD	HL,(CHBUF)		;GET RIGHT SIDE SOURCE
0718   438F C5          	PUSH	BC			;SAVE COUNT & #
0719   4390 01 05 00    	LD	BC,5			;MOVE 5 OF THEM
0720   4393 ED B0       	LDIR
0721   4395 22 E0 4C    	LD	(CHBUF),HL		;UPDATE RIGHT SIDE POINTER
0722   4398 EB          	EX	DE,HL			;HL BACK TO DISPLAY BUFFER
0723   4399 0E 0D       	LD	C,13			;WILL GO PAST EOL TO NEXT LEFT POSITION
0724   439B 09          	ADD	HL,BC
0725   439C C1          	POP	BC				;GET COUNT & #
0726   439D 0C          	INC	C
0727   439E 10 C1       	DJNZ	CAT1		;DO 7 SETS
0728   43A0             CAT3:
0729   43A0 F1          	POP	AF
0730   43A1 C1          	POP	BC
0731   43A2 D1          	POP	DE
0732   43A3 E1          	POP	HL
0733   43A4 C9          	RET				;AND EXIT
TASM Z80 Assembler.               finance.asm                      page 16
YEARLY FINANCE 

0734   43A5             .EJECT
0735   43A5             ;***********************************************************************
0736   43A5             ;
0737   43A5             ;	GETDOL:		GET A DOLLAR AMOUNT INTO DBUFFER
0738   43A5             ;		FROM 1 TO 8 DIGITS FREE FORM
0739   43A5             ;		MOVE TO BCBUF IN BCD FORMAT (CHAR 1 = $ OR =)
0740   43A5             ;
0741   43A5             ;*************************************+**********************************
0742   43A5             GETDOL:
0743   43A5 E5          	PUSH	HL
0744   43A6 D5          	PUSH	DE
0745   43A7 C5          	PUSH	BC
0746   43A8 F5          	PUSH	AF
0747   43A9 21 D1 4C    	LD	HL,FLAGA		;RESET 'Q' FLAG
0748   43AC CB 86       	RES	0,(HL)
0749   43AE 18 12       	JR	DOL2			;SKIP ERROR MESSAGE
0750   43B0             DOL1:
0751   43B0 21 05 17    	LD	HL,1705H		;POSITION IN LOWER TWO LINE
0752   43B3 CD E4 41    	CALL	POSNER
0753   43B6 ED 5B 0E 40 	LD	DE,(DFCC)		;GET ADDRESS
0754   43BA 21 4B 4B    	LD	HL,MSG5			;POINT TO MESSAGE
0755   43BD 01 15 00    	LD	BC,21
0756   43C0 ED B0       	LDIR
0757   43C2             DOL2:
0758   43C2 21 32 4B    	LD	HL,MSG4			;'INPUT AMOUNT: '
0759   43C5 11 03 12    	LD	DE,1203H
0760   43C8 CD 4A 41    	CALL	PNTAT
0761   43CB 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS
0762   43CE 01 0A 00    	LD	BC,10			;BACK TO START
0763   43D1 B7          	OR	A				;RESET CARRY
0764   43D2 ED 42       	SBC	HL,BC
0765   43D4 22 DE 4C    	LD	(SW00),HL		;SAVE START ADDRESS
0766   43D7 22 0E 40    	LD	(DFCC),HL		;REPOSITION
0767   43DA 06 0A       	LD	B,10			;GET UP TO 10 CHAR'S INCLUDES '+','-';'.7
0768   43DC CD F7 40    	CALL	GETSTG
0769   43DF 21 00 17    	LD	HL,1700H
0770   43E2 CD 10 42    	CALL	BLNKLN		;CLEAR LINE
0771   43E5 2A DE 4C    	LD	HL,(SW00)		;TEST FOR 'Q'
0772   43E8 7E          	LD	A,(HL)
0773   43E9 FE 36       	CP	54				;IS 'Q'
0774   43EB 20 07       	JR	NZ,DOL3			;NO CONTINUE
0775   43ED 21 D1 4C    	LD	HL,FLAGA		;YES SET FLAG
0776   43F0 CB C6       	SET	0,(HL)
0777   43F2 18 27       	JR	DOL4			;AND EXIT
0778   43F4             DOL3:
0779   43F4 04          	INC	B
0780   43F5 05          	DEC	B				;ZERO ILLEGAL
0781   43F6 28 B8       	JR	Z,DOL1			;ERROR
0782   43F8 CD 20 44    	CALL	FORMAT		;TEST FORMAT OF INPUT
0783   43FB 20 B3       	JR	NZ,DOL1			;ERROR
0784   43FD CD AC 44    	CALL	DOLMOV		;TRY TO MOVE IT
0785   4400 20 AE       	JR	NZ,DOL1			;ERROR IN LENGTH
0786   4402 21 00 00    	LD	HL,00			;POSITION CURSOR OUT OF BOTTOM
0787   4405 CD E4 41    	CALL	POSNER
0788   4408 26 12       	LD	H,0012H			;INPUT LINE ALSO
0789   440A CD 10 42    	CALL	BLNKLN
0790   440D 21 D4 4C    	LD	HL,BCBUF		;INSERT '$' GR '-'
0791   4410 3A D1 4C    	LD	A,(FLAGA)
0792   4413 36 0D       	LD	(HL),13			;INSERT '$'
0793   4415 CB 4F       	BIT	1,A				;MINUS SDT ?
0794   4417 28 02       	JR	Z,DOL4			;NO SKIP
0795   4419 36 16       	LD	(HL),22			;YES OVER WRITE WITH '-'
0796   441B             DOL4:
0797   441B F1          	POP	AF
0798   441C C1          	POP	BC
0799   441D D1          	POP	DE
0800   441E E1          	POP	HL
0801   441F C9          	RET
TASM Z80 Assembler.               finance.asm                      page 17
YEARLY FINANCE 

0802   4420             .EJECT
0803   4420             ;************************************************************************
0804   4420             ;
0805   4420             ;	TEST INPUT FOR CORRECT # OF '+','-',&'.'
0806   4420             ;
0807   4420             ;************************************************************************
0808   4420             FORMAT:
0809   4420 ED 43 E0 4C 	LD	(CHBUF),BC		;SAVE COUNT
0810   4424 21 D1 4C    	LD	HL,FLAGA		;RESET MINUS FLAG
0811   4427 CB 8E       	RES	1,(HL)
0812   4429 2A DE 4C    	LD	HL,(SW00)		;GET START ADDRESS
0813   442C 11 00 00    	LD	DE,00
0814   442F 0E 00       	LD	C,00			;RESET COUNTERS
0815   4431             MAT1:
0816   4431 C5          	PUSH	BC			;SAVE COUNT
0817   4432 7E          	LD	A,(HL)			;GET CHAR
0818   4433 FE 1B       	CP	27				;'.' ?
0819   4435 20 02       	JR	NZ,MAT2			;NO
0820   4437 14          	INC	D				;YES COUNT '.'
0821   4438 0C          	INC	C				;COUNT # UNDER '0'
0822   4439             MAT2:
0823   4439 FE 16       	CP	22				;'-' ?
0824   443B 20 02       	JR	NZ,MAT3			;NO
0825   443D 1C          	INC	E				;YES COUNT IT
0826   443E 0C          	INC	C				;COUNT # UNDER '0'
0827   443F             MAT3:
0828   443F FE 15       	CP	21				;'+'
0829   4441 20 06       	JR	NZ,MAT4			;NO
0830   4443 7B          	LD	A,E				;COUNT IN HIGH NIBBLE OF E
0831   4444 C6 10       	ADD	A,10H
0832   4446 5F          	LD	E,A
0833   4447 7E          	LD	A,(HL)			;GET CHAR BACK
0834   4448 0C          	INC	C				;COUNT IT
0835   4449             MAT4:
0836   4449 FE 1C       	CP	28				;< 0 ?
0837   444B 30 04       	JR	NC,MAT5			;NO TEST HIGHER
0838   444D 0D          	DEC	C				;ONE OF THE OK'S ?
0839   444E FA 55 44    	JP	M,MAT6			;NO ERROR
0840   4451             MAT5:
0841   4451 FE 26       	CP	38				; > '9' ?
0842   4453 38 04       	JR	C,MAT7			;NO CONTINUE
0843   4455             MAT6:
0844   4455 C1          	POP	BC				;CLEAR STACK RESTORE COUNT
0845   4456 F6 01       	OR	1				;RESET ZERO
0846   4458 C9          	RET					;EXIT
TASM Z80 Assembler.               finance.asm                      page 18
YEARLY FINANCE 

0847   4459             .EJECT
0848   4459             MAT7:
0849   4459 23          	INC	HL				;POINT TO NEXT
0850   445A C1          	POP	BC				;GET COUNT
0851   445B 10 D4       	DJNZ	MAT1
0852   445D ED 4B E0 4C 	LD	BC,(CHBUF)		;GET ORIGINAL COUNT BACK
0853   4461 C5          	PUSH	BC			;SAVE IT
0854   4462 7A          	LD	A,D				;MORE THAN 1 '.' ?
0855   4463 FE 02       	CP	2
0856   4465 30 EE       	JR	NC,MAT6			;YES ERROR
0857   4467 7B          	LD	A,E				;MORE THAN 1 '-' ?
0858   4468 E6 0F       	AND	0FH
0859   446A FE 02       	CP	2
0860   446C 30 E7       	JR	NC,MAT6			;YES ERROR
0861   446E 7B          	LD	A,E				;MORE THAN 1 '+' ?
0862   446F E6 F0       	AND	0F0H
0863   4471 FE 20       	CP	20H
0864   4473 30 E0       	JR	NC,MAT6			;YES ERROR
0865   4475 CB 43       	BIT	0,E				;IS THERE A '-' ?
0866   4477 28 1C       	JR	Z,MAT8			;NO SKIP
0867   4479 CB 63       	BIT	4,E				;A '+' ALSO
0868   447B 20 D8       	JR	NZ,MAT6			;YES ERROR
0869   447D 2A DE 4C    	LD	Hl,(SW00)		;THE '-' MUST BE FIRST CHAR
0870   4480 7E          	LD	A,(HL)			;GET FIRST
0871   4481 23          	INC	HL				;POINT TO DATA
0872   4482 22 DE 4C    	LD	(SW00),HL
0873   4485 C1          	POP	BC				;REDUCE	COUNT
0874   4486 05          	DEC	B	
0875   4487 C5          	PUSH	BC
0876   4488 28 CB       	JR	Z,MAT6			;ERROR CAN'T BE THE ONLY CHAR
0877   448A FE 16       	CP	22				;IS FIRST A '-'
0878   448C 20 C7       	JR	NZ,MAT6			;NO ERROR
0879   448E 21 D1 4C    	LD	HL,FLAGA		;FLAG IT
0880   4491 CB CE       	SET	1,(HL)
0881   4493 18 15       	JR	MAT9			;CONTINUE
0882   4495             MAT8:
0883   4495 CB 63       	BIT	4,E				;WAS THERE A '+'
0884   4497 28 11       	JR	Z,MAT9			;NO SKIP
0885   4499 2A DE 4C    	LD	HL,(SW00)		;IT MUST BE FIRST
0886   449C 7E          	LD	A,(HL)			;GET FIRST
0887   449D 23          	INC	HL				;MOVE POINTER PAST IT
0888   449E 22 DE 4C    	LD	(SW00),HL
0889   44A1 C1          	POP	BC				;TAKE IT OUT OF COUNT
0890   44A2 05          	DEC	B
0891   44A3 C5          	PUSH	BC
0892   44A4 28 AF       	JR	Z,MAT6			;CAN'T BE THE ONLY CHAR
0893   44A6 FE 15       	CP	21				;IS FIRST A '+'
0894   44A8 20 AB       	JR	NZ,MAT6			;NO ERROR
0895   44AA             MAT9:
0896   44AA C1          	POP	BC				;CLEAR STACK
0897   44AB C9          	RET					;EXIT
TASM Z80 Assembler.               finance.asm                      page 19
YEARLY FINANCE 

0898   44AC             .EJECT
0899   44AC             ;************************************************************************
0900   44AC             ;
0901   44AC             ;	DOLMOV:		MOVES DOLLAR AMOUNT TO BCBUF AND TEST LENGTH
0902   44AC             ;
0903   44AC             ;************************************************************************
0904   44AC             DOLMOV:
0905   44AC C5          	PUSH	BC			;SAVE COUNT
0906   44AD CB 42       	BIT	0,D				;WAS THERE A '.'
0907   44AF 20 0B       	JR	NZ,MOV1			;YES SKIP
0908   44B1 48          	LD	C,B
0909   44B2 06 00       	LD	B,0				;NO INSERT ONE
0910   44B4 2A DE 4C    	LD	HL,(SW00)		;GET START
0911   44B7 09          	ADD	HL,BC
0912   44B8 36 1B       	LD	(Hl),27			;PUT IT IN
0913   44BA 18 03       	JR	MOV2
0914   44BC             MOV1:
0915   44BC C1          	POP	BC				;REDUCE TO CHAR COUNT
0916   44BD 05          	DEC	B
0917   44BE C5          	PUSH	BC
0918   44BF             MOV2:
0919   44BF 21 D4 4C    	LD	HL,BCBUF		;CLEAR BUFFER
0920   44C2 11 D5 4C    	LD	DE,BCBUF+1
0921   44C5 01 04 00    	LD	BC,4			;LENGTH IS 5
0922   44C8 36 00       	LD	(HL),00
0923   44CA ED B0       	LDIR
0924   44CC 2A DE 4C    	LD	HL,(SW00)		;GET START
0925   44CF 3E 1B       	LD	A,27			;FIND THE '.'
0926   44D1 01 0C 00    	LD	BC,12
0927   44D4 ED B1       	CPIR
0928   44D6 C1          	POP	BC				;GET COUNT
0929   44D7 7E          	LD	A,(HL)			;IF SPACE
0930   44D8 B7          	OR	A				;CHANGE TO A '0'
0931   44D9 20 03       	JR	NZ,MOV3
0932   44DB 36 1C       	LD	(HL),28			;'0'
0933   44DD 04          	INC	B				;BUMP COUNT
0934   44DE             MOV3:
0935   44DE 23          	INC	HL				;POINT TO NEXT
0936   44DF 7E          	LD	A,(HL)			;IF SPACE
0937   44E0 B7          	OR	A				;CHANGE TO '0'
0938   44E1 20 03       	JR	NZ,MOV4
0939   44E3 36 1C       	LD	(HL),28			;'0'
0940   44E5 04          	INC	B				;PUT IN(COUNT
0941   44E6             MOV4:
0942   44E6 78          	LD	A,B				;COUNT > 8 ?
0943   44E7 FE 09       	CP	9
0944   44E9 38 03       	JR	C,MOV5			;NO CONTINUE
0945   44EB F6 01       	OR	1				;ERROR
0946   44ED C9          	RET
TASM Z80 Assembler.               finance.asm                      page 20
YEARLY FINANCE 

0947   44EE             .EJECT
0948   44EE             MOV5:
0949   44EE 23          	INC	HL				;THE NEXT ONE MUST BE A SPACE
0950   44EF 7E          	LD	A,(HL)			;OR ERROR
0951   44F0 B7          	OR	A
0952   44F1 C0          	RET	NZ
0953   44F2 2B          	DEC	HL				;POINT TO LSD
0954   44F3 11 D8 4C    	LD	DE,BCBUF+4		;AND RIGHT SIDE OF BUFFER
0955   44F6 CD 01 45    	CALL	DSTOBC		;CONVERT TO BCD
0956   44F9 2B          	DEC	HL				;OVER '.'
0957   44FA C8          	RET	Z				;DONE EXIT
0958   44FB             MOV6:
0959   44FB CD 01 45    	CALL	DSTOBC		;MOVE REST TO BCD BUFFER
0960   44FE 20 FB       	JR	NZ,MOV6
0961   4500 C9          	RET
0962   4501             DSTOBC:
0963   4501 7E          	LD	A,(HL)			;GET ZASCII
0964   4502 D6 1C       	SUB	28				;MAKE BINARY
0965   4504 4F          	LD	C,A				;SAVE IT
0966   4505 2B          	DEC	HL				;POINT TO NEXT
0967   4506 05          	DEC	B				;DONE ?
0968   4507 20 02       	JR	NZ,DSBC1		;NO
0969   4509 12          	LD	(DE),A			;YES INSERT IT
0970   450A C9          	RET
0971   450B             DSBC1:
0972   450B 7E          	LD	A,(HL)			;GET NEXT
0973   450C D6 1C       	SUB	28				;MAKE BINARY
0974   450E 17          	RLA
0975   450F 17          	RLA
0976   4510 17          	RLA
0977   4511 17          	RLA					;IN LEFT NIBBLE
0978   4512 E6 F0       	AND	0F0H
0979   4514 81          	ADD	A,C				;COMBINE THEM
0980   4515 12          	LD	(DE),A
0981   4516 2B          	DEC	HL				;TO NEXT SOURCE
0982   4517 1B          	DEC	DE				;AND DEST
0983   4518 05          	DEC	B				;DEC COUNT
0984   4519 C9          	RET					;Z SET IF DONE
TASM Z80 Assembler.               finance.asm                      page 21
YEARLY FINANCE 

0985   451A             .EJECT
0986   451A             PNTSTATE:
0987   451A 21 00 01    	LD	HL,0100H		;GO TO START OF NEXT
0988   451D 3E 0B       	LD	A,11
0989   451F 11 33 51    	LD	DE,CATTXT		;POINT TO CATEGORY'S
0990   4522 CD B9 45    	CALL	ETXTPNT		;PRINT A'S WORTH
0991   4525 CD E4 41    	CALL	POSNER
0992   4528 24          	INC	H
0993   4529 E5          	PUSH	HL			;POINT TO NEXT
0994   452A CD 8C 45    	CALL	TOTLIN		;PRINT TOTAL LINE
0995   452D E1          	POP	HL				;NEXT LINE
0996   452E CD E4 41    	CALL	POSNER
0997   4531 24          	INC	H
0998   4532 24          	INC	H
0999   4533 E5          	PUSh	HL			;SET FOR NEXT
1000   4534 21 AC 4B    	LD		HL,MSG13	;'EXP.'
1001   4537 CD 4F 41    	CALL	PNTSTG
1002   453A 3E 03       	LD	A,3				;DO 3 MORE CATEGORIES
1003   453C E1          	POP	HL				;GET POINTER
1004   453D CD B9 45    	CALL	ETXTPNT
1005   4540 CD E4 41    	CALL	POSNER
1006   4543 24          	INC	H
1007   4544 E5          	PUSH	HL
1008   4545 CD 8C 45    	CALL	TOTLIN
1009   4548 E1          	POP	HL
1010   4549 CD E4 41    	CALL	POSNER		;TO NEXT LINE
1011   454C 24          	INC	H
1012   454D 24          	INC	H
1013   454E E5          	PUSH	HL
1014   454F 21 B1 4B    	LD	HL,MSG14		;'INC.'
1015   4552 CD 4F 41    	CALL	PNTSTG
1016   4555 E1          	POP	HL
1017   4556 CD E4 41    	CALL	POSNER		;TO LAST LINE
1018   4559 21 B6 4B    	LD	HL,MSG15		;'BAL.'
1019   455C CD 4F 41    	CALL	PNTSTG
1020   455F 3A D3 4C    	LD	A,(MONTH)		;GET START MONTH
1021   4562 32 DE 4C    	LD	(SW00),A		;SAVE A COPY
1022   4565 21 06 01    	LD	HL,0106H		;START PUTTING IN MONEY
1023   4568 CD CF 45    	CALL	PNTMONTH	;PRINT A MONTH
1024   456B 3A DE 4C    	LD	A,(SW00)		;GET MONTH
1025   456E 3C          	INC	A				;MOVE TO NEXT
1026   456F FE 0C       	CP	12				;DON'T PRINT PAST DEC
1027   4571 D0          	RET	NC
1028   4572 32 DE 4C    	LD	(SW00),A		;PUT IT BACK
1029   4575 21 0F 01    	LD	HL,010FH		;POSITION FOR MONTH 2
1030   4578 CD CF 45    	CALL	PNTMONTH
1031   457B 3A DE 4C    	LD	A,(SW00)		;GET 2ND MONTH
1032   457E 3C          	INC	A				;BUMP IT
1033   457F FE 0C       	CP	12				;STILL NOT PAST DEC
1034   4581 D0          	RET	NC				;EXIT IF SO
1035   4582 32 DE 4C    	LD	(SW00),A
1036   4585 21 18 01    	LD	HL,0118H		;POSITION FOR 3RD MONTH
1037   4588 CD CF 45    	CALL	PNTMONTH
1038   458B C9          	RET
TASM Z80 Assembler.               finance.asm                      page 22
YEARLY FINANCE 

1039   458C             .EJECT
1040   458C             TOTLIN:
1041   458C 21 9D 4B    	LD	HL,MSG11		;'TOTAL  -------'
1042   458F CD 4F 41    	CALL	PNTSTG
1043   4592 3A D1 4C    	LD	A,(FLAGA)		;ARE WE DOING YEARLY
1044   4595 CB 57       	BIT	2,A
1045   4597 28 09       	JR	Z,TLN0			;NO
1046   4599 2A 0E 40    	LD	HL,(DFCC)		;YES NEED TWO MORE '-'
1047   459C 36 16       	LD	(HL),22
1048   459E 23          	INC	HL				;AN EXTRA '-' FOR YEARLY
1049   459F 36 16       	LD	(HL),22
1050   45A1 C9          	RET					;DONE EXIT
1051   45A2             TLN0:
1052   45A2 3A D3 4C    	LD	A,(MONTH)		;SEE HOW MANY
1053   45A5 FE 0B       	CP	11				;IS DEC EXIT
1054   45A7 C8          	RET	Z
1055   45A8 FE 0A       	CP	10				;IF NOV SKIP ONE
1056   45AA 28 06       	JR	Z,TLN1
1057   45AC 21 A2 4B    	LD	HL,MSG12		;'  -------'
1058   45AF CD 4F 41    	CALL	PNTSTG
1059   45B2             TLN1:
1060   45B2 21 A2 4B    	LD	HL,MSG12		;'  -------'
1061   45B5 CD 4F 41    	CALL	PNTSTG
1062   45B8 C9          	RET
1063   45B9             ETXTPNT:
1064   45B9 E5          	PUSH	HL			;SAVE PIONTER
1065   45BA             ETXT1:
1066   45BA E1          	POP	HL				;GED NEXT TO DE
1067   45BB CD E4 41    	CALL	POSNER
1068   45BE 24          	INC	H				;POINT TO NEXT
1069   45BF E5          	PUSH	HL
1070   45C0 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS
1071   45C3 EB          	EX	DE,HL			;DE --> CATEGORY TEXT
1072   45C4 01 05 00    	LD	BC,05
1073   45C7 ED B0       	LDIR				;MOVE TEXT
1074   45C9 EB          	EX	DE,HL
1075   45CA 3D          	DEC	A				;DONE ?
1076   45CB 20 ED       	JR	NZ,ETXT1		;NO
1077   45CD E1          	POP	HL
1078   45CE C9          	RET					;ELSE EXIT
TASM Z80 Assembler.               finance.asm                      page 23
YEARLY FINANCE 

1079   45CF             .EJECT
1080   45CF             PNTMONTH:
1081   45CF E5          	PUSH	HL			;SAVE POSITION
1082   45D0 06 0B       	LD	B,11			;DO 11 OF THEM
1083   45D2 3A DE 4C    	LD	A,(SW00)		;GO INTO DBUFF
1084   45D5 21 E2 4C    	LD	HL,DBUFF
1085   45D8 11 55 00    	LD	DE,85			;85 BYTES PER MONTH
1086   45DB B7          	OR	A
1087   45DC 28 04       	JR	Z,PM01			;SKIP IF JAN
1088   45DE             PM00:
1089   45DE 19          	ADD	HL,DE			;OFFSET INTO BUFFER
1090   45DF 3D          	DEC	A				;MONTH'S TIMES
1091   45E0 20 FC       	JR	NZ,PM00
1092   45E2             PM01:
1093   45E2 EB          	EX	DE,HL			;DE IS AT BUFFER NOW
1094   45E3 E1          	POP	HL				;GET CURSOR
1095   45E4 CD E4 41    	CALL	POSNER
1096   45E7 24          	INC	H				;POINT TO NEXT
1097   45E8 E5          	PUSH	HL
1098   45E9 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS
1099   45EC EB          	EX	DE,HL			;RIGHT FOR PRINT
1100   45ED CD 31 46    	CALL	BCPNT		;PRINT THEM
1101   45F0 10 F0       	DJNZ	PM01		;DO ALL 12
1102   45F2 EB          	EX	DE,HL
1103   45F3 E1          	POP	HL				;GET LINE #
1104   45F4 24          	INC	H				;PAST TOTAL LINE
1105   45F5 CD E4 41    	CALL	POSNER		;POSITION IT
1106   45F8 24          	INC	H
1107   45F9 24          	INC	H				;PAST BLANK LINE
1108   45FA E5          	PUSH	HL
1109   45FB 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS
1110   45FE EB          	EX	DE,HL			;GET POINTERS CORRECT
1111   45FF CD 31 46    	CALL	BCPNT		;PRINT THIS FIELD
1112   4602 06 03       	LD	B,3				;THREE THIS TIME
1113   4604             PM02:
1114   4604 EB          	EX	DE,HL
1115   4605 E1          	POP	HL
1116   4606 CD E4 41    	CALL	POSNER
1117   4609 24          	INC	H
1118   460A E5          	PUSH	HL
1119   460B 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS
1120   460E EB          	EX	DE,HL			;RIGHT FOR PRINT
1121   460F CD 31 46    	CALL	BCPNT		;PRINT DIGITS
1122   4612 10 F0       	DJNZ	PM02
1123   4614 EB          	EX	DE,HL
1124   4615 E1          	POP	HL
1125   4616 24          	INC	H				;OVER TOTAL LINE
1126   4617 CD E4 41    	CALL	POSNER
1127   461A 24          	INC	H
1128   461B 24          	INC	H				;TO BAL LINE
1129   461C E5          	PUSH	HL
1130   461D 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS
1131   4620 EB          	EX	DE,HL
1132   4621 CD 31 46    	CALL	BCPNT		;PRINT THEM
1133   4624 EB          	EX	DE,HL
1134   4625 E1          	POP	HL				;POSITION TO LAST
1135   4626 CD E4 41    	CALL	POSNER
1136   4629 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS
1137   462C EB          	EX	DE,HL
1138   462D CD 31 46    	CALL	BCPNT
1139   4630 C9          	RET
1140   4631             BCPNT:
1141   4631 3A D1 4C    	LD	A,(FLAGA)		;6 OR 8 ?
1142   4634 CB 57       	BIT	2,A
1143   4636 CA 99 42    	JP	Z,BCPNT6		;DO SIX
1144   4639 C3 A3 42    	JP	BCPNT8
TASM Z80 Assembler.               finance.asm                      page 24
YEARLY FINANCE 

1145   463C             .EJECT
1146   463C             ;***********************************************************************
1147   463C             ;
1148   463C             ;	PRINT STATEMENT ROUTINE
1149   463C             ;
1150   463C             ;**(*******************************+*************************************
1151   463C             STATEMENT:
1152   463C CD 23 41    	CALL	CLS
1153   463F 21 8B 4B    	LD	HL,MSG10		;'MONTHLY STATEMENT'
1154   4642 11 04 0C    	LD	DE,0C04H
1155   4645 CD 4A 41    	CALL	PNTAT
1156   4648 CD 2F 42    	CALL	GTMNTH		;GET START MONTH
1157   464B 3A D1 4C    	LD	A,(FLAGA)		;QUIT FLAG SET
1158   464E CB 47       	BIT	0,A
1159   4650 C2 82 40    	JP	NZ,FINANCE		;YES
1160   4653             STAT1:
1161   4653 CD 23 41    	CALL	CLS
1162   4656 21 05 00    	LD	HL,0005H
1163   4659 CD E4 41    	CALL	POSNER		;POSITION FOR MONTH TEXT
1164   465C 3A D3 4C    	LD	A,(MONTH)
1165   465F 4F          	LD	C,A				;MONTH IN 'C'
1166   4660 87          	ADD	A,A				;* 2
1167   4661 81          	ADD	A,C				;* 3
1168   4662 4F          	LD	C,A
1169   4663 06 00       	LD	B,0				;OFFSET IN BC
1170   4665 21 A7 4C    	LD	HL,MTEXT		;POINT TO TEXT
1171   4668 09          	ADD	HL,BC			;HL --> CORRECT MONTH TEXT
1172   4669 3E 03       	LD	A,3				;DO 3 MONTHS
1173   466B ED 5B 0E 40 	LD	DE,(DFCC)		;GET ADDRESS
1174   466F             STAT2:
1175   466F E5          	PUSH	HL			;SAVE SOURCE
1176   4670 21 06 00    	LD	HL,06			;OFFSET TO NEXT
1177   4673 19          	ADD	HL,DE
1178   4674 EB          	EX	DE,HL			;DE --> DEST
1179   4675 E1          	POP	HL				;GET SOURCE
1180   4676 01 03 00    	LD	BC,03			;MOVE 3 OF THEM
1181   4679 ED B0       	LDIR
1182   467B 3D          	DEC	A				;DONE
1183   467C 20 F1       	JR	NZ,STAT2
1184   467E 21 D1 4C    	LD	HL,FLAGA			;RESET PRINT 8 FLAG
1185   4681 CB 96       	RES	2,(HL)
1186   4683 CD 1A 45    	CALL	PNTSTATE	;PRINT"STATEMENT
1187   4686             STAT3:
1188   4686 21 00 16    	LD	HL,1600H
1189   4689 CD E4 41    	CALL	POSNER		;GET A ADDRESS
1190   468C ED 5B 0E 40 	LD	DE,(DFCC)		;GOT IT
1191   4690 21 DB 4B    	LD	HL,MSG17		;'PRESS L FOR LAST OR N FOR NEXT'
1192   4693 01 1E 00    	LD	BC,30
1193   4696 ED B0       	LDIR				;CANNOT PRINT IN LOWER TWO LINES
1194   4698 21 00 17    	LD	HL,1700H		;MOVE OTHER MESSAGE TO BOTTOM
1195   469B CD E4 41    	CALL	POSNER
1196   469E ED 5B 0E 40 	LD	DE,(DFCC)
1197   46A2 21 BB 4B    	LD	HL,MSG16		;'PRESS P FOR PRINT OR Q FGR QUIT
1198   46A5 01 1F 00    	LD	BC,31
1199   46A8 ED B0       	LDIR
1200   46AA ED 53 0E 40 	LD	(DFCC),DE
1201   46AE CD C6 40    	CALL	GETKEY		;GET A ANSWER
1202   46B1 FE 36       	CP	54				;IS 'Q'
1203   46B3 CA 82 40    	JP	Z,FINANCE		;YES EXIT
1204   46B6 FE 33       	CP	51				;IS 'N'
1205   46B8 20 0F       	JR	NZ,STAT5		;NO
1206   46BA 3A D3 4C    	LD	A,(MONTH)		;EHSE
1207   46BD 3C          	INC	A				;BUMP MONTH
1208   46BE FE 0C       	CP	12				;IS TOO BIG
1209   46C0 20 01       	JR	NZ,STAT4		;YES RESET
1210   46C2 AF          	XOR	A				;SET TO START
1211   46C3             STAT4:
1212   46C3 32 D3 4C    	LD	(MONTH),A		;UPDATE
1213   46C6 C3 53 46    	JP	STAT1			;AND START OVER
1214   46C9             STAT5:
1215   46C9 FE 31       	CP	49				;IS 'L'
1216   46CB 28 1C       	JR	Z,STAT6			;YES DO LAST
1217   46CD FE 35       	CP	35H				;IS 'P'
1218   46CF 20 B5       	JR	NZ,STAT3		;NO GET IT RIGHT
1219   46D1 21 00 17    	LD	HL,1700H		;BLANK LOWER LINES
1220   46D4 CD 10 42    	CALL	BLNKLN
1221   46D7 24          	INC	H
1222   46D8 CD 10 42    	CALL	BLNKLN
1223   46DB 21 00 00    	LD	HL,00			;POSITION TO HOME
1224   46DE CD E4 41    	CALL	POSNER
1225   46E1 CD 69 08    	CALL	COPY		;PUT IT TO THE PRINTER
1226   46E4 CD 2B 0F    	CALL	SLOW		;COPY IS IN FAST
1227   46E7 18 9D       	JR	STAT3
1228   46E9             STAT6:
1229   46E9 3A D3 4C    	LD	A,(MONTH)		;BACK HIM UP ONE
1230   46EC 3D          	DEC	A
1231   46ED F2 F2 46    	JP	P,STAT7			;CAN'T GO PAST 0
1232   46F0 3E 0B       	LD	A,11			;SET FOR DEC
1233   46F2             STAT7:
1234   46F2 32 D3 4C    	LD	(MONTH),A		;PUT IT BACK ONE
1235   46F5 C3 53 46    	JP	STAT1
TASM Z80 Assembler.               finance.asm                      page 25
YEARLY FINANCE 

1236   46F8             .EJECT
1237   46F8             ;************************************************************************
1238   46F8             ;
1239   46F8             ;		UPDATE ROUTINE
1240   46F8             ;
1241   46F8             ;************************************************************************
1242   46F8             UPDATE:
1243   46F8 CD 23 41    	CALL	CLS
1244   46FB 21 45 4C    	LD	HL,MSG24		;'UPDATE '
1245   46FE 11 0C 01    	LD	DE,010CH
1246   4701 CD 4A 41    	CALL	PNTAT
1247   4704 CD 44 43    	CALL CATPNT
1248   4707             UPD01:
1249   4707 CD 2F 42    	CALL	GTMNTH		;WHICH MOFTH TO UPDATE
1250   470A 3A D1 4C    	LD	A,(FLAGA)		;DID THEY 'Q' ?
1251   470D CB 47       	BIT	0,A
1252   470F C2 82 40    	JP	NZ,FINANCE		;YES BACK TO MENUE
1253   4712 21 3F 4C    	LD	HL,MSG23		;_____________4C3FH
1254   4715 11 0B 02    	LD	DE,020BH
1255   4718 CD 4A 41    	CALL	PNTAT
1256   471B 3A D3 4C    	LD	A,(MONTH)		;GET THE MONTH REQUESTED
1257   471E 4F          	LD	C,A				;SAVE * 1
1258   471F 87          	ADD	A,A				;MAKE * 2
1259   4720 81          	ADD	A,C				;FINALY * 3
1260   4721 06 00       	LD	B,0				;BC IS A OFFSET PER THE MONTH
1261   4723 4F          	LD	C,A				;NOW
1262   4724 21 A7 4C    	LD	HL,MTEXT		;POINT TO START OF MONTH'S THREE LETTER TEXT
1263   4727 09          	ADD	HL,BC			;HL POINTS TO PROPER MONTH ZASCII
1264   4728 ED 5B 0E 40 	LD	DE,(DFCC)		;WHERE TO PUT IT ?
1265   472C 01 03 00    	LD	BC,03			;DFCC KNOWS AND 3 IS THE LENGTH
1266   472F ED B0       	LDIR
1267   4731 18 09       	JR UPD03
1268   4733             UPD02:
1269   4733 21 A2 4C    	LD	HL,4CA2H		;CLEAR OTHER LINES
1270   4736 11 04 0E    	LD	DE,0E04H
1271   4739 CD 4A 41    	CALL	PNTAT
1272   473C             UPD03:	
1273   473C 21 00 15    	LD	HL,1500H
1274   473F CD 10 42    	CALL	BLNKLN
1275   4742 25          	DEC	H
1276   4743 CD 10 42    	CALL	BLNKLN
1277   4746 21 4D 4C    	LD	HL,MSG25		;'CATEGORY '
1278   4749 11 03 12    	LD	DE,1203H
1279   474C CD 4A 41    	CALL	PNTAT
1280   474F 06 02       	LD	B,02			;GET UP TO 2
1281   4751 CD F7 40    	CALL	GETSTG		;INPUT A STRING
1282   4754 2A 0E 40    	LD	HL,(DFCC)		;UH! WHICH WAY DID DA GO
1283   4757 48          	LD	C,B				;BACK TO START
1284   4758 06 00       	LD	B,0
1285   475A B7          	OR	A				;RESET CARRY
1286   475B ED 42       	SBC	HL,BC
1287   475D 7E          	LD	A,(HL)			;GET FIRST CHAR
1288   475E FE 36       	CP	54				;DID THEY 'Q'
1289   4760 28 A5       	JR	Z,UPD01			;YEP
1290   4762 B7          	OR	A
1291   4763 28 A2       	JR	Z,UPD01
1292   4765 0D          	DEC	C				;HOW MANY
1293   4766 28 07       	JR	Z,UPD04			;ONLY ONE SKIP
1294   4768 FE 1D       	CP	29				;TENS DIGIT MUST BE A ONE
1295   476A 20 D0       	JR	NZ,UPD03		;OR ERROR
1296   476C 0E 0A       	LD	C,10			;ONE HERE IS WORTH 10
1297   476E 23          	INC	HL				;POINT TO UNIS
1298   476F             UPD04:
1299   476F 7E          	LD	A,(HL)			;GET UNITS DIGIT
1300   4770 D6 1D       	SUB	29				;MAKE BINARY - 1
1301   4772 81          	ADD	A,C				;PUT IN TEN'S
1302   4773 FE 0E       	CP	14				;0 --> 13 ONLY
1303   4775 30 C5       	JR	NC,UPD03			;OR ERROR
1304   4777 32 D2 4C    	LD	(TEMP1),A		;SAVE CATEGORY #
1305   477A             UPD05:
1306   477A 21 00 0E    	LD	HL,0E00H		;CLEAR LAST TEXT
1307   477D CD 10 42    	CALL	BLNKLN
1308   4780 21 45 4C    	LD	HL,4C45H
1309   4783 11 09 0E    	LD	DE,0E09H
1310   4786 CD 4A 41    	CALL	PNTAT
1311   4789 21 33 51    	LD	HL,CATTXT		;GONNA PUT UP THE CATEGORY TEXT
1312   478C 11 05 00    	LD	DE,05
1313   478F 3A D2 4C    	LD	A,(TEMP1)		;GET #
1314   4792 B7          	OR	A				;IF ZERO THEN
1315   4793 28 04       	JR	Z,UPD07			;HL IS CORRECT
1316   4795             UPD06:
1317   4795 19          	ADD	HL,DE			;ELSE ADD IN CORRECT OFFSET
1318   4796 3D          	DEC	A
1319   4797 20 FC       	JR	NZ,UPD06
1320   4799             UPD07:
1321   4799 ED 5B 0E 40 	LD	DE,(DFCC)		;GT DISPLAY ADDRESS
1322   479D 01 05 00    	LD	BC,05			;#TO MOVE
1323   47A0 ED B0       	LDIR				;MOVE THEM FOR ALL TO SEE
1324   47A2 CD A5 43    	CALL	GETDOL		;GET SOME MONEY
1325   47A5 3A D1 4C    	LD	A,(FLAGA)		;IF 'Q' THEN POP
1326   47A8 CB 47       	BIT	0,A				;A LEVEL IN THE ROUTINE
1327   47AA 20 87       	JR	NZ,UPD02
1328   47AC 21 E2 4C    	LD	HL,DBUFF		;POINT TO DOLLARS
1329   47AF 3A D3 4C    	LD	A,(MONTH)		;PER THE MONDH
1330   47B2 11 55 00    	LD	DE,85			;85 BYTES PER MONTH
1331   47B5 B7          	OR	A				;IF JAN
1332   47B6 28 04       	JR	Z,UPD09			;HL IS CORRECT
1333   47B8             UPD08:
1334   47B8 19          	ADD	HL,DE			;HL POINT TO PROPER MONTH'S DATA
1335   47B9 3D          	DEC	A
1336   47BA 20 FC       	JR	NZ,UPD08
1337   47BC             UPD09:
1338   47BC 22 DE 4C    	LD	(SW00),HL		;SAVE START OF MONTH
1339   47BF 3A D2 4C    	LD	A,(TEMP1)		;GET CATEGORY
1340   47C2 11 05 00    	LD	DE,05)			;BYTES PER CATEGORY
1341   47C5 B7          	OR	A				;IF FIRST
1342   47C6 28 09       	JR	Z,UPD11			;HL IS CORRECT
1343   47C8 FE 0B       	CP	11				;ADJUST FOR BUFFER
1344   47CA 38 01       	JR	C,UPD10
1345   47CC 3C          	INC	A
1346   47CD             UPD10:
1347   47CD 19          	ADD	HL,DE			;ELSE POINT TO CORRECT CATEGORY
1348   47CE 3D          	DEC	A
1349   47CF 20 FC       	JR	NZ,UPD10
1350   47D1             UPD11:
1351   47D1 11 D4 4C    	LD	DE,BCBUF		;POINT TO NEW DOLLARS
1352   47D4 CD 11 43    	CALL	SUMR		;SUM INTO CATEGORY
1353   47D7 2A DE 4C    	LD	HL,(SW00)		;GET START OF MONTH'S DOLLARS
1354   47DA 11 37 00    	LD	DE,5*11			;POINT TO EXP. TOTALS
1355   47DD 3A D2 4C    	LD	A,(TEMP1)		;IF THE CATEGORY IS < 12
1356   47E0 FE 0B       	CP	11				;THEN IT'S AN EXPENSE
1357   47E2 38 03       	JR	C,UPD12			;AND DE IS CORRECT
1358   47E4 11 4B 00    	LD	DE,5*15			;ELSE CHANGE TO INC. TOTAL
1359   47E7             UPD12:
1360   47E7 19          	ADD	HL,DE
1361   47E8 11 D4 4C    	LD	DE,BCBUF
1362   47EB CD 11 43    	CALL	SUMR		;SUM INTO PROPER TOTAL
1363   47EE 2A DE 4C    	LD	HL,(SW00)		;GET START OF MONTH'S DOLLARS
1364   47F1 11 37 00    	LD	DE,5*11			;MOVE EXPENSE TOTAL
1365   47F4 19          	ADD	HL,DE
1366   47F5 11 D4 4C    	LD	DE,BCBUF		;TO THE BCD BUFFER
1367   47F8 01 05 00    	LD	BC,05			;SIGN AND ALL
1368   47FB ED B0       	LDIR
1369   47FD 3A D4 4C    	LD	A,(BCBUF)		;FLIP THE SIGN BYTE
1370   4800 EE 1B       	XOR	1BH				;0DH TO 16H OR 16H TO 0DH
1371   4802 32 D4 4C    	LD	(BCBUF),A
1372   4805 2A DE 4C    	LD	HL,(SW00)		;NOW POINT TO INC. TOTAL
1373   4808 11 4B 00    	LD	DE,5*15
1374   480B 19          	ADD	HL,DE
1375   480C 11 D9 4C    	LD	DE,BCBUF1		;MOVE IT TO TEMP STORAGE
1376   480F 01 05 00    	LD	BC,05
1377   4812 ED B0       	LDIR
1378   4814 11 D9 4C    	LD	DE,BCBUF1		;POINT TO THEM
1379   4817 21 D4 4C    	LD	HL,BCBUF		;POINT TG EXP. TOTAL
1380   481A CD 11 43    	CALL	SUMR		;GET A BAL. TOTAL
1381   481D 2A DE 4C    	LD	HL,(SW00)		;POINT TO BAL. TOTAL
1382   4820 11 50 00    	LD	DE,5*16
1383   4823 19          	ADD	HL,DE
1384   4824 11 D4 4C    	LD	DE,BCBUF		;AND NEW BAL. TOTAL
1385   4827 EB          	EX	DE,HL
1386   4828 01 05 00    	LD	BC,05			;AND SOVE IN NEW TOTAL
1387   482B ED B0       	LDIR
1388   482D C3 7A 47    	JP	UPD05			;BACK FOR MORE DOLLARS THIS CATEGORY
1389   4830              
TASM Z80 Assembler.               finance.asm                      page 26
YEARLY FINANCE 

1390   4830             .EJECT
1391   4830             ;************************************************************************
1392   4830             ;		YEARLY PRINT ROUTINE
1393   4830             ;************************************************************************
1394   4830             YEARLY:
1395   4830 CD 23 41    	CALL	CLS
1396   4833 21 DE 50    	LD	HL,DBUFF+(17*12*5)	;POINT TO YEARLY BUFFER
1397   4836 06 11       	LD	B,17			;IT'S THE SAME AS ONE MONTH
1398   4838 CD FB 48    	CALL	CLYR1		;CLEAR IT
1399   483B 11 E2 4C    	LD	DE,DBUFF		;POINT TO MONTHS
1400   483E 0E 0C       	LD	C,12			;TWELVE OF COURSE
1401   4840             YEAR1:
1402   4840 06 11       	LD	B,17			;17 CTEGORYS AND TOTALS
1403   4842 21 DE 50    	LD	HL,DBUFF+(17*12*5)	;THE YEAR BUFFER
1404   4845             YEAR2:
1405   4845 CD 11 43    	CALL	SUMR		;ADD IN A CATEGORY
1406   4848 C5          	PUSH	BC			;SAVE COUNTS
1407   4849 01 05 00    	LD	BC,05			;ON TO NEXT
1408   484C 09          	ADD	HL,BC
1409   484D EB          	EX	DE,HL			;DO BOTH SOURCES
1410   484E 09          	ADD	HL,BC
1411   484F EB          	EX	DE,HL			;BUMPED ONE CATEGORY'S WORTH BOTH
1412   4850 C1          	POP	BC				;GET COUNTS BACK
1413   4851 10 F2       	DJNZ	YEAR2		;17 IN A MONTH
1414   4853 0D          	DEC	C				;12 MONTHS
1415   4854 20 EA       	JR	NZ,YEAR1
1416   4856 3E 0C       	LD	A,12			;SET FOR YEAR BUFFER
1417   4858 32 D3 4C    	LD	(MONTH),A		;FOR THE PRINTER
1418   485B 21 D1 4C    	LD	HL,FLAGA		;SET PNT 8 FLAG
1419   485E CB D6       	SET	2,(HL)
1420   4860 CD 1A 45    	CALL	PNTSTATE	;AND PRINT IT
1421   4863 21 FA 4B    	LD	HL,MSG18		;'YEARLY TOTALS'
1422   4866 11 12 05    	LD	DE,0512H
1423   4869 CD 4A 41    	CALL	PNTAT
1424   486C 21 79 51    	LD	HL,YEAR			;LET THEM KNOW WHAT YEAR
1425   486F 11 16 06    	LD	DE,0616H
1426   4872 CD 4A 41    	CALL	PNTAT
1427   4875             YEAR3:
1428   4875 21 00 17    	LD	HL,1700H
1429   4878 CD E4 41    	CALL	POSNER		;LDIR INTO BOTTOM TWO LINES
1430   487B ED 5B 0E 40 	LD	DE,(DFCC)		;GET THE ADDRESS
1431   487F 21 BB 4B    	LD	HL,MSG16		;'PRESS P FOR PRINT OR Q FOR QUIT'
1432   4882 01 1F 00    	LD	BC,31
1433   4885 ED B0       	LDIR
1434   4887 ED 53 0E 40 	LD	(DFCC),DE		;MOVE CURSOR
1435   488B CD C6 40    	CALL	GETKEY		;NEED AN ANWWER
1436   488E FE 36       	CP	54				;'Q' ?
1437   4890 CA 82 40    	JP	Z,FINANCE		;YES DONE
1438   4893 FE 35       	CP	53				;'P'
1439   4895 20 DE       	JR	NZ,YEAR3		;NO ERROR
1440   4897 21 00 17    	LD	HL,1700H		;BLANK BOTTOM LINES
1441   489A CD 10 42    	CALL	BLNKLN		;INCASE THEY BREAK IN BASIC
1442   489D 21 00 00    	LD	HL,00			;RESET CURSER TO HOME
1443   48A0 CD E4 41    	CALL	POSNER
1444   48A3 CD 69 08    	CALL	COPY		;PUT IT TO THE PRINTER
1445   48A6 00          	NOP
1446   48A7 00          	NOP
1447   48A8 00          	NOP
1448   48A9 18 CA       	JR	YEAR3
TASM Z80 Assembler.               finance.asm                      page 27
YEARLY FINANCE 

1449   48AB             .EJECT
1450   48AB             ;************************************************************************
1451   48AB             ;
1452   48AB             ;	CLEAR MONTH
1453   48AB             ;
1454   48AB             ;************************************************************************
1455   48AB             CLMNTH:
1456   48AB CD 23 41    	CALL	CLS
1457   48AE 21 7F 4B    	LD	HL,MSG9			;'CLEAR MONTH'
1458   48B1 11 08 0A    	LD	DE,0A08H
1459   48B4 CD 4A 41    	CALL	PNTAT
1460   48B7 21 6C 4B    	LD	HL,MSG7			;'AR YOU SURE'
1461   48BA 11 08 0E    	LD	DE,0E08H
1462   48BD CD 4A 41    	CALL	PNTAT
1463   48C0 06 03       	LD	B,3				;GET UP TO 3
1464   48C2 CD F7 40    	CALL	GETSTG		;GET RESPONSE
1465   48C5 2A 0E 40    	LD	HL,(DFCC)		;POINT TO RESPONSE
1466   48C8 01 03 00    	LD	BC,3			;-3
1467   48CB B7          	OR	A
1468   48CC ED 42       	SBC	HL,BC
1469   48CE 11 7B 4B    	LD	DE,MSG8			;'YES'
1470   48D1 06 03       	LD	B,3				;LENGTH
1471   48D3 CD 89 42    	CALL	COMP
1472   48D6 C2 82 40    	JP	NZ,FINANCE		;NOT 'YES'
1473   48D9 CD 2F 42    	CALL	GTMNTH		;GET A MONTH
1474   48DC 3A D1 4C    	LD	A,(FLAGA)		;'Q'
1475   48DF CB 47       	BIT	0,A
1476   48E1 20 C8       	JR	NZ,CLMNTH		;YES TRY AGAMN
1477   48E3 3A D3 4C    	LD	A,(MONTH)		;GET MONTH
1478   48E6 47          	LD	B,A
1479   48E7 21 E2 4C    	LD	HL,DBUFF
1480   48EA 11 55 00    	LD	DE,85			;# BYTES IN A MONTH
1481   48ED B7          	OR	A				;IS JAN ?
1482   48EE 28 03       	JR	Z,CLMT2			;YES SKIP
1483   48F0             CLMT1:
1484   48F0 19          	ADD	HL,DE			;OFFSET INTO DBUFF
1485   48F1 10 FD       	DJNZ	CLMT1
1486   48F3             CLMT2:
1487   48F3 06 11       	LD	B,17			;# OF FIELDS IN A MONTH
1488   48F5 CD FB 48    	CALL	CLYR1		;FINISH HERE
1489   48F8 C3 82 40    	JP	FINANCE
1490   48FB             CLYR1:
1491   48FB 0E 04       	LD	C,4
1492   48FD 36 0D       	LD	(HL),13			;PUT IN A '$'
1493   48FF             CLYR2:
1494   48FF 23          	INC	HL				;ZERO 4 OF THEM
1495   4900 36 00       	LD	(HL),00
1496   4902 0D          	DEC	C
1497   4903 20 FA       	JR	NZ,CLYR2
1498   4905 23          	INC	HL
1499   4906 10 F3       	DJNZ	CLYR1		;DO ALL BUFFERS
1500   4908 C9          	RET
TASM Z80 Assembler.               finance.asm                      page 28
YEARLY FINANCE 

1501   4909             .EJECT
1502   4909             ;************************************************************************
1503   4909             ;
1504   4909             ;	CLYEAR:		CLEAR YEAR ROUTINE
1505   4909             ;
1506   4909             ;************************************************************************
1507   4909             CLYEAR:
1508   4909 CD 23 41    	CALL	CLS
1509   490C 21 61 4B    	LD	HL,MSG6			;'CLEAR YEAR'
1510   490F 11 05 0A    	LD	DE,0A05H
1511   4912 CD 4A 41    	CALL	PNTAT
1512   4915 21 6C 4B    	LD	HL,MSG7			;'ARE YOU SURE'
1513   4918 11 04 0E    	LD	DE,0E04H
1514   491B CD 4A 41    	CALL	PNTAT
1515   491E 06 03       	LD	B,3				;GET UP TO 3
1516   4920 CD F7 40    	CALL	GETSTG
1517   4923 2A 0E 40    	LD	HL,(DFCC)		;POINT TO RESPONSE
1518   4926 01 03 00    	LD	BC,3			;-3
1519   4929 B7          	OR	A
1520   492A ED 42       	SBC	HL,BC
1521   492C 11 7B 4B    	LD	DE,MSG8			;'YES'
1522   492F 06 03       	LD	B,3				;LENGTH
1523   4931 CD 89 42    	CALL	COMP
1524   4934 C2 82 40    	JP	NZ,FINANCE		;NOT 'YES'
1525   4937 CD 23 41    	CALL	CLS
1526   493A 21 08 4C    	LD	HL,MSG19		;'INPUT YEAR'
1527   493D 11 04 15    	LD	DE,1504H
1528   4940 CD 4A 41    	CALL	PNTAT
1529   4943 06 04       	LD	B,4				;GET A MAX OF FOUR
1530   4945 CD F7 40    	CALL	GETSTG
1531   4948 2A 0E 40    	LD	HL,(DFCC)		;GET ENDING ADDRESS
1532   494B 48          	LD	C,B				;IN BC
1533   494C 06 00       	LD	B,0
1534   494E B7          	OR	A
1535   494F ED 42       	SBC	HL,BC			;GO TO START
1536   4951 11 79 51    	LD	DE,YEAR			;MOVE IT
1537   4954 01 04 00    	LD	BC,4
1538   4957 ED B0       	LDIR
1539   4959 3E 60       	LD	A,60H			;PUT IN A EOL
1540   495B 12          	LD	(DE),A
1541   495C 21 E2 4C    	LD	HL,DBUFF		;CLEAR ENTIRE BUFFER
1542   495F 06 CC       	LD	B,12*17			;DO ALL
1543   4961 CD FB 48    	CALL	CLYR1		;CLEAR THEM
1544   4964 C3 82 40    	JP	FINANCE
TASM Z80 Assembler.               finance.asm                      page 29
YEARLY FINANCE 

1545   4967             .EJECT
1546   4967             ;************************************************************************
1547   4967             ;
1548   4967             ;		SAVE ROUTINE
1549   4967             ;		SAVES PROGRAM TWICE UNDER THE NAME 'FINANCE'
1550   4967             ;
1551   4967             ;************************************************************************
1552   4967             SAVE:
1553   4967 CD 23 41    	CALL	CLS
1554   496A 21 76 4C    	LD	HL,MSG27		;'TAPE SAVE'
1555   496D 11 09 05    	LD	DE,0509H
1556   4970 CD 4A 41    	CALL	PNTAT
1557   4973 21 80 4C    	LD	HL,MSG28		;'START RECORDER PRESS ENTER'
1558   4976 11 00 0A    	LD	DE,0A00H
1559   4979 CD 4A 41    	CALL	PNTAT
1560   497C CD C6 40    	CALL	GETKEY		;WAIT FOR ENTER
1561   497F FE 7A       	CP	122				;WAS IT ENTER ?
1562   4981 C2 82 40    	JP	NZ,FINANCE		;NO LEAVE
1563   4984 CD 23 0F    	CALL	FAST		;MUST BE IN FAST MODE
1564   4987 21 9B 4C    	LD	HL,MSG29		;'FINANCE'   ** NOTE THE 'E'IS INVERTED VIDEO
1565   498A CD FC 02    	CALL	CSAVE		;IN ZX81 ROM
1566   498D CD 23 0F    	CALL	FAST		;INSURE FAST MODE
1567   4990 21 9B 4C    	LD	HL,MSG29		;DO SECOND COPY
1568   4993 CD FC 02    	CALL	CSAVE
1569   4996 CD 2B 0F    	CALL	SLOW		;SO WE CAN SEE
1570   4999 C3 82 40    	JP	FINANCE			;AND DO MORE
TASM Z80 Assembler.               finance.asm                      page 30
YEARLY FINANCE 

1571   499C             .EJECT
1572   499C             ;****************************************************************"*******
1573   499C             ;
1574   499C             ;	CHANGE CATEGORY ROUTINE
1575   499C             ;
1576   499C             ;************************************************************************
1577   499C             CHCAT
1578   499C CD 23 41    	CALL	CLS
1579   499F CD 44 43    	CALL	CATPNT		;SHOW THEM THE CATEGORIES
1580   49A2 21 14 4C    	LD	HL,MSG20		;'CATEGORY CHANGE'
1581   49A5 11 02 01    	LD	DE,0102H
1582   49A8 CD 4A 41    	CALL	PNTAT
1583   49AB             CHC1:
1584   49AB 21 00 10    	LD	HL,1000H		;CLEAN UP DISPLAY BOR LOOPING
1585   49AE CD 10 42    	CALL	BLNKLN
1586   49B1 26 12       	LD	H,12H
1587   49B3 CD 10 42    	CALL	BLNKLN
1588   49B6 26 14       	LD	H,14H
1589   49B8 CD 10 42    	CALL	BLNKLN
1590   49BB 21 24 4C    	LD	HL,MSG21		;'INPUT STARTING CATEGORY'
1591   49BE 11 02 11    	LD	DE,1102H
1592   49C1 CD 4A 41    	CALL	PNTAT
1593   49C4 06 02       	LD	B,2				;GET UP TO TWO
1594   49C6 CD F7 40    	CALL	GETSTG
1595   49C9 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS OF INPUT
1596   49CC 48          	LD	C,B				;# ENTERED TO BC
1597   49CD 06 00       	LD	B,0
1598   49CF B7          	OR	A
1599   49D0 ED 42       	SBC	HL,BC
1600   49D2 7E          	LD	A,(HL)			;GET FIRST ENTRY
1601   49D3 FE 36       	CP	54				;'Q' ?
1602   49D5 CA 82 40    	JP	Z,FINANCE		;YES BAG IT
1603   49D8 B7          	OR	A				;IF NONE
1604   49D9 28 D0       	JR	Z,CHC1			;IT WON'T WORK
1605   49DB 0D          	DEC	C				;IF THE COUNT IS ONE
1606   49DC 28 07       	JR	Z,CHC2			;SKIP TENS DIGIT
1607   49DE FE 1D       	CP	29				;IF TWO THEN TEN'S DIGIT
1608   49E0 20 C9       	JR	NZ,CHC1			;MUST BE A ONE
1609   49E2 0E 0A       	LD	C,10			;INIT 10'S COUNT
1610   49E4 23          	INC	HL				;MOVE POINTER TO UNITS
1611   49E5             CHC2:
1612   49E5 7E          	LD	A,(HL)			;GET UNITS DIGIT
1613   49E6 D6 1D       	SUB	29				;BINARY -1
1614   49E8 81          	ADD	A,C				;PUT IN TEN'S VALUE
1615   49E9 FE 0E       	CP	14				;> 13 IS ERROR
1616   49EB 30 BE       	JR	NC,CHC1			;SO TRY AGAIN
1617   49ED             CHC3:
1618   49ED 21 00 11    	LD	HL,1100H		;BLANK INPUT LINE
1619   49F0 CD 10 42    	CALL	BLNKLN
1620   49F3 21 33 4C    	LD	HL,MSG22		;'CATEGORY '
1621   49F6 11 02 10    	LD	DE,1002H
1622   49F9 CD 4A 41    	CALL	PNTAT
1623   49FC 2A 0E 40    	LD	HL,(DFCC)
1624   49FF 0E 00       	LD	C,00			;SET C FOR UNDER 10
1625   4A01 FE 09       	CP	09				;IF OVER 9 SET C
1626   4A03 38 0A       	JR	C,CHC4
1627   4A05 0E 0A       	LD	C,10
1628   4A07 CB 59       	BIT	3,C				;WAS THERE A 10'S DIGIT ?
1629   4A09 28 04       	JR	Z,CHC4			;NO JUST DO UNITS
1630   4A0B 36 1D       	LD	(HL),29			;PUT IN THE '1'
1631   4A0D 23          	INC	HL
1632   4A0E 91          	SUB	C				;AND MAKE REG A UNITS
1633   4A0F             CHC4:
1634   4A0F C6 1D       	ADD	A,29			;MAKE UNITS ZASCII
1635   4A11 77          	LD	(HL),A			;PUT IN DISPLAY
1636   4A12 D6 1D       	SUB	29				;BACK TO BINARY
1637   4A14 81          	ADD	A,C				;TEN'S ALSO
1638   4A15 23          	INC	HL				;INSERT
1639   4A16 36 14       	LD	(HL),20			;A '='
1640   4A18 23          	INC	HL
1641   4A19 EB          	EX	DE,HL			;DISPLAY FILE TO DE
1642   4A1A 01 05 00    	LD	BC,5			;# CHAR PER CATEGORY
1643   4A1D 21 33 51    	LD	HL,CATTXT
1644   4A20 B7          	OR	A				;IF FIRST
1645   4A21 28 06       	JR	Z,CHC6			;HL IS CGRRECT
1646   4A23 F5          	PUSH	AF			;SAVE CATEGORY
1647   4A24             CHC5:
1648   4A24 09          	ADD	HL,BC			;MOVE INTO CTTXT TO PROPER CATEGORY
1649   4A25 3D          	DEC	A
1650   4A26 20 FC       	JR	NZ,CHC5
1651   4A28 F1          	POP	AF				;GET CATEGORY BACK
1652   4A29             CHC6:
1653   4A29 22 DE 4C    	LD	(SW00),HL		;SAVE CATTXT ADDRESS
1654   4A2C ED B0       	LDIR				;BC = 05 DE --> DISPLAY FILE
1655   4A2E EB          	EX	DE,HL			;CLEAR FOR TWO DiGIT #'S
1656   4A2F 36 00       	LD	(HL),00
1657   4A31 21 5E 4C    	LD	HL,MSG26		;'INPUT NEW CATEGORY OR Q'
1658   4A34 11 02 14    	LD	DE,1402H
1659   4A37 CD 4A 41    	CALL	PNTAT
1660   4A3A 21 0F 12    	LD	HL,120FH		;POSATION INPUT TO OLD CATEGORY
1661   4A3D FE 09       	CP	9				;COUNTING 0 --< 13
1662   4A3F 38 01       	JR	C,CHC7
1663   4A41 2C          	INC	L				;MOVE OVER IF OVER 9
1664   4A42             CHC7:
1665   4A42 CD E4 41    	CALL	POSNER
1666   4A45 06 05       	LD	B,5				;GET UP TO 5 FOR NEW NAME
1667   4A47 CD F7 40    	CALL	GETSTG
1668   4A4A 04          	INC	B				;IF ENTER ONLY
1669   4A4B 05          	DEC	B
1670   4A4C 28 1A       	JR	Z,CHC8			;MOVE ON TO NEXT
1671   4A4E 2A 0E 40    	LD	HL,(DFCC)		;GET ADDRESS OF NEW
1672   4A51 48          	LD	C,B
1673   4A52 06 00       	LD	B,0
1674   4A54 B7          	OR	A
1675   4A55 ED 42       	SBC	HL,BC
1676   4A57 5F          	LD	E,A				;SAVE CATEGORY
1677   4A58 7E          	LD	A,(HL)			;GET FIRST CHAR
1678   4A59 FE 36       	CP	54				;IS IT A 'Q'
1679   4A5B 7B          	LD	A,E				;REPLACE CATEGORY
1680   4A5C CA AB 49    	JP	Z,CHC1			;'Q' POP UP A HEVEL
1681   4A5F 01 05 00    	LD	BC,05
1682   4A62 ED 5B DE 4C 	LD	DE,(SW00)		;GET STARTINC ADDRESS
1683   4A66 ED B0       	LDIR				;AND MOVE NEW CATEGORY IN
1684   4A68             CHC8:
1685   4A68 3C          	INC	A				;MOVE TO NEXT
1686   4A69 FE 0E       	CP	14				;WAS THAT THE LAST ?
1687   4A6B 38 01       	JR	C,CHC9			;NO
1688   4A6D AF          	XOR	A				;YES START OVER
1689   4A6E             CHC9:
1690   4A6E CD 44 43    	CALL	CATPNT		;PRINT THE CHANGE
1691   4A71 21 00 12    	LD	HL,1200H		;BLANK INPUT LINE
1692   4A74 CD 10 42    	CALL	BLNKLN
1693   4A77 C3 ED 49    	JP	CHC3			;AND GET NEXT
1694   4A7A             
TASM Z80 Assembler.               finance.asm                      page 31
YEARLY FINANCE 

1695   4A7A             .EJECT
1696   4A7A             ;************************************************************************
1697   4A7A             ;
1698   4A7A             ;							MESSEGES
1699   4A7A             ;
1700   4A7A             ;					SUBSTITUTE CHAR FOR N/L, = 122			
1701   4A7A             ;					BECAUSE A 76H CANNOT GO INTO A REM STATEMENT
1702   4A7A             ;					AND 122 IS NOT USED BY THE ZX81
1703   4A7A             ;
1704   4A7A             ;************************************************************************
1705   4A7A              
1706   4A7A             MSG1:					;'YEARLY FINANCE'
1707   4A7A 3E2A2637313E	.BYTE	62,42,38,55,49,62,00,43,46,51,38,51,40,42,122,122
1707   4A80 002B2E332633282A7A7A
1708   4A8A             	
1709   4A8A             						;'MODES'
1710   4A8A 000000000000	.BYTE	00,00,00,00,00,00,00,00,50,52,41,42,56,122,122
1710   4A90 00003234292A387A7A
1711   4A99             	
1712   4A99             						;'1=STATEMENT'
1713   4A99 000000001D14    .BYTE 00,00,00,00,29,20,56,57,38,57,42,50,42,51,57,122
1713   4A9F 383926392A322A33397A
1714   4AA9             	
1715   4AA9             						;'2=UPDATE'
1716   4AA9 000000001E14	.BYTE	00,00,00,00,30,20,58,53,41,38,57,42,122
1716   4AAF 3A352926392A7A
1717   4AB6             	
1718   4AB6             						;'3=YEARLY TOTALS'
1719   4AB6 000000001F14	.BYTE	00,00,00,00,31,20,62,42,38,55,49,62,00,
1719   4ABC 3E2A2637313E00
1720   4AC3 393439263138	.BYTE	57,52,57,38,49,56,122
1720   4AC9 7A
1721   4ACA             	
1722   4ACA             						;'4=CLEAR MONTH'
1723   4ACA 000000002014	.BYTE	00,00,00,00,32,20,40,49,42,38,55,00,50,52,51,57,45,122
1723   4AD0 28312A263700323433392D7A
1724   4ADC             	
1725   4ADC             						;'5=CLEAR YEAR'
1726   4ADC 000000002114	.BYTE	00,00,00,00,33,20,40,49,42,38,55,00,62,42,38,55,122
1726   4AE2 28312A2637003E2A26377A
1727   4AED             	
1728   4AED             						;'6=SAVE'
1729   4AED 000000002214	.BYTE	00,00,00,00,34,20,56,38,59,42,122
1729   4AF3 38263B2A7A
1730   4AF8             	
1731   4AF8             						;'7=CHANGE CATEGORIES'
1732   4AF8 000000002314	.BYTE	00,00,00,00,35,20,40,45,38,51,44,42,00,40,38,57,42,44,52,55,46,42,56,60H
1732   4AFE 282D26332C2A002826392A2C34372E2A3860
1733   4B10             	
1734   4B10             MSG2:	 				;'SELECTION: '
1735   4B10 382A312A2839	.BYTE	56,42,49,42,40,57,46,52,51,14,00,60H
1735   4B16 2E34330E0060
1736   4B1C             	
1737   4B1C             MSG3:					;'INPUT MONTH 1 T0 12: '
1738   4B1C 2E33353A3900	.BYTE	46,51,53,58,57,00,50,52,51,57,45,00,29,00,57,52,00,29,30,14,00,60H
1738   4B22 323433392D001D003934001D1E0E0060
1739   4B32             	
1740   4B32             MSG4:					;'INPUT AMOUNT:$             '
1741   4B32 2E33353A3900	.BYTE	46,51,53,58,57,00,38,50,52,58,51,57,14,
1741   4B38 2632343A33390E
1742   4B3F 0D0000000000	.BYTE	13,00,00,00,00,00,00,00,00,00,00,60H
1742   4B45 000000000060
1743   4B4B             	
TASM Z80 Assembler.               finance.asm                      page 32
YEARLY FINANCE 

1744   4B4B             .EJECT
1745   4B4B             MSG5:					;REENTER AMOUNT'
1746   4B4B 372A2A33392A	.BYTE	55,42,42,51,57,42,55,00,41,52,49,49,38,55,00,38,50,52,58,51,57,60H
1746   4B51 3700293431312637002632343A333960
1747   4B61             	
1748   4B61             MSG6:					;'CLEAR YEAR'
1749   4B61 28312A263700	.BYTE	40,49,42,38,55,00,62,42,38,55,60H
1749   4B67 3E2A263760
1750   4B6C             	
1751   4B6C             MSG7:					;'ARE YOU SURE? '
1752   4B6C 26372A003E34	.BYTE	38,55,42,00,62,52,58,00,56,58,55,42,15,00,60H
1752   4B72 3A00383A372A0F0060
1753   4B7B             	
1754   4B7B             MSG8:					;'YES'
1755   4B7B 3E 2A 38 60 	.BYTE	62,42,56,60H
1756   4B7F             	
1757   4B7F             MSG9:					;'CLEAR MONTH'
1758   4B7F 28312A263700	.BYTE	40,49,42,38,55,00,50,52,51,57,45,60H
1758   4B85 323433392D60
1759   4B8B             	
1760   4B8B             MSG10:                  ;'MONTHLY STATEMENT'
1761   4B8B 323433392D31    .BYTE   50,52,51,57,45,49,62,00,56,57,38,57,42,50,42,51,57,60H
1761   4B91 3E00383926392A322A333960
1762   4B9D             	
1763   4B9D             MSG11:                  ;'TOTAL  -------'
1764   4B9D 3934392631  	.BYTE	57,52,57,38,49
1765   4BA2             	
1766   4BA2             MSG12:					;'  -------'
1767   4BA2 000016161616	.BYTE	00,00,22,22,22,22,22,22,22,60H
1767   4BA8 16161660
1768   4BAC             	
1769   4BAC             MSG13:					;'EXP.'
1770   4BAC 2A3D351B60  	.BYTE	42,61,53,27,60H
1771   4BB1             	
1772   4BB1             MSG14:					;'INC.'
1773   4BB1 2E33281B60  	.BYTE	46,51,40,27,60H
1774   4BB6             	
1775   4BB6             MSG15:					;'BAL.'
1776   4BB6 2726311B60  	.BYTE	39,38,49,27,60H
1777   4BBB             	
1778   4BBB             MSG16:					;'PRESS P FOR PRINT OR Q TO QUIT '
1779   4BBB 35372A383800	.BYTE	53,55,42,56,56,00,53,00,43,52,55,00,53,55,46,51,57,00,52,
1779   4BC1 35002B34370035372E33390034
1780   4BCE 370036003934	.BYTE	55,00,54,00,57,52,00,54,58,46,57,00,60H
1780   4BD4 00363A2E390060
1781   4BDB             	
1782   4BDB             MSG17:							;PRESS L FOR LAST OR N FOR NEXT'
1783   4BDB 35372A383800	.BYTE	53,55,42,56,56,00,49,00,43,52,55,00,49,38,56,57,00,52,55,00,
1783   4BE1 31002B3437003126383900343700
1784   4BEF 33002B343700	.BYTE	51,00,43,52,55,00,51,42,61,57,60H
1784   4BF5 332A3D3960
1785   4BFA             	
1786   4BFA             MSG18:							;'YEARLY TOTALS'
1787   4BFA 3E2A2637313E	.BYTE	62,42,38,55,49,62,00,57,52,57,38,49,56,60H
1787   4C00 0039343926313860
1788   4C08             	
1789   4C08             MSG19:							;'INPUT YEAR'
1790   4C08 2E33353A3900	.BYTE	46,51,53,58,57,00,62,42,38,55,00,60H
1790   4C0E 3E2A26370060
1791   4C14             	
1792   4C14             MSG20:							;'CATEGORY CHANGE'
1793   4C14 2826392A2C34	.BYTE	40,38,57,42,44,52,55,62,00,40,45,38,51,44,42,60H
1793   4C1A 373E00282D26332C2A60
1794   4C24             	
1795   4C24             MSG21:							;'INPUT STARTING 
1796   4C24 2E33353A3900	.BYTE	46,51,53,58,57,00,56,57,38,55,57,46,51,44,00,
1796   4C2A 38392637392E332C00
1797   4C33             	
1798   4C33             MSG22:							;CATEGORY'
1799   4C33 2826392A2C34	.BYTE	40,38,57,42,44,52,55,62,00,00,00,60H
1799   4C39 373E00000060
1800   4C3F             	
TASM Z80 Assembler.               finance.asm                      page 33
YEARLY FINANCE 

1801   4C3F             .EJECT
1802   4C3F             MSG23:					;'FOR  "
1803   4C3F 2B3437000060	.BYTE	43,52,55,00,00,60H
1804   4C45             MSG24:					;'UPDATE '
1805   4C45 3A352926392A	.BYTE	58,53,41,38,57,42,00,60H
1805   4C4B 0060
1806   4C4D             MSG25:					;'WHICH CATEGORY? '
1807   4C4D 3C2D2E282D00	.BYTE	60,45,46,40,45,00
1808   4C53 2826392A2C34	.BYTE	40,38,57,42,44,52,55,62,15,00,60H
1808   4C59 373E0F0060
TASM Z80 Assembler.               finance.asm                      page 34
YEARLY FINANCE 

1809   4C5E             .EJECT
1810   4C5E             MSG26:					;'INPUT NEW CATEGORY OR Q'
1811   4C5E 2E33353A3900	.BYTE	46,51,53,58,57,00,51,42,60,00,40,38,57,42,44,52
1811   4C64 332A3C002826392A2C34
1812   4C6E 373E00343700	.BYTE	55,62,00,52,55,00,54,60H
1812   4C74 3660
TASM Z80 Assembler.               finance.asm                      page 35
YEARLY FINANCE 

1813   4C76             .EJECT
1814   4C76             MSG27:					;'TAPE SAVE'
1815   4C76 3926352A0038	.BYTE	57,38,53,42,00,56,38,59,42,60H
1815   4C7C 263B2A60
1816   4C80             	
1817   4C80             MSG28:					;'START RECORDER PRESS ENTER'
1818   4C80 383926373900	.BYTE	56,57,38,55,57,00,55,42,40,52,55,41,42,55,00,53
1818   4C86 372A283437292A370035
1819   4C90 372A3838002A	.BYTE	55,42,56,56,00,42,51,57,42,55,60H
1819   4C96 33392A3760
1820   4C9B             	
1821   4C9B             MSG29:					;'FINANCE' ** NOTE 'E' IS INVARTED
1822   4C9B 2B2E33263328	.BYTE	43,46,51,38,51,40,170,49,38,56,57,60H
1822   4CA1 AA3126383960
1823   4CA7             	
TASM Z80 Assembler.               finance.asm                      page 36
YEARLY FINANCE 

1824   4CA7             .EJECT
1825   4CA7             MTEXT:					;'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC         '
1826   4CA7 2F26332B2A27	.BYTE	47,38,51,43,42,39,50,38,55,38,53,55,50,38,62,47
1826   4CAD 32263726353732263E2F
1827   4CB7 3A332F3A3126	.BYTE	58,51,47,58,49,38,58,44,56,42,53,52,40,57,51,52
1827   4CBD 3A2C382A353428393334
1828   4CC7 3B292A280000	.BYTE	59,41,42,40,00,00,00,00,00,00
1828   4CCD 00000000
1829   4CD1             	
TASM Z80 Assembler.               finance.asm                      page 37
YEARLY FINANCE 

1830   4CD1             .EJECT
1831   4CD1             FLAGA:	.block	01
1832   4CD2             ;************************************************************************
1833   4CD2             ;		** FLAGA  *
1834   4CD2             ;	BIT	USE
1835   4CD2             ;	 0	QUIT FLAG -- SET IF 'Q' PRESSED IN GETMNTH & GETDOL
1836   4CD2             ;	 1	MINUS FLAG IN GETDOL SET IF INPUT IS MINUS
1837   4CD2             ;	 2	PRINT 6 0R 8 FLAG (SET = PRINT 8 RESET = PRINT 6 BCD DIGITS)
1838   4CD2             ;	 3	PRINT ONE ONLY FOR UPDATE
1839   4CD2             ;	 4		** UNUSED **
1840   4CD2             ;	 5		** UNUSED **
1841   4CD2             ;	 6		** UNUSED **
1842   4CD2             ;	 7		** UNUSED **
1843   4CD2             ;************************************************************************
1844   4CD2             TEMP1:	.block	01			;CATEGORY STORAGE TEMPORY
1845   4CD3             MONTH:	.block	01			;MONTH STORAGE
1846   4CD4             BCBUF:	.block	05			;BCD BUFFER GOR GETDOL
1847   4CD9             BCBUF1:	.block	05			;BCD BUFFER FOR UPDATE
1848   4CDE             SW00:	.block	02			;TEMP STORAGE
1849   4CE0             CHBUF:	.block	02			;DUMMY STRING FOR PNTCHR
1850   4CE2             DBUFF:	.block	17*13*5		;DOLLAR BUFFER (CAT,MONTH,LENGTH)
1851   5133             CATTXT:	.block	14*5		;CATEGORY TEXT 14X5 LONG
1852   5179             YEAR:	.block	05			;ZASCII YEAR
1853   517E             BCTEMP:	.block	05			;TEMP BUFFER FOR SUMSWAP
1854   5183             CATNO:	.block	02			;CATEGORY # FOR UPDATE IN ZASCII
1855   5185             
1856   5185             ;************************************************************************
1857   5185             ;				THIS MESSAGE REMOVED AT THE REQUEST OF THE PUBLISHER
1858   5185             ;************************************************************************
1859   5185             ;MSG31:						;'(C) 1983, D. J. BERRY'
1860   5185             ;	.BYTE	16,40,17,00,29,37,36,31,00,41,27,47,27,39,42,55,55,62,60H
1861   5185             FIN: .END
tasm: Number of errors = 0
\n
If you have enjoyed the site, please consider a donation towards preservation of more items: