Subversion Repositories MB01 Project

Rev

Blame | Last modification | View Log | Download | RSS feed

  Tue Jul 17 11:00:22 2018                                                                                               Page    1







          2500 A.D. 65816 Macro Assembler #26960 - Version 5.02g
          -----------------------------------------------------

                       Input  Filename : src\FD\qedt.asm
                       Output Filename : obj\FD\qedt.obj
                       Listing Has Been Relocated                               


 2586                           .LIST           on
 2587                           
 2599                           .LIST on
 2600                           
 2601                           DIRP00: .SECTION page0, ref_only, common        ;Direct-Page 00
 2602                           
 2603  000000                           .ABSOLUTE               ;; inizia sempre da $00
 2604  000000                           .ORG            0x00
 2605  000000                           
 2606  000000  0000             JiffyClk        .DW                     ; contatore 10ms 32 bit
 2607  000002  0000                             .DW
 2608  000004                   SysTmr          .DS     SYSTMRCNT       ; system timer 0 (10ms)
 2609  000008                   SysTMF          .DS     SYSTMRCNT       ; flag timer (80 -> start)
 2610  00000C  00               Bnk0Flag        .DB                     ; <7>: flag test RAM banco 0 ok
 2611                                                                   ; <6>: flag warm reset
 2612  00000D  00               RTCFlag         .DB
 2613                           
 2614  00000E                   diskstat        .DS     2       ; flag device on ata bus #0 & #1
 2615                                                           ; <7>: device ready
 2616                                                           ; <6>: compact flash device (C.F.)
 2617                                                           ; <5>: device identification ok
 2618                                                           ; <4>: MBR loaded
 2619                                                           ; <3>: valid signature in MBR
 2620                                                           ; <2>: first partition found&active
 2621                                                           ; <1>:
 2622                                                           ; <0>: valid partition flag
 2623                           
 2624                                                           ; <7>: device ready
 2625                                                           ; <6>: USB device
 2626                                                           ; <5>: compact flash device (C.F.)
 2627                                                           ; <4>: device identification ok
 2628                                                           ; <3>: MBR loaded
 2629                                                           ; <2>: first partition found&active
 2630                                                           ; <1>: always 1
 2631                                                           ; <0>: valid partition flag
 2632  000010                                                   
 2633                           
 2634          00000E           atadev          .EQU    diskstat
 2635                           
 2636  000010                   usbdev          .DS     2       ; flag flash disk on usb bus #0
 2637                                                           ; <7>: device plugged and ready
 2638                                                           ; <6>: always 1 
 2639                                                           ; <5>: device identification ok
 2640                                                           ; <4>: MBR loaded
 2641                                                           ; <3>: valid signature in MBR
 2642                                                           ; <2>: first partition found&active
  Tue Jul 17 11:00:22 2018                                                                                               Page    2




 2643                                                           ; <1>:
 2644                                                           ; <0>: valid partition flag
 2645                           
 2646  000012                   diskmax         .DS     16      ; disk max. sector's
 2647          000012           atasec          .EQU    diskmax
 2648          00001A           usbsec          .EQU    diskmax+8
 2649                           
 2650                           
 2651  000022                   atambr          .DS     8       ; data for first partition found in mbr
 2652                                                           ; first 3 bytes for start sector of partition
 2653                                                           ; last byte for partition type
 2654  00002A                   usbmbr          .DS     8
 2655                           
 2656  000032                   ataprt          .DS     8       ; total sec's of first partition
 2657  00003A                   usbprt          .DS     8       ; total sec's of first partition
 2658                           
 2659                           
 2660  000042  00               usb0ch          .DB     ; usb0 (ch375/ch376) flag
 2661                                                   ; <7>: module on
 2662                                                   ; <6>: ch376 flag
 2663                                                   ; <5:0>: chip version
 2664                           
 2665  000043  00               usb0st          .DB     ; usb0 status
 2666                                                   ; <7>: usb0 host mode ok
 2667                                                   ; <6>: flash disk attached flag
 2668                                                   ; <5>: usb device attached
 2669                           
 2670  000044  00               fdcdrv          .DB             ; phisycal drive status (drive #0)
 2671                                                           ; <7>: disk format established in bit 0&1 
 2672                                                           ; <6>: double step seek done
 2673                                                           ; <5>: trust format bit's (set after ok r/w)
 2674                                                           ; <4>: write protect bit (if disk in drive)
 2675                                                           ; <3>: don't care
 2676                                                           ; <2>: don't care                               
 2677                                                           ; <1>: HD disk if set else DD disk
 2678                                                           ; <0>: CBM format if set else IBM format
 2679                           
 2680  000045  00               vdrive          .DB             ; virtual drive status (ram disk, drive #1)
 2681                                                           ; <7>: disk format established in bit 0&1 
 2682                                                           ; <6>: change disk simulation (after format)
 2683                                                           ; <5>: don't care
 2684                                                           ; <4>: write protect bit (under sw control)
 2685                                                           ; <3>: don't care
 2686                                                           ; <2>: don't care                               
 2687                                                           ; <1>: HD disk if set else DD disk
 2688                                                           ; <0>: CBM format if set else IBM format
 2689                           
 2690  000046  00               fdcctl          .DB             ; fdc controller status
 2691                                                           ; <7>: drive is attached
 2692                                                           ; <6>: drive need recalibration (restore)
 2693                                                           ; <5>: FDC controller ok
 2694                                                           ; <4>: motor on
 2695                                                           ; <3>: dma is active
 2696                                                           ; <2>: dma chip ok (post routine)
 2697                                                           ; <1>: clock rate (1=HD,0=DD)
 2698                                                           ; <0>: disk ready
 2699                           
  Tue Jul 17 11:00:22 2018                                                                                               Page    3




 2700  000047  00               fdctrk          .DB             ; fd: current seek track
 2701  000048  00               fdcerr          .DB             ; fd: last error code
 2702  000049  00               ataerr          .DB             ; ata: last error code
 2703  00004A  00               ataxer          .DB             ; ata: last extended error code
 2704                           
 2705  00004B  00               CtrlBrk         .DB             ; flag CTRL+BREAK (NMI)
 2706                           
 2707  00004C  0000             MemTop          .DW             ; top memoria RAM
 2708  00004E  00                               .DB             ; banco top mem
 2709                           
 2710  00004F  00               DflTxtIn        .DB             ; device di default text input 
 2711  000050  00               DflTxtOut       .DB             ; device di default text output
 2712                           
 2713  000051                   COPPtr          LP              ; long pointer for COP decoding
 2714  000054  00               COPIdx          .DB             ; COP signature/index
 2715                           
 2716  000055  00               BiosEnt         .DB             ; flag accesso a bios setup
 2717                           
 2718                           ; variabili utilizzate da ACIA
 2719  000056                   spwrk           .DS     $30
 2720                           
 2721                           ; bios mem
 2722  000086  0000             nsize           .DW     ; dimensione blocco da allocare
 2723                           ;bsize          .DW     ; dimensione vera blocco free
 2724  000088  0000             splitsz         .DW     ; dimensione blocco splittato
 2725  00008A  0000             bfree           .DW     ; puntatore blocco free
 2726  00008C  0000             hdrptr          .DW     ; puntatore header heap
 2727                           
 2728  00008E  0000             pbrklv          .DW     ; current break level of current process
 2729  000090  0000             pbrkmin         .DW     ; minimum breal level of current process
 2730  000092  0000             pbrkmax         .DW     ; maximum breal level of current process
 2731  000094                           
 2732                           ; bios temp. work area
 2733  000094                   bwrktmp         .DS     $28
 2734                           
 2735  0000BC  00               coptmp          .DB     ; temp. used while cop
 2736                           
 2737  0000BD  00               tstser          .DB     ; check ser/usb test board post
 2738                                                   ; <7>: VIA2 ok
 2739                                                   ; <6>: PICRAM ok
 2740                                                   ; <1>: UART 16C550 ok
 2741                                                   ; <0>: R65C51 ok
 2742                           
 2743                           
 2744                           ;crc16          .DW
 2745                           
 2746  0000BD                           .RELATIVE
 2747                           
 2748                                   .ENDS
 2749                           
 2750          [01]             .IFDEF          _ACIA_INC_
 2751                                   .INCLUDE INC\SP.INC
 2752          [00]             .ENDIF
 2753                           
 2767                           .LIST on
 2768                           
 2769          000060           KBDBUFLEN       .EQU    96              ; dimensione buffer di tastiera
  Tue Jul 17 11:00:22 2018                                                                                               Page    4




 2770                           
 2771                           DIRP01: .SECTION page0, ref_only, common        ;Direct-Page 01
 2772                           
 2773  000000                           .ABSOLUTE               ;; inizia sempre da $00
 2774  000000                           .ORG            0x00
 2775                           
 2776  000000                           
 2777  000000                   KbdBuf          .DS     KBDBUFLEN       ; buffer della tastiera
 2778  000060  00               KbdITail        .DB                     ; coda buffer tastiera
 2779  000061  00               KbdIHead        .DB                     ; testa buffer tastiera
 2780  000062  00               KbdCnt          .DB                     ; numero bytes nel buffer
 2781  000063  00               KbdShift        .DB
 2782  000064  00               KbdFlag         .DB
 2783  000065  00               KbdToggle       .DB
 2784  000066  00               KbdSt           .DB                     ; status tastiera dopo reset
 2785  000067  00               PS2Ctl          .DB                     ; flag controller PS2 keyboard
 2786                           
 2787  000068  00               LCDFlag         .DB
 2788  000069  00               LCDTmp          .DB
 2789  00006A  0000             LCDVal          .DW
 2790                           
 2791  00006C  00               VBBFlag         .DB             ; flag video board
 2792  00006D  00               VBBRam          .DB             ; flag video RAM
 2793                           
 2794  00006E  00               ScnLinTmp       .DB
 2795  00006F  00               ScnChBase       .DB             ; base video ram VDC
 2796  000070  00               ScnAttBase      .DB             ; base ram attributi VDC
 2797  000071  00               ScnCursMode     .DB             ; VDC cursore default
 2798  000072  00               ScnSaveAttr     .DB
 2799  000073  00               ScnInsert       .DB
 2800  000074  00               ScnAutoIns      .DB             ; bit 7 -> autoins - bit 6 -> modo input
 2801  000075  00               ScnScroll       .DB
 2802  000076  00               ScnMaxRow       .DB             ; max. righe finestra (-1)
 2803  000077  00               ScnMaxCols      .DB             ; max. colonne finestra (-1)
 2804                           
 2805  000078                   ScnMapTabs1     .DS     10
 2806  000082                   ScnMapTabs2     .DS     4
 2807  000086                           
 2808  000086  0000             ScnPtr          .DW             ; puntatore video ram linea corrente
 2809  000088  00                               .DB
 2810                           
 2811  000089  00               ScnFiltLen      .DB             ; lunghezza set caratteri filtro
 2812                           
 2813  00008A  0000             ScnAtPtr        .DW             ; puntatore attributi ram linea corrente
 2814  00008C  00                               .DB
 2815                           
 2816  00008D  00               ScnTmpx         .DB             ; temporaneo: durante put char
 2817  00008E                                   
 2818  00008E  00               ScnTop          .DB             ; riga superiore finestra
 2819  00008F  00               ScnLeft         .DB             ; colonna sinistra finestra
 2820  000090  00               ScnBottom       .DB             ; riga inferiore finestra
 2821  000091  00               ScnRight        .DB             ; colonna destra finestra
 2822  000092  00               ScnAttr         .DB             ; attributo default
 2823  000093  00               ScnAttr2        .DB             ; attributo alternativo
 2824  000094  00               ScnRow          .DB             ; riga cursore
 2825  000095  00               ScnCol          .DB             ; colonna cursore
 2826  000096  00               ScnRowStart     .DB             ; riga di start input 
  Tue Jul 17 11:00:22 2018                                                                                               Page    5




 2827  000097  00               ScnInput        .DB             ; riga di fine input 
 2828  000098  00               ScnColStart     .DB             ; colonna di start input 
 2829  000099  00               ScnSaveX        .DB
 2830  00009A  00               ScnSaveY        .DB
 2831  00009B  00               ScnTmpL         .DB
 2832  00009C  00               ScnTmpH         .DB
 2833  00009D  00               ScnSaveRow      .DB
 2834  00009E  00               ScnSaveCol      .DB
 2835  00009F  00               ScnCurChr       .DB
 2836  0000A0  00               ScnLstChr       .DB
 2837  0000A1  00               ScnCR           .DB
 2838  0000A2  0000             ScnPrm          .DW             ; puntatore long utilizzato da print imm
 2839  0000A4  00                               .DB             ; banco puntatore ScnPrm
 2840  0000A5  00               ScnMode         .DB             ; flag modo schermo
 2841                           
 2842  0000A6                   ScnPtr1         LP
 2843                           
 2844  0000A9  00               ScnDefCol       .DB             ; default foreground color
 2845                           
 2846  0000AA                   ScnPtr2         LP
 2847                           
 2848  0000AD  00               ScnDefBkgCol    .DB             ; default background color
 2849  0000AE  00               ScnInpRow       .DB             ; modo input line: riga start input
 2850  0000AF  00               ScnInpCol       .DB             ; modo input line: colonna start input
 2851  0000B0  00               ScnLstRow       .DB             ; modo input line: riga stop input
 2852  0000B1  00               ScnLstCol       .DB             ; modo input line: colonna stop input
 2853  0000B2  00               ScnFlag         .DB             ; Bit 7: input line - Bit 6: input riga unica
 2854  0000B3  00               ScnMask         .DB             ; flag tasti funzione editor di linea
 2855  0000B4  00               ScnFilt         .DB             ; filtro tasti editor di linea
 2856  0000B5  00               ScnCntrl        .DB             ; flag ASCII/CONTROL
 2857                           ;DflTxtIn       .DB             ; device di default text input 
 2858                           ;DflTxtOut      .DB             ; device di default text output
 2859  0000B6                           
 2860          000047           SCNCLRLEN       .EQU    ($ - ScnLinTmp - 1)
 2861                           
 2862                           ;SCNCLRLEN      .EQU    (DflTxtOut - ScnLinTmp)
 2863                           
 2864                           ; variabili monitor
 2865  0000B6  00               SMAddrL         .DB     ; address low/high
 2866  0000B7  00               SMAddrH         .DB
 2867  0000B8  00               SMAddrK         .DB     ; address bank
 2868  0000B9  00               SMFlag32        .DB     ; flag parametro 32 bit
 2869  0000BA  00               SMTmpL          .DB     ; temp. low/high
 2870  0000BB  00               SMTmpH          .DB
 2871  0000BC  00               SMTmpK          .DB     ; temp. bank
 2872  0000BD  00               SMTmpKK         .DB     ; high byte param. 32 bit
 2873  0000BE  00               SMSizeL         .DB     ; size low/high
 2874  0000BF  00               SMSizeH         .DB
 2875  0000C0  00               SMSizeK         .DB     ; size bank
 2876  0000C1  00               SMXAddrL        .DB     ; address low/high XM
 2877  0000C2  00               SMXAddrH        .DB
 2878  0000C3  00               SMXAddrK        .DB     ; address bank XM
 2879  0000C4  00               SMbndx          .DB     ; indice input buffer
 2880  0000C5  00               SMnprm          .DB     ; numero parametri riga di comando
 2881  0000C6  00               SMdumb          .DB
 2882  0000C7  00               SMkr            .DB
 2883  0000C8  0000             SMpc            .DW
  Tue Jul 17 11:00:22 2018                                                                                               Page    6




 2884  0000CA  00               SMsr            .DB
 2885  0000CB  00               SMbr            .DB
 2886  0000CC  0000             SMdp            .DW
 2887  0000CE  0000             SMac            .DW
 2888  0000D0  0000             SMxr            .DW
 2889  0000D2  0000             SMyr            .DW
 2890  0000D4  0000             SMsp            .DW
 2891                           
 2892  0000D6  00               SMAuxL          .DB
 2893  0000D7  00               SMAuxH          .DB
 2894                           
 2895  0000D8  00               asmlong         .DB     ; flag for CPU in 16 mode
 2896                                                   ; <7> -> A/M in 16 bit mode
 2897                                                   ; <6> -> X/Y in 16 bit mode
 2898  0000D9  00               asmcpu          .DB     ; <7> -> 8 bit family
 2899                                                   ; <6> -> 65C02 cmos version
 2900                           
 2901  0000DA  00               SMctx           .DB     ; context (if = $00 no quit command)
 2902  0000DB                   SMrsm           LP      ; long pointer to resume caller context
 2903                           
 2904  0000DE  00               rtcadr          .DB     ; rtc internal ram address
 2905  0000DF  00               rtcbnk          .DB     ; RTC internal bank ram
 2906  0000E0  00               cmdlin          .DB     ;
 2907  0000E1  00               SMesc           .DB
 2908                           
 2909  0000E2                   SMXTmp:         .DS     26      ; 26 bytes tmp
 2910                           
 2911          0000E2           SMTmp2          .EQU    SMXTmp
 2912          0000E4           SMTmp3          .EQU    SMXTmp+2
 2913          0000E6           SMdwTmp1        .EQU    SMXTmp+4
 2914          0000EA           SMdwTmp2        .EQU    SMXTmp+8
 2915          0000EE           SMFsrc          .EQU    SMXTmp+12       ; source bank for flash update
 2916          0000EF           SMFflag         .EQU    SMXTmp+13       ; flag file for flash update
 2917          0000F0           SMXPos2         .EQU    SMXTmp+14
 2918          0000F1           SMYPos2         .EQU    SMXTmp+15
 2919          0000F2           SMXPos3         .EQU    SMXTmp+16
 2920          0000F3           SMYPos3         .EQU    SMXTmp+17
 2921                           ;SMAuxL         .EQU    SMXTmp+18
 2922                           ;SMAuxH         .EQU    SMXTmp+19
 2923          0000F6           SMXPos          .EQU    SMXTmp+20
 2924          0000F7           SMYPos          .EQU    SMXTmp+21
 2925          0000F8           SMdwTmp3        .EQU    SMXTmp+22
 2926                           
 2927          0000E2           atcmd           .EQU    SMXTmp          ; save @ command
 2928          0000E3           atnum           .EQU    SMXTmp+1        ; @ command index
 2929          0000E4           atflag          .EQU    SMXTmp+2        ; @ L,S,V,R,W start address flag
 2930          0000E5           atbnk           .EQU    SMXTmp+3        ; @ L,S,V,R,W bank
 2931          0000E6           atstr           .EQU    SMXTmp+4        ; @ command string start (word)
 2932          0000E8           atstart         .EQU    SMXTmp+6        ; @ L,S,V,R,W start address (word)
 2933          0000EA           atend           .EQU    SMXTmp+8        ; @ S,W end address (word)
 2934          0000EC           atbuf           .EQU    SMXTmp+10       ; @ local buffer pointer (word)
 2935          0000EE           atipb           .EQU    SMXTmp+12       ; @ bank of input buffer
 2936          0000EF           atdir           .EQU    SMXTmp+13       ; @ load dir flag
 2937          0000F0           atptr           .EQU    SMXTmp+14       ; @ load dir pointer (word)
 2938          0000F2           atsiz           .EQU    SMXTmp+16       ; @ buffer size (word) 
 2939          0000F5           atlp            .EQU    SMXTmp+19       ; @ long pointer
 2940          0000F8           atsa            .EQU    SMXTmp+22       ; @ sa
  Tue Jul 17 11:00:22 2018                                                                                               Page    7




 2941                           
 2942          0000E2           btmpx           .EQU    SMXTmp          ; asc2bin conversion
 2943          0000E3           brtcsec         .EQU    SMXTmp+1
 2944          0000E4           brtcmin         .EQU    SMXTmp+2
 2945          0000E5           brtchour        .EQU    SMXTmp+3
 2946          0000E6           brtcday         .EQU    SMXTmp+4
 2947          0000E7           brtcmonth       .EQU    SMXTmp+5
 2948          0000E8           brtcyear        .EQU    SMXTmp+6
 2949          0000E9           brtcct          .EQU    SMXTmp+7
 2950                           
 2951                           
 2952  0000FC                           .RELATIVE
 2953                           
 2954                                   .ENDS
 2955                           
 2958                                   .LIST on
 2959  F8FFB1                           .INCLUDE inc\dpqedt.inc
 2960                           ;; QEDIT
 2961                           
 2962          010000           TXTADDR         .EQU    $010000         ; text char's address
 2963          010730           LSTLINE         .EQU    $010730         ; last text line address
 2964          010780           STLINE          .EQU    $010780         ; status line char's address
 2965          010800           TXTATTR         .EQU    $010800         ; text attributes address
 2966          010F80           STLATTR         .EQU    $010F80         ; status line attributes address
 2967          000780           TXTCNT          .EQU    (STLATTR - TXTATTR)
 2968          000050           MAXCOLS         .EQU    80              ; max. columuns
 2969          00004B           COLX            .EQU    $4B             ; V1574
 2970          0000F0           MAXTEXTLEN      .EQU    $F0
 2971          00FFFD           MAXLINES        .EQU    $FFFD           ; max text lines count in one buffer
 2972                           
 2973          000004           DEFLTAB         .EQU    4               ; default tab value
 2974          000002           MINTABVAL       .EQU    2
 2975          000028           MAXTABVAL       .EQU    40
 2976                           
 2977                           ;;DEFCURS               .EQU    $60             ; default cursor mode
 2978          0000C0           EDEFCURS        .EQU    $C0             ; default cursor mode edit window
 2979                                                                   ; (blinking underline)
 2980                                                                   ; <7>: blink
 2981                                                                   ; <6>: underline cursor
 2982          000080           CDEFCURS        .EQU    $80             ; default cursor mode command line
 2983                                                                   ; blinking block cursor
 2984                                                                   ; <7>: blink
 2985                                                                   ; <6>: underline cursor
 2986                           
 2987          000000           DEFATTR         .EQU    0                ; default editor window attribute
 2988          000001           DEFSATTR        .EQU    1               ; default status line attribute
 2989          000002           DEFEATTR        .EQU    2               ; default error message attribute
 2990          000003           DEFCATTR        .EQU    3               ; default command line attribute
 2991          000004           DFGATTR         .EQU    4               ; disabled flag attribute in s.l.
 2992                           
 2993          000000           BNEXT   .EQU    0
 2994          000002           BPREV   .EQU    2
 2995          000004           BNDX    .EQU    4
 2996          000005           BSTART  .EQU    5
 2997                           
 2998          00000A           MAXBUF          .EQU    10              ; buffer count (0..9)
 2999          00000A           CLIPBRD         .EQU    10              ; clipboard buffer number
  Tue Jul 17 11:00:22 2018                                                                                               Page    8




 3000          000016           BUFSIZ          .EQU    (MAXBUF + 1) * 2        ; buffer table size
 3001                           
 3002          000050           MAXFNAME        .EQU    80              ; filename size
 3003                           
 3004          000010           MINPAGE         .EQU    16              ; min. # pages to alloc
 3005          000040           MINFREE         .EQU    64              ; min. # pages to init free list (16k)
 3006                           
 3007                           ; translated keys
 3008          000029           KTAB            .EQU    $29
 3009          00002A           KCR             .EQU    $2A
 3010          00002B           KESC            .EQU    $2B
 3011          00002C           KCTLC           .EQU    $2C
 3012          00002D           KCTLV           .EQU    $2D
 3013          00002E           KCTLX           .EQU    $2E
 3014                           
 3015                           ; sezione COMMON -- questo permette di includere il file in piu' file
 3016                           
 3017                           DPQEDT: .SECTION page0, ref_only, common
 3018  000000                           .ABSOLUTE               ;; inizia sempre da $00
 3019  000000                           .ORG    0x00
 3020                           
 3021  000000  0000             pp0             .DW             ; M1F49
 3022  000002  0000             pp2             .DW             ; P052
 3023  000004  0000             pp4             .DW             ; M364A
 3024  000006  0000             pp6             .DW             ; M3647
 3025  000008  0000             pp8             .DW             ; P058
 3026                           
 3027  00000A  00               ix0             .DB             ; M1F4A
 3028  00000B  00               ix2             .DB             ; P053
 3029  00000C  00               ix4             .DB             ; M364B
 3030  00000D  00               ix6             .DB             ; M3648
 3031  00000E  00               ix8             .DB             ; P059
 3032                           
 3033  00000F  00               xbuf            .DB             ; P0B0 index of current buffer
 3034                           
 3035  000010  0000             pfree           .DW             ; P00E page pointer to blocks free list
 3036  000012  0000             pbuf            .DW             ; P00D page pointer to start of current buffer
 3037  000014  00               pblk            .DB             ; P04E long pointer to current block
 3038  000015  0000             ppage           .DW             ; P04F
 3039                           
 3040                           ; these 2 bytes MUST be consecutive ! 
 3041  000017  00               ixb             .DB             ; P050 index of current block
 3042  000018  00               bflag           .DB             ; buffer flag
 3043                                                           ; <7>: modified
 3044                                                           ; <6>: ovr mode (default: ins)
 3045                                                           ; <5>: indent mode
 3046                                                           ; <4>: valid drive number & buffer name
 3047                           
 3048  000019  00               deftab          .DB             ; M313C default tab value
 3049                           
 3050  00001A  0000             ncount          .DW             ; # total lines count of current buffer
 3051  00001C  0000             cline           .DW             ; P038/39 current text line with cursor focus
 3052  00001E  00               ccol            .DB             ; P035 current text column with cursor focus
 3053  00001F  00               ecol            .DB             ; P036 text edit column
 3054  000020  00               srow            .DB             ; P05A current screen row
 3055  000021  00               scol            .DB             ; P05B current screen column
 3056  000022  00               ccnt            .DB             ; P092 # count of chars in current text line
  Tue Jul 17 11:00:22 2018                                                                                               Page    9




 3057  000023  00               fslct           .DB             ; M1F48 select text flag mode
 3058  000024  00               nslctl          .DB             ; M1F4B selected text count
 3059  000025  00               nslcth          .DB             ; M1F4C
 3060  000026  00               rcnt            .DB             ; M3649 row counter in edit window
 3061  000027  00               xcol            .DB             ; P019 text column for check
 3062                           
 3063  000028  0000             rclip           .DW             ; M1F4D/4E selection range in clipboard
 3064  00002A  00               rslctl          .DB             ; M26D7 screen reverse attribute range
 3065  00002B  00               rslcth          .DB             ; M26D8
 3066                           
 3067  00002C  0000             curs            .DW             ; P0D1 cursor address in edit window
 3068                           
 3069  00002E  00               cursmode        .DB             ; current cursor mode
 3070                                                           ; <7>: blink
 3071                                                           ; <6>: underline cursor
 3072                           
 3073  00002F  00               ctmp            .DB             ; P0FE temp counter (updatew)
 3074  000030  00               ctmp2           .DB             ; temp used for manage tab key
 3075  000031  00               keyfg           .DB             ; a copy of KbdFlag
 3076  000032  00               embit           .DB             ; save current bit of video ram
 3077  000033  00               edtfg           .DB             ; editor global flag            
 3078                                                           ; <7>: quit from editor
 3079                                                           ; <6>: clipboard flag                   
 3080                                                           ; <5>: CBM emulation mode
 3081                                                           ; <1>: cut selection flag                               
 3082                                                           ; <0>: flag while indent blanks insertion
 3083                           
 3084  000034                   stxtp           LP              ; screen text long pointer
 3085  000037  00               frev            .DB             ; M2829 flag reverse attribute
 3086  000038                   sattp           LP              ; screen attributes long pointer
 3087  00003B  00               eattr           .DB             ; M1583 default editor attribute
 3088  00003C  00               slattr          .DB             ; M111F default status line attribute
 3089  00003D  00               seatt           .DB             ; error message attribute
 3090  00003E  00               scatt           .DB             ; command line attribute
 3091  00003F  00               slfg            .DB             ; status line flag
 3092                                                           ; <7>: command line mode
 3093                                                           ; <6>: update whole status line
 3094                                                           ; <1>: update caps & num only
 3095                                                           ; <0>: copy of select mode flag for s.l.                         
 3096                           
 3097  000040  00               sbank           .DB             ; save bank while setptr/updptr
 3098  000041  00               saveps          .DB             ; save palette address
 3099                           
 3100  000042  0000             cline1          .DW             ; update current line in status line
 3101  000044  0000             ncount1         .DW             ; update total lines in status line
 3102  000046  00               ccol1           .DB             ; update column in status line
 3103  000047  00               xbuf1           .DB             ; update buffer # in status line
 3104  000048  00               bflag1          .DB             ; update buffer flag in status line
 3105  000049  00               fgatt           .DB             ; disabled indicator attribute in status line
 3106                           
 3107  00004A  0000             wtmp            .DW
 3108                           
 3109                           ; temporary used by editor and for 2 long pointer (6 bytes)
 3110  00004C  0000             ewtmp           .DW             ; editor: temp word
 3111  00004E  0000             ewtmp2          .DW             ; editor: temp word
 3112  000050  00               ebtmp           .DB             ; editor: temp byte
 3113  000051  00               ebtmp2          .DB             ; editor: temp byte
  Tue Jul 17 11:00:22 2018                                                                                               Page   10




 3114          00004C           lptmp1          .EQU    ewtmp
 3115          00004F           lptmp2          .EQU    ewtmp2+1
 3116                           
 3117  000052                   pb              LP              ; long pointer used byt cut/paste
 3118  000055                   pd              LP              ; long pointer used by cut/paste
 3119  000058  0000             bka             .DW             ; bka & bkb used by cut/past routines
 3120  00005A  0000             bkb             .DW
 3121                           
 3122          000052           tstr2           .EQU    pb      ; temp. string (26 bytes)
 3123                           
 3124                           ; 16 bytes area for temporary usage (used by garbc routine & scroll) 
 3125  00005C                   lptc            LP              ; temp. long pointer
 3126  00005F                   lpte            LP              ; temp. long pointer
 3127  000062  00               tmp6            .DB             ; 10 temp. bytes
 3128  000063  00               tmp7            .DB
 3129  000064  00               tmp8            .DB
 3130  000065  00               tmp9            .DB
 3131  000066  00               tmpa            .DB
 3132  000067  00               tmpb            .DB
 3133  000068  00               tmpc            .DB
 3134  000069  00               tmpd            .DB
 3135  00006A  00               tmpe            .DB
 3136  00006B  00               tmpf            .DB
 3137                           
 3138          000062           lptc1           .EQU    tmp6    ; long pointer used by scroll up/down
 3139          000065           lpte1           .EQU    tmp9    ; long pointer used by scroll up/down
 3140                           
 3141  00006C                   bstart          .DS     BUFSIZ  ; page pointer of start block
 3142  000082                   bcur            .DS     BUFSIZ  ; page pointer of current block
 3143  000098                   bndx            .DS     BUFSIZ  ; current block index (low) & buffer flag (high)
 3144  0000AE                   bline           .DS     BUFSIZ  ; current edit line
 3145  0000C4                   btot            .DS     BUFSIZ  ; total count of edit lines
 3146                           
 3147  0000DA                   longp           LP              ; generic long pointer
 3148  0000DD  00               fsmode          DB              ; <7>: cbm fs mode
 3149                                                           ; <6>: pascal compiler
 3150                           
 3151  0000DE  0000             dbufsiz         .DW             ; disk buffer size
 3152  0000E0  0000             brksav          .DW             ; save break level
 3153                           
 3154  0000E0                           .RELATIVE
 3155                                   .ENDS
 3156                           
 3157                           
 3158                                   .CODEFD
 3159                                   .LONGA off
 3160                                   .LONGI off
 3161                           
 3162                           ;---------------------------------------------------
 3163                           
 3164                           ; editor main loop
 3165  FD0000                   editor:
 3166  FD0000  20 FF 16                 jsr     setcurs                 ; set cursor mode
 3167  FD0003  A4 21            ?10:    ldy     scol                    ; current screen column
 3168  FD0005  20 E0 16                 jsr     edcurs                  ; set cursor position on edit window
 3169  FD0008  20 C6 16                 jsr     showcurs                ; show cursor
 3170  FD000B                   ?12:    KBGETIN                         ; system call - get key
  Tue Jul 17 11:00:22 2018                                                                                               Page   11




 3171  FD000B  02 17                    cop     $17
 3172                                   .MNLIST
 3173  FD000D  AA                       tax
 3174  FD000E  D0 0C                    bne     ?14                     ; a key was pressed
 3175  FD0010  20 C0 10                 jsr     garbc                   ; call garbage collection
 3176  FD0013  A9 02                    lda     #$02                    ; update caps & num only
 3177  FD0015  04 3F                    tsb     slfg
 3178  FD0017  20 4F 05                 jsr     updsl
 3179  FD001A  80 EF                    bra     ?12
 3180  FD001C  85 2F            ?14:    sta     ctmp                    ; store key code
 3181  FD001E  EB                       xba
 3182  FD001F  85 30                    sta     ctmp2                   ; store control key flag
 3183  FD0021  20 BB 16                 jsr     hidecurs
 3184  FD0024  AF 64 01 00              lda     >DP01ADDR+KbdFlag       
 3185  FD0028  85 31                    sta     keyfg                   ; flag ALT, CTL, SHIFT
 3186  FD002A  A5 2F                    lda     ctmp                    ; A = key code
 3187  FD002C  24 30                    bit     ctmp2                   ; check control key flag
 3188  FD002E  10 28                    bpl     ?22                     ; no-control key        
 3189  FD0030  C9 C4                    cmp     #KB_ALTF1               ; ALT-F1..ALT-F11 switch buffer
 3190  FD0032  90 0F                    bcc     ?16
 3191  FD0034  C9 CF                    cmp     #KB_ALTF12
 3192  FD0036  B0 0B                    bcs     ?16
 3193  FD0038  E9 C3                    sbc     #KB_ALTF1-1
 3194  FD003A  C5 0F                    cmp     xbuf                    ; is the current buffer?
 3195  FD003C  F0 C5                    beq     ?10                     ; yes, skip
 3196  FD003E  20 63 00                 jsr     ?50                     ; switch to buffer
 3197  FD0041  80 C0                    bra     ?10                     ; loop
 3198  FD0043  A2 15            ?16:    ldx     #KEYTBLLEN              ; check control key
 3199  FD0045  DF 44 22 FD      ?18:    cmp     >KEYTBL,x
 3200  FD0049  F0 05                    beq     ?20
 3201  FD004B  CA                       dex
 3202  FD004C  10 F7                    bpl     ?18
 3203  FD004E  30 B3                    bmi     ?10                     ; discard
 3204  FD0050  8A               ?20:    txa
 3205  FD0051  0A                       asl     a
 3206  FD0052  AA                       tax
 3207  FD0053  FC 5A 22                 jsr     (KEYPROC,x)             ; execute key control function
 3208  FD0056  80 06                    bra     ?23                     ; loop
 3209  FD0058  AA               ?22:    tax                             ; no-control key
 3210  FD0059  30 A8                    bmi     ?10                     ; discard if key code >= 128
 3211  FD005B  20 9C 00                 jsr     ?80                     ; no-control key process
 3212  FD005E  24 33            ?23:    bit     edtfg                   ; test bit 7 for quit command
 3213  FD0060  10 A1                    bpl     ?10                     ; loop
 3214  FD0062  60               ?24:    rts
 3215                           
 3216                           ; switch current edit buffer
 3217  FD0063  20 F6 0B         ?50:    jsr     switchb
 3218  FD0066  B0 FA                    bcs     ?24                     ; memory error
 3219  FD0068  64 23                    stz     fslct                   ; clear select mode flag
 3220  FD006A  A9 01                    lda     #$01
 3221  FD006C  14 3F                    trb     slfg
 3222  FD006E  A9 0C                    lda     #$0C
 3223  FD0070  85 20                    sta     srow
 3224  FD0072  A9 27                    lda     #$27
 3225  FD0074  85 21                    sta     scol
 3226  FD0076  A6 0F                    ldx     xbuf
 3227  FD0078  A9 40                    lda     #$40
  Tue Jul 17 11:00:22 2018                                                                                               Page   12




 3228  FD007A  14 33                    trb     edtfg                   ; clear clipboard flag
 3229  FD007C  E0 0A                    cpx     #CLIPBRD
 3230  FD007E  D0 02                    bne     ?52
 3231  FD0080  04 33                    tsb     edtfg                   ; set clipboard flag
 3232  FD0082  04 3F            ?52:    tsb     slfg                    ; force update status line
 3233  FD0084  A5 2E                    lda     cursmode
 3234  FD0086  29 BF                    and     #$BF                    ; mask off bit 6
 3235  FD0088  24 18                    bit     bflag
 3236  FD008A  70 02                    bvs     ?54                     ; overwrite mode => block cursor
 3237  FD008C  09 40                    ora     #$40                    ; insert mode => underline cursor
 3238  FD008E  85 2E            ?54:    sta     cursmode
 3239  FD0090  20 FF 16                 jsr     setcurs
 3240  FD0093  4C 32 04                 jmp     updwin
 3241                           
 3242                           ; process key code < 128
 3243  FD0096  8A               ?76:    txa
 3244  FD0097  0A                       asl     a
 3245  FD0098  AA                       tax
 3246  FD0099  7C 8E 22                 jmp     (KEYPROC2,x)
 3247  FD009C  C9 20            ?80:    cmp     #' '
 3248  FD009E  B0 0C                    bcs     edkey                   ; printable key code, insert in buffer 
 3249  FD00A0  A2 07                    ldx     #KEYTBLLEN2             ; find function for key code < 32
 3250  FD00A2  DF 86 22 FD      ?84:    cmp     >KEYTBL2,x
 3251  FD00A6  F0 EE                    beq     ?76
 3252  FD00A8  CA                       dex
 3253  FD00A9  10 F7                    bpl     ?84
 3254  FD00AB  60               kpx:    rts                             ; discard
 3255                           
 3256                           ; P12AF:
 3257  FD00AC                   edkey:
 3258  FD00AC  A6 23                    LDX     fslct
 3259  FD00AE  D0 FB                    bne     kpx
 3260  FD00B0  A6 22                    LDX     ccnt
 3261  FD00B2  E0 EF                    CPX     #MAXTEXTLEN-1
 3262  FD00B4  F0 F5                    beq     kpx
 3263  FD00B6  A6 1E                    LDX     ccol
 3264  FD00B8  E4 1F                    CPX     ecol
 3265  FD00BA  90 EF                    bcc     kpx
 3266  FD00BC  AA                       tax
 3267  FD00BD                           ACC16
 3268  FD00BD  C2 20                    rep     #PMFLAG
 3269                                   .LONGA  on
 3270                                   .MNLIST
 3271  FD00BF  A5 1C                    lda     cline
 3272  FD00C1  C9 FD FF                 cmp     #MAXLINES
 3273  FD00C4                           ACC08
 3274  FD00C4  E2 20                    sep     #PMFLAG
 3275                                   .LONGA  off
 3276                                   .MNLIST
 3277  FD00C6  B0 E3                    bcs     kpx
 3278  FD00C8  8A                       txa
 3279  FD00C9  20 EC 0C                 JSR     insert
 3280  FD00CC  B0 DD                    bcs     kpx
 3281  FD00CE  20 DF 0F                 JSR     incptr2
 3282  FD00D1  A6 1E                    LDX     ccol
 3283  FD00D3  E8                       INX
 3284  FD00D4  86 1E                    STX     ccol
  Tue Jul 17 11:00:22 2018                                                                                               Page   13




 3285  FD00D6  86 27                    STX     xcol
 3286  FD00D8  E6 22                    INC     ccnt
 3287  FD00DA  20 B4 0F                 JSR     getbyte2
 3288  FD00DD  90 37                    BCC     ?02
 3289  FD00DF  A9 0D                    LDA     #$0D                    ; new line
 3290  FD00E1  20 EC 0C                 JSR     insert
 3291  FD00E4  90 06                    BCC     ?01
 3292  FD00E6  20 1E 10         ?00:    JSR     decptr2                 ; error
 3293  FD00E9  4C 0B 0F                 JMP     delbyte
 3294  FD00EC                   ?01:    ACC16
 3295  FD00EC  C2 20                    rep     #PMFLAG
 3296                                   .LONGA  on
 3297                                   .MNLIST
 3298  FD00EE  A5 1A                    lda     ncount
 3299  FD00F0  1A                       inc     a
 3300  FD00F1  C9 FD FF                 cmp     #MAXLINES
 3301  FD00F4                           ACC08
 3302  FD00F4  E2 20                    sep     #PMFLAG
 3303                                   .LONGA  off
 3304                                   .MNLIST
 3305  FD00F6  B0 EE                    bcs     ?00                     ; no insert a new line
 3306  FD00F8  E6 21                    INC     scol
 3307  FD00FA  20 93 0E                 JSR     mvpp2
 3308  FD00FD  20 70 0F                 JSR     nextln
 3309  FD0100                           ACC16
 3310  FD0100  C2 20                    rep     #PMFLAG
 3311                                   .LONGA  on
 3312                                   .MNLIST
 3313  FD0102  A5 15                    LDA     ppage
 3314  FD0104  85 06                    STA     pp6
 3315  FD0106  E6 1A                    inc     ncount
 3316  FD0108                           ACC08
 3317  FD0108  E2 20                    sep     #PMFLAG
 3318                                   .LONGA  off
 3319                                   .MNLIST
 3320  FD010A  A5 17                    LDA     ixb
 3321  FD010C  85 0D                    STA     ix6
 3322  FD010E  20 4A 0E                 JSR     pp2mv
 3323  FD0111  E6 26                    INC     rcnt
 3324  FD0113  4C 2E 04                 JMP     updwin0
 3325  FD0116  A5 21            ?02:    LDA     scol
 3326  FD0118  C9 4B                    CMP     #COLX
 3327  FD011A  90 07                    BCC     ?03
 3328  FD011C  E6 1F                    INC     ecol
 3329  FD011E  20 E9 12                 JSR     scrlright
 3330  FD0121  80 02                    bra     updrow8
 3331  FD0123  E6 21            ?03:    INC     scol
 3332                           
 3333                           ; P145F:
 3334  FD0125                   updrow8:
 3335  FD0125                           ACC16
 3336  FD0125  C2 20                    rep     #PMFLAG
 3337                                   .LONGA  on
 3338                                   .MNLIST
 3339  FD0127  A5 2C                    lda     curs
 3340  FD0129  85 34                    sta     stxtp
 3341  FD012B  09 00 08                 ora     #!TXTATTR
  Tue Jul 17 11:00:22 2018                                                                                               Page   14




 3342  FD012E  85 38                    sta     sattp
 3343  FD0130                           ACC08
 3344  FD0130  E2 20                    sep     #PMFLAG
 3345                                   .LONGA  off
 3346                                   .MNLIST
 3347  FD0132  A6 08                    LDX     pp8
 3348  FD0134  A5 09                    lda     pp8+1
 3349  FD0136  A4 0E                    LDY     ix8
 3350  FD0138  20 60 14                 JSR     setptr
 3351  FD013B  A9 01                    lda     #$01                    ; no update window while indent...
 3352  FD013D  24 33                    bit     edtfg                   ; ... blank's insertion
 3353  FD013F  D0 29                    bne     tbx
 3354  FD0141  20 69 12                 JSR     updrow
 3355  FD0144  4C 4F 05                 JMP     updsl
 3356                           
 3357                           ; tasto TAB
 3358                           ; P313E:
 3359  FD0147                   tabkey: 
 3360  FD0147  A9 00                    lda     #0
 3361  FD0149  18               ?0:     clc
 3362  FD014A  65 19            ?1:     adc     deftab
 3363  FD014C  C5 1E                    cmp     ccol
 3364  FD014E  F0 F9                    beq     ?0
 3365  FD0150  90 F8                    bcc     ?1
 3366  FD0152  E5 1E                    SBC     ccol
 3367  FD0154  85 30                    STA     ctmp2
 3368  FD0156  A5 1E            ?02:    LDA     ccol
 3369  FD0158  C5 22                    CMP     ccnt
 3370  FD015A  D0 07                    BNE     ?03
 3371  FD015C  A9 20                    LDA     #$20
 3372  FD015E  20 AC 00                 JSR     edkey
 3373  FD0161  80 03                    bra     ?04
 3374  FD0163  20 5C 02         ?03:    jsr     csrrght
 3375  FD0166  C6 30            ?04:    DEC     ctmp2
 3376  FD0168  D0 EC                    BNE     ?02
 3377  FD016A  60               tbx:    RTS 
 3378                           
 3379                           ; 'del' key
 3380                           ; execute 'csrright' and after a 'backkey'
 3381  FD016B                   delkey:
 3382  FD016B  A6 1E                    LDX     ccol
 3383  FD016D  E4 22                    CPX     ccnt
 3384  FD016F  F0 F9                    BEQ     tbx
 3385  FD0171  E8                       INX
 3386  FD0172  86 1E                    STX     ccol
 3387  FD0174  86 27                    STX     xcol
 3388  FD0176  20 DF 0F                 JSR     incptr2
 3389  FD0179  A5 21                    LDA     scol
 3390  FD017B  C9 4B                    CMP     #COLX
 3391  FD017D  90 04                    BCC     ?01
 3392  FD017F  E6 1F                    INC     ecol
 3393  FD0181  80 02                    bra     backkey
 3394  FD0183  E6 21            ?01:    INC     scol
 3395                           
 3396                           ; tasto BACKSPACE
 3397                           ; P1316:
 3398  FD0185                   backkey:
  Tue Jul 17 11:00:22 2018                                                                                               Page   15




 3399  FD0185  A5 23                    LDA     fslct
 3400  FD0187  D0 32                    bne     ?02
 3401  FD0189  A5 1E                    LDA     ccol
 3402  FD018B  C5 1F                    CMP     ecol
 3403  FD018D  90 2C                    bcc     ?02
 3404  FD018F  20 1E 10                 JSR     decptr2
 3405  FD0192  B0 27                    bcs     ?02
 3406  FD0194  20 B4 0F                 JSR     getbyte2
 3407  FD0197  C9 0D                    CMP     #$0D
 3408  FD0199  F0 21                    BEQ     ?03
 3409  FD019B  20 0B 0F                 JSR     delbyte
 3410  FD019E  C6 1E                    DEC     ccol
 3411  FD01A0  A5 1E                    LDA     ccol
 3412  FD01A2  85 27                    STA     xcol
 3413  FD01A4  C6 22                    DEC     ccnt
 3414  FD01A6  20 7B 0E                 JSR     nextln8
 3415  FD01A9  20 25 01                 JSR     updrow8
 3416  FD01AC  20 40 0E                 JSR     xcount
 3417  FD01AF  E8                       INX
 3418  FD01B0  E4 21                    CPX     scol
 3419  FD01B2  F0 05                    BEQ     ?01
 3420  FD01B4  C6 1F                    DEC     ecol
 3421  FD01B6  4C 96 13                 JMP     scrlleft
 3422  FD01B9  C6 21            ?01:    DEC     scol
 3423  FD01BB  60               ?02:    RTS
 3424  FD01BC  20 93 0E         ?03:    JSR     mvpp2
 3425  FD01BF  20 DF 0F                 JSR     incptr2
 3426  FD01C2  20 8C 0F                 JSR     startln
 3427  FD01C5  20 70 0F                 JSR     nextln
 3428  FD01C8  86 2F                    STX     ctmp
 3429  FD01CA  20 70 0F                 JSR     nextln
 3430  FD01CD  20 4A 0E                 JSR     pp2mv
 3431  FD01D0  8A                       TXA
 3432  FD01D1  18                       CLC
 3433  FD01D2  65 2F                    ADC     ctmp
 3434  FD01D4  90 03                    BCC     ?04
 3435  FD01D6  4C DF 0F                 JMP     incptr2
 3436  FD01D9  C9 F0            ?04:    CMP     #MAXTEXTLEN
 3437  FD01DB  90 03                    BCC     ?05
 3438  FD01DD  4C DF 0F                 JMP     incptr2
 3439  FD01E0  20 DF 0F         ?05:    JSR     incptr2
 3440  FD01E3  20 B4 0F                 JSR     getbyte2
 3441  FD01E6  90 1A                    BCC     ?08
 3442  FD01E8  20 1E 10                 JSR     decptr2
 3443  FD01EB  20 1E 10                 JSR     decptr2
 3444  FD01EE  B0 15                    BCS     ?09
 3445  FD01F0  20 B4 0F                 JSR     getbyte2
 3446  FD01F3  C9 0D                    CMP     #$0D
 3447  FD01F5  F0 06                    BEQ     ?06
 3448  FD01F7  20 DF 0F                 JSR     incptr2
 3449  FD01FA  4C DF 0F                 JMP     incptr2
 3450  FD01FD  20 DF 0F         ?06:    JSR     incptr2
 3451  FD0200  80 03                    bra     ?09
 3452  FD0202  20 1E 10         ?08:    JSR     decptr2
 3453  FD0205                   ?09:    ACC16
 3454  FD0205  C2 20                    rep     #PMFLAG
 3455                                   .LONGA  on
  Tue Jul 17 11:00:22 2018                                                                                               Page   16




 3456                                   .MNLIST
 3457  FD0207  C6 1C                    dec     cline
 3458  FD0209  C6 1A                    dec     ncount                  ; check this !!
 3459  FD020B                           ACC08
 3460  FD020B  E2 20                    sep     #PMFLAG
 3461                                   .LONGA  off
 3462                                   .MNLIST
 3463  FD020D  20 0B 0F                 JSR     delbyte
 3464  FD0210  A9 4B                    LDA     #COLX
 3465  FD0212  85 21                    STA     scol
 3466  FD0214  A5 20                    LDA     srow
 3467  FD0216  C9 0D                    CMP     #$0D
 3468  FD0218  B0 05                    bcs     ?10
 3469  FD021A  20 20 0E                 JSR     startln4
 3470  FD021D  90 06                    BCC     ?11
 3471  FD021F  20 57 0E         ?10:    JSR     nextln6
 3472  FD0222  20 5B 15                 JSR     decrow
 3473  FD0225  4C 2E 04         ?11:    JMP     updwin0
 3474                           
 3475                           ; tasto CURSORE SX
 3476                           ; P1D31:
 3477  FD0228                   csrleft:
 3478  FD0228  A6 1E                    LDX     ccol
 3479  FD022A  E4 1F                    CPX     ecol
 3480  FD022C  B0 07                    BCS     ?01
 3481  FD022E  86 27                    STX     xcol
 3482  FD0230  C6 1F                    DEC     ecol
 3483  FD0232  4C 96 13                 JMP     scrlleft
 3484  FD0235  E0 00            ?01:    CPX     #$00
 3485  FD0237  F0 67                    BEQ     slt
 3486  FD0239  CA                       DEX
 3487  FD023A  86 1E                    STX     ccol
 3488  FD023C  86 27                    STX     xcol
 3489  FD023E  20 1E 10                 JSR     decptr2
 3490  FD0241  A5 21                    LDA     scol
 3491  FD0243  C9 05                    CMP     #$05
 3492  FD0245  B0 10                    BCS     ?02
 3493  FD0247  20 40 0E                 JSR     xcount
 3494  FD024A  E8                       INX
 3495  FD024B  E4 21                    CPX     scol
 3496  FD024D  F0 08                    BEQ     ?02
 3497  FD024F  C6 1F                    DEC     ecol
 3498  FD0251  20 96 13                 JSR     scrlleft
 3499  FD0254  4C 4F 05                 JMP     updsl
 3500  FD0257  C6 21            ?02:    DEC     scol
 3501  FD0259  4C 4F 05                 JMP     updsl
 3502                           
 3503                           ; tasto CURSORE DX
 3504                           ; P1D0C:
 3505  FD025C                   csrrght:
 3506  FD025C  A6 1E                    LDX     ccol
 3507  FD025E  E4 22                    CPX     ccnt
 3508  FD0260  F0 3E                    BEQ     slt
 3509  FD0262  E8                       INX
 3510  FD0263  86 1E                    STX     ccol
 3511  FD0265  86 27                    STX     xcol
 3512  FD0267  20 DF 0F                 JSR     incptr2
  Tue Jul 17 11:00:22 2018                                                                                               Page   17




 3513  FD026A  A5 21                    LDA     scol
 3514  FD026C  C9 4B                    CMP     #COLX
 3515  FD026E  90 08                    BCC     ?01
 3516  FD0270  E6 1F                    INC     ecol
 3517  FD0272  20 E9 12                 JSR     scrlright                       ; scroll right
 3518  FD0275  4C 4F 05                 JMP     updsl
 3519  FD0278  E6 21            ?01:    INC     scol
 3520  FD027A  4C 4F 05                 JMP     updsl
 3521                           
 3522                           ; toggle select mode flag
 3523                           ; P1F22:
 3524  FD027D                   seltxt:
 3525  FD027D  A5 23                    LDA     fslct
 3526  FD027F  F0 05                    BEQ     ?01
 3527  FD0281  64 23                    STZ     fslct                           ; clear if enabled
 3528  FD0283  4C 2E 04                 JMP     updwin0
 3529  FD0286  20 A9 0F         ?01:    JSR     getbyte
 3530  FD0289  B0 15                    BCS     slt
 3531  FD028B  E6 23                    INC     fslct
 3532  FD028D  A5 08                    LDA     pp8
 3533  FD028F  85 00                    STA     pp0
 3534  FD0291  A5 09                    LDA     pp8+1
 3535  FD0293  85 01                    STA     pp0+1
 3536  FD0295  A5 0E                    LDA     ix8
 3537  FD0297  85 0A                    STA     ix0
 3538  FD0299  64 24                    STZ     nslctl
 3539  FD029B  64 25                    stz     nslcth
 3540  FD029D  20 4F 05                 jsr     updsl
 3541  FD02A0  60               slt:    RTS
 3542                           
 3543                           ; tasto CURSORE UP
 3544                           ; P1D66:
 3545  FD02A1                   csrup:
 3546  FD02A1  A5 20                    LDA     srow
 3547  FD02A3  C9 07                    CMP     #$07
 3548  FD02A5  90 05                    BCC     ?01
 3549  FD02A7  20 5B 15                 JSR     decrow
 3550  FD02AA  80 17                    bra     ?03
 3551  FD02AC  20 20 0E         ?01:    JSR     startln4
 3552  FD02AF  90 09                    BCC     ?02
 3553  FD02B1  A5 20                    LDA     srow
 3554  FD02B3  F0 EB                    beq     slt                     ; exit
 3555  FD02B5  20 5B 15                 JSR     decrow
 3556  FD02B8  80 09                    bra     ?03
 3557  FD02BA  20 D7 0D         ?02:    JSR     startln6
 3558  FD02BD  20 C9 15                 JSR     scrlup
 3559  FD02C0  20 3B 12                 JSR     updfst
 3560  FD02C3  20 AD 0E         ?03:    JSR     pp8mv
 3561  FD02C6  20 8C 0F                 JSR     startln
 3562  FD02C9  20 A0 0E                 JSR     mvpp8
 3563  FD02CC  A6 27                    LDX     xcol
 3564  FD02CE  20 87 0D                 JSR     xcnt2
 3565  FD02D1  A5 23                    LDA     fslct
 3566  FD02D3  F0 12                    BEQ     ?07
 3567  FD02D5                           ACC16CLC
 3568  FD02D5  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3569                                   .LONGA  on
  Tue Jul 17 11:00:22 2018                                                                                               Page   18




 3570                                   .MNLIST
 3571  FD02D7  A5 2C                    lda     curs
 3572  FD02D9  C6 24                    dec     nslctl
 3573  FD02DB  10 03                    bpl     ?05
 3574  FD02DD  69 50 00                 ADC     #MAXCOLS
 3575  FD02E0  85 34            ?05:    STA     stxtp
 3576  FD02E2                           ACC08
 3577  FD02E2  E2 20                    sep     #PMFLAG
 3578                                   .LONGA  off
 3579                                   .MNLIST
 3580  FD02E4  20 69 15                 JSR     revrow
 3581  FD02E7                   ?07:    ACC16
 3582  FD02E7  C2 20                    rep     #PMFLAG
 3583                                   .LONGA  on
 3584                                   .MNLIST
 3585  FD02E9  C6 1C                    dec     cline
 3586  FD02EB                           ACC08
 3587  FD02EB  E2 20                    sep     #PMFLAG
 3588                                   .LONGA  off
 3589                                   .MNLIST
 3590  FD02ED  4C 4F 05                 JMP     updsl
 3591                           
 3592                           ; tasto CURSORE DOWN
 3593                           ; P1E62:
 3594  FD02F0                   csrdwn:
 3595  FD02F0  20 B4 0F                 JSR     getbyte2
 3596  FD02F3  B0 AB                    bcs     slt                     ; exit if end of buffer
 3597  FD02F5  A5 20                    LDA     srow
 3598  FD02F7  C9 11                    CMP     #$11
 3599  FD02F9  B0 05                    BCS     ?01
 3600  FD02FB  20 4D 15                 JSR     incrow
 3601  FD02FE  80 13                    bra     ?03
 3602  FD0300  20 80 15         ?01:    JSR     scrldown
 3603  FD0303  20 00 0E                 JSR     nextln4
 3604  FD0306  20 57 0E                 JSR     nextln6
 3605  FD0309  B0 05                    BCS     ?02
 3606  FD030B  20 08 12                 JSR     updlst
 3607  FD030E  80 03                    bra     ?03
 3608  FD0310  20 F8 14         ?02:    JSR     clrlst
 3609  FD0313  20 70 0F         ?03:    JSR     nextln
 3610  FD0316  20 A0 0E                 JSR     mvpp8
 3611  FD0319  A6 27                    LDX     xcol
 3612  FD031B  20 87 0D                 JSR     xcnt2
 3613  FD031E  A5 23                    LDA     fslct
 3614  FD0320                           ACC16CLC
 3615  FD0320  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3616                                   .LONGA  on
 3617                                   .MNLIST
 3618  FD0322  F0 14                    BEQ     ?07
 3619  FD0324  A5 2C                    lda     curs
 3620  FD0326  24 24                    bit     nslctl
 3621  FD0328  30 03                    bmi     ?05
 3622  FD032A  E9 4F 00                 SBC     #MAXCOLS-1              ; take in account CF = 0 !
 3623  FD032D  85 34            ?05:    sta     stxtp
 3624  FD032F                           ACC08
 3625  FD032F  E2 20                    sep     #PMFLAG
 3626                                   .LONGA  off
  Tue Jul 17 11:00:22 2018                                                                                               Page   19




 3627                                   .MNLIST
 3628  FD0331  20 69 15                 JSR     revrow
 3629  FD0334                           ACC16
 3630  FD0334  C2 20                    rep     #PMFLAG
 3631                                   .LONGA  on
 3632                                   .MNLIST
 3633  FD0336  E6 24                    inc     nslctl
 3634  FD0338  E6 1C            ?07:    inc     cline
 3635  FD033A                           ACC08
 3636  FD033A  E2 20                    sep     #PMFLAG
 3637                                   .LONGA  off
 3638                                   .MNLIST
 3639  FD033C  4C 4F 05                 JMP     updsl
 3640                           
 3641                           ; SHIFT+END -> fine linea
 3642                           ; P310D:
 3643  FD033F                   goendln:
 3644  FD033F  20 70 0F                 JSR     nextln
 3645  FD0342  B0 03                    BCS     ?01
 3646  FD0344  20 1E 10                 JSR     decptr2
 3647  FD0347  A9 4B            ?01:    LDA     #COLX
 3648  FD0349  85 21                    STA     scol
 3649  FD034B  4C 2E 04                 JMP     updwin0
 3650                           
 3651                           ; ; SHIFT+HOME -> inizio linea
 3652                           ; P311D:
 3653  FD034E                   gostartln:
 3654  FD034E  20 70 0F                 JSR     nextln
 3655  FD0351  B0 03                    BCS     ?01
 3656  FD0353  20 8C 0F                 JSR     startln
 3657  FD0356  4C 2E 04         ?01:    JMP     updwin0
 3658                           
 3659                           ; P1EC8:
 3660  FD0359                   pagedwn:
 3661  FD0359  A9 14                    LDA     #$14
 3662  FD035B  85 2F                    STA     ctmp
 3663  FD035D  20 70 0F         ?01:    JSR     nextln
 3664  FD0360  B0 0C                    BCS     ?03
 3665  FD0362  A5 23                    LDA     fslct
 3666  FD0364                           ACC16
 3667  FD0364  C2 20                    rep     #PMFLAG
 3668                                   .LONGA  on
 3669                                   .MNLIST
 3670  FD0366  F0 02                    BEQ     ?02
 3671  FD0368  E6 24                    INC     nslctl
 3672  FD036A  E6 1C            ?02:    INC     cline
 3673  FD036C                           ACC08
 3674  FD036C  E2 20                    sep     #PMFLAG
 3675                                   .LONGA  off
 3676                                   .MNLIST
 3677  FD036E  C6 2F            ?03:    DEC     ctmp
 3678  FD0370  D0 EB                    BNE     ?01
 3679  FD0372  A9 11                    LDA     #$11
 3680  FD0374  80 1E                    bra     epage
 3681                           
 3682                           ; P1EF1:
 3683  FD0376                   pageup:
  Tue Jul 17 11:00:22 2018                                                                                               Page   20




 3684  FD0376  A9 14                    LDA     #$14
 3685  FD0378  85 2F                    STA     ctmp
 3686  FD037A  20 AD 0E                 JSR     pp8mv
 3687  FD037D  20 8C 0F         ?01:    JSR     startln
 3688  FD0380  B0 0C                    BCS     ?05
 3689  FD0382  A5 23                    LDA     fslct
 3690  FD0384                           ACC16
 3691  FD0384  C2 20                    rep     #PMFLAG
 3692                                   .LONGA  on
 3693                                   .MNLIST
 3694  FD0386  F0 02                    BEQ     ?03
 3695  FD0388  C6 24                    DEC     nslctl
 3696  FD038A  C6 1C            ?03:    DEC     cline
 3697  FD038C                           ACC08
 3698  FD038C  E2 20                    sep     #PMFLAG
 3699                                   .LONGA  off
 3700                                   .MNLIST
 3701  FD038E  C6 2F            ?05:    DEC     ctmp
 3702  FD0390  D0 EB                    BNE     ?01
 3703  FD0392  A9 06                    LDA     #$06
 3704                           
 3705                           ; P1F1D:
 3706  FD0394                   epage:
 3707  FD0394  85 20                    STA     srow
 3708  FD0396  4C 32 04                 jmp     updwin
 3709                           
 3710                           ; HOME - inizio buffer
 3711                           ; P30C5:
 3712  FD0399                   gohome:
 3713  FD0399                           ACC16
 3714  FD0399  C2 20                    rep     #PMFLAG
 3715                                   .LONGA  on
 3716                                   .MNLIST
 3717  FD039B  A5 12                    LDA     pbuf                    ; set current block to first block
 3718  FD039D  85 15                    STA     ppage
 3719  FD039F  A2 05                    LDX     #BSTART
 3720  FD03A1  86 17                    STX     ixb
 3721  FD03A3  A6 23                    LDX     fslct                   
 3722  FD03A5  F0 07                    BEQ     ?01                     ; no selection
 3723  FD03A7  38                       SEC
 3724  FD03A8  A5 24                    LDA     nslctl                  ; update selection range
 3725  FD03AA  E5 1C                    SBC     cline
 3726  FD03AC  85 24                    STA     nslctl
 3727  FD03AE  64 1C            ?01:    STZ     cline                   ; current line = 0
 3728  FD03B0                           ACC08
 3729  FD03B0  E2 20                    sep     #PMFLAG
 3730                                   .LONGA  off
 3731                                   .MNLIST
 3732  FD03B2  80 7E                    bra     updwin
 3733                           
 3734                           ; END - fine buffer
 3735                           ; P30EC:
 3736  FD03B4                   goend:
 3737  FD03B4                           ACC16
 3738  FD03B4  C2 20                    rep     #PMFLAG
 3739                                   .LONGA  on
 3740                                   .MNLIST
  Tue Jul 17 11:00:22 2018                                                                                               Page   21




 3741  FD03B6  A7 14            ?00a:   lda     [pblk]
 3742  FD03B8  F0 04                    beq     ?00b
 3743  FD03BA  85 15                    sta     ppage
 3744  FD03BC  80 F8                    bra     ?00a
 3745  FD03BE                   ?00b:   ACC08   
 3746  FD03BE  E2 20                    sep     #PMFLAG
 3747                                   .LONGA  off
 3748                                   .MNLIST
 3749  FD03C0  A0 05                    ldy     #BSTART
 3750  FD03C2  84 17                    sty     ixb
 3751  FD03C4  20 70 0F                 jsr     nextln
 3752  FD03C7  B0 23                    bcs     ?04
 3753  FD03C9  20 1E 10                 jsr     decptr2
 3754  FD03CC  20 1E 10                 jsr     decptr2 
 3755  FD03CF  20 70 0F         ?00c:   jsr     nextln
 3756  FD03D2  90 FB                    bcc     ?00c
 3757  FD03D4                           ACC16
 3758  FD03D4  C2 20                    rep     #PMFLAG
 3759                                   .LONGA  on
 3760                                   .MNLIST
 3761  FD03D6  A5 1A                    lda     ncount
 3762  FD03D8  A4 23                    ldy     fslct
 3763  FD03DA  F0 0C                    beq     ?02
 3764  FD03DC  85 4A                    sta     wtmp
 3765  FD03DE  38                       sec
 3766  FD03DF  E5 1C                    sbc     cline
 3767  FD03E1  18                       clc
 3768  FD03E2  65 24                    adc     nslctl
 3769  FD03E4  85 24                    sta     nslctl
 3770  FD03E6  A5 4A                    lda     wtmp
 3771  FD03E8  85 1C            ?02:    sta     cline
 3772  FD03EA                           ACC08
 3773  FD03EA  E2 20                    sep     #PMFLAG
 3774                                   .LONGA  off
 3775                                   .MNLIST
 3776  FD03EC  A9 11            ?04:    LDA     #$11                    ; set screen row
 3777  FD03EE  85 20                    STA     srow
 3778  FD03F0  80 40                    bra     updwin
 3779                           
 3780                           ; tasto SHIFT RETURN
 3781                           ; P3129:
 3782  FD03F2                   kshenter:
 3783  FD03F2  A5 23                    LDA     fslct
 3784  FD03F4  F0 01                    beq     kshe
 3785  FD03F6  60               kshr:   rts
 3786  FD03F7  20 70 0F         kshe:   JSR     nextln                  ; find next line
 3787  FD03FA  B0 09                    BCS     ke2
 3788  FD03FC  20 1E 10                 JSR     decptr2                 ; decrement pointer
 3789  FD03FF  80 04                    bra     ke2
 3790                           
 3791                           ; tasto RETURN
 3792                           ; P288F:
 3793  FD0401                   kenter:
 3794  FD0401  A6 23                    LDX     fslct
 3795  FD0403  D0 F1                    bne     kshr
 3796  FD0405  20 BA 0E         ke2:    jsr     xblank                  ; count of starting blanks
 3797  FD0408  20 D5 0C                 jsr     inscr                   ; insert byte $0D (enter key code)
  Tue Jul 17 11:00:22 2018                                                                                               Page   22




 3798  FD040B  B0 E9                    bcs     kshr                    ; error
 3799  FD040D  20 DF 0F                 JSR     incptr2
 3800  FD0410  A5 20                    LDA     srow
 3801  FD0412  C9 11                    CMP     #$11
 3802  FD0414  B0 08                    BCS     ?02
 3803  FD0416  20 4D 15                 JSR     incrow                  ; increment cursor row
 3804  FD0419  20 D7 0D                 JSR     startln6
 3805  FD041C  80 03                    bra     ?03
 3806  FD041E  20 00 0E         ?02:    JSR     nextln4
 3807  FD0421  64 21            ?03:    STZ     scol                    ; screen column = 0
 3808  FD0423                           ACC16
 3809  FD0423  C2 20                    rep     #PMFLAG
 3810                                   .LONGA  on
 3811                                   .MNLIST
 3812  FD0425  E6 1C                    INC     cline                   ; increment current line
 3813  FD0427  E6 1A                    inc     ncount
 3814  FD0429                   ?05:    ACC08
 3815  FD0429  E2 20                    sep     #PMFLAG
 3816                                   .LONGA  off
 3817                                   .MNLIST
 3818  FD042B  20 AE 06                 jsr     indent
 3819                           
 3820                           ; P19DB:
 3821  FD042E                   updwin0:
 3822  FD042E  A9 00                    LDA     #$00                    ; no cursor address update
 3823  FD0430  F0 02                    BEQ     updatew
 3824                           
 3825                           ; P19E0:
 3826  FD0432                   updwin:
 3827  FD0432  A9 01                    LDA     #$01                    ; update cursor address
 3828                           
 3829                           ; P19E3:
 3830  FD0434                   updatew:
 3831  FD0434  48                       PHA
 3832  FD0435  20 93 0E                 JSR     mvpp2
 3833  FD0438  20 A9 0F                 JSR     getbyte
 3834  FD043B  B0 09                    BCS     ?02
 3835  FD043D  20 BE 0F                 JSR     incptr
 3836  FD0440  20 8C 0F                 JSR     startln
 3837  FD0443  CA                       DEX
 3838  FD0444  80 02                    bra     ?03
 3839  FD0446  A2 00            ?02:    LDX     #$00
 3840  FD0448  86 1E            ?03:    STX     ccol                    ; update current editor column
 3841  FD044A  86 27                    STX     xcol
 3842  FD044C  8A                       TXA
 3843  FD044D  38                       SEC
 3844  FD044E  E5 21                    SBC     scol
 3845  FD0450  B0 06                    BCS     ?04
 3846  FD0452  A5 1E                    LDA     ccol
 3847  FD0454  85 21                    STA     scol
 3848  FD0456  A9 00                    LDA     #$00
 3849  FD0458  85 1F            ?04:    STA     ecol
 3850  FD045A  20 A0 0E                 JSR     mvpp8
 3851  FD045D  20 70 0F                 JSR     nextln
 3852  FD0460  86 22                    STX     ccnt
 3853  FD0462  A3 01                    lda     $01,s
 3854  FD0464  F0 06                    BEQ     ?05
  Tue Jul 17 11:00:22 2018                                                                                               Page   23




 3855  FD0466  20 AD 0E                 JSR     pp8mv
 3856  FD0469  20 6A 0D                 JSR     findrow
 3857  FD046C  20 B1 14         ?05:    JSR     chksel
 3858  FD046F                           ACC16
 3859  FD046F  C2 20                    rep     #PMFLAG
 3860                                   .LONGA  on
 3861                                   .MNLIST
 3862  FD0471  38                       sec
 3863  FD0472  A9 00 00                 LDA     #!TXTADDR
 3864  FD0475  E9 50 00                 SBC     #MAXCOLS
 3865  FD0478  85 34                    STA     stxtp
 3866  FD047A  38                       sec
 3867  FD047B  A9 00 08                 LDA     #!TXTATTR
 3868  FD047E  E9 50 00                 SBC     #MAXCOLS
 3869  FD0481  85 38                    sta     sattp
 3870  FD0483                           ACC08
 3871  FD0483  E2 20                    sep     #PMFLAG
 3872                                   .LONGA  off
 3873                                   .MNLIST
 3874  FD0485  A9 FF                    LDA     #$FF
 3875  FD0487  85 2F                    STA     ctmp
 3876  FD0489  A6 04                    LDX     pp4
 3877  FD048B  A5 05                    lda     pp4+1
 3878  FD048D  A4 0C                    LDY     ix4
 3879  FD048F  20 60 14                 JSR     setptr
 3880  FD0492                   ?06:    ACC16CLC        
 3881  FD0492  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3882                                   .LONGA  on
 3883                                   .MNLIST
 3884  FD0494  A5 34                    LDA     stxtp
 3885  FD0496  69 50 00                 ADC     #MAXCOLS
 3886  FD0499  85 34                    sta     stxtp
 3887  FD049B  18                       clc
 3888  FD049C  A5 38                    LDA     sattp
 3889  FD049E  69 50 00                 ADC     #MAXCOLS
 3890  FD04A1  85 38                    sta     sattp
 3891  FD04A3                           ACC08
 3892  FD04A3  E2 20                    sep     #PMFLAG
 3893                                   .LONGA  off
 3894                                   .MNLIST
 3895  FD04A5  E6 2F                    INC     ctmp
 3896  FD04A7  A5 23                    LDA     fslct
 3897  FD04A9  F0 0E                    BEQ     ?07
 3898  FD04AB  A5 2F                    LDA     ctmp
 3899  FD04AD  C5 2A                    CMP     rslctl
 3900  FD04AF  90 08                    BCC     ?07
 3901  FD04B1  C5 2B                    CMP     rslcth
 3902  FD04B3  B0 04                    BCS     ?07
 3903  FD04B5  A9 80                    LDA     #$80
 3904  FD04B7  85 37                    STA     frev
 3905  FD04B9  20 69 12         ?07:    JSR     updrow
 3906  FD04BC  B0 07                    BCS     ?08
 3907  FD04BE  A5 2F                    LDA     ctmp
 3908  FD04C0  C9 17                    CMP     #$17
 3909  FD04C2  D0 CE                    BNE     ?06
 3910  FD04C4  18                       CLC 
 3911  FD04C5  A3 01            ?08:    lda     $01,s
  Tue Jul 17 11:00:22 2018                                                                                               Page   24




 3912  FD04C7  F0 2B                    BEQ     ?11
 3913  FD04C9  AF 86 12 FD              LDA     >updr1+2                ; page
 3914  FD04CD  B0 19                    BCS     ?09
 3915  FD04CF  85 15                    STA     ppage
 3916  FD04D1  A5 40                    lda     sbank                   ; bank
 3917  FD04D3  85 16                    STA     ppage+1
 3918  FD04D5  86 17                    STX     ixb
 3919  FD04D7  20 8C 0F                 JSR     startln
 3920  FD04DA  A5 15                    LDA     ppage
 3921  FD04DC  85 06                    STA     pp6
 3922  FD04DE  A5 16                    LDA     ppage+1
 3923  FD04E0  85 07                    STA     pp6+1
 3924  FD04E2  A5 17                    LDA     ixb
 3925  FD04E4  85 0D                    STA     ix6
 3926  FD04E6  80 08                    bra     ?10
 3927  FD04E8  85 06            ?09:    STA     pp6
 3928  FD04EA  A5 40                    lda     sbank
 3929  FD04EC  85 07                    sta     pp6+1   
 3930  FD04EE  86 0D                    STX     ix6
 3931  FD04F0  A5 2F            ?10:    LDA     ctmp
 3932  FD04F2  85 26                    STA     rcnt
 3933  FD04F4  A5 2F            ?11:    LDA     ctmp
 3934  FD04F6  C9 17                    CMP     #$17
 3935  FD04F8  F0 27                    BEQ     ?13
 3936  FD04FA                           ACC16CLC
 3937  FD04FA  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3938                                   .LONGA  on
 3939                                   .MNLIST
 3940  FD04FC  A5 34                    LDA     stxtp
 3941  FD04FE  69 50 00                 ADC     #MAXCOLS
 3942  FD0501  85 34                    STA     stxtp
 3943  FD0503  18                       clc
 3944  FD0504  A5 38                    LDA     sattp
 3945  FD0506  69 50 00                 ADC     #MAXCOLS
 3946  FD0509  85 38                    STA     sattp
 3947  FD050B                           ACC08
 3948  FD050B  E2 20                    sep     #PMFLAG
 3949                                   .LONGA  off
 3950                                   .MNLIST
 3951  FD050D  A9 20                    LDA     #' '
 3952  FD050F  EB                       xba
 3953  FD0510  A5 3B                    lda     eattr                   ; A = attribute, B = blank
 3954  FD0512  A0 4F                    LDY     #MAXCOLS-1
 3955  FD0514  97 38            ?12:    sta     [sattp],y               ; store attribute
 3956  FD0516  EB                       xba
 3957  FD0517  97 34                    sta     [stxtp],y               ; store blank
 3958  FD0519  EB                       xba
 3959  FD051A  88                       DEY
 3960  FD051B  10 F7                    BPL     ?12
 3961  FD051D  E6 2F                    INC     ctmp
 3962  FD051F  80 D3                    bra     ?11
 3963  FD0521  20 4A 0E         ?13:    JSR     pp2mv
 3964  FD0524  68                       PLA
 3965  FD0525  F0 28                    beq     updsl
 3966  FD0527  64 2D                    STZ     curs+1
 3967  FD0529  A5 20                    LDA     srow
 3968  FD052B  0A                       ASL     a
  Tue Jul 17 11:00:22 2018                                                                                               Page   25




 3969  FD052C  0A                       ASL     a                       ; srow * 4
 3970  FD052D  65 20                    ADC     srow                    ; srow * 5
 3971  FD052F  0A                       ASL     a
 3972  FD0530  0A                       ASL     a                       ; srow * 20
 3973  FD0531  26 2D                    ROL     curs+1
 3974  FD0533  0A                       ASL     a                       ; * 40
 3975  FD0534  26 2D                    ROL     curs+1
 3976  FD0536  0A                       ASL     a                       ; * 80
 3977  FD0537  26 2D                    ROL     curs+1
 3978  FD0539  85 2C                    STA     curs
 3979  FD053B  A5 2D                    LDA     curs+1
 3980  FD053D  69 00                    ADC     #>TXTADDR
 3981  FD053F  85 2D                    STA     curs+1
 3982  FD0541  80 0C                    bra     updsl
 3983                           
 3984                           ; print error message in status line and wait for <enter> key pressed
 3985                           ; in:   X - error number
 3986                           ; P1C3D:
 3987  FD0543                   error:
 3988  FD0543  A5 3D                    lda     seatt                   ; error attribute
 3989  FD0545  20 34 16                 jsr     msgstr
 3990  FD0548  20 12 16                 jsr     waitent
 3991  FD054B  A9 40                    lda     #$40                    ; force update status line
 3992                                   ;tsb    slfg
 3993  FD054D  85 3F                    sta     slfg
 3994                           
 3995                           ; update status line (edit mode only)
 3996                           ; P2989:
 3997  FD054F                   updsl:
 3998  FD054F  24 3F                    bit     slfg
 3999  FD0551  10 01                    bpl     ?00                     ; skip if in command line mode
 4000  FD0553  60                       rts     
 4001  FD0554  50 20            ?00:    bvc     ?04                     ; partial update only
 4002  FD0556  A5 3C                    lda     slattr                  ; status line attribute
 4003  FD0558  EB                       xba
 4004  FD0559  24 33                    bit     edtfg
 4005  FD055B  50 06                    bvc     ?02                     ; standard edit buffer
 4006  FD055D  A2 F4                    ldx     #<stlstr2               ; clipboard status line string
 4007  FD055F  A0 21                    ldy     #>stlstr2
 4008  FD0561  80 0C                    bra     ?03
 4009  FD0563  A2 54            ?02:    ldx     #<stlstr        ; std cbm fs buffer status line string
 4010  FD0565  A0 21                    ldy     #>stlstr
 4011  FD0567  24 DD                    bit     fsmode          ; <7>: cbm fs
 4012  FD0569  30 04                    bmi     ?03
 4013  FD056B  A2 A4                    ldx     #<stlstr1       ; std fat buffer status line string
 4014  FD056D  A0 21                    ldy     #>stlstr1
 4015  FD056F  A9 FD            ?03:    lda     #^stlstr
 4016  FD0571  20 54 16                 jsr     outstr
 4017  FD0574  80 0E                    bra     ?05
 4018  FD0576                   ?04:    ACC16
 4019  FD0576  C2 20                    rep     #PMFLAG
 4020                                   .LONGA  on
 4021                                   .MNLIST
 4022  FD0578  A9 80 07                 lda     #!STLINE                ; set address of last screen row
 4023  FD057B  85 34                    sta     stxtp
 4024  FD057D  A9 80 0F                 lda     #!STLATTR
 4025  FD0580  85 38                    sta     sattp
  Tue Jul 17 11:00:22 2018                                                                                               Page   26




 4026  FD0582                           ACC08
 4027  FD0582  E2 20                    sep     #PMFLAG
 4028                                   .LONGA  off
 4029                                   .MNLIST
 4030  FD0584  A9 02            ?05:    lda     #$02
 4031  FD0586  24 3F                    bit     slfg                    ; test bit 1
 4032  FD0588  F0 03                    beq     ?05a
 4033  FD058A  4C 48 06                 jmp     ?70                     ; update caps & num only        
 4034  FD058D  A5 0F            ?05a:   lda     xbuf                    ; update buffer # indicator
 4035  FD058F  C5 47                    cmp     xbuf1
 4036  FD0591  D0 04                    bne     ?06                     ; changed: update
 4037  FD0593  24 3F                    bit     slfg                    ; not changed, check if forced update
 4038  FD0595  50 0F                    bvc     ?12                     ; no forced update
 4039  FD0597  85 47            ?06:    sta     xbuf1                   ; store buffer #
 4040  FD0599  24 33                    bit     edtfg                   ; skip buffer # for clipboard
 4041  FD059B  70 09                    bvs     ?12 
 4042  FD059D  09 30            ?08:    ora     #'0'                     ; buffer # = 0..9
 4043  FD059F  A0 08            ?10:    ldy     #8                      ; index of buffer #
 4044  FD05A1  97 34                    sta     [stxtp],y               ; update
 4045  FD05A3  20 80 06                 jsr     ?cfn            ; update filename
 4046  FD05A6                   ?12:    ACC16
 4047  FD05A6  C2 20                    rep     #PMFLAG
 4048                                   .LONGA  on
 4049                                   .MNLIST
 4050  FD05A8  A5 1A                    lda     ncount                  ; update total lines count
 4051  FD05AA  C5 44                    cmp     ncount1
 4052  FD05AC  85 44                    sta     ncount1                 ; save in advance for update
 4053  FD05AE  85 4A                    sta     wtmp                    ; save in advance for conversion
 4054  FD05B0                           ACC08
 4055  FD05B0  E2 20                    sep     #PMFLAG
 4056                                   .LONGA  off
 4057                                   .MNLIST
 4058  FD05B2  D0 04                    bne     ?14                     ; changed: update
 4059  FD05B4  24 3F                    bit     slfg                    ; not changed, check if forced update
 4060  FD05B6  50 0A                    bvc     ?16                     ; no forced update
 4061  FD05B8  20 A0 18         ?14:    jsr     int2str                 ; convert in string
 4062  FD05BB  A2 05                    ldx     #5                      ; 5 digits
 4063  FD05BD  A0 3B                    ldy     #$3B                    ; column of N#
 4064  FD05BF  20 71 06                 jsr     ?100
 4065  FD05C2                   ?16:    ACC16
 4066  FD05C2  C2 20                    rep     #PMFLAG
 4067                                   .LONGA  on
 4068                                   .MNLIST
 4069  FD05C4  A5 1C                    lda     cline                   ; update current line #
 4070  FD05C6  C5 42                    cmp     cline1
 4071  FD05C8  85 42                    sta     cline1                  ; save in advance for update
 4072  FD05CA  08                       php
 4073  FD05CB  1A                       inc     a
 4074  FD05CC  85 4A                    sta     wtmp                    ; save in advance for conversion
 4075  FD05CE  28                       plp
 4076  FD05CF                           ACC08
 4077  FD05CF  E2 20                    sep     #PMFLAG
 4078                                   .LONGA  off
 4079                                   .MNLIST
 4080  FD05D1  D0 04                    bne     ?18                     ; changed: update
 4081  FD05D3  24 3F                    bit     slfg                    ; not changed, check if forced update
 4082  FD05D5  50 0A                    bvc     ?20                     ; no forced update
  Tue Jul 17 11:00:22 2018                                                                                               Page   27




 4083  FD05D7  20 A0 18         ?18:    jsr     int2str                 ; convert in string
 4084  FD05DA  A2 05                    ldx     #5                      ; 5 digits
 4085  FD05DC  A0 44                    ldy     #$44                    ; column of L#
 4086  FD05DE  20 71 06                 jsr     ?100
 4087  FD05E1  A5 1E            ?20:    lda     ccol                    ; update current column #
 4088  FD05E3  C5 46                    cmp     ccol1
 4089  FD05E5  D0 04                    bne     ?22                     ; changed: update
 4090  FD05E7  24 3F                    bit     slfg                    ; not changed, check if forced update
 4091  FD05E9  50 0D                    bvc     ?24                     ; no forced update
 4092  FD05EB  85 46            ?22:    sta     ccol1
 4093  FD05ED  1A                       inc     a
 4094  FD05EE  20 96 18                 jsr     byte2str                ; convert in string
 4095  FD05F1  A2 03                    ldx     #3                      ; 3 digits
 4096  FD05F3  A0 4C                    ldy     #$4C                    ; column of C#
 4097  FD05F5  20 71 06                 jsr     ?100    
 4098  FD05F8  A5 18            ?24:    lda     bflag                   ; update flag's indicator's
 4099  FD05FA  C5 48                    cmp     bflag1
 4100  FD05FC  D0 04                    bne     ?26                     ; changed: update
 4101  FD05FE  24 3F                    bit     slfg                    ; not changed, check if forced update
 4102  FD0600  50 27                    bvc     ?34                     ; no forced update
 4103  FD0602  85 48            ?26:    sta     bflag1
 4104  FD0604  A6 49                    ldx     fgatt                   ; X = disabled flag attribute
 4105  FD0606  18                       clc
 4106  FD0607  24 48                    bit     bflag1                  ; check modified flag
 4107  FD0609  10 01                    bpl     ?28
 4108  FD060B  38                       sec                             ; enabled
 4109  FD060C  A0 2E            ?28:    ldy     #$2E                    ; column of M indicator
 4110  FD060E  20 69 06                 jsr     ?80
 4111  FD0611  18                       clc
 4112  FD0612  24 48                    bit     bflag1                  ; check overwrite flag
 4113  FD0614  50 01                    bvc     ?30
 4114  FD0616  38                       sec                             ; enabled
 4115  FD0617  A0 32            ?30:    ldy     #$32                    ; column of O indicator
 4116  FD0619  20 69 06                 jsr     ?80
 4117  FD061C  18                       clc
 4118  FD061D  A9 20                    lda     #$20
 4119  FD061F  24 48                    bit     bflag1                  ; check indent mode flag
 4120  FD0621  F0 01                    beq     ?32
 4121  FD0623  38                       sec                             ; enabled
 4122  FD0624  A0 30            ?32:    ldy     #$30                    ; column of I indicator
 4123  FD0626  20 69 06                 jsr     ?80
 4124  FD0629  A5 23            ?34:    lda     fslct                   ; select mode flag
 4125  FD062B  AA                       tax
 4126  FD062C  45 3F                    eor     slfg
 4127  FD062E  4A                       lsr     a                       ; bit 0 only
 4128  FD062F  B0 04                    bcs     ?36                     ; changed: update
 4129  FD0631  24 3F                    bit     slfg                    ; not changed, check if forced update
 4130  FD0633  50 13                    bvc     ?40                     ; no forced update
 4131  FD0635  A9 FE            ?36:    lda     #$FE                    ; set/reset bit 0 of slfg
 4132  FD0637  25 3F                    and     slfg
 4133  FD0639  9B                       txy
 4134  FD063A  F0 02                    beq     ?38                     ; reset
 4135  FD063C  09 01                    ora     #$01                    ; set
 4136  FD063E  85 3F            ?38:    sta     slfg
 4137  FD0640  4A                       lsr     a                       ; CF = indicator status
 4138  FD0641  A6 49                    ldx     fgatt                   ; X = disabled flag attribute
 4139  FD0643  A0 34                    ldy     #$34                    ; column of S indicator
  Tue Jul 17 11:00:22 2018                                                                                               Page   28




 4140  FD0645  20 69 06                 jsr     ?80
 4141  FD0648                           
 4142  FD0648                   ?40:
 4143  FD0648  A6 49            ?70:    ldx     fgatt                   ; X = disabled flag attribute
 4144  FD064A  AF 65 01 00              lda     >DP01ADDR+KbdToggle
 4145  FD064E  85 6B                    sta     tmpf
 4146  FD0650  18                       clc
 4147  FD0651  10 01                    bpl     ?72                     ; caps lock disabled                    
 4148  FD0653  38                       sec                             ; caps lock indicator enabled
 4149  FD0654  A0 35            ?72:    ldy     #$35                    ; column of C indicator
 4150  FD0656  20 69 06                 jsr     ?80
 4151  FD0659  18                       clc
 4152  FD065A  24 6B                    bit     tmpf                    ; check num lock
 4153  FD065C  50 01                    bvc     ?74
 4154  FD065E  38                       sec                             ; num lock indicator enabled
 4155  FD065F  A0 36            ?74:    ldy     #$36                    ; column of N indicator
 4156  FD0661  20 69 06                 jsr     ?80
 4157  FD0664  A9 42                    lda     #$42                    ; clear forced update
 4158  FD0666  14 3F                    trb     slfg
 4159  FD0668  60                       rts
 4160                           
 4161                           ; set/unset indicator flag on status line
 4162  FD0669  A5 3C            ?80:    lda     slattr                  ; set status
 4163  FD066B  B0 01                    bcs     ?82
 4164  FD066D  8A                       txa                             ; unset status
 4165  FD066E  97 38            ?82:    sta     [sattp],y
 4166  FD0670  60                       rts
 4167                           
 4168                           ; output stringa tstr2 at column Y, X bytes
 4169  FD0671  86 62            ?100:   stx     tmp6
 4170  FD0673  A2 00                    ldx     #0
 4171  FD0675  B5 52            ?102:   lda     <tstr2,x
 4172  FD0677  97 34                    sta     [stxtp],y
 4173  FD0679  E8                       inx
 4174  FD067A  C8                       iny
 4175  FD067B  C6 62                    dec     tmp6
 4176  FD067D  D0 F6                    bne     ?102
 4177  FD067F  60                       rts
 4178                           
 4179                           ; update cbm filename field
 4180  FD0680                   ?cfn:
 4181  FD0680  A2 00                    ldx     #0
 4182  FD0682  A0 0B                    ldy     #$0B            ; index of cbm filename
 4183  FD0684  BF 00 CD 01      ?cfnl:  lda     >EDCURFILE,x
 4184  FD0688  F0 08                    beq     ?cfne
 4185  FD068A  97 34                    sta     [stxtp],y
 4186  FD068C  E8                       inx
 4187  FD068D  C8                       iny
 4188  FD068E  E0 12                    cpx     #18
 4189  FD0690  90 F2                    bcc     ?cfnl
 4190  FD0692  60               ?cfne:  rts
 4191                           
 4192                           ; toggle insert flag
 4193                           ; control key: insert key
 4194  FD0693                   tins:
 4195  FD0693  A9 40                    lda     #$40                    ; insert flag
 4196  FD0695  AA                       tax
  Tue Jul 17 11:00:22 2018                                                                                               Page   29




 4197  FD0696  45 18                    eor     bflag                   ; toggle
 4198  FD0698  85 18                    sta     bflag
 4199  FD069A  8A                       txa
 4200  FD069B  45 2E                    eor     cursmode                ; toggle under/block cursor
 4201  FD069D  85 2E                    sta     cursmode
 4202  FD069F  20 FF 16                 jsr     setcurs
 4203  FD06A2  4C 4F 05                 jmp     updsl
 4204                           
 4205                           ; toggle indent flag
 4206                           ; Ctrl+TAB or Ctrl+I (control key)
 4207  FD06A5                   tind:
 4208  FD06A5  A9 20                    lda     #$20                    ; indent flag
 4209  FD06A7  45 18                    eor     bflag
 4210  FD06A9  85 18                    sta     bflag
 4211  FD06AB  4C 4F 05                 jmp     updsl
 4212                           
 4213                           ; indent new line
 4214  FD06AE                   indent:
 4215  FD06AE  A9 20                    lda     #$20                    ; test indent flag
 4216  FD06B0  24 18                    bit     bflag
 4217  FD06B2  F0 15                    beq     ?04                     ; no indent
 4218  FD06B4  A5 2F                    lda     ctmp
 4219  FD06B6  F0 11                    beq     ?04                     ; no blanks
 4220  FD06B8  A9 01                    lda     #$01                    ; no update edit window while indent...
 4221  FD06BA  04 33                    tsb     edtfg                   ; ... blank's insertion
 4222  FD06BC  A9 20            ?02:    lda     #' '                    ; insert starting blanks
 4223  FD06BE  20 AC 00                 jsr     edkey
 4224  FD06C1  C6 2F                    dec     ctmp
 4225  FD06C3  D0 F7                    bne     ?02
 4226  FD06C5  A9 01                    lda     #$01                    ; restore flag
 4227  FD06C7  14 33                    trb     edtfg
 4228  FD06C9  60               ?04:    rts
 4229                           
 4230                           ;---------------------------------------------------
 4231                           
 4232                           ; CTRL Y
 4233  FD06CA                   delline:
 4234  FD06CA  20 93 0E                 jsr     mvpp2
 4235  FD06CD  20 70 0F                 JSR     nextln
 4236  FD06D0  90 03                    bcc     ?04
 4237  FD06D2  4C 4A 0E         ?02:    jmp     pp2mv   
 4238  FD06D5  A5 15            ?04:    lda     ppage
 4239  FD06D7  85 53                    sta     pb+1
 4240  FD06D9  A5 16                    lda     ppage+1
 4241  FD06DB  85 54                    sta     pb+2
 4242  FD06DD  A5 17                    lda     ixb
 4243  FD06DF  85 6B                    sta     tmpf
 4244  FD06E1  20 8C 0F                 JSR     startln                 ; first byte of this line
 4245  FD06E4  B0 EC                    bcs     ?02
 4246  FD06E6                           ACC16
 4247  FD06E6  C2 20                    rep     #PMFLAG
 4248                                   .LONGA  on
 4249                                   .MNLIST
 4250  FD06E8  C6 1A                    dec     ncount
 4251  FD06EA  A5 15                    lda     ppage
 4252  FD06EC  C5 53                    cmp     pb+1
 4253  FD06EE                           ACC08
  Tue Jul 17 11:00:22 2018                                                                                               Page   30




 4254  FD06EE  E2 20                    sep     #PMFLAG
 4255                                   .LONGA  off
 4256                                   .MNLIST
 4257  FD06F0  F0 21                    beq     ?10                     ; whole line just in one block
 4258  FD06F2  A5 17                    LDA     ixb
 4259  FD06F4  C9 05                    CMP     #BSTART
 4260  FD06F6  D0 0A                    BNE     ?06
 4261  FD06F8  A5 16                    LDA     ppage+1                 ; block can be free'd
 4262  FD06FA  EB                       xba
 4263  FD06FB  A5 15                    lda     ppage
 4264  FD06FD  20 74 10                 JSR     delblk
 4265  FD0700  80 05                    bra     ?08
 4266  FD0702  3A               ?06:    dec     a                       ; just one byte less
 4267  FD0703  A0 04                    LDY     #BNDX
 4268  FD0705  97 14                    STA     [pblk],Y
 4269  FD0707  A5 53            ?08:    LDA     pb+1                    ; go in the next block
 4270  FD0709  85 15                    sta     ppage
 4271  FD070B  A5 54                    lda     pb+2
 4272  FD070D  85 16                    sta     ppage+1
 4273  FD070F  A9 05                    lda     #BSTART                 ; line continue at beginning... 
 4274  FD0711  85 17                    sta     ixb                     ; ...of next block
 4275  FD0713  A0 04            ?10:    LDY     #BNDX                   ; now move back bytes
 4276  FD0715  B7 14                    lda     [pblk],y
 4277  FD0717  85 62                    sta     tmp6
 4278  FD0719  A4 6B                    LDY     tmpf
 4279  FD071B  88                       DEY
 4280  FD071C  84 63                    STY     tmp7
 4281  FD071E  A6 17                    LDX     ixb
 4282  FD0720  CA                       DEX
 4283  FD0721  E6 63            ?12:    INC     tmp7
 4284  FD0723  E8                       inx
 4285  FD0724  A4 63                    LDY     tmp7
 4286  FD0726  B7 14                    lda     [pblk],y
 4287  FD0728  9B                       txy
 4288  FD0729  97 14                    STA     [pblk],Y
 4289  FD072B  A5 62                    lda     tmp6
 4290  FD072D  C5 63                    CMP     tmp7
 4291  FD072F  D0 F0                    BNE     ?12
 4292  FD0731  8A                       txa
 4293  FD0732  A0 04                    LDY     #BNDX
 4294  FD0734  97 14                    STA     [pblk],Y
 4295  FD0736  4C 32 04                 JMP     updwin
 4296                           
 4297  FD0739                           
 4298  FD0739                   copysel:
 4299  FD0739  A9 02                    lda     #$02                    ; copy operation: reset flag
 4300  FD073B  14 33                    trb     edtfg
 4301  FD073D  64 30                    stz     ctmp2                   ; copy op (zero)
 4302  FD073F  80 0B                    bra     ct1
 4303                           
 4304  FD0741                   cberr:
 4305  FD0741  A2 05                    ldx     #$05
 4306  FD0743  4C 43 05                 jmp     error                   ; Clipboard: illegal command
 4307                           
 4308                           ; CUT
 4309                           ; P1F4F:
 4310  FD0746                   cutsel:
  Tue Jul 17 11:00:22 2018                                                                                               Page   31




 4311  FD0746  A9 02                    lda     #$02                    ; cut operation: set flag
 4312  FD0748  04 33                    tsb     edtfg
 4313  FD074A  85 30                    sta     ctmp2                   ; cut op (not zero)                     
 4314  FD074C  24 33            ct1:    bit     edtfg
 4315  FD074E  70 F1                    bvs     cberr                   ; clipboard error
 4316  FD0750  A5 23                    LDA     fslct
 4317  FD0752  F0 2B                    beq     ?00a
 4318  FD0754  64 23                    stz     fslct
 4319  FD0756  A9 0A                    LDA     #CLIPBRD
 4320  FD0758  20 78 0B                 JSR     freebuf
 4321  FD075B  64 52                    STZ     pb
 4322  FD075D  64 55                    STZ     pd
 4323  FD075F  20 93 0E                 JSR     mvpp2
 4324  FD0762  20 DF 0A                 JSR     newblk                  ; need at least of 2 free blocks
 4325  FD0765  B0 15                    BCS     ?00                     ; no free blocks
 4326  FD0767                           ACC16
 4327  FD0767  C2 20                    rep     #PMFLAG
 4328                                   .LONGA  on
 4329                                   .MNLIST
 4330  FD0769  85 58                    STA     bka
 4331  FD076B  85 53                    STA     pb+1
 4332  FD076D  A7 52                    lda     [pb]
 4333  FD076F  85 10                    STA     pfree
 4334  FD0771  20 DF 0A                 JSR     newblk
 4335  FD0774  90 0A                    BCC     ?01                     ; ok
 4336  FD0776  A5 58                    LDA     bka                     ; restore free list
 4337  FD0778  85 10                    STA     pfree
 4338  FD077A                           ACC08
 4339  FD077A  E2 20                    sep     #PMFLAG
 4340                                   .LONGA  off
 4341                                   .MNLIST
 4342  FD077C  20 32 04         ?00:    jsr     updwin                  ; for clear selection on edit window
 4343  FD077F  60               ?00a:   rts
 4344  FD0780  85 5A            ?01:    STA     bkb
 4345                                   .LONGA  on                      ; remember here A/M 16 bit
 4346  FD0782  A5 00                    LDA     pp0
 4347  FD0784  85 15                    STA     ppage
 4348  FD0786  A4 0A                    LDY     ix0
 4349  FD0788  84 17                    STY     ixb     
 4350  FD078A  A5 24                    LDA     nslctl
 4351  FD078C  30 0C                    BMI     ?02
 4352  FD078E  85 28                    STA     rclip
 4353  FD0790  A5 08                    LDA     pp8
 4354  FD0792  85 06                    STA     pp6
 4355  FD0794  A4 0E                    LDY     ix8
 4356  FD0796  84 0D                    STY     ix6
 4357  FD0798  80 1F                    bra     ?04
 4358  FD079A  49 FF FF         ?02:    EOR     #$FFFF
 4359  FD079D  1A                       inc     a
 4360  FD079E  85 28                    STA     rclip
 4361  FD07A0                           ACC08
 4362  FD07A0  E2 20                    sep     #PMFLAG
 4363                                   .LONGA  off
 4364                                   .MNLIST
 4365  FD07A2  20 70 0F                 JSR     nextln
 4366  FD07A5  A5 15                    LDA     ppage
 4367  FD07A7  85 06                    STA     pp6
  Tue Jul 17 11:00:22 2018                                                                                               Page   32




 4368  FD07A9  A5 16                    LDA     ppage+1
 4369  FD07AB  85 07                    STA     pp6+1
 4370  FD07AD  A5 17                    LDA     ixb
 4371  FD07AF  85 0D                    STA     ix6
 4372  FD07B1  20 4A 0E                 JSR     pp2mv
 4373  FD07B4  20 70 0F                 JSR     nextln
 4374  FD07B7                           ACC16
 4375  FD07B7  C2 20                    rep     #PMFLAG
 4376                                   .LONGA  on
 4377                                   .MNLIST
 4378  FD07B9  A6 30            ?04:    ldx     ctmp2
 4379  FD07BB  F0 16                    beq     ?06                     ; copy op: skip update cline/ncount
 4380  FD07BD  38                       sec
 4381  FD07BE  A5 1A                    lda     ncount
 4382  FD07C0  E5 28                    sbc     rclip
 4383  FD07C2  85 1A                    sta     ncount
 4384  FD07C4  A5 24                    LDA     nslctl
 4385  FD07C6  30 09                    BMI     ?05
 4386  FD07C8  38                       SEC
 4387  FD07C9  A5 1C                    LDA     cline
 4388  FD07CB  E5 28                    SBC     rclip
 4389  FD07CD  85 1C                    STA     cline
 4390  FD07CF  80 02                    bra     ?06
 4391  FD07D1  E6 1C            ?05:    INC     cline
 4392  FD07D3  A5 58            ?06:    LDA     bka
 4393  FD07D5  85 53                    STA     pb+1
 4394  FD07D7  A2 14                    LDX     #CLIPBRD*2
 4395  FD07D9  95 6C                    STA     bstart,X
 4396  FD07DB  95 82                    STA     bcur,X
 4397  FD07DD  A9 05 00                 LDA     #BSTART
 4398  FD07E0  95 98                    STA     bndx,X
 4399  FD07E2  A5 28                    lda     rclip
 4400  FD07E4  95 C4                    sta     btot,x
 4401  FD07E6  74 AE                    stz     bline,x
 4402  FD07E8  A5 15                    LDA     ppage
 4403  FD07EA  C5 06                    CMP     pp6
 4404  FD07EC                           ACC08
 4405  FD07EC  E2 20                    sep     #PMFLAG
 4406                                   .LONGA  off
 4407                                   .MNLIST
 4408  FD07EE  D0 03                    BNE     ?07
 4409  FD07F0  4C BB 08                 JMP     ?13                     ; all in the same block
 4410  FD07F3  A6 30            ?07:    ldx     ctmp2
 4411  FD07F5  D0 03                    bne     ?07a                    ; cut op
 4412  FD07F7  4C 19 09                 jmp     ?20                     ; copy op
 4413  FD07FA  A0 00            ?07a:   LDY     #$00
 4414  FD07FC                           CPU16
 4415  FD07FC  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 4416                                   .LONGA  on
 4417                                   .LONGI  on
 4418                                   .MNLIST
 4419  FD07FE  A5 5A                    LDA     bkb                     ; take off bkb from free list
 4420  FD0800  85 56                    STA     pd+1
 4421  FD0802  A7 55                    lda     [pd]
 4422  FD0804  85 10                    STA     pfree
 4423  FD0806  A7 14                    lda     [pblk]
 4424  FD0808  87 52                    STA     [pb]                    ; pb->next = cur->next
  Tue Jul 17 11:00:22 2018                                                                                               Page   33




 4425  FD080A  85 56                    STA     pd+1                    ; pd = cur->next
 4426  FD080C  98                       TYA
 4427  FD080D  C8                       INY
 4428  FD080E  C8                       INY
 4429  FD080F  97 52                    STA     [pb],Y                  ; pb->prev = NULL
 4430  FD0811  A5 53                    LDA     pb+1
 4431  FD0813  97 55                    STA     [pd],Y                  ; cur->next->prev = pb
 4432  FD0815                           CPU08
 4433  FD0815  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 4434                                   .LONGA  off
 4435                                   .LONGI  off
 4436                                   .MNLIST
 4437  FD0817  C8                       INY
 4438  FD0818  C8                       INY                             ; index field
 4439  FD0819  B7 14                    lda     [pblk],y
 4440  FD081B  85 62                    sta     tmp6
 4441  FD081D  38                       SEC
 4442  FD081E  E5 17                    SBC     ixb
 4443  FD0820  18                       CLC
 4444  FD0821  69 05                    ADC     #BSTART
 4445  FD0823  97 52                    STA     [pb],Y
 4446  FD0825  BB                       tyx                             ; BNDX
 4447  FD0826  A4 17                    LDY     ixb
 4448  FD0828  88                       DEY
 4449  FD0829  84 63                    STY     tmp7
 4450  FD082B  E6 63            ?08:    INC     tmp7
 4451  FD082D  E8                       inx
 4452  FD082E  A4 63                    LDY     tmp7
 4453  FD0830  B7 14                    lda     [pblk],y        
 4454  FD0832  9B                       txy
 4455  FD0833  97 52                    STA     [pb],Y
 4456  FD0835  A5 62                    lda     tmp6
 4457  FD0837  C5 63                    CMP     tmp7
 4458  FD0839  D0 F0                    BNE     ?08
 4459  FD083B                           ACC16
 4460  FD083B  C2 20                    rep     #PMFLAG
 4461                                   .LONGA  on
 4462                                   .MNLIST
 4463  FD083D  A5 5A                    LDA     bkb
 4464  FD083F  85 56                    STA     pd+1
 4465  FD0841  A5 06                    LDA     pp6
 4466  FD0843  85 53                    STA     pb+1
 4467  FD0845  A7 52                    lda     [pb]
 4468  FD0847  87 55                    STA     [pd]
 4469  FD0849                           ACC08
 4470  FD0849  E2 20                    sep     #PMFLAG
 4471                                   .LONGA  off
 4472                                   .MNLIST
 4473  FD084B  A0 04                    LDY     #BNDX
 4474  FD084D  B7 52                    lda     [pb],y
 4475  FD084F  85 62                    sta     tmp6
 4476  FD0851  38                       SEC
 4477  FD0852  E5 0D                    SBC     ix6
 4478  FD0854  18                       CLC
 4479  FD0855  69 05                    ADC     #BSTART
 4480  FD0857  97 55                    STA     [pd],Y
 4481  FD0859  BB                       tyx
  Tue Jul 17 11:00:22 2018                                                                                               Page   34




 4482  FD085A  A4 0D                    LDY     ix6
 4483  FD085C  88                       DEY
 4484  FD085D  84 63                    STY     tmp7
 4485  FD085F  E6 63            ?09:    INC     tmp7
 4486  FD0861  E8                       inx
 4487  FD0862  A4 63                    LDY     tmp7
 4488  FD0864  B7 52                    lda     [pb],y
 4489  FD0866  9B                       txy
 4490  FD0867  97 55                    STA     [pd],Y
 4491  FD0869  A5 62                    lda     tmp6
 4492  FD086B  C5 63                    CMP     tmp7
 4493  FD086D  D0 F0                    BNE     ?09
 4494  FD086F  A0 04                    LDY     #BNDX
 4495  FD0871  A5 0D                    LDA     ix6
 4496  FD0873  97 52                    STA     [pb],Y
 4497  FD0875  A8                       TAY
 4498  FD0876  A9 00                    LDA     #$00
 4499  FD0878  97 52                    STA     [pb],Y
 4500  FD087A  EB                       xba
 4501  FD087B  A9 00                    lda     #0
 4502  FD087D                           ACC16
 4503  FD087D  C2 20                    rep     #PMFLAG
 4504                                   .LONGA  on
 4505                                   .MNLIST
 4506  FD087F  87 52                    STA     [pb]                    ; next = NULL
 4507  FD0881  A0 02                    LDY     #BPREV
 4508  FD0883  A5 15                    LDA     ppage
 4509  FD0885  97 55                    STA     [pd],Y
 4510  FD0887  A5 56                    LDA     pd+1
 4511  FD0889  87 14                    STA     [pblk]
 4512  FD088B  A7 55                    lda     [pd]
 4513  FD088D  F0 06                    BEQ     ?10
 4514  FD088F  85 53                    STA     pb+1
 4515  FD0891  A5 56                    LDA     pd+1
 4516  FD0893  97 52                    STA     [pb],Y
 4517  FD0895                   ?10:    ACC08   
 4518  FD0895  E2 20                    sep     #PMFLAG
 4519                                   .LONGA  off
 4520                                   .MNLIST
 4521  FD0897  A5 17                    LDA     ixb
 4522  FD0899  C9 05                    CMP     #BSTART
 4523  FD089B  D0 0A                    BNE     ?11
 4524  FD089D  A5 16                    LDA     ppage+1
 4525  FD089F  EB                       xba
 4526  FD08A0  A5 15                    lda     ppage
 4527  FD08A2  20 74 10                 JSR     delblk
 4528  FD08A5  80 05                    bra     ?12
 4529  FD08A7  3A               ?11:    dec     a
 4530  FD08A8  A0 04                    LDY     #BNDX
 4531  FD08AA  97 14                    STA     [pblk],Y
 4532  FD08AC  A5 56            ?12:    LDA     pd+1
 4533  FD08AE  85 15                    STA     ppage
 4534  FD08B0  A5 57                    lda     pd+2
 4535  FD08B2  85 16                    sta     ppage+1
 4536  FD08B4  A9 05                    LDA     #BSTART
 4537  FD08B6  85 17                    STA     ixb
 4538  FD08B8  4C 32 04                 JMP     updwin
  Tue Jul 17 11:00:22 2018                                                                                               Page   35




 4539                           
 4540  FD08BB  A4 17            ?13:    LDY     ixb
 4541  FD08BD  84 63                    STY     tmp7
 4542  FD08BF  A2 05                    LDX     #BSTART
 4543  FD08C1  A4 63            ?14:    LDY     tmp7
 4544  FD08C3  B7 14                    lda     [pblk],y
 4545  FD08C5  9B                       txy
 4546  FD08C6  97 52                    STA     [pb],Y
 4547  FD08C8  E6 63                    INC     tmp7
 4548  FD08CA  E8                       inx
 4549  FD08CB  A5 63                    LDA     tmp7
 4550  FD08CD  C5 0D                    CMP     ix6
 4551  FD08CF  D0 F0                    BNE     ?14
 4552  FD08D1  A0 00                    LDY     #$00
 4553  FD08D3                           CPU16
 4554  FD08D3  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 4555                                   .LONGA  on
 4556                                   .LONGI  on
 4557                                   .MNLIST
 4558  FD08D5  98                       tya
 4559  FD08D6  87 52                    STA     [pb]                    ; next = NULL
 4560  FD08D8  C8                       INY
 4561  FD08D9  C8                       iny
 4562  FD08DA  97 52                    STA     [pb],Y                  ; prev = NULL
 4563  FD08DC                           CPU08
 4564  FD08DC  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 4565                                   .LONGA  off
 4566                                   .LONGI  off
 4567                                   .MNLIST
 4568  FD08DE  8A                       txa
 4569  FD08DF  C8                       INY
 4570  FD08E0  C8                       iny
 4571  FD08E1  97 52                    STA     [pb],Y                  ; index
 4572  FD08E3  A8                       TAY
 4573  FD08E4  A9 00                    LDA     #$00
 4574  FD08E6  97 52                    STA     [pb],Y                  ; buffer terminator
 4575  FD08E8  A9 02                    lda     #$02                    ; cut operation ?
 4576  FD08EA  24 33                    bit     edtfg
 4577  FD08EC  D0 05                    bne     ?14a                    ; yes
 4578  FD08EE  20 4A 0E                 jsr     pp2mv                   ; restore current buffer pointer
 4579  FD08F1  80 23                    bra     ?16
 4580  FD08F3  A0 04            ?14a:   LDY     #BNDX                   ; move back
 4581  FD08F5  B7 14                    lda     [pblk],y
 4582  FD08F7  85 62                    sta     tmp6
 4583  FD08F9  A4 0D                    LDY     ix6
 4584  FD08FB  88                       DEY
 4585  FD08FC  84 63                    STY     tmp7
 4586  FD08FE  A6 17                    LDX     ixb
 4587  FD0900  CA                       DEX
 4588  FD0901  E6 63            ?15:    INC     tmp7
 4589  FD0903  E8                       inx
 4590  FD0904  A4 63                    LDY     tmp7
 4591  FD0906  B7 14                    lda     [pblk],y
 4592  FD0908  9B                       txy
 4593  FD0909  97 14                    STA     [pblk],Y
 4594  FD090B  A5 62                    lda     tmp6
 4595  FD090D  C5 63                    CMP     tmp7
  Tue Jul 17 11:00:22 2018                                                                                               Page   36




 4596  FD090F  D0 F0                    BNE     ?15
 4597  FD0911  8A                       txa
 4598  FD0912  A0 04                    LDY     #BNDX
 4599  FD0914  97 14                    STA     [pblk],Y
 4600  FD0916  4C 32 04         ?16:    JMP     updwin
 4601                           
 4602  FD0919  A2 00            ?20:    ldx     #0
 4603  FD091B                           CPU16                           ; count needs block's
 4604  FD091B  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 4605                                   .LONGA  on
 4606                                   .LONGI  on
 4607                                   .MNLIST
 4608  FD091D  A5 5A                    LDA     bkb                     ; take off bkb from free list
 4609  FD091F  85 56                    STA     pd+1
 4610  FD0921  A7 55                    lda     [pd]
 4611  FD0923  85 10                    STA     pfree
 4612  FD0925  A5 15                    lda     ppage
 4613  FD0927  85 56            ?22:    sta     pd+1    
 4614  FD0929  A7 55                    lda     [pd]                    ; next
 4615  FD092B  C5 06                    cmp     pp6                     ; loop until last block
 4616  FD092D  F0 03                    beq     ?24                     ; end loop
 4617  FD092F  E8                       inx
 4618  FD0930  80 F5                    bra     ?22
 4619  FD0932  8A               ?24:    txa
 4620  FD0933  F0 13                    beq     ?28                     ; no more blocks need
 4621  FD0935  20 37 0B                 jsr     chkfree                 ; check needs blocks
 4622  FD0938  A9 00 00                 lda     #0
 4623  FD093B  90 0B                    bcc     ?28                     ; ok
 4624  FD093D  A5 58                    LDA     bka                     ; restore free list
 4625  FD093F  85 10                    STA     pfree
 4626  FD0941                           CPU08
 4627  FD0941  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 4628                                   .LONGA  off
 4629                                   .LONGI  off
 4630                                   .MNLIST
 4631  FD0943  A2 04                    LDX     #$04                    ; Not enough memory error
 4632  FD0945  4C 43 05                 JMP     error
 4633  FD0948                   ?28:    LONG_ON                         ; remember here A/M and X/Y 16 bit      
 4634                                   .LONGA  on
 4635                                   .LONGI  on
 4636                                   .MNLIST
 4637  FD0948  A0 02 00                 ldy     #BPREV
 4638  FD094B  97 52                    STA     [pb],Y                  ; prev = NULL
 4639  FD094D                           CPU08
 4640  FD094D  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 4641                                   .LONGA  off
 4642                                   .LONGI  off
 4643                                   .MNLIST
 4644  FD094F  C8                       INY
 4645  FD0950  C8                       INY                             ; index field
 4646  FD0951  B7 14                    lda     [pblk],y
 4647  FD0953  85 62                    sta     tmp6                    ; copy tmp6 - ixb + 1 bytes...
 4648  FD0955  38                       SEC                             ; ...from pblk to pb...
 4649  FD0956  E5 17                    SBC     ixb                     ; ...starting from ixb
 4650  FD0958  18                       CLC
 4651  FD0959  69 05                    ADC     #BSTART
 4652  FD095B  97 52                    STA     [pb],Y
  Tue Jul 17 11:00:22 2018                                                                                               Page   37




 4653  FD095D  BB                       tyx                             ; BNDX
 4654  FD095E  A4 17                    LDY     ixb
 4655  FD0960  88                       DEY
 4656  FD0961  84 63                    STY     tmp7
 4657  FD0963  E6 63            ?30:    INC     tmp7
 4658  FD0965  E8                       inx
 4659  FD0966  A4 63                    LDY     tmp7
 4660  FD0968  B7 14                    lda     [pblk],y        
 4661  FD096A  9B                       txy
 4662  FD096B  97 52                    STA     [pb],Y
 4663  FD096D  A5 62                    lda     tmp6
 4664  FD096F  C5 63                    CMP     tmp7
 4665  FD0971  D0 F0                    BNE     ?30     
 4666  FD0973                           ACC16
 4667  FD0973  C2 20                    rep     #PMFLAG
 4668                                   .LONGA  on
 4669                                   .MNLIST
 4670  FD0975  A7 14                    LDA     [pblk]                  ; next
 4671  FD0977  85 56            ?32:    STA     pd+1
 4672  FD0979  C5 06                    cmp     pp6
 4673  FD097B  F0 24                    beq     ?36
 4674  FD097D  A5 53                    LDA     pb+1
 4675  FD097F  48                       PHA
 4676  FD0980  20 DF 0A                 JSR     newblk                  ; no give error now!
 4677  FD0983  87 52                    STA     [pb]                    ; next
 4678  FD0985  85 53                    STA     pb+1
 4679  FD0987  A7 52                    lda     [pb]
 4680  FD0989  85 10                    STA     pfree
 4681  FD098B  68                       PLA
 4682  FD098C  A0 02                    ldy     #BPREV
 4683  FD098E  97 52                    STA     [pb],Y
 4684  FD0990  C8                       INY
 4685  FD0991  C8                       iny
 4686  FD0992                           ACC08
 4687  FD0992  E2 20                    sep     #PMFLAG
 4688                                   .LONGA  off
 4689                                   .MNLIST
 4690  FD0994  B7 55            ?34:    lda     [pd],y
 4691  FD0996  97 52                    STA     [pb],Y
 4692  FD0998  C8                       INY
 4693  FD0999  D0 F9                    BNE     ?34
 4694  FD099B                           ACC16
 4695  FD099B  C2 20                    rep     #PMFLAG
 4696                                   .LONGA  on
 4697                                   .MNLIST
 4698  FD099D  A7 55                    lda     [pd]
 4699  FD099F  80 D6                    bra     ?32
 4700  FD09A1  A5 53            ?36:    lda     pb+1
 4701  FD09A3  85 58                    sta     bka
 4702  FD09A5  A5 5A                    LDA     bkb
 4703  FD09A7  87 52                    sta     [pb]
 4704  FD09A9  85 53                    STA     pb+1
 4705  FD09AB  A9 00 00                 lda     #0
 4706  FD09AE  87 52                    sta     [pb]
 4707  FD09B0  A0 02                    ldy     #BPREV
 4708  FD09B2  A5 58                    lda     bka
 4709  FD09B4  97 52                    sta     [pb],y
  Tue Jul 17 11:00:22 2018                                                                                               Page   38




 4710  FD09B6                           ACC08
 4711  FD09B6  E2 20                    sep     #PMFLAG
 4712                                   .LONGA  off
 4713                                   .MNLIST
 4714  FD09B8  A0 04                    LDY     #BNDX
 4715  FD09BA  C8               ?38:    iny     
 4716  FD09BB  B7 55                    lda     [pd],y
 4717  FD09BD  97 52                    STA     [pb],Y
 4718  FD09BF  C4 0D                    cpy     ix6
 4719  FD09C1  D0 F7                    BNE     ?38
 4720  FD09C3  A0 04                    LDY     #BNDX
 4721  FD09C5  A5 0D                    LDA     ix6
 4722  FD09C7  97 52                    STA     [pb],Y
 4723  FD09C9  A8                       TAY
 4724  FD09CA  A9 00                    LDA     #$00
 4725  FD09CC  97 52                    STA     [pb],Y
 4726  FD09CE  20 4A 0E                 jsr     pp2mv
 4727  FD09D1  4C 32 04                 jmp     updwin
 4728                           
 4729                           ; PASTE
 4730                           ; P215E:
 4731  FD09D4                   pastesel:
 4732  FD09D4  24 33                    bit     edtfg
 4733  FD09D6  50 03                    bvc     ?00
 4734  FD09D8  4C 41 07                 jmp     cberr                   ; clipboard error
 4735  FD09DB  A5 23            ?00:    LDA     fslct
 4736  FD09DD  D0 1C                    bne     ?01                     ; no selection
 4737  FD09DF  A2 14                    LDX     #CLIPBRD*2
 4738  FD09E1                           ACC16CLC
 4739  FD09E1  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 4740                                   .LONGA  on
 4741                                   .MNLIST
 4742  FD09E3  B5 6C                    LDA     bstart,X
 4743  FD09E5  F0 12                    beq     ?00b                    ; no selected text
 4744  FD09E7  B5 C4                    lda     btot,x                  ; # lines on clipboard
 4745  FD09E9  65 1A                    adc     ncount                  ; check overflow
 4746  FD09EB  B0 05                    bcs     ?00a                    ; overflow
 4747  FD09ED  C9 FD FF                 cmp     #MAXLINES
 4748  FD09F0  90 0A                    bcc     ?02
 4749  FD09F2                   ?00a:   ACC08
 4750  FD09F2  E2 20                    sep     #PMFLAG
 4751                                   .LONGA  off
 4752                                   .MNLIST
 4753  FD09F4  A2 06                    ldx     #6                      ; can't paste text: lines count overflow
 4754  FD09F6  4C 43 05                 jmp     error
 4755  FD09F9                   ?00b:   ACC08
 4756  FD09F9  E2 20                    sep     #PMFLAG
 4757                                   .LONGA  off
 4758                                   .MNLIST
 4759  FD09FB  60               ?01:    rts
 4760                           ?02:    .LONGA  on                      ; remember here A/M 16 bit
 4761  FD09FC  B5 6C                    LDA     bstart,X                ; block's count 
 4762  FD09FE  20 F1 0E                 JSR     blkcnt
 4763  FD0A01  1A                       inc     a                       ; one more      
 4764  FD0A02  20 37 0B                 jsr     chkfree                 ; check free blocks
 4765  FD0A05                           ACC08
 4766  FD0A05  E2 20                    sep     #PMFLAG
  Tue Jul 17 11:00:22 2018                                                                                               Page   39




 4767                                   .LONGA  off
 4768                                   .MNLIST
 4769  FD0A07  90 05                    bcc     ?03
 4770  FD0A09  A2 04                    LDX     #$04                    ; Not enough memory error
 4771  FD0A0B  4C 43 05                 JMP     error
 4772  FD0A0E  20 AD 0E         ?03:    JSR     pp8mv
 4773  FD0A11  64 52                    stz     pb
 4774  FD0A13  64 55                    stz     pd
 4775  FD0A15                           ACC16CLC
 4776  FD0A15  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 4777                                   .LONGA  on
 4778                                   .MNLIST
 4779  FD0A17  A2 14                    LDX     #CLIPBRD*2
 4780  FD0A19  B5 C4                    lda     btot,x
 4781  FD0A1B  85 28                    sta     rclip
 4782  FD0A1D  A5 1C                    LDA     cline
 4783  FD0A1F  65 28                    ADC     rclip
 4784  FD0A21  85 1C                    STA     cline
 4785  FD0A23  18                       clc
 4786  FD0A24  A5 1A                    lda     ncount
 4787  FD0A26  65 28                    adc     rclip
 4788  FD0A28  85 1A                    sta     ncount
 4789  FD0A2A  A7 14                    lda     [pblk]                  ; next
 4790  FD0A2C  48                       PHA
 4791  FD0A2D  A5 15                    LDA     ppage
 4792  FD0A2F  85 53                    STA     pb+1
 4793  FD0A31  A2 14                    LDX     #CLIPBRD*2
 4794  FD0A33  B5 6C                    LDA     bstart,X
 4795  FD0A35  85 56            ?03a:   STA     pd+1
 4796  FD0A37  A5 53                    LDA     pb+1
 4797  FD0A39  48                       PHA
 4798  FD0A3A  20 DF 0A                 JSR     newblk                  ; no give error now!
 4799  FD0A3D  87 52                    STA     [pb]                    ; next
 4800  FD0A3F  85 53                    STA     pb+1
 4801  FD0A41  A7 52                    lda     [pb]
 4802  FD0A43  85 10                    STA     pfree
 4803  FD0A45  68                       PLA
 4804  FD0A46  A0 02                    ldy     #BPREV
 4805  FD0A48  97 52                    STA     [pb],Y
 4806  FD0A4A  C8                       INY
 4807  FD0A4B  C8                       iny
 4808  FD0A4C                           ACC08
 4809  FD0A4C  E2 20                    sep     #PMFLAG
 4810                                   .LONGA  off
 4811                                   .MNLIST
 4812  FD0A4E  B7 55            ?04:    lda     [pd],y
 4813  FD0A50  97 52                    STA     [pb],Y
 4814  FD0A52  C8                       INY
 4815  FD0A53  D0 F9                    BNE     ?04
 4816  FD0A55                           ACC16
 4817  FD0A55  C2 20                    rep     #PMFLAG
 4818                                   .LONGA  on
 4819                                   .MNLIST
 4820  FD0A57  A7 55                    lda     [pd]
 4821  FD0A59  D0 DA                    BNE     ?03a
 4822  FD0A5B  A5 53                    LDA     pb+1
 4823  FD0A5D  85 58                    STA     bka
  Tue Jul 17 11:00:22 2018                                                                                               Page   40




 4824  FD0A5F  20 DF 0A                 JSR     newblk
 4825  FD0A62  87 52                    STA     [pb]
 4826  FD0A64  85 53                    STA     pb+1
 4827  FD0A66  A7 52                    lda     [pb]
 4828  FD0A68  85 10                    STA     pfree
 4829  FD0A6A  A5 58                    LDA     bka
 4830  FD0A6C  A0 02                    ldy     #BPREV
 4831  FD0A6E  97 52                    STA     [pb],Y
 4832  FD0A70  68                       PLA
 4833  FD0A71  87 52                    STA     [pb]
 4834  FD0A73  F0 06                    BEQ     ?05
 4835  FD0A75  85 56                    STA     pd+1
 4836  FD0A77  A5 53                    LDA     pb+1
 4837  FD0A79  97 55                    STA     [pd],Y
 4838  FD0A7B                   ?05:    ACC08   
 4839  FD0A7B  E2 20                    sep     #PMFLAG
 4840                                   .LONGA  off
 4841                                   .MNLIST
 4842  FD0A7D  A4 17                    LDY     ixb
 4843  FD0A7F  88                       DEY
 4844  FD0A80  84 63                    STY     tmp7
 4845  FD0A82  A2 04                    LDX     #BNDX
 4846  FD0A84  E6 63            ?06:    INC     tmp7
 4847  FD0A86  E8                       inx
 4848  FD0A87  A4 63                    LDY     tmp7
 4849  FD0A89  B7 14                    lda     [pblk],y
 4850  FD0A8B  9B                       txy
 4851  FD0A8C  97 52                    STA     [pb],Y
 4852  FD0A8E  A0 04                    LDY     #BNDX
 4853  FD0A90  B7 14                    lda     [pblk],y
 4854  FD0A92  C5 63                    CMP     tmp7
 4855  FD0A94  D0 EE                    BNE     ?06
 4856  FD0A96  8A                       txa
 4857  FD0A97  97 52                    STA     [pb],Y
 4858  FD0A99  A5 17                    LDA     ixb
 4859  FD0A9B  C9 05                    CMP     #BSTART
 4860  FD0A9D  D0 0A                    BNE     ?07
 4861  FD0A9F  A5 16                    LDA     ppage+1
 4862  FD0AA1  EB                       xba
 4863  FD0AA2  A5 15                    lda     ppage
 4864  FD0AA4  20 74 10                 JSR     delblk
 4865  FD0AA7  80 05                    bra     ?08
 4866  FD0AA9  3A               ?07:    dec     a
 4867  FD0AAA  A0 04                    LDY     #BNDX
 4868  FD0AAC  97 14                    STA     [pblk],Y
 4869  FD0AAE                   ?08:    ACC16   
 4870  FD0AAE  C2 20                    rep     #PMFLAG
 4871                                   .LONGA  on
 4872                                   .MNLIST
 4873  FD0AB0  A5 53                    LDA     pb+1
 4874  FD0AB2  85 15                    STA     ppage
 4875  FD0AB4  A0 05                    LDY     #BSTART
 4876  FD0AB6  84 17                    STY     ixb
 4877  FD0AB8  A5 58                    LDA     bka
 4878  FD0ABA  85 56                    STA     pd+1
 4879  FD0ABC                           ACC08
 4880  FD0ABC  E2 20                    sep     #PMFLAG
  Tue Jul 17 11:00:22 2018                                                                                               Page   41




 4881                                   .LONGA  off
 4882                                   .MNLIST
 4883  FD0ABE  88                       dey
 4884  FD0ABF  B7 55                    lda     [pd],y
 4885  FD0AC1  C9 05                    CMP     #BSTART
 4886  FD0AC3  D0 0A                    BNE     ?09
 4887  FD0AC5  A5 57                    LDA     pd+2
 4888  FD0AC7  EB                       xba
 4889  FD0AC8  A5 56                    lda     pd+1
 4890  FD0ACA  20 74 10                 JSR     delblk
 4891  FD0ACD  80 03                    bra     ?10
 4892  FD0ACF  3A               ?09:    dec     a
 4893  FD0AD0  97 55                    STA     [pd],Y
 4894  FD0AD2  A5 20            ?10:    LDA     srow
 4895  FD0AD4  C9 06                    CMP     #$06
 4896  FD0AD6  B0 04                    BCS     ?11
 4897  FD0AD8  A9 06                    LDA     #$06
 4898  FD0ADA  85 20                    STA     srow
 4899  FD0ADC  4C 32 04         ?11:    JMP     updwin
 4900                           
 4901                           ;---------------------------------------------------
 4902                           
 4903                           ; get new block of memory
 4904                           ; out:  C = page pointer to new block or NULL
 4905                           ;       CF = 1 if no left memory
 4906                           ; can be called in both 8/16 bit
 4907                           ; P230E:
 4908  FD0ADF                   newblk:
 4909  FD0ADF  08                       php                             ; save 8/16 bit state
 4910  FD0AE0                           CPU16
 4911  FD0AE0  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 4912                                   .LONGA  on
 4913                                   .LONGI  on
 4914                                   .MNLIST
 4915  FD0AE2  A5 10                    LDA     pfree                   ; get next free block
 4916  FD0AE4  D0 4E                    BNE     ?10                     ; OK
 4917  FD0AE6  20 C0 10         ?02:    JSR     garbc                   ; try to free memory
 4918  FD0AE9  B0 FB                    BCS     ?02     
 4919  FD0AEB  A5 10                    LDA     pfree
 4920  FD0AED  D0 45                    BNE     ?10                     ; OK
 4921  FD0AEF  A9 10 00                 lda     #MINPAGE                ; try to allocate pages
 4922  FD0AF2  AA                       tax                             ; X = # pages
 4923  FD0AF3  18                       clc
 4924  FD0AF4                           SETBRK                          ; increase break level
 4925  FD0AF4  02 7F                    cop     FN_SETBRK
 4926                                   .MNLIST
 4927  FD0AF6  90 08                    bcc     ?04                     ; ok
 4928  FD0AF8  AA                       tax                             ; max. # allocable pages
 4929  FD0AF9  F0 2A                    beq     ?08                     ; no room !
 4930  FD0AFB  18                       clc                             ; allocate max. available
 4931  FD0AFC                           SETBRK
 4932  FD0AFC  02 7F                    cop     FN_SETBRK
 4933                                   .MNLIST
 4934  FD0AFE  B0 25                    bcs     ?08                     ; now will no give error in fact!
 4935  FD0B00  85 10            ?04:    sta     pfree                   ; new free list
 4936  FD0B02  CA                       dex
 4937  FD0B03  86 5F                    stx     lpte                    ; # pages - 1
  Tue Jul 17 11:00:22 2018                                                                                               Page   42




 4938  FD0B05  65 5F                    adc     lpte                    ; last page! (here CF = 0)
 4939  FD0B07  85 5F                    sta     lpte                    ; save last page ptr
 4940  FD0B09                           INDEX08
 4941  FD0B09  E2 10                    sep     #PXFLAG
 4942                                   .LONGI  off
 4943                                   .MNLIST
 4944  FD0B0B  A2 00                    ldx     #0
 4945  FD0B0D  86 5C                    stx     lptc                    ; clear low pointer
 4946  FD0B0F                           INDEX16                         ; X = 0
 4947  FD0B0F  C2 10                    rep     #PXFLAG
 4948                                   .LONGI  on
 4949                                   .MNLIST
 4950  FD0B11  A5 10                    lda     pfree
 4951  FD0B13  85 5D            ?06:    sta     lptc+1                  ; init new free list
 4952  FD0B15  1A                       inc     a                       ; next page
 4953  FD0B16  87 5C                    sta     [lptc]                  ; next field in free list
 4954  FD0B18  C5 5F                    cmp     lpte                    ; till last page
 4955  FD0B1A  D0 F7                    bne     ?06
 4956  FD0B1C  85 5D                    sta     lptc+1
 4957  FD0B1E  8A                       txa                             ; end of list
 4958  FD0B1F  87 5C                    sta     [lptc]
 4959  FD0B21  A5 10                    lda     pfree                   ; return block pointer
 4960  FD0B23  80 0F                    bra     ?10
 4961  FD0B25                   ?08:    CPU08
 4962  FD0B25  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 4963                                   .LONGA  off
 4964                                   .LONGI  off
 4965                                   .MNLIST
 4966  FD0B27  A2 01                    LDX     #$01                    ; 'out of memory' error
 4967  FD0B29  20 43 05                 JSR     error
 4968  FD0B2C  A9 00                    lda     #0                      ; return NULL pointer
 4969  FD0B2E  EB                       xba
 4970  FD0B2F  A9 00                    lda     #0
 4971  FD0B31  28                       plp
 4972  FD0B32  38                       sec                             ; error flag
 4973  FD0B33  60                       rts
 4974  FD0B34  28               ?10:    plp                             ; return pointer
 4975  FD0B35  18                       clc
 4976  FD0B36                           LONG_OFF
 4977                                   .LONGA  off
 4978                                   .LONGI  off
 4979                                   .MNLIST
 4980  FD0B36  60                       RTS
 4981                           
 4982                           ; check if free list contain requested number of free blocks
 4983                           ; and add blocks allocating more memory if need
 4984                           ; in:   C = number of requested free block
 4985                           ; out:  CF = 0 if free list is large enough or if more blocks
 4986                           ;       was succesfully added
 4987                           ;       CF = 1 if free list is not large enough and more blocks
 4988                           ;       can't be added
 4989                           ;       C = number of blocks that can be added if CF = 1
 4990                           ; can be called in both 8/16 bit
 4991  FD0B37                   chkfree:
 4992  FD0B37  08                       php                             ; save 8/16 bit status
 4993  FD0B38  64 5C                    stz     lptc                    ; clear low pointer
 4994  FD0B3A                           CPU16
  Tue Jul 17 11:00:22 2018                                                                                               Page   43




 4995  FD0B3A  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 4996                                   .LONGA  on
 4997                                   .LONGI  on
 4998                                   .MNLIST
 4999  FD0B3C  85 60                    sta     lpte+1                  ; # blocks to add
 5000  FD0B3E  A5 10                    lda     pfree
 5001  FD0B40  F0 07                    beq     ?02                     ; free list is empty
 5002  FD0B42  20 F1 0E                 jsr     blkcnt                  ; how much free blocks?
 5003  FD0B45  C5 60                    cmp     lpte+1
 5004  FD0B47  B0 2C                    bcs     ?08                     ; ok, requested blocks are free
 5005  FD0B49  85 5D            ?02:    sta     lptc+1
 5006  FD0B4B  38                       sec
 5007  FD0B4C  A5 60                    lda     lpte+1                  ; how much blocks to add?
 5008  FD0B4E  E5 5D                    sbc     lptc+1
 5009  FD0B50  AA                       tax
 5010  FD0B51  18                       clc                             ; set a new break level
 5011  FD0B52                           SETBRK
 5012  FD0B52  02 7F                    cop     FN_SETBRK
 5013                                   .MNLIST
 5014  FD0B54  90 03                    bcc     ?04                     ; ok, no error
 5015  FD0B56  28                       plp
 5016  FD0B57  38                       sec                             ; return an error
 5017  FD0B58  60                       rts     
 5018  FD0B59  A8               ?04:    tay                             ; new pointer
 5019  FD0B5A  CA                       dex
 5020  FD0B5B  86 60                    stx     lpte+1                  ; # pages - 1
 5021  FD0B5D  65 60                    adc     lpte+1                  ; last page! (here CF = 0)
 5022  FD0B5F  85 60                    sta     lpte+1                  ; save last page ptr
 5023  FD0B61  98                       tya
 5024  FD0B62  48                       pha                             ; save new free list pointer
 5025  FD0B63  85 5D            ?06:    sta     lptc+1                  ; init new free list
 5026  FD0B65  1A                       inc     a                       ; next page
 5027  FD0B66  87 5C                    sta     [lptc]                  ; next field in free list
 5028  FD0B68  C5 60                    cmp     lpte+1                  ; till last page
 5029  FD0B6A  D0 F7                    bne     ?06
 5030  FD0B6C  85 5D                    sta     lptc+1
 5031  FD0B6E  A5 10                    lda     pfree                   ; link old free list
 5032  FD0B70  87 5C                    sta     [lptc]
 5033  FD0B72  68                       pla
 5034  FD0B73  85 10                    sta     pfree                   ; set new free list
 5035  FD0B75  28               ?08:    plp
 5036  FD0B76  18                       clc
 5037  FD0B77                           LONG_OFF
 5038                                   .LONGA  off
 5039                                   .LONGI  off
 5040                                   .MNLIST
 5041  FD0B77  60                       rts
 5042                           
 5043                           ; free one buffer
 5044                           ; in:   A = buffer number
 5045                           ; out:  CF = 1 if fail to allocate a new block
 5046                           ; P2D34:
 5047  FD0B78                   freebuf:
 5048  FD0B78  85 50                    sta     ebtmp                   ; save buffer number to free
 5049  FD0B7A  0A                       asl     a
 5050  FD0B7B  85 51                    sta     ebtmp2                  ; save index
 5051  FD0B7D  AA                       TAX                             ; table index
  Tue Jul 17 11:00:22 2018                                                                                               Page   44




 5052  FD0B7E  64 5C                    stz     lptc                    ; prepare pointer
 5053  FD0B80                           ACC16
 5054  FD0B80  C2 20                    rep     #PMFLAG
 5055                                   .LONGA  on
 5056                                   .MNLIST
 5057  FD0B82  B5 6C                    LDA     bstart,X
 5058  FD0B84  F0 6D                    beq     ?02                     ; nothing to do
 5059  FD0B86  85 5D                    STA     lptc+1
 5060  FD0B88  74 6C                    stz     bstart,x                ; clear start block
 5061  FD0B8A  74 82                    stz     bcur,x                  ; and all buffer data
 5062  FD0B8C  74 98                    stz     bndx,x
 5063  FD0B8E  74 AE                    stz     bline,x
 5064  FD0B90  74 C4                    stz     btot,x
 5065  FD0B92  A6 50                    ldx     ebtmp
 5066  FD0B94  86 58                    stx     bka
 5067  FD0B96  A2 00                    ldx     #0
 5068  FD0B98  86 59                    stx     bka+1
 5069  FD0B9A  A5 58                    lda     bka
 5070  FD0B9C  0A                       asl     a
 5071  FD0B9D  0A                       asl     a
 5072  FD0B9E  65 58                    adc     bka
 5073  FD0BA0  0A                       asl     a               ; x 10
 5074  FD0BA1  0A                       asl     a
 5075  FD0BA2  0A                       asl     a
 5076  FD0BA3  0A                       asl     a               ; x 80
 5077  FD0BA4  69 00 C8                 adc     #EDBUFNAM
 5078  FD0BA7  85 52                    sta     pb
 5079  FD0BA9                           ACC08
 5080  FD0BA9  E2 20                    sep     #PMFLAG
 5081                                   .LONGA  off
 5082                                   .MNLIST
 5083  FD0BAB  A9 01                    lda     #^EDBUFNAM
 5084  FD0BAD  85 54                    sta     pb+2
 5085  FD0BAF  A9 00                    lda     #0
 5086  FD0BB1  87 52                    sta     [pb]
 5087  FD0BB3  8F 00 CD 01              sta     >EDCURFILE
 5088  FD0BB7                           ACC16
 5089  FD0BB7  C2 20                    rep     #PMFLAG
 5090                                   .LONGA  on
 5091                                   .MNLIST
 5092  FD0BB9  A7 5C            ?01:    lda     [lptc]                  ; put all buffer blocks in free list
 5093  FD0BBB  48                       PHA                             ; next
 5094  FD0BBC  A5 10                    LDA     pfree
 5095  FD0BBE  87 5C                    STA     [lptc]                  ; next free
 5096  FD0BC0  A5 5D                    LDA     lptc+1
 5097  FD0BC2  85 10                    STA     pfree                   ; update free list
 5098  FD0BC4  68                       PLA
 5099  FD0BC5  85 5D                    STA     lptc+1                  ; next block
 5100  FD0BC7  D0 F0                    BNE     ?01                     ; loop until next = NULL
 5101  FD0BC9  A6 50                    ldx     ebtmp                   ; if this is not the current buffer...
 5102  FD0BCB  E4 0F                    CPX     xbuf
 5103  FD0BCD  D0 24                    BNE     ?02                     ; ...done
 5104                                                                   ; ...otherwise alloc one block...
 5105  FD0BCF  20 DF 0A                 JSR     newblk                  ; ...for a new empty buffer
 5106  FD0BD2  B0 1F                    bcs     ?02                     ; error: no left memory
 5107  FD0BD4  85 4A                    sta     wtmp                    ; save new block
 5108  FD0BD6  A6 51                    ldx     ebtmp2
  Tue Jul 17 11:00:22 2018                                                                                               Page   45




 5109  FD0BD8  20 AA 0C                 JSR     bufinit                 ; init new buffer
 5110  FD0BDB  B5 6C                    LDA     bstart,X                ; set up new buffer
 5111  FD0BDD  85 12                    STA     pbuf
 5112  FD0BDF  B5 82                    LDA     bcur,X
 5113  FD0BE1  85 15                    STA     ppage
 5114  FD0BE3  B5 98                    LDA     bndx,X
 5115  FD0BE5  85 17                    STA     ixb
 5116  FD0BE7  B5 AE                    LDA     bline,X
 5117  FD0BE9  85 1C                    STA     cline
 5118  FD0BEB  B5 C4                    LDA     btot,X
 5119  FD0BED  85 1A                    STA     ncount
 5120  FD0BEF  A0 00                    ldy     #$00
 5121  FD0BF1  84 20                    sty     srow
 5122  FD0BF3                   ?02:    ACC08   
 5123  FD0BF3  E2 20                    sep     #PMFLAG
 5124                                   .LONGA  off
 5125                                   .MNLIST
 5126  FD0BF5  60               ?03:    RTS
 5127                           
 5128                           ; switch to another buffer
 5129                           ; in:   A = buffer number
 5130                           ; out:  CF = 1 if fail to allocate a new block
 5131                           ; P2D86:
 5132  FD0BF6                   switchb:
 5133  FD0BF6  48                       pha                             ; save new buffer number
 5134  FD0BF7  0A                       asl     a
 5135  FD0BF8  AA                       tax                             ; X = buffer table index
 5136  FD0BF9                           ACC16
 5137  FD0BF9  C2 20                    rep     #PMFLAG
 5138                                   .LONGA  on
 5139                                   .MNLIST
 5140  FD0BFB  B5 6C                    lda     bstart,x
 5141  FD0BFD  D0 0B                    bne     ?02                     ; ok, buffer already initialized
 5142  FD0BFF  20 DF 0A                 jsr     newblk                  ; get a new block
 5143  FD0C02  90 04                    bcc     ?01                     ; OK
 5144  FD0C04                           ACC08
 5145  FD0C04  E2 20                    sep     #PMFLAG
 5146                                   .LONGA  off
 5147                                   .MNLIST
 5148  FD0C06  68                       pla                             ; error -- no memory left
 5149  FD0C07  60                       rts                             ; exit with CF = 1
 5150  FD0C08  85 4A            ?01:    sta     wtmp                    ; save new page pointer
 5151  FD0C0A                   ?02:    ACC08   
 5152  FD0C0A  E2 20                    sep     #PMFLAG
 5153                                   .LONGA  off
 5154                                   .MNLIST
 5155  FD0C0C  A6 0F                    ldx     xbuf                    ; current buffer index
 5156  FD0C0E  30 47                    bmi     ?03                     ; no current editor buffer
 5157  FD0C10  8A                       txa
 5158  FD0C11  0A                       asl     a
 5159  FD0C12  AA                       tax
 5160  FD0C13                           ACC16CLC
 5161  FD0C13  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 5162                                   .LONGA  on
 5163                                   .MNLIST
 5164  FD0C15  A5 12                    lda     pbuf                    ; save in table current buffer data
 5165  FD0C17  95 6C                    sta     bstart,x
  Tue Jul 17 11:00:22 2018                                                                                               Page   46




 5166  FD0C19  A5 15                    lda     ppage
 5167  FD0C1B  95 82                    sta     bcur,x
 5168  FD0C1D  A5 17                    lda     ixb                     ; index + flag
 5169  FD0C1F  95 98                    sta     bndx,x
 5170  FD0C21  A5 1C                    lda     cline
 5171  FD0C23  95 AE                    sta     bline,x
 5172  FD0C25  A5 1A                    lda     ncount
 5173  FD0C27  95 C4                    sta     btot,x
 5174  FD0C29  A6 0F                    ldx     xbuf
 5175  FD0C2B  86 58                    stx     bka
 5176  FD0C2D  A2 00                    ldx     #0
 5177  FD0C2F  86 59                    stx     bka+1
 5178  FD0C31  A5 58                    lda     bka
 5179  FD0C33  0A                       asl     a
 5180  FD0C34  0A                       asl     a
 5181  FD0C35  65 58                    adc     bka
 5182  FD0C37  0A                       asl     a               ; x 10
 5183  FD0C38  0A                       asl     a
 5184  FD0C39  0A                       asl     a
 5185  FD0C3A  0A                       asl     a               ; x 80
 5186  FD0C3B  69 00 C8                 adc     #EDBUFNAM
 5187  FD0C3E  85 52                    sta     pb
 5188  FD0C40                           ACC08
 5189  FD0C40  E2 20                    sep     #PMFLAG
 5190                                   .LONGA  off
 5191                                   .MNLIST
 5192  FD0C42  A9 01                    lda     #^EDBUFNAM
 5193  FD0C44  85 54                    sta     pb+2
 5194  FD0C46  A2 00                    ldx     #0
 5195  FD0C48  9B                       txy
 5196  FD0C49  BF 00 CD 01      ?lp1:   lda     >EDCURFILE,x
 5197  FD0C4D  97 52                    sta     [pb],y
 5198  FD0C4F  F0 06                    beq     ?03
 5199  FD0C51  E8                       inx
 5200  FD0C52  C8                       iny
 5201  FD0C53  C0 50                    cpy     #MAXFNAME
 5202  FD0C55  90 F2                    bcc     ?lp1
 5203  FD0C57  68               ?03:    pla
 5204  FD0C58  85 0F                    sta     xbuf                    ; set new current buffer
 5205  FD0C5A  0A                       asl     a
 5206  FD0C5B  AA                       tax                             ; table index access
 5207  FD0C5C                           ACC16CLC
 5208  FD0C5C  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 5209                                   .LONGA  on
 5210                                   .MNLIST
 5211  FD0C5E  B5 6C                    lda     bstart,x
 5212  FD0C60  D0 06                    bne     ?04
 5213  FD0C62  20 AA 0C                 jsr     bufinit
 5214  FD0C65  18                       clc
 5215  FD0C66  B5 6C                    lda     bstart,x
 5216  FD0C68  85 12            ?04:    sta     pbuf                    ; start buffer
 5217  FD0C6A  B5 82                    lda     bcur,x
 5218  FD0C6C  85 15                    sta     ppage                   ; current block
 5219  FD0C6E  B5 98                    lda     bndx,x
 5220  FD0C70  85 17                    sta     ixb                     ; block pointer + flag
 5221  FD0C72  B5 AE                    lda     bline,x
 5222  FD0C74  85 1C                    sta     cline                   ; current line
  Tue Jul 17 11:00:22 2018                                                                                               Page   47




 5223  FD0C76  B5 C4                    lda     btot,x
 5224  FD0C78  85 1A                    sta     ncount                  ; total lines
 5225  FD0C7A  A6 0F                    ldx     xbuf
 5226  FD0C7C  86 58                    stx     bka
 5227  FD0C7E  A2 00                    ldx     #0
 5228  FD0C80  86 59                    stx     bka+1
 5229  FD0C82  A5 58                    lda     bka
 5230  FD0C84  0A                       asl     a
 5231  FD0C85  0A                       asl     a
 5232  FD0C86  65 58                    adc     bka
 5233  FD0C88  0A                       asl     a               ; x 10
 5234  FD0C89  0A                       asl     a
 5235  FD0C8A  0A                       asl     a
 5236  FD0C8B  0A                       asl     a               ; x 80
 5237  FD0C8C  69 00 C8                 adc     #EDBUFNAM
 5238  FD0C8F  85 52                    sta     pb
 5239  FD0C91                           ACC08
 5240  FD0C91  E2 20                    sep     #PMFLAG
 5241                                   .LONGA  off
 5242                                   .MNLIST
 5243  FD0C93  A9 01                    lda     #^EDBUFNAM
 5244  FD0C95  85 54                    sta     pb+2
 5245  FD0C97  A2 00                    ldx     #0
 5246  FD0C99  9B                       txy
 5247  FD0C9A  B7 52            ?lp2:   lda     [pb],y
 5248  FD0C9C  9F 00 CD 01              sta     >EDCURFILE,x
 5249  FD0CA0  F0 06                    beq     ?end
 5250  FD0CA2  E8                       inx
 5251  FD0CA3  C8                       iny
 5252  FD0CA4  C0 50                    cpy     #MAXFNAME
 5253  FD0CA6  90 F2                    bcc     ?lp2
 5254  FD0CA8  18               ?end:   clc                     ; no error
 5255  FD0CA9  60                       rts
 5256                           
 5257                           ; init a new editor buffer -- init buffer table
 5258                           ; in:   X = buffer table index
 5259                           ;       wtmp = new page pointer
 5260                           ; can be called in both 8/16 bit
 5261                           ; P2D05:
 5262  FD0CAA                   bufinit:
 5263  FD0CAA  08                       php
 5264  FD0CAB                           CPU08
 5265  FD0CAB  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 5266                                   .LONGA  off
 5267                                   .LONGI  off
 5268                                   .MNLIST
 5269  FD0CAD  A0 00                    ldy     #0
 5270  FD0CAF  84 5C                    sty     lptc
 5271  FD0CB1                           CPU16
 5272  FD0CB1  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 5273                                   .LONGA  on
 5274                                   .LONGI  on
 5275                                   .MNLIST
 5276  FD0CB3  A5 4A                    lda     wtmp                    ; new page pointer
 5277  FD0CB5  95 6C                    sta     bstart,x                ; start buffer block
 5278  FD0CB7  95 82                    sta     bcur,x                  ; current buffer block
 5279  FD0CB9  85 5D                    sta     lptc+1                  ; temp pointer
  Tue Jul 17 11:00:22 2018                                                                                               Page   48




 5280  FD0CBB  94 AE                    sty     bline,x                 ; clear current line
 5281  FD0CBD  94 C4                    sty     btot,x                  ; clear tot. # lines
 5282  FD0CBF  A7 5C                    lda     [lptc]                  ; next block will be in free list
 5283  FD0CC1  85 10                    sta     pfree
 5284  FD0CC3  98                       tya
 5285  FD0CC4  87 5C                    sta     [lptc]                  ; next = NULL
 5286  FD0CC6  C8                       iny
 5287  FD0CC7  C8                       iny                             ; Y = 2
 5288  FD0CC8  97 5C                    sta     [lptc],y                ; prev = NULL
 5289  FD0CCA  C8                       iny
 5290  FD0CCB  C8                       iny                             ; Y = 4;
 5291  FD0CCC  A9 05 00                 lda     #BSTART                 ; set pointer in block
 5292  FD0CCF  97 5C                    sta     [lptc],y                ; and mark end of buffer
 5293  FD0CD1  95 98                    sta     bndx,x                  ; flag buffer = 0
 5294  FD0CD3  28                       plp
 5295  FD0CD4                           LONG_OFF
 5296                                   .LONGA  off
 5297                                   .LONGI  off
 5298                                   .MNLIST
 5299  FD0CD4  60                       rts
 5300                           
 5301                           
 5302                           ; insert <enter> code - check if lines overflow
 5303  FD0CD5                   inscr:
 5304  FD0CD5                           ACC16
 5305  FD0CD5  C2 20                    rep     #PMFLAG
 5306                                   .LONGA  on
 5307                                   .MNLIST
 5308  FD0CD7  A5 1A                    lda     ncount
 5309  FD0CD9  1A                       inc     a
 5310  FD0CDA  C9 FE FF                 cmp     #MAXLINES+1
 5311  FD0CDD                           ACC08
 5312  FD0CDD  E2 20                    sep     #PMFLAG
 5313                                   .LONGA  off
 5314                                   .MNLIST
 5315  FD0CDF  B0 04                    bcs     ?02
 5316  FD0CE1  A9 0D                    LDA     #$0D
 5317  FD0CE3  80 07                    bra     insert                  ; insert byte $0D (enter key code)
 5318  FD0CE5  A2 07            ?02:    ldx     #7                      ; Can't insert a new line: lines count overflow
 5319  FD0CE7  20 43 05                 jsr     error
 5320  FD0CEA  38                       sec
 5321  FD0CEB  60                       rts
 5322                           
 5323                           ; insert byte into buffer at position specified by ixb
 5324                           ; in:   A = byte to insert
 5325                           ; A,X,Y preserved
 5326                           ; P227B:
 5327  FD0CEC                   insert:
 5328  FD0CEC  85 4C                    sta     ewtmp                   ; byte to insert        
 5329  FD0CEE  DA                       phx
 5330  FD0CEF  5A                       phy
 5331  FD0CF0  24 18                    bit     bflag                   ; chek if overwrite mode
 5332  FD0CF2  50 14                    bvc     ?00                     ; default insert mode
 5333  FD0CF4  C9 0D                    cmp     #$0D                    ; insert anyway code $0D
 5334  FD0CF6  F0 10                    beq     ?00
 5335  FD0CF8  AA                       tax
 5336  FD0CF9  A4 17                    ldy     ixb
  Tue Jul 17 11:00:22 2018                                                                                               Page   49




 5337  FD0CFB  B7 14                    lda     [pblk],y                ; A = byte at position where overwrite
 5338  FD0CFD  F0 09                    beq     ?00                     ; no overwrite null terminator
 5339  FD0CFF  C9 0D                    cmp     #$0D
 5340  FD0D01  F0 05                    beq     ?00                     ; no overwrite line terminator
 5341  FD0D03  8A                       txa
 5342  FD0D04  97 14                    sta     [pblk],y                ; overwrite
 5343  FD0D06  80 58                    bra     ?08                     ; exit
 5344  FD0D08  A0 04            ?00:    LDY     #BNDX
 5345  FD0D0A  B7 14                    lda     [pblk],y
 5346  FD0D0C  85 4D                    sta     ewtmp+1                 ; save current pointer
 5347  FD0D0E  C9 FF                    CMP     #$FF
 5348  FD0D10  D0 0E                    BNE     ?02                     ; ok, room for move one byte ahead
 5349  FD0D12  20 DF 0A                 JSR     newblk                  ; alloc new block...
 5350  FD0D15  90 05                    BCC     ?01                     ; ...for move bytes one room ahead
 5351  FD0D17  7A                       PLY
 5352  FD0D18  FA                       plx
 5353  FD0D19  A5 4C                    lda     ewtmp
 5354  FD0D1B  60                       RTS
 5355  FD0D1C                   ?01:    ACC16   
 5356  FD0D1C  C2 20                    rep     #PMFLAG
 5357                                   .LONGA  on
 5358                                   .MNLIST
 5359  FD0D1E  85 4A                    STA     wtmp                    ; save new block
 5360  FD0D20                   ?02:    ACC16   
 5361  FD0D20  C2 20                    rep     #PMFLAG
 5362                                   .LONGA  on
 5363                                   .MNLIST
 5364  FD0D22  A5 06                    LDA     pp6
 5365  FD0D24  C5 15                    CMP     ppage
 5366  FD0D26                           ACC08
 5367  FD0D26  E2 20                    sep     #PMFLAG
 5368                                   .LONGA  off
 5369                                   .MNLIST
 5370  FD0D28  D0 02                    BNE     ?03
 5371  FD0D2A  E6 0D                    INC     ix6
 5372  FD0D2C  A4 4D            ?03     ldy     ewtmp+1
 5373  FD0D2E  C8                       INY
 5374  FD0D2F  88               ?04:    DEY                             ; loop for move ahead
 5375  FD0D30  B7 14                    lda     [pblk],y                ; A = byte to move ahead
 5376  FD0D32  C8                       INY
 5377  FD0D33  D0 17                    BNE     ?06
 5378  FD0D35  20 40 10                 JSR     addblk                  ; insert new block and move byte
 5379  FD0D38  A4 0D                    LDY     ix6
 5380  FD0D3A  D0 0C                    BNE     ?05
 5381  FD0D3C  A5 50                    LDA     lptmp2+1                ; save new block in pp6
 5382  FD0D3E  85 06                    STA     pp6
 5383  FD0D40  A5 51                    LDA     lptmp2+2
 5384  FD0D42  85 07                    STA     pp6+1
 5385  FD0D44  A9 05                    LDA     #BSTART
 5386  FD0D46  85 0D                    STA     ix6
 5387  FD0D48  A0 00            ?05:    LDY     #$00
 5388  FD0D4A  80 02                    bra     ?07
 5389  FD0D4C  97 14            ?06:    sta     [pblk],y
 5390  FD0D4E  88               ?07:    DEY
 5391  FD0D4F  C4 17                    CPY     ixb                     ; move bytes until is free...
 5392  FD0D51  D0 DC                    BNE     ?04                     ; ...the position specified by ixb
 5393  FD0D53  A5 4C                    LDA     ewtmp
  Tue Jul 17 11:00:22 2018                                                                                               Page   50




 5394  FD0D55  97 14                    STA     [pblk],Y                ; store byte
 5395  FD0D57  A5 4D                    lda     ewtmp+1                 ; update pointer
 5396  FD0D59  1A                       inc     a
 5397  FD0D5A  F0 04                    BEQ     ?08
 5398  FD0D5C  A0 04                    LDY     #BNDX
 5399  FD0D5E  97 14                    STA     [pblk],Y
 5400  FD0D60  7A               ?08:    ply
 5401  FD0D61  FA                       plx
 5402  FD0D62  A9 80                    lda     #$80
 5403  FD0D64  04 18                    tsb     bflag                   ; set modified flag
 5404  FD0D66  A5 4C                    lda     ewtmp
 5405  FD0D68  18                       CLC                             ; no error
 5406  FD0D69  60                       RTS 
 5407                           
 5408                           ; align buffer with minimum screen row and save block on pp4
 5409                           ; P1E14:
 5410  FD0D6A                   findrow:
 5411  FD0D6A  A0 00                    LDY     #$00                    ; start at row = 0
 5412  FD0D6C  C4 20            ?01:    CPY     srow                    ; current screen row 
 5413  FD0D6E  F0 08                    BEQ     ?02                     ; already at first row
 5414  FD0D70  20 8C 0F                 JSR     startln                 ; find start of line            
 5415  FD0D73  B0 03                    BCS     ?02                     ; beginning of buffer
 5416  FD0D75  C8                       INY
 5417  FD0D76  80 F4                    bra     ?01                     ; loop
 5418  FD0D78  84 20            ?02:    STY     srow                    ; store row
 5419  FD0D7A  A5 15                    LDA     ppage                   ; save block pointer
 5420  FD0D7C  85 04                    STA     pp4
 5421  FD0D7E  A5 16                    LDA     ppage+1
 5422  FD0D80  85 05                    STA     pp4+1
 5423  FD0D82  A5 17                    LDA     ixb
 5424  FD0D84  85 0C                    STA     ix4
 5425  FD0D86  60                       RTS
 5426                           
 5427                           ; get number of bytes from current column to end of line
 5428                           ; in:   X = text column
 5429                           ; out:  ccnt updated    
 5430                           ; P1474:
 5431  FD0D87                   xcnt2:
 5432  FD0D87  A0 00                    LDY     #$00
 5433  FD0D89  84 21                    STY     scol
 5434  FD0D8B  84 1E                    STY     ccol
 5435  FD0D8D  20 AD 0E                 JSR     pp8mv
 5436  FD0D90  E8                       INX
 5437  FD0D91  C4 1F            ?01:    CPY     ecol
 5438  FD0D93  F0 14                    BEQ     ?02
 5439  FD0D95  CA                       DEX
 5440  FD0D96  F0 3C                    BEQ     ?06
 5441  FD0D98  20 A9 0F                 JSR     getbyte
 5442  FD0D9B  B0 37                    BCS     ?06
 5443  FD0D9D  C9 0D                    CMP     #$0D
 5444  FD0D9F  F0 33                    BEQ     ?06
 5445  FD0DA1  C8                       INY
 5446  FD0DA2  20 BE 0F                 JSR     incptr
 5447  FD0DA5  E6 1E                    INC     ccol
 5448  FD0DA7  80 E8                    bra     ?01
 5449  FD0DA9  CA               ?02:    DEX
 5450  FD0DAA  F0 13                    BEQ     ?03
  Tue Jul 17 11:00:22 2018                                                                                               Page   51




 5451  FD0DAC  20 A9 0F                 JSR     getbyte
 5452  FD0DAF  B0 23                    BCS     ?06
 5453  FD0DB1  C9 0D                    CMP     #$0D
 5454  FD0DB3  F0 1F                    BEQ     ?06
 5455  FD0DB5  C8                       INY
 5456  FD0DB6  20 BE 0F                 JSR     incptr
 5457  FD0DB9  E6 21                    INC     scol
 5458  FD0DBB  E6 1E                    INC     ccol
 5459  FD0DBD  80 EA                    bra     ?02
 5460  FD0DBF  20 93 0E         ?03:    JSR     mvpp2
 5461  FD0DC2  20 A9 0F         ?04:    JSR     getbyte
 5462  FD0DC5  B0 0A                    BCS     ?05
 5463  FD0DC7  C9 0D                    CMP     #$0D
 5464  FD0DC9  F0 06                    BEQ     ?05
 5465  FD0DCB  C8                       INY
 5466  FD0DCC  20 BE 0F                 JSR     incptr
 5467  FD0DCF  80 F1                    bra     ?04
 5468  FD0DD1  20 4A 0E         ?05:    JSR     pp2mv
 5469  FD0DD4  84 22            ?06:    STY     ccnt
 5470  FD0DD6  60                       RTS
 5471                           
 5472                           ; find beginning of line on block pointed by pp6
 5473                           ; P2477:
 5474  FD0DD7                   startln6:
 5475  FD0DD7  A5 26                    LDA     rcnt
 5476  FD0DD9  C9 17                    CMP     #$17
 5477  FD0DDB  F0 03                    beq     ?01
 5478  FD0DDD  E6 26                    INC     rcnt
 5479  FD0DDF  60                       RTS
 5480  FD0DE0  20 93 0E         ?01:    JSR     mvpp2
 5481  FD0DE3  A5 06                    LDA     pp6
 5482  FD0DE5  85 15                    STA     ppage
 5483  FD0DE7  A5 07                    LDA     pp6+1
 5484  FD0DE9  85 16                    STA     ppage+1
 5485  FD0DEB  A5 0D                    LDA     ix6
 5486  FD0DED  85 17                    STA     ixb
 5487  FD0DEF  20 8C 0F                 JSR     startln
 5488  FD0DF2  A5 15                    LDA     ppage
 5489  FD0DF4  85 06                    STA     pp6
 5490  FD0DF6  A5 16                    LDA     ppage+1
 5491  FD0DF8  85 07                    STA     pp6+1
 5492  FD0DFA  A5 17                    LDA     ixb
 5493  FD0DFC  85 0D                    STA     ix6
 5494  FD0DFE  80 4A                    bra     pp2mv
 5495                           
 5496                           ; find next line on block pointed by pp4
 5497                           ; P249F:
 5498  FD0E00                   nextln4:
 5499  FD0E00  20 93 0E                 JSR     mvpp2
 5500  FD0E03  A5 04                    LDA     pp4
 5501  FD0E05  85 15                    STA     ppage
 5502  FD0E07  A5 05                    LDA     pp4+1
 5503  FD0E09  85 16                    STA     ppage+1
 5504  FD0E0B  A5 0C                    LDA     ix4
 5505  FD0E0D  85 17                    STA     ixb
 5506  FD0E0F  20 70 0F                 JSR     nextln
 5507  FD0E12  A5 15                    LDA     ppage
  Tue Jul 17 11:00:22 2018                                                                                               Page   52




 5508  FD0E14  85 04                    STA     pp4
 5509  FD0E16  A5 16                    LDA     ppage+1
 5510  FD0E18  85 05                    STA     pp4+1
 5511  FD0E1A  A5 17                    LDA     ixb
 5512  FD0E1C  85 0C                    STA     ix4
 5513  FD0E1E  80 2A                    bra     pp2mv
 5514                           
 5515                           ; find beginning of line on block pointed by pp4
 5516                           ; P24BC:
 5517  FD0E20                   startln4:
 5518  FD0E20  20 93 0E                 JSR     mvpp2
 5519  FD0E23  A5 04                    LDA     pp4
 5520  FD0E25  85 15                    STA     ppage
 5521  FD0E27  A5 05                    LDA     pp4+1
 5522  FD0E29  85 16                    STA     ppage+1 
 5523  FD0E2B  A5 0C                    LDA     ix4
 5524  FD0E2D  85 17                    STA     ixb
 5525  FD0E2F  20 8C 0F                 JSR     startln
 5526  FD0E32  A5 15                    LDA     ppage
 5527  FD0E34  85 04                    STA     pp4
 5528  FD0E36  A5 16                    LDA     ppage+1
 5529  FD0E38  85 05                    STA     pp4+1
 5530  FD0E3A  A5 17                    LDA     ixb
 5531  FD0E3C  85 0C                    STA     ix4
 5532  FD0E3E  80 0A                    bra     pp2mv
 5533                           
 5534                           ; calc the bytes count in current line
 5535                           ; P141A:
 5536  FD0E40                   xcount:
 5537  FD0E40  20 93 0E                 jsr     mvpp2
 5538  FD0E43  20 DF 0F                 jsr     incptr2
 5539  FD0E46  20 8C 0F                 jsr     startln
 5540  FD0E49  CA                       dex
 5541                           
 5542                           ; move pp2 to page pointer
 5543                           ; P236D:
 5544  FD0E4A                   pp2mv:
 5545  FD0E4A  A5 02                    lda     pp2
 5546  FD0E4C  85 15                    sta     ppage
 5547  FD0E4E  A5 03                    lda     pp2+1
 5548  FD0E50  85 16                    sta     ppage+1
 5549  FD0E52  A5 0B                    lda     ix2
 5550  FD0E54  85 17                    sta     ixb
 5551  FD0E56  60                       rts
 5552                           
 5553                           ; find next line on block pointed by pp6
 5554                           ; P2455:
 5555  FD0E57                   nextln6:
 5556  FD0E57  20 93 0E                 JSR     mvpp2
 5557  FD0E5A  A5 06                    LDA     pp6
 5558  FD0E5C  85 15                    STA     ppage
 5559  FD0E5E  A5 07                    LDA     pp6+1
 5560  FD0E60  85 16                    STA     ppage+1
 5561  FD0E62  A5 0D                    LDA     ix6
 5562  FD0E64  85 17                    STA     ixb
 5563  FD0E66  20 70 0F                 JSR     nextln
 5564  FD0E69  90 02                    BCC     ?01
  Tue Jul 17 11:00:22 2018                                                                                               Page   53




 5565  FD0E6B  C6 26                    DEC     rcnt
 5566  FD0E6D  A5 15            ?01:    LDA     ppage
 5567  FD0E6F  85 06                    STA     pp6
 5568  FD0E71  A5 16                    LDA     ppage+1
 5569  FD0E73  85 07                    STA     pp6+1
 5570  FD0E75  A5 17                    LDA     ixb
 5571  FD0E77  85 0D                    STA     ix6
 5572  FD0E79  80 CF                    bra     pp2mv
 5573                           
 5574                           ; find next line and save in pp8
 5575                           ; X,Y preserved
 5576                           ; P1447:
 5577  FD0E7B                   nextln8:
 5578  FD0E7B  20 93 0E                 JSR     mvpp2
 5579  FD0E7E  5A                       phy
 5580  FD0E7F  20 1E 10         ?01:    JSR     decptr2
 5581  FD0E82  B0 09                    BCS     ?02
 5582  FD0E84  B7 14                    lda     [pblk],y
 5583  FD0E86  C9 0D                    CMP     #$0D
 5584  FD0E88  D0 F5                    BNE     ?01
 5585  FD0E8A  20 DF 0F                 JSR     incptr2
 5586  FD0E8D  7A               ?02:    ply     
 5587  FD0E8E  20 A0 0E                 JSR     mvpp8
 5588  FD0E91  80 B7                    bra     pp2mv
 5589                           
 5590                           ; move page pointer to pp2
 5591                           ; P2362:
 5592  FD0E93                   mvpp2:
 5593  FD0E93  A5 15                    lda     ppage
 5594  FD0E95  85 02                    sta     pp2
 5595  FD0E97  A5 16                    lda     ppage+1
 5596  FD0E99  85 03                    sta     pp2+1
 5597  FD0E9B  A5 17                    lda     ixb
 5598  FD0E9D  85 0B                    sta     ix2
 5599  FD0E9F  60                       rts
 5600                           
 5601                           ; move page pointer to pp8
 5602                           ; P2378:
 5603  FD0EA0                   mvpp8:
 5604  FD0EA0  A5 15                    lda     ppage
 5605  FD0EA2  85 08                    sta     pp8
 5606  FD0EA4  A5 16                    lda     ppage+1
 5607  FD0EA6  85 09                    sta     pp8+1
 5608  FD0EA8  A5 17                    lda     ixb
 5609  FD0EAA  85 0E                    sta     ix8
 5610  FD0EAC  60                       rts
 5611                           
 5612                           ; move pp8 to page pointer
 5613                           ; P2383:
 5614  FD0EAD                   pp8mv:
 5615  FD0EAD  A5 08                    lda     pp8
 5616  FD0EAF  85 15                    sta     ppage
 5617  FD0EB1  A5 09                    lda     pp8+1
 5618  FD0EB3  85 16                    sta     ppage+1
 5619  FD0EB5  A5 0E                    lda     ix8
 5620  FD0EB7  85 17                    sta     ixb
 5621  FD0EB9  60                       rts
  Tue Jul 17 11:00:22 2018                                                                                               Page   54




 5622                           
 5623                           ; count blank from start of line till first non blank
 5624                           ; out: ctmp = starting blanks counter
 5625  FD0EBA                   xblank:
 5626  FD0EBA  64 2F                    stz     ctmp
 5627  FD0EBC  A9 20                    lda     #$20                    ; test indent flag
 5628  FD0EBE  24 18                    bit     bflag
 5629  FD0EC0  F0 2E                    beq     ?06
 5630  FD0EC2  A5 15                    lda     ppage                   ; save current buffer pointer
 5631  FD0EC4  85 5C                    sta     lptc
 5632  FD0EC6  A5 16                    lda     ppage+1
 5633  FD0EC8  85 5D                    sta     lptc+1
 5634  FD0ECA  A5 17                    lda     ixb
 5635  FD0ECC  85 5E                    sta     lptc+2
 5636  FD0ECE  20 8C 0F                 jsr     startln                 ; find start of line
 5637  FD0ED1  A2 FF                    ldx     #$FF                    ; beginning blank counter
 5638  FD0ED3  E8               ?02:    inx     
 5639  FD0ED4  20 B4 0F                 jsr     getbyte2
 5640  FD0ED7  B0 09                    bcs     ?04                     ; end buffer
 5641  FD0ED9  C9 20                    cmp     #' '
 5642  FD0EDB  D0 05                    bne     ?04
 5643  FD0EDD  20 DF 0F                 jsr     incptr2
 5644  FD0EE0  80 F1                    bra     ?02
 5645  FD0EE2  86 2F            ?04:    stx     ctmp    
 5646  FD0EE4  A5 5C                    lda     lptc                    ; restore buffer pointer
 5647  FD0EE6  85 15                    sta     ppage
 5648  FD0EE8  A5 5D                    lda     lptc+1
 5649  FD0EEA  85 16                    sta     ppage+1
 5650  FD0EEC  A5 5E                    lda     lptc+2
 5651  FD0EEE  85 17                    sta     ixb
 5652  FD0EF0  60               ?06:    rts
 5653                           
 5654                           ; get blocks count of buffer
 5655                           ; in:   C = buffer start page
 5656                           ; out:  C = blocks count
 5657                           ; using lptmp1 long pointer
 5658                           ; can be called in 8/16 bit mode
 5659                           ; P2262:
 5660  FD0EF1                   blkcnt:
 5661  FD0EF1  08                       php                             ; save 8/16 bit state
 5662  FD0EF2                           INDEX08
 5663  FD0EF2  E2 10                    sep     #PXFLAG
 5664                                   .LONGI  off
 5665                                   .MNLIST
 5666  FD0EF4  A2 00                    LDX     #$00
 5667  FD0EF6  86 4C                    STX     <lptmp1
 5668  FD0EF8                           CPU16
 5669  FD0EF8  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 5670                                   .LONGA  on
 5671                                   .LONGI  on
 5672                                   .MNLIST
 5673  FD0EFA  A8                       tay
 5674  FD0EFB  F0 0C                    beq     ?03                     ; return C = 0
 5675  FD0EFD  85 4D                    STA     <lptmp1+1               ; page pointer
 5676  FD0EFF  E8               ?01:    INX
 5677  FD0F00  A7 4C                    LDA     [lptmp1]
 5678  FD0F02  F0 04                    BEQ     ?02                     ; end of buffer
  Tue Jul 17 11:00:22 2018                                                                                               Page   55




 5679  FD0F04  85 4D                    STA     <lptmp1+1
 5680  FD0F06  80 F7                    bra     ?01
 5681  FD0F08  8A               ?02:    TXA
 5682  FD0F09  28               ?03:    plp                             ; restore 8/16 bit mode
 5683  FD0F0A                           LONG_OFF
 5684                                   .LONGA  off
 5685                                   .LONGI  off
 5686                                   .MNLIST
 5687  FD0F0A  60                       RTS
 5688                           
 5689                           ; delete byte at current position from block
 5690                           ; A,X,Y preserved
 5691                           ; using lptc, lptmp1 & lptmp2 long pointer
 5692                           ; using wtmp
 5693                           ; P238E:
 5694  FD0F0B                   delbyte:
 5695  FD0F0B  48                       pha
 5696  FD0F0C  DA                       phx
 5697  FD0F0D  5A                       phy
 5698  FD0F0E                           ACC16
 5699  FD0F0E  C2 20                    rep     #PMFLAG
 5700                                   .LONGA  on
 5701                                   .MNLIST
 5702  FD0F10  A5 15                    LDA     ppage
 5703  FD0F12  85 4A                    sta     wtmp                    ; save current page pointer
 5704  FD0F14  C5 06                    CMP     pp6
 5705  FD0F16                           ACC08
 5706  FD0F16  E2 20                    sep     #PMFLAG
 5707                                   .LONGA  off
 5708                                   .MNLIST
 5709  FD0F18  D0 02                    BNE     ?01
 5710  FD0F1A  C6 0D                    DEC     ix6                     ; update
 5711  FD0F1C  A0 04            ?01:    LDY     #BNDX
 5712  FD0F1E  B7 14                    LDA     [pblk],Y
 5713  FD0F20  AA                       TAX                             ; X = pointer in block
 5714  FD0F21  C5 17                    CMP     ixb
 5715  FD0F23  D0 34                    BNE     ?04                     ; not last byte in block        
 5716  FD0F25  3A                       dec     a                       ; update pointer in block
 5717  FD0F26  97 14                    STA     [pblk],Y                ; this is last byte in block
 5718  FD0F28  20 DF 0F                 JSR     incptr2
 5719  FD0F2B  E0 05                    CPX     #BSTART                 ; empty buffer ?
 5720  FD0F2D  D0 0A                    BNE     ?02                     ; no 
 5721  FD0F2F  A5 4B                    lda     wtmp+1                  ; remove block
 5722  FD0F31  EB                       xba
 5723  FD0F32  A5 4A                    lda     wtmp                    ; C = page pointer
 5724  FD0F34  20 74 10                 JSR     delblk
 5725  FD0F37  80 2F                    bra     ?06                     ; exit
 5726  FD0F39  A5 08            ?02:    lda     pp8
 5727  FD0F3B  85 5D                    sta     lptc+1
 5728  FD0F3D  A5 09                    lda     pp8+1
 5729  FD0F3F  85 5E                    sta     lptc+2
 5730  FD0F41  64 5C                    stz     lptc
 5731  FD0F43  A0 04                    LDY     #BNDX
 5732  FD0F45  B7 5C                    LDA     [lptc],Y
 5733  FD0F47  C5 0E                    CMP     ix8
 5734  FD0F49  B0 1D                    BCS     ?06
 5735  FD0F4B                           ACC16
  Tue Jul 17 11:00:22 2018                                                                                               Page   56




 5736  FD0F4B  C2 20                    rep     #PMFLAG
 5737                                   .LONGA  on
 5738                                   .MNLIST
 5739  FD0F4D  A7 5C                    LDA     [lptc]
 5740  FD0F4F  85 08                    STA     pp8
 5741  FD0F51                           ACC08
 5742  FD0F51  E2 20                    sep     #PMFLAG
 5743                                   .LONGA  off
 5744                                   .MNLIST
 5745  FD0F53  A9 05                    LDA     #BSTART
 5746  FD0F55  85 0E                    STA     ix8
 5747  FD0F57  80 0F                    bra     ?06
 5748  FD0F59  3A               ?04:    dec     a                       ; update pointer
 5749  FD0F5A  97 14                    STA     [pblk],Y
 5750  FD0F5C  A4 17                    LDY     ixb                     ; move back bytes from end of block
 5751  FD0F5E  C8                       INY                             ; to current position 
 5752  FD0F5F  B7 14            ?05:    LDA     [pblk],Y                
 5753  FD0F61  88                       DEY
 5754  FD0F62  97 14                    STA     [pblk],Y
 5755  FD0F64  C8                       INY
 5756  FD0F65  C8                       INY
 5757  FD0F66  D0 F7                    BNE     ?05
 5758  FD0F68  A9 80            ?06:    lda     #$80
 5759  FD0F6A  04 18                    tsb     bflag                   ; set modified flag
 5760  FD0F6C  7A                       ply
 5761  FD0F6D  FA                       plx
 5762  FD0F6E  68                       pla
 5763  FD0F6F  60                       rts
 5764                           
 5765                           ; find beginning of next line
 5766                           ; in:   none
 5767                           ; out:  CF = 0 if ok, CF = 1 if end of buffer
 5768                           ;       X = count of bytes till next line
 5769                           ; Y preserved
 5770                           ; P13CA:
 5771  FD0F70                   nextln:
 5772  FD0F70  5A                       phy
 5773  FD0F71  A2 00                    ldx     #0                      ; bytes counter
 5774  FD0F73  A4 17                    ldy     ixb
 5775  FD0F75  38                       sec
 5776  FD0F76  B7 14                    lda     [pblk],y                ; get next byte
 5777  FD0F78  F0 10                    beq     ?03                     ; if end of buffer exit with CF = 1
 5778  FD0F7A  C9 0D            ?01:    cmp     #$0D                    ; end of line ?
 5779  FD0F7C  F0 08                    beq     ?02                     ; yes
 5780  FD0F7E  E8                       inx
 5781  FD0F7F  20 DF 0F                 jsr     incptr2                 ; Y = next index
 5782  FD0F82  B7 14                    lda     [pblk],y                ; get next byte
 5783  FD0F84  80 F4                    bra     ?01
 5784  FD0F86  20 DF 0F         ?02:    jsr     incptr2                 ; beginning of next line
 5785  FD0F89  18                       clc
 5786  FD0F8A  7A               ?03:    ply
 5787  FD0F8B  60                       rts
 5788                           
 5789                           ; find beginning of current line
 5790                           ; in:   none
 5791                           ; out:  CF = 0 if ok, CF = 1 if beginning of buffer
 5792                           ;       X = count of bytes till start of line
  Tue Jul 17 11:00:22 2018                                                                                               Page   57




 5793                           ; Y preserved
 5794                           ; P1427:
 5795  FD0F8C                   startln:
 5796  FD0F8C  5A                       phy
 5797  FD0F8D  A2 00                    ldx     #0                      ; bytes counter
 5798  FD0F8F  20 1E 10                 jsr     decptr2                 ; decrement buffer pointer
 5799  FD0F92  B0 13                    bcs     ?04                     ; exit with CF = 1 if beginning
 5800  FD0F94  E8                       inx
 5801  FD0F95  20 1E 10         ?01:    jsr     decptr2
 5802  FD0F98  B0 0C                    bcs     ?03                     ; we are at the beginning
 5803  FD0F9A  B7 14                    lda     [pblk],y                ; previous byte
 5804  FD0F9C  C9 0D                    cmp     #$0D
 5805  FD0F9E  F0 03                    beq     ?02                     ; end of prev. line
 5806  FD0FA0  E8                       inx
 5807  FD0FA1  80 F2                    bra     ?01
 5808  FD0FA3  20 DF 0F         ?02:    jsr     incptr2                 ; beginning of line
 5809  FD0FA6  18               ?03:    clc
 5810  FD0FA7  7A               ?04:    ply
 5811  FD0FA8  60                       rts
 5812                           
 5813                           ; get byte from buffer at current index
 5814                           ; in:   none
 5815                           ; out:  A = current byte (CF = 0 if not null, CF = 1 if null)
 5816                           ; X,Y preserved
 5817                           ; P2353:
 5818  FD0FA9                   getbyte:
 5819  FD0FA9  5A                       phy
 5820  FD0FAA  A4 17                    ldy     ixb
 5821  FD0FAC  B7 14                    lda     [pblk],y
 5822  FD0FAE  18                       clc
 5823  FD0FAF  D0 01                    bne     ?01
 5824  FD0FB1  38                       sec
 5825  FD0FB2  7A               ?01:    ply
 5826  FD0FB3  60                       rts
 5827                           
 5828                           ; get byte from buffer at current index
 5829                           ; in:   none
 5830                           ; out:  A = current byte (CF = 0 if not null, CF = 1 if null)
 5831                           ; X preserved
 5832                           ; P2353:
 5833  FD0FB4                   getbyte2:
 5834  FD0FB4  A4 17                    ldy     ixb
 5835  FD0FB6  B7 14                    lda     [pblk],y
 5836  FD0FB8  F0 02                    beq     ?02
 5837  FD0FBA  18                       clc
 5838  FD0FBB  60                       rts
 5839  FD0FBC  38               ?02:    sec
 5840  FD0FBD  60                       rts
 5841                           
 5842                           ; increment buffer pointer
 5843                           ; in:   none
 5844                           ; out:  CF = 1 if change block or if end of buffer
 5845                           ; A,X,Y preserved
 5846                           ; P2333:
 5847  FD0FBE                   incptr:
 5848  FD0FBE  48                       pha
 5849  FD0FBF  5A                       phy
  Tue Jul 17 11:00:22 2018                                                                                               Page   58




 5850  FD0FC0  A5 17                    lda     ixb
 5851  FD0FC2  A0 04                    ldy     #BNDX
 5852  FD0FC4  D7 14                    cmp     [pblk],y
 5853  FD0FC6  90 0C                    bcc     ?04                     ; ok, increment
 5854  FD0FC8                           ACC16
 5855  FD0FC8  C2 20                    rep     #PMFLAG
 5856                                   .LONGA  on
 5857                                   .MNLIST
 5858  FD0FCA  A7 14                    lda     [pblk]                  ; next block
 5859  FD0FCC  F0 0C                    beq     ?08                     ; end of buffer, exit with CF = 1
 5860  FD0FCE  85 15                    sta     ppage                   ; update page pointer
 5861  FD0FD0                           ACC08
 5862  FD0FD0  E2 20                    sep     #PMFLAG
 5863                                   .LONGA  off
 5864                                   .MNLIST
 5865  FD0FD2  A9 04                    lda     #BSTART-1               ; beginning of buffer
 5866  FD0FD4  1A               ?04:    inc     a
 5867  FD0FD5  85 17                    sta     ixb
 5868  FD0FD7  7A                       ply
 5869  FD0FD8  68                       pla
 5870  FD0FD9  60                       rts
 5871  FD0FDA                   ?08:    ACC08   
 5872  FD0FDA  E2 20                    sep     #PMFLAG
 5873                                   .LONGA  off
 5874                                   .MNLIST
 5875  FD0FDC  7A                       ply
 5876  FD0FDD  68                       pla
 5877  FD0FDE  60                       rts
 5878                           
 5879                           ; increment buffer pointer
 5880                           ; in:   none
 5881                           ; out:  CF = 1 if change block or if end of buffer
 5882                           ;       Y = index
 5883                           ; X preserved
 5884  FD0FDF                   incptr2:
 5885  FD0FDF  A5 17                    lda     ixb
 5886  FD0FE1  A0 04                    ldy     #BNDX
 5887  FD0FE3  D7 14                    cmp     [pblk],y
 5888  FD0FE5  A8                       tay
 5889  FD0FE6  90 0A                    bcc     ?04                     ; ok, increment
 5890  FD0FE8                           ACC16
 5891  FD0FE8  C2 20                    rep     #PMFLAG
 5892                                   .LONGA  on
 5893                                   .MNLIST
 5894  FD0FEA  A7 14                    lda     [pblk]                  ; next block
 5895  FD0FEC  F0 07                    beq     ?08                     ; end of buffer, exit with CF = 1
 5896  FD0FEE  85 15                    sta     ppage                   ; update page pointer
 5897  FD0FF0  A0 04                    ldy     #BSTART-1               ; beginning of buffer
 5898  FD0FF2  C8               ?04:    iny
 5899  FD0FF3  84 17                    sty     ixb
 5900  FD0FF5                   ?08:    ACC08   
 5901  FD0FF5  E2 20                    sep     #PMFLAG
 5902                                   .LONGA  off
 5903                                   .MNLIST
 5904  FD0FF7  60                       rts
 5905                           
 5906                           ; decrement buffer pointer
  Tue Jul 17 11:00:22 2018                                                                                               Page   59




 5907                           ; in:   none
 5908                           ; out:  CF = 1 if at buffer beginning
 5909                           ; A,X,Y preserved
 5910                           ; P2430:
 5911  FD0FF8                   decptr:
 5912  FD0FF8  48                       pha
 5913  FD0FF9  A5 17                    lda     ixb
 5914  FD0FFB  C9 05                    cmp     #BSTART
 5915  FD0FFD  D0 14                    bne     ?02                     ; ok, decrement
 5916  FD0FFF  5A                       phy
 5917  FD1000  A0 02                    ldy     #BPREV                  ; previous page pointer
 5918  FD1002                           ACC16
 5919  FD1002  C2 20                    rep     #PMFLAG
 5920                                   .LONGA  on
 5921                                   .MNLIST
 5922  FD1004  B7 14                    LDA     [pblk],Y
 5923  FD1006  F0 11                    beq     ?08                     ; exit with CF = 1
 5924  FD1008  85 15                    sta     ppage                   ; update page pointer
 5925  FD100A                           ACC08
 5926  FD100A  E2 20                    sep     #PMFLAG
 5927                                   .LONGA  off
 5928                                   .MNLIST
 5929  FD100C  A0 04                    LDY     #BNDX
 5930  FD100E  B7 14                    LDA     [pblk],Y
 5931  FD1010  7A                       ply
 5932  FD1011  80 01                    bra     ?04
 5933  FD1013  3A               ?02:    dec     a       
 5934  FD1014  85 17            ?04:    sta     ixb
 5935  FD1016  18                       clc                             ; ok, exit with CF = 0
 5936  FD1017  68                       pla
 5937  FD1018  60                       rts
 5938  FD1019                   ?08:    ACC08SEC        
 5939  FD1019  E2 21                    sep     #(PMFLAG.OR.PCFLAG)
 5940                                   .LONGA  off
 5941                                   .MNLIST
 5942  FD101B  7A                       ply
 5943  FD101C  68                       pla
 5944  FD101D  60                       rts
 5945                           
 5946                           ; decrement buffer pointer
 5947                           ; in:   none
 5948                           ; out:  CF = 1 if at buffer beginning
 5949                           ;       Y = index
 5950                           ; X preserved
 5951  FD101E                   decptr2:
 5952  FD101E  A4 17                    ldy     ixb
 5953  FD1020  C0 05                    cpy     #BSTART
 5954  FD1022  D0 12                    bne     ?02                     ; ok, decrement
 5955  FD1024  A0 02                    ldy     #BPREV                  ; previous page pointer
 5956  FD1026                           ACC16
 5957  FD1026  C2 20                    rep     #PMFLAG
 5958                                   .LONGA  on
 5959                                   .MNLIST
 5960  FD1028  B7 14                    LDA     [pblk],Y
 5961  FD102A  F0 0F                    beq     ?08                     ; exit with CF = 1
 5962  FD102C  85 15                    sta     ppage                   ; update page pointer
 5963  FD102E                           ACC08
  Tue Jul 17 11:00:22 2018                                                                                               Page   60




 5964  FD102E  E2 20                    sep     #PMFLAG
 5965                                   .LONGA  off
 5966                                   .MNLIST
 5967  FD1030  A0 04                    LDY     #BNDX
 5968  FD1032  B7 14                    LDA     [pblk],Y
 5969  FD1034  A8                       tay
 5970  FD1035  C8                       iny
 5971  FD1036  88               ?02:    dey     
 5972  FD1037  84 17            ?04:    sty     ixb
 5973  FD1039  18                       clc                             ; ok, exit with CF = 0
 5974  FD103A  60                       rts
 5975  FD103B                   ?08:    ACC08SEC        
 5976  FD103B  E2 21                    sep     #(PMFLAG.OR.PCFLAG)
 5977                                   .LONGA  off
 5978                                   .MNLIST
 5979  FD103D  A4 17                    ldy     ixb
 5980  FD103F  60                       rts
 5981                           
 5982                           ; insert new block in buffer and store byte in new block
 5983                           ; in:   wtmp = page pointer of new block
 5984                           ;       A = byte to store
 5985                           ; out:  buffer linked list modified
 5986                           ; using lptmp2 long pointer
 5987                           ; A,X preserved
 5988                           ; P22DF:
 5989  FD1040                   addblk:
 5990  FD1040  64 4F                    stz     lptmp2                  ; using lptmp2 long pointer
 5991  FD1042  48                       PHA                             ; save byte to store
 5992  FD1043                           ACC16
 5993  FD1043  C2 20                    rep     #PMFLAG
 5994                                   .LONGA  on
 5995                                   .MNLIST
 5996  FD1045  A7 14                    LDA     [pblk]                  ; next page pointer
 5997  FD1047  48                       PHA                             ; save
 5998  FD1048  F0 0A                    BEQ     ?01                     ; next = 0
 5999  FD104A  85 50                    STA     lptmp2+1                ; lptmp2 = next
 6000  FD104C  A5 4A                    LDA     wtmp                    ; new page pointer
 6001  FD104E  A0 02                    LDY     #BPREV
 6002  FD1050  97 4F                    STA     [lptmp2],Y              ; next->prev = new page pointer
 6003  FD1052  80 02                    bra     ?02
 6004  FD1054  A5 4A            ?01:    LDA     wtmp                    ; next = new page pointer
 6005  FD1056  87 14            ?02:    STA     [pblk]
 6006  FD1058  85 50                    STA     lptmp2+1
 6007  FD105A  A7 4F                    LDA     [lptmp2]                ; next free page pointer
 6008  FD105C  85 10                    STA     pfree
 6009  FD105E  68                       PLA
 6010  FD105F  87 4F                    STA     [lptmp2]                ; new page next = cur->next
 6011  FD1061  A5 15                    LDA     ppage
 6012  FD1063  A0 02                    LDY     #BPREV
 6013  FD1065  97 4F                    STA     [lptmp2],Y              ; new page prev = cur
 6014  FD1067                           ACC08
 6015  FD1067  E2 20                    sep     #PMFLAG
 6016                                   .LONGA  off
 6017                                   .MNLIST
 6018  FD1069  A9 05                    LDA     #BSTART
 6019  FD106B  A0 04                    LDY     #BNDX
 6020  FD106D  97 4F                    STA     [lptmp2],Y              ; buffer index
  Tue Jul 17 11:00:22 2018                                                                                               Page   61




 6021  FD106F  68                       PLA
 6022  FD1070  C8                       INY
 6023  FD1071  97 4F                    STA     [lptmp2],Y              ; store byte
 6024  FD1073  60                       RTS
 6025                           
 6026                           ; remove a block from buffer and put in free blocks list
 6027                           ; in:   C = page pointer of block to remove
 6028                           ; using lptmp1 & lptmp2 long pointers
 6029                           ; X preserved
 6030                           ; P23EC:
 6031  FD1074                   delblk:
 6032  FD1074  64 4C                    stz     lptmp1                  ; using lptmp1 & lptmp2 long pointer
 6033  FD1076  64 4F                    stz     lptmp2
 6034  FD1078                           ACC16
 6035  FD1078  C2 20                    rep     #PMFLAG
 6036                                   .LONGA  on
 6037                                   .MNLIST
 6038  FD107A  85 4D                    STA     lptmp1+1                ; page pointer to removing block
 6039  FD107C  C5 04                    CMP     pp4
 6040  FD107E  D0 08                    BNE     ?01
 6041  FD1080  A7 4C                    lda     [lptmp1]
 6042  FD1082  85 04                    STA     pp4                     ; next block
 6043  FD1084  A0 05                    LDY     #BSTART
 6044  FD1086  84 0C                    STY     ix4
 6045  FD1088  A7 4C            ?01:    lda     [lptmp1]
 6046  FD108A  D0 06                    BNE     ?02
 6047  FD108C  A0 02                    LDY     #BPREV                  ; this is the first block
 6048  FD108E  B7 4C                    lda     [lptmp1],y
 6049  FD1090  80 08                    bra     ?03
 6050  FD1092  85 50            ?02:    STA     lptmp2+1                ; next block
 6051  FD1094  A0 02                    LDY     #BPREV
 6052  FD1096  B7 4C                    lda     [lptmp1],y              ; next->prev = this->prev
 6053  FD1098  97 4F                    STA     [lptmp2],Y
 6054  FD109A  D0 13            ?03:    BNE     ?04                     ; prev != NULL
 6055  FD109C  A5 50                    LDA     lptmp2+1                ; prev = NULL => next block 
 6056  FD109E  85 12                    STA     pbuf                    ; become first block of this buffer
 6057  FD10A0  A6 0F                    LDX     xbuf
 6058  FD10A2  48                       pha
 6059  FD10A3                           ACC08
 6060  FD10A3  E2 20                    sep     #PMFLAG
 6061                                   .LONGA  off
 6062                                   .MNLIST
 6063  FD10A5  8A                       txa
 6064  FD10A6  0A                       asl     a
 6065  FD10A7  AA                       tax
 6066  FD10A8                           ACC16
 6067  FD10A8  C2 20                    rep     #PMFLAG
 6068                                   .LONGA  on
 6069                                   .MNLIST
 6070  FD10AA  68                       pla
 6071  FD10AB  95 6C                    STA     bstart,X                ; store first block of this buffer
 6072  FD10AD  80 06                    bra     ?05
 6073  FD10AF  85 50            ?04:    STA     lptmp2+1                ; prev block
 6074  FD10B1  A7 4C                    lda     [lptmp1]                ; prev->next = this->next
 6075  FD10B3  87 4F                    STA     [lptmp2]
 6076  FD10B5  A5 10            ?05:    LDA     pfree                   ; insert this block on free list
 6077  FD10B7  87 4C                    STA     [lptmp1]
  Tue Jul 17 11:00:22 2018                                                                                               Page   62




 6078  FD10B9  A5 4D                    LDA     lptmp1+1
 6079  FD10BB  85 10                    STA     pfree
 6080  FD10BD                           ACC08
 6081  FD10BD  E2 20                    sep     #PMFLAG
 6082                                   .LONGA  off
 6083                                   .MNLIST
 6084  FD10BF  60                       RTS 
 6085                           
 6086                           ; garbage collection -- free unused memory assigned to a buffer
 6087                           ; out:  CF = 0 if completed, otherwise CF = 1
 6088                           ; can be called in both 8/16 bit
 6089                           ; P1855:
 6090  FD10C0                   garbc:
 6091  FD10C0  08                       php                             ; save 8/16 bit mode
 6092  FD10C1                           CPU08
 6093  FD10C1  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 6094                                   .LONGA  off
 6095                                   .LONGI  off
 6096                                   .MNLIST
 6097  FD10C3  64 5C                    stz     lptc                    ; clear used memory
 6098  FD10C5  64 5F                    stz     lpte                    ; using long pointer lptc & lpte
 6099  FD10C7  64 67                    stz     tmpb
 6100  FD10C9  64 68                    stz     tmpc
 6101  FD10CB  64 69                    stz     tmpd
 6102  FD10CD  64 6A                    stz     tmpe
 6103  FD10CF  64 6B                    stz     tmpf
 6104  FD10D1                           ACC16CLC
 6105  FD10D1  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 6106                                   .LONGA  on
 6107                                   .MNLIST
 6108  FD10D3  A5 12                    LDA     pbuf                    ; first block of the buffer
 6109  FD10D5  48                       PHA
 6110  FD10D6  68               ?00:    PLA     
 6111  FD10D7  85 5D                    STA     lptc+1
 6112  FD10D9  A7 5C                    LDA     [lptc]
 6113  FD10DB  D0 03                    bne     ?01
 6114  FD10DD  28                       plp                             ; only this block -- done
 6115  FD10DE  18                       clc
 6116  FD10DF  60                       rts
 6117  FD10E0  48               ?01:    pha                             ; save next block       
 6118  FD10E1                           ACC08   
 6119  FD10E1  E2 20                    sep     #PMFLAG
 6120                                   .LONGA  off
 6121                                   .MNLIST
 6122  FD10E3  A0 04                    ldy     #BNDX
 6123  FD10E5  B7 5C                    LDA     [lptc],Y
 6124  FD10E7  AA                       TAX                             ; X = pointer in block
 6125  FD10E8                           ACC16CLC
 6126  FD10E8  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 6127                                   .LONGA  on
 6128                                   .MNLIST
 6129  FD10EA  E8                       INX                             ; full block?
 6130  FD10EB  F0 E9                    beq     ?00                     ; yes -- check next block
 6131  FD10ED  86 63                    STX     tmp7                    ; tmp7 = next free
 6132  FD10EF  68                       pla                             ; next block
 6133  FD10F0  85 60                    STA     lpte+1
 6134  FD10F2  A2 01                    LDX     #1
  Tue Jul 17 11:00:22 2018                                                                                               Page   63




 6135  FD10F4  C5 15                    CMP     ppage
 6136  FD10F6  D0 02                    BNE     ?02
 6137  FD10F8  86 67                    STX     tmpb                    ; tmpb = 1 if this block = current block
 6138  FD10FA  C5 08            ?02:    CMP     pp8
 6139  FD10FC  D0 02                    bne     ?03
 6140  FD10FE  86 68                    STX     tmpc                    ; tmpc = 1 if this block = pp8
 6141  FD1100  C5 04            ?03:    CMP     pp4
 6142  FD1102  D0 02                    bne     ?04
 6143  FD1104  86 69                    STX     tmpd                    ; tmpd = 1 if this block = pp4
 6144  FD1106  C5 06            ?04:    CMP     pp6
 6145  FD1108  D0 02                    bne     ?05
 6146  FD110A  86 6A                    STX     tmpe                    ; tmpe = 1 if this block = pp6
 6147  FD110C  C5 00            ?05:    CMP     pp0
 6148  FD110E  D0 02                    bne     ?06
 6149  FD1110  86 6B                    STX     tmpf                    ; tmpf = 1 if this block = pp0
 6150  FD1112                   ?06:    ACC08   
 6151  FD1112  E2 20                    sep     #PMFLAG
 6152                                   .LONGA  off
 6153                                   .MNLIST
 6154  FD1114  A0 04                    LDY     #BNDX
 6155  FD1116  B7 5F                    LDA     [lpte],Y
 6156  FD1118  85 65                    STA     tmp9                    ; tmp9 = pointer in next block
 6157  FD111A  C8                       iny
 6158  FD111B  84 64                    STY     tmp8                    ; tmp8 = dynamic pointer in next block
 6159  FD111D  A4 64            ?07:    LDY     tmp8                    ; loop
 6160  FD111F  B7 5F                    LDA     [lpte],Y                ; move first byte of next block
 6161  FD1121  A4 63                    LDY     tmp7                    ; to next free room in this block
 6162  FD1123  97 5C                    STA     [lptc],Y
 6163  FD1125                           ACC16
 6164  FD1125  C2 20                    rep     #PMFLAG
 6165                                   .LONGA  on
 6166                                   .MNLIST
 6167  FD1127  A5 5D                    LDA     lptc+1                  ; C = this block
 6168  FD1129  A6 67                    LDX     tmpb
 6169  FD112B  F0 0E                    beq     ?08
 6170  FD112D  A6 17                    LDX     ixb
 6171  FD112F  E4 64                    CPX     tmp8
 6172  FD1131  D0 08                    BNE     ?08
 6173  FD1133  85 15                    STA     ppage                   ; set to this block
 6174  FD1135  84 17                    STY     ixb
 6175  FD1137  A2 00                    LDX     #0
 6176  FD1139  86 67                    STX     tmpb
 6177  FD113B  A6 68            ?08:    LDX     tmpc
 6178  FD113D  F0 0E                    BEQ     ?09
 6179  FD113F  A6 0E                    LDX     ix8
 6180  FD1141  E4 64                    CPX     tmp8
 6181  FD1143  D0 08                    BNE     ?09
 6182  FD1145  85 08                    STA     pp8                     ; set to this block
 6183  FD1147  84 0E                    STY     ix8
 6184  FD1149  A2 00                    LDX     #0
 6185  FD114B  86 68                    STX     tmpc
 6186  FD114D  A6 69            ?09:    LDX     tmpd
 6187  FD114F  F0 0E                    BEQ     ?10
 6188  FD1151  A6 0C                    LDX     ix4
 6189  FD1153  E4 64                    CPX     tmp8
 6190  FD1155  D0 08                    BNE     ?10
 6191  FD1157  85 04                    STA     pp4                     ; set to this block
  Tue Jul 17 11:00:22 2018                                                                                               Page   64




 6192  FD1159  84 0C                    STY     ix4
 6193  FD115B  A2 00                    LDX     #0
 6194  FD115D  86 69                    STX     tmpd
 6195  FD115F  A6 6A            ?10:    LDX     tmpe
 6196  FD1161  F0 0E                    BEQ     ?11
 6197  FD1163  A6 0D                    LDX     ix6
 6198  FD1165  E4 64                    CPX     tmp8
 6199  FD1167  D0 08                    BNE     ?11
 6200  FD1169  85 06                    STA     pp6                     ; set to this block
 6201  FD116B  84 0D                    STY     ix6
 6202  FD116D  A2 00                    LDX     #0
 6203  FD116F  86 6A                    STX     tmpe
 6204  FD1171  A6 6B            ?11:    LDX     tmpf
 6205  FD1173  F0 0E                    BEQ     ?12
 6206  FD1175  A6 0A                    LDX     ix0
 6207  FD1177  E4 64                    CPX     tmp8
 6208  FD1179  D0 08                    BNE     ?12
 6209  FD117B  85 00                    STA     pp0                     ; set to this block
 6210  FD117D  84 0A                    STY     ix0
 6211  FD117F  A2 00                    LDX     #0
 6212  FD1181  86 6B                    STX     tmpf
 6213  FD1183  A6 64            ?12:    LDX     tmp8                    ; X = pointer in next block
 6214  FD1185  A5 60                    LDA     lpte+1                  ; C = next block
 6215  FD1187                           ACC08
 6216  FD1187  E2 20                    sep     #PMFLAG
 6217                                   .LONGA  off
 6218                                   .MNLIST
 6219  FD1189  E4 65                    CPX     tmp9                    ; if same pointer then next block now
 6220  FD118B  F0 08                    BEQ     ?13                     ; is empty and can be freed
 6221  FD118D  E6 64                    INC     tmp8
 6222  FD118F  E6 63                    INC     tmp7
 6223  FD1191  D0 8A                    bne     ?07                     ; loop move byte
 6224  FD1193  F0 0C                    BEQ     ?15                     ; continue      
 6225  FD1195  20 74 10         ?13:    JSR     delblk                  ; remove next block (C)
 6226  FD1198  A0 04                    LDY     #BNDX
 6227  FD119A  A5 63                    LDA     tmp7                    ; set pointer in block
 6228  FD119C  97 5C                    STA     [lptc],Y
 6229  FD119E  28                       plp
 6230  FD119F  18                       CLC                             ; done
 6231  FD11A0  60                       RTS 
 6232  FD11A1  A9 FF            ?15:    LDA     #$FF                    ; full block
 6233  FD11A3  A0 04                    LDY     #BNDX
 6234  FD11A5  97 5C                    STA     [lptc],Y
 6235  FD11A7  C8                       INY
 6236  FD11A8  84 63                    STY     tmp7
 6237  FD11AA  A5 64                    LDA     tmp8
 6238  FD11AC  38                       SEC
 6239  FD11AD  E9 05                    SBC     #BSTART
 6240  FD11AF  85 66                    STA     tmpa                    ; residue
 6241  FD11B1  E6 65                    INC     tmp9                    ; limit pointer in next block
 6242  FD11B3  A4 64                    LDY     tmp8
 6243  FD11B5  A6 63                    LDX     tmp7
 6244  FD11B7  B7 5F            ?16:    LDA     [lpte],Y                ; move byte
 6245  FD11B9  9B                       TXY
 6246  FD11BA  97 5F                    STA     [lpte],Y
 6247  FD11BC  E8                       INX
 6248  FD11BD  E6 64                    INC     tmp8
  Tue Jul 17 11:00:22 2018                                                                                               Page   65




 6249  FD11BF  A4 64                    LDY     tmp8
 6250  FD11C1  C4 65                    CPY     tmp9
 6251  FD11C3  D0 F2                    BNE     ?16                     ; move all bytes
 6252  FD11C5  A5 67                    LDA     tmpb
 6253  FD11C7  F0 07                    BEQ     ?17
 6254  FD11C9  A5 17                    LDA     ixb
 6255  FD11CB  38                       SEC
 6256  FD11CC  E5 66                    SBC     tmpa
 6257  FD11CE  85 17                    STA     ixb
 6258  FD11D0  A5 68            ?17:    LDA     tmpc
 6259  FD11D2  F0 07                    BEQ     ?18
 6260  FD11D4  A5 0E                    LDA     ix8
 6261  FD11D6  38                       SEC
 6262  FD11D7  E5 66                    SBC     tmpa
 6263  FD11D9  85 0E                    STA     ix8
 6264  FD11DB  A5 69            ?18:    LDA     tmpd
 6265  FD11DD  F0 07                    BEQ     ?19
 6266  FD11DF  A5 0C                    LDA     ix4
 6267  FD11E1  38                       SEC
 6268  FD11E2  E5 66                    SBC     tmpa
 6269  FD11E4  85 0C                    STA     ix4
 6270  FD11E6  A5 6A            ?19:    LDA     tmpe
 6271  FD11E8  F0 07                    BEQ     ?20
 6272  FD11EA  A5 0D                    LDA     ix6
 6273  FD11EC  38                       SEC
 6274  FD11ED  E5 66                    SBC     tmpa
 6275  FD11EF  85 0D                    STA     ix6
 6276  FD11F1  A5 6B            ?20:    LDA     tmpf
 6277  FD11F3  F0 07                    BEQ     ?21
 6278  FD11F5  A5 0A                    LDA     ix0
 6279  FD11F7  38                       SEC
 6280  FD11F8  E5 66                    SBC     tmpa
 6281  FD11FA  85 0A                    STA     ix0
 6282  FD11FC  A5 65            ?21:    LDA     tmp9
 6283  FD11FE  18                       CLC
 6284  FD11FF  E5 66                    SBC     tmpa
 6285  FD1201  A0 04                    LDY     #BNDX                   ; update pointer in next buffer
 6286  FD1203  97 5F                    STA     [lpte],Y
 6287  FD1205  28                       plp
 6288  FD1206  38                       SEC                             ; not done
 6289  FD1207  60                       RTS 
 6290                           
 6291                           ;-----------------------------------------------------------------
 6292                           ; high level screen
 6293                           
 6294                           ; update last edit text row on screen
 6295                           ; P13E5:
 6296  FD1208                   updlst:
 6297  FD1208                           ACC16
 6298  FD1208  C2 20                    rep     #PMFLAG
 6299                                   .LONGA  on
 6300                                   .MNLIST
 6301  FD120A  A9 30 07                 LDA     #!LSTLINE
 6302  FD120D  85 34                    sta     stxtp
 6303  FD120F  09 00 08                 ora     #!TXTATTR
 6304  FD1212  85 38                    sta     sattp
 6305  FD1214                           ACC08
  Tue Jul 17 11:00:22 2018                                                                                               Page   66




 6306  FD1214  E2 20                    sep     #PMFLAG
 6307                                   .LONGA  off
 6308                                   .MNLIST
 6309  FD1216  A5 23                    LDA     fslct
 6310  FD1218  F0 16                    BEQ     ?01
 6311  FD121A  A5 25                    LDA     nslcth
 6312  FD121C  10 12                    BPL     ?01
 6313  FD121E  A9 17                    LDA     #$17
 6314  FD1220  38                       SEC
 6315  FD1221  E5 20                    SBC     srow
 6316  FD1223  18                       CLC
 6317  FD1224  65 24                    ADC     nslctl
 6318  FD1226  A9 00                    LDA     #$00
 6319  FD1228  65 25                    ADC     nslcth
 6320  FD122A  10 04                    BPL     ?01
 6321  FD122C  A9 80                    LDA     #$80
 6322  FD122E  85 37                    STA     frev
 6323  FD1230  A6 06            ?01:    LDX     pp6
 6324  FD1232  A5 07                    lda     pp6+1
 6325  FD1234  A4 0D                    LDY     ix6
 6326  FD1236  20 60 14                 JSR     setptr
 6327  FD1239  80 2E                    bra     updrow
 6328                           
 6329                           ; update first edit text row on screen
 6330                           ; P1E30:
 6331  FD123B                   updfst:
 6332  FD123B                           ACC16
 6333  FD123B  C2 20                    rep     #PMFLAG
 6334                                   .LONGA  on
 6335                                   .MNLIST
 6336  FD123D  A9 00 00                 LDA     #!TXTADDR
 6337  FD1240  85 34                    sta     stxtp
 6338  FD1242  09 00 08                 ora     #!TXTATTR
 6339  FD1245  85 38                    sta     sattp
 6340  FD1247                           ACC08
 6341  FD1247  E2 20                    sep     #PMFLAG
 6342                                   .LONGA  off
 6343                                   .MNLIST
 6344  FD1249  A5 23                    LDA     fslct
 6345  FD124B  F0 13                    BEQ     ?01
 6346  FD124D  A5 25                    LDA     nslcth
 6347  FD124F  30 0F                    BMI     ?01
 6348  FD1251  A5 20                    LDA     srow
 6349  FD1253  38                       SEC
 6350  FD1254  E5 24                    SBC     nslctl
 6351  FD1256  A9 00                    LDA     #$00
 6352  FD1258  E5 25                    SBC     nslcth
 6353  FD125A  10 04                    BPL     ?01
 6354  FD125C  A9 80                    LDA     #$80
 6355  FD125E  85 37                    STA     frev
 6356  FD1260  A6 04            ?01:    LDX     pp4
 6357  FD1262  A5 05                    lda     pp4+1
 6358  FD1264  A4 0C                    LDY     ix4
 6359  FD1266  20 60 14                 JSR     setptr
 6360                           
 6361                           ; update current row on screen
 6362                           ; P2779:
  Tue Jul 17 11:00:22 2018                                                                                               Page   67




 6363  FD1269                   updrow:
 6364  FD1269  BD FF FF                 lda     !$FFFF,x
 6365  FD126C  D0 12                    BNE     ?04
 6366  FD126E  A9 20                    lda     #' '                    ; blank row
 6367  FD1270  EB                       xba
 6368  FD1271  A5 3B                    lda     eattr                   ; A = attribute, B = blank
 6369  FD1273  A0 4F                    ldy     #MAXCOLS-1
 6370  FD1275  97 38            ?02:    sta     [sattp],y               ; store attribute
 6371  FD1277  EB                       xba
 6372  FD1278  97 34                    sta     [stxtp],y               ; store blank
 6373  FD127A  EB                       xba
 6374  FD127B  88                       dey
 6375  FD127C  10 F7                    bpl     ?02
 6376  FD127E  38                       SEC
 6377  FD127F  60                       RTS
 6378  FD1280  A4 1F            ?04:    LDY     ecol
 6379  FD1282  F0 16                    BEQ     updr2
 6380                           ; P279F:
 6381  FD1284                   updr1:
 6382  FD1284  BD FF FF                 lda     !$FFFF,x
 6383  FD1287  C9 0D                    CMP     #$0D
 6384  FD1289  D0 04                    BNE     ?02
 6385  FD128B  A0 00                    LDY     #$00
 6386  FD128D  80 3A                    bra     updr9
 6387  FD128F  E4 51            ?02:    CPX     ebtmp2
 6388  FD1291  D0 03                    BNE     ?03
 6389  FD1293  20 8C 14                 JSR     updptr
 6390  FD1296  E8               ?03:    INX
 6391  FD1297  88                       DEY
 6392  FD1298  D0 EA                    BNE     updr1
 6393                           ; P27B7:
 6394  FD129A                   updr2:
 6395  FD129A  BD FF FF                 lda     !$FFFF,x
 6396  FD129D  C9 0D                    CMP     #$0D
 6397  FD129F  F0 28                    BEQ     updr9
 6398  FD12A1  C0 50                    CPY     #MAXCOLS
 6399  FD12A3  D0 11                    BNE     updr7
 6400  FD12A5  E4 51            updr5:  CPX     ebtmp2
 6401  FD12A7  90 03                    BCC     ?06
 6402  FD12A9  20 8C 14                 JSR     updptr
 6403  FD12AC  E8               ?06:    INX
 6404                           ; P27CC:
 6405  FD12AD                   updr3:
 6406  FD12AD  BD FF FF                 lda     !$FFFF,x
 6407  FD12B0  C9 0D                    CMP     #$0D
 6408  FD12B2  D0 F1                    BNE     updr5
 6409  FD12B4  F0 13                    beq     updr9
 6410  FD12B6  97 34            updr7:  sta     [stxtp],y               ; store char in video ram
 6411  FD12B8  A5 3B                    lda     eattr                   ; editor attribute
 6412  FD12BA  45 37                    EOR     frev                    ; set reverse bit
 6413  FD12BC  97 38                    sta     [sattp],y               ; store attribute
 6414  FD12BE  C8                       INY
 6415  FD12BF  E4 51                    CPX     ebtmp2
 6416  FD12C1  90 03                    BCC     ?08
 6417  FD12C3  20 8C 14                 JSR     updptr
 6418  FD12C6  E8               ?08:    INX
 6419  FD12C7  80 D1                    bra     updr2
  Tue Jul 17 11:00:22 2018                                                                                               Page   68




 6420  FD12C9  E4 51            updr9:  CPX     ebtmp2
 6421  FD12CB  90 03                    BCC     ?10
 6422  FD12CD  20 8C 14                 JSR     updptr
 6423  FD12D0  E8               ?10:    INX
 6424  FD12D1  A9 20                    LDA     #' '                    ; pad row with blank
 6425  FD12D3  EB                       xba                             ; B = char, A = attribute
 6426  FD12D4  A5 3B                    lda     eattr                   ; editor attribute      
 6427  FD12D6  45 37                    EOR     frev                    ; set reverse bit
 6428  FD12D8  C0 50            ?11:    CPY     #MAXCOLS
 6429  FD12DA  F0 09                    BEQ     ?12
 6430  FD12DC  97 38                    sta     [sattp],y               ; store attribute
 6431  FD12DE  EB                       xba
 6432  FD12DF  97 34                    sta     [stxtp],y               ; store blank
 6433  FD12E1  EB                       xba
 6434  FD12E2  C8                       INY
 6435  FD12E3  D0 F3                    BNE     ?11
 6436  FD12E5  64 37            ?12:    STZ     frev                    ; clear reverse flag bit
 6437  FD12E7  18                       CLC
 6438  FD12E8  60                       RTS 
 6439                           
 6440                           ; scroll right editor window (move window left one column)
 6441                           ; P24D9:
 6442  FD12E9                   scrlright:
 6443  FD12E9  8B                       phb                             ; save DBR
 6444  FD12EA                           ACC16CLC
 6445  FD12EA  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 6446                                   .LONGA  on
 6447                                   .MNLIST
 6448  FD12EC  A9 00 00                 lda     #!TXTADDR               ; set screen text pointer
 6449  FD12EF  85 34                    sta     stxtp
 6450  FD12F1  A9 00 08                 lda     #!TXTATTR               ; set screen attributes pointer
 6451  FD12F4  85 38                    sta     sattp
 6452  FD12F6  A5 04                    LDA     pp4                     ; buffer page pointer
 6453  FD12F8  85 5D                    STA     lptc+1                  ; B = bank, A = page
 6454  FD12FA                           ACC08
 6455  FD12FA  E2 20                    sep     #PMFLAG
 6456                                   .LONGA  off
 6457                                   .MNLIST
 6458  FD12FC  4B                       phk
 6459  FD12FD  AB                       plb                             ; DBR = PBR
 6460  FD12FE  9C 23 13                 STZ     !sclr1+1
 6461  FD1301  9C 2C 13                 STZ     !sclr2+1
 6462  FD1304  8D 24 13                 STA     !sclr1+2
 6463  FD1307  8D 2D 13                 STA     !sclr2+2
 6464  FD130A  64 5C                    STZ     lptc
 6465  FD130C  A5 1F                    LDA     ecol
 6466  FD130E  69 4F                    ADC     #MAXCOLS-1
 6467  FD1310  85 4F                    STA     ewtmp2+1
 6468  FD1312  EB                       xba                             ; A = bank
 6469  FD1313  48                       pha
 6470  FD1314  AB                       plb                             ; set DBR to current buffer
 6471  FD1315  A0 04                    LDY     #BNDX
 6472  FD1317  B1 5C                    lda     (lptc),y
 6473  FD1319  85 50                    STA     ebtmp
 6474  FD131B  20 B1 14                 JSR     chksel
 6475  FD131E  64 4D                    stz     ewtmp+1                 ; counter 24 rows
 6476  FD1320  A6 0C                    LDX     ix4
  Tue Jul 17 11:00:22 2018                                                                                               Page   69




 6477                           ;P2512:
 6478  FD1322  BD FF FF         sclr1:  lda     !$FFFF,x
 6479  FD1325  F0 6D                    beq     sclr3
 6480  FD1327  A0 00                    LDY     #$00
 6481  FD1329  84 4E                    STY     ewtmp2
 6482                           ;P251D:
 6483  FD132B  BD FF FF         sclr2:  lda     !$FFFF,x
 6484  FD132E  C9 0D                    CMP     #$0D
 6485  FD1330  D0 0A                    BNE     ?03
 6486  FD1332  A5 4E                    lda     ewtmp2
 6487  FD1334  D0 19                    BNE     ?06
 6488  FD1336  A9 20                    LDA     #' '                    ; blank padding
 6489  FD1338  85 4C                    sta     ewtmp
 6490  FD133A  80 13                    bra     ?06
 6491  FD133C  C4 4F            ?03:    cpy     ewtmp2+1
 6492  FD133E  D0 04                    BNE     ?04
 6493  FD1340  85 4C                    sta     ewtmp
 6494  FD1342  E6 4E                    INC     ewtmp2
 6495  FD1344  E4 50            ?04:    CPX     ebtmp
 6496  FD1346  D0 03                    BNE     ?05
 6497  FD1348  20 3D 14                 JSR     setscrp
 6498  FD134B  E8               ?05:    INX
 6499  FD134C  C8                       INY
 6500  FD134D  80 DC                    bra     sclr2
 6501  FD134F  E4 50            ?06:    CPX     ebtmp
 6502  FD1351  D0 03                    BNE     ?07
 6503  FD1353  20 3D 14                 JSR     setscrp
 6504  FD1356  E8               ?07:    INX
 6505  FD1357  A9 01                    lda     #^TXTADDR
 6506  FD1359  8B                       phb
 6507  FD135A  48                       pha
 6508  FD135B  AB                       plb
 6509  FD135C  A0 01                    ldy     #$01                    ; move left text and attributes
 6510  FD135E  B1 34            ?08:    lda     (stxtp),y
 6511  FD1360  EB                       xba
 6512  FD1361  B1 38                    lda     (sattp),y               ; A = attribute, B = text 
 6513  FD1363  88                       dey
 6514  FD1364  91 38                    sta     (sattp),y
 6515  FD1366  EB                       xba
 6516  FD1367  91 34                    sta     (stxtp),y
 6517  FD1369  C8                       iny
 6518  FD136A  C8                       iny
 6519  FD136B  C0 50                    cpy     #MAXCOLS
 6520  FD136D  90 EF                    bcc     ?08
 6521  FD136F  88                       DEY
 6522  FD1370  A5 4C                    lda     ewtmp
 6523  FD1372  91 34                    sta     (stxtp),y
 6524  FD1374  A5 3B                    lda     eattr                   ; editor attribute      
 6525  FD1376  20 E3 14                 JSR     tglrev                  ; check reverse bit
 6526  FD1379  91 38                    sta     (sattp),y
 6527  FD137B  AB                       plb
 6528  FD137C                           ACC16CLC
 6529  FD137C  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 6530                                   .LONGA  on
 6531                                   .MNLIST
 6532  FD137E  A5 34                    LDA     stxtp
 6533  FD1380  69 50 00                 ADC     #MAXCOLS
  Tue Jul 17 11:00:22 2018                                                                                               Page   70




 6534  FD1383  85 34                    STA     stxtp
 6535  FD1385  09 00 08                 ora     #!TXTATTR
 6536  FD1388  85 38                    sta     sattp
 6537  FD138A                           ACC08
 6538  FD138A  E2 20                    sep     #PMFLAG
 6539                                   .LONGA  off
 6540                                   .MNLIST
 6541  FD138C  E6 4D                    INC     ewtmp+1
 6542  FD138E  A5 4D                    LDA     ewtmp+1
 6543  FD1390  C9 18                    CMP     #$18
 6544  FD1392  D0 8E                    bne     sclr1
 6545  FD1394  AB               sclr3:  plb     
 6546  FD1395  60                       RTS
 6547                           
 6548                           ; scroll left editor window (move window right one column)
 6549                           ; P25CF:
 6550  FD1396                   scrlleft:
 6551  FD1396  8B                       phb                             ; save DBR
 6552  FD1397                           ACC16CLC
 6553  FD1397  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 6554                                   .LONGA  on
 6555                                   .MNLIST
 6556  FD1399  A9 00 00                 lda     #!TXTADDR               ; set screen text pointer
 6557  FD139C  85 34                    sta     stxtp
 6558  FD139E  A9 00 08                 lda     #!TXTATTR               ; set screen attributes pointer
 6559  FD13A1  85 38                    sta     sattp
 6560  FD13A3  A5 04                    LDA     pp4                     ; buffer page pointer
 6561  FD13A5  85 5D                    STA     lptc+1                  ; B = bank, A = page
 6562  FD13A7                           ACC08
 6563  FD13A7  E2 20                    sep     #PMFLAG
 6564                                   .LONGA  off
 6565                                   .MNLIST
 6566  FD13A9  4B                       phk
 6567  FD13AA  AB                       plb                             ; DBR = PBR
 6568  FD13AB  9C CA 13                 STZ     !scll1+1
 6569  FD13AE  9C D3 13                 STZ     !scll2+1
 6570  FD13B1  8D CB 13                 STA     !scll1+2
 6571  FD13B4  8D D4 13                 STA     !scll2+2
 6572  FD13B7  64 5C                    STZ     lptc
 6573  FD13B9  EB                       xba                             ; A = bank
 6574  FD13BA  48                       pha
 6575  FD13BB  AB                       plb                             ; set DBR to current buffer
 6576  FD13BC  A0 04                    LDY     #BNDX
 6577  FD13BE  B1 5C                    lda     (lptc),y
 6578  FD13C0  85 50                    STA     ebtmp
 6579  FD13C2  20 B1 14                 JSR     chksel
 6580  FD13C5  64 4D                    STZ     ewtmp+1                 ; counter 24 rows
 6581  FD13C7  A6 0C                    LDX     ix4
 6582                           ;P25FF:
 6583  FD13C9                   scll1:
 6584  FD13C9  BD FF FF                 lda     !$FFFF,x
 6585  FD13CC  F0 C6                    beq     sclr3
 6586  FD13CE  A0 00                    LDY     #$00
 6587  FD13D0  84 4E                    STY     ewtmp2
 6588                           ;P260A:
 6589  FD13D2                   scll2:
 6590  FD13D2  BD FF FF                 lda     !$FFFF,x
  Tue Jul 17 11:00:22 2018                                                                                               Page   71




 6591  FD13D5  C9 0D                    CMP     #$0D
 6592  FD13D7  D0 0A                    BNE     ?05
 6593  FD13D9  A5 4E                    lda     ewtmp2
 6594  FD13DB  D0 19                    BNE     ?07a
 6595  FD13DD  A9 20                    LDA     #' '
 6596  FD13DF  85 4C                    sta     ewtmp
 6597  FD13E1  80 13            ?04:    bra     ?07a
 6598  FD13E3  C4 1F            ?05:    CPY     ecol
 6599  FD13E5  D0 04                    BNE     ?06
 6600  FD13E7  85 4C                    sta     ewtmp
 6601  FD13E9  E6 4E                    INC     ewtmp2
 6602  FD13EB  E4 50            ?06:    CPX     ebtmp
 6603  FD13ED  D0 03                    BNE     ?07
 6604  FD13EF  20 3D 14                 JSR     setscrp
 6605  FD13F2  E8               ?07:    INX
 6606  FD13F3  C8                       INY
 6607  FD13F4  80 DC                    bra     scll2
 6608  FD13F6  E4 50            ?07a:   CPX     ebtmp
 6609  FD13F8  D0 03                    BNE     ?08
 6610  FD13FA  20 3D 14                 JSR     setscrp
 6611  FD13FD  E8               ?08:    INX
 6612  FD13FE  A9 01                    lda     #^TXTADDR               ; move right text and attributes
 6613  FD1400  8B                       phb
 6614  FD1401  48                       pha
 6615  FD1402  AB                       plb
 6616  FD1403  A0 50                    ldy     #MAXCOLS
 6617  FD1405  88               ?09:    dey
 6618  FD1406  88                       dey
 6619  FD1407  30 0D                    bmi     ?10
 6620  FD1409  B1 34                    lda     (stxtp),y
 6621  FD140B  EB                       xba
 6622  FD140C  B1 38                    lda     (sattp),y               ; A = attribute, B = text 
 6623  FD140E  C8                       iny
 6624  FD140F  91 38                    sta     (sattp),y
 6625  FD1411  EB                       xba
 6626  FD1412  91 34                    sta     (stxtp),y
 6627  FD1414  80 EF                    bra     ?09
 6628  FD1416  C8               ?10:    iny
 6629  FD1417  A5 4C                    lda     ewtmp
 6630  FD1419  91 34                    sta     (stxtp),y
 6631  FD141B  A5 3B                    lda     eattr                   ; editor attribute      
 6632  FD141D  20 E3 14                 JSR     tglrev                  ; check reverse bit
 6633  FD1420  91 38                    sta     (sattp),y
 6634  FD1422  AB                       plb
 6635  FD1423                           ACC16CLC
 6636  FD1423  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 6637                                   .LONGA  on
 6638                                   .MNLIST
 6639  FD1425  A5 34                    LDA     stxtp
 6640  FD1427  69 50 00                 ADC     #MAXCOLS
 6641  FD142A  85 34                    STA     stxtp
 6642  FD142C  09 00 08                 ora     #!TXTATTR
 6643  FD142F  85 38                    sta     sattp
 6644  FD1431                           ACC08
 6645  FD1431  E2 20                    sep     #PMFLAG
 6646                                   .LONGA  off
 6647                                   .MNLIST
  Tue Jul 17 11:00:22 2018                                                                                               Page   72




 6648  FD1433  E6 4D                    INC     ewtmp+1
 6649  FD1435  A5 4D                    LDA     ewtmp+1
 6650  FD1437  C9 18                    CMP     #$18
 6651  FD1439  D0 8E                    bne     scll1
 6652  FD143B  AB                       plb
 6653  FD143C  60                       RTS
 6654                           
 6655                           ; set scroll routine pointers
 6656                           ; this routine change DBR
 6657                           ; P25AF:
 6658  FD143D                   setscrp:
 6659  FD143D  5A                       phy
 6660  FD143E                           ACC16
 6661  FD143E  C2 20                    rep     #PMFLAG
 6662                                   .LONGA  on
 6663                                   .MNLIST
 6664  FD1440  A7 5C                    lda     [lptc]
 6665  FD1442  85 5D                    STA     lptc+1                  ; B = bank, A = page
 6666  FD1444                           ACC08
 6667  FD1444  E2 20                    sep     #PMFLAG
 6668                                   .LONGA  off
 6669                                   .MNLIST
 6670  FD1446  4B                       phk
 6671  FD1447  AB                       plb                             ; DBR = PBR
 6672  FD1448  8D 24 13                 STA     !sclr1+2
 6673  FD144B  8D 2D 13                 STA     !sclr2+2
 6674  FD144E  8D CB 13                 STA     !scll1+2
 6675  FD1451  8D D4 13                 STA     !scll2+2
 6676  FD1454  EB                       xba                             ; A = buffer bank
 6677  FD1455  48                       pha
 6678  FD1456  AB                       plb                             ; DBR = buffer bank
 6679  FD1457  A0 04                    LDY     #BNDX
 6680  FD1459  B1 5C                    lda     (lptc),y
 6681  FD145B  85 50                    STA     ebtmp
 6682  FD145D  BB                       tyx
 6683  FD145E  7A                       ply
 6684  FD145F  60                       rts
 6685                           
 6686                           ; set update routine pointers
 6687                           ; this routine change DBR
 6688                           ; in:   A = bank, X = page, Y = index
 6689                           ; out: X = index
 6690                           ; P2751:
 6691  FD1460                   setptr:
 6692  FD1460  4B                       phk
 6693  FD1461  AB                       plb                             ; DBR = PBR
 6694  FD1462  64 5C                    STZ     lptc
 6695  FD1464  85 5E                    STA     lptc+2
 6696  FD1466  9C 6A 12                 STZ     !updrow+1
 6697  FD1469  9C 85 12                 STZ     !updr1+1
 6698  FD146C  9C 9B 12                 STZ     !updr2+1
 6699  FD146F  9C AE 12                 STZ     !updr3+1
 6700  FD1472  86 5D                    STX     lptc+1
 6701  FD1474  8E 6B 12                 STX     updrow+2
 6702  FD1477  8E 86 12                 STX     updr1+2
 6703  FD147A  8E 9C 12                 STX     updr2+2
 6704  FD147D  8E AF 12                 STX     updr3+2
  Tue Jul 17 11:00:22 2018                                                                                               Page   73




 6705  FD1480  BB                       TYX
 6706  FD1481  48                       pha
 6707  FD1482  AB                       plb                             ; DBR = buffer bank
 6708  FD1483  85 40                    sta     sbank                   ; save bank
 6709  FD1485  A0 04                    LDY     #BNDX
 6710  FD1487  B1 5C                    lda     (lptc),y
 6711  FD1489  85 51                    STA     ebtmp2
 6712  FD148B  60                       RTS
 6713                           
 6714                           ; update routine pointers to start of a block
 6715                           ; this routine change DBR
 6716                           ; out: X = index
 6717                           ; P282A:
 6718  FD148C                   updptr:
 6719  FD148C  5A                       phy
 6720  FD148D                           ACC16
 6721  FD148D  C2 20                    rep     #PMFLAG
 6722                                   .LONGA  on
 6723                                   .MNLIST
 6724  FD148F  A7 5C                    lda     [lptc]
 6725  FD1491  85 5D                    STA     lptc+1                  ; B = bank, A = page
 6726  FD1493                           ACC08
 6727  FD1493  E2 20                    sep     #PMFLAG
 6728                                   .LONGA  off
 6729                                   .MNLIST
 6730  FD1495  4B                       phk
 6731  FD1496  AB                       plb                             ; DBR = PBR
 6732  FD1497  8D 6B 12                 STA     !updrow+2
 6733  FD149A  8D 86 12                 STA     !updr1+2
 6734  FD149D  8D 9C 12                 STA     !updr2+2
 6735  FD14A0  8D AF 12                 STA     !updr3+2
 6736  FD14A3  EB                       xba                             ; A = buffer bank
 6737  FD14A4  48                       pha
 6738  FD14A5  AB                       plb                             ; DBR = buffer bank
 6739  FD14A6  85 40                    sta     sbank                   ; save bank
 6740  FD14A8  A0 04                    LDY     #BNDX
 6741  FD14AA  B1 5C                    lda     (lptc),y
 6742  FD14AC  85 51                    STA     ebtmp2
 6743  FD14AE  BB                       tyx
 6744  FD14AF  7A                       ply
 6745  FD14B0  60                       rts     
 6746                           
 6747                           ; check selected text range in screen row's
 6748                           ; rsctl is starting selection screen row
 6749                           ; rscth is ending selection screen row
 6750                           ; P2693:
 6751  FD14B1                   chksel:
 6752  FD14B1  A5 23                    LDA     fslct
 6753  FD14B3  F0 2D                    BEQ     ?03
 6754  FD14B5  A5 25                    LDA     nslcth                  ; if negative range
 6755  FD14B7  30 14                    BMI     ?02
 6756  FD14B9  A5 20                    LDA     srow
 6757  FD14BB  85 2B                    STA     rslcth
 6758  FD14BD  38                       SEC
 6759  FD14BE  E5 24                    SBC     nslctl
 6760  FD14C0  85 2A                    STA     rslctl
 6761  FD14C2  A9 00                    LDA     #$00
  Tue Jul 17 11:00:22 2018                                                                                               Page   74




 6762  FD14C4  E5 25                    SBC     nslcth
 6763  FD14C6  10 04                    BPL     ?01
 6764  FD14C8  A9 00                    LDA     #$00
 6765  FD14CA  85 2A                    STA     rslctl
 6766  FD14CC  60               ?01:    rts
 6767  FD14CD  A5 20            ?02:    LDA     srow
 6768  FD14CF  1A                       inc     a
 6769  FD14D0  85 2A                    sta     rslctl
 6770  FD14D2  38                       SEC
 6771  FD14D3  E5 24                    SBC     nslctl
 6772  FD14D5  1A                       inc     a
 6773  FD14D6  85 2B                    sta     rslcth
 6774  FD14D8  A9 FF                    LDA     #$FF
 6775  FD14DA  E5 25                    SBC     nslcth
 6776  FD14DC  30 04                    BMI     ?03
 6777  FD14DE  A9 19                    LDA     #$19
 6778  FD14E0  85 2B                    STA     rslcth
 6779  FD14E2  60               ?03:    RTS 
 6780                           
 6781                           ; invert reverse bit attribute
 6782                           ; in:   A = attribute
 6783                           ; P26D9:
 6784  FD14E3                   tglrev:
 6785  FD14E3  48                       PHA
 6786  FD14E4  A5 23                    LDA     fslct
 6787  FD14E6  F0 0E                    BEQ     ?01
 6788  FD14E8  A5 4D                    LDA     ewtmp+1                 ; current showed screen row
 6789  FD14EA  C5 2A                    CMP     rslctl
 6790  FD14EC  90 08                    BCC     ?01
 6791  FD14EE  C5 2B                    CMP     rslcth
 6792  FD14F0  B0 04                    BCS     ?01
 6793  FD14F2  68                       PLA
 6794  FD14F3  49 80                    EOR     #$80
 6795  FD14F5  60                       rts
 6796  FD14F6  68               ?01:    PLA
 6797  FD14F7  60                       RTS 
 6798                           
 6799                           ;-----------------------------------------------------------------
 6800                           ; low level screen
 6801                           
 6802                           ; clear last text line
 6803                           ; P154B:
 6804  FD14F8                   clrlst:
 6805  FD14F8  A2 30                    ldx     #<LSTLINE
 6806  FD14FA  A9 07                    lda     #>LSTLINE
 6807  FD14FC  A0 01                    ldy     #^LSTLINE
 6808  FD14FE  86 5C                    stx     lptc
 6809  FD1500  86 62                    stx     lptc1
 6810  FD1502  85 5D                    sta     lptc+1
 6811  FD1504  09 08                    ora     #>TXTATTR
 6812  FD1506  85 63                    sta     lptc1+1 
 6813  FD1508  84 5E                    sty     lptc+2
 6814  FD150A  84 64                    sty     lptc1+2
 6815  FD150C  A9 20                    lda     #' '
 6816  FD150E  EB                       xba
 6817  FD150F  A5 3B                    lda     eattr                   ; A = attribute, B = blank
 6818  FD1511  A0 4F                    ldy     #MAXCOLS-1
  Tue Jul 17 11:00:22 2018                                                                                               Page   75




 6819  FD1513  97 62            ?02:    sta     [lptc1],y               ; store attribute
 6820  FD1515  EB                       xba
 6821  FD1516  97 5C                    sta     [lptc],y                ; store blank
 6822  FD1518  EB                       xba
 6823  FD1519  88                       dey
 6824  FD151A  10 F7                    bpl     ?02
 6825  FD151C  60                       rts
 6826                           
 6827                           ; set default status line attributes
 6828                           ; P14C9:
 6829  FD151D                   setstla:
 6830  FD151D  A2 80                    ldx     #<STLATTR
 6831  FD151F  A0 0F                    ldy     #>STLATTR
 6832  FD1521  A9 01                    lda     #^STLATTR
 6833  FD1523  86 5C                    stx     lptc
 6834  FD1525  84 5D                    sty     lptc+1
 6835  FD1527  85 5E                    sta     lptc+2
 6836  FD1529  A5 3C                    lda     slattr                  ; status line attribute
 6837  FD152B  A0 4F                    ldy     #MAXCOLS-1
 6838  FD152D  97 5C            ?02:    sta     [lptc],y
 6839  FD152F  88                       dey
 6840  FD1530  10 FB                    bpl     ?02
 6841  FD1532  60                       rts
 6842                           
 6843                           ; set default editor attributes
 6844                           ; P14D5:
 6845  FD1533                   setattr:
 6846  FD1533  8B                       phb
 6847  FD1534                           INDEX16
 6848  FD1534  C2 10                    rep     #PXFLAG
 6849                                   .LONGI  on
 6850                                   .MNLIST
 6851  FD1536  A2 00 08                 ldx     #!TXTATTR
 6852  FD1539  A9 01                    lda     #^TXTATTR
 6853  FD153B  86 5C                    stx     lptc
 6854  FD153D  48                       pha
 6855  FD153E  AB                       plb
 6856  FD153F  A5 3B                    lda     eattr                   ; editor attribute
 6857  FD1541  A0 7F 07                 ldy     #TXTCNT-1
 6858  FD1544  91 5C            ?02:    sta     (lptc),y
 6859  FD1546  88                       dey
 6860  FD1547  10 FB                    bpl     ?02
 6861  FD1549                           INDEX08
 6862  FD1549  E2 10                    sep     #PXFLAG
 6863                                   .LONGI  off
 6864                                   .MNLIST
 6865  FD154B  AB                       plb
 6866  FD154C  60                       rts
 6867                           
 6868                           ; increment screen row
 6869                           ; P1529:
 6870  FD154D                   incrow:
 6871  FD154D                           ACC16CLC
 6872  FD154D  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 6873                                   .LONGA  on
 6874                                   .MNLIST
 6875  FD154F  A5 2C                    lda     curs
  Tue Jul 17 11:00:22 2018                                                                                               Page   76




 6876  FD1551  69 50 00                 adc     #MAXCOLS
 6877  FD1554  85 2C                    sta     curs
 6878  FD1556                           ACC08
 6879  FD1556  E2 20                    sep     #PMFLAG
 6880                                   .LONGA  off
 6881                                   .MNLIST
 6882  FD1558  E6 20                    inc     srow
 6883  FD155A  60                       rts
 6884                           
 6885                           ; decrement screen row
 6886                           ; P153A:
 6887  FD155B                   decrow:
 6888  FD155B                           ACC16CLC
 6889  FD155B  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 6890                                   .LONGA  on
 6891                                   .MNLIST
 6892  FD155D  A5 2C                    lda     curs
 6893  FD155F  E9 4F 00                 sbc     #MAXCOLS-1              ; take account carry !
 6894  FD1562  85 2C                    sta     curs
 6895  FD1564                           ACC08
 6896  FD1564  E2 20                    sep     #PMFLAG
 6897                                   .LONGA  off
 6898                                   .MNLIST
 6899  FD1566  C6 20                    dec     srow
 6900  FD1568  60                       rts
 6901                           
 6902                           ; reverse screen row (invert "reverse" bit)
 6903                           ; P1DD3:
 6904  FD1569                   revrow:
 6905  FD1569                           ACC16
 6906  FD1569  C2 20                    rep     #PMFLAG
 6907                                   .LONGA  on
 6908                                   .MNLIST
 6909  FD156B  A5 34                    lda     stxtp
 6910  FD156D  09 00 08                 ora     #!TXTATTR
 6911  FD1570  85 38                    sta     sattp
 6912  FD1572                           ACC08
 6913  FD1572  E2 20                    sep     #PMFLAG
 6914                                   .LONGA  off
 6915                                   .MNLIST
 6916  FD1574  A0 4F                    ldy     #MAXCOLS-1
 6917  FD1576  B7 38            ?02:    lda     [sattp],y
 6918  FD1578  49 80                    eor     #$80
 6919  FD157A  97 38                    sta     [sattp],y
 6920  FD157C  88                       dey
 6921  FD157D  10 F7                    bpl     ?02
 6922  FD157F  60                       rts
 6923                           
 6924                           ; scroll down editor window (move window up one row)
 6925                           ; P28BD:
 6926  FD1580                   scrldown:
 6927  FD1580  8B                       phb
 6928  FD1581                           CPU16CLC
 6929  FD1581  C2 31                    rep     #(PMFLAG.OR.PXFLAG.OR.PCFLAG)
 6930                                   .LONGA  on
 6931                                   .LONGI  on
 6932                                   .MNLIST
  Tue Jul 17 11:00:22 2018                                                                                               Page   77




 6933  FD1583  A9 00 00                 lda     #!TXTADDR
 6934  FD1586  AA                       tax
 6935  FD1587  85 5C                    sta     lptc
 6936  FD1589  69 50 00                 adc     #MAXCOLS
 6937  FD158C  85 5F                    sta     lpte
 6938  FD158E  8A                       txa
 6939  FD158F  09 00 08                 ora     #!TXTATTR
 6940  FD1592  85 62                    sta     lptc1
 6941  FD1594  69 50 00                 adc     #MAXCOLS
 6942  FD1597  85 65                    sta     lpte1   
 6943  FD1599                           CPU08
 6944  FD1599  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 6945                                   .LONGA  off
 6946                                   .LONGI  off
 6947                                   .MNLIST
 6948  FD159B  A9 01                    lda     #^TXTADDR
 6949  FD159D  48                       pha
 6950  FD159E  AB                       plb
 6951  FD159F  A2 17                    ldx     #$17                    ; move 23 rows
 6952  FD15A1  A0 4F            ?02:    ldy     #MAXCOLS-1
 6953  FD15A3  B1 5F            ?04:    lda     (lpte),y
 6954  FD15A5  91 5C                    sta     (lptc),y
 6955  FD15A7  B1 65                    lda     (lpte1),y
 6956  FD15A9  91 62                    sta     (lptc1),y
 6957  FD15AB  88                       dey
 6958  FD15AC  10 F5                    bpl     ?04
 6959  FD15AE                           ACC16CLC
 6960  FD15AE  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 6961                                   .LONGA  on
 6962                                   .MNLIST
 6963  FD15B0  A5 5F                    lda     lpte
 6964  FD15B2  85 5C                    sta     lptc
 6965  FD15B4  69 50 00                 adc     #MAXCOLS
 6966  FD15B7  85 5F                    sta     lpte
 6967  FD15B9  A5 65                    lda     lpte1
 6968  FD15BB  85 62                    sta     lptc1
 6969  FD15BD  69 50 00                 adc     #MAXCOLS
 6970  FD15C0  85 65                    sta     lpte1
 6971  FD15C2                           ACC08   
 6972  FD15C2  E2 20                    sep     #PMFLAG
 6973                                   .LONGA  off
 6974                                   .MNLIST
 6975  FD15C4  CA                       dex
 6976  FD15C5  D0 DA                    bne     ?02
 6977  FD15C7  AB                       plb
 6978  FD15C8  60                       rts
 6979                           
 6980                           ; scroll up editor window (move window down one row)
 6981                           ; P28F9:
 6982  FD15C9                   scrlup:
 6983  FD15C9  8B                       phb
 6984  FD15CA                           CPU16CLC
 6985  FD15CA  C2 31                    rep     #(PMFLAG.OR.PXFLAG.OR.PCFLAG)
 6986                                   .LONGA  on
 6987                                   .LONGI  on
 6988                                   .MNLIST
 6989  FD15CC  A9 30 07                 lda     #!LSTLINE
  Tue Jul 17 11:00:22 2018                                                                                               Page   78




 6990  FD15CF  85 5C                    sta     lptc
 6991  FD15D1  AA                       tax
 6992  FD15D2  E9 4F 00                 sbc     #MAXCOLS-1              ; take account of CF = 0 !
 6993  FD15D5  85 5F                    sta     lpte
 6994  FD15D7  8A                       txa
 6995  FD15D8  09 00 08                 ora     #!TXTATTR
 6996  FD15DB  85 62                    sta     lptc1
 6997  FD15DD  E9 50 00                 sbc     #MAXCOLS                ; now CF = 1 !
 6998  FD15E0  85 65                    sta     lpte1
 6999  FD15E2                           CPU08
 7000  FD15E2  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 7001                                   .LONGA  off
 7002                                   .LONGI  off
 7003                                   .MNLIST
 7004  FD15E4  A9 01                    lda     #^LSTLINE
 7005  FD15E6  48                       pha
 7006  FD15E7  AB                       plb
 7007  FD15E8  A2 17                    ldx     #$17                    ; move 23 rows
 7008  FD15EA  A0 4F            ?02:    ldy     #MAXCOLS-1
 7009  FD15EC  B1 5F            ?04:    lda     (lpte),y
 7010  FD15EE  91 5C                    sta     (lptc),y
 7011  FD15F0  B1 65                    lda     (lpte1),y
 7012  FD15F2  91 62                    sta     (lptc1),y       
 7013  FD15F4  88                       dey
 7014  FD15F5  10 F5                    bpl     ?04
 7015  FD15F7                           ACC16CLC
 7016  FD15F7  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 7017                                   .LONGA  on
 7018                                   .MNLIST
 7019  FD15F9  A5 5F                    lda     lpte
 7020  FD15FB  85 5C                    sta     lptc
 7021  FD15FD  E9 4F 00                 sbc     #MAXCOLS-1              ; take account carry !
 7022  FD1600  85 5F                    sta     lpte
 7023  FD1602  A5 65                    lda     lpte1
 7024  FD1604  85 62                    sta     lptc1
 7025  FD1606  E9 50 00                 sbc     #MAXCOLS                ; now CF = 1 !
 7026  FD1609  85 65                    sta     lpte1
 7027  FD160B                           ACC08   
 7028  FD160B  E2 20                    sep     #PMFLAG
 7029                                   .LONGA  off
 7030                                   .MNLIST
 7031  FD160D  CA                       dex
 7032  FD160E  D0 DA                    bne     ?02
 7033  FD1610  AB                       plb
 7034  FD1611  60                       rts
 7035                           
 7036                           ; wait for <enter> key pressed
 7037                           ; in:   Y - column in last screen row
 7038                           ; X preserved
 7039  FD1612                   waitent:
 7040  FD1612  DA                       phx
 7041  FD1613  A2 00                    ldx     #0
 7042  FD1615  BF 5D 20 FD      ?02:    lda     >strent,x
 7043  FD1619  F0 0A                    beq     ?04
 7044  FD161B  C0 50                    cpy     #MAXCOLS                ; not above limit
 7045  FD161D  B0 06                    bcs     ?04
 7046  FD161F  97 34                    sta     [stxtp],y
  Tue Jul 17 11:00:22 2018                                                                                               Page   79




 7047  FD1621  E8                       inx
 7048  FD1622  C8                       iny
 7049  FD1623  D0 F0                    bne     ?02
 7050  FD1625  FA               ?04:    plx
 7051                           
 7052  FD1626                   waitent2:
 7053  FD1626  20 90 16                 jsr     slgkey                  ; wait key pressed
 7054  FD1629  B0 FB                    bcs     waitent2                ; control key
 7055  FD162B  EB                       xba                             ; ALT,CTL,SHIFT
 7056  FD162C  D0 F8                    bne     waitent2                ; will be no pressed
 7057  FD162E  EB                       xba
 7058  FD162F  C9 0D                    cmp     #$0D
 7059  FD1631  D0 F3                    bne     waitent2
 7060  FD1633  60                       rts
 7061                           
 7062                           ; put string in status line row (last screen row)
 7063                           ; in:   A - attribute
 7064                           ;       X - string number # (if $FF is cbm disk error)
 7065                           ; out:  Y - next available column in last row
 7066  FD1634                   msgstr:
 7067  FD1634  EB                       xba                             ; B = attribute
 7068  FD1635  E0 FF                    cpx     #$FF
 7069  FD1637  D0 08                    bne     ?01
 7070  FD1639  A2 50                    ldx     #<EDDSKERR
 7071  FD163B  A0 CC                    ldy     #>EDDSKERR
 7072  FD163D  A9 01                    lda     #^EDDSKERR
 7073  FD163F  80 13                    bra     outstr
 7074  FD1641  E0 09            ?01:    cpx     #MAXSTR
 7075  FD1643  90 02                    bcc     ?02
 7076  FD1645  A2 00                    ldx     #0                      ; blank string
 7077  FD1647  BF 4B 20 FD      ?02:    lda     STRTBLL,x               ; take string address
 7078  FD164B  48                       pha
 7079  FD164C  BF 54 20 FD              lda     STRTBLH,x
 7080  FD1650  A8                       tay                             ; Y = high address
 7081  FD1651  FA                       plx                             ; X = low  address
 7082  FD1652  A9 FD                    lda     #^str01                 ; A = bank address
 7083  FD1654                           
 7084                           ; out string in status line (last screen row)
 7085                           ; in:   X,Y,A - address of string
 7086                           ;       B - attribute
 7087                           ; out:  Y - next available column in last row
 7088                           ; P284A:
 7089  FD1654                   outstr:
 7090  FD1654  86 5C                    stx     lptc                    ; store string address
 7091  FD1656  84 5D                    sty     lptc+1
 7092  FD1658  85 5E                    sta     lptc+2
 7093  FD165A  EB                       xba                             ; attribute
 7094  FD165B  AA                       tax                             ; X = attribute
 7095  FD165C                           ACC16
 7096  FD165C  C2 20                    rep     #PMFLAG
 7097                                   .LONGA  on
 7098                                   .MNLIST
 7099  FD165E  A9 80 07                 lda     #!STLINE                ; store address of last screen row
 7100  FD1661  85 34                    sta     stxtp
 7101  FD1663  A9 80 0F                 lda     #!STLATTR
 7102  FD1666  85 38                    sta     sattp
 7103  FD1668                           ACC08
  Tue Jul 17 11:00:22 2018                                                                                               Page   80




 7104  FD1668  E2 20                    sep     #PMFLAG
 7105                                   .LONGA  off
 7106                                   .MNLIST
 7107  FD166A  A0 00                    ldy     #0                      ; out string
 7108  FD166C  B7 5C            ?02:    lda     [lptc],y
 7109  FD166E  F0 0C                    beq     ?04
 7110  FD1670  C0 50                    cpy     #MAXCOLS                ; not above limit
 7111  FD1672  B0 1B                    bcs     ?10
 7112  FD1674  97 34                    sta     [stxtp],y
 7113  FD1676  8A                       txa
 7114  FD1677  97 38                    sta     [sattp],y       
 7115  FD1679  C8                       iny
 7116  FD167A  D0 F0                    bne     ?02
 7117  FD167C  5A               ?04:    phy
 7118  FD167D  A9 20                    lda     #' '                    ; pad row with blanks
 7119  FD167F  EB                       xba
 7120  FD1680  8A                       txa                             ; A = attribute, B = blank
 7121  FD1681  C0 50            ?06:    cpy     #MAXCOLS
 7122  FD1683  B0 09                    bcs     ?08
 7123  FD1685  97 38                    sta     [sattp],y
 7124  FD1687  EB                       xba
 7125  FD1688  97 34                    sta     [stxtp],y
 7126  FD168A  EB                       xba
 7127  FD168B  C8                       iny
 7128  FD168C  D0 F3                    bne     ?06
 7129  FD168E  7A               ?08:    ply
 7130  FD168F  60               ?10:    rts
 7131                           
 7132                           ; get key for command line/status line
 7133                           ; in:   X - number of keys stored
 7134                           ;       Y - column
 7135                           ; out:  A = key code
 7136                           ;       B = flag ALT, CTL, SHIFT
 7137                           ;       CF = 1 if control key
 7138                           ; X,Y preserved
 7139                           ; P1BBE:
 7140  FD1690                   slgkey:
 7141  FD1690  20 D1 16                 jsr     slcurs                  ; set cursor position
 7142  FD1693  20 C6 16                 jsr     showcurs                ; show cursor
 7143  FD1696                   ?02:    KBGETIN                         ; system call - get key
 7144  FD1696  02 17                    cop     $17
 7145                                   .MNLIST
 7146  FD1698  C9 00                    cmp     #0
 7147  FD169A  F0 FA                    beq     ?02                     ; loop -- wait pressed key
 7148  FD169C  C9 20                    cmp     #' '
 7149  FD169E  D0 05                    bne     ?04                     ; no blank key
 7150  FD16A0  8A                       txa
 7151  FD16A1  F0 F3                    beq     ?02                     ; skip beginning blanks
 7152  FD16A3  A9 20                    lda     #' '
 7153  FD16A5  85 6A            ?04:    sta     tmpe                    ; store key code
 7154  FD16A7  EB                       xba
 7155  FD16A8  85 6B                    sta     tmpf                    ; store control key flag
 7156  FD16AA  20 BB 16                 jsr     hidecurs
 7157  FD16AD  AF 64 01 00              lda     >DP01ADDR+KbdFlag       
 7158  FD16B1  EB                       xba                             ; B = flag ALT, CTL, SHIFT
 7159  FD16B2  18                       clc
 7160  FD16B3  A5 6A                    lda     tmpe                    ; key code
  Tue Jul 17 11:00:22 2018                                                                                               Page   81




 7161  FD16B5  24 6B                    bit     tmpf
 7162  FD16B7  10 01                    bpl     ?06
 7163  FD16B9  38                       sec                             ; control key
 7164  FD16BA  60               ?06:    rts
 7165                           
 7166                           ; hide cursor
 7167  FD16BB                   hidecurs:
 7168  FD16BB  A9 10                    lda     #$10                    ; bit PB4 = 1
 7169  FD16BD  0F 76 FC 00              ora     >PIAVBB+PIAPRB
 7170  FD16C1  8F 76 FC 00              sta     >PIAVBB+PIAPRB
 7171  FD16C5  60                       rts
 7172                           
 7173                           ; show cursor
 7174  FD16C6                   showcurs:
 7175  FD16C6  AF 76 FC 00              lda     >PIAVBB+PIAPRB
 7176  FD16CA  29 EF                    and     #$EF                    ; bit PB4 = 0
 7177  FD16CC  8F 76 FC 00              sta     >PIAVBB+PIAPRB
 7178  FD16D0  60                       rts
 7179                           
 7180                           ; set position of cursor in status line row
 7181                           ; in:   Y = column
 7182                           ; X,Y preserved
 7183  FD16D1                   slcurs:
 7184  FD16D1  18                       clc
 7185  FD16D2  A9 0E                    lda     #$0E
 7186  FD16D4  8F 70 FC 00              sta     >CRTAddr
 7187  FD16D8  98                       tya
 7188  FD16D9  65 34                    adc     stxtp
 7189  FD16DB  EB                       xba
 7190  FD16DC  A5 35                    lda     stxtp+1
 7191  FD16DE  80 0D                    bra     pcurs
 7192                           
 7193                           ; set position of cursor in edit window
 7194                           ; in:   Y = column
 7195                           ; X,Y preserved
 7196  FD16E0                   edcurs:
 7197  FD16E0  18                       clc
 7198  FD16E1  A9 0E                    lda     #$0E
 7199  FD16E3  8F 70 FC 00              sta     >CRTAddr
 7200  FD16E7  98                       tya
 7201  FD16E8  65 2C                    adc     curs
 7202  FD16EA  EB                       xba
 7203  FD16EB  A5 2D                    lda     curs+1
 7204  FD16ED                           
 7205  FD16ED                   pcurs:
 7206  FD16ED  69 00                    adc     #0
 7207  FD16EF  8F 71 FC 00              sta     >CRTData
 7208  FD16F3  A9 0F                    lda     #$0F
 7209  FD16F5  8F 70 FC 00              sta     >CRTAddr
 7210  FD16F9  EB                       xba
 7211  FD16FA  8F 71 FC 00              sta     >CRTData
 7212  FD16FE  60                       rts
 7213                           
 7214                           ; set default cursor mode basis cursmode value
 7215  FD16FF                   setcurs:
 7216  FD16FF  A9 0B                    lda     #$0B                    ; set 'end scan line' register
 7217  FD1701  8F 70 FC 00              sta     >CRTAddr
  Tue Jul 17 11:00:22 2018                                                                                               Page   82




 7218  FD1705  A9 0F                    lda     #$0F                    ; end at last line
 7219  FD1707  8F 71 FC 00              sta     >CRTData
 7220  FD170B  A9 0A                    lda     #$0A                    ; set 'start scan line' register
 7221  FD170D  8F 70 FC 00              sta     >CRTAddr
 7222  FD1711  A9 00                    lda     #$00                    ; block cursor: start scan line = 0
 7223  FD1713  24 2E                    bit     cursmode                ; check bit <6>
 7224  FD1715  50 02                    bvc     ?02                     ; block cursor
 7225  FD1717  A9 0F                    lda     #$0F                    ; under line cursor: start = end
 7226  FD1719  8F 71 FC 00      ?02:    sta     >CRTData
 7227  FD171D  AF 76 FC 00              lda     >PIAVBB+PIAPRB
 7228  FD1721  29 FB                    and     #$FB                    ; mask PB2
 7229  FD1723  24 2E                    bit     cursmode                ; check bit <7>
 7230  FD1725  10 02                    bpl     ?04                     ; fixed cursor => PB2 = 0
 7231  FD1727  09 04                    ora     #$04                    ; blink cursor => PB2 = 1
 7232  FD1729  8F 76 FC 00      ?04:    sta     >PIAVBB+PIAPRB
 7233  FD172D  60                       rts
 7234                           
 7235                           ;---------------------------------------------------------------------
 7236                           ; COMMAND LINE
 7237  FD172E                           
 7238                           ; input comand string in EDBUFLIN
 7239                           ; in:   X,Y,A - address of prompt string
 7240                           ; P1AF9:
 7241  FD172E                   inputstr:
 7242  FD172E  86 DA                    stx     longp
 7243  FD1730  84 DB                    sty     longp+1
 7244  FD1732  85 DC                    sta     longp+2
 7245  FD1734  A9 C0                    lda     #$C0
 7246  FD1736  85 3F                    sta     slfg            ; status line input mode
 7247  FD1738  A9 00            ?lp:    lda     #0              ; input loop
 7248  FD173A  8F 50 CC 01              sta     >EDBUFLIN
 7249  FD173E  A5 3E                    lda     scatt
 7250  FD1740  EB                       xba                     ; attribute
 7251  FD1741  A6 DA                    ldx     longp
 7252  FD1743  A4 DB                    ldy     longp+1
 7253  FD1745  A5 DC                    lda     longp+2
 7254  FD1747  20 54 16                 jsr     outstr          ; print prompt
 7255  FD174A  A2 00                    ldx     #0              ; buffer index
 7256  FD174C  20 90 16         ?get:   jsr     slgkey          ; get key
 7257  FD174F  90 13                    bcc     ?key            ; no control key
 7258  FD1751  C9 8E                    cmp     #KB_DELETE      ; <DELETE> clear all input field
 7259  FD1753  F0 E3                    beq     ?lp             ; restart input
 7260  FD1755  C9 90                    cmp     #KB_BACKSPACE
 7261  FD1757  D0 F3                    bne     ?get            ; discard others control keys
 7262  FD1759  8A                       txa
 7263  FD175A  F0 F0                    beq     ?get            ; at first column do nothing
 7264  FD175C  CA                       dex                     ; decrement index and column
 7265  FD175D  88                       dey
 7266  FD175E  A9 20                    lda     #' '            ; put blank at column
 7267  FD1760  97 34                    sta     [stxtp],y
 7268  FD1762  80 E8                    bra     ?get            ; continue input
 7269  FD1764  EB               ?key:   xba                     ; check flag
 7270  FD1765  89 C0                    bit     #(AALTB.OR.ACTRLB)
 7271  FD1767  D0 E3                    bne     ?get            ; discard alt/ctl keys but shift
 7272  FD1769  EB                       xba
 7273  FD176A  C9 1B                    cmp     #KB_ESC         ; <ESC> exit from command line
 7274  FD176C  F0 30                    beq     ?ret            ; exit with CF=1
  Tue Jul 17 11:00:22 2018                                                                                               Page   83




 7275  FD176E  C9 0D                    cmp     #KB_CR          ; <ENTER> terminate input line
 7276  FD1770  F0 16                    beq     ?end
 7277  FD1772  C9 20                    cmp     #' '
 7278  FD1774  90 D6                    bcc     ?get            ; discard no-printables
 7279  FD1776  C9 7F                    cmp     #$7F
 7280  FD1778  B0 D2                    bcs     ?get
 7281  FD177A  C0 4F                    cpy     #MAXCOLS-1      ; no store above max. column
 7282  FD177C  B0 CE                    bcs     ?get
 7283  FD177E  97 34                    sta     [stxtp],y       ; print char at column
 7284  FD1780  9F 50 CC 01              sta     >EDBUFLIN,x     ; store char at index
 7285  FD1784  C8                       iny
 7286  FD1785  E8                       inx
 7287  FD1786  80 C4                    bra     ?get            ; continue input
 7288  FD1788  8A               ?end:   txa                     ; current index
 7289  FD1789  F0 AD                    beq     ?lp             ; empty string: restart
 7290  FD178B  CA               ?trm:   dex                     ; trim blanks
 7291  FD178C  30 AA                    bmi     ?lp             ; restart
 7292  FD178E  BF 50 CC 01              lda     >EDBUFLIN,x
 7293  FD1792  C9 20                    cmp     #' '
 7294  FD1794  F0 F5                    beq     ?trm
 7295  FD1796  E8                       inx
 7296  FD1797  A9 00                    lda     #0
 7297  FD1799  9F 50 CC 01              sta     >EDBUFLIN,x     ; terminate input
 7298  FD179D  18                       clc                     ; exit with CF=0
 7299  FD179E  60               ?ret:   rts
 7300                           
 7301  FD179F                   cmdline:
 7302  FD179F  A2 AD                    ldx     #<CMDSTR
 7303  FD17A1  A0 17                    ldy     #>CMDSTR
 7304  FD17A3  A9 FD                    lda     #^CMDSTR
 7305  FD17A5  20 2E 17                 jsr     inputstr
 7306  FD17A8  A9 80                    lda     #$80
 7307  FD17AA  14 3F                    trb     slfg
 7308  FD17AC  60                       rts
 7309                           
 7310  FD17AD                   CMDSTR:
 7311  FD17AD  43 4D 44 3A 20           .DB     'CMD: ',0
               00 
 7312                           
 7313                           ;---------------------------------------------------------------------
 7314                           
 7315                           ; entry point (DBR and DP set by caller)
 7316                           ;
 7317                           ; stack frame
 7318                           ;
 7319                           ;       ---------
 7320                           ;       |  ...  |       0F
 7321                           ;       ---------
 7322                           ;       |  DPH  |       06
 7323                           ;       ---------
 7324                           ;       |  DPL  |       05
 7325                           ;       ---------
 7326                           ;       |  DBR  |       04
 7327                           ;       ---------
 7328                           ;       |  PBR  |       03
 7329                           ;       ---------
 7330                           ;       |  PCH  |       02
  Tue Jul 17 11:00:22 2018                                                                                               Page   84




 7331                           ;       ---------       
 7332                           ;       |  PCL  |       01
 7333                           ;       ---------
 7334                           
 7335          000001           STKPCL          .SET    $01
 7336          000002           STKPCH          .SET    $02
 7337          000003           STKPBR          .SET    $03     ; caller return address
 7338          000004           STKDBR          .SET    $04     ; DBR for called procedure
 7339          000005           STKDP           .SET    $05     ; DP for called procedure
 7340                           
 7341                                   .PUBLIC qedtent
 7342                           
 7343                           
 7344  FD17B3                   qedtent:        
 7345  FD17B3  08                       php                     ; save M/X status
 7346  FD17B4                           CPU08
 7347  FD17B4  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 7348                                   .LONGA  off
 7349                                   .LONGI  off
 7350                                   .MNLIST
 7351  FD17B6  8B                       phb
 7352  FD17B7  0B                       phd                     ; frame stack +4
 7353  FD17B8  F4 00 40                 pea     #$4000
 7354  FD17BB  2B                       pld
 7355  FD17BC  48                       pha
 7356  FD17BD  DA                       phx
 7357  FD17BE  A2 00                    ldx     #$00
 7358  FD17C0  74 00            ?zp:    stz     <$0,x           ; clear DP memory
 7359  FD17C2  E8                       inx
 7360  FD17C3  D0 FB                    bne     ?zp
 7361  FD17C5                           INDEX16
 7362  FD17C5  C2 10                    rep     #PXFLAG
 7363                                   .LONGI  on
 7364                                   .MNLIST
 7365  FD17C7  A2 FF 37                 ldx     #(EDWRKEND-EDBUFNAM-1)
 7366  FD17CA  A9 00                    lda     #0
 7367  FD17CC  9F 00 C8 01      ?zz:    sta     >EDBUFNAM,x
 7368  FD17D0  CA                       dex
 7369  FD17D1  10 F9                    bpl     ?zz
 7370  FD17D3                           INDEX08
 7371  FD17D3  E2 10                    sep     #PXFLAG
 7372                                   .LONGI  off
 7373                                   .MNLIST
 7374  FD17D5  86 0F                    stx     xbuf            ; force buffer allocation at start
 7375  FD17D7  FA                       plx
 7376  FD17D8  68                       pla
 7377  FD17D9  85 DA                    sta     longp           ; A,X,Y : address of command line
 7378  FD17DB  86 DB                    stx     longp+1
 7379  FD17DD  84 DC                    sty     longp+2
 7380  FD17DF  EB                       xba
 7381  FD17E0  85 DD                    sta     fsmode          ; mode  
 7382  FD17E2                           ACC16
 7383  FD17E2  C2 20                    rep     #PMFLAG
 7384                                   .LONGA  on
 7385                                   .MNLIST
 7386  FD17E4  AF 8E 00 00              lda     >pbrklv
 7387  FD17E8  85 E0                    sta     brksav
  Tue Jul 17 11:00:22 2018                                                                                               Page   85




 7388  FD17EA                           ACC08   
 7389  FD17EA  E2 20                    sep     #PMFLAG
 7390                                   .LONGA  off
 7391                                   .MNLIST
 7392  FD17EC  20 63 1D                 jsr     crtsav
 7393  FD17EF  20 15 18                 jsr     init
 7394  FD17F2  20 60 1E                 jsr     chkcmd          ; check command line
 7395  FD17F5  20 00 00                 jsr     editor          ; launch editor
 7396  FD17F8  A5 41                    lda     saveps
 7397  FD17FA  8F 74 FC 00              sta     >PIAVBB+PIAPRA  ; restore palette address
 7398  FD17FE  20 90 1D                 jsr     crtrest
 7399  FD1801  A6 32                    ldx     embit
 7400  FD1803  9F 0C FC 00              sta     >CREMEOFF,x     ; restore video ram bit
 7401                           
 7402  FD1807                           ACC16
 7403  FD1807  C2 20                    rep     #PMFLAG
 7404                                   .LONGA  on
 7405                                   .MNLIST
 7406  FD1809  A5 E0                    lda     brksav
 7407  FD180B  8F 8E 00 00              sta     >pbrklv
 7408  FD180F                           ACC08
 7409  FD180F  E2 20                    sep     #PMFLAG
 7410                                   .LONGA  off
 7411                                   .MNLIST
 7412                           
 7413  FD1811  2B                       pld
 7414  FD1812  AB                       plb
 7415  FD1813  28                       plp
 7416  FD1814  6B                       rtl
 7417                           
 7418                           ; init editor
 7419                           ; P1631:
 7420  FD1815                   init:
 7421  FD1815  A9 40                    lda     #MINFREE
 7422  FD1817  20 37 0B                 jsr     chkfree
 7423  FD181A  A9 04                    lda     #DEFLTAB        ; default tab value
 7424  FD181C  85 19                    sta     deftab
 7425  FD181E  A9 C0                    lda     #EDEFCURS       ; default cursor mode edit window
 7426  FD1820  85 2E                    sta     cursmode
 7427  FD1822  A9 01                    lda     #^TXTADDR       ; bank of video ram
 7428  FD1824  85 36                    sta     stxtp+2
 7429  FD1826  85 3A                    sta     sattp+2
 7430  FD1828  A9 00                    lda     #DEFATTR        ; default editor window attribute
 7431  FD182A  85 3B                    sta     eattr
 7432  FD182C  A9 01                    lda     #DEFSATTR       ; default status line attribute
 7433  FD182E  85 3C                    sta     slattr
 7434  FD1830  A9 02                    lda     #DEFEATTR       ; default error message attribute
 7435  FD1832  85 3D                    sta     seatt
 7436  FD1834  A9 03                    lda     #DEFCATTR       ; default command line attribute
 7437  FD1836  85 3E                    sta     scatt
 7438  FD1838  A9 04                    lda     #DFGATTR        ; disabled flag indicator attribute
 7439  FD183A  85 49                    sta     fgatt
 7440  FD183C  A9 40                    lda     #$40
 7441  FD183E  85 3F                    sta     slfg            ; update whole status line
 7442  FD1840  A9 00                    lda     #0
 7443  FD1842  48                       pha
 7444  FD1843  AB                       plb                     ; DBR = 0
  Tue Jul 17 11:00:22 2018                                                                                               Page   86




 7445  FD1844  AE 0C FC                 ldx     CREMEOFF        ; save current video ram bit
 7446  FD1847  86 32                    stx     embit
 7447  FD1849  8D 0D FC                 sta     !CREMEON        ; enable video ram
 7448  FD184C  AD 74 FC                 lda     !PIAVBB+PIAPRA  ; save current palette address
 7449  FD184F  85 41                    sta     saveps
 7450  FD1851  09 0F                    ora     #$0F            ; set palette address = 11 11XXX XXXX
 7451  FD1853  8D 74 FC                 sta     !PIAVBB+PIAPRA
 7452  FD1856  A9 00                    lda     #0
 7453  FD1858  A8                       tay                     ; Y = 0
 7454  FD1859  EB                       xba                     ; B = 0
 7455  FD185A  A9 F0                    lda     #$F0            ; set base address palette
 7456  FD185C                           CPU16
 7457  FD185C  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 7458                                   .LONGA  on
 7459                                   .LONGI  on
 7460                                   .MNLIST
 7461  FD185E  0A                       asl     a
 7462  FD185F  0A                       asl     a               ; this make base address = $03C0
 7463  FD1860  AA                       tax
 7464  FD1861                           ACC08
 7465  FD1861  E2 20                    sep     #PMFLAG
 7466                                   .LONGA  off
 7467                                   .MNLIST
 7468  FD1863  A9 D0                    lda     #$D0            ; LIGHT YELLOW/BLACK -- editor
 7469  FD1865  9F 00 10 01              sta     >VBBPALRAM,x    ; palette=0
 7470  FD1869  E8                       inx
 7471  FD186A  A9 F2                    lda     #$F2            ; WHITE/DARK BLUE -- status line
 7472  FD186C  9F 00 10 01              sta     >VBBPALRAM,x    ; palette=1
 7473  FD1870  E8                       inx
 7474  FD1871  A9 92                    lda     #$92            ; LIGHT RED/DARK BLUE -- error line
 7475  FD1873  9F 00 10 01              sta     >VBBPALRAM,x    ; palette=2
 7476  FD1877  E8                       inx
 7477                                   ;lda    #$0E            ; BLACK/LIGHT GRAY -- command line
 7478  FD1878  A9 2F                    lda     #$2F            ; DARK BLUE/WHITE -- command line
 7479  FD187A  9F 00 10 01              sta     >VBBPALRAM,x    ; palette=3
 7480  FD187E  E8                       inx
 7481  FD187F  A9 E2                    lda     #$E2            ; GRAY/DARK BLUE -- status line
 7482  FD1881  9F 00 10 01              sta     >VBBPALRAM,x    ; palette=4
 7483  FD1885                           CPU08
 7484  FD1885  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 7485                                   .LONGA  off
 7486                                   .LONGI  off
 7487                                   .MNLIST
 7488  FD1887  A9 00                    lda     #0              ; start with buffer #0
 7489  FD1889  20 F6 0B                 jsr     switchb
 7490  FD188C  A9 20                    lda     #$20            ; enable indent
 7491  FD188E  04 18                    tsb     bflag
 7492  FD1890  20 33 15                 jsr     setattr
 7493  FD1893  4C 32 04                 jmp     updwin
 7494                           
 7495                           ;---------------------------------------------------------------------
 7496                           
 7497                           ; convert byte A in decimal (3 digits stored in tstr2) 
 7498  FD1896                   byte2str:
 7499  FD1896  85 4A                    sta     wtmp
 7500  FD1898  64 4B                    stz     wtmp+1
 7501  FD189A  A9 80                    lda     #$80                    ; flag byte
  Tue Jul 17 11:00:22 2018                                                                                               Page   87




 7502  FD189C  85 50                    sta     ebtmp
 7503  FD189E  80 02                    bra     int2s
 7504                           
 7505                           ; convert integer in wtmp in decimal (5 digits stored in tstr2)         
 7506  FD18A0                   int2str:
 7507  FD18A0  64 50                    stz     ebtmp                   ; flag integer
 7508  FD18A2                   int2s:
 7509  FD18A2  64 51                    stz     ebtmp2                  ; string index
 7510  FD18A4  8B                       phb
 7511  FD18A5  4B                       phk                             ; set DBR = PBR
 7512  FD18A6  AB                       plb
 7513  FD18A7  A0 08                    ldy     #8                      ; power 10 table access index
 7514  FD18A9  A2 00            ?02:    ldx     #0                      ; partial quotient
 7515  FD18AB  38                       sec
 7516  FD18AC                           ACC16                           ; repeated subctract
 7517  FD18AC  C2 20                    rep     #PMFLAG
 7518                                   .LONGA  on
 7519                                   .MNLIST
 7520  FD18AE  A5 4A                    lda     wtmp
 7521  FD18B0  F9 41 20         ?04:    sbc     P10TBL,y
 7522  FD18B3  90 03                    bcc     ?06                     ; stop subctract
 7523  FD18B5  E8                       inx                             ; increment quotient
 7524  FD18B6  80 F8                    bra     ?04
 7525  FD18B8  79 41 20         ?06:    adc     P10TBL,y                ; store result
 7526  FD18BB  85 4A                    sta     wtmp
 7527  FD18BD                           ACC08SEC
 7528  FD18BD  E2 21                    sep     #(PMFLAG.OR.PCFLAG)
 7529                                   .LONGA  off
 7530                                   .MNLIST
 7531  FD18BF  8A                       txa                             ; 0..9
 7532  FD18C0  69 2F                    adc     #'0'-1                   ; decimal digit
 7533  FD18C2  A6 51                    ldx     ebtmp2                  ; string index
 7534  FD18C4  95 52                    sta     tstr2,x                 ; store digit
 7535  FD18C6  E8                       inx
 7536  FD18C7  86 51                    stx     ebtmp2                  ; update string index
 7537  FD18C9  88                       dey
 7538  FD18CA  88                       dey
 7539  FD18CB  10 DC                    bpl     ?02
 7540  FD18CD  AB                       plb
 7541  FD18CE  24 50                    bit     ebtmp
 7542  FD18D0  10 13                    bpl     ?10
 7543  FD18D2  A2 02                    ldx     #2                      ; adjust for byte
 7544  FD18D4  A0 00                    ldy     #0
 7545  FD18D6  B5 52            ?08:    lda     <tstr2,x
 7546  FD18D8  86 62                    stx     tmp6
 7547  FD18DA  BB                       tyx
 7548  FD18DB  95 52                    sta     <tstr2,x
 7549  FD18DD  A6 62                    ldx     tmp6
 7550  FD18DF  E8                       inx
 7551  FD18E0  C8                       iny
 7552  FD18E1  C0 03                    cpy     #3
 7553  FD18E3  90 F1                    bcc     ?08
 7554  FD18E5  60               ?10:    rts
 7555                           
 7556                           
 7557                           ;------------------------
 7558  FD18E6                   exit:
  Tue Jul 17 11:00:22 2018                                                                                               Page   88




 7559  FD18E6  A9 80                    lda     #$80
 7560  FD18E8  04 33                    tsb     edtfg
 7561  FD18EA  60                       rts
 7562                           
 7563                           ; ALT-O
 7564  FD18EB                   open:
 7565  FD18EB  A2 00                    ldx     #<?opn
 7566  FD18ED  A0 19                    ldy     #>?opn
 7567  FD18EF  A9 FD                    lda     #^?opn
 7568  FD18F1  20 2E 17                 jsr     inputstr
 7569  FD18F4  B0 09                    bcs     ?end
 7570  FD18F6  20 BB 16                 jsr     hidecurs
 7571  FD18F9  20 7D 1E                 jsr     cbmopn
 7572                                   ;lda    #$80            ; clear input mode flag
 7573                                   ;trb    slfg
 7574                                   ;lda    #$80
 7575                                   ;trb    bflag           ; not modified
 7576  FD18FC  20 4F 05                 jsr     updsl
 7577  FD18FF  60               ?end:   rts
 7578  FD1900  4F 70 65 6E 3A   ?opn:   .DB     'Open: ', 0
               20 00 
 7579                           
 7580                           ; ALT-S
 7581  FD1907                   save:
 7582  FD1907  20 26 1B                 jsr     chkbuf
 7583  FD190A  F0 10                    beq     ?end            ; clipboard or empty buffer
 7584  FD190C  A9 10                    lda     #$10            ; named buffer?
 7585  FD190E  24 18                    bit     bflag
 7586  FD1910  F0 0B                    beq     saveas          ; no, call saveas
 7587  FD1912  24 DD                    bit     fsmode
 7588  FD1914  10 03                    bpl     ?fat            ; save fat file
 7589  FD1916  4C 17 1A                 jmp     csave           ; save cbm file         
 7590  FD1919  4C 24 1B         ?fat:   jmp     fsave
 7591  FD191C  60               ?end:   rts
 7592                           
 7593  FD191D                   saveas:
 7594  FD191D  A2 2F                    ldx     #<?sav
 7595  FD191F  A0 19                    ldy     #>?sav
 7596  FD1921  A9 FD                    lda     #^?sav
 7597  FD1923  20 2E 17                 jsr     inputstr
 7598  FD1926  B0 06                    bcs     ?end
 7599  FD1928  24 DD                    bit     fsmode
 7600  FD192A  10 0A                    bpl     fsaveas
 7601  FD192C  30 0A                    bmi     csaveas
 7602  FD192E  60               ?end:   rts
 7603                           
 7604  FD192F  53 61 76 65 3A   ?sav:   .DB     'Save: ', 0
               20 00 
 7605                           
 7606  FD1936                   fsaveas:
 7607  FD1936  18                       clc
 7608  FD1937  60                       rts
 7609                           
 7610  FD1938                   csaveas:
 7611  FD1938  A9 01                    lda     #^EDBUFFILE     ; set pointer to filename
 7612  FD193A  85 DC                    sta     longp+2
 7613  FD193C  A9 00                    lda     #<EDBUFFILE
  Tue Jul 17 11:00:22 2018                                                                                               Page   89




 7614  FD193E  85 DA                    sta     longp
 7615  FD1940  A9 CC                    lda     #>EDBUFFILE
 7616  FD1942  85 DB                    sta     longp+1 
 7617  FD1944  A2 00                    ldx     #0
 7618  FD1946  A9 40                    lda     #'@'
 7619  FD1948  87 DA                    sta     [longp]         ; replace flag
 7620  FD194A  A0 01                    ldy     #1
 7621  FD194C  AF 51 CC 01              lda     >EDDSKERR+1     ; check drive
 7622  FD1950  C9 3A                    cmp     #':'
 7623  FD1952  D0 0C                    bne     ?dr             ; store deafult drive '0'
 7624  FD1954  AF 50 CC 01              lda     >EDDSKERR
 7625  FD1958  C9 30                    cmp     #'0'             ; continue if drive 0 or 1
 7626  FD195A  F0 0E                    beq     ?mv
 7627  FD195C  C9 31                    cmp     #'1'
 7628  FD195E  F0 0A                    beq     ?mv
 7629  FD1960  A9 30            ?dr:    lda     #'0'             ; put default drive '0'
 7630  FD1962  97 DA                    sta     [longp],y
 7631  FD1964  C8                       iny
 7632  FD1965  A9 3A                    lda     #':'
 7633  FD1967  97 DA                    sta     [longp],y
 7634  FD1969  C8                       iny
 7635  FD196A  BF 50 CC 01      ?mv:    lda     >EDDSKERR,x     ; set filename
 7636  FD196E  F0 12                    beq     ?nxt
 7637  FD1970  C9 61                    cmp     #'a'            ; upper case
 7638  FD1972  90 06                    bcc     ?st
 7639  FD1974  C9 7B                    cmp     #'z'+1
 7640  FD1976  B0 02                    bcs     ?st
 7641  FD1978  29 DF                    and     #$DF
 7642  FD197A  97 DA            ?st:    sta     [longp],y
 7643  FD197C  E8                       inx
 7644  FD197D  C8                       iny
 7645  FD197E  C0 48                    cpy     #MAXFNAME-8
 7646  FD1980  90 E8                    bcc     ?mv
 7647  FD1982  A2 03            ?nxt:   ldx     #3
 7648  FD1984  5A                       phy                     ; save index
 7649  FD1985  BF 13 1A FD      ?lp:    lda     >?rdw,x
 7650  FD1989  97 DA                    sta     [longp],y
 7651  FD198B  C8                       iny
 7652  FD198C  CA                       dex
 7653  FD198D  10 F6                    bpl     ?lp
 7654  FD198F  A9 00                    lda     #0
 7655  FD1991  97 DA                    sta     [longp],y
 7656  FD1993                           ACC16
 7657  FD1993  C2 20                    rep     #PMFLAG
 7658                                   .LONGA  on
 7659                                   .MNLIST
 7660  FD1995  E6 DA                    inc     longp           ; no overwrite for now
 7661  FD1997                           ACC08
 7662  FD1997  E2 20                    sep     #PMFLAG
 7663                                   .LONGA  off
 7664                                   .MNLIST
 7665  FD1999  20 99 1F         ?opn:   jsr     cdskopn         ; open file
 7666  FD199C  7A                       ply
 7667  FD199D  90 2A                    bcc     ?ok             ; no error
 7668  FD199F  84 58                    sty     bka
 7669  FD19A1  AF 50 CC 01              lda     >EDDSKERR       ; check error 63 (file exist)
 7670  FD19A5  C9 36                    cmp     #'6'
  Tue Jul 17 11:00:22 2018                                                                                               Page   90




 7671  FD19A7  D0 46                    bne     ?derr           ; error of another kind
 7672  FD19A9  AF 51 CC 01              lda     >EDDSKERR+1
 7673  FD19AD  C9 33                    cmp     #'3'
 7674  FD19AF  D0 3E                    bne     ?derr
 7675  FD19B1  A2 F6                    ldx     #<?msg          ; ask overwrite confirmation
 7676  FD19B3  A0 19                    ldy     #>?msg
 7677  FD19B5  A9 FD                    lda     #^?msg
 7678  FD19B7  20 91 1B                 jsr     confirm         ; ask confirmation
 7679  FD19BA  B0 29                    bcs     ?end            ; no, <ESC>
 7680  FD19BC  D0 27                    bne     ?end            ; no, <N>
 7681  FD19BE                           ACC16
 7682  FD19BE  C2 20                    rep     #PMFLAG
 7683                                   .LONGA  on
 7684                                   .MNLIST
 7685  FD19C0  C6 DA                    dec     longp
 7686  FD19C2                           ACC08
 7687  FD19C2  E2 20                    sep     #PMFLAG
 7688                                   .LONGA  off
 7689                                   .MNLIST
 7690  FD19C4  A4 58                    ldy     bka
 7691  FD19C6  5A                       phy
 7692  FD19C7  80 D0                    bra     ?opn            ; try again with replace flag
 7693  FD19C9  20 50 1A         ?ok:    jsr     csave2
 7694  FD19CC  B0 17                    bcs     ?end            ; some error
 7695  FD19CE  A2 00                    ldx     #0
 7696  FD19D0  BF 01 CC 01      ?cp:    lda     >EDBUFFILE+1,x  ; skip '@'
 7697  FD19D4  9F 00 CD 01              sta     >EDCURFILE,x
 7698  FD19D8  F0 03                    beq     ?upd
 7699  FD19DA  E8                       inx
 7700  FD19DB  80 F3                    bra     ?cp
 7701  FD19DD  A5 18            ?upd:   lda     bflag
 7702  FD19DF  29 7F                    and     #$7F
 7703  FD19E1  09 10                    ora     #$10
 7704  FD19E3  85 18                    sta     bflag
 7705  FD19E5  A9 40            ?end:   lda     #$40
 7706  FD19E7  85 3F                    sta     slfg
 7707  FD19E9  20 4F 05                 jsr     updsl
 7708  FD19EC  4C 32 04                 jmp     updwin
 7709                           
 7710  FD19EF                   ?derr:
 7711  FD19EF  A2 FF                    ldx     #$FF            ; disk error    
 7712  FD19F1  20 43 05                 jsr     error
 7713  FD19F4  80 EF                    bra     ?end
 7714                           
 7715  FD19F6  46 69 6C 65 20   ?msg:   .DB     'File exist; overwrite <Y/N>?', 0
               65 78 69 73 74 
               3B 20 6F 76 65 
               72 77 72 69 74 
               65 20 3C 59 2F 
               4E 3E 3F 00 
 7716  FD1A13  57 2C 53 2C      ?rdw:   .DB     'W,S,'
 7717                           
 7718                           
 7719                           ; save CBM file 
 7720  FD1A17                   csave:
 7721  FD1A17  A9 00                    lda     #<EDBUFFILE     ; prepare filename
 7722  FD1A19  85 DA                    sta     longp
  Tue Jul 17 11:00:22 2018                                                                                               Page   91




 7723  FD1A1B  A9 CC                    lda     #>EDBUFFILE
 7724  FD1A1D  85 DB                    sta     longp+1
 7725  FD1A1F  A9 01                    lda     #^EDBUFFILE
 7726  FD1A21  85 DC                    sta     longp+2
 7727  FD1A23  A9 40                    lda     #'@'            ; replace flag
 7728  FD1A25  87 DA                    sta     [longp]
 7729  FD1A27  A0 01                    ldy     #1
 7730  FD1A29  A2 00                    ldx     #0
 7731  FD1A2B  BF 00 CD 01      ?nam:   lda     >EDCURFILE,x
 7732  FD1A2F  F0 08                    beq     ?nxt
 7733  FD1A31  97 DA                    sta     [longp],y
 7734  FD1A33  C8                       iny
 7735  FD1A34  E8                       inx
 7736  FD1A35  C0 12                    cpy     #18
 7737  FD1A37  90 F2                    bcc     ?nam
 7738  FD1A39  A2 03            ?nxt:   ldx     #3
 7739  FD1A3B  5A                       phy
 7740  FD1A3C  BF 88 1A FD      ?lp:    lda     >_?rdw,x
 7741  FD1A40  97 DA                    sta     [longp],y
 7742  FD1A42  C8                       iny
 7743  FD1A43  CA                       dex
 7744  FD1A44  10 F6                    bpl     ?lp
 7745  FD1A46  A9 00                    lda     #0
 7746  FD1A48  97 DA                    sta     [longp],y
 7747  FD1A4A  20 99 1F                 jsr     cdskopn         ; open file
 7748  FD1A4D  7A                       ply
 7749  FD1A4E  B0 30                    bcs     _?derr          ; error
 7750  FD1A50                   csave2:
 7751  FD1A50  A9 00                    lda     #0
 7752  FD1A52  97 DA                    sta     [longp],y
 7753  FD1A54  A5 DC                    lda     longp+2
 7754  FD1A56  48                       pha
 7755  FD1A57  D4 DA                    pei     (longp)
 7756  FD1A59  4B                       phk
 7757  FD1A5A  F4 8C 1A                 pea     #_?sav
 7758  FD1A5D  A9 07                    lda     #7
 7759  FD1A5F  48                       pha
 7760  FD1A60                           BSPRINTF2               ; format in local string
 7761  FD1A60  02 14                    cop     $14
 7762                                   .MNLIST
 7763  FD1A62  DA                       phx                     ; bank that hold string
 7764  FD1A63  AA                       tax                     ; low address
 7765  FD1A64  EB                       xba
 7766  FD1A65  A8                       tay                     ; hi address
 7767  FD1A66  A5 3C                    lda     slattr          ; attribute
 7768  FD1A68  EB                       xba
 7769  FD1A69  68                       pla                     ; bank
 7770  FD1A6A  20 54 16                 jsr     outstr
 7771  FD1A6D  A9 40                    lda     #$40            ; force update status line
 7772  FD1A6F  85 3F                    sta     slfg
 7773  FD1A71  20 9B 1A                 jsr     savbuf
 7774  FD1A74  B0 0A                    bcs     _?derr
 7775  FD1A76  20 4F 05                 jsr     updsl
 7776  FD1A79  18                       clc
 7777  FD1A7A  08               _?end:  php     
 7778  FD1A7B  20 32 04                 jsr     updwin
 7779  FD1A7E  28                       plp
  Tue Jul 17 11:00:22 2018                                                                                               Page   92




 7780  FD1A7F  60                       rts
 7781                           
 7782  FD1A80                   _?derr:
 7783  FD1A80  A2 FF                    ldx     #$FF            ; disk error    
 7784  FD1A82  20 43 05                 jsr     error
 7785  FD1A85  38                       sec
 7786  FD1A86  80 F2                    bra     _?end
 7787                           
 7788  FD1A88  57 2C 53 2C      _?rdw:  .DB     'W,S,'
 7789  FD1A8C  53 61 76 69 6E   _?sav:  .DB     'Saving "%s"...', 0
               67 20 22 25 73 
               22 2E 2E 2E 00 
 7790                           
 7791                           ; save current buffer
 7792  FD1A9B                   savbuf:
 7793  FD1A9B  20 93 0E                 jsr     mvpp2           ; save buffer pointer
 7794  FD1A9E                           ACC16
 7795  FD1A9E  C2 20                    rep     #PMFLAG
 7796                                   .LONGA  on
 7797                                   .MNLIST
 7798  FD1AA0  A5 12                    lda     pbuf            ; set pointer to start
 7799  FD1AA2  85 15                    sta     ppage
 7800  FD1AA4  64 58                    stz     bka
 7801  FD1AA6  A9 00 E0                 lda     #EDDSKBUF       ; set disk buffer pointer
 7802  FD1AA9  85 52                    sta     pb
 7803  FD1AAB  A2 01                    ldx     #^EDDSKBUF
 7804  FD1AAD  86 54                    stx     pb+2
 7805  FD1AAF                           ACC08
 7806  FD1AAF  E2 20                    sep     #PMFLAG
 7807                                   .LONGA  off
 7808                                   .MNLIST
 7809  FD1AB1  A9 05                    lda     #BSTART
 7810  FD1AB3  85 17                    sta     ixb
 7811  FD1AB5  80 03                    bra     ?get
 7812  FD1AB7  20 BE 0F         ?nxt:   jsr     incptr          ; inc buffer pointer    
 7813  FD1ABA  20 A9 0F         ?get:   jsr     getbyte         ; get next byte
 7814  FD1ABD  B0 12                    bcs     ?end            ; end of text
 7815  FD1ABF  20 F2 1A                 jsr     ?put            ; put into disk buffer
 7816  FD1AC2  B0 24                    bcs     ?rst            ; error
 7817  FD1AC4  C9 0D                    cmp     #$0D
 7818  FD1AC6  D0 EF                    bne     ?nxt
 7819  FD1AC8  A9 0A                    lda     #$0A            ; dos style text file
 7820  FD1ACA  20 F2 1A                 jsr     ?put
 7821  FD1ACD  B0 19                    bcs     ?rst            ; error
 7822  FD1ACF  80 E6                    bra     ?nxt            ; next byte
 7823  FD1AD1  18               ?end:   clc                     ; no error      
 7824  FD1AD2  A5 58                    lda     bka             ; check if must flush disk buffer
 7825  FD1AD4  05 59                    ora     bka+1
 7826  FD1AD6  F0 03                    beq     ?cls            ; no flush: close file
 7827  FD1AD8  20 02 1B                 jsr     ?wr             ; flush buffer
 7828  FD1ADB  08               ?cls:   php     
 7829  FD1ADC  24 DD                    bit     fsmode          ; close file
 7830  FD1ADE  10 06                    bpl     ?fcls
 7831  FD1AE0  A9 0E                    lda     #$0E            ; close file
 7832  FD1AE2                           CBMFSCLS        
 7833  FD1AE2  02 82                    cop     FN_CBMFSCLS
 7834                                   .MNLIST
  Tue Jul 17 11:00:22 2018                                                                                               Page   93




 7835  FD1AE4  80 01                    bra     ?go
 7836  FD1AE6  EA               ?fcls:  nop
 7837  FD1AE7  28               ?go:    plp
 7838  FD1AE8  20 4A 0E         ?rst:   jsr     pp2mv           ; restore pointer
 7839  FD1AEB  B0 04                    bcs     ?end2
 7840  FD1AED  A9 80                    lda     #$80
 7841  FD1AEF  14 18                    trb     bflag           ; clear modified flag
 7842  FD1AF1  60               ?end2:  rts
 7843                           
 7844  FD1AF2                   ?put:   INDEX16                 ; insert into disk buffer
 7845  FD1AF2  C2 10                    rep     #PXFLAG
 7846                                   .LONGI  on
 7847                                   .MNLIST
 7848  FD1AF4  A4 58                    ldy     bka             ; current index
 7849  FD1AF6  97 52                    sta     [pb],y          ; store byte
 7850  FD1AF8  C8                       iny                     ; update index
 7851  FD1AF9  84 58                    sty     bka
 7852  FD1AFB  C0 00 20                 cpy     #EDDSKBUFSIZ    ; check if full
 7853  FD1AFE                           INDEX08
 7854  FD1AFE  E2 10                    sep     #PXFLAG
 7855                                   .LONGI  off
 7856                                   .MNLIST
 7857  FD1B00  90 21                    bcc     ?rts
 7858  FD1B02  24 DD            ?wr:    bit     fsmode          ; write buffer to disk
 7859  FD1B04  10 18                    bpl     ?wfat           ; fat file
 7860  FD1B06  A5 54                    lda     pb+2            ; set buffer pointer
 7861  FD1B08  48                       pha
 7862  FD1B09  D4 52                    pei     (pb)
 7863  FD1B0B  D4 58                    pei     (bka)           ; buffer size
 7864  FD1B0D  A9 0E                    lda     #$0E
 7865  FD1B0F  48                       pha                     ; chnl 14
 7866  FD1B10                           CBMFSWR                 ; write buffer
 7867  FD1B10  02 81                    cop     FN_CBMFSRW
 7868  FD1B12  01                       .DB     $01
 7869                                   .MNLIST
 7870  FD1B13  90 0A                    bcc     ?ok
 7871  FD1B15  20 A6 1F                 jsr     cdskerr         ; get error string
 7872  FD1B18  A9 0E                    lda     #$0E            ; close file
 7873  FD1B1A                           CBMFSCLS        
 7874  FD1B1A  02 82                    cop     FN_CBMFSCLS
 7875                                   .MNLIST
 7876  FD1B1C  38                       sec                     ; error
 7877  FD1B1D  60                       rts
 7878  FD1B1E  18               ?wfat:  clc
 7879  FD1B1F  64 58            ?ok:    stz     bka             ; clear index
 7880  FD1B21  64 59                    stz     bka+1
 7881  FD1B23  60               ?rts:   rts
 7882                           
 7883  FD1B24                   fsave:
 7884  FD1B24  18                       clc
 7885  FD1B25  60                       rts
 7886                           
 7887                           ; check current buffer
 7888                           ; ZF=1 if clipboard or empty buffer
 7889  FD1B26                   chkbuf:
 7890  FD1B26  A5 0F                    lda     xbuf
 7891  FD1B28  C9 0A                    cmp     #CLIPBRD
  Tue Jul 17 11:00:22 2018                                                                                               Page   94




 7892  FD1B2A  F0 0E                    beq     ?end            ; is clipboard
 7893  FD1B2C  A5 12                    lda     pbuf
 7894  FD1B2E  85 53                    sta     pb+1
 7895  FD1B30  A5 13                    lda     pbuf+1
 7896  FD1B32  85 54                    sta     pb+2
 7897  FD1B34  64 52                    stz     pb
 7898  FD1B36  A0 05                    ldy     #BSTART
 7899  FD1B38  B7 52                    lda     [pb],y          ; ZF=1 if empty
 7900  FD1B3A  60               ?end:   rts
 7901                           
 7902                           ; ALT-N
 7903  FD1B3B                   clrbuf:
 7904  FD1B3B  20 26 1B                 jsr     chkbuf
 7905  FD1B3E  F0 24                    beq     ?end            ; clipboard or empty buffer
 7906  FD1B40  A2 65                    ldx     #<?sclr
 7907  FD1B42  A0 1B                    ldy     #>?sclr
 7908  FD1B44  A9 FD                    lda     #^?sclr
 7909  FD1B46  20 91 1B                 jsr     confirm         ; ask confirmation
 7910  FD1B49  B0 19                    bcs     ?end            ; no, <ESC>
 7911  FD1B4B  D0 17                    bne     ?end            ; no, <N>
 7912  FD1B4D  24 18                    bit     bflag           ; buffer modified?
 7913  FD1B4F  10 03                    bpl     ?go             ; no
 7914  FD1B51  20 07 19                 jsr     save
 7915  FD1B54  64 1C            ?go:    stz     cline
 7916  FD1B56  64 1D                    stz     cline+1
 7917  FD1B58  A5 0F                    lda     xbuf
 7918  FD1B5A  20 78 0B                 jsr     freebuf
 7919  FD1B5D  A9 40                    lda     #$40
 7920  FD1B5F  85 3F                    sta     slfg
 7921  FD1B61  20 32 04                 jsr     updwin
 7922  FD1B64  60               ?end:   rts
 7923                           
 7924  FD1B65  41 72 65 20 79   ?sclr:  .DB     'Are you sure to clear current buffer <Y/N>?', 0
               6F 75 20 73 75 
               72 65 20 74 6F 
               20 63 6C 65 61 
               72 20 63 75 72 
               72 65 6E 74 20 
               62 75 66 66 65 
               72 20 3C 59 2F 
               4E 3E 3F 00 
 7925                           
 7926                           ; X,Y,A = string ptr
 7927                           ; CF = 1 if <ESC>
 7928                           ; CF=0, ZF=0 if <N>
 7929                           ; CF=0, ZF=1 if <Y>
 7930  FD1B91                   confirm:
 7931  FD1B91  EB                       xba
 7932  FD1B92  A5 3D                    lda     seatt
 7933  FD1B94  EB                       xba
 7934  FD1B95  20 54 16                 jsr     outstr
 7935  FD1B98  20 90 16         ?get:   jsr     slgkey          ; wait key pressed
 7936  FD1B9B  B0 FB                    bcs     ?get            ; control key
 7937  FD1B9D  EB                       xba                     ; ALT,CTL,SHIFT
 7938  FD1B9E  D0 F8                    bne     ?get            ; will be no pressed
 7939  FD1BA0  EB                       xba
 7940  FD1BA1  C9 1B                    cmp     #KB_ESC
  Tue Jul 17 11:00:22 2018                                                                                               Page   95




 7941  FD1BA3  F0 14                    beq     ?end            ; exit with CF=1
 7942  FD1BA5  C9 61                    cmp     #'a'
 7943  FD1BA7  90 06                    bcc     ?nxt
 7944  FD1BA9  C9 7B                    cmp     #'z'+1
 7945  FD1BAB  B0 02                    bcs     ?nxt
 7946  FD1BAD  29 DF                    and     #$DF            ; capitalize
 7947  FD1BAF  C9 59            ?nxt:   cmp     #'Y'
 7948  FD1BB1  F0 05                    beq     ?ok             ; exit with CF=0, ZF=1
 7949  FD1BB3  C9 4E                    cmp     #'N'
 7950  FD1BB5  D0 E1                    bne     ?get
 7951  FD1BB7  1A                       inc     a               ; exit with CF=0, ZF=0
 7952  FD1BB8  18               ?ok:    clc
 7953  FD1BB9  08               ?end:   php     
 7954  FD1BBA  A9 40                    lda     #$40            ; force updare status line
 7955  FD1BBC  85 3F                    sta     slfg
 7956  FD1BBE  20 4F 05                 jsr     updsl
 7957  FD1BC1  28                       plp
 7958  FD1BC2  60                       rts
 7959                           
 7960                           ;ALT-T
 7961  FD1BC3                   settab:
 7962  FD1BC3  A5 19                    lda     deftab          ; prepare prompt string
 7963  FD1BC5  48                       pha
 7964  FD1BC6  A9 28                    lda     #MAXTABVAL
 7965  FD1BC8  48                       pha
 7966  FD1BC9  A9 02                    lda     #MINTABVAL
 7967  FD1BCB  48                       pha
 7968  FD1BCC  4B                       phk                     ; bank of format string
 7969  FD1BCD  F4 1C 1C                 pea     #?tstr
 7970  FD1BD0  A9 07                    lda     #7
 7971  FD1BD2  48                       pha
 7972  FD1BD3                           BSPRINTF2               ; format in local string
 7973  FD1BD3  02 14                    cop     $14
 7974                                   .MNLIST
 7975  FD1BD5  86 58                    stx     bka             ; bank
 7976  FD1BD7  AA                       tax                     ; low address
 7977  FD1BD8  EB                       xba
 7978  FD1BD9  A8                       tay                     ; hi address
 7979  FD1BDA  A5 58                    lda     bka
 7980  FD1BDC  20 2E 17                 jsr     inputstr
 7981  FD1BDF  B0 36                    bcs     ?end
 7982  FD1BE1  20 1C 1D                 jsr     getnum          ; get number in bka
 7983  FD1BE4  B0 31                    bcs     ?end            ; error
 7984  FD1BE6  A6 58                    ldx     bka
 7985  FD1BE8  A5 59                    lda     bka+1
 7986  FD1BEA  F0 21                    beq     ?ok
 7987  FD1BEC  A0 28            ?err:   ldy     #MAXTABVAL
 7988  FD1BEE  5A                       phy
 7989  FD1BEF  A0 02                    ldy     #MINTABVAL
 7990  FD1BF1  5A                       phy
 7991  FD1BF2  48                       pha                     ; illegal value
 7992  FD1BF3  DA                       phx
 7993  FD1BF4  F4 B0 00                 pea     #EDERRSIZ       ; size of dest. string
 7994  FD1BF7  A9 01                    lda     #^EDDSKERR      ; eror dest. string
 7995  FD1BF9  48                       pha
 7996  FD1BFA  F4 50 CC                 pea     #EDDSKERR
 7997  FD1BFD  4B                       phk                     ; format string
  Tue Jul 17 11:00:22 2018                                                                                               Page   96




 7998  FD1BFE  F4 53 1C                 pea     #?serr
 7999  FD1C01  A9 0D                    lda     #13
 8000  FD1C03  48                       pha
 8001  FD1C04                           BSPRINTF
 8002  FD1C04  02 12                    cop     $12
 8003                                   .MNLIST
 8004  FD1C06  A2 FF                    ldx     #$FF            ; error string in EDDSKERR
 8005  FD1C08  20 43 05                 jsr     error
 8006  FD1C0B  80 0A                    bra     ?end
 8007  FD1C0D  E0 02            ?ok:    cpx     #MINTABVAL
 8008  FD1C0F  90 DB                    bcc     ?err
 8009  FD1C11  E0 29                    cpx     #MAXTABVAL+1
 8010  FD1C13  B0 D7                    bcs     ?err
 8011  FD1C15  86 19                    stx     deftab
 8012  FD1C17  A9 80            ?end:   lda     #$80            ; clear input mode flag
 8013  FD1C19  14 3F                    trb     slfg
 8014  FD1C1B  60                       rts
 8015                           
 8016  FD1C1C  53 65 74 20 74   ?tstr:  .DB     'Set tab value in range %bu..%bu (current value: %bu): ', 0
               61 62 20 76 61 
               6C 75 65 20 69 
               6E 20 72 61 6E 
               67 65 20 25 62 
               75 2E 2E 25 62 
               75 20 28 63 75 
               72 72 65 6E 74 
               20 76 61 6C 75 
               65 3A 20 25 62 
               75 29 3A 20 00 
 8017  FD1C53  49 6C 6C 65 67   ?serr:  .DB     'Illegal tab value: %hu (must be in range %bu..%bu)', 0
               61 6C 20 74 61 
               62 20 76 61 6C 
               75 65 3A 20 25 
               68 75 20 28 6D 
               75 73 74 20 62 
               65 20 69 6E 20 
               72 61 6E 67 65 
               20 25 62 75 2E 
               2E 25 62 75 29 
               00 
 8018                           
 8019                           ; ALT-G
 8020  FD1C86                   gotoln:
 8021  FD1C86  A2 0E                    ldx     #<?gto
 8022  FD1C88  A0 1D                    ldy     #>?gto
 8023  FD1C8A  A9 FD                    lda     #^?gto
 8024  FD1C8C  20 2E 17                 jsr     inputstr
 8025  FD1C8F  B0 78                    bcs     ?end
 8026  FD1C91  20 1C 1D                 jsr     getnum          ; get number in bka
 8027  FD1C94  B0 73                    bcs     ?end            ; error
 8028  FD1C96  A5 58                    lda     bka
 8029  FD1C98  05 59                    ora     bka+1
 8030  FD1C9A  F0 04                    beq     ?hom
 8031  FD1C9C  C9 01                    cmp     #1
 8032  FD1C9E  D0 05                    bne     ?nxt
 8033  FD1CA0  20 99 03         ?hom:   jsr     gohome
 8034  FD1CA3  80 64                    bra     ?end
  Tue Jul 17 11:00:22 2018                                                                                               Page   97




 8035  FD1CA5                   ?nxt:   ACC16
 8036  FD1CA5  C2 20                    rep     #PMFLAG
 8037                                   .LONGA  on
 8038                                   .MNLIST
 8039  FD1CA7  A5 58                    lda     bka
 8040  FD1CA9  C5 1A                    cmp     ncount
 8041  FD1CAB                           ACC08
 8042  FD1CAB  E2 20                    sep     #PMFLAG
 8043                                   .LONGA  off
 8044                                   .MNLIST
 8045  FD1CAD  90 05                    bcc     ?gol
 8046  FD1CAF  20 B4 03                 jsr     goend
 8047  FD1CB2  80 55                    bra     ?end
 8048  FD1CB4                   ?gol:   ACC16
 8049  FD1CB4  C2 20                    rep     #PMFLAG
 8050                                   .LONGA  on
 8051                                   .MNLIST
 8052  FD1CB6  C5 1C                    cmp     cline
 8053  FD1CB8                           ACC08
 8054  FD1CB8  E2 20                    sep     #PMFLAG
 8055                                   .LONGA  off
 8056                                   .MNLIST
 8057  FD1CBA  F0 4D                    beq     ?end
 8058  FD1CBC                           ACC16
 8059  FD1CBC  C2 20                    rep     #PMFLAG
 8060                                   .LONGA  on
 8061                                   .MNLIST
 8062  FD1CBE  A2 00                    ldx     #0
 8063  FD1CC0  B0 08                    bcs     ?gol1           ; > cline
 8064  FD1CC2  CA                       dex                     ; < cline
 8065  FD1CC3  38                       sec
 8066  FD1CC4  A5 1C                    lda     cline
 8067  FD1CC6  E5 58                    sbc     bka
 8068  FD1CC8  80 02                    bra     ?gol2
 8069  FD1CCA  E5 1C            ?gol1:  sbc     cline
 8070  FD1CCC  85 5A            ?gol2:  sta     bkb
 8071  FD1CCE                           ACC08
 8072  FD1CCE  E2 20                    sep     #PMFLAG
 8073                                   .LONGA  off
 8074                                   .MNLIST
 8075  FD1CD0  9B                       txy
 8076  FD1CD1  10 1C                    bpl     ?down           ; go down
 8077  FD1CD3  20 AD 0E                 JSR     pp8mv
 8078  FD1CD6  20 8C 0F         ?01:    JSR     startln
 8079  FD1CD9                           ACC16
 8080  FD1CD9  C2 20                    rep     #PMFLAG
 8081                                   .LONGA  on
 8082                                   .MNLIST
 8083  FD1CDB  B0 08                    BCS     ?05
 8084  FD1CDD  A6 23                    ldx     fslct
 8085  FD1CDF  F0 02                    BEQ     ?03
 8086  FD1CE1  C6 24                    DEC     nslctl
 8087  FD1CE3  C6 1C            ?03:    DEC     cline
 8088  FD1CE5  C6 5A            ?05:    DEC     bkb
 8089  FD1CE7                           ACC08
 8090  FD1CE7  E2 20                    sep     #PMFLAG
 8091                                   .LONGA  off
  Tue Jul 17 11:00:22 2018                                                                                               Page   98




 8092                                   .MNLIST
 8093  FD1CE9  D0 EB                    BNE     ?01
 8094  FD1CEB  A9 06                    LDA     #$06
 8095  FD1CED  80 17                    bra     ?10
 8096  FD1CEF                   ?down:
 8097  FD1CEF  20 70 0F         ?01a:   JSR     nextln
 8098  FD1CF2                           ACC16
 8099  FD1CF2  C2 20                    rep     #PMFLAG
 8100                                   .LONGA  on
 8101                                   .MNLIST
 8102  FD1CF4  B0 08                    BCS     ?03a
 8103  FD1CF6  A6 23                    ldx     fslct
 8104  FD1CF8  F0 02                    BEQ     ?02a
 8105  FD1CFA  E6 24                    INC     nslctl
 8106  FD1CFC  E6 1C            ?02a:   INC     cline
 8107  FD1CFE  C6 5A            ?03a:   DEC     bkb
 8108  FD1D00                           ACC08
 8109  FD1D00  E2 20                    sep     #PMFLAG
 8110                                   .LONGA  off
 8111                                   .MNLIST
 8112  FD1D02  D0 EB                    BNE     ?01a
 8113  FD1D04  A9 11                    LDA     #$11
 8114                           
 8115  FD1D06  20 94 03         ?10:    jsr     epage
 8116  FD1D09  A9 80            ?end:   lda     #$80            ; clear input mode flag
 8117  FD1D0B  14 3F                    trb     slfg
 8118  FD1D0D  60                       rts
 8119                           
 8120  FD1D0E  47 6F 74 6F 20   ?gto:   .DB     'Goto line #: ', 0
               6C 69 6E 65 20 
               23 3A 20 00 
 8121                           
 8122  FD1D1C                   getnum:
 8123  FD1D1C  A2 00                    ldx     #0
 8124  FD1D1E  86 58                    stx     bka
 8125  FD1D20  86 59                    stx     bka+1
 8126  FD1D22  86 5B                    stx     bkb+1
 8127  FD1D24  20 53 1D         ?nxt:   jsr     ?get
 8128  FD1D27  A8                       tay
 8129  FD1D28  F0 27                    beq     ?ret            ; end of string
 8130  FD1D2A  B0 1A                    bcs     ?err
 8131  FD1D2C  E9 2F                    sbc     #'0'-1
 8132  FD1D2E  85 5A                    sta     bkb
 8133  FD1D30                           ACC16
 8134  FD1D30  C2 20                    rep     #PMFLAG
 8135                                   .LONGA  on
 8136                                   .MNLIST
 8137  FD1D32  A5 58                    lda     bka
 8138  FD1D34  C9 9A 19                 cmp     #6554
 8139  FD1D37  B0 09                    bcs     ?end            ; overflow
 8140  FD1D39  0A                       asl     a
 8141  FD1D3A  0A                       asl     a
 8142  FD1D3B  65 58                    adc     bka
 8143  FD1D3D  0A                       asl     a
 8144  FD1D3E  65 5A                    adc     bkb
 8145  FD1D40  85 58                    sta     bka
 8146  FD1D42                   ?end:   ACC08
  Tue Jul 17 11:00:22 2018                                                                                               Page   99




 8147  FD1D42  E2 20                    sep     #PMFLAG
 8148                                   .LONGA  off
 8149                                   .MNLIST
 8150  FD1D44  90 DE                    bcc     ?nxt
 8151  FD1D46  A2 08            ?err:   ldx     #8
 8152  FD1D48  20 43 05                 jsr     error
 8153  FD1D4B  A9 80                    lda     #$80
 8154  FD1D4D  14 3F                    trb     slfg
 8155  FD1D4F  38                       sec
 8156  FD1D50  60                       rts
 8157  FD1D51  18               ?ret:   clc     
 8158  FD1D52  60                       rts
 8159                           
 8160  FD1D53  BF 50 CC 01      ?get:   lda     >EDBUFLIN,x
 8161  FD1D57  E8                       inx
 8162  FD1D58  C9 3A                    cmp     #'9'+1
 8163  FD1D5A  B0 06                    bcs     ?ex
 8164  FD1D5C  38                       sec
 8165  FD1D5D  E9 30                    sbc     #$30
 8166  FD1D5F  38                       sec
 8167  FD1D60  E9 D0                    sbc     #$D0
 8168  FD1D62  60               ?ex:    rts
 8169                           
 8170                           ;---------------------
 8171                           ; save crt buffer & page 01
 8172  FD1D63                   crtsav:
 8173  FD1D63  AF 0C FC 00              lda     >CREMEOFF       ; save current video ram bit
 8174  FD1D67  A8                       tay
 8175  FD1D68  8F 0D FC 00              sta     >CREMEON        ; enable video ram
 8176  FD1D6C                           CPU16
 8177  FD1D6C  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 8178                                   .LONGA  on
 8179                                   .LONGI  on
 8180                                   .MNLIST
 8181  FD1D6E  A2 FF 0F                 ldx     #$0FFF          ; move 4k
 8182  FD1D71  BF 00 00 01      ?lp:    lda     >VBBCHARRAM,x
 8183  FD1D75  9F 00 D0 01              sta     >EDCRTSAV,x
 8184  FD1D79  CA                       dex
 8185  FD1D7A  10 F5                    bpl     ?lp
 8186  FD1D7C                           CPU08
 8187  FD1D7C  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 8188                                   .LONGA  off
 8189                                   .LONGI  off
 8190                                   .MNLIST
 8191  FD1D7E  BB                       tyx
 8192  FD1D7F  9F 0C FC 00              sta     >CREMEOFF,x     ; restore video ram bit
 8193  FD1D83  A2 6E                    ldx     #ScnLinTmp      ; save page 01
 8194  FD1D85  BD 00 01         ?lp2:   lda     !DP01ADDR,x
 8195  FD1D88  9F 00 CB 01              sta     >EDSAVE01,x
 8196  FD1D8C  E8                       inx
 8197  FD1D8D  D0 F6                    bne     ?lp2
 8198  FD1D8F  60                       rts
 8199                           
 8200  FD1D90                   crtrest:
 8201  FD1D90  AF 0C FC 00              lda     >CREMEOFF       ; save current video ram bit
 8202  FD1D94  A8                       tay
 8203  FD1D95  8F 0D FC 00              sta     >CREMEON        ; enable video ram
  Tue Jul 17 11:00:22 2018                                                                                               Page  100




 8204  FD1D99                           CPU16
 8205  FD1D99  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 8206                                   .LONGA  on
 8207                                   .LONGI  on
 8208                                   .MNLIST
 8209  FD1D9B  A2 FF 0F                 ldx     #$0FFF          ; move 4k
 8210  FD1D9E  BF 00 D0 01      ?lp:    lda     >EDCRTSAV,x
 8211  FD1DA2  9F 00 00 01              sta     >VBBCHARRAM,x
 8212  FD1DA6  CA                       dex
 8213  FD1DA7  10 F5                    bpl     ?lp
 8214  FD1DA9                           CPU08
 8215  FD1DA9  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 8216                                   .LONGA  off
 8217                                   .LONGI  off
 8218                                   .MNLIST
 8219  FD1DAB  A9 F0                    lda     #$F0            ; who change this byte????
 8220  FD1DAD  8F 00 10 01              sta     >VBBPALRAM
 8221  FD1DB1  BB                       tyx
 8222  FD1DB2  9F 0C FC 00              sta     >CREMEOFF,x     ; restore video ram bit
 8223  FD1DB6  A2 6E                    ldx     #ScnLinTmp      ; restore page 01
 8224  FD1DB8  BF 00 CB 01      ?lp2:   lda     >EDSAVE01,x
 8225  FD1DBC  9D 00 01                 sta     !DP01ADDR,x
 8226  FD1DBF  E8                       inx
 8227  FD1DC0  D0 F6                    bne     ?lp2
 8228  FD1DC2  60                       rts
 8229                           
 8230                           ; --- load editor buffer
 8231                           ; longp: buffer pointer
 8232                           ; dbufsiz: buffer size
 8233  FD1DC3                   bufld:
 8234  FD1DC3  DA                       phx
 8235  FD1DC4  A5 DE                    lda     dbufsiz
 8236  FD1DC6  05 DF                    ora     dbufsiz+1
 8237  FD1DC8  F0 73                    beq     ?end            ; empty
 8238  FD1DCA  A7 DA            ?nxt:   lda     [longp]         ; get byte
 8239  FD1DCC  C9 0A                    cmp     #$0A            ; skip line feed
 8240  FD1DCE  F0 63                    beq     ?inc
 8241  FD1DD0  C9 0D                    cmp     #$0D
 8242  FD1DD2  F0 22                    beq     ?ins
 8243  FD1DD4  C9 09                    cmp     #KB_TAB         ; discard non printable but TAB & CR
 8244  FD1DD6  F0 27                    beq     ?tab
 8245  FD1DD8  C9 20                    cmp     #' '
 8246  FD1DDA  90 57                    bcc     ?inc
 8247  FD1DDC  A6 58                    ldx     bka
 8248  FD1DDE  E0 F0                    cpx     #MAXTEXTLEN
 8249  FD1DE0  90 14                    bcc     ?ins
 8250  FD1DE2  85 59                    sta     bka+1
 8251  FD1DE4  A9 0D                    lda     #$0D
 8252  FD1DE6  20 EC 0C                 jsr     insert
 8253  FD1DE9                           ACC16
 8254  FD1DE9  C2 20                    rep     #PMFLAG
 8255                                   .LONGA  on
 8256                                   .MNLIST
 8257  FD1DEB  E6 1A                    inc     ncount
 8258  FD1DED                           ACC08
 8259  FD1DED  E2 20                    sep     #PMFLAG
 8260                                   .LONGA  off
  Tue Jul 17 11:00:22 2018                                                                                               Page  101




 8261                                   .MNLIST
 8262  FD1DEF  20 DF 0F                 jsr     incptr2
 8263  FD1DF2  64 58                    stz     bka
 8264  FD1DF4  A5 59                    lda     bka+1
 8265  FD1DF6  20 EC 0C         ?ins:   jsr     insert          ; insert byte in editor buffer
 8266  FD1DF9  E6 58                    inc     bka             ; update text lenght
 8267  FD1DFB  90 1A                    bcc     ?cr             ; ok, room available
 8268  FD1DFD  B0 05                    bcs     ?em             ; memory error
 8269  FD1DFF  20 40 1E         ?tab:   jsr     ?tkey
 8270  FD1E02  80 2F                    bra     ?inc
 8271  FD1E04  A0 FE            ?em:    ldy     #$FE
 8272  FD1E06  A9 0D                    lda     #$0D    
 8273  FD1E08  97 14                    sta     [pblk],y
 8274  FD1E0A  C8                       iny
 8275  FD1E0B  A9 00                    lda     #0
 8276  FD1E0D  97 14                    sta     [pblk],y
 8277  FD1E0F                           ACC16
 8278  FD1E0F  C2 20                    rep     #PMFLAG
 8279                                   .LONGA  on
 8280                                   .MNLIST
 8281  FD1E11  E6 1A                    inc     ncount
 8282  FD1E13                           ACC08
 8283  FD1E13  E2 20                    sep     #PMFLAG
 8284                                   .LONGA  off
 8285                                   .MNLIST
 8286  FD1E15  80 16                    bra     ?ret    
 8287  FD1E17  C9 0D            ?cr:    cmp     #$0D            ; last byte was a CR?
 8288  FD1E19  D0 15                    bne     ?upd            ; no
 8289  FD1E1B  64 58                    stz     bka
 8290  FD1E1D                           ACC16CLC
 8291  FD1E1D  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 8292                                   .LONGA  on
 8293                                   .MNLIST
 8294  FD1E1F  E6 1A                    inc     ncount          ; update lines count
 8295  FD1E21  D0 03                    bne     ?nov
 8296  FD1E23  38                       sec                     ; lines count overflow
 8297  FD1E24  C6 1A                    dec     ncount
 8298  FD1E26                   ?nov:   ACC08
 8299  FD1E26  E2 20                    sep     #PMFLAG
 8300                                   .LONGA  off
 8301                                   .MNLIST
 8302  FD1E28  90 06                    bcc     ?upd
 8303  FD1E2A  20 DF 0F                 jsr     incptr2
 8304  FD1E2D  FA               ?ret:   plx
 8305  FD1E2E  38                       sec                     ; error
 8306  FD1E2F  60                       rts
 8307  FD1E30  20 DF 0F         ?upd:   jsr     incptr2         ; update editor buffer pointer
 8308  FD1E33                   ?inc:   ACC16
 8309  FD1E33  C2 20                    rep     #PMFLAG
 8310                                   .LONGA  on
 8311                                   .MNLIST
 8312  FD1E35  E6 DA                    inc     longp           ; update buffer pointer
 8313  FD1E37  C6 DE                    dec     dbufsiz         ; update size
 8314  FD1E39                           ACC08
 8315  FD1E39  E2 20                    sep     #PMFLAG
 8316                                   .LONGA  off
 8317                                   .MNLIST
  Tue Jul 17 11:00:22 2018                                                                                               Page  102




 8318  FD1E3B  D0 8D                    bne     ?nxt
 8319  FD1E3D  FA               ?end:   plx     
 8320  FD1E3E  18                       clc
 8321  FD1E3F  60                       rts
 8322                           
 8323  FD1E40  A9 00            ?tkey:  lda     #0              ; put blank's instead tab's
 8324  FD1E42  18               ?tb0:   clc
 8325  FD1E43  69 08            ?tb1:   adc     #8              ; assume default tab = 8
 8326  FD1E45  C5 58                    cmp     bka
 8327  FD1E47  F0 F9                    beq     ?tb0
 8328  FD1E49  90 F8                    bcc     ?tb1
 8329  FD1E4B  E5 58                    sbc     bka
 8330  FD1E4D  F0 10                    beq     ?tbx
 8331  FD1E4F  85 30                    sta     ctmp2
 8332  FD1E51  A9 20            ?tbl:   lda     #' '
 8333  FD1E53  20 EC 0C                 jsr     insert
 8334  FD1E56  20 DF 0F                 jsr     incptr2
 8335  FD1E59  E6 58                    inc     bka
 8336  FD1E5B  C6 30                    dec     ctmp2
 8337  FD1E5D  D0 F2                    bne     ?tbl
 8338  FD1E5F  60               ?tbx:   rts
 8339                           
 8340                           ; check command line for open file
 8341  FD1E60                   chkcmd:
 8342  FD1E60  A5 DA                    lda     longp
 8343  FD1E62  05 DB                    ora     longp+1
 8344  FD1E64  05 DC                    ora     longp+2
 8345  FD1E66  F0 14                    beq     ?end            ; null pointer
 8346  FD1E68  A7 DA                    lda     [longp]
 8347  FD1E6A  F0 10                    beq     ?end            ; empty command line
 8348  FD1E6C  A0 00                    ldy     #0
 8349  FD1E6E  BB                       tyx
 8350  FD1E6F  B7 DA            ?mv:    lda     [longp],y
 8351  FD1E71  9F 50 CC 01              sta     >EDDSKERR,x
 8352  FD1E75  C8                       iny
 8353  FD1E76  E8                       inx
 8354  FD1E77  D0 F6                    bne     ?mv
 8355  FD1E79  20 7D 1E                 jsr     cbmopn
 8356  FD1E7C  60               ?end:   rts
 8357                           
 8358                           ;------ CBM FS
 8359                           
 8360                           ; open CBM file
 8361                           ; filename in EDDSKERR buffer
 8362  FD1E7D                   cbmopn:
 8363  FD1E7D  A9 01                    lda     #^EDBUFFILE     ; set pointer to filename
 8364  FD1E7F  85 DC                    sta     longp+2
 8365  FD1E81  A9 00                    lda     #<EDBUFFILE
 8366  FD1E83  85 DA                    sta     longp
 8367  FD1E85  A9 CC                    lda     #>EDBUFFILE
 8368  FD1E87  85 DB                    sta     longp+1 
 8369  FD1E89  A2 00                    ldx     #0
 8370  FD1E8B  9B                       txy
 8371  FD1E8C  AF 51 CC 01              lda     >EDDSKERR+1     ; check drive
 8372  FD1E90  C9 3A                    cmp     #':'
 8373  FD1E92  D0 0C                    bne     ?dr             ; store deafult drive '0'
 8374  FD1E94  AF 50 CC 01              lda     >EDDSKERR
  Tue Jul 17 11:00:22 2018                                                                                               Page  103




 8375  FD1E98  C9 30                    cmp     #'0'             ; continue if drive 0 or 1
 8376  FD1E9A  F0 0E                    beq     ?mv
 8377  FD1E9C  C9 31                    cmp     #'1'
 8378  FD1E9E  F0 0A                    beq     ?mv
 8379  FD1EA0  A9 30            ?dr:    lda     #'0'             ; put default drive '0'
 8380  FD1EA2  87 DA                    sta     [longp]
 8381  FD1EA4  C8                       iny
 8382  FD1EA5  A9 3A                    lda     #':'
 8383  FD1EA7  97 DA                    sta     [longp],y
 8384  FD1EA9  C8                       iny
 8385  FD1EAA  BF 50 CC 01      ?mv:    lda     >EDDSKERR,x     ; set filename
 8386  FD1EAE  F0 10                    beq     ?nxt
 8387  FD1EB0  C9 61                    cmp     #'a'            ; upper case
 8388  FD1EB2  90 06                    bcc     ?st
 8389  FD1EB4  C9 7B                    cmp     #'z'+1
 8390  FD1EB6  B0 02                    bcs     ?st
 8391  FD1EB8  29 DF                    and     #$DF
 8392  FD1EBA  97 DA            ?st:    sta     [longp],y
 8393  FD1EBC  E8                       inx
 8394  FD1EBD  C8                       iny
 8395  FD1EBE  D0 EA                    bne     ?mv
 8396  FD1EC0  A2 03            ?nxt:   ldx     #3
 8397  FD1EC2  5A                       phy                     ; save index
 8398  FD1EC3  BF 5A 1F FD      ?lp:    lda     >?rds,x
 8399  FD1EC7  97 DA                    sta     [longp],y
 8400  FD1EC9  C8                       iny
 8401  FD1ECA  CA                       dex
 8402  FD1ECB  10 F6                    bpl     ?lp
 8403  FD1ECD  A9 00                    lda     #0
 8404  FD1ECF  97 DA                    sta     [longp],y
 8405  FD1ED1  20 99 1F                 jsr     cdskopn         ; open file
 8406  FD1ED4  7A                       ply
 8407  FD1ED5  B0 6E                    bcs     ?derr           ; error
 8408  FD1ED7  A9 00                    lda     #0
 8409  FD1ED9  97 DA                    sta     [longp],y
 8410  FD1EDB  A5 DC                    lda     longp+2
 8411  FD1EDD  48                       pha
 8412  FD1EDE  D4 DA                    pei     (longp)
 8413  FD1EE0  A9 FD                    lda     #^LOADMSG
 8414  FD1EE2  48                       pha
 8415  FD1EE3  F4 44 21                 pea     #LOADMSG
 8416  FD1EE6  A9 07                    lda     #7
 8417  FD1EE8  48                       pha
 8418  FD1EE9                           BSPRINTF2               ; format in local string
 8419  FD1EE9  02 14                    cop     $14
 8420                                   .MNLIST
 8421  FD1EEB  DA                       phx                     ; bank that hold string
 8422  FD1EEC  AA                       tax                     ; low address
 8423  FD1EED  EB                       xba
 8424  FD1EEE  A8                       tay                     ; hi address
 8425  FD1EEF  A5 3C                    lda     slattr          ; attribute
 8426  FD1EF1  EB                       xba
 8427  FD1EF2  68                       pla                     ; bank
 8428  FD1EF3  20 54 16                 jsr     outstr
 8429  FD1EF6  A9 40                    lda     #$40            ; force update status line
 8430  FD1EF8  85 3F                    sta     slfg
 8431  FD1EFA  20 93 0E                 jsr     mvpp2
  Tue Jul 17 11:00:22 2018                                                                                               Page  104




 8432  FD1EFD  64 58                    stz     bka             ; used for count text lenght
 8433  FD1EFF  20 5E 1F         ?ld:    jsr     cdskld          ; load buffer
 8434  FD1F02  B0 41                    bcs     ?derr
 8435  FD1F04  F0 08                    beq     ?end            ; end
 8436  FD1F06  20 C3 1D                 jsr     bufld
 8437  FD1F09  B0 03                    bcs     ?end
 8438  FD1F0B  8A                       txa                     ; eof status
 8439  FD1F0C  10 F1                    bpl     ?ld
 8440  FD1F0E  08               ?end:   php
 8441  FD1F0F  A9 0E                    lda     #$0E            ; close file
 8442  FD1F11                           CBMFSCLS        
 8443  FD1F11  02 82                    cop     FN_CBMFSCLS
 8444                                   .MNLIST
 8445  FD1F13  28                       plp
 8446  FD1F14  B0 3D                    bcs     ?err04
 8447  FD1F16  A2 FF                    ldx     #$FF            ; update buffer filename
 8448  FD1F18  E8               ?fn:    inx     
 8449  FD1F19  BF 00 CC 01              lda     >EDBUFFILE,x
 8450  FD1F1D  9F 00 CD 01              sta     >EDCURFILE,x
 8451  FD1F21  D0 F5                    bne     ?fn
 8452  FD1F23  A5 18                    lda     bflag
 8453  FD1F25  29 7F                    and     #$7F            ; clear modified flag
 8454  FD1F27  09 10                    ora     #$10            ; set valid fname flag
 8455  FD1F29  85 18                    sta     bflag
 8456  FD1F2B  20 1E 10                 jsr     decptr2
 8457  FD1F2E  B0 0F                    bcs     ?err
 8458  FD1F30  20 A9 0F                 jsr     getbyte
 8459  FD1F33  C9 0D                    cmp     #$0D
 8460  FD1F35  F0 08                    beq     ?err
 8461  FD1F37  20 DF 0F                 jsr     incptr2
 8462  FD1F3A  A9 0D                    lda     #$0D
 8463  FD1F3C  20 EC 0C                 jsr     insert
 8464  FD1F3F  20 4A 0E         ?err:   jsr     pp2mv
 8465  FD1F42  4C 32 04                 jmp     updwin
 8466                           
 8467  FD1F45  A2 FF            ?derr:  ldx     #$FF            ; disk error    
 8468  FD1F47  20 43 05                 jsr     error
 8469  FD1F4A  80 F3                    bra     ?err
 8470  FD1F4C  A2 02            ?err02: ldx     #2      
 8471  FD1F4E  20 43 05                 jsr     error
 8472  FD1F51  80 EC                    bra     ?err
 8473  FD1F53  A2 04            ?err04: ldx     #4      
 8474  FD1F55  20 43 05                 jsr     error
 8475  FD1F58  80 E5                    bra     ?err
 8476                           
 8477  FD1F5A  52 2C 53 2C      ?rds:   .DB     'R,S,'
 8478                           
 8479                           ; load a block from CBM disk on chnl 14
 8480                           ; CF = 1 if error
 8481                           ; ZF = 1 if buffer is empty
 8482                           ; X = $80 if eof
 8483  FD1F5E                   cdskld:
 8484  FD1F5E  A9 01                    lda     #^EDDSKBUF      ; set buffer pointer
 8485  FD1F60  48                       pha
 8486  FD1F61  F4 00 E0                 pea     #EDDSKBUF
 8487  FD1F64  F4 00 20                 pea     #EDDSKBUFSIZ    ; buffer size
 8488  FD1F67  A9 0E                    lda     #$0E
  Tue Jul 17 11:00:22 2018                                                                                               Page  105




 8489  FD1F69  48                       pha                     ; chnl 14
 8490  FD1F6A                           CBMFSRD                 ; read buffer
 8491  FD1F6A  02 81                    cop     FN_CBMFSRW
 8492  FD1F6C  00                       .DB     $00
 8493                                   .MNLIST
 8494  FD1F6D  90 09                    bcc     ?ok
 8495  FD1F6F  20 A6 1F                 jsr     cdskerr         ; get error string
 8496  FD1F72  A9 0E                    lda     #$0E            ; close file
 8497  FD1F74                           CBMFSCLS        
 8498  FD1F74  02 82                    cop     FN_CBMFSCLS
 8499                                   .MNLIST
 8500  FD1F76  38                       sec                     ; error
 8501  FD1F77  60                       rts
 8502  FD1F78                   ?ok:    ACC16   
 8503  FD1F78  C2 20                    rep     #PMFLAG
 8504                                   .LONGA  on
 8505                                   .MNLIST
 8506  FD1F7A  85 DE                    sta     dbufsiz         ; store size
 8507  FD1F7C  48                       pha
 8508  FD1F7D  A9 00 E0                 lda     #EDDSKBUF
 8509  FD1F80  85 DA                    sta     longp           ; reset buffer pointer
 8510  FD1F82  A2 01                    ldx     #^EDDSKBUF
 8511  FD1F84  86 DC                    stx     longp+2
 8512  FD1F86  A2 80                    ldx     #$80            ; eof flag
 8513  FD1F88  68                       pla                     ; eof
 8514  FD1F89  F0 06                    beq     ?end            ; ZF = 1 if buffer is empty
 8515  FD1F8B  C9 00 20                 cmp     #EDDSKBUFSIZ
 8516  FD1F8E  90 01                    bcc     ?end            ; eof
 8517  FD1F90  CA                       dex                     ; not eof
 8518  FD1F91                   ?end:   ACC08
 8519  FD1F91  E2 20                    sep     #PMFLAG
 8520                                   .LONGA  off
 8521                                   .MNLIST
 8522  FD1F93  18                       clc
 8523  FD1F94  60                       rts
 8524                           
 8525                           ; send command to cbm fs emulator
 8526                           ; command string in longp
 8527  FD1F95                   cdskcmd:
 8528  FD1F95  A9 0F                    lda     #15
 8529  FD1F97  80 02                    bra     cdsksnd
 8530  FD1F99                           
 8531                           ; open file 
 8532  FD1F99                   cdskopn:
 8533  FD1F99  A9 0E                    lda     #$0E
 8534                           
 8535  FD1F9B                   cdsksnd:
 8536  FD1F9B  A6 DC                    ldx     longp+2         ; bank of cmnd string
 8537  FD1F9D  DA                       phx
 8538  FD1F9E  D4 DA                    pei     (longp)         ; address of cmnd string
 8539  FD1FA0  48                       pha                     ; chnl
 8540  FD1FA1                           CBMFSCMD                ; send command
 8541  FD1FA1  02 80                    cop     FN_CBMFSCMD
 8542                                   .MNLIST
 8543  FD1FA3  B0 01                    bcs     cdskerr         ; if error
 8544  FD1FA5  60                       rts
 8545                           
  Tue Jul 17 11:00:22 2018                                                                                               Page  106




 8546                           ; get CBM disk error (in: CF = 1 if error pending else CF = 0)
 8547  FD1FA6                   cdskerr:
 8548  FD1FA6  08                       php                     ; save carry
 8549  FD1FA7  A9 01                    lda     #^EDDSKERR
 8550  FD1FA9  48                       pha                     ; address of buffer
 8551  FD1FAA  F4 50 CC                 pea     #EDDSKERR
 8552  FD1FAD  F4 B0 00                 pea     #EDERRSIZ       ; size of buffer
 8553  FD1FB0  A9 0F                    lda     #15             ; channel 15
 8554  FD1FB2  48                       pha
 8555  FD1FB3                           CBMFSRD                 ; read
 8556  FD1FB3  02 81                    cop     FN_CBMFSRW
 8557  FD1FB5  00                       .DB     $00
 8558                                   .MNLIST
 8559  FD1FB6  28                       plp
 8560  FD1FB7  B0 0E                    bcs     ?end            ; error pending
 8561  FD1FB9  AF 50 CC 01              lda     >EDDSKERR
 8562  FD1FBD  0F 51 CC 01              ora     >EDDSKERR+1
 8563  FD1FC1  C9 30                    cmp     #'0'
 8564  FD1FC3  18                       clc
 8565  FD1FC4  F0 01                    beq     ?end
 8566  FD1FC6  38                       sec
 8567  FD1FC7  60               ?end:   rts
 8568                           
 8569  FD1FC8                           
 8570                           ; test load 
 8571  FD1FC8                   testl:
 8572                                   .EXTERN PCERRS
 8573                           
 8574                                   ;bra    ?110
 8575  FD1FC8  A2 00                    ldx     #0
 8576  FD1FCA  BF DA 1F FD      ?lp:    lda     >?100,x
 8577  FD1FCE  9F 50 CC 01              sta     >EDDSKERR,x
 8578  FD1FD2  F0 03                    beq     ?lp1
 8579  FD1FD4  E8                       inx
 8580  FD1FD5  D0 F3                    bne     ?lp
 8581  FD1FD7  4C 7D 1E         ?lp1:   jmp     cbmopn
 8582                           
 8583  FD1FDA  31 3A 74 65 73   ?100    .DB     '1:test10.pas',0
               74 31 30 2E 70 
               61 73 00 
 8584                           
 8585  FD1FE7                   ?110:
 8586  FD1FE7  A9 E5                    lda     #<PCERRS
 8587  FD1FE9  85 52                    sta     pb
 8588  FD1FEB  A9 82                    lda     #>PCERRS
 8589  FD1FED  85 53                    sta     pb+1
 8590  FD1FEF  A9 FE                    lda     #^PCERRS
 8591  FD1FF1  85 54                    sta     pb+2
 8592  FD1FF3  20 93 0E                 jsr     mvpp2
 8593  FD1FF6  A7 52            ?02:    lda     [pb]
 8594  FD1FF8  F0 2D                    beq     ?06
 8595  FD1FFA  20 EC 0C                 jsr     insert
 8596  FD1FFD  90 13                    bcc     ?03
 8597  FD1FFF  A0 FE                    ldy     #$FE
 8598  FD2001  A9 0D                    lda     #$0D    
 8599  FD2003  97 14                    sta     [pblk],y
 8600  FD2005  C8                       iny
  Tue Jul 17 11:00:22 2018                                                                                               Page  107




 8601  FD2006  A9 00                    lda     #0
 8602  FD2008  97 14                    sta     [pblk],y
 8603  FD200A                           ACC16
 8604  FD200A  C2 20                    rep     #PMFLAG
 8605                                   .LONGA  on
 8606                                   .MNLIST
 8607  FD200C  E6 1A                    inc     ncount
 8608  FD200E                           ACC08
 8609  FD200E  E2 20                    sep     #PMFLAG
 8610                                   .LONGA  off
 8611                                   .MNLIST
 8612  FD2010  80 29                    bra     ?08     
 8613  FD2012  C9 0D            ?03:    cmp     #$0D
 8614  FD2014  D0 06                    bne     ?04
 8615  FD2016                           ACC16
 8616  FD2016  C2 20                    rep     #PMFLAG
 8617                                   .LONGA  on
 8618                                   .MNLIST
 8619  FD2018  E6 1A                    inc     ncount                  ; check overflow !!!
 8620  FD201A                           ACC08
 8621  FD201A  E2 20                    sep     #PMFLAG
 8622                                   .LONGA  off
 8623                                   .MNLIST
 8624  FD201C  20 DF 0F         ?04:    jsr     incptr2
 8625  FD201F                           ACC16
 8626  FD201F  C2 20                    rep     #PMFLAG
 8627                                   .LONGA  on
 8628                                   .MNLIST
 8629  FD2021  E6 52                    inc     pb
 8630  FD2023                           ACC08
 8631  FD2023  E2 20                    sep     #PMFLAG
 8632                                   .LONGA  off
 8633                                   .MNLIST
 8634  FD2025  80 CF                    bra     ?02
 8635  FD2027  20 1E 10         ?06:    jsr     decptr2
 8636  FD202A  B0 0F                    bcs     ?08
 8637  FD202C  20 A9 0F         ?07:    jsr     getbyte
 8638  FD202F  C9 0D                    cmp     #$0D
 8639  FD2031  F0 08                    beq     ?08
 8640  FD2033  20 DF 0F                 jsr     incptr2
 8641  FD2036  A9 0D                    lda     #$0D
 8642  FD2038  20 EC 0C                 jsr     insert
 8643  FD203B  20 4A 0E         ?08:    jsr     pp2mv
 8644  FD203E  4C 32 04                 jmp     updwin
 8645                           
 8646  FD2041                   P10TBL:
 8647  FD2041  0100                     .DW     1
 8648  FD2043  0A00                     .DW     10
 8649  FD2045  6400                     .DW     100
 8650  FD2047  E803                     .DW     1000
 8651  FD2049  1027                     .DW     10000
 8652                           
 8653  FD204B                   STRTBLL:
 8654  FD204B  6F 7C 8A 9A AC           .DB     <str00, <str01, <str02, <str03, <str04, <str05, <str06, <str07
               BE D9 00 
 8655  FD2053  2E                       .DB     <str08
 8656                           
  Tue Jul 17 11:00:22 2018                                                                                               Page  108




 8657          000009           MAXSTR  .EQU    ($ - STRTBLL)
 8658                           
 8659  FD2054                   STRTBLH:
 8660  FD2054  20 20 20 20 20           .DB     >str00, >str01, >str02, >str03, >str04, >str05, >str06, >str07
               20 20 21 
 8661  FD205C  21                       .DB     >str08
 8662                           
 8663  FD205D                   strent:
 8664  FD205D  20 2D 20 68 69           .DB     ' - hit <enter>...', 0
               74 20 3C 65 6E 
               74 65 72 3E 2E 
               2E 2E 00 
 8665                           
 8666  FD206F                   str00:
 8667  FD206F  4F 4B 2C 20 6E           .DB     'OK, no error', 0
               6F 20 65 72 72 
               6F 72 00 
 8668                           
 8669  FD207C                   str01:
 8670  FD207C  4F 75 74 20 6F           .DB     'Out of memory', 0
               66 20 6D 65 6D 
               6F 72 79 00 
 8671                           
 8672  FD208A                   str02:
 8673  FD208A  49 6E 76 61 6C           .DB     'Invalid command', 0
               69 64 20 63 6F 
               6D 6D 61 6E 64 
               00 
 8674                           
 8675  FD209A                   str03:
 8676  FD209A  49 6C 6C 65 67           .DB     'Illegal tab value', 0
               61 6C 20 74 61 
               62 20 76 61 6C 
               75 65 00 
 8677                           
 8678  FD20AC                   str04:
 8679  FD20AC  4E 6F 74 20 65           .DB     'Not enough memory', 0
               6E 6F 75 67 68 
               20 6D 65 6D 6F 
               72 79 00 
 8680  FD20BE                           
 8681  FD20BE                   str05:
 8682  FD20BE  43 6C 69 70 62           .DB     'Clipboard: illegal command', 0
               6F 61 72 64 3A 
               20 69 6C 6C 65 
               67 61 6C 20 63 
               6F 6D 6D 61 6E 
               64 00 
 8683                           
 8684  FD20D9                   str06:
 8685  FD20D9  43 61 6E 27 74           .DB     'Can''t paste text: lines count overflow', 0
               20 70 61 73 74 
               65 20 74 65 78 
               74 3A 20 6C 69 
               6E 65 73 20 63 
               6F 75 6E 74 20 
               6F 76 65 72 66 
  Tue Jul 17 11:00:22 2018                                                                                               Page  109




               6C 6F 77 00 
 8686                           
 8687  FD2100                   str07:
 8688  FD2100  43 61 6E 27 74           .DB     'Can''t insert a new line: lines count overflow', 0
               20 69 6E 73 65 
               72 74 20 61 20 
               6E 65 77 20 6C 
               69 6E 65 3A 20 
               6C 69 6E 65 73 
               20 63 6F 75 6E 
               74 20 6F 76 65 
               72 66 6C 6F 77 
               00 
 8689                           
 8690  FD212E                   str08:
 8691  FD212E  49 6C 6C 65 67           .DB     'Illegal numeric value', 0
               61 6C 20 6E 75 
               6D 65 72 69 63 
               20 76 61 6C 75 
               65 00 
 8692                           
 8693  FD2144                   LOADMSG:
 8694  FD2144  4C 6F 61 64 69           .DB     'Loading "%s"...', 0
               6E 67 20 22 25 
               73 22 2E 2E 2E 
               00 
 8695                           
 8696  FD2154                   stlstr:
 8697  FD2154  62 75 66 66 65   .DB     'buffer:#0 "                  "                M I O SCN  N:00000  L:00000 C:000 '
               72 3A 23 30 20 
               22 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 22 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 4D 20 49 20 
               4F 20 53 43 4E 
               20 20 4E 3A 30 
               30 30 30 30 20 
               20 4C 3A 30 30 
               30 30 30 20 43 
               3A 30 30 30 20 
 8698  FD21A4                   stlstr1:
 8699  FD21A4  62 75 66 66 65   .DB     'buffer:#0 "                                 " M I O SCN  N:00000  L:00000 C:000 '
               72 3A 23 30 20 
               22 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 22 
               20 4D 20 49 20 
               4F 20 53 43 4E 
               20 20 4E 3A 30 
  Tue Jul 17 11:00:22 2018                                                                                               Page  110




               30 30 30 30 20 
               20 4C 3A 30 30 
               30 30 30 20 43 
               3A 30 30 30 20 
 8700                           ;        0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
 8701  FD21F4                   stlstr2:
 8702  FD21F4  43 4C 49 50 42   .DB     'CLIPBOARD                                     M I O SCN  N:00000  L:00000 C:000 '
               4F 41 52 44 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 20 20 20 20 
               20 4D 20 49 20 
               4F 20 53 43 4E 
               20 20 4E 3A 30 
               30 30 30 30 20 
               20 4C 3A 30 30 
               30 30 30 20 43 
               3A 30 30 30 20 
 8703                           
 8704                           ; control key's table
 8705  FD2244                   KEYTBL:
 8706  FD2244  8F 8B 84 87              .DB     KB_CSRLEFT, KB_CSRDOWN, KB_CSRUP, KB_CSRRIGHT
 8707  FD2248  85 8C 88 8A              .DB     KB_HOME, KB_END, KB_PGUP, KB_PGDOWN
 8708  FD224C  90 05 15 21              .DB     KB_BACKSPACE, KB_SHIFTHOME, KB_SHIFTEND, KB_CTLTAB
 8709  FD2250  8D 8E 86 1F              .DB     KB_SHCR, KB_DELETE, KB_INSERT, KB_CTLESC
 8710                           
 8711                                   ; ALT-X : quit | ALT-O: open | ALT-N: new | ALT-T: set tab
 8712  FD2254  78 6F 6E 74              .DB     'x', 'o', 'n', 't'
 8713                                   ; ALT-G: goto | ALT-S: save
 8714  FD2258  67 73                    .DB     'g', 's'
 8715                           
 8716          000015           KEYTBLLEN       .EQU    ($ - KEYTBL - 1)
 8717                           
 8718                           ; control key's function table
 8719  FD225A                   KEYPROC:
 8720  FD225A  2802 F002 A102           .DW     csrleft, csrdwn, csrup, csrrght
               5C02 
 8721  FD2262  9903 B403 7603           .DW     gohome, goend, pageup, pagedwn
               5903 
 8722  FD226A  8501 4E03 3F03           .DW     backkey, gostartln, goendln, tind
               A506 
 8723  FD2272  F203 6B01 9306           .DW     kshenter, delkey, tins, testl
               C81F 
 8724                           
 8725  FD227A  E618 EB18 3B1B           .DW     exit, open, clrbuf, settab
               C31B 
 8726  FD2282  861C 0719                .DW     gotoln, save
 8727                           
 8728                           ; key's table
 8729  FD2286                   KEYTBL2:
 8730  FD2286  03 09 0D 16              .DB     KB_CTLC, KB_TAB, KB_CR, KB_CTLV
 8731  FD228A  18 1B 13 19              .DB     KB_CTLX, KB_ESC, KB_CTLS, KB_CTLY
 8732                           
  Tue Jul 17 11:00:22 2018                                                                                               Page  111




 8733          000007           KEYTBLLEN2      .EQU    ($ - KEYTBL2 - 1)
 8734                           
 8735                           ; no-control key function table
 8736  FD228E                   KEYPROC2:
 8737  FD228E  3907 4701 0104           .DW     copysel, tabkey, kenter, pastesel  
               D409 
 8738  FD2296  4607 9F17 7D02           .DW     cutsel, cmdline, seltxt, delline
               CA06 


             Lines Assembled : 8010                  Errors : 0