Subversion Repositories MB01 Project

Rev

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

  Tue Jul 17 11:00:17 2018                                                                                               Page    1







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

                       Input  Filename : src\F8\vdc.asm
                       Output Filename : obj\F8\vdc.obj
                       Listing Has Been Relocated                               


 2592                           .LIST           on
 2593                           
 2594  F8FFB1                           .INCLUDE inc\dirp00.inc
 2595                           ;----------------------------------------------------------
 2596                           ; DIRP00.ASM
 2597                           ; PROGETTO: B1601
 2598                           ;
 2599                           ; Variabili in Direct Page $00
 2600                           ;----------------------------------------------------------
 2601                           
 2602                           ; sezione COMMON -- questo permette di includere il file in piu' file
 2603                           
 2604                           .LIST on
 2605                           
 2606                           DIRP00: .SECTION page0, ref_only, common        ;Direct-Page 00
 2607                           
 2608  000000                           .ABSOLUTE               ;; inizia sempre da $00
 2609  000000                           .ORG            0x00
 2610  000000                           
 2611  000000  0000             JiffyClk        .DW                     ; contatore 10ms 32 bit
 2612  000002  0000                             .DW
 2613  000004                   SysTmr          .DS     SYSTMRCNT       ; system timer 0 (10ms)
 2614  000008                   SysTMF          .DS     SYSTMRCNT       ; flag timer (80 -> start)
 2615  00000C  00               Bnk0Flag        .DB                     ; <7>: flag test RAM banco 0 ok
 2616                                                                   ; <6>: flag warm reset
 2617  00000D  00               RTCFlag         .DB
 2618                           
 2619  00000E                   diskstat        .DS     2       ; flag device on ata bus #0 & #1
 2620                                                           ; <7>: device ready
 2621                                                           ; <6>: compact flash device (C.F.)
 2622                                                           ; <5>: device identification ok
 2623                                                           ; <4>: MBR loaded
 2624                                                           ; <3>: valid signature in MBR
 2625                                                           ; <2>: first partition found&active
 2626                                                           ; <1>:
 2627                                                           ; <0>: valid partition flag
 2628                           
 2629                                                           ; <7>: device ready
 2630                                                           ; <6>: USB device
 2631                                                           ; <5>: compact flash device (C.F.)
 2632                                                           ; <4>: device identification ok
 2633                                                           ; <3>: MBR loaded
 2634                                                           ; <2>: first partition found&active
 2635                                                           ; <1>: always 1
 2636                                                           ; <0>: valid partition flag
 2637  000010                                                   
  Tue Jul 17 11:00:17 2018                                                                                               Page    2




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




 2695  000046  00               fdcctl          .DB             ; fdc controller status
 2696                                                           ; <7>: drive is attached
 2697                                                           ; <6>: drive need recalibration (restore)
 2698                                                           ; <5>: FDC controller ok
 2699                                                           ; <4>: motor on
 2700                                                           ; <3>: dma is active
 2701                                                           ; <2>: dma chip ok (post routine)
 2702                                                           ; <1>: clock rate (1=HD,0=DD)
 2703                                                           ; <0>: disk ready
 2704                           
 2705  000047  00               fdctrk          .DB             ; fd: current seek track
 2706  000048  00               fdcerr          .DB             ; fd: last error code
 2707  000049  00               ataerr          .DB             ; ata: last error code
 2708  00004A  00               ataxer          .DB             ; ata: last extended error code
 2709                           
 2710  00004B  00               CtrlBrk         .DB             ; flag CTRL+BREAK (NMI)
 2711                           
 2712  00004C  0000             MemTop          .DW             ; top memoria RAM
 2713  00004E  00                               .DB             ; banco top mem
 2714                           
 2715  00004F  00               DflTxtIn        .DB             ; device di default text input 
 2716  000050  00               DflTxtOut       .DB             ; device di default text output
 2717                           
 2718  000051                   COPPtr          LP              ; long pointer for COP decoding
 2719  000054  00               COPIdx          .DB             ; COP signature/index
 2720                           
 2721  000055  00               BiosEnt         .DB             ; flag accesso a bios setup
 2722                           
 2723                           ; variabili utilizzate da ACIA
 2724  000056                   spwrk           .DS     $30
 2725                           
 2726                           ; bios mem
 2727  000086  0000             nsize           .DW     ; dimensione blocco da allocare
 2728                           ;bsize          .DW     ; dimensione vera blocco free
 2729  000088  0000             splitsz         .DW     ; dimensione blocco splittato
 2730  00008A  0000             bfree           .DW     ; puntatore blocco free
 2731  00008C  0000             hdrptr          .DW     ; puntatore header heap
 2732                           
 2733  00008E  0000             pbrklv          .DW     ; current break level of current process
 2734  000090  0000             pbrkmin         .DW     ; minimum breal level of current process
 2735  000092  0000             pbrkmax         .DW     ; maximum breal level of current process
 2736  000094                           
 2737                           ; bios temp. work area
 2738  000094                   bwrktmp         .DS     $28
 2739                           
 2740  0000BC  00               coptmp          .DB     ; temp. used while cop
 2741                           
 2742  0000BD  00               tstser          .DB     ; check ser/usb test board post
 2743                                                   ; <7>: VIA2 ok
 2744                                                   ; <6>: PICRAM ok
 2745                                                   ; <1>: UART 16C550 ok
 2746                                                   ; <0>: R65C51 ok
 2747                           
 2748                           
 2749                           ;crc16          .DW
 2750                           
 2751  0000BD                           .RELATIVE
  Tue Jul 17 11:00:17 2018                                                                                               Page    4




 2752                           
 2753                                   .ENDS
 2754                           
 2755          [01]             .IFDEF          _ACIA_INC_
 2756                                   .INCLUDE INC\SP.INC
 2757          [00]             .ENDIF
 2758                           
 2772                           .LIST on
 2773                           
 2774          000060           KBDBUFLEN       .EQU    96              ; dimensione buffer di tastiera
 2775                           
 2776                           DIRP01: .SECTION page0, ref_only, common        ;Direct-Page 01
 2777                           
 2778  000000                           .ABSOLUTE               ;; inizia sempre da $00
 2779  000000                           .ORG            0x00
 2780                           
 2781  000000                           
 2782  000000                   KbdBuf          .DS     KBDBUFLEN       ; buffer della tastiera
 2783  000060  00               KbdITail        .DB                     ; coda buffer tastiera
 2784  000061  00               KbdIHead        .DB                     ; testa buffer tastiera
 2785  000062  00               KbdCnt          .DB                     ; numero bytes nel buffer
 2786  000063  00               KbdShift        .DB
 2787  000064  00               KbdFlag         .DB
 2788  000065  00               KbdToggle       .DB
 2789  000066  00               KbdSt           .DB                     ; status tastiera dopo reset
 2790  000067  00               PS2Ctl          .DB                     ; flag controller PS2 keyboard
 2791                           
 2792  000068  00               LCDFlag         .DB
 2793  000069  00               LCDTmp          .DB
 2794  00006A  0000             LCDVal          .DW
 2795                           
 2796  00006C  00               VBBFlag         .DB             ; flag video board
 2797  00006D  00               VBBRam          .DB             ; flag video RAM
 2798                           
 2799  00006E  00               ScnLinTmp       .DB
 2800  00006F  00               ScnChBase       .DB             ; base video ram VDC
 2801  000070  00               ScnAttBase      .DB             ; base ram attributi VDC
 2802  000071  00               ScnCursMode     .DB             ; VDC cursore default
 2803  000072  00               ScnSaveAttr     .DB
 2804  000073  00               ScnInsert       .DB
 2805  000074  00               ScnAutoIns      .DB             ; bit 7 -> autoins - bit 6 -> modo input
 2806  000075  00               ScnScroll       .DB
 2807  000076  00               ScnMaxRow       .DB             ; max. righe finestra (-1)
 2808  000077  00               ScnMaxCols      .DB             ; max. colonne finestra (-1)
 2809                           
 2810  000078                   ScnMapTabs1     .DS     10
 2811  000082                   ScnMapTabs2     .DS     4
 2812  000086                           
 2813  000086  0000             ScnPtr          .DW             ; puntatore video ram linea corrente
 2814  000088  00                               .DB
 2815                           
 2816  000089  00               ScnFiltLen      .DB             ; lunghezza set caratteri filtro
 2817                           
 2818  00008A  0000             ScnAtPtr        .DW             ; puntatore attributi ram linea corrente
 2819  00008C  00                               .DB
 2820                           
 2821  00008D  00               ScnTmpx         .DB             ; temporaneo: durante put char
  Tue Jul 17 11:00:17 2018                                                                                               Page    5




 2822  00008E                                   
 2823  00008E  00               ScnTop          .DB             ; riga superiore finestra
 2824  00008F  00               ScnLeft         .DB             ; colonna sinistra finestra
 2825  000090  00               ScnBottom       .DB             ; riga inferiore finestra
 2826  000091  00               ScnRight        .DB             ; colonna destra finestra
 2827  000092  00               ScnAttr         .DB             ; attributo default
 2828  000093  00               ScnAttr2        .DB             ; attributo alternativo
 2829  000094  00               ScnRow          .DB             ; riga cursore
 2830  000095  00               ScnCol          .DB             ; colonna cursore
 2831  000096  00               ScnRowStart     .DB             ; riga di start input 
 2832  000097  00               ScnInput        .DB             ; riga di fine input 
 2833  000098  00               ScnColStart     .DB             ; colonna di start input 
 2834  000099  00               ScnSaveX        .DB
 2835  00009A  00               ScnSaveY        .DB
 2836  00009B  00               ScnTmpL         .DB
 2837  00009C  00               ScnTmpH         .DB
 2838  00009D  00               ScnSaveRow      .DB
 2839  00009E  00               ScnSaveCol      .DB
 2840  00009F  00               ScnCurChr       .DB
 2841  0000A0  00               ScnLstChr       .DB
 2842  0000A1  00               ScnCR           .DB
 2843  0000A2  0000             ScnPrm          .DW             ; puntatore long utilizzato da print imm
 2844  0000A4  00                               .DB             ; banco puntatore ScnPrm
 2845  0000A5  00               ScnMode         .DB             ; flag modo schermo
 2846                           
 2847  0000A6                   ScnPtr1         LP
 2848                           
 2849  0000A9  00               ScnDefCol       .DB             ; default foreground color
 2850                           
 2851  0000AA                   ScnPtr2         LP
 2852                           
 2853  0000AD  00               ScnDefBkgCol    .DB             ; default background color
 2854  0000AE  00               ScnInpRow       .DB             ; modo input line: riga start input
 2855  0000AF  00               ScnInpCol       .DB             ; modo input line: colonna start input
 2856  0000B0  00               ScnLstRow       .DB             ; modo input line: riga stop input
 2857  0000B1  00               ScnLstCol       .DB             ; modo input line: colonna stop input
 2858  0000B2  00               ScnFlag         .DB             ; Bit 7: input line - Bit 6: input riga unica
 2859  0000B3  00               ScnMask         .DB             ; flag tasti funzione editor di linea
 2860  0000B4  00               ScnFilt         .DB             ; filtro tasti editor di linea
 2861  0000B5  00               ScnCntrl        .DB             ; flag ASCII/CONTROL
 2862                           ;DflTxtIn       .DB             ; device di default text input 
 2863                           ;DflTxtOut      .DB             ; device di default text output
 2864  0000B6                           
 2865          000047           SCNCLRLEN       .EQU    ($ - ScnLinTmp - 1)
 2866                           
 2867                           ;SCNCLRLEN      .EQU    (DflTxtOut - ScnLinTmp)
 2868                           
 2869                           ; variabili monitor
 2870  0000B6  00               SMAddrL         .DB     ; address low/high
 2871  0000B7  00               SMAddrH         .DB
 2872  0000B8  00               SMAddrK         .DB     ; address bank
 2873  0000B9  00               SMFlag32        .DB     ; flag parametro 32 bit
 2874  0000BA  00               SMTmpL          .DB     ; temp. low/high
 2875  0000BB  00               SMTmpH          .DB
 2876  0000BC  00               SMTmpK          .DB     ; temp. bank
 2877  0000BD  00               SMTmpKK         .DB     ; high byte param. 32 bit
 2878  0000BE  00               SMSizeL         .DB     ; size low/high
  Tue Jul 17 11:00:17 2018                                                                                               Page    6




 2879  0000BF  00               SMSizeH         .DB
 2880  0000C0  00               SMSizeK         .DB     ; size bank
 2881  0000C1  00               SMXAddrL        .DB     ; address low/high XM
 2882  0000C2  00               SMXAddrH        .DB
 2883  0000C3  00               SMXAddrK        .DB     ; address bank XM
 2884  0000C4  00               SMbndx          .DB     ; indice input buffer
 2885  0000C5  00               SMnprm          .DB     ; numero parametri riga di comando
 2886  0000C6  00               SMdumb          .DB
 2887  0000C7  00               SMkr            .DB
 2888  0000C8  0000             SMpc            .DW
 2889  0000CA  00               SMsr            .DB
 2890  0000CB  00               SMbr            .DB
 2891  0000CC  0000             SMdp            .DW
 2892  0000CE  0000             SMac            .DW
 2893  0000D0  0000             SMxr            .DW
 2894  0000D2  0000             SMyr            .DW
 2895  0000D4  0000             SMsp            .DW
 2896                           
 2897  0000D6  00               SMAuxL          .DB
 2898  0000D7  00               SMAuxH          .DB
 2899                           
 2900  0000D8  00               asmlong         .DB     ; flag for CPU in 16 mode
 2901                                                   ; <7> -> A/M in 16 bit mode
 2902                                                   ; <6> -> X/Y in 16 bit mode
 2903  0000D9  00               asmcpu          .DB     ; <7> -> 8 bit family
 2904                                                   ; <6> -> 65C02 cmos version
 2905                           
 2906  0000DA  00               SMctx           .DB     ; context (if = $00 no quit command)
 2907  0000DB                   SMrsm           LP      ; long pointer to resume caller context
 2908                           
 2909  0000DE  00               rtcadr          .DB     ; rtc internal ram address
 2910  0000DF  00               rtcbnk          .DB     ; RTC internal bank ram
 2911  0000E0  00               cmdlin          .DB     ;
 2912  0000E1  00               SMesc           .DB
 2913                           
 2914  0000E2                   SMXTmp:         .DS     26      ; 26 bytes tmp
 2915                           
 2916          0000E2           SMTmp2          .EQU    SMXTmp
 2917          0000E4           SMTmp3          .EQU    SMXTmp+2
 2918          0000E6           SMdwTmp1        .EQU    SMXTmp+4
 2919          0000EA           SMdwTmp2        .EQU    SMXTmp+8
 2920          0000EE           SMFsrc          .EQU    SMXTmp+12       ; source bank for flash update
 2921          0000EF           SMFflag         .EQU    SMXTmp+13       ; flag file for flash update
 2922          0000F0           SMXPos2         .EQU    SMXTmp+14
 2923          0000F1           SMYPos2         .EQU    SMXTmp+15
 2924          0000F2           SMXPos3         .EQU    SMXTmp+16
 2925          0000F3           SMYPos3         .EQU    SMXTmp+17
 2926                           ;SMAuxL         .EQU    SMXTmp+18
 2927                           ;SMAuxH         .EQU    SMXTmp+19
 2928          0000F6           SMXPos          .EQU    SMXTmp+20
 2929          0000F7           SMYPos          .EQU    SMXTmp+21
 2930          0000F8           SMdwTmp3        .EQU    SMXTmp+22
 2931                           
 2932          0000E2           atcmd           .EQU    SMXTmp          ; save @ command
 2933          0000E3           atnum           .EQU    SMXTmp+1        ; @ command index
 2934          0000E4           atflag          .EQU    SMXTmp+2        ; @ L,S,V,R,W start address flag
 2935          0000E5           atbnk           .EQU    SMXTmp+3        ; @ L,S,V,R,W bank
  Tue Jul 17 11:00:17 2018                                                                                               Page    7




 2936          0000E6           atstr           .EQU    SMXTmp+4        ; @ command string start (word)
 2937          0000E8           atstart         .EQU    SMXTmp+6        ; @ L,S,V,R,W start address (word)
 2938          0000EA           atend           .EQU    SMXTmp+8        ; @ S,W end address (word)
 2939          0000EC           atbuf           .EQU    SMXTmp+10       ; @ local buffer pointer (word)
 2940          0000EE           atipb           .EQU    SMXTmp+12       ; @ bank of input buffer
 2941          0000EF           atdir           .EQU    SMXTmp+13       ; @ load dir flag
 2942          0000F0           atptr           .EQU    SMXTmp+14       ; @ load dir pointer (word)
 2943          0000F2           atsiz           .EQU    SMXTmp+16       ; @ buffer size (word) 
 2944          0000F5           atlp            .EQU    SMXTmp+19       ; @ long pointer
 2945          0000F8           atsa            .EQU    SMXTmp+22       ; @ sa
 2946                           
 2947          0000E2           btmpx           .EQU    SMXTmp          ; asc2bin conversion
 2948          0000E3           brtcsec         .EQU    SMXTmp+1
 2949          0000E4           brtcmin         .EQU    SMXTmp+2
 2950          0000E5           brtchour        .EQU    SMXTmp+3
 2951          0000E6           brtcday         .EQU    SMXTmp+4
 2952          0000E7           brtcmonth       .EQU    SMXTmp+5
 2953          0000E8           brtcyear        .EQU    SMXTmp+6
 2954          0000E9           brtcct          .EQU    SMXTmp+7
 2955                           
 2956                           
 2957  0000FC                           .RELATIVE
 2958                           
 2959                                   .ENDS
 2960                           
 2964                                   .LIST on
 2965                           
 2966          000010           CHARWIDTH       .EQU    $10     ; ampiezza max. carattere
 2967          000008           CGAWIDTH        .EQU    $08
 2968          00000E           EGAWIDTH        .EQU    $0E
 2969          000010           VGAWIDTH        .EQU    $10
 2970                           
 2971          000007           CURSLINE        .EQU    $07
 2972          000060           DEFCURS         .EQU    $60
 2973          000007           DEFATTR         .EQU    $07
 2974          000000           DEFCURS2        .EQU    $00     ; cursore fisso HD6445
 2975          000000           DEFATTR2        .EQU    $00     ; palette di default
 2976  F8FFB1                           
 2977                           
 2978                                   .CODEF8
 2979  F8A207                           
 2980                                   .GLOBAL VDCSetup, VDCREG16, cinit
 2981                                   .GLOBAL _ScnCharOut, _ScnCharIn, _ScnInit, GetSetPos, GetBufKey
 2982  F8A207                           
 2983                                   .EXTERN VGA8x8L, VGA8x8H
 2984  F8A207                           
 2985                                   .LONGA  off
 2986                                   .LONGI  off
 2987  F8A207                           
 2988                           ;--------------------------------------------------------------------
 2989                           
 2990                           ; Setup VDC
 2991                           ; USA A,B,X,Y
 2992  F8A207                   VDCSetup:
 2993  F8A207  08                       php                     ; salva status
 2994  F8A208  0B                       phd                     ; salva DP
 2995  F8A209  8B                       phb                     ; salva registro DBR
  Tue Jul 17 11:00:17 2018                                                                                               Page    8




 2996  F8A20A                           CPU08                   ; imposta registri a 8 bit
 2997  F8A20A  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 2998                                   .LONGA  off
 2999                                   .LONGI  off
 3000                                   .MNLIST
 3001  F8A20C  A9 01                    lda     #>DP01ADDR      ; imposta nuova DP
 3002  F8A20E  EB                       xba                     ; DP Hi
 3003  F8A20F  A9 00                    lda     #0
 3004  F8A211  5B                       tcd
 3005  F8A212  48                       pha                     ; imposta DBR = 0
 3006  F8A213  AB                       plb
 3007  F8A214  20 2B AE                 jsr     SetVDCFont      
 3008  F8A217  AB                       plb                     ; ripristina DBR
 3009  F8A218  2B                       pld                     ; ripristina DP
 3010  F8A219  28                       plp                     ; ripristina status
 3011  F8A21A  60                       rts
 3012                           
 3013                           
 3014  F8A21B                   GetBufKey:
 3015  F8A21B  08                       php
 3016  F8A21C  0B                       phd
 3017  F8A21D  F4 00 01                 pea     #DP01ADDR
 3018  F8A220  2B                       pld
 3019  F8A221                           CPU08
 3020  F8A221  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 3021                                   .LONGA  off
 3022                                   .LONGI  off
 3023                                   .MNLIST
 3024  F8A223  20 17 A5                 jsr     _GetBufKey
 3025  F8A226  2B                       pld
 3026  F8A227  28                       plp
 3027  F8A228  60                       rts
 3028                           
 3029  F8A229                   COP_KeybGet:
 3030                                   .GLOBAL COP_KeybGet
 3031                           
 3032  F8A229  0B                       phd
 3033  F8A22A  F4 00 01                 pea     #DP01ADDR
 3034  F8A22D  2B                       pld
 3035  F8A22E  38                       sec                     ; no char
 3036  F8A22F  A5 62                    lda     KbdCnt          ; char disponibili nel buffer tastiera ?
 3037  F8A231  F0 0A                    beq     ?10             ; no
 3038  F8A233  20 17 A5                 jsr     _GetBufKey      ; preserve CF
 3039  F8A236  AA                       tax                     ; code
 3040  F8A237  98                       tya                     ; flag
 3041  F8A238  89 40                    bit     #$40            ; test bit <6>
 3042  F8A23A  D0 01                    bne     ?10             ; rilascio - ignora
 3043  F8A23C  18                       clc                     ; OK -- tasto disponibile
 3044  F8A23D  2B               ?10:    pld                     ; restore DP
 3045  F8A23E  90 02                    bcc     ?12
 3046  F8A240  A2 00                    ldx     #$00
 3047  F8A242  83 0E            ?12:    sta     STKCR+1,s       ; flag control key
 3048  F8A244  8A                       txa
 3049  F8A245  83 0D                    sta     STKCR,s         ; key code
 3050  F8A247  18                       clc
 3051  F8A248  6B                       rtl
 3052                           
  Tue Jul 17 11:00:17 2018                                                                                               Page    9




 3053  F8A249                   COP_ScnCtl:
 3054                                   .GLOBAL COP_ScnCtl
 3055                           
 3056  F8A249                           ACC16                   ; retrieve function number
 3057  F8A249  C2 20                    rep     #PMFLAG
 3058                                   .LONGA  on
 3059                                   .MNLIST
 3060  F8A24B  A3 10                    lda     STKPCL,s        ; pointer to byte after signature
 3061  F8A24D  85 51                    sta     COPPtr
 3062  F8A24F  1A                       inc     a               ; update return address
 3063  F8A250  83 10                    sta     STKPCL,s
 3064  F8A252                           ACC08                   ; A,M -> 8 bit
 3065  F8A252  E2 20                    sep     #PMFLAG
 3066                                   .LONGA  off
 3067                                   .MNLIST
 3068  F8A254  A3 12                    lda     STKPBR,s        ; bank where was executed cop instruction
 3069  F8A256  85 53                    sta     COPPtr+2        
 3070  F8A258  A7 51                    lda     [COPPtr]        ; byte after signature
 3071  F8A25A  F4 00 01                 pea     #DP01ADDR
 3072  F8A25D  2B                       pld
 3073  F8A25E  AA                       tax
 3074  F8A25F  F0 1F                    beq     ?38             ; X = 0 -> init screen
 3075  F8A261  CA                       dex
 3076  F8A262  F0 17                    beq     ?36             ; X = 1 -> clear screen
 3077  F8A264  CA                       dex
 3078  F8A265  F0 1E                    beq     ?42             ; X = 2 -> get cursor position
 3079  F8A267  CA                       dex
 3080  F8A268  F0 2D                    beq     ?44             ; X = 3 -> set cursor position
 3081  F8A26A  CA                       dex
 3082  F8A26B  F0 36                    beq     ?46             ; X = 4 -> get screen org
 3083  F8A26D  CA                       dex
 3084  F8A26E  F0 3E                    beq     ?48             ; X = 5 -> get keyboard flag
 3085  F8A270  CA                       dex
 3086  F8A271  F0 45                    beq     ?50             ; X = 6 -> clear keyboard buffer & ctrl break
 3087  F8A273  CA                       dex
 3088  F8A274  F0 4F                    beq     ?52             ; X = 7 -> get ctrl break flag
 3089  F8A276  CA                       dex
 3090  F8A277  F0 66                    beq     ?60             ; X = 8 -> fill keyboard buffer 
 3091  F8A279  18                       clc
 3092  F8A27A  6B                       rtl
 3093  F8A27B  20 55 A3         ?36:    jsr     WndClr
 3094  F8A27E  80 03                    bra     ?40
 3095  F8A280  20 08 A3         ?38:    jsr     cinit   
 3096  F8A283  18               ?40:    clc
 3097  F8A284  6B                       rtl
 3098  F8A285  38               ?42:    sec                     ; get pos
 3099  F8A286  20 97 AC                 jsr     GetSetPos
 3100  F8A289  A9 00                    lda     #0
 3101  F8A28B  83 0C            ?43:    sta     STKXR+1,s
 3102  F8A28D  83 0A                    sta     STKYR+1,s       
 3103  F8A28F  8A                       txa
 3104  F8A290  83 0B                    sta     STKXR,s
 3105  F8A292  98                       tya
 3106  F8A293  83 09                    sta     STKYR,s
 3107  F8A295  18                       clc
 3108  F8A296  6B                       rtl
 3109  F8A297  A3 0B            ?44:    lda     STKXR,s
  Tue Jul 17 11:00:17 2018                                                                                               Page   10




 3110  F8A299  AA                       tax
 3111  F8A29A  A3 09                    lda     STKYR,s
 3112  F8A29C  A8                       tay
 3113  F8A29D  18                       clc                     ; set pos
 3114  F8A29E  20 97 AC                 jsr     GetSetPos
 3115  F8A2A1  18                       clc
 3116  F8A2A2  6B                       rtl
 3117  F8A2A3  20 88 AC         ?46:    jsr     GetWndOrg
 3118  F8A2A6  83 0D                    sta     STKCR,s
 3119  F8A2A8  A9 00            ?47:    lda     #0
 3120  F8A2AA  83 0E                    sta     STKCR+1,s
 3121  F8A2AC  80 DD                    bra     ?43
 3122  F8A2AE  78               ?48:    sei     
 3123  F8A2AF  A5 64                    lda     KbdFlag
 3124  F8A2B1  A6 65                    ldx     KbdToggle
 3125  F8A2B3  A4 63                    ldy     KbdShift
 3126  F8A2B5  58                       cli
 3127  F8A2B6  80 F0                    bra     ?47
 3128  F8A2B8  78               ?50:    sei
 3129  F8A2B9  64 62                    stz     KbdCnt          ; clear keyboard buffer
 3130  F8A2BB  64 60                    stz     KbdITail
 3131  F8A2BD  64 61                    stz     KbdIHead
 3132  F8A2BF  9C 4B 00                 stz     !CtrlBrk        ; clear ctrl break/alt sysreq flags
 3133  F8A2C2  58                       cli
 3134  F8A2C3  18                       clc
 3135  F8A2C4  6B                       rtl
 3136  F8A2C5  AD 4B 00         ?52:    lda     !CtrlBrk
 3137  F8A2C8  29 80                    and     #$80            ; check bit 7
 3138  F8A2CA  F0 0B                    beq     ?54
 3139  F8A2CC  1C 4B 00                 trb     !CtrlBrk        ; clear flag
 3140  F8A2CF  78                       sei
 3141  F8A2D0  64 62                    stz     KbdCnt          ; clear keyboard buffer
 3142  F8A2D2  64 60                    stz     KbdITail
 3143  F8A2D4  64 61                    stz     KbdIHead
 3144  F8A2D6  58                       cli
 3145  F8A2D7  83 0D            ?54:    sta     STKCR,s         ; A = $80 or $00
 3146  F8A2D9  A9 00                    lda     #0
 3147  F8A2DB  83 0E                    sta     STKCR+1,s
 3148  F8A2DD  18                       clc
 3149  F8A2DE  6B                       rtl
 3150  F8A2DF  A3 0D            ?60:    lda     STKCR,s         ; CX -> pointer
 3151  F8A2E1  85 A2                    sta     ScnPrm
 3152  F8A2E3  A3 0E                    lda     STKCR+1,s
 3153  F8A2E5  85 A3                    sta     ScnPrm+1
 3154  F8A2E7  A3 0B                    lda     STKXR,s
 3155  F8A2E9  85 A4                    sta     ScnPrm+2
 3156  F8A2EB  A0 00                    ldy     #0
 3157  F8A2ED  9B                       txy
 3158  F8A2EE  78                       sei     
 3159  F8A2EF  B7 A2            ?62:    lda     [ScnPrm],y
 3160  F8A2F1  F0 09                    beq     ?64
 3161  F8A2F3  95 01                    sta     <KbdBuf+1,x     ; key code
 3162  F8A2F5  74 00                    stz     <KbdBuf,x       ; key pressed
 3163  F8A2F7  E8                       inx
 3164  F8A2F8  E8                       inx
 3165  F8A2F9  C8                       iny
 3166  F8A2FA  D0 F3                    bne     ?62
  Tue Jul 17 11:00:17 2018                                                                                               Page   11




 3167  F8A2FC  86 62            ?64:    stx     <KbdCnt
 3168  F8A2FE  86 60                    stx     <KbdITail
 3169  F8A300  64 61                    stz     <KbdIHead
 3170  F8A302  A9 80                    lda     #$80            ; disable auto insert when fill buffer 
 3171  F8A304  14 74                    trb     ScnAutoIns
 3172  F8A306  18                       clc
 3173  F8A307  6B                       rtl
 3174  F8A308                           
 3175                           ;--------------------------------------------------------------------
 3176                           
 3177                           ; inizializza screen editor
 3178  F8A308                   cinit:
 3179  F8A308  A2 47                    ldx     #SCNCLRLEN              ; warm reset: azzera variabili
 3180  F8A30A  74 6E            ?01:    stz     ScnLinTmp,x
 3181  F8A30C  CA                       dex
 3182  F8A30D  10 FB                    bpl     ?01
 3183  F8A30F  A9 18            ?02:    lda     #$18
 3184  F8A311  85 76                    sta     ScnMaxRow
 3185  F8A313  A9 4F                    lda     #$4F
 3186  F8A315  85 77                    sta     ScnMaxCols
 3187  F8A317  A9 07                    lda     #DEFATTR
 3188  F8A319  24 6D                    bit     VBBRam
 3189  F8A31B  10 02                    bpl     ?02a
 3190  F8A31D  A9 00                    lda     #DEFATTR2
 3191  F8A31F  85 92            ?02a:   sta     ScnAttr
 3192  F8A321  85 93                    sta     ScnAttr2
 3193  F8A323  A9 40                    lda     #$40
 3194  F8A325  A2 48                    ldx     #$48
 3195  F8A327  24 6D                    bit     VBBRam
 3196  F8A329  10 04                    bpl     ?02b
 3197  F8A32B  A9 00                    lda     #$00
 3198  F8A32D  A2 08                    ldx     #$08
 3199  F8A32F  85 6F            ?02b:   sta     ScnChBase
 3200  F8A331  86 70                    stx     ScnAttBase
 3201  F8A333  A9 60                    lda     #DEFCURS
 3202  F8A335  24 6D                    bit     VBBRam
 3203  F8A337  10 02                    bpl     ?02c
 3204  F8A339  A9 00                    lda     #DEFCURS2       
 3205  F8A33B  85 71            ?02c:   sta     ScnCursMode
 3206  F8A33D  A9 40                    lda     #$40
 3207  F8A33F  85 75                    sta     ScnScroll
 3208  F8A341  A9 80                    lda     #$80
 3209  F8A343  85 74                    sta     ScnAutoIns
 3210  F8A345  A9 01                    lda     #$01            ; long puntatore video RAM VB
 3211  F8A347  85 88                    sta     ScnPtr+2
 3212  F8A349  85 8C                    sta     ScnAtPtr+2
 3213  F8A34B  85 A8                    sta     ScnPtr1+2
 3214  F8A34D  85 AC                    sta     ScnPtr2+2       
 3215                                   ;lda    #TXTD_SCN
 3216                                   ;sta    !DflTxtOut
 3217                                   ;stz    !DflTxtIn
 3218                                   ;lda    #HISTSTART
 3219                                   ;sta    HistEnd+1
 3220                                   ;sta    HistCur+1
 3221                                   ;stz    HistEnd
 3222                                   ;stz    HistCur
 3223                                   ;jsr    _Test
  Tue Jul 17 11:00:17 2018                                                                                               Page   12




 3224  F8A34F  20 59 AA                 jsr     SetDefTabs
 3225  F8A352  20 7E AA                 jsr     SetMaxWnd
 3226                           
 3227                           ; Cancella finestra corrente
 3228  F8A355                   WndClr:
 3229  F8A355  20 63 A3                 jsr     WndHome
 3230  F8A358  20 71 A3         ?01:    jsr     WndGetAddrX
 3231  F8A35B  20 89 A7                 jsr     ClrRow
 3232  F8A35E  E4 90                    cpx     ScnBottom
 3233  F8A360  E8                       inx
 3234  F8A361  90 F5                    bcc     ?01
 3235  F8A363                           
 3236                           ; Posizione puntatore al margine sinistro superiore
 3237  F8A363                   WndHome:
 3238  F8A363  A6 8E                    ldx     ScnTop
 3239  F8A365  86 94                    stx     ScnRow
 3240  F8A367  86 96                    stx     ScnRowStart
 3241  F8A369                           
 3242                           ; Posiziona puntatore al margine sinistro
 3243  F8A369                   WndLeft:
 3244  F8A369  A4 8F                    ldy     ScnLeft
 3245  F8A36B  84 95                    sty     ScnCol
 3246  F8A36D  84 98                    sty     ScnColStart
 3247  F8A36F                           
 3248                           ; Ricava indirizzo fisico riga corrente
 3249  F8A36F                   WndGetAddr:
 3250  F8A36F  A6 94                    ldx     ScnRow
 3251  F8A371                           
 3252                           ; Ricava indirizzo fisico riga X
 3253  F8A371                   WndGetAddrX:
 3254  F8A371  BF 9A AE F8              lda     >SCRNADDRL,x            ; forza ABS LONG
 3255  F8A375  85 86                    sta     ScnPtr
 3256  F8A377  BF B3 AE F8              lda     >SCRNADDRH,x
 3257  F8A37B  05 6F                    ora     ScnChBase
 3258  F8A37D  85 87                    sta     ScnPtr+1
 3259  F8A37F                           
 3260  F8A37F                   WndGetAddr2:
 3261  F8A37F  A5 86                    lda     ScnPtr
 3262  F8A381  85 8A                    sta     ScnAtPtr
 3263  F8A383  A5 87                    lda     ScnPtr+1
 3264  F8A385  29 07                    and     #$07
 3265  F8A387  05 70                    ora     ScnAttBase
 3266  F8A389  85 8B                    sta     ScnAtPtr+1
 3267  F8A38B  60                       rts
 3268                           
 3269  F8A38C                   WndEnd:
 3270  F8A38C  A6 90                    ldx     ScnBottom
 3271  F8A38E  86 94                    stx     ScnRow
 3272  F8A390  86 96                    stx     ScnRowStart
 3273  F8A392  80 D5                    bra     WndLeft
 3274  F8A394                           
 3275  F8A394                   WndNewLine:
 3276  F8A394  24 B2                    bit     ScnFlag                 ; test input line
 3277  F8A396  10 18                    bpl     ?00
 3278  F8A398  18                       clc
 3279  F8A399  70 D4                    bvs     WndGetAddr              ; mai scroll per input mono-linea
 3280  F8A39B  A6 94                    ldx     ScnRow
  Tue Jul 17 11:00:17 2018                                                                                               Page   13




 3281  F8A39D  E4 90                    cpx     ScnBottom
 3282  F8A39F  90 23                    bcc     ?02                     ; non occorre scroll
 3283  F8A3A1  A4 AE                    ldy     ScnInpRow
 3284  F8A3A3  C4 8E                    cpy     ScnTop
 3285  F8A3A5  D0 19                    bne     ?01
 3286  F8A3A7  A4 B0                    ldy     ScnLstRow
 3287  F8A3A9  C4 90                    cpy     ScnBottom
 3288  F8A3AB  90 13                    bcc     ?01                     ; scroll ok
 3289  F8A3AD  18                       clc
 3290  F8A3AE  90 BF                    bcc     WndGetAddr
 3291  F8A3B0  A6 94            ?00:    ldx     ScnRow
 3292  F8A3B2  E4 90                    cpx     ScnBottom
 3293  F8A3B4  90 0E                    bcc     ?02                     ; non occorre scroll
 3294  F8A3B6  24 75                    bit     ScnScroll
 3295  F8A3B8  10 06                    bpl     ?01
 3296  F8A3BA  A5 8E                    lda     ScnTop
 3297  F8A3BC  85 94                    sta     ScnRow
 3298  F8A3BE  B0 AF                    bcs     WndGetAddr
 3299  F8A3C0  20 A5 A6         ?01:    jsr     WndScroll
 3300  F8A3C3  18                       clc
 3301  F8A3C4  E6 94            ?02:    inc     ScnRow                  ; incrementa riga       
 3302  F8A3C6  80 A7                    bra     WndGetAddr
 3303                           
 3304                           ; funzione CLR (SHIFT+PRTSCN)
 3305  F8A3C8                   ScnClr:
 3306  F8A3C8  24 B2                    bit     ScnFlag                 ; se in modo normale
 3307  F8A3CA  10 89                    bpl     WndClr                  ; cancella schermo
 3308  F8A3CC  80 29                    bra     _InpClr
 3309                           
 3310                           ; funzione HOME
 3311  F8A3CE                   ScnHome:
 3312  F8A3CE  24 B2                    bit     ScnFlag                 ; se in modo normale
 3313  F8A3D0  10 0A                    bpl     ?00                     ; va a prima posizione schermo
 3314  F8A3D2  A6 AE                    ldx     ScnInpRow               ; altrimenti imposta cursore a
 3315  F8A3D4  86 94                    stx     ScnRow                  ; prima posizione riga di input
 3316  F8A3D6  A4 AF                    ldy     ScnInpCol
 3317  F8A3D8  84 95                    sty     ScnCol
 3318  F8A3DA  80 95                    bra     WndGetAddrX
 3319  F8A3DC  A5 A0            ?00:    lda     ScnLstChr
 3320  F8A3DE  C9 05                    cmp     #SCN_HOME
 3321  F8A3E0  D0 81                    bne     WndHome
 3322  F8A3E2  20 7E AA                 jsr     SetMaxWnd
 3323  F8A3E5  4C 63 A3         ?01:    jmp     WndHome
 3324                           
 3325  F8A3E8                   ScnEnd:
 3326  F8A3E8  24 B2                    bit     ScnFlag                 ; se in modo normale
 3327  F8A3EA  10 A0                    bpl     WndEnd                  ; va a altima posizione schermo
 3328  F8A3EC  A6 B0                    ldx     ScnLstRow               ; altrimenti sposta cursore ad ultima
 3329  F8A3EE  86 94                    stx     ScnRow                  ; posizione riga di input
 3330  F8A3F0  A4 B1                    ldy     ScnLstCol
 3331  F8A3F2  84 95                    sty     ScnCol
 3332  F8A3F4  4C 71 A3                 jmp     WndGetAddrX
 3333                           
 3334  F8A3F7                   _InpClr:
 3335  F8A3F7  20 CE A3                 jsr     ScnHome                 ; posiziona cursore a prima posizione riga di input
 3336  F8A3FA  A6 94                    ldx     ScnRow
 3337  F8A3FC  A4 95                    ldy     ScnCol
  Tue Jul 17 11:00:17 2018                                                                                               Page   14




 3338  F8A3FE  20 8E A7                 jsr     ClrRowY                 ; cancella linea input fino alla fine
 3339  F8A401  A6 94                    ldx     ScnRow                  ; cancella resto delle linee fino alla posizione
 3340  F8A403  E4 B0                    cpx     ScnLstRow
 3341  F8A405  B0 0E                    bcs     ?02
 3342  F8A407  E8               ?01:    inx
 3343  F8A408  86 94                    stx     ScnRow
 3344  F8A40A  A4 8F                    ldy     ScnLeft                 ; ultima della riga di input
 3345  F8A40C  20 8E A7                 jsr     ClrRowY
 3346  F8A40F  A6 94                    ldx     ScnRow
 3347  F8A411  E4 B0                    cpx     ScnLstRow
 3348  F8A413  90 F2                    bcc     ?01
 3349  F8A415  A6 AE            ?02:    ldx     ScnInpRow
 3350  F8A417  A4 AF                    ldy     ScnInpCol
 3351  F8A419  86 B0                    stx     ScnLstRow
 3352  F8A41B  84 B1                    sty     ScnLstCol
 3353  F8A41D  80 AF                    bra     ScnHome
 3354                           
 3355                           ;--------------------------------------------------------------------
 3356                           
 3357                           ; inizializza video
 3358  F8A41F                   _ScnInit:
 3359  F8A41F  48                       pha
 3360  F8A420  DA                       phx
 3361  F8A421  5A                       phy
 3362  F8A422  08                       php                     ; salva status
 3363  F8A423  0B                       phd                     ; salva DP
 3364  F8A424  8B                       phb                     ; salva registro DBR
 3365  F8A425                           CPU08                   ; imposta registri a 8 bit
 3366  F8A425  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 3367                                   .LONGA  off
 3368                                   .LONGI  off
 3369                                   .MNLIST
 3370  F8A427  F4 00 01                 pea     #DP01ADDR       ; imposta nuova DP
 3371  F8A42A  2B                       pld
 3372  F8A42B  A2 00                    ldx     #0              ; 
 3373  F8A42D  DA                       phx                     ; imposta DBR = 0
 3374  F8A42E  AB                       plb
 3375  F8A42F  20 08 A3                 jsr     cinit
 3376  F8A432  AB                       plb
 3377  F8A433  2B                       pld
 3378  F8A434  28                       plp                     ; rispristina status
 3379  F8A435  7A                       ply
 3380  F8A436  FA                       plx
 3381  F8A437  68                       pla
 3382  F8A438  18                       clc                     ; no error
 3383  F8A439  60                       rts
 3384  F8A43A                           
 3385                           ; input mode - caratteri di controllo
 3386  F8A43A                   _ScnCtrl:
 3387  F8A43A  A2 80                    ldx     #$80            ; control
 3388  F8A43C  86 B5                    stx     ScnCntrl
 3389  F8A43E  A6 A0                    ldx     ScnLstChr
 3390  F8A440  E0 1E                    cpx     #SCN_PRTSCN
 3391  F8A442  F0 48                    beq     _ScnPut2        ; passa a procedura PRINT
 3392  F8A444  C9 01                    cmp     #KB_SHIFTPRT    ; SHIFT + PRINT SCRN
 3393  F8A446  D0 04                    bne     ?01
 3394  F8A448  A9 0C                    lda     #SCN_CLR        ; cancella schermo
  Tue Jul 17 11:00:17 2018                                                                                               Page   15




 3395  F8A44A  80 40                    bra     _ScnPut2
 3396  F8A44C  A2 00            ?01:    ldx     #0              ; NOTA
 3397  F8A44E  C9 09                    cmp     #KB_SHIFTINS
 3398  F8A450  F0 06                    beq     ?02
 3399  F8A452  A2 00                    ldx     #0              ; NOTA
 3400  F8A454  C9 18                    cmp     #KB_SHIFTDEL
 3401  F8A456  D0 07                    bne     ?04
 3402  F8A458  A9 1E            ?02:    lda     #SCN_PRTSCN     ; simula        
 3403  F8A45A  85 A0                    sta     ScnLstChr
 3404  F8A45C  8A                       txa
 3405  F8A45D  80 2D                    bra     _ScnPut2
 3406  F8A45F  C9 83            ?04:    cmp     #KB_PRTSCN      ; test tasti cursore e speciali
 3407  F8A461  90 2C                    bcc     _ScnWait
 3408  F8A463  C9 91                    cmp     #(KB_BACKSPACE + 1)
 3409  F8A465  B0 28                    bcs     _ScnWait
 3410  F8A467  E9 82                    sbc     #(KB_PRTSCN - 1)
 3411  F8A469  AA                       tax
 3412  F8A46A  BF 3A AF F8              lda     >KBCONV,x       ; converte tasti $83..90 in SCN_*
 3413  F8A46E  80 1C                    bra     _ScnPut2
 3414                           
 3415                           ; input mode - stampa carattere ASCII
 3416  F8A470                   _ScnPut:
 3417  F8A470  64 B5                    stz     ScnCntrl        ; flag carattere ASCII/CONTROL 
 3418  F8A472  A6 A0                    ldx     ScnLstChr
 3419  F8A474  E0 1E                    cpx     #SCN_PRTSCN
 3420  F8A476  F0 14                    beq     _ScnPut2        ; passa a procedura PRINT
 3421  F8A478  C9 20                    cmp     #' '            ; stampa diretta ASCII >= $32
 3422  F8A47A  B0 10                    bcs     _ScnPut2
 3423  F8A47C  C9 09                    cmp     #KB_TAB         ; tasto TAB
 3424  F8A47E  F0 0C                    beq     _ScnPut2
 3425  F8A480  C9 0A                    cmp     #KB_LF          ; tasto CTRL + J (line feed)
 3426  F8A482  F0 08                    beq     _ScnPut2
 3427  F8A484  C9 07                    cmp     #KB_BELL        ; tasto CTRL + G
 3428  F8A486  F0 04                    beq     _ScnPut2
 3429  F8A488  C9 1B                    cmp     #KB_ESC         ; tasto ESC
 3430  F8A48A  D0 03                    bne     _ScnWait
 3431  F8A48C                   _ScnPut2:
 3432  F8A48C  20 C1 AD                 jsr     _ScnCharOut     ; stampa carattere
 3433  F8A48F                   _ScnWait:
 3434  F8A48F  20 3B AD                 jsr     VDCCursOn
 3435  F8A492  A5 62            ?01:    lda     KbdCnt          ; char disponibili nel buffer tastiera ?
 3436  F8A494  F0 FC                    beq     ?01             ; no - attendi tasto
 3437  F8A496  84 8D                    sty     ScnTmpx
 3438  F8A498  20 17 A5                 jsr     _GetBufKey      ; Y -> flag - A -> codice
 3439  F8A49B  AA                       tax                     ; X = codice
 3440  F8A49C  98                       tya                     ; A = flag
 3441  F8A49D  A4 8D                    ldy     ScnTmpx
 3442  F8A49F  0A                       asl     a               ; C = bit 7, N = bit 6
 3443  F8A4A0  30 F0                    bmi     ?01             ; ignora rilascio tasti
 3444  F8A4A2  08                       php                     ; salva C
 3445  F8A4A3  DA                       phx                     ; salva codice
 3446  F8A4A4  20 90 AD                 jsr     VDCCursOff
 3447  F8A4A7  68                       pla                     ; A = codice
 3448  F8A4A8  28                       plp                     ; C = 1 se carattere di controllo
 3449  F8A4A9  B0 8F                    bcs     _ScnCtrl
 3450  F8A4AB  C9 0D                    cmp     #KB_CR
 3451  F8A4AD  D0 C1                    bne     _ScnPut         ; stampa carattere se non CR
  Tue Jul 17 11:00:17 2018                                                                                               Page   16




 3452  F8A4AF  85 A1                    sta     ScnCR
 3453  F8A4B1  20 D4 AB                 jsr     FindEndRow
 3454  F8A4B4  86 6E                    stx     ScnLinTmp
 3455  F8A4B6  20 44 AB                 jsr     WndEscJ2
 3456  F8A4B9  A4 8F                    ldy     ScnLeft
 3457  F8A4BB  A5 96                    lda     ScnRowStart
 3458  F8A4BD  30 12                    bmi     ?04
 3459  F8A4BF  C5 94                    cmp     ScnRow
 3460  F8A4C1  90 0C                    bcc     ?03
 3461  F8A4C3  A4 98                    ldy     ScnColStart
 3462  F8A4C5  C5 6E                    cmp     ScnLinTmp
 3463  F8A4C7  D0 04                    bne     ?02
 3464  F8A4C9  C4 97                    cpy     ScnInput
 3465  F8A4CB  F0 02                    beq     ?03
 3466  F8A4CD  B0 12            ?02:    bcs     CheckCR
 3467  F8A4CF  85 94            ?03:    sta     ScnRow
 3468  F8A4D1  84 95            ?04:    sty     ScnCol
 3469  F8A4D3  80 23                    bra     _ScnLine
 3470  F8A4D5                           
 3471  F8A4D5                   _ScnCharIn:
 3472  F8A4D5  64 B2                    stz     ScnFlag
 3473  F8A4D7  A9 40                    lda     #$40
 3474  F8A4D9  04 74                    tsb     ScnAutoIns              ; bit 6: modo input
 3475  F8A4DB  A5 A1                    lda     ScnCR
 3476  F8A4DD  F0 B0                    beq     _ScnWait
 3477  F8A4DF  10 17                    bpl     _ScnLine
 3478  F8A4E1                   CheckCR:
 3479  F8A4E1  64 A1                    stz     ScnCR
 3480  F8A4E3  A9 0D                    lda     #KB_CR
 3481  F8A4E5  A2 03                    ldx     #TXTD_SCN
 3482  F8A4E7  EC 4F 00                 cpx     !DflTxtIn
 3483  F8A4EA  F0 05                    beq     ?01
 3484  F8A4EC  EC 50 00                 cpx     !DflTxtOut
 3485  F8A4EF  F0 03                    beq     ?02
 3486  F8A4F1  20 C1 AD         ?01:    jsr     _ScnCharOut
 3487  F8A4F4  A9 0D            ?02:    lda     #KB_CR
 3488  F8A4F6  D0 1B                    bne     _ScnLinX
 3489  F8A4F8                                           
 3490  F8A4F8                   _ScnLine:
 3491  F8A4F8  20 6F A3                 jsr     WndGetAddr
 3492  F8A4FB  20 15 AD                 jsr     GetVDCChar
 3493  F8A4FE  85 9F                    sta     ScnCurChr
 3494  F8A500  A4 94                    ldy     ScnRow
 3495  F8A502  C4 6E                    cpy     ScnLinTmp
 3496  F8A504  90 0A                    bcc     ?01
 3497  F8A506  A4 95                    ldy     ScnCol
 3498  F8A508  C4 97                    cpy     ScnInput
 3499  F8A50A  90 04                    bcc     ?01
 3500  F8A50C  66 A1                    ror     ScnCR
 3501  F8A50E  30 03                    bmi     _ScnLinX
 3502  F8A510  20 20 AC         ?01:    jsr     MoveRight
 3503                           
 3504  F8A513                   _ScnLinX:
 3505  F8A513  85 9F                    sta     ScnCurChr
 3506  F8A515  18                       clc
 3507  F8A516  60                       rts
 3508                           
  Tue Jul 17 11:00:17 2018                                                                                               Page   17




 3509                           ;--------------------------------------------------------------------
 3510                           
 3511                           ; NOTA: va chiamata con DP impostato su DIRP01
 3512  F8A517                   _GetBufKey:
 3513  F8A517  08                       php
 3514  F8A518  78                       sei                             ; disabilita interrupt
 3515  F8A519  A6 61                    ldx     KbdIHead                ; puntatore testa buffer
 3516  F8A51B  B4 00                    ldy     KbdBuf,x                ; flag
 3517  F8A51D  E8                       inx
 3518  F8A51E  B5 00                    lda     KbdBuf,x                ; codice tasto
 3519  F8A520  E8                       inx
 3520  F8A521  E0 60                    cpx     #KBDBUFLEN
 3521  F8A523  90 02                    bcc     ?01
 3522  F8A525  A2 00                    ldx     #0
 3523  F8A527  86 61            ?01:    stx     KbdIHead
 3524  F8A529  C6 62                    dec     KbdCnt
 3525  F8A52B  C6 62                    dec     KbdCnt  
 3526  F8A52D  28                       plp
 3527  F8A52E  60                       rts
 3528                           
 3529                           
 3530  F8A52F                   ScnProcPrnt:
 3531  F8A52F  60                       rts
 3532  F8A530                           
 3533                           ; processa sequenza SCN_COL <A = FOREGROUND COLOR>
 3534  F8A530                   ScnProcCol:
 3535  F8A530  3A                       dec     a               ; color = color - 1
 3536  F8A531  C9 10                    cmp     #$10            ; test default
 3537  F8A533  90 02                    bcc     ?02             ; set color
 3538  F8A535  A5 A9                    lda     ScnDefCol       ; imposta foreground di default
 3539  F8A537  85 99            ?02:    sta     ScnSaveX        ; nuovo colore
 3540  F8A539  A5 92                    lda     ScnAttr
 3541  F8A53B  29 F0                    and     #$F0
 3542  F8A53D  05 99                    ora     ScnSaveX
 3543  F8A53F  85 92                    sta     ScnAttr
 3544  F8A541  60                       rts 
 3545                           
 3546                           ; processa sequenza SCN_BKGCOL <A = BACKGROUND COLOR>
 3547  F8A542                   ScnProcBkgCol:
 3548  F8A542  3A                       dec     a               ; color = color - 1
 3549  F8A543  C9 10                    cmp     #$10            ; test default
 3550  F8A545  90 02                    bcc     ?02             ; set color
 3551  F8A547  A5 AD                    lda     ScnDefBkgCol    ; imposta background di default
 3552  F8A549  85 99            ?02:    sta     ScnSaveX        ; nuovo colore
 3553  F8A54B  A2 1A                    ldx     #$1A            ; attuale bkg color
 3554  F8A54D  20 1F AE                 jsr     GetVDCReg
 3555  F8A550  29 F0                    and     #$F0            ; maschera colore sfondo
 3556  F8A552  05 99                    ora     ScnSaveX        ; imposta nuovo colore  
 3557  F8A554  4C 11 AE                 jmp     SetVDCReg
 3558                           
 3559                           ; processa sequenza SCN_ESC <A = ESC CODE>
 3560  F8A557                   ScnProcEsc:
 3561  F8A557  64 9F                    stz     ScnCurChr       ; invalida byte corrente
 3562  F8A559  C9 1B                    cmp     #SCN_ESC
 3563  F8A55B  F0 2C                    beq     WndEscO         ; ESC + ESC annulla ESC
 3564  F8A55D  AA               ?01:    tax
 3565  F8A55E  30 39                    bmi     _RTS0
  Tue Jul 17 11:00:17 2018                                                                                               Page   18




 3566  F8A560  C9 40                    cmp     #'@'
 3567  F8A562  F0 0B                    beq     ?03
 3568  F8A564  C9 61                    cmp     #'a'
 3569  F8A566  90 31                    bcc     _RTS0
 3570  F8A568  C9 7B                    cmp     #('z' + 1)
 3571  F8A56A  B0 2D                    bcs     _RTS0
 3572  F8A56C  38                       sec
 3573  F8A56D  E9 20                    sbc     #$20
 3574  F8A56F  38               ?03:    sec
 3575  F8A570  E9 40                    sbc     #$40
 3576  F8A572  C9 1B                    cmp     #$1B
 3577  F8A574  B0 23                    bcs     _RTS0
 3578  F8A576  0A                       asl     a
 3579  F8A577  AA                       tax
 3580  F8A578  7C 04 AF                 jmp     (ESCVCTRS,x)
 3581                           
 3582                           ; CR o SHIFT CR
 3583  F8A57B                   ScnOutCR:
 3584  F8A57B  20 D4 AB                 jsr     FindEndRow
 3585  F8A57E  E8                       inx
 3586  F8A57F  20 16 AB                 jsr     TabSetupX
 3587  F8A582  A4 8F                    ldy     ScnLeft
 3588  F8A584  84 95                    sty     ScnCol
 3589  F8A586  20 94 A3                 jsr     WndNewLine
 3590  F8A589                           
 3591                           ; ESC-O
 3592  F8A589                   WndEscO:
 3593  F8A589  A5 92                    lda     ScnAttr         ; azzera reverse, underline, blink
 3594  F8A58B  24 6D                    bit     <VBBRam
 3595  F8A58D  10 04                    bpl     ?01
 3596  F8A58F  29 1F                    and     #$1F
 3597  F8A591  80 02                    bra     ?02
 3598  F8A593  29 8F            ?01:    and     #$8F
 3599  F8A595  85 92            ?02:    sta     ScnAttr
 3600  F8A597  64 73                    stz     ScnInsert
 3601  F8A599  60               _RTS0:  rts
 3602  F8A59A                           
 3603  F8A59A                   ScnOutChr:
 3604  F8A59A  24 B2                    bit     ScnFlag         ; ignora tasto PAUSE 
 3605  F8A59C  30 0A                    bmi     ?02             ; in modo line input
 3606  F8A59E  24 74                    bit     ScnAutoIns      ; ignora tasto PAUSE 
 3607  F8A5A0  70 06                    bvs     ?02             ; in modo full editor
 3608  F8A5A2  A9 10            ?01:    lda     #PAUSETGB       ; attesa durante PAUSE                  
 3609  F8A5A4  24 65                    bit     KbdToggle
 3610  F8A5A6  D0 FA                    bne     ?01
 3611  F8A5A8  64 A1            ?02:    stz     ScnCR
 3612  F8A5AA  A5 9F                    lda     ScnCurChr       ; byte da inviare a schermo
 3613  F8A5AC  A4 95                    ldy     ScnCol          ; colonna corrente
 3614  F8A5AE  A6 A0                    ldx     ScnLstChr       ; se ultimo byte = NULL
 3615  F8A5B0  F0 24                    beq     ?10             ; salta test sequenza escape
 3616  F8A5B2  E0 1B                    cpx     #SCN_ESC        ; se byte < SCN_ESC
 3617  F8A5B4  90 20                    bcc     ?10             ; salta test sequenza escape
 3618  F8A5B6  E0 1F                    cpx     #SCN_PASS       ; se byte < SCN_PASS
 3619  F8A5B8  F0 04                    beq     ?04             ; byte = SCN_PASS
 3620  F8A5BA  90 0E                    bcc     ?06             ; byte < SCN_PASS esegue sequenza escape
 3621  F8A5BC  B0 18                    bcs     ?10             ; byte > SCN_PASS salta test sequenza escape
 3622  F8A5BE  24 B2            ?04:    bit     ScnFlag         ; ignora sequenze SCN_PASS
  Tue Jul 17 11:00:17 2018                                                                                               Page   19




 3623  F8A5C0  30 14                    bmi     ?10             ; in modo input line    
 3624  F8A5C2  24 74                    bit     ScnAutoIns      ; ignora sequenze SCN_PASS
 3625  F8A5C4  70 10                    bvs     ?10             ; in modo full editor
 3626  F8A5C6  64 9F                    stz     ScnCurChr       ; invalida byte corrente
 3627  F8A5C8  80 3D                    bra     ScnOut          ; stampa codice 00..1F come ASCII
 3628  F8A5CA  EB               ?06:    xba                     ; salva byte in B
 3629  F8A5CB  8A                       txa
 3630  F8A5CC  E9 1A                    sbc     #(SCN_ESC - 1)  ; qui C = 0 !
 3631  F8A5CE  0A                       asl     a
 3632  F8A5CF  AA                       tax                     ; indice funzione sequenza escape
 3633  F8A5D0  EB                       xba                     ; ripristina A
 3634  F8A5D1  64 9F                    stz     ScnCurChr       ; invalida byte corrente
 3635  F8A5D3  7C D8 AE                 jmp     (SCNESCSEQ,x)   ; funzione di escape
 3636  F8A5D6  C9 20            ?10:    cmp     #' '            ; byte attuale ASCII ?
 3637  F8A5D8  B0 2D                    bcs     ScnOut          ; si - output a schermo
 3638  F8A5DA  C9 1B                    cmp     #SCN_ESC        ; codice escape ?
 3639  F8A5DC  B0 22                    bcs     ?16             ; si - esce
 3640  F8A5DE  C9 13                    cmp     #SCN_ALTFNT
 3641  F8A5E0  90 1F                    bcc     ?20             ; codice controllo
 3642  F8A5E2  E9 13                    sbc     #SCN_ALTFNT     ; attributo
 3643  F8A5E4  C9 04                    cmp     #$04            ; attributo OFF -> C = 1
 3644  F8A5E6  29 03                    and     #$03
 3645  F8A5E8  AA                       tax
 3646  F8A5E9  24 6D                    bit     <VBBRam
 3647  F8A5EB  10 08                    bpl     ?10a
 3648  F8A5ED                           
 3649                                   ; no alternate font attribute per video board
 3650                                   ; blink e underline invertiti
 3651  F8A5ED  BF D4 AE F8              lda     >MSKROW2,x
 3652  F8A5F1  F0 0D                    beq     ?16             ; ignora se A = $00
 3653  F8A5F3  D0 04                    bne     ?10b
 3654  F8A5F5  BF CC AE F8      ?10a:   lda     >MSKROW,x
 3655  F8A5F9  B0 03            ?10b:   bcs     ?12             ; si
 3656  F8A5FB  04 92                    tsb     ScnAttr         ; attributo ON
 3657  F8A5FD  60                       rts
 3658  F8A5FE  14 92            ?12:    trb     ScnAttr         ; attributo OFF
 3659  F8A600  60               ?16:    rts     
 3660  F8A601  3A               ?20:    dec     a               ; codice controllo
 3661  F8A602  0A                       asl     a
 3662  F8A603  AA                       tax                     ; indice funzione controllo
 3663  F8A604  7C E0 AE                 jmp     (CTRLVCTRS,x)
 3664  F8A607                           
 3665                           ; Output a schermo e posizionamento cursore
 3666  F8A607                   ScnOut:
 3667  F8A607  A6 73            ?01:    ldx     ScnInsert
 3668  F8A609  F0 02                    beq     ?02
 3669  F8A60B  C6 73                    dec     ScnInsert
 3670  F8A60D  24 74            ?02:    bit     ScnAutoIns
 3671  F8A60F  50 25                    bvc     ?10                     ; modo out - stampa carattere
 3672  F8A611  10 07                    bpl     ?03                     ; no auto insert                        
 3673  F8A613  48                       pha
 3674  F8A614  20 8C A9                 jsr     WndMakeSpace            ; solo se in modo input
 3675  F8A617  64 73                    stz     ScnInsert
 3676  F8A619  68                       pla
 3677  F8A61A  24 B2            ?03:    bit     ScnFlag
 3678  F8A61C  10 18                    bpl     ?10                     ; modo input normale
 3679  F8A61E  A6 94                    ldx     ScnRow
  Tue Jul 17 11:00:17 2018                                                                                               Page   20




 3680  F8A620  A4 95                    ldy     ScnCol                  ; colonna in ultima posizione ?
 3681  F8A622  C4 91                    cpy     ScnRight
 3682  F8A624  90 10                    bcc     ?10                     ; no, stampa car.
 3683  F8A626  24 B2                    bit     ScnFlag
 3684  F8A628  70 0A                    bvs     ?06                     ; input riga singola - non stampa       
 3685  F8A62A  E4 90                    cpx     ScnBottom               ; ultima riga schermo ?
 3686  F8A62C  90 08                    bcc     ?10                     ; no - stampa car.
 3687  F8A62E  A6 AE                    ldx     ScnInpRow
 3688  F8A630  E4 8E                    cpx     ScnTop
 3689  F8A632  D0 02                    bne     ?10
 3690  F8A634  18               ?06:    clc
 3691  F8A635  60                       rts
 3692  F8A636  20 E0 AC         ?10:    jsr     PutChar                 ; stampa carattere
 3693  F8A639  24 B2                    bit     ScnFlag
 3694  F8A63B  10 1A                    bpl     CheckCurs
 3695  F8A63D  A6 94                    ldx     ScnRow
 3696  F8A63F  A4 95                    ldy     ScnCol
 3697  F8A641  E4 B0                    cpx     ScnLstRow
 3698  F8A643  D0 02                    bne     ?11
 3699  F8A645  C4 B1                    cpy     ScnLstCol
 3700  F8A647  08               ?11:    php
 3701  F8A648  20 57 A6                 jsr     CheckCurs
 3702  F8A64B  28                       plp
 3703  F8A64C  D0 08                    bne     ?15
 3704  F8A64E  A6 94                    ldx     ScnRow                  ; aggiorna ultima posizione cursore
 3705  F8A650  A4 95                    ldy     ScnCol
 3706  F8A652  86 B0                    stx     ScnLstRow
 3707  F8A654  84 B1                    sty     ScnLstCol
 3708  F8A656  60               ?15:    rts
 3709  F8A657                           
 3710  F8A657                   CheckCurs:
 3711  F8A657  C4 91                    cpy     ScnRight
 3712  F8A659  90 0A                    bcc     ?01                     ; SncCol < ScnRight
 3713  F8A65B  A6 94                    ldx     ScnRow
 3714  F8A65D  E4 90                    cpx     ScnBottom
 3715  F8A65F  90 04                    bcc     ?01                     ; ScnRow < ScnBottom
 3716  F8A661  24 75                    bit     ScnScroll
 3717  F8A663  30 16                    bmi     ?03
 3718  F8A665  20 6F A3         ?01:    jsr     WndGetAddr
 3719  F8A668  20 20 AC                 jsr     MoveRight
 3720  F8A66B  90 0E                    bcc     ?03
 3721  F8A66D  20 07 AB                 jsr     TabCheck
 3722  F8A670  B0 08                    bcs     ?02
 3723  F8A672  38                       sec
 3724  F8A673  24 75                    bit     ScnScroll
 3725  F8A675  70 04                    bvs     ?03
 3726  F8A677  20 7C A6                 jsr     InsertRow
 3727  F8A67A  18               ?02:    clc
 3728  F8A67B  60               ?03:    rts
 3729                           
 3730                           ; Inserisce nuova riga
 3731  F8A67C                   InsertRow:
 3732  F8A67C  A6 96                    ldx     ScnRowStart
 3733  F8A67E  30 06                    bmi     ?01
 3734  F8A680  E4 94                    cpx     ScnRow
 3735  F8A682  90 02                    bcc     ?01
 3736  F8A684  E6 96                    inc     ScnRowStart
  Tue Jul 17 11:00:17 2018                                                                                               Page   21




 3737  F8A686  A6 90            ?01:    ldx     ScnBottom
 3738  F8A688  20 71 A3         ?02:    jsr     WndGetAddrX
 3739  F8A68B  A4 8F                    ldy     ScnLeft
 3740  F8A68D  E4 94                    cpx     ScnRow
 3741  F8A68F  F0 0E                    beq     ?03
 3742  F8A691  CA                       dex
 3743  F8A692  20 09 AB                 jsr     TabCheckX
 3744  F8A695  E8                       inx
 3745  F8A696  20 14 AB                 jsr     TabSetup2
 3746  F8A699  CA                       dex
 3747  F8A69A  20 DD A6                 jsr     MoveRow
 3748  F8A69D  80 E9                    bra     ?02
 3749  F8A69F  20 89 A7         ?03:    jsr     ClrRow
 3750  F8A6A2  4C 22 AB                 jmp     _Tab2Check
 3751  F8A6A5                           
 3752                           ; Scrolla finestra
 3753  F8A6A5                   WndScroll:
 3754  F8A6A5  A6 8E                    ldx     ScnTop
 3755  F8A6A7  E8               PP01:   inx
 3756  F8A6A8  20 09 AB                 jsr     TabCheckX
 3757  F8A6AB  90 0A                    bcc     PP02
 3758  F8A6AD  E4 90                    cpx     ScnBottom
 3759  F8A6AF  90 F6                    bcc     PP01
 3760  F8A6B1  A6 8E                    ldx     ScnTop
 3761  F8A6B3  E8                       inx
 3762  F8A6B4  20 16 AB                 jsr     TabSetupX
 3763  F8A6B7  C6 AE            PP02:   dec     ScnInpRow               ; update riga di start input line
 3764  F8A6B9  C6 94                    dec     ScnRow
 3765  F8A6BB  24 96                    bit     ScnRowStart
 3766  F8A6BD  30 02                    bmi     PP03
 3767  F8A6BF  C6 96                    dec     ScnRowStart
 3768  F8A6C1  A6 8E            PP03:   ldx     ScnTop
 3769  F8A6C3  E4 9D                    cpx     ScnSaveRow
 3770  F8A6C5  B0 02                    bcs     PP04
 3771  F8A6C7  C6 9D                    dec     ScnSaveRow
 3772  F8A6C9  20 72 A7         PP04:   jsr     DeleteRow
 3773  F8A6CC  A6 8E                    ldx     ScnTop
 3774  F8A6CE  20 09 AB                 jsr     TabCheckX
 3775  F8A6D1  08                       php
 3776  F8A6D2  20 16 AB                 jsr     TabSetupX
 3777  F8A6D5  28                       plp
 3778  F8A6D6  90 04                    bcc     PP05
 3779  F8A6D8  24 75                    bit     ScnScroll
 3780  F8A6DA  30 C9                    bmi     WndScroll
 3781  F8A6DC  60               PP05:   rts
 3782                           
 3783                           ; Copia riga corrente nella riga X
 3784  F8A6DD                   MoveRow:
 3785  F8A6DD  86 99                    stx     ScnSaveX
 3786  F8A6DF  24 6D                    bit     <VBBRam
 3787  F8A6E1  10 2E                    bpl     ?10                     ; VDC
 3788  F8A6E3  BF 9A AE F8              lda     >SCRNADDRL,x            ; forza ABS LONG
 3789  F8A6E7  85 A6                    sta     ScnPtr1
 3790  F8A6E9  85 AA                    sta     ScnPtr2
 3791  F8A6EB  BF B3 AE F8              lda     >SCRNADDRH,x
 3792  F8A6EF  85 A7                    sta     ScnPtr1+1
 3793  F8A6F1  29 07                    and     #$07
  Tue Jul 17 11:00:17 2018                                                                                               Page   22




 3794  F8A6F3  05 70                    ora     ScnAttBase
 3795  F8A6F5  85 AB                    sta     ScnPtr2+1
 3796  F8A6F7  AE 0C FC                 ldx     CREMEOFF                ; salva bit corrente
 3797  F8A6FA  DA                       phx
 3798  F8A6FB  8D 0D FC                 sta     !CREMEON                ; abilita memoria video
 3799  F8A6FE  B7 A6            ?04:    lda     [ScnPtr1],y
 3800  F8A700  97 86                    sta     [ScnPtr],y
 3801  F8A702  B7 AA                    lda     [ScnPtr2],y
 3802  F8A704  97 8A                    sta     [ScnAtPtr],y
 3803  F8A706  C4 91                    cpy     ScnRight
 3804  F8A708  C8                       iny
 3805  F8A709  90 F3                    bcc     ?04
 3806  F8A70B  FA                       plx
 3807  F8A70C  9D 0C FC                 sta     !CREMEOFF,x             ; ripristina bit corrente
 3808  F8A70F  80 5E                    bra     ?20
 3809  F8A711  84 9A            ?10:    sty     ScnSaveY
 3810  F8A713  A2 18                    ldx     #$18
 3811  F8A715  20 1F AE                 jsr     GetVDCReg
 3812  F8A718  09 80                    ora     #$80
 3813  F8A71A  20 11 AE                 jsr     SetVDCReg
 3814  F8A71D  20 FD AD                 jsr     SetVRam
 3815  F8A720  A6 99                    ldx     ScnSaveX
 3816  F8A722  BF 9A AE F8              lda     >SCRNADDRL,x            ; forza ABS LONG
 3817  F8A726  85 9B                    sta     ScnTmpL
 3818  F8A728  BF B3 AE F8              lda     >SCRNADDRH,x
 3819  F8A72C  05 6F                    ora     ScnChBase
 3820  F8A72E  85 9C                    sta     ScnTmpH
 3821  F8A730  A2 20                    ldx     #$20
 3822  F8A732  18                       clc
 3823  F8A733  98                       tya
 3824  F8A734  65 9B                    adc     ScnTmpL
 3825  F8A736  85 9B                    sta     ScnTmpL
 3826  F8A738  A9 00                    lda     #$00
 3827  F8A73A  65 9C                    adc     ScnTmpH
 3828  F8A73C  85 9C                    sta     ScnTmpH
 3829  F8A73E  20 11 AE                 jsr     SetVDCReg
 3830  F8A741  E8                       inx
 3831  F8A742  A5 9B                    lda     ScnTmpL
 3832  F8A744  20 11 AE                 jsr     SetVDCReg
 3833  F8A747  A5 91                    lda     ScnRight
 3834  F8A749  1A                       inc     a
 3835  F8A74A  38                       sec
 3836  F8A74B  E5 9A                    sbc     ScnSaveY
 3837  F8A74D  85 9A                    sta     ScnSaveY
 3838  F8A74F  A2 1E                    ldx     #$1E
 3839  F8A751  20 11 AE                 jsr     SetVDCReg
 3840  F8A754  20 F0 AD                 jsr     SetARam
 3841  F8A757  A2 20                    ldx     #$20
 3842  F8A759  A5 9C                    lda     ScnTmpH
 3843  F8A75B  29 07                    and     #$07
 3844  F8A75D  05 70                    ora     ScnAttBase
 3845  F8A75F  20 11 AE                 jsr     SetVDCReg
 3846  F8A762  E8                       inx
 3847  F8A763  A5 9B                    lda     ScnTmpL
 3848  F8A765  20 11 AE                 jsr     SetVDCReg
 3849  F8A768  A5 9A                    lda     ScnSaveY
 3850  F8A76A  A2 1E                    ldx     #$1E
  Tue Jul 17 11:00:17 2018                                                                                               Page   23




 3851  F8A76C  20 11 AE                 jsr     SetVDCReg
 3852  F8A76F  A6 99            ?20:    ldx     ScnSaveX
 3853  F8A771  60                       rts
 3854                           
 3855                           ; Elimina riga X
 3856  F8A772                   DeleteRow:
 3857  F8A772  20 71 A3                 jsr     WndGetAddrX
 3858  F8A775  A4 8F                    ldy     ScnLeft
 3859  F8A777  E4 90                    cpx     ScnBottom
 3860  F8A779  B0 0E                    bcs     ClrRow
 3861  F8A77B  E8                       inx
 3862  F8A77C  20 09 AB                 jsr     TabCheckX
 3863  F8A77F  CA                       dex
 3864  F8A780  20 14 AB                 jsr     TabSetup2
 3865  F8A783  E8                       inx
 3866  F8A784  20 DD A6                 jsr     MoveRow
 3867  F8A787  80 E9                    bra     DeleteRow
 3868  F8A789                           
 3869                           ; Cancella linea X
 3870  F8A789                   ClrRow:
 3871  F8A789  A4 8F                    ldy     ScnLeft
 3872  F8A78B  20 16 AB                 jsr     TabSetupX
 3873  F8A78E                           
 3874                           ; Cancella linea X a partire da colonna Y
 3875  F8A78E                   ClrRowY:
 3876  F8A78E  20 71 A3                 jsr     WndGetAddrX
 3877  F8A791  86 99                    stx     ScnSaveX
 3878  F8A793  24 6D                    bit     <VBBRam
 3879  F8A795  10 1E                    bpl     ?00                     ; VDC
 3880  F8A797  AE 0C FC                 ldx     CREMEOFF                ; salva bit corrente
 3881  F8A79A  DA                       phx
 3882  F8A79B  8D 0D FC                 sta     !CREMEON                ; abilita memoria video
 3883  F8A79E  88                       dey
 3884  F8A79F  C8               ?00a:   iny     
 3885  F8A7A0  A9 20                    lda     #' '
 3886  F8A7A2  97 86                    sta     [ScnPtr],y
 3887  F8A7A4  A5 92                    lda     ScnAttr
 3888  F8A7A6  29 1F                    and     #$1F
 3889  F8A7A8  97 8A                    sta     [ScnAtPtr],y
 3890  F8A7AA  C4 91                    cpy     ScnRight
 3891  F8A7AC  D0 F1                    bne     ?00a
 3892  F8A7AE  FA                       plx
 3893  F8A7AF  9D 0C FC                 sta     !CREMEOFF,x             ; ripristina bit corrente
 3894  F8A7B2  A6 99                    ldx     ScnSaveX
 3895  F8A7B4  60                       rts
 3896  F8A7B5  84 9A            ?00:    sty     ScnSaveY
 3897  F8A7B7  A2 18                    ldx     #$18
 3898  F8A7B9  20 1F AE                 jsr     GetVDCReg
 3899  F8A7BC  29 7F                    and     #$7F
 3900  F8A7BE  20 11 AE                 jsr     SetVDCReg
 3901  F8A7C1  A2 12                    ldx     #$12
 3902  F8A7C3  18                       clc
 3903  F8A7C4  98                       tya
 3904  F8A7C5  65 86                    adc     ScnPtr
 3905  F8A7C7  85 9B                    sta     ScnTmpL
 3906  F8A7C9  A9 00                    lda     #0
 3907  F8A7CB  65 87                    adc     ScnPtr+1
  Tue Jul 17 11:00:17 2018                                                                                               Page   24




 3908  F8A7CD  85 9C                    sta     ScnTmpH
 3909  F8A7CF  20 11 AE                 jsr     SetVDCReg
 3910  F8A7D2  E8                       inx
 3911  F8A7D3  A5 9B                    lda     ScnTmpL
 3912  F8A7D5  20 11 AE                 jsr     SetVDCReg
 3913  F8A7D8  A9 20                    lda     #' '
 3914  F8A7DA  20 0F AE                 jsr     SetVDCReg31
 3915  F8A7DD  38                       sec
 3916  F8A7DE  A5 91                    lda     ScnRight
 3917  F8A7E0  E5 9A                    sbc     ScnSaveY
 3918  F8A7E2  48                       pha
 3919  F8A7E3  F0 10                    beq     ?01
 3920  F8A7E5  AA                       tax
 3921  F8A7E6  38                       sec
 3922  F8A7E7  65 9B                    adc     ScnTmpL
 3923  F8A7E9  85 9B                    sta     ScnTmpL
 3924  F8A7EB  A9 00                    lda     #$00
 3925  F8A7ED  65 9C                    adc     ScnTmpH
 3926  F8A7EF  85 9C                    sta     ScnTmpH
 3927  F8A7F1  8A                       txa
 3928  F8A7F2  20 24 A8                 jsr     CopyVDC
 3929  F8A7F5  A2 12            ?01:    ldx     #$12
 3930  F8A7F7  18                       clc
 3931  F8A7F8  98                       tya
 3932  F8A7F9  65 8A                    adc     ScnAtPtr
 3933  F8A7FB  48                       pha
 3934  F8A7FC  A9 00                    lda     #0
 3935  F8A7FE  65 8B                    adc     ScnAtPtr+1
 3936  F8A800  20 11 AE                 jsr     SetVDCReg
 3937  F8A803  E8                       inx
 3938  F8A804  68                       pla
 3939  F8A805  20 11 AE                 jsr     SetVDCReg
 3940  F8A808  A5 9C                    lda     ScnTmpH
 3941  F8A80A  29 07                    and     #$07
 3942  F8A80C  05 70                    ora     ScnAttBase
 3943  F8A80E  85 9C                    sta     ScnTmpH
 3944  F8A810  A5 92                    lda     ScnAttr
 3945  F8A812  29 8F                    and     #$8F
 3946  F8A814  20 0F AE                 jsr     SetVDCReg31
 3947  F8A817  68                       pla
 3948  F8A818  F0 03                    beq     ?02
 3949  F8A81A  20 24 A8                 jsr     CopyVDC
 3950  F8A81D  A6 99            ?02:    ldx     ScnSaveX
 3951  F8A81F  A4 91                    ldy     ScnRight
 3952  F8A821  60                       rts
 3953  F8A822                           
 3954                           ; Copia in video ram 1 byte
 3955  F8A822                   CopyVDC1:
 3956  F8A822  A9 01                    lda     #$01
 3957  F8A824                           
 3958                           ; Copia in video ram A bytes
 3959  F8A824                   CopyVDC:        
 3960  F8A824  A2 1E                    ldx     #$1E
 3961  F8A826  20 11 AE                 jsr     SetVDCReg
 3962  F8A829  2C 4E FD         ?01:    bit     VDCStatus
 3963  F8A82C  10 FB                    bpl     ?01
 3964  F8A82E  A2 12                    ldx     #$12
  Tue Jul 17 11:00:17 2018                                                                                               Page   25




 3965  F8A830  20 1F AE                 jsr     GetVDCReg
 3966  F8A833  C5 9C                    cmp     ScnTmpH
 3967  F8A835  90 EB                    bcc     CopyVDC1
 3968  F8A837  A2 13                    ldx     #$13
 3969  F8A839  20 1F AE                 jsr     GetVDCReg
 3970  F8A83C  C5 9B                    cmp     ScnTmpL
 3971  F8A83E  90 E2                    bcc     CopyVDC1
 3972  F8A840  60                       rts
 3973                           
 3974                           
 3975                           ;--------------------------------------------------------------------
 3976                           
 3977                           ; tasto insert
 3978  F8A841                   KeybInsert:
 3979  F8A841  24 74                    bit     ScnAutoIns
 3980  F8A843  30 18                    bmi     RTS11
 3981  F8A845  4C 8C A9                 jmp     WndMakeSpace
 3982  F8A848                                   
 3983                           ; Muove cursore a destra
 3984  F8A848                   CsrRight:
 3985  F8A848  24 B2                    bit     ScnFlag
 3986  F8A84A  10 0C                    bpl     ?00                     ; modo normale
 3987  F8A84C  A4 95                    ldy     ScnCol                  ; test: cursore ad ultima posizione ?
 3988  F8A84E  C4 B1                    cpy     ScnLstCol
 3989  F8A850  90 06                    bcc     ?00                     ; no
 3990  F8A852  A4 94                    ldy     ScnRow
 3991  F8A854  C4 B0                    cpy     ScnLstRow
 3992  F8A856  B0 05                    bcs     RTS11                   ; si
 3993  F8A858  20 20 AC         ?00:    jsr     MoveRight
 3994  F8A85B  B0 08                    bcs     _CsrCheck
 3995  F8A85D                   RTS11:
 3996  F8A85D  60                       rts
 3997  F8A85E                           
 3998                           ; Muove cursore in basso
 3999  F8A85E                   CsrDown:
 4000  F8A85E  24 B2                    bit     ScnFlag                 ; se in modo input
 4001  F8A860  30 2A                    bmi     CsrDown2
 4002  F8A862  20 94 A3                 jsr     WndNewLine
 4003  F8A865                           
 4004  F8A865                   _CsrCheck:
 4005  F8A865  20 07 AB                 jsr     TabCheck
 4006  F8A868  B0 03                    bcs     _CsrClc
 4007  F8A86A  38                       sec
 4008  F8A86B  66 96                    ror     ScnRowStart
 4009  F8A86D                   _CsrClc:
 4010  F8A86D  18                       clc
 4011  F8A86E                   _CsrRts:
 4012  F8A86E  60                       rts
 4013  F8A86F                           
 4014                           ; Muove cursore in alto
 4015  F8A86F                   CsrUp:  
 4016  F8A86F  24 B2                    bit     ScnFlag                 ; se in modo input
 4017  F8A871  30 35                    bmi     CsrUp2
 4018  F8A873  A6 8E                    ldx     ScnTop
 4019  F8A875  E4 94                    cpx     ScnRow
 4020  F8A877  B0 F5                    bcs     _CsrRts
 4021  F8A879                   _CsrSet:        
  Tue Jul 17 11:00:17 2018                                                                                               Page   26




 4022  F8A879  20 65 A8                 jsr     _CsrCheck
 4023  F8A87C                   _CsrSet2:       
 4024  F8A87C  C6 94                    dec     ScnRow
 4025  F8A87E  4C 6F A3                 jmp     WndGetAddr
 4026  F8A881                           
 4027                           ; Muove cursore a sinistra
 4028  F8A881                   CsrLeft:
 4029  F8A881  20 51 AC                 jsr     MoveLeft
 4030  F8A884  B0 E8                    bcs     _CsrRts
 4031  F8A886  D0 E5                    bne     _CsrClc
 4032  F8A888  E6 94                    inc     ScnRow
 4033  F8A88A  D0 ED                    bne     _CsrSet
 4034                           
 4035                           ; CURSORE DOWN modo input
 4036  F8A88C                   CsrDown2:
 4037  F8A88C  A6 94                    ldx     ScnRow
 4038  F8A88E  E4 B0                    cpx     ScnLstRow
 4039  F8A890  B0 DC                    bcs     _CsrRts
 4040  F8A892  E6 94                    inc     ScnRow
 4041  F8A894  A4 95                    ldy     ScnCol
 4042  F8A896  A6 94                    ldx     ScnRow
 4043  F8A898  E4 B0                    cpx     ScnLstRow
 4044  F8A89A  90 06                    bcc     _Check4
 4045  F8A89C  C4 B1                    cpy     ScnLstCol
 4046  F8A89E  90 02                    bcc     _Check4
 4047  F8A8A0  A4 B1                    ldy     ScnLstCol
 4048  F8A8A2                           
 4049  F8A8A2                   _Check4:
 4050  F8A8A2  84 95                    sty     ScnCol
 4051  F8A8A4  18                       clc     
 4052  F8A8A5  4C 6F A3                 jmp     WndGetAddr
 4053  F8A8A8                           
 4054                           ; CURSORE UP modo input
 4055  F8A8A8                   CsrUp2:
 4056  F8A8A8  A6 AE                    ldx     ScnInpRow
 4057  F8A8AA  E4 94                    cpx     ScnRow
 4058  F8A8AC  B0 C0                    bcs     _CsrRts
 4059  F8A8AE  C6 94                    dec     ScnRow
 4060  F8A8B0  A4 95                    ldy     ScnCol
 4061  F8A8B2  A6 AE                    ldx     ScnInpRow
 4062  F8A8B4  E4 94                    cpx     ScnRow
 4063  F8A8B6  90 EA                    bcc     _Check4
 4064  F8A8B8  C4 AF                    cpy     ScnInpCol
 4065  F8A8BA  B0 E6                    bcs     _Check4
 4066  F8A8BC  A4 AF                    ldy     ScnInpCol
 4067  F8A8BE  80 E2                    bra     _Check4
 4068  F8A8C0                           
 4069                           ; TAB
 4070  F8A8C0                   CsrTab:
 4071  F8A8C0  24 B2                    bit     ScnFlag                 ; in modo input line
 4072  F8A8C2  30 12                    bmi     ?04                     ; non esegue nulla
 4073  F8A8C4  A4 95                    ldy     ScnCol
 4074  F8A8C6  C8               ?01:    iny
 4075  F8A8C7  C4 91                    cpy     ScnRight
 4076  F8A8C9  B0 07                    bcs     ?02
 4077  F8A8CB  20 F4 A8                 jsr     FindTab
 4078  F8A8CE  F0 F6                    beq     ?01
  Tue Jul 17 11:00:17 2018                                                                                               Page   27




 4079  F8A8D0  D0 02                    bne     ?03
 4080  F8A8D2  A4 91            ?02:    ldy     ScnRight
 4081  F8A8D4  84 95            ?03:    sty     ScnCol
 4082  F8A8D6  60               ?04:    rts
 4083                           
 4084  F8A8D7                   CsrShTab:
 4085  F8A8D7  24 B2                    bit     ScnFlag                 ; in modo input line
 4086  F8A8D9  30 0E                    bmi     ?04                     ; non esegue nulla
 4087  F8A8DB  A4 95                    ldy     ScnCol
 4088  F8A8DD  C4 8F            ?01:    cpy     ScnLeft
 4089  F8A8DF  F0 06                    beq     ?03
 4090  F8A8E1  88                       dey
 4091  F8A8E2  20 F4 A8                 jsr     FindTab
 4092  F8A8E5  F0 F6                    beq     ?01
 4093  F8A8E7  84 95            ?03:    sty     ScnCol
 4094  F8A8E9  60               ?04:    rts
 4095  F8A8EA                           
 4096  F8A8EA                   TabToggle:
 4097  F8A8EA  A4 95                    ldy     ScnCol
 4098  F8A8EC  20 F4 A8                 jsr     FindTab
 4099  F8A8EF  45 9B                    eor     ScnTmpL
 4100  F8A8F1  95 78                    sta     ScnMapTabs1,x
 4101  F8A8F3  60                       rts
 4102  F8A8F4                           
 4103  F8A8F4                   FindTab:
 4104  F8A8F4  98                       tya
 4105  F8A8F5  29 07                    and     #$07
 4106  F8A8F7  AA                       tax
 4107  F8A8F8  BF CC AE F8              lda     >MSKROW,x               ; forza ABS LONG
 4108  F8A8FC  85 9B                    sta     ScnTmpL
 4109  F8A8FE  98                       tya
 4110  F8A8FF  4A                       lsr     a
 4111  F8A900  4A                       lsr     a
 4112  F8A901  4A                       lsr     a
 4113  F8A902  AA                       tax
 4114  F8A903  B5 78                    lda     ScnMapTabs1,x
 4115  F8A905  24 9B                    bit     ScnTmpL
 4116  F8A907  60                       rts
 4117  F8A908                                   
 4118  F8A908                   LineFeed:
 4119  F8A908  24 B2                    bit     ScnFlag                 ; in modo input line
 4120  F8A90A  30 0C                    bmi     ?01                     ; non esegue nulla
 4121  F8A90C  A5 95                    lda     ScnCol
 4122  F8A90E  48                       pha
 4123  F8A90F  20 D4 AB                 jsr     FindEndRow
 4124  F8A912  20 94 A3                 jsr     WndNewLine
 4125  F8A915  68                       pla
 4126  F8A916  85 95                    sta     ScnCol
 4127  F8A918  60               ?01:    rts
 4128                           
 4129  F8A919                   SolidCurs:
 4130  F8A919  A5 71                    lda     ScnCursMode
 4131  F8A91B  29 E0                    and     #$E0
 4132  F8A91D  80 10                    bra     _SetVDCCurs
 4133                           
 4134  F8A91F                   ULineCurs:
 4135  F8A91F  A5 71                    lda     ScnCursMode
  Tue Jul 17 11:00:17 2018                                                                                               Page   28




 4136  F8A921  29 E0                    and     #$E0
 4137  F8A923  09 07                    ora     #CURSLINE
 4138  F8A925  80 08                    bra     _SetVDCCurs
 4139  F8A927                           
 4140  F8A927                   FixedCurs:
 4141  F8A927  A9 80                    lda     #$80
 4142  F8A929  14 74                    trb     ScnAutoIns
 4143  F8A92B  A5 71                    lda     ScnCursMode
 4144  F8A92D  29 1F                    and     #$1F
 4145  F8A92F                           
 4146  F8A92F                   _SetVDCCurs:
 4147  F8A92F  85 71                    sta     ScnCursMode
 4148  F8A931  4C 79 AD                 jmp     VDCCursor
 4149                           
 4150  F8A934                   FlashCurs:
 4151  F8A934  A9 80                    lda     #$80
 4152  F8A936  04 74                    tsb     ScnAutoIns
 4153  F8A938  A5 71                    lda     ScnCursMode
 4154  F8A93A  29 1F                    and     #$1F
 4155  F8A93C  09 60                    ora     #DEFCURS
 4156  F8A93E  D0 EF                    bne     _SetVDCCurs
 4157  F8A940                           
 4158  F8A940                   ScreenRev:
 4159  F8A940  A2 18                    ldx     #$18
 4160  F8A942  20 1F AE                 jsr     GetVDCReg
 4161  F8A945  09 40                    ora     #$40
 4162  F8A947  D0 07                    bne     _ScnSet
 4163  F8A949                           
 4164  F8A949                   ScreenNorm:
 4165  F8A949  A2 18                    ldx     #$18
 4166  F8A94B  20 1F AE                 jsr     GetVDCReg
 4167  F8A94E  29 BF                    and     #$BF
 4168  F8A950                           
 4169  F8A950                   _ScnSet:
 4170  F8A950  4C 11 AE                 jmp     SetVDCReg
 4171                           
 4172  F8A953                   UpdLast:
 4173  F8A953  A4 B1                    ldy     ScnLstCol
 4174  F8A955  A5 94                    lda     ScnRow
 4175  F8A957  C5 AE                    cmp     ScnInpRow
 4176  F8A959  D0 04                    bne     ?05
 4177  F8A95B  C4 AF                    cpy     ScnInpCol
 4178  F8A95D  F0 09                    beq     ?11
 4179  F8A95F  88               ?05:    dey
 4180  F8A960  10 04                    bpl     ?10
 4181  F8A962  C6 B0                    dec     ScnLstRow
 4182  F8A964  A4 91                    ldy     ScnRight
 4183  F8A966  84 B1            ?10:    sty     ScnLstCol
 4184  F8A968  60               ?11:    rts
 4185                           
 4186  F8A969                   MoveRCurs:
 4187  F8A969  20 57 A6                 jsr     CheckCurs
 4188  F8A96C  A6 94                    ldx     ScnRow                  ; aggiorna ultima posizione cursore
 4189  F8A96E  A4 95                    ldy     ScnCol
 4190  F8A970  86 B0                    stx     ScnLstRow
 4191  F8A972  84 B1                    sty     ScnLstCol
 4192  F8A974  60                       rts
  Tue Jul 17 11:00:17 2018                                                                                               Page   29




 4193                           
 4194                           ; tasto DELETE
 4195  F8A975                   KeyDel:
 4196  F8A975  24 B2                    bit     ScnFlag
 4197  F8A977  10 12                    bpl     ?30
 4198  F8A979  A5 94                    lda     ScnRow                  ; non esegue nulla se in ultima posizione                       
 4199  F8A97B  C5 B0                    cmp     ScnLstRow
 4200  F8A97D  D0 06                    bne     ?01
 4201  F8A97F  A5 95                    lda     ScnCol
 4202  F8A981  C5 B1                    cmp     ScnLstCol
 4203  F8A983  F0 06                    beq     ?30
 4204  F8A985  20 7F AC         ?01:    jsr     SaveCursPos
 4205  F8A988  20 13 AA                 jsr     KeyDel1 
 4206  F8A98B  60               ?30:    rts
 4207                           
 4208                           ; Crea spazio nella finestra
 4209  F8A98C                   WndMakeSpace:
 4210  F8A98C  24 B2                    bit     ScnFlag
 4211  F8A98E  10 34                    bpl     ?00
 4212  F8A990  A6 94                    ldx     ScnRow                  ; non apre spazio se stampa avviene 
 4213  F8A992  E4 B0                    cpx     ScnLstRow               ; nella posizione corrente
 4214  F8A994  D0 06                    bne     ?05
 4215  F8A996  A4 95                    ldy     ScnCol
 4216  F8A998  C4 B1                    cpy     ScnLstCol
 4217  F8A99A  F0 0A                    beq     ?10
 4218  F8A99C  24 B2            ?05:    bit     ScnFlag
 4219  F8A99E  50 07                    bvc     ?20                     ; input multi-linea     
 4220  F8A9A0  A4 B1                    ldy     ScnLstCol               ; non apre spazio se cursore
 4221  F8A9A2  C4 91                    cpy     ScnRight                ; in ultima posizione utile
 4222  F8A9A4  90 13                    bcc     ?25
 4223  F8A9A6  60               ?10:    rts
 4224  F8A9A7  A4 B1            ?20:    ldy     ScnLstCol               ; test ultima posizione utile multi-linea
 4225  F8A9A9  C4 91                    cpy     ScnRight
 4226  F8A9AB  90 0C                    bcc     ?25
 4227  F8A9AD  A4 AE                    ldy     ScnInpRow
 4228  F8A9AF  C4 8E                    cpy     ScnTop
 4229  F8A9B1  D0 06                    bne     ?25
 4230  F8A9B3  A4 B0                    ldy     ScnLstRow
 4231  F8A9B5  C4 90                    cpy     ScnBottom
 4232  F8A9B7  B0 ED                    bcs     ?10
 4233  F8A9B9  20 7F AC         ?25:    jsr     SaveCursPos
 4234  F8A9BC  20 8B AB                 jsr     FindEndRow2
 4235  F8A9BF  20 69 A9                 jsr     MoveRCurs
 4236  F8A9C2  80 13                    bra     ?02
 4237                           
 4238  F8A9C4  20 7F AC         ?00:    jsr     SaveCursPos
 4239  F8A9C7  20 D4 AB                 jsr     FindEndRow
 4240  F8A9CA  E4 9D                    cpx     ScnSaveRow
 4241  F8A9CC  D0 02                    bne     ?01
 4242  F8A9CE  C4 9E                    cpy     ScnSaveCol
 4243  F8A9D0  90 21            ?01:    bcc     ?03
 4244  F8A9D2  20 57 A6                 jsr     CheckCurs
 4245  F8A9D5  B0 62                    bcs     CsrRest
 4246  F8A9D7  20 51 AC         ?02:    jsr     MoveLeft
 4247  F8A9DA  20 15 AD                 jsr     GetVDCChar
 4248  F8A9DD  20 20 AC                 jsr     MoveRight
 4249  F8A9E0  20 E4 AC                 jsr     PutChar2
  Tue Jul 17 11:00:17 2018                                                                                               Page   30




 4250  F8A9E3  20 51 AC                 jsr     MoveLeft
 4251  F8A9E6  A6 94                    ldx     ScnRow
 4252  F8A9E8  E4 9D                    cpx     ScnSaveRow
 4253  F8A9EA  D0 EB                    bne     ?02
 4254  F8A9EC  C4 9E                    cpy     ScnSaveCol
 4255  F8A9EE  D0 E7                    bne     ?02
 4256  F8A9F0  20 CF AC                 jsr     PutBlank
 4257  F8A9F3  E6 73            ?03:    inc     ScnInsert
 4258  F8A9F5  D0 42                    bne     CsrRest
 4259  F8A9F7  C6 73                    dec     ScnInsert
 4260  F8A9F9  80 3E            ?04:    bra     CsrRest
 4261                           
 4262                           ; BACKSPACE
 4263  F8A9FB                   KeyBack:
 4264  F8A9FB  24 B2                    bit     ScnFlag
 4265  F8A9FD  10 0C                    bpl     ?10
 4266  F8A9FF  A5 94                    lda     ScnRow
 4267  F8AA01  C5 AE                    cmp     ScnInpRow
 4268  F8AA03  D0 06                    bne     ?10
 4269  F8AA05  A5 95                    lda     ScnCol
 4270  F8AA07  C5 AF                    cmp     ScnInpCol
 4271  F8AA09  F0 57                    beq     _RTSZ
 4272  F8AA0B  20 81 A8         ?10:    jsr     CsrLeft
 4273  F8AA0E  20 7F AC                 jsr     SaveCursPos
 4274  F8AA11  B0 26                    bcs     CsrRest
 4275  F8AA13                   KeyDel1:
 4276  F8AA13  24 B2                    bit     ScnFlag
 4277  F8AA15  10 0C                    bpl     ?11
 4278  F8AA17  A6 94                    ldx     ScnRow
 4279  F8AA19  E4 B0                    cpx     ScnLstRow
 4280  F8AA1B  90 27                    bcc     KeyDel2
 4281  F8AA1D  C4 B1                    cpy     ScnLstCol
 4282  F8AA1F  90 23                    bcc     KeyDel2
 4283  F8AA21  B0 0C                    bcs     ?12
 4284  F8AA23  C4 91            ?11:    cpy     ScnRight
 4285  F8AA25  90 1D                    bcc     KeyDel2
 4286  F8AA27  A6 94                    ldx     ScnRow
 4287  F8AA29  E8                       inx
 4288  F8AA2A  20 09 AB                 jsr     TabCheckX
 4289  F8AA2D  B0 15                    bcs     KeyDel2
 4290  F8AA2F  20 CF AC         ?12:    jsr     PutBlank
 4291  F8AA32  24 B2                    bit     ScnFlag
 4292  F8AA34  10 03                    bpl     CsrRest
 4293  F8AA36  20 53 A9                 jsr     UpdLast
 4294  F8AA39                           
 4295  F8AA39                   CsrRest:
 4296  F8AA39  A5 9D                    lda     ScnSaveRow
 4297  F8AA3B  85 94                    sta     ScnRow
 4298  F8AA3D  A5 9E                    lda     ScnSaveCol
 4299  F8AA3F  85 95                    sta     ScnCol
 4300  F8AA41  4C 6F A3                 jmp     WndGetAddr
 4301  F8AA44                           
 4302  F8AA44                   KeyDel2:
 4303  F8AA44  20 20 AC                 jsr     MoveRight
 4304  F8AA47  20 15 AD                 jsr     GetVDCChar
 4305  F8AA4A  20 51 AC                 jsr     MoveLeft
 4306  F8AA4D  20 E4 AC                 jsr     PutChar2
  Tue Jul 17 11:00:17 2018                                                                                               Page   31




 4307  F8AA50  20 20 AC                 jsr     MoveRight
 4308  F8AA53  80 BE                    bra     KeyDel1
 4309  F8AA55                                                           
 4310                           ;------------------------------------------------------------
 4311                           
 4312                           ; ESC-Z - cancella tab
 4313  F8AA55                   ClearTabs:      
 4314  F8AA55  A9 00                    lda     #0
 4315  F8AA57  80 04                    bra     _SetTabs
 4316  F8AA59                           
 4317                           ; ESC-Y - set default tab
 4318  F8AA59                   SetDefTabs:
 4319  F8AA59  A9 80                    lda     #$80
 4320  F8AA5B  A2 09                    ldx     #$09
 4321  F8AA5D                   _SetTabs:
 4322  F8AA5D  95 78            ?01:    sta     ScnMapTabs1,x
 4323  F8AA5F  CA                       dex
 4324  F8AA60  10 FB                    bpl     ?01
 4325  F8AA62                   _RTSZ:
 4326  F8AA62  60                       rts
 4327  F8AA63                           
 4328                           ; ESC-T - finestra TOP,LEFT
 4329  F8AA63                   WndEscT:
 4330  F8AA63  18                       clc
 4331  F8AA64                           
 4332  F8AA64  24                       .DB     $24
 4333  F8AA65                           
 4334                           ; ESC-B - finestra BOTTOM, RIGHT
 4335  F8AA65                   WndEscB:
 4336  F8AA65  38                       sec
 4337  F8AA66  A6 95                    ldx     ScnCol
 4338  F8AA68  A5 94                    lda     ScnRow
 4339  F8AA6A                           
 4340  F8AA6A                   SetWndL:
 4341  F8AA6A  90 06                    bcc     SetWnd3
 4342  F8AA6C                   SetWndR:        
 4343  F8AA6C  85 90                    sta     ScnBottom
 4344  F8AA6E  86 91                    stx     ScnRight
 4345  F8AA70  80 04                    bra     _SetWnd2
 4346  F8AA72                   SetWnd3:        
 4347  F8AA72  85 8E                    sta     ScnTop
 4348  F8AA74  86 8F                    stx     ScnLeft
 4349  F8AA76                   _SetWnd2:
 4350  F8AA76  A2 03                    ldx     #3
 4351  F8AA78  74 82            ?01:    stz     ScnMapTabs2,x
 4352  F8AA7A  CA                       dex
 4353  F8AA7B  10 FB                    bpl     ?01
 4354  F8AA7D  60                       rts
 4355  F8AA7E                           
 4356  F8AA7E                   SetMaxWnd:
 4357  F8AA7E  A5 76                    lda     ScnMaxRow
 4358  F8AA80  A6 77                    ldx     ScnMaxCols
 4359  F8AA82  20 6C AA                 jsr     SetWndR
 4360  F8AA85  64 8F                    stz     ScnLeft
 4361  F8AA87  64 8E                    stz     ScnTop
 4362  F8AA89  60                       rts
 4363                           
  Tue Jul 17 11:00:17 2018                                                                                               Page   32




 4364                           ; ESC-Q - cancella fino a fine linea
 4365  F8AA8A                   WndEscQ:
 4366  F8AA8A  20 7F AC                 jsr     SaveCursPos
 4367  F8AA8D  20 8E A7         ?01:    jsr     ClrRowY
 4368  F8AA90  E6 94                    inc     ScnRow
 4369  F8AA92  20 6F A3                 jsr     WndGetAddr
 4370  F8AA95  A4 8F                    ldy     ScnLeft
 4371  F8AA97  20 07 AB                 jsr     TabCheck
 4372  F8AA9A  B0 F1                    bcs     ?01
 4373  F8AA9C  80 9B                    bra     CsrRest
 4374                           
 4375                           ; ESC-P - erase begin
 4376  F8AA9E                   WndEscP:
 4377  F8AA9E  20 7F AC                 jsr     SaveCursPos
 4378  F8AAA1  20 CF AC         ?01:    jsr     PutBlank
 4379  F8AAA4  C4 8F                    cpy     ScnLeft
 4380  F8AAA6  D0 05                    bne     ?02
 4381  F8AAA8  20 07 AB                 jsr     TabCheck
 4382  F8AAAB  90 8C                    bcc     CsrRest
 4383  F8AAAD  20 51 AC         ?02:    jsr     MoveLeft
 4384  F8AAB0  90 EF                    bcc     ?01
 4385                           
 4386                           ; ESC-@ - cancella resto dello schermo
 4387  F8AAB2                   WndEscAt:
 4388  F8AAB2  20 7F AC                 jsr     SaveCursPos
 4389  F8AAB5  20 8E A7         ?01:    jsr     ClrRowY
 4390  F8AAB8  E6 94                    inc     ScnRow
 4391  F8AABA  20 6F A3                 jsr     WndGetAddr
 4392  F8AABD  A4 8F                    ldy     ScnLeft
 4393  F8AABF  20 07 AB                 jsr     TabCheck
 4394  F8AAC2  B0 F1                    bcs     ?01
 4395  F8AAC4  A5 94                    lda     ScnRow
 4396  F8AAC6  C5 90                    cmp     ScnBottom
 4397  F8AAC8  90 EB                    bcc     ?01
 4398  F8AACA  F0 E9                    beq     ?01
 4399  F8AACC  4C 39 AA                 jmp     CsrRest
 4400  F8AACF                           
 4401                           ; ESC-V - scroll up
 4402  F8AACF                   WndEscV:
 4403  F8AACF  20 7F AC                 jsr     SaveCursPos
 4404  F8AAD2  DA                       phx
 4405  F8AAD3  20 A5 A6                 jsr     WndScroll
 4406  F8AAD6  68                       pla
 4407  F8AAD7  85 9D                    sta     ScnSaveRow
 4408  F8AAD9  4C 39 AA                 jmp     CsrRest
 4409  F8AADC                           
 4410                           ; ESC-W - scroll Down
 4411  F8AADC                   WndEscW:
 4412  F8AADC  20 7F AC                 jsr     SaveCursPos
 4413  F8AADF  20 07 AB                 jsr     TabCheck
 4414  F8AAE2  B0 03                    bcs     ?01
 4415  F8AAE4  38                       sec
 4416  F8AAE5  66 96                    ror     ScnRowStart
 4417  F8AAE7  A5 8E            ?01:    lda     ScnTop
 4418  F8AAE9  85 94                    sta     ScnRow
 4419  F8AAEB  20 7C A6                 jsr     InsertRow
 4420  F8AAEE  20 16 AB                 jsr     TabSetupX
  Tue Jul 17 11:00:17 2018                                                                                               Page   33




 4421  F8AAF1  4C 39 AA                 jmp     CsrRest
 4422  F8AAF4                                   
 4423                           ; ESC-K - fine riga
 4424  F8AAF4                   WndEscK:
 4425  F8AAF4  20 D4 AB                 jsr     FindEndRow
 4426  F8AAF7  4C 57 A6                 jmp     CheckCurs       
 4427                           
 4428  F8AAFA                   WindowOrg:
 4429  F8AAFA  A4 95                    ldy     ScnCol
 4430  F8AAFC  A6 94                    ldx     ScnRow
 4431  F8AAFE  86 8E                    stx     ScnTop
 4432  F8AB00  84 8F                    sty     ScnLeft
 4433  F8AB02  85 90                    sta     ScnBottom
 4434  F8AB04  4C 76 AA                 jmp     _SetWnd2
 4435                           
 4436  F8AB07                   TabCheck:
 4437  F8AB07  A6 94                    ldx     ScnRow
 4438  F8AB09                   TabCheckX:
 4439  F8AB09  20 2D AB                 jsr     MaskRow
 4440  F8AB0C  35 82                    and     ScnMapTabs2,x
 4441  F8AB0E  C9 01                    cmp     #$01
 4442  F8AB10  80 0D                    bra     _TabExit
 4443  F8AB12                   TabSetup:       
 4444  F8AB12  A6 94                    ldx     ScnRow
 4445  F8AB14                   TabSetup2:
 4446  F8AB14  B0 0C                    bcs     _Tab2Check
 4447  F8AB16                   TabSetupX:      
 4448  F8AB16  20 2D AB                 jsr     MaskRow
 4449  F8AB19  49 FF                    eor     #$FF
 4450  F8AB1B  35 82                    and     ScnMapTabs2,x
 4451  F8AB1D                   _Tab2Set:
 4452  F8AB1D  95 82                    sta     ScnMapTabs2,x
 4453  F8AB1F                   _TabExit:       
 4454  F8AB1F  A6 9B                    ldx     ScnTmpL
 4455  F8AB21  60                       rts
 4456  F8AB22                   _Tab2Check:
 4457  F8AB22  24 75                    bit     ScnScroll
 4458  F8AB24  70 E3                    bvs     TabCheckX
 4459  F8AB26  20 2D AB                 jsr     MaskRow
 4460  F8AB29  15 82                    ora     ScnMapTabs2,x
 4461  F8AB2B  D0 F0                    bne     _Tab2Set
 4462  F8AB2D                           
 4463  F8AB2D                   MaskRow:
 4464  F8AB2D  86 9B                    stx     ScnTmpL
 4465  F8AB2F  8A                       txa
 4466  F8AB30  29 07                    and     #$07
 4467  F8AB32  AA                       tax
 4468  F8AB33  BF CC AE F8              lda     >MSKROW,x               ; forza ABS LONG
 4469  F8AB37  48                       pha
 4470  F8AB38  A5 9B                    lda     ScnTmpL
 4471  F8AB3A  4A                       lsr     a
 4472  F8AB3B  4A                       lsr     a
 4473  F8AB3C  4A                       lsr     a
 4474  F8AB3D  AA                       tax
 4475  F8AB3E  68                       pla
 4476  F8AB3F  60                       rts
 4477                           
  Tue Jul 17 11:00:17 2018                                                                                               Page   34




 4478                           ; ESC-J
 4479  F8AB40                   WndEscJ:
 4480  F8AB40  A4 8F                    ldy     ScnLeft
 4481  F8AB42  84 95                    sty     ScnCol
 4482  F8AB44                           
 4483  F8AB44                   WndEscJ2:
 4484  F8AB44  20 07 AB                 jsr     TabCheck
 4485  F8AB47  90 06                    bcc     ?02
 4486  F8AB49  C6 94                    dec     ScnRow
 4487  F8AB4B  10 F7                    bpl     WndEscJ2
 4488  F8AB4D  E6 94                    inc     ScnRow
 4489  F8AB4F  4C 6F A3         ?02:    jmp     WndGetAddr
 4490                           
 4491                           ; ESC-I - insert line
 4492  F8AB52                   WndEscI:
 4493  F8AB52  20 7C A6                 jsr     InsertRow
 4494  F8AB55  20 69 A3                 jsr     WndLeft
 4495  F8AB58  E8                       inx
 4496  F8AB59  20 09 AB                 jsr     TabCheckX
 4497  F8AB5C  08                       php
 4498  F8AB5D  20 12 AB                 jsr     TabSetup
 4499  F8AB60  28                       plp
 4500  F8AB61  B0 03                    bcs     ?01
 4501  F8AB63  38                       sec
 4502  F8AB64  66 96                    ror     ScnRowStart
 4503  F8AB66  60               ?01:    rts
 4504                           
 4505                           ; ESC-D - delete line
 4506  F8AB67                   WndEscD:
 4507  F8AB67  20 44 AB                 jsr     WndEscJ2
 4508  F8AB6A  A5 8E                    lda     ScnTop
 4509  F8AB6C  48                       pha
 4510  F8AB6D  A5 94                    lda     ScnRow
 4511  F8AB6F  85 8E                    sta     ScnTop
 4512  F8AB71  A5 75                    lda     ScnScroll
 4513  F8AB73  48                       pha
 4514  F8AB74  A9 80                    lda     #$80
 4515  F8AB76  85 75                    sta     ScnScroll
 4516  F8AB78  20 B7 A6                 jsr     PP02
 4517  F8AB7B  68                       pla
 4518  F8AB7C  85 75                    sta     ScnScroll
 4519  F8AB7E  A5 8E                    lda     ScnTop
 4520  F8AB80  85 94                    sta     ScnRow
 4521  F8AB82  68                       pla
 4522  F8AB83  85 8E                    sta     ScnTop
 4523  F8AB85  38                       sec
 4524  F8AB86  66 96                    ror     ScnRowStart
 4525  F8AB88  4C 69 A3                 jmp     WndLeft
 4526                           
 4527  F8AB8B                   FindEndRow2:
 4528  F8AB8B  A6 B0                    ldx     ScnLstRow               ; riga ultima posizione di input
 4529  F8AB8D  86 94                    stx     ScnRow                  ; imposta come riga corrente
 4530  F8AB8F  A4 B1                    ldy     ScnLstCol
 4531  F8AB91  84 95                    sty     ScnCol
 4532  F8AB93  4C 6F A3                 jmp     WndGetAddr
 4533                           
 4534  F8AB96                   _Trim:
  Tue Jul 17 11:00:17 2018                                                                                               Page   35




 4535  F8AB96  20 15 AD         ?01:    jsr     GetVDCChar
 4536  F8AB99  A6 94                    ldx     ScnRow
 4537  F8AB9B  C9 20                    cmp     #' '
 4538  F8AB9D  D0 11                    bne     ?04
 4539  F8AB9F  A5 94                    lda     ScnRow
 4540  F8ABA1  C5 AE                    cmp     ScnInpRow
 4541  F8ABA3  D0 04                    bne     ?02
 4542  F8ABA5  C4 AF                    cpy     ScnInpCol
 4543  F8ABA7  F0 05                    beq     ?03
 4544  F8ABA9  20 51 AC         ?02:    jsr     MoveLeft
 4545  F8ABAC  80 E8                    bra     ?01
 4546  F8ABAE  84 98            ?03:    sty     ScnColStart             ; forza campo input vuoto
 4547  F8ABB0  60               ?04:    rts
 4548                           
 4549  F8ABB1                   FindEndRow3:
 4550  F8ABB1  A6 B0                    ldx     ScnLstRow               ; riga ultima posizione di input
 4551  F8ABB3  86 94                    stx     ScnRow                  ; imposta come riga corrente
 4552  F8ABB5  A4 B1                    ldy     ScnLstCol
 4553  F8ABB7  84 95                    sty     ScnCol
 4554  F8ABB9  84 98                    sty     ScnColStart             ; copia di ScnLstCol
 4555  F8ABBB  E4 AE                    cpx     ScnInpRow
 4556  F8ABBD  D0 04                    bne     ?20
 4557  F8ABBF  C4 AF                    cpy     ScnInpCol
 4558  F8ABC1  F0 5A                    beq     _FindEnd                ; campo input vuoto
 4559  F8ABC3  20 51 AC         ?20:    jsr     MoveLeft                ; cursore ad ultima posizione utile
 4560  F8ABC6  20 6F A3                 jsr     WndGetAddr
 4561  F8ABC9  A9 04                    lda     #$04                    ; test bit 2
 4562  F8ABCB  24 B2                    bit     ScnFlag
 4563  F8ABCD  D0 4E                    bne     _FindEnd
 4564  F8ABCF  20 96 AB                 jsr     _Trim
 4565  F8ABD2  80 49                    bra     _FindEnd
 4566  F8ABD4                                   
 4567                           ; Cerca fine della riga
 4568  F8ABD4                   FindEndRow:
 4569  F8ABD4  24 B2                    bit     ScnFlag
 4570  F8ABD6  10 1E                    bpl     ?00                     ; modo normale
 4571  F8ABD8  A6 B0                    ldx     ScnLstRow               ; riga ultima posizione di input
 4572  F8ABDA  86 94                    stx     ScnRow                  ; imposta come riga corrente
 4573  F8ABDC  A4 B1                    ldy     ScnLstCol
 4574  F8ABDE  84 95                    sty     ScnCol
 4575  F8ABE0  E4 AE                    cpx     ScnInpRow
 4576  F8ABE2  D0 04                    bne     ?20
 4577  F8ABE4  C4 AF                    cpy     ScnInpCol
 4578  F8ABE6  F0 35                    beq     ?03                     ; campo input vuoto
 4579  F8ABE8  24 B2            ?20:    bit     ScnFlag
 4580  F8ABEA  70 13                    bvs     ?00a
 4581  F8ABEC  C4 8F                    cpy     ScnLeft
 4582  F8ABEE  D0 0F                    bne     ?00a
 4583  F8ABF0  C6 94                    dec     ScnRow
 4584  F8ABF2  A4 91                    ldy     ScnRight
 4585  F8ABF4  80 09                    bra     ?00a
 4586  F8ABF6  E6 94            ?00:    inc     ScnRow
 4587  F8ABF8  20 07 AB                 jsr     TabCheck
 4588  F8ABFB  B0 F9                    bcs     ?00
 4589  F8ABFD  C6 94                    dec     ScnRow
 4590  F8ABFF  20 6F A3         ?00a:   jsr     WndGetAddr
 4591  F8AC02  A4 91                    ldy     ScnRight
  Tue Jul 17 11:00:17 2018                                                                                               Page   36




 4592  F8AC04  84 95                    sty     ScnCol
 4593  F8AC06  20 15 AD         ?01:    jsr     GetVDCChar
 4594  F8AC09  A6 94                    ldx     ScnRow
 4595  F8AC0B  C9 20                    cmp     #' '
 4596  F8AC0D  D0 0E                    bne     ?03
 4597  F8AC0F  C4 8F                    cpy     ScnLeft
 4598  F8AC11  D0 05                    bne     ?02
 4599  F8AC13  20 07 AB                 jsr     TabCheck
 4600  F8AC16  90 05                    bcc     ?03
 4601  F8AC18  20 51 AC         ?02:    jsr     MoveLeft
 4602  F8AC1B  90 E9                    bcc     ?01
 4603  F8AC1D                   ?03:    
 4604  F8AC1D                   _FindEnd:
 4605  F8AC1D  84 97                    sty     ScnInput
 4606  F8AC1F  60                       rts
 4607  F8AC20                           
 4608                           ; Muove cursore a destra - update ScnCol
 4609                           ; Out:  C = 0 se ScnRow non cambiato
 4610                           ;       C = 1 se ScnRow cambiato
 4611  F8AC20                   MoveRight:
 4612  F8AC20  24 B2                    bit     ScnFlag
 4613  F8AC22  10 1A                    bpl     ?00                     ; modo normale
 4614  F8AC24  A4 95                    ldy     ScnCol                  ; test: cursore ad ultima posizione ?
 4615  F8AC26  C4 91                    cpy     ScnRight
 4616  F8AC28  90 14                    bcc     ?00                     ; no
 4617  F8AC2A  24 B2                    bit     ScnFlag
 4618  F8AC2C  70 0C                    bvs     ?15                     ; input mono-linea - esce
 4619  F8AC2E  A4 AE                    ldy     ScnInpRow               ; ultima riga ?
 4620  F8AC30  C4 8E                    cpy     ScnTop
 4621  F8AC32  D0 0A                    bne     ?00                     ; no
 4622  F8AC34  A4 94                    ldy     ScnRow
 4623  F8AC36  C4 90                    cpy     ScnBottom
 4624  F8AC38  90 04                    bcc     ?00
 4625  F8AC3A  A4 95            ?15:    ldy     ScnCol  
 4626  F8AC3C  18                       clc                             ; non aggiorna ScnCol
 4627  F8AC3D  60                       rts
 4628  F8AC3E  48               ?00:    pha
 4629  F8AC3F  A4 95                    ldy     ScnCol
 4630  F8AC41  C4 91                    cpy     ScnRight
 4631  F8AC43  90 07                    bcc     ?01
 4632  F8AC45  20 94 A3                 jsr     WndNewLine
 4633  F8AC48  A4 8F                    ldy     ScnLeft
 4634  F8AC4A  88                       dey
 4635  F8AC4B  38                       sec
 4636  F8AC4C  C8               ?01:    iny
 4637  F8AC4D  84 95                    sty     ScnCol
 4638  F8AC4F  68                       pla
 4639  F8AC50  60                       rts
 4640  F8AC51                           
 4641                           ; Muove cursore a sinistra
 4642  F8AC51                   MoveLeft:
 4643  F8AC51  24 B2                    bit     ScnFlag
 4644  F8AC53  10 0C                    bpl     ?00                     ; modo normale
 4645  F8AC55  A4 AE                    ldy     ScnInpRow               ; modo input line
 4646  F8AC57  C4 94                    cpy     ScnRow                  ; riga attuale > riga start input
 4647  F8AC59  90 06                    bcc     ?00                     ; cursore possibile a sinistra
 4648                                   ; riga attuale = riga start input: cursore limitato
  Tue Jul 17 11:00:17 2018                                                                                               Page   37




 4649                                   ; a sinistra alla posizione ScnInpCol
 4650  F8AC5B  A4 AF                    ldy     ScnInpCol
 4651  F8AC5D  C4 95                    cpy     ScnCol
 4652  F8AC5F  B0 18                    bcs     ?02                     ; cursore a posizione ScnInpCol
 4653  F8AC61  A4 95            ?00:    ldy     ScnCol
 4654  F8AC63  88                       dey
 4655  F8AC64  30 04                    bmi     ?01
 4656  F8AC66  C4 8F                    cpy     ScnLeft
 4657  F8AC68  B0 0F                    bcs     ?02
 4658  F8AC6A  A4 8E            ?01:    ldy     ScnTop
 4659  F8AC6C  C4 94                    cpy     ScnRow
 4660  F8AC6E  B0 0E                    bcs     ?03
 4661  F8AC70  C6 94                    dec     ScnRow
 4662  F8AC72  48                       pha
 4663  F8AC73  20 6F A3                 jsr     WndGetAddr
 4664  F8AC76  68                       pla
 4665  F8AC77  A4 91                    ldy     ScnRight
 4666  F8AC79  84 95            ?02:    sty     ScnCol
 4667  F8AC7B  C4 91                    cpy     ScnRight
 4668  F8AC7D  18                       clc
 4669  F8AC7E  60               ?03:    rts
 4670                           
 4671                           ; Salva posizione cursore
 4672  F8AC7F                   SaveCursPos:
 4673  F8AC7F  A4 95                    ldy     ScnCol
 4674  F8AC81  84 9E                    sty     ScnSaveCol
 4675  F8AC83  A6 94                    ldx     ScnRow
 4676  F8AC85  86 9D                    stx     ScnSaveRow
 4677  F8AC87  60                       rts
 4678  F8AC88                           
 4679                           ; Get limiti finestra
 4680  F8AC88                   GetWndOrg:
 4681  F8AC88  38                       sec
 4682  F8AC89  A5 90                    lda     ScnBottom
 4683  F8AC8B  E5 8E                    sbc     ScnTop
 4684  F8AC8D  A8                       tay
 4685  F8AC8E  38                       sec
 4686  F8AC8F  A5 91                    lda     ScnRight
 4687  F8AC91  E5 8F                    sbc     ScnLeft
 4688  F8AC93  AA                       tax
 4689  F8AC94  A5 77                    lda     ScnMaxCols
 4690  F8AC96  60                       rts
 4691  F8AC97                           
 4692                           ; Get/Set posizione cursore
 4693  F8AC97                   GetSetPos:
 4694  F8AC97  B0 29                    bcs     ?05             ; get cursor pos
 4695  F8AC99  8A                       txa
 4696  F8AC9A  65 8E                    adc     ScnTop
 4697  F8AC9C  B0 14                    bcs     ?03
 4698  F8AC9E  C5 90                    cmp     ScnBottom
 4699  F8ACA0  F0 02                    beq     ?01
 4700  F8ACA2  B0 0E                    bcs     ?03
 4701  F8ACA4  48               ?01:    pha
 4702  F8ACA5  18                       clc
 4703  F8ACA6  98                       tya
 4704  F8ACA7  65 8F                    adc     ScnLeft
 4705  F8ACA9  B0 06                    bcs     ?02
  Tue Jul 17 11:00:17 2018                                                                                               Page   38




 4706  F8ACAB  C5 91                    cmp     ScnRight
 4707  F8ACAD  F0 04                    beq     ?04
 4708  F8ACAF  90 02                    bcc     ?04
 4709  F8ACB1  68               ?02:    pla
 4710  F8ACB2  60               ?03:    rts
 4711  F8ACB3  85 95            ?04:    sta     ScnCol
 4712  F8ACB5  85 98                    sta     ScnColStart
 4713  F8ACB7  68                       pla
 4714  F8ACB8  85 94                    sta     ScnRow
 4715  F8ACBA  85 96                    sta     ScnRowStart
 4716  F8ACBC  20 6F A3                 jsr     WndGetAddr
 4717  F8ACBF  20 CA AD                 jsr     SetVDCCurs
 4718  F8ACC2  A5 94            ?05:    lda     ScnRow
 4719  F8ACC4  E5 8E                    sbc     ScnTop
 4720  F8ACC6  AA                       tax
 4721  F8ACC7  38                       sec
 4722  F8ACC8  A5 95                    lda     ScnCol
 4723  F8ACCA  E5 8F                    sbc     ScnLeft
 4724  F8ACCC  A8                       tay
 4725  F8ACCD  18                       clc
 4726  F8ACCE  60                       rts
 4727                           
 4728                           ; Stampa spazio
 4729  F8ACCF                   PutBlank:
 4730  F8ACCF  A5 92                    lda     ScnAttr
 4731  F8ACD1  24 6D                    bit     <VBBRam
 4732  F8ACD3  10 04                    bpl     ?10
 4733  F8ACD5  29 1F                    and     #$1F
 4734  F8ACD7  80 02                    bra     ?12
 4735  F8ACD9  29 8F            ?10:    and     #$8F
 4736  F8ACDB  AA               ?12:    tax
 4737  F8ACDC  A9 20                    lda     #' '
 4738  F8ACDE  80 06                    bra     PutCharAttr
 4739  F8ACE0                           
 4740                           ; Stampa carattere con attributo di default
 4741  F8ACE0                   PutChar:        
 4742  F8ACE0  A6 92                    ldx     ScnAttr
 4743  F8ACE2  80 02                    bra     PutCharAttr
 4744  F8ACE4                           
 4745                           ; Stampa carattere con attributo alternativo
 4746  F8ACE4                   PutChar2:
 4747  F8ACE4  A6 93                    ldx     ScnAttr2
 4748  F8ACE6                           
 4749  F8ACE6                   PutCharAttr:
 4750  F8ACE6  A8                       tay
 4751  F8ACE7  20 7F A3                 jsr     WndGetAddr2
 4752  F8ACEA  98                       tya
 4753  F8ACEB  A4 95                    ldy     ScnCol
 4754  F8ACED  24 6D                    bit     <VBBRam
 4755  F8ACEF  10 14                    bpl     ?10
 4756  F8ACF1  86 8D                    stx     ScnTmpx
 4757  F8ACF3  AE 0C FC                 ldx     CREMEOFF                ; salva bit corrente
 4758  F8ACF6  DA                       phx
 4759  F8ACF7  8D 0D FC                 sta     !CREMEON                ; abilita memoria video
 4760  F8ACFA  97 86                    sta     [ScnPtr],y
 4761  F8ACFC  A5 8D                    lda     ScnTmpx
 4762  F8ACFE  97 8A                    sta     [ScnAtPtr],y
  Tue Jul 17 11:00:17 2018                                                                                               Page   39




 4763  F8AD00  FA                       plx
 4764  F8AD01  9D 0C FC                 sta     !CREMEOFF,x             ; ripristina bit corrente
 4765  F8AD04  60                       rts     
 4766  F8AD05  48               ?10:    pha
 4767  F8AD06  DA                       phx
 4768  F8AD07  20 F0 AD                 jsr     SetARam
 4769  F8AD0A  68                       pla
 4770  F8AD0B  20 0F AE                 jsr     SetVDCReg31
 4771  F8AD0E  20 FD AD                 jsr     SetVRam
 4772  F8AD11  68                       pla
 4773  F8AD12  4C 0F AE                 jmp     SetVDCReg31
 4774  F8AD15                           
 4775                           ; Get carattare e attributo
 4776  F8AD15                   GetVDCChar:
 4777  F8AD15  A4 95                    ldy     ScnCol
 4778  F8AD17  24 6D                    bit     <VBBRam
 4779  F8AD19  10 12                    bpl     ?10
 4780  F8AD1B  AE 0C FC                 ldx     CREMEOFF                ; salva bit corrente
 4781  F8AD1E  DA                       phx
 4782  F8AD1F  8D 0D FC                 sta     !CREMEON                ; abilita memoria video
 4783  F8AD22  B7 8A                    lda     [ScnAtPtr],y
 4784  F8AD24  85 93                    sta     ScnAttr2
 4785  F8AD26  B7 86                    lda     [ScnPtr],y
 4786  F8AD28  FA                       plx
 4787  F8AD29  9D 0C FC                 sta     !CREMEOFF,x             ; ripristina bit corrente
 4788  F8AD2C  60                       rts     
 4789  F8AD2D  20 F0 AD         ?10:    jsr     SetARam
 4790  F8AD30  20 1D AE                 jsr     GetVDCReg31
 4791  F8AD33  85 93                    sta     ScnAttr2
 4792  F8AD35  20 FD AD                 jsr     SetVRam
 4793  F8AD38  4C 1D AE                 jmp     GetVDCReg31
 4794  F8AD3B                                   
 4795                           ; Cursore VDC ON
 4796  F8AD3B                   VDCCursOn:
 4797  F8AD3B  20 7F A3                 jsr     WndGetAddr2
 4798  F8AD3E  A4 95                    ldy     ScnCol
 4799  F8AD40  24 6D                    bit     <VBBRam
 4800  F8AD42  10 1D                    bpl     ?10
 4801  F8AD44  AE 0C FC                 ldx     CREMEOFF                ; salva bit corrente
 4802  F8AD47  DA                       phx
 4803  F8AD48  8D 0D FC                 sta     !CREMEON                ; abilita memoria video
 4804  F8AD4B  B7 8A                    lda     [ScnAtPtr],y
 4805  F8AD4D  85 72                    sta     ScnSaveAttr
 4806  F8AD4F  29 E0                    and     #$E0
 4807  F8AD51  85 9C                    sta     ScnTmpH
 4808  F8AD53  A5 92                    lda     ScnAttr
 4809  F8AD55  29 1F                    and     #$1F
 4810  F8AD57  05 9C                    ora     ScnTmpH
 4811  F8AD59  97 8A                    sta     [ScnAtPtr],y    
 4812  F8AD5B  FA                       plx
 4813  F8AD5C  9D 0C FC                 sta     !CREMEOFF,x             ; ripristina bit corrente
 4814  F8AD5F  80 18                    bra     VDCCursor               
 4815  F8AD61  20 F0 AD         ?10:    jsr     SetARam
 4816  F8AD64  20 1D AE                 jsr     GetVDCReg31
 4817  F8AD67  85 72                    sta     ScnSaveAttr
 4818  F8AD69  29 F0                    and     #$F0
 4819  F8AD6B  85 9C                    sta     ScnTmpH
  Tue Jul 17 11:00:17 2018                                                                                               Page   40




 4820  F8AD6D  20 F0 AD                 jsr     SetARam
 4821  F8AD70  A5 92                    lda     ScnAttr
 4822  F8AD72  29 0F                    and     #$0F
 4823  F8AD74  05 9C                    ora     ScnTmpH
 4824  F8AD76  20 0F AE                 jsr     SetVDCReg31
 4825  F8AD79                           
 4826  F8AD79                   VDCCursor:
 4827  F8AD79  A2 0A                    ldx     #$0A
 4828  F8AD7B  A5 71                    lda     ScnCursMode
 4829  F8AD7D  24 6D                    bit     <VBBRam
 4830  F8AD7F  30 03                    bmi     ?10
 4831  F8AD81  4C 11 AE                 jmp     SetVDCReg
 4832  F8AD84  8E 70 FC         ?10:    stx     CRTAddr
 4833  F8AD87  8D 71 FC                 sta     CRTData
 4834  F8AD8A  A9 04                    lda     #$04
 4835  F8AD8C  0C 76 FC                 tsb     !PIAVBB+PIAPRB  
 4836  F8AD8F  60                       rts     
 4837                           
 4838                           ; Cursore VDC OFF
 4839  F8AD90                   VDCCursOff:
 4840  F8AD90  24 6D                    bit     <VBBRam
 4841  F8AD92  10 11                    bpl     ?10
 4842  F8AD94  A5 72                    lda     ScnSaveAttr
 4843  F8AD96  AE 0C FC                 ldx     CREMEOFF                ; salva bit corrente
 4844  F8AD99  DA                       phx
 4845  F8AD9A  8D 0D FC                 sta     !CREMEON                ; abilita memoria video
 4846  F8AD9D  97 8A                    sta     [ScnAtPtr],y
 4847  F8AD9F  FA                       plx
 4848  F8ADA0  9D 0C FC                 sta     !CREMEOFF,x             ; ripristina bit corrente
 4849  F8ADA3  80 08                    bra     CursOff2                
 4850  F8ADA5  20 F0 AD         ?10:    jsr     SetARam
 4851  F8ADA8  A5 72                    lda     ScnSaveAttr
 4852  F8ADAA  20 0F AE                 jsr     SetVDCReg31
 4853  F8ADAD                   CursOff2:
 4854  F8ADAD  A2 0A                    ldx     #$0A
 4855  F8ADAF  A9 20                    lda     #$20
 4856  F8ADB1  24 6D                    bit     <VBBRam
 4857  F8ADB3  10 5C                    bpl     SetVDCReg
 4858  F8ADB5  8E 70 FC                 stx     CRTAddr
 4859  F8ADB8  8D 71 FC                 sta     CRTData
 4860  F8ADBB  A9 04                    lda     #$04
 4861  F8ADBD  1C 76 FC                 trb     !PIAVBB+PIAPRB
 4862  F8ADC0  60                       rts     
 4863                           
 4864                           ; stampa a schermo carattere in A
 4865  F8ADC1                   _ScnCharOut:
 4866  F8ADC1  85 9F                    sta     ScnCurChr
 4867  F8ADC3  20 9A A5                 jsr     ScnOutChr
 4868  F8ADC6  A5 9F                    lda     ScnCurChr
 4869  F8ADC8  85 A0                    sta     ScnLstChr       
 4870  F8ADCA                           
 4871                           ; Imposta indirizzo cursore VDC
 4872  F8ADCA                   SetVDCCurs:
 4873  F8ADCA  A2 0E                    ldx     #$0E
 4874  F8ADCC  18                       clc
 4875  F8ADCD  A5 86                    lda     ScnPtr
 4876  F8ADCF  65 95                    adc     ScnCol
  Tue Jul 17 11:00:17 2018                                                                                               Page   41




 4877  F8ADD1  48                       pha
 4878  F8ADD2  A5 87                    lda     ScnPtr+1
 4879  F8ADD4  69 00                    adc     #0
 4880  F8ADD6  24 6D                    bit     <VBBRam
 4881  F8ADD8  10 0F                    bpl     ?10
 4882  F8ADDA  8E 70 FC                 stx     CRTAddr
 4883  F8ADDD  8D 71 FC                 sta     CRTData
 4884  F8ADE0  E8                       inx
 4885  F8ADE1  68                       pla
 4886  F8ADE2  8E 70 FC                 stx     CRTAddr
 4887  F8ADE5  8D 71 FC                 sta     CRTData
 4888  F8ADE8  60                       rts
 4889  F8ADE9  20 11 AE         ?10:    jsr     SetVDCReg
 4890  F8ADEC  E8                       inx
 4891  F8ADED  68                       pla
 4892  F8ADEE  80 21                    bra     SetVDCReg
 4893                           
 4894  F8ADF0                           
 4895                           ; Imposta RAM ATTRIBUTI alla riga corrente e colonna Y
 4896  F8ADF0                   SetARam:
 4897  F8ADF0  A2 12                    ldx     #$12
 4898  F8ADF2  18                       clc
 4899  F8ADF3  98                       tya
 4900  F8ADF4  65 8A                    adc     ScnAtPtr
 4901  F8ADF6  48                       pha
 4902  F8ADF7  A9 00                    lda     #0
 4903  F8ADF9  65 8B                    adc     ScnAtPtr+1
 4904  F8ADFB  80 0B                    bra     _SetVRam2
 4905                           
 4906                           ; Imposta RAM VIDEO alla riga corrente e colonna Y              
 4907  F8ADFD                   SetVRam:
 4908  F8ADFD  A2 12                    ldx     #$12
 4909  F8ADFF  18                       clc
 4910  F8AE00  98                       tya
 4911  F8AE01  65 86                    adc     ScnPtr
 4912  F8AE03  48                       pha
 4913  F8AE04  A9 00                    lda     #0
 4914  F8AE06  65 87                    adc     ScnPtr+1
 4915  F8AE08                   _SetVRam2:
 4916  F8AE08  20 11 AE                 jsr     SetVDCReg
 4917  F8AE0B  68                       pla
 4918  F8AE0C  E8                       inx
 4919  F8AE0D  80 02                    bra     SetVDCReg
 4920                           
 4921                           ; Chiamare con M,X=8 bit e DBR = 0
 4922  F8AE0F                   SetVDCReg31:
 4923  F8AE0F  A2 1F                    ldx     #$1F
 4924  F8AE11                   SetVDCReg:
 4925  F8AE11  8E 4E FD                 stx     VDCAddr
 4926  F8AE14  2C 4E FD         ?01:    bit     VDCStatus
 4927  F8AE17  10 FB                    bpl     ?01
 4928  F8AE19  8D 4F FD                 sta     VDCData
 4929  F8AE1C  60                       rts
 4930                           
 4931                           ; Chiamare con M,X=8 bit e DBR = 0      
 4932  F8AE1D                   GetVDCReg31:
 4933  F8AE1D  A2 1F                    ldx     #$1F
  Tue Jul 17 11:00:17 2018                                                                                               Page   42




 4934  F8AE1F                   GetVDCReg:
 4935  F8AE1F  8E 4E FD                 stx     VDCAddr
 4936  F8AE22  2C 4E FD         ?01:    bit     VDCStatus
 4937  F8AE25  10 FB                    bpl     ?01
 4938  F8AE27  AD 4F FD                 lda     VDCData
 4939  F8AE2A  60                       rts
 4940                           
 4941                           ;------------------------------------------------------------
 4942  F8AE2B                                   
 4943                           
 4944                           ; copia font nella memoria del VDC
 4945                           ; Chiamare con M,X=8 bit e DBR = 0
 4946  F8AE2B                   SetVDCFont:
 4947                                   .LONGA  off
 4948                                   .LONGI  off
 4949                           
 4950  F8AE2B  A2 12                    ldx     #$12            ; imposta Hi addr memoria VDC
 4951  F8AE2D  A9 00                    lda     #$0
 4952  F8AE2F  20 11 AE                 jsr     SetVDCReg
 4953  F8AE32  E8                       inx
 4954  F8AE33  A9 00                    lda     #0              ; Lo addr
 4955  F8AE35  20 11 AE                 jsr     SetVDCReg
 4956  F8AE38  A9 FF                    lda     #^VGA8x8L       ; segmento font
 4957  F8AE3A  85 A4                    sta     ScnPrm+2 
 4958  F8AE3C  A9 04                    lda     #$04            ; 1K
 4959  F8AE3E  A2 F8                    ldx     #>VGA8x8L       ; carica font VGA 8x8 L
 4960  F8AE40  A0 08                    ldy     #CGAWIDTH
 4961  F8AE42  20 5D AE                 jsr     CopyFont
 4962  F8AE45  A9 04                    lda     #$04            ; 1K
 4963  F8AE47  A2 FC                    ldx     #>VGA8x8H       ; carica font VGA 8x8 H
 4964  F8AE49  A0 08                    ldy     #CGAWIDTH
 4965  F8AE4B  20 5D AE                 jsr     CopyFont   
 4966  F8AE4E  A9 04                    lda     #$04            ; 1K
 4967  F8AE50  A2 F8                    ldx     #>VGA8x8L       ; carica font VGA 8x8 L
 4968  F8AE52  A0 08                    ldy     #CGAWIDTH
 4969  F8AE54  20 5D AE                 jsr     CopyFont  
 4970  F8AE57  A9 04                    lda     #$04            ; 1K
 4971  F8AE59  A2 FC                    ldx     #>VGA8x8H       ; carica font VGA 8x8 H 
 4972  F8AE5B  A0 08                    ldy     #CGAWIDTH
 4973                           
 4974                           ; copia un set font nella memoria del VDC
 4975                           ; In:   - X = ptr. Hi blocco font
 4976                           ;         Y = numero linee scansione font
 4977                           ;         A = numero pagine da 256b
 4978                           ; Chiamare con M,X=8 bit e DBR = 0
 4979  F8AE5D                   CopyFont:
 4980                                   .LONGA  off
 4981                                   .LONGI  off
 4982  F8AE5D                           
 4983  F8AE5D  86 A3                    stx     ScnPrm+1                ; salva ptr Hi blocco font
 4984  F8AE5F  64 A2                    stz     ScnPrm                  ; ptr Lo = 0
 4985  F8AE61  84 9A                    sty     ScnSaveY                ; linee scansione font
 4986  F8AE63  18                       clc
 4987  F8AE64  65 A3                    adc     ScnPrm+1                ; fine font attuale (Hi)
 4988  F8AE66  85 99                    sta     ScnSaveX
 4989  F8AE68  A9 10                    lda     #CHARWIDTH
 4990  F8AE6A  38                       sec
  Tue Jul 17 11:00:17 2018                                                                                               Page   43




 4991  F8AE6B  E5 9A                    sbc     ScnSaveY                ; linee residue
 4992  F8AE6D  85 9B                    sta     ScnTmpL
 4993  F8AE6F  A0 00                    ldy     #0
 4994  F8AE71  B7 A2            ?01:    lda     [ScnPrm],y              ; load byte font
 4995  F8AE73  20 0F AE                 jsr     SetVDCReg31             ; copia in video ram
 4996  F8AE76  C8                       iny
 4997  F8AE77  C4 9A                    cpy     ScnSaveY                ; loop N linee scansione
 4998  F8AE79  90 F6                    bcc     ?01
 4999  F8AE7B  A4 9B                    ldy     ScnTmpL                 ; linee residue
 5000  F8AE7D  F0 08                    beq     ?03                     ; no linee residue
 5001  F8AE7F  A9 00                    lda     #0
 5002  F8AE81  20 0F AE         ?02:    jsr     SetVDCReg31             ; azzera linee residue
 5003  F8AE84  88                       dey
 5004  F8AE85  D0 FA                    bne     ?02
 5005  F8AE87  A5 A2            ?03:    lda     ScnPrm                  ; aggiorna long ptr
 5006  F8AE89  18                       clc
 5007  F8AE8A  65 9A                    adc     ScnSaveY                ; aggiunge numero linee
 5008  F8AE8C  85 A2                    sta     ScnPrm
 5009  F8AE8E  90 E1                    bcc     ?01                     ; loop
 5010  F8AE90  E6 A3                    inc     ScnPrm+1
 5011  F8AE92  A5 A3                    lda     ScnPrm+1
 5012  F8AE94  C5 99                    cmp     ScnSaveX
 5013  F8AE96  90 D9                    bcc     ?01                     ; loop
 5014  F8AE98  60                       rts
 5015                           
 5016  F8AE99                   HistUp:
 5017  F8AE99                   HistDown:
 5018  F8AE99                   BellSnd:
 5019  F8AE99  60                       rts
 5020  F8AE9A                           
 5021                           ;--------------------------------------------------------------------
 5022  F8AE9A                                           
 5023                           ; tabella indirizzi base video ram
 5024  F8AE9A                   SCRNADDRL:
 5025  F8AE9A  00 50 A0 F0 40           .DB     $00, $50, $A0, $F0, $40, $90, $E0, $30
               90 E0 30 
 5026  F8AEA2  80 D0 20 70 C0           .DB     $80, $D0, $20, $70, $C0, $10, $60, $B0
               10 60 B0 
 5027  F8AEAA  00 50 A0 F0 40           .DB     $00, $50, $A0, $F0, $40, $90, $E0, $30
               90 E0 30 
 5028  F8AEB2  80                       .DB     $80
 5029  F8AEB3                           
 5030  F8AEB3                   SCRNADDRH:
 5031  F8AEB3  00 00 00 00 01           .DB     $00, $00, $00, $00, $01, $01, $01, $02
               01 01 02 
 5032  F8AEBB  02 02 03 03 03           .DB     $02, $02, $03, $03, $03, $04, $04, $04
               04 04 04 
 5033  F8AEC3  05 05 05 05 06           .DB     $05, $05, $05, $05, $06, $06, $06, $07
               06 06 07 
 5034  F8AECB  07                       .DB     $07
 5035                           
 5036                           ;--------------------------------------------------------------------
 5037                           
 5038  F8AECC                   MSKROW:
 5039  F8AECC  80 40 20 10 08           .DB     $80, $40, $20, $10, $08, $04, $02, $01  
               04 02 01 
 5040                           
  Tue Jul 17 11:00:17 2018                                                                                               Page   44




 5041                           ; maschera attributi video board
 5042  F8AED4                   MSKROW2:
 5043  F8AED4  00 80 20 40              .DB     $00, $80, $20, $40      
 5044                           
 5045                           ;--------------------------------------------------------------------
 5046                           
 5047                           ; funzioni sequenze di escape: SCN_ESC, SCN_COL, SCN_BKGCOL, SCN_PRTSCN
 5048  F8AED8                   SCNESCSEQ:
 5049  F8AED8  57A5 30A5 42A5           .DW     ScnProcEsc,     ScnProcCol,     ScnProcBkgCol,  ScnProcPrnt
               2FA5 
 5050  F8AEE0                           
 5051                           ; funzioni codici di controllo $01..$12
 5052  F8AEE0                   CTRLVCTRS:
 5053  F8AEE0  6FA8 48A8 5EA8           .DW     CsrUp,          CsrRight,       CsrDown,        CsrLeft 
               81A8 
 5054  F8AEE8  CEA3 E8A3 99AE           .DW     ScnHome,        ScnEnd,         BellSnd,        KeyBack
               FBA9 
 5055  F8AEF0  C0A8 08A9 D7A8           .DW     CsrTab,         LineFeed,       CsrShTab,       ScnClr  
               C8A3 
 5056  F8AEF8  7BA5 41A8 75A9           .DW     ScnOutCR,       KeybInsert,     KeyDel,         ScnOutCR 
               7BA5 
 5057  F8AF00  99AE 99AE                .DW     HistUp,         HistDown
 5058  F8AF04                           
 5059                                   ;.DW    FixedCurs, FlashCurs, , 
 5060                                   ;.DW    , BellSnd
 5061                           
 5062                           ; tabella comandi dopo tasto ESCAPE (@..Z)
 5063  F8AF04                   ESCVCTRS:
 5064  F8AF04  B2AA 34A9 65AA           DW      WndEscAt,       FlashCurs,      WndEscB,        FixedCurs
               27A9 
 5065  F8AF0C  67AB 99A5 99A5           DW      WndEscD,        _RTS0,           _RTS0,         TabToggle
               EAA8 
 5066  F8AF14  99A5 52AB 40AB           DW      _RTS0,          WndEscI,        WndEscJ,        WndEscK
               F4AA 
 5067  F8AF1C  99A5 99A5 99A5           DW      _RTS0,          _RTS0,          _RTS0,          WndEscO
               89A5 
 5068  F8AF24  9EAA 8AAA 99A5           DW      WndEscP,        WndEscQ,        _RTS0,          _RTS0
               99A5 
 5069  F8AF2C  63AA 99A5 CFAA           DW      WndEscT,        _RTS0,          WndEscV,        WndEscW
               DCAA 
 5070  F8AF34  7EAA 59AA 55AA           DW      SetMaxWnd,      SetDefTabs,     ClearTabs
 5071                           
 5072                           ;--------------------------------------------------------------------
 5073                           ; tabella conversione da codice tasto a codice schermo ($82..$90)
 5074                           
 5075  F8AF3A                   KBCONV:
 5076  F8AF3A  1E                       .DB     SCN_PRTSCN
 5077  F8AF3B  01 05 0E 02              .DB     SCN_CSRUP,      SCN_HOME,       SCN_INSERT,     SCN_CSRRIGHT
 5078  F8AF3F  11 0B 12 03              .DB     SCN_PGUP,       SCN_SHTAB,      SCN_PGDOWN,     SCN_CSRDOWN
 5079  F8AF43  06 10 0F 04              .DB     SCN_END,        SCN_SHCR,       SCN_DELETE,     SCN_CSRLEFT
 5080  F8AF47  08                       .DB     SCN_BS
 5081  F8AF48                           
 5082                           
 5083                           ;----------------------------------------------------------------------------
 5084                           ; Costanti inizializzazione registri VDC
 5085                           ;----------------------------------------------------------------------------
 5086                           
  Tue Jul 17 11:00:17 2018                                                                                               Page   45




 5087                           ; DOT CLOCK 16MHZ - FH = 16KHz FV = 50HZ (FH +, FV +)
 5088  F8AF48                   VDCREG16:
 5089  F8AF48  00 7F 01 50 02                   .BYTE   $00, $7f, $01, $50, $02, $66, $03, $44 ; invece di 49
               66 03 44 
 5090  F8AF50  04 26 05 00 06                   .BYTE   $04, $26, $05, $00, $06, $19, $07, $20
               19 07 20 
 5091  F8AF58  08 00 09 07 0A                   .BYTE   $08, $00, $09, $07, $0A, $20, $0B, $07
               20 0B 07 
 5092  F8AF60  0C 40 0D 00 0E                   .BYTE   $0C, $40, $0D, $00, $0E, $00, $0F, $00
               00 0F 00 
 5093  F8AF68  14 48 15 00 17                   .BYTE   $14, $48, $15, $00, $17, $08, $18, $20
               08 18 20 
 5094  F8AF70  19 47 1A F0 1B                   .BYTE   $19, $47, $1A, $F0, $1B, $00, $1C, $10
               00 1C 10 
 5095  F8AF78  1D 07 22 7D 23                   .BYTE   $1D, $07, $22, $7D, $23, $64, $24, $05,
               64 24 05 
 5096  F8AF80  16 78 FF                         .BYTE   $16, $78, $FF


             Lines Assembled : 5067                  Errors : 0