Subversion Repositories MB01 Project

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 - 1
  Tue Jul 17 11:00:24 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\FF\monitor.asm
13
                       Output Filename : obj\FF\monitor.obj
14
                       Listing Has Been Relocated
15
 
16
 
17
 2593                        	.LIST		on
18
 2594
19
 2595  F8FFB1                		.INCLUDE inc\dirp00.inc
20
 2596                        	;----------------------------------------------------------
21
 2597                        	; DIRP00.ASM
22
 2598                        	; PROGETTO: B1601
23
 2599                        	;
24
 2600                        	; Variabili in Direct Page $00
25
 2601                        	;----------------------------------------------------------
26
 2602
27
 2603                        	; sezione COMMON -- questo permette di includere il file in piu' file
28
 2604
29
 2605                        	.LIST on
30
 2606
31
 2607                        	DIRP00:	.SECTION page0, ref_only, common	;Direct-Page 00
32
 2608
33
 2609  000000                		.ABSOLUTE		;; inizia sempre da $00
34
 2610  000000                		.ORG		0x00
35
 2611  000000
36
 2612  000000  0000          	JiffyClk	.DW			; contatore 10ms 32 bit
37
 2613  000002  0000          			.DW
38
 2614  000004                	SysTmr		.DS	SYSTMRCNT	; system timer 0 (10ms)
39
 2615  000008                	SysTMF		.DS	SYSTMRCNT	; flag timer (80 -> start)
40
 2616  00000C  00            	Bnk0Flag	.DB			; <7>: flag test RAM banco 0 ok
41
 2617                        						; <6>: flag warm reset
42
 2618  00000D  00            	RTCFlag		.DB
43
 2619
44
 2620  00000E                	diskstat	.DS	2	; flag device on ata bus #0 & #1
45
 2621                        					; <7>: device ready
46
 2622                        					; <6>: compact flash device (C.F.)
47
 2623                        					; <5>: device identification ok
48
 2624                        					; <4>: MBR loaded
49
 2625                        					; <3>: valid signature in MBR
50
 2626                        					; <2>: first partition found&active
51
 2627                        					; <1>:
52
 2628                        					; <0>: valid partition flag
53
 2629
54
 2630                        					; <7>: device ready
55
 2631                        					; <6>: USB device
56
 2632                        					; <5>: compact flash device (C.F.)
57
 2633                        					; <4>: device identification ok
58
 2634                        					; <3>: MBR loaded
59
 2635                        					; <2>: first partition found&active
60
 2636                        					; <1>: always 1
61
 2637                        					; <0>: valid partition flag
62
 2638  000010
63
  Tue Jul 17 11:00:24 2018                                                                                               Page    2
64
 
65
 
66
 
67
 
68
 2639
69
 2640          00000E        	atadev		.EQU	diskstat
70
 2641
71
 2642  000010                	usbdev		.DS	2	; flag flash disk on usb bus #0
72
 2643                        					; <7>: device plugged and ready
73
 2644                        					; <6>: always 1
74
 2645                        					; <5>: device identification ok
75
 2646                        					; <4>: MBR loaded
76
 2647                        					; <3>: valid signature in MBR
77
 2648                        					; <2>: first partition found&active
78
 2649                        					; <1>:
79
 2650                        					; <0>: valid partition flag
80
 2651
81
 2652  000012                	diskmax		.DS	16	; disk max. sector's
82
 2653          000012        	atasec		.EQU	diskmax
83
 2654          00001A        	usbsec		.EQU	diskmax+8
84
 2655
85
 2656
86
 2657  000022                	atambr		.DS	8	; data for first partition found in mbr
87
 2658                        					; first 3 bytes for start sector of partition
88
 2659                        					; last byte for partition type
89
 2660  00002A                	usbmbr		.DS	8
90
 2661
91
 2662  000032                	ataprt		.DS	8	; total sec's of first partition
92
 2663  00003A                	usbprt		.DS	8	; total sec's of first partition
93
 2664
94
 2665
95
 2666  000042  00            	usb0ch		.DB	; usb0 (ch375/ch376) flag
96
 2667                        				; <7>: module on
97
 2668                        				; <6>: ch376 flag
98
 2669                        				; <5:0>: chip version
99
 2670
100
 2671  000043  00            	usb0st		.DB	; usb0 status
101
 2672                        				; <7>: usb0 host mode ok
102
 2673                        				; <6>: flash disk attached flag
103
 2674                        				; <5>: usb device attached
104
 2675
105
 2676  000044  00            	fdcdrv		.DB		; phisycal drive status (drive #0)
106
 2677                        					; <7>: disk format established in bit 0&1
107
 2678                        					; <6>: double step seek done
108
 2679                        					; <5>: trust format bit's (set after ok r/w)
109
 2680                        					; <4>: write protect bit (if disk in drive)
110
 2681                        					; <3>: don't care
111
 2682                        					; <2>: don't care
112
 2683                        					; <1>: HD disk if set else DD disk
113
 2684                        					; <0>: CBM format if set else IBM format
114
 2685
115
 2686  000045  00            	vdrive		.DB		; virtual drive status (ram disk, drive #1)
116
 2687                        					; <7>: disk format established in bit 0&1
117
 2688                        					; <6>: change disk simulation (after format)
118
 2689                        					; <5>: don't care
119
 2690                        					; <4>: write protect bit (under sw control)
120
 2691                        					; <3>: don't care
121
 2692                        					; <2>: don't care
122
 2693                        					; <1>: HD disk if set else DD disk
123
 2694                        					; <0>: CBM format if set else IBM format
124
 2695
125
  Tue Jul 17 11:00:24 2018                                                                                               Page    3
126
 
127
 
128
 
129
 
130
 2696  000046  00            	fdcctl		.DB		; fdc controller status
131
 2697                        					; <7>: drive is attached
132
 2698                        					; <6>: drive need recalibration (restore)
133
 2699                        					; <5>: FDC controller ok
134
 2700                        					; <4>: motor on
135
 2701                        					; <3>: dma is active
136
 2702                        					; <2>: dma chip ok (post routine)
137
 2703                        					; <1>: clock rate (1=HD,0=DD)
138
 2704                        					; <0>: disk ready
139
 2705
140
 2706  000047  00            	fdctrk		.DB		; fd: current seek track
141
 2707  000048  00            	fdcerr		.DB		; fd: last error code
142
 2708  000049  00            	ataerr		.DB		; ata: last error code
143
 2709  00004A  00            	ataxer		.DB		; ata: last extended error code
144
 2710
145
 2711  00004B  00            	CtrlBrk		.DB		; flag CTRL+BREAK (NMI)
146
 2712
147
 2713  00004C  0000          	MemTop		.DW		; top memoria RAM
148
 2714  00004E  00            			.DB		; banco top mem
149
 2715
150
 2716  00004F  00            	DflTxtIn	.DB		; device di default text input
151
 2717  000050  00            	DflTxtOut	.DB		; device di default text output
152
 2718
153
 2719  000051                	COPPtr		LP		; long pointer for COP decoding
154
 2720  000054  00            	COPIdx		.DB		; COP signature/index
155
 2721
156
 2722  000055  00            	BiosEnt		.DB		; flag accesso a bios setup
157
 2723
158
 2724                        	; variabili utilizzate da ACIA
159
 2725  000056                	spwrk		.DS	$30
160
 2726
161
 2727                        	; bios mem
162
 2728  000086  0000          	nsize		.DW	; dimensione blocco da allocare
163
 2729                        	;bsize		.DW	; dimensione vera blocco free
164
 2730  000088  0000          	splitsz		.DW	; dimensione blocco splittato
165
 2731  00008A  0000          	bfree		.DW	; puntatore blocco free
166
 2732  00008C  0000          	hdrptr		.DW	; puntatore header heap
167
 2733
168
 2734  00008E  0000          	pbrklv		.DW	; current break level of current process
169
 2735  000090  0000          	pbrkmin		.DW	; minimum breal level of current process
170
 2736  000092  0000          	pbrkmax		.DW	; maximum breal level of current process
171
 2737  000094
172
 2738                        	; bios temp. work area
173
 2739  000094                	bwrktmp		.DS	$28
174
 2740
175
 2741  0000BC  00            	coptmp		.DB	; temp. used while cop
176
 2742
177
 2743  0000BD  00            	tstser		.DB	; check ser/usb test board post
178
 2744                        				; <7>: VIA2 ok
179
 2745                        				; <6>: PICRAM ok
180
 2746                        				; <1>: UART 16C550 ok
181
 2747                        				; <0>: R65C51 ok
182
 2748
183
 2749
184
 2750                        	;crc16		.DW
185
 2751
186
 2752  0000BD                		.RELATIVE
187
  Tue Jul 17 11:00:24 2018                                                                                               Page    4
188
 
189
 
190
 
191
 
192
 2753
193
 2754                        		.ENDS
194
 2755
195
 2756          [01]          	.IFDEF		_ACIA_INC_
196
 2757                        		.INCLUDE INC\SP.INC
197
 2758          [00]          	.ENDIF
198
 2759
199
 2773                        	.LIST on
200
 2774
201
 2775          000060        	KBDBUFLEN	.EQU	96		; dimensione buffer di tastiera
202
 2776
203
 2777                        	DIRP01:	.SECTION page0, ref_only, common	;Direct-Page 01
204
 2778
205
 2779  000000                		.ABSOLUTE		;; inizia sempre da $00
206
 2780  000000                		.ORG		0x00
207
 2781
208
 2782  000000
209
 2783  000000                	KbdBuf		.DS	KBDBUFLEN	; buffer della tastiera
210
 2784  000060  00            	KbdITail	.DB			; coda buffer tastiera
211
 2785  000061  00            	KbdIHead	.DB			; testa buffer tastiera
212
 2786  000062  00            	KbdCnt		.DB			; numero bytes nel buffer
213
 2787  000063  00            	KbdShift	.DB
214
 2788  000064  00            	KbdFlag		.DB
215
 2789  000065  00            	KbdToggle	.DB
216
 2790  000066  00            	KbdSt		.DB			; status tastiera dopo reset
217
 2791  000067  00            	PS2Ctl		.DB			; flag controller PS2 keyboard
218
 2792
219
 2793  000068  00            	LCDFlag		.DB
220
 2794  000069  00            	LCDTmp		.DB
221
 2795  00006A  0000          	LCDVal		.DW
222
 2796
223
 2797  00006C  00            	VBBFlag		.DB		; flag video board
224
 2798  00006D  00            	VBBRam		.DB		; flag video RAM
225
 2799
226
 2800  00006E  00            	ScnLinTmp	.DB
227
 2801  00006F  00            	ScnChBase	.DB		; base video ram VDC
228
 2802  000070  00            	ScnAttBase	.DB		; base ram attributi VDC
229
 2803  000071  00            	ScnCursMode	.DB		; VDC cursore default
230
 2804  000072  00            	ScnSaveAttr	.DB
231
 2805  000073  00            	ScnInsert	.DB
232
 2806  000074  00            	ScnAutoIns	.DB		; bit 7 -> autoins - bit 6 -> modo input
233
 2807  000075  00            	ScnScroll	.DB
234
 2808  000076  00            	ScnMaxRow	.DB		; max. righe finestra (-1)
235
 2809  000077  00            	ScnMaxCols	.DB		; max. colonne finestra (-1)
236
 2810
237
 2811  000078                	ScnMapTabs1	.DS	10
238
 2812  000082                	ScnMapTabs2	.DS	4
239
 2813  000086
240
 2814  000086  0000          	ScnPtr		.DW		; puntatore video ram linea corrente
241
 2815  000088  00            			.DB
242
 2816
243
 2817  000089  00            	ScnFiltLen	.DB		; lunghezza set caratteri filtro
244
 2818
245
 2819  00008A  0000          	ScnAtPtr	.DW		; puntatore attributi ram linea corrente
246
 2820  00008C  00            			.DB
247
 2821
248
 2822  00008D  00            	ScnTmpx		.DB		; temporaneo: durante put char
249
  Tue Jul 17 11:00:24 2018                                                                                               Page    5
250
 
251
 
252
 
253
 
254
 2823  00008E
255
 2824  00008E  00            	ScnTop		.DB		; riga superiore finestra
256
 2825  00008F  00            	ScnLeft		.DB		; colonna sinistra finestra
257
 2826  000090  00            	ScnBottom	.DB		; riga inferiore finestra
258
 2827  000091  00            	ScnRight	.DB		; colonna destra finestra
259
 2828  000092  00            	ScnAttr		.DB		; attributo default
260
 2829  000093  00            	ScnAttr2	.DB		; attributo alternativo
261
 2830  000094  00            	ScnRow		.DB		; riga cursore
262
 2831  000095  00            	ScnCol		.DB		; colonna cursore
263
 2832  000096  00            	ScnRowStart	.DB		; riga di start input
264
 2833  000097  00            	ScnInput	.DB		; riga di fine input
265
 2834  000098  00            	ScnColStart	.DB		; colonna di start input
266
 2835  000099  00            	ScnSaveX	.DB
267
 2836  00009A  00            	ScnSaveY	.DB
268
 2837  00009B  00            	ScnTmpL		.DB
269
 2838  00009C  00            	ScnTmpH		.DB
270
 2839  00009D  00            	ScnSaveRow	.DB
271
 2840  00009E  00            	ScnSaveCol	.DB
272
 2841  00009F  00            	ScnCurChr	.DB
273
 2842  0000A0  00            	ScnLstChr	.DB
274
 2843  0000A1  00            	ScnCR		.DB
275
 2844  0000A2  0000          	ScnPrm		.DW		; puntatore long utilizzato da print imm
276
 2845  0000A4  00            			.DB		; banco puntatore ScnPrm
277
 2846  0000A5  00            	ScnMode		.DB		; flag modo schermo
278
 2847
279
 2848  0000A6                	ScnPtr1		LP
280
 2849
281
 2850  0000A9  00            	ScnDefCol	.DB		; default foreground color
282
 2851
283
 2852  0000AA                	ScnPtr2		LP
284
 2853
285
 2854  0000AD  00            	ScnDefBkgCol	.DB		; default background color
286
 2855  0000AE  00            	ScnInpRow	.DB		; modo input line: riga start input
287
 2856  0000AF  00            	ScnInpCol	.DB		; modo input line: colonna start input
288
 2857  0000B0  00            	ScnLstRow	.DB		; modo input line: riga stop input
289
 2858  0000B1  00            	ScnLstCol	.DB		; modo input line: colonna stop input
290
 2859  0000B2  00            	ScnFlag		.DB		; Bit 7: input line - Bit 6: input riga unica
291
 2860  0000B3  00            	ScnMask		.DB		; flag tasti funzione editor di linea
292
 2861  0000B4  00            	ScnFilt		.DB		; filtro tasti editor di linea
293
 2862  0000B5  00            	ScnCntrl	.DB		; flag ASCII/CONTROL
294
 2863                        	;DflTxtIn	.DB		; device di default text input
295
 2864                        	;DflTxtOut	.DB		; device di default text output
296
 2865  0000B6
297
 2866          000047        	SCNCLRLEN	.EQU	($ - ScnLinTmp - 1)
298
 2867
299
 2868                        	;SCNCLRLEN	.EQU	(DflTxtOut - ScnLinTmp)
300
 2869
301
 2870                        	; variabili monitor
302
 2871  0000B6  00            	SMAddrL		.DB	; address low/high
303
 2872  0000B7  00            	SMAddrH		.DB
304
 2873  0000B8  00            	SMAddrK		.DB	; address bank
305
 2874  0000B9  00            	SMFlag32	.DB	; flag parametro 32 bit
306
 2875  0000BA  00            	SMTmpL		.DB	; temp. low/high
307
 2876  0000BB  00            	SMTmpH		.DB
308
 2877  0000BC  00            	SMTmpK		.DB	; temp. bank
309
 2878  0000BD  00            	SMTmpKK		.DB	; high byte param. 32 bit
310
 2879  0000BE  00            	SMSizeL		.DB	; size low/high
311
  Tue Jul 17 11:00:24 2018                                                                                               Page    6
312
 
313
 
314
 
315
 
316
 2880  0000BF  00            	SMSizeH		.DB
317
 2881  0000C0  00            	SMSizeK		.DB	; size bank
318
 2882  0000C1  00            	SMXAddrL	.DB	; address low/high XM
319
 2883  0000C2  00            	SMXAddrH	.DB
320
 2884  0000C3  00            	SMXAddrK	.DB	; address bank XM
321
 2885  0000C4  00            	SMbndx		.DB	; indice input buffer
322
 2886  0000C5  00            	SMnprm		.DB	; numero parametri riga di comando
323
 2887  0000C6  00            	SMdumb		.DB
324
 2888  0000C7  00            	SMkr		.DB
325
 2889  0000C8  0000          	SMpc		.DW
326
 2890  0000CA  00            	SMsr		.DB
327
 2891  0000CB  00            	SMbr		.DB
328
 2892  0000CC  0000          	SMdp		.DW
329
 2893  0000CE  0000          	SMac		.DW
330
 2894  0000D0  0000          	SMxr		.DW
331
 2895  0000D2  0000          	SMyr		.DW
332
 2896  0000D4  0000          	SMsp		.DW
333
 2897
334
 2898  0000D6  00            	SMAuxL		.DB
335
 2899  0000D7  00            	SMAuxH		.DB
336
 2900
337
 2901  0000D8  00            	asmlong		.DB	; flag for CPU in 16 mode
338
 2902                        				; <7> -> A/M in 16 bit mode
339
 2903                        				; <6> -> X/Y in 16 bit mode
340
 2904  0000D9  00            	asmcpu		.DB	; <7> -> 8 bit family
341
 2905                        				; <6> -> 65C02 cmos version
342
 2906
343
 2907  0000DA  00            	SMctx		.DB	; context (if = $00 no quit command)
344
 2908  0000DB                	SMrsm		LP	; long pointer to resume caller context
345
 2909
346
 2910  0000DE  00            	rtcadr		.DB	; rtc internal ram address
347
 2911  0000DF  00            	rtcbnk		.DB	; RTC internal bank ram
348
 2912  0000E0  00            	cmdlin		.DB	;
349
 2913  0000E1  00            	SMesc		.DB
350
 2914
351
 2915  0000E2                	SMXTmp:		.DS	26	; 26 bytes tmp
352
 2916
353
 2917          0000E2        	SMTmp2		.EQU	SMXTmp
354
 2918          0000E4        	SMTmp3		.EQU	SMXTmp+2
355
 2919          0000E6        	SMdwTmp1	.EQU	SMXTmp+4
356
 2920          0000EA        	SMdwTmp2	.EQU	SMXTmp+8
357
 2921          0000EE        	SMFsrc		.EQU	SMXTmp+12	; source bank for flash update
358
 2922          0000EF        	SMFflag		.EQU	SMXTmp+13	; flag file for flash update
359
 2923          0000F0        	SMXPos2		.EQU	SMXTmp+14
360
 2924          0000F1        	SMYPos2		.EQU	SMXTmp+15
361
 2925          0000F2        	SMXPos3		.EQU	SMXTmp+16
362
 2926          0000F3        	SMYPos3		.EQU	SMXTmp+17
363
 2927                        	;SMAuxL		.EQU	SMXTmp+18
364
 2928                        	;SMAuxH		.EQU	SMXTmp+19
365
 2929          0000F6        	SMXPos		.EQU	SMXTmp+20
366
 2930          0000F7        	SMYPos		.EQU	SMXTmp+21
367
 2931          0000F8        	SMdwTmp3	.EQU	SMXTmp+22
368
 2932
369
 2933          0000E2        	atcmd		.EQU	SMXTmp		; save @ command
370
 2934          0000E3        	atnum		.EQU	SMXTmp+1	; @ command index
371
 2935          0000E4        	atflag		.EQU	SMXTmp+2	; @ L,S,V,R,W start address flag
372
 2936          0000E5        	atbnk		.EQU	SMXTmp+3	; @ L,S,V,R,W bank
373
  Tue Jul 17 11:00:24 2018                                                                                               Page    7
374
 
375
 
376
 
377
 
378
 2937          0000E6        	atstr		.EQU	SMXTmp+4	; @ command string start (word)
379
 2938          0000E8        	atstart		.EQU	SMXTmp+6	; @ L,S,V,R,W start address (word)
380
 2939          0000EA        	atend		.EQU	SMXTmp+8	; @ S,W end address (word)
381
 2940          0000EC        	atbuf		.EQU	SMXTmp+10	; @ local buffer pointer (word)
382
 2941          0000EE        	atipb		.EQU	SMXTmp+12	; @ bank of input buffer
383
 2942          0000EF        	atdir		.EQU	SMXTmp+13	; @ load dir flag
384
 2943          0000F0        	atptr		.EQU	SMXTmp+14	; @ load dir pointer (word)
385
 2944          0000F2        	atsiz		.EQU	SMXTmp+16	; @ buffer size (word)
386
 2945          0000F5        	atlp		.EQU	SMXTmp+19	; @ long pointer
387
 2946          0000F8        	atsa		.EQU	SMXTmp+22	; @ sa
388
 2947
389
 2948          0000E2        	btmpx		.EQU	SMXTmp		; asc2bin conversion
390
 2949          0000E3        	brtcsec		.EQU	SMXTmp+1
391
 2950          0000E4        	brtcmin		.EQU	SMXTmp+2
392
 2951          0000E5        	brtchour	.EQU	SMXTmp+3
393
 2952          0000E6        	brtcday		.EQU	SMXTmp+4
394
 2953          0000E7        	brtcmonth	.EQU	SMXTmp+5
395
 2954          0000E8        	brtcyear	.EQU	SMXTmp+6
396
 2955          0000E9        	brtcct		.EQU	SMXTmp+7
397
 2956
398
 2957
399
 2958  0000FC                		.RELATIVE
400
 2959
401
 2960                        		.ENDS
402
 2961
403
 2965                        	.LIST on
404
 2966
405
 2967                        		.EXTERN qedtent
406
 2968
407
 2969                        		.MONSEG
408
 2970                        		.LONGA	off
409
 2971                        		.LONGI	off
410
 2972
411
 2973                        	; $FF0000 - standard entry monitor
412
 2974  FF0000  4C 6E 00      		jmp	_SysMon
413
 2975
414
 2976                        	; $FF0003 - entry monitor after reset
415
 2977  FF0003  4C 6A 00      		jmp	_mon0
416
 2978  FF0006
417
 2979                        	; $FF0006 - entry monitor after brk
418
 2980  FF0006  4C 0E 00      		jmp	_SysBreak
419
 2981  FF0009
420
 2982                        	; $FF0009 - entry monitor after sys request
421
 2983  FF0009  A9 FF         		lda	#$FF
422
 2984  FF000B  4C 10 00      		jmp	_SysBreak2
423
 2985  FF000E
424
 2986                        		.CODEFF
425
 2987  FF000E
426
 2988          0001E2        	SMTMP2		.EQU	(DP01ADDR + SMTmp2)
427
 2989          0001B6        	SMADDRL		.EQU	(DP01ADDR + SMAddrL)
428
 2990
429
 2991          019900        	INPUTBUF	.EQU	MONBUF
430
 2992          0000A2        	INPBUFLEN	.EQU	$A2
431
 2993
432
 2994                        		.LONGA	off
433
 2995                        		.LONGI	off
434
 2996  FF000E
435
  Tue Jul 17 11:00:24 2018                                                                                               Page    8
436
 
437
 
438
 
439
 
440
 2997                        		.GLOBAL _SysMon, _SysBreak
441
 2998                        		.GLOBAL ErrCls2, GetParm, PrintByte, PrintHex, GetParm32, CkStop
442
 2999                        		.GLOBAL PrintWord, PrintAddr, PrintHex, TmpToAddr, GetParm, DecTmpPtrA
443
 3000                        		.GLOBAL SubTmpAddr, PrintHex1, GetCurCh, FF_Byte2Hex
444
 3001
445
 3002                        		.EXTERN matcmd, atacmd, Cmd_d, Cmd_a
446
 3003  FF000E
447
 3004                        		.EXTERN Cmd_fddisk, Cmd_fdgetfmt, Cmd_fdres, Cmd_fdinit, Cmd_fdformat
448
 3005                        		.EXTERN Cmd_fdverfmt, Cmd_fdread, Cmd_fdwrite, Cmd_fdverf, Cmd_fdnew
449
 3006                        		.EXTERN Cmd_fdtread, Cmd_fdtwrite, Cmd_fdtverf, Cmd_fdfs, Cmd_fdlsys
450
 3007                        		.EXTERN Cmd_mkhash, Cmd_sptst, Cmd_asptst
451
 3008
452
 3009  FF000E
453
 3010                        	; BRK entry
454
 3011                        	; descrizione stack:
455
 3012                        	;
456
 3013                        	;	KR		-> SP + 13
457
 3014                        	;	PCH		-> SP + 12
458
 3015                        	;	PCL		-> SP + 11
459
 3016                        	;	SR		-> SP + 10
460
 3017                        	;	A		-> SP + 8
461
 3018                        	;	X		-> SP + 6
462
 3019                        	;	Y		-> SP + 4
463
 3020                        	;	DPR		-> SP + 2
464
 3021                        	;	DBR		-> SP + 1
465
 3022
466
 3023  FF000E                	_SysBreak:
467
 3024  FF000E  A9 00         		lda	#0
468
 3025  FF0010                	_SysBreak2:
469
 3026  FF0010  A8            		tay			; save context
470
 3027  FF0011                		CPU16
471
 3028  FF0011  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
472
 3029                        		.LONGA	on
473
 3030                        		.LONGI	on
474
 3031                        		.MNLIST
475
 3032  FF0013  A9 00 01      		lda	#DP01ADDR	; imposta nuova DP
476
 3033  FF0016  5B            		tcd
477
 3034  FF0017                		CPU08
478
 3035  FF0017  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
479
 3036                        		.LONGA	off
480
 3037                        		.LONGI	off
481
 3038                        		.MNLIST
482
 3039  FF0019  68            		pla			; DBR
483
 3040  FF001A  85 CB         		sta	SMbr
484
 3041  FF001C                		CPU16
485
 3042  FF001C  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
486
 3043                        		.LONGA	on
487
 3044                        		.LONGI	on
488
 3045                        		.MNLIST
489
 3046  FF001E  68            		pla			; DPR
490
 3047  FF001F  85 CC         		sta	SMdp
491
 3048  FF0021  68            		pla
492
 3049  FF0022  85 D2         		sta	SMyr
493
 3050  FF0024  68            		pla
494
 3051  FF0025  85 D0         		sta	SMxr
495
 3052  FF0027  68            		pla
496
 3053  FF0028  85 CE         		sta	SMac
497
  Tue Jul 17 11:00:24 2018                                                                                               Page    9
498
 
499
 
500
 
501
 
502
 3054  FF002A                		CPU08
503
 3055  FF002A  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
504
 3056                        		.LONGA	off
505
 3057                        		.LONGI	off
506
 3058                        		.MNLIST
507
 3059  FF002C  68            		pla
508
 3060  FF002D  85 CA         		sta	SMsr
509
 3061  FF002F  68            		pla
510
 3062  FF0030  85 C8         		sta	SMpc		; PCL
511
 3063  FF0032  68            		pla
512
 3064  FF0033  85 C9         		sta	SMpc+1		; PCH
513
 3065  FF0035  68            		pla
514
 3066  FF0036  85 C7         		sta	SMkr		; PBR (KR)
515
 3067  FF0038                		CPU16
516
 3068  FF0038  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
517
 3069                        		.LONGA	on
518
 3070                        		.LONGI	on
519
 3071                        		.MNLIST
520
 3072  FF003A  BA            		tsx
521
 3073  FF003B  86 D4         		stx	SMsp
522
 3074  FF003D                		CPU08
523
 3075  FF003D  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
524
 3076                        		.LONGA	off
525
 3077                        		.LONGI	off
526
 3078                        		.MNLIST
527
 3079                        		;SCNINIT
528
 3080
529
 3081  FF003F  98            		tya
530
 3082  FF0040  D0 0B         		bne	?02
531
 3083                        		;SCNINIT
532
 3084  FF0042                		SCNPRINT
533
 3085  FF0042  02 01         		cop	$01
534
 3086                        		.MNLIST
535
 3087  FF0044  0D 42 72 65 61 		.DB	KB_CR, 'Break', 0
536
               6B 00
537
 3088  FF004B  80 12         		bra	?04
538
 3089  FF004D                	?02:	SCNPRINT
539
 3090  FF004D  02 01         		cop	$01
540
 3091                        		.MNLIST
541
 3092  FF004F  0D 53 79 73 74 		.DB	KB_CR, 'System Request', 0
542
               65 6D 20 52 65
543
               71 75 65 73 74
544
               00
545
 3093  FF005F  64 DA         	?04:	stz	SMctx
546
 3094  FF0061
547
 3095  FF0061  9C 21 FC      		stz	$FC21
548
 3096  FF0064
549
 3097  FF0064  58            		cli
550
 3098  FF0065  80 57         		bra	_SysMon2
551
 3099  FF0067
552
 3100                        	; entry monitor con inizializzazione schermo
553
 3101  FF0067                	_SysMonClr:
554
 3102  FF0067                		SCNINIT
555
 3103  FF0067  02 18         		cop	$18
556
 3104  FF0069  00            		.DB	$00
557
 3105                        		.MNLIST
558
 3106
559
  Tue Jul 17 11:00:24 2018                                                                                               Page   10
560
 
561
 
562
 
563
 
564
 3107  FF006A                	_mon0:
565
 3108  FF006A                		CPU08
566
 3109  FF006A  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
567
 3110                        		.LONGA	off
568
 3111                        		.LONGI	off
569
 3112                        		.MNLIST
570
 3113  FF006C  A9 00         		lda	#0
571
 3114  FF006E
572
 3115                        	; entry principale per monitor -- called from user program/reset
573
 3116  FF006E                	_SysMon:
574
 3117  FF006E  A8            		tay			; save context
575
 3118  FF006F                		CPU16
576
 3119  FF006F  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
577
 3120                        		.LONGA	on
578
 3121                        		.LONGI	on
579
 3122                        		.MNLIST
580
 3123  FF0071  A9 00 01      		lda	#DP01ADDR	; imposta nuova DP
581
 3124  FF0074  5B            		tcd
582
 3125  FF0075  85 CC         		sta	SMdp
583
 3126  FF0077  64 CE         		stz	SMac
584
 3127  FF0079  64 D0         		stz	SMxr
585
 3128  FF007B  64 D2         		stz	SMyr
586
 3129  FF007D  BA            		tsx
587
 3130  FF007E  86 D4         		stx	SMsp
588
 3131  FF0080  A9 6E 00      		lda	#_SysMon
589
 3132  FF0083  85 C8         		sta	SMpc
590
 3133  FF0085                		CPU08
591
 3134  FF0085  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
592
 3135                        		.LONGA	off
593
 3136                        		.LONGI	off
594
 3137                        		.MNLIST
595
 3138  FF0087  A9 00         		lda	#0
596
 3139  FF0089  48            		pha
597
 3140  FF008A  AB            		plb
598
 3141  FF008B  85 CB         		sta	SMbr
599
 3142  FF008D  4B            		phk
600
 3143  FF008E  68            		pla
601
 3144  FF008F  85 C7         		sta	SMkr
602
 3145  FF0091  08            		php
603
 3146  FF0092  68            		pla
604
 3147  FF0093  85 CA         		sta	SMsr
605
 3148  FF0095  8D 0C FC      		sta	CREMEOFF
606
 3149  FF0098  8D 0A FC      		sta	CRXMEOFF
607
 3150  FF009B  8D 08 FC      		sta	CRXFEOFF
608
 3151  FF009E  98            		tya
609
 3152  FF009F  85 DA         		sta	SMctx		; save context
610
 3153  FF00A1  F0 0B         		beq	?02
611
 3154  FF00A3                		ACC16
612
 3155  FF00A3  C2 20         		rep	#PMFLAG
613
 3156                        		.LONGA	on
614
 3157                        		.MNLIST
615
 3158  FF00A5  68            		pla
616
 3159  FF00A6  1A            		inc	a
617
 3160  FF00A7  85 DB         		sta	SMrsm		; save resume address
618
 3161  FF00A9                		ACC08
619
 3162  FF00A9  E2 20         		sep	#PMFLAG
620
 3163                        		.LONGA	off
621
  Tue Jul 17 11:00:24 2018                                                                                               Page   11
622
 
623
 
624
 
625
 
626
 3164                        		.MNLIST
627
 3165  FF00AB  68            		pla
628
 3166  FF00AC  85 DD         		sta	SMrsm+2
629
 3167  FF00AE
630
 3168  FF00AE                	?02:	SCNPRINT
631
 3169  FF00AE  02 01         		cop	$01
632
 3170                        		.MNLIST
633
 3171  FF00B0
634
 3172  FF00B0  0D 4D 6F 6E 69 		.DB	KB_CR, 'Monitor v1.2', 0
635
               74 6F 72 20 76
636
               31 2E 32 00
637
 3173  FF00BE
638
 3174  FF00BE                	_SysMon2:
639
 3175  FF00BE  D8            		cld
640
 3176  FF00BF  64 C6         		stz	SMdumb
641
 3177  FF00C1  20 82 0C      		jsr	PrintReg
642
 3178
643
 3179  FF00C4                	GetCmd:
644
 3180  FF00C4                		SCN_CR
645
 3181  FF00C4                		SCNPRCHAR
646
 3182                        		.MLIST
647
 3183  FF00C4  02 07         		cop	$07
648
 3184                        		.MNLIST
649
 3185  FF00C6  0D            		.DB	$0D
650
 3186                        		.MNLIST
651
 3187  FF00C7  64 E1         		stz	SMesc
652
 3188  FF00C9  A2 00         		ldx	#0
653
 3189  FF00CB  86 C4         		stx	SMbndx
654
 3190  FF00CD  CA            		dex
655
 3191  FF00CE  E8            	?01:	inx			; ciclo input
656
 3192  FF00CF  E0 A2         		cpx	#INPBUFLEN
657
 3193  FF00D1  B0 63         		bcs	SMError
658
 3194  FF00D3                		KBCHARIN	; input tastiera
659
 3195  FF00D3  02 0F         		cop	$0F
660
 3196                        		.MNLIST
661
 3197  FF00D5  9F 00 99 01   		sta	INPUTBUF,x
662
 3198  FF00D9  C9 0D         		cmp	#KB_CR
663
 3199  FF00DB  D0 F1         		bne	?01
664
 3200  FF00DD  A9 00         		lda	#0
665
 3201  FF00DF  9F 00 99 01   		sta	INPUTBUF,x
666
 3202  FF00E3  20 48 1A      	?02:	jsr	GetCurCh	; get char da buffer
667
 3203  FF00E6  F0 DC         		beq	GetCmd		; fine linea
668
 3204  FF00E8  C9 20         		cmp	#' '
669
 3205  FF00EA  F0 F7         		beq	?02		; skip spazi
670
 3206  FF00EC  C9 23         		cmp	#'#'
671
 3207  FF00EE  D0 02         		bne	?02w
672
 3208  FF00F0  C6 E1         		dec	SMesc
673
 3209  FF00F2  20 DF 01      	?02w:	jsr	pfxcmd		; check prefix command
674
 3210  FF00F5  A6 C4         		ldx	SMbndx		; salva indice corrente
675
 3211  FF00F7  CA            		dex
676
 3212  FF00F8  86 D7         		stx	SMAuxH
677
 3213  FF00FA  A0 00         		ldy	#0		; indice comando
678
 3214  FF00FC  BB            		tyx			; indice tabella comandi
679
 3215  FF00FD                		INDEX16
680
 3216  FF00FD  C2 10         		rep	#PXFLAG
681
 3217                        		.LONGI	on
682
 3218                        		.MNLIST
683
  Tue Jul 17 11:00:24 2018                                                                                               Page   12
684
 
685
 
686
 
687
 
688
 3219  FF00FF  A5 D7         	?02a:	lda	SMAuxH		; ripristina indice buffer
689
 3220  FF0101  85 C4         		sta	SMbndx
690
 3221  FF0103  DA            	?02b:	phx
691
 3222  FF0104                		INDEX08
692
 3223  FF0104  E2 10         		sep	#PXFLAG
693
 3224                        		.LONGI	off
694
 3225                        		.MNLIST
695
 3226  FF0106  20 48 1A      		jsr	GetCurCh	; get char
696
 3227  FF0109                		INDEX16
697
 3228  FF0109  C2 10         		rep	#PXFLAG
698
 3229                        		.LONGI	on
699
 3230                        		.MNLIST
700
 3231  FF010B  FA            		plx
701
 3232                        		;beq	SMError		; ERRORE
702
 3233  FF010C  5F 41 03 FF   		eor	CMDTBL,x	; cerca comando interno
703
 3234  FF0110  F0 16         		beq	?10		; test carattere ok
704
 3235  FF0112  C9 80         		cmp	#$80		; comando trovato - fine
705
 3236  FF0114  F0 15         		beq	?11
706
 3237  FF0116  C8            		iny			; next command
707
 3238  FF0117  E8            	?09:	inx
708
 3239  FF0118  BF 40 03 FF   		lda	CMDTBL-1,x	; cerca fine stringa
709
 3240  FF011C  10 F9         		bpl	?09
710
 3241  FF011E  BF 41 03 FF   		lda	CMDTBL,x	; test fine tabella comandi
711
 3242  FF0122  D0 DB         		bne	?02a		; continua scan
712
 3243  FF0124                		INDEX08
713
 3244  FF0124  E2 10         		sep	#PXFLAG
714
 3245                        		.LONGI	off
715
 3246                        		.MNLIST
716
 3247  FF0126  F0 0E         		beq	SMError		; comando interno non trovato
717
 3248  FF0128  E8            	?10:	inx
718
 3249  FF0129  D0 D8         		bne	?02b		; continua scan stringa attuale
719
 3250  FF012B                	?11:	INDEX08
720
 3251  FF012B  E2 10         		sep	#PXFLAG
721
 3252                        		.LONGI	off
722
 3253                        		.MNLIST
723
 3254  FF012D  20 BD 01      		jsr	ExecCmd
724
 3255  FF0130  80 92         		bra	GetCmd
725
 3256  FF0132
726
 3257  FF0132                	ErrCls4:
727
 3258  FF0132  68            		pla
728
 3259  FF0133  68            		pla
729
 3260  FF0134                	ErrCls2:
730
 3261  FF0134  68            		pla
731
 3262  FF0135  68            		pla
732
 3263  FF0136
733
 3264  FF0136                	SMError:
734
 3265  FF0136                		SCNPRINT
735
 3266  FF0136  02 01         		cop	$01
736
 3267                        		.MNLIST
737
 3268  FF0138
738
 3269  FF0138  02 3F 00      		.DB	SCN_CSRRIGHT, '?', 0
739
 3270  FF013B
740
 3271  FF013B  80 87         		bra	GetCmd
741
 3272
742
 3273                        	; set program counter
743
 3274  FF013D                	_setpc:
744
 3275  FF013D  B0 0C         		bcs	?02
745
  Tue Jul 17 11:00:24 2018                                                                                               Page   13
746
 
747
 
748
 
749
 
750
 3276  FF013F  A5 BC         		lda	SMTmpK
751
 3277  FF0141  85 C7         		sta	SMkr
752
 3278  FF0143  A5 BB         		lda	SMTmpH
753
 3279  FF0145  85 C9         		sta	SMpc+1
754
 3280  FF0147  A5 BA         		lda	SMTmpL
755
 3281  FF0149  85 C8         		sta	SMpc
756
 3282  FF014B  A5 C7         	?02:	lda	SMkr
757
 3283  FF014D  C9 08         		cmp	#$08			; test bank
758
 3284  FF014F  90 E3         		bcc	ErrCls2
759
 3285  FF0151  60            		rts
760
 3286
761
 3287  FF0152                	GetParm32:
762
 3288  FF0152  A9 80         		lda	#$80
763
 3289  FF0154  85 B9         		sta	SMFlag32
764
 3290  FF0156  80 04         		bra	GetParm2
765
 3291  FF0158
766
 3292  FF0158                	GetParm0:
767
 3293  FF0158  C6 C4         		dec	SMbndx
768
 3294  FF015A
769
 3295  FF015A                	GetParm:
770
 3296  FF015A  64 B9         		stz	SMFlag32
771
 3297
772
 3298  FF015C                	GetParm2:
773
 3299  FF015C  A5 C4         		lda	SMbndx
774
 3300  FF015E  85 E0         		sta	cmdlin		; save start of command line
775
 3301  FF0160  64 BA         		stz	SMTmpL
776
 3302  FF0162  64 BB         		stz	SMTmpH
777
 3303  FF0164  64 BC         		stz	SMTmpK
778
 3304  FF0166  64 BD         		stz	SMTmpKK
779
 3305  FF0168  64 C5         		stz	SMnprm
780
 3306  FF016A  20 48 1A      	?01:	jsr	GetCurCh
781
 3307  FF016D  F0 4D         		beq	?11
782
 3308  FF016F  C9 20         		cmp	#' '
783
 3309  FF0171  F0 F7         		beq	?01
784
 3310  FF0173  C9 20         	?03:	cmp	#' '
785
 3311  FF0175  F0 42         		beq	?10
786
 3312  FF0177  C9 2C         		cmp	#','
787
 3313  FF0179  F0 3E         		beq	?10
788
 3314  FF017B  C9 30         		cmp	#'0'
789
 3315  FF017D  90 B3         		bcc	ErrCls4
790
 3316  FF017F  C9 61         		cmp	#'a'
791
 3317  FF0181  90 07         		bcc	?05
792
 3318  FF0183  C9 7B         		cmp	#('z' + 1)
793
 3319  FF0185  B0 03         		bcs	?05
794
 3320  FF0187  38            		sec
795
 3321  FF0188  E9 20         		sbc	#$20
796
 3322  FF018A  C9 47         	?05:	cmp	#'G'
797
 3323  FF018C  B0 A4         		bcs	ErrCls4
798
 3324  FF018E  C9 3A         		cmp	#':'
799
 3325  FF0190  90 06         		bcc	?07
800
 3326  FF0192  C9 41         		cmp	#'A'
801
 3327  FF0194  90 9C         		bcc	ErrCls4
802
 3328  FF0196  E9 08         		sbc	#$08
803
 3329  FF0198  E9 2F         	?07:	sbc	#$2F
804
 3330  FF019A  0A            		asl	a
805
 3331  FF019B  0A            		asl	a
806
 3332  FF019C  0A            		asl	a
807
  Tue Jul 17 11:00:24 2018                                                                                               Page   14
808
 
809
 
810
 
811
 
812
 3333  FF019D  0A            		asl	a
813
 3334  FF019E  DA            		phx
814
 3335  FF019F  A2 04         		ldx	#4
815
 3336  FF01A1  0A            	?08:	asl	a
816
 3337  FF01A2  26 BA         		rol	SMTmpL
817
 3338  FF01A4  26 BB         		rol	SMTmpH
818
 3339  FF01A6  26 BC         		rol	SMTmpK
819
 3340  FF01A8  24 B9         		bit	SMFlag32	; test valore 32 bit
820
 3341  FF01AA  10 02         		bpl	?09
821
 3342  FF01AC  26 BD         		rol	SMTmpKK
822
 3343  FF01AE  CA            	?09:	dex
823
 3344  FF01AF  D0 F0         		bne	?08
824
 3345  FF01B1  FA            		plx
825
 3346  FF01B2  E6 C5         		inc	SMnprm
826
 3347  FF01B4  20 48 1A      		jsr	GetCurCh
827
 3348  FF01B7  D0 BA         		bne	?03
828
 3349  FF01B9  18            	?10:	clc
829
 3350  FF01BA  A5 C5         		lda	SMnprm
830
 3351  FF01BC  60            	?11:	rts
831
 3352  FF01BD
832
 3353  FF01BD                	ExecCmd:
833
 3354  FF01BD  24 E1         		bit	SMesc
834
 3355  FF01BF  10 11         		bpl	?01
835
 3356  FF01C1  A6 C4         		ldx	SMbndx
836
 3357  FF01C3  86 E0         		stx	cmdlin		; save start of command line
837
 3358  FF01C5  BF 00 99 01   		lda	>INPUTBUF,x
838
 3359  FF01C9  F0 0A         		beq	?02
839
 3360  FF01CB  C9 20         		cmp	#' '
840
 3361  FF01CD  F0 06         		beq	?02
841
 3362  FF01CF  4C 34 01      		jmp	ErrCls2
842
 3363  FF01D2  20 5A 01      	?01:	jsr	GetParm
843
 3364  FF01D5  08            	?02:	php
844
 3365  FF01D6  48            		pha
845
 3366  FF01D7  98            		tya
846
 3367  FF01D8  0A            		asl	a
847
 3368  FF01D9  AA            		tax
848
 3369  FF01DA  68            		pla
849
 3370  FF01DB  28            		plp
850
 3371  FF01DC  7C 81 04      		jmp	(CMDVCTRS,x)
851
 3372
852
 3373                        	;---------------------------------------------------------------------------
853
 3374                        	; prefix commands
854
 3375                        	;---------------------------------------------------------------------------
855
 3376
856
 3377                        	; handle prefix command's
857
 3378                        	; A = byte from input buffer
858
 3379  FF01DF                	pfxcmd:
859
 3380  FF01DF  A2 01         		ldx	#PFXLEN
860
 3381  FF01E1  DF 23 03 FF   	?03:	cmp	>PFXTBL,x
861
 3382  FF01E5  F0 04         		beq	?04
862
 3383  FF01E7  CA            		dex
863
 3384  FF01E8  10 F7         		bpl	?03
864
 3385  FF01EA  60            		rts			; return to standard command
865
 3386  FF01EB  68            	?04:	pla			; pop stack return address
866
 3387  FF01EC  68            		pla
867
 3388  FF01ED  8A            		txa
868
 3389  FF01EE  0A            		asl	a
869
  Tue Jul 17 11:00:24 2018                                                                                               Page   15
870
 
871
 
872
 
873
 
874
 3390  FF01EF  AA            		tax
875
 3391  FF01F0  FC 3D 03      		jsr	(PFXVCTRS,x)	; execute prefix command
876
 3392  FF01F3  4C C4 00      		jmp	GetCmd		; command loop
877
 3393
878
 3394                        	; prefix '@': cbm disk command
879
 3395  FF01F6                	pfx_at:
880
 3396  FF01F6  64 E4         		stz	<atflag
881
 3397  FF01F8  A9 99         		lda	#>INPUTBUF
882
 3398  FF01FA  85 E7         		sta	<atstr+1	; hi ptr command string
883
 3399  FF01FC  A9 01         		lda	#^INPUTBUF
884
 3400  FF01FE  85 EE         		sta	<atipb		; bank of cmnd string
885
 3401  FF0200  20 5E 1A      	?01:	jsr	GetCurCh2	; get next byte
886
 3402  FF0203  F0 12         		beq	?04		; just '@': like '@e'
887
 3403  FF0205  C9 20         		cmp	#' '		; skip blanks
888
 3404  FF0207  F0 F7         		beq	?01
889
 3405  FF0209  A2 0C         		ldx	#PATLEN
890
 3406  FF020B  DF 25 03 FF   	?02:	cmp	>PATTBL,x
891
 3407  FF020F  F0 0A         		beq	?06
892
 3408  FF0211  CA            		dex
893
 3409  FF0212  10 F7         		bpl	?02
894
 3410  FF0214  4C 98 02      		jmp	?15
895
 3411  FF0217  A2 00         	?04:	ldx	#0		; '@e' command
896
 3412  FF0219  A9 45         		lda	#'E'
897
 3413  FF021B  85 E2         	?06:	sta	<atcmd
898
 3414  FF021D  86 E3         		stx	<atnum
899
 3415  FF021F  8A            		txa
900
 3416  FF0220  F0 04         		beq	?08		; @e
901
 3417  FF0222  C9 5A         		cmp	#'Z'		; @z close all
902
 3418  FF0224  D0 0E         		bne	?9a		; get string for command
903
 3419  FF0226  20 48 1A      	?08:	jsr	GetCurCh	; no params for '@e' & '@z' command
904
 3420  FF0229  D0 03         		bne	?09
905
 3421  FF022B  4C CF 02      		jmp	?22		; ok
906
 3422  FF022E  C9 20         	?09:	cmp	#' '
907
 3423  FF0230  F0 F4         		beq	?08
908
 3424  FF0232  D0 64         		bne	?15		; error
909
 3425  FF0234  A5 E2         	?9a:	lda	<atcmd
910
 3426  FF0236  C9 47         		cmp	#'G'		; get
911
 3427  FF0238  F0 0B         		beq	?9c
912
 3428  FF023A  C9 50         		cmp	#'P'		; put
913
 3429  FF023C  F0 07         		beq	?9c
914
 3430  FF023E  C9 58         		cmp	#'X'		; close want one param
915
 3431  FF0240  D0 06         		bne	?10
916
 3432  FF0242  4C F7 02      		jmp	?40		; X want one param
917
 3433  FF0245  4C D2 02      	?9c:	jmp	?30		; G&P want 2/3 param
918
 3434  FF0248  20 48 1A      	?10:	jsr	GetCurCh	; parse command string
919
 3435  FF024B  F0 4B         		beq	?15		; error
920
 3436  FF024D  C9 20         		cmp	#' '
921
 3437  FF024F  F0 F7         		beq	?10
922
 3438  FF0251  C9 22         		cmp	#'"'		; will start with a quotes mark
923
 3439  FF0253  D0 43         		bne	?15		; error
924
 3440  FF0255  A6 C4         		ldx	SMbndx		; save pointer to start string
925
 3441  FF0257  86 E6         		stx	<atstr
926
 3442  FF0259  BF 00 99 01   	?12:	lda	INPUTBUF,x	; search final quote mark
927
 3443  FF025D  F0 39         		beq	?15		; error
928
 3444  FF025F  E8            		inx
929
 3445  FF0260  C9 22         		cmp	#'"'
930
 3446  FF0262  D0 F5         		bne	?12
931
  Tue Jul 17 11:00:24 2018                                                                                               Page   16
932
 
933
 
934
 
935
 
936
 3447  FF0264  86 C4         		stx	SMbndx		; store index to next char
937
 3448  FF0266  CA            		dex
938
 3449  FF0267  A9 00         		lda	#0		; terminate command string
939
 3450  FF0269  9F 00 99 01   		sta	INPUTBUF,x
940
 3451  FF026D  A6 E3         	?14:	ldx	<atnum
941
 3452  FF026F  E0 07         		cpx	#PATLD		; O,L,S,V,R,W need more params
942
 3453  FF0271  90 5C         		bcc	?22
943
 3454  FF0273  20 48 1A      		jsr	GetCurCh
944
 3455  FF0276  F0 20         		beq	?15		; at least need bank/chnl
945
 3456  FF0278  20 5A 01      		jsr	GetParm
946
 3457  FF027B  B0 1B         		bcs	?15
947
 3458  FF027D  A5 BA         		lda	SMTmpL
948
 3459  FF027F  85 E5         		sta	<atbnk		; bank for L,S,V,R,W - chn for O
949
 3460  FF0281  A4 E2         		ldy	<atcmd
950
 3461  FF0283  C0 4F         		cpy	#'O'
951
 3462  FF0285  D0 02         		bne	?14a
952
 3463  FF0287  85 F8         		sta	<atsa
953
 3464  FF0289  20 5A 01      	?14a:	jsr	GetParm
954
 3465  FF028C  90 0D         		bcc	?16
955
 3466  FF028E  A5 E2         		lda	<atcmd
956
 3467  FF0290  C9 57         		cmp	#'W'
957
 3468  FF0292  F0 04         		beq	?15
958
 3469  FF0294  C9 53         		cmp	#'S'
959
 3470  FF0296  D0 37         		bne	?22		; L,V,R without start address or O
960
 3471  FF0298  4C 34 01      	?15:	jmp	ErrCls2		; S,W need start address
961
 3472  FF029B                	?16:	ACC16
962
 3473  FF029B  C2 20         		rep	#PMFLAG
963
 3474                        		.LONGA	on
964
 3475                        		.MNLIST
965
 3476  FF029D  A5 BA         		lda	SMTmpL
966
 3477  FF029F  85 E8         		sta	<atstart
967
 3478  FF02A1                		ACC08
968
 3479  FF02A1  E2 20         		sep	#PMFLAG
969
 3480                        		.LONGA	off
970
 3481                        		.MNLIST
971
 3482  FF02A3  A9 80         		lda	#$80
972
 3483  FF02A5  85 E4         		sta	<atflag		; flag start address
973
 3484  FF02A7  20 5A 01      		jsr	GetParm		; end address
974
 3485  FF02AA  A5 E2         		lda	<atcmd
975
 3486  FF02AC  90 0A         		bcc	?18
976
 3487  FF02AE  C9 53         		cmp	#'S'
977
 3488  FF02B0  F0 E6         		beq	?15		; S,W need end address
978
 3489  FF02B2  C9 57         		cmp	#'W'
979
 3490  FF02B4  F0 E2         		beq	?15
980
 3491  FF02B6  80 17         		bra	?22
981
 3492  FF02B8  C9 57         	?18:	cmp	#'W'
982
 3493  FF02BA  F0 04         		beq	?20
983
 3494  FF02BC  C9 53         		cmp	#'S'
984
 3495  FF02BE  D0 D8         		bne	?15		; L,V,R want just start address
985
 3496  FF02C0                	?20:	ACC16
986
 3497  FF02C0  C2 20         		rep	#PMFLAG
987
 3498                        		.LONGA	on
988
 3499                        		.MNLIST
989
 3500  FF02C2  A5 BA         		lda	SMTmpL
990
 3501  FF02C4  1A            		inc	a
991
 3502  FF02C5  85 EA         		sta	<atend
992
 3503  FF02C7  C5 E8         		cmp	<atstart
993
  Tue Jul 17 11:00:24 2018                                                                                               Page   17
994
 
995
 
996
 
997
 
998
 3504  FF02C9                		ACC08
999
 3505  FF02C9  E2 20         		sep	#PMFLAG
1000
 3506                        		.LONGA	off
1001
 3507                        		.MNLIST
1002
 3508  FF02CB  90 CB         		bcc	?15		; end+1 will be > start
1003
 3509  FF02CD  F0 C9         		beq	?15
1004
 3510  FF02CF  4C D1 25      	?22:	jmp	matcmd
1005
 3511  FF02D2  20 5A 01      	?30:	jsr	GetParm		; G&P
1006
 3512  FF02D5  B0 C1         		bcs	?15
1007
 3513  FF02D7  A5 BA         		lda	SMTmpL
1008
 3514  FF02D9  85 F8         		sta	<atsa
1009
 3515  FF02DB  20 5A 01      		jsr	GetParm
1010
 3516  FF02DE  B0 B8         		bcs	?15
1011
 3517  FF02E0  A5 BA         		lda	SMTmpL
1012
 3518  FF02E2  85 E5         		sta	<atbnk
1013
 3519  FF02E4  64 E8         		stz	<atstart
1014
 3520  FF02E6  64 E9         		stz	<atstart+1
1015
 3521  FF02E8  20 5A 01      		jsr	GetParm
1016
 3522  FF02EB  90 E2         		bcc	?22
1017
 3523  FF02ED                		ACC16
1018
 3524  FF02ED  C2 20         		rep	#PMFLAG
1019
 3525                        		.LONGA	on
1020
 3526                        		.MNLIST
1021
 3527  FF02EF  A5 BA         		lda	SMTmpL
1022
 3528  FF02F1  85 E8         		sta	<atstart
1023
 3529  FF02F3                		ACC08
1024
 3530  FF02F3  E2 20         		sep	#PMFLAG
1025
 3531                        		.LONGA	off
1026
 3532                        		.MNLIST
1027
 3533  FF02F5  80 D8         		bra	?22
1028
 3534  FF02F7  20 5A 01      	?40:	jsr	GetParm		; X (close)
1029
 3535  FF02FA  B0 9C         		bcs	?15
1030
 3536  FF02FC  A5 BA         		lda	SMTmpL
1031
 3537  FF02FE  85 F8         		sta	<atsa
1032
 3538  FF0300  80 CD         		bra	?22
1033
 3539
1034
 3540                        	; prefix '|': ata test
1035
 3541  FF0302                	pfx_bar:
1036
 3542  FF0302  20 48 1A      	?01:	jsr	GetCurCh	; get next byte
1037
 3543  FF0305  F0 0F         		beq	?04		; error
1038
 3544  FF0307  C9 20         		cmp	#' '		; skip blanks
1039
 3545  FF0309  F0 F7         		beq	?01
1040
 3546  FF030B  A2 0A         		ldx	#PBARLEN
1041
 3547  FF030D  DF 32 03 FF   	?02:	cmp	>PBARTBL,x
1042
 3548  FF0311  F0 06         		beq	?06
1043
 3549  FF0313  CA            		dex
1044
 3550  FF0314  10 F7         		bpl	?02
1045
 3551  FF0316  4C 34 01      	?04:	jmp	ErrCls2
1046
 3552  FF0319  86 E3         	?06:	stx	<atnum
1047
 3553  FF031B  20 5A 01      		jsr	GetParm		; get first param
1048
 3554  FF031E  B0 F6         		bcs	?04
1049
 3555  FF0320  4C 9B 2E      		jmp	atacmd
1050
 3556
1051
 3557                        	; prefixes table
1052
 3558  FF0323                	PFXTBL:
1053
 3559  FF0323  40 7C         		.DB	'@|'
1054
 3560  FF0325
1055
  Tue Jul 17 11:00:24 2018                                                                                               Page   18
1056
 
1057
 
1058
 
1059
 
1060
 3561          000001        	PFXLEN		.EQU	($ - PFXTBL - 1)
1061
 3562
1062
 3563                        	; prefix '@' commands table
1063
 3564  FF0325                	PATTBL:
1064
 3565  FF0325  45 5A 58 47 50 		.DB	'EZXGPDC'
1065
               44 43
1066
 3566          000007        	PATLD		.EQU	($ - PATTBL)
1067
 3567  FF032C  4C 53 56 52 57 		.DB	'LSVRWO'
1068
               4F
1069
 3568
1070
 3569          00000C        	PATLEN		.EQU	($ - PATTBL - 1)
1071
 3570
1072
 3571                        	; prefix '|' commands table
1073
 3572                        	; <r>ead pio mode - <w>rite pio mode - <v>erify pio mode
1074
 3573                        	; <c>lear ata device (sw reset) - <i>dentify device
1075
 3574                        	; <m>br sector load - <p>br sector load
1076
 3575                        	; <d>ma ata buffer on/off -  <b>ank dma buffer (0..7)
1077
 3576                        	; <R>ead dma mode - <W>rite dma mode
1078
 3577  FF0332                	PBARTBL:
1079
 3578  FF0332  72 76 77 63 69 		.DB	'rvwcimpdbRW'
1080
               6D 70 64 62 52
1081
               57
1082
 3579
1083
 3580          00000A        	PBARLEN		.EQU	($ - PBARTBL - 1)
1084
 3581
1085
 3582                        	; prefix commands vectors
1086
 3583  FF033D                	PFXVCTRS:
1087
 3584  FF033D  F601 0203     		.DW	pfx_at, pfx_bar
1088
 3585
1089
 3586  FF0341
1090
 3587                        	;---------------------------------------------------------------------------
1091
 3588                        	; keywords table
1092
 3589                        	;---------------------------------------------------------------------------
1093
 3590
1094
 3591  FF0341                	CMDTBL:
1095
 3592  FF0341  64 6D 61 72 E4 		.DC	'dmard'
1096
 3593  FF0346  64 75 6D 62 6F 		.DC	'dumbon'
1097
               EE
1098
 3594  FF034C  64 75 6D 62 6F 		.DC	'dumboff'
1099
               66 E6
1100
 3595  FF0353
1101
 3596  FF0353  63 62 6D 66 F3 		.DC	'cbmfs'
1102
 3597  FF0358  73 62 72 6B F0 		.DC	'sbrkp'
1103
 3598  FF035D  73 62 72 6B ED 		.DC	'sbrkm'
1104
 3599
1105
 3600  FF0362  65 64 69 F4   		.DC	'edit'
1106
 3601  FF0366  6D 6B 68 61 73 		.DC	'mkhash'
1107
               E8
1108
 3602  FF036C  71 75 69 F4   		.DC	'quit'
1109
 3603  FF0370  63 62 6D 70 61 		.DC	'cbmpas'	; CBM quick pascal
1110
               F3
1111
 3604  FF0376  78 6D 74 65 73 		.DC	'xmtest'
1112
               F4
1113
 3605  FF037C  62 65 65 F0   		.DC	'beep'
1114
 3606  FF0380
1115
 3607                        		; FDC diagnostic -- implementation in mond.asm
1116
 3608  FF0380  66 64 64 69 73 		.DC	'fddisk'	; invoca FDCTST
1117
  Tue Jul 17 11:00:24 2018                                                                                               Page   19
1118
 
1119
 
1120
 
1121
 
1122
               EB
1123
 3609  FF0386  66 64 72 65 F3 		.DC	'fdres'		; reset FDC controller UM8388
1124
 3610  FF038B  66 64 72 65 61 		.DC	'fdread'	; read disk sector's
1125
               E4
1126
 3611  FF0391  66 64 69 6E 69 		.DC	'fdinit'	; init drive
1127
               F4
1128
 3612  FF0397  66 64 66 6F 72 		.DC	'fdformat'	; format whole disk (low level)
1129
               6D 61 F4
1130
 3613  FF039F  66 64 77 72 69 		.DC	'fdwrite'	; write disk sector's
1131
               74 E5
1132
 3614  FF03A6  66 64 67 65 74 		.DC	'fdgetfmt'	; get current disk format
1133
               66 6D F4
1134
 3615  FF03AE  66 64 76 65 72 		.DC	'fdverfmt'	; verify disk format
1135
               66 6D F4
1136
 3616  FF03B6  66 64 76 65 72 		.DC	'fdverf'	; verify read
1137
               E6
1138
 3617  FF03BC  66 64 74 72 65 		.DC	'fdtread'	; read whole track
1139
               61 E4
1140
 3618  FF03C3  66 64 74 77 72 		.DC	'fdtwrite'	; write whole track
1141
               69 74 E5
1142
 3619  FF03CB  66 64 74 76 65 		.DC	'fdtverf'	; verify whole track
1143
               72 E6
1144
 3620  FF03D2  66 64 6E 65 F7 		.DC	'fdnew'		; new ram disk's
1145
 3621  FF03D7  66 64 66 F3   		.DC	'fdfs'		; new file system
1146
 3622  FF03DB  66 64 6C 73 79 		.DC	'fdlsys'	; load rom.bin
1147
               F3
1148
 3623
1149
 3624  FF03E1  66 6C 61 73 E8 		.DC	'flash'		; update flash from file (fdlsys)
1150
 3625  FF03E6  6D 66 6C 61 73 		.DC	'mflash'	; update flash from memory
1151
               E8
1152
 3626  FF03EC  65 66 6C 61 73 		.DC	'eflash'	; update flash from emulator
1153
               E8
1154
 3627  FF03F2
1155
 3628  FF03F2  63 6F F0      		.DC	'cop'
1156
 3629  FF03F5  74 72 75 E5   		.DC	'true'
1157
 3630  FF03F9  76 64 E3      		.DC	'vdc'		; cambia dot clock VDC
1158
 3631  FF03FC
1159
 3632                        		; assembler/disassembler mode
1160
 3633  FF03FC  70 38 31 B6   		.DC	'p816'		; set 65C816 mode (default mode)
1161
 3634  FF0400  70 63 30 B2   		.DC	'pc02'		; set 65C02 mode
1162
 3635  FF0404  70 30 B2      		.DC	'p02'		; set 6502 mode
1163
 3636  FF0407  61 6D B8      		.DC	'am8'
1164
 3637  FF040A  61 6D 31 B6   		.DC	'am16'
1165
 3638  FF040E  78 79 B8      		.DC	'xy8'
1166
 3639  FF0411  78 79 31 B6   		.DC	'xy16'
1167
 3640
1168
 3641                        		; memory bank clear/move
1169
 3642  FF0415  6B FA         		.DC	'kz'		; clear whole memory bank
1170
 3643  FF0417  6B E6         		.DC	'kf'		; fill whole memory bank
1171
 3644  FF0419  6B C6         		.DC	'kF'		; fill whole memory bank with pattern
1172
 3645  FF041B  6B 6D F6      		.DC	'kmv'		; move whole memory bank
1173
 3646  FF041E
1174
 3647  FF041E  63 72 F3      		.DC	'crs'		; show CR
1175
 3648  FF0421  63 72 E5      		.DC	'cre'		; enable EM
1176
 3649  FF0424  63 72 F8      		.DC	'crx'		; enable XM
1177
 3650  FF0427  63 72 E6      		.DC	'crf'		; enable FM
1178
 3651  FF042A  6D F8         		.DC	'mx'		; display XM
1179
  Tue Jul 17 11:00:24 2018                                                                                               Page   20
1180
 
1181
 
1182
 
1183
 
1184
 3652  FF042C  78 F3         		.DC	'xs'		; show XM in sectors
1185
 3653  FF042E  78 BE         		.DC	'x>'		; set extended mem
1186
 3654  FF0430  78 6D F0      		.DC	'xmp'		; set extended mem page
1187
 3655  FF0433  72 E4         		.DC	'rd'		; read single mem.
1188
 3656  FF0435  77 F2         		.DC	'wr'		; write single mem
1189
 3657  FF0437  6B 6D F4      		.DC	'kmt'		; full memory bank test
1190
 3658  FF043A  78 6D F4      		.DC	'xmt'		; eXtended memory test
1191
 3659  FF043D
1192
 3660  FF043D  74 E5         		.DC	'te'		; show RTC internal extended ram
1193
 3661  FF043F  65 BE         		.DC	'e>'		; set RTC internal extended ram
1194
 3662  FF0441  74 F5         		.DC	'tu'
1195
 3663  FF0443  74 F3         		.DC	'ts'
1196
 3664  FF0445  75 BE         		.DC	'u>'
1197
 3665  FF0447  74 E3         		.DC	'tc'
1198
 3666  FF0449  63 BE         		.DC	'c>'
1199
 3667  FF044B  67 F4         		.DC	'gt'		; get rtc time
1200
 3668  FF044D  67 E4         		.DC	'gd'		; get rtc date
1201
 3669  FF044F  73 F4         		.DC	'st'		; set rtc time
1202
 3670  FF0451  73 E4         		.DC	'sd'		; set rtc date
1203
 3671  FF0453
1204
 3672  FF0453  23 74 65 73 F4 		.DC	'#test'
1205
 3673  FF0458  23 73 74 72 63 		.DC	'#strcpy'
1206
               70 F9
1207
 3674  FF045F  23 66 64 69 73 		.DC	'#fdisk'
1208
               EB
1209
 3675  FF0465  23 73 70 74 65 		.DC	'#sptest'
1210
               73 F4
1211
 3676  FF046C  23 61 73 70 74 		.DC	'#asptest'
1212
               65 73 F4
1213
 3677
1214
 3678  FF0474  ED            		.DC	'm'		; display mem
1215
 3679  FF0475  BE            		.DC	'>'		; set mem
1216
 3680  FF0476  BB            		.DC	';'		; set registri
1217
 3681  FF0477  F2            		.DC	'r'		; show registri
1218
 3682  FF0478  FA            		.DC	'z'		; fill zero
1219
 3683  FF0479  E6            		.DC	'f'		; fill byte
1220
 3684  FF047A  C6            		.DC	'F'		; fill con byte auto-inc
1221
 3685  FF047B  E4            		.DC	'd'		; disassemble line (masmx.asm)
1222
 3686  FF047C  E1            		.DC	'a'		; assemble line (masmx.asm)
1223
 3687  FF047D  AE            		.DC	'.'		; assemble line (masmx.asm)
1224
 3688  FF047E  EA            		.DC	'j'		; jmp to soubroutine (terminate with rtl)
1225
 3689  FF047F  E7            		.DC	'g'		; jmp to soubroutine (terminate with brk)
1226
 3690  FF0480  00            		.DB	0
1227
 3691  FF0481
1228
 3692  FF0481                	CMDVCTRS:
1229
 3693  FF0481  2905          		.DW	Cmd_dmard
1230
 3694  FF0483  5C09 7409     		.DW	Cmd_dumbon, Cmd_dumboff
1231
 3695  FF0487
1232
 3696  FF0487  5705          		.DW	testcbm
1233
 3697  FF0489  C905          		.DW	Cmd_sbrkp
1234
 3698  FF048B  D405          		.DW	Cmd_sbrkm
1235
 3699  FF048D
1236
 3700  FF048D  2B06          		.DW	Cmd_edit
1237
 3701  FF048F  1C28          		.DW	Cmd_mkhash
1238
 3702  FF0491  9307 A007 6A07 		.DW	Cmd_quit, Cmd_cbmpas, Cmd_xmtest
1239
 3703  FF0497  3006          		.DW	Cmd_beep
1240
 3704  FF0499
1241
  Tue Jul 17 11:00:24 2018                                                                                               Page   21
1242
 
1243
 
1244
 
1245
 
1246
 3705                        		; FDC diagnostic -- implementation in mond.asm
1247
 3706  FF0499  AB2B A42B EA2D 		.DW	Cmd_fddisk, Cmd_fdres, Cmd_fdread, Cmd_fdinit
1248
               E82B
1249
 3707  FF04A1  002C D02D 672B 		.DW	Cmd_fdformat, Cmd_fdwrite, Cmd_fdgetfmt, Cmd_fdverfmt
1250
               4F2C
1251
 3708  FF04A9  DD2D 872D 7E2D 		.DW	Cmd_fdverf, Cmd_fdtread, Cmd_fdtwrite, Cmd_fdtverf
1252
               902D
1253
 3709  FF04B1  452B 312E 7B28 		.DW	Cmd_fdnew, Cmd_fdfs, Cmd_fdlsys
1254
 3710  FF04B7
1255
 3711  FF04B7  C41B CF1B 8B1B 		.DW	Cmd_flash, Cmd_mflash, Cmd_eflash
1256
 3712  FF04BD
1257
 3713  FF04BD  B207 ED08 8409 		.DW	Cmd_cop, Cmd_true, Cmd_vdc
1258
 3714
1259
 3715                        		; assembler/disassembler mode
1260
 3716  FF04C3  5606 5A06 5E06 		.DW	Cmd_p816, Cmd_pc02, Cmd_p02, Cmd_am8, Cmd_am16, Cmd_xy8
1261
               A606 AC06 F006
1262
 3717  FF04CF  2B07          		.DW	Cmd_xy16
1263
 3718  FF04D1
1264
 3719                        		; memory bank clear/move
1265
 3720  FF04D1  B70F DE0F 7B0F 		.DW	Cmd_kz, Cmd_kf, Cmd_kF, Cmd_km
1266
               330F
1267
 3721  FF04D9
1268
 3722  FF04D9  620D 3D0D 4A0D 		.DW	Cmd_crs, Cmd_cre, Cmd_crx, Cmd_crf
1269
               570D
1270
 3723  FF04E1  7E0E 620E 5210 		.DW	Cmd_mx, Cmd_xs, Cmd_SetXMem, Cmd_SetXMPage
1271
               A70D
1272
 3724  FF04E9  230E 3D0E 760B 		.DW	Cmd_rd, Cmd_wr, Cmd_kmt, Cmd_xmt
1273
               4D0A
1274
 3725  FF04F1
1275
 3726  FF04F1  F910 0811 D411 		.DW	Cmd_te, Cmd_stxm, Cmd_tu, Cmd_ts, Cmd_stum, Cmd_tc, Cmd_stcm
1276
               CE11 E711 AE12
1277
               D012
1278
 3727  FF04FF  7413 B513 EF13 		.DW	Cmd_gt, Cmd_gd, Cmd_st, Cmd_sd
1279
               2D14
1280
 3728
1281
 3729  FF0507  0215 CC14 B714 		.DW	Cmd_test, Cmd_strcpy, Cmd_fdisk, Cmd_sptst, Cmd_asptst
1282
               1630 4732
1283
 3730
1284
 3731  FF0511  D80D D70E F40C 		.DW	Cmd_m, Cmd_SetMem, Cmd_SetReg, PrintReg
1285
               820C
1286
 3732  FF0519  1310 1E10 2C10 		.DW	Cmd_z, Cmd_f, Cmd_F, Cmd_d, Cmd_a, Cmd_a
1287
               F71C 2D20 2D20
1288
 3733  FF0525  F606 1007     		.DW	Cmd_j, Cmd_g
1289
 3734
1290
 3735
1291
 3736  FF0529                	Cmd_dmard:
1292
 3737  FF0529  A9 00         		lda	#0
1293
 3738  FF052B  48            		pha
1294
 3739  FF052C  48            		pha
1295
 3740  FF052D  F4 00 00      		pea	#0
1296
 3741  FF0530  A2 01         		ldx	#1
1297
 3742  FF0532  DA            		phx
1298
 3743  FF0533  48            		pha
1299
 3744  FF0534  F4 00 00      		pea	#0
1300
 3745  FF0537                		ATADMARD
1301
 3746  FF0537  02 42         		cop	$42
1302
 3747  FF0539  00            		.DB	$00
1303
  Tue Jul 17 11:00:24 2018                                                                                               Page   22
1304
 
1305
 
1306
 
1307
 
1308
 3748                        		.MNLIST
1309
 3749  FF053A  60            		rts
1310
 3750
1311
 3751                        	; ---- TEST CBM
1312
 3752  FF053B                	getstr:
1313
 3753  FF053B                		SCN_CR
1314
 3754  FF053B                		SCNPRCHAR
1315
 3755                        		.MLIST
1316
 3756  FF053B  02 07         		cop	$07
1317
 3757                        		.MNLIST
1318
 3758  FF053D  0D            		.DB	$0D
1319
 3759                        		.MNLIST
1320
 3760  FF053E  A2 00         		ldx	#0
1321
 3761  FF0540  CA            		dex
1322
 3762  FF0541  E8            	?01:	inx			; ciclo input
1323
 3763  FF0542  E0 A2         		cpx	#INPBUFLEN
1324
 3764  FF0544  B0 0A         		bcs	?02
1325
 3765  FF0546                		KBCHARIN	; input tastiera
1326
 3766  FF0546  02 0F         		cop	$0F
1327
 3767                        		.MNLIST
1328
 3768  FF0548  9F 00 99 01   		sta	>INPUTBUF,x
1329
 3769  FF054C  C9 0D         		cmp	#KB_CR
1330
 3770  FF054E  D0 F1         		bne	?01
1331
 3771  FF0550  A9 0D         	?02:	lda	#KB_CR
1332
 3772  FF0552  9F 00 99 01   		sta	>INPUTBUF,x
1333
 3773  FF0556  60            		rts
1334
 3774
1335
 3775  FF0557                	testcbm:
1336
 3776  FF0557  D0 04         		bne	?02
1337
 3777  FF0559  A9 0F         		lda	#15
1338
 3778  FF055B  85 BA         		sta	SMTmpL
1339
 3779  FF055D  A5 BA         	?02:	lda	SMTmpL
1340
 3780  FF055F  C9 FF         		cmp	#$FF
1341
 3781  FF0561  D0 05         		bne	?02a
1342
 3782  FF0563  20 5B 19      		jsr	PrintCR
1343
 3783  FF0566  80 33         		bra	cbmer
1344
 3784  FF0568  29 0F         	?02a:	and	#$0F
1345
 3785  FF056A  C9 0F         		cmp	#$0F
1346
 3786  FF056C  F0 02         		beq	?03
1347
 3787  FF056E  09 80         		ora	#$80
1348
 3788  FF0570  85 BA         	?03:	sta	SMTmpL
1349
 3789
1350
 3790  FF0572                		SCNPRINT
1351
 3791  FF0572  02 01         		cop	$01
1352
 3792                        		.MNLIST
1353
 3793  FF0574  0D 54 79 70 65 		.DB	$0D, 'Type command string:', 0
1354
               20 63 6F 6D 6D
1355
               61 6E 64 20 73
1356
               74 72 69 6E 67
1357
               3A 00
1358
 3794  FF058A  20 3B 05      		jsr	getstr
1359
 3795  FF058D                		SCN_CR
1360
 3796  FF058D                		SCNPRCHAR
1361
 3797                        		.MLIST
1362
 3798  FF058D  02 07         		cop	$07
1363
 3799                        		.MNLIST
1364
 3800  FF058F  0D            		.DB	$0D
1365
  Tue Jul 17 11:00:24 2018                                                                                               Page   23
1366
 
1367
 
1368
 
1369
 
1370
 3801                        		.MNLIST
1371
 3802  FF0590  A9 01         		lda	#^INPUTBUF
1372
 3803  FF0592  48            		pha
1373
 3804  FF0593  F4 00 99      		pea	#!INPUTBUF
1374
 3805  FF0596  A5 BA         		lda	SMTmpL
1375
 3806  FF0598  48            		pha
1376
 3807  FF0599                		CBMFSCMD
1377
 3808  FF0599  02 80         		cop	FN_CBMFSCMD
1378
 3809                        		.MNLIST
1379
 3810
1380
 3811                        	;;	bcs	?04
1381
 3812                        	;;	ldy	#0
1382
 3813                        	;;?04:	tya
1383
 3814                        	;;	jmp	PrintByte
1384
 3815
1385
 3816  FF059B                	cbmer:
1386
 3817  FF059B                		ACC16
1387
 3818  FF059B  C2 20         		rep	#PMFLAG
1388
 3819                        		.LONGA	on
1389
 3820                        		.MNLIST
1390
 3821  FF059D  3B            		tsc
1391
 3822  FF059E  38            		sec
1392
 3823  FF059F  E9 80 00      		sbc	#128
1393
 3824  FF05A2  1B            		tcs
1394
 3825  FF05A3  1A            		inc	a
1395
 3826  FF05A4  A2 00         		ldx	#0
1396
 3827  FF05A6  DA            		phx
1397
 3828  FF05A7  48            		pha
1398
 3829  FF05A8  F4 80 00      		pea	#128
1399
 3830  FF05AB                		ACC08
1400
 3831  FF05AB  E2 20         		sep	#PMFLAG
1401
 3832                        		.LONGA	off
1402
 3833                        		.MNLIST
1403
 3834  FF05AD  A9 0F         		lda	#15
1404
 3835  FF05AF  48            		pha
1405
 3836  FF05B0                		CBMFSRD
1406
 3837  FF05B0  02 81         		cop	FN_CBMFSRW
1407
 3838  FF05B2  00            		.DB	$00
1408
 3839                        		.MNLIST
1409
 3840  FF05B3                		ACC16
1410
 3841  FF05B3  C2 20         		rep	#PMFLAG
1411
 3842                        		.LONGA	on
1412
 3843                        		.MNLIST
1413
 3844  FF05B5  3B            		tsc
1414
 3845  FF05B6  1A            		inc	a
1415
 3846  FF05B7                		ACC08
1416
 3847  FF05B7  E2 20         		sep	#PMFLAG
1417
 3848                        		.LONGA	off
1418
 3849                        		.MNLIST
1419
 3850  FF05B9  A2 00         		ldx	#0
1420
 3851  FF05BB                		SCNSTROUT
1421
 3852  FF05BB  02 03         		cop	$03
1422
 3853                        		.MNLIST
1423
 3854  FF05BD                		ACC16CLC
1424
 3855  FF05BD  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
1425
 3856                        		.LONGA	on
1426
 3857                        		.MNLIST
1427
  Tue Jul 17 11:00:24 2018                                                                                               Page   24
1428
 
1429
 
1430
 
1431
 
1432
 3858  FF05BF  3B            		tsc
1433
 3859  FF05C0  69 80 00      		adc	#128
1434
 3860  FF05C3  1B            		tcs
1435
 3861  FF05C4                		ACC08
1436
 3862  FF05C4  E2 20         		sep	#PMFLAG
1437
 3863                        		.LONGA	off
1438
 3864                        		.MNLIST
1439
 3865  FF05C6  4C 5B 19      		jmp	PrintCR
1440
 3866  FF05C9
1441
 3867  FF05C9
1442
 3868                        	; --------
1443
 3869  FF05C9                	Cmd_sbrkp:
1444
 3870  FF05C9  D0 06         		bne	?01
1445
 3871  FF05CB  64 BA         		stz	SMTmpL
1446
 3872  FF05CD  64 BB         		stz	SMTmpH
1447
 3873  FF05CF  64 F8         		stz	SMdwTmp3
1448
 3874  FF05D1  18            	?01:	clc
1449
 3875  FF05D2  80 0B         		bra	_sbrk
1450
 3876
1451
 3877  FF05D4                	Cmd_sbrkm:
1452
 3878  FF05D4  D0 04         		bne	?01
1453
 3879  FF05D6  64 BA         		stz	SMTmpL
1454
 3880  FF05D8  64 BB         		stz	SMTmpH
1455
 3881  FF05DA  38            	?01:	sec
1456
 3882  FF05DB  A9 80         		lda	#$80
1457
 3883  FF05DD  85 F8         		sta	SMdwTmp3
1458
 3884  FF05DF
1459
 3885  FF05DF                	_sbrk:
1460
 3886  FF05DF  08            		php
1461
 3887  FF05E0  20 5B 19      		jsr	PrintCR
1462
 3888  FF05E3  28            		plp
1463
 3889  FF05E4  A5 BB         		lda	SMTmpH
1464
 3890  FF05E6  EB            		xba
1465
 3891  FF05E7  A5 BA         		lda	SMTmpL
1466
 3892  FF05E9                		SETBRK
1467
 3893  FF05E9  02 7F         		cop	FN_SETBRK
1468
 3894                        		.MNLIST
1469
 3895  FF05EB  B0 1C         		bcs	?10
1470
 3896  FF05ED  EB            		xba
1471
 3897  FF05EE  AA            		tax			; HI
1472
 3898  FF05EF  EB            		xba			; LOW
1473
 3899  FF05F0  20 48 19      		jsr	PrintWord
1474
 3900  FF05F3  A5 BA         		lda	SMTmpL
1475
 3901  FF05F5  05 BB         		ora	SMTmpH
1476
 3902  FF05F7  F0 0D         		beq	?06
1477
 3903  FF05F9  A9 00         		lda	#0
1478
 3904  FF05FB  EB            		xba
1479
 3905  FF05FC  A9 00         		lda	#0
1480
 3906  FF05FE                		SETBRK
1481
 3907  FF05FE  02 7F         		cop	FN_SETBRK
1482
 3908                        		.MNLIST
1483
 3909  FF0600  EB            		xba
1484
 3910  FF0601  AA            		tax			; HI
1485
 3911  FF0602  EB            		xba			; LOW
1486
 3912  FF0603  20 48 19      		jsr	PrintWord
1487
 3913  FF0606  4C 5B 19      	?06:	jmp	PrintCR
1488
 3914  FF0609                	?10:	SCNPRINT
1489
  Tue Jul 17 11:00:24 2018                                                                                               Page   25
1490
 
1491
 
1492
 
1493
 
1494
 3915  FF0609  02 01         		cop	$01
1495
 3916                        		.MNLIST
1496
 3917  FF060B  0D 3A 3A 20 45 		.DB	$0D, ':: Error -> ', 0
1497
               72 72 6F 72 20
1498
               2D 3E 20 00
1499
 3918  FF0619  48            		pha
1500
 3919  FF061A  98            		tya
1501
 3920  FF061B  20 4E 19      		jsr	PrintByte
1502
 3921  FF061E  20 51 19      		jsr	PrintBlank
1503
 3922  FF0621  68            		pla
1504
 3923  FF0622  EB            		xba
1505
 3924  FF0623  AA            		tax
1506
 3925  FF0624  EB            		xba
1507
 3926  FF0625  20 48 19      		jsr	PrintWord
1508
 3927  FF0628  4C 5B 19      		jmp	PrintCR
1509
 3928
1510
 3929  FF062B                	Cmd_edit:
1511
 3930                        		;phb
1512
 3931                        		;phd
1513
 3932                        		;pea	#$4000
1514
 3933                        		;lda	#$40
1515
 3934                        		;pha
1516
 3935  FF062B  22 B3 17 FD   		jsl	qedtent
1517
 3936                        		;pla
1518
 3937                        		;pla
1519
 3938                        		;pla
1520
 3939                        		;pld
1521
 3940                        		;plb
1522
 3941  FF062F  60            		rts
1523
 3942  FF0630
1524
 3943  FF0630                	Cmd_beep:
1525
 3944  FF0630  90 06         		bcc	?01
1526
 3945  FF0632  A9 B0         		lda	#10110000B	; CTC 2 in modo 0 - 2 bytes
1527
 3946  FF0634  8D 4B FD      		sta	CTC0+CTCCTRL
1528
 3947  FF0637  60            		rts
1529
 3948  FF0638  A9 B0         	?01:	lda	#10110000B	; CTC 2 in modo 0 - 2 bytes
1530
 3949  FF063A  8D 4B FD      		sta	CTC0+CTCCTRL
1531
 3950  FF063D  A5 BA         		lda	SMTmpL
1532
 3951  FF063F  05 BB         		ora	SMTmpH
1533
 3952  FF0641  F0 12         		beq	?02
1534
 3953  FF0643  A5 BA         		lda	SMTmpL
1535
 3954  FF0645  8D 4A FD      		sta	CTC0+CTCCNT2
1536
 3955  FF0648  A5 BB         		lda	SMTmpH
1537
 3956  FF064A  8D 4A FD      		sta	CTC0+CTCCNT2
1538
 3957  FF064D  A9 08         		lda	#$08
1539
 3958  FF064F  1C 2B FD      		trb	PIA0+PIACRB
1540
 3959  FF0652  1C 29 FD      		trb	PIA0+PIACRA
1541
 3960  FF0655  60            	?02:	rts
1542
 3961
1543
 3962  FF0656                	Cmd_p816:
1544
 3963  FF0656  A9 00         		lda	#0
1545
 3964  FF0658  80 06         		bra	_pset
1546
 3965  FF065A
1547
 3966  FF065A                	Cmd_pc02:
1548
 3967  FF065A  A9 C0         		lda	#$C0
1549
 3968  FF065C  80 02         		bra	_pset
1550
 3969  FF065E
1551
  Tue Jul 17 11:00:24 2018                                                                                               Page   26
1552
 
1553
 
1554
 
1555
 
1556
 3970  FF065E                	Cmd_p02:
1557
 3971  FF065E  A9 80         		lda	#$80
1558
 3972
1559
 3973  FF0660                	_pset:
1560
 3974  FF0660  85 D9         		sta	asmcpu
1561
 3975  FF0662                		SCNPRINT
1562
 3976  FF0662  02 01         		cop	$01
1563
 3977                        		.MNLIST
1564
 3978  FF0664  0D 3A 3A 20 43 		.DB	$0D, ':: Current assembler mode -> ', 0
1565
               75 72 72 65 6E
1566
               74 20 61 73 73
1567
               65 6D 62 6C 65
1568
               72 20 6D 6F 64
1569
               65 20 2D 3E 20
1570
               00
1571
 3979  FF0683  A5 D9         		lda	asmcpu
1572
 3980  FF0685  D0 0A         		bne	?02
1573
 3981  FF0687                		SCNPRINT
1574
 3982  FF0687  02 01         		cop	$01
1575
 3983                        		.MNLIST
1576
 3984  FF0689  36 35 43 38 31 		.DB	'65C816', 0
1577
               36 00
1578
 3985  FF0690  60            		rts
1579
 3986  FF0691  24 D9         	?02:	bit	asmcpu
1580
 3987  FF0693  50 09         		bvc	?04
1581
 3988  FF0695                		SCNPRINT
1582
 3989  FF0695  02 01         		cop	$01
1583
 3990                        		.MNLIST
1584
 3991  FF0697  36 35 43 30 32 		.DB	'65C02', 0
1585
               00
1586
 3992  FF069D  60            		rts
1587
 3993  FF069E                	?04:
1588
 3994  FF069E                		SCNPRINT
1589
 3995  FF069E  02 01         		cop	$01
1590
 3996                        		.MNLIST
1591
 3997  FF06A0  36 35 30 32 00 		.DB	'6502', 0
1592
 3998  FF06A5  60            		rts
1593
 3999
1594
 4000  FF06A6                	Cmd_am8:
1595
 4001  FF06A6  A9 80         		lda	#$80
1596
 4002  FF06A8  14 D8         		trb	asmlong
1597
 4003  FF06AA  80 04         		bra	_amx
1598
 4004  FF06AC
1599
 4005  FF06AC                	Cmd_am16:
1600
 4006  FF06AC  A9 80         		lda	#$80
1601
 4007  FF06AE  04 D8         		tsb	asmlong
1602
 4008  FF06B0                	_amx:
1603
 4009  FF06B0                		SCNPRINT
1604
 4010  FF06B0  02 01         		cop	$01
1605
 4011                        		.MNLIST
1606
 4012  FF06B2  0D 3A 3A 20 41 		.DB	$0D, ':: Accumulator/Memory 65C816 mode -> ', 0
1607
               63 63 75 6D 75
1608
               6C 61 74 6F 72
1609
               2F 4D 65 6D 6F
1610
               72 79 20 36 35
1611
               43 38 31 36 20
1612
               6D 6F 64 65 20
1613
  Tue Jul 17 11:00:24 2018                                                                                               Page   27
1614
 
1615
 
1616
 
1617
 
1618
               2D 3E 20 00
1619
 4013  FF06D9  24 D8         		bit	asmlong
1620
 4014  FF06DB  10 0A         		bpl	?02
1621
 4015  FF06DD                		SCNPRINT
1622
 4016  FF06DD  02 01         		cop	$01
1623
 4017                        		.MNLIST
1624
 4018  FF06DF  31 36 20 62 69 		.DB	'16 bit', 0
1625
               74 00
1626
 4019  FF06E6  60            		rts
1627
 4020  FF06E7                	?02:	SCNPRINT
1628
 4021  FF06E7  02 01         		cop	$01
1629
 4022                        		.MNLIST
1630
 4023  FF06E9  38 20 62 69 74 		.DB	'8 bit', 0
1631
               00
1632
 4024  FF06EF  60            		rts
1633
 4025
1634
 4026  FF06F0                	Cmd_xy8:
1635
 4027  FF06F0  A9 40         		lda	#$40
1636
 4028  FF06F2  14 D8         		trb	asmlong
1637
 4029  FF06F4  80 39         		bra	_xy
1638
 4030
1639
 4031  FF06F6                	Cmd_j:
1640
 4032  FF06F6  68            		pla
1641
 4033  FF06F7  68            		pla
1642
 4034  FF06F8  20 3D 01      		jsr	_setpc
1643
 4035  FF06FB  22 15 07 FF   		jsl	_ldregs
1644
 4036  FF06FF                		CPU16
1645
 4037  FF06FF  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
1646
 4038                        		.LONGA	on
1647
 4039                        		.LONGI	on
1648
 4040                        		.MNLIST
1649
 4041  FF0701  85 CE         		sta	SMac
1650
 4042  FF0703  86 D0         		stx	SMxr
1651
 4043  FF0705  84 D2         		sty	SMyr
1652
 4044  FF0707                		CPU08
1653
 4045  FF0707  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
1654
 4046                        		.LONGA	off
1655
 4047                        		.LONGI	off
1656
 4048                        		.MNLIST
1657
 4049  FF0709  08            		php
1658
 4050  FF070A  68            		pla
1659
 4051  FF070B  85 CA         		sta	SMsr
1660
 4052  FF070D  4C BE 00      		jmp	_SysMon2
1661
 4053  FF0710
1662
 4054  FF0710                	Cmd_g:
1663
 4055  FF0710  68            		pla
1664
 4056  FF0711  68            		pla
1665
 4057  FF0712  20 3D 01      		jsr	_setpc
1666
 4058  FF0715
1667
 4059  FF0715                	_ldregs:
1668
 4060  FF0715  A5 C7         		lda	SMkr
1669
 4061  FF0717  48            		pha
1670
 4062  FF0718                		ACC16
1671
 4063  FF0718  C2 20         		rep	#PMFLAG
1672
 4064                        		.LONGA	on
1673
 4065                        		.MNLIST
1674
 4066  FF071A  A5 C8         		lda	SMpc
1675
  Tue Jul 17 11:00:24 2018                                                                                               Page   28
1676
 
1677
 
1678
 
1679
 
1680
 4067  FF071C  48            		pha
1681
 4068  FF071D  A6 CA         		ldx	SMsr
1682
 4069  FF071F  DA            		phx
1683
 4070  FF0720                		CPU16
1684
 4071  FF0720  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
1685
 4072                        		.LONGA	on
1686
 4073                        		.LONGI	on
1687
 4074                        		.MNLIST
1688
 4075  FF0722  A5 CE         		lda	SMac
1689
 4076  FF0724  A6 D0         		ldx	SMxr
1690
 4077  FF0726  A4 D2         		ldy	SMyr
1691
 4078  FF0728                		CPU08
1692
 4079  FF0728  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
1693
 4080                        		.LONGA	off
1694
 4081                        		.LONGI	off
1695
 4082                        		.MNLIST
1696
 4083  FF072A  40            		rti
1697
 4084  FF072B
1698
 4085  FF072B                	Cmd_xy16:
1699
 4086  FF072B  A9 40         		lda	#$40
1700
 4087  FF072D  04 D8         		tsb	asmlong
1701
 4088  FF072F                	_xy:
1702
 4089  FF072F                		SCNPRINT
1703
 4090  FF072F  02 01         		cop	$01
1704
 4091                        		.MNLIST
1705
 4092  FF0731  0D 3A 3A 20 58 		.DB	$0D, ':: X&Y registers 65C816 mode -> ', 0
1706
               26 59 20 72 65
1707
               67 69 73 74 65
1708
               72 73 20 36 35
1709
               43 38 31 36 20
1710
               6D 6F 64 65 20
1711
               2D 3E 20 00
1712
 4093  FF0753  24 D8         		bit	asmlong
1713
 4094  FF0755  50 0A         		bvc	?02
1714
 4095  FF0757                		SCNPRINT
1715
 4096  FF0757  02 01         		cop	$01
1716
 4097                        		.MNLIST
1717
 4098  FF0759  31 36 20 62 69 		.DB	'16 bit', 0
1718
               74 00
1719
 4099  FF0760  60            		rts
1720
 4100  FF0761                	?02:	SCNPRINT
1721
 4101  FF0761  02 01         		cop	$01
1722
 4102                        		.MNLIST
1723
 4103  FF0763  38 20 62 69 74 		.DB	'8 bit', 0
1724
               00
1725
 4104  FF0769  60            		rts
1726
 4105
1727
 4106  FF076A                	Cmd_xmtest:
1728
 4107  FF076A  D0 04         		bne	?01
1729
 4108  FF076C  64 BA         		stz	SMTmpL
1730
 4109  FF076E  64 BB         		stz	SMTmpH
1731
 4110  FF0770                	?01:	ACC16CLC		; A/M 16 bit + CLC
1732
 4111  FF0770  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
1733
 4112                        		.LONGA	on
1734
 4113                        		.MNLIST
1735
 4114  FF0772  A5 BA         		lda	SMTmpL		; LBA
1736
 4115  FF0774  6A            	?02:	ror	a		; divide by 16 to get xmem bank
1737
  Tue Jul 17 11:00:24 2018                                                                                               Page   29
1738
 
1739
 
1740
 
1741
 
1742
 4116  FF0775  6A            		ror	a
1743
 4117  FF0776  6A            		ror	a
1744
 4118  FF0777  6A            		ror	a
1745
 4119  FF0778                		ACC08
1746
 4120  FF0778  E2 20         		sep	#PMFLAG
1747
 4121                        		.LONGA	off
1748
 4122                        		.MNLIST
1749
 4123                        		;sta	SMTmpK		; ram disk bank
1750
 4124  FF077A  EB            		xba			; B = bank, A = modulus
1751
 4125  FF077B  6A            		ror	a		; shift in last carry
1752
 4126  FF077C  4A            		lsr	a		; calc the modulo
1753
 4127  FF077D  4A            		lsr	a
1754
 4128  FF077E  4A            		lsr	a		; MSB of xmem
1755
 4129  FF077F  18            		clc
1756
 4130  FF0780  69 20         		adc	#$20		; add the physical start of xmem
1757
 4131  FF0782  48            		pha
1758
 4132  FF0783  EB            		xba			; return in A the ram disk bank
1759
 4133  FF0784  48            		pha
1760
 4134  FF0785                		TXT_CR
1761
 4135  FF0785                		TXTPRCHAR
1762
 4136                        		.MLIST
1763
 4137  FF0785  02 08         		cop	$08
1764
 4138                        		.MNLIST
1765
 4139  FF0787  0D            		.DB	$0D
1766
 4140                        		.MNLIST
1767
 4141  FF0788  68            		pla
1768
 4142  FF0789  20 4E 19      		jsr	PrintByte
1769
 4143  FF078C  FA            		plx
1770
 4144  FF078D  A9 00         		lda	#0
1771
 4145  FF078F  20 48 19      		jsr	PrintWord
1772
 4146  FF0792  60            		rts
1773
 4147
1774
 4148  FF0793                	Cmd_quit:
1775
 4149  FF0793  A5 DA         		lda	SMctx
1776
 4150  FF0795  D0 03         		bne	?02
1777
 4151  FF0797  4C 1B 0A      		jmp	CmdErr3
1778
 4152  FF079A                	?02:	SCN_CR
1779
 4153  FF079A                		SCNPRCHAR
1780
 4154                        		.MLIST
1781
 4155  FF079A  02 07         		cop	$07
1782
 4156                        		.MNLIST
1783
 4157  FF079C  0D            		.DB	$0D
1784
 4158                        		.MNLIST
1785
 4159  FF079D  DC DB 01      		jml	[DP01ADDR+SMrsm]
1786
 4160  FF07A0
1787
 4161  FF07A0                	Cmd_cbmpas:
1788
 4162  FF07A0  A5 DA         		lda	SMctx
1789
 4163  FF07A2  F0 03         		beq	?02
1790
 4164  FF07A4  4C 1B 0A      		jmp	CmdErr3
1791
 4165  FF07A7  A0 00         	?02:	ldy	#0
1792
 4166  FF07A9  22 00 FF FE   		jsl	CBMCOLD
1793
 4167  FF07AD  64 DA         		stz	SMctx
1794
 4168  FF07AF  4C 82 0C      		jmp	PrintReg
1795
 4169  FF07B2
1796
 4170  FF07B2                	Cmd_cop:
1797
 4171  FF07B2                	?00:	KBGETIN
1798
 4172  FF07B2  02 17         		cop	$17
1799
  Tue Jul 17 11:00:24 2018                                                                                               Page   30
1800
 
1801
 
1802
 
1803
 
1804
 4173                        		.MNLIST
1805
 4174  FF07B4  C9 00         		cmp	#$00
1806
 4175  FF07B6  F0 FA         		beq	?00
1807
 4176  FF07B8  EB            		xba
1808
 4177  FF07B9  AA            		tax
1809
 4178  FF07BA  EB            		xba
1810
 4179  FF07BB                		SCN_CR
1811
 4180  FF07BB                		SCNPRCHAR
1812
 4181                        		.MLIST
1813
 4182  FF07BB  02 07         		cop	$07
1814
 4183                        		.MNLIST
1815
 4184  FF07BD  0D            		.DB	$0D
1816
 4185                        		.MNLIST
1817
 4186  FF07BE  20 48 19      		jsr	PrintWord
1818
 4187  FF07C1                		SCN_CR
1819
 4188  FF07C1                		SCNPRCHAR
1820
 4189                        		.MLIST
1821
 4190  FF07C1  02 07         		cop	$07
1822
 4191                        		.MNLIST
1823
 4192  FF07C3  0D            		.DB	$0D
1824
 4193                        		.MNLIST
1825
 4194  FF07C4  A5 64         		lda	DP01ADDR+KbdFlag
1826
 4195  FF07C6  20 4E 19      		jsr	PrintByte
1827
 4196  FF07C9  A5 65         		lda	DP01ADDR+KbdToggle
1828
 4197  FF07CB  4C 4E 19      		jmp	PrintByte
1829
 4198  FF07CE
1830
 4199  FF07CE  D0 03         		bne	?01
1831
 4200  FF07D0  4C 1B 0A      		jmp	CmdErr3
1832
 4201  FF07D3  A5 BC         	?01:	lda	SMTmpK
1833
 4202                        		;ora	SMTmpH
1834
 4203  FF07D5  F0 03         		beq	?02
1835
 4204  FF07D7  4C 1B 0A      		jmp	CmdErr3
1836
 4205                        	?02:	;ldx	SMTmpL
1837
 4206                        		;pea	$0000
1838
 4207                        		;pea	$0001
1839
 4208                        		;pea	$0002
1840
 4209                        		;cop	$13
1841
 4210  FF07DA  4C 74 08      		jmp	?13
1842
 4211  FF07DD
1843
 4212  FF07DD  A9 12         		lda	#18
1844
 4213  FF07DF  85 F8         		sta	SMdwTmp3
1845
 4214  FF07E1  64 F9         		stz	SMdwTmp3+1
1846
 4215  FF07E3  0A            		asl	a
1847
 4216  FF07E4  85 EA         		sta	SMdwTmp2
1848
 4217  FF07E6  64 EB         		stz	SMdwTmp2+1
1849
 4218  FF07E8  A5 BB         		lda	SMTmpH
1850
 4219  FF07EA  EB            		xba
1851
 4220  FF07EB  A5 BA         		lda	SMTmpL
1852
 4221  FF07ED  A2 10         		ldx	#16
1853
 4222  FF07EF                		CPU16
1854
 4223  FF07EF  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
1855
 4224                        		.LONGA	on
1856
 4225                        		.LONGI	on
1857
 4226                        		.MNLIST
1858
 4227  FF07F1  64 E6         		stz	SMdwTmp1	; azzera rem
1859
 4228  FF07F3  2A            	?04:	rol	a
1860
 4229  FF07F4  26 E6         		rol	SMdwTmp1
1861
  Tue Jul 17 11:00:24 2018                                                                                               Page   31
1862
 
1863
 
1864
 
1865
 
1866
 4230  FF07F6  A8            		tay
1867
 4231  FF07F7  38            		sec
1868
 4232  FF07F8  A5 E6         		lda	SMdwTmp1
1869
 4233  FF07FA  E5 EA         		sbc	SMdwTmp2
1870
 4234  FF07FC  90 02         		bcc	?06
1871
 4235  FF07FE  85 E6         		sta	SMdwTmp1
1872
 4236  FF0800  98            	?06:	tya
1873
 4237  FF0801  CA            		dex
1874
 4238  FF0802  D0 EF         		bne	?04
1875
 4239  FF0804  2A            		rol	a
1876
 4240  FF0805                		CPU08
1877
 4241  FF0805  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
1878
 4242                        		.LONGA	off
1879
 4243                        		.LONGI	off
1880
 4244                        		.MNLIST
1881
 4245  FF0807  85 F0         		sta	SMXPos2
1882
 4246  FF0809  A2 00         		ldx	#0
1883
 4247  FF080B  38            		sec
1884
 4248  FF080C  A5 E6         		lda	SMdwTmp1
1885
 4249  FF080E  E5 F8         		sbc	SMdwTmp3
1886
 4250  FF0810  B0 04         		bcs	?08
1887
 4251  FF0812  65 F8         		adc	SMdwTmp3
1888
 4252  FF0814  80 01         		bra	?09
1889
 4253  FF0816  E8            	?08:	inx
1890
 4254  FF0817  86 F1         	?09:	stx	SMYPos2
1891
 4255  FF0819  1A            		inc	a
1892
 4256  FF081A  85 F2         		sta	SMXPos3
1893
 4257  FF081C
1894
 4258  FF081C  A5 F0         		lda	SMXPos2
1895
 4259  FF081E  0A            		asl	a
1896
 4260  FF081F  18            		clc
1897
 4261  FF0820  65 F1         		adc	SMYPos2
1898
 4262  FF0822  85 BC         		sta	SMTmpK
1899
 4263  FF0824  A9 00         		lda	#0
1900
 4264  FF0826  A2 09         		ldx	#9
1901
 4265  FF0828  18            		clc
1902
 4266  FF0829  6A            	?10:	ror	a
1903
 4267  FF082A  66 BC         		ror	SMTmpK
1904
 4268  FF082C  90 03         		bcc	?12
1905
 4269  FF082E  18            		clc
1906
 4270  FF082F  65 F8         		adc	SMdwTmp3
1907
 4271  FF0831  CA            	?12:	dex
1908
 4272  FF0832  D0 F5         		bne	?10
1909
 4273  FF0834  A6 F2         		ldx	SMXPos3
1910
 4274  FF0836  86 E6         		stx	SMdwTmp1
1911
 4275  FF0838  64 E7         		stz	SMdwTmp1+1
1912
 4276  FF083A  18            		clc
1913
 4277  FF083B  EB            		xba
1914
 4278  FF083C  A5 BC         		lda	SMTmpK
1915
 4279  FF083E                		ACC16
1916
 4280  FF083E  C2 20         		rep	#PMFLAG
1917
 4281                        		.LONGA	on
1918
 4282                        		.MNLIST
1919
 4283  FF0840  65 E6         		adc	SMdwTmp1
1920
 4284  FF0842  3A            		dec	a
1921
 4285  FF0843  85 E6         		sta	SMdwTmp1
1922
 4286  FF0845                		ACC08
1923
  Tue Jul 17 11:00:24 2018                                                                                               Page   32
1924
 
1925
 
1926
 
1927
 
1928
 4287  FF0845  E2 20         		sep	#PMFLAG
1929
 4288                        		.LONGA	off
1930
 4289                        		.MNLIST
1931
 4290  FF0847  20 5B 19      		jsr	PrintCR
1932
 4291  FF084A  A5 BB         		lda	SMTmpH
1933
 4292  FF084C  20 71 19      		jsr	PrintHex
1934
 4293  FF084F  A5 BA         		lda	SMTmpL
1935
 4294  FF0851  20 71 19      		jsr	PrintHex
1936
 4295  FF0854  20 5B 19      		jsr	PrintCR
1937
 4296  FF0857  A5 F0         		lda	SMXPos2
1938
 4297  FF0859  20 4E 19      		jsr	PrintByte
1939
 4298  FF085C  A5 F1         		lda	SMYPos2
1940
 4299  FF085E  20 4E 19      		jsr	PrintByte
1941
 4300  FF0861  A5 F2         		lda	SMXPos3
1942
 4301  FF0863  20 4E 19      		jsr	PrintByte
1943
 4302  FF0866  20 5B 19      		jsr	PrintCR
1944
 4303  FF0869  A5 E7         		lda	SMdwTmp1+1
1945
 4304  FF086B  20 71 19      		jsr	PrintHex
1946
 4305  FF086E  A5 E6         		lda	SMdwTmp1
1947
 4306  FF0870  20 71 19      		jsr	PrintHex
1948
 4307  FF0873  60            		rts
1949
 4308  FF0874
1950
 4309  FF0874                	?13:
1951
 4310  FF0874                		FDCGETFMT
1952
 4311  FF0874  02 30         		cop	$30
1953
 4312  FF0876  04            		.DB	$04
1954
 4313                        		.MNLIST
1955
 4314  FF0877  90 1C         		bcc	?16
1956
 4315  FF0879                		SCNPRINT
1957
 4316  FF0879  02 01         		cop	$01
1958
 4317                        		.MNLIST
1959
 4318  FF087B  0D 3A 3A 65 72 		.DB	$0D, '::error code -> ', $00
1960
               72 6F 72 20 63
1961
               6F 64 65 20 2D
1962
               3E 20 00
1963
 4319  FF088D  98            		tya
1964
 4320  FF088E  20 4E 19      		jsr	PrintByte
1965
 4321  FF0891  8A            		txa
1966
 4322  FF0892  4C 71 19      		jmp	PrintHex
1967
 4323
1968
 4324  FF0895  98            	?16:	tya
1969
 4325  FF0896                		SCN_CR
1970
 4326  FF0896                		SCNPRCHAR
1971
 4327                        		.MLIST
1972
 4328  FF0896  02 07         		cop	$07
1973
 4329                        		.MNLIST
1974
 4330  FF0898  0D            		.DB	$0D
1975
 4331                        		.MNLIST
1976
 4332  FF0899  4C 71 19      		jmp	PrintHex
1977
 4333  FF089C
1978
 4334  FF089C                		SCN_CR
1979
 4335  FF089C                		SCNPRCHAR
1980
 4336                        		.MLIST
1981
 4337  FF089C  02 07         		cop	$07
1982
 4338                        		.MNLIST
1983
 4339  FF089E  0D            		.DB	$0D
1984
 4340                        		.MNLIST
1985
  Tue Jul 17 11:00:24 2018                                                                                               Page   33
1986
 
1987
 
1988
 
1989
 
1990
 4341  FF089F                		ACC16
1991
 4342  FF089F  C2 20         		rep	#PMFLAG
1992
 4343                        		.LONGA	on
1993
 4344                        		.MNLIST
1994
 4345  FF08A1  A9 CB 08      		lda	#passtr1
1995
 4346  FF08A4                		ACC08
1996
 4347  FF08A4  E2 20         		sep	#PMFLAG
1997
 4348                        		.LONGA	off
1998
 4349                        		.MNLIST
1999
 4350  FF08A6  A2 FF         		ldx	#^passtr1
2000
 4351  FF08A8                		SCNPASSTR
2001
 4352  FF08A8  02 0B         		cop	$0B
2002
 4353                        		.MNLIST
2003
 4354  FF08AA                		SCN_CR
2004
 4355  FF08AA                		SCNPRCHAR
2005
 4356                        		.MLIST
2006
 4357  FF08AA  02 07         		cop	$07
2007
 4358                        		.MNLIST
2008
 4359  FF08AC  0D            		.DB	$0D
2009
 4360                        		.MNLIST
2010
 4361  FF08AD                		CPU16
2011
 4362  FF08AD  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2012
 4363                        		.LONGA	on
2013
 4364                        		.LONGI	on
2014
 4365                        		.MNLIST
2015
 4366  FF08AF  A9 DE 08      		lda	#bufstr1
2016
 4367  FF08B2  A2 FF 00      		ldx	#^bufstr1
2017
 4368  FF08B5  A0 0F 00      		ldy	#blen
2018
 4369  FF08B8                		SCNBUFOUT
2019
 4370  FF08B8  02 0D         		cop	$0D
2020
 4371                        		.MNLIST
2021
 4372  FF08BA                		CPU08
2022
 4373  FF08BA  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2023
 4374                        		.LONGA	off
2024
 4375                        		.LONGI	off
2025
 4376                        		.MNLIST
2026
 4377  FF08BC  60            	?100:	rts
2027
 4378  FF08BD
2028
 4379  FF08BD                		SCNPRCHAR
2029
 4380  FF08BD  02 07         		cop	$07
2030
 4381                        		.MNLIST
2031
 4382  FF08BF  56            		.DB	'V'
2032
 4383  FF08C0                		SCNPRCHAR
2033
 4384  FF08C0  02 07         		cop	$07
2034
 4385                        		.MNLIST
2035
 4386  FF08C2  0D            		.DB	$0D
2036
 4387  FF08C3  A5 BA         		lda	SMTmpL
2037
 4388  FF08C5  02 FF         		cop	$FF
2038
 4389  FF08C7                		SCNPRCHAR
2039
 4390  FF08C7  02 07         		cop	$07
2040
 4391                        		.MNLIST
2041
 4392  FF08C9  0D            		.DB	$0D
2042
 4393  FF08CA  60            		rts
2043
 4394
2044
 4395  FF08CB                	passtr1:
2045
 4396  FF08CB  12            		.db	plen
2046
 4397  FF08CC  50 61 73 63 61 		.db	'Pascal String Test'
2047
  Tue Jul 17 11:00:24 2018                                                                                               Page   34
2048
 
2049
 
2050
 
2051
 
2052
               6C 20 53 74 72
2053
               69 6E 67 20 54
2054
               65 73 74
2055
 4398          000012        	plen	.EQU	($ - passtr1 - 1)
2056
 4399
2057
 4400  FF08DE                	bufstr1:
2058
 4401  FF08DE  42 75 66 66 65 		.db	'Buffer Out Test'
2059
               72 20 4F 75 74
2060
               20 54 65 73 74
2061
 4402          00000F        	blen	.EQU	($ - bufstr1)
2062
 4403  FF08ED
2063
 4404  FF08ED                	Cmd_true:
2064
 4405  FF08ED  B0 06         		bcs	?10
2065
 4406  FF08EF  A5 BC         		lda	SMTmpK
2066
 4407  FF08F1  05 BB         		ora	SMTmpH
2067
 4408  FF08F3  F0 03         		beq	?12
2068
 4409  FF08F5  4C 1B 0A      	?10:	jmp	CmdErr3
2069
 4410  FF08F8  A5 BA         	?12:	lda	SMTmpL
2070
 4411  FF08FA  29 7F         		and	#$7F
2071
 4412  FF08FC  C9 06         		cmp	#$06
2072
 4413  FF08FE  B0 F5         		bcs	?10
2073
 4414  FF0900  8D 66 05      		sta	$0566
2074
 4415  FF0903  A5 BA         		lda	SMTmpL
2075
 4416  FF0905  29 80         		and	#$80
2076
 4417  FF0907  85 E2         		sta	SMTmp2
2077
 4418  FF0909  20 48 1A      	?14:	jsr	GetCurCh
2078
 4419  FF090C  A6 C4         		ldx	SMbndx
2079
 4420  FF090E  C9 00         		cmp	#$00
2080
 4421  FF0910  F0 03         		beq	?16
2081
 4422  FF0912  C9 20         		cmp	#' '
2082
 4423                        		;beq	?14
2083
 4424  FF0914  CA            		dex
2084
 4425  FF0915                	?16:	CPU16
2085
 4426  FF0915  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2086
 4427                        		.LONGA	on
2087
 4428                        		.LONGI	on
2088
 4429                        		.MNLIST
2089
 4430  FF0917  18            		clc
2090
 4431  FF0918  8A            		txa
2091
 4432  FF0919  69 00 99      		adc	#INPUTBUF
2092
 4433  FF091C                		INDEX08
2093
 4434  FF091C  E2 10         		sep	#PXFLAG
2094
 4435                        		.LONGI	off
2095
 4436                        		.MNLIST
2096
 4437  FF091E  A2 01         		ldx	#^INPUTBUF
2097
 4438  FF0920  DA            		phx
2098
 4439  FF0921  48            		pha
2099
 4440  FF0922  A2 40         		ldx	#$40
2100
 4441  FF0924  A9 80 03      		lda	#$0380
2101
 4442  FF0927  85 BA         		sta	SMTmpL
2102
 4443  FF0929  86 BC         		stx	SMTmpK
2103
 4444  FF092B  DA            		phx
2104
 4445                        		;pha
2105
 4446  FF092C  D4 BA         		pei	(SMTmpL)
2106
 4447  FF092E  A4 E2         		ldy	SMTmp2
2107
 4448  FF0930  5A            		phy
2108
 4449  FF0931                		CPU08
2109
  Tue Jul 17 11:00:24 2018                                                                                               Page   35
2110
 
2111
 
2112
 
2113
 
2114
 4450  FF0931  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2115
 4451                        		.LONGA	off
2116
 4452                        		.LONGI	off
2117
 4453                        		.MNLIST
2118
 4454  FF0933                		TRUENAM
2119
 4455  FF0933  02 FE         		cop	$FE
2120
 4456                        		.MNLIST
2121
 4457                        		;sta	SMTmpL
2122
 4458                        		;xba
2123
 4459                        		;sta	SMTmpH
2124
 4460                        		;stx	SMTmpK
2125
 4461  FF0935  90 18         		bcc	?1000
2126
 4462  FF0937  98            		tya
2127
 4463  FF0938                		SCNPRINT
2128
 4464  FF0938  02 01         		cop	$01
2129
 4465                        		.MNLIST
2130
 4466  FF093A  0D 3A 3A 65 72 		.DB	$0D, '::error code -> ', $00
2131
               72 6F 72 20 63
2132
               6F 64 65 20 2D
2133
               3E 20 00
2134
 4467  FF094C  20 4E 19      		jsr	PrintByte
2135
 4468  FF094F                	?1000:	TXT_CR
2136
 4469  FF094F                		TXTPRCHAR
2137
 4470                        		.MLIST
2138
 4471  FF094F  02 08         		cop	$08
2139
 4472                        		.MNLIST
2140
 4473  FF0951  0D            		.DB	$0D
2141
 4474                        		.MNLIST
2142
 4475  FF0952  A5 BB         		lda	SMTmpH
2143
 4476  FF0954  EB            		xba
2144
 4477  FF0955  A5 BA         		lda	SMTmpL
2145
 4478  FF0957  A6 BC         		ldx	SMTmpK
2146
 4479  FF0959                		SCNSTROUT
2147
 4480  FF0959  02 03         		cop	$03
2148
 4481                        		.MNLIST
2149
 4482                        		;jsr	PrintCR
2150
 4483  FF095B  60            		rts
2151
 4484
2152
 4485  FF095C                	Cmd_dumbon:
2153
 4486                        		.EXTERN lspset, lspset2
2154
 4487  FF095C  A5 BA         		lda	SMTmpL
2155
 4488  FF095E  29 01         		and	#1
2156
 4489  FF0960  AA            		tax
2157
 4490  FF0961  A9 D4         		lda	#11010100B
2158
 4491  FF0963  22 78 0D F8   		jsl	lspset2
2159
 4492  FF0967  A5 BA         		lda	SMTmpL
2160
 4493  FF0969  29 01         		and	#1
2161
 4494  FF096B  E8            		inx
2162
 4495  FF096C  8E 50 00      		stx	.ABS.DflTxtOut
2163
 4496  FF096F  A2 80         		ldx	#$80
2164
 4497  FF0971  86 C6         		stx	SMdumb
2165
 4498  FF0973  60            		rts
2166
 4499
2167
 4500  FF0974                	Cmd_dumboff:
2168
 4501                        		.EXTERN lspres, lspres2
2169
 4502  FF0974  AE 50 00      		ldx	.ABS.DflTxtOut
2170
 4503  FF0977  CA            		dex
2171
  Tue Jul 17 11:00:24 2018                                                                                               Page   36
2172
 
2173
 
2174
 
2175
 
2176
 4504  FF0978  22 8A 0D F8   		jsl	lspres2
2177
 4505  FF097C  A2 03         		ldx	#TXTD_SCN
2178
 4506  FF097E  8E 50 00      		stx	.ABS.DflTxtOut
2179
 4507  FF0981  64 C6         		stz	SMdumb
2180
 4508  FF0983  60            		rts
2181
 4509
2182
 4510                        	;----------------------------------------------------------
2183
 4511                        	; comando vdc 0|1 - 0 -> 16MHz, 1 -> 20MHz
2184
 4512
2185
 4513                        		.EXTERN VDCX20, VDCREG16
2186
 4514  FF0984
2187
 4515  FF0984                	Cmd_vdc:
2188
 4516  FF0984  D0 03         		bne	?01
2189
 4517  FF0986  4C 1B 0A      		jmp	CmdErr3
2190
 4518  FF0989  A5 BC         	?01:	lda	SMTmpK
2191
 4519  FF098B  05 BB         		ora	SMTmpH
2192
 4520  FF098D  F0 03         		beq	?02
2193
 4521  FF098F  4C 1B 0A      		jmp	CmdErr3
2194
 4522  FF0992  A6 BA         	?02:	ldx	SMTmpL
2195
 4523  FF0994  E0 02         		cpx	#$02
2196
 4524  FF0996  90 03         		bcc	?03
2197
 4525  FF0998  4C 1B 0A      		jmp	CmdErr3
2198
 4526  FF099B  AD 1F FD      	?03:	lda	VIA1+VIAPRANH		; bit 1 -> dot clock
2199
 4527  FF099E  29 02         		and	#$02			; maschera bit 1
2200
 4528  FF09A0  F0 0B         		beq	?04			; dot clock = 16MHz
2201
 4529  FF09A2  E0 01         		cpx	#$01
2202
 4530  FF09A4  F0 30         		beq	?20			; gia' impostato su 20MHz
2203
 4531  FF09A6  1C 1F FD      		trb	VIA1+VIAPRANH		; DOTCLOCK 16MHZ - PAL RGB
2204
 4532  FF09A9  A2 00         		ldx	#0			; indice per setup 16MHZ
2205
 4533  FF09AB  F0 0A         		beq	?08
2206
 4534  FF09AD  8A            	?04:	txa
2207
 4535  FF09AE  F0 26         		beq	?20			; gia' impostato su 16MHz
2208
 4536  FF09B0  A9 02         		lda	#$02
2209
 4537  FF09B2  1C 1F FD      		trb	VIA1+VIAPRANH		; DOTCLOCK 20MHZ - VGA
2210
 4538  FF09B5  A2 00         		ldx	#0			; indice per setup 20MHZ
2211
 4539  FF09B7  A9 01         	?08:	lda	#$01			; video VDC OFF
2212
 4540  FF09B9  0C 1F FD      		tsb	VIA1+VIAPRANH
2213
 4541  FF09BC  BF 48 AF F8   	?10:	LDA	>VDCREG16,X
2214
 4542  FF09C0  30 0F         		BMI	?12
2215
 4543  FF09C2  A8            		tay
2216
 4544  FF09C3  E8            		INX
2217
 4545  FF09C4  BF 48 AF F8   		LDA	>VDCREG16,X
2218
 4546  FF09C8  E8            		INX
2219
 4547  FF09C9  8C 4E FD      		STY	VDCAddr
2220
 4548  FF09CC  8D 4F FD      		STA	VDCData
2221
 4549  FF09CF  80 EB         		BRA	?10
2222
 4550  FF09D1  A9 01         	?12:	lda	#$01			; video VDC ON
2223
 4551  FF09D3  1C 1F FD      		trb	VIA1+VIAPRANH
2224
 4552  FF09D6  60            	?20:	rts
2225
 4553
2226
 4554  FF09D7
2227
 4555                        	;----------------------------------------------------------
2228
 4556                        	; diagnostica floppy disk
2229
 4557
2230
 4558  FF09D7
2231
 4559                        	; fdtest [0|1] - controlla presenza/cambio disco nel drive
2232
 4560  FF09D7                	Cmd_fdtest:
2233
  Tue Jul 17 11:00:24 2018                                                                                               Page   37
2234
 
2235
 
2236
 
2237
 
2238
 4561  FF09D7  F0 42         		beq	CmdErr3
2239
 4562  FF09D9  A5 BC         		lda	SMTmpK
2240
 4563  FF09DB  05 BB         		ora	SMTmpH
2241
 4564  FF09DD  D0 3C         		bne	CmdErr3
2242
 4565  FF09DF  A6 BA         		ldx	SMTmpL
2243
 4566  FF09E1  E0 02         		cpx	#$02
2244
 4567  FF09E3  B0 36         		bcs	CmdErr3
2245
 4568  FF09E5                		FDCTST
2246
 4569  FF09E5  02 30         		cop	$30
2247
 4570  FF09E7  03            		.DB	$03
2248
 4571                        		.MNLIST
2249
 4572  FF09E8  08            	drs:	php
2250
 4573  FF09E9                		SCNPRINT
2251
 4574  FF09E9  02 01         		cop	$01
2252
 4575                        		.MNLIST
2253
 4576  FF09EB  0D 3A 3A 65 72 		.DB	$0D, '::error code -> ', $00
2254
               72 6F 72 20 63
2255
               6F 64 65 20 2D
2256
               3E 20 00
2257
 4577  FF09FD  AD 48 00      		lda	!fdcerr
2258
 4578  FF0A00  20 71 19      		jsr	PrintHex
2259
 4579  FF0A03                		SCNPRINT
2260
 4580  FF0A03  02 01         		cop	$01
2261
 4581                        		.MNLIST
2262
 4582  FF0A05  20 20 2D 20 20 		.DB	'  -  CF -> ', $00
2263
               43 46 20 2D 3E
2264
               20 00
2265
 4583  FF0A11  28            		plp
2266
 4584  FF0A12  A9 30         		lda	#'0'
2267
 4585  FF0A14  90 02         		bcc	?03
2268
 4586  FF0A16  A9 31         		lda	#'1'
2269
 4587  FF0A18                	?03:	SCNCHAROUT
2270
 4588  FF0A18  02 05         		cop	$05
2271
 4589                        		.MNLIST
2272
 4590  FF0A1A  60            		rts
2273
 4591
2274
 4592  FF0A1B                	CmdErr3:
2275
 4593  FF0A1B  4C 34 01      		jmp	ErrCls2
2276
 4594
2277
 4595
2278
 4596                        	; fdread drive+flag fmt buffer track [head sect sectnum vervbuf]
2279
 4597                        	;Cmd_fdread:
2280
 4598  FF0A1E  B0 FB         		bcs	CmdErr3		; no parametri
2281
 4599  FF0A20  20 C8 19      		jsr	GetFDCParm
2282
 4600  FF0A23  B0 07         		bcs	FdcClean
2283
 4601  FF0A25                		FDCREAD
2284
 4602  FF0A25  02 31         		cop	$31
2285
 4603  FF0A27  00            		.DB	$00
2286
 4604                        		.MNLIST
2287
 4605  FF0A28  20 E8 09      		jsr	drs
2288
 4606  FF0A2B  18            		clc
2289
 4607  FF0A2C                	FdcClean:
2290
 4608  FF0A2C  08            		php
2291
 4609  FF0A2D  FA            		plx
2292
 4610  FF0A2E                		ACC16
2293
 4611  FF0A2E  C2 20         		rep	#PMFLAG
2294
 4612                        		.LONGA	on
2295
  Tue Jul 17 11:00:24 2018                                                                                               Page   38
2296
 
2297
 
2298
 
2299
 
2300
 4613                        		.MNLIST
2301
 4614  FF0A30  3B            		tsc
2302
 4615  FF0A31  18            		clc
2303
 4616  FF0A32  69 09 00      		adc	#FDPBSIZE
2304
 4617  FF0A35  1B            		tcs
2305
 4618  FF0A36                		ACC08
2306
 4619  FF0A36  E2 20         		sep	#PMFLAG
2307
 4620                        		.LONGA	off
2308
 4621                        		.MNLIST
2309
 4622  FF0A38  DA            		phx
2310
 4623  FF0A39  28            		plp
2311
 4624  FF0A3A  B0 DF         		bcs	CmdErr3
2312
 4625  FF0A3C  60            		rts
2313
 4626
2314
 4627                        	;Cmd_fdwrite:
2315
 4628  FF0A3D  B0 DC         		bcs	CmdErr3		; no parametri
2316
 4629  FF0A3F  20 C8 19      		jsr	GetFDCParm
2317
 4630  FF0A42  B0 E8         		bcs	FdcClean
2318
 4631  FF0A44                		FDCWRITE
2319
 4632  FF0A44  02 31         		cop	$31
2320
 4633  FF0A46  02            		.DB	$02
2321
 4634                        		.MNLIST
2322
 4635  FF0A47  20 E8 09      		jsr	drs
2323
 4636  FF0A4A  18            		clc
2324
 4637  FF0A4B  90 DF         		bcc	FdcClean
2325
 4638  FF0A4D
2326
 4639  FF0A4D
2327
 4640                        	;----------------------------------------------------------
2328
 4641                        	; comando m
2329
 4642
2330
 4643  FF0A4D                	Cmd_xmt:
2331
 4644  FF0A4D  F0 13         		beq	?00c		; no params - full test
2332
 4645  FF0A4F  A5 BC         		lda	SMTmpK
2333
 4646  FF0A51  05 BB         		ora	SMTmpH
2334
 4647  FF0A53  D0 06         		bne	?00a		; max . $1F
2335
 4648  FF0A55  A5 BA         		lda	SMTmpL		; banco X mem in test
2336
 4649  FF0A57  C9 20         		cmp	#$20
2337
 4650  FF0A59  90 03         		bcc	?00b		; OK
2338
 4651  FF0A5B  4C 34 01      	?00a:	jmp	ErrCls2		; errore - banco > $1F
2339
 4652  FF0A5E  A9 01         	?00b:	lda	#$01		; un banco (64k)
2340
 4653  FF0A60  D0 04         		bne	?00d
2341
 4654  FF0A62  A9 20         	?00c:	lda	#$20		; numero banchi full test (2Mb)
2342
 4655  FF0A64  64 BA         		stz	SMTmpL		; banco start = $00 per full test
2343
 4656  FF0A66  85 BB         	?00d:	sta	SMTmpH		; numero banchi da 64k
2344
 4657  FF0A68  9C 4B 00      		stz	!CtrlBrk	; clear CTRL BREAK flag
2345
 4658  FF0A6B  AE 0A FC      		ldx	CRXME		; salva impostazione X mem
2346
 4659  FF0A6E  DA            		phx
2347
 4660  FF0A6F  AD 28 FD      		lda	PIA0+PIAPRA	; salva banco X mem
2348
 4661  FF0A72  48            		pha
2349
 4662  FF0A73  8D 0B FC      		sta	CRXMEON		; abilita X mem
2350
 4663  FF0A76  A5 BA         		lda	SMTmpL		; calcola pagina X mem
2351
 4664  FF0A78  0A            		asl	a		; moltiplica x 8
2352
 4665  FF0A79  0A            		asl	a
2353
 4666  FF0A7A  0A            		asl	a
2354
 4667  FF0A7B  8D 28 FD      		sta	PIA0+PIAPRA	; pagina fisica di start
2355
 4668  FF0A7E                		SCN_CR
2356
 4669  FF0A7E                		SCNPRCHAR
2357
  Tue Jul 17 11:00:24 2018                                                                                               Page   39
2358
 
2359
 
2360
 
2361
 
2362
 4670                        		.MLIST
2363
 4671  FF0A7E  02 07         		cop	$07
2364
 4672                        		.MNLIST
2365
 4673  FF0A80  0D            		.DB	$0D
2366
 4674                        		.MNLIST
2367
 4675  FF0A81  A5 BB         		lda	SMTmpH
2368
 4676  FF0A83  C9 01         		cmp	#$01
2369
 4677  FF0A85  F0 23         		beq	?00e		; testa un banco
2370
 4678  FF0A87                		SCNPRINT
2371
 4679  FF0A87  02 01         		cop	$01
2372
 4680                        		.MNLIST
2373
 4681  FF0A89  3A 3A 46 75 6C 		.DB	'::Full eXtended memory test: $', 0
2374
               6C 20 65 58 74
2375
               65 6E 64 65 64
2376
               20 6D 65 6D 6F
2377
               72 79 20 74 65
2378
               73 74 3A 20 24
2379
               00
2380
 4682  FF0AA8  80 21         		bra	?00f
2381
 4683  FF0AAA                	?00e:	SCNPRINT
2382
 4684  FF0AAA  02 01         		cop	$01
2383
 4685                        		.MNLIST
2384
 4686  FF0AAC  3A 3A 65 58 74 		.DB	'::eXtended memory bank test: $', 0
2385
               65 6E 64 65 64
2386
               20 6D 65 6D 6F
2387
               72 79 20 62 61
2388
               6E 6B 20 74 65
2389
               73 74 3A 20 24
2390
               00
2391
 4687  FF0ACB                	?00f:	SCNGETPOS
2392
 4688  FF0ACB  02 18         		cop	$18
2393
 4689  FF0ACD  02            		.DB	$02
2394
 4690                        		.MNLIST
2395
 4691  FF0ACE  86 D6         		stx	SMAuxL
2396
 4692  FF0AD0  84 D7         		sty	SMAuxH
2397
 4693  FF0AD2                	?01:	INDEX08
2398
 4694  FF0AD2  E2 10         		sep	#PXFLAG
2399
 4695                        		.LONGI	off
2400
 4696                        		.MNLIST
2401
 4697  FF0AD4  A6 D6         		ldx	SMAuxL		; pos. banco
2402
 4698  FF0AD6  A4 D7         		ldy	SMAuxH
2403
 4699  FF0AD8                		SCNSETPOS
2404
 4700  FF0AD8  02 18         		cop	$18
2405
 4701  FF0ADA  03            		.DB	$03
2406
 4702                        		.MNLIST
2407
 4703  FF0ADB  A5 BA         		lda	SMTmpL		; print banco
2408
 4704  FF0ADD  20 71 19      		jsr	PrintHex
2409
 4705  FF0AE0                		SCNGETPOS	; pos. address
2410
 4706  FF0AE0  02 18         		cop	$18
2411
 4707  FF0AE2  02            		.DB	$02
2412
 4708                        		.MNLIST
2413
 4709  FF0AE3  86 F6         		stx	SMXPos
2414
 4710  FF0AE5  84 F7         		sty	SMYPos
2415
 4711  FF0AE7  A9 08         		lda	#$08		; 8 cicli per banco
2416
 4712  FF0AE9  85 BC         		sta	SMTmpK
2417
 4713  FF0AEB                		INDEX16
2418
 4714  FF0AEB  C2 10         		rep	#PXFLAG
2419
  Tue Jul 17 11:00:24 2018                                                                                               Page   40
2420
 
2421
 
2422
 
2423
 
2424
 4715                        		.LONGI	on
2425
 4716                        		.MNLIST
2426
 4717  FF0AED  A0 00 00      	?02:	ldy	#$0000
2427
 4718  FF0AF0  20 80 1A      		jsr	CkStop
2428
 4719  FF0AF3  F0 5C         		beq	?10
2429
 4720  FF0AF5  B9 00 20      	?03:	lda	$012000,y	; finestra $2000 - $3FFF
2430
 4721  FF0AF8  EB            		xba
2431
 4722  FF0AF9  A9 55         		lda	#$55
2432
 4723  FF0AFB  99 00 20      		sta	$012000,y
2433
 4724  FF0AFE  D9 00 20      		cmp	$012000,y
2434
 4725  FF0B01  D0 08         		bne	?05
2435
 4726  FF0B03  A9 AA         		lda	#$AA
2436
 4727  FF0B05  99 00 20      		sta	$012000,y
2437
 4728  FF0B08  D9 00 20      		cmp	$012000,y
2438
 4729  FF0B0B  08            	?05:	php
2439
 4730  FF0B0C  EB            		xba
2440
 4731  FF0B0D  99 00 20      		sta	$012000,y
2441
 4732  FF0B10  84 BE         		sty	SMSizeL
2442
 4733  FF0B12  28            		plp
2443
 4734  FF0B13  D0 2D         		bne	?09
2444
 4735  FF0B15  A5 BE         		lda	SMSizeL		; stampa solo indirizzi di pagina
2445
 4736  FF0B17  D0 05         		bne	?08
2446
 4737  FF0B19  20 5D 0B      		jsr	XmtPrint
2447
 4738  FF0B1C                		INDEX16
2448
 4739  FF0B1C  C2 10         		rep	#PXFLAG
2449
 4740                        		.LONGI	on
2450
 4741                        		.MNLIST
2451
 4742  FF0B1E  A4 BE         	?08:	ldy	SMSizeL
2452
 4743  FF0B20  C8            		iny
2453
 4744  FF0B21  C0 00 20      		cpy	#$2000		; 8k
2454
 4745  FF0B24  90 CF         		bcc	?03
2455
 4746  FF0B26  EE 28 FD      		inc	PIA0+PIAPRA	; banco successivo
2456
 4747  FF0B29  C6 BC         		dec	SMTmpK		; loop 64k
2457
 4748  FF0B2B  D0 C0         		bne	?02
2458
 4749  FF0B2D  E6 BA         		inc	SMTmpL		; banco successivo
2459
 4750  FF0B2F  C6 BB         		dec	SMTmpH
2460
 4751  FF0B31  D0 9F         		bne	?01		; loop banchi
2461
 4752  FF0B33  CE 28 FD      		dec	PIA0+PIAPRA
2462
 4753  FF0B36  20 5D 0B      		jsr	XmtPrint
2463
 4754  FF0B39                		SCNPRINT
2464
 4755  FF0B39  02 01         		cop	$01
2465
 4756                        		.MNLIST
2466
 4757  FF0B3B  2D 20 4F 4B 00 		.DB	'- OK', 0
2467
 4758  FF0B40  80 0F         		bra	?10
2468
 4759  FF0B42  20 5D 0B      	?09:	jsr	XmtPrint
2469
 4760  FF0B45                		SCNPRINT
2470
 4761  FF0B45  02 01         		cop	$01
2471
 4762                        		.MNLIST
2472
 4763  FF0B47  2D 20 42 41 44 		.DB	'- BAD RAM', 0
2473
               20 52 41 4D 00
2474
 4764  FF0B51                	?10:	INDEX08
2475
 4765  FF0B51  E2 10         		sep	#PXFLAG
2476
 4766                        		.LONGI	off
2477
 4767                        		.MNLIST
2478
 4768  FF0B53  68            		pla
2479
 4769  FF0B54  8D 28 FD      		sta	PIA0+PIAPRA	; ripristina banco X mem
2480
 4770  FF0B57  FA            		plx			; ripristina bit CRX
2481
  Tue Jul 17 11:00:24 2018                                                                                               Page   41
2482
 
2483
 
2484
 
2485
 
2486
 4771  FF0B58  9F 0A FC 00   		sta	CRXME,x
2487
 4772  FF0B5C  60            		rts
2488
 4773
2489
 4774  FF0B5D                	XmtPrint:
2490
 4775  FF0B5D                		INDEX08
2491
 4776  FF0B5D  E2 10         		sep	#PXFLAG
2492
 4777                        		.LONGI	off
2493
 4778                        		.MNLIST
2494
 4779  FF0B5F  A6 F6         		ldx	SMXPos
2495
 4780  FF0B61  A4 F7         		ldy	SMYPos
2496
 4781  FF0B63                		SCNSETPOS
2497
 4782  FF0B63  02 18         		cop	$18
2498
 4783  FF0B65  03            		.DB	$03
2499
 4784                        		.MNLIST
2500
 4785  FF0B66  AD 28 FD      		lda	PIA0+PIAPRA
2501
 4786  FF0B69  0A            		asl	a
2502
 4787  FF0B6A  0A            		asl	a
2503
 4788  FF0B6B  0A            		asl	a
2504
 4789  FF0B6C  0A            		asl	a
2505
 4790  FF0B6D  0A            		asl	a
2506
 4791  FF0B6E  05 BF         		ora	SMSizeH		; indirizzo fisico (Hi)
2507
 4792  FF0B70  AA            		tax
2508
 4793  FF0B71  A5 BE         		lda	SMSizeL
2509
 4794  FF0B73  4C 48 19      		jmp	PrintWord
2510
 4795  FF0B76
2511
 4796  FF0B76                	Cmd_kmt:
2512
 4797  FF0B76  F0 15         		beq	?00c		; no params - full test
2513
 4798  FF0B78  A5 BC         		lda	SMTmpK
2514
 4799  FF0B7A  05 BB         		ora	SMTmpH
2515
 4800  FF0B7C  D0 08         		bne	?00a		; max . $F7
2516
 4801  FF0B7E  A5 BA         		lda	SMTmpL		; banco std mem in test
2517
 4802  FF0B80  F0 04         		beq	?00a		; no test in banco 0 !
2518
 4803  FF0B82  C9 F8         		cmp	#$F8
2519
 4804  FF0B84  90 03         		bcc	?00b		; OK
2520
 4805  FF0B86  4C 34 01      	?00a:	jmp	ErrCls2		; errore - banco > $F7 oppure banco 0
2521
 4806  FF0B89  A9 01         	?00b:	lda	#$01		; un banco (64k)
2522
 4807  FF0B8B  D0 06         		bne	?00d
2523
 4808  FF0B8D  A9 F7         	?00c:	lda	#$F7		; numero banchi full test (eccetto 0 e F8/FF)
2524
 4809  FF0B8F  A2 01         		ldx	#$01
2525
 4810  FF0B91  86 BA         		stx	SMTmpL		; banco start = $01 per full test
2526
 4811  FF0B93  85 BB         	?00d:	sta	SMTmpH		; numero banchi da 64k
2527
 4812  FF0B95  9C 4B 00      		stz	!CtrlBrk	; clear CTRL BREAK flag
2528
 4813  FF0B98                		SCN_CR
2529
 4814  FF0B98                		SCNPRCHAR
2530
 4815                        		.MLIST
2531
 4816  FF0B98  02 07         		cop	$07
2532
 4817                        		.MNLIST
2533
 4818  FF0B9A  0D            		.DB	$0D
2534
 4819                        		.MNLIST
2535
 4820  FF0B9B  A5 BB         		lda	SMTmpH
2536
 4821  FF0B9D  C9 01         		cmp	#$01
2537
 4822  FF0B9F  F0 1A         		beq	?00e		; testa un banco
2538
 4823  FF0BA1                		SCNPRINT
2539
 4824  FF0BA1  02 01         		cop	$01
2540
 4825                        		.MNLIST
2541
 4826  FF0BA3  3A 3A 46 75 6C 		.DB	'::Full memory test: $', 0
2542
               6C 20 6D 65 6D
2543
  Tue Jul 17 11:00:24 2018                                                                                               Page   42
2544
 
2545
 
2546
 
2547
 
2548
               6F 72 79 20 74
2549
               65 73 74 3A 20
2550
               24 00
2551
 4827  FF0BB9  80 18         		bra	?00f
2552
 4828  FF0BBB                	?00e:	SCNPRINT
2553
 4829  FF0BBB  02 01         		cop	$01
2554
 4830                        		.MNLIST
2555
 4831  FF0BBD  3A 3A 4D 65 6D 		.DB	'::Memory bank test: $', 0
2556
               6F 72 79 20 62
2557
               61 6E 6B 20 74
2558
               65 73 74 3A 20
2559
               24 00
2560
 4832  FF0BD3                	?00f:	SCNGETPOS
2561
 4833  FF0BD3  02 18         		cop	$18
2562
 4834  FF0BD5  02            		.DB	$02
2563
 4835                        		.MNLIST
2564
 4836  FF0BD6  86 D6         		stx	SMAuxL
2565
 4837  FF0BD8  84 D7         		sty	SMAuxH
2566
 4838  FF0BDA  AE 0A FC      		ldx	CRXME		; salva impostazione X mem
2567
 4839  FF0BDD  DA            		phx
2568
 4840  FF0BDE  AE 0C FC      		ldx	CREME		; salva impostazione E mem
2569
 4841  FF0BE1  DA            		phx
2570
 4842  FF0BE2  AE 08 FC      		ldx	CRXFE		; salva impostazione flash mem
2571
 4843  FF0BE5  DA            		phx
2572
 4844  FF0BE6  8D 0A FC      		sta	CRXMEOFF	; disabilita X mem
2573
 4845  FF0BE9  8D 0C FC      		sta	CREMEOFF	; disabilita E mem
2574
 4846  FF0BEC  8D 08 FC      		sta	CRXFEOFF	; disabilita F mem
2575
 4847  FF0BEF  8B            		phb			; salva PBR
2576
 4848  FF0BF0                	?01:	INDEX08
2577
 4849  FF0BF0  E2 10         		sep	#PXFLAG
2578
 4850                        		.LONGI	off
2579
 4851                        		.MNLIST
2580
 4852  FF0BF2  A6 D6         		ldx	SMAuxL		; pos. banco
2581
 4853  FF0BF4  A4 D7         		ldy	SMAuxH
2582
 4854  FF0BF6                		SCNSETPOS
2583
 4855  FF0BF6  02 18         		cop	$18
2584
 4856  FF0BF8  03            		.DB	$03
2585
 4857                        		.MNLIST
2586
 4858  FF0BF9  A5 BA         		lda	SMTmpL		; print banco
2587
 4859  FF0BFB  20 71 19      		jsr	PrintHex
2588
 4860  FF0BFE                		SCNGETPOS	; pos. address
2589
 4861  FF0BFE  02 18         		cop	$18
2590
 4862  FF0C00  02            		.DB	$02
2591
 4863                        		.MNLIST
2592
 4864  FF0C01  86 F6         		stx	SMXPos
2593
 4865  FF0C03  84 F7         		sty	SMYPos
2594
 4866  FF0C05                		INDEX16
2595
 4867  FF0C05  C2 10         		rep	#PXFLAG
2596
 4868                        		.LONGI	on
2597
 4869                        		.MNLIST
2598
 4870  FF0C07  A5 BA         		lda	SMTmpL		; imposta PBR corrente
2599
 4871  FF0C09  48            		pha
2600
 4872  FF0C0A  AB            		plb
2601
 4873  FF0C0B  A0 00 00      		ldy	#$0000
2602
 4874  FF0C0E  20 80 1A      		jsr	CkStop
2603
 4875  FF0C11  F0 4F         		beq	?10
2604
 4876  FF0C13  B9 00 00      	?02:	lda	!$0000,y
2605
  Tue Jul 17 11:00:24 2018                                                                                               Page   43
2606
 
2607
 
2608
 
2609
 
2610
 4877  FF0C16  EB            		xba
2611
 4878  FF0C17  A9 55         		lda	#$55
2612
 4879  FF0C19  99 00 00      		sta	!$0000,y
2613
 4880  FF0C1C  D9 00 00      		cmp	!$0000,y
2614
 4881  FF0C1F  D0 08         		bne	?05
2615
 4882  FF0C21  A9 AA         		lda	#$AA
2616
 4883  FF0C23  99 00 00      		sta	!$0000,y
2617
 4884  FF0C26  D9 00 00      		cmp	!$0000,y
2618
 4885  FF0C29  08            	?05:	php
2619
 4886  FF0C2A  EB            		xba
2620
 4887  FF0C2B  99 00 00      		sta	!$0000,y
2621
 4888  FF0C2E  84 BE         		sty	SMSizeL
2622
 4889  FF0C30  28            		plp
2623
 4890  FF0C31  D0 20         		bne	?09
2624
 4891  FF0C33  A5 BE         		lda	SMSizeL
2625
 4892  FF0C35  D0 05         		bne	?08
2626
 4893  FF0C37  20 72 0C      		jsr	MemPrint
2627
 4894  FF0C3A                		INDEX16
2628
 4895  FF0C3A  C2 10         		rep	#PXFLAG
2629
 4896                        		.LONGI	on
2630
 4897                        		.MNLIST
2631
 4898  FF0C3C  A4 BE         	?08:	ldy	SMSizeL
2632
 4899  FF0C3E  C8            		iny
2633
 4900  FF0C3F  D0 D2         		bne	?02
2634
 4901  FF0C41  E6 BA         		inc	SMTmpL		; banco successivo
2635
 4902  FF0C43  C6 BB         		dec	SMTmpH
2636
 4903  FF0C45  D0 A9         		bne	?01		; loop banchi
2637
 4904  FF0C47  20 72 0C      		jsr	MemPrint
2638
 4905  FF0C4A                		SCNPRINT
2639
 4906  FF0C4A  02 01         		cop	$01
2640
 4907                        		.MNLIST
2641
 4908  FF0C4C  2D 20 4F 4B 00 		.DB	'- OK', 0
2642
 4909  FF0C51  80 0F         		bra	?10
2643
 4910  FF0C53  20 72 0C      	?09:	jsr	MemPrint
2644
 4911  FF0C56                		SCNPRINT
2645
 4912  FF0C56  02 01         		cop	$01
2646
 4913                        		.MNLIST
2647
 4914  FF0C58  2D 20 42 41 44 		.DB	'- BAD RAM', 0
2648
               20 52 41 4D 00
2649
 4915  FF0C62
2650
 4916  FF0C62                	?10:	INDEX08
2651
 4917  FF0C62  E2 10         		sep	#PXFLAG
2652
 4918                        		.LONGI	off
2653
 4919                        		.MNLIST
2654
 4920  FF0C64  AB            		plb			; ripristina banco
2655
 4921  FF0C65  FA            		plx
2656
 4922  FF0C66  8D 08 FC      		sta	CRXFE		; ripristina impostazione F mem
2657
 4923  FF0C69  FA            		plx
2658
 4924  FF0C6A  8D 0C FC      		sta	CREME		; ripristina impostazione E mem
2659
 4925  FF0C6D  FA            		plx
2660
 4926  FF0C6E  8D 0A FC      		sta	CRXME		; ripristina impostazione M mem
2661
 4927  FF0C71  60            		rts
2662
 4928
2663
 4929  FF0C72                	MemPrint:
2664
 4930  FF0C72                		INDEX08
2665
 4931  FF0C72  E2 10         		sep	#PXFLAG
2666
 4932                        		.LONGI	off
2667
  Tue Jul 17 11:00:24 2018                                                                                               Page   44
2668
 
2669
 
2670
 
2671
 
2672
 4933                        		.MNLIST
2673
 4934  FF0C74  A6 F6         		ldx	SMXPos
2674
 4935  FF0C76  A4 F7         		ldy	SMYPos
2675
 4936  FF0C78                		SCNSETPOS
2676
 4937  FF0C78  02 18         		cop	$18
2677
 4938  FF0C7A  03            		.DB	$03
2678
 4939                        		.MNLIST
2679
 4940  FF0C7B  A5 BE         		lda	SMSizeL
2680
 4941  FF0C7D  A6 BF         		ldx	SMSizeH
2681
 4942  FF0C7F  4C 48 19      		jmp	PrintWord
2682
 4943  FF0C82
2683
 4944                        	; r -> show registri CPU
2684
 4945  FF0C82                	PrintReg:
2685
 4946  FF0C82                		CPU16
2686
 4947  FF0C82  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2687
 4948                        		.LONGA	on
2688
 4949                        		.LONGI	on
2689
 4950                        		.MNLIST
2690
 4951  FF0C84  BA            		tsx
2691
 4952  FF0C85  E8            		inx
2692
 4953  FF0C86  E8            		inx
2693
 4954  FF0C87  86 D4         		stx	SMsp
2694
 4955  FF0C89                		CPU08
2695
 4956  FF0C89  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2696
 4957                        		.LONGA	off
2697
 4958                        		.LONGI	off
2698
 4959                        		.MNLIST
2699
 4960  FF0C8B                		SCNPRINT
2700
 4961  FF0C8B  02 01         		cop	$01
2701
 4962                        		.MNLIST
2702
 4963  FF0C8D
2703
 4964  FF0C8D  0D 20 20 4B 52 		.DB	KB_CR, '  KR  PC  BR  DP  SR  AC   XR   YR   SP', KB_CR
2704
               20 20 50 43 20
2705
               20 42 52 20 20
2706
               44 50 20 20 53
2707
               52 20 20 41 43
2708
               20 20 20 58 52
2709
               20 20 20 59 52
2710
               20 20 20 53 50
2711
               0D
2712
 4965  FF0CB6  3B 20 1B 51 00 		.DB	'; ', KB_ESC, 'Q', 0
2713
 4966  FF0CBB
2714
 4967  FF0CBB  A5 C7         		lda	SMkr		; stampa PBR (K)
2715
 4968  FF0CBD  20 4E 19      		jsr	PrintByte
2716
 4969  FF0CC0  A5 C8         		lda	SMpc		; stampa PCL
2717
 4970  FF0CC2  A6 C9         		ldx	SMpc+1		; stampa PCH
2718
 4971  FF0CC4  20 48 19      		jsr	PrintWord
2719
 4972  FF0CC7  A5 CB         		lda	SMbr		; stampa DBR (B)
2720
 4973  FF0CC9  20 4E 19      		jsr	PrintByte
2721
 4974  FF0CCC  A5 CC         		lda	SMdp		; stampa DPL
2722
 4975  FF0CCE  A6 CD         		ldx	SMdp+1		; stampa DPH
2723
 4976  FF0CD0  20 48 19      		jsr	PrintWord
2724
 4977  FF0CD3  A5 CA         		lda	SMsr		; stampa SR
2725
 4978  FF0CD5  20 4E 19      		jsr	PrintByte
2726
 4979  FF0CD8  A5 CE         		lda	SMac		; stampa AL
2727
 4980  FF0CDA  A6 CF         		ldx	SMac+1		; stampa AH
2728
 4981  FF0CDC  20 48 19      		jsr	PrintWord
2729
  Tue Jul 17 11:00:24 2018                                                                                               Page   45
2730
 
2731
 
2732
 
2733
 
2734
 4982  FF0CDF  A5 D0         		lda	SMxr		; stampa XL
2735
 4983  FF0CE1  A6 D1         		ldx	SMxr+1		; stampa XH
2736
 4984  FF0CE3  20 48 19      		jsr	PrintWord
2737
 4985  FF0CE6  A5 D2         		lda	SMyr		; stampa XL
2738
 4986  FF0CE8  A6 D3         		ldx	SMyr+1		; stampa YH
2739
 4987  FF0CEA  20 48 19      		jsr	PrintWord
2740
 4988  FF0CED  A5 D4         		lda	SMsp		; stampa SPL
2741
 4989  FF0CEF  A6 D5         		ldx	SMsp+1		; stampa SPH
2742
 4990  FF0CF1  4C 48 19      		jmp	PrintWord
2743
 4991
2744
 4992                        	; comando ';' -> set registri (escluso SP)
2745
 4993  FF0CF4                	Cmd_SetReg:
2746
 4994  FF0CF4  B0 46         		bcs	?10
2747
 4995  FF0CF6  A5 BA         		lda	SMTmpL
2748
 4996  FF0CF8  85 C7         		sta	SMkr
2749
 4997  FF0CFA  20 5A 01      		jsr	GetParm
2750
 4998  FF0CFD  B0 3D         		bcs	?10
2751
 4999  FF0CFF  A5 BA         		lda	SMTmpL		; pcl
2752
 5000  FF0D01  A4 BB         		ldy	SMTmpH		; pch
2753
 5001  FF0D03  85 C8         		sta	SMpc
2754
 5002  FF0D05  84 C9         		sty	SMpc+1
2755
 5003  FF0D07  20 5A 01      		jsr	GetParm
2756
 5004  FF0D0A  B0 30         		bcs	?10
2757
 5005  FF0D0C  A5 BA         		lda	SMTmpL
2758
 5006  FF0D0E  85 CB         		sta	SMbr
2759
 5007  FF0D10  20 5A 01      		jsr	GetParm
2760
 5008  FF0D13  B0 27         		bcs	?10
2761
 5009  FF0D15  A5 BA         		lda	SMTmpL		; dpl
2762
 5010  FF0D17  A4 BB         		ldy	SMTmpH		; dph
2763
 5011  FF0D19  85 CC         		sta	SMdp
2764
 5012  FF0D1B  84 CD         		sty	SMdp+1
2765
 5013  FF0D1D  20 5A 01      		jsr	GetParm
2766
 5014  FF0D20  B0 1A         		bcs	?10
2767
 5015  FF0D22  A5 BA         		lda	SMTmpL
2768
 5016  FF0D24  85 CA         		sta	SMsr
2769
 5017  FF0D26  A0 00         		ldy	#0		; legge 3 param. successivi (A, X, Y)
2770
 5018  FF0D28  20 5A 01      	?01:	jsr	GetParm		; non si imposta SP
2771
 5019  FF0D2B  B0 0F         		bcs	?10
2772
 5020  FF0D2D                		ACC16
2773
 5021  FF0D2D  C2 20         		rep	#PMFLAG
2774
 5022                        		.LONGA	on
2775
 5023                        		.MNLIST
2776
 5024  FF0D2F  A5 BA         		lda	SMTmpL
2777
 5025  FF0D31  99 CE 01      		sta	DP01ADDR+SMac,y
2778
 5026  FF0D34                		ACC08
2779
 5027  FF0D34  E2 20         		sep	#PMFLAG
2780
 5028                        		.LONGA	off
2781
 5029                        		.MNLIST
2782
 5030  FF0D36  C8            		iny
2783
 5031  FF0D37  C8            		iny
2784
 5032  FF0D38  C0 06         		cpy	#6
2785
 5033  FF0D3A  90 EC         		bcc	?01
2786
 5034  FF0D3C  60            	?10:	rts
2787
 5035  FF0D3D
2788
 5036                        	; cre [0|1] -> Expanded Memory $010000-$011FFF off/on
2789
 5037  FF0D3D                	Cmd_cre:
2790
 5038  FF0D3D  F0 23         		beq	Cmd_crs		; no paramteri - show
2791
  Tue Jul 17 11:00:24 2018                                                                                               Page   46
2792
 
2793
 
2794
 
2795
 
2796
 5039  FF0D3F  A5 BA         		lda	SMTmpL
2797
 5040  FF0D41  29 01         		and	#$01
2798
 5041  FF0D43  AA            		tax
2799
 5042  FF0D44  9F 0C FC 00   		sta	CREME,x
2800
 5043  FF0D48  80 18         		bra	Cmd_crs
2801
 5044
2802
 5045                        	; crx [0|1] -> eXtended Memory $012000-$013FFF off/on
2803
 5046  FF0D4A                	Cmd_crx:
2804
 5047  FF0D4A  F0 16         		beq	Cmd_crs		; no paramteri - show
2805
 5048  FF0D4C  A5 BA         		lda	SMTmpL
2806
 5049  FF0D4E  29 01         		and	#$01
2807
 5050  FF0D50  AA            		tax
2808
 5051  FF0D51  9F 0A FC 00   		sta	CRXME,x
2809
 5052  FF0D55  80 0B         		bra	Cmd_crs
2810
 5053  FF0D57
2811
 5054                        	; crf [0|1] -> Flash Memory $F00000-$F0FFFF off/on
2812
 5055  FF0D57                	Cmd_crf:
2813
 5056  FF0D57  F0 09         		beq	Cmd_crs		; no paramteri - show
2814
 5057  FF0D59  A5 BA         		lda	SMTmpL
2815
 5058  FF0D5B  29 01         		and	#$01
2816
 5059  FF0D5D  AA            		tax
2817
 5060  FF0D5E  9F 08 FC 00   		sta	CRXFE,x
2818
 5061
2819
 5062                        	; crs -> show stato registro di controllo accesso memoria
2820
 5063  FF0D62                	Cmd_crs:
2821
 5064  FF0D62  A2 00         		ldx	#0
2822
 5065  FF0D64  BF 8F 1C FF   	?01:	lda	CRSTR,x		; copia stringa nel buffer
2823
 5066  FF0D68  9F 00 99 01   		sta	INPUTBUF,x
2824
 5067  FF0D6C  F0 03         		beq	?01a
2825
 5068  FF0D6E  E8            		inx
2826
 5069  FF0D6F  D0 F3         		bne	?01
2827
 5070  FF0D71  A2 17         	?01a:	ldx	#23		; flag EM
2828
 5071  FF0D73  A9 30         		lda	#'0'
2829
 5072  FF0D75  AC 0C FC      		ldy	CREME
2830
 5073  FF0D78  F0 01         		beq	?02
2831
 5074  FF0D7A  1A            		inc	a
2832
 5075  FF0D7B  9F 00 99 01   	?02:	sta	INPUTBUF,x
2833
 5076  FF0D7F  A2 2F         		ldx	#47		; flag XM
2834
 5077  FF0D81  A9 30         		lda	#'0'
2835
 5078  FF0D83  AC 0A FC      		ldy	CRXME
2836
 5079  FF0D86  F0 01         		beq	?03
2837
 5080  FF0D88  1A            		inc	a
2838
 5081  FF0D89  9F 00 99 01   	?03:	sta	INPUTBUF,x
2839
 5082  FF0D8D  A2 47         		ldx	#71		; flag FM
2840
 5083  FF0D8F  A9 30         		lda	#'0'
2841
 5084  FF0D91  AC 08 FC      		ldy	CRXFE
2842
 5085  FF0D94  F0 01         		beq	?04
2843
 5086  FF0D96  1A            		inc	a
2844
 5087  FF0D97  9F 00 99 01   	?04:	sta	INPUTBUF,x
2845
 5088  FF0D9B                		ACC16
2846
 5089  FF0D9B  C2 20         		rep	#PMFLAG
2847
 5090                        		.LONGA	on
2848
 5091                        		.MNLIST
2849
 5092  FF0D9D  A9 00 99      		lda	#INPUTBUF
2850
 5093  FF0DA0  A2 01         		ldx	#.SEG.INPUTBUF
2851
 5094  FF0DA2                		SCNSTROUT
2852
 5095  FF0DA2  02 03         		cop	$03
2853
  Tue Jul 17 11:00:24 2018                                                                                               Page   47
2854
 
2855
 
2856
 
2857
 
2858
 5096                        		.MNLIST
2859
 5097  FF0DA4                		CPU08
2860
 5098  FF0DA4  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2861
 5099                        		.LONGA	off
2862
 5100                        		.LONGI	off
2863
 5101                        		.MNLIST
2864
 5102  FF0DA6  60            		rts
2865
 5103
2866
 5104                        	; xmp [page] -> set page extended memory
2867
 5105  FF0DA7                	Cmd_SetXMPage:
2868
 5106  FF0DA7  F0 0D         		beq	?10		; no paramteri - show
2869
 5107  FF0DA9                		ACC16
2870
 5108  FF0DA9  C2 20         		rep	#PMFLAG
2871
 5109                        		.LONGA	on
2872
 5110                        		.MNLIST
2873
 5111  FF0DAB  A5 BB         		lda	SMTmpH
2874
 5112  FF0DAD                		ACC08
2875
 5113  FF0DAD  E2 20         		sep	#PMFLAG
2876
 5114                        		.LONGA	off
2877
 5115                        		.MNLIST
2878
 5116  FF0DAF  D0 6F         		bne	CmdErr
2879
 5117  FF0DB1  A5 BA         		lda	SMTmpL
2880
 5118  FF0DB3  8D 28 FD      		sta	PIA0+PIAPRA
2881
 5119  FF0DB6                	?10:	SCNPRINT
2882
 5120  FF0DB6  02 01         		cop	$01
2883
 5121                        		.MNLIST
2884
 5122  FF0DB8  0D 3A 3A 20 43 		.DB	$0D, ':: Current XM Page -> $', 0
2885
               75 72 72 65 6E
2886
               74 20 58 4D 20
2887
               50 61 67 65 20
2888
               2D 3E 20 24 00
2889
 5123  FF0DD1
2890
 5124  FF0DD1  AD 28 FD      		lda	PIA0+PIAPRA
2891
 5125  FF0DD4  20 71 19      		jsr	PrintHex
2892
 5126  FF0DD7  60            		rts
2893
 5127
2894
 5128                        	; m [start][stop] -> visualizza memoria standard
2895
 5129  FF0DD8                	Cmd_m:
2896
 5130  FF0DD8  B0 08         		bcs	?01
2897
 5131  FF0DDA  20 92 18      		jsr	TmpToAddr
2898
 5132  FF0DDD  20 5A 01      		jsr	GetParm
2899
 5133  FF0DE0  90 06         		bcc	?02
2900
 5134  FF0DE2  A9 0B         	?01:	lda	#11		; numero righe x 16 bytes
2901
 5135  FF0DE4  85 BA         		sta	SMTmpL
2902
 5136  FF0DE6  D0 1B         		bne	?03
2903
 5137  FF0DE8  20 9F 18      	?02:	jsr	SubTmpAddr
2904
 5138  FF0DEB  90 33         		bcc	CmdErr		; end address > start address - errore
2905
 5139  FF0DED  4A            		lsr	a		; calcola numero righe (x 16 bytes)
2906
 5140  FF0DEE  66 BB         		ror	SMTmpH
2907
 5141  FF0DF0  66 BA         		ror	SMTmpL
2908
 5142  FF0DF2  4A            		lsr	a
2909
 5143  FF0DF3  66 BB         		ror	SMTmpH
2910
 5144  FF0DF5  66 BA         		ror	SMTmpL
2911
 5145  FF0DF7  4A            		lsr	a
2912
 5146  FF0DF8  66 BB         		ror	SMTmpH
2913
 5147  FF0DFA  66 BA         		ror	SMTmpL
2914
 5148  FF0DFC  4A            		lsr	a
2915
  Tue Jul 17 11:00:24 2018                                                                                               Page   48
2916
 
2917
 
2918
 
2919
 
2920
 5149  FF0DFD  66 BB         		ror	SMTmpH
2921
 5150  FF0DFF  66 BA         		ror	SMTmpL
2922
 5151  FF0E01  85 BC         		sta	SMTmpK
2923
 5152  FF0E03  20 80 1A      	?03:	jsr	CkStop
2924
 5153  FF0E06  F0 17         		beq	?04
2925
 5154  FF0E08  20 F2 0E      		jsr	DispMem
2926
 5155  FF0E0B  C2 21         		rep	#(PMFLAG.OR.PCFLAG)	; 16 bit + clc
2927
 5156                        		.LONGA	on
2928
 5157  FF0E0D  A9 10 00      		lda	#16
2929
 5158                        		.LONGA	off
2930
 5159  FF0E10  20 F4 18      		jsr	IncPtrA
2931
 5160  FF0E13  20 B1 18      		jsr	DecTmpPtr
2932
 5161  FF0E16  B0 EB         		bcs	?03
2933
 5162  FF0E18  A5 C6         		lda	SMdumb
2934
 5163  FF0E1A  F0 03         		beq	?04
2935
 5164  FF0E1C                		TXT_CR
2936
 5165  FF0E1C                		TXTPRCHAR
2937
 5166                        		.MLIST
2938
 5167  FF0E1C  02 08         		cop	$08
2939
 5168                        		.MNLIST
2940
 5169  FF0E1E  0D            		.DB	$0D
2941
 5170                        		.MNLIST
2942
 5171  FF0E1F  60            	?04:	rts
2943
 5172  FF0E20
2944
 5173  FF0E20                	CmdErr:
2945
 5174  FF0E20  4C 34 01      		jmp	ErrCls2
2946
 5175
2947
 5176                        	; rd addr -> read single memory addr.
2948
 5177  FF0E23                	Cmd_rd:
2949
 5178  FF0E23  F0 FB         		beq	CmdErr		; no params
2950
 5179  FF0E25  20 92 18      		jsr	TmpToAddr
2951
 5180  FF0E28                		SCNPRINT
2952
 5181  FF0E28  02 01         		cop	$01
2953
 5182                        		.MNLIST
2954
 5183  FF0E2A  1B 4F 01 0D 72 		.DB	KB_ESC, 'O', SCN_CSRUP, $0D, 'rd ', 0
2955
               64 20 00
2956
 5184  FF0E32  20 37 19      		jsr	PrintAddr
2957
 5185  FF0E35  20 51 19      		jsr	PrintBlank
2958
 5186  FF0E38  A7 B6         		lda	[SMAddrL]
2959
 5187  FF0E3A  4C 71 19      		jmp	PrintHex
2960
 5188
2961
 5189                        	; wr addr data -> write single memory addr.
2962
 5190  FF0E3D                	Cmd_wr:
2963
 5191  FF0E3D  F0 E1         		beq	CmdErr		; no params
2964
 5192  FF0E3F  B0 DF         		bcs	CmdErr
2965
 5193  FF0E41  20 92 18      		jsr	TmpToAddr
2966
 5194  FF0E44  20 5A 01      		jsr	GetParm
2967
 5195  FF0E47  B0 D7         		bcs	CmdErr		; manca data
2968
 5196  FF0E49  A5 BA         		lda	SMTmpL
2969
 5197  FF0E4B  87 B6         		sta	[SMAddrL]
2970
 5198  FF0E4D                		SCNPRINT
2971
 5199  FF0E4D  02 01         		cop	$01
2972
 5200                        		.MNLIST
2973
 5201  FF0E4F  1B 4F 01 0D 77 		.DB	KB_ESC, 'O', SCN_CSRUP, $0D, 'wr ', 0
2974
               72 20 00
2975
 5202  FF0E57  20 37 19      		jsr	PrintAddr
2976
 5203  FF0E5A  20 51 19      		jsr	PrintBlank
2977
  Tue Jul 17 11:00:24 2018                                                                                               Page   49
2978
 
2979
 
2980
 
2981
 
2982
 5204  FF0E5D  A5 BA         		lda	SMTmpL
2983
 5205  FF0E5F  4C 71 19      		jmp	PrintHex
2984
 5206
2985
 5207                        	; xs [sector]
2986
 5208  FF0E62                	Cmd_xs:
2987
 5209  FF0E62  D0 04         		bne	?02
2988
 5210  FF0E64  64 BA         		stz	SMTmpL
2989
 5211  FF0E66  64 BB         		stz	SMTmpH
2990
 5212  FF0E68                	?02:	ACC16
2991
 5213  FF0E68  C2 20         		rep	#PMFLAG
2992
 5214                        		.LONGA	on
2993
 5215                        		.MNLIST
2994
 5216  FF0E6A  A5 BA         		lda	SMTmpL
2995
 5217  FF0E6C  29 FF 0F      		and	#$0FFF
2996
 5218  FF0E6F  0A            		asl	a
2997
 5219  FF0E70                		ACC08
2998
 5220  FF0E70  E2 20         		sep	#PMFLAG
2999
 5221                        		.LONGA	off
3000
 5222                        		.MNLIST
3001
 5223  FF0E72  EB            		xba
3002
 5224  FF0E73  85 B8         		sta	SMAddrK
3003
 5225  FF0E75  EB            		xba
3004
 5226  FF0E76  85 B7         		sta	SMAddrH
3005
 5227  FF0E78  64 B6         		stz	SMAddrL
3006
 5228                        		;stz	SMTmpL
3007
 5229  FF0E7A  64 BB         		stz	SMTmpH
3008
 5230  FF0E7C  80 10         		bra	__?01
3009
 5231  FF0E7E
3010
 5232                        	; mx [start][stop] -> visualizza memoria estesa (max. 1FFFFF)
3011
 5233  FF0E7E                	Cmd_mx:
3012
 5234  FF0E7E  B0 0E         		bcs	__?01
3013
 5235  FF0E80  20 92 18      		jsr	TmpToAddr
3014
 5236  FF0E83  A5 B8         		lda	SMAddrK
3015
 5237  FF0E85  C9 20         		cmp	#$20
3016
 5238  FF0E87  B0 97         		bcs	CmdErr		; max. 1FFFFF
3017
 5239  FF0E89  20 5A 01      		jsr	GetParm
3018
 5240  FF0E8C  90 06         		bcc	__?02
3019
 5241  FF0E8E  A9 0B         	__?01:	lda	#11		; numero di righe di default (righe x 16 bytes)
3020
 5242  FF0E90  85 BA         		sta	SMTmpL
3021
 5243  FF0E92  D0 21         		bne	__?03
3022
 5244  FF0E94  A5 BC         	__?02:	lda	SMTmpK		; max. possibile 1FFFFF
3023
 5245  FF0E96  C9 20         		cmp	#$20
3024
 5246  FF0E98  B0 86         		bcs	CmdErr		; errore
3025
 5247  FF0E9A  20 9F 18      		jsr	SubTmpAddr
3026
 5248  FF0E9D  90 81         		bcc	CmdErr		; end address > start address - errore
3027
 5249  FF0E9F  4A            		lsr	a		; calcola numero righe (x 16 bytes)
3028
 5250  FF0EA0  66 BB         		ror	SMTmpH
3029
 5251  FF0EA2  66 BA         		ror	SMTmpL
3030
 5252  FF0EA4  4A            		lsr	a
3031
 5253  FF0EA5  66 BB         		ror	SMTmpH
3032
 5254  FF0EA7  66 BA         		ror	SMTmpL
3033
 5255  FF0EA9  4A            		lsr	a
3034
 5256  FF0EAA  66 BB         		ror	SMTmpH
3035
 5257  FF0EAC  66 BA         		ror	SMTmpL
3036
 5258  FF0EAE  4A            		lsr	a
3037
 5259  FF0EAF  66 BB         		ror	SMTmpH
3038
 5260  FF0EB1  66 BA         		ror	SMTmpL
3039
  Tue Jul 17 11:00:24 2018                                                                                               Page   50
3040
 
3041
 
3042
 
3043
 
3044
 5261  FF0EB3  85 BC         		sta	SMTmpK
3045
 5262  FF0EB5  A5 B8         	__?03:	lda	SMAddrK
3046
 5263  FF0EB7  C9 20         		cmp	#$20		; MAX 1FFFFF
3047
 5264  FF0EB9  B0 1B         		bcs	?04
3048
 5265  FF0EBB  20 80 1A      		jsr	CkStop
3049
 5266  FF0EBE  F0 16         		beq	?04
3050
 5267  FF0EC0  20 88 10      		jsr	DispXMem
3051
 5268  FF0EC3  C2 21         		rep	#(PMFLAG.OR.PCFLAG)	; 16 bit + clc
3052
 5269                        		.LONGA	on
3053
 5270  FF0EC5  A9 10 00      		lda	#16
3054
 5271                        		.LONGA	off
3055
 5272  FF0EC8  20 F4 18      		jsr	IncPtrA
3056
 5273  FF0ECB  A5 B8         		lda	SMAddrK
3057
 5274  FF0ECD  C9 20         		cmp	#$20		; MAX 1FFFFF
3058
 5275  FF0ECF  B0 05         		bcs	?04
3059
 5276  FF0ED1  20 B1 18      		jsr	DecTmpPtr
3060
 5277  FF0ED4  B0 DF         		bcs	__?03
3061
 5278  FF0ED6  60            	?04:	rts
3062
 5279  FF0ED7
3063
 5280
3064
 5281                        	; >addr data, data, data,... -> set standard memory
3065
 5282  FF0ED7                	Cmd_SetMem:
3066
 5283  FF0ED7  B0 13         		bcs	?02
3067
 5284  FF0ED9  20 92 18      		jsr	TmpToAddr
3068
 5285  FF0EDC  A0 00         		ldy	#0
3069
 5286  FF0EDE  20 5A 01      	?01:	jsr	GetParm
3070
 5287  FF0EE1  B0 09         		bcs	?02
3071
 5288  FF0EE3  A5 BA         		lda	SMTmpL
3072
 5289  FF0EE5  97 B6         		sta	[SMAddrL],y
3073
 5290  FF0EE7  C8            		iny
3074
 5291  FF0EE8  C0 10         		cpy	#16
3075
 5292  FF0EEA  90 F2         		bcc	?01
3076
 5293  FF0EEC                	?02:	SCNPRINT
3077
 5294  FF0EEC  02 01         		cop	$01
3078
 5295                        		.MNLIST
3079
 5296  FF0EEE  1B 4F 01 00   		.DB	KB_ESC, 'O', SCN_CSRUP, 0
3080
 5297
3081
 5298                        	; display 1 riga di memoria
3082
 5299  FF0EF2                	DispMem:
3083
 5300  FF0EF2                		TXT_CR
3084
 5301  FF0EF2                		TXTPRCHAR
3085
 5302                        		.MLIST
3086
 5303  FF0EF2  02 08         		cop	$08
3087
 5304                        		.MNLIST
3088
 5305  FF0EF4  0D            		.DB	$0D
3089
 5306                        		.MNLIST
3090
 5307  FF0EF5                		TXTPRCHAR
3091
 5308  FF0EF5  02 08         		cop	$08
3092
 5309                        		.MNLIST
3093
 5310  FF0EF7  3E            		.DB	'>'
3094
 5311  FF0EF8  20 37 19      		jsr	PrintAddr
3095
 5312  FF0EFB  A0 00         		ldy	#0
3096
 5313  FF0EFD  F0 03         		beq	?02
3097
 5314  FF0EFF  20 51 19      	?01:	jsr	PrintBlank
3098
 5315  FF0F02  B7 B6         	?02:	lda	[SMAddrL],y	; fetch byte
3099
 5316  FF0F04  20 71 19      		jsr	PrintHex
3100
 5317  FF0F07  C8            		iny
3101
  Tue Jul 17 11:00:24 2018                                                                                               Page   51
3102
 
3103
 
3104
 
3105
 
3106
 5318  FF0F08  C0 10         		cpy	#16
3107
 5319  FF0F0A  90 F3         		bcc	?01
3108
 5320  FF0F0C  A5 C6         		lda	SMdumb
3109
 5321  FF0F0E  D0 08         		bne	?03a
3110
 5322  FF0F10                		SCNPRINT
3111
 5323  FF0F10  02 01         		cop	$01
3112
 5324                        		.MNLIST
3113
 5325  FF0F12  20 14 3A 00   		.DB	' ', SCN_RVSON, ':', 0
3114
 5326  FF0F16  80 05         		bra	?03b
3115
 5327  FF0F18                	?03a:	TXTPRINT
3116
 5328  FF0F18  02 02         		cop	$02
3117
 5329                        		.MNLIST
3118
 5330  FF0F1A  20 3A 00      		.DB	' :', 0
3119
 5331  FF0F1D  A0 00         	?03b:	ldy	#0
3120
 5332  FF0F1F  B7 B6         	?03:	lda	[SMAddrL],y	; fetch byte
3121
 5333  FF0F21  C9 80         		cmp	#$80
3122
 5334  FF0F23  B0 04         		bcs	?04
3123
 5335  FF0F25  C9 20         		cmp	#' '
3124
 5336  FF0F27  B0 02         		bcs	?06
3125
 5337  FF0F29  A9 2E         	?04:	lda	#'.'
3126
 5338  FF0F2B                	?06:	TXTCHAROUT
3127
 5339  FF0F2B  02 06         		cop	$06
3128
 5340                        		.MNLIST
3129
 5341  FF0F2D  C8            		iny
3130
 5342  FF0F2E  C0 10         		cpy	#16
3131
 5343  FF0F30  90 ED         		bcc	?03
3132
 5344  FF0F32  60            		rts
3133
 5345
3134
 5346                        	; # km <src bank> <dest bank>(src bank = $01..$FF, dest bank = $01..$F7)
3135
 5347                        	; move whole memory bank - src bank and dest bank must be not the same
3136
 5348  FF0F33                	Cmd_km:
3137
 5349  FF0F33  D0 03         		bne	?01
3138
 5350  FF0F35  4C 4F 10      	?00:	jmp	CmdErr2
3139
 5351  FF0F38  A5 BC         	?01:	lda	SMTmpK
3140
 5352  FF0F3A  05 BB         		ora	SMTmpH
3141
 5353  FF0F3C  D0 F7         		bne	?00
3142
 5354  FF0F3E  A5 BA         		lda	SMTmpL
3143
 5355  FF0F40  F0 F3         		beq	?00
3144
 5356  FF0F42  85 E2         		sta	SMTmp2
3145
 5357  FF0F44  20 5A 01      		jsr	GetParm
3146
 5358  FF0F47  B0 EC         		bcs	?00
3147
 5359  FF0F49  A5 BC         		lda	SMTmpK
3148
 5360  FF0F4B  05 BB         		ora	SMTmpH
3149
 5361  FF0F4D  D0 E6         		bne	?00
3150
 5362  FF0F4F  A5 BA         		lda	SMTmpL
3151
 5363  FF0F51  F0 E2         		beq	?00
3152
 5364  FF0F53  C9 F8         		cmp	#$F8
3153
 5365  FF0F55  B0 DE         		bcs	?00
3154
 5366  FF0F57  C5 E2         		cmp	SMTmp2
3155
 5367  FF0F59  F0 DA         		beq	?00
3156
 5368  FF0F5B  64 B6         		stz	SMAddrL
3157
 5369  FF0F5D  64 B7         		stz	SMAddrH
3158
 5370  FF0F5F  85 B8         		sta	SMAddrK
3159
 5371  FF0F61  8F 75 0F FF   		sta	?10+1		; store dest bank for mvn istruction
3160
 5372  FF0F65  A5 E2         		lda	SMTmp2
3161
 5373  FF0F67  8F 76 0F FF   		sta	?10+2		; store source bank for mvn istruction
3162
 5374  FF0F6B  8B            		phb
3163
  Tue Jul 17 11:00:24 2018                                                                                               Page   52
3164
 
3165
 
3166
 
3167
 
3168
 5375  FF0F6C  A2 00         		ldx	#0
3169
 5376  FF0F6E                		CPU16
3170
 5377  FF0F6E  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
3171
 5378                        		.LONGA	on
3172
 5379                        		.LONGI	on
3173
 5380                        		.MNLIST
3174
 5381  FF0F70  A9 FF FF      		lda	#$FFFF
3175
 5382  FF0F73  9B            		txy
3176
 5383  FF0F74  54 00 00      	?10:	mvn	#0, #0
3177
 5384  FF0F77                		CPU08
3178
 5385  FF0F77  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
3179
 5386                        		.LONGA	off
3180
 5387                        		.LONGI	off
3181
 5388                        		.MNLIST
3182
 5389  FF0F79  AB            		plb
3183
 5390  FF0F7A  60            		rts
3184
 5391
3185
 5392                        	; # kF <bank> (bank = $01..$F7)
3186
 5393                        	; fill whole memory bank with incr/decr pattern
3187
 5394  FF0F7B                	Cmd_kF:
3188
 5395  FF0F7B  D0 03         		bne	?01
3189
 5396  FF0F7D  4C 4F 10      	?00:	jmp	CmdErr2
3190
 5397  FF0F80  A5 BC         	?01:	lda	SMTmpK
3191
 5398  FF0F82  05 BB         		ora	SMTmpH
3192
 5399  FF0F84  D0 F7         		bne	?00
3193
 5400  FF0F86  A5 BA         		lda	SMTmpL
3194
 5401  FF0F88  F0 F3         		beq	?00
3195
 5402  FF0F8A  C9 F8         		cmp	#$F8
3196
 5403  FF0F8C  B0 EF         		bcs	?00
3197
 5404  FF0F8E  85 B8         		sta	SMAddrK
3198
 5405  FF0F90  64 B6         		stz	SMAddrL
3199
 5406  FF0F92  64 B7         		stz	SMAddrH
3200
 5407  FF0F94  A9 00         		lda	#0
3201
 5408  FF0F96  85 E2         		sta	SMTmp2
3202
 5409  FF0F98  A8            		tay
3203
 5410  FF0F99                		INDEX16
3204
 5411  FF0F99  C2 10         		rep	#PXFLAG
3205
 5412                        		.LONGI	on
3206
 5413                        		.MNLIST
3207
 5414  FF0F9B  97 B6         	?02:	sta	[SMAddrL],y
3208
 5415  FF0F9D  24 E2         		bit	SMTmp2
3209
 5416  FF0F9F  30 08         		bmi	?04
3210
 5417  FF0FA1  1A            		inc	a
3211
 5418  FF0FA2  D0 0D         		bne	?06
3212
 5419  FF0FA4  3A            		dec	a
3213
 5420  FF0FA5  85 E2         		sta	SMTmp2
3214
 5421  FF0FA7  80 08         		bra	?06
3215
 5422  FF0FA9  3A            	?04:	dec	a
3216
 5423  FF0FAA  D0 05         		bne	?06
3217
 5424  FF0FAC  64 E2         		stz	SMTmp2
3218
 5425  FF0FAE  C8            		iny
3219
 5426  FF0FAF  97 B6         		sta	[SMAddrL],y
3220
 5427  FF0FB1  C8            	?06:	iny
3221
 5428  FF0FB2  D0 E7         		bne	?02
3222
 5429  FF0FB4                		CPU08
3223
 5430  FF0FB4  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
3224
 5431                        		.LONGA	off
3225
  Tue Jul 17 11:00:24 2018                                                                                               Page   53
3226
 
3227
 
3228
 
3229
 
3230
 5432                        		.LONGI	off
3231
 5433                        		.MNLIST
3232
 5434  FF0FB6  60            		rts
3233
 5435
3234
 5436                        	; # kz <bank> (bank = $01..$F7)
3235
 5437                        	; clear whole memory bank
3236
 5438  FF0FB7                	Cmd_kz:
3237
 5439  FF0FB7  D0 03         		bne	?01
3238
 5440  FF0FB9  4C 4F 10      	?00:	jmp	CmdErr2
3239
 5441  FF0FBC  A5 BC         	?01:	lda	SMTmpK
3240
 5442  FF0FBE  05 BB         		ora	SMTmpH
3241
 5443  FF0FC0  D0 F7         		bne	?00
3242
 5444  FF0FC2  A5 BA         		lda	SMTmpL
3243
 5445  FF0FC4  F0 F3         		beq	?00
3244
 5446  FF0FC6  C9 F8         		cmp	#$F8
3245
 5447  FF0FC8  B0 EF         		bcs	?00
3246
 5448  FF0FCA  85 BC         		sta	SMTmpK
3247
 5449  FF0FCC  64 BA         		stz	SMTmpL
3248
 5450  FF0FCE  64 BB         		stz	SMTmpH
3249
 5451  FF0FD0  A0 00         		ldy	#0
3250
 5452  FF0FD2                		CPU16
3251
 5453  FF0FD2  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
3252
 5454                        		.LONGA	on
3253
 5455                        		.LONGI	on
3254
 5456                        		.MNLIST
3255
 5457  FF0FD4  98            		tya
3256
 5458  FF0FD5  97 BA         	?02:	sta	[SMTmpL],y
3257
 5459  FF0FD7  C8            		iny
3258
 5460  FF0FD8  C8            		iny
3259
 5461  FF0FD9  D0 FA         		bne	?02
3260
 5462  FF0FDB                		CPU08
3261
 5463  FF0FDB  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
3262
 5464                        		.LONGA	off
3263
 5465                        		.LONGI	off
3264
 5466                        		.MNLIST
3265
 5467  FF0FDD  60            		rts
3266
 5468
3267
 5469                        	; # kf <bank> <byte=0> (bank = $01..$F7)
3268
 5470                        	; fill whole memory bank
3269
 5471  FF0FDE                	Cmd_kf:
3270
 5472  FF0FDE  F0 6F         		beq	CmdErr2
3271
 5473  FF0FE0  A5 BC         		lda	SMTmpK
3272
 5474  FF0FE2  05 BB         		ora	SMTmpH
3273
 5475  FF0FE4  D0 69         		bne	CmdErr2
3274
 5476  FF0FE6  A5 BA         		lda	SMTmpL
3275
 5477  FF0FE8  F0 65         		beq	CmdErr2
3276
 5478  FF0FEA  C9 F8         		cmp	#$F8
3277
 5479  FF0FEC  B0 61         		bcs	CmdErr2
3278
 5480  FF0FEE  85 B8         		sta	SMAddrK
3279
 5481  FF0FF0  64 B6         		stz	SMAddrL
3280
 5482  FF0FF2  64 B7         		stz	SMAddrH
3281
 5483  FF0FF4  64 BA         		stz	SMTmpL
3282
 5484  FF0FF6  20 5A 01      		jsr	GetParm
3283
 5485  FF0FF9  B0 06         		bcs	?01
3284
 5486  FF0FFB  A5 BC         		lda	SMTmpK
3285
 5487  FF0FFD  05 BB         		ora	SMTmpH
3286
 5488  FF0FFF  D0 4E         		bne	CmdErr2
3287
  Tue Jul 17 11:00:24 2018                                                                                               Page   54
3288
 
3289
 
3290
 
3291
 
3292
 5489  FF1001  A5 BA         	?01:	lda	SMTmpL
3293
 5490  FF1003  EB            		xba
3294
 5491  FF1004  A5 BA         		lda	SMTmpL
3295
 5492  FF1006  A0 00         		ldy	#0
3296
 5493  FF1008                		CPU16
3297
 5494  FF1008  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
3298
 5495                        		.LONGA	on
3299
 5496                        		.LONGI	on
3300
 5497                        		.MNLIST
3301
 5498  FF100A  97 B6         	?02:	sta	[SMAddrL],y
3302
 5499  FF100C  C8            		iny
3303
 5500  FF100D  C8            		iny
3304
 5501  FF100E  D0 FA         		bne	?02
3305
 5502  FF1010                		CPU08
3306
 5503  FF1010  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
3307
 5504                        		.LONGA	off
3308
 5505                        		.LONGI	off
3309
 5506                        		.MNLIST
3310
 5507  FF1012  60            		rts
3311
 5508  FF1013
3312
 5509  FF1013                	Cmd_z:
3313
 5510  FF1013  20 91 19      		jsr	GetStartStop		; indirizzi Start/Stop
3314
 5511  FF1016  B0 37         		bcs	CmdErr2
3315
 5512  FF1018  64 BA         		stz	SMTmpL			; fill byte = 0
3316
 5513  FF101A  64 E2         		stz	SMTmp2			; fill no inc.
3317
 5514  FF101C  80 19         		bra	_Fill
3318
 5515  FF101E
3319
 5516  FF101E                	Cmd_f:
3320
 5517  FF101E  20 91 19      		jsr	GetStartStop		; indirizzi Start/Stop
3321
 5518  FF1021  B0 2C         		bcs	CmdErr2
3322
 5519  FF1023  20 5A 01      		jsr	GetParm			; Fill byte
3323
 5520  FF1026  B0 27         		bcs	CmdErr2
3324
 5521  FF1028  64 E2         		stz	SMTmp2			; fill no inc.
3325
 5522  FF102A  80 0B         		bra	_Fill
3326
 5523  FF102C
3327
 5524  FF102C                	Cmd_F:
3328
 5525  FF102C  20 91 19      		jsr	GetStartStop		; indirizzi Start/Stop
3329
 5526  FF102F  B0 1E         		bcs	CmdErr2
3330
 5527  FF1031  64 BA         		stz	SMTmpL			; fill byte = 0
3331
 5528  FF1033  A9 80         		lda	#$80
3332
 5529  FF1035  85 E2         		sta	SMTmp2			; flag fill-inc
3333
 5530  FF1037
3334
 5531                        		; SMSizeL/H/K  ->  #bytes
3335
 5532                        		; SMAddrL/H/K  -> indirizzo start
3336
 5533                        		; SMTmpL       -> fill byte
3337
 5534                        		; SMXddrL/H/K  -> indirizzo finale
3338
 5535                        		; SMTmp2       -> flag fill+inc.
3339
 5536
3340
 5537  FF1037                	_Fill:
3341
 5538  FF1037  20 80 1A      	?01:	jsr	CkStop
3342
 5539  FF103A  F0 12         		beq	?10
3343
 5540  FF103C  A5 BA         		lda	SMTmpL			; fill byte
3344
 5541  FF103E  87 B6         		sta	[SMAddrL]
3345
 5542  FF1040  24 E2         		bit	SMTmp2
3346
 5543  FF1042  10 02         		bpl	?04
3347
 5544  FF1044  E6 BA         		inc	SMTmpL
3348
 5545  FF1046  20 EF 18      	?04:	jsr	IncPtr
3349
  Tue Jul 17 11:00:24 2018                                                                                               Page   55
3350
 
3351
 
3352
 
3353
 
3354
 5546  FF1049  20 DC 18      		jsr	DecSize
3355
 5547  FF104C  B0 E9         		bcs	?01
3356
 5548  FF104E  60            	?10:	rts
3357
 5549
3358
 5550  FF104F                	CmdErr2:
3359
 5551  FF104F  4C 34 01      		jmp	ErrCls2
3360
 5552
3361
 5553                        	; x>addr data, data, data,... -> set extended memory
3362
 5554  FF1052                	Cmd_SetXMem:
3363
 5555  FF1052  AE 0A FC      		ldx	CRXME		; salva bit CR
3364
 5556  FF1055  DA            		phx
3365
 5557  FF1056  8D 0B FC      		sta	CRXMEON		; abilita memoria estesa
3366
 5558  FF1059  B0 1E         		bcs	?02
3367
 5559  FF105B  20 92 18      		jsr	TmpToAddr
3368
 5560  FF105E  A5 C3         		lda	SMXAddrK
3369
 5561  FF1060  C9 20         		cmp	#$20
3370
 5562  FF1062  B0 EB         		bcs	CmdErr2
3371
 5563  FF1064  A0 00         		ldy	#0
3372
 5564  FF1066  20 5A 01      	?01:	jsr	GetParm
3373
 5565  FF1069  B0 0E         		bcs	?02
3374
 5566  FF106B  20 0B 19      		jsr	XSetPtrY
3375
 5567  FF106E  B0 09         		bcs	?02		; fine memoria estesa
3376
 5568  FF1070  A5 BA         		lda	SMTmpL
3377
 5569  FF1072  87 C1         		sta	[SMXAddrL]
3378
 5570  FF1074  C8            		iny
3379
 5571  FF1075  C0 10         		cpy	#16
3380
 5572  FF1077  90 ED         		bcc	?01
3381
 5573  FF1079  A5 C3         	?02:	lda	SMXAddrK
3382
 5574  FF107B  C9 20         		cmp	#$20
3383
 5575  FF107D  90 01         		bcc	?03
3384
 5576  FF107F  60            		rts
3385
 5577  FF1080                	?03:	SCNPRINT
3386
 5578  FF1080  02 01         		cop	$01
3387
 5579                        		.MNLIST
3388
 5580  FF1082  1B 4F 01 00   		.DB	KB_ESC, 'O', SCN_CSRUP, 0
3389
 5581  FF1086
3390
 5582  FF1086  80 07         		bra	_xdm
3391
 5583
3392
 5584                        	; display 1 riga di memoria estesa
3393
 5585  FF1088                	DispXMem:
3394
 5586  FF1088  AE 0A FC      		ldx	CRXME		; salva bit CR
3395
 5587  FF108B  DA            		phx
3396
 5588  FF108C  8D 0B FC      		sta	CRXMEON		; abilita memoria estesa
3397
 5589  FF108F                	_xdm:
3398
 5590  FF108F  A9 01         		lda	#$01
3399
 5591  FF1091  85 C3         		sta	SMXAddrK
3400
 5592  FF1093                		TXT_CR
3401
 5593  FF1093                		TXTPRCHAR
3402
 5594                        		.MLIST
3403
 5595  FF1093  02 08         		cop	$08
3404
 5596                        		.MNLIST
3405
 5597  FF1095  0D            		.DB	$0D
3406
 5598                        		.MNLIST
3407
 5599  FF1096                		TXTPRCHAR		; prompt memoria estesa
3408
 5600  FF1096  02 08         		cop	$08
3409
 5601                        		.MNLIST
3410
 5602  FF1098  78            		.DB	'x'
3411
  Tue Jul 17 11:00:24 2018                                                                                               Page   56
3412
 
3413
 
3414
 
3415
 
3416
 5603  FF1099                		TXTPRCHAR
3417
 5604  FF1099  02 08         		cop	$08
3418
 5605                        		.MNLIST
3419
 5606  FF109B  3E            		.DB	'>'
3420
 5607  FF109C  20 37 19      		jsr	PrintAddr
3421
 5608  FF109F  A0 00         		ldy	#0
3422
 5609  FF10A1  F0 03         		beq	?02
3423
 5610  FF10A3  20 51 19      	?01:	jsr	PrintBlank
3424
 5611  FF10A6  20 0B 19      	?02:	jsr	XSetPtrY
3425
 5612  FF10A9  90 04         		bcc	?02a
3426
 5613  FF10AB  A9 FF         		lda	#$FF			; oltre limite memoria
3427
 5614  FF10AD  80 02         		bra	?02b
3428
 5615  FF10AF  A7 C1         	?02a:	lda	[SMXAddrL]
3429
 5616  FF10B1  20 71 19      	?02b:	jsr	PrintHex
3430
 5617  FF10B4  C8            		iny
3431
 5618  FF10B5  C0 10         		cpy	#16
3432
 5619  FF10B7  90 EA         		bcc	?01
3433
 5620  FF10B9  A5 C6         		lda	SMdumb
3434
 5621  FF10BB  D0 08         		bne	?03a
3435
 5622  FF10BD                		SCNPRINT
3436
 5623  FF10BD  02 01         		cop	$01
3437
 5624                        		.MNLIST
3438
 5625  FF10BF  20 14 3A 00   		.DB	' ', SCN_RVSON, ':', 0
3439
 5626  FF10C3  80 05         		bra	?03b
3440
 5627  FF10C5                	?03a:	TXTPRINT
3441
 5628  FF10C5  02 02         		cop	$02
3442
 5629                        		.MNLIST
3443
 5630  FF10C7  20 3A 00      		.DB	' :', 0
3444
 5631  FF10CA  A0 00         	?03b:	ldy	#0
3445
 5632  FF10CC  20 0B 19      	?03:	jsr	XSetPtrY
3446
 5633  FF10CF  90 04         		bcc	?03c
3447
 5634  FF10D1  A9 58         		lda	#'X'			; indica fine memoria
3448
 5635  FF10D3  80 02         		bra	?03d
3449
 5636  FF10D5  A7 C1         	?03c:	lda	[SMXAddrL]
3450
 5637  FF10D7  C9 80         	?03d:	cmp	#$80
3451
 5638  FF10D9  B0 04         		bcs	?04
3452
 5639  FF10DB  C9 20         		cmp	#' '
3453
 5640  FF10DD  B0 02         		bcs	?06
3454
 5641  FF10DF  A9 2E         	?04:	lda	#'.'
3455
 5642  FF10E1                	?06:	TXTCHAROUT
3456
 5643  FF10E1  02 06         		cop	$06
3457
 5644                        		.MNLIST
3458
 5645  FF10E3  C8            		iny
3459
 5646  FF10E4  C0 10         		cpy	#16
3460
 5647  FF10E6  90 E4         		bcc	?03
3461
 5648  FF10E8                		TXTPRINT
3462
 5649  FF10E8  02 02         		cop	$02
3463
 5650                        		.MNLIST
3464
 5651  FF10EA  18 20 00      		.DB	SCN_RVSOFF, ' ', 0
3465
 5652  FF10ED  AD 28 FD      		lda	PIA0+PIAPRA
3466
 5653  FF10F0  20 71 19      		jsr	PrintHex
3467
 5654  FF10F3  FA            		plx
3468
 5655  FF10F4  9F 0A FC 00   		sta	CRXME,x
3469
 5656  FF10F8  60            		rts
3470
 5657
3471
 5658                        	; te -> show RTC internal extended ram (128 bytes)
3472
 5659  FF10F9                	Cmd_te:
3473
  Tue Jul 17 11:00:24 2018                                                                                               Page   57
3474
 
3475
 
3476
 
3477
 
3478
 5660  FF10F9  64 DE         		stz	rtcadr
3479
 5661  FF10FB  20 51 11      	?02:	jsr	rtcxmem
3480
 5662  FF10FE  A5 DE         		lda	rtcadr
3481
 5663  FF1100  18            		clc
3482
 5664  FF1101  69 10         		adc	#16
3483
 5665  FF1103  85 DE         		sta	rtcadr
3484
 5666  FF1105  10 F4         		bpl	?02
3485
 5667  FF1107  60            		rts
3486
 5668
3487
 5669                        	; e>addr data, data, data,... -> set RTC extended memory
3488
 5670  FF1108                	Cmd_stxm:
3489
 5671  FF1108  A2 0A         		ldx	#RTCCTRLA	; setta banco 1 RTC
3490
 5672  FF110A  8E 4C FD      		stx	RTCALE
3491
 5673  FF110D  A9 10         		lda	#$10		; setta banco 1
3492
 5674  FF110F  0C 4D FD      		tsb	RTCDATA
3493
 5675  FF1112  B0 2E         		bcs	?06
3494
 5676  FF1114  A5 BA         		lda	SMTmpL
3495
 5677  FF1116  C9 80         		cmp	#$80
3496
 5678  FF1118  90 03         		bcc	?02
3497
 5679  FF111A  4C 34 01      		jmp	ErrCls2
3498
 5680  FF111D  85 DE         	?02:	sta	rtcadr
3499
 5681  FF111F  A0 00         		ldy	#0
3500
 5682  FF1121  20 5A 01      	?04:	jsr	GetParm
3501
 5683  FF1124  B0 1C         		bcs	?06
3502
 5684  FF1126  98            		tya
3503
 5685  FF1127  65 DE         		adc	rtcadr
3504
 5686  FF1129  30 12         		bmi	?05
3505
 5687  FF112B  A2 50         		ldx	#RTCEXTRAMADDR
3506
 5688  FF112D  8E 4C FD      		stx	RTCALE
3507
 5689  FF1130  8D 4D FD      		sta	RTCDATA
3508
 5690  FF1133  A2 53         		ldx	#RTCEXTRAMDATA
3509
 5691  FF1135  8E 4C FD      		stx	RTCALE
3510
 5692  FF1138  A5 BA         		lda	SMTmpL
3511
 5693  FF113A  8D 4D FD      		sta	RTCDATA		; store byte
3512
 5694  FF113D  C8            	?05:	iny
3513
 5695  FF113E  C0 10         		cpy	#16
3514
 5696  FF1140  90 DF         		bcc	?04
3515
 5697  FF1142  A5 DE         	?06:	lda	rtcadr
3516
 5698  FF1144  C9 80         		cmp	#$80
3517
 5699  FF1146  90 01         		bcc	?08
3518
 5700  FF1148  60            		rts
3519
 5701  FF1149                	?08:	SCNPRINT
3520
 5702  FF1149  02 01         		cop	$01
3521
 5703                        		.MNLIST
3522
 5704  FF114B  1B 4F 01 00   		.DB	KB_ESC, 'O', SCN_CSRUP, 0
3523
 5705  FF114F  80 0A         		bra	rtcxmem2
3524
 5706
3525
 5707                        	; show one row of RTC extended ram
3526
 5708  FF1151                	rtcxmem:
3527
 5709  FF1151  A2 0A         		ldx	#RTCCTRLA	; setta banco 1 RTC
3528
 5710  FF1153  8E 4C FD      		stx	RTCALE
3529
 5711  FF1156  A9 10         		lda	#$10		; setta banco 1
3530
 5712  FF1158  0C 4D FD      		tsb	RTCDATA
3531
 5713  FF115B                	rtcxmem2:
3532
 5714  FF115B                		TXTPRINT
3533
 5715  FF115B  02 02         		cop	$02
3534
 5716                        		.MNLIST
3535
  Tue Jul 17 11:00:24 2018                                                                                               Page   58
3536
 
3537
 
3538
 
3539
 
3540
 5717  FF115D  0D 65 3E 00   		.DB	13, 'e>', 0
3541
 5718  FF1161  A5 DE         		lda	rtcadr
3542
 5719  FF1163  20 4E 19      		jsr	PrintByte
3543
 5720  FF1166  A0 00         		ldy	#0
3544
 5721  FF1168  F0 03         		beq	?02
3545
 5722  FF116A  20 51 19      	?01:	jsr	PrintBlank
3546
 5723  FF116D  A2 50         	?02:	ldx	#RTCEXTRAMADDR
3547
 5724  FF116F  8E 4C FD      		stx	RTCALE
3548
 5725  FF1172  98            		tya
3549
 5726  FF1173  18            		clc
3550
 5727  FF1174  65 DE         		adc	rtcadr
3551
 5728  FF1176  10 08         		bpl	?02b
3552
 5729  FF1178  20 51 19      		jsr	PrintBlank
3553
 5730  FF117B  20 51 19      		jsr	PrintBlank
3554
 5731  FF117E  80 0E         		bra	?02c
3555
 5732  FF1180  8D 4D FD      	?02b:	sta	RTCDATA
3556
 5733  FF1183  A2 53         		ldx	#RTCEXTRAMDATA
3557
 5734  FF1185  8E 4C FD      		stx	RTCALE
3558
 5735  FF1188  AD 4D FD      		lda	RTCDATA		; fetch byte
3559
 5736  FF118B  20 71 19      		jsr	PrintHex
3560
 5737  FF118E  C8            	?02c:	iny
3561
 5738  FF118F  C0 10         		cpy	#16
3562
 5739  FF1191  90 D7         		bcc	?01
3563
 5740  FF1193  A5 C6         		lda	SMdumb
3564
 5741  FF1195  D0 08         		bne	?03a
3565
 5742  FF1197                		SCNPRINT
3566
 5743  FF1197  02 01         		cop	$01
3567
 5744                        		.MNLIST
3568
 5745  FF1199  20 14 3A 00   		.DB	' ', SCN_RVSON, ':', 0
3569
 5746  FF119D  80 05         		bra	?03b
3570
 5747  FF119F                	?03a:	TXTPRINT
3571
 5748  FF119F  02 02         		cop	$02
3572
 5749                        		.MNLIST
3573
 5750  FF11A1  20 3A 00      		.DB	' :', 0
3574
 5751  FF11A4  A0 00         	?03b:	ldy	#0
3575
 5752  FF11A6  A2 50         	?03:	ldx	#RTCEXTRAMADDR
3576
 5753  FF11A8  8E 4C FD      		stx	RTCALE
3577
 5754  FF11AB  98            		tya
3578
 5755  FF11AC  18            		clc
3579
 5756  FF11AD  65 DE         		adc	rtcadr
3580
 5757  FF11AF  30 13         		bmi	?04
3581
 5758  FF11B1  8D 4D FD      		sta	RTCDATA
3582
 5759  FF11B4  A2 53         		ldx	#RTCEXTRAMDATA
3583
 5760  FF11B6  8E 4C FD      		stx	RTCALE
3584
 5761  FF11B9  AD 4D FD      		lda	RTCDATA		; fetch byte
3585
 5762  FF11BC  C9 80         		cmp	#$80
3586
 5763  FF11BE  B0 04         		bcs	?04
3587
 5764  FF11C0  C9 20         		cmp	#' '
3588
 5765  FF11C2  B0 02         		bcs	?06
3589
 5766  FF11C4  A9 2E         	?04:	lda	#'.'
3590
 5767  FF11C6                	?06:	TXTCHAROUT
3591
 5768  FF11C6  02 06         		cop	$06
3592
 5769                        		.MNLIST
3593
 5770  FF11C8  C8            		iny
3594
 5771  FF11C9  C0 10         		cpy	#16
3595
 5772  FF11CB  90 D9         		bcc	?03
3596
 5773  FF11CD  60            		rts
3597
  Tue Jul 17 11:00:24 2018                                                                                               Page   59
3598
 
3599
 
3600
 
3601
 
3602
 5774
3603
 5775                        	; ts -> show RTC internal bank 1 ram 40..7F
3604
 5776  FF11CE                	Cmd_ts:
3605
 5777  FF11CE  A9 01         		lda	#1
3606
 5778  FF11D0  85 DF         		sta	rtcbnk
3607
 5779  FF11D2  80 02         		bra	_rtcm
3608
 5780
3609
 5781                        	; tu -> show RTC internal bank 0 ram 40..7F
3610
 5782  FF11D4                	Cmd_tu:
3611
 5783  FF11D4  64 DF         		stz	rtcbnk
3612
 5784  FF11D6                	_rtcm:
3613
 5785  FF11D6  A9 40         		lda	#$40
3614
 5786  FF11D8  85 DE         		sta	rtcadr
3615
 5787  FF11DA  20 30 12      	?02:	jsr	rtcmem
3616
 5788  FF11DD  A5 DE         		lda	rtcadr
3617
 5789  FF11DF  18            		clc
3618
 5790  FF11E0  69 10         		adc	#16
3619
 5791  FF11E2  85 DE         		sta	rtcadr
3620
 5792  FF11E4  10 F4         		bpl	?02
3621
 5793  FF11E6  60            		rts
3622
 5794
3623
 5795                        	; u>addr data, data, data,... -> set RTC user ram 40..7F bank 0
3624
 5796  FF11E7                	Cmd_stum:
3625
 5797  FF11E7  64 DF         		stz	rtcbnk
3626
 5798  FF11E9  A2 0A         		ldx	#RTCCTRLA
3627
 5799  FF11EB  8E 4C FD      		stx	RTCALE
3628
 5800  FF11EE  A9 10         		lda	#$10
3629
 5801  FF11F0  1C 4D FD      		trb	RTCDATA		; set bank 0
3630
 5802  FF11F3  B0 28         		bcs	?06
3631
 5803  FF11F5  A5 BA         		lda	SMTmpL
3632
 5804  FF11F7  C9 80         		cmp	#$80
3633
 5805  FF11F9  90 03         		bcc	?02
3634
 5806  FF11FB  4C 34 01      	?01:	jmp	ErrCls2
3635
 5807  FF11FE  C9 40         	?02:	cmp	#$40
3636
 5808  FF1200  90 F9         		bcc	?01
3637
 5809  FF1202  85 DE         		sta	rtcadr
3638
 5810  FF1204  A0 00         		ldy	#0
3639
 5811  FF1206  20 5A 01      	?04:	jsr	GetParm
3640
 5812  FF1209  B0 12         		bcs	?06
3641
 5813  FF120B  98            		tya
3642
 5814  FF120C  65 DE         		adc	rtcadr
3643
 5815  FF120E  30 08         		bmi	?05
3644
 5816  FF1210  8D 4C FD      		sta	RTCALE
3645
 5817  FF1213  A5 BA         		lda	SMTmpL
3646
 5818  FF1215  8D 4D FD      		sta	RTCDATA		; store byte
3647
 5819  FF1218  C8            	?05:	iny
3648
 5820  FF1219  C0 10         		cpy	#16
3649
 5821  FF121B  90 E9         		bcc	?04
3650
 5822  FF121D  A5 DE         	?06:	lda	rtcadr
3651
 5823  FF121F  C9 80         		cmp	#$80
3652
 5824  FF1221  B0 04         		bcs	?07
3653
 5825  FF1223  C9 40         		cmp	#$40
3654
 5826  FF1225  B0 01         		bcs	?08
3655
 5827  FF1227  60            	?07:	rts
3656
 5828  FF1228                	?08:	SCNPRINT
3657
 5829  FF1228  02 01         		cop	$01
3658
 5830                        		.MNLIST
3659
  Tue Jul 17 11:00:24 2018                                                                                               Page   60
3660
 
3661
 
3662
 
3663
 
3664
 5831  FF122A  1B 4F 01 00   		.DB	KB_ESC, 'O', SCN_CSRUP, 0
3665
 5832  FF122E  80 13         		bra	rtcmem2
3666
 5833
3667
 5834                        	; show one row of RTC ram 40..7F
3668
 5835  FF1230                	rtcmem:
3669
 5836  FF1230  A2 0A         		ldx	#RTCCTRLA
3670
 5837  FF1232  8E 4C FD      		stx	RTCALE
3671
 5838  FF1235  A9 10         		lda	#$10
3672
 5839  FF1237  A4 DF         		ldy	rtcbnk
3673
 5840  FF1239  F0 05         		beq	?02
3674
 5841  FF123B  0C 4D FD      		tsb	RTCDATA		; set bank 1
3675
 5842  FF123E  80 03         		bra	rtcmem2
3676
 5843  FF1240  1C 4D FD      	?02:	trb	RTCDATA		; set bank 0
3677
 5844
3678
 5845  FF1243                	rtcmem2:
3679
 5846  FF1243  A4 DF         		ldy	rtcbnk
3680
 5847  FF1245  F0 08         		beq	?00
3681
 5848  FF1247                		TXTPRINT
3682
 5849  FF1247  02 02         		cop	$02
3683
 5850                        		.MNLIST
3684
 5851  FF1249  0D 3A 3E 00   		.DB	13, ':>', 0
3685
 5852  FF124D  80 06         		bra	?00a
3686
 5853  FF124F                	?00:	TXTPRINT
3687
 5854  FF124F  02 02         		cop	$02
3688
 5855                        		.MNLIST
3689
 5856  FF1251  0D 75 3E 00   		.DB	13, 'u>', 0
3690
 5857  FF1255  A5 DE         	?00a:	lda	rtcadr
3691
 5858  FF1257  20 4E 19      		jsr	PrintByte
3692
 5859  FF125A  A0 00         		ldy	#0
3693
 5860  FF125C  F0 03         		beq	?02
3694
 5861  FF125E  20 51 19      	?01:	jsr	PrintBlank
3695
 5862  FF1261  98            	?02:	tya
3696
 5863  FF1262  18            		clc
3697
 5864  FF1263  65 DE         		adc	rtcadr
3698
 5865  FF1265  10 08         		bpl	?02b
3699
 5866  FF1267  20 51 19      		jsr	PrintBlank
3700
 5867  FF126A  20 51 19      		jsr	PrintBlank
3701
 5868  FF126D  80 09         		bra	?02c
3702
 5869  FF126F  8D 4C FD      	?02b:	sta	RTCALE
3703
 5870  FF1272  AD 4D FD      		lda	RTCDATA		; fetch byte
3704
 5871  FF1275  20 71 19      		jsr	PrintHex
3705
 5872  FF1278  C8            	?02c:	iny
3706
 5873  FF1279  C0 10         		cpy	#16
3707
 5874  FF127B  90 E1         		bcc	?01
3708
 5875  FF127D  A5 C6         		lda	SMdumb
3709
 5876  FF127F  D0 08         		bne	?03a
3710
 5877  FF1281                		SCNPRINT
3711
 5878  FF1281  02 01         		cop	$01
3712
 5879                        		.MNLIST
3713
 5880  FF1283  20 14 3A 00   		.DB	' ', SCN_RVSON, ':', 0
3714
 5881  FF1287  80 05         		bra	?03b
3715
 5882  FF1289                	?03a:	TXTPRINT
3716
 5883  FF1289  02 02         		cop	$02
3717
 5884                        		.MNLIST
3718
 5885  FF128B  20 3A 00      		.DB	' :', 0
3719
 5886  FF128E  A0 00         	?03b:	ldy	#0
3720
 5887  FF1290  98            	?03:	tya
3721
  Tue Jul 17 11:00:24 2018                                                                                               Page   61
3722
 
3723
 
3724
 
3725
 
3726
 5888  FF1291  18            		clc
3727
 5889  FF1292  65 DE         		adc	rtcadr
3728
 5890  FF1294  30 0E         		bmi	?04
3729
 5891  FF1296  8D 4C FD      		sta	RTCALE
3730
 5892  FF1299  AD 4D FD      		lda	RTCDATA		; fetch byte
3731
 5893  FF129C  C9 80         		cmp	#$80
3732
 5894  FF129E  B0 04         		bcs	?04
3733
 5895  FF12A0  C9 20         		cmp	#' '
3734
 5896  FF12A2  B0 02         		bcs	?06
3735
 5897  FF12A4  A9 2E         	?04:	lda	#'.'
3736
 5898  FF12A6                	?06:	TXTCHAROUT
3737
 5899  FF12A6  02 06         		cop	$06
3738
 5900                        		.MNLIST
3739
 5901  FF12A8  C8            		iny
3740
 5902  FF12A9  C0 10         		cpy	#16
3741
 5903  FF12AB  90 E3         		bcc	?03
3742
 5904  FF12AD  60            		rts
3743
 5905
3744
 5906                        	; tc -> show RTC internal bank 0&1 ram 0E..3F
3745
 5907  FF12AE                	Cmd_tc:
3746
 5908  FF12AE  A9 02         		lda	#2
3747
 5909  FF12B0  85 DF         		sta	rtcbnk
3748
 5910  FF12B2  A9 0E         		lda	#$0E
3749
 5911  FF12B4  85 DE         		sta	rtcadr
3750
 5912  FF12B6  20 11 13      		jsr	rtccm
3751
 5913  FF12B9  E6 DE         		inc	rtcadr
3752
 5914  FF12BB  E6 DE         		inc	rtcadr
3753
 5915  FF12BD  A9 10         		lda	#16
3754
 5916  FF12BF  85 DF         		sta	rtcbnk
3755
 5917  FF12C1  20 11 13      	?02:	jsr	rtccm
3756
 5918  FF12C4  A5 DE         		lda	rtcadr
3757
 5919  FF12C6  18            		clc
3758
 5920  FF12C7  69 10         		adc	#16
3759
 5921  FF12C9  85 DE         		sta	rtcadr
3760
 5922  FF12CB  C9 40         		cmp	#$40
3761
 5923  FF12CD  90 F2         		bcc	?02
3762
 5924  FF12CF  60            		rts
3763
 5925
3764
 5926                        	; c>addr data, data, data,... -> set RTC user ram 0E..3F bank 0&1
3765
 5927  FF12D0                	Cmd_stcm:
3766
 5928  FF12D0  A9 10         		lda	#16
3767
 5929  FF12D2  85 DF         		sta	rtcbnk
3768
 5930  FF12D4  B0 2A         		bcs	?06
3769
 5931  FF12D6  A5 BA         		lda	SMTmpL
3770
 5932  FF12D8  C9 40         		cmp	#$40
3771
 5933  FF12DA  90 03         		bcc	?02
3772
 5934  FF12DC  4C 34 01      	?01:	jmp	ErrCls2
3773
 5935  FF12DF  C9 0E         	?02:	cmp	#$0E
3774
 5936  FF12E1  90 F9         		bcc	?01
3775
 5937  FF12E3  85 DE         		sta	rtcadr
3776
 5938  FF12E5  A0 00         		ldy	#0
3777
 5939  FF12E7  20 5A 01      	?04:	jsr	GetParm
3778
 5940  FF12EA  B0 14         		bcs	?06
3779
 5941  FF12EC  98            		tya
3780
 5942  FF12ED  65 DE         		adc	rtcadr
3781
 5943  FF12EF  C9 40         		cmp	#$40
3782
 5944  FF12F1  B0 08         		bcs	?05
3783
  Tue Jul 17 11:00:24 2018                                                                                               Page   62
3784
 
3785
 
3786
 
3787
 
3788
 5945  FF12F3  8D 4C FD      		sta	RTCALE
3789
 5946  FF12F6  A5 BA         		lda	SMTmpL
3790
 5947  FF12F8  8D 4D FD      		sta	RTCDATA		; store byte
3791
 5948  FF12FB  C8            	?05:	iny
3792
 5949  FF12FC  C0 10         		cpy	#16
3793
 5950  FF12FE  90 E7         		bcc	?04
3794
 5951  FF1300  A5 DE         	?06:	lda	rtcadr
3795
 5952  FF1302  C9 40         		cmp	#$40
3796
 5953  FF1304  B0 04         		bcs	?07
3797
 5954  FF1306  C9 0E         		cmp	#$0E
3798
 5955  FF1308  B0 01         		bcs	?08
3799
 5956  FF130A  60            	?07:	rts
3800
 5957  FF130B                	?08:	SCNPRINT
3801
 5958  FF130B  02 01         		cop	$01
3802
 5959                        		.MNLIST
3803
 5960  FF130D  1B 4F 01 00   		.DB	KB_ESC, 'O', SCN_CSRUP, 0
3804
 5961
3805
 5962  FF1311                	rtccm:
3806
 5963  FF1311                		TXTPRINT
3807
 5964  FF1311  02 02         		cop	$02
3808
 5965                        		.MNLIST
3809
 5966  FF1313  0D 63 3E 00   		.DB	13, 'c>', 0
3810
 5967  FF1317  A5 DE         		lda	rtcadr
3811
 5968  FF1319  20 4E 19      		jsr	PrintByte
3812
 5969  FF131C  A0 00         		ldy	#0
3813
 5970  FF131E  F0 03         		beq	?02
3814
 5971  FF1320  20 51 19      	?01:	jsr	PrintBlank
3815
 5972  FF1323  98            	?02:	tya
3816
 5973  FF1324  18            		clc
3817
 5974  FF1325  65 DE         		adc	rtcadr
3818
 5975  FF1327  C9 40         		cmp	#$40
3819
 5976  FF1329  90 08         		bcc	?02b
3820
 5977  FF132B  20 51 19      		jsr	PrintBlank
3821
 5978  FF132E  20 51 19      		jsr	PrintBlank
3822
 5979  FF1331  80 09         		bra	?02c
3823
 5980  FF1333  8D 4C FD      	?02b:	sta	RTCALE
3824
 5981  FF1336  AD 4D FD      		lda	RTCDATA		; fetch byte
3825
 5982  FF1339  20 71 19      		jsr	PrintHex
3826
 5983  FF133C  C8            	?02c:	iny
3827
 5984  FF133D  C4 DF         		cpy	rtcbnk
3828
 5985  FF133F  90 DF         		bcc	?01
3829
 5986  FF1341  A5 C6         		lda	SMdumb
3830
 5987  FF1343  D0 08         		bne	?03a
3831
 5988  FF1345                		SCNPRINT
3832
 5989  FF1345  02 01         		cop	$01
3833
 5990                        		.MNLIST
3834
 5991  FF1347  20 14 3A 00   		.DB	' ', SCN_RVSON, ':', 0
3835
 5992  FF134B  80 05         		bra	?03b
3836
 5993  FF134D                	?03a:	TXTPRINT
3837
 5994  FF134D  02 02         		cop	$02
3838
 5995                        		.MNLIST
3839
 5996  FF134F  20 3A 00      		.DB	' :', 0
3840
 5997  FF1352  A0 00         	?03b:	ldy	#0
3841
 5998  FF1354  98            	?03:	tya
3842
 5999  FF1355  18            		clc
3843
 6000  FF1356  65 DE         		adc	rtcadr
3844
 6001  FF1358  C9 40         		cmp	#$40
3845
  Tue Jul 17 11:00:24 2018                                                                                               Page   63
3846
 
3847
 
3848
 
3849
 
3850
 6002  FF135A  B0 0E         		bcs	?04
3851
 6003  FF135C  8D 4C FD      		sta	RTCALE
3852
 6004  FF135F  AD 4D FD      		lda	RTCDATA		; fetch byte
3853
 6005  FF1362  C9 80         		cmp	#$80
3854
 6006  FF1364  B0 04         		bcs	?04
3855
 6007  FF1366  C9 20         		cmp	#' '
3856
 6008  FF1368  B0 02         		bcs	?06
3857
 6009  FF136A  A9 2E         	?04:	lda	#'.'
3858
 6010  FF136C                	?06:	TXTCHAROUT
3859
 6011  FF136C  02 06         		cop	$06
3860
 6012                        		.MNLIST
3861
 6013  FF136E  C8            		iny
3862
 6014  FF136F  C4 DF         		cpy	rtcbnk
3863
 6015  FF1371  90 E1         		bcc	?03
3864
 6016  FF1373  60            		rts
3865
 6017
3866
 6018                        	; get rtc time
3867
 6019  FF1374                	Cmd_gt:
3868
 6020  FF1374                		RTCGETT
3869
 6021  FF1374  02 19         		cop	$19
3870
 6022  FF1376  02            		.DB	$02
3871
 6023                        		.MNLIST
3872
 6024  FF1377  EB            		xba
3873
 6025  FF1378  48            		pha			; day of week (1=sunday...)
3874
 6026  FF1379  EB            		xba
3875
 6027  FF137A  DA            		phx			; seconds
3876
 6028  FF137B  5A            		phy			; minutes
3877
 6029  FF137C  48            		pha			; hours
3878
 6030  FF137D  4B            		phk
3879
 6031  FF137E  F4 87 13      		pea	#!?10
3880
 6032  FF1381  A9 08         		lda	#8
3881
 6033  FF1383  48            		pha
3882
 6034  FF1384                		BPRINTF
3883
 6035  FF1384  02 11         		cop	$11
3884
 6036                        		.MNLIST
3885
 6037  FF1386  60            		rts
3886
 6038  FF1387
3887
 6039  FF1387  0D 3A 20 63 75 	?10:	.DB	13,': current time: %02bu:%02bu:%02bu (day: %bu)', 0
3888
               72 72 65 6E 74
3889
               20 74 69 6D 65
3890
               3A 20 25 30 32
3891
               62 75 3A 25 30
3892
               32 62 75 3A 25
3893
               30 32 62 75 20
3894
               28 64 61 79 3A
3895
               20 25 62 75 29
3896
               00
3897
 6040
3898
 6041                        	; get rtc date
3899
 6042  FF13B5                	Cmd_gd:
3900
 6043  FF13B5                		RTCGETD
3901
 6044  FF13B5  02 19         		cop	$19
3902
 6045  FF13B7  03            		.DB	$03
3903
 6046                        		.MNLIST
3904
 6047  FF13B8  DA            		phx			; day
3905
 6048  FF13B9  5A            		phy			; month
3906
 6049  FF13BA  48            		pha			; year
3907
  Tue Jul 17 11:00:24 2018                                                                                               Page   64
3908
 
3909
 
3910
 
3911
 
3912
 6050  FF13BB  EB            		xba
3913
 6051  FF13BC  48            		pha			; century
3914
 6052  FF13BD  4B            		phk
3915
 6053  FF13BE  F4 C7 13      		pea	#!?10
3916
 6054  FF13C1  A9 08         		lda	#8
3917
 6055  FF13C3  48            		pha
3918
 6056  FF13C4                		BPRINTF
3919
 6057  FF13C4  02 11         		cop	$11
3920
 6058                        		.MNLIST
3921
 6059  FF13C6  60            		rts
3922
 6060  FF13C7
3923
 6061  FF13C7  0D 3A 20 63 75 	?10:	.DB	13,': current date: %02bu%02bu/%02bu/%02bu', 0
3924
               72 72 65 6E 74
3925
               20 64 61 74 65
3926
               3A 20 25 30 32
3927
               62 75 25 30 32
3928
               62 75 2F 25 30
3929
               32 62 75 2F 25
3930
               30 32 62 75 00
3931
 6062
3932
 6063                        	; set rtc time
3933
 6064                        	; st HHMMSS
3934
 6065  FF13EF                	Cmd_st:
3935
 6066  FF13EF  A6 E0         		ldx	cmdlin
3936
 6067  FF13F1  20 75 14      		jsr	asc2bin
3937
 6068  FF13F4  B0 0E         		bcs	?05
3938
 6069  FF13F6  85 E5         		sta	brtchour
3939
 6070  FF13F8  20 75 14      		jsr	asc2bin
3940
 6071  FF13FB  B0 07         		bcs	?05
3941
 6072  FF13FD  85 E4         		sta	brtcmin
3942
 6073  FF13FF  20 75 14      		jsr	asc2bin
3943
 6074  FF1402  90 03         		bcc	?10
3944
 6075  FF1404  4C 34 01      	?05:	jmp	ErrCls2
3945
 6076  FF1407  85 E3         	?10:	sta	brtcsec
3946
 6077  FF1409  BF 00 99 01   		lda	>INPUTBUF,x
3947
 6078  FF140D  F0 04         		beq	?15
3948
 6079  FF140F  C9 20         		cmp	#' '
3949
 6080  FF1411  D0 F1         		bne	?05
3950
 6081  FF1413  A6 E3         	?15:	ldx	brtcsec
3951
 6082  FF1415  A4 E4         		ldy	brtcmin
3952
 6083  FF1417  A5 E5         		lda	brtchour
3953
 6084  FF1419                		RTCSETT
3954
 6085  FF1419  02 19         		cop	$19
3955
 6086  FF141B  00            		.DB	$00
3956
 6087                        		.MNLIST
3957
 6088  FF141C  90 0E         		bcc	?20
3958
 6089  FF141E                		SCNPRINT
3959
 6090  FF141E  02 01         		cop	$01
3960
 6091                        		.MNLIST
3961
 6092  FF1420  0D 3A 3A 62 61 		.DB	13, '::bad time', 0
3962
               64 20 74 69 6D
3963
               65 00
3964
 6093  FF142C  60            	?20:	rts
3965
 6094
3966
 6095                        	; set rtc date
3967
 6096                        	; st CCYYMMDD
3968
 6097  FF142D                	Cmd_sd:
3969
  Tue Jul 17 11:00:24 2018                                                                                               Page   65
3970
 
3971
 
3972
 
3973
 
3974
 6098  FF142D  A6 E0         		ldx	cmdlin
3975
 6099  FF142F  20 75 14      		jsr	asc2bin
3976
 6100  FF1432  B0 15         		bcs	?05
3977
 6101  FF1434  85 E9         		sta	brtcct
3978
 6102  FF1436  20 75 14      		jsr	asc2bin
3979
 6103  FF1439  B0 0E         		bcs	?05
3980
 6104  FF143B  85 E8         		sta	brtcyear
3981
 6105  FF143D  20 75 14      		jsr	asc2bin
3982
 6106  FF1440  B0 07         		bcs	?05
3983
 6107  FF1442  85 E7         		sta	brtcmonth
3984
 6108  FF1444  20 75 14      		jsr	asc2bin
3985
 6109  FF1447  90 03         		bcc	?10
3986
 6110  FF1449  4C 34 01      	?05:	jmp	ErrCls2
3987
 6111  FF144C  85 E6         	?10:	sta	brtcday
3988
 6112  FF144E  BF 00 99 01   		lda	>INPUTBUF,x
3989
 6113  FF1452  F0 04         		beq	?15
3990
 6114  FF1454  C9 20         		cmp	#' '
3991
 6115  FF1456  D0 F1         		bne	?05
3992
 6116  FF1458  A6 E6         	?15:	ldx	brtcday
3993
 6117  FF145A  A4 E7         		ldy	brtcmonth
3994
 6118  FF145C  A5 E9         		lda	brtcct
3995
 6119  FF145E  EB            		xba
3996
 6120  FF145F  A5 E8         		lda	brtcyear
3997
 6121  FF1461                		RTCSETD
3998
 6122  FF1461  02 19         		cop	$19
3999
 6123  FF1463  01            		.DB	$01
4000
 6124                        		.MNLIST
4001
 6125  FF1464  90 0E         		bcc	?20
4002
 6126  FF1466                		SCNPRINT
4003
 6127  FF1466  02 01         		cop	$01
4004
 6128                        		.MNLIST
4005
 6129  FF1468  0D 3A 3A 62 61 		.DB	13, '::bad date', 0
4006
               64 20 64 61 74
4007
               65 00
4008
 6130  FF1474  60            	?20:	rts
4009
 6131
4010
 6132  FF1475                	asc2bin:
4011
 6133  FF1475  BF 00 99 01   	?00:	lda	>INPUTBUF,x
4012
 6134  FF1479  08            		php
4013
 6135  FF147A  E8            		inx
4014
 6136  FF147B  28            		plp
4015
 6137  FF147C  F0 37         		beq	?08
4016
 6138  FF147E  C9 20         		cmp	#' '
4017
 6139  FF1480  F0 F3         		beq	?00
4018
 6140  FF1482  A0 02         		ldy	#2		; convert 2 digits
4019
 6141  FF1484  64 E2         		stz	btmpx		; partial value
4020
 6142  FF1486  C9 30         	?02:	cmp	#'0'		; first char must be a digit
4021
 6143  FF1488  90 2B         		bcc	?08
4022
 6144  FF148A  C9 3A         		cmp	#'9'+1
4023
 6145  FF148C  B0 28         		bcs	?10
4024
 6146  FF148E  E9 2F         		sbc	#'0'-1		; convert digit (here always CF = 0)
4025
 6147  FF1490  EB            		xba			; B = digit
4026
 6148  FF1491  18            		clc
4027
 6149  FF1492  A5 E2         		lda	btmpx		; partial null?
4028
 6150  FF1494  F0 0B         		beq	?04		; yes, skip mult * 10
4029
 6151  FF1496  C9 1A         		cmp	#26		; this value make overflow
4030
 6152  FF1498  B0 1B         		bcs	?08
4031
  Tue Jul 17 11:00:24 2018                                                                                               Page   66
4032
 
4033
 
4034
 
4035
 
4036
 6153  FF149A  0A            		asl	a		; safety multiply * 10
4037
 6154  FF149B  0A            		asl	a
4038
 6155  FF149C  65 E2         		adc	btmpx
4039
 6156  FF149E  0A            		asl	a		; always carry = 0 here
4040
 6157  FF149F  85 E2         		sta	btmpx
4041
 6158  FF14A1  EB            	?04:	xba
4042
 6159  FF14A2  65 E2         		adc	btmpx
4043
 6160  FF14A4  B0 0F         		bcs	?08		; overflow
4044
 6161  FF14A6  85 E2         		sta	btmpx
4045
 6162  FF14A8  BF 00 99 01   		lda	>INPUTBUF,x
4046
 6163  FF14AC  E8            		inx
4047
 6164  FF14AD  88            		dey
4048
 6165  FF14AE  D0 D6         		bne	?02
4049
 6166  FF14B0  CA            		dex
4050
 6167  FF14B1  A5 E2         	?06:	lda	btmpx
4051
 6168  FF14B3  18            		clc
4052
 6169  FF14B4  60            		rts
4053
 6170  FF14B5  38            	?08:	sec
4054
 6171  FF14B6  60            	?10:	rts
4055
 6172
4056
 6173  FF14B7                	Cmd_fdisk:
4057
 6174  FF14B7                		SCN_CR
4058
 6175  FF14B7                		SCNPRCHAR
4059
 6176                        		.MLIST
4060
 6177  FF14B7  02 07         		cop	$07
4061
 6178                        		.MNLIST
4062
 6179  FF14B9  0D            		.DB	$0D
4063
 6180                        		.MNLIST
4064
 6181  FF14BA  A6 E0         		ldx	cmdlin
4065
 6182  FF14BC                		ACC16CLC
4066
 6183  FF14BC  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4067
 6184                        		.LONGA	on
4068
 6185                        		.MNLIST
4069
 6186  FF14BE  8A            		txa
4070
 6187  FF14BF  69 00 99      		adc	#INPUTBUF
4071
 6188  FF14C2  A2 01         		ldx	#^INPUTBUF
4072
 6189  FF14C4  DA            		phx
4073
 6190  FF14C5  48            		pha
4074
 6191  FF14C6                		ACC08
4075
 6192  FF14C6  E2 20         		sep	#PMFLAG
4076
 6193                        		.LONGA	off
4077
 6194                        		.MNLIST
4078
 6195  FF14C8  02 60         		cop	$60
4079
 6196  FF14CA  00            		.DB	$00
4080
 6197  FF14CB  60            		rts
4081
 6198  FF14CC
4082
 6199                        		.EXTERN _strcpy, _strcat, _getopt, _strlen, _strdel, _strins
4083
 6200                        		.EXTERN _strcmp, _strncmp, _strcasecmp, _strncasecmp
4084
 6201                        		.EXTERN _strchr, _strrchr, _strlchr, _strstr
4085
 6202
4086
 6203  FF14CC                	Cmd_strcpy:
4087
 6204  FF14CC                		SCN_CR
4088
 6205  FF14CC                		SCNPRCHAR
4089
 6206                        		.MLIST
4090
 6207  FF14CC  02 07         		cop	$07
4091
 6208                        		.MNLIST
4092
 6209  FF14CE  0D            		.DB	$0D
4093
  Tue Jul 17 11:00:24 2018                                                                                               Page   67
4094
 
4095
 
4096
 
4097
 
4098
 6210                        		.MNLIST
4099
 6211  FF14CF                		ACC16CLC
4100
 6212  FF14CF  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4101
 6213                        		.LONGA	on
4102
 6214                        		.MNLIST
4103
 6215  FF14D1  A2 20         		ldx	#$20
4104
 6216  FF14D3  DA            		phx
4105
 6217  FF14D4  F4 00 00      		pea	#0		; dst
4106
 6218  FF14D7  A6 E0         		ldx	cmdlin
4107
 6219  FF14D9  8A            		txa
4108
 6220  FF14DA  69 00 99      		adc	#INPUTBUF
4109
 6221  FF14DD  A2 01         		ldx	#^INPUTBUF
4110
 6222  FF14DF  DA            		phx
4111
 6223  FF14E0  48            		pha			; src
4112
 6224  FF14E1  22 1D 04 FA   		jsl	_strcpy
4113
 6225  FF14E5  48            		pha			; size
4114
 6226  FF14E6  A2 20         		ldx	#$20
4115
 6227  FF14E8  DA            		phx
4116
 6228  FF14E9  F4 00 00      		pea	#0
4117
 6229  FF14EC  4B            		phk			; dst
4118
 6230  FF14ED  F4 F8 14      		pea	#!?00
4119
 6231  FF14F0                		ACC08
4120
 6232  FF14F0  E2 20         		sep	#PMFLAG
4121
 6233                        		.LONGA	off
4122
 6234                        		.MNLIST
4123
 6235  FF14F2  A9 09         		lda	#9
4124
 6236  FF14F4  48            		pha
4125
 6237  FF14F5                		BPRINTF
4126
 6238  FF14F5  02 11         		cop	$11
4127
 6239                        		.MNLIST
4128
 6240  FF14F7  60            		rts
4129
 6241
4130
 6242  FF14F8  3C 25 73 3E 20 	?00:	.DB	'<%s> %hu', 13, 0
4131
               25 68 75 0D 00
4132
 6243
4133
 6244  FF1502                	Cmd_test:
4134
 6245          0000BA        	s1	.SET	SMTmpL
4135
 6246          0000E4        	s2	.SET	SMXTmp+2
4136
 6247          0000E2        	k	.SET	SMXTmp
4137
 6248          0000E7        	l	.SET	SMXTmp+5
4138
 6249          0000E9        	chr	.SET	SMXTmp+7
4139
 6250
4140
 6251  FF1502                		SCN_CR
4141
 6252  FF1502                		SCNPRCHAR
4142
 6253                        		.MLIST
4143
 6254  FF1502  02 07         		cop	$07
4144
 6255                        		.MNLIST
4145
 6256  FF1504  0D            		.DB	$0D
4146
 6257                        		.MNLIST
4147
 6258  FF1505  64 E9         		stz	<chr
4148
 6259  FF1507                		ACC16CLC
4149
 6260  FF1507  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4150
 6261                        		.LONGA	on
4151
 6262                        		.MNLIST
4152
 6263  FF1509  64 E7         		stz	<l
4153
 6264  FF150B  64 E2         		stz	<k
4154
 6265  FF150D  A2 20         		ldx	#$20
4155
  Tue Jul 17 11:00:24 2018                                                                                               Page   68
4156
 
4157
 
4158
 
4159
 
4160
 6266  FF150F  86 BC         		stx	<s1+2
4161
 6267  FF1511  86 E6         		stx	<s2+2
4162
 6268  FF1513  64 BA         		stz	<s1
4163
 6269  FF1515  A9 00 00      		lda	#0
4164
 6270  FF1518  8F 00 00 20   		sta	>$200000
4165
 6271  FF151C  8F 00 80 20   		sta	>$208000
4166
 6272  FF1520  A9 00 80      		lda	#$8000
4167
 6273  FF1523  85 E4         		sta	<s2
4168
 6274  FF1525  A6 E0         		ldx	cmdlin
4169
 6275  FF1527  8A            		txa
4170
 6276  FF1528  69 00 99      		adc	#INPUTBUF
4171
 6277  FF152B  A2 01         		ldx	#^INPUTBUF
4172
 6278  FF152D  A0 C0         		ldy	#$C0
4173
 6279  FF152F  5A            		phy			; flag
4174
 6280  FF1530  DA            		phx
4175
 6281  FF1531  48            		pha			; command line
4176
 6282  FF1532  4B            		phk			; option string
4177
 6283  FF1533  F4 77 16      		pea	#!?1000
4178
 6284  FF1536  F4 00 00      		pea	#0		; result
4179
 6285  FF1539  F4 00 00      		pea	#0
4180
 6286  FF153C                		CPU08
4181
 6287  FF153C  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
4182
 6288                        		.LONGA	off
4183
 6289                        		.LONGI	off
4184
 6290                        		.MNLIST
4185
 6291  FF153E  22 09 00 FA   	?10:	jsl	_getopt		; get opttion's loop
4186
 6292  FF1542  B0 74         		bcs	?20		; error
4187
 6293  FF1544  AA            		tax			; option char
4188
 6294  FF1545  F0 71         		beq	?20		; end of command line
4189
 6295  FF1547  30 6E         		bmi	?16		; no option argument
4190
 6296  FF1549  C9 73         		cmp	#'s'		; -s "string1"
4191
 6297  FF154B  D0 16         		bne	?11
4192
 6298  FF154D  A5 BC         		lda	<s1+2
4193
 6299  FF154F  48            		pha
4194
 6300  FF1550  D4 BA         		pei	(s1)
4195
 6301  FF1552  A3 04         		lda	$04,s
4196
 6302  FF1554  AA            		tax
4197
 6303  FF1555  A3 05         		lda	$05,s
4198
 6304  FF1557  A8            		tay
4199
 6305  FF1558  A3 06         		lda	$06,s
4200
 6306  FF155A  48            		pha
4201
 6307  FF155B  5A            		phy
4202
 6308  FF155C  DA            		phx
4203
 6309  FF155D  22 1D 04 FA   		jsl	_strcpy
4204
 6310  FF1561  80 DB         		bra	?10
4205
 6311  FF1563  C9 53         	?11:	cmp	#'S'		; -S "string2"
4206
 6312  FF1565  D0 16         		bne	?12
4207
 6313  FF1567  A5 E6         		lda	<s2+2
4208
 6314  FF1569  48            		pha
4209
 6315  FF156A  D4 E4         		pei	(s2)
4210
 6316  FF156C  A3 04         		lda	$04,s
4211
 6317  FF156E  AA            		tax
4212
 6318  FF156F  A3 05         		lda	$05,s
4213
 6319  FF1571  A8            		tay
4214
 6320  FF1572  A3 06         		lda	$06,s
4215
 6321  FF1574  48            		pha
4216
 6322  FF1575  5A            		phy
4217
  Tue Jul 17 11:00:24 2018                                                                                               Page   69
4218
 
4219
 
4220
 
4221
 
4222
 6323  FF1576  DA            		phx
4223
 6324  FF1577  22 1D 04 FA   		jsl	_strcpy
4224
 6325  FF157B  80 C1         		bra	?10
4225
 6326  FF157D  C9 7A         	?12:	cmp	#'z'		; -z: null str1
4226
 6327  FF157F  D0 06         		bne	?13
4227
 6328  FF1581  A9 00         		lda	#0
4228
 6329  FF1583  87 BA         		sta	[s1]
4229
 6330  FF1585  80 B7         		bra	?10
4230
 6331  FF1587  C9 5A         	?13:	cmp	#'Z'		; -Z: null str2
4231
 6332  FF1589  D0 06         		bne	?14
4232
 6333  FF158B  A9 00         		lda	#0
4233
 6334  FF158D  87 E4         		sta	[s2]
4234
 6335  FF158F  80 AD         		bra	?10
4235
 6336  FF1591  C9 6B         	?14:	cmp	#'k'		; -k start
4236
 6337  FF1593  D0 0A         		bne	?15
4237
 6338  FF1595  A3 01         		lda	$01,s
4238
 6339  FF1597  85 E2         		sta	<k
4239
 6340  FF1599  A3 02         		lda	$02,s
4240
 6341  FF159B  85 E3         		sta	<k+1
4241
 6342  FF159D  80 9F         		bra	?10
4242
 6343  FF159F  C9 6C         	?15:	cmp	#'l'		; -l maxlen
4243
 6344  FF15A1  D0 0A         		bne	?15a
4244
 6345  FF15A3  A3 01         		lda	$01,s
4245
 6346  FF15A5  85 E7         		sta	<l
4246
 6347  FF15A7  A3 02         		lda	$02,s
4247
 6348  FF15A9  85 E8         		sta	<l+1
4248
 6349  FF15AB  80 91         		bra	?10
4249
 6350  FF15AD  C9 63         	?15a:	cmp	#'c'		; -c char
4250
 6351  FF15AF  D0 06         		bne	?16
4251
 6352  FF15B1  A3 01         		lda	$01,s
4252
 6353  FF15B3  85 E9         		sta	<chr
4253
 6354  FF15B5  80 87         		bra	?10
4254
 6355  FF15B7  38            	?16:	sec
4255
 6356  FF15B8  08            	?20:	php			; clean stack
4256
 6357  FF15B9  FA            		plx			; save carry
4257
 6358  FF15BA                		ACC16CLC
4258
 6359  FF15BA  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4259
 6360                        		.LONGA	on
4260
 6361                        		.MNLIST
4261
 6362  FF15BC  3B            		tsc
4262
 6363  FF15BD  69 0B 00      		adc	#11
4263
 6364  FF15C0  1B            		tcs
4264
 6365  FF15C1                		ACC08
4265
 6366  FF15C1  E2 20         		sep	#PMFLAG
4266
 6367                        		.LONGA	off
4267
 6368                        		.MNLIST
4268
 6369  FF15C3  8A            		txa
4269
 6370  FF15C4  4A            		lsr	a		; test carry
4270
 6371                        		;bcs	?30		; exit
4271
 6372  FF15C5  90 01         		bcc	?19
4272
 6373  FF15C7  60            		rts
4273
 6374  FF15C8                	?19:
4274
 6375  FF15C8  A5 BC         		lda	<s1+2
4275
 6376  FF15CA  48            		pha
4276
 6377  FF15CB  D4 BA         		pei	(s1)
4277
 6378  FF15CD  22 03 00 FA   		jsl	strlen
4278
 6379  FF15D1  A6 E9         		ldx	<chr
4279
  Tue Jul 17 11:00:24 2018                                                                                               Page   70
4280
 
4281
 
4282
 
4283
 
4284
 6380  FF15D3  DA            		phx			; chr
4285
 6381  FF15D4  D4 E7         		pei	(l)
4286
 6382  FF15D6  D4 E2         		pei	(k)
4287
 6383  FF15D8                		ACC16
4288
 6384  FF15D8  C2 20         		rep	#PMFLAG
4289
 6385                        		.LONGA	on
4290
 6386                        		.MNLIST
4291
 6387  FF15DA  48            		pha
4292
 6388  FF15DB                		ACC08
4293
 6389  FF15DB  E2 20         		sep	#PMFLAG
4294
 6390                        		.LONGA	off
4295
 6391                        		.MNLIST
4296
 6392  FF15DD  A5 BC         		lda	<s1+2
4297
 6393  FF15DF  48            		pha
4298
 6394  FF15E0  D4 BA         		pei	(s1)
4299
 6395  FF15E2  4B            		phk			; fmt
4300
 6396  FF15E3  F4 38 16      		pea	#!?01
4301
 6397  FF15E6  A9 0E         		lda	#14
4302
 6398  FF15E8  48            		pha
4303
 6399  FF15E9                		BPRINTF
4304
 6400  FF15E9  02 11         		cop	$11
4305
 6401                        		.MNLIST
4306
 6402
4307
 6403  FF15EB  A5 E6         		lda	<s2+2
4308
 6404  FF15ED  48            		pha
4309
 6405  FF15EE  D4 E4         		pei	(s2)
4310
 6406  FF15F0  22 03 00 FA   		jsl	strlen
4311
 6407  FF15F4                		ACC16
4312
 6408  FF15F4  C2 20         		rep	#PMFLAG
4313
 6409                        		.LONGA	on
4314
 6410                        		.MNLIST
4315
 6411  FF15F6  48            		pha
4316
 6412  FF15F7                		ACC08
4317
 6413  FF15F7  E2 20         		sep	#PMFLAG
4318
 6414                        		.LONGA	off
4319
 6415                        		.MNLIST
4320
 6416  FF15F9  A5 E6         		lda	<s2+2
4321
 6417  FF15FB  48            		pha
4322
 6418  FF15FC  D4 E4         		pei	(s2)
4323
 6419  FF15FE  4B            		phk			; fmt
4324
 6420  FF15FF  F4 2C 16      		pea	#!?00
4325
 6421  FF1602  A9 09         		lda	#9
4326
 6422  FF1604  48            		pha
4327
 6423  FF1605                		BPRINTF
4328
 6424  FF1605  02 11         		cop	$11
4329
 6425                        		.MNLIST
4330
 6426
4331
 6427
4332
 6428  FF1607  A5 BC         		lda	<s1+2		; strstr
4333
 6429  FF1609  48            		pha
4334
 6430  FF160A  D4 BA         		pei	(s1)
4335
 6431  FF160C  A5 E6         		lda	<s2+2
4336
 6432  FF160E  48            		pha
4337
 6433  FF160F  D4 E4         		pei	(s2)
4338
 6434  FF1611  22 81 07 FA   		jsl	_strstr
4339
 6435  FF1615  F4 00 00      		pea	#0
4340
 6436  FF1618  EB            		xba
4341
  Tue Jul 17 11:00:24 2018                                                                                               Page   71
4342
 
4343
 
4344
 
4345
 
4346
 6437  FF1619  48            		pha
4347
 6438  FF161A  EB            		xba
4348
 6439  FF161B  48            		pha
4349
 6440  FF161C  A2 00         		ldx	#0
4350
 6441  FF161E  B0 01         		bcs	?25a
4351
 6442  FF1620  E8            		inx
4352
 6443  FF1621  DA            	?25a:	phx
4353
 6444  FF1622  4B            		phk			; fmt
4354
 6445  FF1623  F4 65 16      		pea	#!?03
4355
 6446  FF1626  A9 09         		lda	#9
4356
 6447  FF1628  48            		pha
4357
 6448  FF1629                		BPRINTF
4358
 6449  FF1629  02 11         		cop	$11
4359
 6450                        		.MNLIST
4360
 6451  FF162B
4361
 6452  FF162B  60            	?30:	rts
4362
 6453
4363
 6454  FF162C  3C 25 73 3E 20 	?00:	.DB	'<%s> %hu  ', 13, 0
4364
               25 68 75 20 20
4365
               0D 00
4366
 6455  FF1638  3C 25 73 3E 20 	?01:	.DB	'<%s> %hu - %hu - %hu - %bu    <<<<', 13, 0
4367
               25 68 75 20 2D
4368
               20 25 68 75 20
4369
               2D 20 25 68 75
4370
               20 2D 20 25 62
4371
               75 20 20 20 20
4372
               3C 3C 3C 3C 0D
4373
               00
4374
 6456  FF165C  25 62 75 20 20 	?02:	.DB	'%bu    ', 13, 0
4375
               20 20 0D 00
4376
 6457  FF1665  25 62 75 20 20 	?03:	.DB	'%bu    %hu   %hu', 13, 0
4377
               20 20 25 68 75
4378
               20 20 20 25 68
4379
               75 0D 00
4380
 6458
4381
 6459  FF1677  6B 23 6C 23 73 	?1000:	.DB	'k#l#s:S:z Z c!', 0
4382
               3A 53 3A 7A 20
4383
               5A 20 63 21 00
4384
 6460
4385
 6461  FF1686                	xxx:
4386
 6462  FF1686  A6 E0         	?01:	ldx	cmdlin
4387
 6463  FF1688                		ACC16CLC
4388
 6464  FF1688  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4389
 6465                        		.LONGA	on
4390
 6466                        		.MNLIST
4391
 6467  FF168A  8A            		txa
4392
 6468  FF168B  69 00 99      		adc	#INPUTBUF
4393
 6469  FF168E  A2 E1         		ldx	#$E1
4394
 6470  FF1690  DA            		phx
4395
 6471  FF1691  A2 01         		ldx	#^INPUTBUF
4396
 6472  FF1693  DA            		phx
4397
 6473  FF1694  48            		pha
4398
 6474  FF1695  4B            		phk
4399
 6475  FF1696  F4 2E 18      		pea	#!?100
4400
 6476  FF1699  48            		pha
4401
 6477  FF169A  48            		pha
4402
 6478  FF169B                		ACC08
4403
  Tue Jul 17 11:00:24 2018                                                                                               Page   72
4404
 
4405
 
4406
 
4407
 
4408
 6479  FF169B  E2 20         		sep	#PMFLAG
4409
 6480                        		.LONGA	off
4410
 6481                        		.MNLIST
4411
 6482  FF169D  22 09 00 FA   	?10:	jsl	_getopt
4412
 6483  FF16A1  90 03         		bcc	?11
4413
 6484  FF16A3  4C 48 17      		jmp	?20
4414
 6485  FF16A6  AA            	?11:	tax
4415
 6486  FF16A7  D0 03         		bne	?11a
4416
 6487  FF16A9  4C 48 17      		jmp	?20
4417
 6488  FF16AC  10 03         	?11a:	bpl	?11b
4418
 6489  FF16AE  4C 31 17      		jmp	?18
4419
 6490  FF16B1  C0 20         	?11b:	cpy	#' '
4420
 6491  FF16B3  F0 6F         		beq	?16
4421
 6492  FF16B5  C0 21         		cpy	#'!'
4422
 6493  FF16B7  F0 04         		beq	?12
4423
 6494  FF16B9  C0 5E         		cpy	#'^'
4424
 6495  FF16BB  D0 10         		bne	?14
4425
 6496  FF16BD  A8            	?12:	tay
4426
 6497  FF16BE  A3 01         		lda	$01,s
4427
 6498  FF16C0  48            		pha
4428
 6499  FF16C1  5A            		phy
4429
 6500  FF16C2  4B            		phk
4430
 6501  FF16C3  F4 90 17      		pea	#?60
4431
 6502  FF16C6  A9 06         		lda	#6
4432
 6503  FF16C8  48            		pha
4433
 6504  FF16C9                		BPRINTF
4434
 6505  FF16C9  02 11         		cop	$11
4435
 6506                        		.MNLIST
4436
 6507  FF16CB  80 D0         		bra	?10
4437
 6508  FF16CD
4438
 6509  FF16CD  C0 3A         	?14:	cpy	#':'
4439
 6510  FF16CF  F0 25         		beq	?15
4440
 6511  FF16D1  C0 24         		cpy	#'$'
4441
 6512  FF16D3  F0 21         		beq	?15
4442
 6513  FF16D5  C0 26         		cpy	#'&'
4443
 6514  FF16D7  F0 03         		beq	?14a
4444
 6515  FF16D9  4C 47 18      		jmp	?200
4445
 6516  FF16DC
4446
 6517  FF16DC  A8            	?14a:	tay
4447
 6518  FF16DD                		CPU16
4448
 6519  FF16DD  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
4449
 6520                        		.LONGA	on
4450
 6521                        		.LONGI	on
4451
 6522                        		.MNLIST
4452
 6523  FF16DF  A3 03         		lda	$03,s
4453
 6524  FF16E1  AA            		tax
4454
 6525  FF16E2  A3 01         		lda	$01,s
4455
 6526  FF16E4  DA            		phx
4456
 6527  FF16E5  48            		pha
4457
 6528  FF16E6  DA            		phx
4458
 6529  FF16E7  48            		pha
4459
 6530  FF16E8                		CPU08
4460
 6531  FF16E8  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
4461
 6532                        		.LONGA	off
4462
 6533                        		.LONGI	off
4463
 6534                        		.MNLIST
4464
 6535  FF16EA  5A            		phy
4465
  Tue Jul 17 11:00:24 2018                                                                                               Page   73
4466
 
4467
 
4468
 
4469
 
4470
 6536  FF16EB  4B            		phk
4471
 6537  FF16EC  F4 AC 17      		pea	#?70
4472
 6538  FF16EF  A9 0D         		lda	#13
4473
 6539  FF16F1  48            		pha
4474
 6540  FF16F2                		BPRINTF
4475
 6541  FF16F2  02 11         		cop	$11
4476
 6542                        		.MNLIST
4477
 6543  FF16F4  80 A7         		bra	?10
4478
 6544  FF16F6
4479
 6545  FF16F6  A8            	?15:	tay
4480
 6546  FF16F7  A3 03         		lda	$03,s
4481
 6547  FF16F9  AA            		tax
4482
 6548  FF16FA                		ACC16
4483
 6549  FF16FA  C2 20         		rep	#PMFLAG
4484
 6550                        		.LONGA	on
4485
 6551                        		.MNLIST
4486
 6552  FF16FC  A3 01         		lda	$01,s
4487
 6553  FF16FE  DA            		phx
4488
 6554  FF16FF  48            		pha
4489
 6555  FF1700                		ACC08
4490
 6556  FF1700  E2 20         		sep	#PMFLAG
4491
 6557                        		.LONGA	off
4492
 6558                        		.MNLIST
4493
 6559  FF1702  5A            		phy
4494
 6560  FF1703  4B            		phk
4495
 6561  FF1704  F4 52 17      		pea	#?30
4496
 6562  FF1707  A9 08         		lda	#8
4497
 6563  FF1709  48            		pha
4498
 6564  FF170A                		BPRINTF
4499
 6565  FF170A  02 11         		cop	$11
4500
 6566                        		.MNLIST
4501
 6567                        		;bra	?10
4502
 6568  FF170C  A3 03         		lda	$03,s
4503
 6569  FF170E  AA            		tax
4504
 6570  FF170F                		ACC16
4505
 6571  FF170F  C2 20         		rep	#PMFLAG
4506
 6572                        		.LONGA	on
4507
 6573                        		.MNLIST
4508
 6574  FF1711  A3 01         		lda	$01,s
4509
 6575  FF1713  DA            		phx
4510
 6576  FF1714  48            		pha
4511
 6577  FF1715                		ACC08
4512
 6578  FF1715  E2 20         		sep	#PMFLAG
4513
 6579                        		.LONGA	off
4514
 6580                        		.MNLIST
4515
 6581  FF1717  22 03 00 FA   		jsl	strlen
4516
 6582  FF171B  20 4E 19      		jsr	PrintByte
4517
 6583  FF171E                		SCN_CR
4518
 6584  FF171E                		SCNPRCHAR
4519
 6585                        		.MLIST
4520
 6586  FF171E  02 07         		cop	$07
4521
 6587                        		.MNLIST
4522
 6588  FF1720  0D            		.DB	$0D
4523
 6589                        		.MNLIST
4524
 6590  FF1721  4C 9D 16      		jmp	?10
4525
 6591  FF1724
4526
 6592  FF1724  48            	?16:	pha
4527
  Tue Jul 17 11:00:24 2018                                                                                               Page   74
4528
 
4529
 
4530
 
4531
 
4532
 6593  FF1725  4B            		phk
4533
 6594  FF1726  F4 6D 17      		pea	#?40
4534
 6595  FF1729  A9 05         		lda	#5
4535
 6596  FF172B  48            		pha
4536
 6597  FF172C                		BPRINTF
4537
 6598  FF172C  02 11         		cop	$11
4538
 6599                        		.MNLIST
4539
 6600  FF172E  4C 9D 16      		jmp	?10
4540
 6601  FF1731  A3 03         	?18:	lda	$03,s
4541
 6602  FF1733  AA            		tax
4542
 6603  FF1734                		ACC16
4543
 6604  FF1734  C2 20         		rep	#PMFLAG
4544
 6605                        		.LONGA	on
4545
 6606                        		.MNLIST
4546
 6607  FF1736  A3 01         		lda	$01,s
4547
 6608  FF1738  DA            		phx
4548
 6609  FF1739  48            		pha
4549
 6610  FF173A                		ACC08
4550
 6611  FF173A  E2 20         		sep	#PMFLAG
4551
 6612                        		.LONGA	off
4552
 6613                        		.MNLIST
4553
 6614  FF173C  4B            		phk
4554
 6615  FF173D  F4 85 17      		pea	#?50
4555
 6616  FF1740  A9 07         		lda	#7
4556
 6617  FF1742  48            		pha
4557
 6618  FF1743                		BPRINTF
4558
 6619  FF1743  02 11         		cop	$11
4559
 6620                        		.MNLIST
4560
 6621  FF1745  4C 9D 16      		jmp	?10
4561
 6622  FF1748                	?20:	ACC16CLC
4562
 6623  FF1748  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4563
 6624                        		.LONGA	on
4564
 6625                        		.MNLIST
4565
 6626  FF174A  3B            		tsc
4566
 6627  FF174B  69 0B 00      		adc	#11
4567
 6628  FF174E  1B            		tcs
4568
 6629  FF174F                		ACC08
4569
 6630  FF174F  E2 20         		sep	#PMFLAG
4570
 6631                        		.LONGA	off
4571
 6632                        		.MNLIST
4572
 6633  FF1751  60            		rts
4573
 6634
4574
 6635  FF1752  6F 70 74 69 6F 	?30:	.DB	'option ''-%c'' -- arg: <%s>', 13, 0
4575
               6E 20 27 2D 25
4576
               63 27 20 2D 2D
4577
               20 61 72 67 3A
4578
               20 3C 25 73 3E
4579
               0D 00
4580
 6636  FF176D  6F 70 74 69 6F 	?40:	.DB	'option ''-%c'' -- no arg', 13, 0
4581
               6E 20 27 2D 25
4582
               63 27 20 2D 2D
4583
               20 6E 6F 20 61
4584
               72 67 0D 00
4585
 6637  FF1785  61 72 67 3A 20 	?50:	.DB	'arg: <%s>', 13, 0
4586
               3C 25 73 3E 0D
4587
               00
4588
 6638  FF1790  6F 70 74 69 6F 	?60:	.DB	'option ''-%c'' -- char: <%c>', 13, 0
4589
  Tue Jul 17 11:00:24 2018                                                                                               Page   75
4590
 
4591
 
4592
 
4593
 
4594
               6E 20 27 2D 25
4595
               63 27 20 2D 2D
4596
               20 63 68 61 72
4597
               3A 20 3C 25 63
4598
               3E 0D 00
4599
 6639  FF17AC  6F 70 74 69 6F 	?70:	.DB	'option ''-%c'' -- int: <%d>, <%X>', 13, 0
4600
               6E 20 27 2D 25
4601
               63 27 20 2D 2D
4602
               20 69 6E 74 3A
4603
               20 3C 25 64 3E
4604
               2C 20 3C 25 58
4605
               3E 0D 00
4606
 6640  FF17CD  6F 70 74 69 6F 	?80:	.DB	'option ''-%c'' -- int: <%bd>, <%bX>', 13, 0
4607
               6E 20 27 2D 25
4608
               63 27 20 2D 2D
4609
               20 69 6E 74 3A
4610
               20 3C 25 62 64
4611
               3E 2C 20 3C 25
4612
               62 58 3E 0D 00
4613
 6641  FF17F0  6F 70 74 69 6F 	?90:	.DB	'option ''-%c'' -- int: <%hd>, <%hX>', 13, 0
4614
               6E 20 27 2D 25
4615
               63 27 20 2D 2D
4616
               20 69 6E 74 3A
4617
               20 3C 25 68 64
4618
               3E 2C 20 3C 25
4619
               68 58 3E 0D 00
4620
 6642  FF1813  6F 70 74 69 6F 	?95:	.DB	'option ''-%c'' -- PTR: <%P>', 13, 0
4621
               6E 20 27 2D 25
4622
               63 27 20 2D 2D
4623
               20 50 54 52 3A
4624
               20 3C 25 50 3E
4625
               0D 00
4626
 6643
4627
 6644  FF182E  72 20 43 20 6C 	?100:	.DB	'r C l:s u!p^b$z%x#v*w&y|', 0
4628
               3A 73 20 75 21
4629
               70 5E 62 24 7A
4630
               25 78 23 76 2A
4631
               77 26 79 7C 00
4632
 6645
4633
 6646  FF1847  C0 25         	?200:	cpy	#'%'
4634
 6647  FF1849  D0 13         		bne	?210
4635
 6648  FF184B  A8            		tay
4636
 6649  FF184C  A3 01         		lda	$01,s
4637
 6650  FF184E  AA            		tax
4638
 6651  FF184F  DA            		phx
4639
 6652  FF1850  48            		pha
4640
 6653  FF1851  5A            		phy
4641
 6654  FF1852  4B            		phk
4642
 6655  FF1853  F4 CD 17      		pea	#?80
4643
 6656  FF1856  A9 07         		lda	#7
4644
 6657  FF1858  48            		pha
4645
 6658  FF1859                		BPRINTF
4646
 6659  FF1859  02 11         		cop	$11
4647
 6660                        		.MNLIST
4648
 6661  FF185B  4C 9D 16      		jmp	?10
4649
 6662
4650
 6663  FF185E  C0 23         	?210:	cpy	#'#'
4651
  Tue Jul 17 11:00:24 2018                                                                                               Page   76
4652
 
4653
 
4654
 
4655
 
4656
 6664  FF1860  D0 17         		bne	?220
4657
 6665  FF1862  A8            		tay
4658
 6666  FF1863  A3 02         		lda	$02,s
4659
 6667  FF1865  AA            		tax
4660
 6668  FF1866  A3 01         		lda	$01,s
4661
 6669  FF1868  DA            		phx
4662
 6670  FF1869  48            		pha
4663
 6671  FF186A  DA            		phx
4664
 6672  FF186B  48            		pha
4665
 6673  FF186C  5A            		phy
4666
 6674  FF186D  4B            		phk
4667
 6675  FF186E  F4 F0 17      		pea	#?90
4668
 6676  FF1871  A9 09         		lda	#9
4669
 6677  FF1873  48            		pha
4670
 6678  FF1874                		BPRINTF
4671
 6679  FF1874  02 11         		cop	$11
4672
 6680                        		.MNLIST
4673
 6681  FF1876  4C 9D 16      		jmp	?10
4674
 6682
4675
 6683  FF1879  A8            	?220:	tay
4676
 6684  FF187A  A3 03         		lda	$03,s
4677
 6685  FF187C  AA            		tax
4678
 6686  FF187D                		ACC16
4679
 6687  FF187D  C2 20         		rep	#PMFLAG
4680
 6688                        		.LONGA	on
4681
 6689                        		.MNLIST
4682
 6690  FF187F  A3 01         		lda	$01,s
4683
 6691  FF1881  DA            		phx
4684
 6692  FF1882  48            		pha
4685
 6693  FF1883                		ACC08
4686
 6694  FF1883  E2 20         		sep	#PMFLAG
4687
 6695                        		.LONGA	off
4688
 6696                        		.MNLIST
4689
 6697  FF1885  5A            		phy
4690
 6698  FF1886  4B            		phk
4691
 6699  FF1887  F4 13 18      		pea	#?95
4692
 6700  FF188A  A9 08         		lda	#8
4693
 6701  FF188C  48            		pha
4694
 6702  FF188D                		BPRINTF
4695
 6703  FF188D  02 11         		cop	$11
4696
 6704                        		.MNLIST
4697
 6705  FF188F  4C 9D 16      		jmp	?10
4698
 6706
4699
 6707                        	;----------------------------------------------------------
4700
 6708                        	; copia/incremento/decremento puntatori
4701
 6709
4702
 6710  FF1892                	TmpToAddr:
4703
 6711  FF1892
4704
 6712  FF1892  A5 BA         		lda	SMTmpL
4705
 6713  FF1894  85 B6         		sta	SMAddrL
4706
 6714  FF1896  A5 BB         		lda	SMTmpH
4707
 6715  FF1898  85 B7         		sta	SMAddrH
4708
 6716  FF189A  A5 BC         		lda	SMTmpK
4709
 6717  FF189C  85 B8         		sta	SMAddrK
4710
 6718  FF189E  60            		rts
4711
 6719  FF189F
4712
 6720  FF189F                	SubTmpAddr:
4713
  Tue Jul 17 11:00:24 2018                                                                                               Page   77
4714
 
4715
 
4716
 
4717
 
4718
 6721  FF189F                		ACC16
4719
 6722  FF189F  C2 20         		rep	#PMFLAG
4720
 6723                        		.LONGA	on
4721
 6724                        		.MNLIST
4722
 6725  FF18A1  38            		sec
4723
 6726  FF18A2  A5 BA         		lda	SMTmpL
4724
 6727  FF18A4  E5 B6         		sbc	SMAddrL
4725
 6728  FF18A6  85 BA         		sta	SMTmpL
4726
 6729  FF18A8                		ACC08
4727
 6730  FF18A8  E2 20         		sep	#PMFLAG
4728
 6731                        		.LONGA	off
4729
 6732                        		.MNLIST
4730
 6733  FF18AA  A5 BC         		lda	SMTmpK
4731
 6734  FF18AC  E5 B8         		sbc	SMAddrK
4732
 6735  FF18AE  85 BC         		sta	SMTmpK
4733
 6736  FF18B0  60            		rts
4734
 6737
4735
 6738  FF18B1                	DecTmpPtr:
4736
 6739  FF18B1  A9 01         		lda	#1
4737
 6740  FF18B3
4738
 6741  FF18B3                	DecTmpPtrA:
4739
 6742  FF18B3  85 D6         		sta	SMAuxL
4740
 6743  FF18B5  64 D7         		stz	SMAuxH
4741
 6744  FF18B7                		ACC16
4742
 6745  FF18B7  C2 20         		rep	#PMFLAG
4743
 6746                        		.LONGA	on
4744
 6747                        		.MNLIST
4745
 6748  FF18B9  38            		sec
4746
 6749  FF18BA  A5 BA         		lda	SMTmpL
4747
 6750  FF18BC  E5 D6         		sbc	SMAuxL
4748
 6751  FF18BE  85 BA         		sta	SMTmpL
4749
 6752  FF18C0                		ACC08
4750
 6753  FF18C0  E2 20         		sep	#PMFLAG
4751
 6754                        		.LONGA	off
4752
 6755                        		.MNLIST
4753
 6756  FF18C2  A5 BC         		lda	SMTmpK
4754
 6757  FF18C4  E9 00         		sbc	#0
4755
 6758  FF18C6  85 BC         		sta	SMTmpK
4756
 6759  FF18C8  60            		rts
4757
 6760
4758
 6761  FF18C9                	DecPtr:
4759
 6762  FF18C9                		ACC16
4760
 6763  FF18C9  C2 20         		rep	#PMFLAG
4761
 6764                        		.LONGA	on
4762
 6765                        		.MNLIST
4763
 6766  FF18CB  38            		sec
4764
 6767  FF18CC  A5 B6         		lda	SMAddrL
4765
 6768  FF18CE  E9 01 00      		sbc	#1
4766
 6769  FF18D1  85 B6         		sta	SMAddrL
4767
 6770  FF18D3                		ACC08
4768
 6771  FF18D3  E2 20         		sep	#PMFLAG
4769
 6772                        		.LONGA	off
4770
 6773                        		.MNLIST
4771
 6774  FF18D5  A5 B8         		lda	SMAddrK
4772
 6775  FF18D7  E9 00         		sbc	#0
4773
 6776  FF18D9  85 B8         		sta	SMAddrK
4774
 6777  FF18DB  60            		rts
4775
  Tue Jul 17 11:00:24 2018                                                                                               Page   78
4776
 
4777
 
4778
 
4779
 
4780
 6778
4781
 6779  FF18DC                	DecSize:
4782
 6780  FF18DC                		ACC16
4783
 6781  FF18DC  C2 20         		rep	#PMFLAG
4784
 6782                        		.LONGA	on
4785
 6783                        		.MNLIST
4786
 6784  FF18DE  38            		sec
4787
 6785  FF18DF  A5 BE         		lda	SMSizeL
4788
 6786  FF18E1  E9 01 00      		sbc	#1
4789
 6787  FF18E4  85 BE         		sta	SMSizeL
4790
 6788  FF18E6                		ACC08
4791
 6789  FF18E6  E2 20         		sep	#PMFLAG
4792
 6790                        		.LONGA	off
4793
 6791                        		.MNLIST
4794
 6792  FF18E8  A5 C0         		lda	SMSizeK
4795
 6793  FF18EA  E9 00         		sbc	#0
4796
 6794  FF18EC  85 C0         		sta	SMSizeK
4797
 6795  FF18EE  60            		rts
4798
 6796  FF18EF
4799
 6797  FF18EF                	IncPtr:
4800
 6798  FF18EF  C2 21         		rep	#(PMFLAG.OR.PCFLAG)	; 16 bit + clc
4801
 6799                        		.LONGA	on
4802
 6800  FF18F1  A9 01 00      		lda	#1
4803
 6801  FF18F4                	IncPtrA:
4804
 6802  FF18F4  65 B6         		adc	SMAddrL
4805
 6803  FF18F6  85 B6         		sta	SMAddrL
4806
 6804  FF18F8                		ACC08
4807
 6805  FF18F8  E2 20         		sep	#PMFLAG
4808
 6806                        		.LONGA	off
4809
 6807                        		.MNLIST
4810
 6808  FF18FA  90 02         		bcc	?01
4811
 6809  FF18FC  E6 B8         		inc	SMAddrK
4812
 6810  FF18FE  60            	?01:	rts
4813
 6811
4814
 6812
4815
 6813  FF18FF                	XSetPtr:
4816
 6814  FF18FF                		ACC16
4817
 6815  FF18FF  C2 20         		rep	#PMFLAG
4818
 6816                        		.LONGA	on
4819
 6817                        		.MNLIST
4820
 6818  FF1901  A5 B6         		lda	SMAddrL
4821
 6819  FF1903  85 C1         		sta	SMXAddrL		; offset
4822
 6820  FF1905                		ACC08
4823
 6821  FF1905  E2 20         		sep	#PMFLAG
4824
 6822                        		.LONGA	off
4825
 6823                        		.MNLIST
4826
 6824  FF1907  A5 B8         		lda	SMAddrK			; bank
4827
 6825  FF1909  80 0F         		bra	_xsptr
4828
 6826  FF190B
4829
 6827  FF190B                	XSetPtrY:
4830
 6828  FF190B  C2 21         		rep	#(PMFLAG.OR.PCFLAG)	; A 16 bit + clc
4831
 6829  FF190D  98            		tya				; YH = 0 !
4832
 6830  FF190E  65 B6         		adc	SMAddrL
4833
 6831  FF1910  85 C1         		sta	SMXAddrL		; offset
4834
 6832  FF1912                		ACC08
4835
 6833  FF1912  E2 20         		sep	#PMFLAG
4836
 6834                        		.LONGA	off
4837
  Tue Jul 17 11:00:24 2018                                                                                               Page   79
4838
 
4839
 
4840
 
4841
 
4842
 6835                        		.MNLIST
4843
 6836  FF1914  A5 B8         		lda	SMAddrK			; hi
4844
 6837  FF1916  69 00         		adc	#0			; A = bank
4845
 6838  FF1918  B0 1C         		bcs	_?01
4846
 6839  FF191A                	_xsptr:
4847
 6840  FF191A  C9 20         		cmp	#$20			; limite max ?
4848
 6841  FF191C  B0 18         		bcs	_?01			; si - errore
4849
 6842  FF191E  A6 C2         		ldx	SMXAddrH
4850
 6843  FF1920  86 D6         		stx	SMAuxL
4851
 6844  FF1922  A2 03         		ldx	#3			; calcola pagina 8k
4852
 6845  FF1924  26 D6         	?01:	rol	SMAuxL
4853
 6846  FF1926  2A            		rol	a
4854
 6847  FF1927  CA            		dex
4855
 6848  FF1928  D0 FA         		bne	?01
4856
 6849  FF192A  8D 28 FD      		sta	PIA0+PIAPRA		; pagina XM
4857
 6850  FF192D  A5 C2         		lda	SMXAddrH
4858
 6851  FF192F  29 1F         		and	#$1F
4859
 6852  FF1931  09 20         		ora	#$20
4860
 6853  FF1933  85 C2         		sta	SMXAddrH
4861
 6854  FF1935  18            		clc				; ptr OK
4862
 6855  FF1936  60            	_?01:	rts
4863
 6856
4864
 6857                        	;----------------------------------------------------------
4865
 6858                        	; funzioni elementari di stampa
4866
 6859
4867
 6860                        	; PrintAddr - stampa a video address SMAddrL,H,K
4868
 6861  FF1937                	PrintAddr:
4869
 6862  FF1937                		ACC16
4870
 6863  FF1937  C2 20         		rep	#PMFLAG
4871
 6864                        		.LONGA	on
4872
 6865                        		.MNLIST
4873
 6866  FF1939  A5 B6         		lda	SMAddrL
4874
 6867  FF193B  A6 B8         		ldx	SMAddrK
4875
 6868  FF193D
4876
 6869                        	; PrintAddr2 - stampa a video address A(offset)-X(bank)
4877
 6870  FF193D                	PrintAddr2:
4878
 6871  FF193D                		ACC16
4879
 6872  FF193D  C2 20         		rep	#PMFLAG
4880
 6873                        		.LONGA	on
4881
 6874                        		.MNLIST
4882
 6875  FF193F  48            		pha
4883
 6876  FF1940                		ACC08
4884
 6877  FF1940  E2 20         		sep	#PMFLAG
4885
 6878                        		.LONGA	off
4886
 6879                        		.MNLIST
4887
 6880  FF1942  8A            		txa			; hi byte
4888
 6881  FF1943  20 71 19      		jsr	PrintHex
4889
 6882  FF1946  68            		pla
4890
 6883  FF1947  FA            		plx
4891
 6884
4892
 6885                        	; PrintWord - stampa a video word A(lo)-X(hi)
4893
 6886  FF1948                	PrintWord:
4894
 6887  FF1948  48            		pha
4895
 6888  FF1949  8A            		txa
4896
 6889  FF194A  20 71 19      		jsr	PrintHex
4897
 6890  FF194D  68            		pla
4898
 6891
4899
  Tue Jul 17 11:00:24 2018                                                                                               Page   80
4900
 
4901
 
4902
 
4903
 
4904
 6892                        	; PrintByte - stampa a video byte A + spazio
4905
 6893  FF194E                	PrintByte:
4906
 6894  FF194E  20 71 19      		jsr	PrintHex
4907
 6895
4908
 6896                        	; PrintBlank - stampa a video uno spazio
4909
 6897  FF1951                	PrintBlank:
4910
 6898  FF1951                		TXTPRCHAR
4911
 6899  FF1951  02 08         		cop	$08
4912
 6900                        		.MNLIST
4913
 6901  FF1953  20            		.DB	' '
4914
 6902  FF1954  60            		rts
4915
 6903
4916
 6904                        	; PrintUp - CR + cursore up
4917
 6905  FF1955                	PrintUp:
4918
 6906  FF1955                		SCNPRINT
4919
 6907  FF1955  02 01         		cop	$01
4920
 6908                        		.MNLIST
4921
 6909  FF1957  0D 01 00      		.DB	KB_CR, SCN_CSRUP, 0
4922
 6910  FF195A  60            		rts
4923
 6911  FF195B
4924
 6912  FF195B                	PrintCR:
4925
 6913  FF195B                		TXTPRCHAR
4926
 6914  FF195B  02 08         		cop	$08
4927
 6915                        		.MNLIST
4928
 6916  FF195D  0D            		.DB	KB_CR
4929
 6917  FF195E  60            		rts
4930
 6918  FF195F
4931
 6919  FF195F                	PrintBlankCR:
4932
 6920  FF195F                		SCNPRINT
4933
 6921  FF195F  02 01         		cop	$01
4934
 6922                        		.MNLIST
4935
 6923  FF1961  0D 1B 51 20 00 		.DB	KB_CR, KB_ESC, 'Q', ' ', 0
4936
 6924  FF1966  60            		rts
4937
 6925
4938
 6926  FF1967                	PrintHex1:
4939
 6927  FF1967                		TXTPRCHAR
4940
 6928  FF1967  02 08         		cop	$08
4941
 6929                        		.MNLIST
4942
 6930  FF1969  24            		.DB	'$'
4943
 6931  FF196A  20 71 19      		jsr	PrintHex
4944
 6932  FF196D                		TXTPRCHAR
4945
 6933  FF196D  02 08         		cop	$08
4946
 6934                        		.MNLIST
4947
 6935  FF196F  2C            		.DB	','
4948
 6936  FF1970  60            		rts
4949
 6937  FF1971
4950
 6938                        	; PrintHex - stampa a video byte HEX
4951
 6939                        	; In	- A = byte
4952
 6940                        	; Out	- nessuno
4953
 6941  FF1971                	PrintHex:
4954
 6942  FF1971  DA            		phx			; salva x
4955
 6943  FF1972  20 7C 19      		jsr	FF_Byte2Hex	; X,A = HEX
4956
 6944  FF1975                		TXTCHAROUT	; stampa hi digit
4957
 6945  FF1975  02 06         		cop	$06
4958
 6946                        		.MNLIST
4959
 6947  FF1977  8A            		txa
4960
 6948  FF1978  FA            		plx			; ripristina x
4961
  Tue Jul 17 11:00:24 2018                                                                                               Page   81
4962
 
4963
 
4964
 
4965
 
4966
 6949  FF1979                		TXTCHAROUT	; stampa low digit
4967
 6950  FF1979  02 06         		cop	$06
4968
 6951                        		.MNLIST
4969
 6952  FF197B  60            		rts
4970
 6953  FF197C
4971
 6954                        	; FF_Byte2Hex - converte byte in HEX
4972
 6955                        	; In	- A = byte
4973
 6956                        	; Out:	- X = low digit
4974
 6957                        	;	  A = hi digit
4975
 6958  FF197C                	FF_Byte2Hex:
4976
 6959  FF197C  48            		pha			; salva A
4977
 6960  FF197D  20 86 19      		jsr	?01		; converte parte bassa
4978
 6961  FF1980  AA            		tax			; x = low digit
4979
 6962  FF1981  68            		pla
4980
 6963  FF1982  4A            		lsr	a		; parte alta
4981
 6964  FF1983  4A            		lsr	a
4982
 6965  FF1984  4A            		lsr	a
4983
 6966  FF1985  4A            		lsr	a
4984
 6967  FF1986  29 0F         	?01:	and	#$0F		; maschera nibble
4985
 6968  FF1988  C9 0A         		cmp	#10
4986
 6969  FF198A  90 02         		bcc	?02
4987
 6970  FF198C  69 06         		adc	#6
4988
 6971  FF198E  69 30         	?02:	adc	#'0'
4989
 6972  FF1990  60            	_?02:	rts
4990
 6973
4991
 6974                        	; ritorna indirizzo start e indirizzo stop
4992
 6975                        	; ritorna C=1 se non ci sono parametri o se Stop < Start
4993
 6976  FF1991                	GetStartStop:
4994
 6977  FF1991  B0 FD         		bcs	_?02		; no parametri
4995
 6978  FF1993  FA            		plx			; return L
4996
 6979  FF1994  68            		pla			; return H
4997
 6980  FF1995  E8            		inx			; scarta stack - necessario per
4998
 6981  FF1996  D0 01         		bne	?01		; chiamare GetParm al giusto livello di stack
4999
 6982  FF1998  1A            		inc	a		; X,A -> indirizzo di ritorno
5000
 6983  FF1999  86 E2         	?01:	stx	SMTmp2
5001
 6984  FF199B  85 E3         		sta	SMTmp2+1
5002
 6985  FF199D  20 92 18      		jsr	TmpToAddr	; salva SMTmpL/H/K in SMAddrL/H/K
5003
 6986  FF19A0  20 5A 01      		jsr	GetParm
5004
 6987  FF19A3  B0 20         		bcs	?20		; no stop address, esce
5005
 6988  FF19A5  A5 BA         		lda	SMTmpL		; SMXAddrL/H/K = indirizzo di stop
5006
 6989  FF19A7  85 C1         		sta	SMXAddrL
5007
 6990  FF19A9  A5 BB         		lda	SMTmpH
5008
 6991  FF19AB  85 C2         		sta	SMXAddrH
5009
 6992  FF19AD  A5 BC         		lda	SMTmpK
5010
 6993  FF19AF  85 C3         		sta	SMXAddrK
5011
 6994  FF19B1  20 9F 18      		jsr	SubTmpAddr	; stop - start = #bytes
5012
 6995  FF19B4  A5 BA         		lda	SMTmpL		; salva #bytes in SMSizeL/H/K
5013
 6996  FF19B6  85 BE         		sta	SMSizeL
5014
 6997  FF19B8  A5 BB         		lda	SMTmpH
5015
 6998  FF19BA  85 BF         		sta	SMSizeH
5016
 6999  FF19BC  A5 BC         		lda	SMTmpK
5017
 7000  FF19BE  85 C0         		sta	SMSizeK
5018
 7001  FF19C0  90 02         		bcc	?19		; errore: stop < start
5019
 7002  FF19C2  18            		clc			; OK
5020
 7003  FF19C3  24            		.DB	$24		; BIT $38
5021
 7004  FF19C4  38            	?19:	sec			; errore
5022
 7005  FF19C5  6C E2 01      	?20:	jmp	(SMTMP2)	; return
5023
  Tue Jul 17 11:00:24 2018                                                                                               Page   82
5024
 
5025
 
5026
 
5027
 
5028
 7006
5029
 7007
5030
 7008                        	; ricava parametri per funzioni fdread/fdwrite
5031
 7009  FF19C8                	GetFDCParm:
5032
 7010  FF19C8  FA            		plx			; return L
5033
 7011  FF19C9  68            		pla			; return H
5034
 7012  FF19CA  E8            		inx			; scarta stack - necessario per
5035
 7013  FF19CB  D0 01         		bne	?01		; chiamare GetParm al giusto livello di stack
5036
 7014  FF19CD  1A            		inc	a		; X,A -> indirizzo di ritorno
5037
 7015  FF19CE  86 E2         	?01:	stx	SMTmp2
5038
 7016  FF19D0  85 E3         		sta	SMTmp2+1
5039
 7017  FF19D2                		ACC16
5040
 7018  FF19D2  C2 20         		rep	#PMFLAG
5041
 7019                        		.LONGA	on
5042
 7020                        		.MNLIST
5043
 7021  FF19D4  3B            		tsc			; stack frame
5044
 7022  FF19D5  38            		sec
5045
 7023  FF19D6  E9 09 00      		sbc	#FDPBSIZE	; crea variabili locali
5046
 7024  FF19D9  1B            		tcs
5047
 7025  FF19DA  1A            		inc	a
5048
 7026  FF19DB  85 BE         		sta	SMSizeL		; salva stack frame
5049
 7027  FF19DD                		ACC08
5050
 7028  FF19DD  E2 20         		sep	#PMFLAG
5051
 7029                        		.LONGA	off
5052
 7030                        		.MNLIST
5053
 7031  FF19DF  A5 BA         		lda	SMTmpL		; parametro 1 - drive + flag
5054
 7032  FF19E1  AA            		tax
5055
 7033  FF19E2  29 01         		and	#$01		; maschera drive
5056
 7034  FF19E4  83 01         		sta	$01,s		; drive
5057
 7035  FF19E6  8A            		txa
5058
 7036  FF19E7  29 E0         		and	#$E0		; maschera flag
5059
 7037  FF19E9  83 0D         		sta	$0D,s		; flag
5060
 7038  FF19EB  85 C0         		sta	SMSizeK		; salva flag
5061
 7039  FF19ED  20 5A 01      		jsr	GetParm		; parametro 2 - formato
5062
 7040  FF19F0  B0 53         		bcs	?20
5063
 7041  FF19F2  A5 BA         		lda	SMTmpL
5064
 7042  FF19F4  83 06         		sta	$06,s		; disk format
5065
 7043  FF19F6  20 5A 01      		jsr	GetParm		; parametro 3 - buffer
5066
 7044  FF19F9  B0 4A         		bcs	?20
5067
 7045  FF19FB  A5 BA         		lda	SMTmpL
5068
 7046  FF19FD  83 07         		sta	$07,s		; buffer ptr
5069
 7047  FF19FF  A5 BB         		lda	SMTmpH
5070
 7048  FF1A01  83 08         		sta	$08,s
5071
 7049  FF1A03  A5 BC         		lda	SMTmpK
5072
 7050  FF1A05  83 09         		sta	$09,s
5073
 7051  FF1A07  20 5A 01      		jsr	GetParm		; parametro 4 - track
5074
 7052  FF1A0A  B0 39         		bcs	?20
5075
 7053  FF1A0C  A5 BA         		lda	SMTmpL
5076
 7054  FF1A0E  83 02         		sta	$02,s		; track
5077
 7055  FF1A10
5078
 7056                        		; i restanti parametri : head, sector, sector number, vbuffer
5079
 7057                        		; sono opzionali in funzione dei flag passati
5080
 7058  FF1A10  A9 00         		lda	#$00
5081
 7059  FF1A12  83 03         		sta	$03,s		; head
5082
 7060  FF1A14  83 04         		sta	$04,s		; sector
5083
 7061  FF1A16  83 05         		sta	$05,s		; sector num.
5084
 7062  FF1A18  83 0A         		sta	$0A,s		; vbuffer
5085
  Tue Jul 17 11:00:24 2018                                                                                               Page   83
5086
 
5087
 
5088
 
5089
 
5090
 7063  FF1A1A  83 0B         		sta	$0B,s
5091
 7064  FF1A1C  83 0C         		sta	$0C,s
5092
 7065  FF1A1E  24 C0         		bit	SMSizeK
5093
 7066  FF1A20  30 1B         		bmi	?18		; MT -> ignora parametri successivi
5094
 7067  FF1A22  20 5A 01      		jsr	GetParm		; head opzionale
5095
 7068  FF1A25  B0 1E         		bcs	?20
5096
 7069  FF1A27  A5 BA         		lda	SMTmpL
5097
 7070  FF1A29  83 03         		sta	$03,s		; head
5098
 7071  FF1A2B  20 5A 01      		jsr	GetParm
5099
 7072  FF1A2E  B0 15         		bcs	?20
5100
 7073  FF1A30  A5 BA         		lda	SMTmpL
5101
 7074  FF1A32  83 04         		sta	$04,s		; sector
5102
 7075  FF1A34  20 5A 01      		jsr	GetParm
5103
 7076  FF1A37  B0 0C         		bcs	?20
5104
 7077  FF1A39  A5 BA         		lda	SMTmpL
5105
 7078  FF1A3B  83 05         		sta	$05,s		; sector num.
5106
 7079  FF1A3D  A5 BF         	?18:	lda	SMSizeH		; C = stack frame
5107
 7080  FF1A3F  EB            		xba
5108
 7081  FF1A40  A5 BE         		lda	SMSizeL
5109
 7082  FF1A42  18            		clc			; OK
5110
 7083  FF1A43  24            		.DB	$24		; BIT $38
5111
 7084  FF1A44  38            	?19:	sec			; errore
5112
 7085  FF1A45  6C E2 01      	?20:	jmp	(SMTMP2)	; return
5113
 7086  FF1A48
5114
 7087                        	;----------------------------------------------------------
5115
 7088                        	; funzioni riga di comando
5116
 7089
5117
 7090                        	;GetPrevCh:
5118
 7091                        	;	dec	SMbndx
5119
 7092  FF1A48
5120
 7093  FF1A48                	GetCurCh:
5121
 7094  FF1A48  86 D6         		stx	SMAuxL
5122
 7095  FF1A4A  A6 C4         		ldx	SMbndx
5123
 7096  FF1A4C  BF 00 99 01   		lda	INPUTBUF,x
5124
 7097  FF1A50  38            		sec
5125
 7098  FF1A51  F0 06         		beq	?01
5126
 7099  FF1A53  C9 3A         		cmp	#':'
5127
 7100  FF1A55  F0 02         		beq	?01
5128
 7101  FF1A57  E6 C4         		inc	SMbndx
5129
 7102  FF1A59  08            	?01:	php
5130
 7103  FF1A5A  A6 D6         		ldx	SMAuxL
5131
 7104  FF1A5C  28            		plp
5132
 7105  FF1A5D  60            		rts
5133
 7106
5134
 7107                        	; no case version
5135
 7108  FF1A5E                	GetCurCh2:
5136
 7109  FF1A5E  86 D6         		stx	SMAuxL
5137
 7110  FF1A60  A6 C4         		ldx	SMbndx
5138
 7111  FF1A62  BF 00 99 01   		lda	INPUTBUF,x
5139
 7112  FF1A66  F0 0A         		beq	?00
5140
 7113  FF1A68  C9 61         		cmp	#'a'
5141
 7114  FF1A6A  90 06         		bcc	?00
5142
 7115  FF1A6C  C9 7B         		cmp	#'z'+1
5143
 7116  FF1A6E  B0 02         		bcs	?00
5144
 7117  FF1A70  29 DF         		and	#$DF
5145
 7118  FF1A72  38            	?00:	sec
5146
 7119  FF1A73  F0 06         		beq	?01
5147
  Tue Jul 17 11:00:24 2018                                                                                               Page   84
5148
 
5149
 
5150
 
5151
 
5152
 7120  FF1A75  C9 3A         		cmp	#':'
5153
 7121  FF1A77  F0 02         		beq	?01
5154
 7122  FF1A79  E6 C4         		inc	SMbndx
5155
 7123  FF1A7B  08            	?01:	php
5156
 7124  FF1A7C  A6 D6         		ldx	SMAuxL
5157
 7125  FF1A7E  28            		plp
5158
 7126  FF1A7F  60            		rts
5159
 7127
5160
 7128  FF1A80                	CkStop:
5161
 7129  FF1A80  0B            		phd
5162
 7130  FF1A81  F4 00 00      		pea	#0
5163
 7131  FF1A84  2B            		pld
5164
 7132  FF1A85  A5 4B         		lda	CtrlBrk
5165
 7133  FF1A87  64 4B         		stz	CtrlBrk
5166
 7134  FF1A89  2B            		pld
5167
 7135  FF1A8A  C9 80         		cmp	#$80
5168
 7136  FF1A8C  60            		rts
5169
 7137
5170
 7138                        	;----------------------------------------------------------
5171
 7139                        	; UPDATE FLASH
5172
 7140                        	;----------------------------------------------------------
5173
 7141
5174
 7142                        	;;_FLASHSTART	.EQU	$
5175
 7143
5176
 7144                        	; flag settori da programmare
5177
 7145  FF1A8D                	_SCTTBL:
5178
 7146  FF1A8D  80 80 80 80 80 		.DB	$80, $80, $80, $80, $80, $80, $80, $80
5179
               80 80 80
5180
 7147  FF1A95                	_SRCBNK:
5181
 7148  FF1A95  F8            		.DB	$F8
5182
 7149  FF1A96                	_DSTBNK:
5183
 7150  FF1A96  F0            		.DB	$F0
5184
 7151  FF1A97
5185
 7152                        	; erase sector: X -> settore (0..7)
5186
 7153  FF1A97                	_erase:
5187
 7154                        		.LONGI	on
5188
 7155  FF1A97  8B            		phb
5189
 7156  FF1A98  4B            		phk
5190
 7157  FF1A99  AB            		plb
5191
 7158  FF1A9A  BD 8D 1A      		lda	!_SCTTBL,x
5192
 7159  FF1A9D  30 05         		bmi	?02			; erase
5193
 7160  FF1A9F  AB            		plb
5194
 7161  FF1AA0  18            		clc
5195
 7162  FF1AA1  E2 40         		sep	#PVFLAG			; V = 1
5196
 7163  FF1AA3  60            		rts
5197
 7164  FF1AA4  8A            	?02:	txa
5198
 7165  FF1AA5  18            		clc
5199
 7166  FF1AA6  6D 96 1A      		adc	!_DSTBNK
5200
 7167  FF1AA9  85 B8         		sta	SMAddrK			; banco fisico
5201
 7168  FF1AAB  64 B6         		stz	SMAddrL
5202
 7169  FF1AAD  64 B7         		stz	SMAddrH
5203
 7170  FF1AAF  AB            		plb
5204
 7171  FF1AB0  A0 00 00      		ldy	#0
5205
 7172  FF1AB3  B7 B6         	?04:	lda	[SMAddrL],y
5206
 7173  FF1AB5  C9 FF         		cmp	#$FF			; test erased
5207
 7174  FF1AB7  D0 06         		bne	?06			; not erased
5208
 7175  FF1AB9  C8            		iny
5209
  Tue Jul 17 11:00:24 2018                                                                                               Page   85
5210
 
5211
 
5212
 
5213
 
5214
 7176  FF1ABA  D0 F7         		bne	?04
5215
 7177  FF1ABC  B8            		clv
5216
 7178  FF1ABD  18            		clc
5217
 7179  FF1ABE  60            		rts				; sector erased
5218
 7180  FF1ABF  A0 55 05      	?06:	ldy	#$0555			; inizia sequenza erase sector
5219
 7181  FF1AC2  A9 AA         		lda	#$AA
5220
 7182  FF1AC4  97 B6         		sta	[SMAddrL],y
5221
 7183  FF1AC6  A0 AA 02      		ldy	#$02AA
5222
 7184  FF1AC9  A9 55         		lda	#$55
5223
 7185  FF1ACB  97 B6         		sta	[SMAddrL],y
5224
 7186  FF1ACD  A0 55 05      		ldy	#$0555
5225
 7187  FF1AD0  A9 80         		lda	#$80
5226
 7188  FF1AD2  97 B6         		sta	[SMAddrL],y
5227
 7189  FF1AD4  A9 AA         		lda	#$AA
5228
 7190  FF1AD6  97 B6         		sta	[SMAddrL],y
5229
 7191  FF1AD8  A0 AA 02      		ldy	#$02AA
5230
 7192  FF1ADB  A9 55         		lda	#$55
5231
 7193  FF1ADD  97 B6         		sta	[SMAddrL],y
5232
 7194  FF1ADF  A0 00 00      		ldy	#$00			; SA - sector address (in banco)
5233
 7195  FF1AE2  A9 30         		lda	#$30			; codice erase
5234
 7196  FF1AE4  87 B6         		sta	[SMAddrL]
5235
 7197  FF1AE6  20 5B 1B      		jsr	_waitfl			; attende fine operazione
5236
 7198  FF1AE9  B0 0D         		bcs	?30			; fail
5237
 7199  FF1AEB  B7 B6         	?24:	lda	[SMAddrL],y
5238
 7200  FF1AED  C9 FF         		cmp	#$FF			; test erased
5239
 7201  FF1AEF  D0 06         		bne	?26			; not erased
5240
 7202  FF1AF1  C8            		iny
5241
 7203  FF1AF2  D0 F7         		bne	?24
5242
 7204  FF1AF4  B8            		clv
5243
 7205  FF1AF5  18            		clc
5244
 7206  FF1AF6  60            		rts				; sector erased
5245
 7207  FF1AF7  38            	?26:	sec				; erased fail
5246
 7208  FF1AF8  60            	?30:	rts
5247
 7209  FF1AF9
5248
 7210                        	; pgm sector: X -> settore (0..7)
5249
 7211  FF1AF9                	_sctrpgm:
5250
 7212  FF1AF9  8B            		phb
5251
 7213  FF1AFA  4B            		phk
5252
 7214  FF1AFB  AB            		plb
5253
 7215  FF1AFC  BD 8D 1A      		lda	!_SCTTBL,x
5254
 7216  FF1AFF  30 05         		bmi	?02			; erase
5255
 7217  FF1B01  AB            		plb
5256
 7218  FF1B02  E2 40         		sep	#PVFLAG			; V = 1
5257
 7219  FF1B04  18            		clc
5258
 7220  FF1B05  60            		rts
5259
 7221  FF1B06  8A            	?02:	txa
5260
 7222  FF1B07  18            		clc
5261
 7223  FF1B08  6D 96 1A      		adc	!_DSTBNK
5262
 7224  FF1B0B  85 B8         		sta	SMAddrK			; banco fisico DST
5263
 7225  FF1B0D  64 B6         		stz	SMAddrL
5264
 7226  FF1B0F  64 B7         		stz	SMAddrH
5265
 7227  FF1B11  8A            		txa
5266
 7228  FF1B12  18            		clc
5267
 7229  FF1B13  65 EE         		adc	SMFsrc
5268
 7230  FF1B15  85 C3         		sta	SMXAddrK		; banco fisico SRC
5269
 7231  FF1B17  64 C1         		stz	SMXAddrL
5270
 7232  FF1B19  64 C2         		stz	SMXAddrH
5271
  Tue Jul 17 11:00:24 2018                                                                                               Page   86
5272
 
5273
 
5274
 
5275
 
5276
 7233  FF1B1B  AB            		plb
5277
 7234  FF1B1C  A0 00 00      		ldy	#0
5278
 7235  FF1B1F  B7 C1         	?04:	lda	[SMXAddrL],y
5279
 7236  FF1B21  EA            		nop
5280
 7237  FF1B22  D7 C1         		cmp	[SMXAddrL],y
5281
 7238  FF1B24  D0 F9         		bne	?04
5282
 7239  FF1B26  85 E2         		sta	SMTmp2
5283
 7240  FF1B28  84 BE         		sty	SMSizeL
5284
 7241  FF1B2A  A0 55 05      		ldy	#$0555			; inizia sequenza pgm
5285
 7242  FF1B2D  A9 AA         		lda	#$AA
5286
 7243  FF1B2F  97 B6         		sta	[SMAddrL],y
5287
 7244  FF1B31  A0 AA 02      		ldy	#$02AA
5288
 7245  FF1B34  A9 55         		lda	#$55
5289
 7246  FF1B36  97 B6         		sta	[SMAddrL],y
5290
 7247  FF1B38  A0 55 05      		ldy	#$0555
5291
 7248  FF1B3B  A9 A0         		lda	#$A0
5292
 7249  FF1B3D  97 B6         		sta	[SMAddrL],y
5293
 7250  FF1B3F  A4 BE         		ldy	SMSizeL
5294
 7251  FF1B41  A5 E2         		lda	SMTmp2
5295
 7252  FF1B43  97 B6         		sta	[SMAddrL],y		; program byte
5296
 7253  FF1B45  20 5B 1B      		jsr	_waitfl
5297
 7254  FF1B48  E2 40         		sep	#PVFLAG			; V = 1 -> pgm fail
5298
 7255  FF1B4A  B0 0E         		bcs	?30			; fail
5299
 7256  FF1B4C  B7 B6         	?20:	lda	[SMAddrL],y
5300
 7257  FF1B4E  C5 E2         		cmp	SMTmp2
5301
 7258  FF1B50  D0 06         		bne	?28
5302
 7259  FF1B52  C8            		iny
5303
 7260  FF1B53  D0 CA         		bne	?04
5304
 7261  FF1B55  B8            		clv
5305
 7262  FF1B56  18            		clc
5306
 7263  FF1B57  60            		rts
5307
 7264  FF1B58  38            	?28:	sec
5308
 7265  FF1B59  B8            		clv				; V = 0 -> verf fail
5309
 7266  FF1B5A  60            	?30:	rts
5310
 7267
5311
 7268                        	; polling toggle bit (DQ6)
5312
 7269  FF1B5B                	_waitfl:
5313
 7270  FF1B5B  B7 B6         	?08:	lda	[SMAddrL],y		; loop toggle bit
5314
 7271  FF1B5D  85 D6         		sta	SMAuxL
5315
 7272  FF1B5F  B7 B6         	?10:	lda	[SMAddrL],y		; read toggle bit
5316
 7273  FF1B61  85 D7         		sta	SMAuxH
5317
 7274  FF1B63  45 D6         		eor	SMAuxL			; confronta
5318
 7275  FF1B65  29 40         		and	#$40			; bit 6 toggle ?
5319
 7276  FF1B67  F0 20         		beq	?20			; no - operazione terminata
5320
 7277  FF1B69  A9 20         		lda	#00100000B		; test DQ5
5321
 7278  FF1B6B  24 D7         		bit	SMAuxH
5322
 7279  FF1B6D  D0 06         		bne	?12			; DQ5 = 1 -> read toggle bit
5323
 7280  FF1B6F  A5 D7         		lda	SMAuxH			; DQ5 = 0 -> loop
5324
 7281  FF1B71  85 D6         		sta	SMAuxL
5325
 7282  FF1B73  80 EA         		bra	?10
5326
 7283  FF1B75  A7 B6         	?12:	lda	[SMAddrL]		; read toggle bit
5327
 7284  FF1B77  85 D6         		sta	SMAuxL
5328
 7285  FF1B79  A7 B6         		lda	[SMAddrL]		; read toggle bit
5329
 7286  FF1B7B  85 D7         		sta	SMAuxH
5330
 7287  FF1B7D  45 D6         		eor	SMAuxL
5331
 7288  FF1B7F  29 40         		and	#$40			; bit 6 toggle ?
5332
 7289  FF1B81  F0 06         		beq	?20			; no - operazione terminata
5333
  Tue Jul 17 11:00:24 2018                                                                                               Page   87
5334
 
5335
 
5336
 
5337
 
5338
 7290  FF1B83  A9 F0         		lda	#$F0			; fail - reset device
5339
 7291  FF1B85  87 B6         		sta	[SMAddrL]
5340
 7292  FF1B87  38            		sec
5341
 7293  FF1B88  60            		rts
5342
 7294  FF1B89  18            	?20:	clc
5343
 7295  FF1B8A  60            		rts
5344
 7296
5345
 7297                        	; update flash from emulator
5346
 7298  FF1B8B                	Cmd_eflash:
5347
 7299  FF1B8B  A9 E0         		lda	#$E0
5348
 7300  FF1B8D  85 B8         		sta	SMAddrL+2
5349
 7301  FF1B8F  64 B6         		stz	SMAddrL
5350
 7302  FF1B91  64 B7         		stz	SMAddrL+1
5351
 7303  FF1B93  9C 10 FC      		stz	!VIA2+VIAPRB
5352
 7304  FF1B96  8D 0D FC      		sta	!CREMEON
5353
 7305  FF1B99                		INDEX16
5354
 7306  FF1B99  C2 10         		rep	#PXFLAG
5355
 7307                        		.LONGI	on
5356
 7308                        		.MNLIST
5357
 7309  FF1B9B  A0 00 00      	?lp1:	ldy	#0
5358
 7310  FF1B9E  BB            		tyx
5359
 7311  FF1B9F  BF 00 18 01   	?lp2:	lda	>EMURAM,x
5360
 7312  FF1BA3  97 B6         		sta	[SMAddrL],y
5361
 7313  FF1BA5  C8            		iny
5362
 7314  FF1BA6  E8            		inx
5363
 7315  FF1BA7  E0 00 08      		cpx	#$0800
5364
 7316  FF1BAA  90 F3         		bcc	?lp2
5365
 7317  FF1BAC                		ACC16CLC
5366
 7318  FF1BAC  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
5367
 7319                        		.LONGA	on
5368
 7320                        		.MNLIST
5369
 7321  FF1BAE  8A            		txa
5370
 7322  FF1BAF  65 B6         		adc	SMAddrL
5371
 7323  FF1BB1  85 B6         		sta	SMAddrL
5372
 7324  FF1BB3                		ACC08
5373
 7325  FF1BB3  E2 20         		sep	#PMFLAG
5374
 7326                        		.LONGA	off
5375
 7327                        		.MNLIST
5376
 7328  FF1BB5  90 02         		bcc	?nxt
5377
 7329  FF1BB7  E6 B8         		inc	SMAddrL+2
5378
 7330  FF1BB9  EE 10 FC      	?nxt:	inc	!VIA2+VIAPRB
5379
 7331  FF1BBC  D0 DD         		bne	?lp1
5380
 7332  FF1BBE                		CPU08
5381
 7333  FF1BBE  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
5382
 7334                        		.LONGA	off
5383
 7335                        		.LONGI	off
5384
 7336                        		.MNLIST
5385
 7337  FF1BC0  A9 E0         		lda	#$E0		; from bank $E0
5386
 7338  FF1BC2  80 0D         		bra	_flash
5387
 7339
5388
 7340                        	; update flash from file
5389
 7341  FF1BC4                	Cmd_flash:
5390
 7342  FF1BC4  24 EF         		bit	SMFflag
5391
 7343  FF1BC6  30 03         		bmi	?01
5392
 7344  FF1BC8  4C 1B 0A      		jmp	CmdErr3
5393
 7345  FF1BCB  A9 E0         	?01:	lda	#$E0		; from bank $E0
5394
 7346  FF1BCD  80 02         		bra	_flash
5395
  Tue Jul 17 11:00:24 2018                                                                                               Page   88
5396
 
5397
 
5398
 
5399
 
5400
 7347  FF1BCF
5401
 7348                        	; update flash from memory
5402
 7349  FF1BCF                	Cmd_mflash:
5403
 7350  FF1BCF  A9 F8         		lda	#$F8		; from memory
5404
 7351
5405
 7352  FF1BD1                	_flash:
5406
 7353  FF1BD1  85 EE         		sta	SMFsrc
5407
 7354  FF1BD3                		CPU08
5408
 7355  FF1BD3  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
5409
 7356                        		.LONGA	off
5410
 7357                        		.LONGI	off
5411
 7358                        		.MNLIST
5412
 7359  FF1BD5  F4 00 01      		pea	#DP01ADDR	; imposta nuova DP
5413
 7360  FF1BD8  2B            		pld
5414
 7361  FF1BD9  A9 00         		lda	#$00
5415
 7362  FF1BDB  48            		pha
5416
 7363  FF1BDC  AB            		plb
5417
 7364  FF1BDD  8D 07 FC      		sta	!CRFWEON	; enable write flash
5418
 7365  FF1BE0  8D 08 FC      		sta	!CRXFEOFF	; abilita flash banco $F0
5419
 7366  FF1BE3  A2 7F         		ldx	#$7F
5420
 7367  FF1BE5  8E 0E FD      		stx	VIA0+VIAIER	; disabilita interrupt VIA 0
5421
 7368  FF1BE8  8E 0D FD      		stx	VIA0+VIAIFR	; ed azzera tutti i flag
5422
 7369  FF1BEB  8E 1E FD      		stx	VIA1+VIAIER	; disabilita interrupt VIA 1
5423
 7370  FF1BEE  8E 1D FD      		stx	VIA1+VIAIFR	; ed azzera tutti i flag
5424
 7371  FF1BF1  78            		sei
5425
 7372  FF1BF2                		INDEX16
5426
 7373  FF1BF2  C2 10         		rep	#PXFLAG
5427
 7374                        		.LONGI	on
5428
 7375                        		.MNLIST
5429
 7376  FF1BF4  A2 07 00      		ldx	#$07
5430
 7377  FF1BF7  20 97 1A      	_?ff:	jsr	_erase		; erase sector X
5431
 7378  FF1BFA  B0 1A         		bcs	_fail1		; fail sector
5432
 7379  FF1BFC  70 0D         		bvs	?02		; salta settore
5433
 7380  FF1BFE  20 F9 1A      		jsr	_sctrpgm
5434
 7381  FF1C01  B0 2C         		bcs	_fail2		; fail pgm
5435
 7382  FF1C03  70 06         		bvs	?02		; salta settore
5436
 7383  FF1C05  20 65 1C      		jsr	_okbeep
5437
 7384  FF1C08  20 7D 1C      		jsr	_delay
5438
 7385  FF1C0B  CA            	?02:	dex
5439
 7386  FF1C0C  10 E9         		bpl	_?ff
5440
 7387  FF1C0E  A9 80         		lda	#$80
5441
 7388  FF1C10  1C 01 FD      		trb	VIA0+VIAPRA	; reset
5442
 7389  FF1C13  EA            	?03:	nop
5443
 7390  FF1C14  80 FD         		bra	?03
5444
 7391
5445
 7392  FF1C16                	_fail1:
5446
 7393  FF1C16  A9 B0         		lda	#10110000B	; CTC 2 in modo 0 - 2 bytes
5447
 7394  FF1C18  8D 4B FD      		sta	CTC0+CTCCTRL
5448
 7395  FF1C1B  A9 D0         		lda	#<2000
5449
 7396  FF1C1D  8D 4A FD      		sta	CTC0+CTCCNT2
5450
 7397  FF1C20  A9 07         		lda	#>2000
5451
 7398  FF1C22  8D 4A FD      		sta	CTC0+CTCCNT2
5452
 7399  FF1C25  A9 08         		lda	#$08
5453
 7400  FF1C27  1C 2B FD      		trb	PIA0+PIACRB
5454
 7401  FF1C2A  1C 29 FD      		trb	PIA0+PIACRA
5455
 7402                        		;bra	_?ff
5456
 7403  FF1C2D  80 34         		bra	_fail3
5457
  Tue Jul 17 11:00:24 2018                                                                                               Page   89
5458
 
5459
 
5460
 
5461
 
5462
 7404  FF1C2F
5463
 7405  FF1C2F                	_fail2:
5464
 7406  FF1C2F  50 20         		bvc	?10
5465
 7407  FF1C31  A9 B0         		lda	#10110000B		; CTC counter 2 in modo 0 - 2 bytes
5466
 7408  FF1C33  8D 4B FD      		sta	CTC0+CTCCTRL
5467
 7409  FF1C36  A9 76         		lda	#01110110B		; CTC counter 1 in modo 3 - 2 bytes
5468
 7410  FF1C38  8D 4B FD      		sta	CTC0+CTCCTRL
5469
 7411  FF1C3B  A9 90         		lda	#<400			; beep 200ms - pausa 200ms
5470
 7412  FF1C3D  8D 49 FD      		sta	CTC0+CTCCNT1
5471
 7413  FF1C40  A9 01         		lda	#>400
5472
 7414  FF1C42  8D 49 FD      		sta	CTC0+CTCCNT1
5473
 7415  FF1C45  A9 40         		lda	#<1600			; 4 beep
5474
 7416  FF1C47  8D 4A FD      		sta	CTC0+CTCCNT2
5475
 7417  FF1C4A  A9 06         		lda	#>1600
5476
 7418  FF1C4C  8D 4A FD      		sta	CTC0+CTCCNT2
5477
 7419  FF1C4F  80 0A         		bra	?20
5478
 7420  FF1C51  A9 80         	?10:	lda	#<3200			; 4 beep
5479
 7421  FF1C53  8D 4A FD      		sta	CTC0+CTCCNT2
5480
 7422  FF1C56  A9 0C         		lda	#>3200
5481
 7423  FF1C58  8D 4A FD      		sta	CTC0+CTCCNT2
5482
 7424  FF1C5B
5483
 7425  FF1C5B  A9 08         	?20:	lda	#$08			; beep ... beep...
5484
 7426  FF1C5D  0C 2B FD      		tsb	PIA0+PIACRB
5485
 7427  FF1C60  1C 29 FD      		trb	PIA0+PIACRA
5486
 7428                        		;bra	_?ff
5487
 7429  FF1C63                	_fail3:
5488
 7430  FF1C63  80 FE         		bra	_fail3
5489
 7431  FF1C65
5490
 7432  FF1C65                	_okbeep:
5491
 7433  FF1C65  A9 B0         		lda	#10110000B	; CTC 2 in modo 0 - 2 bytes
5492
 7434  FF1C67  8D 4B FD      		sta	CTC0+CTCCTRL
5493
 7435  FF1C6A  A9 96         		lda	#<150
5494
 7436  FF1C6C  8D 4A FD      		sta	CTC0+CTCCNT2
5495
 7437  FF1C6F  A9 00         		lda	#>150
5496
 7438  FF1C71  8D 4A FD      		sta	CTC0+CTCCNT2
5497
 7439  FF1C74  A9 08         		lda	#$08
5498
 7440  FF1C76  1C 2B FD      		trb	PIA0+PIACRB
5499
 7441  FF1C79  1C 29 FD      		trb	PIA0+PIACRA
5500
 7442  FF1C7C  60            		rts
5501
 7443  FF1C7D
5502
 7444  FF1C7D                	_delay:
5503
 7445  FF1C7D  A9 2C         		lda	#<300			; timeout
5504
 7446  FF1C7F  8D 08 FD      		sta	VIA0+VIAT2CL
5505
 7447  FF1C82  A9 01         		lda	#>300
5506
 7448  FF1C84  8D 09 FD      		sta	VIA0+VIAT2CH
5507
 7449  FF1C87  A9 20         	?02:	lda	#T2IFRB
5508
 7450  FF1C89  2C 0D FD      		bit	VIA0+VIAIFR		; test timeout
5509
 7451  FF1C8C  F0 F9         		beq	?02			; loop
5510
 7452  FF1C8E  60            		rts
5511
 7453
5512
 7454                        	;;_startpgm:
5513
 7455                        	;;	jmp	_flash
5514
 7456  FF1C8F
5515
 7457                        	;;_FLASHEND	.EQU	$
5516
 7458                        	;;_FLASHCNT	.EQU	($ - _FLASHSTART)
5517
 7459
5518
 7460  FF1C8F
5519
  Tue Jul 17 11:00:24 2018                                                                                               Page   90
5520
 
5521
 
5522
 
5523
 
5524
 7461                        	;----------------------------------------------------------
5525
 7462                        	; stringhe
5526
 7463
5527
 7464  FF1C8F                	CRSTR:
5528
 7465  FF1C8F  0D 3A 3A 45 4D 		.DB	$0D, '::EM $010000-$011FFF->0 * XM $012000-$013FFF->0'
5529
               20 24 30 31 30
5530
               30 30 30 2D 24
5531
               30 31 31 46 46
5532
               46 2D 3E 30 20
5533
               2A 20 58 4D 20
5534
               24 30 31 32 30
5535
               30 30 2D 24 30
5536
               31 33 46 46 46
5537
               2D 3E 30
5538
 7466  FF1CBF  20 2A 20 46 4D 		.DB	' * FM $F00000-$F7FFFF->0', 0
5539
               20 24 46 30 30
5540
               30 30 30 2D 24
5541
               46 37 46 46 46
5542
               46 2D 3E 30 00
5543
 
5544
 
5545
             Lines Assembled : 6669                  Errors : 0
5546
 
5547
 
5548