Subversion Repositories MB01 Project

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 - 1
  Tue Jul 17 11:00:17 2018                                                                                               Page    1
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
          2500 A.D. 65816 Macro Assembler #26960 - Version 5.02g
10
          -----------------------------------------------------
11
 
12
                       Input  Filename : src\F8\vdc.asm
13
                       Output Filename : obj\F8\vdc.obj
14
                       Listing Has Been Relocated
15
 
16
 
17
 2592                        	.LIST		on
18
 2593
19
 2594  F8FFB1                		.INCLUDE inc\dirp00.inc
20
 2595                        	;----------------------------------------------------------
21
 2596                        	; DIRP00.ASM
22
 2597                        	; PROGETTO: B1601
23
 2598                        	;
24
 2599                        	; Variabili in Direct Page $00
25
 2600                        	;----------------------------------------------------------
26
 2601
27
 2602                        	; sezione COMMON -- questo permette di includere il file in piu' file
28
 2603
29
 2604                        	.LIST on
30
 2605
31
 2606                        	DIRP00:	.SECTION page0, ref_only, common	;Direct-Page 00
32
 2607
33
 2608  000000                		.ABSOLUTE		;; inizia sempre da $00
34
 2609  000000                		.ORG		0x00
35
 2610  000000
36
 2611  000000  0000          	JiffyClk	.DW			; contatore 10ms 32 bit
37
 2612  000002  0000          			.DW
38
 2613  000004                	SysTmr		.DS	SYSTMRCNT	; system timer 0 (10ms)
39
 2614  000008                	SysTMF		.DS	SYSTMRCNT	; flag timer (80 -> start)
40
 2615  00000C  00            	Bnk0Flag	.DB			; <7>: flag test RAM banco 0 ok
41
 2616                        						; <6>: flag warm reset
42
 2617  00000D  00            	RTCFlag		.DB
43
 2618
44
 2619  00000E                	diskstat	.DS	2	; flag device on ata bus #0 & #1
45
 2620                        					; <7>: device ready
46
 2621                        					; <6>: compact flash device (C.F.)
47
 2622                        					; <5>: device identification ok
48
 2623                        					; <4>: MBR loaded
49
 2624                        					; <3>: valid signature in MBR
50
 2625                        					; <2>: first partition found&active
51
 2626                        					; <1>:
52
 2627                        					; <0>: valid partition flag
53
 2628
54
 2629                        					; <7>: device ready
55
 2630                        					; <6>: USB device
56
 2631                        					; <5>: compact flash device (C.F.)
57
 2632                        					; <4>: device identification ok
58
 2633                        					; <3>: MBR loaded
59
 2634                        					; <2>: first partition found&active
60
 2635                        					; <1>: always 1
61
 2636                        					; <0>: valid partition flag
62
 2637  000010
63
  Tue Jul 17 11:00:17 2018                                                                                               Page    2
64
 
65
 
66
 
67
 
68
 2638
69
 2639          00000E        	atadev		.EQU	diskstat
70
 2640
71
 2641  000010                	usbdev		.DS	2	; flag flash disk on usb bus #0
72
 2642                        					; <7>: device plugged and ready
73
 2643                        					; <6>: always 1
74
 2644                        					; <5>: device identification ok
75
 2645                        					; <4>: MBR loaded
76
 2646                        					; <3>: valid signature in MBR
77
 2647                        					; <2>: first partition found&active
78
 2648                        					; <1>:
79
 2649                        					; <0>: valid partition flag
80
 2650
81
 2651  000012                	diskmax		.DS	16	; disk max. sector's
82
 2652          000012        	atasec		.EQU	diskmax
83
 2653          00001A        	usbsec		.EQU	diskmax+8
84
 2654
85
 2655
86
 2656  000022                	atambr		.DS	8	; data for first partition found in mbr
87
 2657                        					; first 3 bytes for start sector of partition
88
 2658                        					; last byte for partition type
89
 2659  00002A                	usbmbr		.DS	8
90
 2660
91
 2661  000032                	ataprt		.DS	8	; total sec's of first partition
92
 2662  00003A                	usbprt		.DS	8	; total sec's of first partition
93
 2663
94
 2664
95
 2665  000042  00            	usb0ch		.DB	; usb0 (ch375/ch376) flag
96
 2666                        				; <7>: module on
97
 2667                        				; <6>: ch376 flag
98
 2668                        				; <5:0>: chip version
99
 2669
100
 2670  000043  00            	usb0st		.DB	; usb0 status
101
 2671                        				; <7>: usb0 host mode ok
102
 2672                        				; <6>: flash disk attached flag
103
 2673                        				; <5>: usb device attached
104
 2674
105
 2675  000044  00            	fdcdrv		.DB		; phisycal drive status (drive #0)
106
 2676                        					; <7>: disk format established in bit 0&1
107
 2677                        					; <6>: double step seek done
108
 2678                        					; <5>: trust format bit's (set after ok r/w)
109
 2679                        					; <4>: write protect bit (if disk in drive)
110
 2680                        					; <3>: don't care
111
 2681                        					; <2>: don't care
112
 2682                        					; <1>: HD disk if set else DD disk
113
 2683                        					; <0>: CBM format if set else IBM format
114
 2684
115
 2685  000045  00            	vdrive		.DB		; virtual drive status (ram disk, drive #1)
116
 2686                        					; <7>: disk format established in bit 0&1
117
 2687                        					; <6>: change disk simulation (after format)
118
 2688                        					; <5>: don't care
119
 2689                        					; <4>: write protect bit (under sw control)
120
 2690                        					; <3>: don't care
121
 2691                        					; <2>: don't care
122
 2692                        					; <1>: HD disk if set else DD disk
123
 2693                        					; <0>: CBM format if set else IBM format
124
 2694
125
  Tue Jul 17 11:00:17 2018                                                                                               Page    3
126
 
127
 
128
 
129
 
130
 2695  000046  00            	fdcctl		.DB		; fdc controller status
131
 2696                        					; <7>: drive is attached
132
 2697                        					; <6>: drive need recalibration (restore)
133
 2698                        					; <5>: FDC controller ok
134
 2699                        					; <4>: motor on
135
 2700                        					; <3>: dma is active
136
 2701                        					; <2>: dma chip ok (post routine)
137
 2702                        					; <1>: clock rate (1=HD,0=DD)
138
 2703                        					; <0>: disk ready
139
 2704
140
 2705  000047  00            	fdctrk		.DB		; fd: current seek track
141
 2706  000048  00            	fdcerr		.DB		; fd: last error code
142
 2707  000049  00            	ataerr		.DB		; ata: last error code
143
 2708  00004A  00            	ataxer		.DB		; ata: last extended error code
144
 2709
145
 2710  00004B  00            	CtrlBrk		.DB		; flag CTRL+BREAK (NMI)
146
 2711
147
 2712  00004C  0000          	MemTop		.DW		; top memoria RAM
148
 2713  00004E  00            			.DB		; banco top mem
149
 2714
150
 2715  00004F  00            	DflTxtIn	.DB		; device di default text input
151
 2716  000050  00            	DflTxtOut	.DB		; device di default text output
152
 2717
153
 2718  000051                	COPPtr		LP		; long pointer for COP decoding
154
 2719  000054  00            	COPIdx		.DB		; COP signature/index
155
 2720
156
 2721  000055  00            	BiosEnt		.DB		; flag accesso a bios setup
157
 2722
158
 2723                        	; variabili utilizzate da ACIA
159
 2724  000056                	spwrk		.DS	$30
160
 2725
161
 2726                        	; bios mem
162
 2727  000086  0000          	nsize		.DW	; dimensione blocco da allocare
163
 2728                        	;bsize		.DW	; dimensione vera blocco free
164
 2729  000088  0000          	splitsz		.DW	; dimensione blocco splittato
165
 2730  00008A  0000          	bfree		.DW	; puntatore blocco free
166
 2731  00008C  0000          	hdrptr		.DW	; puntatore header heap
167
 2732
168
 2733  00008E  0000          	pbrklv		.DW	; current break level of current process
169
 2734  000090  0000          	pbrkmin		.DW	; minimum breal level of current process
170
 2735  000092  0000          	pbrkmax		.DW	; maximum breal level of current process
171
 2736  000094
172
 2737                        	; bios temp. work area
173
 2738  000094                	bwrktmp		.DS	$28
174
 2739
175
 2740  0000BC  00            	coptmp		.DB	; temp. used while cop
176
 2741
177
 2742  0000BD  00            	tstser		.DB	; check ser/usb test board post
178
 2743                        				; <7>: VIA2 ok
179
 2744                        				; <6>: PICRAM ok
180
 2745                        				; <1>: UART 16C550 ok
181
 2746                        				; <0>: R65C51 ok
182
 2747
183
 2748
184
 2749                        	;crc16		.DW
185
 2750
186
 2751  0000BD                		.RELATIVE
187
  Tue Jul 17 11:00:17 2018                                                                                               Page    4
188
 
189
 
190
 
191
 
192
 2752
193
 2753                        		.ENDS
194
 2754
195
 2755          [01]          	.IFDEF		_ACIA_INC_
196
 2756                        		.INCLUDE INC\SP.INC
197
 2757          [00]          	.ENDIF
198
 2758
199
 2772                        	.LIST on
200
 2773
201
 2774          000060        	KBDBUFLEN	.EQU	96		; dimensione buffer di tastiera
202
 2775
203
 2776                        	DIRP01:	.SECTION page0, ref_only, common	;Direct-Page 01
204
 2777
205
 2778  000000                		.ABSOLUTE		;; inizia sempre da $00
206
 2779  000000                		.ORG		0x00
207
 2780
208
 2781  000000
209
 2782  000000                	KbdBuf		.DS	KBDBUFLEN	; buffer della tastiera
210
 2783  000060  00            	KbdITail	.DB			; coda buffer tastiera
211
 2784  000061  00            	KbdIHead	.DB			; testa buffer tastiera
212
 2785  000062  00            	KbdCnt		.DB			; numero bytes nel buffer
213
 2786  000063  00            	KbdShift	.DB
214
 2787  000064  00            	KbdFlag		.DB
215
 2788  000065  00            	KbdToggle	.DB
216
 2789  000066  00            	KbdSt		.DB			; status tastiera dopo reset
217
 2790  000067  00            	PS2Ctl		.DB			; flag controller PS2 keyboard
218
 2791
219
 2792  000068  00            	LCDFlag		.DB
220
 2793  000069  00            	LCDTmp		.DB
221
 2794  00006A  0000          	LCDVal		.DW
222
 2795
223
 2796  00006C  00            	VBBFlag		.DB		; flag video board
224
 2797  00006D  00            	VBBRam		.DB		; flag video RAM
225
 2798
226
 2799  00006E  00            	ScnLinTmp	.DB
227
 2800  00006F  00            	ScnChBase	.DB		; base video ram VDC
228
 2801  000070  00            	ScnAttBase	.DB		; base ram attributi VDC
229
 2802  000071  00            	ScnCursMode	.DB		; VDC cursore default
230
 2803  000072  00            	ScnSaveAttr	.DB
231
 2804  000073  00            	ScnInsert	.DB
232
 2805  000074  00            	ScnAutoIns	.DB		; bit 7 -> autoins - bit 6 -> modo input
233
 2806  000075  00            	ScnScroll	.DB
234
 2807  000076  00            	ScnMaxRow	.DB		; max. righe finestra (-1)
235
 2808  000077  00            	ScnMaxCols	.DB		; max. colonne finestra (-1)
236
 2809
237
 2810  000078                	ScnMapTabs1	.DS	10
238
 2811  000082                	ScnMapTabs2	.DS	4
239
 2812  000086
240
 2813  000086  0000          	ScnPtr		.DW		; puntatore video ram linea corrente
241
 2814  000088  00            			.DB
242
 2815
243
 2816  000089  00            	ScnFiltLen	.DB		; lunghezza set caratteri filtro
244
 2817
245
 2818  00008A  0000          	ScnAtPtr	.DW		; puntatore attributi ram linea corrente
246
 2819  00008C  00            			.DB
247
 2820
248
 2821  00008D  00            	ScnTmpx		.DB		; temporaneo: durante put char
249
  Tue Jul 17 11:00:17 2018                                                                                               Page    5
250
 
251
 
252
 
253
 
254
 2822  00008E
255
 2823  00008E  00            	ScnTop		.DB		; riga superiore finestra
256
 2824  00008F  00            	ScnLeft		.DB		; colonna sinistra finestra
257
 2825  000090  00            	ScnBottom	.DB		; riga inferiore finestra
258
 2826  000091  00            	ScnRight	.DB		; colonna destra finestra
259
 2827  000092  00            	ScnAttr		.DB		; attributo default
260
 2828  000093  00            	ScnAttr2	.DB		; attributo alternativo
261
 2829  000094  00            	ScnRow		.DB		; riga cursore
262
 2830  000095  00            	ScnCol		.DB		; colonna cursore
263
 2831  000096  00            	ScnRowStart	.DB		; riga di start input
264
 2832  000097  00            	ScnInput	.DB		; riga di fine input
265
 2833  000098  00            	ScnColStart	.DB		; colonna di start input
266
 2834  000099  00            	ScnSaveX	.DB
267
 2835  00009A  00            	ScnSaveY	.DB
268
 2836  00009B  00            	ScnTmpL		.DB
269
 2837  00009C  00            	ScnTmpH		.DB
270
 2838  00009D  00            	ScnSaveRow	.DB
271
 2839  00009E  00            	ScnSaveCol	.DB
272
 2840  00009F  00            	ScnCurChr	.DB
273
 2841  0000A0  00            	ScnLstChr	.DB
274
 2842  0000A1  00            	ScnCR		.DB
275
 2843  0000A2  0000          	ScnPrm		.DW		; puntatore long utilizzato da print imm
276
 2844  0000A4  00            			.DB		; banco puntatore ScnPrm
277
 2845  0000A5  00            	ScnMode		.DB		; flag modo schermo
278
 2846
279
 2847  0000A6                	ScnPtr1		LP
280
 2848
281
 2849  0000A9  00            	ScnDefCol	.DB		; default foreground color
282
 2850
283
 2851  0000AA                	ScnPtr2		LP
284
 2852
285
 2853  0000AD  00            	ScnDefBkgCol	.DB		; default background color
286
 2854  0000AE  00            	ScnInpRow	.DB		; modo input line: riga start input
287
 2855  0000AF  00            	ScnInpCol	.DB		; modo input line: colonna start input
288
 2856  0000B0  00            	ScnLstRow	.DB		; modo input line: riga stop input
289
 2857  0000B1  00            	ScnLstCol	.DB		; modo input line: colonna stop input
290
 2858  0000B2  00            	ScnFlag		.DB		; Bit 7: input line - Bit 6: input riga unica
291
 2859  0000B3  00            	ScnMask		.DB		; flag tasti funzione editor di linea
292
 2860  0000B4  00            	ScnFilt		.DB		; filtro tasti editor di linea
293
 2861  0000B5  00            	ScnCntrl	.DB		; flag ASCII/CONTROL
294
 2862                        	;DflTxtIn	.DB		; device di default text input
295
 2863                        	;DflTxtOut	.DB		; device di default text output
296
 2864  0000B6
297
 2865          000047        	SCNCLRLEN	.EQU	($ - ScnLinTmp - 1)
298
 2866
299
 2867                        	;SCNCLRLEN	.EQU	(DflTxtOut - ScnLinTmp)
300
 2868
301
 2869                        	; variabili monitor
302
 2870  0000B6  00            	SMAddrL		.DB	; address low/high
303
 2871  0000B7  00            	SMAddrH		.DB
304
 2872  0000B8  00            	SMAddrK		.DB	; address bank
305
 2873  0000B9  00            	SMFlag32	.DB	; flag parametro 32 bit
306
 2874  0000BA  00            	SMTmpL		.DB	; temp. low/high
307
 2875  0000BB  00            	SMTmpH		.DB
308
 2876  0000BC  00            	SMTmpK		.DB	; temp. bank
309
 2877  0000BD  00            	SMTmpKK		.DB	; high byte param. 32 bit
310
 2878  0000BE  00            	SMSizeL		.DB	; size low/high
311
  Tue Jul 17 11:00:17 2018                                                                                               Page    6
312
 
313
 
314
 
315
 
316
 2879  0000BF  00            	SMSizeH		.DB
317
 2880  0000C0  00            	SMSizeK		.DB	; size bank
318
 2881  0000C1  00            	SMXAddrL	.DB	; address low/high XM
319
 2882  0000C2  00            	SMXAddrH	.DB
320
 2883  0000C3  00            	SMXAddrK	.DB	; address bank XM
321
 2884  0000C4  00            	SMbndx		.DB	; indice input buffer
322
 2885  0000C5  00            	SMnprm		.DB	; numero parametri riga di comando
323
 2886  0000C6  00            	SMdumb		.DB
324
 2887  0000C7  00            	SMkr		.DB
325
 2888  0000C8  0000          	SMpc		.DW
326
 2889  0000CA  00            	SMsr		.DB
327
 2890  0000CB  00            	SMbr		.DB
328
 2891  0000CC  0000          	SMdp		.DW
329
 2892  0000CE  0000          	SMac		.DW
330
 2893  0000D0  0000          	SMxr		.DW
331
 2894  0000D2  0000          	SMyr		.DW
332
 2895  0000D4  0000          	SMsp		.DW
333
 2896
334
 2897  0000D6  00            	SMAuxL		.DB
335
 2898  0000D7  00            	SMAuxH		.DB
336
 2899
337
 2900  0000D8  00            	asmlong		.DB	; flag for CPU in 16 mode
338
 2901                        				; <7> -> A/M in 16 bit mode
339
 2902                        				; <6> -> X/Y in 16 bit mode
340
 2903  0000D9  00            	asmcpu		.DB	; <7> -> 8 bit family
341
 2904                        				; <6> -> 65C02 cmos version
342
 2905
343
 2906  0000DA  00            	SMctx		.DB	; context (if = $00 no quit command)
344
 2907  0000DB                	SMrsm		LP	; long pointer to resume caller context
345
 2908
346
 2909  0000DE  00            	rtcadr		.DB	; rtc internal ram address
347
 2910  0000DF  00            	rtcbnk		.DB	; RTC internal bank ram
348
 2911  0000E0  00            	cmdlin		.DB	;
349
 2912  0000E1  00            	SMesc		.DB
350
 2913
351
 2914  0000E2                	SMXTmp:		.DS	26	; 26 bytes tmp
352
 2915
353
 2916          0000E2        	SMTmp2		.EQU	SMXTmp
354
 2917          0000E4        	SMTmp3		.EQU	SMXTmp+2
355
 2918          0000E6        	SMdwTmp1	.EQU	SMXTmp+4
356
 2919          0000EA        	SMdwTmp2	.EQU	SMXTmp+8
357
 2920          0000EE        	SMFsrc		.EQU	SMXTmp+12	; source bank for flash update
358
 2921          0000EF        	SMFflag		.EQU	SMXTmp+13	; flag file for flash update
359
 2922          0000F0        	SMXPos2		.EQU	SMXTmp+14
360
 2923          0000F1        	SMYPos2		.EQU	SMXTmp+15
361
 2924          0000F2        	SMXPos3		.EQU	SMXTmp+16
362
 2925          0000F3        	SMYPos3		.EQU	SMXTmp+17
363
 2926                        	;SMAuxL		.EQU	SMXTmp+18
364
 2927                        	;SMAuxH		.EQU	SMXTmp+19
365
 2928          0000F6        	SMXPos		.EQU	SMXTmp+20
366
 2929          0000F7        	SMYPos		.EQU	SMXTmp+21
367
 2930          0000F8        	SMdwTmp3	.EQU	SMXTmp+22
368
 2931
369
 2932          0000E2        	atcmd		.EQU	SMXTmp		; save @ command
370
 2933          0000E3        	atnum		.EQU	SMXTmp+1	; @ command index
371
 2934          0000E4        	atflag		.EQU	SMXTmp+2	; @ L,S,V,R,W start address flag
372
 2935          0000E5        	atbnk		.EQU	SMXTmp+3	; @ L,S,V,R,W bank
373
  Tue Jul 17 11:00:17 2018                                                                                               Page    7
374
 
375
 
376
 
377
 
378
 2936          0000E6        	atstr		.EQU	SMXTmp+4	; @ command string start (word)
379
 2937          0000E8        	atstart		.EQU	SMXTmp+6	; @ L,S,V,R,W start address (word)
380
 2938          0000EA        	atend		.EQU	SMXTmp+8	; @ S,W end address (word)
381
 2939          0000EC        	atbuf		.EQU	SMXTmp+10	; @ local buffer pointer (word)
382
 2940          0000EE        	atipb		.EQU	SMXTmp+12	; @ bank of input buffer
383
 2941          0000EF        	atdir		.EQU	SMXTmp+13	; @ load dir flag
384
 2942          0000F0        	atptr		.EQU	SMXTmp+14	; @ load dir pointer (word)
385
 2943          0000F2        	atsiz		.EQU	SMXTmp+16	; @ buffer size (word)
386
 2944          0000F5        	atlp		.EQU	SMXTmp+19	; @ long pointer
387
 2945          0000F8        	atsa		.EQU	SMXTmp+22	; @ sa
388
 2946
389
 2947          0000E2        	btmpx		.EQU	SMXTmp		; asc2bin conversion
390
 2948          0000E3        	brtcsec		.EQU	SMXTmp+1
391
 2949          0000E4        	brtcmin		.EQU	SMXTmp+2
392
 2950          0000E5        	brtchour	.EQU	SMXTmp+3
393
 2951          0000E6        	brtcday		.EQU	SMXTmp+4
394
 2952          0000E7        	brtcmonth	.EQU	SMXTmp+5
395
 2953          0000E8        	brtcyear	.EQU	SMXTmp+6
396
 2954          0000E9        	brtcct		.EQU	SMXTmp+7
397
 2955
398
 2956
399
 2957  0000FC                		.RELATIVE
400
 2958
401
 2959                        		.ENDS
402
 2960
403
 2964                        		.LIST on
404
 2965
405
 2966          000010        	CHARWIDTH	.EQU	$10	; ampiezza max. carattere
406
 2967          000008        	CGAWIDTH	.EQU	$08
407
 2968          00000E        	EGAWIDTH	.EQU	$0E
408
 2969          000010        	VGAWIDTH	.EQU	$10
409
 2970
410
 2971          000007        	CURSLINE	.EQU	$07
411
 2972          000060        	DEFCURS		.EQU	$60
412
 2973          000007        	DEFATTR		.EQU	$07
413
 2974          000000        	DEFCURS2	.EQU	$00	; cursore fisso HD6445
414
 2975          000000        	DEFATTR2	.EQU	$00	; palette di default
415
 2976  F8FFB1
416
 2977
417
 2978                        		.CODEF8
418
 2979  F8A207
419
 2980                        		.GLOBAL VDCSetup, VDCREG16, cinit
420
 2981                        		.GLOBAL _ScnCharOut, _ScnCharIn, _ScnInit, GetSetPos, GetBufKey
421
 2982  F8A207
422
 2983                        		.EXTERN VGA8x8L, VGA8x8H
423
 2984  F8A207
424
 2985                        		.LONGA	off
425
 2986                        		.LONGI	off
426
 2987  F8A207
427
 2988                        	;--------------------------------------------------------------------
428
 2989
429
 2990                        	; Setup VDC
430
 2991                        	; USA A,B,X,Y
431
 2992  F8A207                	VDCSetup:
432
 2993  F8A207  08            		php			; salva status
433
 2994  F8A208  0B            		phd			; salva DP
434
 2995  F8A209  8B            		phb			; salva registro DBR
435
  Tue Jul 17 11:00:17 2018                                                                                               Page    8
436
 
437
 
438
 
439
 
440
 2996  F8A20A                		CPU08			; imposta registri a 8 bit
441
 2997  F8A20A  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
442
 2998                        		.LONGA	off
443
 2999                        		.LONGI	off
444
 3000                        		.MNLIST
445
 3001  F8A20C  A9 01         		lda	#>DP01ADDR	; imposta nuova DP
446
 3002  F8A20E  EB            		xba			; DP Hi
447
 3003  F8A20F  A9 00         		lda	#0
448
 3004  F8A211  5B            		tcd
449
 3005  F8A212  48            		pha			; imposta DBR = 0
450
 3006  F8A213  AB            		plb
451
 3007  F8A214  20 2B AE      		jsr	SetVDCFont
452
 3008  F8A217  AB            		plb			; ripristina DBR
453
 3009  F8A218  2B            		pld			; ripristina DP
454
 3010  F8A219  28            		plp			; ripristina status
455
 3011  F8A21A  60            		rts
456
 3012
457
 3013
458
 3014  F8A21B                	GetBufKey:
459
 3015  F8A21B  08            		php
460
 3016  F8A21C  0B            		phd
461
 3017  F8A21D  F4 00 01      		pea	#DP01ADDR
462
 3018  F8A220  2B            		pld
463
 3019  F8A221                		CPU08
464
 3020  F8A221  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
465
 3021                        		.LONGA	off
466
 3022                        		.LONGI	off
467
 3023                        		.MNLIST
468
 3024  F8A223  20 17 A5      		jsr	_GetBufKey
469
 3025  F8A226  2B            		pld
470
 3026  F8A227  28            		plp
471
 3027  F8A228  60            		rts
472
 3028
473
 3029  F8A229                	COP_KeybGet:
474
 3030                        		.GLOBAL COP_KeybGet
475
 3031
476
 3032  F8A229  0B            		phd
477
 3033  F8A22A  F4 00 01      		pea	#DP01ADDR
478
 3034  F8A22D  2B            		pld
479
 3035  F8A22E  38            		sec			; no char
480
 3036  F8A22F  A5 62         		lda	KbdCnt		; char disponibili nel buffer tastiera ?
481
 3037  F8A231  F0 0A         		beq	?10		; no
482
 3038  F8A233  20 17 A5      		jsr	_GetBufKey	; preserve CF
483
 3039  F8A236  AA            		tax			; code
484
 3040  F8A237  98            		tya			; flag
485
 3041  F8A238  89 40         		bit	#$40		; test bit <6>
486
 3042  F8A23A  D0 01         		bne	?10		; rilascio - ignora
487
 3043  F8A23C  18            		clc			; OK -- tasto disponibile
488
 3044  F8A23D  2B            	?10:	pld			; restore DP
489
 3045  F8A23E  90 02         		bcc	?12
490
 3046  F8A240  A2 00         		ldx	#$00
491
 3047  F8A242  83 0E         	?12:	sta	STKCR+1,s	; flag control key
492
 3048  F8A244  8A            		txa
493
 3049  F8A245  83 0D         		sta	STKCR,s		; key code
494
 3050  F8A247  18            		clc
495
 3051  F8A248  6B            		rtl
496
 3052
497
  Tue Jul 17 11:00:17 2018                                                                                               Page    9
498
 
499
 
500
 
501
 
502
 3053  F8A249                	COP_ScnCtl:
503
 3054                        		.GLOBAL COP_ScnCtl
504
 3055
505
 3056  F8A249                		ACC16			; retrieve function number
506
 3057  F8A249  C2 20         		rep	#PMFLAG
507
 3058                        		.LONGA	on
508
 3059                        		.MNLIST
509
 3060  F8A24B  A3 10         		lda	STKPCL,s	; pointer to byte after signature
510
 3061  F8A24D  85 51         		sta	COPPtr
511
 3062  F8A24F  1A            		inc	a		; update return address
512
 3063  F8A250  83 10         		sta	STKPCL,s
513
 3064  F8A252                		ACC08			; A,M -> 8 bit
514
 3065  F8A252  E2 20         		sep	#PMFLAG
515
 3066                        		.LONGA	off
516
 3067                        		.MNLIST
517
 3068  F8A254  A3 12         		lda	STKPBR,s	; bank where was executed cop instruction
518
 3069  F8A256  85 53         		sta	COPPtr+2
519
 3070  F8A258  A7 51         		lda	[COPPtr]	; byte after signature
520
 3071  F8A25A  F4 00 01      		pea	#DP01ADDR
521
 3072  F8A25D  2B            		pld
522
 3073  F8A25E  AA            		tax
523
 3074  F8A25F  F0 1F         		beq	?38		; X = 0 -> init screen
524
 3075  F8A261  CA            		dex
525
 3076  F8A262  F0 17         		beq	?36		; X = 1 -> clear screen
526
 3077  F8A264  CA            		dex
527
 3078  F8A265  F0 1E         		beq	?42		; X = 2 -> get cursor position
528
 3079  F8A267  CA            		dex
529
 3080  F8A268  F0 2D         		beq	?44		; X = 3 -> set cursor position
530
 3081  F8A26A  CA            		dex
531
 3082  F8A26B  F0 36         		beq	?46		; X = 4 -> get screen org
532
 3083  F8A26D  CA            		dex
533
 3084  F8A26E  F0 3E         		beq	?48		; X = 5 -> get keyboard flag
534
 3085  F8A270  CA            		dex
535
 3086  F8A271  F0 45         		beq	?50		; X = 6 -> clear keyboard buffer & ctrl break
536
 3087  F8A273  CA            		dex
537
 3088  F8A274  F0 4F         		beq	?52		; X = 7 -> get ctrl break flag
538
 3089  F8A276  CA            		dex
539
 3090  F8A277  F0 66         		beq	?60		; X = 8 -> fill keyboard buffer
540
 3091  F8A279  18            		clc
541
 3092  F8A27A  6B            		rtl
542
 3093  F8A27B  20 55 A3      	?36:	jsr	WndClr
543
 3094  F8A27E  80 03         		bra	?40
544
 3095  F8A280  20 08 A3      	?38:	jsr	cinit
545
 3096  F8A283  18            	?40:	clc
546
 3097  F8A284  6B            		rtl
547
 3098  F8A285  38            	?42:	sec			; get pos
548
 3099  F8A286  20 97 AC      		jsr	GetSetPos
549
 3100  F8A289  A9 00         		lda	#0
550
 3101  F8A28B  83 0C         	?43:	sta	STKXR+1,s
551
 3102  F8A28D  83 0A         		sta	STKYR+1,s
552
 3103  F8A28F  8A            		txa
553
 3104  F8A290  83 0B         		sta	STKXR,s
554
 3105  F8A292  98            		tya
555
 3106  F8A293  83 09         		sta	STKYR,s
556
 3107  F8A295  18            		clc
557
 3108  F8A296  6B            		rtl
558
 3109  F8A297  A3 0B         	?44:	lda	STKXR,s
559
  Tue Jul 17 11:00:17 2018                                                                                               Page   10
560
 
561
 
562
 
563
 
564
 3110  F8A299  AA            		tax
565
 3111  F8A29A  A3 09         		lda	STKYR,s
566
 3112  F8A29C  A8            		tay
567
 3113  F8A29D  18            		clc			; set pos
568
 3114  F8A29E  20 97 AC      		jsr	GetSetPos
569
 3115  F8A2A1  18            		clc
570
 3116  F8A2A2  6B            		rtl
571
 3117  F8A2A3  20 88 AC      	?46:	jsr	GetWndOrg
572
 3118  F8A2A6  83 0D         		sta	STKCR,s
573
 3119  F8A2A8  A9 00         	?47:	lda	#0
574
 3120  F8A2AA  83 0E         		sta	STKCR+1,s
575
 3121  F8A2AC  80 DD         		bra	?43
576
 3122  F8A2AE  78            	?48:	sei
577
 3123  F8A2AF  A5 64         		lda	KbdFlag
578
 3124  F8A2B1  A6 65         		ldx	KbdToggle
579
 3125  F8A2B3  A4 63         		ldy	KbdShift
580
 3126  F8A2B5  58            		cli
581
 3127  F8A2B6  80 F0         		bra	?47
582
 3128  F8A2B8  78            	?50:	sei
583
 3129  F8A2B9  64 62         		stz	KbdCnt		; clear keyboard buffer
584
 3130  F8A2BB  64 60         		stz	KbdITail
585
 3131  F8A2BD  64 61         		stz	KbdIHead
586
 3132  F8A2BF  9C 4B 00      		stz	!CtrlBrk	; clear ctrl break/alt sysreq flags
587
 3133  F8A2C2  58            		cli
588
 3134  F8A2C3  18            		clc
589
 3135  F8A2C4  6B            		rtl
590
 3136  F8A2C5  AD 4B 00      	?52:	lda	!CtrlBrk
591
 3137  F8A2C8  29 80         		and	#$80		; check bit 7
592
 3138  F8A2CA  F0 0B         		beq	?54
593
 3139  F8A2CC  1C 4B 00      		trb	!CtrlBrk	; clear flag
594
 3140  F8A2CF  78            		sei
595
 3141  F8A2D0  64 62         		stz	KbdCnt		; clear keyboard buffer
596
 3142  F8A2D2  64 60         		stz	KbdITail
597
 3143  F8A2D4  64 61         		stz	KbdIHead
598
 3144  F8A2D6  58            		cli
599
 3145  F8A2D7  83 0D         	?54:	sta	STKCR,s		; A = $80 or $00
600
 3146  F8A2D9  A9 00         		lda	#0
601
 3147  F8A2DB  83 0E         		sta	STKCR+1,s
602
 3148  F8A2DD  18            		clc
603
 3149  F8A2DE  6B            		rtl
604
 3150  F8A2DF  A3 0D         	?60:	lda	STKCR,s		; CX -> pointer
605
 3151  F8A2E1  85 A2         		sta	ScnPrm
606
 3152  F8A2E3  A3 0E         		lda	STKCR+1,s
607
 3153  F8A2E5  85 A3         		sta	ScnPrm+1
608
 3154  F8A2E7  A3 0B         		lda	STKXR,s
609
 3155  F8A2E9  85 A4         		sta	ScnPrm+2
610
 3156  F8A2EB  A0 00         		ldy	#0
611
 3157  F8A2ED  9B            		txy
612
 3158  F8A2EE  78            		sei
613
 3159  F8A2EF  B7 A2         	?62:	lda	[ScnPrm],y
614
 3160  F8A2F1  F0 09         		beq	?64
615
 3161  F8A2F3  95 01         		sta	<KbdBuf+1,x	; key code
616
 3162  F8A2F5  74 00         		stz	<KbdBuf,x	; key pressed
617
 3163  F8A2F7  E8            		inx
618
 3164  F8A2F8  E8            		inx
619
 3165  F8A2F9  C8            		iny
620
 3166  F8A2FA  D0 F3         		bne	?62
621
  Tue Jul 17 11:00:17 2018                                                                                               Page   11
622
 
623
 
624
 
625
 
626
 3167  F8A2FC  86 62         	?64:	stx	<KbdCnt
627
 3168  F8A2FE  86 60         		stx	<KbdITail
628
 3169  F8A300  64 61         		stz	<KbdIHead
629
 3170  F8A302  A9 80         		lda	#$80		; disable auto insert when fill buffer
630
 3171  F8A304  14 74         		trb	ScnAutoIns
631
 3172  F8A306  18            		clc
632
 3173  F8A307  6B            		rtl
633
 3174  F8A308
634
 3175                        	;--------------------------------------------------------------------
635
 3176
636
 3177                        	; inizializza screen editor
637
 3178  F8A308                	cinit:
638
 3179  F8A308  A2 47         		ldx	#SCNCLRLEN		; warm reset: azzera variabili
639
 3180  F8A30A  74 6E         	?01:	stz	ScnLinTmp,x
640
 3181  F8A30C  CA            		dex
641
 3182  F8A30D  10 FB         		bpl	?01
642
 3183  F8A30F  A9 18         	?02:	lda	#$18
643
 3184  F8A311  85 76         		sta	ScnMaxRow
644
 3185  F8A313  A9 4F         		lda	#$4F
645
 3186  F8A315  85 77         		sta	ScnMaxCols
646
 3187  F8A317  A9 07         		lda	#DEFATTR
647
 3188  F8A319  24 6D         		bit	VBBRam
648
 3189  F8A31B  10 02         		bpl	?02a
649
 3190  F8A31D  A9 00         		lda	#DEFATTR2
650
 3191  F8A31F  85 92         	?02a:	sta	ScnAttr
651
 3192  F8A321  85 93         		sta	ScnAttr2
652
 3193  F8A323  A9 40         		lda	#$40
653
 3194  F8A325  A2 48         		ldx	#$48
654
 3195  F8A327  24 6D         		bit	VBBRam
655
 3196  F8A329  10 04         		bpl	?02b
656
 3197  F8A32B  A9 00         		lda	#$00
657
 3198  F8A32D  A2 08         		ldx	#$08
658
 3199  F8A32F  85 6F         	?02b:	sta	ScnChBase
659
 3200  F8A331  86 70         		stx	ScnAttBase
660
 3201  F8A333  A9 60         		lda	#DEFCURS
661
 3202  F8A335  24 6D         		bit	VBBRam
662
 3203  F8A337  10 02         		bpl	?02c
663
 3204  F8A339  A9 00         		lda	#DEFCURS2
664
 3205  F8A33B  85 71         	?02c:	sta	ScnCursMode
665
 3206  F8A33D  A9 40         		lda	#$40
666
 3207  F8A33F  85 75         		sta	ScnScroll
667
 3208  F8A341  A9 80         		lda	#$80
668
 3209  F8A343  85 74         		sta	ScnAutoIns
669
 3210  F8A345  A9 01         		lda	#$01		; long puntatore video RAM VB
670
 3211  F8A347  85 88         		sta	ScnPtr+2
671
 3212  F8A349  85 8C         		sta	ScnAtPtr+2
672
 3213  F8A34B  85 A8         		sta	ScnPtr1+2
673
 3214  F8A34D  85 AC         		sta	ScnPtr2+2
674
 3215                        		;lda	#TXTD_SCN
675
 3216                        		;sta	!DflTxtOut
676
 3217                        		;stz	!DflTxtIn
677
 3218                        		;lda	#HISTSTART
678
 3219                        		;sta	HistEnd+1
679
 3220                        		;sta	HistCur+1
680
 3221                        		;stz	HistEnd
681
 3222                        		;stz	HistCur
682
 3223                        		;jsr	_Test
683
  Tue Jul 17 11:00:17 2018                                                                                               Page   12
684
 
685
 
686
 
687
 
688
 3224  F8A34F  20 59 AA      		jsr	SetDefTabs
689
 3225  F8A352  20 7E AA      		jsr	SetMaxWnd
690
 3226
691
 3227                        	; Cancella finestra corrente
692
 3228  F8A355                	WndClr:
693
 3229  F8A355  20 63 A3      		jsr	WndHome
694
 3230  F8A358  20 71 A3      	?01:	jsr	WndGetAddrX
695
 3231  F8A35B  20 89 A7      		jsr	ClrRow
696
 3232  F8A35E  E4 90         		cpx	ScnBottom
697
 3233  F8A360  E8            		inx
698
 3234  F8A361  90 F5         		bcc	?01
699
 3235  F8A363
700
 3236                        	; Posizione puntatore al margine sinistro superiore
701
 3237  F8A363                	WndHome:
702
 3238  F8A363  A6 8E         		ldx	ScnTop
703
 3239  F8A365  86 94         		stx	ScnRow
704
 3240  F8A367  86 96         		stx	ScnRowStart
705
 3241  F8A369
706
 3242                        	; Posiziona puntatore al margine sinistro
707
 3243  F8A369                	WndLeft:
708
 3244  F8A369  A4 8F         		ldy	ScnLeft
709
 3245  F8A36B  84 95         		sty	ScnCol
710
 3246  F8A36D  84 98         		sty	ScnColStart
711
 3247  F8A36F
712
 3248                        	; Ricava indirizzo fisico riga corrente
713
 3249  F8A36F                	WndGetAddr:
714
 3250  F8A36F  A6 94         		ldx	ScnRow
715
 3251  F8A371
716
 3252                        	; Ricava indirizzo fisico riga X
717
 3253  F8A371                	WndGetAddrX:
718
 3254  F8A371  BF 9A AE F8   		lda	>SCRNADDRL,x		; forza ABS LONG
719
 3255  F8A375  85 86         		sta	ScnPtr
720
 3256  F8A377  BF B3 AE F8   		lda	>SCRNADDRH,x
721
 3257  F8A37B  05 6F         		ora	ScnChBase
722
 3258  F8A37D  85 87         		sta	ScnPtr+1
723
 3259  F8A37F
724
 3260  F8A37F                	WndGetAddr2:
725
 3261  F8A37F  A5 86         		lda	ScnPtr
726
 3262  F8A381  85 8A         		sta	ScnAtPtr
727
 3263  F8A383  A5 87         		lda	ScnPtr+1
728
 3264  F8A385  29 07         		and	#$07
729
 3265  F8A387  05 70         		ora	ScnAttBase
730
 3266  F8A389  85 8B         		sta	ScnAtPtr+1
731
 3267  F8A38B  60            		rts
732
 3268
733
 3269  F8A38C                	WndEnd:
734
 3270  F8A38C  A6 90         		ldx	ScnBottom
735
 3271  F8A38E  86 94         		stx	ScnRow
736
 3272  F8A390  86 96         		stx	ScnRowStart
737
 3273  F8A392  80 D5         		bra	WndLeft
738
 3274  F8A394
739
 3275  F8A394                	WndNewLine:
740
 3276  F8A394  24 B2         		bit	ScnFlag			; test input line
741
 3277  F8A396  10 18         		bpl	?00
742
 3278  F8A398  18            		clc
743
 3279  F8A399  70 D4         		bvs	WndGetAddr		; mai scroll per input mono-linea
744
 3280  F8A39B  A6 94         		ldx	ScnRow
745
  Tue Jul 17 11:00:17 2018                                                                                               Page   13
746
 
747
 
748
 
749
 
750
 3281  F8A39D  E4 90         		cpx	ScnBottom
751
 3282  F8A39F  90 23         		bcc	?02			; non occorre scroll
752
 3283  F8A3A1  A4 AE         		ldy	ScnInpRow
753
 3284  F8A3A3  C4 8E         		cpy	ScnTop
754
 3285  F8A3A5  D0 19         		bne	?01
755
 3286  F8A3A7  A4 B0         		ldy	ScnLstRow
756
 3287  F8A3A9  C4 90         		cpy	ScnBottom
757
 3288  F8A3AB  90 13         		bcc	?01			; scroll ok
758
 3289  F8A3AD  18            		clc
759
 3290  F8A3AE  90 BF         		bcc	WndGetAddr
760
 3291  F8A3B0  A6 94         	?00:	ldx	ScnRow
761
 3292  F8A3B2  E4 90         		cpx	ScnBottom
762
 3293  F8A3B4  90 0E         		bcc	?02			; non occorre scroll
763
 3294  F8A3B6  24 75         		bit	ScnScroll
764
 3295  F8A3B8  10 06         		bpl	?01
765
 3296  F8A3BA  A5 8E         		lda	ScnTop
766
 3297  F8A3BC  85 94         		sta	ScnRow
767
 3298  F8A3BE  B0 AF         		bcs	WndGetAddr
768
 3299  F8A3C0  20 A5 A6      	?01:	jsr	WndScroll
769
 3300  F8A3C3  18            		clc
770
 3301  F8A3C4  E6 94         	?02:	inc	ScnRow			; incrementa riga
771
 3302  F8A3C6  80 A7         		bra	WndGetAddr
772
 3303
773
 3304                        	; funzione CLR (SHIFT+PRTSCN)
774
 3305  F8A3C8                	ScnClr:
775
 3306  F8A3C8  24 B2         		bit	ScnFlag			; se in modo normale
776
 3307  F8A3CA  10 89         		bpl	WndClr			; cancella schermo
777
 3308  F8A3CC  80 29         		bra	_InpClr
778
 3309
779
 3310                        	; funzione HOME
780
 3311  F8A3CE                	ScnHome:
781
 3312  F8A3CE  24 B2         		bit	ScnFlag			; se in modo normale
782
 3313  F8A3D0  10 0A         		bpl	?00			; va a prima posizione schermo
783
 3314  F8A3D2  A6 AE         		ldx	ScnInpRow		; altrimenti imposta cursore a
784
 3315  F8A3D4  86 94         		stx	ScnRow			; prima posizione riga di input
785
 3316  F8A3D6  A4 AF         		ldy	ScnInpCol
786
 3317  F8A3D8  84 95         		sty	ScnCol
787
 3318  F8A3DA  80 95         		bra	WndGetAddrX
788
 3319  F8A3DC  A5 A0         	?00:	lda	ScnLstChr
789
 3320  F8A3DE  C9 05         		cmp	#SCN_HOME
790
 3321  F8A3E0  D0 81         		bne	WndHome
791
 3322  F8A3E2  20 7E AA      		jsr	SetMaxWnd
792
 3323  F8A3E5  4C 63 A3      	?01:	jmp	WndHome
793
 3324
794
 3325  F8A3E8                	ScnEnd:
795
 3326  F8A3E8  24 B2         		bit	ScnFlag			; se in modo normale
796
 3327  F8A3EA  10 A0         		bpl	WndEnd			; va a altima posizione schermo
797
 3328  F8A3EC  A6 B0         		ldx	ScnLstRow		; altrimenti sposta cursore ad ultima
798
 3329  F8A3EE  86 94         		stx	ScnRow			; posizione riga di input
799
 3330  F8A3F0  A4 B1         		ldy	ScnLstCol
800
 3331  F8A3F2  84 95         		sty	ScnCol
801
 3332  F8A3F4  4C 71 A3      		jmp	WndGetAddrX
802
 3333
803
 3334  F8A3F7                	_InpClr:
804
 3335  F8A3F7  20 CE A3      		jsr	ScnHome			; posiziona cursore a prima posizione riga di input
805
 3336  F8A3FA  A6 94         		ldx	ScnRow
806
 3337  F8A3FC  A4 95         		ldy	ScnCol
807
  Tue Jul 17 11:00:17 2018                                                                                               Page   14
808
 
809
 
810
 
811
 
812
 3338  F8A3FE  20 8E A7      		jsr	ClrRowY			; cancella linea input fino alla fine
813
 3339  F8A401  A6 94         		ldx	ScnRow			; cancella resto delle linee fino alla posizione
814
 3340  F8A403  E4 B0         		cpx	ScnLstRow
815
 3341  F8A405  B0 0E         		bcs	?02
816
 3342  F8A407  E8            	?01:	inx
817
 3343  F8A408  86 94         		stx	ScnRow
818
 3344  F8A40A  A4 8F         		ldy	ScnLeft			; ultima della riga di input
819
 3345  F8A40C  20 8E A7      		jsr	ClrRowY
820
 3346  F8A40F  A6 94         		ldx	ScnRow
821
 3347  F8A411  E4 B0         		cpx	ScnLstRow
822
 3348  F8A413  90 F2         		bcc	?01
823
 3349  F8A415  A6 AE         	?02:	ldx	ScnInpRow
824
 3350  F8A417  A4 AF         		ldy	ScnInpCol
825
 3351  F8A419  86 B0         		stx	ScnLstRow
826
 3352  F8A41B  84 B1         		sty	ScnLstCol
827
 3353  F8A41D  80 AF         		bra	ScnHome
828
 3354
829
 3355                        	;--------------------------------------------------------------------
830
 3356
831
 3357                        	; inizializza video
832
 3358  F8A41F                	_ScnInit:
833
 3359  F8A41F  48            		pha
834
 3360  F8A420  DA            		phx
835
 3361  F8A421  5A            		phy
836
 3362  F8A422  08            		php			; salva status
837
 3363  F8A423  0B            		phd			; salva DP
838
 3364  F8A424  8B            		phb			; salva registro DBR
839
 3365  F8A425                		CPU08			; imposta registri a 8 bit
840
 3366  F8A425  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
841
 3367                        		.LONGA	off
842
 3368                        		.LONGI	off
843
 3369                        		.MNLIST
844
 3370  F8A427  F4 00 01      		pea	#DP01ADDR	; imposta nuova DP
845
 3371  F8A42A  2B            		pld
846
 3372  F8A42B  A2 00         		ldx	#0		;
847
 3373  F8A42D  DA            		phx			; imposta DBR = 0
848
 3374  F8A42E  AB            		plb
849
 3375  F8A42F  20 08 A3      		jsr	cinit
850
 3376  F8A432  AB            		plb
851
 3377  F8A433  2B            		pld
852
 3378  F8A434  28            		plp			; rispristina status
853
 3379  F8A435  7A            		ply
854
 3380  F8A436  FA            		plx
855
 3381  F8A437  68            		pla
856
 3382  F8A438  18            		clc			; no error
857
 3383  F8A439  60            		rts
858
 3384  F8A43A
859
 3385                        	; input mode - caratteri di controllo
860
 3386  F8A43A                	_ScnCtrl:
861
 3387  F8A43A  A2 80         		ldx	#$80		; control
862
 3388  F8A43C  86 B5         		stx	ScnCntrl
863
 3389  F8A43E  A6 A0         		ldx	ScnLstChr
864
 3390  F8A440  E0 1E         		cpx	#SCN_PRTSCN
865
 3391  F8A442  F0 48         		beq	_ScnPut2	; passa a procedura PRINT
866
 3392  F8A444  C9 01         		cmp	#KB_SHIFTPRT	; SHIFT + PRINT SCRN
867
 3393  F8A446  D0 04         		bne	?01
868
 3394  F8A448  A9 0C         		lda	#SCN_CLR	; cancella schermo
869
  Tue Jul 17 11:00:17 2018                                                                                               Page   15
870
 
871
 
872
 
873
 
874
 3395  F8A44A  80 40         		bra	_ScnPut2
875
 3396  F8A44C  A2 00         	?01:	ldx	#0		; NOTA
876
 3397  F8A44E  C9 09         		cmp	#KB_SHIFTINS
877
 3398  F8A450  F0 06         		beq	?02
878
 3399  F8A452  A2 00         		ldx	#0		; NOTA
879
 3400  F8A454  C9 18         		cmp	#KB_SHIFTDEL
880
 3401  F8A456  D0 07         		bne	?04
881
 3402  F8A458  A9 1E         	?02:	lda	#SCN_PRTSCN	; simula
882
 3403  F8A45A  85 A0         		sta	ScnLstChr
883
 3404  F8A45C  8A            		txa
884
 3405  F8A45D  80 2D         		bra	_ScnPut2
885
 3406  F8A45F  C9 83         	?04:	cmp	#KB_PRTSCN	; test tasti cursore e speciali
886
 3407  F8A461  90 2C         		bcc	_ScnWait
887
 3408  F8A463  C9 91         		cmp	#(KB_BACKSPACE + 1)
888
 3409  F8A465  B0 28         		bcs	_ScnWait
889
 3410  F8A467  E9 82         		sbc	#(KB_PRTSCN - 1)
890
 3411  F8A469  AA            		tax
891
 3412  F8A46A  BF 3A AF F8   		lda	>KBCONV,x	; converte tasti $83..90 in SCN_*
892
 3413  F8A46E  80 1C         		bra	_ScnPut2
893
 3414
894
 3415                        	; input mode - stampa carattere ASCII
895
 3416  F8A470                	_ScnPut:
896
 3417  F8A470  64 B5         		stz	ScnCntrl	; flag carattere ASCII/CONTROL
897
 3418  F8A472  A6 A0         		ldx	ScnLstChr
898
 3419  F8A474  E0 1E         		cpx	#SCN_PRTSCN
899
 3420  F8A476  F0 14         		beq	_ScnPut2	; passa a procedura PRINT
900
 3421  F8A478  C9 20         		cmp	#' '		; stampa diretta ASCII >= $32
901
 3422  F8A47A  B0 10         		bcs	_ScnPut2
902
 3423  F8A47C  C9 09         		cmp	#KB_TAB		; tasto TAB
903
 3424  F8A47E  F0 0C         		beq	_ScnPut2
904
 3425  F8A480  C9 0A         		cmp	#KB_LF		; tasto CTRL + J (line feed)
905
 3426  F8A482  F0 08         		beq	_ScnPut2
906
 3427  F8A484  C9 07         		cmp	#KB_BELL	; tasto CTRL + G
907
 3428  F8A486  F0 04         		beq	_ScnPut2
908
 3429  F8A488  C9 1B         		cmp	#KB_ESC		; tasto ESC
909
 3430  F8A48A  D0 03         		bne	_ScnWait
910
 3431  F8A48C                	_ScnPut2:
911
 3432  F8A48C  20 C1 AD      		jsr	_ScnCharOut	; stampa carattere
912
 3433  F8A48F                	_ScnWait:
913
 3434  F8A48F  20 3B AD      		jsr	VDCCursOn
914
 3435  F8A492  A5 62         	?01:	lda	KbdCnt		; char disponibili nel buffer tastiera ?
915
 3436  F8A494  F0 FC         		beq	?01		; no - attendi tasto
916
 3437  F8A496  84 8D         		sty	ScnTmpx
917
 3438  F8A498  20 17 A5      		jsr	_GetBufKey	; Y -> flag - A -> codice
918
 3439  F8A49B  AA            		tax			; X = codice
919
 3440  F8A49C  98            		tya			; A = flag
920
 3441  F8A49D  A4 8D         		ldy	ScnTmpx
921
 3442  F8A49F  0A            		asl	a		; C = bit 7, N = bit 6
922
 3443  F8A4A0  30 F0         		bmi	?01		; ignora rilascio tasti
923
 3444  F8A4A2  08            		php			; salva C
924
 3445  F8A4A3  DA            		phx			; salva codice
925
 3446  F8A4A4  20 90 AD      		jsr	VDCCursOff
926
 3447  F8A4A7  68            		pla			; A = codice
927
 3448  F8A4A8  28            		plp			; C = 1 se carattere di controllo
928
 3449  F8A4A9  B0 8F         		bcs	_ScnCtrl
929
 3450  F8A4AB  C9 0D         		cmp	#KB_CR
930
 3451  F8A4AD  D0 C1         		bne	_ScnPut		; stampa carattere se non CR
931
  Tue Jul 17 11:00:17 2018                                                                                               Page   16
932
 
933
 
934
 
935
 
936
 3452  F8A4AF  85 A1         		sta	ScnCR
937
 3453  F8A4B1  20 D4 AB      		jsr	FindEndRow
938
 3454  F8A4B4  86 6E         		stx	ScnLinTmp
939
 3455  F8A4B6  20 44 AB      		jsr	WndEscJ2
940
 3456  F8A4B9  A4 8F         		ldy	ScnLeft
941
 3457  F8A4BB  A5 96         		lda	ScnRowStart
942
 3458  F8A4BD  30 12         		bmi	?04
943
 3459  F8A4BF  C5 94         		cmp	ScnRow
944
 3460  F8A4C1  90 0C         		bcc	?03
945
 3461  F8A4C3  A4 98         		ldy	ScnColStart
946
 3462  F8A4C5  C5 6E         		cmp	ScnLinTmp
947
 3463  F8A4C7  D0 04         		bne	?02
948
 3464  F8A4C9  C4 97         		cpy	ScnInput
949
 3465  F8A4CB  F0 02         		beq	?03
950
 3466  F8A4CD  B0 12         	?02:	bcs	CheckCR
951
 3467  F8A4CF  85 94         	?03:	sta	ScnRow
952
 3468  F8A4D1  84 95         	?04:	sty	ScnCol
953
 3469  F8A4D3  80 23         		bra	_ScnLine
954
 3470  F8A4D5
955
 3471  F8A4D5                	_ScnCharIn:
956
 3472  F8A4D5  64 B2         		stz	ScnFlag
957
 3473  F8A4D7  A9 40         		lda	#$40
958
 3474  F8A4D9  04 74         		tsb	ScnAutoIns		; bit 6: modo input
959
 3475  F8A4DB  A5 A1         		lda	ScnCR
960
 3476  F8A4DD  F0 B0         		beq	_ScnWait
961
 3477  F8A4DF  10 17         		bpl	_ScnLine
962
 3478  F8A4E1                	CheckCR:
963
 3479  F8A4E1  64 A1         		stz	ScnCR
964
 3480  F8A4E3  A9 0D         		lda	#KB_CR
965
 3481  F8A4E5  A2 03         		ldx	#TXTD_SCN
966
 3482  F8A4E7  EC 4F 00      		cpx	!DflTxtIn
967
 3483  F8A4EA  F0 05         		beq	?01
968
 3484  F8A4EC  EC 50 00      		cpx	!DflTxtOut
969
 3485  F8A4EF  F0 03         		beq	?02
970
 3486  F8A4F1  20 C1 AD      	?01:	jsr	_ScnCharOut
971
 3487  F8A4F4  A9 0D         	?02:	lda	#KB_CR
972
 3488  F8A4F6  D0 1B         		bne	_ScnLinX
973
 3489  F8A4F8
974
 3490  F8A4F8                	_ScnLine:
975
 3491  F8A4F8  20 6F A3      		jsr	WndGetAddr
976
 3492  F8A4FB  20 15 AD      		jsr	GetVDCChar
977
 3493  F8A4FE  85 9F         		sta	ScnCurChr
978
 3494  F8A500  A4 94         		ldy	ScnRow
979
 3495  F8A502  C4 6E         		cpy	ScnLinTmp
980
 3496  F8A504  90 0A         		bcc	?01
981
 3497  F8A506  A4 95         		ldy	ScnCol
982
 3498  F8A508  C4 97         		cpy	ScnInput
983
 3499  F8A50A  90 04         		bcc	?01
984
 3500  F8A50C  66 A1         		ror	ScnCR
985
 3501  F8A50E  30 03         		bmi	_ScnLinX
986
 3502  F8A510  20 20 AC      	?01:	jsr	MoveRight
987
 3503
988
 3504  F8A513                	_ScnLinX:
989
 3505  F8A513  85 9F         		sta	ScnCurChr
990
 3506  F8A515  18            		clc
991
 3507  F8A516  60            		rts
992
 3508
993
  Tue Jul 17 11:00:17 2018                                                                                               Page   17
994
 
995
 
996
 
997
 
998
 3509                        	;--------------------------------------------------------------------
999
 3510
1000
 3511                        	; NOTA: va chiamata con DP impostato su DIRP01
1001
 3512  F8A517                	_GetBufKey:
1002
 3513  F8A517  08            		php
1003
 3514  F8A518  78            		sei				; disabilita interrupt
1004
 3515  F8A519  A6 61         		ldx	KbdIHead		; puntatore testa buffer
1005
 3516  F8A51B  B4 00         		ldy	KbdBuf,x		; flag
1006
 3517  F8A51D  E8            		inx
1007
 3518  F8A51E  B5 00         		lda	KbdBuf,x		; codice tasto
1008
 3519  F8A520  E8            		inx
1009
 3520  F8A521  E0 60         		cpx	#KBDBUFLEN
1010
 3521  F8A523  90 02         		bcc	?01
1011
 3522  F8A525  A2 00         		ldx	#0
1012
 3523  F8A527  86 61         	?01:	stx	KbdIHead
1013
 3524  F8A529  C6 62         		dec	KbdCnt
1014
 3525  F8A52B  C6 62         		dec	KbdCnt
1015
 3526  F8A52D  28            		plp
1016
 3527  F8A52E  60            		rts
1017
 3528
1018
 3529
1019
 3530  F8A52F                	ScnProcPrnt:
1020
 3531  F8A52F  60            		rts
1021
 3532  F8A530
1022
 3533                        	; processa sequenza SCN_COL <A = FOREGROUND COLOR>
1023
 3534  F8A530                	ScnProcCol:
1024
 3535  F8A530  3A            		dec	a		; color = color - 1
1025
 3536  F8A531  C9 10         		cmp	#$10		; test default
1026
 3537  F8A533  90 02         		bcc	?02		; set color
1027
 3538  F8A535  A5 A9         		lda	ScnDefCol	; imposta foreground di default
1028
 3539  F8A537  85 99         	?02:	sta	ScnSaveX	; nuovo colore
1029
 3540  F8A539  A5 92         		lda	ScnAttr
1030
 3541  F8A53B  29 F0         		and	#$F0
1031
 3542  F8A53D  05 99         		ora	ScnSaveX
1032
 3543  F8A53F  85 92         		sta	ScnAttr
1033
 3544  F8A541  60            		rts
1034
 3545
1035
 3546                        	; processa sequenza SCN_BKGCOL <A = BACKGROUND COLOR>
1036
 3547  F8A542                	ScnProcBkgCol:
1037
 3548  F8A542  3A            		dec	a		; color = color - 1
1038
 3549  F8A543  C9 10         		cmp	#$10		; test default
1039
 3550  F8A545  90 02         		bcc	?02		; set color
1040
 3551  F8A547  A5 AD         		lda	ScnDefBkgCol	; imposta background di default
1041
 3552  F8A549  85 99         	?02:	sta	ScnSaveX	; nuovo colore
1042
 3553  F8A54B  A2 1A         		ldx	#$1A		; attuale bkg color
1043
 3554  F8A54D  20 1F AE      		jsr	GetVDCReg
1044
 3555  F8A550  29 F0         		and	#$F0		; maschera colore sfondo
1045
 3556  F8A552  05 99         		ora	ScnSaveX	; imposta nuovo colore
1046
 3557  F8A554  4C 11 AE      		jmp	SetVDCReg
1047
 3558
1048
 3559                        	; processa sequenza SCN_ESC <A = ESC CODE>
1049
 3560  F8A557                	ScnProcEsc:
1050
 3561  F8A557  64 9F         		stz	ScnCurChr	; invalida byte corrente
1051
 3562  F8A559  C9 1B         		cmp	#SCN_ESC
1052
 3563  F8A55B  F0 2C         		beq	WndEscO		; ESC + ESC annulla ESC
1053
 3564  F8A55D  AA            	?01:	tax
1054
 3565  F8A55E  30 39         		bmi	_RTS0
1055
  Tue Jul 17 11:00:17 2018                                                                                               Page   18
1056
 
1057
 
1058
 
1059
 
1060
 3566  F8A560  C9 40         		cmp	#'@'
1061
 3567  F8A562  F0 0B         		beq	?03
1062
 3568  F8A564  C9 61         		cmp	#'a'
1063
 3569  F8A566  90 31         		bcc	_RTS0
1064
 3570  F8A568  C9 7B         		cmp	#('z' + 1)
1065
 3571  F8A56A  B0 2D         		bcs	_RTS0
1066
 3572  F8A56C  38            		sec
1067
 3573  F8A56D  E9 20         		sbc	#$20
1068
 3574  F8A56F  38            	?03:	sec
1069
 3575  F8A570  E9 40         		sbc	#$40
1070
 3576  F8A572  C9 1B         		cmp	#$1B
1071
 3577  F8A574  B0 23         		bcs	_RTS0
1072
 3578  F8A576  0A            		asl	a
1073
 3579  F8A577  AA            		tax
1074
 3580  F8A578  7C 04 AF      		jmp	(ESCVCTRS,x)
1075
 3581
1076
 3582                        	; CR o SHIFT CR
1077
 3583  F8A57B                	ScnOutCR:
1078
 3584  F8A57B  20 D4 AB      		jsr	FindEndRow
1079
 3585  F8A57E  E8            		inx
1080
 3586  F8A57F  20 16 AB      		jsr	TabSetupX
1081
 3587  F8A582  A4 8F         		ldy	ScnLeft
1082
 3588  F8A584  84 95         		sty	ScnCol
1083
 3589  F8A586  20 94 A3      		jsr	WndNewLine
1084
 3590  F8A589
1085
 3591                        	; ESC-O
1086
 3592  F8A589                	WndEscO:
1087
 3593  F8A589  A5 92         		lda	ScnAttr		; azzera reverse, underline, blink
1088
 3594  F8A58B  24 6D         		bit	<VBBRam
1089
 3595  F8A58D  10 04         		bpl	?01
1090
 3596  F8A58F  29 1F         		and	#$1F
1091
 3597  F8A591  80 02         		bra	?02
1092
 3598  F8A593  29 8F         	?01:	and	#$8F
1093
 3599  F8A595  85 92         	?02:	sta	ScnAttr
1094
 3600  F8A597  64 73         		stz	ScnInsert
1095
 3601  F8A599  60            	_RTS0:	rts
1096
 3602  F8A59A
1097
 3603  F8A59A                	ScnOutChr:
1098
 3604  F8A59A  24 B2         		bit	ScnFlag		; ignora tasto PAUSE
1099
 3605  F8A59C  30 0A         		bmi	?02		; in modo line input
1100
 3606  F8A59E  24 74         		bit	ScnAutoIns	; ignora tasto PAUSE
1101
 3607  F8A5A0  70 06         		bvs	?02		; in modo full editor
1102
 3608  F8A5A2  A9 10         	?01:	lda	#PAUSETGB	; attesa durante PAUSE
1103
 3609  F8A5A4  24 65         		bit	KbdToggle
1104
 3610  F8A5A6  D0 FA         		bne	?01
1105
 3611  F8A5A8  64 A1         	?02:	stz	ScnCR
1106
 3612  F8A5AA  A5 9F         		lda	ScnCurChr	; byte da inviare a schermo
1107
 3613  F8A5AC  A4 95         		ldy	ScnCol		; colonna corrente
1108
 3614  F8A5AE  A6 A0         		ldx	ScnLstChr	; se ultimo byte = NULL
1109
 3615  F8A5B0  F0 24         		beq	?10		; salta test sequenza escape
1110
 3616  F8A5B2  E0 1B         		cpx	#SCN_ESC	; se byte < SCN_ESC
1111
 3617  F8A5B4  90 20         		bcc	?10		; salta test sequenza escape
1112
 3618  F8A5B6  E0 1F         		cpx	#SCN_PASS	; se byte < SCN_PASS
1113
 3619  F8A5B8  F0 04         		beq	?04		; byte = SCN_PASS
1114
 3620  F8A5BA  90 0E         		bcc	?06		; byte < SCN_PASS esegue sequenza escape
1115
 3621  F8A5BC  B0 18         		bcs	?10		; byte > SCN_PASS salta test sequenza escape
1116
 3622  F8A5BE  24 B2         	?04:	bit	ScnFlag		; ignora sequenze SCN_PASS
1117
  Tue Jul 17 11:00:17 2018                                                                                               Page   19
1118
 
1119
 
1120
 
1121
 
1122
 3623  F8A5C0  30 14         		bmi	?10		; in modo input line
1123
 3624  F8A5C2  24 74         		bit	ScnAutoIns	; ignora sequenze SCN_PASS
1124
 3625  F8A5C4  70 10         		bvs	?10		; in modo full editor
1125
 3626  F8A5C6  64 9F         		stz	ScnCurChr	; invalida byte corrente
1126
 3627  F8A5C8  80 3D         		bra	ScnOut		; stampa codice 00..1F come ASCII
1127
 3628  F8A5CA  EB            	?06:	xba			; salva byte in B
1128
 3629  F8A5CB  8A            		txa
1129
 3630  F8A5CC  E9 1A         		sbc	#(SCN_ESC - 1)	; qui C = 0 !
1130
 3631  F8A5CE  0A            		asl	a
1131
 3632  F8A5CF  AA            		tax			; indice funzione sequenza escape
1132
 3633  F8A5D0  EB            		xba			; ripristina A
1133
 3634  F8A5D1  64 9F         		stz	ScnCurChr	; invalida byte corrente
1134
 3635  F8A5D3  7C D8 AE      		jmp	(SCNESCSEQ,x)	; funzione di escape
1135
 3636  F8A5D6  C9 20         	?10:	cmp	#' '		; byte attuale ASCII ?
1136
 3637  F8A5D8  B0 2D         		bcs	ScnOut		; si - output a schermo
1137
 3638  F8A5DA  C9 1B         		cmp	#SCN_ESC	; codice escape ?
1138
 3639  F8A5DC  B0 22         		bcs	?16		; si - esce
1139
 3640  F8A5DE  C9 13         		cmp	#SCN_ALTFNT
1140
 3641  F8A5E0  90 1F         		bcc	?20		; codice controllo
1141
 3642  F8A5E2  E9 13         		sbc	#SCN_ALTFNT	; attributo
1142
 3643  F8A5E4  C9 04         		cmp	#$04		; attributo OFF -> C = 1
1143
 3644  F8A5E6  29 03         		and	#$03
1144
 3645  F8A5E8  AA            		tax
1145
 3646  F8A5E9  24 6D         		bit	<VBBRam
1146
 3647  F8A5EB  10 08         		bpl	?10a
1147
 3648  F8A5ED
1148
 3649                        		; no alternate font attribute per video board
1149
 3650                        		; blink e underline invertiti
1150
 3651  F8A5ED  BF D4 AE F8   		lda	>MSKROW2,x
1151
 3652  F8A5F1  F0 0D         		beq	?16		; ignora se A = $00
1152
 3653  F8A5F3  D0 04         		bne	?10b
1153
 3654  F8A5F5  BF CC AE F8   	?10a:	lda	>MSKROW,x
1154
 3655  F8A5F9  B0 03         	?10b:	bcs	?12		; si
1155
 3656  F8A5FB  04 92         		tsb	ScnAttr		; attributo ON
1156
 3657  F8A5FD  60            		rts
1157
 3658  F8A5FE  14 92         	?12:	trb	ScnAttr		; attributo OFF
1158
 3659  F8A600  60            	?16:	rts
1159
 3660  F8A601  3A            	?20:	dec	a		; codice controllo
1160
 3661  F8A602  0A            		asl	a
1161
 3662  F8A603  AA            		tax			; indice funzione controllo
1162
 3663  F8A604  7C E0 AE      		jmp	(CTRLVCTRS,x)
1163
 3664  F8A607
1164
 3665                        	; Output a schermo e posizionamento cursore
1165
 3666  F8A607                	ScnOut:
1166
 3667  F8A607  A6 73         	?01:	ldx	ScnInsert
1167
 3668  F8A609  F0 02         		beq	?02
1168
 3669  F8A60B  C6 73         		dec	ScnInsert
1169
 3670  F8A60D  24 74         	?02:	bit	ScnAutoIns
1170
 3671  F8A60F  50 25         		bvc	?10			; modo out - stampa carattere
1171
 3672  F8A611  10 07         		bpl	?03			; no auto insert
1172
 3673  F8A613  48            		pha
1173
 3674  F8A614  20 8C A9      		jsr	WndMakeSpace		; solo se in modo input
1174
 3675  F8A617  64 73         		stz	ScnInsert
1175
 3676  F8A619  68            		pla
1176
 3677  F8A61A  24 B2         	?03:	bit	ScnFlag
1177
 3678  F8A61C  10 18         		bpl	?10			; modo input normale
1178
 3679  F8A61E  A6 94         		ldx	ScnRow
1179
  Tue Jul 17 11:00:17 2018                                                                                               Page   20
1180
 
1181
 
1182
 
1183
 
1184
 3680  F8A620  A4 95         		ldy	ScnCol			; colonna in ultima posizione ?
1185
 3681  F8A622  C4 91         		cpy	ScnRight
1186
 3682  F8A624  90 10         		bcc	?10			; no, stampa car.
1187
 3683  F8A626  24 B2         		bit	ScnFlag
1188
 3684  F8A628  70 0A         		bvs	?06			; input riga singola - non stampa
1189
 3685  F8A62A  E4 90         		cpx	ScnBottom		; ultima riga schermo ?
1190
 3686  F8A62C  90 08         		bcc	?10			; no - stampa car.
1191
 3687  F8A62E  A6 AE         		ldx	ScnInpRow
1192
 3688  F8A630  E4 8E         		cpx	ScnTop
1193
 3689  F8A632  D0 02         		bne	?10
1194
 3690  F8A634  18            	?06:	clc
1195
 3691  F8A635  60            		rts
1196
 3692  F8A636  20 E0 AC      	?10:	jsr	PutChar			; stampa carattere
1197
 3693  F8A639  24 B2         		bit	ScnFlag
1198
 3694  F8A63B  10 1A         		bpl	CheckCurs
1199
 3695  F8A63D  A6 94         		ldx	ScnRow
1200
 3696  F8A63F  A4 95         		ldy	ScnCol
1201
 3697  F8A641  E4 B0         		cpx	ScnLstRow
1202
 3698  F8A643  D0 02         		bne	?11
1203
 3699  F8A645  C4 B1         		cpy	ScnLstCol
1204
 3700  F8A647  08            	?11:	php
1205
 3701  F8A648  20 57 A6      		jsr	CheckCurs
1206
 3702  F8A64B  28            		plp
1207
 3703  F8A64C  D0 08         		bne	?15
1208
 3704  F8A64E  A6 94         		ldx	ScnRow			; aggiorna ultima posizione cursore
1209
 3705  F8A650  A4 95         		ldy	ScnCol
1210
 3706  F8A652  86 B0         		stx	ScnLstRow
1211
 3707  F8A654  84 B1         		sty	ScnLstCol
1212
 3708  F8A656  60            	?15:	rts
1213
 3709  F8A657
1214
 3710  F8A657                	CheckCurs:
1215
 3711  F8A657  C4 91         		cpy	ScnRight
1216
 3712  F8A659  90 0A         		bcc	?01			; SncCol < ScnRight
1217
 3713  F8A65B  A6 94         		ldx	ScnRow
1218
 3714  F8A65D  E4 90         		cpx	ScnBottom
1219
 3715  F8A65F  90 04         		bcc	?01			; ScnRow < ScnBottom
1220
 3716  F8A661  24 75         		bit	ScnScroll
1221
 3717  F8A663  30 16         		bmi	?03
1222
 3718  F8A665  20 6F A3      	?01:	jsr	WndGetAddr
1223
 3719  F8A668  20 20 AC      		jsr	MoveRight
1224
 3720  F8A66B  90 0E         		bcc	?03
1225
 3721  F8A66D  20 07 AB      		jsr	TabCheck
1226
 3722  F8A670  B0 08         		bcs	?02
1227
 3723  F8A672  38            		sec
1228
 3724  F8A673  24 75         		bit	ScnScroll
1229
 3725  F8A675  70 04         		bvs	?03
1230
 3726  F8A677  20 7C A6      		jsr	InsertRow
1231
 3727  F8A67A  18            	?02:	clc
1232
 3728  F8A67B  60            	?03:	rts
1233
 3729
1234
 3730                        	; Inserisce nuova riga
1235
 3731  F8A67C                	InsertRow:
1236
 3732  F8A67C  A6 96         		ldx	ScnRowStart
1237
 3733  F8A67E  30 06         		bmi	?01
1238
 3734  F8A680  E4 94         		cpx	ScnRow
1239
 3735  F8A682  90 02         		bcc	?01
1240
 3736  F8A684  E6 96         		inc	ScnRowStart
1241
  Tue Jul 17 11:00:17 2018                                                                                               Page   21
1242
 
1243
 
1244
 
1245
 
1246
 3737  F8A686  A6 90         	?01:	ldx	ScnBottom
1247
 3738  F8A688  20 71 A3      	?02:	jsr	WndGetAddrX
1248
 3739  F8A68B  A4 8F         		ldy	ScnLeft
1249
 3740  F8A68D  E4 94         		cpx	ScnRow
1250
 3741  F8A68F  F0 0E         		beq	?03
1251
 3742  F8A691  CA            		dex
1252
 3743  F8A692  20 09 AB      		jsr	TabCheckX
1253
 3744  F8A695  E8            		inx
1254
 3745  F8A696  20 14 AB      		jsr	TabSetup2
1255
 3746  F8A699  CA            		dex
1256
 3747  F8A69A  20 DD A6      		jsr	MoveRow
1257
 3748  F8A69D  80 E9         		bra	?02
1258
 3749  F8A69F  20 89 A7      	?03:	jsr	ClrRow
1259
 3750  F8A6A2  4C 22 AB      		jmp	_Tab2Check
1260
 3751  F8A6A5
1261
 3752                        	; Scrolla finestra
1262
 3753  F8A6A5                	WndScroll:
1263
 3754  F8A6A5  A6 8E         		ldx	ScnTop
1264
 3755  F8A6A7  E8            	PP01:	inx
1265
 3756  F8A6A8  20 09 AB      		jsr	TabCheckX
1266
 3757  F8A6AB  90 0A         		bcc	PP02
1267
 3758  F8A6AD  E4 90         		cpx	ScnBottom
1268
 3759  F8A6AF  90 F6         		bcc	PP01
1269
 3760  F8A6B1  A6 8E         		ldx	ScnTop
1270
 3761  F8A6B3  E8            		inx
1271
 3762  F8A6B4  20 16 AB      		jsr	TabSetupX
1272
 3763  F8A6B7  C6 AE         	PP02:	dec	ScnInpRow		; update riga di start input line
1273
 3764  F8A6B9  C6 94         		dec	ScnRow
1274
 3765  F8A6BB  24 96         		bit	ScnRowStart
1275
 3766  F8A6BD  30 02         		bmi	PP03
1276
 3767  F8A6BF  C6 96         		dec	ScnRowStart
1277
 3768  F8A6C1  A6 8E         	PP03:	ldx	ScnTop
1278
 3769  F8A6C3  E4 9D         		cpx	ScnSaveRow
1279
 3770  F8A6C5  B0 02         		bcs	PP04
1280
 3771  F8A6C7  C6 9D         		dec	ScnSaveRow
1281
 3772  F8A6C9  20 72 A7      	PP04:	jsr	DeleteRow
1282
 3773  F8A6CC  A6 8E         		ldx	ScnTop
1283
 3774  F8A6CE  20 09 AB      		jsr	TabCheckX
1284
 3775  F8A6D1  08            		php
1285
 3776  F8A6D2  20 16 AB      		jsr	TabSetupX
1286
 3777  F8A6D5  28            		plp
1287
 3778  F8A6D6  90 04         		bcc	PP05
1288
 3779  F8A6D8  24 75         		bit	ScnScroll
1289
 3780  F8A6DA  30 C9         		bmi	WndScroll
1290
 3781  F8A6DC  60            	PP05:	rts
1291
 3782
1292
 3783                        	; Copia riga corrente nella riga X
1293
 3784  F8A6DD                	MoveRow:
1294
 3785  F8A6DD  86 99         		stx	ScnSaveX
1295
 3786  F8A6DF  24 6D         		bit	<VBBRam
1296
 3787  F8A6E1  10 2E         		bpl	?10			; VDC
1297
 3788  F8A6E3  BF 9A AE F8   		lda	>SCRNADDRL,x		; forza ABS LONG
1298
 3789  F8A6E7  85 A6         		sta	ScnPtr1
1299
 3790  F8A6E9  85 AA         		sta	ScnPtr2
1300
 3791  F8A6EB  BF B3 AE F8   		lda	>SCRNADDRH,x
1301
 3792  F8A6EF  85 A7         		sta	ScnPtr1+1
1302
 3793  F8A6F1  29 07         		and	#$07
1303
  Tue Jul 17 11:00:17 2018                                                                                               Page   22
1304
 
1305
 
1306
 
1307
 
1308
 3794  F8A6F3  05 70         		ora	ScnAttBase
1309
 3795  F8A6F5  85 AB         		sta	ScnPtr2+1
1310
 3796  F8A6F7  AE 0C FC      		ldx	CREMEOFF		; salva bit corrente
1311
 3797  F8A6FA  DA            		phx
1312
 3798  F8A6FB  8D 0D FC      		sta	!CREMEON		; abilita memoria video
1313
 3799  F8A6FE  B7 A6         	?04:	lda	[ScnPtr1],y
1314
 3800  F8A700  97 86         		sta	[ScnPtr],y
1315
 3801  F8A702  B7 AA         		lda	[ScnPtr2],y
1316
 3802  F8A704  97 8A         		sta	[ScnAtPtr],y
1317
 3803  F8A706  C4 91         		cpy	ScnRight
1318
 3804  F8A708  C8            		iny
1319
 3805  F8A709  90 F3         		bcc	?04
1320
 3806  F8A70B  FA            		plx
1321
 3807  F8A70C  9D 0C FC      		sta	!CREMEOFF,x		; ripristina bit corrente
1322
 3808  F8A70F  80 5E         		bra	?20
1323
 3809  F8A711  84 9A         	?10:	sty	ScnSaveY
1324
 3810  F8A713  A2 18         		ldx	#$18
1325
 3811  F8A715  20 1F AE      		jsr	GetVDCReg
1326
 3812  F8A718  09 80         		ora	#$80
1327
 3813  F8A71A  20 11 AE      		jsr	SetVDCReg
1328
 3814  F8A71D  20 FD AD      		jsr	SetVRam
1329
 3815  F8A720  A6 99         		ldx	ScnSaveX
1330
 3816  F8A722  BF 9A AE F8   		lda	>SCRNADDRL,x		; forza ABS LONG
1331
 3817  F8A726  85 9B         		sta	ScnTmpL
1332
 3818  F8A728  BF B3 AE F8   		lda	>SCRNADDRH,x
1333
 3819  F8A72C  05 6F         		ora	ScnChBase
1334
 3820  F8A72E  85 9C         		sta	ScnTmpH
1335
 3821  F8A730  A2 20         		ldx	#$20
1336
 3822  F8A732  18            		clc
1337
 3823  F8A733  98            		tya
1338
 3824  F8A734  65 9B         		adc	ScnTmpL
1339
 3825  F8A736  85 9B         		sta	ScnTmpL
1340
 3826  F8A738  A9 00         		lda	#$00
1341
 3827  F8A73A  65 9C         		adc	ScnTmpH
1342
 3828  F8A73C  85 9C         		sta	ScnTmpH
1343
 3829  F8A73E  20 11 AE      		jsr	SetVDCReg
1344
 3830  F8A741  E8            		inx
1345
 3831  F8A742  A5 9B         		lda	ScnTmpL
1346
 3832  F8A744  20 11 AE      		jsr	SetVDCReg
1347
 3833  F8A747  A5 91         		lda	ScnRight
1348
 3834  F8A749  1A            		inc	a
1349
 3835  F8A74A  38            		sec
1350
 3836  F8A74B  E5 9A         		sbc	ScnSaveY
1351
 3837  F8A74D  85 9A         		sta	ScnSaveY
1352
 3838  F8A74F  A2 1E         		ldx	#$1E
1353
 3839  F8A751  20 11 AE      		jsr	SetVDCReg
1354
 3840  F8A754  20 F0 AD      		jsr	SetARam
1355
 3841  F8A757  A2 20         		ldx	#$20
1356
 3842  F8A759  A5 9C         		lda	ScnTmpH
1357
 3843  F8A75B  29 07         		and	#$07
1358
 3844  F8A75D  05 70         		ora	ScnAttBase
1359
 3845  F8A75F  20 11 AE      		jsr	SetVDCReg
1360
 3846  F8A762  E8            		inx
1361
 3847  F8A763  A5 9B         		lda	ScnTmpL
1362
 3848  F8A765  20 11 AE      		jsr	SetVDCReg
1363
 3849  F8A768  A5 9A         		lda	ScnSaveY
1364
 3850  F8A76A  A2 1E         		ldx	#$1E
1365
  Tue Jul 17 11:00:17 2018                                                                                               Page   23
1366
 
1367
 
1368
 
1369
 
1370
 3851  F8A76C  20 11 AE      		jsr	SetVDCReg
1371
 3852  F8A76F  A6 99         	?20:	ldx	ScnSaveX
1372
 3853  F8A771  60            		rts
1373
 3854
1374
 3855                        	; Elimina riga X
1375
 3856  F8A772                	DeleteRow:
1376
 3857  F8A772  20 71 A3      		jsr	WndGetAddrX
1377
 3858  F8A775  A4 8F         		ldy	ScnLeft
1378
 3859  F8A777  E4 90         		cpx	ScnBottom
1379
 3860  F8A779  B0 0E         		bcs	ClrRow
1380
 3861  F8A77B  E8            		inx
1381
 3862  F8A77C  20 09 AB      		jsr	TabCheckX
1382
 3863  F8A77F  CA            		dex
1383
 3864  F8A780  20 14 AB      		jsr	TabSetup2
1384
 3865  F8A783  E8            		inx
1385
 3866  F8A784  20 DD A6      		jsr	MoveRow
1386
 3867  F8A787  80 E9         		bra	DeleteRow
1387
 3868  F8A789
1388
 3869                        	; Cancella linea X
1389
 3870  F8A789                	ClrRow:
1390
 3871  F8A789  A4 8F         		ldy	ScnLeft
1391
 3872  F8A78B  20 16 AB      		jsr	TabSetupX
1392
 3873  F8A78E
1393
 3874                        	; Cancella linea X a partire da colonna Y
1394
 3875  F8A78E                	ClrRowY:
1395
 3876  F8A78E  20 71 A3      		jsr	WndGetAddrX
1396
 3877  F8A791  86 99         		stx	ScnSaveX
1397
 3878  F8A793  24 6D         		bit	<VBBRam
1398
 3879  F8A795  10 1E         		bpl	?00			; VDC
1399
 3880  F8A797  AE 0C FC      		ldx	CREMEOFF		; salva bit corrente
1400
 3881  F8A79A  DA            		phx
1401
 3882  F8A79B  8D 0D FC      		sta	!CREMEON		; abilita memoria video
1402
 3883  F8A79E  88            		dey
1403
 3884  F8A79F  C8            	?00a:	iny
1404
 3885  F8A7A0  A9 20         		lda	#' '
1405
 3886  F8A7A2  97 86         		sta	[ScnPtr],y
1406
 3887  F8A7A4  A5 92         		lda	ScnAttr
1407
 3888  F8A7A6  29 1F         		and	#$1F
1408
 3889  F8A7A8  97 8A         		sta	[ScnAtPtr],y
1409
 3890  F8A7AA  C4 91         		cpy	ScnRight
1410
 3891  F8A7AC  D0 F1         		bne	?00a
1411
 3892  F8A7AE  FA            		plx
1412
 3893  F8A7AF  9D 0C FC      		sta	!CREMEOFF,x		; ripristina bit corrente
1413
 3894  F8A7B2  A6 99         		ldx	ScnSaveX
1414
 3895  F8A7B4  60            		rts
1415
 3896  F8A7B5  84 9A         	?00:	sty	ScnSaveY
1416
 3897  F8A7B7  A2 18         		ldx	#$18
1417
 3898  F8A7B9  20 1F AE      		jsr	GetVDCReg
1418
 3899  F8A7BC  29 7F         		and	#$7F
1419
 3900  F8A7BE  20 11 AE      		jsr	SetVDCReg
1420
 3901  F8A7C1  A2 12         		ldx	#$12
1421
 3902  F8A7C3  18            		clc
1422
 3903  F8A7C4  98            		tya
1423
 3904  F8A7C5  65 86         		adc	ScnPtr
1424
 3905  F8A7C7  85 9B         		sta	ScnTmpL
1425
 3906  F8A7C9  A9 00         		lda	#0
1426
 3907  F8A7CB  65 87         		adc	ScnPtr+1
1427
  Tue Jul 17 11:00:17 2018                                                                                               Page   24
1428
 
1429
 
1430
 
1431
 
1432
 3908  F8A7CD  85 9C         		sta	ScnTmpH
1433
 3909  F8A7CF  20 11 AE      		jsr	SetVDCReg
1434
 3910  F8A7D2  E8            		inx
1435
 3911  F8A7D3  A5 9B         		lda	ScnTmpL
1436
 3912  F8A7D5  20 11 AE      		jsr	SetVDCReg
1437
 3913  F8A7D8  A9 20         		lda	#' '
1438
 3914  F8A7DA  20 0F AE      		jsr	SetVDCReg31
1439
 3915  F8A7DD  38            		sec
1440
 3916  F8A7DE  A5 91         		lda	ScnRight
1441
 3917  F8A7E0  E5 9A         		sbc	ScnSaveY
1442
 3918  F8A7E2  48            		pha
1443
 3919  F8A7E3  F0 10         		beq	?01
1444
 3920  F8A7E5  AA            		tax
1445
 3921  F8A7E6  38            		sec
1446
 3922  F8A7E7  65 9B         		adc	ScnTmpL
1447
 3923  F8A7E9  85 9B         		sta	ScnTmpL
1448
 3924  F8A7EB  A9 00         		lda	#$00
1449
 3925  F8A7ED  65 9C         		adc	ScnTmpH
1450
 3926  F8A7EF  85 9C         		sta	ScnTmpH
1451
 3927  F8A7F1  8A            		txa
1452
 3928  F8A7F2  20 24 A8      		jsr	CopyVDC
1453
 3929  F8A7F5  A2 12         	?01:	ldx	#$12
1454
 3930  F8A7F7  18            		clc
1455
 3931  F8A7F8  98            		tya
1456
 3932  F8A7F9  65 8A         		adc	ScnAtPtr
1457
 3933  F8A7FB  48            		pha
1458
 3934  F8A7FC  A9 00         		lda	#0
1459
 3935  F8A7FE  65 8B         		adc	ScnAtPtr+1
1460
 3936  F8A800  20 11 AE      		jsr	SetVDCReg
1461
 3937  F8A803  E8            		inx
1462
 3938  F8A804  68            		pla
1463
 3939  F8A805  20 11 AE      		jsr	SetVDCReg
1464
 3940  F8A808  A5 9C         		lda	ScnTmpH
1465
 3941  F8A80A  29 07         		and	#$07
1466
 3942  F8A80C  05 70         		ora	ScnAttBase
1467
 3943  F8A80E  85 9C         		sta	ScnTmpH
1468
 3944  F8A810  A5 92         		lda	ScnAttr
1469
 3945  F8A812  29 8F         		and	#$8F
1470
 3946  F8A814  20 0F AE      		jsr	SetVDCReg31
1471
 3947  F8A817  68            		pla
1472
 3948  F8A818  F0 03         		beq	?02
1473
 3949  F8A81A  20 24 A8      		jsr	CopyVDC
1474
 3950  F8A81D  A6 99         	?02:	ldx	ScnSaveX
1475
 3951  F8A81F  A4 91         		ldy	ScnRight
1476
 3952  F8A821  60            		rts
1477
 3953  F8A822
1478
 3954                        	; Copia in video ram 1 byte
1479
 3955  F8A822                	CopyVDC1:
1480
 3956  F8A822  A9 01         		lda	#$01
1481
 3957  F8A824
1482
 3958                        	; Copia in video ram A bytes
1483
 3959  F8A824                	CopyVDC:
1484
 3960  F8A824  A2 1E         		ldx	#$1E
1485
 3961  F8A826  20 11 AE      		jsr	SetVDCReg
1486
 3962  F8A829  2C 4E FD      	?01:	bit	VDCStatus
1487
 3963  F8A82C  10 FB         		bpl	?01
1488
 3964  F8A82E  A2 12         		ldx	#$12
1489
  Tue Jul 17 11:00:17 2018                                                                                               Page   25
1490
 
1491
 
1492
 
1493
 
1494
 3965  F8A830  20 1F AE      		jsr	GetVDCReg
1495
 3966  F8A833  C5 9C         		cmp	ScnTmpH
1496
 3967  F8A835  90 EB         		bcc	CopyVDC1
1497
 3968  F8A837  A2 13         		ldx	#$13
1498
 3969  F8A839  20 1F AE      		jsr	GetVDCReg
1499
 3970  F8A83C  C5 9B         		cmp	ScnTmpL
1500
 3971  F8A83E  90 E2         		bcc	CopyVDC1
1501
 3972  F8A840  60            		rts
1502
 3973
1503
 3974
1504
 3975                        	;--------------------------------------------------------------------
1505
 3976
1506
 3977                        	; tasto insert
1507
 3978  F8A841                	KeybInsert:
1508
 3979  F8A841  24 74         		bit	ScnAutoIns
1509
 3980  F8A843  30 18         		bmi	RTS11
1510
 3981  F8A845  4C 8C A9      		jmp	WndMakeSpace
1511
 3982  F8A848
1512
 3983                        	; Muove cursore a destra
1513
 3984  F8A848                	CsrRight:
1514
 3985  F8A848  24 B2         		bit	ScnFlag
1515
 3986  F8A84A  10 0C         		bpl	?00			; modo normale
1516
 3987  F8A84C  A4 95         		ldy	ScnCol			; test: cursore ad ultima posizione ?
1517
 3988  F8A84E  C4 B1         		cpy	ScnLstCol
1518
 3989  F8A850  90 06         		bcc	?00			; no
1519
 3990  F8A852  A4 94         		ldy	ScnRow
1520
 3991  F8A854  C4 B0         		cpy	ScnLstRow
1521
 3992  F8A856  B0 05         		bcs	RTS11			; si
1522
 3993  F8A858  20 20 AC      	?00:	jsr	MoveRight
1523
 3994  F8A85B  B0 08         		bcs	_CsrCheck
1524
 3995  F8A85D                	RTS11:
1525
 3996  F8A85D  60            		rts
1526
 3997  F8A85E
1527
 3998                        	; Muove cursore in basso
1528
 3999  F8A85E                	CsrDown:
1529
 4000  F8A85E  24 B2         		bit	ScnFlag			; se in modo input
1530
 4001  F8A860  30 2A         		bmi	CsrDown2
1531
 4002  F8A862  20 94 A3      		jsr	WndNewLine
1532
 4003  F8A865
1533
 4004  F8A865                	_CsrCheck:
1534
 4005  F8A865  20 07 AB      		jsr	TabCheck
1535
 4006  F8A868  B0 03         		bcs	_CsrClc
1536
 4007  F8A86A  38            		sec
1537
 4008  F8A86B  66 96         		ror	ScnRowStart
1538
 4009  F8A86D                	_CsrClc:
1539
 4010  F8A86D  18            		clc
1540
 4011  F8A86E                	_CsrRts:
1541
 4012  F8A86E  60            		rts
1542
 4013  F8A86F
1543
 4014                        	; Muove cursore in alto
1544
 4015  F8A86F                	CsrUp:
1545
 4016  F8A86F  24 B2         		bit	ScnFlag			; se in modo input
1546
 4017  F8A871  30 35         		bmi	CsrUp2
1547
 4018  F8A873  A6 8E         		ldx	ScnTop
1548
 4019  F8A875  E4 94         		cpx	ScnRow
1549
 4020  F8A877  B0 F5         		bcs	_CsrRts
1550
 4021  F8A879                	_CsrSet:
1551
  Tue Jul 17 11:00:17 2018                                                                                               Page   26
1552
 
1553
 
1554
 
1555
 
1556
 4022  F8A879  20 65 A8      		jsr	_CsrCheck
1557
 4023  F8A87C                	_CsrSet2:
1558
 4024  F8A87C  C6 94         		dec	ScnRow
1559
 4025  F8A87E  4C 6F A3      		jmp	WndGetAddr
1560
 4026  F8A881
1561
 4027                        	; Muove cursore a sinistra
1562
 4028  F8A881                	CsrLeft:
1563
 4029  F8A881  20 51 AC      		jsr	MoveLeft
1564
 4030  F8A884  B0 E8         		bcs	_CsrRts
1565
 4031  F8A886  D0 E5         		bne	_CsrClc
1566
 4032  F8A888  E6 94         		inc	ScnRow
1567
 4033  F8A88A  D0 ED         		bne	_CsrSet
1568
 4034
1569
 4035                        	; CURSORE DOWN modo input
1570
 4036  F8A88C                	CsrDown2:
1571
 4037  F8A88C  A6 94         		ldx	ScnRow
1572
 4038  F8A88E  E4 B0         		cpx	ScnLstRow
1573
 4039  F8A890  B0 DC         		bcs	_CsrRts
1574
 4040  F8A892  E6 94         		inc	ScnRow
1575
 4041  F8A894  A4 95         		ldy	ScnCol
1576
 4042  F8A896  A6 94         		ldx	ScnRow
1577
 4043  F8A898  E4 B0         		cpx	ScnLstRow
1578
 4044  F8A89A  90 06         		bcc	_Check4
1579
 4045  F8A89C  C4 B1         		cpy	ScnLstCol
1580
 4046  F8A89E  90 02         		bcc	_Check4
1581
 4047  F8A8A0  A4 B1         		ldy	ScnLstCol
1582
 4048  F8A8A2
1583
 4049  F8A8A2                	_Check4:
1584
 4050  F8A8A2  84 95         		sty	ScnCol
1585
 4051  F8A8A4  18            		clc
1586
 4052  F8A8A5  4C 6F A3      		jmp	WndGetAddr
1587
 4053  F8A8A8
1588
 4054                        	; CURSORE UP modo input
1589
 4055  F8A8A8                	CsrUp2:
1590
 4056  F8A8A8  A6 AE         		ldx	ScnInpRow
1591
 4057  F8A8AA  E4 94         		cpx	ScnRow
1592
 4058  F8A8AC  B0 C0         		bcs	_CsrRts
1593
 4059  F8A8AE  C6 94         		dec	ScnRow
1594
 4060  F8A8B0  A4 95         		ldy	ScnCol
1595
 4061  F8A8B2  A6 AE         		ldx	ScnInpRow
1596
 4062  F8A8B4  E4 94         		cpx	ScnRow
1597
 4063  F8A8B6  90 EA         		bcc	_Check4
1598
 4064  F8A8B8  C4 AF         		cpy	ScnInpCol
1599
 4065  F8A8BA  B0 E6         		bcs	_Check4
1600
 4066  F8A8BC  A4 AF         		ldy	ScnInpCol
1601
 4067  F8A8BE  80 E2         		bra	_Check4
1602
 4068  F8A8C0
1603
 4069                        	; TAB
1604
 4070  F8A8C0                	CsrTab:
1605
 4071  F8A8C0  24 B2         		bit	ScnFlag			; in modo input line
1606
 4072  F8A8C2  30 12         		bmi	?04			; non esegue nulla
1607
 4073  F8A8C4  A4 95         		ldy	ScnCol
1608
 4074  F8A8C6  C8            	?01:	iny
1609
 4075  F8A8C7  C4 91         		cpy	ScnRight
1610
 4076  F8A8C9  B0 07         		bcs	?02
1611
 4077  F8A8CB  20 F4 A8      		jsr	FindTab
1612
 4078  F8A8CE  F0 F6         		beq	?01
1613
  Tue Jul 17 11:00:17 2018                                                                                               Page   27
1614
 
1615
 
1616
 
1617
 
1618
 4079  F8A8D0  D0 02         		bne	?03
1619
 4080  F8A8D2  A4 91         	?02:	ldy	ScnRight
1620
 4081  F8A8D4  84 95         	?03:	sty	ScnCol
1621
 4082  F8A8D6  60            	?04:	rts
1622
 4083
1623
 4084  F8A8D7                	CsrShTab:
1624
 4085  F8A8D7  24 B2         		bit	ScnFlag			; in modo input line
1625
 4086  F8A8D9  30 0E         		bmi	?04			; non esegue nulla
1626
 4087  F8A8DB  A4 95         		ldy	ScnCol
1627
 4088  F8A8DD  C4 8F         	?01:	cpy	ScnLeft
1628
 4089  F8A8DF  F0 06         		beq	?03
1629
 4090  F8A8E1  88            		dey
1630
 4091  F8A8E2  20 F4 A8      		jsr	FindTab
1631
 4092  F8A8E5  F0 F6         		beq	?01
1632
 4093  F8A8E7  84 95         	?03:	sty	ScnCol
1633
 4094  F8A8E9  60            	?04:	rts
1634
 4095  F8A8EA
1635
 4096  F8A8EA                	TabToggle:
1636
 4097  F8A8EA  A4 95         		ldy	ScnCol
1637
 4098  F8A8EC  20 F4 A8      		jsr	FindTab
1638
 4099  F8A8EF  45 9B         		eor	ScnTmpL
1639
 4100  F8A8F1  95 78         		sta	ScnMapTabs1,x
1640
 4101  F8A8F3  60            		rts
1641
 4102  F8A8F4
1642
 4103  F8A8F4                	FindTab:
1643
 4104  F8A8F4  98            		tya
1644
 4105  F8A8F5  29 07         		and	#$07
1645
 4106  F8A8F7  AA            		tax
1646
 4107  F8A8F8  BF CC AE F8   		lda	>MSKROW,x		; forza ABS LONG
1647
 4108  F8A8FC  85 9B         		sta	ScnTmpL
1648
 4109  F8A8FE  98            		tya
1649
 4110  F8A8FF  4A            		lsr	a
1650
 4111  F8A900  4A            		lsr	a
1651
 4112  F8A901  4A            		lsr	a
1652
 4113  F8A902  AA            		tax
1653
 4114  F8A903  B5 78         		lda	ScnMapTabs1,x
1654
 4115  F8A905  24 9B         		bit	ScnTmpL
1655
 4116  F8A907  60            		rts
1656
 4117  F8A908
1657
 4118  F8A908                	LineFeed:
1658
 4119  F8A908  24 B2         		bit	ScnFlag			; in modo input line
1659
 4120  F8A90A  30 0C         		bmi	?01			; non esegue nulla
1660
 4121  F8A90C  A5 95         		lda	ScnCol
1661
 4122  F8A90E  48            		pha
1662
 4123  F8A90F  20 D4 AB      		jsr	FindEndRow
1663
 4124  F8A912  20 94 A3      		jsr	WndNewLine
1664
 4125  F8A915  68            		pla
1665
 4126  F8A916  85 95         		sta	ScnCol
1666
 4127  F8A918  60            	?01:	rts
1667
 4128
1668
 4129  F8A919                	SolidCurs:
1669
 4130  F8A919  A5 71         		lda	ScnCursMode
1670
 4131  F8A91B  29 E0         		and	#$E0
1671
 4132  F8A91D  80 10         		bra	_SetVDCCurs
1672
 4133
1673
 4134  F8A91F                	ULineCurs:
1674
 4135  F8A91F  A5 71         		lda	ScnCursMode
1675
  Tue Jul 17 11:00:17 2018                                                                                               Page   28
1676
 
1677
 
1678
 
1679
 
1680
 4136  F8A921  29 E0         		and	#$E0
1681
 4137  F8A923  09 07         		ora	#CURSLINE
1682
 4138  F8A925  80 08         		bra	_SetVDCCurs
1683
 4139  F8A927
1684
 4140  F8A927                	FixedCurs:
1685
 4141  F8A927  A9 80         		lda	#$80
1686
 4142  F8A929  14 74         		trb	ScnAutoIns
1687
 4143  F8A92B  A5 71         		lda	ScnCursMode
1688
 4144  F8A92D  29 1F         		and	#$1F
1689
 4145  F8A92F
1690
 4146  F8A92F                	_SetVDCCurs:
1691
 4147  F8A92F  85 71         		sta	ScnCursMode
1692
 4148  F8A931  4C 79 AD      		jmp	VDCCursor
1693
 4149
1694
 4150  F8A934                	FlashCurs:
1695
 4151  F8A934  A9 80         		lda	#$80
1696
 4152  F8A936  04 74         		tsb	ScnAutoIns
1697
 4153  F8A938  A5 71         		lda	ScnCursMode
1698
 4154  F8A93A  29 1F         		and	#$1F
1699
 4155  F8A93C  09 60         		ora	#DEFCURS
1700
 4156  F8A93E  D0 EF         		bne	_SetVDCCurs
1701
 4157  F8A940
1702
 4158  F8A940                	ScreenRev:
1703
 4159  F8A940  A2 18         		ldx	#$18
1704
 4160  F8A942  20 1F AE      		jsr	GetVDCReg
1705
 4161  F8A945  09 40         		ora	#$40
1706
 4162  F8A947  D0 07         		bne	_ScnSet
1707
 4163  F8A949
1708
 4164  F8A949                	ScreenNorm:
1709
 4165  F8A949  A2 18         		ldx	#$18
1710
 4166  F8A94B  20 1F AE      		jsr	GetVDCReg
1711
 4167  F8A94E  29 BF         		and	#$BF
1712
 4168  F8A950
1713
 4169  F8A950                	_ScnSet:
1714
 4170  F8A950  4C 11 AE      		jmp	SetVDCReg
1715
 4171
1716
 4172  F8A953                	UpdLast:
1717
 4173  F8A953  A4 B1         		ldy	ScnLstCol
1718
 4174  F8A955  A5 94         		lda	ScnRow
1719
 4175  F8A957  C5 AE         		cmp	ScnInpRow
1720
 4176  F8A959  D0 04         		bne	?05
1721
 4177  F8A95B  C4 AF         		cpy	ScnInpCol
1722
 4178  F8A95D  F0 09         		beq	?11
1723
 4179  F8A95F  88            	?05:	dey
1724
 4180  F8A960  10 04         		bpl	?10
1725
 4181  F8A962  C6 B0         		dec	ScnLstRow
1726
 4182  F8A964  A4 91         		ldy	ScnRight
1727
 4183  F8A966  84 B1         	?10:	sty	ScnLstCol
1728
 4184  F8A968  60            	?11:	rts
1729
 4185
1730
 4186  F8A969                	MoveRCurs:
1731
 4187  F8A969  20 57 A6      		jsr	CheckCurs
1732
 4188  F8A96C  A6 94         		ldx	ScnRow			; aggiorna ultima posizione cursore
1733
 4189  F8A96E  A4 95         		ldy	ScnCol
1734
 4190  F8A970  86 B0         		stx	ScnLstRow
1735
 4191  F8A972  84 B1         		sty	ScnLstCol
1736
 4192  F8A974  60            		rts
1737
  Tue Jul 17 11:00:17 2018                                                                                               Page   29
1738
 
1739
 
1740
 
1741
 
1742
 4193
1743
 4194                        	; tasto DELETE
1744
 4195  F8A975                	KeyDel:
1745
 4196  F8A975  24 B2         		bit	ScnFlag
1746
 4197  F8A977  10 12         		bpl	?30
1747
 4198  F8A979  A5 94         		lda	ScnRow			; non esegue nulla se in ultima posizione
1748
 4199  F8A97B  C5 B0         		cmp	ScnLstRow
1749
 4200  F8A97D  D0 06         		bne	?01
1750
 4201  F8A97F  A5 95         		lda	ScnCol
1751
 4202  F8A981  C5 B1         		cmp	ScnLstCol
1752
 4203  F8A983  F0 06         		beq	?30
1753
 4204  F8A985  20 7F AC      	?01:	jsr	SaveCursPos
1754
 4205  F8A988  20 13 AA      		jsr	KeyDel1
1755
 4206  F8A98B  60            	?30:	rts
1756
 4207
1757
 4208                        	; Crea spazio nella finestra
1758
 4209  F8A98C                	WndMakeSpace:
1759
 4210  F8A98C  24 B2         		bit	ScnFlag
1760
 4211  F8A98E  10 34         		bpl	?00
1761
 4212  F8A990  A6 94         		ldx	ScnRow			; non apre spazio se stampa avviene
1762
 4213  F8A992  E4 B0         		cpx	ScnLstRow		; nella posizione corrente
1763
 4214  F8A994  D0 06         		bne	?05
1764
 4215  F8A996  A4 95         		ldy	ScnCol
1765
 4216  F8A998  C4 B1         		cpy	ScnLstCol
1766
 4217  F8A99A  F0 0A         		beq	?10
1767
 4218  F8A99C  24 B2         	?05:	bit	ScnFlag
1768
 4219  F8A99E  50 07         		bvc	?20			; input multi-linea
1769
 4220  F8A9A0  A4 B1         		ldy	ScnLstCol		; non apre spazio se cursore
1770
 4221  F8A9A2  C4 91         		cpy	ScnRight		; in ultima posizione utile
1771
 4222  F8A9A4  90 13         		bcc	?25
1772
 4223  F8A9A6  60            	?10:	rts
1773
 4224  F8A9A7  A4 B1         	?20:	ldy	ScnLstCol		; test ultima posizione utile multi-linea
1774
 4225  F8A9A9  C4 91         		cpy	ScnRight
1775
 4226  F8A9AB  90 0C         		bcc	?25
1776
 4227  F8A9AD  A4 AE         		ldy	ScnInpRow
1777
 4228  F8A9AF  C4 8E         		cpy	ScnTop
1778
 4229  F8A9B1  D0 06         		bne	?25
1779
 4230  F8A9B3  A4 B0         		ldy	ScnLstRow
1780
 4231  F8A9B5  C4 90         		cpy	ScnBottom
1781
 4232  F8A9B7  B0 ED         		bcs	?10
1782
 4233  F8A9B9  20 7F AC      	?25:	jsr	SaveCursPos
1783
 4234  F8A9BC  20 8B AB      		jsr	FindEndRow2
1784
 4235  F8A9BF  20 69 A9      		jsr	MoveRCurs
1785
 4236  F8A9C2  80 13         		bra	?02
1786
 4237
1787
 4238  F8A9C4  20 7F AC      	?00:	jsr	SaveCursPos
1788
 4239  F8A9C7  20 D4 AB      		jsr	FindEndRow
1789
 4240  F8A9CA  E4 9D         		cpx	ScnSaveRow
1790
 4241  F8A9CC  D0 02         		bne	?01
1791
 4242  F8A9CE  C4 9E         		cpy	ScnSaveCol
1792
 4243  F8A9D0  90 21         	?01:	bcc	?03
1793
 4244  F8A9D2  20 57 A6      		jsr	CheckCurs
1794
 4245  F8A9D5  B0 62         		bcs	CsrRest
1795
 4246  F8A9D7  20 51 AC      	?02:	jsr	MoveLeft
1796
 4247  F8A9DA  20 15 AD      		jsr	GetVDCChar
1797
 4248  F8A9DD  20 20 AC      		jsr	MoveRight
1798
 4249  F8A9E0  20 E4 AC      		jsr	PutChar2
1799
  Tue Jul 17 11:00:17 2018                                                                                               Page   30
1800
 
1801
 
1802
 
1803
 
1804
 4250  F8A9E3  20 51 AC      		jsr	MoveLeft
1805
 4251  F8A9E6  A6 94         		ldx	ScnRow
1806
 4252  F8A9E8  E4 9D         		cpx	ScnSaveRow
1807
 4253  F8A9EA  D0 EB         		bne	?02
1808
 4254  F8A9EC  C4 9E         		cpy	ScnSaveCol
1809
 4255  F8A9EE  D0 E7         		bne	?02
1810
 4256  F8A9F0  20 CF AC      		jsr	PutBlank
1811
 4257  F8A9F3  E6 73         	?03:	inc	ScnInsert
1812
 4258  F8A9F5  D0 42         		bne	CsrRest
1813
 4259  F8A9F7  C6 73         		dec	ScnInsert
1814
 4260  F8A9F9  80 3E         	?04:	bra	CsrRest
1815
 4261
1816
 4262                        	; BACKSPACE
1817
 4263  F8A9FB                	KeyBack:
1818
 4264  F8A9FB  24 B2         		bit	ScnFlag
1819
 4265  F8A9FD  10 0C         		bpl	?10
1820
 4266  F8A9FF  A5 94         		lda	ScnRow
1821
 4267  F8AA01  C5 AE         		cmp	ScnInpRow
1822
 4268  F8AA03  D0 06         		bne	?10
1823
 4269  F8AA05  A5 95         		lda	ScnCol
1824
 4270  F8AA07  C5 AF         		cmp	ScnInpCol
1825
 4271  F8AA09  F0 57         		beq	_RTSZ
1826
 4272  F8AA0B  20 81 A8      	?10:	jsr	CsrLeft
1827
 4273  F8AA0E  20 7F AC      		jsr	SaveCursPos
1828
 4274  F8AA11  B0 26         		bcs	CsrRest
1829
 4275  F8AA13                	KeyDel1:
1830
 4276  F8AA13  24 B2         		bit	ScnFlag
1831
 4277  F8AA15  10 0C         		bpl	?11
1832
 4278  F8AA17  A6 94         		ldx	ScnRow
1833
 4279  F8AA19  E4 B0         		cpx	ScnLstRow
1834
 4280  F8AA1B  90 27         		bcc	KeyDel2
1835
 4281  F8AA1D  C4 B1         		cpy	ScnLstCol
1836
 4282  F8AA1F  90 23         		bcc	KeyDel2
1837
 4283  F8AA21  B0 0C         		bcs	?12
1838
 4284  F8AA23  C4 91         	?11:	cpy	ScnRight
1839
 4285  F8AA25  90 1D         		bcc	KeyDel2
1840
 4286  F8AA27  A6 94         		ldx	ScnRow
1841
 4287  F8AA29  E8            		inx
1842
 4288  F8AA2A  20 09 AB      		jsr	TabCheckX
1843
 4289  F8AA2D  B0 15         		bcs	KeyDel2
1844
 4290  F8AA2F  20 CF AC      	?12:	jsr	PutBlank
1845
 4291  F8AA32  24 B2         		bit	ScnFlag
1846
 4292  F8AA34  10 03         		bpl	CsrRest
1847
 4293  F8AA36  20 53 A9      		jsr	UpdLast
1848
 4294  F8AA39
1849
 4295  F8AA39                	CsrRest:
1850
 4296  F8AA39  A5 9D         		lda	ScnSaveRow
1851
 4297  F8AA3B  85 94         		sta	ScnRow
1852
 4298  F8AA3D  A5 9E         		lda	ScnSaveCol
1853
 4299  F8AA3F  85 95         		sta	ScnCol
1854
 4300  F8AA41  4C 6F A3      		jmp	WndGetAddr
1855
 4301  F8AA44
1856
 4302  F8AA44                	KeyDel2:
1857
 4303  F8AA44  20 20 AC      		jsr	MoveRight
1858
 4304  F8AA47  20 15 AD      		jsr	GetVDCChar
1859
 4305  F8AA4A  20 51 AC      		jsr	MoveLeft
1860
 4306  F8AA4D  20 E4 AC      		jsr	PutChar2
1861
  Tue Jul 17 11:00:17 2018                                                                                               Page   31
1862
 
1863
 
1864
 
1865
 
1866
 4307  F8AA50  20 20 AC      		jsr	MoveRight
1867
 4308  F8AA53  80 BE         		bra	KeyDel1
1868
 4309  F8AA55
1869
 4310                        	;------------------------------------------------------------
1870
 4311
1871
 4312                        	; ESC-Z - cancella tab
1872
 4313  F8AA55                	ClearTabs:
1873
 4314  F8AA55  A9 00         		lda	#0
1874
 4315  F8AA57  80 04         		bra	_SetTabs
1875
 4316  F8AA59
1876
 4317                        	; ESC-Y - set default tab
1877
 4318  F8AA59                	SetDefTabs:
1878
 4319  F8AA59  A9 80         		lda	#$80
1879
 4320  F8AA5B  A2 09         		ldx	#$09
1880
 4321  F8AA5D                	_SetTabs:
1881
 4322  F8AA5D  95 78         	?01:	sta	ScnMapTabs1,x
1882
 4323  F8AA5F  CA            		dex
1883
 4324  F8AA60  10 FB         		bpl	?01
1884
 4325  F8AA62                	_RTSZ:
1885
 4326  F8AA62  60            		rts
1886
 4327  F8AA63
1887
 4328                        	; ESC-T - finestra TOP,LEFT
1888
 4329  F8AA63                	WndEscT:
1889
 4330  F8AA63  18            		clc
1890
 4331  F8AA64
1891
 4332  F8AA64  24            		.DB	$24
1892
 4333  F8AA65
1893
 4334                        	; ESC-B - finestra BOTTOM, RIGHT
1894
 4335  F8AA65                	WndEscB:
1895
 4336  F8AA65  38            		sec
1896
 4337  F8AA66  A6 95         		ldx	ScnCol
1897
 4338  F8AA68  A5 94         		lda	ScnRow
1898
 4339  F8AA6A
1899
 4340  F8AA6A                	SetWndL:
1900
 4341  F8AA6A  90 06         		bcc	SetWnd3
1901
 4342  F8AA6C                	SetWndR:
1902
 4343  F8AA6C  85 90         		sta	ScnBottom
1903
 4344  F8AA6E  86 91         		stx	ScnRight
1904
 4345  F8AA70  80 04         		bra	_SetWnd2
1905
 4346  F8AA72                	SetWnd3:
1906
 4347  F8AA72  85 8E         		sta	ScnTop
1907
 4348  F8AA74  86 8F         		stx	ScnLeft
1908
 4349  F8AA76                	_SetWnd2:
1909
 4350  F8AA76  A2 03         		ldx	#3
1910
 4351  F8AA78  74 82         	?01:	stz	ScnMapTabs2,x
1911
 4352  F8AA7A  CA            		dex
1912
 4353  F8AA7B  10 FB         		bpl	?01
1913
 4354  F8AA7D  60            		rts
1914
 4355  F8AA7E
1915
 4356  F8AA7E                	SetMaxWnd:
1916
 4357  F8AA7E  A5 76         		lda	ScnMaxRow
1917
 4358  F8AA80  A6 77         		ldx	ScnMaxCols
1918
 4359  F8AA82  20 6C AA      		jsr	SetWndR
1919
 4360  F8AA85  64 8F         		stz	ScnLeft
1920
 4361  F8AA87  64 8E         		stz	ScnTop
1921
 4362  F8AA89  60            		rts
1922
 4363
1923
  Tue Jul 17 11:00:17 2018                                                                                               Page   32
1924
 
1925
 
1926
 
1927
 
1928
 4364                        	; ESC-Q - cancella fino a fine linea
1929
 4365  F8AA8A                	WndEscQ:
1930
 4366  F8AA8A  20 7F AC      		jsr	SaveCursPos
1931
 4367  F8AA8D  20 8E A7      	?01:	jsr	ClrRowY
1932
 4368  F8AA90  E6 94         		inc	ScnRow
1933
 4369  F8AA92  20 6F A3      		jsr	WndGetAddr
1934
 4370  F8AA95  A4 8F         		ldy	ScnLeft
1935
 4371  F8AA97  20 07 AB      		jsr	TabCheck
1936
 4372  F8AA9A  B0 F1         		bcs	?01
1937
 4373  F8AA9C  80 9B         		bra	CsrRest
1938
 4374
1939
 4375                        	; ESC-P - erase begin
1940
 4376  F8AA9E                	WndEscP:
1941
 4377  F8AA9E  20 7F AC      		jsr	SaveCursPos
1942
 4378  F8AAA1  20 CF AC      	?01:	jsr	PutBlank
1943
 4379  F8AAA4  C4 8F         		cpy	ScnLeft
1944
 4380  F8AAA6  D0 05         		bne	?02
1945
 4381  F8AAA8  20 07 AB      		jsr	TabCheck
1946
 4382  F8AAAB  90 8C         		bcc	CsrRest
1947
 4383  F8AAAD  20 51 AC      	?02:	jsr	MoveLeft
1948
 4384  F8AAB0  90 EF         		bcc	?01
1949
 4385
1950
 4386                        	; ESC-@ - cancella resto dello schermo
1951
 4387  F8AAB2                	WndEscAt:
1952
 4388  F8AAB2  20 7F AC      		jsr	SaveCursPos
1953
 4389  F8AAB5  20 8E A7      	?01:	jsr	ClrRowY
1954
 4390  F8AAB8  E6 94         		inc	ScnRow
1955
 4391  F8AABA  20 6F A3      		jsr	WndGetAddr
1956
 4392  F8AABD  A4 8F         		ldy	ScnLeft
1957
 4393  F8AABF  20 07 AB      		jsr	TabCheck
1958
 4394  F8AAC2  B0 F1         		bcs	?01
1959
 4395  F8AAC4  A5 94         		lda	ScnRow
1960
 4396  F8AAC6  C5 90         		cmp	ScnBottom
1961
 4397  F8AAC8  90 EB         		bcc	?01
1962
 4398  F8AACA  F0 E9         		beq	?01
1963
 4399  F8AACC  4C 39 AA      		jmp	CsrRest
1964
 4400  F8AACF
1965
 4401                        	; ESC-V - scroll up
1966
 4402  F8AACF                	WndEscV:
1967
 4403  F8AACF  20 7F AC      		jsr	SaveCursPos
1968
 4404  F8AAD2  DA            		phx
1969
 4405  F8AAD3  20 A5 A6      		jsr	WndScroll
1970
 4406  F8AAD6  68            		pla
1971
 4407  F8AAD7  85 9D         		sta	ScnSaveRow
1972
 4408  F8AAD9  4C 39 AA      		jmp	CsrRest
1973
 4409  F8AADC
1974
 4410                        	; ESC-W - scroll Down
1975
 4411  F8AADC                	WndEscW:
1976
 4412  F8AADC  20 7F AC      		jsr	SaveCursPos
1977
 4413  F8AADF  20 07 AB      		jsr	TabCheck
1978
 4414  F8AAE2  B0 03         		bcs	?01
1979
 4415  F8AAE4  38            		sec
1980
 4416  F8AAE5  66 96         		ror	ScnRowStart
1981
 4417  F8AAE7  A5 8E         	?01:	lda	ScnTop
1982
 4418  F8AAE9  85 94         		sta	ScnRow
1983
 4419  F8AAEB  20 7C A6      		jsr	InsertRow
1984
 4420  F8AAEE  20 16 AB      		jsr	TabSetupX
1985
  Tue Jul 17 11:00:17 2018                                                                                               Page   33
1986
 
1987
 
1988
 
1989
 
1990
 4421  F8AAF1  4C 39 AA      		jmp	CsrRest
1991
 4422  F8AAF4
1992
 4423                        	; ESC-K - fine riga
1993
 4424  F8AAF4                	WndEscK:
1994
 4425  F8AAF4  20 D4 AB      		jsr	FindEndRow
1995
 4426  F8AAF7  4C 57 A6      		jmp	CheckCurs
1996
 4427
1997
 4428  F8AAFA                	WindowOrg:
1998
 4429  F8AAFA  A4 95         		ldy	ScnCol
1999
 4430  F8AAFC  A6 94         		ldx	ScnRow
2000
 4431  F8AAFE  86 8E         		stx	ScnTop
2001
 4432  F8AB00  84 8F         		sty	ScnLeft
2002
 4433  F8AB02  85 90         		sta	ScnBottom
2003
 4434  F8AB04  4C 76 AA      		jmp	_SetWnd2
2004
 4435
2005
 4436  F8AB07                	TabCheck:
2006
 4437  F8AB07  A6 94         		ldx	ScnRow
2007
 4438  F8AB09                	TabCheckX:
2008
 4439  F8AB09  20 2D AB      		jsr	MaskRow
2009
 4440  F8AB0C  35 82         		and	ScnMapTabs2,x
2010
 4441  F8AB0E  C9 01         		cmp	#$01
2011
 4442  F8AB10  80 0D         		bra	_TabExit
2012
 4443  F8AB12                	TabSetup:
2013
 4444  F8AB12  A6 94         		ldx	ScnRow
2014
 4445  F8AB14                	TabSetup2:
2015
 4446  F8AB14  B0 0C         		bcs	_Tab2Check
2016
 4447  F8AB16                	TabSetupX:
2017
 4448  F8AB16  20 2D AB      		jsr	MaskRow
2018
 4449  F8AB19  49 FF         		eor	#$FF
2019
 4450  F8AB1B  35 82         		and	ScnMapTabs2,x
2020
 4451  F8AB1D                	_Tab2Set:
2021
 4452  F8AB1D  95 82         		sta	ScnMapTabs2,x
2022
 4453  F8AB1F                	_TabExit:
2023
 4454  F8AB1F  A6 9B         		ldx	ScnTmpL
2024
 4455  F8AB21  60            		rts
2025
 4456  F8AB22                	_Tab2Check:
2026
 4457  F8AB22  24 75         		bit	ScnScroll
2027
 4458  F8AB24  70 E3         		bvs	TabCheckX
2028
 4459  F8AB26  20 2D AB      		jsr	MaskRow
2029
 4460  F8AB29  15 82         		ora	ScnMapTabs2,x
2030
 4461  F8AB2B  D0 F0         		bne	_Tab2Set
2031
 4462  F8AB2D
2032
 4463  F8AB2D                	MaskRow:
2033
 4464  F8AB2D  86 9B         		stx	ScnTmpL
2034
 4465  F8AB2F  8A            		txa
2035
 4466  F8AB30  29 07         		and	#$07
2036
 4467  F8AB32  AA            		tax
2037
 4468  F8AB33  BF CC AE F8   		lda	>MSKROW,x		; forza ABS LONG
2038
 4469  F8AB37  48            		pha
2039
 4470  F8AB38  A5 9B         		lda	ScnTmpL
2040
 4471  F8AB3A  4A            		lsr	a
2041
 4472  F8AB3B  4A            		lsr	a
2042
 4473  F8AB3C  4A            		lsr	a
2043
 4474  F8AB3D  AA            		tax
2044
 4475  F8AB3E  68            		pla
2045
 4476  F8AB3F  60            		rts
2046
 4477
2047
  Tue Jul 17 11:00:17 2018                                                                                               Page   34
2048
 
2049
 
2050
 
2051
 
2052
 4478                        	; ESC-J
2053
 4479  F8AB40                	WndEscJ:
2054
 4480  F8AB40  A4 8F         		ldy	ScnLeft
2055
 4481  F8AB42  84 95         		sty	ScnCol
2056
 4482  F8AB44
2057
 4483  F8AB44                	WndEscJ2:
2058
 4484  F8AB44  20 07 AB      		jsr	TabCheck
2059
 4485  F8AB47  90 06         		bcc	?02
2060
 4486  F8AB49  C6 94         		dec	ScnRow
2061
 4487  F8AB4B  10 F7         		bpl	WndEscJ2
2062
 4488  F8AB4D  E6 94         		inc	ScnRow
2063
 4489  F8AB4F  4C 6F A3      	?02:	jmp	WndGetAddr
2064
 4490
2065
 4491                        	; ESC-I - insert line
2066
 4492  F8AB52                	WndEscI:
2067
 4493  F8AB52  20 7C A6      		jsr	InsertRow
2068
 4494  F8AB55  20 69 A3      		jsr	WndLeft
2069
 4495  F8AB58  E8            		inx
2070
 4496  F8AB59  20 09 AB      		jsr	TabCheckX
2071
 4497  F8AB5C  08            		php
2072
 4498  F8AB5D  20 12 AB      		jsr	TabSetup
2073
 4499  F8AB60  28            		plp
2074
 4500  F8AB61  B0 03         		bcs	?01
2075
 4501  F8AB63  38            		sec
2076
 4502  F8AB64  66 96         		ror	ScnRowStart
2077
 4503  F8AB66  60            	?01:	rts
2078
 4504
2079
 4505                        	; ESC-D - delete line
2080
 4506  F8AB67                	WndEscD:
2081
 4507  F8AB67  20 44 AB      		jsr	WndEscJ2
2082
 4508  F8AB6A  A5 8E         		lda	ScnTop
2083
 4509  F8AB6C  48            		pha
2084
 4510  F8AB6D  A5 94         		lda	ScnRow
2085
 4511  F8AB6F  85 8E         		sta	ScnTop
2086
 4512  F8AB71  A5 75         		lda	ScnScroll
2087
 4513  F8AB73  48            		pha
2088
 4514  F8AB74  A9 80         		lda	#$80
2089
 4515  F8AB76  85 75         		sta	ScnScroll
2090
 4516  F8AB78  20 B7 A6      		jsr	PP02
2091
 4517  F8AB7B  68            		pla
2092
 4518  F8AB7C  85 75         		sta	ScnScroll
2093
 4519  F8AB7E  A5 8E         		lda	ScnTop
2094
 4520  F8AB80  85 94         		sta	ScnRow
2095
 4521  F8AB82  68            		pla
2096
 4522  F8AB83  85 8E         		sta	ScnTop
2097
 4523  F8AB85  38            		sec
2098
 4524  F8AB86  66 96         		ror	ScnRowStart
2099
 4525  F8AB88  4C 69 A3      		jmp	WndLeft
2100
 4526
2101
 4527  F8AB8B                	FindEndRow2:
2102
 4528  F8AB8B  A6 B0         		ldx	ScnLstRow		; riga ultima posizione di input
2103
 4529  F8AB8D  86 94         		stx	ScnRow			; imposta come riga corrente
2104
 4530  F8AB8F  A4 B1         		ldy	ScnLstCol
2105
 4531  F8AB91  84 95         		sty	ScnCol
2106
 4532  F8AB93  4C 6F A3      		jmp	WndGetAddr
2107
 4533
2108
 4534  F8AB96                	_Trim:
2109
  Tue Jul 17 11:00:17 2018                                                                                               Page   35
2110
 
2111
 
2112
 
2113
 
2114
 4535  F8AB96  20 15 AD      	?01:	jsr	GetVDCChar
2115
 4536  F8AB99  A6 94         		ldx	ScnRow
2116
 4537  F8AB9B  C9 20         		cmp	#' '
2117
 4538  F8AB9D  D0 11         		bne	?04
2118
 4539  F8AB9F  A5 94         		lda	ScnRow
2119
 4540  F8ABA1  C5 AE         		cmp	ScnInpRow
2120
 4541  F8ABA3  D0 04         		bne	?02
2121
 4542  F8ABA5  C4 AF         		cpy	ScnInpCol
2122
 4543  F8ABA7  F0 05         		beq	?03
2123
 4544  F8ABA9  20 51 AC      	?02:	jsr	MoveLeft
2124
 4545  F8ABAC  80 E8         		bra	?01
2125
 4546  F8ABAE  84 98         	?03:	sty	ScnColStart		; forza campo input vuoto
2126
 4547  F8ABB0  60            	?04:	rts
2127
 4548
2128
 4549  F8ABB1                	FindEndRow3:
2129
 4550  F8ABB1  A6 B0         		ldx	ScnLstRow		; riga ultima posizione di input
2130
 4551  F8ABB3  86 94         		stx	ScnRow			; imposta come riga corrente
2131
 4552  F8ABB5  A4 B1         		ldy	ScnLstCol
2132
 4553  F8ABB7  84 95         		sty	ScnCol
2133
 4554  F8ABB9  84 98         		sty	ScnColStart		; copia di ScnLstCol
2134
 4555  F8ABBB  E4 AE         		cpx	ScnInpRow
2135
 4556  F8ABBD  D0 04         		bne	?20
2136
 4557  F8ABBF  C4 AF         		cpy	ScnInpCol
2137
 4558  F8ABC1  F0 5A         		beq	_FindEnd		; campo input vuoto
2138
 4559  F8ABC3  20 51 AC      	?20:	jsr	MoveLeft		; cursore ad ultima posizione utile
2139
 4560  F8ABC6  20 6F A3      		jsr	WndGetAddr
2140
 4561  F8ABC9  A9 04         		lda	#$04			; test bit 2
2141
 4562  F8ABCB  24 B2         		bit	ScnFlag
2142
 4563  F8ABCD  D0 4E         		bne	_FindEnd
2143
 4564  F8ABCF  20 96 AB      		jsr	_Trim
2144
 4565  F8ABD2  80 49         		bra	_FindEnd
2145
 4566  F8ABD4
2146
 4567                        	; Cerca fine della riga
2147
 4568  F8ABD4                	FindEndRow:
2148
 4569  F8ABD4  24 B2         		bit	ScnFlag
2149
 4570  F8ABD6  10 1E         		bpl	?00			; modo normale
2150
 4571  F8ABD8  A6 B0         		ldx	ScnLstRow		; riga ultima posizione di input
2151
 4572  F8ABDA  86 94         		stx	ScnRow			; imposta come riga corrente
2152
 4573  F8ABDC  A4 B1         		ldy	ScnLstCol
2153
 4574  F8ABDE  84 95         		sty	ScnCol
2154
 4575  F8ABE0  E4 AE         		cpx	ScnInpRow
2155
 4576  F8ABE2  D0 04         		bne	?20
2156
 4577  F8ABE4  C4 AF         		cpy	ScnInpCol
2157
 4578  F8ABE6  F0 35         		beq	?03			; campo input vuoto
2158
 4579  F8ABE8  24 B2         	?20:	bit	ScnFlag
2159
 4580  F8ABEA  70 13         		bvs	?00a
2160
 4581  F8ABEC  C4 8F         		cpy	ScnLeft
2161
 4582  F8ABEE  D0 0F         		bne	?00a
2162
 4583  F8ABF0  C6 94         		dec	ScnRow
2163
 4584  F8ABF2  A4 91         		ldy	ScnRight
2164
 4585  F8ABF4  80 09         		bra	?00a
2165
 4586  F8ABF6  E6 94         	?00:	inc	ScnRow
2166
 4587  F8ABF8  20 07 AB      		jsr	TabCheck
2167
 4588  F8ABFB  B0 F9         		bcs	?00
2168
 4589  F8ABFD  C6 94         		dec	ScnRow
2169
 4590  F8ABFF  20 6F A3      	?00a:	jsr	WndGetAddr
2170
 4591  F8AC02  A4 91         		ldy	ScnRight
2171
  Tue Jul 17 11:00:17 2018                                                                                               Page   36
2172
 
2173
 
2174
 
2175
 
2176
 4592  F8AC04  84 95         		sty	ScnCol
2177
 4593  F8AC06  20 15 AD      	?01:	jsr	GetVDCChar
2178
 4594  F8AC09  A6 94         		ldx	ScnRow
2179
 4595  F8AC0B  C9 20         		cmp	#' '
2180
 4596  F8AC0D  D0 0E         		bne	?03
2181
 4597  F8AC0F  C4 8F         		cpy	ScnLeft
2182
 4598  F8AC11  D0 05         		bne	?02
2183
 4599  F8AC13  20 07 AB      		jsr	TabCheck
2184
 4600  F8AC16  90 05         		bcc	?03
2185
 4601  F8AC18  20 51 AC      	?02:	jsr	MoveLeft
2186
 4602  F8AC1B  90 E9         		bcc	?01
2187
 4603  F8AC1D                	?03:
2188
 4604  F8AC1D                	_FindEnd:
2189
 4605  F8AC1D  84 97         		sty	ScnInput
2190
 4606  F8AC1F  60            		rts
2191
 4607  F8AC20
2192
 4608                        	; Muove cursore a destra - update ScnCol
2193
 4609                        	; Out:	C = 0 se ScnRow non cambiato
2194
 4610                        	;	C = 1 se ScnRow cambiato
2195
 4611  F8AC20                	MoveRight:
2196
 4612  F8AC20  24 B2         		bit	ScnFlag
2197
 4613  F8AC22  10 1A         		bpl	?00			; modo normale
2198
 4614  F8AC24  A4 95         		ldy	ScnCol			; test: cursore ad ultima posizione ?
2199
 4615  F8AC26  C4 91         		cpy	ScnRight
2200
 4616  F8AC28  90 14         		bcc	?00			; no
2201
 4617  F8AC2A  24 B2         		bit	ScnFlag
2202
 4618  F8AC2C  70 0C         		bvs	?15			; input mono-linea - esce
2203
 4619  F8AC2E  A4 AE         		ldy	ScnInpRow		; ultima riga ?
2204
 4620  F8AC30  C4 8E         		cpy	ScnTop
2205
 4621  F8AC32  D0 0A         		bne	?00			; no
2206
 4622  F8AC34  A4 94         		ldy	ScnRow
2207
 4623  F8AC36  C4 90         		cpy	ScnBottom
2208
 4624  F8AC38  90 04         		bcc	?00
2209
 4625  F8AC3A  A4 95         	?15:	ldy	ScnCol
2210
 4626  F8AC3C  18            		clc				; non aggiorna ScnCol
2211
 4627  F8AC3D  60            		rts
2212
 4628  F8AC3E  48            	?00:	pha
2213
 4629  F8AC3F  A4 95         		ldy	ScnCol
2214
 4630  F8AC41  C4 91         		cpy	ScnRight
2215
 4631  F8AC43  90 07         		bcc	?01
2216
 4632  F8AC45  20 94 A3      		jsr	WndNewLine
2217
 4633  F8AC48  A4 8F         		ldy	ScnLeft
2218
 4634  F8AC4A  88            		dey
2219
 4635  F8AC4B  38            		sec
2220
 4636  F8AC4C  C8            	?01:	iny
2221
 4637  F8AC4D  84 95         		sty	ScnCol
2222
 4638  F8AC4F  68            		pla
2223
 4639  F8AC50  60            		rts
2224
 4640  F8AC51
2225
 4641                        	; Muove cursore a sinistra
2226
 4642  F8AC51                	MoveLeft:
2227
 4643  F8AC51  24 B2         		bit	ScnFlag
2228
 4644  F8AC53  10 0C         		bpl	?00			; modo normale
2229
 4645  F8AC55  A4 AE         		ldy	ScnInpRow		; modo input line
2230
 4646  F8AC57  C4 94         		cpy	ScnRow			; riga attuale > riga start input
2231
 4647  F8AC59  90 06         		bcc	?00			; cursore possibile a sinistra
2232
 4648                        		; riga attuale = riga start input: cursore limitato
2233
  Tue Jul 17 11:00:17 2018                                                                                               Page   37
2234
 
2235
 
2236
 
2237
 
2238
 4649                        		; a sinistra alla posizione ScnInpCol
2239
 4650  F8AC5B  A4 AF         		ldy	ScnInpCol
2240
 4651  F8AC5D  C4 95         		cpy	ScnCol
2241
 4652  F8AC5F  B0 18         		bcs	?02			; cursore a posizione ScnInpCol
2242
 4653  F8AC61  A4 95         	?00:	ldy	ScnCol
2243
 4654  F8AC63  88            		dey
2244
 4655  F8AC64  30 04         		bmi	?01
2245
 4656  F8AC66  C4 8F         		cpy	ScnLeft
2246
 4657  F8AC68  B0 0F         		bcs	?02
2247
 4658  F8AC6A  A4 8E         	?01:	ldy	ScnTop
2248
 4659  F8AC6C  C4 94         		cpy	ScnRow
2249
 4660  F8AC6E  B0 0E         		bcs	?03
2250
 4661  F8AC70  C6 94         		dec	ScnRow
2251
 4662  F8AC72  48            		pha
2252
 4663  F8AC73  20 6F A3      		jsr	WndGetAddr
2253
 4664  F8AC76  68            		pla
2254
 4665  F8AC77  A4 91         		ldy	ScnRight
2255
 4666  F8AC79  84 95         	?02:	sty	ScnCol
2256
 4667  F8AC7B  C4 91         		cpy	ScnRight
2257
 4668  F8AC7D  18            		clc
2258
 4669  F8AC7E  60            	?03:	rts
2259
 4670
2260
 4671                        	; Salva posizione cursore
2261
 4672  F8AC7F                	SaveCursPos:
2262
 4673  F8AC7F  A4 95         		ldy	ScnCol
2263
 4674  F8AC81  84 9E         		sty	ScnSaveCol
2264
 4675  F8AC83  A6 94         		ldx	ScnRow
2265
 4676  F8AC85  86 9D         		stx	ScnSaveRow
2266
 4677  F8AC87  60            		rts
2267
 4678  F8AC88
2268
 4679                        	; Get limiti finestra
2269
 4680  F8AC88                	GetWndOrg:
2270
 4681  F8AC88  38            		sec
2271
 4682  F8AC89  A5 90         		lda	ScnBottom
2272
 4683  F8AC8B  E5 8E         		sbc	ScnTop
2273
 4684  F8AC8D  A8            		tay
2274
 4685  F8AC8E  38            		sec
2275
 4686  F8AC8F  A5 91         		lda	ScnRight
2276
 4687  F8AC91  E5 8F         		sbc	ScnLeft
2277
 4688  F8AC93  AA            		tax
2278
 4689  F8AC94  A5 77         		lda	ScnMaxCols
2279
 4690  F8AC96  60            		rts
2280
 4691  F8AC97
2281
 4692                        	; Get/Set posizione cursore
2282
 4693  F8AC97                	GetSetPos:
2283
 4694  F8AC97  B0 29         		bcs	?05		; get cursor pos
2284
 4695  F8AC99  8A            		txa
2285
 4696  F8AC9A  65 8E         		adc	ScnTop
2286
 4697  F8AC9C  B0 14         		bcs	?03
2287
 4698  F8AC9E  C5 90         		cmp	ScnBottom
2288
 4699  F8ACA0  F0 02         		beq	?01
2289
 4700  F8ACA2  B0 0E         		bcs	?03
2290
 4701  F8ACA4  48            	?01:	pha
2291
 4702  F8ACA5  18            		clc
2292
 4703  F8ACA6  98            		tya
2293
 4704  F8ACA7  65 8F         		adc	ScnLeft
2294
 4705  F8ACA9  B0 06         		bcs	?02
2295
  Tue Jul 17 11:00:17 2018                                                                                               Page   38
2296
 
2297
 
2298
 
2299
 
2300
 4706  F8ACAB  C5 91         		cmp	ScnRight
2301
 4707  F8ACAD  F0 04         		beq	?04
2302
 4708  F8ACAF  90 02         		bcc	?04
2303
 4709  F8ACB1  68            	?02:	pla
2304
 4710  F8ACB2  60            	?03:	rts
2305
 4711  F8ACB3  85 95         	?04:	sta	ScnCol
2306
 4712  F8ACB5  85 98         		sta	ScnColStart
2307
 4713  F8ACB7  68            		pla
2308
 4714  F8ACB8  85 94         		sta	ScnRow
2309
 4715  F8ACBA  85 96         		sta	ScnRowStart
2310
 4716  F8ACBC  20 6F A3      		jsr	WndGetAddr
2311
 4717  F8ACBF  20 CA AD      		jsr	SetVDCCurs
2312
 4718  F8ACC2  A5 94         	?05:	lda	ScnRow
2313
 4719  F8ACC4  E5 8E         		sbc	ScnTop
2314
 4720  F8ACC6  AA            		tax
2315
 4721  F8ACC7  38            		sec
2316
 4722  F8ACC8  A5 95         		lda	ScnCol
2317
 4723  F8ACCA  E5 8F         		sbc	ScnLeft
2318
 4724  F8ACCC  A8            		tay
2319
 4725  F8ACCD  18            		clc
2320
 4726  F8ACCE  60            		rts
2321
 4727
2322
 4728                        	; Stampa spazio
2323
 4729  F8ACCF                	PutBlank:
2324
 4730  F8ACCF  A5 92         		lda	ScnAttr
2325
 4731  F8ACD1  24 6D         		bit	<VBBRam
2326
 4732  F8ACD3  10 04         		bpl	?10
2327
 4733  F8ACD5  29 1F         		and	#$1F
2328
 4734  F8ACD7  80 02         		bra	?12
2329
 4735  F8ACD9  29 8F         	?10:	and	#$8F
2330
 4736  F8ACDB  AA            	?12:	tax
2331
 4737  F8ACDC  A9 20         		lda	#' '
2332
 4738  F8ACDE  80 06         		bra	PutCharAttr
2333
 4739  F8ACE0
2334
 4740                        	; Stampa carattere con attributo di default
2335
 4741  F8ACE0                	PutChar:
2336
 4742  F8ACE0  A6 92         		ldx	ScnAttr
2337
 4743  F8ACE2  80 02         		bra	PutCharAttr
2338
 4744  F8ACE4
2339
 4745                        	; Stampa carattere con attributo alternativo
2340
 4746  F8ACE4                	PutChar2:
2341
 4747  F8ACE4  A6 93         		ldx	ScnAttr2
2342
 4748  F8ACE6
2343
 4749  F8ACE6                	PutCharAttr:
2344
 4750  F8ACE6  A8            		tay
2345
 4751  F8ACE7  20 7F A3      		jsr	WndGetAddr2
2346
 4752  F8ACEA  98            		tya
2347
 4753  F8ACEB  A4 95         		ldy	ScnCol
2348
 4754  F8ACED  24 6D         		bit	<VBBRam
2349
 4755  F8ACEF  10 14         		bpl	?10
2350
 4756  F8ACF1  86 8D         		stx	ScnTmpx
2351
 4757  F8ACF3  AE 0C FC      		ldx	CREMEOFF		; salva bit corrente
2352
 4758  F8ACF6  DA            		phx
2353
 4759  F8ACF7  8D 0D FC      		sta	!CREMEON		; abilita memoria video
2354
 4760  F8ACFA  97 86         		sta	[ScnPtr],y
2355
 4761  F8ACFC  A5 8D         		lda	ScnTmpx
2356
 4762  F8ACFE  97 8A         		sta	[ScnAtPtr],y
2357
  Tue Jul 17 11:00:17 2018                                                                                               Page   39
2358
 
2359
 
2360
 
2361
 
2362
 4763  F8AD00  FA            		plx
2363
 4764  F8AD01  9D 0C FC      		sta	!CREMEOFF,x		; ripristina bit corrente
2364
 4765  F8AD04  60            		rts
2365
 4766  F8AD05  48            	?10:	pha
2366
 4767  F8AD06  DA            		phx
2367
 4768  F8AD07  20 F0 AD      		jsr	SetARam
2368
 4769  F8AD0A  68            		pla
2369
 4770  F8AD0B  20 0F AE      		jsr	SetVDCReg31
2370
 4771  F8AD0E  20 FD AD      		jsr	SetVRam
2371
 4772  F8AD11  68            		pla
2372
 4773  F8AD12  4C 0F AE      		jmp	SetVDCReg31
2373
 4774  F8AD15
2374
 4775                        	; Get carattare e attributo
2375
 4776  F8AD15                	GetVDCChar:
2376
 4777  F8AD15  A4 95         		ldy	ScnCol
2377
 4778  F8AD17  24 6D         		bit	<VBBRam
2378
 4779  F8AD19  10 12         		bpl	?10
2379
 4780  F8AD1B  AE 0C FC      		ldx	CREMEOFF		; salva bit corrente
2380
 4781  F8AD1E  DA            		phx
2381
 4782  F8AD1F  8D 0D FC      		sta	!CREMEON		; abilita memoria video
2382
 4783  F8AD22  B7 8A         		lda	[ScnAtPtr],y
2383
 4784  F8AD24  85 93         		sta	ScnAttr2
2384
 4785  F8AD26  B7 86         		lda	[ScnPtr],y
2385
 4786  F8AD28  FA            		plx
2386
 4787  F8AD29  9D 0C FC      		sta	!CREMEOFF,x		; ripristina bit corrente
2387
 4788  F8AD2C  60            		rts
2388
 4789  F8AD2D  20 F0 AD      	?10:	jsr	SetARam
2389
 4790  F8AD30  20 1D AE      		jsr	GetVDCReg31
2390
 4791  F8AD33  85 93         		sta	ScnAttr2
2391
 4792  F8AD35  20 FD AD      		jsr	SetVRam
2392
 4793  F8AD38  4C 1D AE      		jmp	GetVDCReg31
2393
 4794  F8AD3B
2394
 4795                        	; Cursore VDC ON
2395
 4796  F8AD3B                	VDCCursOn:
2396
 4797  F8AD3B  20 7F A3      		jsr	WndGetAddr2
2397
 4798  F8AD3E  A4 95         		ldy	ScnCol
2398
 4799  F8AD40  24 6D         		bit	<VBBRam
2399
 4800  F8AD42  10 1D         		bpl	?10
2400
 4801  F8AD44  AE 0C FC      		ldx	CREMEOFF		; salva bit corrente
2401
 4802  F8AD47  DA            		phx
2402
 4803  F8AD48  8D 0D FC      		sta	!CREMEON		; abilita memoria video
2403
 4804  F8AD4B  B7 8A         		lda	[ScnAtPtr],y
2404
 4805  F8AD4D  85 72         		sta	ScnSaveAttr
2405
 4806  F8AD4F  29 E0         		and	#$E0
2406
 4807  F8AD51  85 9C         		sta	ScnTmpH
2407
 4808  F8AD53  A5 92         		lda	ScnAttr
2408
 4809  F8AD55  29 1F         		and	#$1F
2409
 4810  F8AD57  05 9C         		ora	ScnTmpH
2410
 4811  F8AD59  97 8A         		sta	[ScnAtPtr],y
2411
 4812  F8AD5B  FA            		plx
2412
 4813  F8AD5C  9D 0C FC      		sta	!CREMEOFF,x		; ripristina bit corrente
2413
 4814  F8AD5F  80 18         		bra	VDCCursor
2414
 4815  F8AD61  20 F0 AD      	?10:	jsr	SetARam
2415
 4816  F8AD64  20 1D AE      		jsr	GetVDCReg31
2416
 4817  F8AD67  85 72         		sta	ScnSaveAttr
2417
 4818  F8AD69  29 F0         		and	#$F0
2418
 4819  F8AD6B  85 9C         		sta	ScnTmpH
2419
  Tue Jul 17 11:00:17 2018                                                                                               Page   40
2420
 
2421
 
2422
 
2423
 
2424
 4820  F8AD6D  20 F0 AD      		jsr	SetARam
2425
 4821  F8AD70  A5 92         		lda	ScnAttr
2426
 4822  F8AD72  29 0F         		and	#$0F
2427
 4823  F8AD74  05 9C         		ora	ScnTmpH
2428
 4824  F8AD76  20 0F AE      		jsr	SetVDCReg31
2429
 4825  F8AD79
2430
 4826  F8AD79                	VDCCursor:
2431
 4827  F8AD79  A2 0A         		ldx	#$0A
2432
 4828  F8AD7B  A5 71         		lda	ScnCursMode
2433
 4829  F8AD7D  24 6D         		bit	<VBBRam
2434
 4830  F8AD7F  30 03         		bmi	?10
2435
 4831  F8AD81  4C 11 AE      		jmp	SetVDCReg
2436
 4832  F8AD84  8E 70 FC      	?10:	stx	CRTAddr
2437
 4833  F8AD87  8D 71 FC      		sta	CRTData
2438
 4834  F8AD8A  A9 04         		lda	#$04
2439
 4835  F8AD8C  0C 76 FC      		tsb	!PIAVBB+PIAPRB
2440
 4836  F8AD8F  60            		rts
2441
 4837
2442
 4838                        	; Cursore VDC OFF
2443
 4839  F8AD90                	VDCCursOff:
2444
 4840  F8AD90  24 6D         		bit	<VBBRam
2445
 4841  F8AD92  10 11         		bpl	?10
2446
 4842  F8AD94  A5 72         		lda	ScnSaveAttr
2447
 4843  F8AD96  AE 0C FC      		ldx	CREMEOFF		; salva bit corrente
2448
 4844  F8AD99  DA            		phx
2449
 4845  F8AD9A  8D 0D FC      		sta	!CREMEON		; abilita memoria video
2450
 4846  F8AD9D  97 8A         		sta	[ScnAtPtr],y
2451
 4847  F8AD9F  FA            		plx
2452
 4848  F8ADA0  9D 0C FC      		sta	!CREMEOFF,x		; ripristina bit corrente
2453
 4849  F8ADA3  80 08         		bra	CursOff2
2454
 4850  F8ADA5  20 F0 AD      	?10:	jsr	SetARam
2455
 4851  F8ADA8  A5 72         		lda	ScnSaveAttr
2456
 4852  F8ADAA  20 0F AE      		jsr	SetVDCReg31
2457
 4853  F8ADAD                	CursOff2:
2458
 4854  F8ADAD  A2 0A         		ldx	#$0A
2459
 4855  F8ADAF  A9 20         		lda	#$20
2460
 4856  F8ADB1  24 6D         		bit	<VBBRam
2461
 4857  F8ADB3  10 5C         		bpl	SetVDCReg
2462
 4858  F8ADB5  8E 70 FC      		stx	CRTAddr
2463
 4859  F8ADB8  8D 71 FC      		sta	CRTData
2464
 4860  F8ADBB  A9 04         		lda	#$04
2465
 4861  F8ADBD  1C 76 FC      		trb	!PIAVBB+PIAPRB
2466
 4862  F8ADC0  60            		rts
2467
 4863
2468
 4864                        	; stampa a schermo carattere in A
2469
 4865  F8ADC1                	_ScnCharOut:
2470
 4866  F8ADC1  85 9F         		sta	ScnCurChr
2471
 4867  F8ADC3  20 9A A5      		jsr	ScnOutChr
2472
 4868  F8ADC6  A5 9F         		lda	ScnCurChr
2473
 4869  F8ADC8  85 A0         		sta	ScnLstChr
2474
 4870  F8ADCA
2475
 4871                        	; Imposta indirizzo cursore VDC
2476
 4872  F8ADCA                	SetVDCCurs:
2477
 4873  F8ADCA  A2 0E         		ldx	#$0E
2478
 4874  F8ADCC  18            		clc
2479
 4875  F8ADCD  A5 86         		lda	ScnPtr
2480
 4876  F8ADCF  65 95         		adc	ScnCol
2481
  Tue Jul 17 11:00:17 2018                                                                                               Page   41
2482
 
2483
 
2484
 
2485
 
2486
 4877  F8ADD1  48            		pha
2487
 4878  F8ADD2  A5 87         		lda	ScnPtr+1
2488
 4879  F8ADD4  69 00         		adc	#0
2489
 4880  F8ADD6  24 6D         		bit	<VBBRam
2490
 4881  F8ADD8  10 0F         		bpl	?10
2491
 4882  F8ADDA  8E 70 FC      		stx	CRTAddr
2492
 4883  F8ADDD  8D 71 FC      		sta	CRTData
2493
 4884  F8ADE0  E8            		inx
2494
 4885  F8ADE1  68            		pla
2495
 4886  F8ADE2  8E 70 FC      		stx	CRTAddr
2496
 4887  F8ADE5  8D 71 FC      		sta	CRTData
2497
 4888  F8ADE8  60            		rts
2498
 4889  F8ADE9  20 11 AE      	?10:	jsr	SetVDCReg
2499
 4890  F8ADEC  E8            		inx
2500
 4891  F8ADED  68            		pla
2501
 4892  F8ADEE  80 21         		bra	SetVDCReg
2502
 4893
2503
 4894  F8ADF0
2504
 4895                        	; Imposta RAM ATTRIBUTI alla riga corrente e colonna Y
2505
 4896  F8ADF0                	SetARam:
2506
 4897  F8ADF0  A2 12         		ldx	#$12
2507
 4898  F8ADF2  18            		clc
2508
 4899  F8ADF3  98            		tya
2509
 4900  F8ADF4  65 8A         		adc	ScnAtPtr
2510
 4901  F8ADF6  48            		pha
2511
 4902  F8ADF7  A9 00         		lda	#0
2512
 4903  F8ADF9  65 8B         		adc	ScnAtPtr+1
2513
 4904  F8ADFB  80 0B         		bra	_SetVRam2
2514
 4905
2515
 4906                        	; Imposta RAM VIDEO alla riga corrente e colonna Y
2516
 4907  F8ADFD                	SetVRam:
2517
 4908  F8ADFD  A2 12         		ldx	#$12
2518
 4909  F8ADFF  18            		clc
2519
 4910  F8AE00  98            		tya
2520
 4911  F8AE01  65 86         		adc	ScnPtr
2521
 4912  F8AE03  48            		pha
2522
 4913  F8AE04  A9 00         		lda	#0
2523
 4914  F8AE06  65 87         		adc	ScnPtr+1
2524
 4915  F8AE08                	_SetVRam2:
2525
 4916  F8AE08  20 11 AE      		jsr	SetVDCReg
2526
 4917  F8AE0B  68            		pla
2527
 4918  F8AE0C  E8            		inx
2528
 4919  F8AE0D  80 02         		bra	SetVDCReg
2529
 4920
2530
 4921                        	; Chiamare con M,X=8 bit e DBR = 0
2531
 4922  F8AE0F                	SetVDCReg31:
2532
 4923  F8AE0F  A2 1F         		ldx	#$1F
2533
 4924  F8AE11                	SetVDCReg:
2534
 4925  F8AE11  8E 4E FD      		stx	VDCAddr
2535
 4926  F8AE14  2C 4E FD      	?01:	bit	VDCStatus
2536
 4927  F8AE17  10 FB         		bpl	?01
2537
 4928  F8AE19  8D 4F FD      		sta	VDCData
2538
 4929  F8AE1C  60            		rts
2539
 4930
2540
 4931                        	; Chiamare con M,X=8 bit e DBR = 0
2541
 4932  F8AE1D                	GetVDCReg31:
2542
 4933  F8AE1D  A2 1F         		ldx	#$1F
2543
  Tue Jul 17 11:00:17 2018                                                                                               Page   42
2544
 
2545
 
2546
 
2547
 
2548
 4934  F8AE1F                	GetVDCReg:
2549
 4935  F8AE1F  8E 4E FD      		stx	VDCAddr
2550
 4936  F8AE22  2C 4E FD      	?01:	bit	VDCStatus
2551
 4937  F8AE25  10 FB         		bpl	?01
2552
 4938  F8AE27  AD 4F FD      		lda	VDCData
2553
 4939  F8AE2A  60            		rts
2554
 4940
2555
 4941                        	;------------------------------------------------------------
2556
 4942  F8AE2B
2557
 4943
2558
 4944                        	; copia font nella memoria del VDC
2559
 4945                        	; Chiamare con M,X=8 bit e DBR = 0
2560
 4946  F8AE2B                	SetVDCFont:
2561
 4947                        		.LONGA	off
2562
 4948                        		.LONGI	off
2563
 4949
2564
 4950  F8AE2B  A2 12         		ldx	#$12		; imposta Hi addr memoria VDC
2565
 4951  F8AE2D  A9 00         		lda	#$0
2566
 4952  F8AE2F  20 11 AE      		jsr	SetVDCReg
2567
 4953  F8AE32  E8            		inx
2568
 4954  F8AE33  A9 00         		lda	#0		; Lo addr
2569
 4955  F8AE35  20 11 AE      		jsr	SetVDCReg
2570
 4956  F8AE38  A9 FF         		lda	#^VGA8x8L	; segmento font
2571
 4957  F8AE3A  85 A4         		sta	ScnPrm+2
2572
 4958  F8AE3C  A9 04         		lda	#$04		; 1K
2573
 4959  F8AE3E  A2 F8         		ldx	#>VGA8x8L	; carica font VGA 8x8 L
2574
 4960  F8AE40  A0 08         		ldy	#CGAWIDTH
2575
 4961  F8AE42  20 5D AE      		jsr	CopyFont
2576
 4962  F8AE45  A9 04         		lda	#$04		; 1K
2577
 4963  F8AE47  A2 FC         		ldx	#>VGA8x8H	; carica font VGA 8x8 H
2578
 4964  F8AE49  A0 08         		ldy	#CGAWIDTH
2579
 4965  F8AE4B  20 5D AE      		jsr	CopyFont
2580
 4966  F8AE4E  A9 04         		lda	#$04		; 1K
2581
 4967  F8AE50  A2 F8         		ldx	#>VGA8x8L	; carica font VGA 8x8 L
2582
 4968  F8AE52  A0 08         		ldy	#CGAWIDTH
2583
 4969  F8AE54  20 5D AE      		jsr	CopyFont
2584
 4970  F8AE57  A9 04         		lda	#$04		; 1K
2585
 4971  F8AE59  A2 FC         		ldx	#>VGA8x8H	; carica font VGA 8x8 H
2586
 4972  F8AE5B  A0 08         		ldy	#CGAWIDTH
2587
 4973
2588
 4974                        	; copia un set font nella memoria del VDC
2589
 4975                        	; In:	- X = ptr. Hi blocco font
2590
 4976                        	;	  Y = numero linee scansione font
2591
 4977                        	;	  A = numero pagine da 256b
2592
 4978                        	; Chiamare con M,X=8 bit e DBR = 0
2593
 4979  F8AE5D                	CopyFont:
2594
 4980                        		.LONGA	off
2595
 4981                        		.LONGI	off
2596
 4982  F8AE5D
2597
 4983  F8AE5D  86 A3         		stx	ScnPrm+1		; salva ptr Hi blocco font
2598
 4984  F8AE5F  64 A2         		stz	ScnPrm			; ptr Lo = 0
2599
 4985  F8AE61  84 9A         		sty	ScnSaveY		; linee scansione font
2600
 4986  F8AE63  18            		clc
2601
 4987  F8AE64  65 A3         		adc	ScnPrm+1		; fine font attuale (Hi)
2602
 4988  F8AE66  85 99         		sta	ScnSaveX
2603
 4989  F8AE68  A9 10         		lda	#CHARWIDTH
2604
 4990  F8AE6A  38            		sec
2605
  Tue Jul 17 11:00:17 2018                                                                                               Page   43
2606
 
2607
 
2608
 
2609
 
2610
 4991  F8AE6B  E5 9A         		sbc	ScnSaveY		; linee residue
2611
 4992  F8AE6D  85 9B         		sta	ScnTmpL
2612
 4993  F8AE6F  A0 00         		ldy	#0
2613
 4994  F8AE71  B7 A2         	?01:	lda	[ScnPrm],y		; load byte font
2614
 4995  F8AE73  20 0F AE      		jsr	SetVDCReg31		; copia in video ram
2615
 4996  F8AE76  C8            		iny
2616
 4997  F8AE77  C4 9A         		cpy	ScnSaveY		; loop N linee scansione
2617
 4998  F8AE79  90 F6         		bcc	?01
2618
 4999  F8AE7B  A4 9B         		ldy	ScnTmpL			; linee residue
2619
 5000  F8AE7D  F0 08         		beq	?03			; no linee residue
2620
 5001  F8AE7F  A9 00         		lda	#0
2621
 5002  F8AE81  20 0F AE      	?02:	jsr	SetVDCReg31		; azzera linee residue
2622
 5003  F8AE84  88            		dey
2623
 5004  F8AE85  D0 FA         		bne	?02
2624
 5005  F8AE87  A5 A2         	?03:	lda	ScnPrm			; aggiorna long ptr
2625
 5006  F8AE89  18            		clc
2626
 5007  F8AE8A  65 9A         		adc	ScnSaveY		; aggiunge numero linee
2627
 5008  F8AE8C  85 A2         		sta	ScnPrm
2628
 5009  F8AE8E  90 E1         		bcc	?01			; loop
2629
 5010  F8AE90  E6 A3         		inc	ScnPrm+1
2630
 5011  F8AE92  A5 A3         		lda	ScnPrm+1
2631
 5012  F8AE94  C5 99         		cmp	ScnSaveX
2632
 5013  F8AE96  90 D9         		bcc	?01			; loop
2633
 5014  F8AE98  60            		rts
2634
 5015
2635
 5016  F8AE99                	HistUp:
2636
 5017  F8AE99                	HistDown:
2637
 5018  F8AE99                	BellSnd:
2638
 5019  F8AE99  60            		rts
2639
 5020  F8AE9A
2640
 5021                        	;--------------------------------------------------------------------
2641
 5022  F8AE9A
2642
 5023                        	; tabella indirizzi base video ram
2643
 5024  F8AE9A                	SCRNADDRL:
2644
 5025  F8AE9A  00 50 A0 F0 40 		.DB	$00, $50, $A0, $F0, $40, $90, $E0, $30
2645
               90 E0 30
2646
 5026  F8AEA2  80 D0 20 70 C0 		.DB	$80, $D0, $20, $70, $C0, $10, $60, $B0
2647
               10 60 B0
2648
 5027  F8AEAA  00 50 A0 F0 40 		.DB	$00, $50, $A0, $F0, $40, $90, $E0, $30
2649
               90 E0 30
2650
 5028  F8AEB2  80            		.DB	$80
2651
 5029  F8AEB3
2652
 5030  F8AEB3                	SCRNADDRH:
2653
 5031  F8AEB3  00 00 00 00 01 		.DB	$00, $00, $00, $00, $01, $01, $01, $02
2654
               01 01 02
2655
 5032  F8AEBB  02 02 03 03 03 		.DB	$02, $02, $03, $03, $03, $04, $04, $04
2656
               04 04 04
2657
 5033  F8AEC3  05 05 05 05 06 		.DB	$05, $05, $05, $05, $06, $06, $06, $07
2658
               06 06 07
2659
 5034  F8AECB  07            		.DB	$07
2660
 5035
2661
 5036                        	;--------------------------------------------------------------------
2662
 5037
2663
 5038  F8AECC                	MSKROW:
2664
 5039  F8AECC  80 40 20 10 08 		.DB	$80, $40, $20, $10, $08, $04, $02, $01
2665
               04 02 01
2666
 5040
2667
  Tue Jul 17 11:00:17 2018                                                                                               Page   44
2668
 
2669
 
2670
 
2671
 
2672
 5041                        	; maschera attributi video board
2673
 5042  F8AED4                	MSKROW2:
2674
 5043  F8AED4  00 80 20 40   		.DB	$00, $80, $20, $40
2675
 5044
2676
 5045                        	;--------------------------------------------------------------------
2677
 5046
2678
 5047                        	; funzioni sequenze di escape: SCN_ESC, SCN_COL, SCN_BKGCOL, SCN_PRTSCN
2679
 5048  F8AED8                	SCNESCSEQ:
2680
 5049  F8AED8  57A5 30A5 42A5 		.DW	ScnProcEsc,	ScnProcCol,	ScnProcBkgCol,	ScnProcPrnt
2681
               2FA5
2682
 5050  F8AEE0
2683
 5051                        	; funzioni codici di controllo $01..$12
2684
 5052  F8AEE0                	CTRLVCTRS:
2685
 5053  F8AEE0  6FA8 48A8 5EA8 		.DW	CsrUp,		CsrRight,	CsrDown,	CsrLeft
2686
               81A8
2687
 5054  F8AEE8  CEA3 E8A3 99AE 		.DW	ScnHome,	ScnEnd, 	BellSnd, 	KeyBack
2688
               FBA9
2689
 5055  F8AEF0  C0A8 08A9 D7A8 		.DW	CsrTab, 	LineFeed, 	CsrShTab,	ScnClr
2690
               C8A3
2691
 5056  F8AEF8  7BA5 41A8 75A9 		.DW	ScnOutCR,	KeybInsert,	KeyDel,		ScnOutCR
2692
               7BA5
2693
 5057  F8AF00  99AE 99AE     		.DW	HistUp,		HistDown
2694
 5058  F8AF04
2695
 5059                        		;.DW	FixedCurs, FlashCurs, ,
2696
 5060                        		;.DW	, BellSnd
2697
 5061
2698
 5062                        	; tabella comandi dopo tasto ESCAPE (@..Z)
2699
 5063  F8AF04                	ESCVCTRS:
2700
 5064  F8AF04  B2AA 34A9 65AA 		DW	WndEscAt, 	FlashCurs, 	WndEscB, 	FixedCurs
2701
               27A9
2702
 5065  F8AF0C  67AB 99A5 99A5 		DW	WndEscD, 	_RTS0,		 _RTS0, 	TabToggle
2703
               EAA8
2704
 5066  F8AF14  99A5 52AB 40AB 		DW	_RTS0, 		WndEscI, 	WndEscJ, 	WndEscK
2705
               F4AA
2706
 5067  F8AF1C  99A5 99A5 99A5 		DW	_RTS0, 		_RTS0, 		_RTS0, 		WndEscO
2707
               89A5
2708
 5068  F8AF24  9EAA 8AAA 99A5 		DW	WndEscP, 	WndEscQ, 	_RTS0,		_RTS0
2709
               99A5
2710
 5069  F8AF2C  63AA 99A5 CFAA 		DW	WndEscT, 	_RTS0, 		WndEscV, 	WndEscW
2711
               DCAA
2712
 5070  F8AF34  7EAA 59AA 55AA 		DW	SetMaxWnd, 	SetDefTabs, 	ClearTabs
2713
 5071
2714
 5072                        	;--------------------------------------------------------------------
2715
 5073                        	; tabella conversione da codice tasto a codice schermo ($82..$90)
2716
 5074
2717
 5075  F8AF3A                	KBCONV:
2718
 5076  F8AF3A  1E            		.DB	SCN_PRTSCN
2719
 5077  F8AF3B  01 05 0E 02   		.DB	SCN_CSRUP,	SCN_HOME,	SCN_INSERT,	SCN_CSRRIGHT
2720
 5078  F8AF3F  11 0B 12 03   		.DB	SCN_PGUP,	SCN_SHTAB,	SCN_PGDOWN,	SCN_CSRDOWN
2721
 5079  F8AF43  06 10 0F 04   		.DB	SCN_END,	SCN_SHCR,	SCN_DELETE,	SCN_CSRLEFT
2722
 5080  F8AF47  08            		.DB	SCN_BS
2723
 5081  F8AF48
2724
 5082
2725
 5083                        	;----------------------------------------------------------------------------
2726
 5084                        	; Costanti inizializzazione registri VDC
2727
 5085                        	;----------------------------------------------------------------------------
2728
 5086
2729
  Tue Jul 17 11:00:17 2018                                                                                               Page   45
2730
 
2731
 
2732
 
2733
 
2734
 5087                        	; DOT CLOCK 16MHZ - FH = 16KHz FV = 50HZ (FH +, FV +)
2735
 5088  F8AF48                	VDCREG16:
2736
 5089  F8AF48  00 7F 01 50 02 			.BYTE	$00, $7f, $01, $50, $02, $66, $03, $44 ; invece di 49
2737
               66 03 44
2738
 5090  F8AF50  04 26 05 00 06 			.BYTE	$04, $26, $05, $00, $06, $19, $07, $20
2739
               19 07 20
2740
 5091  F8AF58  08 00 09 07 0A 			.BYTE	$08, $00, $09, $07, $0A, $20, $0B, $07
2741
               20 0B 07
2742
 5092  F8AF60  0C 40 0D 00 0E 			.BYTE	$0C, $40, $0D, $00, $0E, $00, $0F, $00
2743
               00 0F 00
2744
 5093  F8AF68  14 48 15 00 17 			.BYTE	$14, $48, $15, $00, $17, $08, $18, $20
2745
               08 18 20
2746
 5094  F8AF70  19 47 1A F0 1B 			.BYTE	$19, $47, $1A, $F0, $1B, $00, $1C, $10
2747
               00 1C 10
2748
 5095  F8AF78  1D 07 22 7D 23 			.BYTE	$1D, $07, $22, $7D, $23, $64, $24, $05,
2749
               64 24 05
2750
 5096  F8AF80  16 78 FF      			.BYTE	$16, $78, $FF
2751
 
2752
 
2753
             Lines Assembled : 5067                  Errors : 0
2754
 
2755
 
2756