Subversion Repositories MB01 Project

Rev

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

  Tue Jul 17 11:00:24 2018                                                                                               Page    1







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

                       Input  Filename : src\FF\mond.asm
                       Output Filename : obj\FF\mond.obj
                       Listing Has Been Relocated                               


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




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




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




 2753                           
 2754                                   .ENDS
 2755                           
 2756          [01]             .IFDEF          _ACIA_INC_
 2757  F8FFB1                           .INCLUDE INC\SP.INC
 2758                           ;;
 2759                           ;; Copyright (c) 2016 Marco Granati <mg@unet.bz>
 2760                           ;;
 2761                           ;; Permission to use, copy, modify, and distribute this software for any
 2762                           ;; purpose with or without fee is hereby granted, provided that the above
 2763                           ;; copyright notice and this permission notice appear in all copies.
 2764                           ;;
 2765                           ;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 2766                           ;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 2767                           ;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 2768                           ;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 2769                           ;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 2770                           ;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 2771                           ;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 2772                           ;;
 2773                           
 2774                           ;; name: sp.inc 
 2775                           ;; rev.: 2016/07/28
 2776                           ;; bios C816 version v1.0
 2777                           
 2778                           .LIST on
 2779                           
 2780          000001           SOH             .EQU    $01
 2781          000002           STX             .EQU    $02
 2782          000003           ETX             .EQU    $03
 2783          000004           EOT             .EQU    $04
 2784          000005           ENQ             .EQU    $05
 2785          000006           ACK             .EQU    $06
 2786          000010           DLE             .EQU    $10
 2787          000016           SYN             .EQU    $16
 2788                           
 2789          002000           SOBUFSIZ        .EQU    $2000   ; dimensione coda TX1/TX2 ACIA (8K)
 2790                           ;SOBUFSIZ       .EQU    $0100   ; dimensione coda TX1/TX2 ACIA (8K)
 2791          004000           SIBUFSIZ        .EQU    $4000   ; dimensione coda RX1/RX2 ACIA (16K)
 2792                           ;SIBUFSIZ       .EQU    $0100   ; dimensione coda RX1/RX2 ACIA (16K)
 2793                           
 2794          000080           NGUARD1         .EQU    $80     ; numero bytes di guardia buffer RX XON/XOFF
 2795          000040           NGUARD2         .EQU    $40     ; numero bytes di guardia buffer RX handshake
 2796                           ;NGUARD1                .EQU    $40     ; numero bytes di guardia buffer RX XON/XOFF
 2797                           ;NGUARD2                .EQU    $20     ; numero bytes di guardia buffer RX handshake
 2798          001000           NFREE1          .EQU    $1000   ; minimo posto in coda RX per cancellare pausa remota
 2799          000800           NFREE2          .EQU    $0800
 2800                           ;NGUARD3                .EQU    $F0
 2801                           ;NGUARD4                .EQU    $F8
 2802                           
 2803                           ;---------------------------------------------------------------------------
 2804                           ; direct page var's for serial ports handling 
 2805                           ;---------------------------------------------------------------------------
 2806                           
 2807                           DPSP:   .SECTION page0, common, ref_only, offset spwrk  ;ACIA D.P.
 2808                           
 2809  000056                   _DPSP_START     .DS     0
  Tue Jul 17 11:00:24 2018                                                                                               Page    5




 2810                           
 2811                           ; WARNING: not change order and type of the following variables
 2812                           
 2813                           ; acia 1 var's
 2814  000056  00               splin           .DB             ; interrupt status register
 2815  000057  00               spcsr           .DB             ; control status register
 2816  000058  00               spfr            .DB             ; format register
 2817  000059  00               spout           .DB             ; XON/XOFF send flag
 2818                           
 2819                           ; acia 2 var's
 2820  00005A  00               splin2          .DB             ; interrupt status register
 2821  00005B  00               spcsr2          .DB             ; control status register
 2822  00005C  00               spfr2           .DB             ; format register
 2823  00005D  00               spout2          .DB             ; XON/XOFF send flag
 2824                           
 2825                           ; serial port's mode & status
 2826  00005E  00               spmode          .DB             ; <7>: 0=no handshake, 1=handshake
 2827                                                           ; <6>: 0=software/1=hardware handshake
 2828                                                           ; <5>: not used
 2829                                                           ; <4>: baud rate: 0=19200, 1=38400
 2830                                                           ; <3>: 0=odd parity, 1=even parity
 2831                                                           ; <2>: 0=no parity, 1=parity as specified
 2832                                                           ;      by bit <3>
 2833                                                           ; <1>: interface type: 0=RS232, 1=RS485
 2834                                                           ; <0>: RS232: uplink flow control (RTS/DCD)
 2835                                                           ;      RS485: 120 ohm termination on
 2836                                                           ; if bit 7=1 and bit 1=1, bit 6 is forced to 0
 2837  00005F                                           
 2838  00005F  00               spstat          .DB             ; serial port status            
 2839                                                           ; <7>: rx error (data discarded)
 2840                                                           ; <6>: rx buffer overflow
 2841                                                           ; <5>: remote disconnession (DSR line = 1)
 2842                                                           ; <4>: output buffer overflow
 2843                                                           ; <3>: not used
 2844                                                           ; <2>: framing error
 2845                                                           ; <1>: parity error
 2846                                                           ; <0>: overrun error
 2847                           
 2848  000060  00               sppause         .DB             ; local/remote pause flag's             
 2849                                                           ; <7>: remote pause (sent an XON or set RTS=1)
 2850                                                           ; <6>: local pause (received an XON or CTS=1)
 2851                           
 2852  000061  00               sptmp           .DB             ; temp. byte used while get data
 2853                           
 2854                           ; serial port's mode & status
 2855  000062  00               spmode2         .DB             ; <7>: 0=no handshake, 1=handshake
 2856                                                           ; <6>: 0=software/1=hardware handshake
 2857                                                           ; <5>: not used
 2858                                                           ; <4>: baud rate: 0=19200, 1=38400
 2859                                                           ; <3>: 0=odd parity, 1=even parity
 2860                                                           ; <2>: 0=no parity, 1=parity as specified
 2861                                                           ;      by bit <3>
 2862                                                           ; <1>: interface type: 0=RS232, 1=RS485
 2863                                                           ; <0>: RS232: uplink flow control (RTS/DCD)
 2864                                                           ;      RS485: 120 ohm termination on
 2865                                                           ; if bit 7=1 and bit 1=1, bit 6 is forced to 0
 2866  000063                                           
  Tue Jul 17 11:00:24 2018                                                                                               Page    6




 2867  000063  00               spstat2         .DB             ; serial port status            
 2868                                                           ; <7>: rx error (data discarded)
 2869                                                           ; <6>: rx buffer overflow
 2870                                                           ; <5>: remote disconnession (DSR line = 1)
 2871                                                           ; <4>: output buffer overflow
 2872                                                           ; <3>: not used
 2873                                                           ; <2>: framing error
 2874                                                           ; <1>: parity error
 2875                                                           ; <0>: overrun error
 2876                           
 2877  000064  00               sppause2        .DB             ; local/remote pause flag's             
 2878                                                           ; <7>: remote pause (sent XOFF/XON or RTS=1/0)
 2879                                                           ; <6>: local pause (rx XOFF/XON or CTS=0/1)
 2880                           
 2881  000065  00               sppost          .DB             ; after POST must hold $C0
 2882                           
 2883  000066  0000             ibuftail        .DW             ; pointer to tail of input buffer
 2884  000068  0000             ibufhead        .DW             ; pointer to head of input buffer
 2885  00006A  0000             ibuftail2       .DW
 2886  00006C  0000             ibufhead2       .DW
 2887                           
 2888  00006E  0000             obuftail        .DW             ; pointer to tail of output buffer
 2889  000070  0000             obufhead        .DW             ; pointer to head of output buffer
 2890  000072  0000             obuftail2       .DW
 2891  000074  0000             obufhead2       .DW
 2892                           
 2893  000076  0000             ibufcnt         .DW             ; count of bytes in input buffer
 2894  000078  0000             obufcnt         .DW             ; count of bytes in output buffer
 2895  00007A  0000             ibufcnt2        .DW
 2896  00007C  0000             obufcnt2        .DW
 2897                           
 2898  00007E  0000             icntmin         .DW             ; min. count for clear remote pause  
 2899  000080  0000             icntmax         .DW             ; max. count for set remote pause
 2900  000082  0000             icntmin2        .DW
 2901  000084  0000             icntmax2        .DW
 2902                           
 2903  000086                   _DPSP_END       .DS     0
 2904          000030           DPSPSIZ         .EQU    (_DPSP_END - _DPSP_START)
 2905                           
 2906                           
 2907                                   .ENDS
 2908                           
 2909          00005F           ACIArxe_1       .EQU    spstat
 2910          000063           ACIArxe_2       .EQU    spstat2
 2911          00005E           ACIAhsk_1       .EQU    spmode
 2912          000062           ACIAhsk_2       .EQU    spmode2
 2913          000060           ACIAPause_1     .EQU    sppause
 2914          000064           ACIAPause_2     .EQU    sppause2
 2915          000057           ACIAcsr_1       .EQU    spcsr
 2916          00005B           ACIAcsr_2       .EQU    spcsr2
 2917          000058           ACIAfr_1        .EQU    spfr
 2918          00005C           ACIAfr_2        .EQU    spfr2
 2919          000060           ACIAOut_1       .EQU    sppause
 2920          000064           ACIAOut_2       .EQU    sppause2
 2921          000076           ACIAICnt_1      .EQU    ibufcnt
 2922          00007A           ACIAICnt_2      .EQU    ibufcnt2
 2923          000068           ACIAIHead_1     .EQU    ibufhead
  Tue Jul 17 11:00:24 2018                                                                                               Page    7




 2924          00006C           ACIAIHead_2     .EQU    ibufhead2
 2925          000066           ACIAITail_1     .EQU    ibuftail
 2926          00006A           ACIAITail_2     .EQU    ibuftail2
 2927          000078           ACIAOCnt_1      .EQU    obufcnt
 2928          00007C           ACIAOCnt_2      .EQU    obufcnt2
 2929          000070           ACIAOHead_1     .EQU    obufhead
 2930          000074           ACIAOHead_2     .EQU    obufhead2
 2931          00006E           ACIAOTail_1     .EQU    obuftail
 2932          000072           ACIAOTail_2     .EQU    obuftail2
 2933                           
 2934          002000           ACIAOBUFLEN     .EQU    SOBUFSIZ
 2935          004000           ACIAIBUFLEN     .EQU    SIBUFSIZ
 2936          050000           ACIAOUTBUF1     .EQU    SPOUTBUFF
 2937          052000           ACIAOUTBUF2     .EQU    SPOUTBUFF2
 2938          054000           ACIAINBUF1      .EQU    SPINBUFF
 2939          058000           ACIAINBUF2      .EQU    SPINBUFF2
 2940                           
 2941          000061           ACIATmp         .EQU    sptmp
 2942                           
 2960                           .LIST on
 2961                           
 2962          000060           KBDBUFLEN       .EQU    96              ; dimensione buffer di tastiera
 2963                           
 2964                           DIRP01: .SECTION page0, ref_only, common        ;Direct-Page 01
 2965                           
 2966  000000                           .ABSOLUTE               ;; inizia sempre da $00
 2967  000000                           .ORG            0x00
 2968                           
 2969  000000                           
 2970  000000                   KbdBuf          .DS     KBDBUFLEN       ; buffer della tastiera
 2971  000060  00               KbdITail        .DB                     ; coda buffer tastiera
 2972  000061  00               KbdIHead        .DB                     ; testa buffer tastiera
 2973  000062  00               KbdCnt          .DB                     ; numero bytes nel buffer
 2974  000063  00               KbdShift        .DB
 2975  000064  00               KbdFlag         .DB
 2976  000065  00               KbdToggle       .DB
 2977  000066  00               KbdSt           .DB                     ; status tastiera dopo reset
 2978  000067  00               PS2Ctl          .DB                     ; flag controller PS2 keyboard
 2979                           
 2980  000068  00               LCDFlag         .DB
 2981  000069  00               LCDTmp          .DB
 2982  00006A  0000             LCDVal          .DW
 2983                           
 2984  00006C  00               VBBFlag         .DB             ; flag video board
 2985  00006D  00               VBBRam          .DB             ; flag video RAM
 2986                           
 2987  00006E  00               ScnLinTmp       .DB
 2988  00006F  00               ScnChBase       .DB             ; base video ram VDC
 2989  000070  00               ScnAttBase      .DB             ; base ram attributi VDC
 2990  000071  00               ScnCursMode     .DB             ; VDC cursore default
 2991  000072  00               ScnSaveAttr     .DB
 2992  000073  00               ScnInsert       .DB
 2993  000074  00               ScnAutoIns      .DB             ; bit 7 -> autoins - bit 6 -> modo input
 2994  000075  00               ScnScroll       .DB
 2995  000076  00               ScnMaxRow       .DB             ; max. righe finestra (-1)
 2996  000077  00               ScnMaxCols      .DB             ; max. colonne finestra (-1)
 2997                           
  Tue Jul 17 11:00:24 2018                                                                                               Page    8




 2998  000078                   ScnMapTabs1     .DS     10
 2999  000082                   ScnMapTabs2     .DS     4
 3000  000086                           
 3001  000086  0000             ScnPtr          .DW             ; puntatore video ram linea corrente
 3002  000088  00                               .DB
 3003                           
 3004  000089  00               ScnFiltLen      .DB             ; lunghezza set caratteri filtro
 3005                           
 3006  00008A  0000             ScnAtPtr        .DW             ; puntatore attributi ram linea corrente
 3007  00008C  00                               .DB
 3008                           
 3009  00008D  00               ScnTmpx         .DB             ; temporaneo: durante put char
 3010  00008E                                   
 3011  00008E  00               ScnTop          .DB             ; riga superiore finestra
 3012  00008F  00               ScnLeft         .DB             ; colonna sinistra finestra
 3013  000090  00               ScnBottom       .DB             ; riga inferiore finestra
 3014  000091  00               ScnRight        .DB             ; colonna destra finestra
 3015  000092  00               ScnAttr         .DB             ; attributo default
 3016  000093  00               ScnAttr2        .DB             ; attributo alternativo
 3017  000094  00               ScnRow          .DB             ; riga cursore
 3018  000095  00               ScnCol          .DB             ; colonna cursore
 3019  000096  00               ScnRowStart     .DB             ; riga di start input 
 3020  000097  00               ScnInput        .DB             ; riga di fine input 
 3021  000098  00               ScnColStart     .DB             ; colonna di start input 
 3022  000099  00               ScnSaveX        .DB
 3023  00009A  00               ScnSaveY        .DB
 3024  00009B  00               ScnTmpL         .DB
 3025  00009C  00               ScnTmpH         .DB
 3026  00009D  00               ScnSaveRow      .DB
 3027  00009E  00               ScnSaveCol      .DB
 3028  00009F  00               ScnCurChr       .DB
 3029  0000A0  00               ScnLstChr       .DB
 3030  0000A1  00               ScnCR           .DB
 3031  0000A2  0000             ScnPrm          .DW             ; puntatore long utilizzato da print imm
 3032  0000A4  00                               .DB             ; banco puntatore ScnPrm
 3033  0000A5  00               ScnMode         .DB             ; flag modo schermo
 3034                           
 3035  0000A6                   ScnPtr1         LP
 3036                           
 3037  0000A9  00               ScnDefCol       .DB             ; default foreground color
 3038                           
 3039  0000AA                   ScnPtr2         LP
 3040                           
 3041  0000AD  00               ScnDefBkgCol    .DB             ; default background color
 3042  0000AE  00               ScnInpRow       .DB             ; modo input line: riga start input
 3043  0000AF  00               ScnInpCol       .DB             ; modo input line: colonna start input
 3044  0000B0  00               ScnLstRow       .DB             ; modo input line: riga stop input
 3045  0000B1  00               ScnLstCol       .DB             ; modo input line: colonna stop input
 3046  0000B2  00               ScnFlag         .DB             ; Bit 7: input line - Bit 6: input riga unica
 3047  0000B3  00               ScnMask         .DB             ; flag tasti funzione editor di linea
 3048  0000B4  00               ScnFilt         .DB             ; filtro tasti editor di linea
 3049  0000B5  00               ScnCntrl        .DB             ; flag ASCII/CONTROL
 3050                           ;DflTxtIn       .DB             ; device di default text input 
 3051                           ;DflTxtOut      .DB             ; device di default text output
 3052  0000B6                           
 3053          000047           SCNCLRLEN       .EQU    ($ - ScnLinTmp - 1)
 3054                           
  Tue Jul 17 11:00:24 2018                                                                                               Page    9




 3055                           ;SCNCLRLEN      .EQU    (DflTxtOut - ScnLinTmp)
 3056                           
 3057                           ; variabili monitor
 3058  0000B6  00               SMAddrL         .DB     ; address low/high
 3059  0000B7  00               SMAddrH         .DB
 3060  0000B8  00               SMAddrK         .DB     ; address bank
 3061  0000B9  00               SMFlag32        .DB     ; flag parametro 32 bit
 3062  0000BA  00               SMTmpL          .DB     ; temp. low/high
 3063  0000BB  00               SMTmpH          .DB
 3064  0000BC  00               SMTmpK          .DB     ; temp. bank
 3065  0000BD  00               SMTmpKK         .DB     ; high byte param. 32 bit
 3066  0000BE  00               SMSizeL         .DB     ; size low/high
 3067  0000BF  00               SMSizeH         .DB
 3068  0000C0  00               SMSizeK         .DB     ; size bank
 3069  0000C1  00               SMXAddrL        .DB     ; address low/high XM
 3070  0000C2  00               SMXAddrH        .DB
 3071  0000C3  00               SMXAddrK        .DB     ; address bank XM
 3072  0000C4  00               SMbndx          .DB     ; indice input buffer
 3073  0000C5  00               SMnprm          .DB     ; numero parametri riga di comando
 3074  0000C6  00               SMdumb          .DB
 3075  0000C7  00               SMkr            .DB
 3076  0000C8  0000             SMpc            .DW
 3077  0000CA  00               SMsr            .DB
 3078  0000CB  00               SMbr            .DB
 3079  0000CC  0000             SMdp            .DW
 3080  0000CE  0000             SMac            .DW
 3081  0000D0  0000             SMxr            .DW
 3082  0000D2  0000             SMyr            .DW
 3083  0000D4  0000             SMsp            .DW
 3084                           
 3085  0000D6  00               SMAuxL          .DB
 3086  0000D7  00               SMAuxH          .DB
 3087                           
 3088  0000D8  00               asmlong         .DB     ; flag for CPU in 16 mode
 3089                                                   ; <7> -> A/M in 16 bit mode
 3090                                                   ; <6> -> X/Y in 16 bit mode
 3091  0000D9  00               asmcpu          .DB     ; <7> -> 8 bit family
 3092                                                   ; <6> -> 65C02 cmos version
 3093                           
 3094  0000DA  00               SMctx           .DB     ; context (if = $00 no quit command)
 3095  0000DB                   SMrsm           LP      ; long pointer to resume caller context
 3096                           
 3097  0000DE  00               rtcadr          .DB     ; rtc internal ram address
 3098  0000DF  00               rtcbnk          .DB     ; RTC internal bank ram
 3099  0000E0  00               cmdlin          .DB     ;
 3100  0000E1  00               SMesc           .DB
 3101                           
 3102  0000E2                   SMXTmp:         .DS     26      ; 26 bytes tmp
 3103                           
 3104          0000E2           SMTmp2          .EQU    SMXTmp
 3105          0000E4           SMTmp3          .EQU    SMXTmp+2
 3106          0000E6           SMdwTmp1        .EQU    SMXTmp+4
 3107          0000EA           SMdwTmp2        .EQU    SMXTmp+8
 3108          0000EE           SMFsrc          .EQU    SMXTmp+12       ; source bank for flash update
 3109          0000EF           SMFflag         .EQU    SMXTmp+13       ; flag file for flash update
 3110          0000F0           SMXPos2         .EQU    SMXTmp+14
 3111          0000F1           SMYPos2         .EQU    SMXTmp+15
  Tue Jul 17 11:00:24 2018                                                                                               Page   10




 3112          0000F2           SMXPos3         .EQU    SMXTmp+16
 3113          0000F3           SMYPos3         .EQU    SMXTmp+17
 3114                           ;SMAuxL         .EQU    SMXTmp+18
 3115                           ;SMAuxH         .EQU    SMXTmp+19
 3116          0000F6           SMXPos          .EQU    SMXTmp+20
 3117          0000F7           SMYPos          .EQU    SMXTmp+21
 3118          0000F8           SMdwTmp3        .EQU    SMXTmp+22
 3119                           
 3120          0000E2           atcmd           .EQU    SMXTmp          ; save @ command
 3121          0000E3           atnum           .EQU    SMXTmp+1        ; @ command index
 3122          0000E4           atflag          .EQU    SMXTmp+2        ; @ L,S,V,R,W start address flag
 3123          0000E5           atbnk           .EQU    SMXTmp+3        ; @ L,S,V,R,W bank
 3124          0000E6           atstr           .EQU    SMXTmp+4        ; @ command string start (word)
 3125          0000E8           atstart         .EQU    SMXTmp+6        ; @ L,S,V,R,W start address (word)
 3126          0000EA           atend           .EQU    SMXTmp+8        ; @ S,W end address (word)
 3127          0000EC           atbuf           .EQU    SMXTmp+10       ; @ local buffer pointer (word)
 3128          0000EE           atipb           .EQU    SMXTmp+12       ; @ bank of input buffer
 3129          0000EF           atdir           .EQU    SMXTmp+13       ; @ load dir flag
 3130          0000F0           atptr           .EQU    SMXTmp+14       ; @ load dir pointer (word)
 3131          0000F2           atsiz           .EQU    SMXTmp+16       ; @ buffer size (word) 
 3132          0000F5           atlp            .EQU    SMXTmp+19       ; @ long pointer
 3133          0000F8           atsa            .EQU    SMXTmp+22       ; @ sa
 3134                           
 3135          0000E2           btmpx           .EQU    SMXTmp          ; asc2bin conversion
 3136          0000E3           brtcsec         .EQU    SMXTmp+1
 3137          0000E4           brtcmin         .EQU    SMXTmp+2
 3138          0000E5           brtchour        .EQU    SMXTmp+3
 3139          0000E6           brtcday         .EQU    SMXTmp+4
 3140          0000E7           brtcmonth       .EQU    SMXTmp+5
 3141          0000E8           brtcyear        .EQU    SMXTmp+6
 3142          0000E9           brtcct          .EQU    SMXTmp+7
 3143                           
 3144                           
 3145  0000FC                           .RELATIVE
 3146                           
 3147                                   .ENDS
 3148                           
 3172                           .LIST on
 3173                           
 3174          05C000           SOBUFADDR3      .EQU    SPOUTBUFF3
 3175          05D000           SIBUFADDR3      .EQU    SPINBUFF3
 3176          001000           SOBUFSIZ3       .EQU    $1000
 3177          001000           SIBUFSIZ3       .EQU    $1000
 3178                           
 3179          060000           SOBUFADDR4      .EQU    SPOUTBUFF4
 3180          068000           SIBUFADDR4      .EQU    SPINBUFF4
 3181                           ;SOBUFSIZ4      .EQU    $1000
 3182                           ;SIBUFSIZ4      .EQU    $1000
 3183          008000           SOBUFSIZ4       .EQU    $8000
 3184          008000           SIBUFSIZ4       .EQU    $8000
 3185                           
 3186          000200           NGUARD31        .EQU    $0200   ; numero bytes di guardia buffer RX XON/XOFF
 3187          000100           NGUARD32        .EQU    $0100   ; numero bytes di guardia buffer RX handshake
 3188          000800           NFREE31         .EQU    $0800   ; minimo posto in coda RX per cancellare pausa remota
 3189          000400           NFREE32         .EQU    $0400
 3190                           
 3191                           ;---------------------------------------------------------------------------
  Tue Jul 17 11:00:24 2018                                                                                               Page   11




 3192                           ; direct page var's for test serial ports/usb handling 
 3193                           ;---------------------------------------------------------------------------
 3194                           
 3195                           DPSP2:  .SECTION page0, common, ref_only        ;UART D.P.
 3196                           
 3197  000000  00               usbslv          .DB     ; <7>: plugged-in, <6>: plug-in pending 
 3198  000001  00               usbum           .DB     ; <7>: pending message, <6>: connected  
 3199  000002  00               usbcnt1         .DB     ; timeout UM245 plug-in detection
 3200  000003                   usbbuf          .DS     8       
 3201  00000B  00               usbtim          .DB
 3202  00000C  00               usbcnt          .DB
 3203  00000D  00               usbmst          .DB
 3204  00000E  0000             usbsiz          .DW
 3205  000010                   usbptr          LP
 3206  000013  00               usbtmp          .DB
 3207  000014  00               usbcmp          .DB
 3208                           
 3209                           ; serial port 65C51
 3210  000015  00               spmode3         .DB     ; <7>: 0=no handshake, 1=handshake
 3211                                                   ; <6>: 0=software/1=hardware handshake
 3212                                                   ; <5>: not used
 3213                                                   ; <4>: not used
 3214                                                   ; <3>: 0=odd parity, 1=even parity
 3215                                                   ; <2>: 0=no parity, 1=parity as specified
 3216                                                   ;      by bit <3>
 3217                                                   ; <1:0> : baud rate
 3218                                                   ;       00 =  19200
 3219                                                   ;       01 =  38400
 3220                                                   ;       10 =  57600
 3221                                                   ;       11 = 115200
 3222  000016                                           
 3223  000016  00               splin3          .DB     ; <7>: /CTS line level
 3224                                                   ; <6>: /DSR line status
 3225  000017                                           
 3226  000017  00               sppause3        .DB
 3227  000018  00               spout3          .DB
 3228  000019  00               spstat3         .DB     ; staus
 3229                                                   ; <7>: rx error (data discarded)
 3230                                                   ; <6>: rx buffer overflow
 3231                                                   ; <5>: remote disconnession (/DSR line = 1)
 3232                                                   ; <4>: output buffer overflow
 3233                                                   ; <3>: not used
 3234                                                   ; <2>: framing error
 3235                                                   ; <1>: parity error
 3236                                                   ; <0>: overrun error
 3237                           
 3238  00001A  00               sptmp3          .DB
 3239                           
 3240  00001B  0000             ibuftail3       .DW
 3241  00001D  0000             ibufhead3       .DW
 3242  00001F  0000             obuftail3       .DW
 3243  000021  0000             obufhead3       .DW
 3244  000023  0000             ibufcnt3        .DW
 3245  000025  0000             obufcnt3        .DW
 3246  000027  0000             icntmin3        .DW
 3247  000029  0000             icntmax3        .DW
 3248                           
  Tue Jul 17 11:00:24 2018                                                                                               Page   12




 3249                           ; serial port 16C550
 3250  00002B  00               spmode4         .DB     ; <7>: 0=no handshake, 1=handshake
 3251                                                   ; <6>: 0=software/1=hardware handshake
 3252                                                   ; <5>: not used
 3253                                                   ; <4>: not used
 3254                                                   ; <3>: 0=odd parity, 1=even parity
 3255                                                   ; <2>: 0=no parity, 1=parity as specified
 3256                                                   ;      by bit <3>
 3257                                                   ; <1:0> : baud rate
 3258                                                   ;       00 =  19200
 3259                                                   ;       01 =  38400
 3260                                                   ;       10 =  57600
 3261                                                   ;       11 = 115200
 3262  00002C                                           
 3263  00002C  00               splin4          .DB     ; <7>: /DSR line level
 3264                                                   ; <6>: /CTS line status
 3265  00002D                                           
 3266  00002D  00               sppause4        .DB
 3267  00002E  00               spout4          .DB
 3268  00002F  00               spstat4         .DB     ; staus
 3269                                                   ; <7>: rx error (data discarded)
 3270                                                   ; <6>: rx buffer overflow
 3271                                                   ; <5>: remote disconnession (/DSR line = 1)
 3272                                                   ; <4>: output buffer overflow
 3273                                                   ; <3>: break
 3274                                                   ; <2>: framing error
 3275                                                   ; <1>: parity error
 3276                                                   ; <0>: overrun error
 3277                           
 3278  000030  00               sptmp4          .DB
 3279                           
 3280  000031  0000             ibuftail4       .DW
 3281  000033  0000             ibufhead4       .DW
 3282  000035  0000             obuftail4       .DW
 3283  000037  0000             obufhead4       .DW
 3284  000039  0000             ibufcnt4        .DW
 3285  00003B  0000             obufcnt4        .DW
 3286  00003D  0000             icntmin4        .DW
 3287  00003F  0000             icntmax4        .DW
 3288                           
 3289  000041  00               spcnt4          .DB
 3290  000042  00               uartlsr         .DB
 3291  000043  00               uartiir         .DB
 3292                           
 3293  000044                   usb0name        .DS     36
 3294                           
 3295                                   .ENDS
 3296                           
 3300                                   .LIST on
 3301                           
 3302          019900           INPUTBUF        .EQU    MONBUF
 3303  F8FFB1                           
 3304                                   .CODEFF
 3305                                   .EXTERN ErrCls2, GetParm, PrintByte, PrintHex, GetParm32
 3306                                   .EXTERN PrintWord, CkStop, FF_Byte2Hex
 3307                                   .EXTERN _getopt                 ; FA/getopt.asm
 3308  FF25D1                           
  Tue Jul 17 11:00:24 2018                                                                                               Page   13




 3309                                   .GLOBAL Cmd_fddisk, Cmd_fdgetfmt, Cmd_fdres, Cmd_fdinit, Cmd_fdformat
 3310                                   .GLOBAL Cmd_fdverfmt, Cmd_fdread, Cmd_fdwrite, Cmd_fdverf, Cmd_fdlsys
 3311                                   .GLOBAL Cmd_fdtread, Cmd_fdtwrite, Cmd_fdtverf, Cmd_fdnew, Cmd_fdfs
 3312                           
 3313                                   .GLOBAL matcmd, atacmd, Cmd_mkhash
 3314                           
 3315                                   .LONGA  off
 3316                                   .LONGI  off
 3317                           
 3318                           ;---------------------------------------------------------------------------
 3319                           ; at '@' commands
 3320                           ;---------------------------------------------------------------------------
 3321                           
 3322                           ; @ commands
 3323  FF25D1                   matcmd:
 3324  FF25D1  A5 E3                    lda     <atnum
 3325  FF25D3  0A                       asl     a
 3326  FF25D4  AA                       tax
 3327  FF25D5  FC 02 28                 jsr     (MATVECS,x)
 3328                                   ;SCN_CR
 3329  FF25D8  60                       rts
 3330                           
 3331                           ; '@c "command"' send command to cbm fs emulator
 3332  FF25D9                   matsnd:
 3333  FF25D9  A9 0F                    lda     #15
 3334  FF25DB  85 F8                    sta     <atsa
 3335  FF25DD                           
 3336                           ; '@o "file" chnl' - open file
 3337  FF25DD                   matopn:
 3338  FF25DD  A5 EE                    lda     <atipb          ; bank of cmnd string
 3339  FF25DF  48                       pha
 3340  FF25E0  D4 E6                    pei     (atstr)         ; address of cmnd string
 3341  FF25E2  A5 F8                    lda     <atsa           ; chnl
 3342  FF25E4  48                       pha
 3343  FF25E5                           CBMFSCMD                ; send command
 3344  FF25E5  02 80                    cop     FN_CBMFSCMD
 3345                                   .MNLIST
 3346  FF25E7  B0 01                    bcs     materr          ; if error
 3347  FF25E9  60                       rts
 3348                           
 3349                           ; '@' or '@e': print error message
 3350  FF25EA                   materr:
 3351          000080           VARSIZ  .SET    128
 3352  FF25EA                           SCN_CR
 3353  FF25EA                           SCNPRCHAR
 3354                                   .MLIST
 3355  FF25EA  02 07                    cop     $07
 3356                                   .MNLIST
 3357  FF25EC  0D                       .DB     $0D
 3358                                   .MNLIST
 3359  FF25ED                           ACC16                   ; make room in stack
 3360  FF25ED  C2 20                    rep     #PMFLAG
 3361                                   .LONGA  on
 3362                                   .MNLIST
 3363  FF25EF  3B                       tsc
 3364  FF25F0  38                       sec
 3365  FF25F1  E9 80 00                 sbc     #VARSIZ
  Tue Jul 17 11:00:24 2018                                                                                               Page   14




 3366  FF25F4  1B                       tcs
 3367  FF25F5  1A                       inc     a               ; buffer pointer
 3368  FF25F6  A2 00                    ldx     #0
 3369  FF25F8  DA                       phx                     ; bank of buffer
 3370  FF25F9  48                       pha                     ; address of buffer
 3371  FF25FA  F4 80 00                 pea     #VARSIZ         ; size of buffer
 3372  FF25FD                           ACC08
 3373  FF25FD  E2 20                    sep     #PMFLAG
 3374                                   .LONGA  off
 3375                                   .MNLIST
 3376  FF25FF  A9 0F                    lda     #15             ; channel 15
 3377  FF2601  48                       pha
 3378  FF2602                           CBMFSRD                 ; read
 3379  FF2602  02 81                    cop     FN_CBMFSRW
 3380  FF2604  00                       .DB     $00
 3381                                   .MNLIST
 3382  FF2605                           ACC16
 3383  FF2605  C2 20                    rep     #PMFLAG
 3384                                   .LONGA  on
 3385                                   .MNLIST
 3386  FF2607  3B                       tsc
 3387  FF2608  1A                       inc     a               ; address of buffer
 3388  FF2609                           ACC08
 3389  FF2609  E2 20                    sep     #PMFLAG
 3390                                   .LONGA  off
 3391                                   .MNLIST
 3392  FF260B  A2 00                    ldx     #0              ; bank of buffer
 3393  FF260D                           SCNSTROUT               ; print string
 3394  FF260D  02 03                    cop     $03
 3395                                   .MNLIST
 3396  FF260F                           ACC16CLC
 3397  FF260F  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3398                                   .LONGA  on
 3399                                   .MNLIST
 3400  FF2611  3B                       tsc                     ; clean stack
 3401  FF2612  69 80 00                 adc     #VARSIZ
 3402  FF2615  1B                       tcs
 3403  FF2616                           ACC08
 3404  FF2616  E2 20                    sep     #PMFLAG
 3405                                   .LONGA  off
 3406                                   .MNLIST
 3407  FF2618  60                       rts
 3408                           
 3409                           ; '@d "$[drive[:pattern[=type]]]"'
 3410                           ; load and print directory
 3411  FF2619                   matdir:
 3412          000080           VARSIZ  .SET    128             ; mult. of 32 !!!
 3413  FF2619  A5 EE                    lda     <atipb          ; bank of cmnd string
 3414  FF261B  48                       pha
 3415  FF261C  D4 E6                    pei     (atstr)         ; address of cmnd string
 3416  FF261E  A9 00                    lda     #$00            ; chnl = 0
 3417  FF2620  48                       pha
 3418  FF2621                           CBMFSCMD                ; send command
 3419  FF2621  02 80                    cop     FN_CBMFSCMD
 3420                                   .MNLIST
 3421  FF2623  B0 C5                    bcs     materr          ; if error
 3422  FF2625                           ACC16                   ; make room in stack
  Tue Jul 17 11:00:24 2018                                                                                               Page   15




 3423  FF2625  C2 20                    rep     #PMFLAG
 3424                                   .LONGA  on
 3425                                   .MNLIST
 3426  FF2627  3B                       tsc
 3427  FF2628  38                       sec
 3428  FF2629  E9 80 00                 sbc     #VARSIZ
 3429  FF262C  1B                       tcs
 3430  FF262D  1A                       inc     a               ; buffer pointer
 3431  FF262E  85 EC                    sta     <atbuf
 3432  FF2630  64 EA                    stz     <atend          ; buffer count #
 3433  FF2632                           ACC08
 3434  FF2632  E2 20                    sep     #PMFLAG
 3435                                   .LONGA  off
 3436                                   .MNLIST
 3437  FF2634  64 EF                    stz     <atdir
 3438  FF2636  A9 06                    lda     #6              ; offset # blocks header
 3439  FF2638  85 E8                    sta     <atstart
 3440  FF263A  64 E9                    stz     <atstart+1
 3441  FF263C                           SCN_CR
 3442  FF263C                           SCNPRCHAR
 3443                                   .MLIST
 3444  FF263C  02 07                    cop     $07
 3445                                   .MNLIST
 3446  FF263E  0D                       .DB     $0D
 3447                                   .MNLIST
 3448  FF263F  20 92 26         ?10:    jsr     ?100            ; load buffer                   
 3449  FF2642  F0 40                    beq     ?90             ; no data: end of load
 3450  FF2644  A4 E8            ?14:    ldy     <atstart        
 3451  FF2646  5A                       phy
 3452  FF2647  B1 F0            ?14a:   lda     (atptr),y
 3453  FF2649  C9 20                    cmp     #' '
 3454  FF264B  D0 03                    bne     ?14b
 3455  FF264D  C8                       iny
 3456  FF264E  80 F7                    bra     ?14a
 3457  FF2650  84 E8            ?14b:   sty     <atstart
 3458  FF2652  7A                       ply
 3459  FF2653                           
 3460  FF2653                           ACC16CLC
 3461  FF2653  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3462                                   .LONGA  on
 3463                                   .MNLIST
 3464  FF2655  A5 F0                    lda     <atptr
 3465  FF2657  65 E8                    adc     <atstart
 3466  FF2659  A2 00                    ldx     #0
 3467  FF265B  DA                       phx                     ; bank of string (stack)
 3468  FF265C  48                       pha                     ; address of string
 3469                                   ;;ldy   <atstart
 3470  FF265D  88                       dey
 3471  FF265E  88                       dey
 3472  FF265F  B1 F0                    lda     (atptr),y       ; blocks #
 3473  FF2661  48                       pha
 3474  FF2662                           ACC08
 3475  FF2662  E2 20                    sep     #PMFLAG
 3476                                   .LONGA  off
 3477                                   .MNLIST
 3478  FF2664  4B                       phk                     ; bank of format
 3479  FF2665  F4 CF 26                 pea     #!?200          ; address of format
  Tue Jul 17 11:00:24 2018                                                                                               Page   16




 3480  FF2668  A2 09                    ldx     #9              ; # params
 3481  FF266A  DA                       phx
 3482  FF266B                           BPRINTF
 3483  FF266B  02 11                    cop     $11
 3484                                   .MNLIST
 3485  FF266D  A9 04                    lda     #4              ; just header need offset = 6
 3486  FF266F  85 E8                    sta     <atstart
 3487  FF2671                           ACC16CLC
 3488  FF2671  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3489                                   .LONGA  on
 3490                                   .MNLIST
 3491  FF2673  A5 F0                    lda     <atptr
 3492  FF2675  69 20 00                 adc     #32
 3493  FF2678  85 F0                    sta     <atptr
 3494  FF267A  C5 EA                    cmp     <atend
 3495  FF267C                           ACC08
 3496  FF267C  E2 20                    sep     #PMFLAG
 3497                                   .LONGA  off
 3498                                   .MNLIST
 3499  FF267E  90 C4                    bcc     ?14             ; next line in buffer
 3500  FF2680  24 EF                    bit     <atdir          ; bit 7 set if end
 3501  FF2682  10 BB                    bpl     ?10             ; loop
 3502  FF2684                   ?90:    ACC16CLC
 3503  FF2684  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3504                                   .LONGA  on
 3505                                   .MNLIST
 3506  FF2686  3B                       tsc                     ; clean stack
 3507  FF2687  69 80 00                 adc     #VARSIZ
 3508  FF268A  1B                       tcs
 3509  FF268B                           ACC08
 3510  FF268B  E2 20                    sep     #PMFLAG
 3511                                   .LONGA  off
 3512                                   .MNLIST
 3513  FF268D  A9 00                    lda     #0
 3514  FF268F                           CBMFSCLS
 3515  FF268F  02 82                    cop     FN_CBMFSCLS
 3516                                   .MNLIST
 3517  FF2691  60                       rts
 3518                           
 3519  FF2692  A9 00            ?100:   lda     #0              ; load buffer
 3520  FF2694  48                       pha                     ; bank of buffer
 3521  FF2695  D4 EC                    pei     (atbuf)         ; address of buffer
 3522  FF2697  F4 80 00                 pea     #VARSIZ         ; size of buffer
 3523  FF269A  A9 00                    lda     #$00
 3524  FF269C  48                       pha                     ; chnl 0
 3525  FF269D                           CBMFSRD                 ; read  
 3526  FF269D  02 81                    cop     FN_CBMFSRW
 3527  FF269F  00                       .DB     $00
 3528                                   .MNLIST
 3529  FF26A0  90 12                    bcc     ?104
 3530  FF26A2  68                       pla
 3531  FF26A3  68                       pla
 3532  FF26A4                           ACC16CLC
 3533  FF26A4  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3534                                   .LONGA  on
 3535                                   .MNLIST
 3536  FF26A6  3B                       tsc                     ; clean stack
  Tue Jul 17 11:00:24 2018                                                                                               Page   17




 3537  FF26A7  69 80 00                 adc     #VARSIZ
 3538  FF26AA  1B                       tcs
 3539  FF26AB                           ACC08
 3540  FF26AB  E2 20                    sep     #PMFLAG
 3541                                   .LONGA  off
 3542                                   .MNLIST
 3543  FF26AD  A9 00                    lda     #0
 3544  FF26AF                           CBMFSCLS        
 3545  FF26AF  02 82                    cop     FN_CBMFSCLS
 3546                                   .MNLIST
 3547  FF26B1  4C EA 25                 jmp     materr
 3548  FF26B4                   ?104:   ACC16
 3549  FF26B4  C2 20                    rep     #PMFLAG
 3550                                   .LONGA  on
 3551                                   .MNLIST
 3552  FF26B6  48                       pha
 3553  FF26B7  68                       pla
 3554  FF26B8  F0 12                    beq     ?110            ; end of data
 3555  FF26BA  C9 80 00                 cmp     #VARSIZ
 3556  FF26BD  B0 04                    bcs     ?106
 3557  FF26BF  A2 80                    ldx     #$80
 3558  FF26C1  86 EF                    stx     <atdir          ; EOF flag
 3559  FF26C3  18               ?106:   clc
 3560  FF26C4  65 EC                    adc     <atbuf
 3561  FF26C6  85 EA                    sta     <atend          ; end buffer
 3562  FF26C8  A5 EC                    lda     <atbuf
 3563  FF26CA  85 F0                    sta     <atptr
 3564  FF26CC                   ?110:   ACC08   
 3565  FF26CC  E2 20                    sep     #PMFLAG
 3566                                   .LONGA  off
 3567                                   .MNLIST
 3568  FF26CE  60                       rts
 3569  FF26CF                           
 3570  FF26CF                   ?200:
 3571  FF26CF  25 20 34 68 75           .DB     '% 4hu %s', $0D, 0
               20 25 73 0D 00 
 3572                           
 3573                           ; '@l "file" bnk [start]' load file (chnl 0)    
 3574  FF26D9                   matload:
 3575  FF26D9  64 F8                    stz     <atsa
 3576  FF26DB  80 05                    bra     matrd1
 3577  FF26DD                           
 3578  FF26DD                   matver:
 3579  FF26DD  60                       rts
 3580                           
 3581                           ; '@r "file" bnk [start]' open file for read (chnl 5)
 3582  FF26DE                   matrd:
 3583  FF26DE  A9 05                    lda     #5
 3584  FF26E0  85 F8                    sta     <atsa
 3585  FF26E2                   matrd1:
 3586  FF26E2                           SCN_CR  
 3587  FF26E2                           SCNPRCHAR
 3588                                   .MLIST
 3589  FF26E2  02 07                    cop     $07
 3590                                   .MNLIST
 3591  FF26E4  0D                       .DB     $0D
 3592                                   .MNLIST
  Tue Jul 17 11:00:24 2018                                                                                               Page   18




 3593  FF26E5  A5 EE                    lda     <atipb          ; bank of cmnd string
 3594  FF26E7  48                       pha
 3595  FF26E8  D4 E6                    pei     (atstr)         ; address of cmnd string
 3596  FF26EA  A5 F8                    lda     <atsa           ; chnl = 15
 3597  FF26EC  48                       pha
 3598  FF26ED                           CBMFSCMD                ; send command
 3599  FF26ED  02 80                    cop     FN_CBMFSCMD
 3600                                   .MNLIST
 3601  FF26EF  90 03                    bcc     ?02
 3602  FF26F1  4C EA 25         ?01:    jmp     materr          ; if error
 3603  FF26F4  64 F5            ?02:    stz     atlp
 3604  FF26F6  64 F6                    stz     atlp+1
 3605  FF26F8  A5 E5                    lda     <atbnk
 3606  FF26FA  85 F7                    sta     <atlp+2
 3607  FF26FC                           INDEX16
 3608  FF26FC  C2 10                    rep     #PXFLAG
 3609                                   .LONGI  on
 3610                                   .MNLIST
 3611  FF26FE  A0 00 00                 ldy     #0
 3612  FF2701  A9 EA                    lda     #$EA
 3613  FF2703  97 F5            ?03:    sta     [atlp],y
 3614  FF2705  C8                       iny
 3615  FF2706  D0 FB                    bne     ?03
 3616  FF2708                           INDEX08
 3617  FF2708  E2 10                    sep     #PXFLAG
 3618                                   .LONGI  off
 3619                                   .MNLIST
 3620  FF270A  24 E4                    bit     <atflag
 3621  FF270C                           ACC16
 3622  FF270C  C2 20                    rep     #PMFLAG
 3623                                   .LONGA  on
 3624                                   .MNLIST
 3625  FF270E  10 0E                    bpl     ?04             ; no start address
 3626  FF2710  A5 E8                    lda     <atstart
 3627  FF2712  85 F5                    sta     <atlp
 3628  FF2714  38                       sec
 3629  FF2715  A9 F0 FF                 lda     #$FFF0
 3630  FF2718  E5 E8                    sbc     <atstart
 3631  FF271A  85 F2                    sta     <atsiz
 3632  FF271C  80 05                    bra     ?06
 3633  FF271E  A9 F0 FF         ?04:    lda     #$FFF0
 3634  FF2721  85 F2                    sta     <atsiz
 3635  FF2723                   ?06:    ACC08
 3636  FF2723  E2 20                    sep     #PMFLAG
 3637                                   .LONGA  off
 3638                                   .MNLIST
 3639  FF2725  A5 F7                    lda     <atlp+2
 3640  FF2727  48                       pha
 3641  FF2728  D4 F5                    pei     (atlp)
 3642  FF272A  D4 F2                    pei     (atsiz)
 3643  FF272C  A5 F8                    lda     <atsa
 3644  FF272E  48                       pha
 3645  FF272F                           CBMFSRD                 ; read  
 3646  FF272F  02 81                    cop     FN_CBMFSRW
 3647  FF2731  00                       .DB     $00
 3648                                   .MNLIST
 3649  FF2732  08                       php
  Tue Jul 17 11:00:24 2018                                                                                               Page   19




 3650  FF2733                           ACC16
 3651  FF2733  C2 20                    rep     #PMFLAG
 3652                                   .LONGA  on
 3653                                   .MNLIST
 3654  FF2735  48                       pha
 3655  FF2736                           ACC08
 3656  FF2736  E2 20                    sep     #PMFLAG
 3657                                   .LONGA  off
 3658                                   .MNLIST
 3659  FF2738  A5 F8                    lda     <atsa
 3660  FF273A                           CBMFSCLS
 3661  FF273A  02 82                    cop     FN_CBMFSCLS
 3662                                   .MNLIST
 3663                                   ;SCN_CR
 3664  FF273C                           ACC16
 3665  FF273C  C2 20                    rep     #PMFLAG
 3666                                   .LONGA  on
 3667                                   .MNLIST
 3668  FF273E  68                       pla
 3669  FF273F                           ACC08
 3670  FF273F  E2 20                    sep     #PMFLAG
 3671                                   .LONGA  off
 3672                                   .MNLIST
 3673  FF2741  EB                       xba
 3674  FF2742  AA                       tax                     ; HI
 3675  FF2743  EB                       xba                     ; LOW
 3676  FF2744  20 48 19                 jsr     PrintWord
 3677                                   ;SCN_CR
 3678  FF2747  28                       plp
 3679  FF2748  B0 A7                    bcs     ?01
 3680  FF274A  60                       rts
 3681                           
 3682                           ; '@g chnl bnk [start]' - read in max. 256 bytes
 3683  FF274B                   matget:
 3684  FF274B                           ACC16
 3685  FF274B  C2 20                    rep     #PMFLAG
 3686                                   .LONGA  on
 3687                                   .MNLIST
 3688  FF274D  A9 00 01                 lda     #256
 3689  FF2750  85 F2                    sta     <atsiz
 3690  FF2752  64 F5                    stz     atlp
 3691  FF2754                           ACC08
 3692  FF2754  E2 20                    sep     #PMFLAG
 3693                                   .LONGA  off
 3694                                   .MNLIST
 3695  FF2756  A5 E5                    lda     <atbnk
 3696  FF2758  85 F7                    sta     <atlp+2
 3697  FF275A  A5 F7                    lda     <atlp+2
 3698  FF275C  48                       pha
 3699  FF275D  D4 F5                    pei     (atlp)
 3700  FF275F  D4 F2                    pei     (atsiz)
 3701  FF2761  A5 F8                    lda     <atsa
 3702  FF2763  48                       pha
 3703  FF2764                           CBMFSRD                 ; read
 3704  FF2764  02 81                    cop     FN_CBMFSRW
 3705  FF2766  00                       .DB     $00
 3706                                   .MNLIST
  Tue Jul 17 11:00:24 2018                                                                                               Page   20




 3707  FF2767  08                       php
 3708  FF2768  EB                       xba
 3709  FF2769  AA                       tax                     ; HI
 3710  FF276A  EB                       xba                     ; LOW
 3711  FF276B  20 48 19                 jsr     PrintWord
 3712                                   ;SCN_CR
 3713  FF276E  28                       plp
 3714  FF276F  90 01                    bcc     ?02
 3715  FF2771  60                       rts
 3716  FF2772  4C EA 25         ?02:    jmp     materr          ; if error
 3717                           
 3718                           ; '@p chnl bnk [start]' - write out max. 256 bytes
 3719  FF2775                   matput:
 3720  FF2775                           ACC16
 3721  FF2775  C2 20                    rep     #PMFLAG
 3722                                   .LONGA  on
 3723                                   .MNLIST
 3724  FF2777  A9 00 01                 lda     #256
 3725  FF277A  85 F2                    sta     <atsiz
 3726  FF277C  64 F5                    stz     atlp
 3727  FF277E                           ACC08
 3728  FF277E  E2 20                    sep     #PMFLAG
 3729                                   .LONGA  off
 3730                                   .MNLIST
 3731  FF2780  A5 E5                    lda     <atbnk
 3732  FF2782  85 F7                    sta     <atlp+2
 3733  FF2784  A5 F7                    lda     <atlp+2
 3734  FF2786  48                       pha
 3735  FF2787  D4 F5                    pei     (atlp)
 3736  FF2789  D4 F2                    pei     (atsiz)
 3737  FF278B  A5 F8                    lda     <atsa
 3738  FF278D  48                       pha
 3739  FF278E                           CBMFSWR                 ; write
 3740  FF278E  02 81                    cop     FN_CBMFSRW
 3741  FF2790  01                       .DB     $01
 3742                                   .MNLIST
 3743  FF2791  08                       php
 3744  FF2792  EB                       xba
 3745  FF2793  AA                       tax                     ; HI
 3746  FF2794  EB                       xba                     ; LOW
 3747  FF2795  20 48 19                 jsr     PrintWord
 3748                                   ;SCN_CR
 3749  FF2798  28                       plp
 3750  FF2799  90 01                    bcc     ?02
 3751  FF279B  60                       rts
 3752  FF279C  4C EA 25         ?02:    jmp     materr          ; if error
 3753                           
 3754                           ; '@s "file" bnk start end' save file chnl=1
 3755  FF279F                   matsave:
 3756  FF279F  A9 01                    lda     #1
 3757  FF27A1  85 F8                    sta     <atsa
 3758  FF27A3  80 04                    bra     matwr1
 3759                           
 3760                           ; '@w "file" bnk start end'
 3761  FF27A5                   matwr:
 3762  FF27A5  A9 05                    lda     #5
 3763  FF27A7  85 F8                    sta     <atsa
  Tue Jul 17 11:00:24 2018                                                                                               Page   21




 3764                           
 3765  FF27A9                   matwr1:
 3766  FF27A9                           SCN_CR  
 3767  FF27A9                           SCNPRCHAR
 3768                                   .MLIST
 3769  FF27A9  02 07                    cop     $07
 3770                                   .MNLIST
 3771  FF27AB  0D                       .DB     $0D
 3772                                   .MNLIST
 3773  FF27AC  A5 EE                    lda     <atipb          ; bank of cmnd string
 3774  FF27AE  48                       pha
 3775  FF27AF  D4 E6                    pei     (atstr)         ; address of cmnd string
 3776  FF27B1  A5 F8                    lda     <atsa           ; chnl = 15
 3777  FF27B3  48                       pha
 3778  FF27B4                           CBMFSCMD                ; send command
 3779  FF27B4  02 80                    cop     FN_CBMFSCMD
 3780                                   .MNLIST
 3781  FF27B6  90 03                    bcc     ?02
 3782  FF27B8  4C EA 25         ?01:    jmp     materr          ; if error
 3783  FF27BB  64 F5            ?02:    stz     atlp
 3784  FF27BD  64 F6                    stz     atlp+1
 3785  FF27BF  A5 E5                    lda     <atbnk
 3786  FF27C1  85 F7                    sta     <atlp+2
 3787  FF27C3                           ACC16
 3788  FF27C3  C2 20                    rep     #PMFLAG
 3789                                   .LONGA  on
 3790                                   .MNLIST
 3791  FF27C5  A5 E8                    lda     <atstart
 3792  FF27C7  85 F5                    sta     <atlp
 3793  FF27C9  38                       sec
 3794  FF27CA  A5 EA                    lda     <atend
 3795  FF27CC  E5 E8                    sbc     <atstart
 3796  FF27CE  85 F2                    sta     <atsiz
 3797  FF27D0                           ACC08
 3798  FF27D0  E2 20                    sep     #PMFLAG
 3799                                   .LONGA  off
 3800                                   .MNLIST
 3801  FF27D2  A5 F7                    lda     <atlp+2
 3802  FF27D4  48                       pha
 3803  FF27D5  D4 F5                    pei     (atlp)
 3804  FF27D7  D4 F2                    pei     (atsiz)
 3805  FF27D9  A5 F8                    lda     <atsa
 3806  FF27DB  48                       pha
 3807  FF27DC                           CBMFSWR                 ; write
 3808  FF27DC  02 81                    cop     FN_CBMFSRW
 3809  FF27DE  01                       .DB     $01
 3810                                   .MNLIST
 3811  FF27DF  08                       php
 3812  FF27E0                           ACC16
 3813  FF27E0  C2 20                    rep     #PMFLAG
 3814                                   .LONGA  on
 3815                                   .MNLIST
 3816  FF27E2  48                       pha
 3817  FF27E3                           ACC08
 3818  FF27E3  E2 20                    sep     #PMFLAG
 3819                                   .LONGA  off
 3820                                   .MNLIST
  Tue Jul 17 11:00:24 2018                                                                                               Page   22




 3821  FF27E5  A5 F8                    lda     <atsa
 3822  FF27E7                           CBMFSCLS
 3823  FF27E7  02 82                    cop     FN_CBMFSCLS
 3824                                   .MNLIST
 3825                                   ;SCN_CR
 3826  FF27E9                           ACC16
 3827  FF27E9  C2 20                    rep     #PMFLAG
 3828                                   .LONGA  on
 3829                                   .MNLIST
 3830  FF27EB  68                       pla
 3831  FF27EC                           ACC08
 3832  FF27EC  E2 20                    sep     #PMFLAG
 3833                                   .LONGA  off
 3834                                   .MNLIST
 3835  FF27EE  EB                       xba
 3836  FF27EF  AA                       tax                     ; HI
 3837  FF27F0  EB                       xba                     ; LOW
 3838  FF27F1  20 48 19                 jsr     PrintWord
 3839                                   ;SCN_CR
 3840  FF27F4  28                       plp
 3841  FF27F5  B0 C1                    bcs     ?01
 3842  FF27F7  60                       rts
 3843                           
 3844                           ; '@z' - close all
 3845  FF27F8                   matclsall:
 3846  FF27F8  A9 0F                    lda     #15
 3847  FF27FA                           CBMFSCLS
 3848  FF27FA  02 82                    cop     FN_CBMFSCLS
 3849                                   .MNLIST
 3850  FF27FC  60                       rts
 3851                           
 3852                           ; '@x chnl' - close chnl
 3853  FF27FD                   matclose:
 3854  FF27FD  A5 F8                    lda     <atsa
 3855  FF27FF                           CBMFSCLS
 3856  FF27FF  02 82                    cop     FN_CBMFSCLS
 3857                                   .MNLIST
 3858  FF2801  60                       rts
 3859                           
 3860  FF2802                   MATVECS:
 3861  FF2802  EA25 F827 FD27           .DW     materr, matclsall, matclose, matget, matput
               4B27 7527 
 3862  FF280C  1926 D925 D926           .DW     matdir, matsnd, matload, matsave, matver
               9F27 DD26 
 3863  FF2816  DE26 A527 DD25           .DW     matrd, matwr, matopn
 3864                           
 3865                           ;---------------------------------------------------------------------------
 3866  FF281C                           
 3867                           ; test hash
 3868          0000E2           HASH    .EQU    SMXTmp
 3869          0000E4           FCBS    .EQU    SMXTmp+2
 3870                           
 3871  FF281C                   Cmd_mkhash:
 3872  FF281C                           SCNPRCHAR
 3873  FF281C  02 07                    cop     $07
 3874                                   .MNLIST
 3875  FF281E  0D                       .DB     KB_CR
  Tue Jul 17 11:00:24 2018                                                                                               Page   23




 3876                           
 3877  FF281F  A2 0A                    ldx     #$0A
 3878  FF2821  BF 70 28 FF      ?02:    lda     >TESTSTR,x
 3879  FF2825  95 E4                    sta     FCBS,x
 3880  FF2827  CA                       dex
 3881  FF2828  10 F7                    bpl     ?02
 3882  FF282A  A2 E4                    ldx     #FCBS
 3883  FF282C  20 3A 28                 jsr     _mkhash
 3884  FF282F  A5 E2                    lda     HASH
 3885  FF2831  A6 E3                    ldx     HASH+1
 3886  FF2833  20 48 19                 jsr     PrintWord
 3887  FF2836                           SCNPRCHAR
 3888  FF2836  02 07                    cop     $07
 3889                                   .MNLIST
 3890  FF2838  0D                       .DB     KB_CR
 3891  FF2839  60                       rts     
 3892  FF283A                           
 3893  FF283A                   _mkhash:
 3894  FF283A  64 E2                    stz     HASH
 3895  FF283C  64 E3                    stz     HASH+1
 3896  FF283E  B5 00                    lda     <0,x
 3897  FF2840  F0 2D                    beq     ?20
 3898  FF2842  C9 E5                    cmp     #$E5
 3899  FF2844  F0 29                    beq     ?20
 3900  FF2846  29 7F                    and     #$7F
 3901  FF2848  85 E3                    sta     HASH+1
 3902  FF284A  A0 0A                    ldy     #$0A
 3903  FF284C                   ?04:    ACC16
 3904  FF284C  C2 20                    rep     #PMFLAG
 3905                                   .LONGA  on
 3906                                   .MNLIST
 3907  FF284E  A5 E2                    lda     HASH
 3908  FF2850  0A                       asl     a
 3909  FF2851  69 00 00                 adc     #$0000
 3910  FF2854  85 E2                    sta     HASH
 3911  FF2856                           ACC08
 3912  FF2856  E2 20                    sep     #PMFLAG
 3913                                   .LONGA  off
 3914                                   .MNLIST
 3915  FF2858  E8                       inx
 3916  FF2859  B5 00                    lda     <0,x
 3917  FF285B  29 7F                    and     #$7F
 3918  FF285D  45 E2                    eor     HASH
 3919  FF285F  85 E2                    sta     HASH
 3920  FF2861  88                       dey
 3921  FF2862  D0 E8                    bne     ?04
 3922  FF2864                           ACC16
 3923  FF2864  C2 20                    rep     #PMFLAG
 3924                                   .LONGA  on
 3925                                   .MNLIST
 3926  FF2866  A5 E2                    lda     HASH
 3927  FF2868  D0 03                    bne     ?08
 3928  FF286A  1A                       inc     a
 3929  FF286B  85 E2                    sta     HASH
 3930  FF286D                   ?08:    ACC08
 3931  FF286D  E2 20                    sep     #PMFLAG
 3932                                   .LONGA  off
  Tue Jul 17 11:00:24 2018                                                                                               Page   24




 3933                                   .MNLIST
 3934  FF286F  60               ?20:    rts
 3935                           
 3936  FF2870                   TESTSTR:
 3937  FF2870  2E 2E 20 20 20           .DB     '..         '
               20 20 20 20 20 
               20 
 3938  FF287B                           
 3939                           ; # fdlsys [drive = 0]
 3940                           ; load rom.bin from floppy and store in bank $E0..$E7
 3941  FF287B                   Cmd_fdlsys:
 3942  FF287B  64 EF                    stz     SMFflag
 3943  FF287D  A9 00                    lda     #$00
 3944  FF287F  B0 12                    bcs     ?04             ; use default drive #0
 3945  FF2881  A5 BC                    lda     SMTmpK
 3946  FF2883  05 BB                    ora     SMTmpH
 3947  FF2885  F0 03                    beq     ?02
 3948  FF2887  4C E5 2B                 jmp     CmdErr
 3949  FF288A  A5 BA            ?02:    lda     SMTmpL
 3950  FF288C  C9 04                    cmp     #$04
 3951  FF288E  90 03                    bcc     ?04
 3952  FF2890  4C E5 2B                 jmp     CmdErr
 3953  FF2893  85 E4            ?04:    sta     SMTmp3          ; drive
 3954  FF2895  AA                       tax                     ; X = drive
 3955  FF2896                           FDCGETFMT               ; get disk format
 3956  FF2896  02 30                    cop     $30
 3957  FF2898  04                       .DB     $04
 3958                                   .MNLIST
 3959  FF2899  90 03                    bcc     ?06
 3960  FF289B  4C 78 2B                 jmp     drs0            ; error
 3961  FF289E  C0 02            ?06:    cpy     #$02            ; required format = $02
 3962  FF28A0  F0 32                    beq     ?08
 3963  FF28A2                           SCNPRINT                ; error 
 3964  FF28A2  02 01                    cop     $01
 3965                                   .MNLIST
 3966  FF28A4  0D 1B 71 00              .DB     $0D, KB_ESC, 'q', $00
 3967  FF28A8                           SCNPRINT
 3968  FF28A8  02 01                    cop     $01
 3969                                   .MNLIST
 3970  FF28AA  3A 3A 45 52 52           .DB     '::ERROR - disk format is not 02, but ', $00
               4F 52 20 2D 20 
               64 69 73 6B 20 
               66 6F 72 6D 61 
               74 20 69 73 20 
               6E 6F 74 20 30 
               32 2C 20 62 75 
               74 20 00 
 3971  FF28D0  98                       tya
 3972  FF28D1  4C 71 19                 jmp     PrintHex
 3973  FF28D4  A5 E4            ?08:    lda     SMTmp3          ; drive
 3974  FF28D6  48                       pha
 3975  FF28D7  A9 00                    lda     #$00
 3976  FF28D9  48                       pha                     ; track = 0
 3977  FF28DA  48                       pha                     ; buffer = 0
 3978  FF28DB  48                       pha                     ; flag = dos format
 3979  FF28DC                           FDCTKRD                 ; read whole track 0
 3980  FF28DC  02 35                    cop     $35
  Tue Jul 17 11:00:24 2018                                                                                               Page   25




 3981  FF28DE  00                       .DB     $00
 3982                                   .MNLIST
 3983  FF28DF  90 03                    bcc     ?10
 3984  FF28E1  4C F5 2D                 jmp     fdcr            ; error
 3985  FF28E4                   ?10:    INDEX16
 3986  FF28E4  C2 10                    rep     #PXFLAG
 3987                                   .LONGI  on
 3988                                   .MNLIST
 3989  FF28E6  A0 00 26                 ldy     #$2600          ; start of root directory
 3990  FF28E9  84 BA                    sty     SMTmpL
 3991  FF28EB                           INDEX08
 3992  FF28EB  E2 10                    sep     #PXFLAG
 3993                                   .LONGI  off
 3994                                   .MNLIST
 3995  FF28ED  A9 02                    lda     #$02
 3996  FF28EF  85 BC                    sta     SMTmpK
 3997  FF28F1  A7 BA            ?12:    lda     [SMTmpL]        ; scan root directory
 3998  FF28F3  D0 2A                    bne     ?16
 3999  FF28F5                   ?14:    SCNPRINT                ; error -- end of root directory 
 4000  FF28F5  02 01                    cop     $01
 4001                                   .MNLIST
 4002  FF28F7  0D 1B 71 00              .DB     $0D, KB_ESC, 'q', $00
 4003  FF28FB                           SCNPRINT
 4004  FF28FB  02 01                    cop     $01
 4005                                   .MNLIST
 4006  FF28FD  3A 3A 45 52 52           .DB     '::ERROR - file ROM.BIN not found', $00
               4F 52 20 2D 20 
               66 69 6C 65 20 
               52 4F 4D 2E 42 
               49 4E 20 6E 6F 
               74 20 66 6F 75 
               6E 64 00 
 4007  FF291E  60                       rts
 4008  FF291F  A2 00            ?16:    ldx     #0              ; search 'rom.bin'
 4009  FF2921  9B                       txy
 4010  FF2922  B7 BA            ?16l:   lda     [SMTmpL],y
 4011  FF2924  DF 3A 2B FF              cmp     >SYNAM,x
 4012  FF2928  F0 12                    beq     ?17
 4013  FF292A                           ACC16CLC
 4014  FF292A  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 4015                                   .LONGA  on
 4016                                   .MNLIST
 4017  FF292C  A5 BA                    lda     SMTmpL
 4018  FF292E  69 20 00                 adc     #$0020
 4019  FF2931  85 BA                    sta     SMTmpL
 4020  FF2933  C9 00 42                 cmp     #$4200          ; end of root directory?
 4021  FF2936                           ACC08
 4022  FF2936  E2 20                    sep     #PMFLAG
 4023                                   .LONGA  off
 4024                                   .MNLIST
 4025  FF2938  90 B7                    bcc     ?12             ; loop scan
 4026  FF293A  B0 B9                    bcs     ?14             ; end of root directory
 4027  FF293C  C8               ?17:    iny
 4028  FF293D  E8                       inx
 4029  FF293E  E0 0B                    cpx     #$0B
 4030  FF2940  90 E0                    bcc     ?16l
 4031  FF2942  B7 BA                    lda     [SMTmpL],y      ; name ok -- check record
  Tue Jul 17 11:00:24 2018                                                                                               Page   26




 4032  FF2944  C9 20                    cmp     #$20            ; attribute
 4033  FF2946  F0 29                    beq     ?20
 4034  FF2948                   ?18:    SCNPRINT                ; error -- entry not valid 
 4035  FF2948  02 01                    cop     $01
 4036                                   .MNLIST
 4037  FF294A  0D 1B 71 00              .DB     $0D, KB_ESC, 'q', $00
 4038  FF294E                           SCNPRINT
 4039  FF294E  02 01                    cop     $01
 4040                                   .MNLIST
 4041  FF2950  3A 3A 45 52 52           .DB     '::ERROR - invalid ROM.BIN entry', $00
               4F 52 20 2D 20 
               69 6E 76 61 6C 
               69 64 20 52 4F 
               4D 2E 42 49 4E 
               20 65 6E 74 72 
               79 00 
 4042  FF2970  60                       rts
 4043  FF2971  A0 1A            ?20:    ldy     #$1A            ; check cluster
 4044  FF2973  B7 BA                    lda     [SMTmpL],y
 4045  FF2975  C9 02                    cmp     #$02
 4046  FF2977  D0 CF                    bne     ?18             ; will be cluster #2
 4047  FF2979  C8                       iny
 4048  FF297A  B7 BA                    lda     [SMTmpL],y
 4049  FF297C  D0 CA                    bne     ?18
 4050  FF297E  C8                       iny
 4051  FF297F  C8                       iny
 4052  FF2980  C8                       iny
 4053  FF2981                           ACC16                   ; test size
 4054  FF2981  C2 20                    rep     #PMFLAG
 4055                                   .LONGA  on
 4056                                   .MNLIST
 4057  FF2983  B7 BA                    lda     [SMTmpL],y      ; size H
 4058  FF2985  85 E8                    sta     SMdwTmp1+2
 4059  FF2987  88                       dey
 4060  FF2988  88                       dey
 4061  FF2989  B7 BA                    lda     [SMTmpL],y      ; size L
 4062  FF298B  85 E6                    sta     SMdwTmp1
 4063  FF298D                           ACC08
 4064  FF298D  E2 20                    sep     #PMFLAG
 4065                                   .LONGA  off
 4066                                   .MNLIST
 4067  FF298F  D0 B7                    bne     ?18             ; size L must be 0
 4068  FF2991  A5 E9                    lda     SMdwTmp1+3
 4069  FF2993  D0 B3                    bne     ?18             ; must be 0
 4070  FF2995  A5 E8                    lda     SMdwTmp1+2
 4071  FF2997  C9 08                    cmp     #$08
 4072  FF2999  D0 AD                    bne     ?18             ; must be 0
 4073                                   ; now check FAT 1 -- ROM.BIN must be in sqeuential clusters
 4074                                   ; starting from cluster #2 - last cluster $0402
 4075  FF299B  A0 01                    ldy     #1
 4076  FF299D                           CPU16
 4077  FF299D  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 4078                                   .LONGA  on
 4079                                   .LONGI  on
 4080                                   .MNLIST
 4081  FF299F  A9 00 02                 lda     #$0200          ; start of FAT #1
 4082  FF29A2  85 BA                    sta     SMTmpL
  Tue Jul 17 11:00:24 2018                                                                                               Page   27




 4083  FF29A4  A7 BA                    lda     [SMTmpL]        
 4084  FF29A6  C9 F0 FF                 cmp     #$FFF0
 4085  FF29A9  D0 34                    bne     ?28
 4086  FF29AB  B7 BA                    lda     [SMTmpL],y      ; must be $FFFF
 4087  FF29AD  1A                       inc     a
 4088  FF29AE  D0 2F                    bne     ?28
 4089  FF29B0  C8                       iny
 4090  FF29B1  C8                       iny
 4091  FF29B2  84 EA                    sty     SMdwTmp2        ; next expected cluster
 4092  FF29B4  B7 BA            ?22:    lda     [SMTmpL],y
 4093  FF29B6  29 FF 0F                 and     #$0FFF          ; mask 12 bit low
 4094  FF29B9  C5 EA                    cmp     SMdwTmp2        ; even cluster
 4095  FF29BB  D0 22                    bne     ?28             ; unmatch
 4096  FF29BD  C8                       iny                     ; 12 bit high
 4097  FF29BE  C9 01 04                 cmp     #$0401
 4098  FF29C1  D0 07                    bne     ?24
 4099  FF29C3  A9 FF 0F                 lda     #$0FFF
 4100  FF29C6  85 EA                    sta     SMdwTmp2        ; mark last cluster
 4101  FF29C8  80 02                    bra     ?26
 4102  FF29CA  E6 EA            ?24:    inc     SMdwTmp2
 4103  FF29CC  B7 BA            ?26:    lda     [SMTmpL],y
 4104  FF29CE  4A                       lsr     a
 4105  FF29CF  4A                       lsr     a
 4106  FF29D0  4A                       lsr     a
 4107  FF29D1  4A                       lsr     a               ; odd cluster
 4108  FF29D2  C8                       iny
 4109  FF29D3  C8                       iny                     ; next FAT entry
 4110  FF29D4  C5 EA                    cmp     SMdwTmp2        ; even cluster
 4111  FF29D6  D0 07                    bne     ?28
 4112  FF29D8  E6 EA                    inc     SMdwTmp2
 4113  FF29DA  C9 FF 0F                 cmp     #$0FFF
 4114  FF29DD  D0 D5                    bne     ?22             ; loop
 4115  FF29DF                   ?28:    CPU08
 4116  FF29DF  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 4117                                   .LONGA  off
 4118                                   .LONGI  off
 4119                                   .MNLIST
 4120  FF29E1  F0 1F                    beq     ?30             ; ok -- check FAT done
 4121  FF29E3                           SCNPRINT                ; error -- invalid FAT 
 4122  FF29E3  02 01                    cop     $01
 4123                                   .MNLIST
 4124  FF29E5  0D 1B 71 00              .DB     $0D, KB_ESC, 'q', $00
 4125  FF29E9                           SCNPRINT
 4126  FF29E9  02 01                    cop     $01
 4127                                   .MNLIST
 4128  FF29EB  3A 3A 45 52 52           .DB     '::ERROR - invalid FAT', $00
               4F 52 20 2D 20 
               69 6E 76 61 6C 
               69 64 20 46 41 
               54 00 
 4129  FF2A01  60                       rts
 4130  FF2A02                   ?30:    SCNPRINT
 4131  FF2A02  02 01                    cop     $01
 4132                                   .MNLIST
 4133  FF2A04  0D 1B 71 00              .DB     $0D, KB_ESC, 'q', $00
 4134  FF2A08                           SCNPRINT
 4135  FF2A08  02 01                    cop     $01
  Tue Jul 17 11:00:24 2018                                                                                               Page   28




 4136                                   .MNLIST
 4137  FF2A0A  3A 3A 6C 6F 61           .DB     '::load "ROM.BIN" from bank $E0 to bank $E7', $00
               64 20 22 52 4F 
               4D 2E 42 49 4E 
               22 20 66 72 6F 
               6D 20 62 61 6E 
               6B 20 24 45 30 
               20 74 6F 20 62 
               61 6E 6B 20 24 
               45 37 00 
 4138  FF2A35  A9 E0                    lda     #$E0
 4139  FF2A37  85 FA                    sta     SMdwTmp3+2
 4140  FF2A39  A9 01                    lda     #1
 4141  FF2A3B  85 E5                    sta     SMTmp3+1        ; track = 1
 4142  FF2A3D  A0 00                    ldy     #0
 4143  FF2A3F                           CPU16
 4144  FF2A3F  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 4145                                   .LONGA  on
 4146                                   .LONGI  on
 4147                                   .MNLIST
 4148  FF2A41  A9 00 42                 lda     #$4200          ; start of cluster #2
 4149  FF2A44  85 BA                    sta     SMTmpL
 4150  FF2A46  64 F8                    stz     SMdwTmp3
 4151  FF2A48  B7 BA            ?34:    lda     [SMTmpL],y      ; copy the last 3 sectors of track 0, head 1
 4152  FF2A4A  97 F8                    sta     [SMdwTmp3],y
 4153  FF2A4C  C8                       iny
 4154  FF2A4D  C8                       iny
 4155  FF2A4E  C0 00 06                 cpy     #$0600
 4156  FF2A51  90 F5                    bcc     ?34
 4157  FF2A53  84 F8                    sty     SMdwTmp3        ; update dest pointer
 4158  FF2A55  84 E6                    sty     SMdwTmp1        ; count moved bytes 
 4159  FF2A57  64 E8                    stz     SMdwTmp1+2
 4160  FF2A59  64 BA                    stz     SMTmpL          ; buffer pointer
 4161  FF2A5B                           CPU08
 4162  FF2A5B  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 4163                                   .LONGA  off
 4164                                   .LONGI  off
 4165                                   .MNLIST
 4166  FF2A5D  A5 E4            ?36:    lda     SMTmp3          ; loop track 1..28
 4167  FF2A5F  48                       pha                     ; drive
 4168  FF2A60  A5 E5                    lda     SMTmp3+1
 4169  FF2A62  48                       pha                     ; track
 4170  FF2A63  F4 00 00                 pea     #0              ; buffer = 0, flag = 0
 4171  FF2A66                           FDCTKRD                 ; read whole track
 4172  FF2A66  02 35                    cop     $35
 4173  FF2A68  00                       .DB     $00
 4174                                   .MNLIST
 4175  FF2A69  90 03                    bcc     ?38
 4176  FF2A6B  4C F5 2D                 jmp     fdcr            ; error
 4177  FF2A6E  20 10 2B         ?38:    jsr     ?100            ; move bytes
 4178  FF2A71  A6 E5            ?42:    ldx     SMTmp3+1
 4179  FF2A73  E8                       inx
 4180  FF2A74  86 E5                    stx     SMTmp3+1
 4181  FF2A76  E0 1D                    cpx     #29
 4182  FF2A78  90 E3                    bcc     ?36             ; loop track 1..28
 4183  FF2A7A  A5 E4                    lda     SMTmp3
 4184  FF2A7C  48                       pha                     ; drive
  Tue Jul 17 11:00:24 2018                                                                                               Page   29




 4185  FF2A7D  DA                       phx                     ; track 29
 4186  FF2A7E  A9 00                    lda     #0
 4187  FF2A80  48                       pha                     ; head = 0
 4188  FF2A81  1A                       inc     a
 4189  FF2A82  48                       pha                     ; secror = 1
 4190  FF2A83  A9 0D                    lda     #13
 4191  FF2A85  48                       pha                     ; read 13 sectors
 4192  FF2A86  F4 00 00                 pea     #0              ; buffer = 0, flag = 0
 4193  FF2A89                           FDCREAD
 4194  FF2A89  02 31                    cop     $31
 4195  FF2A8B  00                       .DB     $00
 4196                                   .MNLIST
 4197  FF2A8C  90 03                    bcc     ?44
 4198  FF2A8E  4C F5 2D                 jmp     fdcr
 4199  FF2A91  20 10 2B         ?44:    jsr     ?100            ; move bytes
 4200  FF2A94                           SCNPRCHAR
 4201  FF2A94  02 07                    cop     $07
 4202                                   .MNLIST
 4203  FF2A96  0D                       .DB     KB_CR
 4204  FF2A97  A5 E8                    lda     SMdwTmp1+2
 4205  FF2A99  20 71 19                 jsr     PrintHex        ; number of bytes
 4206  FF2A9C  A5 E6                    lda     SMdwTmp1
 4207  FF2A9E  A6 E7                    ldx     SMdwTmp1+1
 4208  FF2AA0  20 48 19                 jsr     PrintWord       ; number of bytes
 4209  FF2AA3  A5 FA                    lda     SMdwTmp3+2
 4210  FF2AA5  20 71 19                 jsr     PrintHex        ; final address +1
 4211  FF2AA8  A5 F8                    lda     SMdwTmp3
 4212  FF2AAA  A6 F9                    ldx     SMdwTmp3+1
 4213  FF2AAC  20 48 19                 jsr     PrintWord
 4214  FF2AAF  A5 E6                    lda     SMdwTmp1
 4215  FF2AB1  05 E7                    ora     SMdwTmp1+1      ; must be null
 4216  FF2AB3  D0 12                    bne     ?46
 4217  FF2AB5  A5 F8                    lda     SMdwTmp3
 4218  FF2AB7  05 F9                    ora     SMdwTmp3+1      ; must be null
 4219  FF2AB9  D0 0C                    bne     ?46
 4220  FF2ABB  A5 E8                    lda     SMdwTmp1+2
 4221  FF2ABD  C9 08                    cmp     #$08            ; must be = 8
 4222  FF2ABF  D0 06                    bne     ?46
 4223  FF2AC1  A5 FA                    lda     SMdwTmp3+2
 4224  FF2AC3  C9 E8                    cmp     #$E8            ; must be = E8
 4225  FF2AC5  F0 28                    beq     ?48
 4226  FF2AC7                   ?46:    SCNPRINT
 4227  FF2AC7  02 01                    cop     $01
 4228                                   .MNLIST
 4229  FF2AC9  20 2D 2D 20 45           .DB     ' -- ERROR -- flash cannot be updated', $00
               52 52 4F 52 20 
               2D 2D 20 66 6C 
               61 73 68 20 63 
               61 6E 6E 6F 74 
               20 62 65 20 75 
               70 64 61 74 65 
               64 00 
 4230  FF2AEE  60                       rts
 4231  FF2AEF  A9 80            ?48:    lda     #$80
 4232  FF2AF1  85 EF                    sta     SMFflag
 4233  FF2AF3                           SCNPRINT
 4234  FF2AF3  02 01                    cop     $01
  Tue Jul 17 11:00:24 2018                                                                                               Page   30




 4235                                   .MNLIST
 4236  FF2AF5  20 4F 4B 3A 20           .DB     ' OK: flash can be updated', $00
               66 6C 61 73 68 
               20 63 61 6E 20 
               62 65 20 75 70 
               64 61 74 65 64 
               00 
 4237  FF2B0F  60                       rts     
 4238  FF2B10  A0 00            ?100:   ldy     #0      
 4239  FF2B12                           CPU16
 4240  FF2B12  C2 30                    rep     #(PMFLAG.OR.PXFLAG)
 4241                                   .LONGA  on
 4242                                   .LONGI  on
 4243                                   .MNLIST
 4244  FF2B14  85 EA                    sta     SMdwTmp2        ; number of bytes
 4245  FF2B16  B7 BA            ?200:   lda     [SMTmpL],y      ; copy 36 sectors
 4246  FF2B18  97 F8                    sta     [SMdwTmp3],y
 4247  FF2B1A  C8                       iny
 4248  FF2B1B  C8                       iny
 4249  FF2B1C  C4 EA                    cpy     SMdwTmp2
 4250  FF2B1E  90 F6                    bcc     ?200
 4251  FF2B20  A5 E6                    lda     SMdwTmp1
 4252  FF2B22  18                       clc
 4253  FF2B23  65 EA                    adc     SMdwTmp2        ; update count of moved bytes
 4254  FF2B25  85 E6                    sta     SMdwTmp1
 4255  FF2B27  A5 E8                    lda     SMdwTmp1+2
 4256  FF2B29  69 00 00                 adc     #$0000
 4257  FF2B2C  85 E8                    sta     SMdwTmp1+2      
 4258  FF2B2E  98                       tya
 4259  FF2B2F  65 F8                    adc     SMdwTmp3        ; update dest pointer
 4260  FF2B31  85 F8                    sta     SMdwTmp3
 4261  FF2B33                           CPU08
 4262  FF2B33  E2 30                    sep     #(PMFLAG.OR.PXFLAG)
 4263                                   .LONGA  off
 4264                                   .LONGI  off
 4265                                   .MNLIST
 4266  FF2B35  90 02                    bcc     ?202
 4267  FF2B37  E6 FA                    inc     SMdwTmp3+2
 4268  FF2B39  60               ?202:   rts
 4269                           
 4270  FF2B3A                   SYNAM:
 4271  FF2B3A  52 4F 4D 20 20           .DB     'ROM     BIN'
               20 20 20 42 49 
               4E 
 4272  FF2B45                           
 4273                           
 4274                           ; # fdnew fmt0 [fmt1 = $80]
 4275  FF2B45                   Cmd_fdnew:
 4276  FF2B45  90 03                    bcc     ?00
 4277  FF2B47  4C E5 2B                 jmp     CmdErr          ; no parametri
 4278  FF2B4A  A5 BC            ?00:    lda     SMTmpK
 4279  FF2B4C  05 BB                    ora     SMTmpH
 4280  FF2B4E  F0 03                    beq     ?01
 4281  FF2B50  4C E5 2B                 jmp     CmdErr
 4282  FF2B53  A5 BA            ?01:    lda     SMTmpL
 4283  FF2B55  48                       pha                     ; format #0
 4284  FF2B56  20 5A 01                 jsr     GetParm         ; format #1
  Tue Jul 17 11:00:24 2018                                                                                               Page   31




 4285  FF2B59  90 04                    bcc     ?02
 4286  FF2B5B  A9 80                    lda     #$80
 4287  FF2B5D  85 BA                    sta     SMTmpL
 4288  FF2B5F  FA               ?02:    plx                     ; X = format #0
 4289  FF2B60  A4 BA                    ldy     SMTmpL          ; Y = format #1
 4290  FF2B62                           FDNEWRD
 4291  FF2B62  02 30                    cop     $30
 4292  FF2B64  02                       .DB     $02
 4293                                   .MNLIST
 4294  FF2B65  80 55                    bra     drs
 4295                           
 4296                           ; # fdgetfmt [0=default|1] - get current disk format
 4297  FF2B67                   Cmd_fdgetfmt:
 4298  FF2B67  F0 06                    beq     ?01
 4299  FF2B69  A5 BC                    lda     SMTmpK
 4300  FF2B6B  05 BB                    ora     SMTmpH
 4301  FF2B6D  D0 76                    bne     CmdErr
 4302  FF2B6F  A6 BA            ?01:    ldx     SMTmpL
 4303  FF2B71  C9 04                    cmp     #$04
 4304  FF2B73  B0 70                    bcs     CmdErr
 4305  FF2B75                           FDCGETFMT
 4306  FF2B75  02 30                    cop     $30
 4307  FF2B77  04                       .DB     $04
 4308                                   .MNLIST
 4309                                   ;FDCGETST
 4310  FF2B78  08               drs0:   php     
 4311  FF2B79                           SCNPRINT        ; clear result line 
 4312  FF2B79  02 01                    cop     $01
 4313                                   .MNLIST
 4314  FF2B7B  0D 1B 71 00              .DB     $0D, KB_ESC, 'q', $00
 4315  FF2B7F  28                       plp
 4316  FF2B80  90 15                    bcc     ?02
 4317  FF2B82                           SCNPRINT
 4318  FF2B82  02 01                    cop     $01
 4319                                   .MNLIST
 4320  FF2B84  3A 3A 65 72 72           .DB     '::error code -> ', $00
               6F 72 20 63 6F 
               64 65 20 2D 3E 
               20 00 
 4321  FF2B95  80 09                    bra     ?04
 4322  FF2B97                   ?02:    SCNPRINT
 4323  FF2B97  02 01                    cop     $01
 4324                                   .MNLIST
 4325  FF2B99  3A 3A 4F 4B 2C           .DB     '::OK, ', $00
               20 00 
 4326  FF2BA0  98               ?04:    tya
 4327  FF2BA1  4C 71 19                 jmp     PrintHex
 4328  FF2BA4                           
 4329                           ; # fdres  - reset FDC controller
 4330  FF2BA4                   Cmd_fdres:
 4331  FF2BA4  D0 3F                    bne     CmdErr
 4332  FF2BA6                           FDCRESET
 4333  FF2BA6  02 30                    cop     $30
 4334  FF2BA8  00                       .DB     $00
 4335                                   .MNLIST
 4336  FF2BA9  80 11                    bra     drs
 4337                           
  Tue Jul 17 11:00:24 2018                                                                                               Page   32




 4338                           ; # fddisk [0=default|1] - check drive for disk inserted
 4339  FF2BAB                   Cmd_fddisk:
 4340  FF2BAB  F0 06                    beq     ?01
 4341  FF2BAD  A5 BC                    lda     SMTmpK
 4342  FF2BAF  05 BB                    ora     SMTmpH
 4343  FF2BB1  D0 32                    bne     CmdErr
 4344  FF2BB3  A6 BA            ?01:    ldx     SMTmpL
 4345  FF2BB5  E0 04                    cpx     #$04
 4346  FF2BB7  B0 2C                    bcs     CmdErr
 4347  FF2BB9                           FDCTST
 4348  FF2BB9  02 30                    cop     $30
 4349  FF2BBB  03                       .DB     $03
 4350                                   .MNLIST
 4351  FF2BBC  08               drs:    php     
 4352  FF2BBD                           SCNPRINT        ; clear result line 
 4353  FF2BBD  02 01                    cop     $01
 4354                                   .MNLIST
 4355  FF2BBF  0D 1B 71 00              .DB     $0D, KB_ESC, 'q', $00
 4356  FF2BC3  28                       plp
 4357  FF2BC4  90 17                    bcc     ?02
 4358  FF2BC6                           SCNPRINT
 4359  FF2BC6  02 01                    cop     $01
 4360                                   .MNLIST
 4361  FF2BC8  3A 3A 65 72 72           .DB     '::error code -> ', $00
               6F 72 20 63 6F 
               64 65 20 2D 3E 
               20 00 
 4362  FF2BD9  98                       tya
 4363  FF2BDA  4C 71 19                 jmp     PrintHex
 4364  FF2BDD                   ?02:    SCNPRINT
 4365  FF2BDD  02 01                    cop     $01
 4366                                   .MNLIST
 4367  FF2BDF  3A 3A 4F 4B 00           .DB     '::OK', $00
 4368  FF2BE4  60                       rts
 4369                           
 4370  FF2BE5                   CmdErr: 
 4371  FF2BE5  4C 34 01                 jmp     ErrCls2
 4372                           
 4373                           ; # fdinit - reset FDC controller and check drives
 4374  FF2BE8                   Cmd_fdinit:
 4375  FF2BE8  D0 FB                    bne     CmdErr
 4376  FF2BEA  A9 40                    lda     #$40
 4377  FF2BEC  1C 55 00                 trb     !BiosEnt
 4378  FF2BEF  A9 04                    lda     #$04
 4379  FF2BF1  2C 46 00                 bit     !fdcctl
 4380  FF2BF4  F0 09                    beq     ?10             ; skip test FDC
 4381  FF2BF6                           SCNPRINT        ; clear result line 
 4382  FF2BF6  02 01                    cop     $01
 4383                                   .MNLIST
 4384  FF2BF8  0D 1B 71 00              .DB     $0D, KB_ESC, 'q', $00
 4385  FF2BFC                           FDCINIT
 4386  FF2BFC  02 30                    cop     $30
 4387  FF2BFE  01                       .DB     $01
 4388                                   .MNLIST
 4389  FF2BFF  60               ?10:    rts
 4390                           
 4391                           ; # fdformat  drive flag/disk_fmt [fill = $00]
  Tue Jul 17 11:00:24 2018                                                                                               Page   33




 4392  FF2C00                   Cmd_fdformat:
 4393  FF2C00  B0 E3                    bcs     CmdErr          ; no parametri
 4394  FF2C02  A5 BA                    lda     SMTmpL
 4395  FF2C04  85 E2                    sta     SMTmp2          ; drive
 4396  FF2C06  20 5A 01                 jsr     GetParm         ; parametro 2 - flag
 4397  FF2C09  B0 DA                    bcs     CmdErr
 4398  FF2C0B  A5 BA                    lda     SMTmpL
 4399  FF2C0D  85 E3                    sta     SMTmp2+1        ; flag
 4400  FF2C0F  20 5A 01                 jsr     GetParm         ; parametro 3 - fill byte
 4401  FF2C12  90 02                    bcc     ?04
 4402  FF2C14  64 BA                    stz     SMTmpL          ; default fill byte = $00
 4403  FF2C16  A5 E2            ?04:    lda     SMTmp2
 4404  FF2C18  48                       pha
 4405  FF2C19  48                       pha                     ; drive
 4406  FF2C1A  A5 E3                    lda     SMTmp2+1
 4407  FF2C1C  48                       pha                     ; flag
 4408  FF2C1D  A5 BA                    lda     SMTmpL
 4409  FF2C1F  48                       pha                     ; fill byte
 4410  FF2C20  4B                       phk                     ; bank of callback
 4411  FF2C21  F4 63 2C                 pea     #_FmtNotify     ; address of callback
 4412  FF2C24                           FDCFORMAT
 4413  FF2C24  02 33                    cop     $33
 4414                                   .MNLIST
 4415  FF2C26  68                       pla
 4416  FF2C27  B0 93                    bcs     drs
 4417  FF2C29                           SCNPRINT
 4418  FF2C29  02 01                    cop     $01
 4419                                   .MNLIST
 4420  FF2C2B  0D 3A 3A 6D 61           .DB     $0D, '::make file system', $00
               6B 65 20 66 69 
               6C 65 20 73 79 
               73 74 65 6D 00 
 4421                                   ;lda    SMTmp2
 4422  FF2C3F  48                       pha                     ; drive
 4423  FF2C40  A9 00                    lda     #0
 4424  FF2C42  48                       pha                     ; buffer
 4425  FF2C43  F4 00 00                 pea     #0              ; ID
 4426  FF2C46  48                       pha                     ; name = null
 4427  FF2C47  F4 00 00                 pea     #0
 4428  FF2C4A                           FDCMKFS
 4429  FF2C4A  02 36                    cop     $36
 4430                                   .MNLIST
 4431  FF2C4C  4C BC 2B                 jmp     drs
 4432  FF2C4F                           
 4433                           
 4434                           ; # fdverfmt  drive [default = 0]
 4435  FF2C4F                   Cmd_fdverfmt:
 4436  FF2C4F  F0 06                    beq     ?01
 4437  FF2C51  A5 BC                    lda     SMTmpK
 4438  FF2C53  05 BB                    ora     SMTmpH
 4439  FF2C55  D0 8E                    bne     CmdErr
 4440  FF2C57  A5 BA            ?01:    lda     SMTmpL
 4441  FF2C59  48                       pha                     ; drive
 4442  FF2C5A  4B                       phk                     ; bank of callback
 4443  FF2C5B  F4 EC 2C                 pea     #_VFmtNotify    ; address of callback
 4444  FF2C5E                           FDCVERFMT
 4445  FF2C5E  02 34                    cop     $34
  Tue Jul 17 11:00:24 2018                                                                                               Page   34




 4446                                   .MNLIST
 4447  FF2C60  4C 78 2B                 jmp     drs0
 4448  FF2C63                           
 4449                           ; funzione notify callback durante fdformat (LONG)
 4450                           ; In    - A = drive
 4451                           ;         X = head
 4452                           ;         Y = track
 4453                           ;         B = sector/track
 4454                           ;         CF = 0 prima chiamata
 4455  FF2C63                   _FmtNotify:
 4456  FF2C63  0B                       phd
 4457  FF2C64  F4 00 01                 pea     #DP01ADDR
 4458  FF2C67  2B                       pld
 4459  FF2C68  B0 68                    bcs     ?10             ; chiamate successive
 4460  FF2C6A                           SCNPRINT
 4461  FF2C6A  02 01                    cop     $01
 4462                                   .MNLIST
 4463  FF2C6C  0D 3A 3A 66 6F           .DB     $0D, '::format diskette on drive #', $00
               72 6D 61 74 20 
               64 69 73 6B 65 
               74 74 65 20 6F 
               6E 20 64 72 69 
               76 65 20 23 00 
 4464  FF2C8A  09 30                    ora     #'0'
 4465  FF2C8C                           SCNCHAROUT
 4466  FF2C8C  02 05                    cop     $05
 4467                                   .MNLIST
 4468  FF2C8E                           SCNPRINT
 4469  FF2C8E  02 01                    cop     $01
 4470                                   .MNLIST
 4471  FF2C90  20 28 23 35 30           .DB     ' (#50T, #', $00
               54 2C 20 23 00 
 4472  FF2C9A  EB                       xba                     ; A = sector/track
 4473  FF2C9B  DA                       phx
 4474  FF2C9C  5A                       phy
 4475  FF2C9D  20 71 19                 jsr     PrintHex
 4476  FF2CA0                           SCNPRINT
 4477  FF2CA0  02 01                    cop     $01
 4478                                   .MNLIST
 4479  FF2CA2  53 2F 54 29 20           .DB     'S/T) - Track: #', $00
               2D 20 54 72 61 
               63 6B 3A 20 23 
               00 
 4480  FF2CB2                           SCNGETPOS
 4481  FF2CB2  02 18                    cop     $18
 4482  FF2CB4  02                       .DB     $02
 4483                                   .MNLIST
 4484  FF2CB5  86 D6                    stx     SMAuxL
 4485  FF2CB7  84 D7                    sty     SMAuxH
 4486  FF2CB9  68                       pla                     ; track
 4487  FF2CBA  20 71 19                 jsr     PrintHex
 4488  FF2CBD                           SCNPRINT
 4489  FF2CBD  02 01                    cop     $01
 4490                                   .MNLIST
 4491  FF2CBF  2C 20 53 69 64           .DB     ', Side: #', $00
               65 3A 20 23 00 
 4492  FF2CC9                           SCNGETPOS
  Tue Jul 17 11:00:24 2018                                                                                               Page   35




 4493  FF2CC9  02 18                    cop     $18
 4494  FF2CCB  02                       .DB     $02
 4495                                   .MNLIST
 4496  FF2CCC  86 E2                    stx     SMTmp2
 4497  FF2CCE  84 E3                    sty     SMTmp2+1
 4498  FF2CD0  80 14                    bra     ?20
 4499  FF2CD2  DA               ?10:    phx
 4500  FF2CD3  5A                       phy
 4501  FF2CD4  A6 D6                    ldx     SMAuxL
 4502  FF2CD6  A4 D7                    ldy     SMAuxH
 4503  FF2CD8                           SCNSETPOS
 4504  FF2CD8  02 18                    cop     $18
 4505  FF2CDA  03                       .DB     $03
 4506                                   .MNLIST
 4507  FF2CDB  68                       pla
 4508  FF2CDC  20 71 19                 jsr     PrintHex
 4509  FF2CDF  A6 E2                    ldx     SMTmp2
 4510  FF2CE1  A4 E3                    ldy     SMTmp2+1
 4511  FF2CE3                           SCNSETPOS
 4512  FF2CE3  02 18                    cop     $18
 4513  FF2CE5  03                       .DB     $03
 4514                                   .MNLIST
 4515  FF2CE6  68               ?20:    pla
 4516  FF2CE7  20 71 19                 jsr     PrintHex
 4517  FF2CEA  2B                       pld
 4518  FF2CEB  6B                       rtl
 4519                           
 4520                           ; funzione notify callback durante fdverfmt (LONG)
 4521                           ; In    - A = drive
 4522                           ;         X = head
 4523                           ;         Y = track
 4524                           ;         B = format
 4525                           ;         CF = 0 prima chiamata
 4526  FF2CEC                   _VFmtNotify:
 4527  FF2CEC  0B                       phd
 4528  FF2CED  F4 00 01                 pea     #DP01ADDR
 4529  FF2CF0  2B                       pld
 4530  FF2CF1  B0 71                    bcs     ?10             ; chiamate successive
 4531  FF2CF3                           SCNPRINT
 4532  FF2CF3  02 01                    cop     $01
 4533                                   .MNLIST
 4534  FF2CF5  0D 3A 3A 76 65           .DB     $0D, '::verify format diskette on drive #', $00
               72 69 66 79 20 
               66 6F 72 6D 61 
               74 20 64 69 73 
               6B 65 74 74 65 
               20 6F 6E 20 64 
               72 69 76 65 20 
               23 00 
 4535  FF2D1A  09 30                    ora     #'0'
 4536  FF2D1C                           SCNCHAROUT
 4537  FF2D1C  02 05                    cop     $05
 4538                                   .MNLIST
 4539  FF2D1E                           SCNPRINT
 4540  FF2D1E  02 01                    cop     $01
 4541                                   .MNLIST
 4542  FF2D20  20 28 66 6F 72           .DB     ' (format #', $00
  Tue Jul 17 11:00:24 2018                                                                                               Page   36




               6D 61 74 20 23 
               00 
 4543  FF2D2B  EB                       xba                     ; A = format
 4544  FF2D2C  DA                       phx
 4545  FF2D2D  5A                       phy
 4546  FF2D2E  20 71 19                 jsr     PrintHex
 4547  FF2D31                           SCNPRINT
 4548  FF2D31  02 01                    cop     $01
 4549                                   .MNLIST
 4550  FF2D33  29 20 2D 20 54           .DB     ') - Track: #', $00
               72 61 63 6B 3A 
               20 23 00 
 4551  FF2D40                           SCNGETPOS
 4552  FF2D40  02 18                    cop     $18
 4553  FF2D42  02                       .DB     $02
 4554                                   .MNLIST
 4555  FF2D43  86 D6                    stx     SMAuxL
 4556  FF2D45  84 D7                    sty     SMAuxH
 4557  FF2D47  68                       pla                     ; track
 4558  FF2D48  20 71 19                 jsr     PrintHex
 4559  FF2D4B                           SCNPRINT
 4560  FF2D4B  02 01                    cop     $01
 4561                                   .MNLIST
 4562  FF2D4D  2C 20 48 65 61           .DB     ', Head: #', $00
               64 3A 20 23 00 
 4563  FF2D57                           SCNGETPOS
 4564  FF2D57  02 18                    cop     $18
 4565  FF2D59  02                       .DB     $02
 4566                                   .MNLIST
 4567  FF2D5A  86 E2                    stx     SMTmp2
 4568  FF2D5C  84 E3                    sty     SMTmp2+1
 4569  FF2D5E  68                       pla
 4570  FF2D5F  20 71 19                 jsr     PrintHex
 4571  FF2D62  2B                       pld
 4572  FF2D63  6B                       rtl
 4573  FF2D64  DA               ?10:    phx
 4574  FF2D65  5A                       phy
 4575  FF2D66  A6 D6                    ldx     SMAuxL
 4576  FF2D68  A4 D7                    ldy     SMAuxH
 4577  FF2D6A                           SCNSETPOS
 4578  FF2D6A  02 18                    cop     $18
 4579  FF2D6C  03                       .DB     $03
 4580                                   .MNLIST
 4581  FF2D6D  68                       pla
 4582  FF2D6E  20 71 19                 jsr     PrintHex
 4583  FF2D71  A6 E2                    ldx     SMTmp2
 4584  FF2D73  A4 E3                    ldy     SMTmp2+1
 4585  FF2D75                           SCNSETPOS
 4586  FF2D75  02 18                    cop     $18
 4587  FF2D77  03                       .DB     $03
 4588                                   .MNLIST
 4589  FF2D78  68                       pla
 4590  FF2D79  20 71 19                 jsr     PrintHex
 4591  FF2D7C  2B                       pld
 4592  FF2D7D  6B                       rtl
 4593                           
 4594                           ; # fdtwrite drive [track=0 [buffer=0 [flag=0]]]  
  Tue Jul 17 11:00:24 2018                                                                                               Page   37




 4595  FF2D7E                   Cmd_fdtwrite:
 4596  FF2D7E  90 03                    bcc     ?02
 4597  FF2D80  4C 49 2F                 jmp     CmdErr3         ; no parametri
 4598  FF2D83  A2 02            ?02:    ldx     #2
 4599  FF2D85  80 10                    bra     fdtrk
 4600  FF2D87                           
 4601                           ; # fdtread drive [track=0 [buffer=0 [flag=0]]]  
 4602  FF2D87                   Cmd_fdtread:
 4603  FF2D87  90 03                    bcc     ?02
 4604  FF2D89  4C 49 2F                 jmp     CmdErr3         ; no parametri
 4605  FF2D8C  A2 00            ?02:    ldx     #0
 4606  FF2D8E  80 07                    bra     fdtrk
 4607                           
 4608                           ; # fdtverf drive [track=0 [buffer=0 [flag=0]]]  
 4609  FF2D90                   Cmd_fdtverf:
 4610  FF2D90  90 03                    bcc     ?02
 4611  FF2D92  4C 49 2F                 jmp     CmdErr3         ; no parametri
 4612  FF2D95  A2 01            ?02:    ldx     #1
 4613                           
 4614  FF2D97                   fdtrk:
 4615  FF2D97  A5 BA                    lda     SMTmpL
 4616  FF2D99  48                       pha                     ; drive
 4617  FF2D9A  A9 00                    lda     #0
 4618  FF2D9C  48                       pha                     ; track
 4619  FF2D9D  48                       pha                     ; buffer
 4620  FF2D9E  48                       pha                     ; flag
 4621  FF2D9F  DA                       phx                     ; op
 4622  FF2DA0  20 5A 01                 jsr     GetParm         ; parametro 2 - track
 4623  FF2DA3  B0 16                    bcs     ?10
 4624  FF2DA5  A5 BA                    lda     SMTmpL
 4625  FF2DA7  83 04                    sta     $04,s           ; track
 4626  FF2DA9  20 5A 01                 jsr     GetParm         ; parametro 3 - buffer
 4627  FF2DAC  B0 0D                    bcs     ?10
 4628  FF2DAE  A5 BA                    lda     SMTmpL
 4629  FF2DB0  83 03                    sta     $03,s           ; buffer
 4630  FF2DB2  20 5A 01                 jsr     GetParm         ; parametro 4 - flag
 4631  FF2DB5  B0 04                    bcs     ?10
 4632  FF2DB7  A5 BA                    lda     SMTmpL
 4633  FF2DB9  83 02                    sta     $02,s           ; flag
 4634  FF2DBB  FA               ?10:    plx                     ; op
 4635  FF2DBC  F0 0D                    beq     ?30             ; read
 4636  FF2DBE  CA                       dex
 4637  FF2DBF  F0 05                    beq     ?20             ; verf
 4638  FF2DC1                           FDCTKWR
 4639  FF2DC1  02 35                    cop     $35
 4640  FF2DC3  02                       .DB     $02
 4641                                   .MNLIST
 4642  FF2DC4  80 2F                    bra     fdcr
 4643  FF2DC6                   ?20:    FDCTKVERF
 4644  FF2DC6  02 35                    cop     $35
 4645  FF2DC8  01                       .DB     $01
 4646                                   .MNLIST
 4647  FF2DC9  80 2A                    bra     fdcr
 4648  FF2DCB                   ?30:    FDCTKRD
 4649  FF2DCB  02 35                    cop     $35
 4650  FF2DCD  00                       .DB     $00
 4651                                   .MNLIST
  Tue Jul 17 11:00:24 2018                                                                                               Page   38




 4652  FF2DCE  80 25                    bra     fdcr
 4653  FF2DD0                           
 4654                           ; # fdwrite drive [track=0 [head=0 [sect=1 [sectnum=1 [buffer=0 [flag=0]]]]]]  
 4655  FF2DD0                   Cmd_fdwrite:
 4656  FF2DD0  90 03                    bcc     ?02
 4657  FF2DD2  4C 49 2F                 jmp     CmdErr3         ; no parametri
 4658  FF2DD5  20 47 2E         ?02:    jsr     GetFDCParm
 4659  FF2DD8                           FDCWRITE
 4660  FF2DD8  02 31                    cop     $31
 4661  FF2DDA  02                       .DB     $02
 4662                                   .MNLIST
 4663  FF2DDB  80 18                    bra     fdcr
 4664  FF2DDD                           
 4665                           ; # fdverf drive [track=0 [head=0 [sect=1 [sectnum=1 [buffer=0 [flag=0]]]]]]  
 4666  FF2DDD                   Cmd_fdverf:
 4667  FF2DDD  90 03                    bcc     ?02
 4668  FF2DDF  4C 49 2F                 jmp     CmdErr3         ; no parametri
 4669  FF2DE2  20 47 2E         ?02:    jsr     GetFDCParm
 4670  FF2DE5                           FDCVERF
 4671  FF2DE5  02 31                    cop     $31
 4672  FF2DE7  01                       .DB     $01
 4673                                   .MNLIST
 4674  FF2DE8  80 0B                    bra     fdcr
 4675                           
 4676                           ; # fdread drive [track=0 [head=0 [sect=1 [sectnum=1 [buffer=0 [flag=0]]]]]]  
 4677  FF2DEA                   Cmd_fdread:
 4678  FF2DEA  90 03                    bcc     ?02
 4679  FF2DEC  4C 49 2F                 jmp     CmdErr3         ; no parametri
 4680  FF2DEF  20 47 2E         ?02:    jsr     GetFDCParm
 4681  FF2DF2                           FDCREAD
 4682  FF2DF2  02 31                    cop     $31
 4683  FF2DF4  00                       .DB     $00
 4684                                   .MNLIST
 4685  FF2DF5                           
 4686  FF2DF5                   fdcr:
 4687  FF2DF5  08                       php     
 4688  FF2DF6                           SCNPRINT        ; clear result line 
 4689  FF2DF6  02 01                    cop     $01
 4690                                   .MNLIST
 4691  FF2DF8  0D 1B 71 00              .DB     $0D, KB_ESC, 'q', $00
 4692  FF2DFC  28                       plp
 4693  FF2DFD  90 1B                    bcc     ?02
 4694  FF2DFF                           SCNPRINT
 4695  FF2DFF  02 01                    cop     $01
 4696                                   .MNLIST
 4697  FF2E01  3A 3A 65 72 72           .DB     '::error code -> ', $00
               6F 72 20 63 6F 
               64 65 20 2D 3E 
               20 00 
 4698  FF2E12  48                       pha
 4699  FF2E13  98                       tya
 4700  FF2E14  20 4E 19                 jsr     PrintByte
 4701  FF2E17  68                       pla
 4702  FF2E18  80 09                    bra     ?04
 4703  FF2E1A                   ?02:    SCNPRINT
 4704  FF2E1A  02 01                    cop     $01
 4705                                   .MNLIST
  Tue Jul 17 11:00:24 2018                                                                                               Page   39




 4706  FF2E1C  3A 3A 4F 4B 2C           .DB     '::OK, ', $00
               20 00 
 4707  FF2E23  9B               ?04:    txy
 4708  FF2E24  EB                       xba
 4709  FF2E25  AA                       tax
 4710  FF2E26  EB                       xba
 4711  FF2E27  20 48 19                 jsr     PrintWord
 4712  FF2E2A  98                       tya
 4713  FF2E2B                           SCNPRCHAR
 4714  FF2E2B  02 07                    cop     $07
 4715                                   .MNLIST
 4716  FF2E2D  20                       .DB     ' '
 4717  FF2E2E  4C 71 19                 jmp     PrintHex
 4718                           
 4719                           ; # fdfs [drive = 0] {buffer = 0, ID = 0, name = NULL}
 4720  FF2E31                   Cmd_fdfs:
 4721  FF2E31  D0 02                    bne     ?02
 4722  FF2E33  64 BA                    stz     SMTmpL
 4723  FF2E35  A5 BA            ?02:    lda     SMTmpL
 4724  FF2E37  48                       pha                     ; drive
 4725  FF2E38  A9 00                    lda     #$00
 4726  FF2E3A  48                       pha                     ; buffer
 4727  FF2E3B  F4 00 00                 pea     #0              ; ID
 4728  FF2E3E  48                       pha                     ; name = null
 4729  FF2E3F  F4 00 00                 pea     #0
 4730  FF2E42                           FDCMKFS
 4731  FF2E42  02 36                    cop     $36
 4732                                   .MNLIST
 4733  FF2E44  4C BC 2B                 jmp     drs
 4734                           
 4735                           ; ricava parametri per funzioni fdread/fdwrite
 4736  FF2E47                   GetFDCParm:
 4737  FF2E47  FA                       plx                     ; return L
 4738  FF2E48  68                       pla                     ; return H
 4739  FF2E49  E8                       inx                     ; scarta stack - necessario per  
 4740  FF2E4A  D0 01                    bne     ?01             ; chiamare GetParm al giusto livello di stack
 4741  FF2E4C  1A                       inc     a               ; X,A -> indirizzo di ritorno
 4742  FF2E4D  86 E2            ?01:    stx     SMTmp2
 4743  FF2E4F  85 E3                    sta     SMTmp2+1
 4744  FF2E51  A5 BA                    lda     SMTmpL          ; drive
 4745  FF2E53  48                       pha
 4746  FF2E54  A9 00                    lda     #0              ; default params
 4747  FF2E56  48                       pha                     ; track = 0
 4748  FF2E57  48                       pha                     ; head = 0
 4749  FF2E58  A2 01                    ldx     #1
 4750  FF2E5A  DA                       phx                     ; start sector = 1
 4751  FF2E5B  DA                       phx                     ; sect. number = 1
 4752  FF2E5C  48                       pha                     ; # buffer = 0
 4753  FF2E5D  48                       pha                     ; flag = 0
 4754  FF2E5E  20 5A 01                 jsr     GetParm         ; parametro 2 - track
 4755  FF2E61  B0 35                    bcs     ?20
 4756  FF2E63  A5 BA                    lda     SMTmpL
 4757  FF2E65  83 06                    sta     $06,s           ; track
 4758  FF2E67  20 5A 01                 jsr     GetParm         ; parametro 3 - head
 4759  FF2E6A  B0 2C                    bcs     ?20
 4760  FF2E6C  A5 BA                    lda     SMTmpL
 4761  FF2E6E  83 05                    sta     $05,s           ; head
  Tue Jul 17 11:00:24 2018                                                                                               Page   40




 4762  FF2E70  20 5A 01                 jsr     GetParm         ; parametro 4 - sector
 4763  FF2E73  B0 23                    bcs     ?20
 4764  FF2E75  A5 BA                    lda     SMTmpL
 4765  FF2E77  F0 02                    beq     ?02
 4766  FF2E79  83 04                    sta     $04,s           ; sector
 4767  FF2E7B  20 5A 01         ?02:    jsr     GetParm         ; sector number
 4768  FF2E7E  B0 18                    bcs     ?20     
 4769  FF2E80  A5 BA                    lda     SMTmpL
 4770  FF2E82  F0 02                    beq     ?03
 4771  FF2E84  83 03                    sta     $03,s           ; sector number
 4772  FF2E86  20 5A 01         ?03:    jsr     GetParm
 4773  FF2E89  B0 0D                    bcs     ?20
 4774  FF2E8B  A5 BA                    lda     SMTmpL
 4775  FF2E8D  83 02                    sta     $02,s           ; buffer
 4776  FF2E8F  20 5A 01                 jsr     GetParm
 4777  FF2E92  B0 04                    bcs     ?20
 4778  FF2E94  A5 BA                    lda     SMTmpL
 4779  FF2E96  83 01                    sta     $01,s           ; flag
 4780  FF2E98  6C E2 01         ?20:    jmp     (DP01ADDR+SMTmp2)       ; return
 4781                           
 4782  FF2E9B                           
 4783                           ;---------------------------------
 4784  FF2E9B                   atacmd:
 4785  FF2E9B  A5 E3                    lda     <atnum
 4786  FF2E9D  0A                       asl     a
 4787  FF2E9E  AA                       tax
 4788  FF2E9F  7C A2 2E                 jmp     (ATACT,x)
 4789  FF2EA2                           
 4790  FF2EA2                   ATACT:
 4791  FF2EA2  092F 012F 412F           .DW     Cmd_atard, Cmd_ataverf, Cmd_atawr, Cmd_atares
               F92E 
 4792  FF2EAA  E72E ED2E F32E           .DW     Cmd_ataid, Cmd_atambr, Cmd_atapbr, Cmd_atadbuf
               B82E 
 4793  FF2EB2  C62E D72E DF2E           .DW     Cmd_atadbnk, Cmd_atadrd, Cmd_atadwr
 4794                           
 4795  FF2EB8                   Cmd_atadbuf:
 4796  FF2EB8  A9 08                    lda     #$08            ; PB3 VIA3
 4797  FF2EBA  A6 BA                    ldx     SMTmpL
 4798  FF2EBC  F0 04                    beq     ?dis            ; disable 1Mb buffer
 4799  FF2EBE  1C C0 FD                 trb     VIA3+VIAPRB     ; enable 1Mb buffer
 4800  FF2EC1  60                       rts
 4801  FF2EC2  0C C0 FD         ?dis:   tsb     VIA3+VIAPRB
 4802  FF2EC5  60                       rts
 4803                           
 4804  FF2EC6                   Cmd_atadbnk:
 4805  FF2EC6  A5 BA                    lda     SMTmpL
 4806  FF2EC8  29 07                    and     #$07            ; mask bank
 4807  FF2ECA  85 BA                    sta     SMTmpL
 4808  FF2ECC  AD CF FD                 lda     !VIA3+VIAPRANH
 4809  FF2ECF  29 F8                    and     #$F8
 4810  FF2ED1  05 BA                    ora     SMTmpL
 4811  FF2ED3  8D CF FD                 sta     !VIA3+VIAPRANH  ; set bank
 4812  FF2ED6  60                       rts
 4813                           
 4814  FF2ED7                   Cmd_atadrd:
 4815  FF2ED7  20 B8 2F                 jsr     GetATAParm2
 4816  FF2EDA                           ATADMARD
  Tue Jul 17 11:00:24 2018                                                                                               Page   41




 4817  FF2EDA  02 42                    cop     $42
 4818  FF2EDC  00                       .DB     $00
 4819                                   .MNLIST
 4820  FF2EDD  80 30                    bra     ATAClean
 4821                           
 4822  FF2EDF                   Cmd_atadwr:
 4823  FF2EDF  20 B8 2F                 jsr     GetATAParm2
 4824  FF2EE2                           ATADMAWR
 4825  FF2EE2  02 42                    cop     $42
 4826  FF2EE4  01                       .DB     $01
 4827                                   .MNLIST
 4828  FF2EE5  80 28                    bra     ATAClean
 4829                           
 4830  FF2EE7                   Cmd_ataid:
 4831  FF2EE7  A6 BA                    ldx     SMTmpL
 4832  FF2EE9  A9 01                    lda     #1
 4833  FF2EEB  80 10                    bra     atactl
 4834                           
 4835  FF2EED                   Cmd_atambr:
 4836  FF2EED  A6 BA                    ldx     SMTmpL
 4837  FF2EEF  A9 02                    lda     #2
 4838  FF2EF1  80 0A                    bra     atactl
 4839                           
 4840  FF2EF3                   Cmd_atapbr:
 4841  FF2EF3  A6 BA                    ldx     SMTmpL
 4842  FF2EF5  A9 03                    lda     #3
 4843  FF2EF7  80 04                    bra     atactl
 4844                           
 4845  FF2EF9                   Cmd_atares:
 4846  FF2EF9  A6 BA                    ldx     SMTmpL
 4847  FF2EFB  A9 00                    lda     #0
 4848  FF2EFD                   atactl:
 4849  FF2EFD                           ATACTL
 4850  FF2EFD  02 41                    cop     $41
 4851                                   .MNLIST
 4852  FF2EFF  80 0E                    bra     ATAClean
 4853  FF2F01                           
 4854                           ; test lettura device ATA
 4855                           ; atard <80 (flag verifica)> + device <LBA=0> <NUMSECT=64> <BUFFER=030000>
 4856  FF2F01                   Cmd_ataverf:
 4857  FF2F01  20 4C 2F                 jsr     GetATAParm
 4858  FF2F04                           ATAVERF
 4859  FF2F04  02 40                    cop     $40
 4860  FF2F06  01                       .DB     $01
 4861                                   .MNLIST
 4862  FF2F07  80 06                    bra     ATAClean
 4863  FF2F09                           
 4864  FF2F09                   Cmd_atard:
 4865  FF2F09  20 4C 2F                 jsr     GetATAParm
 4866  FF2F0C                           ATAREAD
 4867  FF2F0C  02 40                    cop     $40
 4868  FF2F0E  00                       .DB     $00
 4869                                   .MNLIST
 4870                           
 4871  FF2F0F                   ATAClean:
 4872  FF2F0F  B0 14                    bcs     ?02
 4873  FF2F11                           SCNPRINT        
  Tue Jul 17 11:00:24 2018                                                                                               Page   42




 4874  FF2F11  02 01                    cop     $01
 4875                                   .MNLIST
 4876  FF2F13  0D 3A 3A 4F 4B           .DB     $0D, '::OK - no error', $00
               20 2D 20 6E 6F 
               20 65 72 72 6F 
               72 00 
 4877  FF2F24  60                       rts
 4878  FF2F25                   ?02:    SCNPRINT
 4879  FF2F25  02 01                    cop     $01
 4880                                   .MNLIST
 4881  FF2F27  0D 3A 3A 65 72           .DB     $0D, '::error code -> ', $00
               72 6F 72 20 63 
               6F 64 65 20 2D 
               3E 20 00 
 4882  FF2F39  98                       tya
 4883  FF2F3A  20 4E 19                 jsr     PrintByte
 4884  FF2F3D  8A                       txa
 4885  FF2F3E  4C 71 19                 jmp     PrintHex
 4886                           
 4887                           ; test scrittura su device ATA
 4888                           ; atawrite <80 (flag verifica)> + device <LBA=0> <NUMSECT=64> <BUFFER=0>        
 4889  FF2F41                   Cmd_atawr:
 4890  FF2F41  20 4C 2F                 jsr     GetATAParm
 4891  FF2F44                           ATAWRITE
 4892  FF2F44  02 40                    cop     $40
 4893  FF2F46  02                       .DB     $02
 4894                                   .MNLIST
 4895  FF2F47  80 C6                    bra     ATAClean
 4896                           
 4897  FF2F49                   CmdErr3:
 4898  FF2F49  4C 34 01                 jmp     ErrCls2
 4899                           
 4900                           ; ricava parametri per funzioni ATA read/write
 4901  FF2F4C                   GetATAParm:
 4902  FF2F4C  FA                       plx                     ; return L
 4903  FF2F4D  68                       pla                     ; return H
 4904  FF2F4E  E8                       inx                     ; scarta stack - necessario per  
 4905  FF2F4F  D0 01                    bne     ?01             ; chiamare GetParm al giusto livello di stack
 4906  FF2F51  1A                       inc     a               ; X,A -> indirizzo di ritorno
 4907  FF2F52  86 E2            ?01:    stx     SMTmp2
 4908  FF2F54  85 E3                    sta     SMTmp2+1
 4909  FF2F56                           ACC16
 4910  FF2F56  C2 20                    rep     #PMFLAG
 4911                                   .LONGA  on
 4912                                   .MNLIST
 4913  FF2F58  3B                       tsc                     ; stack frame
 4914  FF2F59  38                       sec
 4915  FF2F5A  E9 09 00                 sbc     #9              ; crea parametri stack
 4916  FF2F5D  1B                       tcs
 4917  FF2F5E  1A                       inc     a
 4918  FF2F5F  85 BE                    sta     SMSizeL         ; salva stack frame
 4919  FF2F61                           ACC08
 4920  FF2F61  E2 20                    sep     #PMFLAG
 4921                                   .LONGA  off
 4922                                   .MNLIST
 4923  FF2F63  A5 BA                    lda     SMTmpL          ; parametro 1 - device + flag verifica
 4924  FF2F65  AA                       tax
  Tue Jul 17 11:00:24 2018                                                                                               Page   43




 4925  FF2F66  29 01                    and     #$01            ; maschera device
 4926  FF2F68  83 09                    sta     $09,s           ; device
 4927  FF2F6A  8A                       txa
 4928  FF2F6B  29 80                    and     #$80            ; maschera flag
 4929  FF2F6D  83 01                    sta     $01,s           ; flag
 4930  FF2F6F  A9 00                    lda     #0
 4931  FF2F71  83 02                    sta     $02,s           ; lpBuf default=$030000
 4932  FF2F73  83 03                    sta     $03,s
 4933  FF2F75  A9 03                    lda     #3
 4934  FF2F77  83 04                    sta     $04,s
 4935  FF2F79  A9 40                    lda     #64             ; numero settori di default (64)
 4936  FF2F7B  83 05                    sta     $05,s
 4937  FF2F7D  A9 00                    lda     #0
 4938  FF2F7F  83 06                    sta     $06,s           ; LBA di default (0)
 4939  FF2F81  83 07                    sta     $07,s
 4940  FF2F83  83 08                    sta     $08,s
 4941  FF2F85  20 52 01                 jsr     GetParm32       ; parametro 2 - LBA
 4942  FF2F88  B0 26                    bcs     ?18             ; fine - OK
 4943  FF2F8A  A5 BA                    lda     SMTmpL
 4944  FF2F8C  83 06                    sta     $06,s
 4945  FF2F8E  A5 BB                    lda     SMTmpH
 4946  FF2F90  83 07                    sta     $07,s
 4947  FF2F92  A5 BC                    lda     SMTmpK
 4948  FF2F94  83 08                    sta     $08,s
 4949  FF2F96  20 5A 01                 jsr     GetParm         ; parametro 3 - numero settori
 4950  FF2F99  B0 15                    bcs     ?18             ; fine - OK
 4951  FF2F9B  A5 BA                    lda     SMTmpL
 4952  FF2F9D  83 05                    sta     $05,s
 4953  FF2F9F  20 5A 01                 jsr     GetParm         ; parametro 4 - buffer
 4954  FF2FA2  B0 0C                    bcs     ?18             ; fine - OK
 4955  FF2FA4  A5 BA                    lda     SMTmpL
 4956  FF2FA6  83 02                    sta     $02,s
 4957  FF2FA8  A5 BB                    lda     SMTmpH
 4958  FF2FAA  83 03                    sta     $03,s
 4959  FF2FAC  A5 BC                    lda     SMTmpK
 4960                                   ;lda    #0
 4961  FF2FAE  83 04                    sta     $04,s   
 4962  FF2FB0  A5 BF            ?18:    lda     SMSizeH         ; C = stack frame
 4963  FF2FB2  EB                       xba
 4964  FF2FB3  A5 BE                    lda     SMSizeL
 4965  FF2FB5  6C E2 01                 jmp     (DP01ADDR+SMTmp2)       ; return
 4966                           
 4967                           ; ricava parametri per funzioni ATA DMA read/write
 4968  FF2FB8                   GetATAParm2:
 4969  FF2FB8  FA                       plx                     ; return L
 4970  FF2FB9  68                       pla                     ; return H
 4971  FF2FBA  E8                       inx                     ; scarta stack - necessario per  
 4972  FF2FBB  D0 01                    bne     ?01             ; chiamare GetParm al giusto livello di stack
 4973  FF2FBD  1A                       inc     a               ; X,A -> indirizzo di ritorno
 4974  FF2FBE  86 E2            ?01:    stx     SMTmp2
 4975  FF2FC0  85 E3                    sta     SMTmp2+1
 4976  FF2FC2                           ACC16
 4977  FF2FC2  C2 20                    rep     #PMFLAG
 4978                                   .LONGA  on
 4979                                   .MNLIST
 4980  FF2FC4  3B                       tsc                     ; stack frame
 4981  FF2FC5  38                       sec
  Tue Jul 17 11:00:24 2018                                                                                               Page   44




 4982  FF2FC6  E9 07 00                 sbc     #7              ; crea parametri stack
 4983  FF2FC9  1B                       tcs
 4984  FF2FCA  1A                       inc     a
 4985  FF2FCB  85 BE                    sta     SMSizeL         ; salva stack frame
 4986  FF2FCD                           ACC08
 4987  FF2FCD  E2 20                    sep     #PMFLAG
 4988                                   .LONGA  off
 4989                                   .MNLIST
 4990  FF2FCF  A5 BA                    lda     SMTmpL          ; parametro 1 - device
 4991  FF2FD1  29 01                    and     #$01            ; maschera device
 4992  FF2FD3  83 07                    sta     $07,s           ; device
 4993  FF2FD5  A9 00                    lda     #0
 4994  FF2FD7  83 01                    sta     $01,s           ; nBuf default=$0000
 4995  FF2FD9  83 02                    sta     $02,s
 4996  FF2FDB  A9 40                    lda     #64             ; numero settori di default (64)
 4997  FF2FDD  83 03                    sta     $03,s
 4998  FF2FDF  A9 00                    lda     #0
 4999  FF2FE1  83 04                    sta     $04,s           ; LBA di default (0)
 5000  FF2FE3  83 05                    sta     $05,s
 5001  FF2FE5  83 06                    sta     $06,s
 5002  FF2FE7  20 52 01                 jsr     GetParm32       ; parametro 2 - LBA
 5003  FF2FEA  B0 22                    bcs     ?18             ; fine - OK
 5004  FF2FEC  A5 BA                    lda     SMTmpL
 5005  FF2FEE  83 04                    sta     $04,s
 5006  FF2FF0  A5 BB                    lda     SMTmpH
 5007  FF2FF2  83 05                    sta     $05,s
 5008  FF2FF4  A5 BC                    lda     SMTmpK
 5009  FF2FF6  83 06                    sta     $06,s
 5010  FF2FF8  20 5A 01                 jsr     GetParm         ; parametro 3 - numero settori
 5011  FF2FFB  B0 11                    bcs     ?18             ; fine - OK
 5012  FF2FFD  A5 BA                    lda     SMTmpL
 5013  FF2FFF  83 03                    sta     $03,s
 5014  FF3001  20 5A 01                 jsr     GetParm         ; parametro 4 - buffer
 5015  FF3004  B0 08                    bcs     ?18             ; fine - OK
 5016  FF3006  A5 BA                    lda     SMTmpL
 5017  FF3008  83 01                    sta     $01,s
 5018  FF300A  A5 BB                    lda     SMTmpH
 5019  FF300C  83 02                    sta     $02,s
 5020  FF300E  A5 BF            ?18:    lda     SMSizeH         ; C = stack frame
 5021  FF3010  EB                       xba
 5022  FF3011  A5 BE                    lda     SMSizeL
 5023  FF3013  6C E2 01                 jmp     (DP01ADDR+SMTmp2)       ; return
 5024                           
 5025                           ; #sptest -p<port> -b -h<handshake> -r -e -t -u 
 5026                           ; -p: port 0 or 1 (default: 0)
 5027                           ; -b: baud rate = 19,200 (default: 38,400)
 5028                           ; -h: handshke level = 0,1,2 (defalt: 2)
 5029                           ;       0=none, 1=software, 2=hardware
 5030                           ; -r: RS485 (default: RS232)
 5031                           ; -e: enable echo in rx mode (default mode: rx)
 5032                           ; -t: enable tx mode (-e ignored)
 5033                           ; -u: RS232 uplink (RS485 term.)
 5034  FF3016                   Cmd_sptst:
 5035                                   .EXTERN lspset, lspget, lspput, lspres
 5036                                   .PUBLIC Cmd_sptst
 5037                           
 5038  FF3016                           SCN_CR
  Tue Jul 17 11:00:24 2018                                                                                               Page   45




 5039  FF3016                           SCNPRCHAR
 5040                                   .MLIST
 5041  FF3016  02 07                    cop     $07
 5042                                   .MNLIST
 5043  FF3018  0D                       .DB     $0D
 5044                                   .MNLIST
 5045  FF3019  64 E2                    stz     SMTmp2          ; port 0
 5046  FF301B  64 E5                    stz     SMTmp2+3        ; no echo, rx mode
 5047  FF301D  A9 02                    lda     #2
 5048  FF301F  85 E3                    sta     SMTmp2+1        ; hardware handshake
 5049  FF3021  A9 D4                    lda     #11010100B
 5050  FF3023  85 E4                    sta     SMTmp2+2
 5051  FF3025  A9 80                    lda     #$80            ; flag
 5052  FF3027  48                       pha
 5053  FF3028  A6 E0                    ldx     cmdlin
 5054  FF302A                           ACC16CLC
 5055  FF302A  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 5056                                   .LONGA  on
 5057                                   .MNLIST
 5058  FF302C  8A                       txa
 5059  FF302D  69 00 99                 adc     #INPUTBUF
 5060  FF3030  A2 01                    ldx     #^INPUTBUF
 5061  FF3032  DA                       phx                     ; command line
 5062  FF3033  48                       pha
 5063  FF3034                           ACC08
 5064  FF3034  E2 20                    sep     #PMFLAG
 5065                                   .LONGA  off
 5066                                   .MNLIST
 5067  FF3036  4B                       phk                     ; option string
 5068  FF3037  F4 76 31                 pea     #!?100          
 5069  FF303A  F4 00 00                 pea     #0              ; result
 5070  FF303D  F4 00 00                 pea     #0
 5071  FF3040  22 09 00 FA      ?10:    jsl     _getopt         ; get opttion's loop
 5072  FF3044  B0 56                    bcs     ?26             ; error
 5073  FF3046  AA                       tax                     ; option char
 5074  FF3047  F0 53                    beq     ?26             ; end of command line
 5075  FF3049  30 50                    bmi     ?24             ; no option argument
 5076  FF304B  C9 70                    cmp     #'p'
 5077  FF304D  D0 08                    bne     ?12
 5078  FF304F  A3 01                    lda     $01,s
 5079  FF3051  29 01                    and     #1
 5080  FF3053  85 E2                    sta     SMTmp2          ; port
 5081  FF3055  80 E9                    bra     ?10
 5082  FF3057  C9 68            ?12:    cmp     #'h'
 5083  FF3059  D0 0E                    bne     ?14
 5084  FF305B  A3 01                    lda     $01,s
 5085  FF305D  29 03                    and     #3
 5086  FF305F  C9 03                    cmp     #3
 5087  FF3061  90 02                    bcc     ?13
 5088  FF3063  A9 02                    lda     #2
 5089  FF3065  85 E3            ?13:    sta     SMTmp2+1        ; handshake
 5090  FF3067  80 D7                    bra     ?10
 5091  FF3069  C9 62            ?14:    cmp     #'b'
 5092  FF306B  D0 06                    bne     ?16
 5093  FF306D  A9 10                    lda     #$10
 5094  FF306F  14 E4                    trb     SMTmp2+2        ; 19200
 5095  FF3071  80 CD                    bra     ?10
  Tue Jul 17 11:00:24 2018                                                                                               Page   46




 5096  FF3073  C9 72            ?16:    cmp     #'r'
 5097  FF3075  D0 06                    bne     ?18
 5098  FF3077  A9 02                    lda     #$02
 5099  FF3079  04 E4                    tsb     SMTmp2+2        ; RS485
 5100  FF307B  80 C3                    bra     ?10
 5101  FF307D  C9 75            ?18:    cmp     #'u'
 5102  FF307F  D0 06                    bne     ?20
 5103  FF3081  A9 01                    lda     #$01
 5104  FF3083  04 E4                    tsb     SMTmp2+2        ; RS485 term/RS232 uplink cable
 5105  FF3085  80 B9                    bra     ?10     
 5106  FF3087  C9 65            ?20:    cmp     #'e'
 5107  FF3089  D0 06                    bne     ?22
 5108  FF308B  A9 80                    lda     #$80
 5109  FF308D  04 E5                    tsb     SMTmp2+3        ; rx+echo mode
 5110  FF308F  80 AF                    bra     ?10
 5111  FF3091  C9 74            ?22:    cmp     #'t'
 5112  FF3093  D0 06                    bne     ?24
 5113  FF3095  A9 40                    lda     #$40
 5114  FF3097  04 E5                    tsb     SMTmp2+3        ; tx mode
 5115  FF3099  80 A5                    bra     ?10
 5116  FF309B  38               ?24:    sec
 5117  FF309C  08               ?26:    php                     ; clean stack
 5118  FF309D  FA                       plx                     ; save carry
 5119  FF309E                           ACC16CLC
 5120  FF309E  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 5121                                   .LONGA  on
 5122                                   .MNLIST
 5123  FF30A0  3B                       tsc
 5124  FF30A1  69 0B 00                 adc     #11
 5125  FF30A4  1B                       tcs
 5126  FF30A5                           ACC08
 5127  FF30A5  E2 20                    sep     #PMFLAG
 5128                                   .LONGA  off
 5129                                   .MNLIST
 5130  FF30A7  8A                       txa
 5131  FF30A8  4A                       lsr     a               ; test carry
 5132  FF30A9  90 03                    bcc     ?28             ; ok
 5133  FF30AB  4C 34 01                 jmp     ErrCls2
 5134  FF30AE  A5 E3            ?28:    lda     SMTmp2+1
 5135  FF30B0  D0 06                    bne     ?30
 5136  FF30B2  A9 C0                    lda     #$C0
 5137  FF30B4  14 E4                    trb     SMTmp2+2
 5138  FF30B6  80 12                    bra     ?34
 5139  FF30B8  C9 01            ?30:    cmp     #1
 5140  FF30BA  D0 0A                    bne     ?32
 5141  FF30BC  A9 C0                    lda     #$C0
 5142  FF30BE  14 E4                    trb     SMTmp2+2
 5143  FF30C0  A9 80                    lda     #$80
 5144  FF30C2  04 E4                    tsb     SMTmp2+2
 5145  FF30C4  80 04                    bra     ?34
 5146  FF30C6  A9 C0            ?32:    lda     #$C0
 5147  FF30C8  04 E4                    tsb     SMTmp2+2
 5148  FF30CA  A6 E2            ?34:    ldx     SMTmp2          ; X=port
 5149  FF30CC  A5 E4                    lda     SMTmp2+2        ; A=mode
 5150  FF30CE  22 06 08 F8              jsl     lspset
 5151  FF30D2  A5 E2                    lda     SMTmp2
 5152  FF30D4  0A                       asl     a
  Tue Jul 17 11:00:24 2018                                                                                               Page   47




 5153  FF30D5  0A                       asl     a
 5154  FF30D6  85 E3                    sta     SMTmp2+1
 5155  FF30D8  3B                       tsc
 5156  FF30D9  85 E6                    sta     SMTmp2+4
 5157  FF30DB  EB                       xba
 5158  FF30DC  85 E7                    sta     SMTmp2+5
 5159  FF30DE  24 E5                    bit     SMTmp2+3        ; check tx/rx mode
 5160  FF30E0  70 03                    bvs     ?40             ; tx mode
 5161  FF30E2  4C 85 31                 jmp     ?300
 5162  FF30E5                           
 5163  FF30E5  64 BA            ?40:    stz     SMTmpL
 5164  FF30E7  64 BB                    stz     SMTmpH
 5165  FF30E9  A6 E3            ?41:    ldx     SMTmp2+1
 5166  FF30EB  3C 56 00                 bit     !splin,x
 5167  FF30EE  10 07                    bpl     ?42             ; on line       
 5168  FF30F0  20 80 1A                 jsr     CkStop
 5169  FF30F3  D0 F4                    bne     ?41
 5170  FF30F5  F0 47                    beq     ?90             ; stop
 5171  FF30F7  A9 0D            ?42:    lda     #$0D
 5172  FF30F9  20 56 31                 jsr     ?200
 5173  FF30FC  20 80 1A         ?45:    jsr     CkStop          ; loop TX
 5174  FF30FF  F0 3D                    beq     ?90             ; stop
 5175  FF3101  A5 BB                    lda     SMTmpH
 5176  FF3103  20 7C 19                 jsr     FF_Byte2Hex
 5177  FF3106  DA                       phx
 5178  FF3107  20 56 31                 jsr     ?200            ; send
 5179  FF310A  68                       pla
 5180  FF310B  20 56 31                 jsr     ?200            ; send
 5181  FF310E  A5 BA                    lda     SMTmpL
 5182  FF3110  20 7C 19                 jsr     FF_Byte2Hex
 5183  FF3113  DA                       phx
 5184  FF3114  20 56 31                 jsr     ?200
 5185  FF3117  68                       pla
 5186  FF3118  20 56 31                 jsr     ?200
 5187  FF311B  A9 20                    lda     #' '
 5188  FF311D  20 56 31                 jsr     ?200
 5189  FF3120  A9 40                    lda     #$40
 5190  FF3122  85 BC                    sta     SMTmpK
 5191  FF3124  A5 BC            ?47:    lda     SMTmpK
 5192  FF3126  20 56 31                 jsr     ?200
 5193  FF3129  E6 BC                    inc     SMTmpK
 5194  FF312B  A5 BC                    lda     SMTmpK
 5195  FF312D  C9 7E                    cmp     #$7E
 5196  FF312F  90 F3                    bcc     ?47
 5197  FF3131  A9 0D                    lda     #$0D
 5198  FF3133  20 56 31                 jsr     ?200
 5199  FF3136                           ACC16
 5200  FF3136  C2 20                    rep     #PMFLAG
 5201                                   .LONGA  on
 5202                                   .MNLIST
 5203  FF3138  E6 BA                    inc     SMTmpL
 5204  FF313A                           ACC08
 5205  FF313A  E2 20                    sep     #PMFLAG
 5206                                   .LONGA  off
 5207                                   .MNLIST
 5208  FF313C  80 BE                    bra     ?45
 5209  FF313E                           
  Tue Jul 17 11:00:24 2018                                                                                               Page   48




 5210  FF313E  A9 FF            ?90:    lda     #$FF            ; stop: CTRL BREAK
 5211  FF3140                   ?91:    SCN_CR
 5212  FF3140                           SCNPRCHAR
 5213                                   .MLIST
 5214  FF3140  02 07                    cop     $07
 5215                                   .MNLIST
 5216  FF3142  0D                       .DB     $0D
 5217                                   .MNLIST
 5218  FF3143  20 4E 19                 jsr     PrintByte
 5219  FF3146                           SCN_CR
 5220  FF3146                           SCNPRCHAR
 5221                                   .MLIST
 5222  FF3146  02 07                    cop     $07
 5223                                   .MNLIST
 5224  FF3148  0D                       .DB     $0D
 5225                                   .MNLIST
 5226  FF3149  A6 E2            ?99:    ldx     SMTmp2
 5227  FF314B  22 16 08 F8              jsl     lspres
 5228  FF314F  A5 E7                    lda     SMTmp2+5
 5229  FF3151  EB                       xba
 5230  FF3152  A5 E6                    lda     SMTmp2+4
 5231  FF3154  1B                       tcs
 5232  FF3155  60                       rts
 5233  FF3156                           
 5234  FF3156  A6 E2            ?200:   ldx     SMTmp2
 5235  FF3158  22 F6 07 F8      ?210:   jsl     lspput
 5236  FF315C  90 07                    bcc     ?215
 5237  FF315E  C8                       iny
 5238  FF315F  D0 F7                    bne     ?210
 5239  FF3161  A9 80                    lda     #$80            ; remote off-line
 5240  FF3163  80 DB                    bra     ?91
 5241  FF3165                           
 5242  FF3165  24 E5            ?215:   bit     SMTmp2+3        
 5243  FF3167  10 0C                    bpl     ?250
 5244  FF3169  22 E6 07 F8              jsl     lspget
 5245  FF316D  B0 03                    bcs     ?220
 5246  FF316F                           TXTCHAROUT
 5247  FF316F  02 06                    cop     $06
 5248                                   .MNLIST
 5249  FF3171  60                       rts
 5250  FF3172  A8               ?220:   tay
 5251  FF3173  D0 CB                    bne     ?91
 5252  FF3175  60               ?250:   rts
 5253                           
 5254  FF3176                           
 5255  FF3176  70 25 62 20 68   ?100:   .DB     'p%b h%r e t u ', 0
               25 72 20 65 20 
               74 20 75 20 00 
 5256                           
 5257  FF3185  A9 30            ?300:   lda     #'0'
 5258  FF3187  8D 00 20                 sta     !$2000
 5259  FF318A  8D 01 20                 sta     !$2001
 5260  FF318D  8D 02 20                 sta     !$2002
 5261  FF3190  8D 03 20                 sta     !$2003
 5262  FF3193  A9 20                    lda     #' '
 5263  FF3195  8D 04 20                 sta     !$2004
 5264  FF3198  A9 40                    lda     #$40
  Tue Jul 17 11:00:24 2018                                                                                               Page   49




 5265  FF319A  A2 00                    ldx     #0
 5266  FF319C  9D 05 20         ?300l:  sta     !$2005,x
 5267  FF319F  E8                       inx
 5268  FF31A0  1A                       inc     a
 5269  FF31A1  C9 7E                    cmp     #$7E
 5270  FF31A3  90 F7                    bcc     ?300l
 5271  FF31A5  9E 05 20                 stz     !$2005,x
 5272  FF31A8  64 BA            ?300w:  stz     SMTmpL
 5273  FF31AA  64 BB                    stz     SMTmpH
 5274  FF31AC  64 BC                    stz     SMTmpK
 5275  FF31AE  A6 E3                    ldx     SMTmp2+1
 5276  FF31B0  3C 56 00                 bit     !splin,x
 5277  FF31B3  10 07                    bpl     ?320            ; on line       
 5278  FF31B5  20 80 1A                 jsr     CkStop
 5279  FF31B8  D0 EE                    bne     ?300w
 5280  FF31BA  F0 76                    beq     ?340
 5281  FF31BC  A5 BC            ?320:   lda     SMTmpK
 5282  FF31BE  D0 16                    bne     ?320z
 5283                           
 5284  FF31C0  A5 BB                    lda     SMTmpH
 5285  FF31C2  20 7C 19                 jsr     FF_Byte2Hex
 5286  FF31C5  8D 00 20                 sta     !$2000
 5287  FF31C8  8E 01 20                 stx     .ABS.$2001
 5288  FF31CB  A5 BA                    lda     SMTmpL
 5289  FF31CD  20 7C 19                 jsr     FF_Byte2Hex
 5290  FF31D0  8D 02 20                 sta     !$2002
 5291  FF31D3  8E 03 20                 stx     .ABS.$2003
 5292  FF31D6                           
 5293  FF31D6  20 80 1A         ?320z:  jsr     CkStop
 5294  FF31D9  F0 57                    beq     ?340
 5295  FF31DB  A6 E2                    ldx     SMTmp2
 5296  FF31DD  22 E6 07 F8              jsl     lspget
 5297  FF31E1  B0 4A                    bcs     ?330
 5298  FF31E3  C9 0A                    cmp     #$0A
 5299  FF31E5  F0 31                    beq     ?324
 5300  FF31E7  C9 0D                    cmp     #$0D
 5301  FF31E9  D0 12                    bne     ?320a
 5302  FF31EB  A6 BC                    ldx     SMTmpK
 5303  FF31ED  F0 29                    beq     ?324
 5304  FF31EF  E0 43                    cpx     #$43
 5305  FF31F1  D0 1B                    bne     ?320e
 5306  FF31F3                           ACC16
 5307  FF31F3  C2 20                    rep     #PMFLAG
 5308                                   .LONGA  on
 5309                                   .MNLIST
 5310  FF31F5  E6 BA                    inc     SMTmpL
 5311  FF31F7                           ACC08
 5312  FF31F7  E2 20                    sep     #PMFLAG
 5313                                   .LONGA  off
 5314                                   .MNLIST
 5315  FF31F9  64 BC                    stz     SMTmpK
 5316  FF31FB  80 1B                    bra     ?324
 5317  FF31FD  C9 09            ?320a:  cmp     #$09
 5318  FF31FF  F0 17                    beq     ?324
 5319  FF3201  C9 20                    cmp     #$20
 5320  FF3203  90 B7                    bcc     ?320
 5321  FF3205  A6 BC                    ldx     SMTmpK
  Tue Jul 17 11:00:24 2018                                                                                               Page   50




 5322  FF3207  E6 BC                    inc     SMTmpK
 5323  FF3209  DD 00 20                 cmp     !$2000,x
 5324  FF320C  F0 0A                    beq     ?324
 5325  FF320E  8E 50 20         ?320e:  stx     $2050
 5326  FF3211  8D 51 20                 sta     $2051
 5327  FF3214  A9 E5                    lda     #$E5
 5328  FF3216  80 15                    bra     ?330
 5329  FF3218                   ?324:   TXTCHAROUT
 5330  FF3218  02 06                    cop     $06
 5331                                   .MNLIST
 5332  FF321A  24 E5                    bit     SMTmp2+3        
 5333  FF321C  10 9E                    bpl     ?320    
 5334  FF321E                   ?325a:
 5335  FF321E  A6 E2                    ldx     SMTmp2
 5336  FF3220  22 F6 07 F8      ?325:   jsl     lspput
 5337  FF3224  90 96                    bcc     ?320
 5338  FF3226  C8                       iny
 5339  FF3227  D0 F7                    bne     ?325
 5340  FF3229  A9 80                    lda     #$80
 5341  FF322B  80 07                    bra     ?350
 5342  FF322D  A8               ?330:   tay
 5343  FF322E  F0 8C                    beq     ?320
 5344  FF3230  80 02                    bra     ?350
 5345  FF3232  A9 FF            ?340:   lda     #$FF
 5346  FF3234                   ?350:   SCN_CR
 5347  FF3234                           SCNPRCHAR
 5348                                   .MLIST
 5349  FF3234  02 07                    cop     $07
 5350                                   .MNLIST
 5351  FF3236  0D                       .DB     $0D
 5352                                   .MNLIST
 5353  FF3237  20 4E 19                 jsr     PrintByte
 5354  FF323A  A6 E2                    ldx     SMTmp2
 5355  FF323C  22 16 08 F8              jsl     lspres
 5356  FF3240  A5 E7                    lda     SMTmp2+5
 5357  FF3242  EB                       xba
 5358  FF3243  A5 E6                    lda     SMTmp2+4
 5359  FF3245  1B                       tcs
 5360  FF3246  60                       rts
 5361                           
 5362                           ; #asptest -p<port> -b<baud_rate> -h<handshake> -e -t -n
 5363                           ; -p: port 0 or 1 (default: 0)
 5364                           ; -b: baud rate = 0,1,2,3 (default: 1 = 38,400)
 5365                           ; -h: handshke level = 0,1,2 (defalt: 2)
 5366                           ;       0=none, 1=software, 2=hardware
 5367                           ; -e: enable echo in rx mode (default mode: rx)
 5368                           ; -t: enable tx mode (-e ignored)
 5369                           ; -n: no FIFO
 5370  FF3247                   Cmd_asptst:
 5371                                   .EXTERN lspset2, lspget2, lspput2, lspres2
 5372                                   .PUBLIC Cmd_asptst
 5373                           
 5374  FF3247                           SCN_CR
 5375  FF3247                           SCNPRCHAR
 5376                                   .MLIST
 5377  FF3247  02 07                    cop     $07
 5378                                   .MNLIST
  Tue Jul 17 11:00:24 2018                                                                                               Page   51




 5379  FF3249  0D                       .DB     $0D
 5380                                   .MNLIST
 5381  FF324A  64 E2                    stz     SMTmp2          ; port 0
 5382  FF324C  64 E5                    stz     SMTmp2+3        ; no echo, rx mode
 5383  FF324E  A9 02                    lda     #2
 5384  FF3250  85 E3                    sta     SMTmp2+1        ; hardware handshake
 5385  FF3252  A9 C5                    lda     #11000101B
 5386  FF3254  85 E4                    sta     SMTmp2+2
 5387  FF3256  A9 80                    lda     #$80            ; flag
 5388  FF3258  48                       pha
 5389  FF3259  A6 E0                    ldx     cmdlin
 5390  FF325B                           ACC16CLC
 5391  FF325B  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 5392                                   .LONGA  on
 5393                                   .MNLIST
 5394  FF325D  8A                       txa
 5395  FF325E  69 00 99                 adc     #INPUTBUF
 5396  FF3261  A2 01                    ldx     #^INPUTBUF
 5397  FF3263  DA                       phx                     ; command line
 5398  FF3264  48                       pha
 5399  FF3265                           ACC08
 5400  FF3265  E2 20                    sep     #PMFLAG
 5401                                   .LONGA  off
 5402                                   .MNLIST
 5403  FF3267  4B                       phk                     ; option string
 5404  FF3268  F4 AC 33                 pea     #!?100          
 5405  FF326B  F4 00 00                 pea     #0              ; result
 5406  FF326E  F4 00 00                 pea     #0
 5407  FF3271  22 09 00 FA      ?10:    jsl     _getopt         ; get opttion's loop
 5408  FF3275  B0 54                    bcs     ?26             ; error
 5409  FF3277  AA                       tax                     ; option char
 5410  FF3278  F0 51                    beq     ?26             ; end of command line
 5411  FF327A  30 4E                    bmi     ?24             ; no option argument
 5412  FF327C  C9 70                    cmp     #'p'
 5413  FF327E  D0 08                    bne     ?12
 5414  FF3280  A3 01                    lda     $01,s
 5415  FF3282  29 01                    and     #1
 5416  FF3284  85 E2                    sta     SMTmp2          ; port
 5417  FF3286  80 E9                    bra     ?10
 5418  FF3288  C9 68            ?12:    cmp     #'h'
 5419  FF328A  D0 0E                    bne     ?14
 5420  FF328C  A3 01                    lda     $01,s
 5421  FF328E  29 03                    and     #3
 5422  FF3290  C9 03                    cmp     #3
 5423  FF3292  90 02                    bcc     ?13
 5424  FF3294  A9 02                    lda     #2
 5425  FF3296  85 E3            ?13:    sta     SMTmp2+1        ; handshake
 5426  FF3298  80 D7                    bra     ?10
 5427  FF329A  C9 62            ?14:    cmp     #'b'
 5428  FF329C  D0 0E                    bne     ?16
 5429  FF329E  A3 01                    lda     $01,s
 5430  FF32A0  29 03                    and     #3
 5431  FF32A2  AA                       tax
 5432  FF32A3  A9 03                    lda     #3
 5433  FF32A5  14 E4                    trb     SMTmp2+2
 5434  FF32A7  8A                       txa
 5435  FF32A8  04 E4                    tsb     SMTmp2+2
  Tue Jul 17 11:00:24 2018                                                                                               Page   52




 5436  FF32AA  80 C5                    bra     ?10
 5437  FF32AC  C9 6E            ?16:    cmp     #'n'
 5438  FF32AE  D0 06                    bne     ?20
 5439  FF32B0  A9 20                    lda     #$20
 5440  FF32B2  04 E4                    tsb     SMTmp2+2
 5441  FF32B4  80 BB                    bra     ?10
 5442  FF32B6  C9 65            ?20:    cmp     #'e'
 5443  FF32B8  D0 06                    bne     ?22
 5444  FF32BA  A9 80                    lda     #$80
 5445  FF32BC  04 E5                    tsb     SMTmp2+3        ; rx+echo mode
 5446  FF32BE  80 B1                    bra     ?10
 5447  FF32C0  C9 74            ?22:    cmp     #'t'
 5448  FF32C2  D0 06                    bne     ?24
 5449  FF32C4  A9 40                    lda     #$40
 5450  FF32C6  04 E5                    tsb     SMTmp2+3        ; tx mode
 5451  FF32C8  80 A7                    bra     ?10
 5452  FF32CA  38               ?24:    sec
 5453  FF32CB  08               ?26:    php                     ; clean stack
 5454  FF32CC  FA                       plx                     ; save carry
 5455  FF32CD                           ACC16CLC
 5456  FF32CD  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 5457                                   .LONGA  on
 5458                                   .MNLIST
 5459  FF32CF  3B                       tsc
 5460  FF32D0  69 0B 00                 adc     #11
 5461  FF32D3  1B                       tcs
 5462  FF32D4                           ACC08
 5463  FF32D4  E2 20                    sep     #PMFLAG
 5464                                   .LONGA  off
 5465                                   .MNLIST
 5466  FF32D6  8A                       txa
 5467  FF32D7  4A                       lsr     a               ; test carry
 5468  FF32D8  90 03                    bcc     ?28             ; ok
 5469  FF32DA  4C 34 01                 jmp     ErrCls2
 5470  FF32DD  A5 E3            ?28:    lda     SMTmp2+1
 5471  FF32DF  D0 06                    bne     ?30
 5472  FF32E1  A9 C0                    lda     #$C0
 5473  FF32E3  14 E4                    trb     SMTmp2+2
 5474  FF32E5  80 12                    bra     ?34
 5475  FF32E7  C9 01            ?30:    cmp     #1
 5476  FF32E9  D0 0A                    bne     ?32
 5477  FF32EB  A9 C0                    lda     #$C0
 5478  FF32ED  14 E4                    trb     SMTmp2+2
 5479  FF32EF  A9 80                    lda     #$80
 5480  FF32F1  04 E4                    tsb     SMTmp2+2
 5481  FF32F3  80 04                    bra     ?34
 5482  FF32F5  A9 C0            ?32:    lda     #$C0
 5483  FF32F7  04 E4                    tsb     SMTmp2+2
 5484  FF32F9  A6 E2            ?34:    ldx     SMTmp2          ; X=port
 5485  FF32FB  A5 E4                    lda     SMTmp2+2        ; A=mode
 5486  FF32FD  22 78 0D F8              jsl     lspset2
 5487  FF3301  A5 E2                    lda     SMTmp2
 5488  FF3303  0A                       asl     a
 5489  FF3304  0A                       asl     a
 5490  FF3305  85 E3                    sta     SMTmp2+1
 5491  FF3307  3B                       tsc
 5492  FF3308  85 E6                    sta     SMTmp2+4
  Tue Jul 17 11:00:24 2018                                                                                               Page   53




 5493  FF330A  EB                       xba
 5494  FF330B  85 E7                    sta     SMTmp2+5
 5495  FF330D  24 E5                    bit     SMTmp2+3        ; check tx/rx mode
 5496  FF330F  70 03                    bvs     ?40             ; tx mode
 5497  FF3311  4C B9 33                 jmp     ?300
 5498  FF3314                           
 5499  FF3314  64 BA            ?40:    stz     SMTmpL
 5500  FF3316  64 BB                    stz     SMTmpH
 5501  FF3318  A6 E2            ?41:    ldx     SMTmp2
 5502  FF331A  F0 05                    beq     ?41a
 5503  FF331C  2C 16 05                 bit     !DP05ADDR+splin3
 5504  FF331F  80 03                    bra     ?41b
 5505  FF3321  2C 2C 05         ?41a:   bit     !DP05ADDR+splin4
 5506  FF3324  50 07            ?41b:   bvc     ?42             ; on line       
 5507  FF3326  20 80 1A                 jsr     CkStop
 5508  FF3329  D0 ED                    bne     ?41
 5509  FF332B  F0 47                    beq     ?90             ; stop
 5510  FF332D  A9 0D            ?42:    lda     #$0D
 5511  FF332F  20 8C 33                 jsr     ?200
 5512  FF3332  20 80 1A         ?45:    jsr     CkStop          ; loop TX
 5513  FF3335  F0 3D                    beq     ?90             ; stop
 5514  FF3337  A5 BB                    lda     SMTmpH
 5515  FF3339  20 7C 19                 jsr     FF_Byte2Hex
 5516  FF333C  DA                       phx
 5517  FF333D  20 8C 33                 jsr     ?200            ; send
 5518  FF3340  68                       pla
 5519  FF3341  20 8C 33                 jsr     ?200            ; send
 5520  FF3344  A5 BA                    lda     SMTmpL
 5521  FF3346  20 7C 19                 jsr     FF_Byte2Hex
 5522  FF3349  DA                       phx
 5523  FF334A  20 8C 33                 jsr     ?200
 5524  FF334D  68                       pla
 5525  FF334E  20 8C 33                 jsr     ?200
 5526  FF3351  A9 20                    lda     #' '
 5527  FF3353  20 8C 33                 jsr     ?200
 5528  FF3356  A9 40                    lda     #$40
 5529  FF3358  85 BC                    sta     SMTmpK
 5530  FF335A  A5 BC            ?47:    lda     SMTmpK
 5531  FF335C  20 8C 33                 jsr     ?200
 5532  FF335F  E6 BC                    inc     SMTmpK
 5533  FF3361  A5 BC                    lda     SMTmpK
 5534  FF3363  C9 7E                    cmp     #$7E
 5535  FF3365  90 F3                    bcc     ?47
 5536  FF3367  A9 0D                    lda     #$0D
 5537  FF3369  20 8C 33                 jsr     ?200
 5538  FF336C                           ACC16
 5539  FF336C  C2 20                    rep     #PMFLAG
 5540                                   .LONGA  on
 5541                                   .MNLIST
 5542  FF336E  E6 BA                    inc     SMTmpL
 5543                                   ;lda    SMTmpL
 5544                                   ;cmp    #8
 5545  FF3370                           ACC08
 5546  FF3370  E2 20                    sep     #PMFLAG
 5547                                   .LONGA  off
 5548                                   .MNLIST
 5549  FF3372  80 BE                    bra     ?45
  Tue Jul 17 11:00:24 2018                                                                                               Page   54




 5550                                   ;bcc    ?45
 5551  FF3374                           
 5552  FF3374  A9 FF            ?90:    lda     #$FF            ; stop: CTRL BREAK
 5553  FF3376                   ?91:    SCN_CR
 5554  FF3376                           SCNPRCHAR
 5555                                   .MLIST
 5556  FF3376  02 07                    cop     $07
 5557                                   .MNLIST
 5558  FF3378  0D                       .DB     $0D
 5559                                   .MNLIST
 5560  FF3379  20 4E 19                 jsr     PrintByte
 5561  FF337C                           SCN_CR
 5562  FF337C                           SCNPRCHAR
 5563                                   .MLIST
 5564  FF337C  02 07                    cop     $07
 5565                                   .MNLIST
 5566  FF337E  0D                       .DB     $0D
 5567                                   .MNLIST
 5568  FF337F  A6 E2            ?99:    ldx     SMTmp2
 5569  FF3381  22 8A 0D F8              jsl     lspres2
 5570  FF3385  A5 E7                    lda     SMTmp2+5
 5571  FF3387  EB                       xba
 5572  FF3388  A5 E6                    lda     SMTmp2+4
 5573  FF338A  1B                       tcs
 5574  FF338B  60                       rts
 5575  FF338C                           
 5576  FF338C  A6 E2            ?200:   ldx     SMTmp2
 5577  FF338E  22 66 0D F8      ?210:   jsl     lspput2
 5578  FF3392  90 07                    bcc     ?215
 5579  FF3394  C8                       iny
 5580  FF3395  D0 F7                    bne     ?210
 5581  FF3397  A9 80                    lda     #$80            ; remote off-line
 5582  FF3399  80 DB                    bra     ?91
 5583  FF339B                           
 5584  FF339B  24 E5            ?215:   bit     SMTmp2+3        
 5585  FF339D  10 0C                    bpl     ?250
 5586  FF339F  22 54 0D F8              jsl     lspget2
 5587  FF33A3  B0 03                    bcs     ?220
 5588  FF33A5                           TXTCHAROUT
 5589  FF33A5  02 06                    cop     $06
 5590                                   .MNLIST
 5591  FF33A7  60                       rts
 5592  FF33A8  A8               ?220:   tay
 5593  FF33A9  D0 CB                    bne     ?91
 5594  FF33AB  60               ?250:   rts
 5595                           
 5596  FF33AC                           
 5597  FF33AC  70 25 62 25 68   ?100:   .DB     'p%b%h%e t n ', 0
               25 65 20 74 20 
               6E 20 00 
 5598                           
 5599                           ; RX mode
 5600  FF33B9  A9 30            ?300:   lda     #'0'
 5601  FF33BB  8D 00 20                 sta     !$2000
 5602  FF33BE  8D 01 20                 sta     !$2001
 5603  FF33C1  8D 02 20                 sta     !$2002
 5604  FF33C4  8D 03 20                 sta     !$2003
  Tue Jul 17 11:00:24 2018                                                                                               Page   55




 5605  FF33C7  A9 20                    lda     #' '
 5606  FF33C9  8D 04 20                 sta     !$2004
 5607  FF33CC  A9 40                    lda     #$40
 5608  FF33CE  A2 00                    ldx     #0
 5609  FF33D0  9D 05 20         ?300l:  sta     !$2005,x
 5610  FF33D3  E8                       inx
 5611  FF33D4  1A                       inc     a
 5612  FF33D5  C9 7E                    cmp     #$7E
 5613  FF33D7  90 F7                    bcc     ?300l
 5614  FF33D9  9E 05 20                 stz     !$2005,x
 5615  FF33DC  64 BA            ?300w:  stz     SMTmpL
 5616  FF33DE  64 BB                    stz     SMTmpH
 5617  FF33E0  64 BC                    stz     SMTmpK
 5618  FF33E2  A6 E2                    ldx     SMTmp2
 5619  FF33E4  F0 05                    beq     ?320aa
 5620  FF33E6  2C 16 05                 bit     !DP05ADDR+splin3
 5621  FF33E9  80 03                    bra     ?320b
 5622  FF33EB  2C 2C 05         ?320aa: bit     !DP05ADDR+splin4
 5623  FF33EE  10 08            ?320b:  bpl     ?320            ; on line       
 5624  FF33F0  20 80 1A                 jsr     CkStop
 5625  FF33F3  D0 E7                    bne     ?300w
 5626                                   ;beq    ?340
 5627  FF33F5  4C 78 34                 jmp     ?340
 5628                           
 5629  FF33F8  A5 BC            ?320:   lda     SMTmpK
 5630  FF33FA  D0 16                    bne     ?320z
 5631                           
 5632  FF33FC  A5 BB                    lda     SMTmpH
 5633  FF33FE  20 7C 19                 jsr     FF_Byte2Hex
 5634  FF3401  8D 00 20                 sta     !$2000
 5635  FF3404  8E 01 20                 stx     .ABS.$2001
 5636  FF3407  A5 BA                    lda     SMTmpL
 5637  FF3409  20 7C 19                 jsr     FF_Byte2Hex
 5638  FF340C  8D 02 20                 sta     !$2002
 5639  FF340F  8E 03 20                 stx     .ABS.$2003
 5640  FF3412                           
 5641  FF3412  20 80 1A         ?320z:  jsr     CkStop
 5642  FF3415  F0 61                    beq     ?340
 5643  FF3417  A6 E2                    ldx     SMTmp2
 5644  FF3419  22 54 0D F8              jsl     lspget2
 5645  FF341D  B0 54                    bcs     ?330
 5646  FF341F  C9 0A                    cmp     #$0A
 5647  FF3421  F0 3B                    beq     ?324
 5648  FF3423  C9 0D                    cmp     #$0D
 5649  FF3425  D0 1C                    bne     ?320a
 5650  FF3427  A6 BC                    ldx     SMTmpK
 5651  FF3429  F0 33                    beq     ?324
 5652  FF342B  E0 43                    cpx     #$43
 5653                                   ;bne    ?320e
 5654  FF342D  F0 0A                    beq     ?320xxx
 5655  FF342F  8E 50 20                 stx     $2050
 5656  FF3432  8D 51 20                 sta     $2051
 5657  FF3435  A9 E6                    lda     #$E6
 5658  FF3437  80 3A                    bra     ?330
 5659  FF3439                           
 5660  FF3439                   ?320xxx:
 5661  FF3439                           ACC16
  Tue Jul 17 11:00:24 2018                                                                                               Page   56




 5662  FF3439  C2 20                    rep     #PMFLAG
 5663                                   .LONGA  on
 5664                                   .MNLIST
 5665  FF343B  E6 BA                    inc     SMTmpL
 5666  FF343D                           ACC08
 5667  FF343D  E2 20                    sep     #PMFLAG
 5668                                   .LONGA  off
 5669                                   .MNLIST
 5670  FF343F  64 BC                    stz     SMTmpK
 5671  FF3441  80 1B                    bra     ?324
 5672  FF3443  C9 09            ?320a:  cmp     #$09
 5673  FF3445  F0 17                    beq     ?324
 5674  FF3447  C9 20                    cmp     #$20
 5675  FF3449  90 AD                    bcc     ?320
 5676  FF344B  A6 BC                    ldx     SMTmpK
 5677  FF344D  E6 BC                    inc     SMTmpK
 5678  FF344F  DD 00 20                 cmp     !$2000,x
 5679  FF3452  F0 0A                    beq     ?324
 5680                                   ;bne    ?324
 5681  FF3454  8E 50 20         ?320e:  stx     $2050
 5682  FF3457  8D 51 20                 sta     $2051
 5683  FF345A  A9 E5                    lda     #$E5
 5684  FF345C  80 15                    bra     ?330
 5685  FF345E                   ?324:   TXTCHAROUT
 5686  FF345E  02 06                    cop     $06
 5687                                   .MNLIST
 5688  FF3460  24 E5                    bit     SMTmp2+3        
 5689  FF3462  10 94                    bpl     ?320    
 5690  FF3464                   ?325a:
 5691  FF3464  A6 E2                    ldx     SMTmp2
 5692  FF3466  22 66 0D F8      ?325:   jsl     lspput2
 5693  FF346A  90 8C                    bcc     ?320
 5694  FF346C  C8                       iny
 5695  FF346D  D0 F7                    bne     ?325
 5696  FF346F  A9 80                    lda     #$80
 5697  FF3471  80 07                    bra     ?350
 5698  FF3473  A8               ?330:   tay
 5699  FF3474  F0 82                    beq     ?320
 5700  FF3476  80 02                    bra     ?350
 5701  FF3478  A9 FF            ?340:   lda     #$FF
 5702  FF347A                   ?350:   SCN_CR
 5703  FF347A                           SCNPRCHAR
 5704                                   .MLIST
 5705  FF347A  02 07                    cop     $07
 5706                                   .MNLIST
 5707  FF347C  0D                       .DB     $0D
 5708                                   .MNLIST
 5709  FF347D  20 4E 19                 jsr     PrintByte
 5710  FF3480  A6 E2                    ldx     SMTmp2
 5711  FF3482  22 8A 0D F8              jsl     lspres2
 5712  FF3486  A5 E7                    lda     SMTmp2+5
 5713  FF3488  EB                       xba
 5714  FF3489  A5 E6                    lda     SMTmp2+4
 5715  FF348B  1B                       tcs
 5716  FF348C  60                       rts
 5717                           
 5718  FF348D                   ATACPYSTR1:
  Tue Jul 17 11:00:24 2018                                                                                               Page   57




 5719  FF348D  72 65 61 64 20           .DB     'read  %02bX sect. from %08X to %08X (Total %08X, dev. #%01bX)', $00
               20 25 30 32 62 
               58 20 73 65 63 
               74 2E 20 66 72 
               6F 6D 20 25 30 
               38 58 20 74 6F 
               20 25 30 38 58 
               20 28 54 6F 74 
               61 6C 20 25 30 
               38 58 2C 20 64 
               65 76 2E 20 23 
               25 30 31 62 58 
               29 00 
 5720                           
 5721  FF34CB                   ATACPYSTR2:
 5722  FF34CB  77 72 69 74 65           .DB     'write %02bX sect. from %08X to %08X (Total %08X, dev. #%01bX)', $00
               20 25 30 32 62 
               58 20 73 65 63 
               74 2E 20 66 72 
               6F 6D 20 25 30 
               38 58 20 74 6F 
               20 25 30 38 58 
               20 28 54 6F 74 
               61 6C 20 25 30 
               38 58 2C 20 64 
               65 76 2E 20 23 
               25 30 31 62 58 
               29 00 


             Lines Assembled : 5193                  Errors : 0