Subversion Repositories MB01 Project

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 - 1
  Tue Jul 17 11:00:16 2018                                                                                               Page    1
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
          2500 A.D. 65816 Macro Assembler #26960 - Version 5.02g
10
          -----------------------------------------------------
11
 
12
                       Input  Filename : src\F8\intp.asm
13
                       Output Filename : obj\F8\intp.obj
14
                       Listing Has Been Relocated
15
 
16
 
17
 2588                        	.LIST		on
18
 2589
19
 2590
20
 2591                        	;----------------------------------------------------------
21
 2592                        	; variabili in Direct-Page 02
22
 2593                        	;----------------------------------------------------------
23
 2594  F8FFB1
24
 2595  F8FFB1                		.INCLUDE inc\dirp02.inc
25
 2596                        	;----------------------------------------------------------
26
 2597                        	; DIRP02.ASM
27
 2598                        	; PROGETTO: B1601
28
 2599                        	;
29
 2600                        	; Variabili in Direct Page $02
30
 2601                        	;----------------------------------------------------------
31
 2602
32
 2603                        	; sezione COMMON -- questo permette di includere il file in piu' file
33
 2604
34
 2605                        	DIRP02:	.SECTION page0, ref_only, common	;Direct-Page 02
35
 2606
36
 2607  000000                		.ABSOLUTE		;; inizia sempre da $00
37
 2608  000000                		.ORG		0x00
38
 2609  000000
39
 2610                        	; variabili usate nella funzione _vprintl e famiglia funzioni di formattazione
40
 2611  000000  0000          	FmtParm		.DW		;; ptr array parametri banco 0
41
 2612  000002                	FmtLPFmt	LP		;; long ptr stringa szFmt
42
 2613  000005                	FmtLPPut	LP		;; long ptr funzione 'putter'
43
 2614  000008  00            	FmtSpec		.DB		;; indice '%' corrente in szFmt
44
 2615  000009  00            	FmtWidth	.DB		;; campo width
45
 2616  00000A  00            	FmtPrec		.DB		;; campo precision
46
 2617  00000B  00            	FmtFlag		.DB		;; flag formattazione
47
 2618  00000C  00            	FmtSgn		.DB		;; segno positivo (se 0 -> no segno)
48
 2619  00000D  00            	VStoreF		.DB		;; flag modo store
49
 2620  00000E  00            	FmtMod		.DB		;; flag modificatori
50
 2621  00000F  00            	FmtDst		.DB		;; ptr stringa szDst banco 0
51
 2622
52
 2623  000010  0000          	FmtCnt		.DW		;; contatore caratteri
53
 2624  000012  0000          	FmtGMax		.DW		;; max. len stringa globale
54
 2625  000014
55
 2626  000014  0000          	XVDec		.DW		; esponente decimale (signed)
56
 2627  000016  00            	XVFlag		.DB		; flag per conversioni numeriche
57
 2628  000017
58
 2629  000017  00            	ACMCmps		.DB		; flag compare segno e tipo (intero)
59
 2630
60
 2631  000018                	ACM		DQ		; accumulatore #1 integer 64 bit
61
 2632  000020  00            	ACMSize		.DB		; size
62
 2633  000021  00            	ACMSgn		.DB		; <7>:segno, <6>:tipo signed
63
  Tue Jul 17 11:00:16 2018                                                                                               Page    2
64
 
65
 
66
 
67
 
68
 2634  000022  00            	ACMMinSize	.DB		; minima dimensione richiesta per ACM
69
 2635  000023  00            	IARGMinSize	.DB
70
 2636
71
 2637  000024  00            	FPTmp1		.DB		; byte temporaneo
72
 2638  000025  00            	FPTmp2		.DB		; byte temporaneo
73
 2639  000026  00            	FPTmp3		.DB		; byte temporaneo
74
 2640  000027  00            	FPTmp4		.DB		; byte temporaneo
75
 2641
76
 2642  000028                	IARG		DQ		; accumulatore #2 integer 64 bit
77
 2643  000030  00            	IARGSize	.DB		; size
78
 2644  000031  00            	IARGSgn		.DB		; <7>:segno, <6>:tipo signed
79
 2645
80
 2646  000032                	FOP		DS	9	; temporaneo per FDIV/FMULT/integer MULT/DIV
81
 2647                        					; conversione integer -> string
82
 2648  00003B  00            	FPIndx		.DB		; byte generico indice
83
 2649  00003C  0000          	FPWTmp7		.DW		; word temporanea
84
 2650  00003E  0000          	FPWTmp8		.DW		; word temporanea
85
 2651
86
 2652                        	; variabili temporanee sovrapposte a FOP
87
 2653          000036        	FACXM		.EQU	FOP+4	; byte temporaneo
88
 2654          000037        	ARGXM		.EQU	FOP+5	; byte temporaneo
89
 2655          000038        	FPWTmp5		.EQU	FOP+6	; word temporanea
90
 2656          00003A        	FPTmp6		.EQU	FOP+8	; byte temporaneo
91
 2657
92
 2658                        	; Floating Point Accumulator #1 - FAC
93
 2659  000040  00            	FACSGN		.DB		; FAC mantissa sign
94
 2660  000041  00            	FACEXT		.DB		; FAC 8 bit extension (rounding)
95
 2661  000042                	FACM		DQ		; FAC Mantissa (64 bit)
96
 2662  00004A  0000          	FACExp		.DW		; FAC Exponent
97
 2663          00004A        	FACEXPL		.EQU	FACExp		; FAC Exponent Low
98
 2664          00004B        	FACEXPH		.EQU	FACExp+1	; FAC Exponent Hi
99
 2665
100
 2666  00004C  00            	FACSCMP		.DB		; Sign Comparison Result: FAC vs ARG
101
 2667  00004D  00            	FACMlt		.DB		; flag MULT
102
 2668  00004E  00            	FACUndf		.DB		; conteggio shift per underflow
103
 2669  00004F  00            	FPDCnt		.DB		; contatore per inserzione punto decimale
104
 2670  000050
105
 2671                        	; Floating Point Accumulator #2 - ARG
106
 2672  000050  00            	ARGSGN		.DB		; ARG mantissa sign
107
 2673  000051  00            	ARGEXT		.DB		; ARG 8 bit extension (rounding)
108
 2674  000052                	ARGM		DQ		; ARG Mantissa (64 bit)
109
 2675  00005A  0000          	ARGExp		.DW		; ARG Exponent
110
 2676          00005A        	ARGEXPL		.EQU	ARGExp		; ARG Exponent Low
111
 2677          00005B        	ARGEXPH		.EQU	ARGExp+1	; ARG Exponent Hi
112
 2678
113
 2679                        	; numero bytes FAC
114
 2680          00000A        	FACSIZE		.EQU	(FACEXPH - FACEXT)
115
 2681          000008        	MANTSIZE	.EQU	(FACSIZE - 2)
116
 2682          000040        	FACMBITS	.EQU	(MANTSIZE * 8)
117
 2683          000041        	FAC		.EQU	FACEXT
118
 2684          000051        	ARG		.EQU	ARGEXT
119
 2685
120
 2686  00005C  0000          	FPWTmp		.DW
121
 2687  00005E  0000          	FPExp		.DW		; esponente conversioni str/float
122
 2688  000060                	FPLPtr		LP		; long ptr operazioni move
123
 2689  000063  00            	FPFlag		.DB		; flag generico operazioni FPU
124
 2690  000064                	FACTmp		.DS	12	; registro FAC temporaneo (con sgn ed ext)
125
  Tue Jul 17 11:00:16 2018                                                                                               Page    3
126
 
127
 
128
 
129
 
130
 2691
131
 2692                        	; buffer per conversione da int/float a string (20 digit + 2)
132
 2693          000016        	FPSTRSIZE	.EQU	22
133
 2694  000070                	FPUStr		.DS	FPSTRSIZE
134
 2695
135
 2696                        	; buffer per formattazione int/float
136
 2697          000030        	XFSTRSIZE	.EQU	48
137
 2698  000086                	XCVTStr		.DS	XFSTRSIZE
138
 2699          0000B5        	XCVTStrEnd	.EQU	($ - 1)
139
 2700
140
 2701  0000B6                	DUMMY100	.DS	22
141
 2702
142
 2703          000060        	PTR1	.EQU	FPLPtr		; long ptr operazioni 'move'
143
 2704          000063        	FPFLAG	.EQU	FPFlag
144
 2705          00004F        	FPDCNT	.EQU	FPDCnt
145
 2706  0000CC
146
 2707  0000CC                		.RELATIVE
147
 2708
148
 2709                        		.ENDS
149
 2710
150
 2711          FFFFB0        	MAXMANTSHIFT	.EQU	(-(FACMBITS + 16))	; max. shift divisione mant.
151
 2712          00002F        	XCVTMAXF	.EQU	(XFSTRSIZE - 1)		; max. caratteri formato F
152
 2713          000027        	XCVTMAXE	.EQU	(XCVTMAXF -  8)		; max. caratteri formato E
153
 2714          00002E        	XCVTMAXI	.EQU	(XFSTRSIZE - 2)		; max. caratteri stringa int.
154
 2715
155
 2716  F8FFB1
156
 2717
157
 2718
158
 2719                        	; max. unsigned:  18446744073709551615
159
 2720                        	; max. signed  :   9223372036854775807
160
 2721                        	; min. signed  :  -9223372036854775808
161
 2722
162
 2723                        	;----------------------------------------------------------
163
 2724                        	; segmento codice banco $F8
164
 2725                        	;----------------------------------------------------------
165
 2726
166
 2727                        		.CODEF8
167
 2728                        		.GLOBAL _iUMult8, _iUMult16, _iUMult32, _iUMult64
168
 2729                        		.GLOBAL _iSMult8, _iSMult16, _iSMult32, _iSMult64
169
 2730                        		.GLOBAL _iUDiv8, _iUDiv16, _iUDiv32, _iUDiv64, Byte2Hex
170
 2731                        		.GLOBAL _iSDiv8, _iSDiv16, _iSDiv32, _iSDiv64
171
 2732                        		.GLOBAL _Str2Hex, _Str2Int, _Int2Str, _UI2Str, _iMovACM2A
172
 2733                        		.PUBLIC fidiv, fimlt
173
 2734
174
 2735                        		.LONGA	off
175
 2736                        		.LONGI	off
176
 2737
177
 2738          000008        	INTGSIZE	.EQU	8	; # bytes interi a 64 bytes
178
 2739          00007F        	MAXINTSTR	.EQU	127	; max. lughezza stringa dec/hex
179
 2740
180
 2741
181
 2742                        	; _lstrtoint(lpStr, bSiz, bFlag, lpRes)
182
 2743                        	;
183
 2744                        	; convert decimal/hexadecimal string lpStr to integer
184
 2745                        	;
185
 2746                        	; entry
186
 2747                        	; 	lpStr	= long pointer to string
187
  Tue Jul 17 11:00:16 2018                                                                                               Page    4
188
 
189
 
190
 
191
 
192
 2748                        	;	bSiz	= size of integer (1,2,3,4,8) - size=3 valid for hex only
193
 2749                        	;	bFlag	= <7>: wanted signed integer
194
 2750                        	;		  <6>: default to decimal string (autodetect '$' for hex)
195
 2751                        	;	lpRes	= long pointer to dest. buffer to store result
196
 2752                        	;
197
 2753                        	; exit
198
 2754                        	;	C,X	= long pointer to first invalid char. (not digit)
199
 2755                        	;	Y	= <7>: sign of result (only if bit 6 is set)
200
 2756                        	;		  <6>: set if result is signed integer
201
 2757                        	;
202
 2758                        	;	P:	= CF & VF flag's report any error condition
203
 2759                        	;		  CF = 0 & VF = 0 -> no error
204
 2760                        	;		  CF = 0 & VF = 1 -> mismatch type (signed/unsigned)
205
 2761                        	;		  CF = 1 & VF = 0 -> no conversion (invalid string)
206
 2762                        	;		  CF = 1 & VF = 1 -> overflow error
207
 2763                        	;
208
 2764                        	;
209
 2765          000008        	M	.SET	8	; param's bytes count
210
 2766          00000D        	N	.SET	13	; bytes pushed on stack after param's
211
 2767          00000E        	lpRes	.SET	N+1
212
 2768          000011        	bFlag	.SET	N+4
213
 2769          000012        	bSiz	.SET	N+5
214
 2770          000013        	lpStr	.SET	N+6
215
 2771          000001        	CReg	.SET	1
216
 2772          000003        	YReg	.SET	3
217
 2773          000005        	XReg	.SET	5
218
 2774          00000A        	PReg	.SET	10
219
 2775
220
 2776                        	;----------------------
221
 2777  F827BB                	_lstrtoint:
222
 2778                        		.PUBLIC _lstrtoint
223
 2779                        	;----------------------
224
 2780
225
 2781                        		.LONGA	off
226
 2782                        		.LONGI	off
227
 2783
228
 2784  F827BB  08            		php			; save register's size and CF&VF exit value's
229
 2785  F827BC  8B            		phb			; save dbr
230
 2786  F827BD  0B            		phd			; save dpr
231
 2787  F827BE                		CPU16
232
 2788  F827BE  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
233
 2789                        		.LONGA	on
234
 2790                        		.LONGI	on
235
 2791                        		.MNLIST
236
 2792  F827C0  DA            		phx			; X exit value
237
 2793  F827C1  5A            		phy			; Y exit value
238
 2794  F827C2  48            		pha			; C exit value
239
 2795  F827C3  A9 00 02      		lda	#DP02ADDR	; set working dpr
240
 2796  F827C6  5B            		tcd
241
 2797  F827C7                		CPU08
242
 2798  F827C7  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
243
 2799                        		.LONGA	off
244
 2800                        		.LONGI	off
245
 2801                        		.MNLIST
246
 2802  F827C9  A3 0A         		lda	PReg,s
247
 2803  F827CB  29 BE         		and	#~(PCFLAG+PVFLAG)
248
 2804  F827CD  83 0A         		sta	PReg,s		; clear CF & VF
249
  Tue Jul 17 11:00:16 2018                                                                                               Page    5
250
 
251
 
252
 
253
 
254
 2805  F827CF  A3 12         		lda	bSiz,s
255
 2806  F827D1  85 24         		sta	FPTmp1		; integer size
256
 2807  F827D3  A3 11         		lda	bFlag,s
257
 2808  F827D5  85 25         		sta	FPTmp2		; conversion flag
258
 2809  F827D7  AA            		tax
259
 2810  F827D8  0A            		asl	a		; test bit 6
260
 2811  F827D9  10 30         		bpl	?20		; convert hex. string
261
 2812  F827DB  A3 15         		lda	lpStr+2,s
262
 2813  F827DD  48            		pha
263
 2814  F827DE  AB            		plb
264
 2815  F827DF  A0 00         		ldy	#0
265
 2816  F827E1  B3 13         		lda	(lpStr,s),y	; check first char
266
 2817  F827E3  C9 24         		cmp	#'$'		; hex. string?
267
 2818  F827E5  D0 0B         		bne	?10		; no
268
 2819  F827E7                		ACC16
269
 2820  F827E7  C2 20         		rep	#PMFLAG
270
 2821                        		.LONGA	on
271
 2822                        		.MNLIST
272
 2823  F827E9  A3 13         		lda	lpStr,s		; bump string pointer
273
 2824  F827EB  1A            		inc	a
274
 2825  F827EC  83 13         		sta	lpStr,s
275
 2826  F827EE                		ACC08
276
 2827  F827EE  E2 20         		sep	#PMFLAG
277
 2828                        		.LONGA	off
278
 2829                        		.MNLIST
279
 2830  F827F0  80 19         		bra	?20		; convert hex. string
280
 2831  F827F2  A4 24         	?10:	ldy	FPTmp1
281
 2832  F827F4  C0 03         		cpy	#3		; decimal conversion refuse pointer size
282
 2833  F827F6  F0 13         		beq	?20		; force hex.
283
 2834  F827F8  8A            	?15:	txa
284
 2835  F827F9  29 80         		and	#$80		; wanted signed flag
285
 2836  F827FB  05 24         		ora	FPTmp1		; add size
286
 2837  F827FD  AA            		tax
287
 2838  F827FE  A3 15         		lda	lpStr+2,s
288
 2839  F82800  A8            		tay
289
 2840  F82801  A3 14         		lda	lpStr+1,s
290
 2841  F82803  EB            		xba
291
 2842  F82804  A3 13         		lda	lpStr,s
292
 2843  F82806  20 C7 2E      		jsr	_Str2Int	; decimal string
293
 2844  F82809  80 0D         		bra	?25
294
 2845  F8280B  A6 24         	?20:	ldx	FPTmp1
295
 2846  F8280D  A3 15         		lda	lpStr+2,s
296
 2847  F8280F  A8            		tay
297
 2848  F82810  A3 14         		lda	lpStr+1,s
298
 2849  F82812  EB            		xba
299
 2850  F82813  A3 13         		lda	lpStr,s
300
 2851  F82815  20 7E 2F      		jsr	_Str2Hex	; hex string
301
 2852  F82818  A3 0A         	?25:	lda	PReg,s		; set status result
302
 2853  F8281A  90 02         		bcc	?26		; no error
303
 2854  F8281C  09 01         		ora	#PCFLAG		; set CF on exit status
304
 2855  F8281E  50 02         	?26:	bvc	?27
305
 2856  F82820  09 40         		ora	#PVFLAG		; set VF on exit status
306
 2857  F82822  83 0A         	?27:	sta	PReg,s
307
 2858  F82824  AA            		tax
308
 2859  F82825                		ACC16CLC
309
 2860  F82825  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
310
 2861                        		.LONGA	on
311
  Tue Jul 17 11:00:16 2018                                                                                               Page    6
312
 
313
 
314
 
315
 
316
 2862                        		.MNLIST
317
 2863  F82827  98            		tya			; remainder string ptr
318
 2864  F82828  63 13         		adc	lpStr,s
319
 2865  F8282A  83 01         		sta	CReg,s
320
 2866  F8282C                		ACC08
321
 2867  F8282C  E2 20         		sep	#PMFLAG
322
 2868                        		.LONGA	off
323
 2869                        		.MNLIST
324
 2870  F8282E  A3 15         		lda	lpStr+2,s
325
 2871  F82830  90 01         		bcc	?28
326
 2872  F82832  1A            		inc	a
327
 2873  F82833  83 05         	?28:	sta	XReg,s
328
 2874  F82835  A9 00         		lda	#0
329
 2875  F82837  83 06         		sta	XReg+1,s
330
 2876  F82839  83 04         		sta	YReg+1,s
331
 2877  F8283B  A5 21         		lda	ACMSgn
332
 2878  F8283D  83 03         		sta	YReg,s
333
 2879  F8283F  8A            		txa			; status
334
 2880  F82840  4A            		lsr	a		; CF check
335
 2881  F82841  B0 15         		bcs	?40		; error, so no store result
336
 2882  F82843  A3 12         		lda	bSiz,s
337
 2883  F82845  85 24         		sta	FPTmp1		; size
338
 2884  F82847  A3 10         		lda	lpRes+2,s
339
 2885  F82849  48            		pha
340
 2886  F8284A  AB            		plb
341
 2887  F8284B  A0 00         		ldy	#0
342
 2888  F8284D  BB            		tyx
343
 2889  F8284E  B5 18         	?30:	lda	ACM,x
344
 2890  F82850  93 0E         		sta	(lpRes,s),y
345
 2891  F82852  C8            		iny
346
 2892  F82853  E8            		inx
347
 2893  F82854  E4 24         		cpx	FPTmp1
348
 2894  F82856  90 F6         		bcc	?30
349
 2895  F82858                	?40:	CPU16CLC
350
 2896  F82858  C2 31         		rep	#(PMFLAG.OR.PXFLAG.OR.PCFLAG)
351
 2897                        		.LONGA	on
352
 2898                        		.LONGI	on
353
 2899                        		.MNLIST
354
 2900  F8285A  3B            		tsc			; epilogue code
355
 2901  F8285B  69 0D 00      		adc	#N
356
 2902  F8285E  AA            		tax			; source address for move
357
 2903  F8285F  69 08 00      		adc	#M
358
 2904  F82862  A8            		tay			; destination address for move
359
 2905  F82863  A9 0C 00      		lda	#N-1		; bytes to move - 1
360
 2906  F82866  44 00 00      		mvp	#0, #0		; move previous
361
 2907  F82869  98            		tya			; new stack pointer
362
 2908  F8286A  1B            		tcs
363
 2909  F8286B  68            		pla			; return C
364
 2910  F8286C  7A            		ply			; return Y
365
 2911  F8286D  FA            		plx			; return X
366
 2912  F8286E  2B            		pld			; restore dpr
367
 2913  F8286F  AB            		plb			; restore dbr
368
 2914  F82870  28            		plp			; restore status
369
 2915  F82871  6B            		rtl
370
 2916
371
 2917                        	;----------------------------------------------------------
372
 2918                        	; estensione segno accumulatori
373
  Tue Jul 17 11:00:16 2018                                                                                               Page    7
374
 
375
 
376
 
377
 
378
 2919                        	;----------------------------------------------------------
379
 2920
380
 2921                        	; _iCWD16 - estende ACM a WORD
381
 2922  F82872                	_iCWD16:
382
 2923  F82872  A6 20         		ldx	ACMSize
383
 2924  F82874  E0 02 00      		cpx	#$02		; ACM WORD ?
384
 2925  F82877  B0 13         		bcs	?06		; si -- non deve estendere
385
 2926  F82879  A0 00 00      		ldy	#0
386
 2927  F8287C  24 21         		bit	ACMSgn
387
 2928  F8287E  50 07         		bvc	?04		; unsigned => estende con 00
388
 2929  F82880  CA            		dex			; indice MSB BYTE
389
 2930  F82881  34 18         		bit	ACM,x
390
 2931  F82883  10 01         		bpl	?02		; signed positivo => estende con 00
391
 2932  F82885  88            		dey			; signed negativo => estende con FF
392
 2933  F82886  E8            	?02:	inx			; indice MSB WORD
393
 2934  F82887  94 18         	?04:	sty	ACM,x
394
 2935  F82889  E8            		inx			; size = 2 (WORD)
395
 2936  F8288A  86 20         		stx	ACMSize		; update size
396
 2937  F8288C  60            	?06:	rts
397
 2938
398
 2939                        	; _iCWD32 - estende ACM a LONG
399
 2940  F8288D                	_iCWD32:
400
 2941  F8288D  20 72 28      		jsr	_iCWD16		; assicura ACM esteso a WORD
401
 2942  F82890  A6 20         		ldx	ACMSize
402
 2943  F82892  E0 04 00      		cpx	#$04		; ACM LONG ?
403
 2944  F82895  B0 18         		bcs	?06		; si -- non deve estendere
404
 2945  F82897  A0 00 00      		ldy	#0
405
 2946  F8289A                		INDEX16
406
 2947  F8289A  C2 10         		rep	#PXFLAG
407
 2948                        		.LONGI	on
408
 2949                        		.MNLIST
409
 2950  F8289C  24 21         		bit	ACMSgn
410
 2951  F8289E  50 07         		bvc	?04		; unsigned => estende con 0000
411
 2952  F828A0  CA            		dex			; indice MSB WORD
412
 2953  F828A1  34 18         		bit	ACM,x
413
 2954  F828A3  10 01         		bpl	?02		; signed positivo => estende con 0000
414
 2955  F828A5  88            		dey			; signed negativo => estende con FFFF
415
 2956  F828A6  E8            	?02:	inx			; indice MSB LONG
416
 2957  F828A7  94 18         	?04:	sty	ACM,x		; estende
417
 2958  F828A9                		INDEX08
418
 2959  F828A9  E2 10         		sep	#PXFLAG
419
 2960                        		.LONGI	off
420
 2961                        		.MNLIST
421
 2962  F828AB  E8            		inx
422
 2963  F828AC  E8            		inx			; size = 4 (LONG)
423
 2964  F828AD  86 20         		stx	ACMSize		; update size
424
 2965  F828AF  60            	?06:	rts
425
 2966
426
 2967                        	; _iCWD64 - estende ACM a QUAD
427
 2968  F828B0                	_iCWD64:
428
 2969  F828B0  20 8D 28      		jsr	_iCWD32		; assicura ACM esteso a LONG
429
 2970  F828B3  A6 20         		ldx	ACMSize
430
 2971  F828B5  E0 08         		cpx	#$08		; ACM QUAD ?
431
 2972  F828B7  B0 19         		bcs	?06		; si -- non deve estendere
432
 2973  F828B9  A0 00         		ldy	#0
433
 2974  F828BB                		INDEX16
434
 2975  F828BB  C2 10         		rep	#PXFLAG
435
  Tue Jul 17 11:00:16 2018                                                                                               Page    8
436
 
437
 
438
 
439
 
440
 2976                        		.LONGI	on
441
 2977                        		.MNLIST
442
 2978  F828BD  24 21         		bit	ACMSgn
443
 2979  F828BF  50 07         		bvc	?04		; unsigned => estende con 0000
444
 2980  F828C1  CA            		dex			; indice MSB LONG
445
 2981  F828C2  34 18         		bit	ACM,x
446
 2982  F828C4  10 01         		bpl	?02		; signed positivo => estende con 0000
447
 2983  F828C6  88            		dey			; signed negativo => estende con FFFF
448
 2984  F828C7  E8            	?02:	inx			; indice MSB QUAD
449
 2985  F828C8  94 18         	?04:	sty	ACM,x		; estende
450
 2986  F828CA  94 1A         		sty	ACM+2,x
451
 2987  F828CC                		INDEX08
452
 2988  F828CC  E2 10         		sep	#PXFLAG
453
 2989                        		.LONGI	off
454
 2990                        		.MNLIST
455
 2991  F828CE  A2 08         		ldx	#$08		; size = 8 (QUAD)
456
 2992  F828D0  86 20         		stx	ACMSize		; update size
457
 2993  F828D2  60            	?06:	rts
458
 2994
459
 2995                        	; _iCWDARG16 - estende IARG a WORD
460
 2996  F828D3                	_iCWDARG16:
461
 2997  F828D3  A6 30         		ldx	IARGSize
462
 2998  F828D5  E0 02         		cpx	#$02		; IARG WORD ?
463
 2999  F828D7  B0 12         		bcs	?06		; si -- non deve estendere
464
 3000  F828D9  A0 00         		ldy	#0
465
 3001  F828DB  24 31         		bit	IARGSgn
466
 3002  F828DD  50 07         		bvc	?04		; unsigned => estende con 00
467
 3003  F828DF  CA            		dex			; indice MSB BYTE
468
 3004  F828E0  34 28         		bit	IARG,x
469
 3005  F828E2  10 01         		bpl	?02		; signed positivo => estende con 00
470
 3006  F828E4  88            		dey			; signed negativo => estende con FF
471
 3007  F828E5  E8            	?02:	inx			; indice MSB WORD
472
 3008  F828E6  94 28         	?04:	sty	IARG,x
473
 3009  F828E8  E8            		inx			; size = 2 (WORD)
474
 3010  F828E9  86 30         		stx	IARGSize	; update size
475
 3011  F828EB  60            	?06:	rts
476
 3012
477
 3013                        	; _iCWDARG32 - estende IARG a LONG
478
 3014  F828EC                	_iCWDARG32:
479
 3015  F828EC  20 D3 28      		jsr	_iCWDARG16	; assicura IARG esteso a WORD
480
 3016  F828EF  A6 30         		ldx	IARGSize
481
 3017  F828F1  E0 04         		cpx	#$04		; IARG LONG ?
482
 3018  F828F3  B0 17         		bcs	?06		; si -- non deve estendere
483
 3019  F828F5  A0 00         		ldy	#0
484
 3020  F828F7                		INDEX16
485
 3021  F828F7  C2 10         		rep	#PXFLAG
486
 3022                        		.LONGI	on
487
 3023                        		.MNLIST
488
 3024  F828F9  24 31         		bit	IARGSgn
489
 3025  F828FB  50 07         		bvc	?04		; unsigned => estende con 0000
490
 3026  F828FD  CA            		dex			; indice MSB WORD
491
 3027  F828FE  34 28         		bit	IARG,x
492
 3028  F82900  10 01         		bpl	?02		; signed positivo => estende con 0000
493
 3029  F82902  88            		dey			; signed negativo => estende con FFFF
494
 3030  F82903  E8            	?02:	inx			; indice MSB LONG
495
 3031  F82904  94 28         	?04:	sty	IARG,x		; estende
496
 3032  F82906                		INDEX08
497
  Tue Jul 17 11:00:16 2018                                                                                               Page    9
498
 
499
 
500
 
501
 
502
 3033  F82906  E2 10         		sep	#PXFLAG
503
 3034                        		.LONGI	off
504
 3035                        		.MNLIST
505
 3036  F82908  E8            		inx
506
 3037  F82909  E8            		inx			; size = 4 (LONG)
507
 3038  F8290A  86 30         		stx	IARGSize	; update size
508
 3039  F8290C  60            	?06:	rts
509
 3040
510
 3041                        	; _iCWDARG64 - estende IARG a QUAD
511
 3042  F8290D                	_iCWDARG64:
512
 3043  F8290D  20 EC 28      		jsr	_iCWDARG32	; assicura IARG esteso a LONG
513
 3044  F82910  A6 30         		ldx	IARGSize
514
 3045  F82912  E0 08         		cpx	#$08		; IARG QUAD ?
515
 3046  F82914  B0 19         		bcs	?06		; si -- non deve estendere
516
 3047  F82916  A0 00         		ldy	#0
517
 3048  F82918                		INDEX16
518
 3049  F82918  C2 10         		rep	#PXFLAG
519
 3050                        		.LONGI	on
520
 3051                        		.MNLIST
521
 3052  F8291A  24 31         		bit	IARGSgn
522
 3053  F8291C  50 07         		bvc	?04		; unsigned => estende con 0000
523
 3054  F8291E  CA            		dex			; indice MSB LONG
524
 3055  F8291F  34 28         		bit	IARG,x
525
 3056  F82921  10 01         		bpl	?02		; signed positivo => estende con 0000
526
 3057  F82923  88            		dey			; signed negativo => estende con FFFF
527
 3058  F82924  E8            	?02:	inx			; indice MSB QUAD
528
 3059  F82925  94 28         	?04:	sty	IARG,x		; estende
529
 3060  F82927  94 2A         		sty	IARG+2,x
530
 3061  F82929                		INDEX08
531
 3062  F82929  E2 10         		sep	#PXFLAG
532
 3063                        		.LONGI	off
533
 3064                        		.MNLIST
534
 3065  F8292B  A2 08         		ldx	#$08		; size = 8 (QUAD)
535
 3066  F8292D  86 30         		stx	IARGSize	; update size
536
 3067  F8292F  60            	?06:	rts
537
 3068
538
 3069                        	; _iCWD2 - estensione segno operandi ACM e IARG
539
 3070  F82930                	_iCWD2:
540
 3071  F82930  A5 30         		lda	IARGSize
541
 3072  F82932  C5 20         		cmp	ACMSize
542
 3073  F82934  F0 20         		beq	?10		; no estensione
543
 3074  F82936  B0 02         		bcs	?02		; CF = 1 => estende ACM
544
 3075  F82938  A5 20         		lda	ACMSize
545
 3076  F8293A  08            	?02:	php			; salva CF
546
 3077  F8293B  A2 02         		ldx	#$02
547
 3078  F8293D  DF 5F 29 F8   	?04:	cmp	>CWDTBL,x	; X = indice CWD
548
 3079  F82941  F0 07         		beq	?06
549
 3080  F82943  CA            		dex
550
 3081  F82944  10 F7         		bpl	?04
551
 3082  F82946  28            		plp			; non dovrebbe accadere
552
 3083  F82947  B8            		clv			; VF = 0
553
 3084  F82948  38            		sec			; CF = 1
554
 3085  F82949  60            		rts
555
 3086  F8294A  8A            	?06:	txa
556
 3087  F8294B  0A            		asl	a
557
 3088  F8294C  28            		plp			; ripristina CF
558
 3089  F8294D  B0 03         		bcs	?08		; CF = 1 => CWD ACM
559
  Tue Jul 17 11:00:16 2018                                                                                               Page   10
560
 
561
 
562
 
563
 
564
 3090  F8294F  69 06 00      		adc	#$06		; CF = 0 => CWD IARG
565
 3091  F82952  AA            	?08:	tax			; indice funzione
566
 3092  F82953  FC 62 29      		jsr	(CWDJMP,x)	; estensione segno ACM/IARG
567
 3093  F82956  A5 20         	?10:	lda	ACMSize
568
 3094  F82958  45 30         		eor	IARGSize
569
 3095  F8295A  85 17         		sta	ACMCmps		; set flag compare segno (7) e tipo (6)
570
 3096  F8295C  B8            		clv
571
 3097  F8295D  18            		clc
572
 3098  F8295E  60            		rts
573
 3099  F8295F
574
 3100                        	; tabella per estensione segno
575
 3101  F8295F                	CWDTBL:
576
 3102  F8295F  02 04 08      		.DB	$02, $04, $08
577
 3103
578
 3104                        	; tabella funzioni CWD ACM
579
 3105  F82962                	CWDJMP:
580
 3106  F82962  7228 8D28 B028 		.DW	_iCWD16, _iCWD32, _iCWD64
581
 3107  F82968
582
 3108                        	; tabella funzioni CWD IARG
583
 3109  F82968                	CWDJMP2:
584
 3110  F82968  D328 EC28 0D29 		.DW	_iCWDARG16, _iCWDARG32, _iCWDARG64
585
 3111
586
 3112                        	;----------------------------------------------------------
587
 3113                        	; implementazione MULT unsigned integer
588
 3114                        	;----------------------------------------------------------
589
 3115
590
 3116                        	; _iUMult8: moltiplicazione integer 8 bit unsigned
591
 3117                        	; In:	ACM: unsigned integer 1
592
 3118                        	;	IARG: unsigned integer 2
593
 3119                        	; Out:	ACM..ACM+1 -> risultato integer unsigned (16 bit)
594
 3120                        	;	X = 0
595
 3121                        	;	Y = minima size
596
 3122                        	;	CF = 0
597
 3123                        	; Uso:	A,X,Y,ACM,IARG
598
 3124  F8296E                	_iUMult8:
599
 3125  F8296E  A9 00 00      		lda	#0		; azzera parte alta del risultato
600
 3126  F82971  A2 09         		LDX	#9		; ciclo 9 bit
601
 3127  F82973  18            		CLC
602
 3128  F82974  6A            	?01:	ror	a		; ACM + 1
603
 3129  F82975  66 18         		ROR	ACM
604
 3130  F82977  90 03         		BCC	?02
605
 3131  F82979  18            		CLC
606
 3132  F8297A  65 28         		adc	IARG
607
 3133  F8297C  CA            	?02:	DEX
608
 3134  F8297D  D0 F5         		BNE	?01
609
 3135  F8297F  85 19         		sta	ACM+1
610
 3136  F82981  A0 02         		ldy	#$02
611
 3137  F82983  84 20         		sty	ACMSize		; ACM WORD
612
 3138  F82985  09 00 00      		ora	#$00
613
 3139  F82988  D0 01         		bne	?03		; ACM+1 non ZERO
614
 3140  F8298A  88            		dey			; ACM+1 = 0 => min size = BYTE
615
 3141  F8298B  84 22         	?03:	sty	ACMMinSize
616
 3142  F8298D  18            		clc
617
 3143  F8298E  60            		RTS
618
 3144
619
 3145                        	; _iUMult16: moltiplicazione integer 16 bit unsigned
620
 3146                        	; In:	ACM, ACM+1: unsigned integer 1
621
  Tue Jul 17 11:00:16 2018                                                                                               Page   11
622
 
623
 
624
 
625
 
626
 3147                        	;	IARG, IARG+1: unsigned integer 2
627
 3148                        	; Out:	ACM..ACM+3 -> risultato integer unsigned (32 bit)
628
 3149                        	;	X = 0
629
 3150                        	;	Y = minima size
630
 3151                        	;	CF = 0
631
 3152                        	; Uso:	A,X,Y,ACM,IARG
632
 3153  F8298F                	_iUMult16:
633
 3154  F8298F                		ACC16
634
 3155  F8298F  C2 20         		rep	#PMFLAG
635
 3156                        		.LONGA	on
636
 3157                        		.MNLIST
637
 3158  F82991  A9 00 00      		lda	#0		; azzera parte alta del risultato
638
 3159  F82994  A2 11         		LDX	#17		; ciclo 17 bit
639
 3160  F82996  18            		CLC
640
 3161  F82997  6A            	?01:	ror	a		: ACM + 2
641
 3162  F82998  66 18         		ROR	ACM
642
 3163  F8299A  90 03         		BCC	?02
643
 3164  F8299C  18            		CLC
644
 3165  F8299D  65 28         		adc	IARG
645
 3166  F8299F  CA            	?02:	DEX
646
 3167  F829A0  D0 F5         		BNE	?01
647
 3168  F829A2  85 1A         		sta	ACM+2
648
 3169  F829A4  A0 04         		ldy	#$04
649
 3170  F829A6  84 20         		sty	ACMSize		; ACM LONG
650
 3171  F829A8  09 00 00      		ora	#$0000
651
 3172  F829AB  D0 02         		bne	?03		; WORD ACM+2 NON NULLA
652
 3173  F829AD  88            		dey
653
 3174  F829AE  88            		dey			; MIN SIZE = WORD
654
 3175  F829AF  84 22         	?03:	sty	ACMMinSize
655
 3176  F829B1                		ACC08
656
 3177  F829B1  E2 20         		sep	#PMFLAG
657
 3178                        		.LONGA	off
658
 3179                        		.MNLIST
659
 3180  F829B3  18            		clc
660
 3181  F829B4  60            		RTS
661
 3182
662
 3183                        	; _iUMult32: moltiplicazione integer 32 bit unsigned
663
 3184                        	; In:	ACM..ACM+3: unsigned integer 1
664
 3185                        	;	IARG..IARG+3: unsigned integer 2
665
 3186                        	; Out:	ACM..ACM+7 -> risultato integer unsigned (64 bit)
666
 3187                        	;	X = 0
667
 3188                        	;	Y = minima size
668
 3189                        	;	CF = 0
669
 3190                        	; Uso:	A,X,Y,ACM,IARG
670
 3191  F829B5                	_iUMult32:
671
 3192  F829B5                		ACC16
672
 3193  F829B5  C2 20         		rep	#PMFLAG
673
 3194                        		.LONGA	on
674
 3195                        		.MNLIST
675
 3196  F829B7  64 1C         		STZ	ACM+4		; azzera parte alta del risultato
676
 3197  F829B9  64 1E         		STZ	ACM+6
677
 3198  F829BB  A2 21         		LDX	#33		; ciclo 33 bit
678
 3199  F829BD  18            		CLC
679
 3200  F829BE  66 1E         	?01:	ROR	ACM+6
680
 3201  F829C0  66 1C         		ROR	ACM+4
681
 3202  F829C2  66 1A         		ROR	ACM+2
682
 3203  F829C4  66 18         		ROR	ACM
683
  Tue Jul 17 11:00:16 2018                                                                                               Page   12
684
 
685
 
686
 
687
 
688
 3204  F829C6  90 0D         		BCC	?02
689
 3205  F829C8  18            		CLC
690
 3206  F829C9  A5 28         		LDA	IARG
691
 3207  F829CB  65 1C         		ADC	ACM+4
692
 3208  F829CD  85 1C         		STA	ACM+4
693
 3209  F829CF  A5 2A         		LDA	IARG+2
694
 3210  F829D1  65 1E         		ADC	ACM+6
695
 3211  F829D3  85 1E         		STA	ACM+6
696
 3212  F829D5  CA            	?02:	DEX
697
 3213  F829D6  D0 E6         		BNE	?01
698
 3214  F829D8  A0 08         		ldy	#$08
699
 3215  F829DA  84 20         		sty	ACMSize		; ACM QUAD
700
 3216  F829DC  A5 1E         		lda	ACM+6
701
 3217  F829DE  05 1C         		ora	ACM+4
702
 3218  F829E0  D0 02         		bne	?03		; LONG ACM+4 NON ZERO
703
 3219  F829E2  A0 04         		ldy	#$04		; MIN SIZE = LONG
704
 3220  F829E4  84 22         	?03:	sty	ACMMinSize
705
 3221  F829E6                		ACC08
706
 3222  F829E6  E2 20         		sep	#PMFLAG
707
 3223                        		.LONGA	off
708
 3224                        		.MNLIST
709
 3225  F829E8  18            		clc
710
 3226  F829E9  60            		RTS
711
 3227
712
 3228                        	; _iUMult64: moltiplicazione integer 64 bit unsigned
713
 3229                        	; In:	ACM..ACM+7: unsigned integer 1
714
 3230                        	;	IARG..IARG+7: unsigned integer 2
715
 3231                        	; Out:	ACM..ACM+7 -> risultato integer unsigned (128 bit LOW)
716
 3232                        	; 	FOP..FOP+7 -> risultato integer unsigned (128 bit HIGH) (OVERFLOW)
717
 3233                        	;	X = 0
718
 3234                        	;	CF = 0 -> risultato OK
719
 3235                        	;	CF = 1 -> unsigned overflow
720
 3236                        	; Uso:	A,X,Y,ACM,IARG,FOP
721
 3237  F829EA                	_iUMult64:
722
 3238  F829EA  A0 08         		ldy	#$08
723
 3239  F829EC  84 22         		sty	ACMMinSize
724
 3240  F829EE  84 20         		sty	ACMSize
725
 3241  F829F0                		ACC16
726
 3242  F829F0  C2 20         		rep	#PMFLAG
727
 3243                        		.LONGA	on
728
 3244                        		.MNLIST
729
 3245  F829F2  64 32         		stz	FOP		; azzera parte alta del risultato a 128 bit
730
 3246  F829F4  64 34         		stz	FOP+2		; la parte bassa (64 bit) in ACM
731
 3247  F829F6  64 36         		stz	FOP+4
732
 3248  F829F8  64 38         		stz	FOP+6
733
 3249  F829FA  A2 41         		LDX	#65		; ciclo 65 bit
734
 3250  F829FC  18            		CLC
735
 3251  F829FD  66 38         	?01:	ROR	FOP+6
736
 3252  F829FF  66 36         		ROR	FOP+4
737
 3253  F82A01  66 34         		ROR	FOP+2
738
 3254  F82A03  66 32         		ROR	FOP
739
 3255  F82A05  66 1E         		ROR	ACM+6
740
 3256  F82A07  66 1C         		ROR	ACM+4
741
 3257  F82A09  66 1A         		ROR	ACM+2
742
 3258  F82A0B  66 18         		ROR	ACM
743
 3259  F82A0D  90 19         		BCC	?02
744
 3260  F82A0F  18            		CLC
745
  Tue Jul 17 11:00:16 2018                                                                                               Page   13
746
 
747
 
748
 
749
 
750
 3261  F82A10  A5 28         		LDA	IARG
751
 3262  F82A12  65 32         		ADC	FOP
752
 3263  F82A14  85 32         		STA	FOP
753
 3264  F82A16  A5 2A         		LDA	IARG+2
754
 3265  F82A18  65 34         		ADC	FOP+2
755
 3266  F82A1A  85 34         		STA	FOP+2
756
 3267  F82A1C  A5 2C         		LDA	IARG+4
757
 3268  F82A1E  65 36         		ADC	FOP+4
758
 3269  F82A20  85 36         		STA	FOP+4
759
 3270  F82A22  A5 2E         		LDA	IARG+6
760
 3271  F82A24  65 38         		ADC	FOP+6
761
 3272  F82A26  85 38         		STA	FOP+6
762
 3273  F82A28  CA            	?02:	DEX
763
 3274  F82A29  D0 D2         		BNE	?01
764
 3275  F82A2B  38            		sec			; flag overflow
765
 3276  F82A2C  A5 32         		lda	FOP		; test overflow
766
 3277  F82A2E  05 34         		ora	FOP+2
767
 3278  F82A30  05 36         		ora	FOP+4
768
 3279  F82A32  05 38         		ora	FOP+6
769
 3280  F82A34  D0 01         		bne	?04		; overflow -> CF = 1
770
 3281  F82A36  18            		clc
771
 3282  F82A37                	?04:	ACC08
772
 3283  F82A37  E2 20         		sep	#PMFLAG
773
 3284                        		.LONGA	off
774
 3285                        		.MNLIST
775
 3286  F82A39  60            		RTS
776
 3287
777
 3288                        	;----------------------------------------------------------
778
 3289                        	; 2's complement
779
 3290                        	;----------------------------------------------------------
780
 3291
781
 3292                        	; complento a 2 di IARG
782
 3293  F82A3A                	_iNegIARG
783
 3294  F82A3A  A2 28         		ldx	#IARG
784
 3295  F82A3C  80 02         		bra	_iNegX
785
 3296
786
 3297                        	; complento a 2 di ACM
787
 3298  F82A3E                	_iNegACM:
788
 3299  F82A3E  A2 18         		ldx	#ACM
789
 3300  F82A40
790
 3301                        	; complemento a 2 accumulatore X (ACM, IARG, FOP)
791
 3302  F82A40                	_iNegX:
792
 3303  F82A40  38            		sec
793
 3304  F82A41                	_iNegXnc:
794
 3305  F82A41  5A            		phy			; salva Y
795
 3306  F82A42  A0 00         		ldy	#0
796
 3307  F82A44                		ACC16
797
 3308  F82A44  C2 20         		rep	#PMFLAG
798
 3309                        		.LONGA	on
799
 3310                        		.MNLIST
800
 3311  F82A46  98            		tya			; A = 0
801
 3312  F82A47  F5 00         		sbc	<0,x
802
 3313  F82A49  95 00         		sta	<0,x
803
 3314  F82A4B  98            		tya
804
 3315  F82A4C  F5 02         		sbc	<2,x
805
 3316  F82A4E  95 02         		sta	<2,x
806
 3317  F82A50  98            		tya
807
  Tue Jul 17 11:00:16 2018                                                                                               Page   14
808
 
809
 
810
 
811
 
812
 3318  F82A51  F5 04         		sbc	<4,x
813
 3319  F82A53  95 04         		sta	<4,x
814
 3320  F82A55  98            		tya
815
 3321  F82A56  F5 06         		sbc	<6,x
816
 3322  F82A58  95 06         		sta	<6,x
817
 3323  F82A5A                		ACC08
818
 3324  F82A5A  E2 20         		sep	#PMFLAG
819
 3325                        		.LONGA	off
820
 3326                        		.MNLIST
821
 3327  F82A5C  7A            		ply
822
 3328  F82A5D  60            		rts
823
 3329  F82A5E
824
 3330                        	;----------------------------------------------------------
825
 3331                        	; implementazione SMULT signed integer
826
 3332                        	;----------------------------------------------------------
827
 3333
828
 3334                        	; _iSMult8: moltiplicazione integer 8 bit signed
829
 3335                        	; In:	ACM: signed integer 1
830
 3336                        	;	IARG: signed integer 2
831
 3337                        	; Out:	ACM..ACM+1 -> risultato integer signed (16 bit)
832
 3338                        	;	X = 0
833
 3339                        	;	CF = 0
834
 3340                        	; Uso:	A,X,Y,ACM,IARG
835
 3341  F82A5E                	_iSMult8:
836
 3342  F82A5E  A2 00         		ldx	#0
837
 3343  F82A60  A5 18         		LDA	ACM
838
 3344  F82A62  45 28         		EOR	IARG		; segno risultato
839
 3345  F82A64  29 80         		and	#$80		; bit 7 => segno
840
 3346  F82A66  09 40         		ora	#$40		; bit 6 => signed int
841
 3347  F82A68  85 21         		sta	ACMSgn		; salva segno
842
 3348  F82A6A  24 28         		BIT	IARG		; test segno IARG
843
 3349  F82A6C  10 06         		BPL	?01
844
 3350  F82A6E  38            		SEC			; complementa IARG
845
 3351  F82A6F  8A            		txa
846
 3352  F82A70  E5 28         		SBC	IARG
847
 3353  F82A72  85 28         		STA	IARG
848
 3354  F82A74  24 18         	?01:	BIT	ACM		; test segno ACM
849
 3355  F82A76  10 06         		BPL	?02
850
 3356  F82A78  38            		SEC			; complementa ACM
851
 3357  F82A79  8A            		txa
852
 3358  F82A7A  E5 18         		SBC	ACM
853
 3359  F82A7C  85 18         		STA	ACM
854
 3360  F82A7E  20 6E 29      	?02:	JSR	_iUMult8	; moltiplicazione unsigned (X = 0)
855
 3361  F82A81  C0 02         		cpy	#$02		; min size WORD ?
856
 3362  F82A83  F0 0D         		beq	?02b		; si
857
 3363                        		; se ACM <= 7F allora min size = BYTE
858
 3364  F82A85  A5 18         		lda	ACM
859
 3365  F82A87  C9 80         		cmp	#$80
860
 3366  F82A89  90 07         		bcc	?02b
861
 3367  F82A8B  D0 04         		bne	?02a		; ACM > 80 => WORD
862
 3368                        		; ACM = 80 -- se risultato negativo => BYTE
863
 3369  F82A8D  24 21         		bit	ACMSgn
864
 3370  F82A8F  30 05         		bmi	?02c		; ACM BYTE negativo
865
 3371  F82A91  C8            	?02a:	iny			; ACM WORD
866
 3372  F82A92  24 21         	?02b:	bit	ACMSgn		; Flag N = segno risultato
867
 3373  F82A94  10 0A         		BPL	?03		; risultato positivo
868
 3374  F82A96                	?02c:	ACC16
869
  Tue Jul 17 11:00:16 2018                                                                                               Page   15
870
 
871
 
872
 
873
 
874
 3375  F82A96  C2 20         		rep	#PMFLAG
875
 3376                        		.LONGA	on
876
 3377                        		.MNLIST
877
 3378  F82A98  8A            		txa
878
 3379  F82A99  38            		sec			; risultato negativo: complementa ACM
879
 3380  F82A9A  E5 18         		sbc	ACM
880
 3381  F82A9C  85 18         		sta	ACM
881
 3382  F82A9E                		ACC08
882
 3383  F82A9E  E2 20         		sep	#PMFLAG
883
 3384                        		.LONGA	off
884
 3385                        		.MNLIST
885
 3386  F82AA0  84 22         	?03:	sty	ACMMinSize
886
 3387  F82AA2  18            		clc
887
 3388  F82AA3  60            		RTS
888
 3389  F82AA4
889
 3390                        	; _iSMult16: moltiplicazione integer 16 bit signed
890
 3391                        	; In:	ACM, ACM+1: signed integer 1
891
 3392                        	;	IARG, IARG+1: signed integer 2
892
 3393                        	; Out:	ACM..ACM+3 -> risultato integer signed (32 bit)
893
 3394                        	;	X = 0
894
 3395                        	;	CF = 0
895
 3396                        	; Uso:	A,X,Y,ACM,IARG
896
 3397  F82AA4                	_iSMult16:
897
 3398  F82AA4  A2 00         		ldx	#0
898
 3399  F82AA6  A5 19         		LDA	ACM+1
899
 3400  F82AA8  45 29         		EOR	IARG+1		; segno risultato
900
 3401  F82AAA  29 80         		and	#$80		; bit 7 => segno
901
 3402  F82AAC  09 40         		ora	#$40		; bit 6 => signed int
902
 3403  F82AAE  85 21         		sta	ACMSgn		; salva segno
903
 3404  F82AB0                		ACC16
904
 3405  F82AB0  C2 20         		rep	#PMFLAG
905
 3406                        		.LONGA	on
906
 3407                        		.MNLIST
907
 3408  F82AB2  24 28         		BIT	IARG		; test segno IARG
908
 3409  F82AB4  10 06         		BPL	?01
909
 3410  F82AB6  38            		sec			; complementa IARG
910
 3411  F82AB7  8A            		txa
911
 3412  F82AB8  E5 28         		sbc	IARG
912
 3413  F82ABA  85 28         		sta	IARG
913
 3414  F82ABC  24 18         	?01:	BIT	ACM		; test segno ACM
914
 3415  F82ABE  10 06         		BPL	?02
915
 3416  F82AC0  38            		sec			; complementa ACM
916
 3417  F82AC1  8A            		txa
917
 3418  F82AC2  E5 18         		sbc	ACM
918
 3419  F82AC4  85 18         		sta	ACM
919
 3420  F82AC6                	?02:	ACC08
920
 3421  F82AC6  E2 20         		sep	#PMFLAG
921
 3422                        		.LONGA	off
922
 3423                        		.MNLIST
923
 3424  F82AC8  20 8F 29      		JSR	_iUMult16	; moltiplicazione unsigned (X = 0)
924
 3425  F82ACB  C0 04         		cpy	#$04		; min size LONG ?
925
 3426  F82ACD  F0 13         		beq	?02b		; si
926
 3427                        		; se ACM <= 7FFF allora min size = WORD
927
 3428  F82ACF                		ACC16
928
 3429  F82ACF  C2 20         		rep	#PMFLAG
929
 3430                        		.LONGA	on
930
 3431                        		.MNLIST
931
  Tue Jul 17 11:00:16 2018                                                                                               Page   16
932
 
933
 
934
 
935
 
936
 3432  F82AD1  A5 18         		lda	ACM
937
 3433  F82AD3  C9 00 80      		cmp	#$8000
938
 3434  F82AD6                		ACC08
939
 3435  F82AD6  E2 20         		sep	#PMFLAG
940
 3436                        		.LONGA	off
941
 3437                        		.MNLIST
942
 3438  F82AD8  90 08         		bcc	?02b		; ACM < 8000 => WORD
943
 3439  F82ADA  D0 04         		bne	?02a		; ACM > 8000 => LONG
944
 3440                        		; ACM = 8000 -- se risultato negativo => WORD
945
 3441  F82ADC  24 21         		bit	ACMSgn
946
 3442  F82ADE  30 06         		bmi	?02c		; ACM WORD negativo
947
 3443  F82AE0  C8            	?02a:	iny			; ACM LONG
948
 3444  F82AE1  C8            		iny
949
 3445  F82AE2  24 21         	?02b:	bit	ACMSgn		; Flag N = segno risultato
950
 3446  F82AE4  10 0F         		BPL	?03		; risultato positivo
951
 3447  F82AE6                	?02c:	ACC16
952
 3448  F82AE6  C2 20         		rep	#PMFLAG
953
 3449                        		.LONGA	on
954
 3450                        		.MNLIST
955
 3451  F82AE8  8A            		txa
956
 3452  F82AE9  38            		sec			; risultato negativo: complementa ACM
957
 3453  F82AEA  E5 18         		sbc	ACM
958
 3454  F82AEC  85 18         		sta	ACM
959
 3455  F82AEE  8A            		TXA			; A = 0
960
 3456  F82AEF  E5 1A         		sbc	ACM+2
961
 3457  F82AF1  85 1A         		sta	ACM+2
962
 3458  F82AF3                		ACC08
963
 3459  F82AF3  E2 20         		sep	#PMFLAG
964
 3460                        		.LONGA	off
965
 3461                        		.MNLIST
966
 3462  F82AF5  84 22         	?03:	sty	ACMMinSize
967
 3463  F82AF7  18            		clc
968
 3464  F82AF8  60            		RTS
969
 3465
970
 3466                        	; _iSMult32: moltiplicazione integer 32 bit signed
971
 3467                        	; In:	ACM..ACM+3: signed integer 1
972
 3468                        	;	IARG..IARG+3: signed integer 2
973
 3469                        	; Out:	ACM..ACM+7 -> risultato integer signed (64 bit)
974
 3470                        	;	X = 0
975
 3471                        	;	CF = 0
976
 3472                        	; Uso:	A,X,Y,ACM,IARG
977
 3473  F82AF9                	_iSMult32:
978
 3474  F82AF9  A2 00         		ldx	#0
979
 3475  F82AFB  A5 1B         		LDA	ACM+3
980
 3476  F82AFD  45 2B         		EOR	IARG+3		; segno risultato
981
 3477  F82AFF  29 80         		and	#$80		; bit 7 => segno
982
 3478  F82B01  09 40         		ora	#$40		; bit 6 => signed int
983
 3479  F82B03  85 21         		sta	ACMSgn		; salva segno
984
 3480  F82B05                		ACC16
985
 3481  F82B05  C2 20         		rep	#PMFLAG
986
 3482                        		.LONGA	on
987
 3483                        		.MNLIST
988
 3484  F82B07  24 2A         		BIT	IARG+2		; test segno IARG
989
 3485  F82B09  10 0B         		BPL	?01
990
 3486  F82B0B  38            		sec			; complementa IARG
991
 3487  F82B0C  8A            		txa
992
 3488  F82B0D  E5 28         		sbc	IARG
993
  Tue Jul 17 11:00:16 2018                                                                                               Page   17
994
 
995
 
996
 
997
 
998
 3489  F82B0F  85 28         		sta	IARG
999
 3490  F82B11  8A            		txa
1000
 3491  F82B12  E5 2A         		sbc	IARG+2
1001
 3492  F82B14  85 2A         		sta	IARG+2
1002
 3493  F82B16  24 1A         	?01:	BIT	ACM+2		; test segno ACM
1003
 3494  F82B18  10 0B         		BPL	?02
1004
 3495  F82B1A  38            		sec			; complementa ACM
1005
 3496  F82B1B  8A            		txa
1006
 3497  F82B1C  E5 18         		sbc	ACM
1007
 3498  F82B1E  85 18         		sta	ACM
1008
 3499  F82B20  8A            		txa
1009
 3500  F82B21  E5 1A         		sbc	ACM+2
1010
 3501  F82B23  85 1A         		sta	ACM+2
1011
 3502  F82B25                	?02:	ACC08
1012
 3503  F82B25  E2 20         		sep	#PMFLAG
1013
 3504                        		.LONGA	off
1014
 3505                        		.MNLIST
1015
 3506  F82B27  20 B5 29      		JSR	_iUMult32	; moltiplicazione unsigned
1016
 3507  F82B2A  C0 08         		cpy	#$08		; min size QUAD ?
1017
 3508  F82B2C  F0 1B         		beq	?02b		; si
1018
 3509                        		; se ACM <= 7FFFFFFF allora min size = LONG
1019
 3510  F82B2E                		ACC16
1020
 3511  F82B2E  C2 20         		rep	#PMFLAG
1021
 3512                        		.LONGA	on
1022
 3513                        		.MNLIST
1023
 3514  F82B30  A5 1A         		lda	ACM+2
1024
 3515  F82B32  C9 00 80      		cmp	#$8000
1025
 3516  F82B35                		ACC08
1026
 3517  F82B35  E2 20         		sep	#PMFLAG
1027
 3518                        		.LONGA	off
1028
 3519                        		.MNLIST
1029
 3520  F82B37  90 10         		bcc	?02b		; ACM < 80000000 => LONG
1030
 3521  F82B39  D0 0C         		bne	?02a		; ACM > 80000000 => QUAD
1031
 3522  F82B3B                		ACC16
1032
 3523  F82B3B  C2 20         		rep	#PMFLAG
1033
 3524                        		.LONGA	on
1034
 3525                        		.MNLIST
1035
 3526  F82B3D  A5 18         		lda	ACM
1036
 3527                        		;cmp	#$0000
1037
 3528  F82B3F                		ACC08
1038
 3529  F82B3F  E2 20         		sep	#PMFLAG
1039
 3530                        		.LONGA	off
1040
 3531                        		.MNLIST
1041
 3532  F82B41  D0 04         		bne	?02a		; ACM > 80000000 => QUAD
1042
 3533                        		; ACM = 80000000 -- se risultato negativo => LONG
1043
 3534  F82B43  24 21         		bit	ACMSgn
1044
 3535  F82B45  30 06         		bmi	?02c		; ACM LONG negativo
1045
 3536  F82B47  A0 08         	?02a:	ldy	#$08		; ACM QUAD
1046
 3537  F82B49  24 21         	?02b:	bit	ACMSgn		; Flag N = segno risultato
1047
 3538  F82B4B  10 05         		BPL	?03		; risultato positivo
1048
 3539  F82B4D  20 3E 2A      	?02c:	JSR	_iNegACM	; risultato negativo: complementa ACM
1049
 3540  F82B50  A2 00         		ldx	#0		; X = 0
1050
 3541  F82B52  84 22         	?03:	sty	ACMMinSize
1051
 3542  F82B54  18            		clc
1052
 3543  F82B55  60            		rts
1053
 3544  F82B56
1054
 3545                        	; _iSMult64: moltiplicazione integer 64 bit signed
1055
  Tue Jul 17 11:00:16 2018                                                                                               Page   18
1056
 
1057
 
1058
 
1059
 
1060
 3546                        	; In:	ACM..ACM+7: signed integer 1
1061
 3547                        	;	IARG..IARG+7: signed integer 2
1062
 3548                        	; Out:	ACM..ACM+7 -> risultato integer signed (128 bit LOW)
1063
 3549                        	;	FOP..FOP+7 -> risultato integer signed (128 bit HIGH)
1064
 3550                        	;
1065
 3551                        	;	CF = 0 -> risultato OK
1066
 3552                        	;	CF = 1 -> signed overflow
1067
 3553                        	; Uso:	A,X,Y,ACM,IARG,FOP
1068
 3554  F82B56                	_iSMult64:
1069
 3555  F82B56  A5 1F         		LDA	ACM+7
1070
 3556  F82B58  45 2F         		EOR	IARG+7		; segno risultato
1071
 3557  F82B5A  29 80         		and	#$80		; bit 7 => segno
1072
 3558  F82B5C  09 40         		ora	#$40		; bit 6 => signed int
1073
 3559  F82B5E  85 21         		sta	ACMSgn		; salva segno
1074
 3560  F82B60  24 2F         		BIT	IARG+7		; test segno IARG
1075
 3561  F82B62  10 03         		BPL	?01
1076
 3562  F82B64  20 3A 2A      		JSR	_iNegIARG	; complementa IARG
1077
 3563  F82B67  24 1F         	?01:	BIT	ACM+7		; test segno ACM
1078
 3564  F82B69  10 03         		BPL	?02
1079
 3565  F82B6B  20 3E 2A      		JSR	_iNegACM	; complementa ACM
1080
 3566  F82B6E  20 EA 29      	?02:	JSR	_iUMult64	; moltiplicazione unsigned
1081
 3567  F82B71  B0 1A         		bcs	?10		; overflow (risultato a 128 bit)
1082
 3568                        		; risultato in 64 bit -- se MSB = 0 risultato ok -- qui CF = 0
1083
 3569  F82B73                		ACC16
1084
 3570  F82B73  C2 20         		rep	#PMFLAG
1085
 3571                        		.LONGA	on
1086
 3572                        		.MNLIST
1087
 3573  F82B75  A5 1E         		lda	ACM+6
1088
 3574  F82B77  10 12         		bpl	?08		; OK -- CF = 0
1089
 3575  F82B79  C9 00 80      		cmp	#$8000		; qui imposta CF = 1
1090
 3576  F82B7C  D0 0D         		bne	?08		; ACM > 8000000000000000 => overflow
1091
 3577  F82B7E  A6 21         		ldx	ACMSgn
1092
 3578  F82B80  10 09         		bpl	?08		; positivo => overflow
1093
 3579  F82B82  A5 1C         		lda	ACM+4
1094
 3580  F82B84  05 1A         		ora	ACM+2
1095
 3581  F82B86  05 18         		ora	ACM+0
1096
 3582  F82B88  D0 01         		bne	?08		; ACM > 8000000000000000 => overflow
1097
 3583                        		; ACM = 8000000000000000 negativo => OK
1098
 3584  F82B8A  18            		clc
1099
 3585  F82B8B                	?08:	ACC08
1100
 3586  F82B8B  E2 20         		sep	#PMFLAG
1101
 3587                        		.LONGA	off
1102
 3588                        		.MNLIST
1103
 3589  F82B8D  24 21         	?10:	bit	ACMSgn
1104
 3590  F82B8F  10 0A         		bpl	?12
1105
 3591  F82B91  08            		php			; salva CF
1106
 3592  F82B92  20 3E 2A      		jsr	_iNegACM	; complementa
1107
 3593  F82B95  A2 32         		ldx	#FOP
1108
 3594  F82B97  20 41 2A      		jsr	_iNegXnc
1109
 3595  F82B9A  28            		plp
1110
 3596  F82B9B  60            	?12:	rts
1111
 3597
1112
 3598                        	;----------------------------------------------------------
1113
 3599                        	; implementazione DIV unsigned integer
1114
 3600                        	;----------------------------------------------------------
1115
 3601
1116
 3602                        	; _iUDiv8: divisione integer 8 bit unsigned
1117
  Tue Jul 17 11:00:16 2018                                                                                               Page   19
1118
 
1119
 
1120
 
1121
 
1122
 3603                        	; In:	ACM: unsigned integer 1
1123
 3604                        	;	IARG: unsigned integer 2
1124
 3605                        	; Out:	ACM  -> integer unsigned ACM / IARG
1125
 3606                        	;	IARG -> integer unsigned ACM MOD IARG
1126
 3607                        	;	X = minima size quoziente
1127
 3608                        	;	Y = minima size remainder
1128
 3609                        	;	CF = 1 se IARG = 0 altrimenti CF = 0
1129
 3610                        	; Uso:	A,X,Y,ACM,IARG,FOP
1130
 3611  F82B9C                	_iUDiv8:
1131
 3612  F82B9C  A5 28         		lda	IARG
1132
 3613  F82B9E  D0 02         		bne	?02
1133
 3614  F82BA0  38            		sec			; division by sero
1134
 3615  F82BA1  60            		rts
1135
 3616  F82BA2  64 32         	?02:	stz	FOP		; azzera rem
1136
 3617  F82BA4  A2 08         		ldx	#8		; loop 8 bit
1137
 3618  F82BA6  A5 18         		lda	ACM		; quoziente
1138
 3619  F82BA8  2A            	?04:	rol	a
1139
 3620  F82BA9  26 32         		rol	FOP
1140
 3621  F82BAB  A8            		tay
1141
 3622  F82BAC  38            		sec
1142
 3623  F82BAD  A5 32         		lda	FOP
1143
 3624  F82BAF  E5 28         		sbc	IARG
1144
 3625  F82BB1  90 02         		bcc	?06
1145
 3626  F82BB3  85 32         		sta	FOP
1146
 3627  F82BB5  98            	?06:	tya
1147
 3628  F82BB6  CA            		dex
1148
 3629  F82BB7  D0 EF         		bne	?04
1149
 3630  F82BB9  2A            		rol	a
1150
 3631  F82BBA  85 18         		sta	ACM		; quot
1151
 3632  F82BBC  A5 32         		lda	FOP
1152
 3633  F82BBE  85 28         		sta	IARG
1153
 3634  F82BC0  A0 01         		ldy	#1
1154
 3635  F82BC2  BB            		tyx
1155
 3636  F82BC3  86 22         		stx	ACMMinSize
1156
 3637  F82BC5  84 23         		sty	IARGMinSize
1157
 3638  F82BC7  18            		clc
1158
 3639  F82BC8  60            		rts
1159
 3640
1160
 3641                        	; _iUDiv16: divisione integer 16 bit unsigned
1161
 3642                        	; In:	ACM: unsigned integer 1
1162
 3643                        	;	IARG: unsigned integer 2
1163
 3644                        	; Out:	ACM  -> integer unsigned ACM / IARG
1164
 3645                        	;	IARG -> integer unsigned ACM MOD IARG
1165
 3646                        	;	X = minima size quoziente
1166
 3647                        	;	Y = minima size remainder
1167
 3648                        	;	CF = 1 se IARG = 0 altrimenti CF = 0
1168
 3649                        	; Uso:	A,X,Y,ACM,IARG,FOP
1169
 3650  F82BC9                	_iUDiv16:
1170
 3651  F82BC9                		ACC16
1171
 3652  F82BC9  C2 20         		rep	#PMFLAG
1172
 3653                        		.LONGA	on
1173
 3654                        		.MNLIST
1174
 3655  F82BCB  A5 28         		lda	IARG
1175
 3656  F82BCD  D0 04         		bne	?02
1176
 3657  F82BCF                		ACC08
1177
 3658  F82BCF  E2 20         		sep	#PMFLAG
1178
 3659                        		.LONGA	off
1179
  Tue Jul 17 11:00:16 2018                                                                                               Page   20
1180
 
1181
 
1182
 
1183
 
1184
 3660                        		.MNLIST
1185
 3661  F82BD1  38            		sec			; division by sero
1186
 3662  F82BD2  60            		rts
1187
 3663  F82BD3  A2 10         	?02:	ldx	#16		; loop 16 bit
1188
 3664  F82BD5                		CPU16
1189
 3665  F82BD5  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
1190
 3666                        		.LONGA	on
1191
 3667                        		.LONGI	on
1192
 3668                        		.MNLIST
1193
 3669  F82BD7  64 32         		stz	FOP		; azzera rem
1194
 3670  F82BD9  A5 18         		lda	ACM		; quoziente
1195
 3671  F82BDB  2A            	?04:	rol	a
1196
 3672  F82BDC  26 32         		rol	FOP
1197
 3673  F82BDE  A8            		tay
1198
 3674  F82BDF  38            		sec
1199
 3675  F82BE0  A5 32         		lda	FOP
1200
 3676  F82BE2  E5 28         		sbc	IARG
1201
 3677  F82BE4  90 02         		bcc	?06
1202
 3678  F82BE6  85 32         		sta	FOP
1203
 3679  F82BE8  98            	?06:	tya
1204
 3680  F82BE9  CA            		dex
1205
 3681  F82BEA  D0 EF         		bne	?04
1206
 3682  F82BEC  2A            		rol	a
1207
 3683  F82BED  85 18         		sta	ACM		; quoziente
1208
 3684  F82BEF  A5 32         		lda	FOP
1209
 3685  F82BF1  85 28         		sta	IARG		; remainder
1210
 3686  F82BF3                		CPU08
1211
 3687  F82BF3  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
1212
 3688                        		.LONGA	off
1213
 3689                        		.LONGI	off
1214
 3690                        		.MNLIST
1215
 3691  F82BF5  A0 02         		ldy	#2
1216
 3692  F82BF7  BB            		tyx
1217
 3693  F82BF8  EB            		xba			; A = hi rem
1218
 3694  F82BF9  D0 01         		bne	?08		; rem 16 bit
1219
 3695  F82BFB  88            		dey			; rem 8 bit
1220
 3696  F82BFC  A5 19         	?08:	lda	ACM+1		; A = hi quot
1221
 3697  F82BFE  D0 01         		bne	?10		; quot 16 bit
1222
 3698  F82C00  CA            		dex			; quot 8 bit
1223
 3699  F82C01  18            	?10:	clc
1224
 3700  F82C02  86 22         		stx	ACMMinSize
1225
 3701  F82C04  84 23         		sty	IARGMinSize
1226
 3702  F82C06  60            		rts
1227
 3703
1228
 3704                        	; _iUDiv32: divisione integer 32 bit unsigned
1229
 3705                        	; In:	ACM: unsigned integer 1
1230
 3706                        	;	IARG: unsigned integer 2
1231
 3707                        	; Out:	ACM  -> integer unsigned ACM / IARG
1232
 3708                        	;	IARG -> integer unsigned ACM MOD IARG
1233
 3709                        	;	X = minima size quoziente
1234
 3710                        	;	Y = minima size remainder
1235
 3711                        	;	CF = 1 se IARG = 0 altrimenti CF = 0
1236
 3712                        	; Uso:	A,X,Y,ACM,IARG,FOP
1237
 3713  F82C07                	_iUDiv32:
1238
 3714  F82C07                		ACC16
1239
 3715  F82C07  C2 20         		rep	#PMFLAG
1240
 3716                        		.LONGA	on
1241
  Tue Jul 17 11:00:16 2018                                                                                               Page   21
1242
 
1243
 
1244
 
1245
 
1246
 3717                        		.MNLIST
1247
 3718  F82C09  A5 28         		lda	IARG
1248
 3719  F82C0B  05 2A         		ora	IARG+2
1249
 3720  F82C0D  D0 04         		bne	?02
1250
 3721  F82C0F                		ACC08
1251
 3722  F82C0F  E2 20         		sep	#PMFLAG
1252
 3723                        		.LONGA	off
1253
 3724                        		.MNLIST
1254
 3725  F82C11  38            		sec			; division by sero
1255
 3726  F82C12  60            		rts
1256
 3727  F82C13  A2 20         	?02:	ldx	#32		; loop 32 bit
1257
 3728  F82C15                		CPU16
1258
 3729  F82C15  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
1259
 3730                        		.LONGA	on
1260
 3731                        		.LONGI	on
1261
 3732                        		.MNLIST
1262
 3733  F82C17  64 32         		stz	FOP		; azzera rem
1263
 3734  F82C19  64 34         		stz	FOP+2
1264
 3735  F82C1B  26 18         	?04:	rol	ACM		; quot
1265
 3736  F82C1D  26 1A         		rol	ACM+2
1266
 3737  F82C1F  26 32         		rol	FOP
1267
 3738  F82C21  26 34         		rol	FOP+2
1268
 3739  F82C23  38            		sec
1269
 3740  F82C24  A5 32         		lda	FOP
1270
 3741  F82C26  E5 28         		sbc	IARG
1271
 3742  F82C28  A8            		tay
1272
 3743  F82C29  A5 34         		lda	FOP+2
1273
 3744  F82C2B  E5 2A         		sbc	IARG+2
1274
 3745  F82C2D  90 04         		bcc	?06
1275
 3746  F82C2F  84 32         		sty	FOP
1276
 3747  F82C31  85 34         		sta	FOP+2
1277
 3748  F82C33  CA            	?06:	dex
1278
 3749  F82C34  D0 E5         		bne	?04
1279
 3750  F82C36                		INDEX08
1280
 3751  F82C36  E2 10         		sep	#PXFLAG
1281
 3752                        		.LONGI	off
1282
 3753                        		.MNLIST
1283
 3754  F82C38  A0 04         		ldy	#4
1284
 3755  F82C3A  BB            		tyx
1285
 3756  F82C3B  26 18         		rol	ACM
1286
 3757  F82C3D  26 1A         		rol	ACM+2		; quoziente
1287
 3758  F82C3F  A5 32         		lda	FOP
1288
 3759  F82C41  85 28         		sta	IARG		; remainder
1289
 3760  F82C43  A5 34         		lda	FOP+2
1290
 3761  F82C45  85 2A         		sta	IARG+2		; C = hi rem
1291
 3762  F82C47  D0 02         		bne	?08		; rem 32 bit
1292
 3763  F82C49  A0 02         		ldy	#2		; rem 16 bit
1293
 3764  F82C4B  A5 1A         	?08:	lda	ACM+2		; C = hi quot
1294
 3765  F82C4D  D0 02         		bne	?10		; quot 32 bit
1295
 3766  F82C4F  A2 02         		ldx	#2		; quot 16 bit
1296
 3767  F82C51                	?10:	CPU08
1297
 3768  F82C51  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
1298
 3769                        		.LONGA	off
1299
 3770                        		.LONGI	off
1300
 3771                        		.MNLIST
1301
 3772  F82C53  86 22         		stx	ACMMinSize
1302
 3773  F82C55  84 23         		sty	IARGMinSize
1303
  Tue Jul 17 11:00:16 2018                                                                                               Page   22
1304
 
1305
 
1306
 
1307
 
1308
 3774  F82C57  18            		clc
1309
 3775  F82C58  60            		rts
1310
 3776
1311
 3777                        	; _iUDiv64: divisione integer 64 bit unsigned
1312
 3778                        	; In:	ACM: unsigned integer 1
1313
 3779                        	;	IARG: unsigned integer 2
1314
 3780                        	; Out:	ACM  -> integer unsigned ACM / IARG
1315
 3781                        	;	IARG -> integer unsigned ACM MOD IARG
1316
 3782                        	;	X = minima size quoziente
1317
 3783                        	;	Y = minima size remainder
1318
 3784                        	;	CF = 1 se IARG = 0 altrimenti CF = 0
1319
 3785                        	; Uso:	A,X,Y,ACM,IARG,FOP
1320
 3786  F82C59                	_iUDiv64:
1321
 3787  F82C59                		ACC16
1322
 3788  F82C59  C2 20         		rep	#PMFLAG
1323
 3789                        		.LONGA	on
1324
 3790                        		.MNLIST
1325
 3791  F82C5B  A5 28         		lda	IARG
1326
 3792  F82C5D  05 2A         		ora	IARG+2
1327
 3793  F82C5F  05 2C         		ora	IARG+4
1328
 3794  F82C61  05 2E         		ora	IARG+6
1329
 3795  F82C63  D0 04         		bne	?02
1330
 3796  F82C65                		ACC08
1331
 3797  F82C65  E2 20         		sep	#PMFLAG
1332
 3798                        		.LONGA	off
1333
 3799                        		.MNLIST
1334
 3800  F82C67  38            		sec			; division by sero
1335
 3801  F82C68  60            		rts
1336
 3802  F82C69  A2 40         	?02:	ldx	#64		; loop 32 bit
1337
 3803  F82C6B                		CPU16
1338
 3804  F82C6B  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
1339
 3805                        		.LONGA	on
1340
 3806                        		.LONGI	on
1341
 3807                        		.MNLIST
1342
 3808  F82C6D  64 32         		stz	FOP		; azzera rem
1343
 3809  F82C6F  64 34         		stz	FOP+2
1344
 3810  F82C71  64 36         		stz	FOP+4
1345
 3811  F82C73  64 38         		stz	FOP+6
1346
 3812  F82C75  48            		pha			; 2 word temp.
1347
 3813  F82C76  48            		pha
1348
 3814  F82C77  26 18         	?04:	rol	ACM		; quot
1349
 3815  F82C79  26 1A         		rol	ACM+2
1350
 3816  F82C7B  26 1C         		rol	ACM+4
1351
 3817  F82C7D  26 1E         		rol	ACM+6
1352
 3818  F82C7F  26 32         		rol	FOP
1353
 3819  F82C81  26 34         		rol	FOP+2
1354
 3820  F82C83  26 36         		rol	FOP+4
1355
 3821  F82C85  26 38         		rol	FOP+6
1356
 3822  F82C87  38            		sec
1357
 3823  F82C88  A5 32         		lda	FOP
1358
 3824  F82C8A  E5 28         		sbc	IARG
1359
 3825  F82C8C  83 01         		sta	$01,s
1360
 3826  F82C8E  A5 34         		lda	FOP+2
1361
 3827  F82C90  E5 2A         		sbc	IARG+2
1362
 3828  F82C92  83 03         		sta	$03,s
1363
 3829  F82C94  A5 36         		lda	FOP+4
1364
 3830  F82C96  E5 2C         		sbc	IARG+4
1365
  Tue Jul 17 11:00:16 2018                                                                                               Page   23
1366
 
1367
 
1368
 
1369
 
1370
 3831  F82C98  A8            		tay
1371
 3832  F82C99  A5 38         		lda	FOP+6
1372
 3833  F82C9B  E5 2E         		sbc	IARG+6
1373
 3834  F82C9D  90 0C         		bcc	?06
1374
 3835  F82C9F  84 36         		sty	FOP+4
1375
 3836  F82CA1  85 38         		sta	FOP+6
1376
 3837  F82CA3  A3 01         		lda	$01,s
1377
 3838  F82CA5  85 32         		sta	FOP
1378
 3839  F82CA7  A3 03         		lda	$03,s
1379
 3840  F82CA9  85 34         		sta	FOP+2
1380
 3841  F82CAB  CA            	?06:	dex
1381
 3842  F82CAC  D0 C9         		bne	?04
1382
 3843  F82CAE                		INDEX08
1383
 3844  F82CAE  E2 10         		sep	#PXFLAG
1384
 3845                        		.LONGI	off
1385
 3846                        		.MNLIST
1386
 3847  F82CB0  A0 08         		ldy	#8
1387
 3848  F82CB2  BB            		tyx
1388
 3849  F82CB3  26 18         		rol	ACM
1389
 3850  F82CB5  26 1A         		rol	ACM+2		; quoziente
1390
 3851  F82CB7  26 1C         		rol	ACM+4
1391
 3852  F82CB9  26 1E         		rol	ACM+6
1392
 3853  F82CBB  A5 32         		lda	FOP
1393
 3854  F82CBD  85 28         		sta	IARG		; remainder
1394
 3855  F82CBF  A5 34         		lda	FOP+2
1395
 3856  F82CC1  85 2A         		sta	IARG+2
1396
 3857  F82CC3  A5 36         		lda	FOP+4
1397
 3858  F82CC5  85 2C         		sta	IARG+4
1398
 3859  F82CC7  A5 38         		lda	FOP+6
1399
 3860  F82CC9  85 2E         		sta	IARG+6		; C = hi rem
1400
 3861  F82CCB  05 2C         		ora	IARG+4
1401
 3862  F82CCD  D0 02         		bne	?08		; rem 64 bit
1402
 3863  F82CCF  A0 04         		ldy	#4		; rem 32 bit
1403
 3864  F82CD1  A5 1E         	?08:	lda	ACM+6		; C = hi quot
1404
 3865  F82CD3  05 1C         		ora	ACM+4
1405
 3866  F82CD5  D0 02         		bne	?10		; quot 64 bit
1406
 3867  F82CD7  A2 04         		ldx	#4		; quot 32 bit
1407
 3868  F82CD9  68            	?10:	pla			; scarta 2 word temp.
1408
 3869  F82CDA  68            		pla
1409
 3870  F82CDB                		CPU08
1410
 3871  F82CDB  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
1411
 3872                        		.LONGA	off
1412
 3873                        		.LONGI	off
1413
 3874                        		.MNLIST
1414
 3875  F82CDD  86 22         		stx	ACMMinSize
1415
 3876  F82CDF  84 23         		sty	IARGMinSize
1416
 3877  F82CE1  18            		clc
1417
 3878  F82CE2  60            		rts
1418
 3879
1419
 3880                        	;----------------------------------------------------------
1420
 3881                        	; implementazione SDIV signed integer
1421
 3882                        	;----------------------------------------------------------
1422
 3883
1423
 3884                        	; _iSDiv8: divisione integer 8 bit signed
1424
 3885                        	; In:	ACM: signed integer 1
1425
 3886                        	;	IARG: signed integer 2
1426
 3887                        	; Out:	ACM  -> integer signed ACM / IARG
1427
  Tue Jul 17 11:00:16 2018                                                                                               Page   24
1428
 
1429
 
1430
 
1431
 
1432
 3888                        	;	IARG -> integer signed ACM MOD IARG
1433
 3889                        	;	X = minima size quoziente
1434
 3890                        	;	Y = minima size remainder
1435
 3891                        	;	CF = 1 se IARG = 0 altrimenti CF = 0
1436
 3892                        	;	VF = 1 se ACM overflow (quoziente)
1437
 3893                        	; Uso:	A,X,Y,ACM,IARG,FOP
1438
 3894  F82CE3                	_iSDiv8:
1439
 3895  F82CE3  A5 28         		lda	IARG
1440
 3896  F82CE5  D0 02         		bne	?02
1441
 3897  F82CE7  38            		sec			; division by sero
1442
 3898  F82CE8  60            		rts
1443
 3899  F82CE9  A2 00         	?02:	ldx	#0
1444
 3900  F82CEB  45 18         		EOR	ACM		; segno risultato
1445
 3901  F82CED  29 80         		and	#$80		; bit 7 => segno
1446
 3902  F82CEF  09 40         		ora	#$40		; bit 6 => signed int
1447
 3903  F82CF1  85 21         		sta	ACMSgn		; salva segno quot.
1448
 3904  F82CF3  A5 18         		LDA	ACM
1449
 3905  F82CF5  29 80         		and	#$80		; bit 7 => segno remainder = segno dividendo
1450
 3906  F82CF7  09 40         		ora	#$40		; bit 6 => signed int
1451
 3907  F82CF9  85 31         		sta	IARGSgn		; salva segno remainder
1452
 3908  F82CFB  24 28         		BIT	IARG		; test segno IARG
1453
 3909  F82CFD  10 06         		BPL	?04
1454
 3910  F82CFF  38            		SEC			; complementa IARG
1455
 3911  F82D00  8A            		txa
1456
 3912  F82D01  E5 28         		SBC	IARG
1457
 3913  F82D03  85 28         		STA	IARG
1458
 3914  F82D05  24 18         	?04:	BIT	ACM		; test segno ACM
1459
 3915  F82D07  10 06         		BPL	?06
1460
 3916  F82D09  38            		SEC			; complementa ACM
1461
 3917  F82D0A  8A            		txa
1462
 3918  F82D0B  E5 18         		SBC	ACM
1463
 3919  F82D0D  85 18         		STA	ACM
1464
 3920  F82D0F  20 9C 2B      	?06:	JSR	_iUDiv8
1465
 3921  F82D12  24 21         		bit	ACMSgn
1466
 3922  F82D14  10 07         		bpl	?08
1467
 3923  F82D16  38            		sec			; quot. negativo
1468
 3924  F82D17  A9 00         		lda	#0
1469
 3925  F82D19  E5 18         		sbc	ACM
1470
 3926  F82D1B  85 18         		sta	ACM
1471
 3927  F82D1D  24 31         	?08:	bit	IARGSgn
1472
 3928  F82D1F  10 07         		bpl	?10
1473
 3929  F82D21  38            		sec			; remainder negativo
1474
 3930  F82D22  A9 00         		lda	#0
1475
 3931  F82D24  E5 28         		sbc	IARG
1476
 3932  F82D26  85 28         		sta	IARG
1477
 3933  F82D28  18            	?10:	clc
1478
 3934  F82D29  B8            		clv			; remainder mai provoca overflow
1479
 3935  F82D2A  A5 18         		lda	ACM		; confronta segno quoziente
1480
 3936  F82D2C  45 21         		eor	ACMSgn		; con segno aspettato
1481
 3937  F82D2E  10 02         		bpl	?12		; segni concordi -- OK
1482
 3938  F82D30  E2 40         		sep	#PVFLAG		; segnni discordi => overflow
1483
 3939  F82D32  60            	?12:	RTS
1484
 3940
1485
 3941                        	; _iSDiv16: divisione integer 16 bit signed
1486
 3942                        	; In:	ACM: signed integer 1
1487
 3943                        	;	IARG: signed integer 2
1488
 3944                        	; Out:	ACM  -> integer signed ACM / IARG
1489
  Tue Jul 17 11:00:16 2018                                                                                               Page   25
1490
 
1491
 
1492
 
1493
 
1494
 3945                        	;	IARG -> integer signed ACM MOD IARG
1495
 3946                        	;	X = minima size quoziente
1496
 3947                        	;	Y = minima size remainder
1497
 3948                        	;	CF = 1 se IARG = 0 altrimenti CF = 0
1498
 3949                        	;	VF = 1 se ACM overflow (quoziente)
1499
 3950                        	; Uso:	A,X,Y,ACM,IARG,FOP
1500
 3951  F82D33                	_iSDiv16:
1501
 3952  F82D33  A5 28         		lda	IARG
1502
 3953  F82D35  05 29         		ora	IARG+1
1503
 3954  F82D37  D0 02         		bne	?02
1504
 3955  F82D39  38            		sec			; division by sero
1505
 3956  F82D3A  60            		rts
1506
 3957  F82D3B  A2 00         	?02:	ldx	#0
1507
 3958  F82D3D  A5 29         		lda	IARG+1
1508
 3959  F82D3F  45 19         		EOR	ACM+1		; segno risultato
1509
 3960  F82D41  29 80         		and	#$80		; bit 7 => segno
1510
 3961  F82D43  09 40         		ora	#$40		; bit 6 => signed int
1511
 3962  F82D45  85 21         		sta	ACMSgn		; salva segno quot.
1512
 3963  F82D47  A5 19         		LDA	ACM+1
1513
 3964  F82D49  29 80         		and	#$80		; bit 7 => segno remainder = segno dividendo
1514
 3965  F82D4B  09 40         		ora	#$40		; bit 6 => signed int
1515
 3966  F82D4D  85 31         		sta	IARGSgn		; salva segno remainder
1516
 3967  F82D4F  10 0A         		BPL	?04
1517
 3968  F82D51                		ACC16
1518
 3969  F82D51  C2 20         		rep	#PMFLAG
1519
 3970                        		.LONGA	on
1520
 3971                        		.MNLIST
1521
 3972  F82D53  38            		SEC			; complementa ACM
1522
 3973  F82D54  8A            		txa
1523
 3974  F82D55  E5 18         		SBC	ACM
1524
 3975  F82D57  85 18         		STA	ACM
1525
 3976  F82D59                		ACC08
1526
 3977  F82D59  E2 20         		sep	#PMFLAG
1527
 3978                        		.LONGA	off
1528
 3979                        		.MNLIST
1529
 3980  F82D5B  24 29         	?04:	BIT	IARG+1		; test segno IARG
1530
 3981  F82D5D  10 0A         		BPL	?06
1531
 3982  F82D5F                		ACC16
1532
 3983  F82D5F  C2 20         		rep	#PMFLAG
1533
 3984                        		.LONGA	on
1534
 3985                        		.MNLIST
1535
 3986  F82D61  38            		SEC			; complementa IARG
1536
 3987  F82D62  8A            		txa
1537
 3988  F82D63  E5 28         		SBC	IARG
1538
 3989  F82D65  85 28         		STA	IARG
1539
 3990  F82D67                		ACC08
1540
 3991  F82D67  E2 20         		sep	#PMFLAG
1541
 3992                        		.LONGA	off
1542
 3993                        		.MNLIST
1543
 3994  F82D69  20 C9 2B      	?06:	JSR	_iUDiv16
1544
 3995                        		; Y = minima size remainder -- aggiusta IARG (remainder)
1545
 3996  F82D6C  A2 28         		ldx	#IARG
1546
 3997  F82D6E  20 8A 2D      		jsr	post16
1547
 3998  F82D71  84 23         		sty	IARGMinSize
1548
 3999  F82D73  A4 22         		ldy	ACMMinSize
1549
 4000                        		; Y = minima size quot. -- aggiusta ACM (quot.)
1550
 4001  F82D75  A2 18         		ldx	#ACM
1551
  Tue Jul 17 11:00:16 2018                                                                                               Page   26
1552
 
1553
 
1554
 
1555
 
1556
 4002  F82D77  20 8A 2D      		jsr	post16
1557
 4003  F82D7A  84 22         		sty	ACMMinSize
1558
 4004  F82D7C  BB            		tyx
1559
 4005  F82D7D  A4 23         		ldy	IARGMinSize
1560
 4006  F82D7F  18            		clc
1561
 4007  F82D80  B8            		clv			; remainder mai provoca overflow
1562
 4008  F82D81  A5 19         		lda	ACM+1		; confronta segno quoziente
1563
 4009  F82D83  45 21         		eor	ACMSgn		; con segno aspettato
1564
 4010  F82D85  10 02         		bpl	?12		; segni concordi -- OK
1565
 4011  F82D87  E2 40         		sep	#PVFLAG		; segnni discordi => overflow
1566
 4012  F82D89  60            	?12:	RTS
1567
 4013
1568
 4014                        	; post16 - aggiusta risultato per _iSDiv16
1569
 4015                        	; In	Y = minima size
1570
 4016                        	;	X = ptr ACM/IARG
1571
 4017                        	; Out:	Y = minima size
1572
 4018                        	;	ACM/IARG eventualmente complementato
1573
 4019  F82D8A                	post16:
1574
 4020  F82D8A  C0 02         		cpy	#$02		; min size WORD ?
1575
 4021  F82D8C  F0 0D         		beq	?02b		; si
1576
 4022                        		; se ACM/IARG <= 7F allora min size = BYTE
1577
 4023  F82D8E  B5 00         		lda	<0,x
1578
 4024  F82D90  C9 80         		cmp	#$80
1579
 4025  F82D92  90 07         		bcc	?02b
1580
 4026  F82D94  D0 04         		bne	?02a		; ACM/IARG > 80 => WORD
1581
 4027                        		; ACM/IARG = 80 -- se risultato negativo => BYTE
1582
 4028  F82D96  34 09         		bit	<9,x
1583
 4029  F82D98  30 05         		bmi	?02c		; ACM/IARG BYTE negativo
1584
 4030  F82D9A  C8            	?02a:	iny			; ACM/IARG WORD
1585
 4031  F82D9B  34 09         	?02b:	bit	<9,x		; Flag N = segno risultato
1586
 4032  F82D9D  10 0C         		BPL	?03		; risultato positivo
1587
 4033  F82D9F                	?02c:	ACC16
1588
 4034  F82D9F  C2 20         		rep	#PMFLAG
1589
 4035                        		.LONGA	on
1590
 4036                        		.MNLIST
1591
 4037  F82DA1  A9 00 00      		lda	#0
1592
 4038  F82DA4  38            		sec			; risultato negativo: complementa ACM/IARG
1593
 4039  F82DA5  F5 00         		sbc	<0,x
1594
 4040  F82DA7  95 00         		sta	<0,x
1595
 4041  F82DA9                		ACC08
1596
 4042  F82DA9  E2 20         		sep	#PMFLAG
1597
 4043                        		.LONGA	off
1598
 4044                        		.MNLIST
1599
 4045  F82DAB  60            	?03:	rts
1600
 4046
1601
 4047                        	; _iSDiv32: divisione integer 32 bit signed
1602
 4048                        	; In:	ACM: signed integer 1
1603
 4049                        	;	IARG: signed integer 2
1604
 4050                        	; Out:	ACM  -> integer signed ACM / IARG
1605
 4051                        	;	IARG -> integer signed ACM MOD IARG
1606
 4052                        	;	X = minima size quoziente
1607
 4053                        	;	Y = minima size remainder
1608
 4054                        	;	CF = 1 se IARG = 0 altrimenti CF = 0
1609
 4055                        	;	VF = 1 se ACM overflow (quoziente)
1610
 4056                        	; Uso:	A,X,Y,ACM,IARG,FOP
1611
 4057  F82DAC                	_iSDiv32:
1612
 4058  F82DAC                		ACC16
1613
  Tue Jul 17 11:00:16 2018                                                                                               Page   27
1614
 
1615
 
1616
 
1617
 
1618
 4059  F82DAC  C2 20         		rep	#PMFLAG
1619
 4060                        		.LONGA	on
1620
 4061                        		.MNLIST
1621
 4062  F82DAE  A5 28         		lda	IARG
1622
 4063  F82DB0  05 2A         		ora	IARG+2
1623
 4064  F82DB2                		ACC08
1624
 4065  F82DB2  E2 20         		sep	#PMFLAG
1625
 4066                        		.LONGA	off
1626
 4067                        		.MNLIST
1627
 4068  F82DB4  D0 02         		bne	?02
1628
 4069  F82DB6  38            		sec			; division by sero
1629
 4070  F82DB7  60            		rts
1630
 4071  F82DB8  A2 00         	?02:	ldx	#0
1631
 4072  F82DBA  A5 2B         		lda	IARG+3
1632
 4073  F82DBC  45 1B         		EOR	ACM+3		; segno risultato
1633
 4074  F82DBE  29 80         		and	#$80		; bit 7 => segno
1634
 4075  F82DC0  09 40         		ora	#$40		; bit 6 => signed int
1635
 4076  F82DC2  85 21         		sta	ACMSgn		; salva segno quot.
1636
 4077  F82DC4  A5 1B         		LDA	ACM+3
1637
 4078  F82DC6  29 80         		and	#$80		; bit 7 => segno remainder = segno dividendo
1638
 4079  F82DC8  09 40         		ora	#$40		; bit 6 => signed int
1639
 4080  F82DCA  85 31         		sta	IARGSgn		; salva segno remainder
1640
 4081  F82DCC  10 0F         		BPL	?04
1641
 4082  F82DCE                		ACC16
1642
 4083  F82DCE  C2 20         		rep	#PMFLAG
1643
 4084                        		.LONGA	on
1644
 4085                        		.MNLIST
1645
 4086  F82DD0  38            		SEC			; complementa ACM
1646
 4087  F82DD1  8A            		txa
1647
 4088  F82DD2  E5 18         		SBC	ACM
1648
 4089  F82DD4  85 18         		STA	ACM
1649
 4090  F82DD6  8A            		txa
1650
 4091  F82DD7  E5 1A         		SBC	ACM+2
1651
 4092  F82DD9  85 1A         		STA	ACM+2
1652
 4093  F82DDB                		ACC08
1653
 4094  F82DDB  E2 20         		sep	#PMFLAG
1654
 4095                        		.LONGA	off
1655
 4096                        		.MNLIST
1656
 4097  F82DDD  24 2B         	?04:	BIT	IARG+3		; test segno IARG
1657
 4098  F82DDF  10 0F         		BPL	?06
1658
 4099  F82DE1                		ACC16
1659
 4100  F82DE1  C2 20         		rep	#PMFLAG
1660
 4101                        		.LONGA	on
1661
 4102                        		.MNLIST
1662
 4103  F82DE3  38            		SEC			; complementa IARG
1663
 4104  F82DE4  8A            		txa
1664
 4105  F82DE5  E5 28         		SBC	IARG
1665
 4106  F82DE7  85 28         		STA	IARG
1666
 4107  F82DE9  8A            		txa
1667
 4108  F82DEA  E5 2A         		SBC	IARG+2
1668
 4109  F82DEC  85 2A         		STA	IARG+2
1669
 4110  F82DEE                		ACC08
1670
 4111  F82DEE  E2 20         		sep	#PMFLAG
1671
 4112                        		.LONGA	off
1672
 4113                        		.MNLIST
1673
 4114  F82DF0  20 07 2C      	?06:	JSR	_iUDiv32
1674
 4115                        		; Y = minima size remainder -- aggiusta IARG (remainder)
1675
  Tue Jul 17 11:00:16 2018                                                                                               Page   28
1676
 
1677
 
1678
 
1679
 
1680
 4116  F82DF3  A2 28         		ldx	#IARG
1681
 4117  F82DF5  20 11 2E      		jsr	post32
1682
 4118  F82DF8  84 23         		sty	IARGMinSize
1683
 4119  F82DFA  A4 22         		ldy	ACMMinSize
1684
 4120                        		; Y = minima size quot. -- aggiusta ACM (quot.)
1685
 4121  F82DFC  A2 18         		ldx	#ACM
1686
 4122  F82DFE  20 11 2E      		jsr	post32
1687
 4123  F82E01  84 22         		sty	ACMMinSize
1688
 4124  F82E03  BB            		tyx
1689
 4125  F82E04  A4 23         		ldy	IARGMinSize
1690
 4126  F82E06  18            		clc
1691
 4127  F82E07  B8            		clv			; remainder mai provoca overflow
1692
 4128  F82E08  A5 1B         		lda	ACM+3		; confronta segno quoziente
1693
 4129  F82E0A  45 21         		eor	ACMSgn		; con segno aspettato
1694
 4130  F82E0C  10 02         		bpl	?12		; segni concordi -- OK
1695
 4131  F82E0E  E2 40         		sep	#PVFLAG		; segnni discordi => overflow
1696
 4132  F82E10  60            	?12:	RTS
1697
 4133
1698
 4134                        	; post32 - aggiusta risultato per _iSDiv32
1699
 4135                        	; In	Y = minima size
1700
 4136                        	;	X = ptr ACM/IARG
1701
 4137                        	; Out:	Y = minima size
1702
 4138                        	;	ACM/IARG eventualmente complementato
1703
 4139  F82E11                	post32:
1704
 4140  F82E11  C0 04         		cpy	#$04		; min size LONG ?
1705
 4141  F82E13  F0 13         		beq	?02b		; si
1706
 4142                        		; se ACM/IARG <= 7FFF allora min size = WORD
1707
 4143  F82E15                		ACC16
1708
 4144  F82E15  C2 20         		rep	#PMFLAG
1709
 4145                        		.LONGA	on
1710
 4146                        		.MNLIST
1711
 4147  F82E17  B5 00         		lda	<0,x
1712
 4148  F82E19  C9 00 80      		cmp	#$8000
1713
 4149  F82E1C                		ACC08
1714
 4150  F82E1C  E2 20         		sep	#PMFLAG
1715
 4151                        		.LONGA	off
1716
 4152                        		.MNLIST
1717
 4153  F82E1E  90 08         		bcc	?02b
1718
 4154  F82E20  D0 04         		bne	?02a		; ACM/IARG > 8000 => LONG
1719
 4155                        		; ACM/IARG = 8000 -- se risultato negativo => BYTE
1720
 4156  F82E22  34 09         		bit	<9,x
1721
 4157  F82E24  30 06         		bmi	?02c		; ACM/IARG WORD negativo
1722
 4158  F82E26  C8            	?02a:	iny			; ACM/IARG LONG
1723
 4159  F82E27  C8            		iny
1724
 4160  F82E28  34 09         	?02b:	bit	<9,x		; Flag N = segno risultato
1725
 4161  F82E2A  10 13         		BPL	?03		; risultato positivo
1726
 4162  F82E2C                	?02c:	ACC16
1727
 4163  F82E2C  C2 20         		rep	#PMFLAG
1728
 4164                        		.LONGA	on
1729
 4165                        		.MNLIST
1730
 4166  F82E2E  A9 00 00      		lda	#0
1731
 4167  F82E31  38            		sec			; risultato negativo: complementa ACM/IARG
1732
 4168  F82E32  F5 00         		sbc	<0,x
1733
 4169  F82E34  95 00         		sta	<0,x
1734
 4170  F82E36  A9 00 00      		lda	#0
1735
 4171  F82E39  F5 02         		sbc	<2,x
1736
 4172  F82E3B  95 02         		sta	<2,x
1737
  Tue Jul 17 11:00:16 2018                                                                                               Page   29
1738
 
1739
 
1740
 
1741
 
1742
 4173  F82E3D                		ACC08
1743
 4174  F82E3D  E2 20         		sep	#PMFLAG
1744
 4175                        		.LONGA	off
1745
 4176                        		.MNLIST
1746
 4177  F82E3F  60            	?03:	rts
1747
 4178
1748
 4179                        	; _iSDiv64: divisione integer 64 bit signed
1749
 4180                        	; In:	ACM: signed integer 1
1750
 4181                        	;	IARG: signed integer 2
1751
 4182                        	; Out:	ACM  -> integer signed ACM / IARG
1752
 4183                        	;	IARG -> integer signed ACM MOD IARG
1753
 4184                        	;	X = minima size quoziente
1754
 4185                        	;	Y = minima size remainder
1755
 4186                        	;	CF = 1 se IARG = 0 altrimenti CF = 0
1756
 4187                        	;	VF = 1 se ACM overflow (quoziente)
1757
 4188                        	; Uso:	A,X,Y,ACM,IARG,FOP
1758
 4189  F82E40                	_iSDiv64:
1759
 4190  F82E40                		ACC16
1760
 4191  F82E40  C2 20         		rep	#PMFLAG
1761
 4192                        		.LONGA	on
1762
 4193                        		.MNLIST
1763
 4194  F82E42  A5 28         		lda	IARG
1764
 4195  F82E44  05 2A         		ora	IARG+2
1765
 4196  F82E46  05 2C         		ora	IARG+4
1766
 4197  F82E48  05 2E         		ora	IARG+6
1767
 4198  F82E4A                		ACC08
1768
 4199  F82E4A  E2 20         		sep	#PMFLAG
1769
 4200                        		.LONGA	off
1770
 4201                        		.MNLIST
1771
 4202  F82E4C  D0 02         		bne	?02
1772
 4203  F82E4E  38            		sec			; division by sero
1773
 4204  F82E4F  60            		rts
1774
 4205  F82E50  A5 2F         	?02:	lda	IARG+7
1775
 4206  F82E52  45 1F         		EOR	ACM+7		; segno risultato
1776
 4207  F82E54  29 80         		and	#$80		; bit 7 => segno
1777
 4208  F82E56  09 40         		ora	#$40		; bit 6 => signed int
1778
 4209  F82E58  85 21         		sta	ACMSgn		; salva segno quot.
1779
 4210  F82E5A  A5 1F         		LDA	ACM+7
1780
 4211  F82E5C  29 80         		and	#$80		; bit 7 => segno remainder = segno dividendo
1781
 4212  F82E5E  09 40         		ora	#$40		; bit 6 => signed int
1782
 4213  F82E60  85 31         		sta	IARGSgn		; salva segno remainder
1783
 4214  F82E62  10 03         		BPL	?04
1784
 4215  F82E64  20 3E 2A      		jsr	_iNegACM	; complementa ACM
1785
 4216  F82E67  24 2F         	?04:	BIT	IARG+7		; test segno IARG
1786
 4217  F82E69  10 03         		BPL	?06
1787
 4218  F82E6B  20 3A 2A      		jsr	_iNegIARG	; complementa IARG
1788
 4219  F82E6E  20 59 2C      	?06:	JSR	_iUDiv64
1789
 4220                        		; Y = minima size remainder -- aggiusta IARG (remainder)
1790
 4221  F82E71  A2 28         		ldx	#IARG
1791
 4222  F82E73  20 8F 2E      		jsr	post64
1792
 4223  F82E76  84 23         		sty	IARGMinSize
1793
 4224  F82E78  A4 22         		ldy	ACMMinSize
1794
 4225                        		; Y = minima size quot. -- aggiusta ACM (quot.)
1795
 4226  F82E7A  A2 18         		ldx	#ACM
1796
 4227  F82E7C  20 8F 2E      		jsr	post64
1797
 4228  F82E7F  84 22         		sty	ACMMinSize
1798
 4229  F82E81  BB            		tyx
1799
  Tue Jul 17 11:00:16 2018                                                                                               Page   30
1800
 
1801
 
1802
 
1803
 
1804
 4230  F82E82  A4 23         		ldy	IARGMinSize
1805
 4231  F82E84  18            		clc
1806
 4232  F82E85  B8            		clv			; remainder mai provoca overflow
1807
 4233  F82E86  A5 1F         		lda	ACM+7		; confronta segno quoziente
1808
 4234  F82E88  45 21         		eor	ACMSgn		; con segno aspettato
1809
 4235  F82E8A  10 02         		bpl	?12		; segni concordi -- OK
1810
 4236  F82E8C  E2 40         		sep	#PVFLAG		; segnni discordi => overflow
1811
 4237  F82E8E  60            	?12:	RTS
1812
 4238
1813
 4239                        	; post64 - aggiusta risultato per _iSDiv64
1814
 4240                        	; In	Y = minima size
1815
 4241                        	;	X = ptr ACM/IARG
1816
 4242                        	; Out:	Y = minima size
1817
 4243                        	;	ACM/IARG eventualmente complementato
1818
 4244  F82E8F                	post64:
1819
 4245  F82E8F  C0 08         		cpy	#$08		; min size QUAD ?
1820
 4246  F82E91  F0 1B         		beq	?02b		; si
1821
 4247                        		; se ACM/IARG <= 7FFFFFFF allora min size = LONG
1822
 4248  F82E93                		ACC16
1823
 4249  F82E93  C2 20         		rep	#PMFLAG
1824
 4250                        		.LONGA	on
1825
 4251                        		.MNLIST
1826
 4252  F82E95  B5 02         		lda	<2,x
1827
 4253  F82E97  C9 00 80      		cmp	#$8000
1828
 4254  F82E9A                		ACC08
1829
 4255  F82E9A  E2 20         		sep	#PMFLAG
1830
 4256                        		.LONGA	off
1831
 4257                        		.MNLIST
1832
 4258  F82E9C  90 10         		bcc	?02b		; ACM/IARG < 80000000 => LONG
1833
 4259  F82E9E  D0 0C         		bne	?02a		; ACM/IARG > 80000000 => QUAD
1834
 4260  F82EA0                		ACC16
1835
 4261  F82EA0  C2 20         		rep	#PMFLAG
1836
 4262                        		.LONGA	on
1837
 4263                        		.MNLIST
1838
 4264  F82EA2  A5 18         		lda	ACM
1839
 4265  F82EA4                		ACC08
1840
 4266  F82EA4  E2 20         		sep	#PMFLAG
1841
 4267                        		.LONGA	off
1842
 4268                        		.MNLIST
1843
 4269  F82EA6  D0 04         		bne	?02a		; ACM/IARG > 80000000 => QUAD
1844
 4270                        		; ACM/IARG = 80000000 -- se risultato negativo => LONG
1845
 4271  F82EA8  34 09         		bit	<9,x
1846
 4272  F82EAA  30 06         		bmi	?02c		; ACM/IARG LONG negativo
1847
 4273  F82EAC  A0 08         	?02a:	ldy	#8		; ACM/IARG QUAD
1848
 4274  F82EAE  34 09         	?02b:	bit	<9,x		; Flag N = segno risultato
1849
 4275  F82EB0  10 03         		BPL	?03		; risultato positivo
1850
 4276  F82EB2  20 40 2A      	?02c:	jsr	_iNegX		; risultato negativo: complementa ACM/IARG
1851
 4277  F82EB5  60            	?03:	rts
1852
 4278
1853
 4279                        	;----------------------------------------------------------
1854
 4280                        	; Funzioni 'move'
1855
 4281                        	;----------------------------------------------------------
1856
 4282
1857
 4283                        	; _iMovACM2A - copia ACM (in size e tipo) in IARG
1858
 4284  F82EB6                	_iMovACM2A:
1859
 4285  F82EB6  A5 21         		lda	ACMSgn
1860
 4286  F82EB8  85 31         		sta	IARGSgn
1861
  Tue Jul 17 11:00:16 2018                                                                                               Page   31
1862
 
1863
 
1864
 
1865
 
1866
 4287  F82EBA  A6 20         		ldx	ACMSize
1867
 4288  F82EBC  86 30         		stx	IARGSize
1868
 4289  F82EBE  CA            		dex
1869
 4290  F82EBF  B5 18         	?01:	lda	ACM,x
1870
 4291  F82EC1  95 28         		sta	IARG,x
1871
 4292  F82EC3  CA            		dex
1872
 4293  F82EC4  10 F9         		bpl	?01
1873
 4294  F82EC6  60            		rts
1874
 4295  F82EC7
1875
 4296                        	;----------------------------------------------------------
1876
 4297                        	; Conversioni Stringa (decimale / hex) - Integer
1877
 4298                        	;----------------------------------------------------------
1878
 4299
1879
 4300                        	; _Str2Int - converte stringa decimale in intero
1880
 4301                        	; In	- C = offset stringa decimale
1881
 4302                        	;	  Y = banco stringa
1882
 4303                        	;	  X<7> = bit signed (richiesto signed int)
1883
 4304                        	;	  X<6:0> = dimensione richiesta => 1,2,4,8
1884
 4305                        	;	  DPR = DP02ADDR
1885
 4306                        	;
1886
 4307                        	; Out	- ACM => intero 1,2,3,4,8 bytes
1887
 4308                        	;	  ACMSgn<7> = segno (solo signed)
1888
 4309                        	;	  ACMSgn<6> = signed int
1889
 4310                        	;	  Y => indice dove si arresta la conversione
1890
 4311                        	;	  CF = 0, VF = 0 OK
1891
 4312                        	;	  CF = 0, VF = 1 mismatch type
1892
 4313                        	;	  CF = 1, VF = 1 se overflow
1893
 4314                        	;	  CF = 1, VF = 0 se stringa non valida
1894
 4315  F82EC7                	_Str2Int:
1895
 4316  F82EC7  20 ED 2F      		jsr	_pres2i		; prepara var. conversione
1896
 4317  F82ECA  A5 20         		lda	ACMSize		; interi a 3 bytes non accettati
1897
 4318  F82ECC  C9 03         		cmp	#$03
1898
 4319  F82ECE  D0 02         		bne	?01
1899
 4320  F82ED0  A9 04         		lda	#$04
1900
 4321  F82ED2  85 20         	?01:	sta	ACMSize
1901
 4322  F82ED4  A0 FF         		LDY	#-1
1902
 4323  F82ED6  C8            	?02:	INY
1903
 4324  F82ED7  C0 7F         		CPY	#MAXINTSTR	; max. dimensione stringa hex/dec
1904
 4325  F82ED9  B0 51         		bcs	?11		; esce con CF = 1 e con VF = 0
1905
 4326  F82EDB  B7 60         		lda	[FPLPtr],y	; load char
1906
 4327  F82EDD  F0 4C         		beq	?10		; fine stringa => esce con CF = 1 e VF = 0
1907
 4328  F82EDF  C9 20         		CMP	#' '
1908
 4329  F82EE1  F0 F3         		BEQ	?02		; scarta spazi iniziali
1909
 4330  F82EE3  C9 08         		CMP	#$08
1910
 4331  F82EE5  F0 EF         		BEQ	?02		; scarta TAB iniziali
1911
 4332  F82EE7  C9 2B         		CMP	#'+'		; segno +
1912
 4333  F82EE9  F0 0C         		BEQ	?04		; cerca primo digit decimale
1913
 4334  F82EEB  C9 2D         		CMP	#'-'
1914
 4335  F82EED  D0 1F         		BNE	?08		; test digit decimale
1915
 4336  F82EEF  A9 80         		LDA	#$80
1916
 4337  F82EF1  04 21         		TSB	ACMSgn		; intero negativo
1917
 4338  F82EF3  A9 40         		lda	#$40
1918
 4339  F82EF5  85 63         		STA	FPFlag		; FPFlag<6> => intero signed
1919
 4340  F82EF7  C8            	?04:	INY			; cerca digit decimale dopo '+' o '-'
1920
 4341  F82EF8  C0 7F         		CPY	#MAXINTSTR	; max. dimensione stringa hex/dec
1921
 4342  F82EFA  B0 30         		bcs	?11		; esce con CF = 1 e con VF = 0
1922
 4343  F82EFC  B7 60         		lda	[FPLPtr],y	; load char
1923
  Tue Jul 17 11:00:16 2018                                                                                               Page   32
1924
 
1925
 
1926
 
1927
 
1928
 4344  F82EFE  F0 2B         		beq	?10		; fine stringa => esce con CF = 1 e VF = 0
1929
 4345  F82F00  C9 20         		CMP	#' '
1930
 4346  F82F02  F0 F3         		BEQ	?04		; scarta spazi dopo '+' o '-'
1931
 4347  F82F04  C9 08         		CMP	#$08
1932
 4348  F82F06  F0 CE         		BEQ	?02		; scarta TAB dopo '+' o '-'
1933
 4349  F82F08  D0 04         		bne	?08		; test digit decimale
1934
 4350  F82F0A  B7 60         	?06:	lda	[FPLPtr],y	; loop scansione digit decimale
1935
 4351  F82F0C  F0 1D         		beq	?10		; fine stringa
1936
 4352  F82F0E  38            	?08:	SEC			; next digit decimale
1937
 4353  F82F0F  E9 3A         		SBC	#('0'+10)
1938
 4354  F82F11  18            		CLC
1939
 4355  F82F12  69 0A         		ADC	#10
1940
 4356  F82F14  90 15         		BCC	?10		; no digit decimale => fine scansione
1941
 4357  F82F16  48            		PHA
1942
 4358  F82F17  20 35 30      		JSR	_iUMult10	; ACM * 10 -> ACM
1943
 4359  F82F1A  68            		PLA
1944
 4360  F82F1B  B0 5E         		bcs	?30		; overflow => esce con CF = 1, VF = 1
1945
 4361  F82F1D  20 5A 30      		JSR	_iUAdd8		; ACM + A -> ACM
1946
 4362  F82F20  B0 59         		bcs	?30		; overflow => esce con CF = 1, VF = 1
1947
 4363  F82F22  A9 80         		lda	#$80
1948
 4364  F82F24  04 63         		tsb	FPFlag		; FPFlag<7> -> flag digit decimale
1949
 4365  F82F26  C8            		INY			; next char
1950
 4366  F82F27  C0 7F         		CPY	#MAXINTSTR	; max. dimensione stringa hex/dec
1951
 4367  F82F29  90 DF         		bcc	?06		; loop scansione digit decimale
1952
 4368
1953
 4369                        	?10:	; a questo punto scansione terminata o per fine stringa o per
1954
 4370                        		; primo carattere non digit decimale all'indice attuale
1955
 4371  F82F2B  38            		sec			; assume CF = 1, VF = 0
1956
 4372  F82F2C  B8            	?11:	clv
1957
 4373  F82F2D  A5 63         		lda	FPFlag
1958
 4374  F82F2F  10 4C         		bpl	?40		; CF = 1 e VF = 0 => stringa vuota
1959
 4375                        					; o nessun digit decimale valido
1960
 4376
1961
 4377                        		; si testa se ACM contiene un numero
1962
 4378                        		; compatibile con la dimensione richiesta
1963
 4379  F82F31  20 17 30      		jsr	_minsize	; X = minima dimensione - 1
1964
 4380  F82F34  E4 20         		cpx	ACMSize		; 1,2,3,4,8 => CF = 1 se overflow
1965
 4381  F82F36  B0 43         		bcs	?30		; overflow => CF = 1, VF = 1
1966
 4382                        		; qui ora CF = 0
1967
 4383  F82F38  24 21         		bit	ACMSgn		; bit 6 => richiesto tipi signed
1968
 4384  F82F3A  70 04         		bvs	?13		; richiesto signed
1969
 4385  F82F3C  24 63         		bit	FPFlag		; test segno '-'
1970
 4386  F82F3E  80 3D         		bra	?40		; unsigned => OK => CF = 0, VF = 0
1971
 4387                        					; se VF = 1 => signed => mismatch
1972
 4388  F82F40
1973
 4389                        	?13:	; richiesto tipo signed
1974
 4390  F82F40  A5 63         		lda	FPFlag		; FPFlag<6> = segno
1975
 4391  F82F42  0A            		asl	a		; bit 7 = segno, CF = 1 (FPFlag<7> = 1)
1976
 4392  F82F43  04 21         		tsb	ACMSgn		; imposta segno
1977
 4393  F82F45  A6 20         		ldx	ACMSize
1978
 4394  F82F47  CA            		dex			; indice MSB
1979
 4395  F82F48  B5 18         		lda	ACM,x		; test MSB ACM
1980
 4396  F82F4A  10 10         		bpl	?18		; OK -- valore abs. < 8000...00
1981
 4397  F82F4C
1982
 4398                        		; se MSB = 1 e tutti i restanti bit sono nulli il signed int
1983
 4399                        		; e' valido e pari al minimo negativo. Qui ancora CF = 1
1984
 4400  F82F4C  24 21         		bit	ACMSgn		; signed positivo deve avere MSB = 0
1985
  Tue Jul 17 11:00:16 2018                                                                                               Page   33
1986
 
1987
 
1988
 
1989
 
1990
 4401  F82F4E  10 2B         		bpl	?30		; overflow => CF = 1, VF = 1
1991
 4402                        		; intero negativo
1992
 4403  F82F50  C9 80         		cmp	#$80		; al minimo deve essere 80 00 00 ... 00
1993
 4404  F82F52  D0 27         		bne	?30		; overflow => CF = 1, VF = 1
1994
 4405                        		; qui ancora CF = 1
1995
 4406  F82F54  CA            		dex
1996
 4407  F82F55  B5 18         	?15:	lda	ACM,x
1997
 4408  F82F57  D0 22         		bne	?30		; overflow => CF = 1, VF = 1
1998
 4409  F82F59  CA            		dex
1999
 4410  F82F5A  10 F9         		bpl	?15		; testa tutti i bytes (= 00)
2000
 4411  F82F5C
2001
 4412                        	?18:	; OK -- adesso signed int in ACM compatibile con tipo richiesto
2002
 4413  F82F5C                		ACC16
2003
 4414  F82F5C  C2 20         		rep	#PMFLAG
2004
 4415                        		.LONGA	on
2005
 4416                        		.MNLIST
2006
 4417  F82F5E  A5 18         		lda	ACM		; test ACM = 0
2007
 4418  F82F60  05 1A         		ora	ACM+2
2008
 4419  F82F62  05 1C         		ora	ACM+4
2009
 4420  F82F64  05 1E         		ora	ACM+6
2010
 4421  F82F66                		ACC08
2011
 4422  F82F66  E2 20         		sep	#PMFLAG
2012
 4423                        		.LONGA	off
2013
 4424                        		.MNLIST
2014
 4425  F82F68  D0 06         		bne	?19		; non nullo
2015
 4426  F82F6A  A9 80         		lda	#$80
2016
 4427  F82F6C  14 21         		trb	ACMSgn		; azzera segno se nullo
2017
 4428  F82F6E  80 07         		bra	?20
2018
 4429  F82F70  24 21         	?19:	bit	ACMSgn		; test segno
2019
 4430  F82F72  10 03         		bpl	?20		; positivo
2020
 4431  F82F74  20 3E 2A      		jsr	_iNegACM	; complemento a 2 di ACM
2021
 4432  F82F77  B8            	?20:	clv			; OK
2022
 4433  F82F78  18            		clc
2023
 4434  F82F79  90 02         		bcc	?40
2024
 4435  F82F7B  E2 40         	?30:	sep	#PVFLAG		; VF = 1 => overflow
2025
 4436  F82F7D  60            	?40:	rts
2026
 4437  F82F7E
2027
 4438                        	; _Str2Hex - converte stringa hex. in unsigned intero
2028
 4439                        	; In	- C = offset stringa hex.
2029
 4440                        	;	  Y = banco stringa
2030
 4441                        	;	  X = dimensione richiesta => 1,2,3,4,8
2031
 4442                        	;	  DPR = DP02ADDR
2032
 4443                        	;
2033
 4444                        	; Out	- ACM => intero 1,2,3,4,8 bytes
2034
 4445                        	;	  Y => indice dove si arresta la conversione
2035
 4446                        	;	  CF = 1, VF = 1 se overflow
2036
 4447                        	;	  CF = 1, VF = 0 se stringa non valida
2037
 4448  F82F7E                	_Str2Hex:
2038
 4449  F82F7E  20 ED 2F      		jsr	_pres2i		; prepara var. conversione
2039
 4450  F82F81  64 21         		stz	ACMSgn		; HEX => solo unsigned
2040
 4451  F82F83  A0 00         		ldy	#0		; indice stringa
2041
 4452  F82F85  B7 60         	?01:	lda	[FPLPtr],y	; load char
2042
 4453  F82F87  F0 53         		beq	?20		; fine stringa => esce con CF = 1 e VF = 0
2043
 4454  F82F89  C9 20         		cmp	#' '		; scarta spazi iniziali
2044
 4455  F82F8B  F0 04         		beq	?02
2045
 4456  F82F8D  C9 08         		cmp	#$08		; scarta 'TAB' iniziali
2046
 4457  F82F8F  D0 07         		bne	?04
2047
  Tue Jul 17 11:00:16 2018                                                                                               Page   34
2048
 
2049
 
2050
 
2051
 
2052
 4458  F82F91  C8            	?02:	iny			; next char
2053
 4459  F82F92  C0 7F         		cpy	#MAXINTSTR	; max. dimensione stringa hex/dec
2054
 4460  F82F94  90 EF         		bcc	?01
2055
 4461  F82F96  B0 54         		bcs	?25		; esce con CF = 1 e con VF = 0
2056
 4462  F82F98  C9 61         	?04:	CMP	#'a'		; loop test digit esadecimali
2057
 4463  F82F9A  90 02         		BCC	?12
2058
 4464  F82F9C  E9 20         		SBC	#$20		; caps
2059
 4465  F82F9E  38            	?12:	SEC
2060
 4466  F82F9F  E9 3A         		SBC	#('0'+10)
2061
 4467  F82FA1  18            		CLC
2062
 4468  F82FA2  69 0A         		ADC	#10
2063
 4469  F82FA4  B0 09         		BCS	?13		; ok, digit hex
2064
 4470  F82FA6  E9 16         		SBC	#(6+16)
2065
 4471  F82FA8  18            		CLC
2066
 4472  F82FA9  69 06         		ADC	#6
2067
 4473  F82FAB  90 2F         		BCC	?20		; no digit esadecimale => fine scansione
2068
 4474  F82FAD  69 09         		ADC	#9		; digit hex
2069
 4475  F82FAF  29 0F         	?13:	and	#$0F		; maschera digit hex
2070
 4476  F82FB1  48            		PHA			; salva digit
2071
 4477  F82FB2  A9 80         		lda	#$80
2072
 4478  F82FB4  85 63         		sta	FPFlag		; segnala hex digit valido
2073
 4479  F82FB6                		ACC16			; ACM = ACM * 16
2074
 4480  F82FB6  C2 20         		rep	#PMFLAG
2075
 4481                        		.LONGA	on
2076
 4482                        		.MNLIST
2077
 4483  F82FB8  A2 04         		ldx	#$04		; 4 shift
2078
 4484  F82FBA  A5 18         		lda	ACM
2079
 4485  F82FBC  0A            	?15:	asl	a
2080
 4486  F82FBD  26 1A         		rol	ACM+2
2081
 4487  F82FBF  26 1C         		rol	ACM+4
2082
 4488  F82FC1  26 1E         		rol	ACM+6
2083
 4489  F82FC3  B0 03         		bcs	?17		; overflow
2084
 4490  F82FC5  CA            		dex
2085
 4491  F82FC6  D0 F4         		bne	?15
2086
 4492  F82FC8  85 18         	?17:	sta	ACM
2087
 4493  F82FCA                		ACC08
2088
 4494  F82FCA  E2 20         		sep	#PMFLAG
2089
 4495                        		.LONGA	off
2090
 4496                        		.MNLIST
2091
 4497  F82FCC  68            		pla			; digit hex
2092
 4498  F82FCD  05 18         		ora	ACM		; add digit
2093
 4499  F82FCF  85 18         		sta	ACM
2094
 4500  F82FD1  B0 17         		bcs	?24		; CF = 1, VF = 1 => overflow su 64 bit
2095
 4501  F82FD3  C8            		iny			; next char
2096
 4502  F82FD4  C0 7F         		cpy	#MAXINTSTR	; max. dimensione stringa hex/dec
2097
 4503  F82FD6  B0 04         		bcs	?20		; fine scansione
2098
 4504  F82FD8  B7 60         		lda	[FPLPtr],y	; load char
2099
 4505  F82FDA  D0 BC         		bne	?04		; loop
2100
 4506                        	?20:	; a questo punto scansione terminata o per fine stringa o per
2101
 4507                        		; primo carattere non hex all'indice attuale
2102
 4508  F82FDC  38            		sec			; assume CF = 1, VF = 0
2103
 4509  F82FDD  B8            		clv
2104
 4510  F82FDE  A5 63         		lda	FPFlag
2105
 4511  F82FE0  F0 0A         		beq	?25		; CF = 1 e VF = 0 => stringa vuota
2106
 4512                        					; o nessun digit hex valido
2107
 4513                        		; si testa se ACM contiene un numero
2108
 4514                        		; compatibile con la dimensione richiesta
2109
  Tue Jul 17 11:00:16 2018                                                                                               Page   35
2110
 
2111
 
2112
 
2113
 
2114
 4515  F82FE2  20 17 30      		jsr	_minsize	; X = minima dimensione - 1
2115
 4516  F82FE5  B8            		clv			; assume no overflow
2116
 4517  F82FE6  E4 20         		cpx	ACMSize		; 1,2,3,4,8 => CF = 1 se overflow
2117
 4518  F82FE8  90 02         		bcc	?25		; OK => CF = 0, VF = 0
2118
 4519  F82FEA  E2 40         	?24:	sep	#PVFLAG		; VF = 1 => overflow
2119
 4520  F82FEC  60            	?25:	rts			; CF = 1 se errore
2120
 4521  F82FED
2121
 4522                        	; routine di preparazione a conversione stringa -> intero
2122
 4523  F82FED                	_pres2i:
2123
 4524  F82FED  85 60         		sta	FPLPtr		; set long pointer
2124
 4525  F82FEF  EB            		xba
2125
 4526  F82FF0  85 61         		sta	FPLPtr+1
2126
 4527  F82FF2  84 62         		sty	FPLPtr+2
2127
 4528  F82FF4  8A            		txa
2128
 4529  F82FF5  29 7F         		and	#$7F		; maschera off tipo
2129
 4530  F82FF7  D0 01         		bne	?01
2130
 4531  F82FF9  1A            		inc	a		; minima dimensione: byte
2131
 4532  F82FFA  C9 05         	?01:	cmp	#$05
2132
 4533  F82FFC  90 02         		bcc	?02		; valori leciti: 1,2,3,4,8
2133
 4534  F82FFE  A9 08         		lda	#$08		; max. dimensione: 8 bytes
2134
 4535  F83000  85 20         	?02:	sta	ACMSize		; tipo intero richiesto
2135
 4536  F83002  8A            		txa
2136
 4537  F83003  29 80         		and	#$80		; bit 7: tipo signed
2137
 4538  F83005  4A            		lsr	a		; bit 6: tipo signed
2138
 4539  F83006  85 21         		sta	ACMSgn
2139
 4540  F83008                		ACC16			; azzera ACM
2140
 4541  F83008  C2 20         		rep	#PMFLAG
2141
 4542                        		.LONGA	on
2142
 4543                        		.MNLIST
2143
 4544  F8300A  64 18         		stz	ACM
2144
 4545  F8300C  64 1A         		stz	ACM+2
2145
 4546  F8300E  64 1C         		stz	ACM+4
2146
 4547  F83010  64 1E         		stz	ACM+6
2147
 4548  F83012                		ACC08
2148
 4549  F83012  E2 20         		sep	#PMFLAG
2149
 4550                        		.LONGA	off
2150
 4551                        		.MNLIST
2151
 4552  F83014  64 63         		stz	FPFlag		; flag conversione
2152
 4553  F83016  60            		rts
2153
 4554
2154
 4555                        	; calcola minima dimensione ACM
2155
 4556                        	; Out X = minima dimensione ACM - 1 (0,1,2,3,7)
2156
 4557  F83017                	_minsize:
2157
 4558  F83017                		ACC16
2158
 4559  F83017  C2 20         		rep	#PMFLAG
2159
 4560                        		.LONGA	on
2160
 4561                        		.MNLIST
2161
 4562  F83019  A2 07         		ldx	#$07		; si assume intero 64 bit
2162
 4563  F8301B  A5 1E         		lda	ACM+6
2163
 4564  F8301D  05 1C         		ora	ACM+4
2164
 4565  F8301F                		ACC08
2165
 4566  F8301F  E2 20         		sep	#PMFLAG
2166
 4567                        		.LONGA	off
2167
 4568                        		.MNLIST
2168
 4569  F83021  D0 11         		bne	?02		; X = 07 => intero 64 bit
2169
 4570  F83023  A2 03         		ldx	#$03
2170
 4571  F83025  A5 1B         		lda	ACM+3
2171
  Tue Jul 17 11:00:16 2018                                                                                               Page   36
2172
 
2173
 
2174
 
2175
 
2176
 4572  F83027  D0 0B         		bne	?02		; X = 03 => intero 32 bit
2177
 4573  F83029  CA            		dex
2178
 4574  F8302A  A5 1A         		lda	ACM+2
2179
 4575  F8302C  D0 06         		bne	?02		; X = 02 => intero 24 bit
2180
 4576  F8302E  CA            		dex
2181
 4577  F8302F  A5 19         		lda	ACM+1
2182
 4578  F83031  D0 01         		bne	?02		; X = 01 => intero 16 bit
2183
 4579  F83033  CA            		dex			; X = 00 => intero  8 bit
2184
 4580  F83034  60            	?02:	rts
2185
 4581  F83035
2186
 4582                        	; _iUMult10 - Moltiplica unsigned ACM (64 bit) x 10
2187
 4583                        	; In:	ACM -> unsigned integer 64 bit
2188
 4584                        	; Out:	ACM <- ACM * 10 (unsigned 64 bit)
2189
 4585                        	;	CF -> unsigned overflow flag
2190
 4586                        	; Uso:	A,X,ACM,FOP
2191
 4587  F83035                	_iUMult10:
2192
 4588  F83035  A2 07         		LDX	#INTGSIZE-1
2193
 4589  F83037  B5 18         	?01:	LDA	ACM,X		; copia ACM -> FOP
2194
 4590  F83039  95 32         		STA	FOP,X
2195
 4591  F8303B  CA            		DEX
2196
 4592  F8303C  10 F9         		BPL	?01
2197
 4593  F8303E  20 4D 30      		JSR	?10		; ACM * 2 -> ACM
2198
 4594  F83041  B0 16         		bcs	?22
2199
 4595  F83043  20 4D 30      		JSR	?10		; ACM * 4 -> ACM
2200
 4596  F83046  B0 11         		bcs	?22
2201
 4597  F83048  20 63 30      		JSR	_iUAdd64	; ACM * 5 -> ACM
2202
 4598  F8304B  B0 0C         		bcs	?22
2203
 4599                        					; ACM * 10 -> ACM
2204
 4600
2205
 4601                        	?10:	; moltiplica x 2
2206
 4602  F8304D                		ACC16
2207
 4603  F8304D  C2 20         		rep	#PMFLAG
2208
 4604                        		.LONGA	on
2209
 4605                        		.MNLIST
2210
 4606  F8304F  06 18         		ASL	ACM
2211
 4607  F83051  26 1A         		ROL	ACM+2
2212
 4608  F83053  26 1C         		ROL	ACM+4
2213
 4609  F83055  26 1E         		ROL	ACM+6
2214
 4610  F83057                	?20:	ACC08
2215
 4611  F83057  E2 20         		sep	#PMFLAG
2216
 4612                        		.LONGA	off
2217
 4613                        		.MNLIST
2218
 4614  F83059  60            	?22:	RTS			; CF = 1 => overflow
2219
 4615
2220
 4616                        	; _iUAdd8 - Somma unsigned ACM (64 bit) e Accmulatore (8 bit)
2221
 4617                        	; In:	ACM -> unsigned integer 64 bit
2222
 4618                        	;	A   -> unsigned byte
2223
 4619                        	; Out:	ACM <- ACM + A (unsigned 64 bit)
2224
 4620                        	;	CF = 1 +> overflow
2225
 4621                        	; Uso:	A,X,ACM,FOP
2226
 4622  F8305A                	_iUAdd8:
2227
 4623  F8305A                		LONG_OFF
2228
 4624                        		.LONGA	off
2229
 4625                        		.LONGI	off
2230
 4626                        		.MNLIST
2231
 4627  F8305A  A2 07         		LDX	#(INTGSIZE-1)	; azzera FOP+1..FOP+7
2232
 4628  F8305C  74 32         	?01:	STZ	FOP,X
2233
  Tue Jul 17 11:00:16 2018                                                                                               Page   37
2234
 
2235
 
2236
 
2237
 
2238
 4629  F8305E  CA            		DEX
2239
 4630  F8305F  D0 FB         		BNE	?01
2240
 4631  F83061  85 32         		STA	FOP		; byte in A
2241
 4632  F83063
2242
 4633                        	; _iUAdd64 - Somma unsigned ACM e FOP (64 bit)
2243
 4634                        	; In:	ACM -> unsigned integer 64 bit
2244
 4635                        	;	FOP -> unsigned integer 64 bit
2245
 4636                        	; Out:	ACM <- ACM + FOP  (unsigned 64 bit)
2246
 4637                        	;	CF = 1 => unsigned overflow
2247
 4638                        	;	VF = 1 +> signed overflow
2248
 4639                        	; Uso:	A,ACM,FOP
2249
 4640  F83063                	_iUAdd64:
2250
 4641  F83063  C2 21         		rep	#(PMFLAG+PCFLAG)	; ACC16 + CLC
2251
 4642  F83065  A5 18         		LDA	ACM
2252
 4643  F83067  65 32         		ADC	FOP
2253
 4644  F83069  85 18         		STA	ACM
2254
 4645  F8306B  A5 1A         		LDA	ACM+2
2255
 4646  F8306D  65 34         		ADC	FOP+2
2256
 4647  F8306F  85 1A         		STA	ACM+2
2257
 4648  F83071  A5 1C         		LDA	ACM+4
2258
 4649  F83073  65 36         		ADC	FOP+4
2259
 4650  F83075  85 1C         		STA	ACM+4
2260
 4651  F83077  A5 1E         		LDA	ACM+6
2261
 4652  F83079  65 38         		ADC	FOP+6
2262
 4653  F8307B  85 1E         		STA	ACM+6
2263
 4654  F8307D                		ACC08
2264
 4655  F8307D  E2 20         		sep	#PMFLAG
2265
 4656                        		.LONGA	off
2266
 4657                        		.MNLIST
2267
 4658  F8307F  60            		RTS
2268
 4659
2269
 4660                        	;----------------------------------------------------------
2270
 4661                        	; Conversioni Integer-Stringa (decimale / hex)
2271
 4662                        	;----------------------------------------------------------
2272
 4663  F83080
2273
 4664                        	; _Int2Str: converte numero intero in stringa decimale/hex
2274
 4665                        	; In	- ACM => intero max. 64 bit
2275
 4666                        	;	  ACMSize => dimensione intero (1, 2, 3, 4, 8 bytes)
2276
 4667                        	;	  ACMSgn => <7>:segno, <6>:tipo signed
2277
 4668                        	;	  X => precisione richiesta
2278
 4669                        	;	  A => flag conversione:
2279
 4670                        	;		<7> 1 => DEC, 0 => HEX
2280
 4671                        	;		<6> 0 => LOWCAPS, 1 => HICAPS (HEX only - <7> = 0)
2281
 4672                        	;		<6> 1 => group thousand       (DEC only - <7> = 1)
2282
 4673                        	;		<5> flag long pointer (forza hex a 6 digit)
2283
 4674                        	; 	  	<1> => blank se positivo (DEC signed only)
2284
 4675                        	; 	  	<0> => segno '+'/blank se positivo (DEC signed only)
2285
 4676                        	;	  DPR -> impostato a DP02ADDR
2286
 4677                        	;	  DBR -> impostato su banco 0
2287
 4678                        	;	  CPU -> 8 bit
2288
 4679                        	;
2289
 4680                        	; Out:	- X => puntatore stringa in pagina 02
2290
 4681                        	;	  A = Y => lunghezza stringa
2291
 4682  F83080                	_Int2Str:
2292
 4683  F83080  9B            		txy			; precisione minima = 1
2293
 4684  F83081  D0 01         		bne	?02
2294
 4685  F83083  E8            		inx
2295
  Tue Jul 17 11:00:16 2018                                                                                               Page   38
2296
 
2297
 
2298
 
2299
 
2300
 4686  F83084  E0 2E         	?02:	cpx	#XCVTMAXI	; max. numero char stringa integer
2301
 4687  F83086  90 02         		bcc	?03
2302
 4688  F83088  A2 2E         		ldx	#XCVTMAXI
2303
 4689  F8308A  89 20         	?03:	bit	#$20		; test long pointer
2304
 4690  F8308C  F0 08         		beq	?04		; standard integer (1,2,4,8)
2305
 4691  F8308E  A2 06         		ldx	#6		; precisione fissa a 6 digit
2306
 4692  F83090  A0 03         		ldy	#3		; dimensione long pointer = 3 bytes
2307
 4693  F83092  29 60         		and	#01100000B	; maschera off bit inutilizzati - forza HEX
2308
 4694  F83094  D0 07         		bne	?06
2309
 4695  F83096  A4 20         	?04:	ldy	ACMSize		; standard integer
2310
 4696  F83098  C0 03         		cpy	#3		; se size = 3 imposta size = 4
2311
 4697  F8309A  D0 01         		bne	?06
2312
 4698  F8309C  C8            		iny
2313
 4699  F8309D  86 0A         	?06:	stx	FmtPrec		; salva precisione
2314
 4700  F8309F  85 16         		sta	XVFlag		; salva flag
2315
 4701  F830A1  BB            		tyx			; minima dimensione = byte
2316
 4702  F830A2  D0 01         		bne	?07
2317
 4703  F830A4  C8            		iny
2318
 4704  F830A5  C0 05         	?07:	cpy	#5
2319
 4705  F830A7  90 02         		bcc	?08		; Y < 5 => OK (size = 1,2,3,4)
2320
 4706  F830A9  A0 08         		ldy	#8		; MAX: 8 bytes
2321
 4707  F830AB  84 20         	?08:	sty	ACMSize		; salva size corretta integer
2322
 4708  F830AD  AA            		tax			; test bit 7
2323
 4709  F830AE  30 36         		bmi	?20		; <7> = 1 => DEC
2324
 4710  F830B0
2325
 4711                        		; conversione in stringa HEX -- ignora ACMSgn
2326
 4712  F830B0  A2 06         		ldx	#$06		; valore da aggiungere per digit A..F
2327
 4713  F830B2  0A            		asl	a		; NF => HI CAPS, bit 6 => long ptr
2328
 4714  F830B3  85 16         		sta	XVFlag		; <6> => long pointer
2329
 4715  F830B5  30 02         		bmi	?10		; HI CAPS
2330
 4716  F830B7  A2 26         		ldx	#$26		; valore da aggiungere per digit a..f
2331
 4717  F830B9  86 24         	?10:	stx	FPTmp1
2332
 4718  F830BB  BB            		tyx
2333
 4719  F830BC  CA            		dex			; X = MSB integer (0,1,3,7)
2334
 4720  F830BD  A0 01         		LDY	#1		; indice stringa destinazione (FPUStr+1)
2335
 4721  F830BF  B5 18         	?12:	LDA	<ACM,X		; converte MSB
2336
 4722  F830C1  20 1E 32      		JSR	Byte2Hex	; A = nibble H
2337
 4723  F830C4  99 70 02      		STA	!DP02ADDR+FPUStr,Y
2338
 4724  F830C7  C8            		INY
2339
 4725  F830C8  EB            		xba			; nibble L
2340
 4726  F830C9  99 70 02      		STA	!DP02ADDR+FPUStr,Y
2341
 4727  F830CC  C8            		INY
2342
 4728  F830CD  CA            		DEX
2343
 4729  F830CE  10 EF         		BPL	?12
2344
 4730  F830D0  BB            		tyx
2345
 4731  F830D1  74 70         		stz	FPUStr,x	; terminatore #0 stringa
2346
 4732                        		; a questo punto la stringa HEX e' convertita in ACMSize * 2 digit
2347
 4733  F830D3  A2 71         		ldx	#FPUStr+1	; puntatore stringa pagina 02
2348
 4734  F830D5  24 16         		bit	XVFlag		; test long pointer ?
2349
 4735  F830D7  50 04         		bvc	?14		; no
2350
 4736                        		; long pointer => stringa completa a 6 digit
2351
 4737  F830D9  A4 0A         		ldy	FmtPrec
2352
 4738  F830DB  98            		tya			; A = Y = lunghezza stringa
2353
 4739  F830DC  60            		rts			; X = inizio stringa pagina 02
2354
 4740  F830DD  20 D8 31      	?14:	jsr	_Int2End	; A = len -- Y = first -- X = last
2355
 4741  F830E0  64 16         		stz	XVFlag		; per stringa HEX ignora restanti flag
2356
 4742  F830E2  64 21         		stz	ACMSgn		; HEX ignora segno
2357
  Tue Jul 17 11:00:16 2018                                                                                               Page   39
2358
 
2359
 
2360
 
2361
 
2362
 4743  F830E4  80 4A         		bra	?30		; padding finale
2363
 4744  F830E6
2364
 4745                        	?20:	; conversione in stringa decimale -- Y = size (1,2,4,8)
2365
 4746  F830E6  BB            		tyx
2366
 4747  F830E7  CA            		dex			; X = MSB integer (0,1,3,7)
2367
 4748  F830E8  A9 80         		lda	#$80		; clear segno
2368
 4749  F830EA  14 21         		trb	ACMSgn
2369
 4750  F830EC  24 21         		bit	ACMSgn		; signed ?
2370
 4751  F830EE  50 06         		bvc	?22		; NO
2371
 4752  F830F0  34 18         		bit	<ACM,x		; test segno
2372
 4753  F830F2  10 02         		bpl	?22		; positivo
2373
 4754  F830F4  04 21         		tsb	ACMSgn		; imposta segno negativo
2374
 4755  F830F6  C0 08         	?22:	cpy	#8
2375
 4756  F830F8  F0 16         		beq	?26		; non occorre estensione
2376
 4757  F830FA  84 24         		sty	FPTmp1		; calcola numero byte estensione
2377
 4758  F830FC  A9 08         		lda	#8
2378
 4759  F830FE  38            		sec
2379
 4760  F830FF  E5 24         		sbc	FPTmp1
2380
 4761  F83101  A8            		tay			; Y = numero di bytes da estendere (7,6,4)
2381
 4762  F83102  A9 00         		lda	#0		; estende con $00 se positivo/unsigned
2382
 4763  F83104  24 21         		bit	ACMSgn
2383
 4764  F83106  10 02         		bpl	?24		; positivo
2384
 4765  F83108  A9 FF         		lda	#$FF		; estende negativo
2385
 4766  F8310A  E8            	?24:	inx			; next byte da estendere
2386
 4767  F8310B  95 18         		sta	<ACM,x
2387
 4768  F8310D  88            		dey
2388
 4769  F8310E  D0 FA         		bne	?24
2389
 4770  F83110                	?26:	ACC16			; copia ACM in FOP (signed 64 bytes)
2390
 4771  F83110  C2 20         		rep	#PMFLAG
2391
 4772                        		.LONGA	on
2392
 4773                        		.MNLIST
2393
 4774  F83112  A5 18         		lda	ACM
2394
 4775  F83114  85 32         		sta	FOP
2395
 4776  F83116  A5 1A         		lda	ACM+2
2396
 4777  F83118  85 34         		sta	FOP+2
2397
 4778  F8311A  A5 1C         		lda	ACM+4
2398
 4779  F8311C  85 36         		sta	FOP+4
2399
 4780  F8311E  A5 1E         		lda	ACM+6
2400
 4781  F83120  85 38         		sta	FOP+6
2401
 4782  F83122                		ACC08
2402
 4783  F83122  E2 20         		sep	#PMFLAG
2403
 4784                        		.LONGA	off
2404
 4785                        		.MNLIST
2405
 4786  F83124  24 21         		bit	ACMSgn
2406
 4787  F83126  10 05         		bpl	?28		; positivo
2407
 4788  F83128  A2 32         		ldx	#FOP
2408
 4789  F8312A  20 40 2A      		jsr	_iNegX		; negativo => complementa a 2
2409
 4790  F8312D  20 6C 31      	?28:	jsr	_UI2Str		; converte in stringa decimale
2410
 4791
2411
 4792                        	?30:	; a questo punto la stringa convertita si trova in FPUStr+1
2412
 4793                        		; A = len -- Y = ptr al primo digit non '0' -- X = ptr last digit
2413
 4794  F83130  20 F9 31      		jsr	_thgroup	; copia in XCVTStr/group thousand
2414
 4795                        		; A = len -- Y = ptr first digit -- X = ptr last digit
2415
 4796  F83133  BB            		tyx			; X = puntatore stringa in pagina 02
2416
 4797  F83134  A8            		tay			; Y = lunghezza attuale stringa
2417
 4798  F83135  85 27         		sta	FPTmp4		; lunghezza attuale stringa
2418
 4799  F83137  A5 0A         		lda	FmtPrec		; precisione richiesta
2419
  Tue Jul 17 11:00:16 2018                                                                                               Page   40
2420
 
2421
 
2422
 
2423
 
2424
 4800  F83139  38            		sec
2425
 4801  F8313A  E5 27         		sbc	FPTmp4		; lunghezza padding
2426
 4802  F8313C  F0 0D         		beq	?50		; no padding
2427
 4803  F8313E  90 0B         		bcc	?50		; no padding
2428
 4804  F83140
2429
 4805                        		; padding della stringa con '0' iniziali
2430
 4806  F83140  A8            		tay			; counter padding
2431
 4807  F83141  A9 30         		lda	#'0'
2432
 4808  F83143  CA            	?32:	dex			; aggiorna ptr a digit precedente
2433
 4809  F83144  95 00         		sta	<0,x
2434
 4810  F83146  88            		dey
2435
 4811  F83147  D0 FA         		bne	?32
2436
 4812  F83149  A4 0A         		ldy	FmtPrec		; Y = lunghezza stringa
2437
 4813  F8314B
2438
 4814                        		; memorizza eventuale segno ('+', '-', o ' ')
2439
 4815                        		; X = ptr stringa -- Y = lunghezza stringa
2440
 4816  F8314B  24 21         	?50:	bit	ACMSgn		; signed ?
2441
 4817  F8314D  50 1B         		bvc	?60		; NO -- esce
2442
 4818  F8314F  10 04         		bpl	?52		; signed positivo
2443
 4819  F83151  A9 2D         		lda	#'-'		; signed negativo => store '-'
2444
 4820  F83153  D0 11         		bne	?56
2445
 4821  F83155  A5 16         	?52:	lda	XVFlag		; test store segno
2446
 4822  F83157  4A            		lsr	a		; CF -> flag segno positivo
2447
 4823  F83158  90 10         		bcc	?60		; no store segno se positivo
2448
 4824  F8315A  86 24         		stx	FPTmp1		; salva ptr stringa
2449
 4825  F8315C  A2 2B         		ldx	#'+'		; assume '+'
2450
 4826  F8315E  4A            		lsr	a		; CF -> flag blank
2451
 4827  F8315F  90 02         		bcc	?54		; store '+'
2452
 4828  F83161  A2 20         		ldx	#' '		; store blank
2453
 4829  F83163  8A            	?54:	txa			; A = segno
2454
 4830  F83164  A6 24         		ldx	FPTmp1		; X = ptr stringa
2455
 4831  F83166  CA            	?56:	dex			; ptr al segno
2456
 4832  F83167  95 00         		sta	<0,x
2457
 4833  F83169  C8            		iny			; incrementa lunghezza
2458
 4834  F8316A  98            	?60:	tya			; A = Y = lunghezza stringa
2459
 4835  F8316B  60            		rts			; X = puntatore stringa
2460
 4836
2461
 4837                        	; _UI2Str: converte intero senza segno in stringa decimale a 20 digits
2462
 4838                        	; In:	- FOP -> unsigned integer 64 bit
2463
 4839                        	;	  DPR -> impostato a DP02ADDR
2464
 4840                        	;	  CPU -> 8 bit
2465
 4841                        	;
2466
 4842                        	; Out:	- FPUStr+1 -> stringa decimale 20 cifre
2467
 4843                        	;	- A -> lunghezza stringa significativa (X - Y + 1)
2468
 4844                        	;	- Y -> ptr in pag02 al primo digit diverso ad '0'
2469
 4845                        	;	- X -> ptr in pag02 ultimo digit
2470
 4846                        	; NOTA	il numero intero viene esteso a 9 bytes e si applica il metodo
2471
 4847                        	;	delle sottrazioni ripetute per determinare ciascun digit
2472
 4848  F8316C                	_UI2Str:
2473
 4849  F8316C  A0 00         		LDY	#$00
2474
 4850  F8316E  84 3A         		STY	FOP+8		; MSB = 0 (9 bytes)
2475
 4851  F83170  84 25         		STY	FPTmp2		; indice stringa
2476
 4852  F83172  A2 15         		LDX	#(FPSTRSIZE - 1)
2477
 4853  F83174  74 70         	?01:	STZ	FPUStr,X	; clear stringa destinazione
2478
 4854  F83176  CA            		DEX
2479
 4855  F83177  10 FB         		BPL	?01
2480
 4856  F83179  BB            		TYX
2481
  Tue Jul 17 11:00:16 2018                                                                                               Page   41
2482
 
2483
 
2484
 
2485
 
2486
 4857  F8317A  8B            		phb			; imposta DBR al PBR corrente
2487
 4858  F8317B  4B            		phk			; per accedere alle costanti
2488
 4859  F8317C  AB            		plb
2489
 4860  F8317D  A0 80         		LDY	#$80		; contatore SBC
2490
 4861  F8317F  C2 21         	?02:	rep	#(PMFLAG.OR.PCFLAG)
2491
 4862                        		.LONGA	on		; ACC16 + CLC
2492
 4863  F83181  A5 32         		LDA	FOP		; divisione mediante sottrazioni ripetute
2493
 4864  F83183  7D D3 32      		ADC	!CONSTDECTBL,x
2494
 4865  F83186  85 32         		STA	FOP
2495
 4866  F83188  A5 34         		LDA	FOP+2
2496
 4867  F8318A  7D D5 32      		ADC	!CONSTDECTBL+2,x
2497
 4868  F8318D  85 34         		STA	FOP+2
2498
 4869  F8318F  A5 36         		LDA	FOP+4
2499
 4870  F83191  7D D7 32      		ADC	!CONSTDECTBL+4,x
2500
 4871  F83194  85 36         		STA	FOP+4
2501
 4872  F83196  A5 38         		LDA	FOP+6
2502
 4873  F83198  7D D9 32      		ADC	!CONSTDECTBL+6,x
2503
 4874  F8319B  85 38         		STA	FOP+6
2504
 4875  F8319D                		ACC08			; ripristina acc/mem 8 bit
2505
 4876  F8319D  E2 20         		sep	#PMFLAG
2506
 4877                        		.LONGA	off
2507
 4878                        		.MNLIST
2508
 4879  F8319F  A5 3A         		LDA	FOP+8
2509
 4880  F831A1  7D DB 32      		ADC	!CONSTDECTBL+8,x
2510
 4881  F831A4  85 3A         		STA	FOP+8
2511
 4882  F831A6  C8            		INY			; incrementa contatore SBC
2512
 4883  F831A7  B0 04         		BCS	?03		; nuova SBC se X < 0
2513
 4884  F831A9  10 D4         		BPL	?02		; resto >= 10, nuova SBC
2514
 4885  F831AB  30 02         		BMI	?04		; resto < 10 - store digit
2515
 4886  F831AD  30 D0         	?03:	BMI	?02		; nuova SBC se X < 0
2516
 4887  F831AF  98            	?04:	TYA			; fine SBC
2517
 4888  F831B0  90 04         		BCC	?05		; positivo
2518
 4889  F831B2  49 FF         		EOR	#$FF		; negativo
2519
 4890  F831B4  69 0A         		ADC	#10
2520
 4891  F831B6  69 2F         	?05:	ADC	#('0' - 1)	; digit
2521
 4892  F831B8  A8            		TAY
2522
 4893  F831B9  8A            		TXA
2523
 4894  F831BA  18            		CLC
2524
 4895  F831BB  69 09         		ADC	#DECTBLLEN	; indice tabella divisioni
2525
 4896  F831BD  85 24         		STA	FPTmp1
2526
 4897  F831BF  A6 25         		LDX	FPTmp2
2527
 4898  F831C1  E8            		INX
2528
 4899  F831C2  98            		TYA
2529
 4900  F831C3  29 7F         		AND	#$7F
2530
 4901  F831C5  95 70         		STA	FPUStr,x	; salva digit
2531
 4902  F831C7  86 25         	?06:	STX	FPTmp2		; indice stringa
2532
 4903  F831C9  A6 24         		LDX	FPTmp1
2533
 4904  F831CB  98            		TYA
2534
 4905  F831CC  49 FF         		EOR	#$FF		; inverte contatore SBC
2535
 4906  F831CE  29 80         		AND	#$80
2536
 4907  F831D0  A8            		TAY
2537
 4908  F831D1  E0 B4         		CPX	#DECTBLSIZE
2538
 4909  F831D3  D0 AA         		BNE	?02		; ricava digit successivo
2539
 4910  F831D5  AB            		plb			; ripristina DBR
2540
 4911  F831D6  A2 71         		LDX	#FPUStr+1	; posiziona puntatori start-end
2541
 4912  F831D8
2542
 4913  F831D8                	_Int2End:
2543
  Tue Jul 17 11:00:16 2018                                                                                               Page   42
2544
 
2545
 
2546
 
2547
 
2548
 4914                        		; posiziona X sulla prima cifra diversa da '0'
2549
 4915                        		; la stringa e' terminata sicuramente con #0
2550
 4916  F831D8  86 25         		stx	FPTmp2
2551
 4917  F831DA  B5 00         	?10:	LDA	<0,X		; start stringa
2552
 4918  F831DC  F0 07         		beq	?11		; fine
2553
 4919  F831DE  C9 30         		CMP	#'0'
2554
 4920  F831E0  D0 04         		BNE	?12		; primo digit non '0'
2555
 4921  F831E2  E8            		INX
2556
 4922  F831E3  D0 F5         		bne	?10		; loop
2557
 4923  F831E5  CA            	?11:	DEX			; ultimo digit
2558
 4924  F831E6  9B            	?12:	txy			; Y = indice primo digit significativo
2559
 4925  F831E7  A6 25         		ldx	FPTmp2
2560
 4926  F831E9  B5 00         	?13:	lda	<0,x		; si posiziona su ultimo digit
2561
 4927  F831EB  F0 03         		beq	?14
2562
 4928  F831ED  E8            		inx
2563
 4929  F831EE  D0 F9         		bne	?13
2564
 4930  F831F0  CA            	?14:	dex			; X = last digit
2565
 4931  F831F1  8A            		txa
2566
 4932  F831F2  84 24         		sty	FPTmp1
2567
 4933  F831F4  38            		sec
2568
 4934  F831F5  E5 24         		sbc	FPTmp1
2569
 4935  F831F7  1A            		inc	a		; A = lunghezza stringa significativa
2570
 4936  F831F8  60            		rts
2571
 4937
2572
 4938                        	; formatta stringa minima raggruppando le migliaia
2573
 4939                        	; i digit vengono spostati verso la fine di XCVTStr
2574
 4940  F831F9                	_thgroup:
2575
 4941  F831F9  84 24         		sty	FPTmp1		; indice primo digit significativo
2576
 4942  F831FB  9B            		txy			; Y => ptr ultimo digit
2577
 4943  F831FC  A2 B5         		ldx	#XCVTStrEnd
2578
 4944  F831FE  74 00         		stz	<0,x		; terminatore #0
2579
 4945  F83200  CA            		dex			; indice ultimo digit
2580
 4946  F83201  A9 03         	?02:	lda	#3		; counter gruppi digits
2581
 4947  F83203  EB            	?04:	xba			; B = counter
2582
 4948  F83204  B9 00 02      		lda	!DP02ADDR,y
2583
 4949  F83207  95 00         		sta	<0,x		; copia digit
2584
 4950  F83209  EB            		xba			; A = counter
2585
 4951  F8320A  88            		dey
2586
 4952  F8320B  C4 24         		cpy	FPTmp1
2587
 4953  F8320D  90 C9         		bcc	_Int2End	; fine loop
2588
 4954  F8320F  CA            		dex
2589
 4955  F83210  3A            		dec	a
2590
 4956  F83211  D0 F0         		bne	?04
2591
 4957  F83213  24 16         		bit	XVFlag		; test group thousand
2592
 4958  F83215  50 EA         		bvc	?02		; no group -- loop
2593
 4959  F83217  A9 2C         		lda	#','		; separatore migliaia
2594
 4960  F83219  95 00         		sta	<0,x
2595
 4961  F8321B  CA            		dex
2596
 4962  F8321C  80 E3         		bra	?02		; loop
2597
 4963
2598
 4964                        	; Byte2Hex: converte byte in digit HEX
2599
 4965                        	; In:	- A = byte
2600
 4966                        	;	  FPTmp1 -> valore da aggiungere per digit a..f/A..F
2601
 4967                        	;
2602
 4968                        	; Out:	- BA - Digit HEX (A->H, B->L)
2603
 4969  F8321E                	Byte2Hex:
2604
 4970  F8321E  48            		pha		; salva byte
2605
  Tue Jul 17 11:00:16 2018                                                                                               Page   43
2606
 
2607
 
2608
 
2609
 
2610
 4971  F8321F  20 28 32      		JSR	?01	; converte digit L
2611
 4972  F83222  EB            		xba		; B -> Digit L
2612
 4973  F83223  68            		pla		; ripristina byte
2613
 4974  F83224  4A            		LSR	A	; A/16 -> A
2614
 4975  F83225  4A            		LSR	A
2615
 4976  F83226  4A            		LSR	A
2616
 4977  F83227  4A            		LSR	A
2617
 4978  F83228  29 0F         	?01:	AND	#$0F	; maschera nibble L
2618
 4979  F8322A  C9 0A         		CMP	#10
2619
 4980  F8322C  90 02         		BCC	?02
2620
 4981  F8322E  65 24         		ADC	FPTmp1
2621
 4982  F83230  69 30         	?02:	ADC	#'0'
2622
 4983  F83232  60            		RTS
2623
 4984
2624
 4985                        	; long fast unsigned division 16 bit
2625
 4986                        	;
2626
 4987                        	;	entry:	C = dividend 16 bit
2627
 4988                        	;		X = divisor low
2628
 4989                        	;		Y = divisor high
2629
 4990                        	;
2630
 4991                        	;	exit:	C = quotient
2631
 4992                        	;		X = remainder low
2632
 4993                        	;		Y = remainder high
2633
 4994                        	;
2634
 4995                        	;	use:	all
2635
 4996                        	;
2636
 4997                        	;	note:	no check for null divisor
2637
 4998                        	;		long subroutine (call with jsl)
2638
 4999                        	;
2639
 5000          0000B6        	dvend	.EQU	DUMMY100
2640
 5001          0000B8        	dvsor	.EQU	DUMMY100+2
2641
 5002  F83233                	fidiv:
2642
 5003  F83233  0B            		phd			; save dp
2643
 5004  F83234  F4 00 02      		pea	#P0MAT
2644
 5005  F83237  2B            		pld			; set dp
2645
 5006  F83238  86 B8         		stx	dvsor		; set divisor
2646
 5007  F8323A  84 B9         		sty	dvsor+1
2647
 5008  F8323C  A2 10         		ldx	#16		; bit counter
2648
 5009  F8323E  A0 00         		ldy	#0		; partial remainder
2649
 5010  F83240                		CPU16
2650
 5011  F83240  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2651
 5012                        		.LONGA	on
2652
 5013                        		.LONGI	on
2653
 5014                        		.MNLIST
2654
 5015  F83242  85 B6         		sta	dvend		; set dividend
2655
 5016  F83244  98            		tya			; C=remainder
2656
 5017  F83245  26 B6         	?10:	rol	dvend		; partial quotient
2657
 5018  F83247  2A            		rol	a
2658
 5019  F83248  38            		sec
2659
 5020  F83249  A8            		tay			; save remainder
2660
 5021  F8324A  E5 B8         		sbc	dvsor
2661
 5022  F8324C  B0 01         		bcs	?20		; ok
2662
 5023  F8324E  98            		tya			; restore old remainder
2663
 5024  F8324F  CA            	?20:	dex
2664
 5025  F83250  D0 F3         		bne	?10		; loop
2665
 5026  F83252  26 B6         		rol	dvend		; adjust final quotient
2666
 5027  F83254  85 B8         		sta	dvsor		; save remainder
2667
  Tue Jul 17 11:00:16 2018                                                                                               Page   44
2668
 
2669
 
2670
 
2671
 
2672
 5028  F83256  A5 B6         		lda	dvend		; C=quotient
2673
 5029  F83258                		CPU08
2674
 5030  F83258  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2675
 5031                        		.LONGA	off
2676
 5032                        		.LONGI	off
2677
 5033                        		.MNLIST
2678
 5034  F8325A  A6 B8         		ldx	dvsor		; X=remainder low
2679
 5035  F8325C  A4 B9         		ldy	dvsor+1		; Y=remainder high
2680
 5036  F8325E  2B            		pld			; restore dp
2681
 5037  F8325F  6B            		rtl
2682
 5038
2683
 5039                        	; long fast unsigned division 16 bit
2684
 5040                        	;
2685
 5041                        	;	entry:	C = dividend 16 bit
2686
 5042                        	;		X = divisor low
2687
 5043                        	;		Y = divisor high
2688
 5044                        	;
2689
 5045                        	;	exit:	C = quotient
2690
 5046                        	;		X = remainder low
2691
 5047                        	;		Y = remainder high
2692
 5048                        	;
2693
 5049                        	;	use:	all
2694
 5050                        	;
2695
 5051                        	;	note:	no check for null divisor
2696
 5052                        	;		long subroutine (call with jsl)
2697
 5053                        	;
2698
 5054                        	;dvsor	.EQU	DUMMY100
2699
 5055          0000B6        	quot	.EQU	DUMMY100
2700
 5056  F83260                	fidiv2:
2701
 5057  F83260  0B            		phd			; save dp
2702
 5058  F83261  F4 00 02      		pea	#P0MAT
2703
 5059  F83264  2B            		pld			; set dp
2704
 5060  F83265  86 B8         		stx	dvsor		; set divisor
2705
 5061  F83267  84 B9         		sty	dvsor+1
2706
 5062  F83269  A2 01         		ldx	#1		; bit counter
2707
 5063  F8326B                		CPU16
2708
 5064  F8326B  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2709
 5065                        		.LONGA	on
2710
 5066                        		.LONGI	on
2711
 5067                        		.MNLIST
2712
 5068  F8326D  A8            		tay			; Y=dividend
2713
 5069  F8326E  64 B6         		stz	quot		; init quotient
2714
 5070  F83270  A5 B8         		lda	dvsor		; C=divisor
2715
 5071  F83272  0A            	?10:	asl	a		; shift divisor: get leftmost bit
2716
 5072  F83273  B0 06         		bcs	?20		; go to division
2717
 5073  F83275  E8            		inx
2718
 5074  F83276  E0 11 00      		cpx	#17		; test all divisor bit's
2719
 5075  F83279  D0 F7         		bne	?10
2720
 5076  F8327B  6A            	?20:	ror	a		; put shifted-out bit back
2721
 5077  F8327C  85 B8         		sta	dvsor
2722
 5078  F8327E  98            	?30:	tya			; get dividend
2723
 5079  F8327F  38            		sec
2724
 5080  F83280  E5 B8         		sbc	dvsor
2725
 5081  F83282  90 01         		bcc	?40		; can't subctract, retain old dividend
2726
 5082  F83284  A8            		tay			; Y=new dividend
2727
 5083  F83285  26 B6         	?40:	rol	quot		; shift carry into quotient (1 if division)
2728
 5084  F83287  46 B8         		lsr	dvsor		; shift right divisor for next subtract
2729
  Tue Jul 17 11:00:16 2018                                                                                               Page   45
2730
 
2731
 
2732
 
2733
 
2734
 5085  F83289  CA            		dex
2735
 5086  F8328A  D0 F2         		bne	?30
2736
 5087  F8328C  84 B8         		sty	dvsor		; store remainder
2737
 5088  F8328E  A5 B6         		lda	quot		; C=quotient
2738
 5089  F83290                		CPU08
2739
 5090  F83290  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2740
 5091                        		.LONGA	off
2741
 5092                        		.LONGI	off
2742
 5093                        		.MNLIST
2743
 5094  F83292  A6 B8         		ldx	dvsor		; X=remainder low
2744
 5095  F83294  A4 B9         		ldy	dvsor+1		; Y=remainder high
2745
 5096  F83296  2B            		pld			; restore dp
2746
 5097  F83297  6B            		rtl
2747
 5098
2748
 5099                        	; long fast unsigned multiplication 16 bit
2749
 5100                        	;
2750
 5101                        	;	entry:	C = multiplicand 1 16 bit
2751
 5102                        	;		X = multiplicand 2 low byte
2752
 5103                        	;		Y = multiplicand 2 high byte
2753
 5104                        	;
2754
 5105                        	;	exit:	C = result
2755
 5106                        	;		Y = result low byte
2756
 5107                        	;
2757
 5108                        	;	use:	all
2758
 5109                        	;
2759
 5110                        	;	note:	16 bit result only, no overflow detected
2760
 5111                        	;		long subroutine (call with jsl)
2761
 5112                        	;
2762
 5113          0000B6        	mcand2	.EQU	DUMMY100
2763
 5114  F83298                	fimlt:
2764
 5115  F83298  0B            		phd			; save dp
2765
 5116  F83299  F4 00 02      		pea	#P0MAT
2766
 5117  F8329C  2B            		pld			; set dp
2767
 5118  F8329D  86 B6         		stx	mcand2
2768
 5119  F8329F  84 B7         		sty	mcand2+1
2769
 5120  F832A1  A0 00         		ldy	#0		; partial result
2770
 5121  F832A3                		CPU16
2771
 5122  F832A3  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2772
 5123                        		.LONGA	on
2773
 5124                        		.LONGI	on
2774
 5125                        		.MNLIST
2775
 5126  F832A5  AA            	?10:	tax			; if mcand1 = 0...
2776
 5127  F832A6  F0 0E         		beq	?30		; ...done
2777
 5128  F832A8  4A            		lsr	a		; get right bit
2778
 5129  F832A9  90 07         		bcc	?20		; if clear, no addition to partial result...
2779
 5130  F832AB  18            		clc
2780
 5131  F832AC  AA            		tax
2781
 5132  F832AD  98            		tya			; ...else add mcand2 to partial result
2782
 5133  F832AE  65 B6         		adc	mcand2
2783
 5134  F832B0  A8            		tay			; Y=partial result
2784
 5135  F832B1  8A            		txa
2785
 5136  F832B2  06 B6         	?20:	asl	mcand2		; shift mcand2 for next time
2786
 5137  F832B4  80 EF         		bra	?10
2787
 5138  F832B6  98            	?30:	tya			; C=result
2788
 5139  F832B7                		CPU08
2789
 5140  F832B7  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2790
 5141                        		.LONGA	off
2791
  Tue Jul 17 11:00:16 2018                                                                                               Page   46
2792
 
2793
 
2794
 
2795
 
2796
 5142                        		.LONGI	off
2797
 5143                        		.MNLIST
2798
 5144  F832B9  2B            		pld			; restore dp
2799
 5145  F832BA  6B            		rtl
2800
 5146
2801
 5147  F832BB                	test1:
2802
 5148  F832BB  22 33 32 F8   		jsl	fidiv
2803
 5149  F832BF  00 00         		brk
2804
 5150  F832C1  00 00         		brk
2805
 5151  F832C3
2806
 5152  F832C3                	test3:
2807
 5153  F832C3  22 98 32 F8   		jsl	fimlt
2808
 5154  F832C7  00 00         		brk
2809
 5155  F832C9  00 00         		brk
2810
 5156
2811
 5157  F832CB                	test2:
2812
 5158  F832CB  22 60 32 F8   		jsl	fidiv2
2813
 5159  F832CF  00 00         		brk
2814
 5160  F832D1  00 00         		brk
2815
 5161  F832D3
2816
 5162                        	;----------------------------------------------------------------------------
2817
 5163                        	; COSTANTI
2818
 5164                        	;----------------------------------------------------------------------------
2819
 5165  F832D3
2820
 5166                        	; Tabella potenze di 10 in ordine decrescente da -1E19 a 1E00,
2821
 5167                        	; con segni alterni, a 9 bytes
2822
 5168  F832D3                	CONSTDECTBL:
2823
 5169  F832D3  00 00 18 76 FB 		.DB	$00, $00, $18, $76, $FB, $DC, $38, $75, $FF	; -1E19
2824
               DC 38 75 FF
2825
 5170  F832DC                	CONSTDECTBL1:
2826
 5171  F832DC  00 00 64 A7 B3 		.DB	$00, $00, $64, $A7, $B3, $B6, $E0, $0D, $00	; +1E18
2827
               B6 E0 0D 00
2828
 5172  F832E5  00 00 76 A2 87 		.DB	$00, $00, $76, $A2, $87, $BA, $9C, $FE, $FF	; -1E17
2829
               BA 9C FE FF
2830
 5173  F832EE  00 00 C1 6F F2 		.DB	$00, $00, $C1, $6F, $F2, $86, $23, $00, $00	; +1E16
2831
               86 23 00 00
2832
 5174  F832F7  00 80 39 5B 81 		.DB	$00, $80, $39, $5B, $81, $72, $FC, $FF, $FF	; -1E15
2833
               72 FC FF FF
2834
 5175  F83300  00 40 7A 10 F3 		.DB	$00, $40, $7A, $10, $F3, $5A, $00, $00, $00	; +1E14
2835
               5A 00 00 00
2836
 5176  F83309  00 60 8D B1 E7 		.DB	$00, $60, $8D, $B1, $E7, $F6, $FF, $FF, $FF	; -1E13
2837
               F6 FF FF FF
2838
 5177  F83312  00 10 A5 D4 E8 		.DB	$00, $10, $A5, $D4, $E8, $00, $00, $00, $00	; +1E12
2839
               00 00 00 00
2840
 5178  F8331B  00 18 89 B7 E8 		.DB	$00, $18, $89, $B7, $E8, $FF, $FF, $FF, $FF	; -1E11
2841
               FF FF FF FF
2842
 5179  F83324  00 E4 0B 54 02 		.DB	$00, $E4, $0B, $54, $02, $00, $00, $00, $00	; +1E10
2843
               00 00 00 00
2844
 5180  F8332D  00 36 65 C4 FF 		.DB	$00, $36, $65, $C4, $FF, $FF, $FF, $FF, $FF	; -1E9
2845
               FF FF FF FF
2846
 5181  F83336  00 E1 F5 05 00 		.DB	$00, $E1, $F5, $05, $00, $00, $00, $00, $00	; +1E8
2847
               00 00 00 00
2848
 5182  F8333F  80 69 67 FF FF 		.DB	$80, $69, $67, $FF, $FF, $FF, $FF, $FF, $FF	; -1E7
2849
               FF FF FF FF
2850
 5183  F83348  40 42 0F 00 00 		.DB	$40, $42, $0F, $00, $00, $00, $00, $00, $00	; +1E6
2851
               00 00 00 00
2852
 5184  F83351  60 79 FE FF FF 		.DB	$60, $79, $FE, $FF, $FF, $FF, $FF, $FF, $FF	; -1E5
2853
  Tue Jul 17 11:00:16 2018                                                                                               Page   47
2854
 
2855
 
2856
 
2857
 
2858
               FF FF FF FF
2859
 5185  F8335A  10 27 00 00 00 		.DB	$10, $27, $00, $00, $00, $00, $00, $00, $00	; +1E4
2860
               00 00 00 00
2861
 5186  F83363  18 FC FF FF FF 		.DB	$18, $FC, $FF, $FF, $FF, $FF, $FF, $FF, $FF	; -1E3
2862
               FF FF FF FF
2863
 5187  F8336C  64 00 00 00 00 		.DB	$64, $00, $00, $00, $00, $00, $00, $00, $00	; +1E2
2864
               00 00 00 00
2865
 5188  F83375  F6 FF FF FF FF 		.DB	$F6, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF	; -1E1
2866
               FF FF FF FF
2867
 5189  F8337E  01 00 00 00 00 		.DB	$01, $00, $00, $00, $00, $00, $00, $00, $00	; +1E0
2868
               00 00 00 00
2869
 5190
2870
 5191          0000B4        	DECTBLSIZE:	.EQU ($ - CONSTDECTBL)
2871
 5192          000009        	DECTBLLEN:	.EQU (CONSTDECTBL1 - CONSTDECTBL)
2872
 
2873
 
2874
             Lines Assembled : 4879                  Errors : 0
2875
 
2876
 
2877