Subversion Repositories MB01 Project

Rev

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

  Tue Jul 17 11:00:21 2018                                                                                               Page    1







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

                       Input  Filename : src\FA\getopt.asm
                       Output Filename : obj\FA\getopt.obj
                       Listing Has Been Relocated                               


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




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




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




 2763                           
 2764                                   .ENDS
 2765                           
 2766          [01]             .IFDEF          _ACIA_INC_
 2767                                   .INCLUDE INC\SP.INC
 2768          [00]             .ENDIF
 2769                           
 2773                           .LIST on
 2774                           
 2775                           ; page 0 local var's (declared in bios temp. work area)
 2776                           _P0BTMP:        .SECTION page0, ref_only, offset bwrktmp        ; DP Tmp. BIOS
 2777                           
 2778  000094                   cmdlin          LP              ; long pointer to command line
 2779  000097                   optstr          LP              ; long pointer to options mask
 2780  00009A  0000 0000        dwres           .LWORD          ; result
 2781  00009E  00               slen            .DB             ; string length
 2782  00009F  00               squot           .DB             ; flag quotation marks
 2783  0000A0  00               cmdy            .DB             ; index
 2784  0000A1  00               chopt           .DB             ; option char
 2785  0000A2  00               prsfg           .DB             ; parsing flag
 2786  0000A3  00               opttyp          .DB             ; option type
 2787  0000A4                   intarg          .DS     4       ; integer argument
 2788  0000A8                   tmpp            LP
 2789  0000AB  00               argsgn          .DB
 2790                           
 2791                                   .ENDS
 2792                           
 2793                           ;---------------------------------------------------------------------------
 2794                           ; code segment -- bank $FA
 2795                           ;---------------------------------------------------------------------------
 2796                           
 2797                                   .CODEFA
 2798                                   .EXTERN _lstrtoint
 2799                           
 2800                                   .LONGA  off
 2801                                   .LONGI  off
 2802                           
 2803                           ; getopt
 2804                           ;
 2805                           ; parse a command line and return option&argument
 2806                           ; command line is parsed basis on option string, a mask that specify option ch
 2807                           ; and argument type. Any option start with '-' character, followed by a single
 2808                           ; character; if option requires an argument, this argument follow (without
 2809                           ; blanks) the character option. String option can be quoted (with quotation
 2810                           ; marks, this need when argument contains blanks).
 2811                           ; Option string have this simple skeleton:
 2812                           ;
 2813                           ;       xtxtxtxt....
 2814                           ;
 2815                           ; where x is a single option character and t is the argument type
 2816                           ; recognized argument types:
 2817                           ;       t=      blank, mean option does not requires argument
 2818                           ;               ':', '$': mean option requires a string argument
 2819                           ;                         type '$' return an up case string
 2820                           ;               '!', '^': mean option requires a single char argument
 2821                           ;                         type '^' return an up case char
 2822                           ;               '%'     : byte argument required
  Tue Jul 17 11:00:21 2018                                                                                               Page    5




 2823                           ;               '#'     : integer 16 bit argument required
 2824                           ;               '*'     : integer 24 bit argument required (ptr type)
 2825                           ;               '&'     : integer 32 bit argument required
 2826                           ;
 2827                           ; option string example: 'r s:t^'
 2828                           ; option '-r' without argument
 2829                           ; option '-s' requires a string
 2830                           ; option '-t' requires a single character, returned in up case
 2831                           ; an example of valid command line for above mask:
 2832                           ;       xxxxx  -szzzzz -r -tC  yyyyy
 2833                           ; string 'yyyyy' is an argument without option
 2834                           ;
 2835                           ; function return
 2836                           ; getopt does not clean stack frame when exit and parameter's will be modified
 2837                           ; sCmd change at any call and hold the residual command line string
 2838                           ; sRes change at any call and hold the argument (long pointer to string,
 2839                           ; a single character, a numeric argument)
 2840                           ; Y return the option type associated with the current parsed option
 2841                           ; A return: 0 if reached the end of command line, the current parsed option,
 2842                           ; or a negative value if return an argument without option: in this last case
 2843                           ; sRes return a string.
 2844                           ;
 2845                           ; calling getopt will be in a loop until A=0 or until error; the caller should
 2846                           ; clean stack when finish to parse command line
 2847                           ;
 2848                           ; param's:
 2849                           ;
 2850                           ;               sFlag   = <7>: show error message
 2851                           ;                         <6>: accept decimal numeric arguments
 2852                           ;                         <5>: wanted signed int arg. (only if bit 6 is set)
 2853                           ;                         <0>: called from monitor
 2854                           ;               sCmd    = long pointer to command line
 2855                           ;               sOpt    = long pointer to option's string
 2856                           ;               sRes    = 32 bit result
 2857                           ;
 2858                           ; exit:
 2859                           ;               sCmd    = residual command line string
 2860                           ;               sRes    = argument (depend on type)
 2861                           ;               A       = option character currently parsed
 2862                           ;                         or =0 when end of string,
 2863                           ;                         or negative when parsed argument without option
 2864                           ;               Y       = option type associated with option
 2865                           ;
 2866                           ; if any error, function return CF=1, otherwise CF=0
 2867                           ;
 2868                           ; param's stack offset
 2869          000006           sRes    .SET    6
 2870          00000A           sOpt    .SET    10
 2871          00000D           sCmd    .SET    13
 2872          000010           sFlag   .SET    16
 2873                           
 2874                           ;----------------------
 2875  FA0009                   _getopt:
 2876                                   .PUBLIC _getopt
 2877                           ;----------------------
 2878  FA0009  0B                       phd
 2879  FA000A  F4 00 00                 pea     #0
  Tue Jul 17 11:00:21 2018                                                                                               Page    6




 2880  FA000D  2B                       pld
 2881  FA000E                           ACC16                   ; move param's in local var's
 2882  FA000E  C2 20                    rep     #PMFLAG
 2883                                   .LONGA  on
 2884                                   .MNLIST
 2885  FA0010  A3 0A                    lda     sOpt,s
 2886  FA0012  85 97                    sta     optstr
 2887  FA0014  A3 0D                    lda     sCmd,s
 2888  FA0016  85 94                    sta     cmdlin
 2889  FA0018  64 A4                    stz     intarg
 2890  FA001A  64 A6                    stz     intarg+2
 2891  FA001C                           ACC08
 2892  FA001C  E2 20                    sep     #PMFLAG
 2893                                   .LONGA  off
 2894                                   .MNLIST
 2895  FA001E  A3 0C                    lda     sOpt+2,s
 2896  FA0020  85 99                    sta     optstr+2
 2897  FA0022  A3 0F                    lda     sCmd+2,s
 2898  FA0024  85 96                    sta     cmdlin+2
 2899  FA0026  A3 10                    lda     sFlag,s
 2900  FA0028  85 A2                    sta     prsfg
 2901  FA002A  A0 00                    ldy     #0
 2902  FA002C  84 A3                    sty     opttyp
 2903  FA002E  84 AB                    sty     argsgn
 2904  FA0030  20 A5 00                 jsr     ?104            ; get next char
 2905  FA0033  F0 6C                    beq     ?94             ; return A=0
 2906  FA0035  C9 2D                    cmp     #'-'            ; option?
 2907  FA0037  F0 0B                    beq     ?05             ; yes
 2908  FA0039  20 AE 00                 jsr     ?110            ; find end of argument
 2909  FA003C  B0 64                    bcs     ?95             ; error
 2910  FA003E  A9 80                    lda     #$80            ; no option argument
 2911  FA0040  85 A1                    sta     chopt
 2912  FA0042  80 45                    bra     ?90
 2913  FA0044  20 59 01         ?05:    jsr     ?130            ; check option
 2914  FA0047  B0 59                    bcs     ?95             ; error
 2915  FA0049  20 C4 01                 jsr     ?140            ; test option argument
 2916  FA004C  B0 54                    bcs     ?95             ; error
 2917  FA004E  A6 A3                    ldx     opttyp
 2918  FA0050  E0 20                    cpx     #' '            ; option without argument?
 2919  FA0052  F0 35                    beq     ?90             ; yes...so exit
 2920  FA0054  E0 3A                    cpx     #':'            ; option requires a simple string argument?
 2921  FA0056  F0 31                    beq     ?90             ; yes...so exit
 2922  FA0058  E0 24                    cpx     #'$'            ; option requires up case string argument?
 2923  FA005A  F0 08                    beq     ?10             ; yes
 2924  FA005C  E0 21                    cpx     #'!'            ; option requires a single char argument?
 2925  FA005E  F0 1D                    beq     ?30             ; yes
 2926  FA0060  E0 5E                    cpx     #'^'            ; option requires a single up case char arg.?
 2927  FA0062  D0 20                    bne     ?40             ; no
 2928  FA0064  A0 00            ?10:    ldy     #0
 2929  FA0066  B7 9A            ?15:    lda     [dwres],y       ; up case string
 2930  FA0068  F0 0F                    beq     ?25             ; end of string
 2931  FA006A  C9 61                    cmp     #'a'
 2932  FA006C  90 08                    bcc     ?20
 2933  FA006E  C9 7B                    cmp     #'z'+1
 2934  FA0070  B0 04                    bcs     ?20
 2935  FA0072  29 DF                    and     #$DF
 2936  FA0074  97 9A                    sta     [dwres],y
  Tue Jul 17 11:00:21 2018                                                                                               Page    7




 2937  FA0076  C8               ?20:    iny
 2938  FA0077  80 ED                    bra     ?15
 2939  FA0079  E0 24            ?25:    cpx     #'$'            ; if requires string exit
 2940  FA007B  F0 0C                    beq     ?90
 2941  FA007D  20 52 02         ?30:    jsr     ?150            ; check single char argument
 2942  FA0080  B0 20                    bcs     ?95             ; error
 2943  FA0082  80 05                    bra     ?90
 2944  FA0084  20 AD 02         ?40:    jsr     ?160            ; others option type
 2945  FA0087  B0 19                    bcs     ?95
 2946  FA0089                   ?90:    ACC16                   ; return result to the caller...
 2947  FA0089  C2 20                    rep     #PMFLAG
 2948                                   .LONGA  on
 2949                                   .MNLIST
 2950  FA008B  A5 94                    lda     cmdlin          ; ...and residual command line string
 2951  FA008D  83 0D                    sta     sCmd,s
 2952  FA008F  A5 9A                    lda     dwres
 2953  FA0091  83 06                    sta     sRes,s
 2954  FA0093  A5 9C                    lda     dwres+2
 2955  FA0095  83 08                    sta     sRes+2,s
 2956  FA0097                           ACC08
 2957  FA0097  E2 20                    sep     #PMFLAG
 2958                                   .LONGA  off
 2959                                   .MNLIST
 2960  FA0099  A5 96                    lda     cmdlin+2
 2961  FA009B  83 0F                    sta     sCmd+2,s
 2962  FA009D  A4 A3                    ldy     opttyp          ; return Y=option type
 2963  FA009F  A5 A1                    lda     chopt           ; return A=option char
 2964  FA00A1  18               ?94:    clc                     ; no error
 2965  FA00A2  2B               ?95:    pld
 2966  FA00A3  6B                       rtl
 2967                           
 2968  FA00A4  C8               ?100:   iny                     ; get char from command line
 2969  FA00A5  B7 94            ?104:   lda     [cmdlin],y
 2970  FA00A7  F0 04                    beq     ?106
 2971  FA00A9  C9 20                    cmp     #' '
 2972  FA00AB  F0 F7                    beq     ?100
 2973  FA00AD  60               ?106:   rts
 2974                           
 2975  FA00AE  A2 20            ?110:   ldx     #' '    
 2976  FA00B0  86 9F                    stx     squot           ; normal end of string char
 2977  FA00B2  64 9E                    stz     slen            ; size of argument
 2978  FA00B4  C9 22                    cmp     #'"'            ; search end of string
 2979  FA00B6  D0 03                    bne     ?112            ; not quoted
 2980  FA00B8  85 9F                    sta     squot           ; quoted string
 2981  FA00BA  C8                       iny
 2982  FA00BB  84 A0            ?112:   sty     cmdy            ; save index    
 2983  FA00BD  B7 94            ?114:   lda     [cmdlin],y
 2984  FA00BF  D0 08                    bne     ?115
 2985  FA00C1  A6 9F                    ldx     squot
 2986  FA00C3  E0 22                    cpx     #'"'
 2987  FA00C5  F0 37                    beq     ?122            ; missing final quote
 2988  FA00C7  80 0E                    bra     ?117
 2989  FA00C9  C5 9F            ?115:   cmp     squot           ; first blank/quote is end of string
 2990  FA00CB  F0 05                    beq     ?116
 2991  FA00CD  E6 9E                    inc     slen
 2992  FA00CF  C8                       iny
 2993  FA00D0  80 EB                    bra     ?114
  Tue Jul 17 11:00:21 2018                                                                                               Page    8




 2994  FA00D2  A9 00            ?116:   lda     #0              ; put string terminator
 2995  FA00D4  97 94                    sta     [cmdlin],y
 2996  FA00D6  C8                       iny                     ; next token in command line
 2997  FA00D7  A6 9E            ?117:   ldx     slen            ; check string length
 2998  FA00D9  F0 53                    beq     ?126            ; error
 2999  FA00DB  A6 A0                    ldx     cmdy
 3000  FA00DD                           ACC16CLC
 3001  FA00DD  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3002                                   .LONGA  on
 3003                                   .MNLIST
 3004  FA00DF  8A                       txa
 3005  FA00E0  65 94                    adc     cmdlin
 3006  FA00E2  85 9A                    sta     dwres           ; pointer to argument
 3007  FA00E4                           ACC08
 3008  FA00E4  E2 20                    sep     #PMFLAG
 3009                                   .LONGA  off
 3010                                   .MNLIST
 3011  FA00E6  A5 96                    lda     cmdlin+2
 3012  FA00E8  90 01                    bcc     ?118
 3013  FA00EA  1A                       inc     a
 3014  FA00EB  85 9C            ?118:   sta     dwres+2
 3015  FA00ED  64 9D                    stz     dwres+3
 3016  FA00EF                   ?119:   ACC16CLC
 3017  FA00EF  C2 21                    rep     #(PMFLAG.OR.PCFLAG)
 3018                                   .LONGA  on
 3019                                   .MNLIST
 3020  FA00F1  98                       tya
 3021  FA00F2  65 94                    adc     cmdlin
 3022  FA00F4  85 94                    sta     cmdlin          ; bump command line ptr
 3023  FA00F6                           ACC08
 3024  FA00F6  E2 20                    sep     #PMFLAG
 3025                                   .LONGA  off
 3026                                   .MNLIST
 3027  FA00F8  90 03                    bcc     ?120
 3028  FA00FA  E6 96                    inc     cmdlin+2
 3029  FA00FC  18                       clc
 3030  FA00FD  60               ?120:   rts
 3031  FA00FE  A5 A2            ?122:   lda     prsfg           ; test bit 7
 3032  FA0100  10 2A                    bpl     ?124            ; no show error message
 3033  FA0102  20 50 01                 jsr     ?128
 3034  FA0105                           SCNPRINT
 3035  FA0105  02 01                    cop     $01
 3036                                   .MNLIST
 3037  FA0107  6D 69 73 73 69           .DB     'missig quotation marks in argument.', 13, 0 
               67 20 71 75 6F 
               74 61 74 69 6F 
               6E 20 6D 61 72 
               6B 73 20 69 6E 
               20 61 72 67 75 
               6D 65 6E 74 2E 
               0D 00 
 3038  FA012C  38               ?124:   sec                     ; error flag
 3039  FA012D  60                       rts
 3040  FA012E  A5 A2            ?126:   lda     prsfg
 3041  FA0130  10 FA                    bpl     ?124
 3042  FA0132  20 50 01                 jsr     ?128
 3043  FA0135                           SCNPRINT
  Tue Jul 17 11:00:21 2018                                                                                               Page    9




 3044  FA0135  02 01                    cop     $01
 3045                                   .MNLIST
 3046  FA0137  61 72 67 75 6D           .DB     'argument zero length.', 13, 0 
               65 6E 74 20 7A 
               65 72 6F 20 6C 
               65 6E 67 74 68 
               2E 0D 00 
 3047  FA014E  38               ?127:   sec
 3048  FA014F  60                       rts
 3049  FA0150  4A               ?128:   lsr     a
 3050  FA0151  90 05                    bcc     ?129
 3051  FA0153                           SCNPRINT
 3052  FA0153  02 01                    cop     $01
 3053                                   .MNLIST
 3054  FA0155  3A 3A 00                 .DB     '::', 0
 3055  FA0158  60               ?129:   rts
 3056                           
 3057  FA0159  C8               ?130:   iny                     ; check option
 3058  FA015A  B7 94                    lda     [cmdlin],y
 3059  FA015C  F0 1E                    beq     ?135            ; missing option
 3060  FA015E  C9 20                    cmp     #' '
 3061  FA0160  F0 1A                    beq     ?135            ; missing option
 3062  FA0162  BB                       tyx
 3063  FA0163  85 A1                    sta     chopt           ; store option char
 3064  FA0165  A0 00                    ldy     #0              ; scan option string
 3065  FA0167  B7 97            ?132:   lda     [optstr],y
 3066  FA0169  F0 2D                    beq     ?136            ; option not found
 3067  FA016B  C5 A1                    cmp     chopt
 3068  FA016D  F0 04                    beq     ?134            ; found
 3069  FA016F  C8                       iny
 3070  FA0170  C8                       iny
 3071  FA0171  80 F4                    bra     ?132
 3072  FA0173  C8               ?134:   iny
 3073  FA0174  B7 97                    lda     [optstr],y      ; get option type
 3074  FA0176  85 A3                    sta     opttyp
 3075  FA0178  9B                       txy
 3076  FA0179  C8                       iny
 3077  FA017A  18                       clc
 3078  FA017B  60                       rts
 3079  FA017C                           
 3080  FA017C  A5 A2            ?135:   lda     prsfg
 3081  FA017E  10 CE                    bpl     ?127
 3082  FA0180  20 50 01                 jsr     ?128
 3083  FA0183                           SCNPRINT
 3084  FA0183  02 01                    cop     $01
 3085                                   .MNLIST
 3086  FA0185  6D 69 73 73 69           .DB     'missing option.', 13, 0
               6E 67 20 6F 70 
               74 69 6F 6E 2E 
               0D 00 
 3087  FA0196  38                       sec
 3088  FA0197  60                       rts
 3089                           
 3090  FA0198  A5 A2            ?136:   lda     prsfg
 3091  FA019A  10 B2                    bpl     ?127
 3092  FA019C  20 50 01                 jsr     ?128
 3093  FA019F  A5 A1                    lda     chopt
  Tue Jul 17 11:00:21 2018                                                                                               Page   10




 3094  FA01A1  48                       pha
 3095  FA01A2  4B                       phk
 3096  FA01A3  F4 AD 01                 pea     #!?138
 3097  FA01A6  A9 05                    lda     #5
 3098  FA01A8  48                       pha
 3099  FA01A9                           BPRINTF
 3100  FA01A9  02 11                    cop     $11
 3101                                   .MNLIST
 3102  FA01AB  38                       sec
 3103  FA01AC  60                       rts
 3104                           
 3105  FA01AD  69 6C 6C 65 67   ?138:   .DB     'illegal option ''-%c''.', 13, 0
               61 6C 20 6F 70 
               74 69 6F 6E 20 
               27 2D 25 63 27 
               2E 0D 00 
 3106                           
 3107  FA01C4  A6 A3            ?140:   ldx     opttyp          ; option type
 3108  FA01C6  B7 94                    lda     [cmdlin],y      ; get char after option
 3109  FA01C8  F0 0B                    beq     ?142            ; no argument
 3110  FA01CA  C9 20                    cmp     #' '
 3111  FA01CC  F0 07                    beq     ?142            ; no argument
 3112  FA01CE  E0 20                    cpx     #' '            ; option requires an argument?
 3113  FA01D0  F0 0A                    beq     ?144            ; no...so error
 3114  FA01D2  4C AE 00                 jmp     ?110            ; get argument
 3115  FA01D5  E0 20            ?142:   cpx     #' '            ; option requires an argument?
 3116  FA01D7  D0 45                    bne     ?148            ; yes...so error
 3117  FA01D9  4C EF 00                 jmp     ?119            ; bump command line ptr
 3118  FA01DC                           
 3119  FA01DC  A5 A2            ?144:   lda     prsfg
 3120  FA01DE  10 0F                    bpl     ?145
 3121  FA01E0  20 50 01                 jsr     ?128
 3122  FA01E3  A5 A1                    lda     chopt
 3123  FA01E5  48                       pha
 3124  FA01E6  4B                       phk
 3125  FA01E7  F4 F1 01                 pea     #!?146
 3126  FA01EA  A9 05            ?144a:  lda     #5
 3127  FA01EC  48                       pha
 3128  FA01ED                           BPRINTF
 3129  FA01ED  02 11                    cop     $11
 3130                                   .MNLIST
 3131  FA01EF  38               ?145:   sec
 3132  FA01F0  60                       rts
 3133                           
 3134  FA01F1  6F 70 74 69 6F   ?146:   .DB     'option ''-%c'' does not requires an argument.', 13, 0
               6E 20 27 2D 25 
               63 27 20 64 6F 
               65 73 20 6E 6F 
               74 20 72 65 71 
               75 69 72 65 73 
               20 61 6E 20 61 
               72 67 75 6D 65 
               6E 74 2E 0D 00 
 3135                           
 3136  FA021E  A5 A2            ?148:   lda     prsfg
 3137  FA0220  10 CD                    bpl     ?145
 3138  FA0222  20 50 01                 jsr     ?128
  Tue Jul 17 11:00:21 2018                                                                                               Page   11




 3139  FA0225  A5 A1                    lda     chopt
 3140  FA0227  48                       pha
 3141  FA0228  4B                       phk
 3142  FA0229  F4 2E 02                 pea     #!?149
 3143  FA022C  80 BC                    bra     ?144a
 3144                           
 3145  FA022E  6F 70 74 69 6F   ?149:   .DB     'option ''-%c'' requires an argument.', 13, 0
               6E 20 27 2D 25 
               63 27 20 72 65 
               71 75 69 72 65 
               73 20 61 6E 20 
               61 72 67 75 6D 
               65 6E 74 2E 0D 
               00 
 3146                           
 3147  FA0252  A5 9E            ?150:   lda     slen            ; check single char argument
 3148  FA0254  C9 01                    cmp     #1
 3149  FA0256  D0 0C                    bne     ?152
 3150  FA0258  A7 9A                    lda     [dwres]
 3151  FA025A  85 9A                    sta     dwres
 3152  FA025C  64 9B                    stz     dwres+1
 3153  FA025E  64 9C                    stz     dwres+2
 3154  FA0260  64 9D                    stz     dwres+3
 3155  FA0262  18                       clc
 3156  FA0263  60                       rts
 3157  FA0264  A5 A2            ?152:   lda     prsfg
 3158  FA0266  10 0F                    bpl     ?154
 3159  FA0268  20 50 01                 jsr     ?128
 3160  FA026B  A5 A1                    lda     chopt
 3161  FA026D  48                       pha
 3162  FA026E  4B                       phk
 3163  FA026F  F4 79 02                 pea     #!?156
 3164  FA0272  A9 05                    lda     #5
 3165  FA0274  48                       pha
 3166  FA0275                           BPRINTF
 3167  FA0275  02 11                    cop     $11
 3168                                   .MNLIST
 3169  FA0277  38               ?154:   sec
 3170  FA0278  60                       rts
 3171                           
 3172  FA0279  6F 70 74 69 6F   ?156:   .DB     'option ''-%c'' requires a single character argument.', 13, 0
               6E 20 27 2D 25 
               63 27 20 72 65 
               71 75 69 72 65 
               73 20 61 20 73 
               69 6E 67 6C 65 
               20 63 68 61 72 
               61 63 74 65 72 
               20 61 72 67 75 
               6D 65 6E 74 2E 
               0D 00 
 3173                           
 3174  FA02AD  A2 03            ?160:   ldx     #3              ; check others option's type
 3175  FA02AF  BF F3 03 FA      ?162:   lda     >?200,x
 3176  FA02B3  C5 A3                    cmp     opttyp
 3177  FA02B5  F0 46                    beq     ?166
 3178  FA02B7  CA                       dex
  Tue Jul 17 11:00:21 2018                                                                                               Page   12




 3179  FA02B8  10 F5                    bpl     ?162
 3180  FA02BA  A5 A2                    lda     prsfg
 3181  FA02BC  10 12                    bpl     ?164
 3182  FA02BE  20 50 01                 jsr     ?128
 3183  FA02C1  A5 A3                    lda     opttyp
 3184  FA02C3  48                       pha
 3185  FA02C4  A5 A1                    lda     chopt
 3186  FA02C6  48                       pha
 3187  FA02C7  4B                       phk
 3188  FA02C8  F4 D2 02                 pea     #!?165
 3189  FA02CB  A9 06                    lda     #6
 3190  FA02CD  48                       pha
 3191  FA02CE                           BPRINTF
 3192  FA02CE  02 11                    cop     $11
 3193                                   .MNLIST
 3194  FA02D0  38               ?164:   sec
 3195  FA02D1  60                       rts
 3196                           
 3197  FA02D2  6F 70 74 69 6F   ?165:   .DB     'option ''-%c'': invalid argument type ''%c''.', 13, 0
               6E 20 27 2D 25 
               63 27 3A 20 69 
               6E 76 61 6C 69 
               64 20 61 72 67 
               75 6D 65 6E 74 
               20 74 79 70 65 
               20 27 25 63 27 
               2E 0D 00 
 3198                           
 3199  FA02FD  E8               ?166:   inx                     ; wanted integer size
 3200  FA02FE  A5 A2                    lda     prsfg
 3201  FA0300  A8                       tay
 3202  FA0301  29 40                    and     #$40            ; mask autodetect flag
 3203  FA0303  F0 07                    beq     ?166a           ; hex string only
 3204  FA0305  85 A8                    sta     tmpp
 3205  FA0307  98                       tya
 3206  FA0308  0A                       asl     a
 3207  FA0309  0A                       asl     a               ; wanted signed flag
 3208  FA030A  05 A8                    ora     tmpp    
 3209  FA030C  A4 9C            ?166a:  ldy     dwres+2         ; string ptr
 3210  FA030E  5A                       phy
 3211  FA030F  D4 9A                    pei     (dwres)
 3212  FA0311  DA                       phx                     ; integer size
 3213  FA0312  48                       pha                     ; flag
 3214  FA0313  F4 00 00                 pea     #0              ; pointer to result
 3215  FA0316  A9 A4                    lda     #intarg
 3216  FA0318  48                       pha
 3217  FA0319  22 BB 27 F8              jsl     _lstrtoint
 3218  FA031D  B0 1A                    bcs     ?168
 3219  FA031F  70 31                    bvs     ?180
 3220  FA0321                           ACC16
 3221  FA0321  C2 20                    rep     #PMFLAG
 3222                                   .LONGA  on
 3223                                   .MNLIST
 3224  FA0323  85 A8                    sta     tmpp
 3225  FA0325  86 AA                    stx     tmpp+2
 3226  FA0327  84 AB                    sty     argsgn
 3227  FA0329  A5 A4                    lda     intarg
  Tue Jul 17 11:00:21 2018                                                                                               Page   13




 3228  FA032B  85 9A                    sta     dwres
 3229  FA032D  A5 A6                    lda     intarg+2
 3230  FA032F  85 9C                    sta     dwres+2
 3231  FA0331                           ACC08
 3232  FA0331  E2 20                    sep     #PMFLAG
 3233                                   .LONGA  off
 3234                                   .MNLIST
 3235  FA0333  A7 A8                    lda     [tmpp]          ; check residual string
 3236  FA0335  D0 01                    bne     ?167            ; should be null        
 3237  FA0337  60                       rts
 3238  FA0338  B8               ?167:   clv                     ; invalid numeric string        
 3239  FA0339  A5 A2            ?168:   lda     prsfg
 3240  FA033B  10 28                    bpl     ?184
 3241  FA033D  08                       php
 3242  FA033E  20 50 01                 jsr     ?128
 3243  FA0341  28                       plp
 3244  FA0342  A5 A1                    lda     chopt
 3245  FA0344  48                       pha
 3246  FA0345  4B                       phk
 3247  FA0346  70 05                    bvs     ?170
 3248  FA0348  F4 67 03                 pea     #!?190
 3249  FA034B  80 13                    bra     ?182
 3250  FA034D  F4 97 03         ?170:   pea     #!?192          
 3251  FA0350  80 0E                    bra     ?182
 3252  FA0352  A5 A2            ?180:   lda     prsfg
 3253  FA0354  10 0F                    bpl     ?184
 3254  FA0356  20 50 01                 jsr     ?128
 3255  FA0359  A5 A1                    lda     chopt
 3256  FA035B  48                       pha
 3257  FA035C  4B                       phk
 3258  FA035D  F4 C1 03                 pea     #!?194
 3259  FA0360  A9 05            ?182:   lda     #5
 3260  FA0362  48                       pha
 3261  FA0363                           BPRINTF
 3262  FA0363  02 11                    cop     $11
 3263                                   .MNLIST
 3264  FA0365  38               ?184:   sec
 3265  FA0366  60                       rts
 3266                           
 3267  FA0367  6F 70 74 69 6F   ?190:   .DB     'option ''-%c'': invalid numeric string argument.', 13, 0
               6E 20 27 2D 25 
               63 27 3A 20 69 
               6E 76 61 6C 69 
               64 20 6E 75 6D 
               65 72 69 63 20 
               73 74 72 69 6E 
               67 20 61 72 67 
               75 6D 65 6E 74 
               2E 0D 00 
 3268  FA0397  6F 70 74 69 6F   ?192:   .DB     'option ''-%c'': numeric argument overflow.', 13, 0
               6E 20 27 2D 25 
               63 27 3A 20 6E 
               75 6D 65 72 69 
               63 20 61 72 67 
               75 6D 65 6E 74 
               20 6F 76 65 72 
               66 6C 6F 77 2E 
  Tue Jul 17 11:00:21 2018                                                                                               Page   14




               0D 00 
 3269  FA03C1  6F 70 74 69 6F   ?194:   .DB     'option ''-%c'': signed/unsigned mismatch argument.', 13, 0
               6E 20 27 2D 25 
               63 27 3A 20 73 
               69 67 6E 65 64 
               2F 75 6E 73 69 
               67 6E 65 64 20 
               6D 69 73 6D 61 
               74 63 68 20 61 
               72 67 75 6D 65 
               6E 74 2E 0D 00 
 3270                           
 3271  FA03F3  25 23 2A 26      ?200:   .DB     '%#*&'


             Lines Assembled : 3213                  Errors : 0