Subversion Repositories MB01 Project

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 - 1
  Tue Jul 17 11:00:22 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\FD\qedt.asm
13
                       Output Filename : obj\FD\qedt.obj
14
                       Listing Has Been Relocated
15
 
16
 
17
 2586                        	.LIST		on
18
 2587
19
 2599                        	.LIST on
20
 2600
21
 2601                        	DIRP00:	.SECTION page0, ref_only, common	;Direct-Page 00
22
 2602
23
 2603  000000                		.ABSOLUTE		;; inizia sempre da $00
24
 2604  000000                		.ORG		0x00
25
 2605  000000
26
 2606  000000  0000          	JiffyClk	.DW			; contatore 10ms 32 bit
27
 2607  000002  0000          			.DW
28
 2608  000004                	SysTmr		.DS	SYSTMRCNT	; system timer 0 (10ms)
29
 2609  000008                	SysTMF		.DS	SYSTMRCNT	; flag timer (80 -> start)
30
 2610  00000C  00            	Bnk0Flag	.DB			; <7>: flag test RAM banco 0 ok
31
 2611                        						; <6>: flag warm reset
32
 2612  00000D  00            	RTCFlag		.DB
33
 2613
34
 2614  00000E                	diskstat	.DS	2	; flag device on ata bus #0 & #1
35
 2615                        					; <7>: device ready
36
 2616                        					; <6>: compact flash device (C.F.)
37
 2617                        					; <5>: device identification ok
38
 2618                        					; <4>: MBR loaded
39
 2619                        					; <3>: valid signature in MBR
40
 2620                        					; <2>: first partition found&active
41
 2621                        					; <1>:
42
 2622                        					; <0>: valid partition flag
43
 2623
44
 2624                        					; <7>: device ready
45
 2625                        					; <6>: USB device
46
 2626                        					; <5>: compact flash device (C.F.)
47
 2627                        					; <4>: device identification ok
48
 2628                        					; <3>: MBR loaded
49
 2629                        					; <2>: first partition found&active
50
 2630                        					; <1>: always 1
51
 2631                        					; <0>: valid partition flag
52
 2632  000010
53
 2633
54
 2634          00000E        	atadev		.EQU	diskstat
55
 2635
56
 2636  000010                	usbdev		.DS	2	; flag flash disk on usb bus #0
57
 2637                        					; <7>: device plugged and ready
58
 2638                        					; <6>: always 1
59
 2639                        					; <5>: device identification ok
60
 2640                        					; <4>: MBR loaded
61
 2641                        					; <3>: valid signature in MBR
62
 2642                        					; <2>: first partition found&active
63
  Tue Jul 17 11:00:22 2018                                                                                               Page    2
64
 
65
 
66
 
67
 
68
 2643                        					; <1>:
69
 2644                        					; <0>: valid partition flag
70
 2645
71
 2646  000012                	diskmax		.DS	16	; disk max. sector's
72
 2647          000012        	atasec		.EQU	diskmax
73
 2648          00001A        	usbsec		.EQU	diskmax+8
74
 2649
75
 2650
76
 2651  000022                	atambr		.DS	8	; data for first partition found in mbr
77
 2652                        					; first 3 bytes for start sector of partition
78
 2653                        					; last byte for partition type
79
 2654  00002A                	usbmbr		.DS	8
80
 2655
81
 2656  000032                	ataprt		.DS	8	; total sec's of first partition
82
 2657  00003A                	usbprt		.DS	8	; total sec's of first partition
83
 2658
84
 2659
85
 2660  000042  00            	usb0ch		.DB	; usb0 (ch375/ch376) flag
86
 2661                        				; <7>: module on
87
 2662                        				; <6>: ch376 flag
88
 2663                        				; <5:0>: chip version
89
 2664
90
 2665  000043  00            	usb0st		.DB	; usb0 status
91
 2666                        				; <7>: usb0 host mode ok
92
 2667                        				; <6>: flash disk attached flag
93
 2668                        				; <5>: usb device attached
94
 2669
95
 2670  000044  00            	fdcdrv		.DB		; phisycal drive status (drive #0)
96
 2671                        					; <7>: disk format established in bit 0&1
97
 2672                        					; <6>: double step seek done
98
 2673                        					; <5>: trust format bit's (set after ok r/w)
99
 2674                        					; <4>: write protect bit (if disk in drive)
100
 2675                        					; <3>: don't care
101
 2676                        					; <2>: don't care
102
 2677                        					; <1>: HD disk if set else DD disk
103
 2678                        					; <0>: CBM format if set else IBM format
104
 2679
105
 2680  000045  00            	vdrive		.DB		; virtual drive status (ram disk, drive #1)
106
 2681                        					; <7>: disk format established in bit 0&1
107
 2682                        					; <6>: change disk simulation (after format)
108
 2683                        					; <5>: don't care
109
 2684                        					; <4>: write protect bit (under sw control)
110
 2685                        					; <3>: don't care
111
 2686                        					; <2>: don't care
112
 2687                        					; <1>: HD disk if set else DD disk
113
 2688                        					; <0>: CBM format if set else IBM format
114
 2689
115
 2690  000046  00            	fdcctl		.DB		; fdc controller status
116
 2691                        					; <7>: drive is attached
117
 2692                        					; <6>: drive need recalibration (restore)
118
 2693                        					; <5>: FDC controller ok
119
 2694                        					; <4>: motor on
120
 2695                        					; <3>: dma is active
121
 2696                        					; <2>: dma chip ok (post routine)
122
 2697                        					; <1>: clock rate (1=HD,0=DD)
123
 2698                        					; <0>: disk ready
124
 2699
125
  Tue Jul 17 11:00:22 2018                                                                                               Page    3
126
 
127
 
128
 
129
 
130
 2700  000047  00            	fdctrk		.DB		; fd: current seek track
131
 2701  000048  00            	fdcerr		.DB		; fd: last error code
132
 2702  000049  00            	ataerr		.DB		; ata: last error code
133
 2703  00004A  00            	ataxer		.DB		; ata: last extended error code
134
 2704
135
 2705  00004B  00            	CtrlBrk		.DB		; flag CTRL+BREAK (NMI)
136
 2706
137
 2707  00004C  0000          	MemTop		.DW		; top memoria RAM
138
 2708  00004E  00            			.DB		; banco top mem
139
 2709
140
 2710  00004F  00            	DflTxtIn	.DB		; device di default text input
141
 2711  000050  00            	DflTxtOut	.DB		; device di default text output
142
 2712
143
 2713  000051                	COPPtr		LP		; long pointer for COP decoding
144
 2714  000054  00            	COPIdx		.DB		; COP signature/index
145
 2715
146
 2716  000055  00            	BiosEnt		.DB		; flag accesso a bios setup
147
 2717
148
 2718                        	; variabili utilizzate da ACIA
149
 2719  000056                	spwrk		.DS	$30
150
 2720
151
 2721                        	; bios mem
152
 2722  000086  0000          	nsize		.DW	; dimensione blocco da allocare
153
 2723                        	;bsize		.DW	; dimensione vera blocco free
154
 2724  000088  0000          	splitsz		.DW	; dimensione blocco splittato
155
 2725  00008A  0000          	bfree		.DW	; puntatore blocco free
156
 2726  00008C  0000          	hdrptr		.DW	; puntatore header heap
157
 2727
158
 2728  00008E  0000          	pbrklv		.DW	; current break level of current process
159
 2729  000090  0000          	pbrkmin		.DW	; minimum breal level of current process
160
 2730  000092  0000          	pbrkmax		.DW	; maximum breal level of current process
161
 2731  000094
162
 2732                        	; bios temp. work area
163
 2733  000094                	bwrktmp		.DS	$28
164
 2734
165
 2735  0000BC  00            	coptmp		.DB	; temp. used while cop
166
 2736
167
 2737  0000BD  00            	tstser		.DB	; check ser/usb test board post
168
 2738                        				; <7>: VIA2 ok
169
 2739                        				; <6>: PICRAM ok
170
 2740                        				; <1>: UART 16C550 ok
171
 2741                        				; <0>: R65C51 ok
172
 2742
173
 2743
174
 2744                        	;crc16		.DW
175
 2745
176
 2746  0000BD                		.RELATIVE
177
 2747
178
 2748                        		.ENDS
179
 2749
180
 2750          [01]          	.IFDEF		_ACIA_INC_
181
 2751                        		.INCLUDE INC\SP.INC
182
 2752          [00]          	.ENDIF
183
 2753
184
 2767                        	.LIST on
185
 2768
186
 2769          000060        	KBDBUFLEN	.EQU	96		; dimensione buffer di tastiera
187
  Tue Jul 17 11:00:22 2018                                                                                               Page    4
188
 
189
 
190
 
191
 
192
 2770
193
 2771                        	DIRP01:	.SECTION page0, ref_only, common	;Direct-Page 01
194
 2772
195
 2773  000000                		.ABSOLUTE		;; inizia sempre da $00
196
 2774  000000                		.ORG		0x00
197
 2775
198
 2776  000000
199
 2777  000000                	KbdBuf		.DS	KBDBUFLEN	; buffer della tastiera
200
 2778  000060  00            	KbdITail	.DB			; coda buffer tastiera
201
 2779  000061  00            	KbdIHead	.DB			; testa buffer tastiera
202
 2780  000062  00            	KbdCnt		.DB			; numero bytes nel buffer
203
 2781  000063  00            	KbdShift	.DB
204
 2782  000064  00            	KbdFlag		.DB
205
 2783  000065  00            	KbdToggle	.DB
206
 2784  000066  00            	KbdSt		.DB			; status tastiera dopo reset
207
 2785  000067  00            	PS2Ctl		.DB			; flag controller PS2 keyboard
208
 2786
209
 2787  000068  00            	LCDFlag		.DB
210
 2788  000069  00            	LCDTmp		.DB
211
 2789  00006A  0000          	LCDVal		.DW
212
 2790
213
 2791  00006C  00            	VBBFlag		.DB		; flag video board
214
 2792  00006D  00            	VBBRam		.DB		; flag video RAM
215
 2793
216
 2794  00006E  00            	ScnLinTmp	.DB
217
 2795  00006F  00            	ScnChBase	.DB		; base video ram VDC
218
 2796  000070  00            	ScnAttBase	.DB		; base ram attributi VDC
219
 2797  000071  00            	ScnCursMode	.DB		; VDC cursore default
220
 2798  000072  00            	ScnSaveAttr	.DB
221
 2799  000073  00            	ScnInsert	.DB
222
 2800  000074  00            	ScnAutoIns	.DB		; bit 7 -> autoins - bit 6 -> modo input
223
 2801  000075  00            	ScnScroll	.DB
224
 2802  000076  00            	ScnMaxRow	.DB		; max. righe finestra (-1)
225
 2803  000077  00            	ScnMaxCols	.DB		; max. colonne finestra (-1)
226
 2804
227
 2805  000078                	ScnMapTabs1	.DS	10
228
 2806  000082                	ScnMapTabs2	.DS	4
229
 2807  000086
230
 2808  000086  0000          	ScnPtr		.DW		; puntatore video ram linea corrente
231
 2809  000088  00            			.DB
232
 2810
233
 2811  000089  00            	ScnFiltLen	.DB		; lunghezza set caratteri filtro
234
 2812
235
 2813  00008A  0000          	ScnAtPtr	.DW		; puntatore attributi ram linea corrente
236
 2814  00008C  00            			.DB
237
 2815
238
 2816  00008D  00            	ScnTmpx		.DB		; temporaneo: durante put char
239
 2817  00008E
240
 2818  00008E  00            	ScnTop		.DB		; riga superiore finestra
241
 2819  00008F  00            	ScnLeft		.DB		; colonna sinistra finestra
242
 2820  000090  00            	ScnBottom	.DB		; riga inferiore finestra
243
 2821  000091  00            	ScnRight	.DB		; colonna destra finestra
244
 2822  000092  00            	ScnAttr		.DB		; attributo default
245
 2823  000093  00            	ScnAttr2	.DB		; attributo alternativo
246
 2824  000094  00            	ScnRow		.DB		; riga cursore
247
 2825  000095  00            	ScnCol		.DB		; colonna cursore
248
 2826  000096  00            	ScnRowStart	.DB		; riga di start input
249
  Tue Jul 17 11:00:22 2018                                                                                               Page    5
250
 
251
 
252
 
253
 
254
 2827  000097  00            	ScnInput	.DB		; riga di fine input
255
 2828  000098  00            	ScnColStart	.DB		; colonna di start input
256
 2829  000099  00            	ScnSaveX	.DB
257
 2830  00009A  00            	ScnSaveY	.DB
258
 2831  00009B  00            	ScnTmpL		.DB
259
 2832  00009C  00            	ScnTmpH		.DB
260
 2833  00009D  00            	ScnSaveRow	.DB
261
 2834  00009E  00            	ScnSaveCol	.DB
262
 2835  00009F  00            	ScnCurChr	.DB
263
 2836  0000A0  00            	ScnLstChr	.DB
264
 2837  0000A1  00            	ScnCR		.DB
265
 2838  0000A2  0000          	ScnPrm		.DW		; puntatore long utilizzato da print imm
266
 2839  0000A4  00            			.DB		; banco puntatore ScnPrm
267
 2840  0000A5  00            	ScnMode		.DB		; flag modo schermo
268
 2841
269
 2842  0000A6                	ScnPtr1		LP
270
 2843
271
 2844  0000A9  00            	ScnDefCol	.DB		; default foreground color
272
 2845
273
 2846  0000AA                	ScnPtr2		LP
274
 2847
275
 2848  0000AD  00            	ScnDefBkgCol	.DB		; default background color
276
 2849  0000AE  00            	ScnInpRow	.DB		; modo input line: riga start input
277
 2850  0000AF  00            	ScnInpCol	.DB		; modo input line: colonna start input
278
 2851  0000B0  00            	ScnLstRow	.DB		; modo input line: riga stop input
279
 2852  0000B1  00            	ScnLstCol	.DB		; modo input line: colonna stop input
280
 2853  0000B2  00            	ScnFlag		.DB		; Bit 7: input line - Bit 6: input riga unica
281
 2854  0000B3  00            	ScnMask		.DB		; flag tasti funzione editor di linea
282
 2855  0000B4  00            	ScnFilt		.DB		; filtro tasti editor di linea
283
 2856  0000B5  00            	ScnCntrl	.DB		; flag ASCII/CONTROL
284
 2857                        	;DflTxtIn	.DB		; device di default text input
285
 2858                        	;DflTxtOut	.DB		; device di default text output
286
 2859  0000B6
287
 2860          000047        	SCNCLRLEN	.EQU	($ - ScnLinTmp - 1)
288
 2861
289
 2862                        	;SCNCLRLEN	.EQU	(DflTxtOut - ScnLinTmp)
290
 2863
291
 2864                        	; variabili monitor
292
 2865  0000B6  00            	SMAddrL		.DB	; address low/high
293
 2866  0000B7  00            	SMAddrH		.DB
294
 2867  0000B8  00            	SMAddrK		.DB	; address bank
295
 2868  0000B9  00            	SMFlag32	.DB	; flag parametro 32 bit
296
 2869  0000BA  00            	SMTmpL		.DB	; temp. low/high
297
 2870  0000BB  00            	SMTmpH		.DB
298
 2871  0000BC  00            	SMTmpK		.DB	; temp. bank
299
 2872  0000BD  00            	SMTmpKK		.DB	; high byte param. 32 bit
300
 2873  0000BE  00            	SMSizeL		.DB	; size low/high
301
 2874  0000BF  00            	SMSizeH		.DB
302
 2875  0000C0  00            	SMSizeK		.DB	; size bank
303
 2876  0000C1  00            	SMXAddrL	.DB	; address low/high XM
304
 2877  0000C2  00            	SMXAddrH	.DB
305
 2878  0000C3  00            	SMXAddrK	.DB	; address bank XM
306
 2879  0000C4  00            	SMbndx		.DB	; indice input buffer
307
 2880  0000C5  00            	SMnprm		.DB	; numero parametri riga di comando
308
 2881  0000C6  00            	SMdumb		.DB
309
 2882  0000C7  00            	SMkr		.DB
310
 2883  0000C8  0000          	SMpc		.DW
311
  Tue Jul 17 11:00:22 2018                                                                                               Page    6
312
 
313
 
314
 
315
 
316
 2884  0000CA  00            	SMsr		.DB
317
 2885  0000CB  00            	SMbr		.DB
318
 2886  0000CC  0000          	SMdp		.DW
319
 2887  0000CE  0000          	SMac		.DW
320
 2888  0000D0  0000          	SMxr		.DW
321
 2889  0000D2  0000          	SMyr		.DW
322
 2890  0000D4  0000          	SMsp		.DW
323
 2891
324
 2892  0000D6  00            	SMAuxL		.DB
325
 2893  0000D7  00            	SMAuxH		.DB
326
 2894
327
 2895  0000D8  00            	asmlong		.DB	; flag for CPU in 16 mode
328
 2896                        				; <7> -> A/M in 16 bit mode
329
 2897                        				; <6> -> X/Y in 16 bit mode
330
 2898  0000D9  00            	asmcpu		.DB	; <7> -> 8 bit family
331
 2899                        				; <6> -> 65C02 cmos version
332
 2900
333
 2901  0000DA  00            	SMctx		.DB	; context (if = $00 no quit command)
334
 2902  0000DB                	SMrsm		LP	; long pointer to resume caller context
335
 2903
336
 2904  0000DE  00            	rtcadr		.DB	; rtc internal ram address
337
 2905  0000DF  00            	rtcbnk		.DB	; RTC internal bank ram
338
 2906  0000E0  00            	cmdlin		.DB	;
339
 2907  0000E1  00            	SMesc		.DB
340
 2908
341
 2909  0000E2                	SMXTmp:		.DS	26	; 26 bytes tmp
342
 2910
343
 2911          0000E2        	SMTmp2		.EQU	SMXTmp
344
 2912          0000E4        	SMTmp3		.EQU	SMXTmp+2
345
 2913          0000E6        	SMdwTmp1	.EQU	SMXTmp+4
346
 2914          0000EA        	SMdwTmp2	.EQU	SMXTmp+8
347
 2915          0000EE        	SMFsrc		.EQU	SMXTmp+12	; source bank for flash update
348
 2916          0000EF        	SMFflag		.EQU	SMXTmp+13	; flag file for flash update
349
 2917          0000F0        	SMXPos2		.EQU	SMXTmp+14
350
 2918          0000F1        	SMYPos2		.EQU	SMXTmp+15
351
 2919          0000F2        	SMXPos3		.EQU	SMXTmp+16
352
 2920          0000F3        	SMYPos3		.EQU	SMXTmp+17
353
 2921                        	;SMAuxL		.EQU	SMXTmp+18
354
 2922                        	;SMAuxH		.EQU	SMXTmp+19
355
 2923          0000F6        	SMXPos		.EQU	SMXTmp+20
356
 2924          0000F7        	SMYPos		.EQU	SMXTmp+21
357
 2925          0000F8        	SMdwTmp3	.EQU	SMXTmp+22
358
 2926
359
 2927          0000E2        	atcmd		.EQU	SMXTmp		; save @ command
360
 2928          0000E3        	atnum		.EQU	SMXTmp+1	; @ command index
361
 2929          0000E4        	atflag		.EQU	SMXTmp+2	; @ L,S,V,R,W start address flag
362
 2930          0000E5        	atbnk		.EQU	SMXTmp+3	; @ L,S,V,R,W bank
363
 2931          0000E6        	atstr		.EQU	SMXTmp+4	; @ command string start (word)
364
 2932          0000E8        	atstart		.EQU	SMXTmp+6	; @ L,S,V,R,W start address (word)
365
 2933          0000EA        	atend		.EQU	SMXTmp+8	; @ S,W end address (word)
366
 2934          0000EC        	atbuf		.EQU	SMXTmp+10	; @ local buffer pointer (word)
367
 2935          0000EE        	atipb		.EQU	SMXTmp+12	; @ bank of input buffer
368
 2936          0000EF        	atdir		.EQU	SMXTmp+13	; @ load dir flag
369
 2937          0000F0        	atptr		.EQU	SMXTmp+14	; @ load dir pointer (word)
370
 2938          0000F2        	atsiz		.EQU	SMXTmp+16	; @ buffer size (word)
371
 2939          0000F5        	atlp		.EQU	SMXTmp+19	; @ long pointer
372
 2940          0000F8        	atsa		.EQU	SMXTmp+22	; @ sa
373
  Tue Jul 17 11:00:22 2018                                                                                               Page    7
374
 
375
 
376
 
377
 
378
 2941
379
 2942          0000E2        	btmpx		.EQU	SMXTmp		; asc2bin conversion
380
 2943          0000E3        	brtcsec		.EQU	SMXTmp+1
381
 2944          0000E4        	brtcmin		.EQU	SMXTmp+2
382
 2945          0000E5        	brtchour	.EQU	SMXTmp+3
383
 2946          0000E6        	brtcday		.EQU	SMXTmp+4
384
 2947          0000E7        	brtcmonth	.EQU	SMXTmp+5
385
 2948          0000E8        	brtcyear	.EQU	SMXTmp+6
386
 2949          0000E9        	brtcct		.EQU	SMXTmp+7
387
 2950
388
 2951
389
 2952  0000FC                		.RELATIVE
390
 2953
391
 2954                        		.ENDS
392
 2955
393
 2958                        		.LIST on
394
 2959  F8FFB1                		.INCLUDE inc\dpqedt.inc
395
 2960                        	;; QEDIT
396
 2961
397
 2962          010000        	TXTADDR		.EQU	$010000		; text char's address
398
 2963          010730        	LSTLINE		.EQU	$010730		; last text line address
399
 2964          010780        	STLINE		.EQU	$010780		; status line char's address
400
 2965          010800        	TXTATTR		.EQU	$010800		; text attributes address
401
 2966          010F80        	STLATTR		.EQU	$010F80		; status line attributes address
402
 2967          000780        	TXTCNT		.EQU	(STLATTR - TXTATTR)
403
 2968          000050        	MAXCOLS		.EQU	80		; max. columuns
404
 2969          00004B        	COLX		.EQU	$4B		; V1574
405
 2970          0000F0        	MAXTEXTLEN	.EQU	$F0
406
 2971          00FFFD        	MAXLINES	.EQU	$FFFD		; max text lines count in one buffer
407
 2972
408
 2973          000004        	DEFLTAB		.EQU	4		; default tab value
409
 2974          000002        	MINTABVAL	.EQU	2
410
 2975          000028        	MAXTABVAL	.EQU	40
411
 2976
412
 2977                        	;;DEFCURS		.EQU	$60		; default cursor mode
413
 2978          0000C0        	EDEFCURS	.EQU	$C0		; default cursor mode edit window
414
 2979                        						; (blinking underline)
415
 2980                        						; <7>: blink
416
 2981                        						; <6>: underline cursor
417
 2982          000080        	CDEFCURS	.EQU	$80		; default cursor mode command line
418
 2983                        						; blinking block cursor
419
 2984                        						; <7>: blink
420
 2985                        						; <6>: underline cursor
421
 2986
422
 2987          000000        	DEFATTR		.EQU	0		; default editor window attribute
423
 2988          000001        	DEFSATTR	.EQU	1		; default status line attribute
424
 2989          000002        	DEFEATTR	.EQU	2		; default error message attribute
425
 2990          000003        	DEFCATTR	.EQU	3		; default command line attribute
426
 2991          000004        	DFGATTR		.EQU	4		; disabled flag attribute in s.l.
427
 2992
428
 2993          000000        	BNEXT	.EQU	0
429
 2994          000002        	BPREV	.EQU	2
430
 2995          000004        	BNDX	.EQU	4
431
 2996          000005        	BSTART	.EQU	5
432
 2997
433
 2998          00000A        	MAXBUF		.EQU	10		; buffer count (0..9)
434
 2999          00000A        	CLIPBRD		.EQU	10		; clipboard buffer number
435
  Tue Jul 17 11:00:22 2018                                                                                               Page    8
436
 
437
 
438
 
439
 
440
 3000          000016        	BUFSIZ		.EQU	(MAXBUF + 1) * 2	; buffer table size
441
 3001
442
 3002          000050        	MAXFNAME	.EQU	80		; filename size
443
 3003
444
 3004          000010        	MINPAGE		.EQU	16		; min. # pages to alloc
445
 3005          000040        	MINFREE		.EQU	64		; min. # pages to init free list (16k)
446
 3006
447
 3007                        	; translated keys
448
 3008          000029        	KTAB		.EQU	$29
449
 3009          00002A        	KCR		.EQU	$2A
450
 3010          00002B        	KESC		.EQU	$2B
451
 3011          00002C        	KCTLC		.EQU	$2C
452
 3012          00002D        	KCTLV		.EQU	$2D
453
 3013          00002E        	KCTLX		.EQU	$2E
454
 3014
455
 3015                        	; sezione COMMON -- questo permette di includere il file in piu' file
456
 3016
457
 3017                        	DPQEDT:	.SECTION page0, ref_only, common
458
 3018  000000                		.ABSOLUTE		;; inizia sempre da $00
459
 3019  000000                		.ORG	0x00
460
 3020
461
 3021  000000  0000          	pp0		.DW		; M1F49
462
 3022  000002  0000          	pp2		.DW		; P052
463
 3023  000004  0000          	pp4		.DW		; M364A
464
 3024  000006  0000          	pp6		.DW		; M3647
465
 3025  000008  0000          	pp8		.DW		; P058
466
 3026
467
 3027  00000A  00            	ix0		.DB		; M1F4A
468
 3028  00000B  00            	ix2		.DB		; P053
469
 3029  00000C  00            	ix4		.DB		; M364B
470
 3030  00000D  00            	ix6		.DB		; M3648
471
 3031  00000E  00            	ix8		.DB		; P059
472
 3032
473
 3033  00000F  00            	xbuf		.DB		; P0B0 index of current buffer
474
 3034
475
 3035  000010  0000          	pfree		.DW		; P00E page pointer to blocks free list
476
 3036  000012  0000          	pbuf		.DW		; P00D page pointer to start of current buffer
477
 3037  000014  00            	pblk		.DB		; P04E long pointer to current block
478
 3038  000015  0000          	ppage		.DW		; P04F
479
 3039
480
 3040                        	; these 2 bytes MUST be consecutive !
481
 3041  000017  00            	ixb		.DB		; P050 index of current block
482
 3042  000018  00            	bflag		.DB		; buffer flag
483
 3043                        					; <7>: modified
484
 3044                        					; <6>: ovr mode (default: ins)
485
 3045                        					; <5>: indent mode
486
 3046                        					; <4>: valid drive number & buffer name
487
 3047
488
 3048  000019  00            	deftab		.DB		; M313C default tab value
489
 3049
490
 3050  00001A  0000          	ncount		.DW		; # total lines count of current buffer
491
 3051  00001C  0000          	cline		.DW		; P038/39 current text line with cursor focus
492
 3052  00001E  00            	ccol		.DB		; P035 current text column with cursor focus
493
 3053  00001F  00            	ecol		.DB		; P036 text edit column
494
 3054  000020  00            	srow		.DB		; P05A current screen row
495
 3055  000021  00            	scol		.DB		; P05B current screen column
496
 3056  000022  00            	ccnt		.DB		; P092 # count of chars in current text line
497
  Tue Jul 17 11:00:22 2018                                                                                               Page    9
498
 
499
 
500
 
501
 
502
 3057  000023  00            	fslct		.DB		; M1F48 select text flag mode
503
 3058  000024  00            	nslctl		.DB		; M1F4B selected text count
504
 3059  000025  00            	nslcth		.DB		; M1F4C
505
 3060  000026  00            	rcnt		.DB		; M3649 row counter in edit window
506
 3061  000027  00            	xcol		.DB		; P019 text column for check
507
 3062
508
 3063  000028  0000          	rclip		.DW		; M1F4D/4E selection range in clipboard
509
 3064  00002A  00            	rslctl		.DB		; M26D7 screen reverse attribute range
510
 3065  00002B  00            	rslcth		.DB		; M26D8
511
 3066
512
 3067  00002C  0000          	curs		.DW		; P0D1 cursor address in edit window
513
 3068
514
 3069  00002E  00            	cursmode	.DB		; current cursor mode
515
 3070                        					; <7>: blink
516
 3071                        					; <6>: underline cursor
517
 3072
518
 3073  00002F  00            	ctmp		.DB		; P0FE temp counter (updatew)
519
 3074  000030  00            	ctmp2		.DB		; temp used for manage tab key
520
 3075  000031  00            	keyfg		.DB		; a copy of KbdFlag
521
 3076  000032  00            	embit		.DB		; save current bit of video ram
522
 3077  000033  00            	edtfg		.DB		; editor global flag
523
 3078                        					; <7>: quit from editor
524
 3079                        					; <6>: clipboard flag
525
 3080                        					; <5>: CBM emulation mode
526
 3081                        					; <1>: cut selection flag
527
 3082                        					; <0>: flag while indent blanks insertion
528
 3083
529
 3084  000034                	stxtp		LP		; screen text long pointer
530
 3085  000037  00            	frev		.DB		; M2829 flag reverse attribute
531
 3086  000038                	sattp		LP		; screen attributes long pointer
532
 3087  00003B  00            	eattr		.DB		; M1583 default editor attribute
533
 3088  00003C  00            	slattr		.DB		; M111F default status line attribute
534
 3089  00003D  00            	seatt		.DB		; error message attribute
535
 3090  00003E  00            	scatt		.DB		; command line attribute
536
 3091  00003F  00            	slfg		.DB		; status line flag
537
 3092                        					; <7>: command line mode
538
 3093                        					; <6>: update whole status line
539
 3094                        					; <1>: update caps & num only
540
 3095                        					; <0>: copy of select mode flag for s.l.
541
 3096
542
 3097  000040  00            	sbank		.DB		; save bank while setptr/updptr
543
 3098  000041  00            	saveps		.DB		; save palette address
544
 3099
545
 3100  000042  0000          	cline1		.DW		; update current line in status line
546
 3101  000044  0000          	ncount1		.DW		; update total lines in status line
547
 3102  000046  00            	ccol1		.DB		; update column in status line
548
 3103  000047  00            	xbuf1		.DB		; update buffer # in status line
549
 3104  000048  00            	bflag1		.DB		; update buffer flag in status line
550
 3105  000049  00            	fgatt		.DB		; disabled indicator attribute in status line
551
 3106
552
 3107  00004A  0000          	wtmp		.DW
553
 3108
554
 3109                        	; temporary used by editor and for 2 long pointer (6 bytes)
555
 3110  00004C  0000          	ewtmp		.DW		; editor: temp word
556
 3111  00004E  0000          	ewtmp2		.DW		; editor: temp word
557
 3112  000050  00            	ebtmp		.DB		; editor: temp byte
558
 3113  000051  00            	ebtmp2		.DB		; editor: temp byte
559
  Tue Jul 17 11:00:22 2018                                                                                               Page   10
560
 
561
 
562
 
563
 
564
 3114          00004C        	lptmp1		.EQU	ewtmp
565
 3115          00004F        	lptmp2		.EQU	ewtmp2+1
566
 3116
567
 3117  000052                	pb		LP		; long pointer used byt cut/paste
568
 3118  000055                	pd		LP		; long pointer used by cut/paste
569
 3119  000058  0000          	bka		.DW		; bka & bkb used by cut/past routines
570
 3120  00005A  0000          	bkb		.DW
571
 3121
572
 3122          000052        	tstr2		.EQU	pb	; temp. string (26 bytes)
573
 3123
574
 3124                        	; 16 bytes area for temporary usage (used by garbc routine & scroll)
575
 3125  00005C                	lptc		LP		; temp. long pointer
576
 3126  00005F                	lpte		LP		; temp. long pointer
577
 3127  000062  00            	tmp6		.DB		; 10 temp. bytes
578
 3128  000063  00            	tmp7		.DB
579
 3129  000064  00            	tmp8		.DB
580
 3130  000065  00            	tmp9		.DB
581
 3131  000066  00            	tmpa		.DB
582
 3132  000067  00            	tmpb		.DB
583
 3133  000068  00            	tmpc		.DB
584
 3134  000069  00            	tmpd		.DB
585
 3135  00006A  00            	tmpe		.DB
586
 3136  00006B  00            	tmpf		.DB
587
 3137
588
 3138          000062        	lptc1		.EQU	tmp6	; long pointer used by scroll up/down
589
 3139          000065        	lpte1		.EQU	tmp9	; long pointer used by scroll up/down
590
 3140
591
 3141  00006C                	bstart		.DS	BUFSIZ	; page pointer of start block
592
 3142  000082                	bcur		.DS	BUFSIZ	; page pointer of current block
593
 3143  000098                	bndx		.DS	BUFSIZ	; current block index (low) & buffer flag (high)
594
 3144  0000AE                	bline		.DS	BUFSIZ	; current edit line
595
 3145  0000C4                	btot		.DS	BUFSIZ	; total count of edit lines
596
 3146
597
 3147  0000DA                	longp		LP		; generic long pointer
598
 3148  0000DD  00            	fsmode		DB		; <7>: cbm fs mode
599
 3149                        					; <6>: pascal compiler
600
 3150
601
 3151  0000DE  0000          	dbufsiz		.DW		; disk buffer size
602
 3152  0000E0  0000          	brksav		.DW		; save break level
603
 3153
604
 3154  0000E0                		.RELATIVE
605
 3155                        		.ENDS
606
 3156
607
 3157
608
 3158                        		.CODEFD
609
 3159                        		.LONGA off
610
 3160                        		.LONGI off
611
 3161
612
 3162                        	;---------------------------------------------------
613
 3163
614
 3164                        	; editor main loop
615
 3165  FD0000                	editor:
616
 3166  FD0000  20 FF 16      		jsr	setcurs			; set cursor mode
617
 3167  FD0003  A4 21         	?10:	ldy	scol			; current screen column
618
 3168  FD0005  20 E0 16      		jsr	edcurs			; set cursor position on edit window
619
 3169  FD0008  20 C6 16      		jsr	showcurs		; show cursor
620
 3170  FD000B                	?12:	KBGETIN				; system call - get key
621
  Tue Jul 17 11:00:22 2018                                                                                               Page   11
622
 
623
 
624
 
625
 
626
 3171  FD000B  02 17         		cop	$17
627
 3172                        		.MNLIST
628
 3173  FD000D  AA            		tax
629
 3174  FD000E  D0 0C         		bne	?14			; a key was pressed
630
 3175  FD0010  20 C0 10      		jsr	garbc			; call garbage collection
631
 3176  FD0013  A9 02         		lda	#$02			; update caps & num only
632
 3177  FD0015  04 3F         		tsb	slfg
633
 3178  FD0017  20 4F 05      		jsr	updsl
634
 3179  FD001A  80 EF         		bra	?12
635
 3180  FD001C  85 2F         	?14:	sta	ctmp			; store key code
636
 3181  FD001E  EB            		xba
637
 3182  FD001F  85 30         		sta	ctmp2			; store control key flag
638
 3183  FD0021  20 BB 16      		jsr	hidecurs
639
 3184  FD0024  AF 64 01 00   		lda	>DP01ADDR+KbdFlag
640
 3185  FD0028  85 31         		sta	keyfg			; flag ALT, CTL, SHIFT
641
 3186  FD002A  A5 2F         		lda	ctmp			; A = key code
642
 3187  FD002C  24 30         		bit	ctmp2			; check control key flag
643
 3188  FD002E  10 28         		bpl	?22			; no-control key
644
 3189  FD0030  C9 C4         		cmp	#KB_ALTF1		; ALT-F1..ALT-F11 switch buffer
645
 3190  FD0032  90 0F         		bcc	?16
646
 3191  FD0034  C9 CF         		cmp	#KB_ALTF12
647
 3192  FD0036  B0 0B         		bcs	?16
648
 3193  FD0038  E9 C3         		sbc	#KB_ALTF1-1
649
 3194  FD003A  C5 0F         		cmp	xbuf			; is the current buffer?
650
 3195  FD003C  F0 C5         		beq	?10			; yes, skip
651
 3196  FD003E  20 63 00      		jsr	?50			; switch to buffer
652
 3197  FD0041  80 C0         		bra	?10			; loop
653
 3198  FD0043  A2 15         	?16:	ldx	#KEYTBLLEN		; check control key
654
 3199  FD0045  DF 44 22 FD   	?18:	cmp	>KEYTBL,x
655
 3200  FD0049  F0 05         		beq	?20
656
 3201  FD004B  CA            		dex
657
 3202  FD004C  10 F7         		bpl	?18
658
 3203  FD004E  30 B3         		bmi	?10			; discard
659
 3204  FD0050  8A            	?20:	txa
660
 3205  FD0051  0A            		asl	a
661
 3206  FD0052  AA            		tax
662
 3207  FD0053  FC 5A 22      		jsr	(KEYPROC,x)		; execute key control function
663
 3208  FD0056  80 06         		bra	?23			; loop
664
 3209  FD0058  AA            	?22:	tax				; no-control key
665
 3210  FD0059  30 A8         		bmi	?10			; discard if key code >= 128
666
 3211  FD005B  20 9C 00      		jsr	?80			; no-control key process
667
 3212  FD005E  24 33         	?23:	bit	edtfg			; test bit 7 for quit command
668
 3213  FD0060  10 A1         		bpl	?10			; loop
669
 3214  FD0062  60            	?24:	rts
670
 3215
671
 3216                        	; switch current edit buffer
672
 3217  FD0063  20 F6 0B      	?50:	jsr	switchb
673
 3218  FD0066  B0 FA         		bcs	?24			; memory error
674
 3219  FD0068  64 23         		stz	fslct			; clear select mode flag
675
 3220  FD006A  A9 01         		lda	#$01
676
 3221  FD006C  14 3F         		trb	slfg
677
 3222  FD006E  A9 0C         		lda	#$0C
678
 3223  FD0070  85 20         		sta	srow
679
 3224  FD0072  A9 27         		lda	#$27
680
 3225  FD0074  85 21         		sta	scol
681
 3226  FD0076  A6 0F         		ldx	xbuf
682
 3227  FD0078  A9 40         		lda	#$40
683
  Tue Jul 17 11:00:22 2018                                                                                               Page   12
684
 
685
 
686
 
687
 
688
 3228  FD007A  14 33         		trb	edtfg			; clear clipboard flag
689
 3229  FD007C  E0 0A         		cpx	#CLIPBRD
690
 3230  FD007E  D0 02         		bne	?52
691
 3231  FD0080  04 33         		tsb	edtfg			; set clipboard flag
692
 3232  FD0082  04 3F         	?52:	tsb	slfg			; force update status line
693
 3233  FD0084  A5 2E         		lda	cursmode
694
 3234  FD0086  29 BF         		and	#$BF			; mask off bit 6
695
 3235  FD0088  24 18         		bit	bflag
696
 3236  FD008A  70 02         		bvs	?54			; overwrite mode => block cursor
697
 3237  FD008C  09 40         		ora	#$40			; insert mode => underline cursor
698
 3238  FD008E  85 2E         	?54:	sta	cursmode
699
 3239  FD0090  20 FF 16      		jsr	setcurs
700
 3240  FD0093  4C 32 04      		jmp	updwin
701
 3241
702
 3242                        	; process key code < 128
703
 3243  FD0096  8A            	?76:	txa
704
 3244  FD0097  0A            		asl	a
705
 3245  FD0098  AA            		tax
706
 3246  FD0099  7C 8E 22      		jmp	(KEYPROC2,x)
707
 3247  FD009C  C9 20         	?80:	cmp	#' '
708
 3248  FD009E  B0 0C         		bcs	edkey			; printable key code, insert in buffer
709
 3249  FD00A0  A2 07         		ldx	#KEYTBLLEN2		; find function for key code < 32
710
 3250  FD00A2  DF 86 22 FD   	?84:	cmp	>KEYTBL2,x
711
 3251  FD00A6  F0 EE         		beq	?76
712
 3252  FD00A8  CA            		dex
713
 3253  FD00A9  10 F7         		bpl	?84
714
 3254  FD00AB  60            	kpx:	rts				; discard
715
 3255
716
 3256                        	; P12AF:
717
 3257  FD00AC                	edkey:
718
 3258  FD00AC  A6 23         		LDX	fslct
719
 3259  FD00AE  D0 FB         		bne	kpx
720
 3260  FD00B0  A6 22         		LDX	ccnt
721
 3261  FD00B2  E0 EF         		CPX	#MAXTEXTLEN-1
722
 3262  FD00B4  F0 F5         		beq	kpx
723
 3263  FD00B6  A6 1E         		LDX	ccol
724
 3264  FD00B8  E4 1F         		CPX	ecol
725
 3265  FD00BA  90 EF         		bcc	kpx
726
 3266  FD00BC  AA            		tax
727
 3267  FD00BD                		ACC16
728
 3268  FD00BD  C2 20         		rep	#PMFLAG
729
 3269                        		.LONGA	on
730
 3270                        		.MNLIST
731
 3271  FD00BF  A5 1C         		lda	cline
732
 3272  FD00C1  C9 FD FF      		cmp	#MAXLINES
733
 3273  FD00C4                		ACC08
734
 3274  FD00C4  E2 20         		sep	#PMFLAG
735
 3275                        		.LONGA	off
736
 3276                        		.MNLIST
737
 3277  FD00C6  B0 E3         		bcs	kpx
738
 3278  FD00C8  8A            		txa
739
 3279  FD00C9  20 EC 0C      		JSR	insert
740
 3280  FD00CC  B0 DD         		bcs	kpx
741
 3281  FD00CE  20 DF 0F      		JSR	incptr2
742
 3282  FD00D1  A6 1E         		LDX	ccol
743
 3283  FD00D3  E8            		INX
744
 3284  FD00D4  86 1E         		STX	ccol
745
  Tue Jul 17 11:00:22 2018                                                                                               Page   13
746
 
747
 
748
 
749
 
750
 3285  FD00D6  86 27         		STX	xcol
751
 3286  FD00D8  E6 22         		INC	ccnt
752
 3287  FD00DA  20 B4 0F      		JSR	getbyte2
753
 3288  FD00DD  90 37         		BCC	?02
754
 3289  FD00DF  A9 0D         		LDA	#$0D			; new line
755
 3290  FD00E1  20 EC 0C      		JSR	insert
756
 3291  FD00E4  90 06         		BCC	?01
757
 3292  FD00E6  20 1E 10      	?00:	JSR	decptr2			; error
758
 3293  FD00E9  4C 0B 0F      		JMP	delbyte
759
 3294  FD00EC                	?01:	ACC16
760
 3295  FD00EC  C2 20         		rep	#PMFLAG
761
 3296                        		.LONGA	on
762
 3297                        		.MNLIST
763
 3298  FD00EE  A5 1A         		lda	ncount
764
 3299  FD00F0  1A            		inc	a
765
 3300  FD00F1  C9 FD FF      		cmp	#MAXLINES
766
 3301  FD00F4                		ACC08
767
 3302  FD00F4  E2 20         		sep	#PMFLAG
768
 3303                        		.LONGA	off
769
 3304                        		.MNLIST
770
 3305  FD00F6  B0 EE         		bcs	?00			; no insert a new line
771
 3306  FD00F8  E6 21         		INC	scol
772
 3307  FD00FA  20 93 0E      		JSR	mvpp2
773
 3308  FD00FD  20 70 0F      		JSR	nextln
774
 3309  FD0100                		ACC16
775
 3310  FD0100  C2 20         		rep	#PMFLAG
776
 3311                        		.LONGA	on
777
 3312                        		.MNLIST
778
 3313  FD0102  A5 15         		LDA	ppage
779
 3314  FD0104  85 06         		STA	pp6
780
 3315  FD0106  E6 1A         		inc	ncount
781
 3316  FD0108                		ACC08
782
 3317  FD0108  E2 20         		sep	#PMFLAG
783
 3318                        		.LONGA	off
784
 3319                        		.MNLIST
785
 3320  FD010A  A5 17         		LDA	ixb
786
 3321  FD010C  85 0D         		STA	ix6
787
 3322  FD010E  20 4A 0E      		JSR	pp2mv
788
 3323  FD0111  E6 26         		INC	rcnt
789
 3324  FD0113  4C 2E 04      		JMP	updwin0
790
 3325  FD0116  A5 21         	?02:	LDA	scol
791
 3326  FD0118  C9 4B         		CMP	#COLX
792
 3327  FD011A  90 07         		BCC	?03
793
 3328  FD011C  E6 1F         		INC	ecol
794
 3329  FD011E  20 E9 12      		JSR	scrlright
795
 3330  FD0121  80 02         		bra	updrow8
796
 3331  FD0123  E6 21         	?03:	INC	scol
797
 3332
798
 3333                        	; P145F:
799
 3334  FD0125                	updrow8:
800
 3335  FD0125                		ACC16
801
 3336  FD0125  C2 20         		rep	#PMFLAG
802
 3337                        		.LONGA	on
803
 3338                        		.MNLIST
804
 3339  FD0127  A5 2C         		lda	curs
805
 3340  FD0129  85 34         		sta	stxtp
806
 3341  FD012B  09 00 08      		ora	#!TXTATTR
807
  Tue Jul 17 11:00:22 2018                                                                                               Page   14
808
 
809
 
810
 
811
 
812
 3342  FD012E  85 38         		sta	sattp
813
 3343  FD0130                		ACC08
814
 3344  FD0130  E2 20         		sep	#PMFLAG
815
 3345                        		.LONGA	off
816
 3346                        		.MNLIST
817
 3347  FD0132  A6 08         		LDX	pp8
818
 3348  FD0134  A5 09         		lda	pp8+1
819
 3349  FD0136  A4 0E         		LDY	ix8
820
 3350  FD0138  20 60 14      		JSR	setptr
821
 3351  FD013B  A9 01         		lda	#$01			; no update window while indent...
822
 3352  FD013D  24 33         		bit	edtfg			; ... blank's insertion
823
 3353  FD013F  D0 29         		bne	tbx
824
 3354  FD0141  20 69 12      		JSR	updrow
825
 3355  FD0144  4C 4F 05      		JMP	updsl
826
 3356
827
 3357                        	; tasto TAB
828
 3358                        	; P313E:
829
 3359  FD0147                	tabkey:
830
 3360  FD0147  A9 00         		lda	#0
831
 3361  FD0149  18            	?0:	clc
832
 3362  FD014A  65 19         	?1:	adc	deftab
833
 3363  FD014C  C5 1E         		cmp	ccol
834
 3364  FD014E  F0 F9         		beq	?0
835
 3365  FD0150  90 F8         		bcc	?1
836
 3366  FD0152  E5 1E         		SBC	ccol
837
 3367  FD0154  85 30         		STA	ctmp2
838
 3368  FD0156  A5 1E         	?02:	LDA	ccol
839
 3369  FD0158  C5 22         		CMP	ccnt
840
 3370  FD015A  D0 07         		BNE	?03
841
 3371  FD015C  A9 20         		LDA	#$20
842
 3372  FD015E  20 AC 00      		JSR	edkey
843
 3373  FD0161  80 03         		bra	?04
844
 3374  FD0163  20 5C 02      	?03:	jsr	csrrght
845
 3375  FD0166  C6 30         	?04:	DEC	ctmp2
846
 3376  FD0168  D0 EC         		BNE	?02
847
 3377  FD016A  60            	tbx:	RTS
848
 3378
849
 3379                        	; 'del' key
850
 3380                        	; execute 'csrright' and after a 'backkey'
851
 3381  FD016B                	delkey:
852
 3382  FD016B  A6 1E         		LDX	ccol
853
 3383  FD016D  E4 22         		CPX	ccnt
854
 3384  FD016F  F0 F9         		BEQ	tbx
855
 3385  FD0171  E8            		INX
856
 3386  FD0172  86 1E         		STX	ccol
857
 3387  FD0174  86 27         		STX	xcol
858
 3388  FD0176  20 DF 0F      		JSR	incptr2
859
 3389  FD0179  A5 21         		LDA	scol
860
 3390  FD017B  C9 4B         		CMP	#COLX
861
 3391  FD017D  90 04         		BCC	?01
862
 3392  FD017F  E6 1F         		INC	ecol
863
 3393  FD0181  80 02         		bra	backkey
864
 3394  FD0183  E6 21         	?01:	INC	scol
865
 3395
866
 3396                        	; tasto BACKSPACE
867
 3397                        	; P1316:
868
 3398  FD0185                	backkey:
869
  Tue Jul 17 11:00:22 2018                                                                                               Page   15
870
 
871
 
872
 
873
 
874
 3399  FD0185  A5 23         		LDA	fslct
875
 3400  FD0187  D0 32         		bne	?02
876
 3401  FD0189  A5 1E         		LDA	ccol
877
 3402  FD018B  C5 1F         		CMP	ecol
878
 3403  FD018D  90 2C         		bcc	?02
879
 3404  FD018F  20 1E 10      		JSR	decptr2
880
 3405  FD0192  B0 27         		bcs	?02
881
 3406  FD0194  20 B4 0F      		JSR	getbyte2
882
 3407  FD0197  C9 0D         		CMP	#$0D
883
 3408  FD0199  F0 21         		BEQ	?03
884
 3409  FD019B  20 0B 0F      		JSR	delbyte
885
 3410  FD019E  C6 1E         		DEC	ccol
886
 3411  FD01A0  A5 1E         		LDA	ccol
887
 3412  FD01A2  85 27         		STA	xcol
888
 3413  FD01A4  C6 22         		DEC	ccnt
889
 3414  FD01A6  20 7B 0E      		JSR	nextln8
890
 3415  FD01A9  20 25 01      		JSR	updrow8
891
 3416  FD01AC  20 40 0E      		JSR	xcount
892
 3417  FD01AF  E8            		INX
893
 3418  FD01B0  E4 21         		CPX	scol
894
 3419  FD01B2  F0 05         		BEQ	?01
895
 3420  FD01B4  C6 1F         		DEC	ecol
896
 3421  FD01B6  4C 96 13      		JMP	scrlleft
897
 3422  FD01B9  C6 21         	?01:	DEC	scol
898
 3423  FD01BB  60            	?02:	RTS
899
 3424  FD01BC  20 93 0E      	?03:	JSR	mvpp2
900
 3425  FD01BF  20 DF 0F      		JSR	incptr2
901
 3426  FD01C2  20 8C 0F      		JSR	startln
902
 3427  FD01C5  20 70 0F      		JSR	nextln
903
 3428  FD01C8  86 2F         		STX	ctmp
904
 3429  FD01CA  20 70 0F      		JSR	nextln
905
 3430  FD01CD  20 4A 0E      		JSR	pp2mv
906
 3431  FD01D0  8A            		TXA
907
 3432  FD01D1  18            		CLC
908
 3433  FD01D2  65 2F         		ADC	ctmp
909
 3434  FD01D4  90 03         		BCC	?04
910
 3435  FD01D6  4C DF 0F      		JMP	incptr2
911
 3436  FD01D9  C9 F0         	?04:	CMP	#MAXTEXTLEN
912
 3437  FD01DB  90 03         		BCC	?05
913
 3438  FD01DD  4C DF 0F      		JMP	incptr2
914
 3439  FD01E0  20 DF 0F      	?05:	JSR	incptr2
915
 3440  FD01E3  20 B4 0F      		JSR	getbyte2
916
 3441  FD01E6  90 1A         		BCC	?08
917
 3442  FD01E8  20 1E 10      		JSR	decptr2
918
 3443  FD01EB  20 1E 10      		JSR	decptr2
919
 3444  FD01EE  B0 15         		BCS	?09
920
 3445  FD01F0  20 B4 0F      		JSR	getbyte2
921
 3446  FD01F3  C9 0D         		CMP	#$0D
922
 3447  FD01F5  F0 06         		BEQ	?06
923
 3448  FD01F7  20 DF 0F      		JSR	incptr2
924
 3449  FD01FA  4C DF 0F      		JMP	incptr2
925
 3450  FD01FD  20 DF 0F      	?06:	JSR	incptr2
926
 3451  FD0200  80 03         		bra	?09
927
 3452  FD0202  20 1E 10      	?08:	JSR	decptr2
928
 3453  FD0205                	?09:	ACC16
929
 3454  FD0205  C2 20         		rep	#PMFLAG
930
 3455                        		.LONGA	on
931
  Tue Jul 17 11:00:22 2018                                                                                               Page   16
932
 
933
 
934
 
935
 
936
 3456                        		.MNLIST
937
 3457  FD0207  C6 1C         		dec	cline
938
 3458  FD0209  C6 1A         		dec	ncount			; check this !!
939
 3459  FD020B                		ACC08
940
 3460  FD020B  E2 20         		sep	#PMFLAG
941
 3461                        		.LONGA	off
942
 3462                        		.MNLIST
943
 3463  FD020D  20 0B 0F      		JSR	delbyte
944
 3464  FD0210  A9 4B         		LDA	#COLX
945
 3465  FD0212  85 21         		STA	scol
946
 3466  FD0214  A5 20         		LDA	srow
947
 3467  FD0216  C9 0D         		CMP	#$0D
948
 3468  FD0218  B0 05         		bcs	?10
949
 3469  FD021A  20 20 0E      		JSR	startln4
950
 3470  FD021D  90 06         		BCC	?11
951
 3471  FD021F  20 57 0E      	?10:	JSR	nextln6
952
 3472  FD0222  20 5B 15      		JSR	decrow
953
 3473  FD0225  4C 2E 04      	?11:	JMP	updwin0
954
 3474
955
 3475                        	; tasto CURSORE SX
956
 3476                        	; P1D31:
957
 3477  FD0228                	csrleft:
958
 3478  FD0228  A6 1E         		LDX	ccol
959
 3479  FD022A  E4 1F         		CPX	ecol
960
 3480  FD022C  B0 07         		BCS	?01
961
 3481  FD022E  86 27         		STX	xcol
962
 3482  FD0230  C6 1F         		DEC	ecol
963
 3483  FD0232  4C 96 13      		JMP	scrlleft
964
 3484  FD0235  E0 00         	?01:	CPX	#$00
965
 3485  FD0237  F0 67         		BEQ	slt
966
 3486  FD0239  CA            		DEX
967
 3487  FD023A  86 1E         		STX	ccol
968
 3488  FD023C  86 27         		STX	xcol
969
 3489  FD023E  20 1E 10      		JSR	decptr2
970
 3490  FD0241  A5 21         		LDA	scol
971
 3491  FD0243  C9 05         		CMP	#$05
972
 3492  FD0245  B0 10         		BCS	?02
973
 3493  FD0247  20 40 0E      		JSR	xcount
974
 3494  FD024A  E8            		INX
975
 3495  FD024B  E4 21         		CPX	scol
976
 3496  FD024D  F0 08         		BEQ	?02
977
 3497  FD024F  C6 1F         		DEC	ecol
978
 3498  FD0251  20 96 13      		JSR	scrlleft
979
 3499  FD0254  4C 4F 05      		JMP	updsl
980
 3500  FD0257  C6 21         	?02:	DEC	scol
981
 3501  FD0259  4C 4F 05      		JMP	updsl
982
 3502
983
 3503                        	; tasto CURSORE DX
984
 3504                        	; P1D0C:
985
 3505  FD025C                	csrrght:
986
 3506  FD025C  A6 1E         		LDX	ccol
987
 3507  FD025E  E4 22         		CPX	ccnt
988
 3508  FD0260  F0 3E         		BEQ	slt
989
 3509  FD0262  E8            		INX
990
 3510  FD0263  86 1E         		STX	ccol
991
 3511  FD0265  86 27         		STX	xcol
992
 3512  FD0267  20 DF 0F      		JSR	incptr2
993
  Tue Jul 17 11:00:22 2018                                                                                               Page   17
994
 
995
 
996
 
997
 
998
 3513  FD026A  A5 21         		LDA	scol
999
 3514  FD026C  C9 4B         		CMP	#COLX
1000
 3515  FD026E  90 08         		BCC	?01
1001
 3516  FD0270  E6 1F         		INC	ecol
1002
 3517  FD0272  20 E9 12      		JSR	scrlright			; scroll right
1003
 3518  FD0275  4C 4F 05      		JMP	updsl
1004
 3519  FD0278  E6 21         	?01:	INC	scol
1005
 3520  FD027A  4C 4F 05      		JMP 	updsl
1006
 3521
1007
 3522                        	; toggle select mode flag
1008
 3523                        	; P1F22:
1009
 3524  FD027D                	seltxt:
1010
 3525  FD027D  A5 23         		LDA	fslct
1011
 3526  FD027F  F0 05         		BEQ	?01
1012
 3527  FD0281  64 23         		STZ	fslct				; clear if enabled
1013
 3528  FD0283  4C 2E 04      		JMP	updwin0
1014
 3529  FD0286  20 A9 0F      	?01:	JSR	getbyte
1015
 3530  FD0289  B0 15         		BCS	slt
1016
 3531  FD028B  E6 23         		INC	fslct
1017
 3532  FD028D  A5 08         		LDA	pp8
1018
 3533  FD028F  85 00         		STA	pp0
1019
 3534  FD0291  A5 09         		LDA	pp8+1
1020
 3535  FD0293  85 01         		STA	pp0+1
1021
 3536  FD0295  A5 0E         		LDA	ix8
1022
 3537  FD0297  85 0A         		STA	ix0
1023
 3538  FD0299  64 24         		STZ	nslctl
1024
 3539  FD029B  64 25         		stz	nslcth
1025
 3540  FD029D  20 4F 05      		jsr	updsl
1026
 3541  FD02A0  60            	slt:	RTS
1027
 3542
1028
 3543                        	; tasto CURSORE UP
1029
 3544                        	; P1D66:
1030
 3545  FD02A1                	csrup:
1031
 3546  FD02A1  A5 20         		LDA	srow
1032
 3547  FD02A3  C9 07         		CMP	#$07
1033
 3548  FD02A5  90 05         		BCC	?01
1034
 3549  FD02A7  20 5B 15      		JSR	decrow
1035
 3550  FD02AA  80 17         		bra	?03
1036
 3551  FD02AC  20 20 0E      	?01:	JSR	startln4
1037
 3552  FD02AF  90 09         		BCC	?02
1038
 3553  FD02B1  A5 20         		LDA	srow
1039
 3554  FD02B3  F0 EB         		beq	slt			; exit
1040
 3555  FD02B5  20 5B 15      		JSR	decrow
1041
 3556  FD02B8  80 09         		bra	?03
1042
 3557  FD02BA  20 D7 0D      	?02:	JSR	startln6
1043
 3558  FD02BD  20 C9 15      		JSR	scrlup
1044
 3559  FD02C0  20 3B 12      		JSR	updfst
1045
 3560  FD02C3  20 AD 0E      	?03:	JSR	pp8mv
1046
 3561  FD02C6  20 8C 0F      		JSR	startln
1047
 3562  FD02C9  20 A0 0E      		JSR	mvpp8
1048
 3563  FD02CC  A6 27         		LDX	xcol
1049
 3564  FD02CE  20 87 0D      		JSR	xcnt2
1050
 3565  FD02D1  A5 23         		LDA	fslct
1051
 3566  FD02D3  F0 12         		BEQ	?07
1052
 3567  FD02D5                		ACC16CLC
1053
 3568  FD02D5  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
1054
 3569                        		.LONGA	on
1055
  Tue Jul 17 11:00:22 2018                                                                                               Page   18
1056
 
1057
 
1058
 
1059
 
1060
 3570                        		.MNLIST
1061
 3571  FD02D7  A5 2C         		lda	curs
1062
 3572  FD02D9  C6 24         		dec	nslctl
1063
 3573  FD02DB  10 03         		bpl	?05
1064
 3574  FD02DD  69 50 00      		ADC 	#MAXCOLS
1065
 3575  FD02E0  85 34         	?05:	STA	stxtp
1066
 3576  FD02E2                		ACC08
1067
 3577  FD02E2  E2 20         		sep	#PMFLAG
1068
 3578                        		.LONGA	off
1069
 3579                        		.MNLIST
1070
 3580  FD02E4  20 69 15      		JSR	revrow
1071
 3581  FD02E7                	?07:	ACC16
1072
 3582  FD02E7  C2 20         		rep	#PMFLAG
1073
 3583                        		.LONGA	on
1074
 3584                        		.MNLIST
1075
 3585  FD02E9  C6 1C         		dec	cline
1076
 3586  FD02EB                		ACC08
1077
 3587  FD02EB  E2 20         		sep	#PMFLAG
1078
 3588                        		.LONGA	off
1079
 3589                        		.MNLIST
1080
 3590  FD02ED  4C 4F 05      		JMP	updsl
1081
 3591
1082
 3592                        	; tasto CURSORE DOWN
1083
 3593                        	; P1E62:
1084
 3594  FD02F0                	csrdwn:
1085
 3595  FD02F0  20 B4 0F      		JSR	getbyte2
1086
 3596  FD02F3  B0 AB         		bcs	slt			; exit if end of buffer
1087
 3597  FD02F5  A5 20         		LDA	srow
1088
 3598  FD02F7  C9 11         		CMP	#$11
1089
 3599  FD02F9  B0 05         		BCS	?01
1090
 3600  FD02FB  20 4D 15      		JSR	incrow
1091
 3601  FD02FE  80 13         		bra	?03
1092
 3602  FD0300  20 80 15      	?01:	JSR	scrldown
1093
 3603  FD0303  20 00 0E      		JSR	nextln4
1094
 3604  FD0306  20 57 0E      		JSR	nextln6
1095
 3605  FD0309  B0 05         		BCS	?02
1096
 3606  FD030B  20 08 12      		JSR	updlst
1097
 3607  FD030E  80 03         		bra	?03
1098
 3608  FD0310  20 F8 14      	?02:	JSR	clrlst
1099
 3609  FD0313  20 70 0F      	?03:	JSR	nextln
1100
 3610  FD0316  20 A0 0E      		JSR	mvpp8
1101
 3611  FD0319  A6 27         		LDX	xcol
1102
 3612  FD031B  20 87 0D      		JSR	xcnt2
1103
 3613  FD031E  A5 23         		LDA	fslct
1104
 3614  FD0320                		ACC16CLC
1105
 3615  FD0320  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
1106
 3616                        		.LONGA	on
1107
 3617                        		.MNLIST
1108
 3618  FD0322  F0 14         		BEQ	?07
1109
 3619  FD0324  A5 2C         		lda	curs
1110
 3620  FD0326  24 24         		bit	nslctl
1111
 3621  FD0328  30 03         		bmi	?05
1112
 3622  FD032A  E9 4F 00      		SBC	#MAXCOLS-1		; take in account CF = 0 !
1113
 3623  FD032D  85 34         	?05:	sta	stxtp
1114
 3624  FD032F                		ACC08
1115
 3625  FD032F  E2 20         		sep	#PMFLAG
1116
 3626                        		.LONGA	off
1117
  Tue Jul 17 11:00:22 2018                                                                                               Page   19
1118
 
1119
 
1120
 
1121
 
1122
 3627                        		.MNLIST
1123
 3628  FD0331  20 69 15      		JSR	revrow
1124
 3629  FD0334                		ACC16
1125
 3630  FD0334  C2 20         		rep	#PMFLAG
1126
 3631                        		.LONGA	on
1127
 3632                        		.MNLIST
1128
 3633  FD0336  E6 24         		inc	nslctl
1129
 3634  FD0338  E6 1C         	?07:	inc	cline
1130
 3635  FD033A                		ACC08
1131
 3636  FD033A  E2 20         		sep	#PMFLAG
1132
 3637                        		.LONGA	off
1133
 3638                        		.MNLIST
1134
 3639  FD033C  4C 4F 05      		JMP	updsl
1135
 3640
1136
 3641                        	; SHIFT+END -> fine linea
1137
 3642                        	; P310D:
1138
 3643  FD033F                	goendln:
1139
 3644  FD033F  20 70 0F      		JSR	nextln
1140
 3645  FD0342  B0 03         		BCS	?01
1141
 3646  FD0344  20 1E 10      		JSR	decptr2
1142
 3647  FD0347  A9 4B         	?01:	LDA	#COLX
1143
 3648  FD0349  85 21         		STA	scol
1144
 3649  FD034B  4C 2E 04      		JMP	updwin0
1145
 3650
1146
 3651                        	; ; SHIFT+HOME -> inizio linea
1147
 3652                        	; P311D:
1148
 3653  FD034E                	gostartln:
1149
 3654  FD034E  20 70 0F      		JSR	nextln
1150
 3655  FD0351  B0 03         		BCS	?01
1151
 3656  FD0353  20 8C 0F      		JSR	startln
1152
 3657  FD0356  4C 2E 04      	?01:	JMP	updwin0
1153
 3658
1154
 3659                        	; P1EC8:
1155
 3660  FD0359                	pagedwn:
1156
 3661  FD0359  A9 14         		LDA	#$14
1157
 3662  FD035B  85 2F         		STA	ctmp
1158
 3663  FD035D  20 70 0F      	?01:	JSR	nextln
1159
 3664  FD0360  B0 0C         		BCS	?03
1160
 3665  FD0362  A5 23         		LDA	fslct
1161
 3666  FD0364                		ACC16
1162
 3667  FD0364  C2 20         		rep	#PMFLAG
1163
 3668                        		.LONGA	on
1164
 3669                        		.MNLIST
1165
 3670  FD0366  F0 02         		BEQ	?02
1166
 3671  FD0368  E6 24         		INC	nslctl
1167
 3672  FD036A  E6 1C         	?02:	INC	cline
1168
 3673  FD036C                		ACC08
1169
 3674  FD036C  E2 20         		sep	#PMFLAG
1170
 3675                        		.LONGA	off
1171
 3676                        		.MNLIST
1172
 3677  FD036E  C6 2F         	?03:	DEC	ctmp
1173
 3678  FD0370  D0 EB         		BNE	?01
1174
 3679  FD0372  A9 11         		LDA	#$11
1175
 3680  FD0374  80 1E         		bra	epage
1176
 3681
1177
 3682                        	; P1EF1:
1178
 3683  FD0376                	pageup:
1179
  Tue Jul 17 11:00:22 2018                                                                                               Page   20
1180
 
1181
 
1182
 
1183
 
1184
 3684  FD0376  A9 14         		LDA	#$14
1185
 3685  FD0378  85 2F         		STA	ctmp
1186
 3686  FD037A  20 AD 0E      		JSR	pp8mv
1187
 3687  FD037D  20 8C 0F      	?01:	JSR	startln
1188
 3688  FD0380  B0 0C         		BCS	?05
1189
 3689  FD0382  A5 23         		LDA	fslct
1190
 3690  FD0384                		ACC16
1191
 3691  FD0384  C2 20         		rep	#PMFLAG
1192
 3692                        		.LONGA	on
1193
 3693                        		.MNLIST
1194
 3694  FD0386  F0 02         		BEQ	?03
1195
 3695  FD0388  C6 24         		DEC	nslctl
1196
 3696  FD038A  C6 1C         	?03:	DEC	cline
1197
 3697  FD038C                		ACC08
1198
 3698  FD038C  E2 20         		sep	#PMFLAG
1199
 3699                        		.LONGA	off
1200
 3700                        		.MNLIST
1201
 3701  FD038E  C6 2F         	?05:	DEC	ctmp
1202
 3702  FD0390  D0 EB         		BNE	?01
1203
 3703  FD0392  A9 06         		LDA	#$06
1204
 3704
1205
 3705                        	; P1F1D:
1206
 3706  FD0394                	epage:
1207
 3707  FD0394  85 20         		STA	srow
1208
 3708  FD0396  4C 32 04      		jmp	updwin
1209
 3709
1210
 3710                        	; HOME - inizio buffer
1211
 3711                        	; P30C5:
1212
 3712  FD0399                	gohome:
1213
 3713  FD0399                		ACC16
1214
 3714  FD0399  C2 20         		rep	#PMFLAG
1215
 3715                        		.LONGA	on
1216
 3716                        		.MNLIST
1217
 3717  FD039B  A5 12         		LDA	pbuf			; set current block to first block
1218
 3718  FD039D  85 15         		STA	ppage
1219
 3719  FD039F  A2 05         		LDX	#BSTART
1220
 3720  FD03A1  86 17         		STX	ixb
1221
 3721  FD03A3  A6 23         		LDX	fslct
1222
 3722  FD03A5  F0 07         		BEQ	?01			; no selection
1223
 3723  FD03A7  38            		SEC
1224
 3724  FD03A8  A5 24         		LDA	nslctl			; update selection range
1225
 3725  FD03AA  E5 1C         		SBC	cline
1226
 3726  FD03AC  85 24         		STA	nslctl
1227
 3727  FD03AE  64 1C         	?01:	STZ	cline			; current line = 0
1228
 3728  FD03B0                		ACC08
1229
 3729  FD03B0  E2 20         		sep	#PMFLAG
1230
 3730                        		.LONGA	off
1231
 3731                        		.MNLIST
1232
 3732  FD03B2  80 7E         		bra	updwin
1233
 3733
1234
 3734                        	; END - fine buffer
1235
 3735                        	; P30EC:
1236
 3736  FD03B4                	goend:
1237
 3737  FD03B4                		ACC16
1238
 3738  FD03B4  C2 20         		rep	#PMFLAG
1239
 3739                        		.LONGA	on
1240
 3740                        		.MNLIST
1241
  Tue Jul 17 11:00:22 2018                                                                                               Page   21
1242
 
1243
 
1244
 
1245
 
1246
 3741  FD03B6  A7 14         	?00a:	lda	[pblk]
1247
 3742  FD03B8  F0 04         		beq	?00b
1248
 3743  FD03BA  85 15         		sta	ppage
1249
 3744  FD03BC  80 F8         		bra	?00a
1250
 3745  FD03BE                	?00b:	ACC08
1251
 3746  FD03BE  E2 20         		sep	#PMFLAG
1252
 3747                        		.LONGA	off
1253
 3748                        		.MNLIST
1254
 3749  FD03C0  A0 05         		ldy	#BSTART
1255
 3750  FD03C2  84 17         		sty	ixb
1256
 3751  FD03C4  20 70 0F      		jsr	nextln
1257
 3752  FD03C7  B0 23         		bcs	?04
1258
 3753  FD03C9  20 1E 10      		jsr	decptr2
1259
 3754  FD03CC  20 1E 10      		jsr	decptr2
1260
 3755  FD03CF  20 70 0F      	?00c:	jsr	nextln
1261
 3756  FD03D2  90 FB         		bcc	?00c
1262
 3757  FD03D4                		ACC16
1263
 3758  FD03D4  C2 20         		rep	#PMFLAG
1264
 3759                        		.LONGA	on
1265
 3760                        		.MNLIST
1266
 3761  FD03D6  A5 1A         		lda	ncount
1267
 3762  FD03D8  A4 23         		ldy	fslct
1268
 3763  FD03DA  F0 0C         		beq	?02
1269
 3764  FD03DC  85 4A         		sta	wtmp
1270
 3765  FD03DE  38            		sec
1271
 3766  FD03DF  E5 1C         		sbc	cline
1272
 3767  FD03E1  18            		clc
1273
 3768  FD03E2  65 24         		adc	nslctl
1274
 3769  FD03E4  85 24         		sta	nslctl
1275
 3770  FD03E6  A5 4A         		lda	wtmp
1276
 3771  FD03E8  85 1C         	?02:	sta	cline
1277
 3772  FD03EA                		ACC08
1278
 3773  FD03EA  E2 20         		sep	#PMFLAG
1279
 3774                        		.LONGA	off
1280
 3775                        		.MNLIST
1281
 3776  FD03EC  A9 11         	?04:	LDA	#$11			; set screen row
1282
 3777  FD03EE  85 20         		STA	srow
1283
 3778  FD03F0  80 40         		bra	updwin
1284
 3779
1285
 3780                        	; tasto SHIFT RETURN
1286
 3781                        	; P3129:
1287
 3782  FD03F2                	kshenter:
1288
 3783  FD03F2  A5 23         		LDA	fslct
1289
 3784  FD03F4  F0 01         		beq	kshe
1290
 3785  FD03F6  60            	kshr:	rts
1291
 3786  FD03F7  20 70 0F      	kshe:	JSR	nextln			; find next line
1292
 3787  FD03FA  B0 09         		BCS	ke2
1293
 3788  FD03FC  20 1E 10      		JSR	decptr2			; decrement pointer
1294
 3789  FD03FF  80 04         		bra	ke2
1295
 3790
1296
 3791                        	; tasto RETURN
1297
 3792                        	; P288F:
1298
 3793  FD0401                	kenter:
1299
 3794  FD0401  A6 23         		LDX	fslct
1300
 3795  FD0403  D0 F1         		bne	kshr
1301
 3796  FD0405  20 BA 0E      	ke2:	jsr	xblank			; count of starting blanks
1302
 3797  FD0408  20 D5 0C      		jsr	inscr			; insert byte $0D (enter key code)
1303
  Tue Jul 17 11:00:22 2018                                                                                               Page   22
1304
 
1305
 
1306
 
1307
 
1308
 3798  FD040B  B0 E9         		bcs	kshr			; error
1309
 3799  FD040D  20 DF 0F      		JSR	incptr2
1310
 3800  FD0410  A5 20         		LDA	srow
1311
 3801  FD0412  C9 11         		CMP	#$11
1312
 3802  FD0414  B0 08         		BCS	?02
1313
 3803  FD0416  20 4D 15      		JSR	incrow			; increment cursor row
1314
 3804  FD0419  20 D7 0D      		JSR	startln6
1315
 3805  FD041C  80 03         		bra	?03
1316
 3806  FD041E  20 00 0E      	?02:	JSR	nextln4
1317
 3807  FD0421  64 21         	?03:	STZ	scol			; screen column = 0
1318
 3808  FD0423                		ACC16
1319
 3809  FD0423  C2 20         		rep	#PMFLAG
1320
 3810                        		.LONGA	on
1321
 3811                        		.MNLIST
1322
 3812  FD0425  E6 1C         		INC	cline			; increment current line
1323
 3813  FD0427  E6 1A         		inc	ncount
1324
 3814  FD0429                	?05:	ACC08
1325
 3815  FD0429  E2 20         		sep	#PMFLAG
1326
 3816                        		.LONGA	off
1327
 3817                        		.MNLIST
1328
 3818  FD042B  20 AE 06      		jsr	indent
1329
 3819
1330
 3820                        	; P19DB:
1331
 3821  FD042E                	updwin0:
1332
 3822  FD042E  A9 00         		LDA	#$00			; no cursor address update
1333
 3823  FD0430  F0 02         		BEQ	updatew
1334
 3824
1335
 3825                        	; P19E0:
1336
 3826  FD0432                	updwin:
1337
 3827  FD0432  A9 01         		LDA	#$01			; update cursor address
1338
 3828
1339
 3829                        	; P19E3:
1340
 3830  FD0434                	updatew:
1341
 3831  FD0434  48            		PHA
1342
 3832  FD0435  20 93 0E      		JSR	mvpp2
1343
 3833  FD0438  20 A9 0F      		JSR	getbyte
1344
 3834  FD043B  B0 09         		BCS	?02
1345
 3835  FD043D  20 BE 0F      		JSR	incptr
1346
 3836  FD0440  20 8C 0F      		JSR	startln
1347
 3837  FD0443  CA            		DEX
1348
 3838  FD0444  80 02         		bra	?03
1349
 3839  FD0446  A2 00         	?02:	LDX	#$00
1350
 3840  FD0448  86 1E         	?03:	STX	ccol			; update current editor column
1351
 3841  FD044A  86 27         		STX	xcol
1352
 3842  FD044C  8A            		TXA
1353
 3843  FD044D  38            		SEC
1354
 3844  FD044E  E5 21         		SBC	scol
1355
 3845  FD0450  B0 06         		BCS	?04
1356
 3846  FD0452  A5 1E         		LDA	ccol
1357
 3847  FD0454  85 21         		STA	scol
1358
 3848  FD0456  A9 00         		LDA	#$00
1359
 3849  FD0458  85 1F         	?04:	STA	ecol
1360
 3850  FD045A  20 A0 0E      		JSR	mvpp8
1361
 3851  FD045D  20 70 0F      		JSR	nextln
1362
 3852  FD0460  86 22         		STX	ccnt
1363
 3853  FD0462  A3 01         		lda	$01,s
1364
 3854  FD0464  F0 06         		BEQ	?05
1365
  Tue Jul 17 11:00:22 2018                                                                                               Page   23
1366
 
1367
 
1368
 
1369
 
1370
 3855  FD0466  20 AD 0E      		JSR	pp8mv
1371
 3856  FD0469  20 6A 0D      		JSR	findrow
1372
 3857  FD046C  20 B1 14      	?05:	JSR	chksel
1373
 3858  FD046F                		ACC16
1374
 3859  FD046F  C2 20         		rep	#PMFLAG
1375
 3860                        		.LONGA	on
1376
 3861                        		.MNLIST
1377
 3862  FD0471  38            		sec
1378
 3863  FD0472  A9 00 00      		LDA	#!TXTADDR
1379
 3864  FD0475  E9 50 00      		SBC	#MAXCOLS
1380
 3865  FD0478  85 34         		STA	stxtp
1381
 3866  FD047A  38            		sec
1382
 3867  FD047B  A9 00 08      		LDA	#!TXTATTR
1383
 3868  FD047E  E9 50 00      		SBC	#MAXCOLS
1384
 3869  FD0481  85 38         		sta	sattp
1385
 3870  FD0483                		ACC08
1386
 3871  FD0483  E2 20         		sep	#PMFLAG
1387
 3872                        		.LONGA	off
1388
 3873                        		.MNLIST
1389
 3874  FD0485  A9 FF         		LDA	#$FF
1390
 3875  FD0487  85 2F         		STA	ctmp
1391
 3876  FD0489  A6 04         		LDX	pp4
1392
 3877  FD048B  A5 05         		lda	pp4+1
1393
 3878  FD048D  A4 0C         		LDY	ix4
1394
 3879  FD048F  20 60 14      		JSR	setptr
1395
 3880  FD0492                	?06:	ACC16CLC
1396
 3881  FD0492  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
1397
 3882                        		.LONGA	on
1398
 3883                        		.MNLIST
1399
 3884  FD0494  A5 34         		LDA	stxtp
1400
 3885  FD0496  69 50 00      		ADC	#MAXCOLS
1401
 3886  FD0499  85 34         		sta	stxtp
1402
 3887  FD049B  18            		clc
1403
 3888  FD049C  A5 38         		LDA	sattp
1404
 3889  FD049E  69 50 00      		ADC	#MAXCOLS
1405
 3890  FD04A1  85 38         		sta	sattp
1406
 3891  FD04A3                		ACC08
1407
 3892  FD04A3  E2 20         		sep	#PMFLAG
1408
 3893                        		.LONGA	off
1409
 3894                        		.MNLIST
1410
 3895  FD04A5  E6 2F         		INC	ctmp
1411
 3896  FD04A7  A5 23         		LDA	fslct
1412
 3897  FD04A9  F0 0E         		BEQ	?07
1413
 3898  FD04AB  A5 2F         		LDA	ctmp
1414
 3899  FD04AD  C5 2A         		CMP	rslctl
1415
 3900  FD04AF  90 08         		BCC	?07
1416
 3901  FD04B1  C5 2B         		CMP	rslcth
1417
 3902  FD04B3  B0 04         		BCS	?07
1418
 3903  FD04B5  A9 80         		LDA	#$80
1419
 3904  FD04B7  85 37         		STA	frev
1420
 3905  FD04B9  20 69 12      	?07:	JSR	updrow
1421
 3906  FD04BC  B0 07         		BCS	?08
1422
 3907  FD04BE  A5 2F         		LDA	ctmp
1423
 3908  FD04C0  C9 17         		CMP	#$17
1424
 3909  FD04C2  D0 CE         		BNE	?06
1425
 3910  FD04C4  18            		CLC
1426
 3911  FD04C5  A3 01         	?08:	lda	$01,s
1427
  Tue Jul 17 11:00:22 2018                                                                                               Page   24
1428
 
1429
 
1430
 
1431
 
1432
 3912  FD04C7  F0 2B         		BEQ	?11
1433
 3913  FD04C9  AF 86 12 FD   		LDA	>updr1+2		; page
1434
 3914  FD04CD  B0 19         		BCS	?09
1435
 3915  FD04CF  85 15         		STA	ppage
1436
 3916  FD04D1  A5 40         		lda	sbank			; bank
1437
 3917  FD04D3  85 16         		STA	ppage+1
1438
 3918  FD04D5  86 17         		STX	ixb
1439
 3919  FD04D7  20 8C 0F      		JSR	startln
1440
 3920  FD04DA  A5 15         		LDA	ppage
1441
 3921  FD04DC  85 06         		STA	pp6
1442
 3922  FD04DE  A5 16         		LDA	ppage+1
1443
 3923  FD04E0  85 07         		STA	pp6+1
1444
 3924  FD04E2  A5 17         		LDA	ixb
1445
 3925  FD04E4  85 0D         		STA	ix6
1446
 3926  FD04E6  80 08         		bra	?10
1447
 3927  FD04E8  85 06         	?09:	STA	pp6
1448
 3928  FD04EA  A5 40         		lda	sbank
1449
 3929  FD04EC  85 07         		sta	pp6+1
1450
 3930  FD04EE  86 0D         		STX	ix6
1451
 3931  FD04F0  A5 2F         	?10:	LDA	ctmp
1452
 3932  FD04F2  85 26         		STA	rcnt
1453
 3933  FD04F4  A5 2F         	?11:	LDA	ctmp
1454
 3934  FD04F6  C9 17         		CMP	#$17
1455
 3935  FD04F8  F0 27         		BEQ	?13
1456
 3936  FD04FA                		ACC16CLC
1457
 3937  FD04FA  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
1458
 3938                        		.LONGA	on
1459
 3939                        		.MNLIST
1460
 3940  FD04FC  A5 34         		LDA	stxtp
1461
 3941  FD04FE  69 50 00      		ADC	#MAXCOLS
1462
 3942  FD0501  85 34         		STA	stxtp
1463
 3943  FD0503  18            		clc
1464
 3944  FD0504  A5 38         		LDA	sattp
1465
 3945  FD0506  69 50 00      		ADC	#MAXCOLS
1466
 3946  FD0509  85 38         		STA	sattp
1467
 3947  FD050B                		ACC08
1468
 3948  FD050B  E2 20         		sep	#PMFLAG
1469
 3949                        		.LONGA	off
1470
 3950                        		.MNLIST
1471
 3951  FD050D  A9 20         		LDA	#' '
1472
 3952  FD050F  EB            		xba
1473
 3953  FD0510  A5 3B         		lda	eattr			; A = attribute, B = blank
1474
 3954  FD0512  A0 4F         		LDY	#MAXCOLS-1
1475
 3955  FD0514  97 38         	?12:	sta	[sattp],y		; store attribute
1476
 3956  FD0516  EB            		xba
1477
 3957  FD0517  97 34         		sta	[stxtp],y		; store blank
1478
 3958  FD0519  EB            		xba
1479
 3959  FD051A  88            		DEY
1480
 3960  FD051B  10 F7         		BPL	?12
1481
 3961  FD051D  E6 2F         		INC	ctmp
1482
 3962  FD051F  80 D3         		bra	?11
1483
 3963  FD0521  20 4A 0E      	?13:	JSR	pp2mv
1484
 3964  FD0524  68            		PLA
1485
 3965  FD0525  F0 28         		beq	updsl
1486
 3966  FD0527  64 2D         		STZ	curs+1
1487
 3967  FD0529  A5 20         		LDA	srow
1488
 3968  FD052B  0A            		ASL	a
1489
  Tue Jul 17 11:00:22 2018                                                                                               Page   25
1490
 
1491
 
1492
 
1493
 
1494
 3969  FD052C  0A            		ASL	a			; srow * 4
1495
 3970  FD052D  65 20         		ADC	srow			; srow * 5
1496
 3971  FD052F  0A            		ASL	a
1497
 3972  FD0530  0A            		ASL	a			; srow * 20
1498
 3973  FD0531  26 2D         		ROL	curs+1
1499
 3974  FD0533  0A            		ASL	a			; * 40
1500
 3975  FD0534  26 2D         		ROL	curs+1
1501
 3976  FD0536  0A            		ASL	a			; * 80
1502
 3977  FD0537  26 2D         		ROL	curs+1
1503
 3978  FD0539  85 2C         		STA	curs
1504
 3979  FD053B  A5 2D         		LDA	curs+1
1505
 3980  FD053D  69 00         		ADC	#>TXTADDR
1506
 3981  FD053F  85 2D         		STA	curs+1
1507
 3982  FD0541  80 0C         		bra	updsl
1508
 3983
1509
 3984                        	; print error message in status line and wait for <enter> key pressed
1510
 3985                        	; in:	X - error number
1511
 3986                        	; P1C3D:
1512
 3987  FD0543                	error:
1513
 3988  FD0543  A5 3D         		lda	seatt			; error attribute
1514
 3989  FD0545  20 34 16      		jsr	msgstr
1515
 3990  FD0548  20 12 16      		jsr	waitent
1516
 3991  FD054B  A9 40         		lda	#$40			; force update status line
1517
 3992                        		;tsb	slfg
1518
 3993  FD054D  85 3F         		sta	slfg
1519
 3994
1520
 3995                        	; update status line (edit mode only)
1521
 3996                        	; P2989:
1522
 3997  FD054F                	updsl:
1523
 3998  FD054F  24 3F         		bit	slfg
1524
 3999  FD0551  10 01         		bpl	?00			; skip if in command line mode
1525
 4000  FD0553  60            		rts
1526
 4001  FD0554  50 20         	?00:	bvc	?04			; partial update only
1527
 4002  FD0556  A5 3C         		lda	slattr			; status line attribute
1528
 4003  FD0558  EB            		xba
1529
 4004  FD0559  24 33         		bit	edtfg
1530
 4005  FD055B  50 06         		bvc	?02			; standard edit buffer
1531
 4006  FD055D  A2 F4         		ldx	#<stlstr2		; clipboard status line string
1532
 4007  FD055F  A0 21         		ldy	#>stlstr2
1533
 4008  FD0561  80 0C         		bra	?03
1534
 4009  FD0563  A2 54         	?02:	ldx	#<stlstr	; std cbm fs buffer status line string
1535
 4010  FD0565  A0 21         		ldy	#>stlstr
1536
 4011  FD0567  24 DD         		bit	fsmode		; <7>: cbm fs
1537
 4012  FD0569  30 04         		bmi	?03
1538
 4013  FD056B  A2 A4         		ldx	#<stlstr1	; std fat buffer status line string
1539
 4014  FD056D  A0 21         		ldy	#>stlstr1
1540
 4015  FD056F  A9 FD         	?03:	lda	#^stlstr
1541
 4016  FD0571  20 54 16      		jsr	outstr
1542
 4017  FD0574  80 0E         		bra	?05
1543
 4018  FD0576                	?04:	ACC16
1544
 4019  FD0576  C2 20         		rep	#PMFLAG
1545
 4020                        		.LONGA	on
1546
 4021                        		.MNLIST
1547
 4022  FD0578  A9 80 07      		lda	#!STLINE		; set address of last screen row
1548
 4023  FD057B  85 34         		sta	stxtp
1549
 4024  FD057D  A9 80 0F      		lda	#!STLATTR
1550
 4025  FD0580  85 38         		sta	sattp
1551
  Tue Jul 17 11:00:22 2018                                                                                               Page   26
1552
 
1553
 
1554
 
1555
 
1556
 4026  FD0582                		ACC08
1557
 4027  FD0582  E2 20         		sep	#PMFLAG
1558
 4028                        		.LONGA	off
1559
 4029                        		.MNLIST
1560
 4030  FD0584  A9 02         	?05:	lda	#$02
1561
 4031  FD0586  24 3F         		bit	slfg			; test bit 1
1562
 4032  FD0588  F0 03         		beq	?05a
1563
 4033  FD058A  4C 48 06      		jmp	?70			; update caps & num only
1564
 4034  FD058D  A5 0F         	?05a:	lda	xbuf			; update buffer # indicator
1565
 4035  FD058F  C5 47         		cmp	xbuf1
1566
 4036  FD0591  D0 04         		bne	?06			; changed: update
1567
 4037  FD0593  24 3F         		bit	slfg			; not changed, check if forced update
1568
 4038  FD0595  50 0F         		bvc	?12			; no forced update
1569
 4039  FD0597  85 47         	?06:	sta	xbuf1			; store buffer #
1570
 4040  FD0599  24 33         		bit	edtfg			; skip buffer # for clipboard
1571
 4041  FD059B  70 09         		bvs	?12
1572
 4042  FD059D  09 30         	?08:	ora	#'0'			; buffer # = 0..9
1573
 4043  FD059F  A0 08         	?10:	ldy	#8			; index of buffer #
1574
 4044  FD05A1  97 34         		sta	[stxtp],y		; update
1575
 4045  FD05A3  20 80 06      		jsr	?cfn		; update filename
1576
 4046  FD05A6                	?12:	ACC16
1577
 4047  FD05A6  C2 20         		rep	#PMFLAG
1578
 4048                        		.LONGA	on
1579
 4049                        		.MNLIST
1580
 4050  FD05A8  A5 1A         		lda	ncount			; update total lines count
1581
 4051  FD05AA  C5 44         		cmp	ncount1
1582
 4052  FD05AC  85 44         		sta	ncount1			; save in advance for update
1583
 4053  FD05AE  85 4A         		sta	wtmp			; save in advance for conversion
1584
 4054  FD05B0                		ACC08
1585
 4055  FD05B0  E2 20         		sep	#PMFLAG
1586
 4056                        		.LONGA	off
1587
 4057                        		.MNLIST
1588
 4058  FD05B2  D0 04         		bne	?14			; changed: update
1589
 4059  FD05B4  24 3F         		bit	slfg			; not changed, check if forced update
1590
 4060  FD05B6  50 0A         		bvc	?16			; no forced update
1591
 4061  FD05B8  20 A0 18      	?14:	jsr	int2str			; convert in string
1592
 4062  FD05BB  A2 05         		ldx	#5			; 5 digits
1593
 4063  FD05BD  A0 3B         		ldy	#$3B			; column of N#
1594
 4064  FD05BF  20 71 06      		jsr	?100
1595
 4065  FD05C2                	?16:	ACC16
1596
 4066  FD05C2  C2 20         		rep	#PMFLAG
1597
 4067                        		.LONGA	on
1598
 4068                        		.MNLIST
1599
 4069  FD05C4  A5 1C         		lda	cline			; update current line #
1600
 4070  FD05C6  C5 42         		cmp	cline1
1601
 4071  FD05C8  85 42         		sta	cline1			; save in advance for update
1602
 4072  FD05CA  08            		php
1603
 4073  FD05CB  1A            		inc	a
1604
 4074  FD05CC  85 4A         		sta	wtmp			; save in advance for conversion
1605
 4075  FD05CE  28            		plp
1606
 4076  FD05CF                		ACC08
1607
 4077  FD05CF  E2 20         		sep	#PMFLAG
1608
 4078                        		.LONGA	off
1609
 4079                        		.MNLIST
1610
 4080  FD05D1  D0 04         		bne	?18			; changed: update
1611
 4081  FD05D3  24 3F         		bit	slfg			; not changed, check if forced update
1612
 4082  FD05D5  50 0A         		bvc	?20			; no forced update
1613
  Tue Jul 17 11:00:22 2018                                                                                               Page   27
1614
 
1615
 
1616
 
1617
 
1618
 4083  FD05D7  20 A0 18      	?18:	jsr	int2str			; convert in string
1619
 4084  FD05DA  A2 05         		ldx	#5			; 5 digits
1620
 4085  FD05DC  A0 44         		ldy	#$44			; column of L#
1621
 4086  FD05DE  20 71 06      		jsr	?100
1622
 4087  FD05E1  A5 1E         	?20:	lda	ccol			; update current column #
1623
 4088  FD05E3  C5 46         		cmp	ccol1
1624
 4089  FD05E5  D0 04         		bne	?22			; changed: update
1625
 4090  FD05E7  24 3F         		bit	slfg			; not changed, check if forced update
1626
 4091  FD05E9  50 0D         		bvc	?24			; no forced update
1627
 4092  FD05EB  85 46         	?22:	sta	ccol1
1628
 4093  FD05ED  1A            		inc	a
1629
 4094  FD05EE  20 96 18      		jsr	byte2str		; convert in string
1630
 4095  FD05F1  A2 03         		ldx	#3			; 3 digits
1631
 4096  FD05F3  A0 4C         		ldy	#$4C			; column of C#
1632
 4097  FD05F5  20 71 06      		jsr	?100
1633
 4098  FD05F8  A5 18         	?24:	lda	bflag			; update flag's indicator's
1634
 4099  FD05FA  C5 48         		cmp	bflag1
1635
 4100  FD05FC  D0 04         		bne	?26			; changed: update
1636
 4101  FD05FE  24 3F         		bit	slfg			; not changed, check if forced update
1637
 4102  FD0600  50 27         		bvc	?34			; no forced update
1638
 4103  FD0602  85 48         	?26:	sta	bflag1
1639
 4104  FD0604  A6 49         		ldx	fgatt			; X = disabled flag attribute
1640
 4105  FD0606  18            		clc
1641
 4106  FD0607  24 48         		bit	bflag1			; check modified flag
1642
 4107  FD0609  10 01         		bpl	?28
1643
 4108  FD060B  38            		sec				; enabled
1644
 4109  FD060C  A0 2E         	?28:	ldy	#$2E			; column of M indicator
1645
 4110  FD060E  20 69 06      		jsr	?80
1646
 4111  FD0611  18            		clc
1647
 4112  FD0612  24 48         		bit	bflag1			; check overwrite flag
1648
 4113  FD0614  50 01         		bvc	?30
1649
 4114  FD0616  38            		sec				; enabled
1650
 4115  FD0617  A0 32         	?30:	ldy	#$32			; column of O indicator
1651
 4116  FD0619  20 69 06      		jsr	?80
1652
 4117  FD061C  18            		clc
1653
 4118  FD061D  A9 20         		lda	#$20
1654
 4119  FD061F  24 48         		bit	bflag1			; check indent mode flag
1655
 4120  FD0621  F0 01         		beq	?32
1656
 4121  FD0623  38            		sec				; enabled
1657
 4122  FD0624  A0 30         	?32:	ldy	#$30			; column of I indicator
1658
 4123  FD0626  20 69 06      		jsr	?80
1659
 4124  FD0629  A5 23         	?34:	lda	fslct			; select mode flag
1660
 4125  FD062B  AA            		tax
1661
 4126  FD062C  45 3F         		eor	slfg
1662
 4127  FD062E  4A            		lsr	a			; bit 0 only
1663
 4128  FD062F  B0 04         		bcs	?36			; changed: update
1664
 4129  FD0631  24 3F         		bit	slfg			; not changed, check if forced update
1665
 4130  FD0633  50 13         		bvc	?40			; no forced update
1666
 4131  FD0635  A9 FE         	?36:	lda	#$FE			; set/reset bit 0 of slfg
1667
 4132  FD0637  25 3F         		and	slfg
1668
 4133  FD0639  9B            		txy
1669
 4134  FD063A  F0 02         		beq	?38			; reset
1670
 4135  FD063C  09 01         		ora	#$01			; set
1671
 4136  FD063E  85 3F         	?38:	sta	slfg
1672
 4137  FD0640  4A            		lsr	a			; CF = indicator status
1673
 4138  FD0641  A6 49         		ldx	fgatt			; X = disabled flag attribute
1674
 4139  FD0643  A0 34         		ldy	#$34			; column of S indicator
1675
  Tue Jul 17 11:00:22 2018                                                                                               Page   28
1676
 
1677
 
1678
 
1679
 
1680
 4140  FD0645  20 69 06      		jsr	?80
1681
 4141  FD0648
1682
 4142  FD0648                	?40:
1683
 4143  FD0648  A6 49         	?70:	ldx	fgatt			; X = disabled flag attribute
1684
 4144  FD064A  AF 65 01 00   		lda	>DP01ADDR+KbdToggle
1685
 4145  FD064E  85 6B         		sta	tmpf
1686
 4146  FD0650  18            		clc
1687
 4147  FD0651  10 01         		bpl	?72			; caps lock disabled
1688
 4148  FD0653  38            		sec				; caps lock indicator enabled
1689
 4149  FD0654  A0 35         	?72:	ldy	#$35			; column of C indicator
1690
 4150  FD0656  20 69 06      		jsr	?80
1691
 4151  FD0659  18            		clc
1692
 4152  FD065A  24 6B         		bit	tmpf			; check num lock
1693
 4153  FD065C  50 01         		bvc	?74
1694
 4154  FD065E  38            		sec				; num lock indicator enabled
1695
 4155  FD065F  A0 36         	?74:	ldy	#$36			; column of N indicator
1696
 4156  FD0661  20 69 06      		jsr	?80
1697
 4157  FD0664  A9 42         		lda	#$42			; clear forced update
1698
 4158  FD0666  14 3F         		trb	slfg
1699
 4159  FD0668  60            		rts
1700
 4160
1701
 4161                        	; set/unset indicator flag on status line
1702
 4162  FD0669  A5 3C         	?80:	lda	slattr			; set status
1703
 4163  FD066B  B0 01         		bcs	?82
1704
 4164  FD066D  8A            		txa				; unset status
1705
 4165  FD066E  97 38         	?82:	sta	[sattp],y
1706
 4166  FD0670  60            		rts
1707
 4167
1708
 4168                        	; output stringa tstr2 at column Y, X bytes
1709
 4169  FD0671  86 62         	?100:	stx	tmp6
1710
 4170  FD0673  A2 00         		ldx	#0
1711
 4171  FD0675  B5 52         	?102:	lda	<tstr2,x
1712
 4172  FD0677  97 34         		sta	[stxtp],y
1713
 4173  FD0679  E8            		inx
1714
 4174  FD067A  C8            		iny
1715
 4175  FD067B  C6 62         		dec	tmp6
1716
 4176  FD067D  D0 F6         		bne	?102
1717
 4177  FD067F  60            		rts
1718
 4178
1719
 4179                        	; update cbm filename field
1720
 4180  FD0680                	?cfn:
1721
 4181  FD0680  A2 00         		ldx	#0
1722
 4182  FD0682  A0 0B         		ldy	#$0B		; index of cbm filename
1723
 4183  FD0684  BF 00 CD 01   	?cfnl:	lda	>EDCURFILE,x
1724
 4184  FD0688  F0 08         		beq	?cfne
1725
 4185  FD068A  97 34         		sta	[stxtp],y
1726
 4186  FD068C  E8            		inx
1727
 4187  FD068D  C8            		iny
1728
 4188  FD068E  E0 12         		cpx	#18
1729
 4189  FD0690  90 F2         		bcc	?cfnl
1730
 4190  FD0692  60            	?cfne:	rts
1731
 4191
1732
 4192                        	; toggle insert flag
1733
 4193                        	; control key: insert key
1734
 4194  FD0693                	tins:
1735
 4195  FD0693  A9 40         		lda	#$40			; insert flag
1736
 4196  FD0695  AA            		tax
1737
  Tue Jul 17 11:00:22 2018                                                                                               Page   29
1738
 
1739
 
1740
 
1741
 
1742
 4197  FD0696  45 18         		eor	bflag			; toggle
1743
 4198  FD0698  85 18         		sta	bflag
1744
 4199  FD069A  8A            		txa
1745
 4200  FD069B  45 2E         		eor	cursmode		; toggle under/block cursor
1746
 4201  FD069D  85 2E         		sta	cursmode
1747
 4202  FD069F  20 FF 16      		jsr	setcurs
1748
 4203  FD06A2  4C 4F 05      		jmp	updsl
1749
 4204
1750
 4205                        	; toggle indent flag
1751
 4206                        	; Ctrl+TAB or Ctrl+I (control key)
1752
 4207  FD06A5                	tind:
1753
 4208  FD06A5  A9 20         		lda	#$20			; indent flag
1754
 4209  FD06A7  45 18         		eor	bflag
1755
 4210  FD06A9  85 18         		sta	bflag
1756
 4211  FD06AB  4C 4F 05      		jmp	updsl
1757
 4212
1758
 4213                        	; indent new line
1759
 4214  FD06AE                	indent:
1760
 4215  FD06AE  A9 20         		lda	#$20			; test indent flag
1761
 4216  FD06B0  24 18         		bit	bflag
1762
 4217  FD06B2  F0 15         		beq	?04			; no indent
1763
 4218  FD06B4  A5 2F         		lda	ctmp
1764
 4219  FD06B6  F0 11         		beq	?04			; no blanks
1765
 4220  FD06B8  A9 01         		lda	#$01			; no update edit window while indent...
1766
 4221  FD06BA  04 33         		tsb	edtfg			; ... blank's insertion
1767
 4222  FD06BC  A9 20         	?02:	lda	#' '			; insert starting blanks
1768
 4223  FD06BE  20 AC 00      		jsr	edkey
1769
 4224  FD06C1  C6 2F         		dec	ctmp
1770
 4225  FD06C3  D0 F7         		bne	?02
1771
 4226  FD06C5  A9 01         		lda	#$01			; restore flag
1772
 4227  FD06C7  14 33         		trb	edtfg
1773
 4228  FD06C9  60            	?04:	rts
1774
 4229
1775
 4230                        	;---------------------------------------------------
1776
 4231
1777
 4232                        	; CTRL Y
1778
 4233  FD06CA                	delline:
1779
 4234  FD06CA  20 93 0E      		jsr	mvpp2
1780
 4235  FD06CD  20 70 0F      		JSR	nextln
1781
 4236  FD06D0  90 03         		bcc	?04
1782
 4237  FD06D2  4C 4A 0E      	?02:	jmp	pp2mv
1783
 4238  FD06D5  A5 15         	?04:	lda	ppage
1784
 4239  FD06D7  85 53         		sta	pb+1
1785
 4240  FD06D9  A5 16         		lda	ppage+1
1786
 4241  FD06DB  85 54         		sta	pb+2
1787
 4242  FD06DD  A5 17         		lda	ixb
1788
 4243  FD06DF  85 6B         		sta	tmpf
1789
 4244  FD06E1  20 8C 0F      		JSR	startln			; first byte of this line
1790
 4245  FD06E4  B0 EC         		bcs	?02
1791
 4246  FD06E6                		ACC16
1792
 4247  FD06E6  C2 20         		rep	#PMFLAG
1793
 4248                        		.LONGA	on
1794
 4249                        		.MNLIST
1795
 4250  FD06E8  C6 1A         		dec	ncount
1796
 4251  FD06EA  A5 15         		lda	ppage
1797
 4252  FD06EC  C5 53         		cmp	pb+1
1798
 4253  FD06EE                		ACC08
1799
  Tue Jul 17 11:00:22 2018                                                                                               Page   30
1800
 
1801
 
1802
 
1803
 
1804
 4254  FD06EE  E2 20         		sep	#PMFLAG
1805
 4255                        		.LONGA	off
1806
 4256                        		.MNLIST
1807
 4257  FD06F0  F0 21         		beq	?10			; whole line just in one block
1808
 4258  FD06F2  A5 17         		LDA	ixb
1809
 4259  FD06F4  C9 05         		CMP	#BSTART
1810
 4260  FD06F6  D0 0A         		BNE	?06
1811
 4261  FD06F8  A5 16         		LDA	ppage+1			; block can be free'd
1812
 4262  FD06FA  EB            		xba
1813
 4263  FD06FB  A5 15         		lda	ppage
1814
 4264  FD06FD  20 74 10      		JSR	delblk
1815
 4265  FD0700  80 05         		bra	?08
1816
 4266  FD0702  3A            	?06:	dec	a			; just one byte less
1817
 4267  FD0703  A0 04         		LDY	#BNDX
1818
 4268  FD0705  97 14         		STA	[pblk],Y
1819
 4269  FD0707  A5 53         	?08:	LDA	pb+1			; go in the next block
1820
 4270  FD0709  85 15         		sta	ppage
1821
 4271  FD070B  A5 54         		lda	pb+2
1822
 4272  FD070D  85 16         		sta	ppage+1
1823
 4273  FD070F  A9 05         		lda	#BSTART			; line continue at beginning...
1824
 4274  FD0711  85 17         		sta	ixb			; ...of next block
1825
 4275  FD0713  A0 04         	?10:	LDY	#BNDX			; now move back bytes
1826
 4276  FD0715  B7 14         		lda	[pblk],y
1827
 4277  FD0717  85 62         		sta	tmp6
1828
 4278  FD0719  A4 6B         		LDY	tmpf
1829
 4279  FD071B  88            		DEY
1830
 4280  FD071C  84 63         		STY	tmp7
1831
 4281  FD071E  A6 17         		LDX	ixb
1832
 4282  FD0720  CA            		DEX
1833
 4283  FD0721  E6 63         	?12:	INC	tmp7
1834
 4284  FD0723  E8            		inx
1835
 4285  FD0724  A4 63         		LDY	tmp7
1836
 4286  FD0726  B7 14         		lda	[pblk],y
1837
 4287  FD0728  9B            		txy
1838
 4288  FD0729  97 14         		STA	[pblk],Y
1839
 4289  FD072B  A5 62         		lda	tmp6
1840
 4290  FD072D  C5 63         		CMP	tmp7
1841
 4291  FD072F  D0 F0         		BNE	?12
1842
 4292  FD0731  8A            		txa
1843
 4293  FD0732  A0 04         		LDY	#BNDX
1844
 4294  FD0734  97 14         		STA	[pblk],Y
1845
 4295  FD0736  4C 32 04      		JMP	updwin
1846
 4296
1847
 4297  FD0739
1848
 4298  FD0739                	copysel:
1849
 4299  FD0739  A9 02         		lda	#$02			; copy operation: reset flag
1850
 4300  FD073B  14 33         		trb	edtfg
1851
 4301  FD073D  64 30         		stz	ctmp2			; copy op (zero)
1852
 4302  FD073F  80 0B         		bra	ct1
1853
 4303
1854
 4304  FD0741                	cberr:
1855
 4305  FD0741  A2 05         		ldx	#$05
1856
 4306  FD0743  4C 43 05      		jmp	error			; Clipboard: illegal command
1857
 4307
1858
 4308                        	; CUT
1859
 4309                        	; P1F4F:
1860
 4310  FD0746                	cutsel:
1861
  Tue Jul 17 11:00:22 2018                                                                                               Page   31
1862
 
1863
 
1864
 
1865
 
1866
 4311  FD0746  A9 02         		lda	#$02			; cut operation: set flag
1867
 4312  FD0748  04 33         		tsb	edtfg
1868
 4313  FD074A  85 30         		sta	ctmp2			; cut op (not zero)
1869
 4314  FD074C  24 33         	ct1:	bit	edtfg
1870
 4315  FD074E  70 F1         		bvs	cberr			; clipboard error
1871
 4316  FD0750  A5 23         		LDA	fslct
1872
 4317  FD0752  F0 2B         		beq	?00a
1873
 4318  FD0754  64 23         		stz	fslct
1874
 4319  FD0756  A9 0A         		LDA	#CLIPBRD
1875
 4320  FD0758  20 78 0B      		JSR	freebuf
1876
 4321  FD075B  64 52         		STZ	pb
1877
 4322  FD075D  64 55         		STZ	pd
1878
 4323  FD075F  20 93 0E      		JSR	mvpp2
1879
 4324  FD0762  20 DF 0A      		JSR	newblk			; need at least of 2 free blocks
1880
 4325  FD0765  B0 15         		BCS	?00			; no free blocks
1881
 4326  FD0767                		ACC16
1882
 4327  FD0767  C2 20         		rep	#PMFLAG
1883
 4328                        		.LONGA	on
1884
 4329                        		.MNLIST
1885
 4330  FD0769  85 58         		STA	bka
1886
 4331  FD076B  85 53         		STA	pb+1
1887
 4332  FD076D  A7 52         		lda	[pb]
1888
 4333  FD076F  85 10         		STA	pfree
1889
 4334  FD0771  20 DF 0A      		JSR	newblk
1890
 4335  FD0774  90 0A         		BCC	?01			; ok
1891
 4336  FD0776  A5 58         		LDA	bka			; restore free list
1892
 4337  FD0778  85 10         		STA	pfree
1893
 4338  FD077A                		ACC08
1894
 4339  FD077A  E2 20         		sep	#PMFLAG
1895
 4340                        		.LONGA	off
1896
 4341                        		.MNLIST
1897
 4342  FD077C  20 32 04      	?00:	jsr	updwin			; for clear selection on edit window
1898
 4343  FD077F  60            	?00a:	rts
1899
 4344  FD0780  85 5A         	?01:	STA	bkb
1900
 4345                        		.LONGA	on			; remember here A/M 16 bit
1901
 4346  FD0782  A5 00         		LDA	pp0
1902
 4347  FD0784  85 15         		STA	ppage
1903
 4348  FD0786  A4 0A         		LDY	ix0
1904
 4349  FD0788  84 17         		STY	ixb
1905
 4350  FD078A  A5 24         		LDA	nslctl
1906
 4351  FD078C  30 0C         		BMI	?02
1907
 4352  FD078E  85 28         		STA	rclip
1908
 4353  FD0790  A5 08         		LDA	pp8
1909
 4354  FD0792  85 06         		STA	pp6
1910
 4355  FD0794  A4 0E         		LDY	ix8
1911
 4356  FD0796  84 0D         		STY	ix6
1912
 4357  FD0798  80 1F         		bra	?04
1913
 4358  FD079A  49 FF FF      	?02:	EOR	#$FFFF
1914
 4359  FD079D  1A            		inc	a
1915
 4360  FD079E  85 28         		STA	rclip
1916
 4361  FD07A0                		ACC08
1917
 4362  FD07A0  E2 20         		sep	#PMFLAG
1918
 4363                        		.LONGA	off
1919
 4364                        		.MNLIST
1920
 4365  FD07A2  20 70 0F      		JSR	nextln
1921
 4366  FD07A5  A5 15         		LDA	ppage
1922
 4367  FD07A7  85 06         		STA	pp6
1923
  Tue Jul 17 11:00:22 2018                                                                                               Page   32
1924
 
1925
 
1926
 
1927
 
1928
 4368  FD07A9  A5 16         		LDA	ppage+1
1929
 4369  FD07AB  85 07         		STA	pp6+1
1930
 4370  FD07AD  A5 17         		LDA	ixb
1931
 4371  FD07AF  85 0D         		STA	ix6
1932
 4372  FD07B1  20 4A 0E      		JSR	pp2mv
1933
 4373  FD07B4  20 70 0F      		JSR	nextln
1934
 4374  FD07B7                		ACC16
1935
 4375  FD07B7  C2 20         		rep	#PMFLAG
1936
 4376                        		.LONGA	on
1937
 4377                        		.MNLIST
1938
 4378  FD07B9  A6 30         	?04:	ldx	ctmp2
1939
 4379  FD07BB  F0 16         		beq	?06			; copy op: skip update cline/ncount
1940
 4380  FD07BD  38            		sec
1941
 4381  FD07BE  A5 1A         		lda	ncount
1942
 4382  FD07C0  E5 28         		sbc	rclip
1943
 4383  FD07C2  85 1A         		sta	ncount
1944
 4384  FD07C4  A5 24         		LDA	nslctl
1945
 4385  FD07C6  30 09         		BMI	?05
1946
 4386  FD07C8  38            		SEC
1947
 4387  FD07C9  A5 1C         		LDA	cline
1948
 4388  FD07CB  E5 28         		SBC	rclip
1949
 4389  FD07CD  85 1C         		STA	cline
1950
 4390  FD07CF  80 02         		bra	?06
1951
 4391  FD07D1  E6 1C         	?05:	INC	cline
1952
 4392  FD07D3  A5 58         	?06:	LDA	bka
1953
 4393  FD07D5  85 53         		STA	pb+1
1954
 4394  FD07D7  A2 14         		LDX	#CLIPBRD*2
1955
 4395  FD07D9  95 6C         		STA	bstart,X
1956
 4396  FD07DB  95 82         		STA	bcur,X
1957
 4397  FD07DD  A9 05 00      		LDA	#BSTART
1958
 4398  FD07E0  95 98         		STA	bndx,X
1959
 4399  FD07E2  A5 28         		lda	rclip
1960
 4400  FD07E4  95 C4         		sta	btot,x
1961
 4401  FD07E6  74 AE         		stz	bline,x
1962
 4402  FD07E8  A5 15         		LDA	ppage
1963
 4403  FD07EA  C5 06         		CMP	pp6
1964
 4404  FD07EC                		ACC08
1965
 4405  FD07EC  E2 20         		sep	#PMFLAG
1966
 4406                        		.LONGA	off
1967
 4407                        		.MNLIST
1968
 4408  FD07EE  D0 03         		BNE	?07
1969
 4409  FD07F0  4C BB 08      		JMP	?13			; all in the same block
1970
 4410  FD07F3  A6 30         	?07:	ldx	ctmp2
1971
 4411  FD07F5  D0 03         		bne	?07a			; cut op
1972
 4412  FD07F7  4C 19 09      		jmp	?20			; copy op
1973
 4413  FD07FA  A0 00         	?07a:	LDY	#$00
1974
 4414  FD07FC                		CPU16
1975
 4415  FD07FC  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
1976
 4416                        		.LONGA	on
1977
 4417                        		.LONGI	on
1978
 4418                        		.MNLIST
1979
 4419  FD07FE  A5 5A         		LDA	bkb			; take off bkb from free list
1980
 4420  FD0800  85 56         		STA	pd+1
1981
 4421  FD0802  A7 55         		lda	[pd]
1982
 4422  FD0804  85 10         		STA	pfree
1983
 4423  FD0806  A7 14         		lda	[pblk]
1984
 4424  FD0808  87 52         		STA	[pb]			; pb->next = cur->next
1985
  Tue Jul 17 11:00:22 2018                                                                                               Page   33
1986
 
1987
 
1988
 
1989
 
1990
 4425  FD080A  85 56         		STA	pd+1			; pd = cur->next
1991
 4426  FD080C  98            		TYA
1992
 4427  FD080D  C8            		INY
1993
 4428  FD080E  C8            		INY
1994
 4429  FD080F  97 52         		STA	[pb],Y			; pb->prev = NULL
1995
 4430  FD0811  A5 53         		LDA	pb+1
1996
 4431  FD0813  97 55         		STA	[pd],Y			; cur->next->prev = pb
1997
 4432  FD0815                		CPU08
1998
 4433  FD0815  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
1999
 4434                        		.LONGA	off
2000
 4435                        		.LONGI	off
2001
 4436                        		.MNLIST
2002
 4437  FD0817  C8            		INY
2003
 4438  FD0818  C8            		INY				; index field
2004
 4439  FD0819  B7 14         		lda	[pblk],y
2005
 4440  FD081B  85 62         		sta	tmp6
2006
 4441  FD081D  38            		SEC
2007
 4442  FD081E  E5 17         		SBC	ixb
2008
 4443  FD0820  18            		CLC
2009
 4444  FD0821  69 05         		ADC	#BSTART
2010
 4445  FD0823  97 52         		STA	[pb],Y
2011
 4446  FD0825  BB            		tyx				; BNDX
2012
 4447  FD0826  A4 17         		LDY	ixb
2013
 4448  FD0828  88            		DEY
2014
 4449  FD0829  84 63         		STY	tmp7
2015
 4450  FD082B  E6 63         	?08:	INC	tmp7
2016
 4451  FD082D  E8            		inx
2017
 4452  FD082E  A4 63         		LDY	tmp7
2018
 4453  FD0830  B7 14         		lda	[pblk],y
2019
 4454  FD0832  9B            		txy
2020
 4455  FD0833  97 52         		STA	[pb],Y
2021
 4456  FD0835  A5 62         		lda	tmp6
2022
 4457  FD0837  C5 63         		CMP	tmp7
2023
 4458  FD0839  D0 F0         		BNE	?08
2024
 4459  FD083B                		ACC16
2025
 4460  FD083B  C2 20         		rep	#PMFLAG
2026
 4461                        		.LONGA	on
2027
 4462                        		.MNLIST
2028
 4463  FD083D  A5 5A         		LDA	bkb
2029
 4464  FD083F  85 56         		STA	pd+1
2030
 4465  FD0841  A5 06         		LDA	pp6
2031
 4466  FD0843  85 53         		STA	pb+1
2032
 4467  FD0845  A7 52         		lda	[pb]
2033
 4468  FD0847  87 55         		STA	[pd]
2034
 4469  FD0849                		ACC08
2035
 4470  FD0849  E2 20         		sep	#PMFLAG
2036
 4471                        		.LONGA	off
2037
 4472                        		.MNLIST
2038
 4473  FD084B  A0 04         		LDY	#BNDX
2039
 4474  FD084D  B7 52         		lda	[pb],y
2040
 4475  FD084F  85 62         		sta	tmp6
2041
 4476  FD0851  38            		SEC
2042
 4477  FD0852  E5 0D         		SBC	ix6
2043
 4478  FD0854  18            		CLC
2044
 4479  FD0855  69 05         		ADC	#BSTART
2045
 4480  FD0857  97 55         		STA	[pd],Y
2046
 4481  FD0859  BB            		tyx
2047
  Tue Jul 17 11:00:22 2018                                                                                               Page   34
2048
 
2049
 
2050
 
2051
 
2052
 4482  FD085A  A4 0D         		LDY	ix6
2053
 4483  FD085C  88            		DEY
2054
 4484  FD085D  84 63         		STY	tmp7
2055
 4485  FD085F  E6 63         	?09:	INC	tmp7
2056
 4486  FD0861  E8            		inx
2057
 4487  FD0862  A4 63         		LDY	tmp7
2058
 4488  FD0864  B7 52         		lda	[pb],y
2059
 4489  FD0866  9B            		txy
2060
 4490  FD0867  97 55         		STA	[pd],Y
2061
 4491  FD0869  A5 62         		lda	tmp6
2062
 4492  FD086B  C5 63         		CMP	tmp7
2063
 4493  FD086D  D0 F0         		BNE	?09
2064
 4494  FD086F  A0 04         		LDY	#BNDX
2065
 4495  FD0871  A5 0D         		LDA	ix6
2066
 4496  FD0873  97 52         		STA	[pb],Y
2067
 4497  FD0875  A8            		TAY
2068
 4498  FD0876  A9 00         		LDA	#$00
2069
 4499  FD0878  97 52         		STA	[pb],Y
2070
 4500  FD087A  EB            		xba
2071
 4501  FD087B  A9 00         		lda	#0
2072
 4502  FD087D                		ACC16
2073
 4503  FD087D  C2 20         		rep	#PMFLAG
2074
 4504                        		.LONGA	on
2075
 4505                        		.MNLIST
2076
 4506  FD087F  87 52         		STA	[pb]			; next = NULL
2077
 4507  FD0881  A0 02         		LDY	#BPREV
2078
 4508  FD0883  A5 15         		LDA	ppage
2079
 4509  FD0885  97 55         		STA	[pd],Y
2080
 4510  FD0887  A5 56         		LDA	pd+1
2081
 4511  FD0889  87 14         		STA	[pblk]
2082
 4512  FD088B  A7 55         		lda	[pd]
2083
 4513  FD088D  F0 06         		BEQ	?10
2084
 4514  FD088F  85 53         		STA	pb+1
2085
 4515  FD0891  A5 56         		LDA	pd+1
2086
 4516  FD0893  97 52         		STA	[pb],Y
2087
 4517  FD0895                	?10:	ACC08
2088
 4518  FD0895  E2 20         		sep	#PMFLAG
2089
 4519                        		.LONGA	off
2090
 4520                        		.MNLIST
2091
 4521  FD0897  A5 17         		LDA	ixb
2092
 4522  FD0899  C9 05         		CMP	#BSTART
2093
 4523  FD089B  D0 0A         		BNE	?11
2094
 4524  FD089D  A5 16         		LDA	ppage+1
2095
 4525  FD089F  EB            		xba
2096
 4526  FD08A0  A5 15         		lda	ppage
2097
 4527  FD08A2  20 74 10      		JSR	delblk
2098
 4528  FD08A5  80 05         		bra	?12
2099
 4529  FD08A7  3A            	?11:	dec	a
2100
 4530  FD08A8  A0 04         		LDY	#BNDX
2101
 4531  FD08AA  97 14         		STA	[pblk],Y
2102
 4532  FD08AC  A5 56         	?12:	LDA	pd+1
2103
 4533  FD08AE  85 15         		STA	ppage
2104
 4534  FD08B0  A5 57         		lda	pd+2
2105
 4535  FD08B2  85 16         		sta	ppage+1
2106
 4536  FD08B4  A9 05         		LDA	#BSTART
2107
 4537  FD08B6  85 17         		STA	ixb
2108
 4538  FD08B8  4C 32 04      		JMP	updwin
2109
  Tue Jul 17 11:00:22 2018                                                                                               Page   35
2110
 
2111
 
2112
 
2113
 
2114
 4539
2115
 4540  FD08BB  A4 17         	?13:	LDY	ixb
2116
 4541  FD08BD  84 63         		STY	tmp7
2117
 4542  FD08BF  A2 05         		LDX	#BSTART
2118
 4543  FD08C1  A4 63         	?14:	LDY	tmp7
2119
 4544  FD08C3  B7 14         		lda	[pblk],y
2120
 4545  FD08C5  9B            		txy
2121
 4546  FD08C6  97 52         		STA	[pb],Y
2122
 4547  FD08C8  E6 63         		INC	tmp7
2123
 4548  FD08CA  E8            		inx
2124
 4549  FD08CB  A5 63         		LDA	tmp7
2125
 4550  FD08CD  C5 0D         		CMP	ix6
2126
 4551  FD08CF  D0 F0         		BNE	?14
2127
 4552  FD08D1  A0 00         		LDY	#$00
2128
 4553  FD08D3                		CPU16
2129
 4554  FD08D3  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2130
 4555                        		.LONGA	on
2131
 4556                        		.LONGI	on
2132
 4557                        		.MNLIST
2133
 4558  FD08D5  98            		tya
2134
 4559  FD08D6  87 52         		STA	[pb]			; next = NULL
2135
 4560  FD08D8  C8            		INY
2136
 4561  FD08D9  C8            		iny
2137
 4562  FD08DA  97 52         		STA	[pb],Y			; prev = NULL
2138
 4563  FD08DC                		CPU08
2139
 4564  FD08DC  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2140
 4565                        		.LONGA	off
2141
 4566                        		.LONGI	off
2142
 4567                        		.MNLIST
2143
 4568  FD08DE  8A            		txa
2144
 4569  FD08DF  C8            		INY
2145
 4570  FD08E0  C8            		iny
2146
 4571  FD08E1  97 52         		STA	[pb],Y			; index
2147
 4572  FD08E3  A8            		TAY
2148
 4573  FD08E4  A9 00         		LDA	#$00
2149
 4574  FD08E6  97 52         		STA	[pb],Y			; buffer terminator
2150
 4575  FD08E8  A9 02         		lda	#$02			; cut operation ?
2151
 4576  FD08EA  24 33         		bit	edtfg
2152
 4577  FD08EC  D0 05         		bne	?14a			; yes
2153
 4578  FD08EE  20 4A 0E      		jsr	pp2mv			; restore current buffer pointer
2154
 4579  FD08F1  80 23         		bra	?16
2155
 4580  FD08F3  A0 04         	?14a:	LDY	#BNDX			; move back
2156
 4581  FD08F5  B7 14         		lda	[pblk],y
2157
 4582  FD08F7  85 62         		sta	tmp6
2158
 4583  FD08F9  A4 0D         		LDY	ix6
2159
 4584  FD08FB  88            		DEY
2160
 4585  FD08FC  84 63         		STY	tmp7
2161
 4586  FD08FE  A6 17         		LDX	ixb
2162
 4587  FD0900  CA            		DEX
2163
 4588  FD0901  E6 63         	?15:	INC	tmp7
2164
 4589  FD0903  E8            		inx
2165
 4590  FD0904  A4 63         		LDY	tmp7
2166
 4591  FD0906  B7 14         		lda	[pblk],y
2167
 4592  FD0908  9B            		txy
2168
 4593  FD0909  97 14         		STA	[pblk],Y
2169
 4594  FD090B  A5 62         		lda	tmp6
2170
 4595  FD090D  C5 63         		CMP	tmp7
2171
  Tue Jul 17 11:00:22 2018                                                                                               Page   36
2172
 
2173
 
2174
 
2175
 
2176
 4596  FD090F  D0 F0         		BNE	?15
2177
 4597  FD0911  8A            		txa
2178
 4598  FD0912  A0 04         		LDY	#BNDX
2179
 4599  FD0914  97 14         		STA	[pblk],Y
2180
 4600  FD0916  4C 32 04      	?16:	JMP	updwin
2181
 4601
2182
 4602  FD0919  A2 00         	?20:	ldx	#0
2183
 4603  FD091B                		CPU16				; count needs block's
2184
 4604  FD091B  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2185
 4605                        		.LONGA	on
2186
 4606                        		.LONGI	on
2187
 4607                        		.MNLIST
2188
 4608  FD091D  A5 5A         		LDA	bkb			; take off bkb from free list
2189
 4609  FD091F  85 56         		STA	pd+1
2190
 4610  FD0921  A7 55         		lda	[pd]
2191
 4611  FD0923  85 10         		STA	pfree
2192
 4612  FD0925  A5 15         		lda	ppage
2193
 4613  FD0927  85 56         	?22:	sta	pd+1
2194
 4614  FD0929  A7 55         		lda	[pd]			; next
2195
 4615  FD092B  C5 06         		cmp	pp6			; loop until last block
2196
 4616  FD092D  F0 03         		beq	?24			; end loop
2197
 4617  FD092F  E8            		inx
2198
 4618  FD0930  80 F5         		bra	?22
2199
 4619  FD0932  8A            	?24:	txa
2200
 4620  FD0933  F0 13         		beq	?28			; no more blocks need
2201
 4621  FD0935  20 37 0B      		jsr	chkfree			; check needs blocks
2202
 4622  FD0938  A9 00 00      		lda	#0
2203
 4623  FD093B  90 0B         		bcc	?28			; ok
2204
 4624  FD093D  A5 58         		LDA	bka			; restore free list
2205
 4625  FD093F  85 10         		STA	pfree
2206
 4626  FD0941                		CPU08
2207
 4627  FD0941  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2208
 4628                        		.LONGA	off
2209
 4629                        		.LONGI	off
2210
 4630                        		.MNLIST
2211
 4631  FD0943  A2 04         		LDX	#$04			; Not enough memory error
2212
 4632  FD0945  4C 43 05      		JMP	error
2213
 4633  FD0948                	?28:	LONG_ON				; remember here A/M and X/Y 16 bit
2214
 4634                        		.LONGA	on
2215
 4635                        		.LONGI	on
2216
 4636                        		.MNLIST
2217
 4637  FD0948  A0 02 00      		ldy	#BPREV
2218
 4638  FD094B  97 52         		STA	[pb],Y			; prev = NULL
2219
 4639  FD094D                		CPU08
2220
 4640  FD094D  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2221
 4641                        		.LONGA	off
2222
 4642                        		.LONGI	off
2223
 4643                        		.MNLIST
2224
 4644  FD094F  C8            		INY
2225
 4645  FD0950  C8            		INY				; index field
2226
 4646  FD0951  B7 14         		lda	[pblk],y
2227
 4647  FD0953  85 62         		sta	tmp6			; copy tmp6 - ixb + 1 bytes...
2228
 4648  FD0955  38            		SEC				; ...from pblk to pb...
2229
 4649  FD0956  E5 17         		SBC	ixb			; ...starting from ixb
2230
 4650  FD0958  18            		CLC
2231
 4651  FD0959  69 05         		ADC	#BSTART
2232
 4652  FD095B  97 52         		STA	[pb],Y
2233
  Tue Jul 17 11:00:22 2018                                                                                               Page   37
2234
 
2235
 
2236
 
2237
 
2238
 4653  FD095D  BB            		tyx				; BNDX
2239
 4654  FD095E  A4 17         		LDY	ixb
2240
 4655  FD0960  88            		DEY
2241
 4656  FD0961  84 63         		STY	tmp7
2242
 4657  FD0963  E6 63         	?30:	INC	tmp7
2243
 4658  FD0965  E8            		inx
2244
 4659  FD0966  A4 63         		LDY	tmp7
2245
 4660  FD0968  B7 14         		lda	[pblk],y
2246
 4661  FD096A  9B            		txy
2247
 4662  FD096B  97 52         		STA	[pb],Y
2248
 4663  FD096D  A5 62         		lda	tmp6
2249
 4664  FD096F  C5 63         		CMP	tmp7
2250
 4665  FD0971  D0 F0         		BNE	?30
2251
 4666  FD0973                		ACC16
2252
 4667  FD0973  C2 20         		rep	#PMFLAG
2253
 4668                        		.LONGA	on
2254
 4669                        		.MNLIST
2255
 4670  FD0975  A7 14         		LDA	[pblk]			; next
2256
 4671  FD0977  85 56         	?32:	STA	pd+1
2257
 4672  FD0979  C5 06         		cmp	pp6
2258
 4673  FD097B  F0 24         		beq	?36
2259
 4674  FD097D  A5 53         		LDA	pb+1
2260
 4675  FD097F  48            		PHA
2261
 4676  FD0980  20 DF 0A      		JSR	newblk			; no give error now!
2262
 4677  FD0983  87 52         		STA	[pb]			; next
2263
 4678  FD0985  85 53         		STA	pb+1
2264
 4679  FD0987  A7 52         		lda	[pb]
2265
 4680  FD0989  85 10         		STA	pfree
2266
 4681  FD098B  68            		PLA
2267
 4682  FD098C  A0 02         		ldy	#BPREV
2268
 4683  FD098E  97 52         		STA	[pb],Y
2269
 4684  FD0990  C8            		INY
2270
 4685  FD0991  C8            		iny
2271
 4686  FD0992                		ACC08
2272
 4687  FD0992  E2 20         		sep	#PMFLAG
2273
 4688                        		.LONGA	off
2274
 4689                        		.MNLIST
2275
 4690  FD0994  B7 55         	?34:	lda	[pd],y
2276
 4691  FD0996  97 52         		STA	[pb],Y
2277
 4692  FD0998  C8            		INY
2278
 4693  FD0999  D0 F9         		BNE	?34
2279
 4694  FD099B                		ACC16
2280
 4695  FD099B  C2 20         		rep	#PMFLAG
2281
 4696                        		.LONGA	on
2282
 4697                        		.MNLIST
2283
 4698  FD099D  A7 55         		lda	[pd]
2284
 4699  FD099F  80 D6         		bra	?32
2285
 4700  FD09A1  A5 53         	?36:	lda	pb+1
2286
 4701  FD09A3  85 58         		sta	bka
2287
 4702  FD09A5  A5 5A         		LDA	bkb
2288
 4703  FD09A7  87 52         		sta	[pb]
2289
 4704  FD09A9  85 53         		STA	pb+1
2290
 4705  FD09AB  A9 00 00      		lda	#0
2291
 4706  FD09AE  87 52         		sta	[pb]
2292
 4707  FD09B0  A0 02         		ldy	#BPREV
2293
 4708  FD09B2  A5 58         		lda	bka
2294
 4709  FD09B4  97 52         		sta	[pb],y
2295
  Tue Jul 17 11:00:22 2018                                                                                               Page   38
2296
 
2297
 
2298
 
2299
 
2300
 4710  FD09B6                		ACC08
2301
 4711  FD09B6  E2 20         		sep	#PMFLAG
2302
 4712                        		.LONGA	off
2303
 4713                        		.MNLIST
2304
 4714  FD09B8  A0 04         		LDY	#BNDX
2305
 4715  FD09BA  C8            	?38:	iny
2306
 4716  FD09BB  B7 55         		lda	[pd],y
2307
 4717  FD09BD  97 52         		STA	[pb],Y
2308
 4718  FD09BF  C4 0D         		cpy	ix6
2309
 4719  FD09C1  D0 F7         		BNE	?38
2310
 4720  FD09C3  A0 04         		LDY	#BNDX
2311
 4721  FD09C5  A5 0D         		LDA	ix6
2312
 4722  FD09C7  97 52         		STA	[pb],Y
2313
 4723  FD09C9  A8            		TAY
2314
 4724  FD09CA  A9 00         		LDA	#$00
2315
 4725  FD09CC  97 52         		STA	[pb],Y
2316
 4726  FD09CE  20 4A 0E      		jsr	pp2mv
2317
 4727  FD09D1  4C 32 04      		jmp	updwin
2318
 4728
2319
 4729                        	; PASTE
2320
 4730                        	; P215E:
2321
 4731  FD09D4                	pastesel:
2322
 4732  FD09D4  24 33         		bit	edtfg
2323
 4733  FD09D6  50 03         		bvc	?00
2324
 4734  FD09D8  4C 41 07      		jmp	cberr			; clipboard error
2325
 4735  FD09DB  A5 23         	?00:	LDA	fslct
2326
 4736  FD09DD  D0 1C         		bne	?01			; no selection
2327
 4737  FD09DF  A2 14         		LDX	#CLIPBRD*2
2328
 4738  FD09E1                		ACC16CLC
2329
 4739  FD09E1  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
2330
 4740                        		.LONGA	on
2331
 4741                        		.MNLIST
2332
 4742  FD09E3  B5 6C         		LDA	bstart,X
2333
 4743  FD09E5  F0 12         		beq	?00b			; no selected text
2334
 4744  FD09E7  B5 C4         		lda	btot,x			; # lines on clipboard
2335
 4745  FD09E9  65 1A         		adc	ncount			; check overflow
2336
 4746  FD09EB  B0 05         		bcs	?00a			; overflow
2337
 4747  FD09ED  C9 FD FF      		cmp	#MAXLINES
2338
 4748  FD09F0  90 0A         		bcc	?02
2339
 4749  FD09F2                	?00a:	ACC08
2340
 4750  FD09F2  E2 20         		sep	#PMFLAG
2341
 4751                        		.LONGA	off
2342
 4752                        		.MNLIST
2343
 4753  FD09F4  A2 06         		ldx	#6			; can't paste text: lines count overflow
2344
 4754  FD09F6  4C 43 05      		jmp	error
2345
 4755  FD09F9                	?00b:	ACC08
2346
 4756  FD09F9  E2 20         		sep	#PMFLAG
2347
 4757                        		.LONGA	off
2348
 4758                        		.MNLIST
2349
 4759  FD09FB  60            	?01:	rts
2350
 4760                        	?02:	.LONGA	on			; remember here A/M 16 bit
2351
 4761  FD09FC  B5 6C         		LDA	bstart,X		; block's count
2352
 4762  FD09FE  20 F1 0E      		JSR	blkcnt
2353
 4763  FD0A01  1A            		inc	a			; one more
2354
 4764  FD0A02  20 37 0B      		jsr	chkfree			; check free blocks
2355
 4765  FD0A05                		ACC08
2356
 4766  FD0A05  E2 20         		sep	#PMFLAG
2357
  Tue Jul 17 11:00:22 2018                                                                                               Page   39
2358
 
2359
 
2360
 
2361
 
2362
 4767                        		.LONGA	off
2363
 4768                        		.MNLIST
2364
 4769  FD0A07  90 05         		bcc	?03
2365
 4770  FD0A09  A2 04         		LDX	#$04			; Not enough memory error
2366
 4771  FD0A0B  4C 43 05      		JMP	error
2367
 4772  FD0A0E  20 AD 0E      	?03:	JSR	pp8mv
2368
 4773  FD0A11  64 52         		stz	pb
2369
 4774  FD0A13  64 55         		stz	pd
2370
 4775  FD0A15                		ACC16CLC
2371
 4776  FD0A15  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
2372
 4777                        		.LONGA	on
2373
 4778                        		.MNLIST
2374
 4779  FD0A17  A2 14         		LDX	#CLIPBRD*2
2375
 4780  FD0A19  B5 C4         		lda	btot,x
2376
 4781  FD0A1B  85 28         		sta	rclip
2377
 4782  FD0A1D  A5 1C         		LDA	cline
2378
 4783  FD0A1F  65 28         		ADC	rclip
2379
 4784  FD0A21  85 1C         		STA	cline
2380
 4785  FD0A23  18            		clc
2381
 4786  FD0A24  A5 1A         		lda	ncount
2382
 4787  FD0A26  65 28         		adc	rclip
2383
 4788  FD0A28  85 1A         		sta	ncount
2384
 4789  FD0A2A  A7 14         		lda	[pblk]			; next
2385
 4790  FD0A2C  48            		PHA
2386
 4791  FD0A2D  A5 15         		LDA	ppage
2387
 4792  FD0A2F  85 53         		STA	pb+1
2388
 4793  FD0A31  A2 14         		LDX	#CLIPBRD*2
2389
 4794  FD0A33  B5 6C         		LDA	bstart,X
2390
 4795  FD0A35  85 56         	?03a:	STA	pd+1
2391
 4796  FD0A37  A5 53         		LDA	pb+1
2392
 4797  FD0A39  48            		PHA
2393
 4798  FD0A3A  20 DF 0A      		JSR	newblk			; no give error now!
2394
 4799  FD0A3D  87 52         		STA	[pb]			; next
2395
 4800  FD0A3F  85 53         		STA	pb+1
2396
 4801  FD0A41  A7 52         		lda	[pb]
2397
 4802  FD0A43  85 10         		STA	pfree
2398
 4803  FD0A45  68            		PLA
2399
 4804  FD0A46  A0 02         		ldy	#BPREV
2400
 4805  FD0A48  97 52         		STA	[pb],Y
2401
 4806  FD0A4A  C8            		INY
2402
 4807  FD0A4B  C8            		iny
2403
 4808  FD0A4C                		ACC08
2404
 4809  FD0A4C  E2 20         		sep	#PMFLAG
2405
 4810                        		.LONGA	off
2406
 4811                        		.MNLIST
2407
 4812  FD0A4E  B7 55         	?04:	lda	[pd],y
2408
 4813  FD0A50  97 52         		STA	[pb],Y
2409
 4814  FD0A52  C8            		INY
2410
 4815  FD0A53  D0 F9         		BNE	?04
2411
 4816  FD0A55                		ACC16
2412
 4817  FD0A55  C2 20         		rep	#PMFLAG
2413
 4818                        		.LONGA	on
2414
 4819                        		.MNLIST
2415
 4820  FD0A57  A7 55         		lda	[pd]
2416
 4821  FD0A59  D0 DA         		BNE	?03a
2417
 4822  FD0A5B  A5 53         		LDA	pb+1
2418
 4823  FD0A5D  85 58         		STA	bka
2419
  Tue Jul 17 11:00:22 2018                                                                                               Page   40
2420
 
2421
 
2422
 
2423
 
2424
 4824  FD0A5F  20 DF 0A      		JSR	newblk
2425
 4825  FD0A62  87 52         		STA	[pb]
2426
 4826  FD0A64  85 53         		STA	pb+1
2427
 4827  FD0A66  A7 52         		lda	[pb]
2428
 4828  FD0A68  85 10         		STA	pfree
2429
 4829  FD0A6A  A5 58         		LDA	bka
2430
 4830  FD0A6C  A0 02         		ldy	#BPREV
2431
 4831  FD0A6E  97 52         		STA	[pb],Y
2432
 4832  FD0A70  68            		PLA
2433
 4833  FD0A71  87 52         		STA	[pb]
2434
 4834  FD0A73  F0 06         		BEQ	?05
2435
 4835  FD0A75  85 56         		STA	pd+1
2436
 4836  FD0A77  A5 53         		LDA	pb+1
2437
 4837  FD0A79  97 55         		STA	[pd],Y
2438
 4838  FD0A7B                	?05:	ACC08
2439
 4839  FD0A7B  E2 20         		sep	#PMFLAG
2440
 4840                        		.LONGA	off
2441
 4841                        		.MNLIST
2442
 4842  FD0A7D  A4 17         		LDY	ixb
2443
 4843  FD0A7F  88            		DEY
2444
 4844  FD0A80  84 63         		STY	tmp7
2445
 4845  FD0A82  A2 04         		LDX	#BNDX
2446
 4846  FD0A84  E6 63         	?06:	INC	tmp7
2447
 4847  FD0A86  E8            		inx
2448
 4848  FD0A87  A4 63         		LDY	tmp7
2449
 4849  FD0A89  B7 14         		lda	[pblk],y
2450
 4850  FD0A8B  9B            		txy
2451
 4851  FD0A8C  97 52         		STA	[pb],Y
2452
 4852  FD0A8E  A0 04         		LDY	#BNDX
2453
 4853  FD0A90  B7 14         		lda	[pblk],y
2454
 4854  FD0A92  C5 63         		CMP	tmp7
2455
 4855  FD0A94  D0 EE         		BNE	?06
2456
 4856  FD0A96  8A            		txa
2457
 4857  FD0A97  97 52         		STA	[pb],Y
2458
 4858  FD0A99  A5 17         		LDA	ixb
2459
 4859  FD0A9B  C9 05         		CMP	#BSTART
2460
 4860  FD0A9D  D0 0A         		BNE	?07
2461
 4861  FD0A9F  A5 16         		LDA	ppage+1
2462
 4862  FD0AA1  EB            		xba
2463
 4863  FD0AA2  A5 15         		lda	ppage
2464
 4864  FD0AA4  20 74 10      		JSR	delblk
2465
 4865  FD0AA7  80 05         		bra	?08
2466
 4866  FD0AA9  3A            	?07:	dec	a
2467
 4867  FD0AAA  A0 04         		LDY	#BNDX
2468
 4868  FD0AAC  97 14         		STA	[pblk],Y
2469
 4869  FD0AAE                	?08:	ACC16
2470
 4870  FD0AAE  C2 20         		rep	#PMFLAG
2471
 4871                        		.LONGA	on
2472
 4872                        		.MNLIST
2473
 4873  FD0AB0  A5 53         		LDA	pb+1
2474
 4874  FD0AB2  85 15         		STA	ppage
2475
 4875  FD0AB4  A0 05         		LDY	#BSTART
2476
 4876  FD0AB6  84 17         		STY	ixb
2477
 4877  FD0AB8  A5 58         		LDA	bka
2478
 4878  FD0ABA  85 56         		STA	pd+1
2479
 4879  FD0ABC                		ACC08
2480
 4880  FD0ABC  E2 20         		sep	#PMFLAG
2481
  Tue Jul 17 11:00:22 2018                                                                                               Page   41
2482
 
2483
 
2484
 
2485
 
2486
 4881                        		.LONGA	off
2487
 4882                        		.MNLIST
2488
 4883  FD0ABE  88            		dey
2489
 4884  FD0ABF  B7 55         		lda	[pd],y
2490
 4885  FD0AC1  C9 05         		CMP	#BSTART
2491
 4886  FD0AC3  D0 0A         		BNE	?09
2492
 4887  FD0AC5  A5 57         		LDA	pd+2
2493
 4888  FD0AC7  EB            		xba
2494
 4889  FD0AC8  A5 56         		lda	pd+1
2495
 4890  FD0ACA  20 74 10      		JSR	delblk
2496
 4891  FD0ACD  80 03         		bra	?10
2497
 4892  FD0ACF  3A            	?09:	dec	a
2498
 4893  FD0AD0  97 55         		STA	[pd],Y
2499
 4894  FD0AD2  A5 20         	?10:	LDA	srow
2500
 4895  FD0AD4  C9 06         		CMP	#$06
2501
 4896  FD0AD6  B0 04         		BCS	?11
2502
 4897  FD0AD8  A9 06         		LDA	#$06
2503
 4898  FD0ADA  85 20         		STA	srow
2504
 4899  FD0ADC  4C 32 04      	?11:	JMP	updwin
2505
 4900
2506
 4901                        	;---------------------------------------------------
2507
 4902
2508
 4903                        	; get new block of memory
2509
 4904                        	; out:	C = page pointer to new block or NULL
2510
 4905                        	;	CF = 1 if no left memory
2511
 4906                        	; can be called in both 8/16 bit
2512
 4907                        	; P230E:
2513
 4908  FD0ADF                	newblk:
2514
 4909  FD0ADF  08            		php				; save 8/16 bit state
2515
 4910  FD0AE0                		CPU16
2516
 4911  FD0AE0  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2517
 4912                        		.LONGA	on
2518
 4913                        		.LONGI	on
2519
 4914                        		.MNLIST
2520
 4915  FD0AE2  A5 10         		LDA	pfree			; get next free block
2521
 4916  FD0AE4  D0 4E         		BNE	?10			; OK
2522
 4917  FD0AE6  20 C0 10      	?02:	JSR	garbc			; try to free memory
2523
 4918  FD0AE9  B0 FB         		BCS	?02
2524
 4919  FD0AEB  A5 10         		LDA	pfree
2525
 4920  FD0AED  D0 45         		BNE	?10			; OK
2526
 4921  FD0AEF  A9 10 00      		lda	#MINPAGE		; try to allocate pages
2527
 4922  FD0AF2  AA            		tax				; X = # pages
2528
 4923  FD0AF3  18            		clc
2529
 4924  FD0AF4                		SETBRK				; increase break level
2530
 4925  FD0AF4  02 7F         		cop	FN_SETBRK
2531
 4926                        		.MNLIST
2532
 4927  FD0AF6  90 08         		bcc	?04			; ok
2533
 4928  FD0AF8  AA            		tax				; max. # allocable pages
2534
 4929  FD0AF9  F0 2A         		beq	?08			; no room !
2535
 4930  FD0AFB  18            		clc				; allocate max. available
2536
 4931  FD0AFC                		SETBRK
2537
 4932  FD0AFC  02 7F         		cop	FN_SETBRK
2538
 4933                        		.MNLIST
2539
 4934  FD0AFE  B0 25         		bcs	?08			; now will no give error in fact!
2540
 4935  FD0B00  85 10         	?04:	sta	pfree			; new free list
2541
 4936  FD0B02  CA            		dex
2542
 4937  FD0B03  86 5F         		stx	lpte			; # pages - 1
2543
  Tue Jul 17 11:00:22 2018                                                                                               Page   42
2544
 
2545
 
2546
 
2547
 
2548
 4938  FD0B05  65 5F         		adc	lpte			; last page! (here CF = 0)
2549
 4939  FD0B07  85 5F         		sta	lpte			; save last page ptr
2550
 4940  FD0B09                		INDEX08
2551
 4941  FD0B09  E2 10         		sep	#PXFLAG
2552
 4942                        		.LONGI	off
2553
 4943                        		.MNLIST
2554
 4944  FD0B0B  A2 00         		ldx	#0
2555
 4945  FD0B0D  86 5C         		stx	lptc			; clear low pointer
2556
 4946  FD0B0F                		INDEX16				; X = 0
2557
 4947  FD0B0F  C2 10         		rep	#PXFLAG
2558
 4948                        		.LONGI	on
2559
 4949                        		.MNLIST
2560
 4950  FD0B11  A5 10         		lda	pfree
2561
 4951  FD0B13  85 5D         	?06:	sta	lptc+1			; init new free list
2562
 4952  FD0B15  1A            		inc	a			; next page
2563
 4953  FD0B16  87 5C         		sta	[lptc]			; next field in free list
2564
 4954  FD0B18  C5 5F         		cmp	lpte			; till last page
2565
 4955  FD0B1A  D0 F7         		bne	?06
2566
 4956  FD0B1C  85 5D         		sta	lptc+1
2567
 4957  FD0B1E  8A            		txa				; end of list
2568
 4958  FD0B1F  87 5C         		sta	[lptc]
2569
 4959  FD0B21  A5 10         		lda	pfree			; return block pointer
2570
 4960  FD0B23  80 0F         		bra	?10
2571
 4961  FD0B25                	?08:	CPU08
2572
 4962  FD0B25  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2573
 4963                        		.LONGA	off
2574
 4964                        		.LONGI	off
2575
 4965                        		.MNLIST
2576
 4966  FD0B27  A2 01         		LDX	#$01			; 'out of memory' error
2577
 4967  FD0B29  20 43 05      		JSR	error
2578
 4968  FD0B2C  A9 00         		lda	#0			; return NULL pointer
2579
 4969  FD0B2E  EB            		xba
2580
 4970  FD0B2F  A9 00         		lda	#0
2581
 4971  FD0B31  28            		plp
2582
 4972  FD0B32  38            		sec				; error flag
2583
 4973  FD0B33  60            		rts
2584
 4974  FD0B34  28            	?10:	plp				; return pointer
2585
 4975  FD0B35  18            		clc
2586
 4976  FD0B36                		LONG_OFF
2587
 4977                        		.LONGA	off
2588
 4978                        		.LONGI	off
2589
 4979                        		.MNLIST
2590
 4980  FD0B36  60            		RTS
2591
 4981
2592
 4982                        	; check if free list contain requested number of free blocks
2593
 4983                        	; and add blocks allocating more memory if need
2594
 4984                        	; in:	C = number of requested free block
2595
 4985                        	; out:	CF = 0 if free list is large enough or if more blocks
2596
 4986                        	;	was succesfully added
2597
 4987                        	;	CF = 1 if free list is not large enough and more blocks
2598
 4988                        	;	can't be added
2599
 4989                        	;	C = number of blocks that can be added if CF = 1
2600
 4990                        	; can be called in both 8/16 bit
2601
 4991  FD0B37                	chkfree:
2602
 4992  FD0B37  08            		php				; save 8/16 bit status
2603
 4993  FD0B38  64 5C         		stz	lptc			; clear low pointer
2604
 4994  FD0B3A                		CPU16
2605
  Tue Jul 17 11:00:22 2018                                                                                               Page   43
2606
 
2607
 
2608
 
2609
 
2610
 4995  FD0B3A  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2611
 4996                        		.LONGA	on
2612
 4997                        		.LONGI	on
2613
 4998                        		.MNLIST
2614
 4999  FD0B3C  85 60         		sta	lpte+1			; # blocks to add
2615
 5000  FD0B3E  A5 10         		lda	pfree
2616
 5001  FD0B40  F0 07         		beq	?02			; free list is empty
2617
 5002  FD0B42  20 F1 0E      		jsr	blkcnt			; how much free blocks?
2618
 5003  FD0B45  C5 60         		cmp	lpte+1
2619
 5004  FD0B47  B0 2C         		bcs	?08			; ok, requested blocks are free
2620
 5005  FD0B49  85 5D         	?02:	sta	lptc+1
2621
 5006  FD0B4B  38            		sec
2622
 5007  FD0B4C  A5 60         		lda	lpte+1			; how much blocks to add?
2623
 5008  FD0B4E  E5 5D         		sbc	lptc+1
2624
 5009  FD0B50  AA            		tax
2625
 5010  FD0B51  18            		clc				; set a new break level
2626
 5011  FD0B52                		SETBRK
2627
 5012  FD0B52  02 7F         		cop	FN_SETBRK
2628
 5013                        		.MNLIST
2629
 5014  FD0B54  90 03         		bcc	?04			; ok, no error
2630
 5015  FD0B56  28            		plp
2631
 5016  FD0B57  38            		sec				; return an error
2632
 5017  FD0B58  60            		rts
2633
 5018  FD0B59  A8            	?04:	tay				; new pointer
2634
 5019  FD0B5A  CA            		dex
2635
 5020  FD0B5B  86 60         		stx	lpte+1			; # pages - 1
2636
 5021  FD0B5D  65 60         		adc	lpte+1			; last page! (here CF = 0)
2637
 5022  FD0B5F  85 60         		sta	lpte+1			; save last page ptr
2638
 5023  FD0B61  98            		tya
2639
 5024  FD0B62  48            		pha				; save new free list pointer
2640
 5025  FD0B63  85 5D         	?06:	sta	lptc+1			; init new free list
2641
 5026  FD0B65  1A            		inc	a			; next page
2642
 5027  FD0B66  87 5C         		sta	[lptc]			; next field in free list
2643
 5028  FD0B68  C5 60         		cmp	lpte+1			; till last page
2644
 5029  FD0B6A  D0 F7         		bne	?06
2645
 5030  FD0B6C  85 5D         		sta	lptc+1
2646
 5031  FD0B6E  A5 10         		lda	pfree			; link old free list
2647
 5032  FD0B70  87 5C         		sta	[lptc]
2648
 5033  FD0B72  68            		pla
2649
 5034  FD0B73  85 10         		sta	pfree			; set new free list
2650
 5035  FD0B75  28            	?08:	plp
2651
 5036  FD0B76  18            		clc
2652
 5037  FD0B77                		LONG_OFF
2653
 5038                        		.LONGA	off
2654
 5039                        		.LONGI	off
2655
 5040                        		.MNLIST
2656
 5041  FD0B77  60            		rts
2657
 5042
2658
 5043                        	; free one buffer
2659
 5044                        	; in:	A = buffer number
2660
 5045                        	; out:	CF = 1 if fail to allocate a new block
2661
 5046                        	; P2D34:
2662
 5047  FD0B78                	freebuf:
2663
 5048  FD0B78  85 50         		sta	ebtmp			; save buffer number to free
2664
 5049  FD0B7A  0A            		asl	a
2665
 5050  FD0B7B  85 51         		sta	ebtmp2			; save index
2666
 5051  FD0B7D  AA            		TAX				; table index
2667
  Tue Jul 17 11:00:22 2018                                                                                               Page   44
2668
 
2669
 
2670
 
2671
 
2672
 5052  FD0B7E  64 5C         		stz	lptc			; prepare pointer
2673
 5053  FD0B80                		ACC16
2674
 5054  FD0B80  C2 20         		rep	#PMFLAG
2675
 5055                        		.LONGA	on
2676
 5056                        		.MNLIST
2677
 5057  FD0B82  B5 6C         		LDA	bstart,X
2678
 5058  FD0B84  F0 6D         		beq	?02			; nothing to do
2679
 5059  FD0B86  85 5D         		STA	lptc+1
2680
 5060  FD0B88  74 6C         		stz	bstart,x		; clear start block
2681
 5061  FD0B8A  74 82         		stz	bcur,x			; and all buffer data
2682
 5062  FD0B8C  74 98         		stz	bndx,x
2683
 5063  FD0B8E  74 AE         		stz	bline,x
2684
 5064  FD0B90  74 C4         		stz	btot,x
2685
 5065  FD0B92  A6 50         		ldx	ebtmp
2686
 5066  FD0B94  86 58         		stx	bka
2687
 5067  FD0B96  A2 00         		ldx	#0
2688
 5068  FD0B98  86 59         		stx	bka+1
2689
 5069  FD0B9A  A5 58         		lda	bka
2690
 5070  FD0B9C  0A            		asl	a
2691
 5071  FD0B9D  0A            		asl	a
2692
 5072  FD0B9E  65 58         		adc	bka
2693
 5073  FD0BA0  0A            		asl	a		; x 10
2694
 5074  FD0BA1  0A            		asl	a
2695
 5075  FD0BA2  0A            		asl	a
2696
 5076  FD0BA3  0A            		asl	a		; x 80
2697
 5077  FD0BA4  69 00 C8      		adc	#EDBUFNAM
2698
 5078  FD0BA7  85 52         		sta	pb
2699
 5079  FD0BA9                		ACC08
2700
 5080  FD0BA9  E2 20         		sep	#PMFLAG
2701
 5081                        		.LONGA	off
2702
 5082                        		.MNLIST
2703
 5083  FD0BAB  A9 01         		lda	#^EDBUFNAM
2704
 5084  FD0BAD  85 54         		sta	pb+2
2705
 5085  FD0BAF  A9 00         		lda	#0
2706
 5086  FD0BB1  87 52         		sta	[pb]
2707
 5087  FD0BB3  8F 00 CD 01   		sta	>EDCURFILE
2708
 5088  FD0BB7                		ACC16
2709
 5089  FD0BB7  C2 20         		rep	#PMFLAG
2710
 5090                        		.LONGA	on
2711
 5091                        		.MNLIST
2712
 5092  FD0BB9  A7 5C         	?01:	lda	[lptc]			; put all buffer blocks in free list
2713
 5093  FD0BBB  48            		PHA				; next
2714
 5094  FD0BBC  A5 10         		LDA	pfree
2715
 5095  FD0BBE  87 5C         		STA	[lptc]			; next free
2716
 5096  FD0BC0  A5 5D         		LDA	lptc+1
2717
 5097  FD0BC2  85 10         		STA	pfree			; update free list
2718
 5098  FD0BC4  68            		PLA
2719
 5099  FD0BC5  85 5D         		STA	lptc+1			; next block
2720
 5100  FD0BC7  D0 F0         		BNE	?01			; loop until next = NULL
2721
 5101  FD0BC9  A6 50         		ldx	ebtmp			; if this is not the current buffer...
2722
 5102  FD0BCB  E4 0F         		CPX	xbuf
2723
 5103  FD0BCD  D0 24         		BNE	?02			; ...done
2724
 5104                        						; ...otherwise alloc one block...
2725
 5105  FD0BCF  20 DF 0A      		JSR	newblk			; ...for a new empty buffer
2726
 5106  FD0BD2  B0 1F         		bcs	?02			; error: no left memory
2727
 5107  FD0BD4  85 4A         		sta	wtmp			; save new block
2728
 5108  FD0BD6  A6 51         		ldx	ebtmp2
2729
  Tue Jul 17 11:00:22 2018                                                                                               Page   45
2730
 
2731
 
2732
 
2733
 
2734
 5109  FD0BD8  20 AA 0C      		JSR	bufinit			; init new buffer
2735
 5110  FD0BDB  B5 6C         		LDA	bstart,X		; set up new buffer
2736
 5111  FD0BDD  85 12         		STA	pbuf
2737
 5112  FD0BDF  B5 82         		LDA	bcur,X
2738
 5113  FD0BE1  85 15         		STA	ppage
2739
 5114  FD0BE3  B5 98         		LDA	bndx,X
2740
 5115  FD0BE5  85 17         		STA	ixb
2741
 5116  FD0BE7  B5 AE         		LDA	bline,X
2742
 5117  FD0BE9  85 1C         		STA	cline
2743
 5118  FD0BEB  B5 C4         		LDA	btot,X
2744
 5119  FD0BED  85 1A         		STA	ncount
2745
 5120  FD0BEF  A0 00         		ldy	#$00
2746
 5121  FD0BF1  84 20         		sty	srow
2747
 5122  FD0BF3                	?02:	ACC08
2748
 5123  FD0BF3  E2 20         		sep	#PMFLAG
2749
 5124                        		.LONGA	off
2750
 5125                        		.MNLIST
2751
 5126  FD0BF5  60            	?03:	RTS
2752
 5127
2753
 5128                        	; switch to another buffer
2754
 5129                        	; in:	A = buffer number
2755
 5130                        	; out:	CF = 1 if fail to allocate a new block
2756
 5131                        	; P2D86:
2757
 5132  FD0BF6                	switchb:
2758
 5133  FD0BF6  48            		pha				; save new buffer number
2759
 5134  FD0BF7  0A            		asl	a
2760
 5135  FD0BF8  AA            		tax				; X = buffer table index
2761
 5136  FD0BF9                		ACC16
2762
 5137  FD0BF9  C2 20         		rep	#PMFLAG
2763
 5138                        		.LONGA	on
2764
 5139                        		.MNLIST
2765
 5140  FD0BFB  B5 6C         		lda	bstart,x
2766
 5141  FD0BFD  D0 0B         		bne	?02			; ok, buffer already initialized
2767
 5142  FD0BFF  20 DF 0A      		jsr	newblk			; get a new block
2768
 5143  FD0C02  90 04         		bcc	?01			; OK
2769
 5144  FD0C04                		ACC08
2770
 5145  FD0C04  E2 20         		sep	#PMFLAG
2771
 5146                        		.LONGA	off
2772
 5147                        		.MNLIST
2773
 5148  FD0C06  68            		pla				; error -- no memory left
2774
 5149  FD0C07  60            		rts				; exit with CF = 1
2775
 5150  FD0C08  85 4A         	?01:	sta	wtmp			; save new page pointer
2776
 5151  FD0C0A                	?02:	ACC08
2777
 5152  FD0C0A  E2 20         		sep	#PMFLAG
2778
 5153                        		.LONGA	off
2779
 5154                        		.MNLIST
2780
 5155  FD0C0C  A6 0F         		ldx	xbuf			; current buffer index
2781
 5156  FD0C0E  30 47         		bmi	?03			; no current editor buffer
2782
 5157  FD0C10  8A            		txa
2783
 5158  FD0C11  0A            		asl	a
2784
 5159  FD0C12  AA            		tax
2785
 5160  FD0C13                		ACC16CLC
2786
 5161  FD0C13  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
2787
 5162                        		.LONGA	on
2788
 5163                        		.MNLIST
2789
 5164  FD0C15  A5 12         		lda	pbuf			; save in table current buffer data
2790
 5165  FD0C17  95 6C         		sta	bstart,x
2791
  Tue Jul 17 11:00:22 2018                                                                                               Page   46
2792
 
2793
 
2794
 
2795
 
2796
 5166  FD0C19  A5 15         		lda	ppage
2797
 5167  FD0C1B  95 82         		sta	bcur,x
2798
 5168  FD0C1D  A5 17         		lda	ixb			; index + flag
2799
 5169  FD0C1F  95 98         		sta	bndx,x
2800
 5170  FD0C21  A5 1C         		lda	cline
2801
 5171  FD0C23  95 AE         		sta	bline,x
2802
 5172  FD0C25  A5 1A         		lda	ncount
2803
 5173  FD0C27  95 C4         		sta	btot,x
2804
 5174  FD0C29  A6 0F         		ldx	xbuf
2805
 5175  FD0C2B  86 58         		stx	bka
2806
 5176  FD0C2D  A2 00         		ldx	#0
2807
 5177  FD0C2F  86 59         		stx	bka+1
2808
 5178  FD0C31  A5 58         		lda	bka
2809
 5179  FD0C33  0A            		asl	a
2810
 5180  FD0C34  0A            		asl	a
2811
 5181  FD0C35  65 58         		adc	bka
2812
 5182  FD0C37  0A            		asl	a		; x 10
2813
 5183  FD0C38  0A            		asl	a
2814
 5184  FD0C39  0A            		asl	a
2815
 5185  FD0C3A  0A            		asl	a		; x 80
2816
 5186  FD0C3B  69 00 C8      		adc	#EDBUFNAM
2817
 5187  FD0C3E  85 52         		sta	pb
2818
 5188  FD0C40                		ACC08
2819
 5189  FD0C40  E2 20         		sep	#PMFLAG
2820
 5190                        		.LONGA	off
2821
 5191                        		.MNLIST
2822
 5192  FD0C42  A9 01         		lda	#^EDBUFNAM
2823
 5193  FD0C44  85 54         		sta	pb+2
2824
 5194  FD0C46  A2 00         		ldx	#0
2825
 5195  FD0C48  9B            		txy
2826
 5196  FD0C49  BF 00 CD 01   	?lp1:	lda	>EDCURFILE,x
2827
 5197  FD0C4D  97 52         		sta	[pb],y
2828
 5198  FD0C4F  F0 06         		beq	?03
2829
 5199  FD0C51  E8            		inx
2830
 5200  FD0C52  C8            		iny
2831
 5201  FD0C53  C0 50         		cpy	#MAXFNAME
2832
 5202  FD0C55  90 F2         		bcc	?lp1
2833
 5203  FD0C57  68            	?03:	pla
2834
 5204  FD0C58  85 0F         		sta	xbuf			; set new current buffer
2835
 5205  FD0C5A  0A            		asl	a
2836
 5206  FD0C5B  AA            		tax				; table index access
2837
 5207  FD0C5C                		ACC16CLC
2838
 5208  FD0C5C  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
2839
 5209                        		.LONGA	on
2840
 5210                        		.MNLIST
2841
 5211  FD0C5E  B5 6C         		lda	bstart,x
2842
 5212  FD0C60  D0 06         		bne	?04
2843
 5213  FD0C62  20 AA 0C      		jsr	bufinit
2844
 5214  FD0C65  18            		clc
2845
 5215  FD0C66  B5 6C         		lda	bstart,x
2846
 5216  FD0C68  85 12         	?04:	sta	pbuf			; start buffer
2847
 5217  FD0C6A  B5 82         		lda	bcur,x
2848
 5218  FD0C6C  85 15         		sta	ppage			; current block
2849
 5219  FD0C6E  B5 98         		lda	bndx,x
2850
 5220  FD0C70  85 17         		sta	ixb			; block pointer + flag
2851
 5221  FD0C72  B5 AE         		lda	bline,x
2852
 5222  FD0C74  85 1C         		sta	cline			; current line
2853
  Tue Jul 17 11:00:22 2018                                                                                               Page   47
2854
 
2855
 
2856
 
2857
 
2858
 5223  FD0C76  B5 C4         		lda	btot,x
2859
 5224  FD0C78  85 1A         		sta	ncount			; total lines
2860
 5225  FD0C7A  A6 0F         		ldx	xbuf
2861
 5226  FD0C7C  86 58         		stx	bka
2862
 5227  FD0C7E  A2 00         		ldx	#0
2863
 5228  FD0C80  86 59         		stx	bka+1
2864
 5229  FD0C82  A5 58         		lda	bka
2865
 5230  FD0C84  0A            		asl	a
2866
 5231  FD0C85  0A            		asl	a
2867
 5232  FD0C86  65 58         		adc	bka
2868
 5233  FD0C88  0A            		asl	a		; x 10
2869
 5234  FD0C89  0A            		asl	a
2870
 5235  FD0C8A  0A            		asl	a
2871
 5236  FD0C8B  0A            		asl	a		; x 80
2872
 5237  FD0C8C  69 00 C8      		adc	#EDBUFNAM
2873
 5238  FD0C8F  85 52         		sta	pb
2874
 5239  FD0C91                		ACC08
2875
 5240  FD0C91  E2 20         		sep	#PMFLAG
2876
 5241                        		.LONGA	off
2877
 5242                        		.MNLIST
2878
 5243  FD0C93  A9 01         		lda	#^EDBUFNAM
2879
 5244  FD0C95  85 54         		sta	pb+2
2880
 5245  FD0C97  A2 00         		ldx	#0
2881
 5246  FD0C99  9B            		txy
2882
 5247  FD0C9A  B7 52         	?lp2:	lda	[pb],y
2883
 5248  FD0C9C  9F 00 CD 01   		sta	>EDCURFILE,x
2884
 5249  FD0CA0  F0 06         		beq	?end
2885
 5250  FD0CA2  E8            		inx
2886
 5251  FD0CA3  C8            		iny
2887
 5252  FD0CA4  C0 50         		cpy	#MAXFNAME
2888
 5253  FD0CA6  90 F2         		bcc	?lp2
2889
 5254  FD0CA8  18            	?end:	clc			; no error
2890
 5255  FD0CA9  60            		rts
2891
 5256
2892
 5257                        	; init a new editor buffer -- init buffer table
2893
 5258                        	; in:	X = buffer table index
2894
 5259                        	;	wtmp = new page pointer
2895
 5260                        	; can be called in both 8/16 bit
2896
 5261                        	; P2D05:
2897
 5262  FD0CAA                	bufinit:
2898
 5263  FD0CAA  08            		php
2899
 5264  FD0CAB                		CPU08
2900
 5265  FD0CAB  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
2901
 5266                        		.LONGA	off
2902
 5267                        		.LONGI	off
2903
 5268                        		.MNLIST
2904
 5269  FD0CAD  A0 00         		ldy	#0
2905
 5270  FD0CAF  84 5C         		sty	lptc
2906
 5271  FD0CB1                		CPU16
2907
 5272  FD0CB1  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
2908
 5273                        		.LONGA	on
2909
 5274                        		.LONGI	on
2910
 5275                        		.MNLIST
2911
 5276  FD0CB3  A5 4A         		lda	wtmp			; new page pointer
2912
 5277  FD0CB5  95 6C         		sta	bstart,x		; start buffer block
2913
 5278  FD0CB7  95 82         		sta	bcur,x			; current buffer block
2914
 5279  FD0CB9  85 5D         		sta	lptc+1			; temp pointer
2915
  Tue Jul 17 11:00:22 2018                                                                                               Page   48
2916
 
2917
 
2918
 
2919
 
2920
 5280  FD0CBB  94 AE         		sty	bline,x			; clear current line
2921
 5281  FD0CBD  94 C4         		sty	btot,x			; clear tot. # lines
2922
 5282  FD0CBF  A7 5C         		lda	[lptc]			; next block will be in free list
2923
 5283  FD0CC1  85 10         		sta	pfree
2924
 5284  FD0CC3  98            		tya
2925
 5285  FD0CC4  87 5C         		sta	[lptc]			; next = NULL
2926
 5286  FD0CC6  C8            		iny
2927
 5287  FD0CC7  C8            		iny				; Y = 2
2928
 5288  FD0CC8  97 5C         		sta	[lptc],y		; prev = NULL
2929
 5289  FD0CCA  C8            		iny
2930
 5290  FD0CCB  C8            		iny				; Y = 4;
2931
 5291  FD0CCC  A9 05 00      		lda	#BSTART			; set pointer in block
2932
 5292  FD0CCF  97 5C         		sta	[lptc],y		; and mark end of buffer
2933
 5293  FD0CD1  95 98         		sta	bndx,x			; flag buffer = 0
2934
 5294  FD0CD3  28            		plp
2935
 5295  FD0CD4                		LONG_OFF
2936
 5296                        		.LONGA	off
2937
 5297                        		.LONGI	off
2938
 5298                        		.MNLIST
2939
 5299  FD0CD4  60            		rts
2940
 5300
2941
 5301
2942
 5302                        	; insert <enter> code - check if lines overflow
2943
 5303  FD0CD5                	inscr:
2944
 5304  FD0CD5                		ACC16
2945
 5305  FD0CD5  C2 20         		rep	#PMFLAG
2946
 5306                        		.LONGA	on
2947
 5307                        		.MNLIST
2948
 5308  FD0CD7  A5 1A         		lda	ncount
2949
 5309  FD0CD9  1A            		inc	a
2950
 5310  FD0CDA  C9 FE FF      		cmp	#MAXLINES+1
2951
 5311  FD0CDD                		ACC08
2952
 5312  FD0CDD  E2 20         		sep	#PMFLAG
2953
 5313                        		.LONGA	off
2954
 5314                        		.MNLIST
2955
 5315  FD0CDF  B0 04         		bcs	?02
2956
 5316  FD0CE1  A9 0D         		LDA	#$0D
2957
 5317  FD0CE3  80 07         		bra	insert			; insert byte $0D (enter key code)
2958
 5318  FD0CE5  A2 07         	?02:	ldx	#7			; Can't insert a new line: lines count overflow
2959
 5319  FD0CE7  20 43 05      		jsr	error
2960
 5320  FD0CEA  38            		sec
2961
 5321  FD0CEB  60            		rts
2962
 5322
2963
 5323                        	; insert byte into buffer at position specified by ixb
2964
 5324                        	; in:	A = byte to insert
2965
 5325                        	; A,X,Y preserved
2966
 5326                        	; P227B:
2967
 5327  FD0CEC                	insert:
2968
 5328  FD0CEC  85 4C         		sta	ewtmp			; byte to insert
2969
 5329  FD0CEE  DA            		phx
2970
 5330  FD0CEF  5A            		phy
2971
 5331  FD0CF0  24 18         		bit	bflag			; chek if overwrite mode
2972
 5332  FD0CF2  50 14         		bvc	?00			; default insert mode
2973
 5333  FD0CF4  C9 0D         		cmp	#$0D			; insert anyway code $0D
2974
 5334  FD0CF6  F0 10         		beq	?00
2975
 5335  FD0CF8  AA            		tax
2976
 5336  FD0CF9  A4 17         		ldy	ixb
2977
  Tue Jul 17 11:00:22 2018                                                                                               Page   49
2978
 
2979
 
2980
 
2981
 
2982
 5337  FD0CFB  B7 14         		lda	[pblk],y		; A = byte at position where overwrite
2983
 5338  FD0CFD  F0 09         		beq	?00			; no overwrite null terminator
2984
 5339  FD0CFF  C9 0D         		cmp	#$0D
2985
 5340  FD0D01  F0 05         		beq	?00			; no overwrite line terminator
2986
 5341  FD0D03  8A            		txa
2987
 5342  FD0D04  97 14         		sta	[pblk],y		; overwrite
2988
 5343  FD0D06  80 58         		bra	?08			; exit
2989
 5344  FD0D08  A0 04         	?00:	LDY	#BNDX
2990
 5345  FD0D0A  B7 14         		lda	[pblk],y
2991
 5346  FD0D0C  85 4D         		sta	ewtmp+1			; save current pointer
2992
 5347  FD0D0E  C9 FF         		CMP	#$FF
2993
 5348  FD0D10  D0 0E         		BNE	?02			; ok, room for move one byte ahead
2994
 5349  FD0D12  20 DF 0A      		JSR	newblk			; alloc new block...
2995
 5350  FD0D15  90 05         		BCC	?01			; ...for move bytes one room ahead
2996
 5351  FD0D17  7A            		PLY
2997
 5352  FD0D18  FA            		plx
2998
 5353  FD0D19  A5 4C         		lda	ewtmp
2999
 5354  FD0D1B  60            		RTS
3000
 5355  FD0D1C                	?01:	ACC16
3001
 5356  FD0D1C  C2 20         		rep	#PMFLAG
3002
 5357                        		.LONGA	on
3003
 5358                        		.MNLIST
3004
 5359  FD0D1E  85 4A         		STA	wtmp			; save new block
3005
 5360  FD0D20                	?02:	ACC16
3006
 5361  FD0D20  C2 20         		rep	#PMFLAG
3007
 5362                        		.LONGA	on
3008
 5363                        		.MNLIST
3009
 5364  FD0D22  A5 06         		LDA	pp6
3010
 5365  FD0D24  C5 15         		CMP	ppage
3011
 5366  FD0D26                		ACC08
3012
 5367  FD0D26  E2 20         		sep	#PMFLAG
3013
 5368                        		.LONGA	off
3014
 5369                        		.MNLIST
3015
 5370  FD0D28  D0 02         		BNE	?03
3016
 5371  FD0D2A  E6 0D         		INC	ix6
3017
 5372  FD0D2C  A4 4D         	?03	ldy	ewtmp+1
3018
 5373  FD0D2E  C8            		INY
3019
 5374  FD0D2F  88            	?04:	DEY				; loop for move ahead
3020
 5375  FD0D30  B7 14         		lda	[pblk],y		; A = byte to move ahead
3021
 5376  FD0D32  C8            		INY
3022
 5377  FD0D33  D0 17         		BNE	?06
3023
 5378  FD0D35  20 40 10      		JSR	addblk			; insert new block and move byte
3024
 5379  FD0D38  A4 0D         		LDY	ix6
3025
 5380  FD0D3A  D0 0C         		BNE	?05
3026
 5381  FD0D3C  A5 50         		LDA	lptmp2+1		; save new block in pp6
3027
 5382  FD0D3E  85 06         		STA	pp6
3028
 5383  FD0D40  A5 51         		LDA	lptmp2+2
3029
 5384  FD0D42  85 07         		STA	pp6+1
3030
 5385  FD0D44  A9 05         		LDA	#BSTART
3031
 5386  FD0D46  85 0D         		STA	ix6
3032
 5387  FD0D48  A0 00         	?05:	LDY	#$00
3033
 5388  FD0D4A  80 02         		bra	?07
3034
 5389  FD0D4C  97 14         	?06:	sta	[pblk],y
3035
 5390  FD0D4E  88            	?07:	DEY
3036
 5391  FD0D4F  C4 17         		CPY	ixb			; move bytes until is free...
3037
 5392  FD0D51  D0 DC         		BNE	?04			; ...the position specified by ixb
3038
 5393  FD0D53  A5 4C         		LDA	ewtmp
3039
  Tue Jul 17 11:00:22 2018                                                                                               Page   50
3040
 
3041
 
3042
 
3043
 
3044
 5394  FD0D55  97 14         		STA	[pblk],Y		; store byte
3045
 5395  FD0D57  A5 4D         		lda	ewtmp+1			; update pointer
3046
 5396  FD0D59  1A            		inc	a
3047
 5397  FD0D5A  F0 04         		BEQ	?08
3048
 5398  FD0D5C  A0 04         		LDY	#BNDX
3049
 5399  FD0D5E  97 14         		STA	[pblk],Y
3050
 5400  FD0D60  7A            	?08:	ply
3051
 5401  FD0D61  FA            		plx
3052
 5402  FD0D62  A9 80         		lda	#$80
3053
 5403  FD0D64  04 18         		tsb	bflag			; set modified flag
3054
 5404  FD0D66  A5 4C         		lda	ewtmp
3055
 5405  FD0D68  18            		CLC				; no error
3056
 5406  FD0D69  60            		RTS
3057
 5407
3058
 5408                        	; align buffer with minimum screen row and save block on pp4
3059
 5409                        	; P1E14:
3060
 5410  FD0D6A                	findrow:
3061
 5411  FD0D6A  A0 00         		LDY	#$00			; start at row = 0
3062
 5412  FD0D6C  C4 20         	?01:	CPY	srow			; current screen row
3063
 5413  FD0D6E  F0 08         		BEQ	?02			; already at first row
3064
 5414  FD0D70  20 8C 0F      		JSR	startln			; find start of line
3065
 5415  FD0D73  B0 03         		BCS	?02			; beginning of buffer
3066
 5416  FD0D75  C8            		INY
3067
 5417  FD0D76  80 F4         		bra	?01			; loop
3068
 5418  FD0D78  84 20         	?02:	STY	srow			; store row
3069
 5419  FD0D7A  A5 15         		LDA	ppage			; save block pointer
3070
 5420  FD0D7C  85 04         		STA	pp4
3071
 5421  FD0D7E  A5 16         		LDA	ppage+1
3072
 5422  FD0D80  85 05         		STA	pp4+1
3073
 5423  FD0D82  A5 17         		LDA	ixb
3074
 5424  FD0D84  85 0C         		STA	ix4
3075
 5425  FD0D86  60            		RTS
3076
 5426
3077
 5427                        	; get number of bytes from current column to end of line
3078
 5428                        	; in:	X = text column
3079
 5429                        	; out:	ccnt updated
3080
 5430                        	; P1474:
3081
 5431  FD0D87                	xcnt2:
3082
 5432  FD0D87  A0 00         		LDY	#$00
3083
 5433  FD0D89  84 21         		STY	scol
3084
 5434  FD0D8B  84 1E         		STY	ccol
3085
 5435  FD0D8D  20 AD 0E      		JSR	pp8mv
3086
 5436  FD0D90  E8            		INX
3087
 5437  FD0D91  C4 1F         	?01:	CPY	ecol
3088
 5438  FD0D93  F0 14         		BEQ	?02
3089
 5439  FD0D95  CA            		DEX
3090
 5440  FD0D96  F0 3C         		BEQ	?06
3091
 5441  FD0D98  20 A9 0F      		JSR	getbyte
3092
 5442  FD0D9B  B0 37         		BCS	?06
3093
 5443  FD0D9D  C9 0D         		CMP	#$0D
3094
 5444  FD0D9F  F0 33         		BEQ	?06
3095
 5445  FD0DA1  C8            		INY
3096
 5446  FD0DA2  20 BE 0F      		JSR	incptr
3097
 5447  FD0DA5  E6 1E         		INC	ccol
3098
 5448  FD0DA7  80 E8         		bra	?01
3099
 5449  FD0DA9  CA            	?02:	DEX
3100
 5450  FD0DAA  F0 13         		BEQ	?03
3101
  Tue Jul 17 11:00:22 2018                                                                                               Page   51
3102
 
3103
 
3104
 
3105
 
3106
 5451  FD0DAC  20 A9 0F      		JSR	getbyte
3107
 5452  FD0DAF  B0 23         		BCS	?06
3108
 5453  FD0DB1  C9 0D         		CMP	#$0D
3109
 5454  FD0DB3  F0 1F         		BEQ	?06
3110
 5455  FD0DB5  C8            		INY
3111
 5456  FD0DB6  20 BE 0F      		JSR	incptr
3112
 5457  FD0DB9  E6 21         		INC	scol
3113
 5458  FD0DBB  E6 1E         		INC	ccol
3114
 5459  FD0DBD  80 EA         		bra	?02
3115
 5460  FD0DBF  20 93 0E      	?03:	JSR	mvpp2
3116
 5461  FD0DC2  20 A9 0F      	?04:	JSR	getbyte
3117
 5462  FD0DC5  B0 0A         		BCS	?05
3118
 5463  FD0DC7  C9 0D         		CMP	#$0D
3119
 5464  FD0DC9  F0 06         		BEQ	?05
3120
 5465  FD0DCB  C8            		INY
3121
 5466  FD0DCC  20 BE 0F      		JSR	incptr
3122
 5467  FD0DCF  80 F1         		bra	?04
3123
 5468  FD0DD1  20 4A 0E      	?05:	JSR	pp2mv
3124
 5469  FD0DD4  84 22         	?06:	STY	ccnt
3125
 5470  FD0DD6  60            		RTS
3126
 5471
3127
 5472                        	; find beginning of line on block pointed by pp6
3128
 5473                        	; P2477:
3129
 5474  FD0DD7                	startln6:
3130
 5475  FD0DD7  A5 26         		LDA	rcnt
3131
 5476  FD0DD9  C9 17         		CMP	#$17
3132
 5477  FD0DDB  F0 03         		beq	?01
3133
 5478  FD0DDD  E6 26         		INC	rcnt
3134
 5479  FD0DDF  60            		RTS
3135
 5480  FD0DE0  20 93 0E      	?01:	JSR	mvpp2
3136
 5481  FD0DE3  A5 06         		LDA	pp6
3137
 5482  FD0DE5  85 15         		STA	ppage
3138
 5483  FD0DE7  A5 07         		LDA	pp6+1
3139
 5484  FD0DE9  85 16         		STA	ppage+1
3140
 5485  FD0DEB  A5 0D         		LDA	ix6
3141
 5486  FD0DED  85 17         		STA	ixb
3142
 5487  FD0DEF  20 8C 0F      		JSR	startln
3143
 5488  FD0DF2  A5 15         		LDA	ppage
3144
 5489  FD0DF4  85 06         		STA	pp6
3145
 5490  FD0DF6  A5 16         		LDA	ppage+1
3146
 5491  FD0DF8  85 07         		STA	pp6+1
3147
 5492  FD0DFA  A5 17         		LDA	ixb
3148
 5493  FD0DFC  85 0D         		STA	ix6
3149
 5494  FD0DFE  80 4A         		bra	pp2mv
3150
 5495
3151
 5496                        	; find next line on block pointed by pp4
3152
 5497                        	; P249F:
3153
 5498  FD0E00                	nextln4:
3154
 5499  FD0E00  20 93 0E      		JSR	mvpp2
3155
 5500  FD0E03  A5 04         		LDA	pp4
3156
 5501  FD0E05  85 15         		STA	ppage
3157
 5502  FD0E07  A5 05         		LDA	pp4+1
3158
 5503  FD0E09  85 16         		STA	ppage+1
3159
 5504  FD0E0B  A5 0C         		LDA	ix4
3160
 5505  FD0E0D  85 17         		STA	ixb
3161
 5506  FD0E0F  20 70 0F      		JSR	nextln
3162
 5507  FD0E12  A5 15         		LDA	ppage
3163
  Tue Jul 17 11:00:22 2018                                                                                               Page   52
3164
 
3165
 
3166
 
3167
 
3168
 5508  FD0E14  85 04         		STA	pp4
3169
 5509  FD0E16  A5 16         		LDA	ppage+1
3170
 5510  FD0E18  85 05         		STA	pp4+1
3171
 5511  FD0E1A  A5 17         		LDA	ixb
3172
 5512  FD0E1C  85 0C         		STA	ix4
3173
 5513  FD0E1E  80 2A         		bra	pp2mv
3174
 5514
3175
 5515                        	; find beginning of line on block pointed by pp4
3176
 5516                        	; P24BC:
3177
 5517  FD0E20                	startln4:
3178
 5518  FD0E20  20 93 0E      		JSR	mvpp2
3179
 5519  FD0E23  A5 04         		LDA	pp4
3180
 5520  FD0E25  85 15         		STA	ppage
3181
 5521  FD0E27  A5 05         		LDA	pp4+1
3182
 5522  FD0E29  85 16         		STA	ppage+1
3183
 5523  FD0E2B  A5 0C         		LDA	ix4
3184
 5524  FD0E2D  85 17         		STA	ixb
3185
 5525  FD0E2F  20 8C 0F      		JSR	startln
3186
 5526  FD0E32  A5 15         		LDA	ppage
3187
 5527  FD0E34  85 04         		STA	pp4
3188
 5528  FD0E36  A5 16         		LDA	ppage+1
3189
 5529  FD0E38  85 05         		STA	pp4+1
3190
 5530  FD0E3A  A5 17         		LDA	ixb
3191
 5531  FD0E3C  85 0C         		STA	ix4
3192
 5532  FD0E3E  80 0A         		bra	pp2mv
3193
 5533
3194
 5534                        	; calc the bytes count in current line
3195
 5535                        	; P141A:
3196
 5536  FD0E40                	xcount:
3197
 5537  FD0E40  20 93 0E      		jsr	mvpp2
3198
 5538  FD0E43  20 DF 0F      		jsr	incptr2
3199
 5539  FD0E46  20 8C 0F      		jsr	startln
3200
 5540  FD0E49  CA            		dex
3201
 5541
3202
 5542                        	; move pp2 to page pointer
3203
 5543                        	; P236D:
3204
 5544  FD0E4A                	pp2mv:
3205
 5545  FD0E4A  A5 02         		lda	pp2
3206
 5546  FD0E4C  85 15         		sta	ppage
3207
 5547  FD0E4E  A5 03         		lda	pp2+1
3208
 5548  FD0E50  85 16         		sta	ppage+1
3209
 5549  FD0E52  A5 0B         		lda	ix2
3210
 5550  FD0E54  85 17         		sta	ixb
3211
 5551  FD0E56  60            		rts
3212
 5552
3213
 5553                        	; find next line on block pointed by pp6
3214
 5554                        	; P2455:
3215
 5555  FD0E57                	nextln6:
3216
 5556  FD0E57  20 93 0E      		JSR	mvpp2
3217
 5557  FD0E5A  A5 06         		LDA	pp6
3218
 5558  FD0E5C  85 15         		STA	ppage
3219
 5559  FD0E5E  A5 07         		LDA	pp6+1
3220
 5560  FD0E60  85 16         		STA	ppage+1
3221
 5561  FD0E62  A5 0D         		LDA	ix6
3222
 5562  FD0E64  85 17         		STA	ixb
3223
 5563  FD0E66  20 70 0F      		JSR	nextln
3224
 5564  FD0E69  90 02         		BCC	?01
3225
  Tue Jul 17 11:00:22 2018                                                                                               Page   53
3226
 
3227
 
3228
 
3229
 
3230
 5565  FD0E6B  C6 26         		DEC	rcnt
3231
 5566  FD0E6D  A5 15         	?01:	LDA	ppage
3232
 5567  FD0E6F  85 06         		STA	pp6
3233
 5568  FD0E71  A5 16         		LDA	ppage+1
3234
 5569  FD0E73  85 07         		STA	pp6+1
3235
 5570  FD0E75  A5 17         		LDA	ixb
3236
 5571  FD0E77  85 0D         		STA	ix6
3237
 5572  FD0E79  80 CF         		bra	pp2mv
3238
 5573
3239
 5574                        	; find next line and save in pp8
3240
 5575                        	; X,Y preserved
3241
 5576                        	; P1447:
3242
 5577  FD0E7B                	nextln8:
3243
 5578  FD0E7B  20 93 0E      		JSR	mvpp2
3244
 5579  FD0E7E  5A            		phy
3245
 5580  FD0E7F  20 1E 10      	?01:	JSR	decptr2
3246
 5581  FD0E82  B0 09         		BCS	?02
3247
 5582  FD0E84  B7 14         		lda	[pblk],y
3248
 5583  FD0E86  C9 0D         		CMP	#$0D
3249
 5584  FD0E88  D0 F5         		BNE	?01
3250
 5585  FD0E8A  20 DF 0F      		JSR	incptr2
3251
 5586  FD0E8D  7A            	?02:	ply
3252
 5587  FD0E8E  20 A0 0E      		JSR	mvpp8
3253
 5588  FD0E91  80 B7         		bra	pp2mv
3254
 5589
3255
 5590                        	; move page pointer to pp2
3256
 5591                        	; P2362:
3257
 5592  FD0E93                	mvpp2:
3258
 5593  FD0E93  A5 15         		lda	ppage
3259
 5594  FD0E95  85 02         		sta	pp2
3260
 5595  FD0E97  A5 16         		lda	ppage+1
3261
 5596  FD0E99  85 03         		sta	pp2+1
3262
 5597  FD0E9B  A5 17         		lda	ixb
3263
 5598  FD0E9D  85 0B         		sta	ix2
3264
 5599  FD0E9F  60            		rts
3265
 5600
3266
 5601                        	; move page pointer to pp8
3267
 5602                        	; P2378:
3268
 5603  FD0EA0                	mvpp8:
3269
 5604  FD0EA0  A5 15         		lda	ppage
3270
 5605  FD0EA2  85 08         		sta	pp8
3271
 5606  FD0EA4  A5 16         		lda	ppage+1
3272
 5607  FD0EA6  85 09         		sta	pp8+1
3273
 5608  FD0EA8  A5 17         		lda	ixb
3274
 5609  FD0EAA  85 0E         		sta	ix8
3275
 5610  FD0EAC  60            		rts
3276
 5611
3277
 5612                        	; move pp8 to page pointer
3278
 5613                        	; P2383:
3279
 5614  FD0EAD                	pp8mv:
3280
 5615  FD0EAD  A5 08         		lda	pp8
3281
 5616  FD0EAF  85 15         		sta	ppage
3282
 5617  FD0EB1  A5 09         		lda	pp8+1
3283
 5618  FD0EB3  85 16         		sta	ppage+1
3284
 5619  FD0EB5  A5 0E         		lda	ix8
3285
 5620  FD0EB7  85 17         		sta	ixb
3286
 5621  FD0EB9  60            		rts
3287
  Tue Jul 17 11:00:22 2018                                                                                               Page   54
3288
 
3289
 
3290
 
3291
 
3292
 5622
3293
 5623                        	; count blank from start of line till first non blank
3294
 5624                        	; out: ctmp = starting blanks counter
3295
 5625  FD0EBA                	xblank:
3296
 5626  FD0EBA  64 2F         		stz	ctmp
3297
 5627  FD0EBC  A9 20         		lda	#$20			; test indent flag
3298
 5628  FD0EBE  24 18         		bit	bflag
3299
 5629  FD0EC0  F0 2E         		beq	?06
3300
 5630  FD0EC2  A5 15         		lda	ppage			; save current buffer pointer
3301
 5631  FD0EC4  85 5C         		sta	lptc
3302
 5632  FD0EC6  A5 16         		lda	ppage+1
3303
 5633  FD0EC8  85 5D         		sta	lptc+1
3304
 5634  FD0ECA  A5 17         		lda	ixb
3305
 5635  FD0ECC  85 5E         		sta	lptc+2
3306
 5636  FD0ECE  20 8C 0F      		jsr	startln			; find start of line
3307
 5637  FD0ED1  A2 FF         		ldx	#$FF			; beginning blank counter
3308
 5638  FD0ED3  E8            	?02:	inx
3309
 5639  FD0ED4  20 B4 0F      		jsr	getbyte2
3310
 5640  FD0ED7  B0 09         		bcs	?04			; end buffer
3311
 5641  FD0ED9  C9 20         		cmp	#' '
3312
 5642  FD0EDB  D0 05         		bne	?04
3313
 5643  FD0EDD  20 DF 0F      		jsr	incptr2
3314
 5644  FD0EE0  80 F1         		bra	?02
3315
 5645  FD0EE2  86 2F         	?04:	stx	ctmp
3316
 5646  FD0EE4  A5 5C         		lda	lptc			; restore buffer pointer
3317
 5647  FD0EE6  85 15         		sta	ppage
3318
 5648  FD0EE8  A5 5D         		lda	lptc+1
3319
 5649  FD0EEA  85 16         		sta	ppage+1
3320
 5650  FD0EEC  A5 5E         		lda	lptc+2
3321
 5651  FD0EEE  85 17         		sta	ixb
3322
 5652  FD0EF0  60            	?06:	rts
3323
 5653
3324
 5654                        	; get blocks count of buffer
3325
 5655                        	; in:	C = buffer start page
3326
 5656                        	; out:	C = blocks count
3327
 5657                        	; using lptmp1 long pointer
3328
 5658                        	; can be called in 8/16 bit mode
3329
 5659                        	; P2262:
3330
 5660  FD0EF1                	blkcnt:
3331
 5661  FD0EF1  08            		php				; save 8/16 bit state
3332
 5662  FD0EF2                		INDEX08
3333
 5663  FD0EF2  E2 10         		sep	#PXFLAG
3334
 5664                        		.LONGI	off
3335
 5665                        		.MNLIST
3336
 5666  FD0EF4  A2 00         		LDX	#$00
3337
 5667  FD0EF6  86 4C         		STX	<lptmp1
3338
 5668  FD0EF8                		CPU16
3339
 5669  FD0EF8  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
3340
 5670                        		.LONGA	on
3341
 5671                        		.LONGI	on
3342
 5672                        		.MNLIST
3343
 5673  FD0EFA  A8            		tay
3344
 5674  FD0EFB  F0 0C         		beq	?03			; return C = 0
3345
 5675  FD0EFD  85 4D         		STA	<lptmp1+1		; page pointer
3346
 5676  FD0EFF  E8            	?01:	INX
3347
 5677  FD0F00  A7 4C         		LDA	[lptmp1]
3348
 5678  FD0F02  F0 04         		BEQ	?02			; end of buffer
3349
  Tue Jul 17 11:00:22 2018                                                                                               Page   55
3350
 
3351
 
3352
 
3353
 
3354
 5679  FD0F04  85 4D         		STA	<lptmp1+1
3355
 5680  FD0F06  80 F7         		bra	?01
3356
 5681  FD0F08  8A            	?02:	TXA
3357
 5682  FD0F09  28            	?03:	plp				; restore 8/16 bit mode
3358
 5683  FD0F0A                		LONG_OFF
3359
 5684                        		.LONGA	off
3360
 5685                        		.LONGI	off
3361
 5686                        		.MNLIST
3362
 5687  FD0F0A  60            		RTS
3363
 5688
3364
 5689                        	; delete byte at current position from block
3365
 5690                        	; A,X,Y preserved
3366
 5691                        	; using lptc, lptmp1 & lptmp2 long pointer
3367
 5692                        	; using wtmp
3368
 5693                        	; P238E:
3369
 5694  FD0F0B                	delbyte:
3370
 5695  FD0F0B  48            		pha
3371
 5696  FD0F0C  DA            		phx
3372
 5697  FD0F0D  5A            		phy
3373
 5698  FD0F0E                		ACC16
3374
 5699  FD0F0E  C2 20         		rep	#PMFLAG
3375
 5700                        		.LONGA	on
3376
 5701                        		.MNLIST
3377
 5702  FD0F10  A5 15         		LDA	ppage
3378
 5703  FD0F12  85 4A         		sta	wtmp			; save current page pointer
3379
 5704  FD0F14  C5 06         		CMP	pp6
3380
 5705  FD0F16                		ACC08
3381
 5706  FD0F16  E2 20         		sep	#PMFLAG
3382
 5707                        		.LONGA	off
3383
 5708                        		.MNLIST
3384
 5709  FD0F18  D0 02         		BNE	?01
3385
 5710  FD0F1A  C6 0D         		DEC	ix6			; update
3386
 5711  FD0F1C  A0 04         	?01:	LDY	#BNDX
3387
 5712  FD0F1E  B7 14         		LDA	[pblk],Y
3388
 5713  FD0F20  AA            		TAX				; X = pointer in block
3389
 5714  FD0F21  C5 17         		CMP	ixb
3390
 5715  FD0F23  D0 34         		BNE	?04			; not last byte in block
3391
 5716  FD0F25  3A            		dec	a			; update pointer in block
3392
 5717  FD0F26  97 14         		STA	[pblk],Y		; this is last byte in block
3393
 5718  FD0F28  20 DF 0F      		JSR	incptr2
3394
 5719  FD0F2B  E0 05         		CPX	#BSTART			; empty buffer ?
3395
 5720  FD0F2D  D0 0A         		BNE	?02			; no
3396
 5721  FD0F2F  A5 4B         		lda	wtmp+1			; remove block
3397
 5722  FD0F31  EB            		xba
3398
 5723  FD0F32  A5 4A         		lda	wtmp			; C = page pointer
3399
 5724  FD0F34  20 74 10      		JSR	delblk
3400
 5725  FD0F37  80 2F         		bra	?06			; exit
3401
 5726  FD0F39  A5 08         	?02:	lda	pp8
3402
 5727  FD0F3B  85 5D         		sta	lptc+1
3403
 5728  FD0F3D  A5 09         		lda	pp8+1
3404
 5729  FD0F3F  85 5E         		sta	lptc+2
3405
 5730  FD0F41  64 5C         		stz	lptc
3406
 5731  FD0F43  A0 04         		LDY	#BNDX
3407
 5732  FD0F45  B7 5C         		LDA	[lptc],Y
3408
 5733  FD0F47  C5 0E         		CMP	ix8
3409
 5734  FD0F49  B0 1D         		BCS	?06
3410
 5735  FD0F4B                		ACC16
3411
  Tue Jul 17 11:00:22 2018                                                                                               Page   56
3412
 
3413
 
3414
 
3415
 
3416
 5736  FD0F4B  C2 20         		rep	#PMFLAG
3417
 5737                        		.LONGA	on
3418
 5738                        		.MNLIST
3419
 5739  FD0F4D  A7 5C         		LDA	[lptc]
3420
 5740  FD0F4F  85 08         		STA	pp8
3421
 5741  FD0F51                		ACC08
3422
 5742  FD0F51  E2 20         		sep	#PMFLAG
3423
 5743                        		.LONGA	off
3424
 5744                        		.MNLIST
3425
 5745  FD0F53  A9 05         		LDA	#BSTART
3426
 5746  FD0F55  85 0E         		STA	ix8
3427
 5747  FD0F57  80 0F         		bra	?06
3428
 5748  FD0F59  3A            	?04:	dec	a			; update pointer
3429
 5749  FD0F5A  97 14         		STA	[pblk],Y
3430
 5750  FD0F5C  A4 17         		LDY	ixb			; move back bytes from end of block
3431
 5751  FD0F5E  C8            		INY				; to current position
3432
 5752  FD0F5F  B7 14         	?05:	LDA	[pblk],Y
3433
 5753  FD0F61  88            		DEY
3434
 5754  FD0F62  97 14         		STA	[pblk],Y
3435
 5755  FD0F64  C8            		INY
3436
 5756  FD0F65  C8            		INY
3437
 5757  FD0F66  D0 F7         		BNE	?05
3438
 5758  FD0F68  A9 80         	?06:	lda	#$80
3439
 5759  FD0F6A  04 18         		tsb	bflag			; set modified flag
3440
 5760  FD0F6C  7A            		ply
3441
 5761  FD0F6D  FA            		plx
3442
 5762  FD0F6E  68            		pla
3443
 5763  FD0F6F  60            		rts
3444
 5764
3445
 5765                        	; find beginning of next line
3446
 5766                        	; in:	none
3447
 5767                        	; out:	CF = 0 if ok, CF = 1 if end of buffer
3448
 5768                        	;	X = count of bytes till next line
3449
 5769                        	; Y preserved
3450
 5770                        	; P13CA:
3451
 5771  FD0F70                	nextln:
3452
 5772  FD0F70  5A            		phy
3453
 5773  FD0F71  A2 00         		ldx	#0			; bytes counter
3454
 5774  FD0F73  A4 17         		ldy	ixb
3455
 5775  FD0F75  38            		sec
3456
 5776  FD0F76  B7 14         		lda	[pblk],y		; get next byte
3457
 5777  FD0F78  F0 10         		beq	?03			; if end of buffer exit with CF = 1
3458
 5778  FD0F7A  C9 0D         	?01:	cmp	#$0D			; end of line ?
3459
 5779  FD0F7C  F0 08         		beq	?02			; yes
3460
 5780  FD0F7E  E8            		inx
3461
 5781  FD0F7F  20 DF 0F      		jsr	incptr2			; Y = next index
3462
 5782  FD0F82  B7 14         		lda	[pblk],y		; get next byte
3463
 5783  FD0F84  80 F4         		bra	?01
3464
 5784  FD0F86  20 DF 0F      	?02:	jsr	incptr2			; beginning of next line
3465
 5785  FD0F89  18            		clc
3466
 5786  FD0F8A  7A            	?03:	ply
3467
 5787  FD0F8B  60            		rts
3468
 5788
3469
 5789                        	; find beginning of current line
3470
 5790                        	; in:	none
3471
 5791                        	; out:	CF = 0 if ok, CF = 1 if beginning of buffer
3472
 5792                        	;	X = count of bytes till start of line
3473
  Tue Jul 17 11:00:22 2018                                                                                               Page   57
3474
 
3475
 
3476
 
3477
 
3478
 5793                        	; Y preserved
3479
 5794                        	; P1427:
3480
 5795  FD0F8C                	startln:
3481
 5796  FD0F8C  5A            		phy
3482
 5797  FD0F8D  A2 00         		ldx	#0			; bytes counter
3483
 5798  FD0F8F  20 1E 10      		jsr	decptr2			; decrement buffer pointer
3484
 5799  FD0F92  B0 13         		bcs	?04			; exit with CF = 1 if beginning
3485
 5800  FD0F94  E8            		inx
3486
 5801  FD0F95  20 1E 10      	?01:	jsr	decptr2
3487
 5802  FD0F98  B0 0C         		bcs	?03			; we are at the beginning
3488
 5803  FD0F9A  B7 14         		lda	[pblk],y		; previous byte
3489
 5804  FD0F9C  C9 0D         		cmp	#$0D
3490
 5805  FD0F9E  F0 03         		beq	?02			; end of prev. line
3491
 5806  FD0FA0  E8            		inx
3492
 5807  FD0FA1  80 F2         		bra	?01
3493
 5808  FD0FA3  20 DF 0F      	?02:	jsr	incptr2			; beginning of line
3494
 5809  FD0FA6  18            	?03:	clc
3495
 5810  FD0FA7  7A            	?04:	ply
3496
 5811  FD0FA8  60            		rts
3497
 5812
3498
 5813                        	; get byte from buffer at current index
3499
 5814                        	; in:	none
3500
 5815                        	; out:	A = current byte (CF = 0 if not null, CF = 1 if null)
3501
 5816                        	; X,Y preserved
3502
 5817                        	; P2353:
3503
 5818  FD0FA9                	getbyte:
3504
 5819  FD0FA9  5A            		phy
3505
 5820  FD0FAA  A4 17         		ldy	ixb
3506
 5821  FD0FAC  B7 14         		lda	[pblk],y
3507
 5822  FD0FAE  18            		clc
3508
 5823  FD0FAF  D0 01         		bne	?01
3509
 5824  FD0FB1  38            		sec
3510
 5825  FD0FB2  7A            	?01:	ply
3511
 5826  FD0FB3  60            		rts
3512
 5827
3513
 5828                        	; get byte from buffer at current index
3514
 5829                        	; in:	none
3515
 5830                        	; out:	A = current byte (CF = 0 if not null, CF = 1 if null)
3516
 5831                        	; X preserved
3517
 5832                        	; P2353:
3518
 5833  FD0FB4                	getbyte2:
3519
 5834  FD0FB4  A4 17         		ldy	ixb
3520
 5835  FD0FB6  B7 14         		lda	[pblk],y
3521
 5836  FD0FB8  F0 02         		beq	?02
3522
 5837  FD0FBA  18            		clc
3523
 5838  FD0FBB  60            		rts
3524
 5839  FD0FBC  38            	?02:	sec
3525
 5840  FD0FBD  60            		rts
3526
 5841
3527
 5842                        	; increment buffer pointer
3528
 5843                        	; in:	none
3529
 5844                        	; out:	CF = 1 if change block or if end of buffer
3530
 5845                        	; A,X,Y preserved
3531
 5846                        	; P2333:
3532
 5847  FD0FBE                	incptr:
3533
 5848  FD0FBE  48            		pha
3534
 5849  FD0FBF  5A            		phy
3535
  Tue Jul 17 11:00:22 2018                                                                                               Page   58
3536
 
3537
 
3538
 
3539
 
3540
 5850  FD0FC0  A5 17         		lda	ixb
3541
 5851  FD0FC2  A0 04         		ldy	#BNDX
3542
 5852  FD0FC4  D7 14         		cmp	[pblk],y
3543
 5853  FD0FC6  90 0C         		bcc	?04			; ok, increment
3544
 5854  FD0FC8                		ACC16
3545
 5855  FD0FC8  C2 20         		rep	#PMFLAG
3546
 5856                        		.LONGA	on
3547
 5857                        		.MNLIST
3548
 5858  FD0FCA  A7 14         		lda	[pblk]			; next block
3549
 5859  FD0FCC  F0 0C         		beq	?08			; end of buffer, exit with CF = 1
3550
 5860  FD0FCE  85 15         		sta	ppage			; update page pointer
3551
 5861  FD0FD0                		ACC08
3552
 5862  FD0FD0  E2 20         		sep	#PMFLAG
3553
 5863                        		.LONGA	off
3554
 5864                        		.MNLIST
3555
 5865  FD0FD2  A9 04         		lda	#BSTART-1		; beginning of buffer
3556
 5866  FD0FD4  1A            	?04:	inc	a
3557
 5867  FD0FD5  85 17         		sta	ixb
3558
 5868  FD0FD7  7A            		ply
3559
 5869  FD0FD8  68            		pla
3560
 5870  FD0FD9  60            		rts
3561
 5871  FD0FDA                	?08:	ACC08
3562
 5872  FD0FDA  E2 20         		sep	#PMFLAG
3563
 5873                        		.LONGA	off
3564
 5874                        		.MNLIST
3565
 5875  FD0FDC  7A            		ply
3566
 5876  FD0FDD  68            		pla
3567
 5877  FD0FDE  60            		rts
3568
 5878
3569
 5879                        	; increment buffer pointer
3570
 5880                        	; in:	none
3571
 5881                        	; out:	CF = 1 if change block or if end of buffer
3572
 5882                        	;	Y = index
3573
 5883                        	; X preserved
3574
 5884  FD0FDF                	incptr2:
3575
 5885  FD0FDF  A5 17         		lda	ixb
3576
 5886  FD0FE1  A0 04         		ldy	#BNDX
3577
 5887  FD0FE3  D7 14         		cmp	[pblk],y
3578
 5888  FD0FE5  A8            		tay
3579
 5889  FD0FE6  90 0A         		bcc	?04			; ok, increment
3580
 5890  FD0FE8                		ACC16
3581
 5891  FD0FE8  C2 20         		rep	#PMFLAG
3582
 5892                        		.LONGA	on
3583
 5893                        		.MNLIST
3584
 5894  FD0FEA  A7 14         		lda	[pblk]			; next block
3585
 5895  FD0FEC  F0 07         		beq	?08			; end of buffer, exit with CF = 1
3586
 5896  FD0FEE  85 15         		sta	ppage			; update page pointer
3587
 5897  FD0FF0  A0 04         		ldy	#BSTART-1		; beginning of buffer
3588
 5898  FD0FF2  C8            	?04:	iny
3589
 5899  FD0FF3  84 17         		sty	ixb
3590
 5900  FD0FF5                	?08:	ACC08
3591
 5901  FD0FF5  E2 20         		sep	#PMFLAG
3592
 5902                        		.LONGA	off
3593
 5903                        		.MNLIST
3594
 5904  FD0FF7  60            		rts
3595
 5905
3596
 5906                        	; decrement buffer pointer
3597
  Tue Jul 17 11:00:22 2018                                                                                               Page   59
3598
 
3599
 
3600
 
3601
 
3602
 5907                        	; in:	none
3603
 5908                        	; out:	CF = 1 if at buffer beginning
3604
 5909                        	; A,X,Y preserved
3605
 5910                        	; P2430:
3606
 5911  FD0FF8                	decptr:
3607
 5912  FD0FF8  48            		pha
3608
 5913  FD0FF9  A5 17         		lda	ixb
3609
 5914  FD0FFB  C9 05         		cmp	#BSTART
3610
 5915  FD0FFD  D0 14         		bne	?02			; ok, decrement
3611
 5916  FD0FFF  5A            		phy
3612
 5917  FD1000  A0 02         		ldy	#BPREV			; previous page pointer
3613
 5918  FD1002                		ACC16
3614
 5919  FD1002  C2 20         		rep	#PMFLAG
3615
 5920                        		.LONGA	on
3616
 5921                        		.MNLIST
3617
 5922  FD1004  B7 14         		LDA	[pblk],Y
3618
 5923  FD1006  F0 11         		beq	?08			; exit with CF = 1
3619
 5924  FD1008  85 15         		sta	ppage			; update page pointer
3620
 5925  FD100A                		ACC08
3621
 5926  FD100A  E2 20         		sep	#PMFLAG
3622
 5927                        		.LONGA	off
3623
 5928                        		.MNLIST
3624
 5929  FD100C  A0 04         		LDY	#BNDX
3625
 5930  FD100E  B7 14         		LDA	[pblk],Y
3626
 5931  FD1010  7A            		ply
3627
 5932  FD1011  80 01         		bra	?04
3628
 5933  FD1013  3A            	?02:	dec	a
3629
 5934  FD1014  85 17         	?04:	sta	ixb
3630
 5935  FD1016  18            		clc				; ok, exit with CF = 0
3631
 5936  FD1017  68            		pla
3632
 5937  FD1018  60            		rts
3633
 5938  FD1019                	?08:	ACC08SEC
3634
 5939  FD1019  E2 21         		sep	#(PMFLAG.OR.PCFLAG)
3635
 5940                        		.LONGA	off
3636
 5941                        		.MNLIST
3637
 5942  FD101B  7A            		ply
3638
 5943  FD101C  68            		pla
3639
 5944  FD101D  60            		rts
3640
 5945
3641
 5946                        	; decrement buffer pointer
3642
 5947                        	; in:	none
3643
 5948                        	; out:	CF = 1 if at buffer beginning
3644
 5949                        	;	Y = index
3645
 5950                        	; X preserved
3646
 5951  FD101E                	decptr2:
3647
 5952  FD101E  A4 17         		ldy	ixb
3648
 5953  FD1020  C0 05         		cpy	#BSTART
3649
 5954  FD1022  D0 12         		bne	?02			; ok, decrement
3650
 5955  FD1024  A0 02         		ldy	#BPREV			; previous page pointer
3651
 5956  FD1026                		ACC16
3652
 5957  FD1026  C2 20         		rep	#PMFLAG
3653
 5958                        		.LONGA	on
3654
 5959                        		.MNLIST
3655
 5960  FD1028  B7 14         		LDA	[pblk],Y
3656
 5961  FD102A  F0 0F         		beq	?08			; exit with CF = 1
3657
 5962  FD102C  85 15         		sta	ppage			; update page pointer
3658
 5963  FD102E                		ACC08
3659
  Tue Jul 17 11:00:22 2018                                                                                               Page   60
3660
 
3661
 
3662
 
3663
 
3664
 5964  FD102E  E2 20         		sep	#PMFLAG
3665
 5965                        		.LONGA	off
3666
 5966                        		.MNLIST
3667
 5967  FD1030  A0 04         		LDY	#BNDX
3668
 5968  FD1032  B7 14         		LDA	[pblk],Y
3669
 5969  FD1034  A8            		tay
3670
 5970  FD1035  C8            		iny
3671
 5971  FD1036  88            	?02:	dey
3672
 5972  FD1037  84 17         	?04:	sty	ixb
3673
 5973  FD1039  18            		clc				; ok, exit with CF = 0
3674
 5974  FD103A  60            		rts
3675
 5975  FD103B                	?08:	ACC08SEC
3676
 5976  FD103B  E2 21         		sep	#(PMFLAG.OR.PCFLAG)
3677
 5977                        		.LONGA	off
3678
 5978                        		.MNLIST
3679
 5979  FD103D  A4 17         		ldy	ixb
3680
 5980  FD103F  60            		rts
3681
 5981
3682
 5982                        	; insert new block in buffer and store byte in new block
3683
 5983                        	; in:	wtmp = page pointer of new block
3684
 5984                        	;	A = byte to store
3685
 5985                        	; out:	buffer linked list modified
3686
 5986                        	; using lptmp2 long pointer
3687
 5987                        	; A,X preserved
3688
 5988                        	; P22DF:
3689
 5989  FD1040                	addblk:
3690
 5990  FD1040  64 4F         		stz	lptmp2			; using lptmp2 long pointer
3691
 5991  FD1042  48            		PHA				; save byte to store
3692
 5992  FD1043                		ACC16
3693
 5993  FD1043  C2 20         		rep	#PMFLAG
3694
 5994                        		.LONGA	on
3695
 5995                        		.MNLIST
3696
 5996  FD1045  A7 14         		LDA	[pblk]			; next page pointer
3697
 5997  FD1047  48            		PHA				; save
3698
 5998  FD1048  F0 0A         		BEQ	?01			; next = 0
3699
 5999  FD104A  85 50         		STA	lptmp2+1		; lptmp2 = next
3700
 6000  FD104C  A5 4A         		LDA	wtmp			; new page pointer
3701
 6001  FD104E  A0 02         		LDY	#BPREV
3702
 6002  FD1050  97 4F         		STA	[lptmp2],Y		; next->prev = new page pointer
3703
 6003  FD1052  80 02         		bra	?02
3704
 6004  FD1054  A5 4A         	?01:	LDA	wtmp			; next = new page pointer
3705
 6005  FD1056  87 14         	?02:	STA	[pblk]
3706
 6006  FD1058  85 50         		STA	lptmp2+1
3707
 6007  FD105A  A7 4F         		LDA	[lptmp2]		; next free page pointer
3708
 6008  FD105C  85 10         		STA	pfree
3709
 6009  FD105E  68            		PLA
3710
 6010  FD105F  87 4F         		STA	[lptmp2]		; new page next = cur->next
3711
 6011  FD1061  A5 15         		LDA	ppage
3712
 6012  FD1063  A0 02         		LDY	#BPREV
3713
 6013  FD1065  97 4F         		STA	[lptmp2],Y		; new page prev = cur
3714
 6014  FD1067                		ACC08
3715
 6015  FD1067  E2 20         		sep	#PMFLAG
3716
 6016                        		.LONGA	off
3717
 6017                        		.MNLIST
3718
 6018  FD1069  A9 05         		LDA	#BSTART
3719
 6019  FD106B  A0 04         		LDY	#BNDX
3720
 6020  FD106D  97 4F         		STA	[lptmp2],Y		; buffer index
3721
  Tue Jul 17 11:00:22 2018                                                                                               Page   61
3722
 
3723
 
3724
 
3725
 
3726
 6021  FD106F  68            		PLA
3727
 6022  FD1070  C8            		INY
3728
 6023  FD1071  97 4F         		STA	[lptmp2],Y		; store byte
3729
 6024  FD1073  60            		RTS
3730
 6025
3731
 6026                        	; remove a block from buffer and put in free blocks list
3732
 6027                        	; in:	C = page pointer of block to remove
3733
 6028                        	; using lptmp1 & lptmp2 long pointers
3734
 6029                        	; X preserved
3735
 6030                        	; P23EC:
3736
 6031  FD1074                	delblk:
3737
 6032  FD1074  64 4C         		stz	lptmp1			; using lptmp1 & lptmp2 long pointer
3738
 6033  FD1076  64 4F         		stz	lptmp2
3739
 6034  FD1078                		ACC16
3740
 6035  FD1078  C2 20         		rep	#PMFLAG
3741
 6036                        		.LONGA	on
3742
 6037                        		.MNLIST
3743
 6038  FD107A  85 4D         		STA	lptmp1+1		; page pointer to removing block
3744
 6039  FD107C  C5 04         		CMP	pp4
3745
 6040  FD107E  D0 08         		BNE	?01
3746
 6041  FD1080  A7 4C         		lda	[lptmp1]
3747
 6042  FD1082  85 04         		STA	pp4			; next block
3748
 6043  FD1084  A0 05         		LDY	#BSTART
3749
 6044  FD1086  84 0C         		STY	ix4
3750
 6045  FD1088  A7 4C         	?01:	lda	[lptmp1]
3751
 6046  FD108A  D0 06         		BNE	?02
3752
 6047  FD108C  A0 02         		LDY	#BPREV			; this is the first block
3753
 6048  FD108E  B7 4C         		lda	[lptmp1],y
3754
 6049  FD1090  80 08         		bra	?03
3755
 6050  FD1092  85 50         	?02:	STA	lptmp2+1		; next block
3756
 6051  FD1094  A0 02         		LDY	#BPREV
3757
 6052  FD1096  B7 4C         		lda	[lptmp1],y		; next->prev = this->prev
3758
 6053  FD1098  97 4F         		STA	[lptmp2],Y
3759
 6054  FD109A  D0 13         	?03:	BNE	?04			; prev != NULL
3760
 6055  FD109C  A5 50         		LDA	lptmp2+1		; prev = NULL => next block
3761
 6056  FD109E  85 12         		STA	pbuf			; become first block of this buffer
3762
 6057  FD10A0  A6 0F         		LDX	xbuf
3763
 6058  FD10A2  48            		pha
3764
 6059  FD10A3                		ACC08
3765
 6060  FD10A3  E2 20         		sep	#PMFLAG
3766
 6061                        		.LONGA	off
3767
 6062                        		.MNLIST
3768
 6063  FD10A5  8A            		txa
3769
 6064  FD10A6  0A            		asl	a
3770
 6065  FD10A7  AA            		tax
3771
 6066  FD10A8                		ACC16
3772
 6067  FD10A8  C2 20         		rep	#PMFLAG
3773
 6068                        		.LONGA	on
3774
 6069                        		.MNLIST
3775
 6070  FD10AA  68            		pla
3776
 6071  FD10AB  95 6C         		STA	bstart,X		; store first block of this buffer
3777
 6072  FD10AD  80 06         		bra	?05
3778
 6073  FD10AF  85 50         	?04:	STA	lptmp2+1		; prev block
3779
 6074  FD10B1  A7 4C         		lda	[lptmp1]		; prev->next = this->next
3780
 6075  FD10B3  87 4F         		STA	[lptmp2]
3781
 6076  FD10B5  A5 10         	?05:	LDA	pfree			; insert this block on free list
3782
 6077  FD10B7  87 4C         		STA	[lptmp1]
3783
  Tue Jul 17 11:00:22 2018                                                                                               Page   62
3784
 
3785
 
3786
 
3787
 
3788
 6078  FD10B9  A5 4D         		LDA	lptmp1+1
3789
 6079  FD10BB  85 10         		STA	pfree
3790
 6080  FD10BD                		ACC08
3791
 6081  FD10BD  E2 20         		sep	#PMFLAG
3792
 6082                        		.LONGA	off
3793
 6083                        		.MNLIST
3794
 6084  FD10BF  60            		RTS
3795
 6085
3796
 6086                        	; garbage collection -- free unused memory assigned to a buffer
3797
 6087                        	; out:	CF = 0 if completed, otherwise CF = 1
3798
 6088                        	; can be called in both 8/16 bit
3799
 6089                        	; P1855:
3800
 6090  FD10C0                	garbc:
3801
 6091  FD10C0  08            		php				; save 8/16 bit mode
3802
 6092  FD10C1                		CPU08
3803
 6093  FD10C1  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
3804
 6094                        		.LONGA	off
3805
 6095                        		.LONGI	off
3806
 6096                        		.MNLIST
3807
 6097  FD10C3  64 5C         		stz	lptc			; clear used memory
3808
 6098  FD10C5  64 5F         		stz	lpte			; using long pointer lptc & lpte
3809
 6099  FD10C7  64 67         		stz	tmpb
3810
 6100  FD10C9  64 68         		stz	tmpc
3811
 6101  FD10CB  64 69         		stz	tmpd
3812
 6102  FD10CD  64 6A         		stz	tmpe
3813
 6103  FD10CF  64 6B         		stz	tmpf
3814
 6104  FD10D1                		ACC16CLC
3815
 6105  FD10D1  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
3816
 6106                        		.LONGA	on
3817
 6107                        		.MNLIST
3818
 6108  FD10D3  A5 12         		LDA	pbuf			; first block of the buffer
3819
 6109  FD10D5  48            		PHA
3820
 6110  FD10D6  68            	?00:	PLA
3821
 6111  FD10D7  85 5D         		STA	lptc+1
3822
 6112  FD10D9  A7 5C         		LDA	[lptc]
3823
 6113  FD10DB  D0 03         		bne	?01
3824
 6114  FD10DD  28            		plp				; only this block -- done
3825
 6115  FD10DE  18            		clc
3826
 6116  FD10DF  60            		rts
3827
 6117  FD10E0  48            	?01:	pha				; save next block
3828
 6118  FD10E1                		ACC08
3829
 6119  FD10E1  E2 20         		sep	#PMFLAG
3830
 6120                        		.LONGA	off
3831
 6121                        		.MNLIST
3832
 6122  FD10E3  A0 04         		ldy	#BNDX
3833
 6123  FD10E5  B7 5C         		LDA	[lptc],Y
3834
 6124  FD10E7  AA            		TAX				; X = pointer in block
3835
 6125  FD10E8                		ACC16CLC
3836
 6126  FD10E8  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
3837
 6127                        		.LONGA	on
3838
 6128                        		.MNLIST
3839
 6129  FD10EA  E8            		INX				; full block?
3840
 6130  FD10EB  F0 E9         		beq	?00			; yes -- check next block
3841
 6131  FD10ED  86 63         		STX	tmp7			; tmp7 = next free
3842
 6132  FD10EF  68            		pla				; next block
3843
 6133  FD10F0  85 60         		STA	lpte+1
3844
 6134  FD10F2  A2 01         		LDX	#1
3845
  Tue Jul 17 11:00:22 2018                                                                                               Page   63
3846
 
3847
 
3848
 
3849
 
3850
 6135  FD10F4  C5 15         		CMP	ppage
3851
 6136  FD10F6  D0 02         		BNE	?02
3852
 6137  FD10F8  86 67         		STX	tmpb			; tmpb = 1 if this block = current block
3853
 6138  FD10FA  C5 08         	?02:	CMP	pp8
3854
 6139  FD10FC  D0 02         		bne	?03
3855
 6140  FD10FE  86 68         		STX	tmpc			; tmpc = 1 if this block = pp8
3856
 6141  FD1100  C5 04         	?03:	CMP	pp4
3857
 6142  FD1102  D0 02         		bne	?04
3858
 6143  FD1104  86 69         		STX	tmpd			; tmpd = 1 if this block = pp4
3859
 6144  FD1106  C5 06         	?04:	CMP	pp6
3860
 6145  FD1108  D0 02         		bne	?05
3861
 6146  FD110A  86 6A         		STX	tmpe			; tmpe = 1 if this block = pp6
3862
 6147  FD110C  C5 00         	?05:	CMP	pp0
3863
 6148  FD110E  D0 02         		bne	?06
3864
 6149  FD1110  86 6B         		STX	tmpf			; tmpf = 1 if this block = pp0
3865
 6150  FD1112                	?06:	ACC08
3866
 6151  FD1112  E2 20         		sep	#PMFLAG
3867
 6152                        		.LONGA	off
3868
 6153                        		.MNLIST
3869
 6154  FD1114  A0 04         		LDY	#BNDX
3870
 6155  FD1116  B7 5F         		LDA	[lpte],Y
3871
 6156  FD1118  85 65         		STA	tmp9			; tmp9 = pointer in next block
3872
 6157  FD111A  C8            		iny
3873
 6158  FD111B  84 64         		STY	tmp8			; tmp8 = dynamic pointer in next block
3874
 6159  FD111D  A4 64         	?07:	LDY	tmp8			; loop
3875
 6160  FD111F  B7 5F         		LDA	[lpte],Y		; move first byte of next block
3876
 6161  FD1121  A4 63         		LDY	tmp7			; to next free room in this block
3877
 6162  FD1123  97 5C         		STA	[lptc],Y
3878
 6163  FD1125                		ACC16
3879
 6164  FD1125  C2 20         		rep	#PMFLAG
3880
 6165                        		.LONGA	on
3881
 6166                        		.MNLIST
3882
 6167  FD1127  A5 5D         		LDA	lptc+1			; C = this block
3883
 6168  FD1129  A6 67         		LDX	tmpb
3884
 6169  FD112B  F0 0E         		beq	?08
3885
 6170  FD112D  A6 17         		LDX	ixb
3886
 6171  FD112F  E4 64         		CPX	tmp8
3887
 6172  FD1131  D0 08         		BNE	?08
3888
 6173  FD1133  85 15         		STA	ppage			; set to this block
3889
 6174  FD1135  84 17         		STY	ixb
3890
 6175  FD1137  A2 00         		LDX	#0
3891
 6176  FD1139  86 67         		STX	tmpb
3892
 6177  FD113B  A6 68         	?08:	LDX	tmpc
3893
 6178  FD113D  F0 0E         		BEQ	?09
3894
 6179  FD113F  A6 0E         		LDX	ix8
3895
 6180  FD1141  E4 64         		CPX	tmp8
3896
 6181  FD1143  D0 08         		BNE	?09
3897
 6182  FD1145  85 08         		STA	pp8			; set to this block
3898
 6183  FD1147  84 0E         		STY	ix8
3899
 6184  FD1149  A2 00         		LDX	#0
3900
 6185  FD114B  86 68         		STX	tmpc
3901
 6186  FD114D  A6 69         	?09:	LDX	tmpd
3902
 6187  FD114F  F0 0E         		BEQ	?10
3903
 6188  FD1151  A6 0C         		LDX	ix4
3904
 6189  FD1153  E4 64         		CPX	tmp8
3905
 6190  FD1155  D0 08         		BNE	?10
3906
 6191  FD1157  85 04         		STA	pp4			; set to this block
3907
  Tue Jul 17 11:00:22 2018                                                                                               Page   64
3908
 
3909
 
3910
 
3911
 
3912
 6192  FD1159  84 0C         		STY	ix4
3913
 6193  FD115B  A2 00         		LDX	#0
3914
 6194  FD115D  86 69         		STX	tmpd
3915
 6195  FD115F  A6 6A         	?10:	LDX	tmpe
3916
 6196  FD1161  F0 0E         		BEQ	?11
3917
 6197  FD1163  A6 0D         		LDX	ix6
3918
 6198  FD1165  E4 64         		CPX	tmp8
3919
 6199  FD1167  D0 08         		BNE	?11
3920
 6200  FD1169  85 06         		STA	pp6			; set to this block
3921
 6201  FD116B  84 0D         		STY	ix6
3922
 6202  FD116D  A2 00         		LDX	#0
3923
 6203  FD116F  86 6A         		STX	tmpe
3924
 6204  FD1171  A6 6B         	?11:	LDX	tmpf
3925
 6205  FD1173  F0 0E         		BEQ	?12
3926
 6206  FD1175  A6 0A         		LDX	ix0
3927
 6207  FD1177  E4 64         		CPX	tmp8
3928
 6208  FD1179  D0 08         		BNE	?12
3929
 6209  FD117B  85 00         		STA	pp0			; set to this block
3930
 6210  FD117D  84 0A         		STY	ix0
3931
 6211  FD117F  A2 00         		LDX	#0
3932
 6212  FD1181  86 6B         		STX	tmpf
3933
 6213  FD1183  A6 64         	?12:	LDX	tmp8			; X = pointer in next block
3934
 6214  FD1185  A5 60         		LDA	lpte+1			; C = next block
3935
 6215  FD1187                		ACC08
3936
 6216  FD1187  E2 20         		sep	#PMFLAG
3937
 6217                        		.LONGA	off
3938
 6218                        		.MNLIST
3939
 6219  FD1189  E4 65         		CPX	tmp9			; if same pointer then next block now
3940
 6220  FD118B  F0 08         		BEQ	?13			; is empty and can be freed
3941
 6221  FD118D  E6 64         		INC	tmp8
3942
 6222  FD118F  E6 63         		INC	tmp7
3943
 6223  FD1191  D0 8A         		bne	?07			; loop move byte
3944
 6224  FD1193  F0 0C         		BEQ	?15			; continue
3945
 6225  FD1195  20 74 10      	?13:	JSR	delblk			; remove next block (C)
3946
 6226  FD1198  A0 04         		LDY	#BNDX
3947
 6227  FD119A  A5 63         		LDA	tmp7			; set pointer in block
3948
 6228  FD119C  97 5C         		STA	[lptc],Y
3949
 6229  FD119E  28            		plp
3950
 6230  FD119F  18            		CLC				; done
3951
 6231  FD11A0  60            		RTS
3952
 6232  FD11A1  A9 FF         	?15:	LDA	#$FF			; full block
3953
 6233  FD11A3  A0 04         		LDY	#BNDX
3954
 6234  FD11A5  97 5C         		STA	[lptc],Y
3955
 6235  FD11A7  C8            		INY
3956
 6236  FD11A8  84 63         		STY	tmp7
3957
 6237  FD11AA  A5 64         		LDA	tmp8
3958
 6238  FD11AC  38            		SEC
3959
 6239  FD11AD  E9 05         		SBC	#BSTART
3960
 6240  FD11AF  85 66         		STA	tmpa			; residue
3961
 6241  FD11B1  E6 65         		INC	tmp9			; limit pointer in next block
3962
 6242  FD11B3  A4 64         		LDY	tmp8
3963
 6243  FD11B5  A6 63         		LDX	tmp7
3964
 6244  FD11B7  B7 5F         	?16:	LDA	[lpte],Y		; move byte
3965
 6245  FD11B9  9B            		TXY
3966
 6246  FD11BA  97 5F         		STA	[lpte],Y
3967
 6247  FD11BC  E8            		INX
3968
 6248  FD11BD  E6 64         		INC	tmp8
3969
  Tue Jul 17 11:00:22 2018                                                                                               Page   65
3970
 
3971
 
3972
 
3973
 
3974
 6249  FD11BF  A4 64         		LDY	tmp8
3975
 6250  FD11C1  C4 65         		CPY	tmp9
3976
 6251  FD11C3  D0 F2         		BNE	?16			; move all bytes
3977
 6252  FD11C5  A5 67         		LDA	tmpb
3978
 6253  FD11C7  F0 07         		BEQ	?17
3979
 6254  FD11C9  A5 17         		LDA	ixb
3980
 6255  FD11CB  38            		SEC
3981
 6256  FD11CC  E5 66         		SBC	tmpa
3982
 6257  FD11CE  85 17         		STA	ixb
3983
 6258  FD11D0  A5 68         	?17:	LDA	tmpc
3984
 6259  FD11D2  F0 07         		BEQ	?18
3985
 6260  FD11D4  A5 0E         		LDA	ix8
3986
 6261  FD11D6  38            		SEC
3987
 6262  FD11D7  E5 66         		SBC	tmpa
3988
 6263  FD11D9  85 0E         		STA	ix8
3989
 6264  FD11DB  A5 69         	?18:	LDA	tmpd
3990
 6265  FD11DD  F0 07         		BEQ	?19
3991
 6266  FD11DF  A5 0C         		LDA	ix4
3992
 6267  FD11E1  38            		SEC
3993
 6268  FD11E2  E5 66         		SBC	tmpa
3994
 6269  FD11E4  85 0C         		STA	ix4
3995
 6270  FD11E6  A5 6A         	?19:	LDA	tmpe
3996
 6271  FD11E8  F0 07         		BEQ	?20
3997
 6272  FD11EA  A5 0D         		LDA	ix6
3998
 6273  FD11EC  38            		SEC
3999
 6274  FD11ED  E5 66         		SBC	tmpa
4000
 6275  FD11EF  85 0D         		STA	ix6
4001
 6276  FD11F1  A5 6B         	?20:	LDA	tmpf
4002
 6277  FD11F3  F0 07         		BEQ	?21
4003
 6278  FD11F5  A5 0A         		LDA	ix0
4004
 6279  FD11F7  38            		SEC
4005
 6280  FD11F8  E5 66         		SBC	tmpa
4006
 6281  FD11FA  85 0A         		STA	ix0
4007
 6282  FD11FC  A5 65         	?21:	LDA	tmp9
4008
 6283  FD11FE  18            		CLC
4009
 6284  FD11FF  E5 66         		SBC	tmpa
4010
 6285  FD1201  A0 04         		LDY	#BNDX			; update pointer in next buffer
4011
 6286  FD1203  97 5F         		STA	[lpte],Y
4012
 6287  FD1205  28            		plp
4013
 6288  FD1206  38            		SEC				; not done
4014
 6289  FD1207  60            		RTS
4015
 6290
4016
 6291                        	;-----------------------------------------------------------------
4017
 6292                        	; high level screen
4018
 6293
4019
 6294                        	; update last edit text row on screen
4020
 6295                        	; P13E5:
4021
 6296  FD1208                	updlst:
4022
 6297  FD1208                		ACC16
4023
 6298  FD1208  C2 20         		rep	#PMFLAG
4024
 6299                        		.LONGA	on
4025
 6300                        		.MNLIST
4026
 6301  FD120A  A9 30 07      		LDA	#!LSTLINE
4027
 6302  FD120D  85 34         		sta	stxtp
4028
 6303  FD120F  09 00 08      		ora	#!TXTATTR
4029
 6304  FD1212  85 38         		sta	sattp
4030
 6305  FD1214                		ACC08
4031
  Tue Jul 17 11:00:22 2018                                                                                               Page   66
4032
 
4033
 
4034
 
4035
 
4036
 6306  FD1214  E2 20         		sep	#PMFLAG
4037
 6307                        		.LONGA	off
4038
 6308                        		.MNLIST
4039
 6309  FD1216  A5 23         		LDA	fslct
4040
 6310  FD1218  F0 16         		BEQ	?01
4041
 6311  FD121A  A5 25         		LDA	nslcth
4042
 6312  FD121C  10 12         		BPL	?01
4043
 6313  FD121E  A9 17         		LDA	#$17
4044
 6314  FD1220  38            		SEC
4045
 6315  FD1221  E5 20         		SBC	srow
4046
 6316  FD1223  18            		CLC
4047
 6317  FD1224  65 24         		ADC	nslctl
4048
 6318  FD1226  A9 00         		LDA	#$00
4049
 6319  FD1228  65 25         		ADC	nslcth
4050
 6320  FD122A  10 04         		BPL	?01
4051
 6321  FD122C  A9 80         		LDA	#$80
4052
 6322  FD122E  85 37         		STA	frev
4053
 6323  FD1230  A6 06         	?01:	LDX	pp6
4054
 6324  FD1232  A5 07         		lda	pp6+1
4055
 6325  FD1234  A4 0D         		LDY	ix6
4056
 6326  FD1236  20 60 14      		JSR	setptr
4057
 6327  FD1239  80 2E         		bra	updrow
4058
 6328
4059
 6329                        	; update first edit text row on screen
4060
 6330                        	; P1E30:
4061
 6331  FD123B                	updfst:
4062
 6332  FD123B                		ACC16
4063
 6333  FD123B  C2 20         		rep	#PMFLAG
4064
 6334                        		.LONGA	on
4065
 6335                        		.MNLIST
4066
 6336  FD123D  A9 00 00      		LDA	#!TXTADDR
4067
 6337  FD1240  85 34         		sta	stxtp
4068
 6338  FD1242  09 00 08      		ora	#!TXTATTR
4069
 6339  FD1245  85 38         		sta	sattp
4070
 6340  FD1247                		ACC08
4071
 6341  FD1247  E2 20         		sep	#PMFLAG
4072
 6342                        		.LONGA	off
4073
 6343                        		.MNLIST
4074
 6344  FD1249  A5 23         		LDA	fslct
4075
 6345  FD124B  F0 13         		BEQ	?01
4076
 6346  FD124D  A5 25         		LDA	nslcth
4077
 6347  FD124F  30 0F         		BMI	?01
4078
 6348  FD1251  A5 20         		LDA	srow
4079
 6349  FD1253  38            		SEC
4080
 6350  FD1254  E5 24         		SBC	nslctl
4081
 6351  FD1256  A9 00         		LDA	#$00
4082
 6352  FD1258  E5 25         		SBC	nslcth
4083
 6353  FD125A  10 04         		BPL	?01
4084
 6354  FD125C  A9 80         		LDA	#$80
4085
 6355  FD125E  85 37         		STA	frev
4086
 6356  FD1260  A6 04         	?01:	LDX	pp4
4087
 6357  FD1262  A5 05         		lda	pp4+1
4088
 6358  FD1264  A4 0C         		LDY	ix4
4089
 6359  FD1266  20 60 14      		JSR	setptr
4090
 6360
4091
 6361                        	; update current row on screen
4092
 6362                        	; P2779:
4093
  Tue Jul 17 11:00:22 2018                                                                                               Page   67
4094
 
4095
 
4096
 
4097
 
4098
 6363  FD1269                	updrow:
4099
 6364  FD1269  BD FF FF      		lda	!$FFFF,x
4100
 6365  FD126C  D0 12         		BNE	?04
4101
 6366  FD126E  A9 20         		lda	#' '			; blank row
4102
 6367  FD1270  EB            		xba
4103
 6368  FD1271  A5 3B         		lda	eattr			; A = attribute, B = blank
4104
 6369  FD1273  A0 4F         		ldy	#MAXCOLS-1
4105
 6370  FD1275  97 38         	?02:	sta	[sattp],y		; store attribute
4106
 6371  FD1277  EB            		xba
4107
 6372  FD1278  97 34         		sta	[stxtp],y		; store blank
4108
 6373  FD127A  EB            		xba
4109
 6374  FD127B  88            		dey
4110
 6375  FD127C  10 F7         		bpl	?02
4111
 6376  FD127E  38            		SEC
4112
 6377  FD127F  60            		RTS
4113
 6378  FD1280  A4 1F         	?04:	LDY	ecol
4114
 6379  FD1282  F0 16         		BEQ	updr2
4115
 6380                        	; P279F:
4116
 6381  FD1284                	updr1:
4117
 6382  FD1284  BD FF FF      		lda	!$FFFF,x
4118
 6383  FD1287  C9 0D         		CMP	#$0D
4119
 6384  FD1289  D0 04         		BNE	?02
4120
 6385  FD128B  A0 00         		LDY	#$00
4121
 6386  FD128D  80 3A         		bra	updr9
4122
 6387  FD128F  E4 51         	?02:	CPX	ebtmp2
4123
 6388  FD1291  D0 03         		BNE	?03
4124
 6389  FD1293  20 8C 14      		JSR	updptr
4125
 6390  FD1296  E8            	?03:	INX
4126
 6391  FD1297  88            		DEY
4127
 6392  FD1298  D0 EA         		BNE	updr1
4128
 6393                        	; P27B7:
4129
 6394  FD129A                	updr2:
4130
 6395  FD129A  BD FF FF      		lda	!$FFFF,x
4131
 6396  FD129D  C9 0D         		CMP	#$0D
4132
 6397  FD129F  F0 28         		BEQ	updr9
4133
 6398  FD12A1  C0 50         		CPY	#MAXCOLS
4134
 6399  FD12A3  D0 11         		BNE	updr7
4135
 6400  FD12A5  E4 51         	updr5:	CPX	ebtmp2
4136
 6401  FD12A7  90 03         		BCC	?06
4137
 6402  FD12A9  20 8C 14      		JSR	updptr
4138
 6403  FD12AC  E8            	?06:	INX
4139
 6404                        	; P27CC:
4140
 6405  FD12AD                	updr3:
4141
 6406  FD12AD  BD FF FF      		lda	!$FFFF,x
4142
 6407  FD12B0  C9 0D         		CMP	#$0D
4143
 6408  FD12B2  D0 F1         		BNE	updr5
4144
 6409  FD12B4  F0 13         		beq	updr9
4145
 6410  FD12B6  97 34         	updr7:	sta	[stxtp],y		; store char in video ram
4146
 6411  FD12B8  A5 3B         		lda	eattr			; editor attribute
4147
 6412  FD12BA  45 37         		EOR	frev			; set reverse bit
4148
 6413  FD12BC  97 38         		sta	[sattp],y		; store attribute
4149
 6414  FD12BE  C8            		INY
4150
 6415  FD12BF  E4 51         		CPX	ebtmp2
4151
 6416  FD12C1  90 03         		BCC	?08
4152
 6417  FD12C3  20 8C 14      		JSR	updptr
4153
 6418  FD12C6  E8            	?08:	INX
4154
 6419  FD12C7  80 D1         		bra	updr2
4155
  Tue Jul 17 11:00:22 2018                                                                                               Page   68
4156
 
4157
 
4158
 
4159
 
4160
 6420  FD12C9  E4 51         	updr9:	CPX	ebtmp2
4161
 6421  FD12CB  90 03         		BCC	?10
4162
 6422  FD12CD  20 8C 14      		JSR	updptr
4163
 6423  FD12D0  E8            	?10:	INX
4164
 6424  FD12D1  A9 20         		LDA	#' '			; pad row with blank
4165
 6425  FD12D3  EB            		xba				; B = char, A = attribute
4166
 6426  FD12D4  A5 3B         		lda	eattr			; editor attribute
4167
 6427  FD12D6  45 37         		EOR	frev			; set reverse bit
4168
 6428  FD12D8  C0 50         	?11:	CPY	#MAXCOLS
4169
 6429  FD12DA  F0 09         		BEQ	?12
4170
 6430  FD12DC  97 38         		sta	[sattp],y		; store attribute
4171
 6431  FD12DE  EB            		xba
4172
 6432  FD12DF  97 34         		sta	[stxtp],y		; store blank
4173
 6433  FD12E1  EB            		xba
4174
 6434  FD12E2  C8            		INY
4175
 6435  FD12E3  D0 F3         		BNE	?11
4176
 6436  FD12E5  64 37         	?12:	STZ	frev			; clear reverse flag bit
4177
 6437  FD12E7  18            		CLC
4178
 6438  FD12E8  60            		RTS
4179
 6439
4180
 6440                        	; scroll right editor window (move window left one column)
4181
 6441                        	; P24D9:
4182
 6442  FD12E9                	scrlright:
4183
 6443  FD12E9  8B            		phb				; save DBR
4184
 6444  FD12EA                		ACC16CLC
4185
 6445  FD12EA  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4186
 6446                        		.LONGA	on
4187
 6447                        		.MNLIST
4188
 6448  FD12EC  A9 00 00      		lda	#!TXTADDR		; set screen text pointer
4189
 6449  FD12EF  85 34         		sta	stxtp
4190
 6450  FD12F1  A9 00 08      		lda	#!TXTATTR		; set screen attributes pointer
4191
 6451  FD12F4  85 38         		sta	sattp
4192
 6452  FD12F6  A5 04         		LDA	pp4			; buffer page pointer
4193
 6453  FD12F8  85 5D         		STA	lptc+1			; B = bank, A = page
4194
 6454  FD12FA                		ACC08
4195
 6455  FD12FA  E2 20         		sep	#PMFLAG
4196
 6456                        		.LONGA	off
4197
 6457                        		.MNLIST
4198
 6458  FD12FC  4B            		phk
4199
 6459  FD12FD  AB            		plb				; DBR = PBR
4200
 6460  FD12FE  9C 23 13      		STZ	!sclr1+1
4201
 6461  FD1301  9C 2C 13      		STZ	!sclr2+1
4202
 6462  FD1304  8D 24 13      		STA	!sclr1+2
4203
 6463  FD1307  8D 2D 13      		STA	!sclr2+2
4204
 6464  FD130A  64 5C         		STZ	lptc
4205
 6465  FD130C  A5 1F         		LDA	ecol
4206
 6466  FD130E  69 4F         		ADC	#MAXCOLS-1
4207
 6467  FD1310  85 4F         		STA	ewtmp2+1
4208
 6468  FD1312  EB            		xba				; A = bank
4209
 6469  FD1313  48            		pha
4210
 6470  FD1314  AB            		plb				; set DBR to current buffer
4211
 6471  FD1315  A0 04         		LDY	#BNDX
4212
 6472  FD1317  B1 5C         		lda	(lptc),y
4213
 6473  FD1319  85 50         		STA	ebtmp
4214
 6474  FD131B  20 B1 14      		JSR	chksel
4215
 6475  FD131E  64 4D         		stz	ewtmp+1			; counter 24 rows
4216
 6476  FD1320  A6 0C         		LDX	ix4
4217
  Tue Jul 17 11:00:22 2018                                                                                               Page   69
4218
 
4219
 
4220
 
4221
 
4222
 6477                        	;P2512:
4223
 6478  FD1322  BD FF FF      	sclr1:	lda	!$FFFF,x
4224
 6479  FD1325  F0 6D         		beq	sclr3
4225
 6480  FD1327  A0 00         		LDY	#$00
4226
 6481  FD1329  84 4E         		STY	ewtmp2
4227
 6482                        	;P251D:
4228
 6483  FD132B  BD FF FF      	sclr2:	lda	!$FFFF,x
4229
 6484  FD132E  C9 0D         		CMP	#$0D
4230
 6485  FD1330  D0 0A         		BNE	?03
4231
 6486  FD1332  A5 4E         		lda	ewtmp2
4232
 6487  FD1334  D0 19         		BNE	?06
4233
 6488  FD1336  A9 20         		LDA	#' '			; blank padding
4234
 6489  FD1338  85 4C         		sta	ewtmp
4235
 6490  FD133A  80 13         		bra	?06
4236
 6491  FD133C  C4 4F         	?03:	cpy	ewtmp2+1
4237
 6492  FD133E  D0 04         		BNE	?04
4238
 6493  FD1340  85 4C         		sta	ewtmp
4239
 6494  FD1342  E6 4E         		INC	ewtmp2
4240
 6495  FD1344  E4 50         	?04:	CPX	ebtmp
4241
 6496  FD1346  D0 03         		BNE	?05
4242
 6497  FD1348  20 3D 14      		JSR	setscrp
4243
 6498  FD134B  E8            	?05:	INX
4244
 6499  FD134C  C8            		INY
4245
 6500  FD134D  80 DC         		bra	sclr2
4246
 6501  FD134F  E4 50         	?06:	CPX	ebtmp
4247
 6502  FD1351  D0 03         		BNE	?07
4248
 6503  FD1353  20 3D 14      		JSR	setscrp
4249
 6504  FD1356  E8            	?07:	INX
4250
 6505  FD1357  A9 01         		lda	#^TXTADDR
4251
 6506  FD1359  8B            		phb
4252
 6507  FD135A  48            		pha
4253
 6508  FD135B  AB            		plb
4254
 6509  FD135C  A0 01         		ldy	#$01			; move left text and attributes
4255
 6510  FD135E  B1 34         	?08:	lda	(stxtp),y
4256
 6511  FD1360  EB            		xba
4257
 6512  FD1361  B1 38         		lda	(sattp),y		; A = attribute, B = text
4258
 6513  FD1363  88            		dey
4259
 6514  FD1364  91 38         		sta	(sattp),y
4260
 6515  FD1366  EB            		xba
4261
 6516  FD1367  91 34         		sta	(stxtp),y
4262
 6517  FD1369  C8            		iny
4263
 6518  FD136A  C8            		iny
4264
 6519  FD136B  C0 50         		cpy	#MAXCOLS
4265
 6520  FD136D  90 EF         		bcc	?08
4266
 6521  FD136F  88            		DEY
4267
 6522  FD1370  A5 4C         		lda	ewtmp
4268
 6523  FD1372  91 34         		sta	(stxtp),y
4269
 6524  FD1374  A5 3B         		lda	eattr			; editor attribute
4270
 6525  FD1376  20 E3 14      		JSR	tglrev			; check reverse bit
4271
 6526  FD1379  91 38         		sta	(sattp),y
4272
 6527  FD137B  AB            		plb
4273
 6528  FD137C                		ACC16CLC
4274
 6529  FD137C  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4275
 6530                        		.LONGA	on
4276
 6531                        		.MNLIST
4277
 6532  FD137E  A5 34         		LDA	stxtp
4278
 6533  FD1380  69 50 00      		ADC	#MAXCOLS
4279
  Tue Jul 17 11:00:22 2018                                                                                               Page   70
4280
 
4281
 
4282
 
4283
 
4284
 6534  FD1383  85 34         		STA	stxtp
4285
 6535  FD1385  09 00 08      		ora	#!TXTATTR
4286
 6536  FD1388  85 38         		sta	sattp
4287
 6537  FD138A                		ACC08
4288
 6538  FD138A  E2 20         		sep	#PMFLAG
4289
 6539                        		.LONGA	off
4290
 6540                        		.MNLIST
4291
 6541  FD138C  E6 4D         		INC	ewtmp+1
4292
 6542  FD138E  A5 4D         		LDA	ewtmp+1
4293
 6543  FD1390  C9 18         		CMP	#$18
4294
 6544  FD1392  D0 8E         		bne	sclr1
4295
 6545  FD1394  AB            	sclr3:	plb
4296
 6546  FD1395  60            		RTS
4297
 6547
4298
 6548                        	; scroll left editor window (move window right one column)
4299
 6549                        	; P25CF:
4300
 6550  FD1396                	scrlleft:
4301
 6551  FD1396  8B            		phb				; save DBR
4302
 6552  FD1397                		ACC16CLC
4303
 6553  FD1397  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4304
 6554                        		.LONGA	on
4305
 6555                        		.MNLIST
4306
 6556  FD1399  A9 00 00      		lda	#!TXTADDR		; set screen text pointer
4307
 6557  FD139C  85 34         		sta	stxtp
4308
 6558  FD139E  A9 00 08      		lda	#!TXTATTR		; set screen attributes pointer
4309
 6559  FD13A1  85 38         		sta	sattp
4310
 6560  FD13A3  A5 04         		LDA	pp4			; buffer page pointer
4311
 6561  FD13A5  85 5D         		STA	lptc+1			; B = bank, A = page
4312
 6562  FD13A7                		ACC08
4313
 6563  FD13A7  E2 20         		sep	#PMFLAG
4314
 6564                        		.LONGA	off
4315
 6565                        		.MNLIST
4316
 6566  FD13A9  4B            		phk
4317
 6567  FD13AA  AB            		plb				; DBR = PBR
4318
 6568  FD13AB  9C CA 13      		STZ	!scll1+1
4319
 6569  FD13AE  9C D3 13      		STZ	!scll2+1
4320
 6570  FD13B1  8D CB 13      		STA	!scll1+2
4321
 6571  FD13B4  8D D4 13      		STA	!scll2+2
4322
 6572  FD13B7  64 5C         		STZ	lptc
4323
 6573  FD13B9  EB            		xba				; A = bank
4324
 6574  FD13BA  48            		pha
4325
 6575  FD13BB  AB            		plb				; set DBR to current buffer
4326
 6576  FD13BC  A0 04         		LDY	#BNDX
4327
 6577  FD13BE  B1 5C         		lda	(lptc),y
4328
 6578  FD13C0  85 50         		STA	ebtmp
4329
 6579  FD13C2  20 B1 14      		JSR	chksel
4330
 6580  FD13C5  64 4D         		STZ	ewtmp+1			; counter 24 rows
4331
 6581  FD13C7  A6 0C         		LDX	ix4
4332
 6582                        	;P25FF:
4333
 6583  FD13C9                	scll1:
4334
 6584  FD13C9  BD FF FF      		lda	!$FFFF,x
4335
 6585  FD13CC  F0 C6         		beq	sclr3
4336
 6586  FD13CE  A0 00         		LDY	#$00
4337
 6587  FD13D0  84 4E         		STY	ewtmp2
4338
 6588                        	;P260A:
4339
 6589  FD13D2                	scll2:
4340
 6590  FD13D2  BD FF FF      		lda	!$FFFF,x
4341
  Tue Jul 17 11:00:22 2018                                                                                               Page   71
4342
 
4343
 
4344
 
4345
 
4346
 6591  FD13D5  C9 0D         		CMP	#$0D
4347
 6592  FD13D7  D0 0A         		BNE	?05
4348
 6593  FD13D9  A5 4E         		lda	ewtmp2
4349
 6594  FD13DB  D0 19         		BNE	?07a
4350
 6595  FD13DD  A9 20         		LDA	#' '
4351
 6596  FD13DF  85 4C         		sta	ewtmp
4352
 6597  FD13E1  80 13         	?04:	bra	?07a
4353
 6598  FD13E3  C4 1F         	?05:	CPY	ecol
4354
 6599  FD13E5  D0 04         		BNE	?06
4355
 6600  FD13E7  85 4C         		sta	ewtmp
4356
 6601  FD13E9  E6 4E         		INC	ewtmp2
4357
 6602  FD13EB  E4 50         	?06:	CPX	ebtmp
4358
 6603  FD13ED  D0 03         		BNE	?07
4359
 6604  FD13EF  20 3D 14      		JSR	setscrp
4360
 6605  FD13F2  E8            	?07:	INX
4361
 6606  FD13F3  C8            		INY
4362
 6607  FD13F4  80 DC         		bra	scll2
4363
 6608  FD13F6  E4 50         	?07a:	CPX	ebtmp
4364
 6609  FD13F8  D0 03         		BNE	?08
4365
 6610  FD13FA  20 3D 14      		JSR	setscrp
4366
 6611  FD13FD  E8            	?08:	INX
4367
 6612  FD13FE  A9 01         		lda	#^TXTADDR		; move right text and attributes
4368
 6613  FD1400  8B            		phb
4369
 6614  FD1401  48            		pha
4370
 6615  FD1402  AB            		plb
4371
 6616  FD1403  A0 50         		ldy	#MAXCOLS
4372
 6617  FD1405  88            	?09:	dey
4373
 6618  FD1406  88            		dey
4374
 6619  FD1407  30 0D         		bmi	?10
4375
 6620  FD1409  B1 34         		lda	(stxtp),y
4376
 6621  FD140B  EB            		xba
4377
 6622  FD140C  B1 38         		lda	(sattp),y		; A = attribute, B = text
4378
 6623  FD140E  C8            		iny
4379
 6624  FD140F  91 38         		sta	(sattp),y
4380
 6625  FD1411  EB            		xba
4381
 6626  FD1412  91 34         		sta	(stxtp),y
4382
 6627  FD1414  80 EF         		bra	?09
4383
 6628  FD1416  C8            	?10:	iny
4384
 6629  FD1417  A5 4C         		lda	ewtmp
4385
 6630  FD1419  91 34         		sta	(stxtp),y
4386
 6631  FD141B  A5 3B         		lda	eattr			; editor attribute
4387
 6632  FD141D  20 E3 14      		JSR	tglrev			; check reverse bit
4388
 6633  FD1420  91 38         		sta	(sattp),y
4389
 6634  FD1422  AB            		plb
4390
 6635  FD1423                		ACC16CLC
4391
 6636  FD1423  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4392
 6637                        		.LONGA	on
4393
 6638                        		.MNLIST
4394
 6639  FD1425  A5 34         		LDA	stxtp
4395
 6640  FD1427  69 50 00      		ADC	#MAXCOLS
4396
 6641  FD142A  85 34         		STA	stxtp
4397
 6642  FD142C  09 00 08      		ora	#!TXTATTR
4398
 6643  FD142F  85 38         		sta	sattp
4399
 6644  FD1431                		ACC08
4400
 6645  FD1431  E2 20         		sep	#PMFLAG
4401
 6646                        		.LONGA	off
4402
 6647                        		.MNLIST
4403
  Tue Jul 17 11:00:22 2018                                                                                               Page   72
4404
 
4405
 
4406
 
4407
 
4408
 6648  FD1433  E6 4D         		INC	ewtmp+1
4409
 6649  FD1435  A5 4D         		LDA	ewtmp+1
4410
 6650  FD1437  C9 18         		CMP	#$18
4411
 6651  FD1439  D0 8E         		bne	scll1
4412
 6652  FD143B  AB            		plb
4413
 6653  FD143C  60            		RTS
4414
 6654
4415
 6655                        	; set scroll routine pointers
4416
 6656                        	; this routine change DBR
4417
 6657                        	; P25AF:
4418
 6658  FD143D                	setscrp:
4419
 6659  FD143D  5A            		phy
4420
 6660  FD143E                		ACC16
4421
 6661  FD143E  C2 20         		rep	#PMFLAG
4422
 6662                        		.LONGA	on
4423
 6663                        		.MNLIST
4424
 6664  FD1440  A7 5C         		lda	[lptc]
4425
 6665  FD1442  85 5D         		STA	lptc+1			; B = bank, A = page
4426
 6666  FD1444                		ACC08
4427
 6667  FD1444  E2 20         		sep	#PMFLAG
4428
 6668                        		.LONGA	off
4429
 6669                        		.MNLIST
4430
 6670  FD1446  4B            		phk
4431
 6671  FD1447  AB            		plb				; DBR = PBR
4432
 6672  FD1448  8D 24 13      		STA	!sclr1+2
4433
 6673  FD144B  8D 2D 13      		STA	!sclr2+2
4434
 6674  FD144E  8D CB 13      		STA	!scll1+2
4435
 6675  FD1451  8D D4 13      		STA	!scll2+2
4436
 6676  FD1454  EB            		xba				; A = buffer bank
4437
 6677  FD1455  48            		pha
4438
 6678  FD1456  AB            		plb				; DBR = buffer bank
4439
 6679  FD1457  A0 04         		LDY	#BNDX
4440
 6680  FD1459  B1 5C         		lda	(lptc),y
4441
 6681  FD145B  85 50         		STA	ebtmp
4442
 6682  FD145D  BB            		tyx
4443
 6683  FD145E  7A            		ply
4444
 6684  FD145F  60            		rts
4445
 6685
4446
 6686                        	; set update routine pointers
4447
 6687                        	; this routine change DBR
4448
 6688                        	; in:	A = bank, X = page, Y = index
4449
 6689                        	; out: X = index
4450
 6690                        	; P2751:
4451
 6691  FD1460                	setptr:
4452
 6692  FD1460  4B            		phk
4453
 6693  FD1461  AB            		plb				; DBR = PBR
4454
 6694  FD1462  64 5C         		STZ	lptc
4455
 6695  FD1464  85 5E         		STA	lptc+2
4456
 6696  FD1466  9C 6A 12      		STZ	!updrow+1
4457
 6697  FD1469  9C 85 12      		STZ	!updr1+1
4458
 6698  FD146C  9C 9B 12      		STZ	!updr2+1
4459
 6699  FD146F  9C AE 12      		STZ	!updr3+1
4460
 6700  FD1472  86 5D         		STX	lptc+1
4461
 6701  FD1474  8E 6B 12      		STX	updrow+2
4462
 6702  FD1477  8E 86 12      		STX	updr1+2
4463
 6703  FD147A  8E 9C 12      		STX	updr2+2
4464
 6704  FD147D  8E AF 12      		STX	updr3+2
4465
  Tue Jul 17 11:00:22 2018                                                                                               Page   73
4466
 
4467
 
4468
 
4469
 
4470
 6705  FD1480  BB            		TYX
4471
 6706  FD1481  48            		pha
4472
 6707  FD1482  AB            		plb				; DBR = buffer bank
4473
 6708  FD1483  85 40         		sta	sbank			; save bank
4474
 6709  FD1485  A0 04         		LDY	#BNDX
4475
 6710  FD1487  B1 5C         		lda	(lptc),y
4476
 6711  FD1489  85 51         		STA	ebtmp2
4477
 6712  FD148B  60            		RTS
4478
 6713
4479
 6714                        	; update routine pointers to start of a block
4480
 6715                        	; this routine change DBR
4481
 6716                        	; out: X = index
4482
 6717                        	; P282A:
4483
 6718  FD148C                	updptr:
4484
 6719  FD148C  5A            		phy
4485
 6720  FD148D                		ACC16
4486
 6721  FD148D  C2 20         		rep	#PMFLAG
4487
 6722                        		.LONGA	on
4488
 6723                        		.MNLIST
4489
 6724  FD148F  A7 5C         		lda	[lptc]
4490
 6725  FD1491  85 5D         		STA	lptc+1			; B = bank, A = page
4491
 6726  FD1493                		ACC08
4492
 6727  FD1493  E2 20         		sep	#PMFLAG
4493
 6728                        		.LONGA	off
4494
 6729                        		.MNLIST
4495
 6730  FD1495  4B            		phk
4496
 6731  FD1496  AB            		plb				; DBR = PBR
4497
 6732  FD1497  8D 6B 12      		STA	!updrow+2
4498
 6733  FD149A  8D 86 12      		STA	!updr1+2
4499
 6734  FD149D  8D 9C 12      		STA	!updr2+2
4500
 6735  FD14A0  8D AF 12      		STA	!updr3+2
4501
 6736  FD14A3  EB            		xba				; A = buffer bank
4502
 6737  FD14A4  48            		pha
4503
 6738  FD14A5  AB            		plb				; DBR = buffer bank
4504
 6739  FD14A6  85 40         		sta	sbank			; save bank
4505
 6740  FD14A8  A0 04         		LDY	#BNDX
4506
 6741  FD14AA  B1 5C         		lda	(lptc),y
4507
 6742  FD14AC  85 51         		STA	ebtmp2
4508
 6743  FD14AE  BB            		tyx
4509
 6744  FD14AF  7A            		ply
4510
 6745  FD14B0  60            		rts
4511
 6746
4512
 6747                        	; check selected text range in screen row's
4513
 6748                        	; rsctl is starting selection screen row
4514
 6749                        	; rscth is ending selection screen row
4515
 6750                        	; P2693:
4516
 6751  FD14B1                	chksel:
4517
 6752  FD14B1  A5 23         		LDA	fslct
4518
 6753  FD14B3  F0 2D         		BEQ	?03
4519
 6754  FD14B5  A5 25         		LDA	nslcth			; if negative range
4520
 6755  FD14B7  30 14         		BMI	?02
4521
 6756  FD14B9  A5 20         		LDA	srow
4522
 6757  FD14BB  85 2B         		STA	rslcth
4523
 6758  FD14BD  38            		SEC
4524
 6759  FD14BE  E5 24         		SBC	nslctl
4525
 6760  FD14C0  85 2A         		STA	rslctl
4526
 6761  FD14C2  A9 00         		LDA	#$00
4527
  Tue Jul 17 11:00:22 2018                                                                                               Page   74
4528
 
4529
 
4530
 
4531
 
4532
 6762  FD14C4  E5 25         		SBC	nslcth
4533
 6763  FD14C6  10 04         		BPL	?01
4534
 6764  FD14C8  A9 00         		LDA	#$00
4535
 6765  FD14CA  85 2A         		STA	rslctl
4536
 6766  FD14CC  60            	?01:	rts
4537
 6767  FD14CD  A5 20         	?02:	LDA	srow
4538
 6768  FD14CF  1A            		inc	a
4539
 6769  FD14D0  85 2A         		sta	rslctl
4540
 6770  FD14D2  38            		SEC
4541
 6771  FD14D3  E5 24         		SBC	nslctl
4542
 6772  FD14D5  1A            		inc	a
4543
 6773  FD14D6  85 2B         		sta	rslcth
4544
 6774  FD14D8  A9 FF         		LDA	#$FF
4545
 6775  FD14DA  E5 25         		SBC	nslcth
4546
 6776  FD14DC  30 04         		BMI	?03
4547
 6777  FD14DE  A9 19         		LDA	#$19
4548
 6778  FD14E0  85 2B         		STA	rslcth
4549
 6779  FD14E2  60            	?03:	RTS
4550
 6780
4551
 6781                        	; invert reverse bit attribute
4552
 6782                        	; in:	A = attribute
4553
 6783                        	; P26D9:
4554
 6784  FD14E3                	tglrev:
4555
 6785  FD14E3  48            		PHA
4556
 6786  FD14E4  A5 23         		LDA	fslct
4557
 6787  FD14E6  F0 0E         		BEQ	?01
4558
 6788  FD14E8  A5 4D         		LDA	ewtmp+1			; current showed screen row
4559
 6789  FD14EA  C5 2A         		CMP	rslctl
4560
 6790  FD14EC  90 08         		BCC	?01
4561
 6791  FD14EE  C5 2B         		CMP	rslcth
4562
 6792  FD14F0  B0 04         		BCS	?01
4563
 6793  FD14F2  68            		PLA
4564
 6794  FD14F3  49 80         		EOR	#$80
4565
 6795  FD14F5  60            		rts
4566
 6796  FD14F6  68            	?01:	PLA
4567
 6797  FD14F7  60            		RTS
4568
 6798
4569
 6799                        	;-----------------------------------------------------------------
4570
 6800                        	; low level screen
4571
 6801
4572
 6802                        	; clear last text line
4573
 6803                        	; P154B:
4574
 6804  FD14F8                	clrlst:
4575
 6805  FD14F8  A2 30         		ldx	#<LSTLINE
4576
 6806  FD14FA  A9 07         		lda	#>LSTLINE
4577
 6807  FD14FC  A0 01         		ldy	#^LSTLINE
4578
 6808  FD14FE  86 5C         		stx	lptc
4579
 6809  FD1500  86 62         		stx	lptc1
4580
 6810  FD1502  85 5D         		sta	lptc+1
4581
 6811  FD1504  09 08         		ora	#>TXTATTR
4582
 6812  FD1506  85 63         		sta	lptc1+1
4583
 6813  FD1508  84 5E         		sty	lptc+2
4584
 6814  FD150A  84 64         		sty	lptc1+2
4585
 6815  FD150C  A9 20         		lda	#' '
4586
 6816  FD150E  EB            		xba
4587
 6817  FD150F  A5 3B         		lda	eattr			; A = attribute, B = blank
4588
 6818  FD1511  A0 4F         		ldy	#MAXCOLS-1
4589
  Tue Jul 17 11:00:22 2018                                                                                               Page   75
4590
 
4591
 
4592
 
4593
 
4594
 6819  FD1513  97 62         	?02:	sta	[lptc1],y		; store attribute
4595
 6820  FD1515  EB            		xba
4596
 6821  FD1516  97 5C         		sta	[lptc],y		; store blank
4597
 6822  FD1518  EB            		xba
4598
 6823  FD1519  88            		dey
4599
 6824  FD151A  10 F7         		bpl	?02
4600
 6825  FD151C  60            		rts
4601
 6826
4602
 6827                        	; set default status line attributes
4603
 6828                        	; P14C9:
4604
 6829  FD151D                	setstla:
4605
 6830  FD151D  A2 80         		ldx	#<STLATTR
4606
 6831  FD151F  A0 0F         		ldy	#>STLATTR
4607
 6832  FD1521  A9 01         		lda	#^STLATTR
4608
 6833  FD1523  86 5C         		stx	lptc
4609
 6834  FD1525  84 5D         		sty	lptc+1
4610
 6835  FD1527  85 5E         		sta	lptc+2
4611
 6836  FD1529  A5 3C         		lda	slattr			; status line attribute
4612
 6837  FD152B  A0 4F         		ldy	#MAXCOLS-1
4613
 6838  FD152D  97 5C         	?02:	sta	[lptc],y
4614
 6839  FD152F  88            		dey
4615
 6840  FD1530  10 FB         		bpl	?02
4616
 6841  FD1532  60            		rts
4617
 6842
4618
 6843                        	; set default editor attributes
4619
 6844                        	; P14D5:
4620
 6845  FD1533                	setattr:
4621
 6846  FD1533  8B            		phb
4622
 6847  FD1534                		INDEX16
4623
 6848  FD1534  C2 10         		rep	#PXFLAG
4624
 6849                        		.LONGI	on
4625
 6850                        		.MNLIST
4626
 6851  FD1536  A2 00 08      		ldx	#!TXTATTR
4627
 6852  FD1539  A9 01         		lda	#^TXTATTR
4628
 6853  FD153B  86 5C         		stx	lptc
4629
 6854  FD153D  48            		pha
4630
 6855  FD153E  AB            		plb
4631
 6856  FD153F  A5 3B         		lda	eattr			; editor attribute
4632
 6857  FD1541  A0 7F 07      		ldy	#TXTCNT-1
4633
 6858  FD1544  91 5C         	?02:	sta	(lptc),y
4634
 6859  FD1546  88            		dey
4635
 6860  FD1547  10 FB         		bpl	?02
4636
 6861  FD1549                		INDEX08
4637
 6862  FD1549  E2 10         		sep	#PXFLAG
4638
 6863                        		.LONGI	off
4639
 6864                        		.MNLIST
4640
 6865  FD154B  AB            		plb
4641
 6866  FD154C  60            		rts
4642
 6867
4643
 6868                        	; increment screen row
4644
 6869                        	; P1529:
4645
 6870  FD154D                	incrow:
4646
 6871  FD154D                		ACC16CLC
4647
 6872  FD154D  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4648
 6873                        		.LONGA	on
4649
 6874                        		.MNLIST
4650
 6875  FD154F  A5 2C         		lda	curs
4651
  Tue Jul 17 11:00:22 2018                                                                                               Page   76
4652
 
4653
 
4654
 
4655
 
4656
 6876  FD1551  69 50 00      		adc	#MAXCOLS
4657
 6877  FD1554  85 2C         		sta	curs
4658
 6878  FD1556                		ACC08
4659
 6879  FD1556  E2 20         		sep	#PMFLAG
4660
 6880                        		.LONGA	off
4661
 6881                        		.MNLIST
4662
 6882  FD1558  E6 20         		inc	srow
4663
 6883  FD155A  60            		rts
4664
 6884
4665
 6885                        	; decrement screen row
4666
 6886                        	; P153A:
4667
 6887  FD155B                	decrow:
4668
 6888  FD155B                		ACC16CLC
4669
 6889  FD155B  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4670
 6890                        		.LONGA	on
4671
 6891                        		.MNLIST
4672
 6892  FD155D  A5 2C         		lda	curs
4673
 6893  FD155F  E9 4F 00      		sbc	#MAXCOLS-1		; take account carry !
4674
 6894  FD1562  85 2C         		sta	curs
4675
 6895  FD1564                		ACC08
4676
 6896  FD1564  E2 20         		sep	#PMFLAG
4677
 6897                        		.LONGA	off
4678
 6898                        		.MNLIST
4679
 6899  FD1566  C6 20         		dec	srow
4680
 6900  FD1568  60            		rts
4681
 6901
4682
 6902                        	; reverse screen row (invert "reverse" bit)
4683
 6903                        	; P1DD3:
4684
 6904  FD1569                	revrow:
4685
 6905  FD1569                		ACC16
4686
 6906  FD1569  C2 20         		rep	#PMFLAG
4687
 6907                        		.LONGA	on
4688
 6908                        		.MNLIST
4689
 6909  FD156B  A5 34         		lda	stxtp
4690
 6910  FD156D  09 00 08      		ora	#!TXTATTR
4691
 6911  FD1570  85 38         		sta	sattp
4692
 6912  FD1572                		ACC08
4693
 6913  FD1572  E2 20         		sep	#PMFLAG
4694
 6914                        		.LONGA	off
4695
 6915                        		.MNLIST
4696
 6916  FD1574  A0 4F         		ldy	#MAXCOLS-1
4697
 6917  FD1576  B7 38         	?02:	lda	[sattp],y
4698
 6918  FD1578  49 80         		eor	#$80
4699
 6919  FD157A  97 38         		sta	[sattp],y
4700
 6920  FD157C  88            		dey
4701
 6921  FD157D  10 F7         		bpl	?02
4702
 6922  FD157F  60            		rts
4703
 6923
4704
 6924                        	; scroll down editor window (move window up one row)
4705
 6925                        	; P28BD:
4706
 6926  FD1580                	scrldown:
4707
 6927  FD1580  8B            		phb
4708
 6928  FD1581                		CPU16CLC
4709
 6929  FD1581  C2 31         		rep	#(PMFLAG.OR.PXFLAG.OR.PCFLAG)
4710
 6930                        		.LONGA	on
4711
 6931                        		.LONGI	on
4712
 6932                        		.MNLIST
4713
  Tue Jul 17 11:00:22 2018                                                                                               Page   77
4714
 
4715
 
4716
 
4717
 
4718
 6933  FD1583  A9 00 00      		lda	#!TXTADDR
4719
 6934  FD1586  AA            		tax
4720
 6935  FD1587  85 5C         		sta	lptc
4721
 6936  FD1589  69 50 00      		adc	#MAXCOLS
4722
 6937  FD158C  85 5F         		sta	lpte
4723
 6938  FD158E  8A            		txa
4724
 6939  FD158F  09 00 08      		ora	#!TXTATTR
4725
 6940  FD1592  85 62         		sta	lptc1
4726
 6941  FD1594  69 50 00      		adc	#MAXCOLS
4727
 6942  FD1597  85 65         		sta	lpte1
4728
 6943  FD1599                		CPU08
4729
 6944  FD1599  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
4730
 6945                        		.LONGA	off
4731
 6946                        		.LONGI	off
4732
 6947                        		.MNLIST
4733
 6948  FD159B  A9 01         		lda	#^TXTADDR
4734
 6949  FD159D  48            		pha
4735
 6950  FD159E  AB            		plb
4736
 6951  FD159F  A2 17         		ldx	#$17			; move 23 rows
4737
 6952  FD15A1  A0 4F         	?02:	ldy	#MAXCOLS-1
4738
 6953  FD15A3  B1 5F         	?04:	lda	(lpte),y
4739
 6954  FD15A5  91 5C         		sta	(lptc),y
4740
 6955  FD15A7  B1 65         		lda	(lpte1),y
4741
 6956  FD15A9  91 62         		sta	(lptc1),y
4742
 6957  FD15AB  88            		dey
4743
 6958  FD15AC  10 F5         		bpl	?04
4744
 6959  FD15AE                		ACC16CLC
4745
 6960  FD15AE  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4746
 6961                        		.LONGA	on
4747
 6962                        		.MNLIST
4748
 6963  FD15B0  A5 5F         		lda	lpte
4749
 6964  FD15B2  85 5C         		sta	lptc
4750
 6965  FD15B4  69 50 00      		adc	#MAXCOLS
4751
 6966  FD15B7  85 5F         		sta	lpte
4752
 6967  FD15B9  A5 65         		lda	lpte1
4753
 6968  FD15BB  85 62         		sta	lptc1
4754
 6969  FD15BD  69 50 00      		adc	#MAXCOLS
4755
 6970  FD15C0  85 65         		sta	lpte1
4756
 6971  FD15C2                		ACC08
4757
 6972  FD15C2  E2 20         		sep	#PMFLAG
4758
 6973                        		.LONGA	off
4759
 6974                        		.MNLIST
4760
 6975  FD15C4  CA            		dex
4761
 6976  FD15C5  D0 DA         		bne	?02
4762
 6977  FD15C7  AB            		plb
4763
 6978  FD15C8  60            		rts
4764
 6979
4765
 6980                        	; scroll up editor window (move window down one row)
4766
 6981                        	; P28F9:
4767
 6982  FD15C9                	scrlup:
4768
 6983  FD15C9  8B            		phb
4769
 6984  FD15CA                		CPU16CLC
4770
 6985  FD15CA  C2 31         		rep	#(PMFLAG.OR.PXFLAG.OR.PCFLAG)
4771
 6986                        		.LONGA	on
4772
 6987                        		.LONGI	on
4773
 6988                        		.MNLIST
4774
 6989  FD15CC  A9 30 07      		lda	#!LSTLINE
4775
  Tue Jul 17 11:00:22 2018                                                                                               Page   78
4776
 
4777
 
4778
 
4779
 
4780
 6990  FD15CF  85 5C         		sta	lptc
4781
 6991  FD15D1  AA            		tax
4782
 6992  FD15D2  E9 4F 00      		sbc	#MAXCOLS-1		; take account of CF = 0 !
4783
 6993  FD15D5  85 5F         		sta	lpte
4784
 6994  FD15D7  8A            		txa
4785
 6995  FD15D8  09 00 08      		ora	#!TXTATTR
4786
 6996  FD15DB  85 62         		sta	lptc1
4787
 6997  FD15DD  E9 50 00      		sbc	#MAXCOLS		; now CF = 1 !
4788
 6998  FD15E0  85 65         		sta	lpte1
4789
 6999  FD15E2                		CPU08
4790
 7000  FD15E2  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
4791
 7001                        		.LONGA	off
4792
 7002                        		.LONGI	off
4793
 7003                        		.MNLIST
4794
 7004  FD15E4  A9 01         		lda	#^LSTLINE
4795
 7005  FD15E6  48            		pha
4796
 7006  FD15E7  AB            		plb
4797
 7007  FD15E8  A2 17         		ldx	#$17			; move 23 rows
4798
 7008  FD15EA  A0 4F         	?02:	ldy	#MAXCOLS-1
4799
 7009  FD15EC  B1 5F         	?04:	lda	(lpte),y
4800
 7010  FD15EE  91 5C         		sta	(lptc),y
4801
 7011  FD15F0  B1 65         		lda	(lpte1),y
4802
 7012  FD15F2  91 62         		sta	(lptc1),y
4803
 7013  FD15F4  88            		dey
4804
 7014  FD15F5  10 F5         		bpl	?04
4805
 7015  FD15F7                		ACC16CLC
4806
 7016  FD15F7  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
4807
 7017                        		.LONGA	on
4808
 7018                        		.MNLIST
4809
 7019  FD15F9  A5 5F         		lda	lpte
4810
 7020  FD15FB  85 5C         		sta	lptc
4811
 7021  FD15FD  E9 4F 00      		sbc	#MAXCOLS-1		; take account carry !
4812
 7022  FD1600  85 5F         		sta	lpte
4813
 7023  FD1602  A5 65         		lda	lpte1
4814
 7024  FD1604  85 62         		sta	lptc1
4815
 7025  FD1606  E9 50 00      		sbc	#MAXCOLS		; now CF = 1 !
4816
 7026  FD1609  85 65         		sta	lpte1
4817
 7027  FD160B                		ACC08
4818
 7028  FD160B  E2 20         		sep	#PMFLAG
4819
 7029                        		.LONGA	off
4820
 7030                        		.MNLIST
4821
 7031  FD160D  CA            		dex
4822
 7032  FD160E  D0 DA         		bne	?02
4823
 7033  FD1610  AB            		plb
4824
 7034  FD1611  60            		rts
4825
 7035
4826
 7036                        	; wait for <enter> key pressed
4827
 7037                        	; in:	Y - column in last screen row
4828
 7038                        	; X preserved
4829
 7039  FD1612                	waitent:
4830
 7040  FD1612  DA            		phx
4831
 7041  FD1613  A2 00         		ldx	#0
4832
 7042  FD1615  BF 5D 20 FD   	?02:	lda	>strent,x
4833
 7043  FD1619  F0 0A         		beq	?04
4834
 7044  FD161B  C0 50         		cpy	#MAXCOLS		; not above limit
4835
 7045  FD161D  B0 06         		bcs	?04
4836
 7046  FD161F  97 34         		sta	[stxtp],y
4837
  Tue Jul 17 11:00:22 2018                                                                                               Page   79
4838
 
4839
 
4840
 
4841
 
4842
 7047  FD1621  E8            		inx
4843
 7048  FD1622  C8            		iny
4844
 7049  FD1623  D0 F0         		bne	?02
4845
 7050  FD1625  FA            	?04:	plx
4846
 7051
4847
 7052  FD1626                	waitent2:
4848
 7053  FD1626  20 90 16      		jsr	slgkey			; wait key pressed
4849
 7054  FD1629  B0 FB         		bcs	waitent2		; control key
4850
 7055  FD162B  EB            		xba				; ALT,CTL,SHIFT
4851
 7056  FD162C  D0 F8         		bne	waitent2		; will be no pressed
4852
 7057  FD162E  EB            		xba
4853
 7058  FD162F  C9 0D         		cmp	#$0D
4854
 7059  FD1631  D0 F3         		bne	waitent2
4855
 7060  FD1633  60            		rts
4856
 7061
4857
 7062                        	; put string in status line row (last screen row)
4858
 7063                        	; in:	A - attribute
4859
 7064                        	;	X - string number # (if $FF is cbm disk error)
4860
 7065                        	; out:	Y - next available column in last row
4861
 7066  FD1634                	msgstr:
4862
 7067  FD1634  EB            		xba				; B = attribute
4863
 7068  FD1635  E0 FF         		cpx	#$FF
4864
 7069  FD1637  D0 08         		bne	?01
4865
 7070  FD1639  A2 50         		ldx	#<EDDSKERR
4866
 7071  FD163B  A0 CC         		ldy	#>EDDSKERR
4867
 7072  FD163D  A9 01         		lda	#^EDDSKERR
4868
 7073  FD163F  80 13         		bra	outstr
4869
 7074  FD1641  E0 09         	?01:	cpx	#MAXSTR
4870
 7075  FD1643  90 02         		bcc	?02
4871
 7076  FD1645  A2 00         		ldx	#0			; blank string
4872
 7077  FD1647  BF 4B 20 FD   	?02:	lda	STRTBLL,x		; take string address
4873
 7078  FD164B  48            		pha
4874
 7079  FD164C  BF 54 20 FD   		lda	STRTBLH,x
4875
 7080  FD1650  A8            		tay				; Y = high address
4876
 7081  FD1651  FA            		plx				; X = low  address
4877
 7082  FD1652  A9 FD         		lda	#^str01			; A = bank address
4878
 7083  FD1654
4879
 7084                        	; out string in status line (last screen row)
4880
 7085                        	; in:	X,Y,A - address of string
4881
 7086                        	;	B - attribute
4882
 7087                        	; out:	Y - next available column in last row
4883
 7088                        	; P284A:
4884
 7089  FD1654                	outstr:
4885
 7090  FD1654  86 5C         		stx	lptc			; store string address
4886
 7091  FD1656  84 5D         		sty	lptc+1
4887
 7092  FD1658  85 5E         		sta	lptc+2
4888
 7093  FD165A  EB            		xba				; attribute
4889
 7094  FD165B  AA            		tax				; X = attribute
4890
 7095  FD165C                		ACC16
4891
 7096  FD165C  C2 20         		rep	#PMFLAG
4892
 7097                        		.LONGA	on
4893
 7098                        		.MNLIST
4894
 7099  FD165E  A9 80 07      		lda	#!STLINE		; store address of last screen row
4895
 7100  FD1661  85 34         		sta	stxtp
4896
 7101  FD1663  A9 80 0F      		lda	#!STLATTR
4897
 7102  FD1666  85 38         		sta	sattp
4898
 7103  FD1668                		ACC08
4899
  Tue Jul 17 11:00:22 2018                                                                                               Page   80
4900
 
4901
 
4902
 
4903
 
4904
 7104  FD1668  E2 20         		sep	#PMFLAG
4905
 7105                        		.LONGA	off
4906
 7106                        		.MNLIST
4907
 7107  FD166A  A0 00         		ldy	#0			; out string
4908
 7108  FD166C  B7 5C         	?02:	lda	[lptc],y
4909
 7109  FD166E  F0 0C         		beq	?04
4910
 7110  FD1670  C0 50         		cpy	#MAXCOLS		; not above limit
4911
 7111  FD1672  B0 1B         		bcs	?10
4912
 7112  FD1674  97 34         		sta	[stxtp],y
4913
 7113  FD1676  8A            		txa
4914
 7114  FD1677  97 38         		sta	[sattp],y
4915
 7115  FD1679  C8            		iny
4916
 7116  FD167A  D0 F0         		bne	?02
4917
 7117  FD167C  5A            	?04:	phy
4918
 7118  FD167D  A9 20         		lda	#' '			; pad row with blanks
4919
 7119  FD167F  EB            		xba
4920
 7120  FD1680  8A            		txa				; A = attribute, B = blank
4921
 7121  FD1681  C0 50         	?06:	cpy	#MAXCOLS
4922
 7122  FD1683  B0 09         		bcs	?08
4923
 7123  FD1685  97 38         		sta	[sattp],y
4924
 7124  FD1687  EB            		xba
4925
 7125  FD1688  97 34         		sta	[stxtp],y
4926
 7126  FD168A  EB            		xba
4927
 7127  FD168B  C8            		iny
4928
 7128  FD168C  D0 F3         		bne	?06
4929
 7129  FD168E  7A            	?08:	ply
4930
 7130  FD168F  60            	?10:	rts
4931
 7131
4932
 7132                        	; get key for command line/status line
4933
 7133                        	; in:	X - number of keys stored
4934
 7134                        	;	Y - column
4935
 7135                        	; out:	A = key code
4936
 7136                        	;	B = flag ALT, CTL, SHIFT
4937
 7137                        	;	CF = 1 if control key
4938
 7138                        	; X,Y preserved
4939
 7139                        	; P1BBE:
4940
 7140  FD1690                	slgkey:
4941
 7141  FD1690  20 D1 16      		jsr	slcurs			; set cursor position
4942
 7142  FD1693  20 C6 16      		jsr	showcurs		; show cursor
4943
 7143  FD1696                	?02:	KBGETIN				; system call - get key
4944
 7144  FD1696  02 17         		cop	$17
4945
 7145                        		.MNLIST
4946
 7146  FD1698  C9 00         		cmp	#0
4947
 7147  FD169A  F0 FA         		beq	?02			; loop -- wait pressed key
4948
 7148  FD169C  C9 20         		cmp	#' '
4949
 7149  FD169E  D0 05         		bne	?04			; no blank key
4950
 7150  FD16A0  8A            		txa
4951
 7151  FD16A1  F0 F3         		beq	?02			; skip beginning blanks
4952
 7152  FD16A3  A9 20         		lda	#' '
4953
 7153  FD16A5  85 6A         	?04:	sta	tmpe			; store key code
4954
 7154  FD16A7  EB            		xba
4955
 7155  FD16A8  85 6B         		sta	tmpf			; store control key flag
4956
 7156  FD16AA  20 BB 16      		jsr	hidecurs
4957
 7157  FD16AD  AF 64 01 00   		lda	>DP01ADDR+KbdFlag
4958
 7158  FD16B1  EB            		xba				; B = flag ALT, CTL, SHIFT
4959
 7159  FD16B2  18            		clc
4960
 7160  FD16B3  A5 6A         		lda	tmpe			; key code
4961
  Tue Jul 17 11:00:22 2018                                                                                               Page   81
4962
 
4963
 
4964
 
4965
 
4966
 7161  FD16B5  24 6B         		bit	tmpf
4967
 7162  FD16B7  10 01         		bpl	?06
4968
 7163  FD16B9  38            		sec				; control key
4969
 7164  FD16BA  60            	?06:	rts
4970
 7165
4971
 7166                        	; hide cursor
4972
 7167  FD16BB                	hidecurs:
4973
 7168  FD16BB  A9 10         		lda	#$10			; bit PB4 = 1
4974
 7169  FD16BD  0F 76 FC 00   		ora	>PIAVBB+PIAPRB
4975
 7170  FD16C1  8F 76 FC 00   		sta	>PIAVBB+PIAPRB
4976
 7171  FD16C5  60            		rts
4977
 7172
4978
 7173                        	; show cursor
4979
 7174  FD16C6                	showcurs:
4980
 7175  FD16C6  AF 76 FC 00   		lda	>PIAVBB+PIAPRB
4981
 7176  FD16CA  29 EF         		and	#$EF			; bit PB4 = 0
4982
 7177  FD16CC  8F 76 FC 00   		sta	>PIAVBB+PIAPRB
4983
 7178  FD16D0  60            		rts
4984
 7179
4985
 7180                        	; set position of cursor in status line row
4986
 7181                        	; in:	Y = column
4987
 7182                        	; X,Y preserved
4988
 7183  FD16D1                	slcurs:
4989
 7184  FD16D1  18            		clc
4990
 7185  FD16D2  A9 0E         		lda	#$0E
4991
 7186  FD16D4  8F 70 FC 00   		sta	>CRTAddr
4992
 7187  FD16D8  98            		tya
4993
 7188  FD16D9  65 34         		adc	stxtp
4994
 7189  FD16DB  EB            		xba
4995
 7190  FD16DC  A5 35         		lda	stxtp+1
4996
 7191  FD16DE  80 0D         		bra	pcurs
4997
 7192
4998
 7193                        	; set position of cursor in edit window
4999
 7194                        	; in:	Y = column
5000
 7195                        	; X,Y preserved
5001
 7196  FD16E0                	edcurs:
5002
 7197  FD16E0  18            		clc
5003
 7198  FD16E1  A9 0E         		lda	#$0E
5004
 7199  FD16E3  8F 70 FC 00   		sta	>CRTAddr
5005
 7200  FD16E7  98            		tya
5006
 7201  FD16E8  65 2C         		adc	curs
5007
 7202  FD16EA  EB            		xba
5008
 7203  FD16EB  A5 2D         		lda	curs+1
5009
 7204  FD16ED
5010
 7205  FD16ED                	pcurs:
5011
 7206  FD16ED  69 00         		adc	#0
5012
 7207  FD16EF  8F 71 FC 00   		sta	>CRTData
5013
 7208  FD16F3  A9 0F         		lda	#$0F
5014
 7209  FD16F5  8F 70 FC 00   		sta	>CRTAddr
5015
 7210  FD16F9  EB            		xba
5016
 7211  FD16FA  8F 71 FC 00   		sta	>CRTData
5017
 7212  FD16FE  60            		rts
5018
 7213
5019
 7214                        	; set default cursor mode basis cursmode value
5020
 7215  FD16FF                	setcurs:
5021
 7216  FD16FF  A9 0B         		lda	#$0B			; set 'end scan line' register
5022
 7217  FD1701  8F 70 FC 00   		sta	>CRTAddr
5023
  Tue Jul 17 11:00:22 2018                                                                                               Page   82
5024
 
5025
 
5026
 
5027
 
5028
 7218  FD1705  A9 0F         		lda	#$0F			; end at last line
5029
 7219  FD1707  8F 71 FC 00   		sta	>CRTData
5030
 7220  FD170B  A9 0A         		lda	#$0A			; set 'start scan line' register
5031
 7221  FD170D  8F 70 FC 00   		sta	>CRTAddr
5032
 7222  FD1711  A9 00         		lda	#$00			; block cursor: start scan line = 0
5033
 7223  FD1713  24 2E         		bit	cursmode		; check bit <6>
5034
 7224  FD1715  50 02         		bvc	?02			; block cursor
5035
 7225  FD1717  A9 0F         		lda	#$0F			; under line cursor: start = end
5036
 7226  FD1719  8F 71 FC 00   	?02:	sta	>CRTData
5037
 7227  FD171D  AF 76 FC 00   		lda	>PIAVBB+PIAPRB
5038
 7228  FD1721  29 FB         		and	#$FB			; mask PB2
5039
 7229  FD1723  24 2E         		bit	cursmode		; check bit <7>
5040
 7230  FD1725  10 02         		bpl	?04			; fixed cursor => PB2 = 0
5041
 7231  FD1727  09 04         		ora	#$04			; blink cursor => PB2 = 1
5042
 7232  FD1729  8F 76 FC 00   	?04:	sta	>PIAVBB+PIAPRB
5043
 7233  FD172D  60            		rts
5044
 7234
5045
 7235                        	;---------------------------------------------------------------------
5046
 7236                        	; COMMAND LINE
5047
 7237  FD172E
5048
 7238                        	; input comand string in EDBUFLIN
5049
 7239                        	; in:	X,Y,A - address of prompt string
5050
 7240                        	; P1AF9:
5051
 7241  FD172E                	inputstr:
5052
 7242  FD172E  86 DA         		stx	longp
5053
 7243  FD1730  84 DB         		sty	longp+1
5054
 7244  FD1732  85 DC         		sta	longp+2
5055
 7245  FD1734  A9 C0         		lda	#$C0
5056
 7246  FD1736  85 3F         		sta	slfg		; status line input mode
5057
 7247  FD1738  A9 00         	?lp:	lda	#0		; input loop
5058
 7248  FD173A  8F 50 CC 01   		sta	>EDBUFLIN
5059
 7249  FD173E  A5 3E         		lda	scatt
5060
 7250  FD1740  EB            		xba			; attribute
5061
 7251  FD1741  A6 DA         		ldx	longp
5062
 7252  FD1743  A4 DB         		ldy	longp+1
5063
 7253  FD1745  A5 DC         		lda	longp+2
5064
 7254  FD1747  20 54 16      		jsr	outstr		; print prompt
5065
 7255  FD174A  A2 00         		ldx	#0		; buffer index
5066
 7256  FD174C  20 90 16      	?get:	jsr	slgkey		; get key
5067
 7257  FD174F  90 13         		bcc	?key		; no control key
5068
 7258  FD1751  C9 8E         		cmp	#KB_DELETE	; <DELETE> clear all input field
5069
 7259  FD1753  F0 E3         		beq	?lp		; restart input
5070
 7260  FD1755  C9 90         		cmp	#KB_BACKSPACE
5071
 7261  FD1757  D0 F3         		bne	?get		; discard others control keys
5072
 7262  FD1759  8A            		txa
5073
 7263  FD175A  F0 F0         		beq	?get		; at first column do nothing
5074
 7264  FD175C  CA            		dex			; decrement index and column
5075
 7265  FD175D  88            		dey
5076
 7266  FD175E  A9 20         		lda	#' '		; put blank at column
5077
 7267  FD1760  97 34         		sta	[stxtp],y
5078
 7268  FD1762  80 E8         		bra	?get		; continue input
5079
 7269  FD1764  EB            	?key:	xba			; check flag
5080
 7270  FD1765  89 C0         		bit	#(AALTB.OR.ACTRLB)
5081
 7271  FD1767  D0 E3         		bne	?get		; discard alt/ctl keys but shift
5082
 7272  FD1769  EB            		xba
5083
 7273  FD176A  C9 1B         		cmp	#KB_ESC		; <ESC> exit from command line
5084
 7274  FD176C  F0 30         		beq	?ret		; exit with CF=1
5085
  Tue Jul 17 11:00:22 2018                                                                                               Page   83
5086
 
5087
 
5088
 
5089
 
5090
 7275  FD176E  C9 0D         		cmp	#KB_CR		; <ENTER> terminate input line
5091
 7276  FD1770  F0 16         		beq	?end
5092
 7277  FD1772  C9 20         		cmp	#' '
5093
 7278  FD1774  90 D6         		bcc	?get		; discard no-printables
5094
 7279  FD1776  C9 7F         		cmp	#$7F
5095
 7280  FD1778  B0 D2         		bcs	?get
5096
 7281  FD177A  C0 4F         		cpy	#MAXCOLS-1	; no store above max. column
5097
 7282  FD177C  B0 CE         		bcs	?get
5098
 7283  FD177E  97 34         		sta	[stxtp],y	; print char at column
5099
 7284  FD1780  9F 50 CC 01   		sta	>EDBUFLIN,x	; store char at index
5100
 7285  FD1784  C8            		iny
5101
 7286  FD1785  E8            		inx
5102
 7287  FD1786  80 C4         		bra	?get		; continue input
5103
 7288  FD1788  8A            	?end:	txa			; current index
5104
 7289  FD1789  F0 AD         		beq	?lp		; empty string: restart
5105
 7290  FD178B  CA            	?trm:	dex			; trim blanks
5106
 7291  FD178C  30 AA         		bmi	?lp		; restart
5107
 7292  FD178E  BF 50 CC 01   		lda	>EDBUFLIN,x
5108
 7293  FD1792  C9 20         		cmp	#' '
5109
 7294  FD1794  F0 F5         		beq	?trm
5110
 7295  FD1796  E8            		inx
5111
 7296  FD1797  A9 00         		lda	#0
5112
 7297  FD1799  9F 50 CC 01   		sta	>EDBUFLIN,x	; terminate input
5113
 7298  FD179D  18            		clc			; exit with CF=0
5114
 7299  FD179E  60            	?ret:	rts
5115
 7300
5116
 7301  FD179F                	cmdline:
5117
 7302  FD179F  A2 AD         		ldx	#<CMDSTR
5118
 7303  FD17A1  A0 17         		ldy	#>CMDSTR
5119
 7304  FD17A3  A9 FD         		lda	#^CMDSTR
5120
 7305  FD17A5  20 2E 17      		jsr	inputstr
5121
 7306  FD17A8  A9 80         		lda	#$80
5122
 7307  FD17AA  14 3F         		trb	slfg
5123
 7308  FD17AC  60            		rts
5124
 7309
5125
 7310  FD17AD                	CMDSTR:
5126
 7311  FD17AD  43 4D 44 3A 20 		.DB	'CMD: ',0
5127
               00
5128
 7312
5129
 7313                        	;---------------------------------------------------------------------
5130
 7314
5131
 7315                        	; entry point (DBR and DP set by caller)
5132
 7316                        	;
5133
 7317                        	; stack frame
5134
 7318                        	;
5135
 7319                        	;	---------
5136
 7320                        	;	|  ...  |	0F
5137
 7321                        	;	---------
5138
 7322                        	;	|  DPH  |	06
5139
 7323                        	;	---------
5140
 7324                        	;	|  DPL  |	05
5141
 7325                        	;	---------
5142
 7326                        	;	|  DBR  |	04
5143
 7327                        	;	---------
5144
 7328                        	;	|  PBR  |	03
5145
 7329                        	;	---------
5146
 7330                        	;	|  PCH  |	02
5147
  Tue Jul 17 11:00:22 2018                                                                                               Page   84
5148
 
5149
 
5150
 
5151
 
5152
 7331                        	;	---------
5153
 7332                        	;	|  PCL  |	01
5154
 7333                        	;	---------
5155
 7334
5156
 7335          000001        	STKPCL		.SET	$01
5157
 7336          000002        	STKPCH		.SET	$02
5158
 7337          000003        	STKPBR		.SET	$03	; caller return address
5159
 7338          000004        	STKDBR		.SET	$04	; DBR for called procedure
5160
 7339          000005        	STKDP		.SET	$05	; DP for called procedure
5161
 7340
5162
 7341                        		.PUBLIC qedtent
5163
 7342
5164
 7343
5165
 7344  FD17B3                	qedtent:
5166
 7345  FD17B3  08            		php			; save M/X status
5167
 7346  FD17B4                		CPU08
5168
 7347  FD17B4  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
5169
 7348                        		.LONGA	off
5170
 7349                        		.LONGI	off
5171
 7350                        		.MNLIST
5172
 7351  FD17B6  8B            		phb
5173
 7352  FD17B7  0B            		phd			; frame stack +4
5174
 7353  FD17B8  F4 00 40      		pea	#$4000
5175
 7354  FD17BB  2B            		pld
5176
 7355  FD17BC  48            		pha
5177
 7356  FD17BD  DA            		phx
5178
 7357  FD17BE  A2 00         		ldx	#$00
5179
 7358  FD17C0  74 00         	?zp:	stz	<$0,x		; clear DP memory
5180
 7359  FD17C2  E8            		inx
5181
 7360  FD17C3  D0 FB         		bne	?zp
5182
 7361  FD17C5                		INDEX16
5183
 7362  FD17C5  C2 10         		rep	#PXFLAG
5184
 7363                        		.LONGI	on
5185
 7364                        		.MNLIST
5186
 7365  FD17C7  A2 FF 37      		ldx	#(EDWRKEND-EDBUFNAM-1)
5187
 7366  FD17CA  A9 00         		lda	#0
5188
 7367  FD17CC  9F 00 C8 01   	?zz:	sta	>EDBUFNAM,x
5189
 7368  FD17D0  CA            		dex
5190
 7369  FD17D1  10 F9         		bpl	?zz
5191
 7370  FD17D3                		INDEX08
5192
 7371  FD17D3  E2 10         		sep	#PXFLAG
5193
 7372                        		.LONGI	off
5194
 7373                        		.MNLIST
5195
 7374  FD17D5  86 0F         		stx	xbuf		; force buffer allocation at start
5196
 7375  FD17D7  FA            		plx
5197
 7376  FD17D8  68            		pla
5198
 7377  FD17D9  85 DA         		sta	longp		; A,X,Y : address of command line
5199
 7378  FD17DB  86 DB         		stx	longp+1
5200
 7379  FD17DD  84 DC         		sty	longp+2
5201
 7380  FD17DF  EB            		xba
5202
 7381  FD17E0  85 DD         		sta	fsmode		; mode
5203
 7382  FD17E2                		ACC16
5204
 7383  FD17E2  C2 20         		rep	#PMFLAG
5205
 7384                        		.LONGA	on
5206
 7385                        		.MNLIST
5207
 7386  FD17E4  AF 8E 00 00   		lda	>pbrklv
5208
 7387  FD17E8  85 E0         		sta	brksav
5209
  Tue Jul 17 11:00:22 2018                                                                                               Page   85
5210
 
5211
 
5212
 
5213
 
5214
 7388  FD17EA                		ACC08
5215
 7389  FD17EA  E2 20         		sep	#PMFLAG
5216
 7390                        		.LONGA	off
5217
 7391                        		.MNLIST
5218
 7392  FD17EC  20 63 1D      		jsr	crtsav
5219
 7393  FD17EF  20 15 18      		jsr	init
5220
 7394  FD17F2  20 60 1E      		jsr	chkcmd		; check command line
5221
 7395  FD17F5  20 00 00      		jsr	editor		; launch editor
5222
 7396  FD17F8  A5 41         		lda	saveps
5223
 7397  FD17FA  8F 74 FC 00   		sta	>PIAVBB+PIAPRA	; restore palette address
5224
 7398  FD17FE  20 90 1D      		jsr	crtrest
5225
 7399  FD1801  A6 32         		ldx	embit
5226
 7400  FD1803  9F 0C FC 00   		sta	>CREMEOFF,x	; restore video ram bit
5227
 7401
5228
 7402  FD1807                		ACC16
5229
 7403  FD1807  C2 20         		rep	#PMFLAG
5230
 7404                        		.LONGA	on
5231
 7405                        		.MNLIST
5232
 7406  FD1809  A5 E0         		lda	brksav
5233
 7407  FD180B  8F 8E 00 00   		sta	>pbrklv
5234
 7408  FD180F                		ACC08
5235
 7409  FD180F  E2 20         		sep	#PMFLAG
5236
 7410                        		.LONGA	off
5237
 7411                        		.MNLIST
5238
 7412
5239
 7413  FD1811  2B            		pld
5240
 7414  FD1812  AB            		plb
5241
 7415  FD1813  28            		plp
5242
 7416  FD1814  6B            		rtl
5243
 7417
5244
 7418                        	; init editor
5245
 7419                        	; P1631:
5246
 7420  FD1815                	init:
5247
 7421  FD1815  A9 40         		lda	#MINFREE
5248
 7422  FD1817  20 37 0B      		jsr	chkfree
5249
 7423  FD181A  A9 04         		lda	#DEFLTAB	; default tab value
5250
 7424  FD181C  85 19         		sta	deftab
5251
 7425  FD181E  A9 C0         		lda	#EDEFCURS	; default cursor mode edit window
5252
 7426  FD1820  85 2E         		sta	cursmode
5253
 7427  FD1822  A9 01         		lda	#^TXTADDR	; bank of video ram
5254
 7428  FD1824  85 36         		sta	stxtp+2
5255
 7429  FD1826  85 3A         		sta	sattp+2
5256
 7430  FD1828  A9 00         		lda	#DEFATTR	; default editor window attribute
5257
 7431  FD182A  85 3B         		sta	eattr
5258
 7432  FD182C  A9 01         		lda	#DEFSATTR	; default status line attribute
5259
 7433  FD182E  85 3C         		sta	slattr
5260
 7434  FD1830  A9 02         		lda	#DEFEATTR	; default error message attribute
5261
 7435  FD1832  85 3D         		sta	seatt
5262
 7436  FD1834  A9 03         		lda	#DEFCATTR	; default command line attribute
5263
 7437  FD1836  85 3E         		sta	scatt
5264
 7438  FD1838  A9 04         		lda	#DFGATTR	; disabled flag indicator attribute
5265
 7439  FD183A  85 49         		sta	fgatt
5266
 7440  FD183C  A9 40         		lda	#$40
5267
 7441  FD183E  85 3F         		sta	slfg		; update whole status line
5268
 7442  FD1840  A9 00         		lda	#0
5269
 7443  FD1842  48            		pha
5270
 7444  FD1843  AB            		plb			; DBR = 0
5271
  Tue Jul 17 11:00:22 2018                                                                                               Page   86
5272
 
5273
 
5274
 
5275
 
5276
 7445  FD1844  AE 0C FC      		ldx	CREMEOFF	; save current video ram bit
5277
 7446  FD1847  86 32         		stx	embit
5278
 7447  FD1849  8D 0D FC      		sta	!CREMEON	; enable video ram
5279
 7448  FD184C  AD 74 FC      		lda	!PIAVBB+PIAPRA	; save current palette address
5280
 7449  FD184F  85 41         		sta	saveps
5281
 7450  FD1851  09 0F         		ora	#$0F		; set palette address = 11 11XXX XXXX
5282
 7451  FD1853  8D 74 FC      		sta	!PIAVBB+PIAPRA
5283
 7452  FD1856  A9 00         		lda	#0
5284
 7453  FD1858  A8            		tay			; Y = 0
5285
 7454  FD1859  EB            		xba			; B = 0
5286
 7455  FD185A  A9 F0         		lda	#$F0		; set base address palette
5287
 7456  FD185C                		CPU16
5288
 7457  FD185C  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
5289
 7458                        		.LONGA	on
5290
 7459                        		.LONGI	on
5291
 7460                        		.MNLIST
5292
 7461  FD185E  0A            		asl	a
5293
 7462  FD185F  0A            		asl	a		; this make base address = $03C0
5294
 7463  FD1860  AA            		tax
5295
 7464  FD1861                		ACC08
5296
 7465  FD1861  E2 20         		sep	#PMFLAG
5297
 7466                        		.LONGA	off
5298
 7467                        		.MNLIST
5299
 7468  FD1863  A9 D0         		lda	#$D0		; LIGHT YELLOW/BLACK -- editor
5300
 7469  FD1865  9F 00 10 01   		sta	>VBBPALRAM,x	; palette=0
5301
 7470  FD1869  E8            		inx
5302
 7471  FD186A  A9 F2         		lda	#$F2		; WHITE/DARK BLUE -- status line
5303
 7472  FD186C  9F 00 10 01   		sta	>VBBPALRAM,x	; palette=1
5304
 7473  FD1870  E8            		inx
5305
 7474  FD1871  A9 92         		lda	#$92		; LIGHT RED/DARK BLUE -- error line
5306
 7475  FD1873  9F 00 10 01   		sta	>VBBPALRAM,x	; palette=2
5307
 7476  FD1877  E8            		inx
5308
 7477                        		;lda	#$0E		; BLACK/LIGHT GRAY -- command line
5309
 7478  FD1878  A9 2F         		lda	#$2F		; DARK BLUE/WHITE -- command line
5310
 7479  FD187A  9F 00 10 01   		sta	>VBBPALRAM,x	; palette=3
5311
 7480  FD187E  E8            		inx
5312
 7481  FD187F  A9 E2         		lda	#$E2		; GRAY/DARK BLUE -- status line
5313
 7482  FD1881  9F 00 10 01   		sta	>VBBPALRAM,x	; palette=4
5314
 7483  FD1885                		CPU08
5315
 7484  FD1885  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
5316
 7485                        		.LONGA	off
5317
 7486                        		.LONGI	off
5318
 7487                        		.MNLIST
5319
 7488  FD1887  A9 00         		lda	#0		; start with buffer #0
5320
 7489  FD1889  20 F6 0B      		jsr	switchb
5321
 7490  FD188C  A9 20         		lda	#$20		; enable indent
5322
 7491  FD188E  04 18         		tsb	bflag
5323
 7492  FD1890  20 33 15      		jsr	setattr
5324
 7493  FD1893  4C 32 04      		jmp	updwin
5325
 7494
5326
 7495                        	;---------------------------------------------------------------------
5327
 7496
5328
 7497                        	; convert byte A in decimal (3 digits stored in tstr2)
5329
 7498  FD1896                	byte2str:
5330
 7499  FD1896  85 4A         		sta	wtmp
5331
 7500  FD1898  64 4B         		stz	wtmp+1
5332
 7501  FD189A  A9 80         		lda	#$80			; flag byte
5333
  Tue Jul 17 11:00:22 2018                                                                                               Page   87
5334
 
5335
 
5336
 
5337
 
5338
 7502  FD189C  85 50         		sta	ebtmp
5339
 7503  FD189E  80 02         		bra	int2s
5340
 7504
5341
 7505                        	; convert integer in wtmp in decimal (5 digits stored in tstr2)
5342
 7506  FD18A0                	int2str:
5343
 7507  FD18A0  64 50         		stz	ebtmp			; flag integer
5344
 7508  FD18A2                	int2s:
5345
 7509  FD18A2  64 51         		stz	ebtmp2			; string index
5346
 7510  FD18A4  8B            		phb
5347
 7511  FD18A5  4B            		phk				; set DBR = PBR
5348
 7512  FD18A6  AB            		plb
5349
 7513  FD18A7  A0 08         		ldy	#8			; power 10 table access index
5350
 7514  FD18A9  A2 00         	?02:	ldx	#0			; partial quotient
5351
 7515  FD18AB  38            		sec
5352
 7516  FD18AC                		ACC16				; repeated subctract
5353
 7517  FD18AC  C2 20         		rep	#PMFLAG
5354
 7518                        		.LONGA	on
5355
 7519                        		.MNLIST
5356
 7520  FD18AE  A5 4A         		lda	wtmp
5357
 7521  FD18B0  F9 41 20      	?04:	sbc	P10TBL,y
5358
 7522  FD18B3  90 03         		bcc	?06			; stop subctract
5359
 7523  FD18B5  E8            		inx				; increment quotient
5360
 7524  FD18B6  80 F8         		bra	?04
5361
 7525  FD18B8  79 41 20      	?06:	adc	P10TBL,y		; store result
5362
 7526  FD18BB  85 4A         		sta	wtmp
5363
 7527  FD18BD                		ACC08SEC
5364
 7528  FD18BD  E2 21         		sep	#(PMFLAG.OR.PCFLAG)
5365
 7529                        		.LONGA	off
5366
 7530                        		.MNLIST
5367
 7531  FD18BF  8A            		txa				; 0..9
5368
 7532  FD18C0  69 2F         		adc	#'0'-1			; decimal digit
5369
 7533  FD18C2  A6 51         		ldx	ebtmp2			; string index
5370
 7534  FD18C4  95 52         		sta	tstr2,x			; store digit
5371
 7535  FD18C6  E8            		inx
5372
 7536  FD18C7  86 51         		stx	ebtmp2			; update string index
5373
 7537  FD18C9  88            		dey
5374
 7538  FD18CA  88            		dey
5375
 7539  FD18CB  10 DC         		bpl	?02
5376
 7540  FD18CD  AB            		plb
5377
 7541  FD18CE  24 50         		bit	ebtmp
5378
 7542  FD18D0  10 13         		bpl	?10
5379
 7543  FD18D2  A2 02         		ldx	#2			; adjust for byte
5380
 7544  FD18D4  A0 00         		ldy	#0
5381
 7545  FD18D6  B5 52         	?08:	lda	<tstr2,x
5382
 7546  FD18D8  86 62         		stx	tmp6
5383
 7547  FD18DA  BB            		tyx
5384
 7548  FD18DB  95 52         		sta	<tstr2,x
5385
 7549  FD18DD  A6 62         		ldx	tmp6
5386
 7550  FD18DF  E8            		inx
5387
 7551  FD18E0  C8            		iny
5388
 7552  FD18E1  C0 03         		cpy	#3
5389
 7553  FD18E3  90 F1         		bcc	?08
5390
 7554  FD18E5  60            	?10:	rts
5391
 7555
5392
 7556
5393
 7557                        	;------------------------
5394
 7558  FD18E6                	exit:
5395
  Tue Jul 17 11:00:22 2018                                                                                               Page   88
5396
 
5397
 
5398
 
5399
 
5400
 7559  FD18E6  A9 80         		lda	#$80
5401
 7560  FD18E8  04 33         		tsb	edtfg
5402
 7561  FD18EA  60            		rts
5403
 7562
5404
 7563                        	; ALT-O
5405
 7564  FD18EB                	open:
5406
 7565  FD18EB  A2 00         		ldx	#<?opn
5407
 7566  FD18ED  A0 19         		ldy	#>?opn
5408
 7567  FD18EF  A9 FD         		lda	#^?opn
5409
 7568  FD18F1  20 2E 17      		jsr	inputstr
5410
 7569  FD18F4  B0 09         		bcs	?end
5411
 7570  FD18F6  20 BB 16      		jsr	hidecurs
5412
 7571  FD18F9  20 7D 1E      		jsr	cbmopn
5413
 7572                        		;lda	#$80		; clear input mode flag
5414
 7573                        		;trb	slfg
5415
 7574                        		;lda	#$80
5416
 7575                        		;trb	bflag		; not modified
5417
 7576  FD18FC  20 4F 05      		jsr	updsl
5418
 7577  FD18FF  60            	?end:	rts
5419
 7578  FD1900  4F 70 65 6E 3A 	?opn:	.DB	'Open: ', 0
5420
               20 00
5421
 7579
5422
 7580                        	; ALT-S
5423
 7581  FD1907                	save:
5424
 7582  FD1907  20 26 1B      		jsr	chkbuf
5425
 7583  FD190A  F0 10         		beq	?end		; clipboard or empty buffer
5426
 7584  FD190C  A9 10         		lda	#$10		; named buffer?
5427
 7585  FD190E  24 18         		bit	bflag
5428
 7586  FD1910  F0 0B         		beq	saveas		; no, call saveas
5429
 7587  FD1912  24 DD         		bit	fsmode
5430
 7588  FD1914  10 03         		bpl	?fat		; save fat file
5431
 7589  FD1916  4C 17 1A      		jmp	csave		; save cbm file
5432
 7590  FD1919  4C 24 1B      	?fat:	jmp	fsave
5433
 7591  FD191C  60            	?end:	rts
5434
 7592
5435
 7593  FD191D                	saveas:
5436
 7594  FD191D  A2 2F         		ldx	#<?sav
5437
 7595  FD191F  A0 19         		ldy	#>?sav
5438
 7596  FD1921  A9 FD         		lda	#^?sav
5439
 7597  FD1923  20 2E 17      		jsr	inputstr
5440
 7598  FD1926  B0 06         		bcs	?end
5441
 7599  FD1928  24 DD         		bit	fsmode
5442
 7600  FD192A  10 0A         		bpl	fsaveas
5443
 7601  FD192C  30 0A         		bmi	csaveas
5444
 7602  FD192E  60            	?end:	rts
5445
 7603
5446
 7604  FD192F  53 61 76 65 3A 	?sav:	.DB	'Save: ', 0
5447
               20 00
5448
 7605
5449
 7606  FD1936                	fsaveas:
5450
 7607  FD1936  18            		clc
5451
 7608  FD1937  60            		rts
5452
 7609
5453
 7610  FD1938                	csaveas:
5454
 7611  FD1938  A9 01         		lda	#^EDBUFFILE	; set pointer to filename
5455
 7612  FD193A  85 DC         		sta	longp+2
5456
 7613  FD193C  A9 00         		lda	#<EDBUFFILE
5457
  Tue Jul 17 11:00:22 2018                                                                                               Page   89
5458
 
5459
 
5460
 
5461
 
5462
 7614  FD193E  85 DA         		sta	longp
5463
 7615  FD1940  A9 CC         		lda	#>EDBUFFILE
5464
 7616  FD1942  85 DB         		sta	longp+1
5465
 7617  FD1944  A2 00         		ldx	#0
5466
 7618  FD1946  A9 40         		lda	#'@'
5467
 7619  FD1948  87 DA         		sta	[longp]		; replace flag
5468
 7620  FD194A  A0 01         		ldy	#1
5469
 7621  FD194C  AF 51 CC 01   		lda	>EDDSKERR+1	; check drive
5470
 7622  FD1950  C9 3A         		cmp	#':'
5471
 7623  FD1952  D0 0C         		bne	?dr		; store deafult drive '0'
5472
 7624  FD1954  AF 50 CC 01   		lda	>EDDSKERR
5473
 7625  FD1958  C9 30         		cmp	#'0'		; continue if drive 0 or 1
5474
 7626  FD195A  F0 0E         		beq	?mv
5475
 7627  FD195C  C9 31         		cmp	#'1'
5476
 7628  FD195E  F0 0A         		beq	?mv
5477
 7629  FD1960  A9 30         	?dr:	lda	#'0'		; put default drive '0'
5478
 7630  FD1962  97 DA         		sta	[longp],y
5479
 7631  FD1964  C8            		iny
5480
 7632  FD1965  A9 3A         		lda	#':'
5481
 7633  FD1967  97 DA         		sta	[longp],y
5482
 7634  FD1969  C8            		iny
5483
 7635  FD196A  BF 50 CC 01   	?mv:	lda	>EDDSKERR,x	; set filename
5484
 7636  FD196E  F0 12         		beq	?nxt
5485
 7637  FD1970  C9 61         		cmp	#'a'		; upper case
5486
 7638  FD1972  90 06         		bcc	?st
5487
 7639  FD1974  C9 7B         		cmp	#'z'+1
5488
 7640  FD1976  B0 02         		bcs	?st
5489
 7641  FD1978  29 DF         		and	#$DF
5490
 7642  FD197A  97 DA         	?st:	sta	[longp],y
5491
 7643  FD197C  E8            		inx
5492
 7644  FD197D  C8            		iny
5493
 7645  FD197E  C0 48         		cpy	#MAXFNAME-8
5494
 7646  FD1980  90 E8         		bcc	?mv
5495
 7647  FD1982  A2 03         	?nxt:	ldx	#3
5496
 7648  FD1984  5A            		phy			; save index
5497
 7649  FD1985  BF 13 1A FD   	?lp:	lda	>?rdw,x
5498
 7650  FD1989  97 DA         		sta	[longp],y
5499
 7651  FD198B  C8            		iny
5500
 7652  FD198C  CA            		dex
5501
 7653  FD198D  10 F6         		bpl	?lp
5502
 7654  FD198F  A9 00         		lda	#0
5503
 7655  FD1991  97 DA         		sta	[longp],y
5504
 7656  FD1993                		ACC16
5505
 7657  FD1993  C2 20         		rep	#PMFLAG
5506
 7658                        		.LONGA	on
5507
 7659                        		.MNLIST
5508
 7660  FD1995  E6 DA         		inc	longp		; no overwrite for now
5509
 7661  FD1997                		ACC08
5510
 7662  FD1997  E2 20         		sep	#PMFLAG
5511
 7663                        		.LONGA	off
5512
 7664                        		.MNLIST
5513
 7665  FD1999  20 99 1F      	?opn:	jsr	cdskopn		; open file
5514
 7666  FD199C  7A            		ply
5515
 7667  FD199D  90 2A         		bcc	?ok		; no error
5516
 7668  FD199F  84 58         		sty	bka
5517
 7669  FD19A1  AF 50 CC 01   		lda	>EDDSKERR	; check error 63 (file exist)
5518
 7670  FD19A5  C9 36         		cmp	#'6'
5519
  Tue Jul 17 11:00:22 2018                                                                                               Page   90
5520
 
5521
 
5522
 
5523
 
5524
 7671  FD19A7  D0 46         		bne	?derr		; error of another kind
5525
 7672  FD19A9  AF 51 CC 01   		lda	>EDDSKERR+1
5526
 7673  FD19AD  C9 33         		cmp	#'3'
5527
 7674  FD19AF  D0 3E         		bne	?derr
5528
 7675  FD19B1  A2 F6         		ldx	#<?msg		; ask overwrite confirmation
5529
 7676  FD19B3  A0 19         		ldy	#>?msg
5530
 7677  FD19B5  A9 FD         		lda	#^?msg
5531
 7678  FD19B7  20 91 1B      		jsr	confirm		; ask confirmation
5532
 7679  FD19BA  B0 29         		bcs	?end		; no, <ESC>
5533
 7680  FD19BC  D0 27         		bne	?end		; no, <N>
5534
 7681  FD19BE                		ACC16
5535
 7682  FD19BE  C2 20         		rep	#PMFLAG
5536
 7683                        		.LONGA	on
5537
 7684                        		.MNLIST
5538
 7685  FD19C0  C6 DA         		dec	longp
5539
 7686  FD19C2                		ACC08
5540
 7687  FD19C2  E2 20         		sep	#PMFLAG
5541
 7688                        		.LONGA	off
5542
 7689                        		.MNLIST
5543
 7690  FD19C4  A4 58         		ldy	bka
5544
 7691  FD19C6  5A            		phy
5545
 7692  FD19C7  80 D0         		bra	?opn		; try again with replace flag
5546
 7693  FD19C9  20 50 1A      	?ok:	jsr	csave2
5547
 7694  FD19CC  B0 17         		bcs	?end		; some error
5548
 7695  FD19CE  A2 00         		ldx	#0
5549
 7696  FD19D0  BF 01 CC 01   	?cp:	lda	>EDBUFFILE+1,x	; skip '@'
5550
 7697  FD19D4  9F 00 CD 01   		sta	>EDCURFILE,x
5551
 7698  FD19D8  F0 03         		beq	?upd
5552
 7699  FD19DA  E8            		inx
5553
 7700  FD19DB  80 F3         		bra	?cp
5554
 7701  FD19DD  A5 18         	?upd:	lda	bflag
5555
 7702  FD19DF  29 7F         		and	#$7F
5556
 7703  FD19E1  09 10         		ora	#$10
5557
 7704  FD19E3  85 18         		sta	bflag
5558
 7705  FD19E5  A9 40         	?end:	lda	#$40
5559
 7706  FD19E7  85 3F         		sta	slfg
5560
 7707  FD19E9  20 4F 05      		jsr	updsl
5561
 7708  FD19EC  4C 32 04      		jmp	updwin
5562
 7709
5563
 7710  FD19EF                	?derr:
5564
 7711  FD19EF  A2 FF         		ldx	#$FF		; disk error
5565
 7712  FD19F1  20 43 05      		jsr	error
5566
 7713  FD19F4  80 EF         		bra	?end
5567
 7714
5568
 7715  FD19F6  46 69 6C 65 20 	?msg:	.DB	'File exist; overwrite <Y/N>?', 0
5569
               65 78 69 73 74
5570
               3B 20 6F 76 65
5571
               72 77 72 69 74
5572
               65 20 3C 59 2F
5573
               4E 3E 3F 00
5574
 7716  FD1A13  57 2C 53 2C   	?rdw:	.DB	'W,S,'
5575
 7717
5576
 7718
5577
 7719                        	; save CBM file
5578
 7720  FD1A17                	csave:
5579
 7721  FD1A17  A9 00         		lda	#<EDBUFFILE	; prepare filename
5580
 7722  FD1A19  85 DA         		sta	longp
5581
  Tue Jul 17 11:00:22 2018                                                                                               Page   91
5582
 
5583
 
5584
 
5585
 
5586
 7723  FD1A1B  A9 CC         		lda	#>EDBUFFILE
5587
 7724  FD1A1D  85 DB         		sta	longp+1
5588
 7725  FD1A1F  A9 01         		lda	#^EDBUFFILE
5589
 7726  FD1A21  85 DC         		sta	longp+2
5590
 7727  FD1A23  A9 40         		lda	#'@'		; replace flag
5591
 7728  FD1A25  87 DA         		sta	[longp]
5592
 7729  FD1A27  A0 01         		ldy	#1
5593
 7730  FD1A29  A2 00         		ldx	#0
5594
 7731  FD1A2B  BF 00 CD 01   	?nam:	lda	>EDCURFILE,x
5595
 7732  FD1A2F  F0 08         		beq	?nxt
5596
 7733  FD1A31  97 DA         		sta	[longp],y
5597
 7734  FD1A33  C8            		iny
5598
 7735  FD1A34  E8            		inx
5599
 7736  FD1A35  C0 12         		cpy	#18
5600
 7737  FD1A37  90 F2         		bcc	?nam
5601
 7738  FD1A39  A2 03         	?nxt:	ldx	#3
5602
 7739  FD1A3B  5A            		phy
5603
 7740  FD1A3C  BF 88 1A FD   	?lp:	lda	>_?rdw,x
5604
 7741  FD1A40  97 DA         		sta	[longp],y
5605
 7742  FD1A42  C8            		iny
5606
 7743  FD1A43  CA            		dex
5607
 7744  FD1A44  10 F6         		bpl	?lp
5608
 7745  FD1A46  A9 00         		lda	#0
5609
 7746  FD1A48  97 DA         		sta	[longp],y
5610
 7747  FD1A4A  20 99 1F      		jsr	cdskopn		; open file
5611
 7748  FD1A4D  7A            		ply
5612
 7749  FD1A4E  B0 30         		bcs	_?derr		; error
5613
 7750  FD1A50                	csave2:
5614
 7751  FD1A50  A9 00         		lda	#0
5615
 7752  FD1A52  97 DA         		sta	[longp],y
5616
 7753  FD1A54  A5 DC         		lda	longp+2
5617
 7754  FD1A56  48            		pha
5618
 7755  FD1A57  D4 DA         		pei	(longp)
5619
 7756  FD1A59  4B            		phk
5620
 7757  FD1A5A  F4 8C 1A      		pea	#_?sav
5621
 7758  FD1A5D  A9 07         		lda	#7
5622
 7759  FD1A5F  48            		pha
5623
 7760  FD1A60                		BSPRINTF2		; format in local string
5624
 7761  FD1A60  02 14         		cop	$14
5625
 7762                        		.MNLIST
5626
 7763  FD1A62  DA            		phx			; bank that hold string
5627
 7764  FD1A63  AA            		tax			; low address
5628
 7765  FD1A64  EB            		xba
5629
 7766  FD1A65  A8            		tay			; hi address
5630
 7767  FD1A66  A5 3C         		lda	slattr		; attribute
5631
 7768  FD1A68  EB            		xba
5632
 7769  FD1A69  68            		pla			; bank
5633
 7770  FD1A6A  20 54 16      		jsr	outstr
5634
 7771  FD1A6D  A9 40         		lda	#$40		; force update status line
5635
 7772  FD1A6F  85 3F         		sta	slfg
5636
 7773  FD1A71  20 9B 1A      		jsr	savbuf
5637
 7774  FD1A74  B0 0A         		bcs	_?derr
5638
 7775  FD1A76  20 4F 05      		jsr	updsl
5639
 7776  FD1A79  18            		clc
5640
 7777  FD1A7A  08            	_?end:	php
5641
 7778  FD1A7B  20 32 04      		jsr	updwin
5642
 7779  FD1A7E  28            		plp
5643
  Tue Jul 17 11:00:22 2018                                                                                               Page   92
5644
 
5645
 
5646
 
5647
 
5648
 7780  FD1A7F  60            		rts
5649
 7781
5650
 7782  FD1A80                	_?derr:
5651
 7783  FD1A80  A2 FF         		ldx	#$FF		; disk error
5652
 7784  FD1A82  20 43 05      		jsr	error
5653
 7785  FD1A85  38            		sec
5654
 7786  FD1A86  80 F2         		bra	_?end
5655
 7787
5656
 7788  FD1A88  57 2C 53 2C   	_?rdw:	.DB	'W,S,'
5657
 7789  FD1A8C  53 61 76 69 6E 	_?sav:	.DB	'Saving "%s"...', 0
5658
               67 20 22 25 73
5659
               22 2E 2E 2E 00
5660
 7790
5661
 7791                        	; save current buffer
5662
 7792  FD1A9B                	savbuf:
5663
 7793  FD1A9B  20 93 0E      		jsr	mvpp2		; save buffer pointer
5664
 7794  FD1A9E                		ACC16
5665
 7795  FD1A9E  C2 20         		rep	#PMFLAG
5666
 7796                        		.LONGA	on
5667
 7797                        		.MNLIST
5668
 7798  FD1AA0  A5 12         		lda	pbuf		; set pointer to start
5669
 7799  FD1AA2  85 15         		sta	ppage
5670
 7800  FD1AA4  64 58         		stz	bka
5671
 7801  FD1AA6  A9 00 E0      		lda	#EDDSKBUF	; set disk buffer pointer
5672
 7802  FD1AA9  85 52         		sta	pb
5673
 7803  FD1AAB  A2 01         		ldx	#^EDDSKBUF
5674
 7804  FD1AAD  86 54         		stx	pb+2
5675
 7805  FD1AAF                		ACC08
5676
 7806  FD1AAF  E2 20         		sep	#PMFLAG
5677
 7807                        		.LONGA	off
5678
 7808                        		.MNLIST
5679
 7809  FD1AB1  A9 05         		lda	#BSTART
5680
 7810  FD1AB3  85 17         		sta	ixb
5681
 7811  FD1AB5  80 03         		bra	?get
5682
 7812  FD1AB7  20 BE 0F      	?nxt:	jsr	incptr		; inc buffer pointer
5683
 7813  FD1ABA  20 A9 0F      	?get:	jsr	getbyte		; get next byte
5684
 7814  FD1ABD  B0 12         		bcs	?end		; end of text
5685
 7815  FD1ABF  20 F2 1A      		jsr	?put		; put into disk buffer
5686
 7816  FD1AC2  B0 24         		bcs	?rst		; error
5687
 7817  FD1AC4  C9 0D         		cmp	#$0D
5688
 7818  FD1AC6  D0 EF         		bne	?nxt
5689
 7819  FD1AC8  A9 0A         		lda	#$0A		; dos style text file
5690
 7820  FD1ACA  20 F2 1A      		jsr	?put
5691
 7821  FD1ACD  B0 19         		bcs	?rst		; error
5692
 7822  FD1ACF  80 E6         		bra	?nxt		; next byte
5693
 7823  FD1AD1  18            	?end:	clc			; no error
5694
 7824  FD1AD2  A5 58         		lda	bka		; check if must flush disk buffer
5695
 7825  FD1AD4  05 59         		ora	bka+1
5696
 7826  FD1AD6  F0 03         		beq	?cls		; no flush: close file
5697
 7827  FD1AD8  20 02 1B      		jsr	?wr		; flush buffer
5698
 7828  FD1ADB  08            	?cls:	php
5699
 7829  FD1ADC  24 DD         		bit	fsmode		; close file
5700
 7830  FD1ADE  10 06         		bpl	?fcls
5701
 7831  FD1AE0  A9 0E         		lda	#$0E		; close file
5702
 7832  FD1AE2                		CBMFSCLS
5703
 7833  FD1AE2  02 82         		cop	FN_CBMFSCLS
5704
 7834                        		.MNLIST
5705
  Tue Jul 17 11:00:22 2018                                                                                               Page   93
5706
 
5707
 
5708
 
5709
 
5710
 7835  FD1AE4  80 01         		bra	?go
5711
 7836  FD1AE6  EA            	?fcls:	nop
5712
 7837  FD1AE7  28            	?go:	plp
5713
 7838  FD1AE8  20 4A 0E      	?rst:	jsr	pp2mv		; restore pointer
5714
 7839  FD1AEB  B0 04         		bcs	?end2
5715
 7840  FD1AED  A9 80         		lda	#$80
5716
 7841  FD1AEF  14 18         		trb	bflag		; clear modified flag
5717
 7842  FD1AF1  60            	?end2:	rts
5718
 7843
5719
 7844  FD1AF2                	?put:	INDEX16			; insert into disk buffer
5720
 7845  FD1AF2  C2 10         		rep	#PXFLAG
5721
 7846                        		.LONGI	on
5722
 7847                        		.MNLIST
5723
 7848  FD1AF4  A4 58         		ldy	bka		; current index
5724
 7849  FD1AF6  97 52         		sta	[pb],y		; store byte
5725
 7850  FD1AF8  C8            		iny			; update index
5726
 7851  FD1AF9  84 58         		sty	bka
5727
 7852  FD1AFB  C0 00 20      		cpy	#EDDSKBUFSIZ	; check if full
5728
 7853  FD1AFE                		INDEX08
5729
 7854  FD1AFE  E2 10         		sep	#PXFLAG
5730
 7855                        		.LONGI	off
5731
 7856                        		.MNLIST
5732
 7857  FD1B00  90 21         		bcc	?rts
5733
 7858  FD1B02  24 DD         	?wr:	bit	fsmode		; write buffer to disk
5734
 7859  FD1B04  10 18         		bpl	?wfat		; fat file
5735
 7860  FD1B06  A5 54         		lda	pb+2		; set buffer pointer
5736
 7861  FD1B08  48            		pha
5737
 7862  FD1B09  D4 52         		pei	(pb)
5738
 7863  FD1B0B  D4 58         		pei	(bka)		; buffer size
5739
 7864  FD1B0D  A9 0E         		lda	#$0E
5740
 7865  FD1B0F  48            		pha			; chnl 14
5741
 7866  FD1B10                		CBMFSWR			; write buffer
5742
 7867  FD1B10  02 81         		cop	FN_CBMFSRW
5743
 7868  FD1B12  01            		.DB	$01
5744
 7869                        		.MNLIST
5745
 7870  FD1B13  90 0A         		bcc	?ok
5746
 7871  FD1B15  20 A6 1F      		jsr	cdskerr		; get error string
5747
 7872  FD1B18  A9 0E         		lda	#$0E		; close file
5748
 7873  FD1B1A                		CBMFSCLS
5749
 7874  FD1B1A  02 82         		cop	FN_CBMFSCLS
5750
 7875                        		.MNLIST
5751
 7876  FD1B1C  38            		sec			; error
5752
 7877  FD1B1D  60            		rts
5753
 7878  FD1B1E  18            	?wfat:	clc
5754
 7879  FD1B1F  64 58         	?ok:	stz	bka		; clear index
5755
 7880  FD1B21  64 59         		stz	bka+1
5756
 7881  FD1B23  60            	?rts:	rts
5757
 7882
5758
 7883  FD1B24                	fsave:
5759
 7884  FD1B24  18            		clc
5760
 7885  FD1B25  60            		rts
5761
 7886
5762
 7887                        	; check current buffer
5763
 7888                        	; ZF=1 if clipboard or empty buffer
5764
 7889  FD1B26                	chkbuf:
5765
 7890  FD1B26  A5 0F         		lda	xbuf
5766
 7891  FD1B28  C9 0A         		cmp	#CLIPBRD
5767
  Tue Jul 17 11:00:22 2018                                                                                               Page   94
5768
 
5769
 
5770
 
5771
 
5772
 7892  FD1B2A  F0 0E         		beq	?end		; is clipboard
5773
 7893  FD1B2C  A5 12         		lda	pbuf
5774
 7894  FD1B2E  85 53         		sta	pb+1
5775
 7895  FD1B30  A5 13         		lda	pbuf+1
5776
 7896  FD1B32  85 54         		sta	pb+2
5777
 7897  FD1B34  64 52         		stz	pb
5778
 7898  FD1B36  A0 05         		ldy	#BSTART
5779
 7899  FD1B38  B7 52         		lda	[pb],y		; ZF=1 if empty
5780
 7900  FD1B3A  60            	?end:	rts
5781
 7901
5782
 7902                        	; ALT-N
5783
 7903  FD1B3B                	clrbuf:
5784
 7904  FD1B3B  20 26 1B      		jsr	chkbuf
5785
 7905  FD1B3E  F0 24         		beq	?end		; clipboard or empty buffer
5786
 7906  FD1B40  A2 65         		ldx	#<?sclr
5787
 7907  FD1B42  A0 1B         		ldy	#>?sclr
5788
 7908  FD1B44  A9 FD         		lda	#^?sclr
5789
 7909  FD1B46  20 91 1B      		jsr	confirm		; ask confirmation
5790
 7910  FD1B49  B0 19         		bcs	?end		; no, <ESC>
5791
 7911  FD1B4B  D0 17         		bne	?end		; no, <N>
5792
 7912  FD1B4D  24 18         		bit	bflag		; buffer modified?
5793
 7913  FD1B4F  10 03         		bpl	?go		; no
5794
 7914  FD1B51  20 07 19      		jsr	save
5795
 7915  FD1B54  64 1C         	?go:	stz	cline
5796
 7916  FD1B56  64 1D         		stz	cline+1
5797
 7917  FD1B58  A5 0F         		lda	xbuf
5798
 7918  FD1B5A  20 78 0B      		jsr	freebuf
5799
 7919  FD1B5D  A9 40         		lda	#$40
5800
 7920  FD1B5F  85 3F         		sta	slfg
5801
 7921  FD1B61  20 32 04      		jsr	updwin
5802
 7922  FD1B64  60            	?end:	rts
5803
 7923
5804
 7924  FD1B65  41 72 65 20 79 	?sclr:	.DB	'Are you sure to clear current buffer <Y/N>?', 0
5805
               6F 75 20 73 75
5806
               72 65 20 74 6F
5807
               20 63 6C 65 61
5808
               72 20 63 75 72
5809
               72 65 6E 74 20
5810
               62 75 66 66 65
5811
               72 20 3C 59 2F
5812
               4E 3E 3F 00
5813
 7925
5814
 7926                        	; X,Y,A = string ptr
5815
 7927                        	; CF = 1 if <ESC>
5816
 7928                        	; CF=0, ZF=0 if <N>
5817
 7929                        	; CF=0, ZF=1 if <Y>
5818
 7930  FD1B91                	confirm:
5819
 7931  FD1B91  EB            		xba
5820
 7932  FD1B92  A5 3D         		lda	seatt
5821
 7933  FD1B94  EB            		xba
5822
 7934  FD1B95  20 54 16      		jsr	outstr
5823
 7935  FD1B98  20 90 16      	?get:	jsr	slgkey		; wait key pressed
5824
 7936  FD1B9B  B0 FB         		bcs	?get		; control key
5825
 7937  FD1B9D  EB            		xba			; ALT,CTL,SHIFT
5826
 7938  FD1B9E  D0 F8         		bne	?get		; will be no pressed
5827
 7939  FD1BA0  EB            		xba
5828
 7940  FD1BA1  C9 1B         		cmp	#KB_ESC
5829
  Tue Jul 17 11:00:22 2018                                                                                               Page   95
5830
 
5831
 
5832
 
5833
 
5834
 7941  FD1BA3  F0 14         		beq	?end		; exit with CF=1
5835
 7942  FD1BA5  C9 61         		cmp	#'a'
5836
 7943  FD1BA7  90 06         		bcc	?nxt
5837
 7944  FD1BA9  C9 7B         		cmp	#'z'+1
5838
 7945  FD1BAB  B0 02         		bcs	?nxt
5839
 7946  FD1BAD  29 DF         		and	#$DF		; capitalize
5840
 7947  FD1BAF  C9 59         	?nxt:	cmp	#'Y'
5841
 7948  FD1BB1  F0 05         		beq	?ok		; exit with CF=0, ZF=1
5842
 7949  FD1BB3  C9 4E         		cmp	#'N'
5843
 7950  FD1BB5  D0 E1         		bne	?get
5844
 7951  FD1BB7  1A            		inc	a		; exit with CF=0, ZF=0
5845
 7952  FD1BB8  18            	?ok:	clc
5846
 7953  FD1BB9  08            	?end:	php
5847
 7954  FD1BBA  A9 40         		lda	#$40		; force updare status line
5848
 7955  FD1BBC  85 3F         		sta	slfg
5849
 7956  FD1BBE  20 4F 05      		jsr	updsl
5850
 7957  FD1BC1  28            		plp
5851
 7958  FD1BC2  60            		rts
5852
 7959
5853
 7960                        	;ALT-T
5854
 7961  FD1BC3                	settab:
5855
 7962  FD1BC3  A5 19         		lda	deftab		; prepare prompt string
5856
 7963  FD1BC5  48            		pha
5857
 7964  FD1BC6  A9 28         		lda	#MAXTABVAL
5858
 7965  FD1BC8  48            		pha
5859
 7966  FD1BC9  A9 02         		lda	#MINTABVAL
5860
 7967  FD1BCB  48            		pha
5861
 7968  FD1BCC  4B            		phk			; bank of format string
5862
 7969  FD1BCD  F4 1C 1C      		pea	#?tstr
5863
 7970  FD1BD0  A9 07         		lda	#7
5864
 7971  FD1BD2  48            		pha
5865
 7972  FD1BD3                		BSPRINTF2		; format in local string
5866
 7973  FD1BD3  02 14         		cop	$14
5867
 7974                        		.MNLIST
5868
 7975  FD1BD5  86 58         		stx	bka		; bank
5869
 7976  FD1BD7  AA            		tax			; low address
5870
 7977  FD1BD8  EB            		xba
5871
 7978  FD1BD9  A8            		tay			; hi address
5872
 7979  FD1BDA  A5 58         		lda	bka
5873
 7980  FD1BDC  20 2E 17      		jsr	inputstr
5874
 7981  FD1BDF  B0 36         		bcs	?end
5875
 7982  FD1BE1  20 1C 1D      		jsr	getnum		; get number in bka
5876
 7983  FD1BE4  B0 31         		bcs	?end		; error
5877
 7984  FD1BE6  A6 58         		ldx	bka
5878
 7985  FD1BE8  A5 59         		lda	bka+1
5879
 7986  FD1BEA  F0 21         		beq	?ok
5880
 7987  FD1BEC  A0 28         	?err:	ldy	#MAXTABVAL
5881
 7988  FD1BEE  5A            		phy
5882
 7989  FD1BEF  A0 02         		ldy	#MINTABVAL
5883
 7990  FD1BF1  5A            		phy
5884
 7991  FD1BF2  48            		pha			; illegal value
5885
 7992  FD1BF3  DA            		phx
5886
 7993  FD1BF4  F4 B0 00      		pea	#EDERRSIZ	; size of dest. string
5887
 7994  FD1BF7  A9 01         		lda	#^EDDSKERR	; eror dest. string
5888
 7995  FD1BF9  48            		pha
5889
 7996  FD1BFA  F4 50 CC      		pea	#EDDSKERR
5890
 7997  FD1BFD  4B            		phk			; format string
5891
  Tue Jul 17 11:00:22 2018                                                                                               Page   96
5892
 
5893
 
5894
 
5895
 
5896
 7998  FD1BFE  F4 53 1C      		pea	#?serr
5897
 7999  FD1C01  A9 0D         		lda	#13
5898
 8000  FD1C03  48            		pha
5899
 8001  FD1C04                		BSPRINTF
5900
 8002  FD1C04  02 12         		cop	$12
5901
 8003                        		.MNLIST
5902
 8004  FD1C06  A2 FF         		ldx	#$FF		; error string in EDDSKERR
5903
 8005  FD1C08  20 43 05      		jsr	error
5904
 8006  FD1C0B  80 0A         		bra	?end
5905
 8007  FD1C0D  E0 02         	?ok:	cpx	#MINTABVAL
5906
 8008  FD1C0F  90 DB         		bcc	?err
5907
 8009  FD1C11  E0 29         		cpx	#MAXTABVAL+1
5908
 8010  FD1C13  B0 D7         		bcs	?err
5909
 8011  FD1C15  86 19         		stx	deftab
5910
 8012  FD1C17  A9 80         	?end:	lda	#$80		; clear input mode flag
5911
 8013  FD1C19  14 3F         		trb	slfg
5912
 8014  FD1C1B  60            		rts
5913
 8015
5914
 8016  FD1C1C  53 65 74 20 74 	?tstr:	.DB	'Set tab value in range %bu..%bu (current value: %bu): ', 0
5915
               61 62 20 76 61
5916
               6C 75 65 20 69
5917
               6E 20 72 61 6E
5918
               67 65 20 25 62
5919
               75 2E 2E 25 62
5920
               75 20 28 63 75
5921
               72 72 65 6E 74
5922
               20 76 61 6C 75
5923
               65 3A 20 25 62
5924
               75 29 3A 20 00
5925
 8017  FD1C53  49 6C 6C 65 67 	?serr:	.DB	'Illegal tab value: %hu (must be in range %bu..%bu)', 0
5926
               61 6C 20 74 61
5927
               62 20 76 61 6C
5928
               75 65 3A 20 25
5929
               68 75 20 28 6D
5930
               75 73 74 20 62
5931
               65 20 69 6E 20
5932
               72 61 6E 67 65
5933
               20 25 62 75 2E
5934
               2E 25 62 75 29
5935
               00
5936
 8018
5937
 8019                        	; ALT-G
5938
 8020  FD1C86                	gotoln:
5939
 8021  FD1C86  A2 0E         		ldx	#<?gto
5940
 8022  FD1C88  A0 1D         		ldy	#>?gto
5941
 8023  FD1C8A  A9 FD         		lda	#^?gto
5942
 8024  FD1C8C  20 2E 17      		jsr	inputstr
5943
 8025  FD1C8F  B0 78         		bcs	?end
5944
 8026  FD1C91  20 1C 1D      		jsr	getnum		; get number in bka
5945
 8027  FD1C94  B0 73         		bcs	?end		; error
5946
 8028  FD1C96  A5 58         		lda	bka
5947
 8029  FD1C98  05 59         		ora	bka+1
5948
 8030  FD1C9A  F0 04         		beq	?hom
5949
 8031  FD1C9C  C9 01         		cmp	#1
5950
 8032  FD1C9E  D0 05         		bne	?nxt
5951
 8033  FD1CA0  20 99 03      	?hom:	jsr	gohome
5952
 8034  FD1CA3  80 64         		bra	?end
5953
  Tue Jul 17 11:00:22 2018                                                                                               Page   97
5954
 
5955
 
5956
 
5957
 
5958
 8035  FD1CA5                	?nxt:	ACC16
5959
 8036  FD1CA5  C2 20         		rep	#PMFLAG
5960
 8037                        		.LONGA	on
5961
 8038                        		.MNLIST
5962
 8039  FD1CA7  A5 58         		lda	bka
5963
 8040  FD1CA9  C5 1A         		cmp	ncount
5964
 8041  FD1CAB                		ACC08
5965
 8042  FD1CAB  E2 20         		sep	#PMFLAG
5966
 8043                        		.LONGA	off
5967
 8044                        		.MNLIST
5968
 8045  FD1CAD  90 05         		bcc	?gol
5969
 8046  FD1CAF  20 B4 03      		jsr	goend
5970
 8047  FD1CB2  80 55         		bra	?end
5971
 8048  FD1CB4                	?gol:	ACC16
5972
 8049  FD1CB4  C2 20         		rep	#PMFLAG
5973
 8050                        		.LONGA	on
5974
 8051                        		.MNLIST
5975
 8052  FD1CB6  C5 1C         		cmp	cline
5976
 8053  FD1CB8                		ACC08
5977
 8054  FD1CB8  E2 20         		sep	#PMFLAG
5978
 8055                        		.LONGA	off
5979
 8056                        		.MNLIST
5980
 8057  FD1CBA  F0 4D         		beq	?end
5981
 8058  FD1CBC                		ACC16
5982
 8059  FD1CBC  C2 20         		rep	#PMFLAG
5983
 8060                        		.LONGA	on
5984
 8061                        		.MNLIST
5985
 8062  FD1CBE  A2 00         		ldx	#0
5986
 8063  FD1CC0  B0 08         		bcs	?gol1		; > cline
5987
 8064  FD1CC2  CA            		dex			; < cline
5988
 8065  FD1CC3  38            		sec
5989
 8066  FD1CC4  A5 1C         		lda	cline
5990
 8067  FD1CC6  E5 58         		sbc	bka
5991
 8068  FD1CC8  80 02         		bra	?gol2
5992
 8069  FD1CCA  E5 1C         	?gol1:	sbc	cline
5993
 8070  FD1CCC  85 5A         	?gol2:	sta	bkb
5994
 8071  FD1CCE                		ACC08
5995
 8072  FD1CCE  E2 20         		sep	#PMFLAG
5996
 8073                        		.LONGA	off
5997
 8074                        		.MNLIST
5998
 8075  FD1CD0  9B            		txy
5999
 8076  FD1CD1  10 1C         		bpl	?down		; go down
6000
 8077  FD1CD3  20 AD 0E      		JSR	pp8mv
6001
 8078  FD1CD6  20 8C 0F      	?01:	JSR	startln
6002
 8079  FD1CD9                		ACC16
6003
 8080  FD1CD9  C2 20         		rep	#PMFLAG
6004
 8081                        		.LONGA	on
6005
 8082                        		.MNLIST
6006
 8083  FD1CDB  B0 08         		BCS	?05
6007
 8084  FD1CDD  A6 23         		ldx	fslct
6008
 8085  FD1CDF  F0 02         		BEQ	?03
6009
 8086  FD1CE1  C6 24         		DEC	nslctl
6010
 8087  FD1CE3  C6 1C         	?03:	DEC	cline
6011
 8088  FD1CE5  C6 5A         	?05:	DEC	bkb
6012
 8089  FD1CE7                		ACC08
6013
 8090  FD1CE7  E2 20         		sep	#PMFLAG
6014
 8091                        		.LONGA	off
6015
  Tue Jul 17 11:00:22 2018                                                                                               Page   98
6016
 
6017
 
6018
 
6019
 
6020
 8092                        		.MNLIST
6021
 8093  FD1CE9  D0 EB         		BNE	?01
6022
 8094  FD1CEB  A9 06         		LDA	#$06
6023
 8095  FD1CED  80 17         		bra	?10
6024
 8096  FD1CEF                	?down:
6025
 8097  FD1CEF  20 70 0F      	?01a:	JSR	nextln
6026
 8098  FD1CF2                		ACC16
6027
 8099  FD1CF2  C2 20         		rep	#PMFLAG
6028
 8100                        		.LONGA	on
6029
 8101                        		.MNLIST
6030
 8102  FD1CF4  B0 08         		BCS	?03a
6031
 8103  FD1CF6  A6 23         		ldx	fslct
6032
 8104  FD1CF8  F0 02         		BEQ	?02a
6033
 8105  FD1CFA  E6 24         		INC	nslctl
6034
 8106  FD1CFC  E6 1C         	?02a:	INC	cline
6035
 8107  FD1CFE  C6 5A         	?03a:	DEC	bkb
6036
 8108  FD1D00                		ACC08
6037
 8109  FD1D00  E2 20         		sep	#PMFLAG
6038
 8110                        		.LONGA	off
6039
 8111                        		.MNLIST
6040
 8112  FD1D02  D0 EB         		BNE	?01a
6041
 8113  FD1D04  A9 11         		LDA	#$11
6042
 8114
6043
 8115  FD1D06  20 94 03      	?10:	jsr	epage
6044
 8116  FD1D09  A9 80         	?end:	lda	#$80		; clear input mode flag
6045
 8117  FD1D0B  14 3F         		trb	slfg
6046
 8118  FD1D0D  60            		rts
6047
 8119
6048
 8120  FD1D0E  47 6F 74 6F 20 	?gto:	.DB	'Goto line #: ', 0
6049
               6C 69 6E 65 20
6050
               23 3A 20 00
6051
 8121
6052
 8122  FD1D1C                	getnum:
6053
 8123  FD1D1C  A2 00         		ldx	#0
6054
 8124  FD1D1E  86 58         		stx	bka
6055
 8125  FD1D20  86 59         		stx	bka+1
6056
 8126  FD1D22  86 5B         		stx	bkb+1
6057
 8127  FD1D24  20 53 1D      	?nxt:	jsr	?get
6058
 8128  FD1D27  A8            		tay
6059
 8129  FD1D28  F0 27         		beq	?ret		; end of string
6060
 8130  FD1D2A  B0 1A         		bcs	?err
6061
 8131  FD1D2C  E9 2F         		sbc	#'0'-1
6062
 8132  FD1D2E  85 5A         		sta	bkb
6063
 8133  FD1D30                		ACC16
6064
 8134  FD1D30  C2 20         		rep	#PMFLAG
6065
 8135                        		.LONGA	on
6066
 8136                        		.MNLIST
6067
 8137  FD1D32  A5 58         		lda	bka
6068
 8138  FD1D34  C9 9A 19      		cmp	#6554
6069
 8139  FD1D37  B0 09         		bcs	?end		; overflow
6070
 8140  FD1D39  0A            		asl	a
6071
 8141  FD1D3A  0A            		asl	a
6072
 8142  FD1D3B  65 58         		adc	bka
6073
 8143  FD1D3D  0A            		asl	a
6074
 8144  FD1D3E  65 5A         		adc	bkb
6075
 8145  FD1D40  85 58         		sta	bka
6076
 8146  FD1D42                	?end:	ACC08
6077
  Tue Jul 17 11:00:22 2018                                                                                               Page   99
6078
 
6079
 
6080
 
6081
 
6082
 8147  FD1D42  E2 20         		sep	#PMFLAG
6083
 8148                        		.LONGA	off
6084
 8149                        		.MNLIST
6085
 8150  FD1D44  90 DE         		bcc	?nxt
6086
 8151  FD1D46  A2 08         	?err:	ldx	#8
6087
 8152  FD1D48  20 43 05      		jsr	error
6088
 8153  FD1D4B  A9 80         		lda	#$80
6089
 8154  FD1D4D  14 3F         		trb	slfg
6090
 8155  FD1D4F  38            		sec
6091
 8156  FD1D50  60            		rts
6092
 8157  FD1D51  18            	?ret:	clc
6093
 8158  FD1D52  60            		rts
6094
 8159
6095
 8160  FD1D53  BF 50 CC 01   	?get:	lda	>EDBUFLIN,x
6096
 8161  FD1D57  E8            		inx
6097
 8162  FD1D58  C9 3A         		cmp	#'9'+1
6098
 8163  FD1D5A  B0 06         		bcs	?ex
6099
 8164  FD1D5C  38            		sec
6100
 8165  FD1D5D  E9 30         		sbc	#$30
6101
 8166  FD1D5F  38            		sec
6102
 8167  FD1D60  E9 D0         		sbc	#$D0
6103
 8168  FD1D62  60            	?ex:	rts
6104
 8169
6105
 8170                        	;---------------------
6106
 8171                        	; save crt buffer & page 01
6107
 8172  FD1D63                	crtsav:
6108
 8173  FD1D63  AF 0C FC 00   		lda	>CREMEOFF	; save current video ram bit
6109
 8174  FD1D67  A8            		tay
6110
 8175  FD1D68  8F 0D FC 00   		sta	>CREMEON	; enable video ram
6111
 8176  FD1D6C                		CPU16
6112
 8177  FD1D6C  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
6113
 8178                        		.LONGA	on
6114
 8179                        		.LONGI	on
6115
 8180                        		.MNLIST
6116
 8181  FD1D6E  A2 FF 0F      		ldx	#$0FFF		; move 4k
6117
 8182  FD1D71  BF 00 00 01   	?lp:	lda	>VBBCHARRAM,x
6118
 8183  FD1D75  9F 00 D0 01   		sta	>EDCRTSAV,x
6119
 8184  FD1D79  CA            		dex
6120
 8185  FD1D7A  10 F5         		bpl	?lp
6121
 8186  FD1D7C                		CPU08
6122
 8187  FD1D7C  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
6123
 8188                        		.LONGA	off
6124
 8189                        		.LONGI	off
6125
 8190                        		.MNLIST
6126
 8191  FD1D7E  BB            		tyx
6127
 8192  FD1D7F  9F 0C FC 00   		sta	>CREMEOFF,x	; restore video ram bit
6128
 8193  FD1D83  A2 6E         		ldx	#ScnLinTmp	; save page 01
6129
 8194  FD1D85  BD 00 01      	?lp2:	lda	!DP01ADDR,x
6130
 8195  FD1D88  9F 00 CB 01   		sta	>EDSAVE01,x
6131
 8196  FD1D8C  E8            		inx
6132
 8197  FD1D8D  D0 F6         		bne	?lp2
6133
 8198  FD1D8F  60            		rts
6134
 8199
6135
 8200  FD1D90                	crtrest:
6136
 8201  FD1D90  AF 0C FC 00   		lda	>CREMEOFF	; save current video ram bit
6137
 8202  FD1D94  A8            		tay
6138
 8203  FD1D95  8F 0D FC 00   		sta	>CREMEON	; enable video ram
6139
  Tue Jul 17 11:00:22 2018                                                                                               Page  100
6140
 
6141
 
6142
 
6143
 
6144
 8204  FD1D99                		CPU16
6145
 8205  FD1D99  C2 30         		rep	#(PMFLAG.OR.PXFLAG)
6146
 8206                        		.LONGA	on
6147
 8207                        		.LONGI	on
6148
 8208                        		.MNLIST
6149
 8209  FD1D9B  A2 FF 0F      		ldx	#$0FFF		; move 4k
6150
 8210  FD1D9E  BF 00 D0 01   	?lp:	lda	>EDCRTSAV,x
6151
 8211  FD1DA2  9F 00 00 01   		sta	>VBBCHARRAM,x
6152
 8212  FD1DA6  CA            		dex
6153
 8213  FD1DA7  10 F5         		bpl	?lp
6154
 8214  FD1DA9                		CPU08
6155
 8215  FD1DA9  E2 30         		sep	#(PMFLAG.OR.PXFLAG)
6156
 8216                        		.LONGA	off
6157
 8217                        		.LONGI	off
6158
 8218                        		.MNLIST
6159
 8219  FD1DAB  A9 F0         		lda	#$F0		; who change this byte????
6160
 8220  FD1DAD  8F 00 10 01   		sta	>VBBPALRAM
6161
 8221  FD1DB1  BB            		tyx
6162
 8222  FD1DB2  9F 0C FC 00   		sta	>CREMEOFF,x	; restore video ram bit
6163
 8223  FD1DB6  A2 6E         		ldx	#ScnLinTmp	; restore page 01
6164
 8224  FD1DB8  BF 00 CB 01   	?lp2:	lda	>EDSAVE01,x
6165
 8225  FD1DBC  9D 00 01      		sta	!DP01ADDR,x
6166
 8226  FD1DBF  E8            		inx
6167
 8227  FD1DC0  D0 F6         		bne	?lp2
6168
 8228  FD1DC2  60            		rts
6169
 8229
6170
 8230                        	; --- load editor buffer
6171
 8231                        	; longp: buffer pointer
6172
 8232                        	; dbufsiz: buffer size
6173
 8233  FD1DC3                	bufld:
6174
 8234  FD1DC3  DA            		phx
6175
 8235  FD1DC4  A5 DE         		lda	dbufsiz
6176
 8236  FD1DC6  05 DF         		ora	dbufsiz+1
6177
 8237  FD1DC8  F0 73         		beq	?end		; empty
6178
 8238  FD1DCA  A7 DA         	?nxt:	lda	[longp]		; get byte
6179
 8239  FD1DCC  C9 0A         		cmp	#$0A		; skip line feed
6180
 8240  FD1DCE  F0 63         		beq	?inc
6181
 8241  FD1DD0  C9 0D         		cmp	#$0D
6182
 8242  FD1DD2  F0 22         		beq	?ins
6183
 8243  FD1DD4  C9 09         		cmp	#KB_TAB		; discard non printable but TAB & CR
6184
 8244  FD1DD6  F0 27         		beq	?tab
6185
 8245  FD1DD8  C9 20         		cmp	#' '
6186
 8246  FD1DDA  90 57         		bcc	?inc
6187
 8247  FD1DDC  A6 58         		ldx	bka
6188
 8248  FD1DDE  E0 F0         		cpx	#MAXTEXTLEN
6189
 8249  FD1DE0  90 14         		bcc	?ins
6190
 8250  FD1DE2  85 59         		sta	bka+1
6191
 8251  FD1DE4  A9 0D         		lda	#$0D
6192
 8252  FD1DE6  20 EC 0C      		jsr	insert
6193
 8253  FD1DE9                		ACC16
6194
 8254  FD1DE9  C2 20         		rep	#PMFLAG
6195
 8255                        		.LONGA	on
6196
 8256                        		.MNLIST
6197
 8257  FD1DEB  E6 1A         		inc	ncount
6198
 8258  FD1DED                		ACC08
6199
 8259  FD1DED  E2 20         		sep	#PMFLAG
6200
 8260                        		.LONGA	off
6201
  Tue Jul 17 11:00:22 2018                                                                                               Page  101
6202
 
6203
 
6204
 
6205
 
6206
 8261                        		.MNLIST
6207
 8262  FD1DEF  20 DF 0F      		jsr	incptr2
6208
 8263  FD1DF2  64 58         		stz	bka
6209
 8264  FD1DF4  A5 59         		lda	bka+1
6210
 8265  FD1DF6  20 EC 0C      	?ins:	jsr	insert		; insert byte in editor buffer
6211
 8266  FD1DF9  E6 58         		inc	bka		; update text lenght
6212
 8267  FD1DFB  90 1A         		bcc	?cr		; ok, room available
6213
 8268  FD1DFD  B0 05         		bcs	?em		; memory error
6214
 8269  FD1DFF  20 40 1E      	?tab:	jsr	?tkey
6215
 8270  FD1E02  80 2F         		bra	?inc
6216
 8271  FD1E04  A0 FE         	?em:	ldy	#$FE
6217
 8272  FD1E06  A9 0D         		lda	#$0D
6218
 8273  FD1E08  97 14         		sta	[pblk],y
6219
 8274  FD1E0A  C8            		iny
6220
 8275  FD1E0B  A9 00         		lda	#0
6221
 8276  FD1E0D  97 14         		sta	[pblk],y
6222
 8277  FD1E0F                		ACC16
6223
 8278  FD1E0F  C2 20         		rep	#PMFLAG
6224
 8279                        		.LONGA	on
6225
 8280                        		.MNLIST
6226
 8281  FD1E11  E6 1A         		inc	ncount
6227
 8282  FD1E13                		ACC08
6228
 8283  FD1E13  E2 20         		sep	#PMFLAG
6229
 8284                        		.LONGA	off
6230
 8285                        		.MNLIST
6231
 8286  FD1E15  80 16         		bra	?ret
6232
 8287  FD1E17  C9 0D         	?cr:	cmp	#$0D		; last byte was a CR?
6233
 8288  FD1E19  D0 15         		bne	?upd		; no
6234
 8289  FD1E1B  64 58         		stz	bka
6235
 8290  FD1E1D                		ACC16CLC
6236
 8291  FD1E1D  C2 21         		rep	#(PMFLAG.OR.PCFLAG)
6237
 8292                        		.LONGA	on
6238
 8293                        		.MNLIST
6239
 8294  FD1E1F  E6 1A         		inc	ncount		; update lines count
6240
 8295  FD1E21  D0 03         		bne	?nov
6241
 8296  FD1E23  38            		sec			; lines count overflow
6242
 8297  FD1E24  C6 1A         		dec	ncount
6243
 8298  FD1E26                	?nov:	ACC08
6244
 8299  FD1E26  E2 20         		sep	#PMFLAG
6245
 8300                        		.LONGA	off
6246
 8301                        		.MNLIST
6247
 8302  FD1E28  90 06         		bcc	?upd
6248
 8303  FD1E2A  20 DF 0F      		jsr	incptr2
6249
 8304  FD1E2D  FA            	?ret:	plx
6250
 8305  FD1E2E  38            		sec			; error
6251
 8306  FD1E2F  60            		rts
6252
 8307  FD1E30  20 DF 0F      	?upd:	jsr	incptr2		; update editor buffer pointer
6253
 8308  FD1E33                	?inc:	ACC16
6254
 8309  FD1E33  C2 20         		rep	#PMFLAG
6255
 8310                        		.LONGA	on
6256
 8311                        		.MNLIST
6257
 8312  FD1E35  E6 DA         		inc	longp		; update buffer pointer
6258
 8313  FD1E37  C6 DE         		dec	dbufsiz		; update size
6259
 8314  FD1E39                		ACC08
6260
 8315  FD1E39  E2 20         		sep	#PMFLAG
6261
 8316                        		.LONGA	off
6262
 8317                        		.MNLIST
6263
  Tue Jul 17 11:00:22 2018                                                                                               Page  102
6264
 
6265
 
6266
 
6267
 
6268
 8318  FD1E3B  D0 8D         		bne	?nxt
6269
 8319  FD1E3D  FA            	?end:	plx
6270
 8320  FD1E3E  18            		clc
6271
 8321  FD1E3F  60            		rts
6272
 8322
6273
 8323  FD1E40  A9 00         	?tkey:	lda	#0		; put blank's instead tab's
6274
 8324  FD1E42  18            	?tb0:	clc
6275
 8325  FD1E43  69 08         	?tb1:	adc	#8		; assume default tab = 8
6276
 8326  FD1E45  C5 58         		cmp	bka
6277
 8327  FD1E47  F0 F9         		beq	?tb0
6278
 8328  FD1E49  90 F8         		bcc	?tb1
6279
 8329  FD1E4B  E5 58         		sbc	bka
6280
 8330  FD1E4D  F0 10         		beq	?tbx
6281
 8331  FD1E4F  85 30         		sta	ctmp2
6282
 8332  FD1E51  A9 20         	?tbl:	lda	#' '
6283
 8333  FD1E53  20 EC 0C      		jsr	insert
6284
 8334  FD1E56  20 DF 0F      		jsr	incptr2
6285
 8335  FD1E59  E6 58         		inc	bka
6286
 8336  FD1E5B  C6 30         		dec	ctmp2
6287
 8337  FD1E5D  D0 F2         		bne	?tbl
6288
 8338  FD1E5F  60            	?tbx:	rts
6289
 8339
6290
 8340                        	; check command line for open file
6291
 8341  FD1E60                	chkcmd:
6292
 8342  FD1E60  A5 DA         		lda	longp
6293
 8343  FD1E62  05 DB         		ora	longp+1
6294
 8344  FD1E64  05 DC         		ora	longp+2
6295
 8345  FD1E66  F0 14         		beq	?end		; null pointer
6296
 8346  FD1E68  A7 DA         		lda	[longp]
6297
 8347  FD1E6A  F0 10         		beq	?end		; empty command line
6298
 8348  FD1E6C  A0 00         		ldy	#0
6299
 8349  FD1E6E  BB            		tyx
6300
 8350  FD1E6F  B7 DA         	?mv:	lda	[longp],y
6301
 8351  FD1E71  9F 50 CC 01   		sta	>EDDSKERR,x
6302
 8352  FD1E75  C8            		iny
6303
 8353  FD1E76  E8            		inx
6304
 8354  FD1E77  D0 F6         		bne	?mv
6305
 8355  FD1E79  20 7D 1E      		jsr	cbmopn
6306
 8356  FD1E7C  60            	?end:	rts
6307
 8357
6308
 8358                        	;------ CBM FS
6309
 8359
6310
 8360                        	; open CBM file
6311
 8361                        	; filename in EDDSKERR buffer
6312
 8362  FD1E7D                	cbmopn:
6313
 8363  FD1E7D  A9 01         		lda	#^EDBUFFILE	; set pointer to filename
6314
 8364  FD1E7F  85 DC         		sta	longp+2
6315
 8365  FD1E81  A9 00         		lda	#<EDBUFFILE
6316
 8366  FD1E83  85 DA         		sta	longp
6317
 8367  FD1E85  A9 CC         		lda	#>EDBUFFILE
6318
 8368  FD1E87  85 DB         		sta	longp+1
6319
 8369  FD1E89  A2 00         		ldx	#0
6320
 8370  FD1E8B  9B            		txy
6321
 8371  FD1E8C  AF 51 CC 01   		lda	>EDDSKERR+1	; check drive
6322
 8372  FD1E90  C9 3A         		cmp	#':'
6323
 8373  FD1E92  D0 0C         		bne	?dr		; store deafult drive '0'
6324
 8374  FD1E94  AF 50 CC 01   		lda	>EDDSKERR
6325
  Tue Jul 17 11:00:22 2018                                                                                               Page  103
6326
 
6327
 
6328
 
6329
 
6330
 8375  FD1E98  C9 30         		cmp	#'0'		; continue if drive 0 or 1
6331
 8376  FD1E9A  F0 0E         		beq	?mv
6332
 8377  FD1E9C  C9 31         		cmp	#'1'
6333
 8378  FD1E9E  F0 0A         		beq	?mv
6334
 8379  FD1EA0  A9 30         	?dr:	lda	#'0'		; put default drive '0'
6335
 8380  FD1EA2  87 DA         		sta	[longp]
6336
 8381  FD1EA4  C8            		iny
6337
 8382  FD1EA5  A9 3A         		lda	#':'
6338
 8383  FD1EA7  97 DA         		sta	[longp],y
6339
 8384  FD1EA9  C8            		iny
6340
 8385  FD1EAA  BF 50 CC 01   	?mv:	lda	>EDDSKERR,x	; set filename
6341
 8386  FD1EAE  F0 10         		beq	?nxt
6342
 8387  FD1EB0  C9 61         		cmp	#'a'		; upper case
6343
 8388  FD1EB2  90 06         		bcc	?st
6344
 8389  FD1EB4  C9 7B         		cmp	#'z'+1
6345
 8390  FD1EB6  B0 02         		bcs	?st
6346
 8391  FD1EB8  29 DF         		and	#$DF
6347
 8392  FD1EBA  97 DA         	?st:	sta	[longp],y
6348
 8393  FD1EBC  E8            		inx
6349
 8394  FD1EBD  C8            		iny
6350
 8395  FD1EBE  D0 EA         		bne	?mv
6351
 8396  FD1EC0  A2 03         	?nxt:	ldx	#3
6352
 8397  FD1EC2  5A            		phy			; save index
6353
 8398  FD1EC3  BF 5A 1F FD   	?lp:	lda	>?rds,x
6354
 8399  FD1EC7  97 DA         		sta	[longp],y
6355
 8400  FD1EC9  C8            		iny
6356
 8401  FD1ECA  CA            		dex
6357
 8402  FD1ECB  10 F6         		bpl	?lp
6358
 8403  FD1ECD  A9 00         		lda	#0
6359
 8404  FD1ECF  97 DA         		sta	[longp],y
6360
 8405  FD1ED1  20 99 1F      		jsr	cdskopn		; open file
6361
 8406  FD1ED4  7A            		ply
6362
 8407  FD1ED5  B0 6E         		bcs	?derr		; error
6363
 8408  FD1ED7  A9 00         		lda	#0
6364
 8409  FD1ED9  97 DA         		sta	[longp],y
6365
 8410  FD1EDB  A5 DC         		lda	longp+2
6366
 8411  FD1EDD  48            		pha
6367
 8412  FD1EDE  D4 DA         		pei	(longp)
6368
 8413  FD1EE0  A9 FD         		lda	#^LOADMSG
6369
 8414  FD1EE2  48            		pha
6370
 8415  FD1EE3  F4 44 21      		pea	#LOADMSG
6371
 8416  FD1EE6  A9 07         		lda	#7
6372
 8417  FD1EE8  48            		pha
6373
 8418  FD1EE9                		BSPRINTF2		; format in local string
6374
 8419  FD1EE9  02 14         		cop	$14
6375
 8420                        		.MNLIST
6376
 8421  FD1EEB  DA            		phx			; bank that hold string
6377
 8422  FD1EEC  AA            		tax			; low address
6378
 8423  FD1EED  EB            		xba
6379
 8424  FD1EEE  A8            		tay			; hi address
6380
 8425  FD1EEF  A5 3C         		lda	slattr		; attribute
6381
 8426  FD1EF1  EB            		xba
6382
 8427  FD1EF2  68            		pla			; bank
6383
 8428  FD1EF3  20 54 16      		jsr	outstr
6384
 8429  FD1EF6  A9 40         		lda	#$40		; force update status line
6385
 8430  FD1EF8  85 3F         		sta	slfg
6386
 8431  FD1EFA  20 93 0E      		jsr	mvpp2
6387
  Tue Jul 17 11:00:22 2018                                                                                               Page  104
6388
 
6389
 
6390
 
6391
 
6392
 8432  FD1EFD  64 58         		stz	bka		; used for count text lenght
6393
 8433  FD1EFF  20 5E 1F      	?ld:	jsr	cdskld		; load buffer
6394
 8434  FD1F02  B0 41         		bcs	?derr
6395
 8435  FD1F04  F0 08         		beq	?end		; end
6396
 8436  FD1F06  20 C3 1D      		jsr	bufld
6397
 8437  FD1F09  B0 03         		bcs	?end
6398
 8438  FD1F0B  8A            		txa			; eof status
6399
 8439  FD1F0C  10 F1         		bpl	?ld
6400
 8440  FD1F0E  08            	?end:	php
6401
 8441  FD1F0F  A9 0E         		lda	#$0E		; close file
6402
 8442  FD1F11                		CBMFSCLS
6403
 8443  FD1F11  02 82         		cop	FN_CBMFSCLS
6404
 8444                        		.MNLIST
6405
 8445  FD1F13  28            		plp
6406
 8446  FD1F14  B0 3D         		bcs	?err04
6407
 8447  FD1F16  A2 FF         		ldx	#$FF		; update buffer filename
6408
 8448  FD1F18  E8            	?fn:	inx
6409
 8449  FD1F19  BF 00 CC 01   		lda	>EDBUFFILE,x
6410
 8450  FD1F1D  9F 00 CD 01   		sta	>EDCURFILE,x
6411
 8451  FD1F21  D0 F5         		bne	?fn
6412
 8452  FD1F23  A5 18         		lda	bflag
6413
 8453  FD1F25  29 7F         		and	#$7F		; clear modified flag
6414
 8454  FD1F27  09 10         		ora	#$10		; set valid fname flag
6415
 8455  FD1F29  85 18         		sta	bflag
6416
 8456  FD1F2B  20 1E 10      		jsr	decptr2
6417
 8457  FD1F2E  B0 0F         		bcs	?err
6418
 8458  FD1F30  20 A9 0F      		jsr	getbyte
6419
 8459  FD1F33  C9 0D         		cmp	#$0D
6420
 8460  FD1F35  F0 08         		beq	?err
6421
 8461  FD1F37  20 DF 0F      		jsr	incptr2
6422
 8462  FD1F3A  A9 0D         		lda	#$0D
6423
 8463  FD1F3C  20 EC 0C      		jsr	insert
6424
 8464  FD1F3F  20 4A 0E      	?err:	jsr	pp2mv
6425
 8465  FD1F42  4C 32 04      		jmp	updwin
6426
 8466
6427
 8467  FD1F45  A2 FF         	?derr:	ldx	#$FF		; disk error
6428
 8468  FD1F47  20 43 05      		jsr	error
6429
 8469  FD1F4A  80 F3         		bra	?err
6430
 8470  FD1F4C  A2 02         	?err02:	ldx	#2
6431
 8471  FD1F4E  20 43 05      		jsr	error
6432
 8472  FD1F51  80 EC         		bra	?err
6433
 8473  FD1F53  A2 04         	?err04:	ldx	#4
6434
 8474  FD1F55  20 43 05      		jsr	error
6435
 8475  FD1F58  80 E5         		bra	?err
6436
 8476
6437
 8477  FD1F5A  52 2C 53 2C   	?rds:	.DB	'R,S,'
6438
 8478
6439
 8479                        	; load a block from CBM disk on chnl 14
6440
 8480                        	; CF = 1 if error
6441
 8481                        	; ZF = 1 if buffer is empty
6442
 8482                        	; X = $80 if eof
6443
 8483  FD1F5E                	cdskld:
6444
 8484  FD1F5E  A9 01         		lda	#^EDDSKBUF	; set buffer pointer
6445
 8485  FD1F60  48            		pha
6446
 8486  FD1F61  F4 00 E0      		pea	#EDDSKBUF
6447
 8487  FD1F64  F4 00 20      		pea	#EDDSKBUFSIZ	; buffer size
6448
 8488  FD1F67  A9 0E         		lda	#$0E
6449
  Tue Jul 17 11:00:22 2018                                                                                               Page  105
6450
 
6451
 
6452
 
6453
 
6454
 8489  FD1F69  48            		pha			; chnl 14
6455
 8490  FD1F6A                		CBMFSRD			; read buffer
6456
 8491  FD1F6A  02 81         		cop	FN_CBMFSRW
6457
 8492  FD1F6C  00            		.DB	$00
6458
 8493                        		.MNLIST
6459
 8494  FD1F6D  90 09         		bcc	?ok
6460
 8495  FD1F6F  20 A6 1F      		jsr	cdskerr		; get error string
6461
 8496  FD1F72  A9 0E         		lda	#$0E		; close file
6462
 8497  FD1F74                		CBMFSCLS
6463
 8498  FD1F74  02 82         		cop	FN_CBMFSCLS
6464
 8499                        		.MNLIST
6465
 8500  FD1F76  38            		sec			; error
6466
 8501  FD1F77  60            		rts
6467
 8502  FD1F78                	?ok:	ACC16
6468
 8503  FD1F78  C2 20         		rep	#PMFLAG
6469
 8504                        		.LONGA	on
6470
 8505                        		.MNLIST
6471
 8506  FD1F7A  85 DE         		sta	dbufsiz		; store size
6472
 8507  FD1F7C  48            		pha
6473
 8508  FD1F7D  A9 00 E0      		lda	#EDDSKBUF
6474
 8509  FD1F80  85 DA         		sta	longp		; reset buffer pointer
6475
 8510  FD1F82  A2 01         		ldx	#^EDDSKBUF
6476
 8511  FD1F84  86 DC         		stx	longp+2
6477
 8512  FD1F86  A2 80         		ldx	#$80		; eof flag
6478
 8513  FD1F88  68            		pla			; eof
6479
 8514  FD1F89  F0 06         		beq	?end		; ZF = 1 if buffer is empty
6480
 8515  FD1F8B  C9 00 20      		cmp	#EDDSKBUFSIZ
6481
 8516  FD1F8E  90 01         		bcc	?end		; eof
6482
 8517  FD1F90  CA            		dex			; not eof
6483
 8518  FD1F91                	?end:	ACC08
6484
 8519  FD1F91  E2 20         		sep	#PMFLAG
6485
 8520                        		.LONGA	off
6486
 8521                        		.MNLIST
6487
 8522  FD1F93  18            		clc
6488
 8523  FD1F94  60            		rts
6489
 8524
6490
 8525                        	; send command to cbm fs emulator
6491
 8526                        	; command string in longp
6492
 8527  FD1F95                	cdskcmd:
6493
 8528  FD1F95  A9 0F         		lda	#15
6494
 8529  FD1F97  80 02         		bra	cdsksnd
6495
 8530  FD1F99
6496
 8531                        	; open file
6497
 8532  FD1F99                	cdskopn:
6498
 8533  FD1F99  A9 0E         		lda	#$0E
6499
 8534
6500
 8535  FD1F9B                	cdsksnd:
6501
 8536  FD1F9B  A6 DC         		ldx	longp+2		; bank of cmnd string
6502
 8537  FD1F9D  DA            		phx
6503
 8538  FD1F9E  D4 DA         		pei	(longp)		; address of cmnd string
6504
 8539  FD1FA0  48            		pha			; chnl
6505
 8540  FD1FA1                		CBMFSCMD		; send command
6506
 8541  FD1FA1  02 80         		cop	FN_CBMFSCMD
6507
 8542                        		.MNLIST
6508
 8543  FD1FA3  B0 01         		bcs	cdskerr		; if error
6509
 8544  FD1FA5  60            		rts
6510
 8545
6511
  Tue Jul 17 11:00:22 2018                                                                                               Page  106
6512
 
6513
 
6514
 
6515
 
6516
 8546                        	; get CBM disk error (in: CF = 1 if error pending else CF = 0)
6517
 8547  FD1FA6                	cdskerr:
6518
 8548  FD1FA6  08            		php			; save carry
6519
 8549  FD1FA7  A9 01         		lda	#^EDDSKERR
6520
 8550  FD1FA9  48            		pha			; address of buffer
6521
 8551  FD1FAA  F4 50 CC      		pea	#EDDSKERR
6522
 8552  FD1FAD  F4 B0 00      		pea	#EDERRSIZ	; size of buffer
6523
 8553  FD1FB0  A9 0F         		lda	#15		; channel 15
6524
 8554  FD1FB2  48            		pha
6525
 8555  FD1FB3                		CBMFSRD			; read
6526
 8556  FD1FB3  02 81         		cop	FN_CBMFSRW
6527
 8557  FD1FB5  00            		.DB	$00
6528
 8558                        		.MNLIST
6529
 8559  FD1FB6  28            		plp
6530
 8560  FD1FB7  B0 0E         		bcs	?end		; error pending
6531
 8561  FD1FB9  AF 50 CC 01   		lda	>EDDSKERR
6532
 8562  FD1FBD  0F 51 CC 01   		ora	>EDDSKERR+1
6533
 8563  FD1FC1  C9 30         		cmp	#'0'
6534
 8564  FD1FC3  18            		clc
6535
 8565  FD1FC4  F0 01         		beq	?end
6536
 8566  FD1FC6  38            		sec
6537
 8567  FD1FC7  60            	?end:	rts
6538
 8568
6539
 8569  FD1FC8
6540
 8570                        	; test load
6541
 8571  FD1FC8                	testl:
6542
 8572                        		.EXTERN PCERRS
6543
 8573
6544
 8574                        		;bra	?110
6545
 8575  FD1FC8  A2 00         		ldx	#0
6546
 8576  FD1FCA  BF DA 1F FD   	?lp:	lda	>?100,x
6547
 8577  FD1FCE  9F 50 CC 01   		sta	>EDDSKERR,x
6548
 8578  FD1FD2  F0 03         		beq	?lp1
6549
 8579  FD1FD4  E8            		inx
6550
 8580  FD1FD5  D0 F3         		bne	?lp
6551
 8581  FD1FD7  4C 7D 1E      	?lp1:	jmp	cbmopn
6552
 8582
6553
 8583  FD1FDA  31 3A 74 65 73 	?100	.DB	'1:test10.pas',0
6554
               74 31 30 2E 70
6555
               61 73 00
6556
 8584
6557
 8585  FD1FE7                	?110:
6558
 8586  FD1FE7  A9 E5         		lda	#<PCERRS
6559
 8587  FD1FE9  85 52         		sta	pb
6560
 8588  FD1FEB  A9 82         		lda	#>PCERRS
6561
 8589  FD1FED  85 53         		sta	pb+1
6562
 8590  FD1FEF  A9 FE         		lda	#^PCERRS
6563
 8591  FD1FF1  85 54         		sta	pb+2
6564
 8592  FD1FF3  20 93 0E      		jsr	mvpp2
6565
 8593  FD1FF6  A7 52         	?02:	lda	[pb]
6566
 8594  FD1FF8  F0 2D         		beq	?06
6567
 8595  FD1FFA  20 EC 0C      		jsr	insert
6568
 8596  FD1FFD  90 13         		bcc	?03
6569
 8597  FD1FFF  A0 FE         		ldy	#$FE
6570
 8598  FD2001  A9 0D         		lda	#$0D
6571
 8599  FD2003  97 14         		sta	[pblk],y
6572
 8600  FD2005  C8            		iny
6573
  Tue Jul 17 11:00:22 2018                                                                                               Page  107
6574
 
6575
 
6576
 
6577
 
6578
 8601  FD2006  A9 00         		lda	#0
6579
 8602  FD2008  97 14         		sta	[pblk],y
6580
 8603  FD200A                		ACC16
6581
 8604  FD200A  C2 20         		rep	#PMFLAG
6582
 8605                        		.LONGA	on
6583
 8606                        		.MNLIST
6584
 8607  FD200C  E6 1A         		inc	ncount
6585
 8608  FD200E                		ACC08
6586
 8609  FD200E  E2 20         		sep	#PMFLAG
6587
 8610                        		.LONGA	off
6588
 8611                        		.MNLIST
6589
 8612  FD2010  80 29         		bra	?08
6590
 8613  FD2012  C9 0D         	?03:	cmp	#$0D
6591
 8614  FD2014  D0 06         		bne	?04
6592
 8615  FD2016                		ACC16
6593
 8616  FD2016  C2 20         		rep	#PMFLAG
6594
 8617                        		.LONGA	on
6595
 8618                        		.MNLIST
6596
 8619  FD2018  E6 1A         		inc	ncount			; check overflow !!!
6597
 8620  FD201A                		ACC08
6598
 8621  FD201A  E2 20         		sep	#PMFLAG
6599
 8622                        		.LONGA	off
6600
 8623                        		.MNLIST
6601
 8624  FD201C  20 DF 0F      	?04:	jsr	incptr2
6602
 8625  FD201F                		ACC16
6603
 8626  FD201F  C2 20         		rep	#PMFLAG
6604
 8627                        		.LONGA	on
6605
 8628                        		.MNLIST
6606
 8629  FD2021  E6 52         		inc	pb
6607
 8630  FD2023                		ACC08
6608
 8631  FD2023  E2 20         		sep	#PMFLAG
6609
 8632                        		.LONGA	off
6610
 8633                        		.MNLIST
6611
 8634  FD2025  80 CF         		bra	?02
6612
 8635  FD2027  20 1E 10      	?06:	jsr	decptr2
6613
 8636  FD202A  B0 0F         		bcs	?08
6614
 8637  FD202C  20 A9 0F      	?07:	jsr	getbyte
6615
 8638  FD202F  C9 0D         		cmp	#$0D
6616
 8639  FD2031  F0 08         		beq	?08
6617
 8640  FD2033  20 DF 0F      		jsr	incptr2
6618
 8641  FD2036  A9 0D         		lda	#$0D
6619
 8642  FD2038  20 EC 0C      		jsr	insert
6620
 8643  FD203B  20 4A 0E      	?08:	jsr	pp2mv
6621
 8644  FD203E  4C 32 04      		jmp	updwin
6622
 8645
6623
 8646  FD2041                	P10TBL:
6624
 8647  FD2041  0100          		.DW	1
6625
 8648  FD2043  0A00          		.DW	10
6626
 8649  FD2045  6400          		.DW	100
6627
 8650  FD2047  E803          		.DW	1000
6628
 8651  FD2049  1027          		.DW	10000
6629
 8652
6630
 8653  FD204B                	STRTBLL:
6631
 8654  FD204B  6F 7C 8A 9A AC 		.DB	<str00, <str01, <str02, <str03, <str04, <str05, <str06, <str07
6632
               BE D9 00
6633
 8655  FD2053  2E            		.DB	<str08
6634
 8656
6635
  Tue Jul 17 11:00:22 2018                                                                                               Page  108
6636
 
6637
 
6638
 
6639
 
6640
 8657          000009        	MAXSTR	.EQU	($ - STRTBLL)
6641
 8658
6642
 8659  FD2054                	STRTBLH:
6643
 8660  FD2054  20 20 20 20 20 		.DB	>str00, >str01, >str02, >str03, >str04, >str05, >str06, >str07
6644
               20 20 21
6645
 8661  FD205C  21            		.DB	>str08
6646
 8662
6647
 8663  FD205D                	strent:
6648
 8664  FD205D  20 2D 20 68 69 		.DB	' - hit <enter>...', 0
6649
               74 20 3C 65 6E
6650
               74 65 72 3E 2E
6651
               2E 2E 00
6652
 8665
6653
 8666  FD206F                	str00:
6654
 8667  FD206F  4F 4B 2C 20 6E 		.DB	'OK, no error', 0
6655
               6F 20 65 72 72
6656
               6F 72 00
6657
 8668
6658
 8669  FD207C                	str01:
6659
 8670  FD207C  4F 75 74 20 6F 		.DB	'Out of memory', 0
6660
               66 20 6D 65 6D
6661
               6F 72 79 00
6662
 8671
6663
 8672  FD208A                	str02:
6664
 8673  FD208A  49 6E 76 61 6C 		.DB	'Invalid command', 0
6665
               69 64 20 63 6F
6666
               6D 6D 61 6E 64
6667
               00
6668
 8674
6669
 8675  FD209A                	str03:
6670
 8676  FD209A  49 6C 6C 65 67 		.DB	'Illegal tab value', 0
6671
               61 6C 20 74 61
6672
               62 20 76 61 6C
6673
               75 65 00
6674
 8677
6675
 8678  FD20AC                	str04:
6676
 8679  FD20AC  4E 6F 74 20 65 		.DB	'Not enough memory', 0
6677
               6E 6F 75 67 68
6678
               20 6D 65 6D 6F
6679
               72 79 00
6680
 8680  FD20BE
6681
 8681  FD20BE                	str05:
6682
 8682  FD20BE  43 6C 69 70 62 		.DB	'Clipboard: illegal command', 0
6683
               6F 61 72 64 3A
6684
               20 69 6C 6C 65
6685
               67 61 6C 20 63
6686
               6F 6D 6D 61 6E
6687
               64 00
6688
 8683
6689
 8684  FD20D9                	str06:
6690
 8685  FD20D9  43 61 6E 27 74 		.DB	'Can''t paste text: lines count overflow', 0
6691
               20 70 61 73 74
6692
               65 20 74 65 78
6693
               74 3A 20 6C 69
6694
               6E 65 73 20 63
6695
               6F 75 6E 74 20
6696
               6F 76 65 72 66
6697
  Tue Jul 17 11:00:22 2018                                                                                               Page  109
6698
 
6699
 
6700
 
6701
 
6702
               6C 6F 77 00
6703
 8686
6704
 8687  FD2100                	str07:
6705
 8688  FD2100  43 61 6E 27 74 		.DB	'Can''t insert a new line: lines count overflow', 0
6706
               20 69 6E 73 65
6707
               72 74 20 61 20
6708
               6E 65 77 20 6C
6709
               69 6E 65 3A 20
6710
               6C 69 6E 65 73
6711
               20 63 6F 75 6E
6712
               74 20 6F 76 65
6713
               72 66 6C 6F 77
6714
               00
6715
 8689
6716
 8690  FD212E                	str08:
6717
 8691  FD212E  49 6C 6C 65 67 		.DB	'Illegal numeric value', 0
6718
               61 6C 20 6E 75
6719
               6D 65 72 69 63
6720
               20 76 61 6C 75
6721
               65 00
6722
 8692
6723
 8693  FD2144                	LOADMSG:
6724
 8694  FD2144  4C 6F 61 64 69 		.DB	'Loading "%s"...', 0
6725
               6E 67 20 22 25
6726
               73 22 2E 2E 2E
6727
               00
6728
 8695
6729
 8696  FD2154                	stlstr:
6730
 8697  FD2154  62 75 66 66 65 	.DB	'buffer:#0 "                  "                M I O SCN  N:00000  L:00000 C:000 '
6731
               72 3A 23 30 20
6732
               22 20 20 20 20
6733
               20 20 20 20 20
6734
               20 20 20 20 20
6735
               20 20 20 20 22
6736
               20 20 20 20 20
6737
               20 20 20 20 20
6738
               20 20 20 20 20
6739
               20 4D 20 49 20
6740
               4F 20 53 43 4E
6741
               20 20 4E 3A 30
6742
               30 30 30 30 20
6743
               20 4C 3A 30 30
6744
               30 30 30 20 43
6745
               3A 30 30 30 20
6746
 8698  FD21A4                	stlstr1:
6747
 8699  FD21A4  62 75 66 66 65 	.DB	'buffer:#0 "                                 " M I O SCN  N:00000  L:00000 C:000 '
6748
               72 3A 23 30 20
6749
               22 20 20 20 20
6750
               20 20 20 20 20
6751
               20 20 20 20 20
6752
               20 20 20 20 20
6753
               20 20 20 20 20
6754
               20 20 20 20 20
6755
               20 20 20 20 22
6756
               20 4D 20 49 20
6757
               4F 20 53 43 4E
6758
               20 20 4E 3A 30
6759
  Tue Jul 17 11:00:22 2018                                                                                               Page  110
6760
 
6761
 
6762
 
6763
 
6764
               30 30 30 30 20
6765
               20 4C 3A 30 30
6766
               30 30 30 20 43
6767
               3A 30 30 30 20
6768
 8700                        	;	 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
6769
 8701  FD21F4                	stlstr2:
6770
 8702  FD21F4  43 4C 49 50 42 	.DB	'CLIPBOARD                                     M I O SCN  N:00000  L:00000 C:000 '
6771
               4F 41 52 44 20
6772
               20 20 20 20 20
6773
               20 20 20 20 20
6774
               20 20 20 20 20
6775
               20 20 20 20 20
6776
               20 20 20 20 20
6777
               20 20 20 20 20
6778
               20 20 20 20 20
6779
               20 4D 20 49 20
6780
               4F 20 53 43 4E
6781
               20 20 4E 3A 30
6782
               30 30 30 30 20
6783
               20 4C 3A 30 30
6784
               30 30 30 20 43
6785
               3A 30 30 30 20
6786
 8703
6787
 8704                        	; control key's table
6788
 8705  FD2244                	KEYTBL:
6789
 8706  FD2244  8F 8B 84 87   		.DB	KB_CSRLEFT, KB_CSRDOWN, KB_CSRUP, KB_CSRRIGHT
6790
 8707  FD2248  85 8C 88 8A   		.DB	KB_HOME, KB_END, KB_PGUP, KB_PGDOWN
6791
 8708  FD224C  90 05 15 21   		.DB	KB_BACKSPACE, KB_SHIFTHOME, KB_SHIFTEND, KB_CTLTAB
6792
 8709  FD2250  8D 8E 86 1F   		.DB	KB_SHCR, KB_DELETE, KB_INSERT, KB_CTLESC
6793
 8710
6794
 8711                        		; ALT-X : quit | ALT-O: open | ALT-N: new | ALT-T: set tab
6795
 8712  FD2254  78 6F 6E 74   		.DB	'x', 'o', 'n', 't'
6796
 8713                        		; ALT-G: goto | ALT-S: save
6797
 8714  FD2258  67 73         		.DB	'g', 's'
6798
 8715
6799
 8716          000015        	KEYTBLLEN	.EQU	($ - KEYTBL - 1)
6800
 8717
6801
 8718                        	; control key's function table
6802
 8719  FD225A                	KEYPROC:
6803
 8720  FD225A  2802 F002 A102 		.DW	csrleft, csrdwn, csrup, csrrght
6804
               5C02
6805
 8721  FD2262  9903 B403 7603 		.DW	gohome, goend, pageup, pagedwn
6806
               5903
6807
 8722  FD226A  8501 4E03 3F03 		.DW	backkey, gostartln, goendln, tind
6808
               A506
6809
 8723  FD2272  F203 6B01 9306 		.DW	kshenter, delkey, tins, testl
6810
               C81F
6811
 8724
6812
 8725  FD227A  E618 EB18 3B1B 		.DW	exit, open, clrbuf, settab
6813
               C31B
6814
 8726  FD2282  861C 0719     		.DW	gotoln, save
6815
 8727
6816
 8728                        	; key's table
6817
 8729  FD2286                	KEYTBL2:
6818
 8730  FD2286  03 09 0D 16   		.DB	KB_CTLC, KB_TAB, KB_CR, KB_CTLV
6819
 8731  FD228A  18 1B 13 19   		.DB	KB_CTLX, KB_ESC, KB_CTLS, KB_CTLY
6820
 8732
6821
  Tue Jul 17 11:00:22 2018                                                                                               Page  111
6822
 
6823
 
6824
 
6825
 
6826
 8733          000007        	KEYTBLLEN2	.EQU	($ - KEYTBL2 - 1)
6827
 8734
6828
 8735                        	; no-control key function table
6829
 8736  FD228E                	KEYPROC2:
6830
 8737  FD228E  3907 4701 0104 		.DW	copysel, tabkey, kenter, pastesel
6831
               D409
6832
 8738  FD2296  4607 9F17 7D02 		.DW	cutsel, cmdline, seltxt, delline
6833
               CA06
6834
 
6835
 
6836
             Lines Assembled : 8010                  Errors : 0
6837
 
6838
 
6839