AS65 Assembler for R6502 [1.42].                                     Page    1
-------------------------- 6502_functional_test.a65 --------------------------

-------------------------------- Symbol Table --------------------------------

              Symbol   Value        Decimal

               absAN : $025f            607
              absANa : $026b            619
               absEO : $0263            611
              absEOa : $026f            623
              absflo : $0277            631
               absOR : $025b            603
              absORa : $0267            615
              absrlo : $0273            627
                abst : $0203            515
                abs1 : $0218            536
               abs7f : $021c            540
                ada2 : $0203            515
                adfc : $000c             12
               adiy2 : $0058             88
                adi2 : $0054             84
                adrf : $0011             17
                adrh : $0010             16
                adrl : $000f             15
                 ad1 : $000d             13
                 ad2 : $000e             14
         bin_rti_ret : $3469          13417
               brcc1 : $071e           1822
               brcc2 : $0721           1825
               brcc3 : $0725           1829
               brcc4 : $0728           1832
               brcc5 : $072c           1836
               brcc6 : $072f           1839
               brcc7 : $0733           1843
               brcc8 : $0736           1846
               brcs1 : $069e           1694
               brcs2 : $06a1           1697
               brcs3 : $06a5           1701
               brcs4 : $06a8           1704
               brcs5 : $06ac           1708
               brcs6 : $06af           1711
               brcs7 : $06b3           1715
               brcs8 : $06b6           1718
               break : $0010             16
              break2 : $3809          14345
            brk_ret0 : $09dc           2524
            brk_ret1 : $0a0b           2571
               brmi1 : $06be           1726
               brmi2 : $06c1           1729
               brmi3 : $06c5           1733
               brmi4 : $06c8           1736
               brmi5 : $06cc           1740
               brmi6 : $06cf           1743
               brmi7 : $06d3           1747
               brmi8 : $06d6           1750
               brpl1 : $073e           1854
               brpl2 : $0741           1857
               brpl3 : $0745           1861
               brpl4 : $0748           1864
               brpl5 : $074c           1868
               brpl6 : $074f           1871
               brpl7 : $0753           1875
               brpl8 : $0756           1878
               brvc1 : $075e           1886
AS65 Assembler for R6502 [1.42].                                     Page    2
-------------------------- 6502_functional_test.a65 --------------------------

               brvc2 : $0761           1889
               brvc3 : $0765           1893
               brvc4 : $0768           1896
               brvc5 : $076c           1900
               brvc6 : $076f           1903
               brvc7 : $0773           1907
               brvc8 : $0776           1910
               brvs1 : $06de           1758
               brvs2 : $06e1           1761
               brvs3 : $06e5           1765
               brvs4 : $06e8           1768
               brvs5 : $06ec           1772
               brvs6 : $06ef           1775
               brvs7 : $06f3           1779
               brvs8 : $06f6           1782
               brzc1 : $06fe           1790
               brzc2 : $0701           1793
               brzc3 : $0705           1797
               brzc4 : $0708           1800
               brzc5 : $070c           1804
               brzc6 : $070f           1807
               brzc7 : $0713           1811
               brzc8 : $0716           1814
               brzs1 : $067e           1662
               brzs2 : $0681           1665
               brzs3 : $0685           1669
               brzs4 : $0688           1672
               brzs5 : $068c           1676
               brzs6 : $068f           1679
               brzs7 : $0693           1683
               brzs8 : $0696           1686
                 br1 : $0619           1561
                br11 : $0655           1621
                br12 : $065a           1626
                br13 : $065f           1631
                br14 : $0670           1648
                 br2 : $061e           1566
                 br3 : $0623           1571
                 br4 : $0634           1588
               carry : $0001              1
           check_ram : <macro>
              chkadd : $35b6          13750
              chkdad : $3483          13443
               ckad1 : $35cb          13771
            cmp_flag : <macro>
        code_segment : $0400           1024   *
            data_bss : $0209            521
        data_bss_end : $027b            635
        data_segment : $0200            512   *
             decmode : $0008              8
         dec_rti_ret : $3460          13408
     disable_decimal : $0000              0   *
     disable_selfmod : $0000              0   *
            eor_flag : <macro>
             ex_adci : $0212            530
             ex_andi : $0209            521
             ex_eori : $020c            524
             ex_orai : $020f            527
             ex_sbci : $0215            533
                fASL : $0239            569
                 fai : $0034             52
                faid : $003c             60
AS65 Assembler for R6502 [1.42].                                     Page    3
-------------------------- 6502_functional_test.a65 --------------------------

                 fao : $0030             48
                faod : $0038             56
             far_ret : $090f           2319
                  fc : $0001              1
                fINC : $0256            598
                fLDx : $021d            541
                fLSR : $0245            581
                  fn : $0080            128
                 fnc : $0081            129
                 fnv : $00c0            192
                 fnz : $0082            130
                fnzc : $0083            131
                fROL : $0239            569
               fROLc : $023f            575
                fROR : $0245            581
               fRORc : $024b            587
                  fv : $0040             64
                 fvz : $0042             66
                  fz : $0002              2
                 fzc : $0003              3
              I_flag : $0003              3   *
               indAN : $003c             60
               indEO : $0044             68
               indOR : $004c             76
                indt : $0032             50
                ind1 : $0026             38
             ind_ret : $0964           2404
              intdis : $0004              4
                inwt : $003a             58
                inw1 : $0030             48
               irq_a : $000a             10
            irq_trap : $37bf          14271
               irq_x : $000b             11
             jsr_ret : $099a           2458   *
    load_data_direct : $0001              1   *
           load_flag : <macro>
               minus : $0080            128
                  m8 : $00ff            255
                 m8i : $00fb            251
                nbr1 : $0628           1576
               nbr11 : $0664           1636
               nbr12 : $0667           1639
               nbr13 : $066a           1642
               nbr14 : $066d           1645
                nbr2 : $062b           1579
                nbr3 : $062e           1582
                nbr4 : $0631           1585
           next_test : <macro>
            nmi_trap : $37b1          14257
              overfl : $0040             64
            psb_back : $0429           1065
            psb_bwok : $040e           1038
            psb_forw : $041a           1050
            psb_fwok : $0438           1080
            psb_test : $0433           1075
         ptr_ind_ret : $3734          14132
         ptr_tst_ind : $3732          14130
         ROM_vectors : $0000              0   *
                rASL : $0221            545
           ram_chksm : $0201            513
             ram_top : $ffff             -1   *
           range_adr : $04e6           1254   *
AS65 Assembler for R6502 [1.42].                                     Page    4
-------------------------- 6502_functional_test.a65 --------------------------

           range_end : $0581           1409
            range_fw : $0453           1107
          range_loop : $0446           1094
            range_ok : $0575           1397
            range_op : $04e5           1253
              report : $0000              0   *
              reserv : $0020             32
            res_trap : $37b7          14263
                rINC : $0251            593
                rLSR : $022d            557
                rROL : $0221            545
               rROLc : $0227            551
                rROR : $022d            557
               rRORc : $0233            563
                sba2 : $0204            516
               sbiy2 : $005a             90
                sbi2 : $0056             86
                 sb2 : $0012             18
               set_a : <macro>
             set_abs : <macro>
            set_absx : <macro>
              set_ax : <macro>
              set_ay : <macro>
            set_stat : <macro>
               set_x : <macro>
               set_y : <macro>
               set_z : <macro>
              set_zx : <macro>
               start : $0400           1024
             success : <macro>
                tadd : $333b          13115
               tadd1 : $334d          13133
                tand : $2d35          11573
               tand1 : $2d57          11607
              tand10 : $2e6f          11887
              tand11 : $2e8c          11916
              tand12 : $2eab          11947
              tand13 : $2ecb          11979
              tand14 : $2ee9          12009
              tand15 : $2f05          12037
               tand2 : $2d79          11641
               tand3 : $2d99          11673
               tand4 : $2db9          11705
               tand5 : $2ddb          11739
               tand6 : $2dfd          11773
               tand7 : $2e19          11801
               tand8 : $2e35          11829
               tand9 : $2e52          11858
                tasl : $22d9           8921
               tasl1 : $22f3           8947
               tasl2 : $241d           9245
               tasl3 : $243c           9276
               tasl4 : $259d           9629
               tasl5 : $25bf           9663
               tasl6 : $2741          10049
               tasl7 : $2760          10080
               tasl8 : $28c1          10433
               tasl9 : $28e3          10467
                tdad : $339e          13214
               tdad1 : $33b0          13232
               tdad2 : $33c0          13248
               tdad3 : $33c2          13250
AS65 Assembler for R6502 [1.42].                                     Page    5
-------------------------- 6502_functional_test.a65 --------------------------

               tdad4 : $33dc          13276
               tdad5 : $33e1          13281
               tdad6 : $3405          13317
               tdad7 : $3419          13337
                tdec : $2a8f          10895
               tdec1 : $2ab2          10930
              tdec10 : $2ade          10974
              tdec11 : $2b01          11009
              tdec12 : $2b95          11157
              tdec13 : $2bbb          11195
              tdec14 : $2c44          11332
              tdec15 : $2c69          11369
              tdec16 : $2cfe          11518
              tdec17 : $2d27          11559
               tdec2 : $2b3e          11070
               tdec3 : $2b64          11108
               tdec4 : $2bf3          11251
               tdec5 : $2c18          11288
               tdec6 : $2ca5          11429
               tdec7 : $2cce          11470
                teor : $2f2d          12077
               teor1 : $2f4f          12111
              teor10 : $3067          12391
              teor11 : $3084          12420
              teor12 : $30a3          12451
              teor13 : $30c3          12483
              teor14 : $30e1          12513
              teor15 : $30fd          12541
               teor2 : $2f71          12145
               teor3 : $2f91          12177
               teor4 : $2fb1          12209
               teor5 : $2fd3          12243
               teor6 : $2ff5          12277
               teor7 : $3011          12305
               teor8 : $302d          12333
               teor9 : $304a          12362
            test_bne : $0594           1428
           test_case : $0200            512
            test_far : $3703          14083
            test_ind : $373b          14139
            test_jsr : $3771          14193
           test_near : $0932           2354
            test_num : $002b             43   *
                tinc : $2a69          10857
               tinc1 : $2a88          10888
              tinc10 : $2ab8          10936
              tinc11 : $2ad7          10967
              tinc12 : $2b6b          11115
              tinc13 : $2b8d          11149
              tinc14 : $2c1c          11292
              tinc15 : $2c3d          11325
              tinc16 : $2cd2          11474
              tinc17 : $2cf7          11511
               tinc2 : $2b14          11028
               tinc3 : $2b36          11062
               tinc4 : $2bcb          11211
               tinc5 : $2bec          11244
               tinc6 : $2c79          11385
               tinc7 : $2c9e          11422
               tldax : $164c           5708
              tldax1 : $166e           5742
              tldax2 : $1690           5776
AS65 Assembler for R6502 [1.42].                                     Page    6
-------------------------- 6502_functional_test.a65 --------------------------

              tldax3 : $16b1           5809
              tldax4 : $17af           6063
              tldax5 : $17d4           6100
              tldax6 : $1818           6168
              tldax7 : $1824           6180
               tlday : $16fd           5885
              tlday1 : $171f           5919
              tlday2 : $1756           5974
              tlday3 : $1777           6007
              tlday4 : $184d           6221
              tlday5 : $186e           6254
              tlday6 : $188f           6287
                tldx : $0e68           3688
               tldx1 : $0e8b           3723
               tldx2 : $0eae           3758
               tldx3 : $0ed2           3794
               tldx4 : $0f23           3875
               tldx5 : $0f30           3888
                tldy : $0f65           3941
               tldy1 : $0f88           3976
               tldy2 : $0fab           4011
               tldy3 : $0fce           4046
               tldy4 : $101c           4124
               tldy5 : $1029           4137
                tlsr : $230d           8973
               tlsr1 : $2327           8999
               tlsr2 : $245b           9307
               tlsr3 : $247a           9338
               tlsr4 : $25e1           9697
               tlsr5 : $2603           9731
               tlsr6 : $277f          10111
               tlsr7 : $279e          10142
               tlsr8 : $2905          10501
               tlsr9 : $2927          10535
                tora : $3125          12581
               tora1 : $3147          12615
              tora10 : $325f          12895
              tora11 : $327c          12924
              tora12 : $329b          12955
              tora13 : $32bb          12987
              tora14 : $32d9          13017
              tora15 : $32f5          13045
               tora2 : $3169          12649
               tora3 : $3189          12681
               tora4 : $31a9          12713
               tora5 : $31cb          12747
               tora6 : $31ed          12781
               tora7 : $3209          12809
               tora8 : $3225          12837
               tora9 : $3242          12866
                trap : <macro>
             trap_cc : <macro>
             trap_cs : <macro>
             trap_eq : <macro>
             trap_mi : <macro>
             trap_ne : <macro>
             trap_pl : <macro>
             trap_vc : <macro>
             trap_vs : <macro>
                trol : $2341           9025
               trolc : $2375           9077
              trolc1 : $238f           9103
AS65 Assembler for R6502 [1.42].                                     Page    7
-------------------------- 6502_functional_test.a65 --------------------------

              trolc2 : $24d7           9431
              trolc3 : $24f6           9462
              trolc4 : $2669           9833
              trolc5 : $268b           9867
              trolc6 : $27fb          10235
              trolc7 : $281a          10266
              trolc8 : $298d          10637
              trolc9 : $29af          10671
               trol1 : $235b           9051
               trol2 : $2499           9369
               trol3 : $24b8           9400
               trol4 : $2625           9765
               trol5 : $2647           9799
               trol6 : $27bd          10173
               trol7 : $27dc          10204
               trol8 : $2949          10569
               trol9 : $296b          10603
                tror : $23a9           9129
               trorc : $23dd           9181
              trorc1 : $23f7           9207
              trorc2 : $2553           9555
              trorc3 : $2572           9586
              trorc4 : $26f1           9969
              trorc5 : $2713          10003
              trorc6 : $2877          10359
              trorc7 : $2896          10390
              trorc8 : $2a15          10773
              trorc9 : $2a37          10807
               tror1 : $23c3           9155
               tror2 : $2515           9493
               tror3 : $2534           9524
               tror4 : $26ad           9901
               tror5 : $26cf           9935
               tror6 : $2839          10297
               tror7 : $2858          10328
               tror8 : $29d1          10705
               tror9 : $29f3          10739
               tstax : $16d4           5844
              tstax1 : $1832           6194
               tstay : $1743           5955
              tstay1 : $179a           6042
              tstay2 : $17f9           6137
              tstay4 : $185d           6237
              tstay5 : $187c           6268
              tstay6 : $189e           6302
                tstx : $0ef8           3832
               tstx1 : $0f3e           3902
                tsty : $0ff3           4083
               tsty1 : $1037           4151
               tst_a : <macro>
             tst_abs : <macro>
            tst_absx : <macro>
              tst_ax : <macro>
              tst_ay : <macro>
            tst_stat : <macro>
               tst_x : <macro>
               tst_y : <macro>
               tst_z : <macro>
              tst_zx : <macro>
                zero : $0002              2
           zero_page : $000a             10   *
                zpAN : $001e             30
AS65 Assembler for R6502 [1.42].                                     Page    8
-------------------------- 6502_functional_test.a65 --------------------------

                zpEO : $0022             34
                zpOR : $001a             26
                 zps : $0013             19
                 zpt : $000c             12
                 zp1 : $0015             21
                zp7f : $0019             25
              zp_bss : $0013             19
          zp_bss_end : $005c             92
            __6502__ : $0001              1

404 labels used

6109 lines read, no errors in pass 1.
AS65 Assembler for R6502 [1.42].                                     Page    9
-------------------------- 6502_functional_test.a65 --------------------------

                        ;
                        ; 6 5 0 2   F U N C T I O N A L   T E S T
                        ;
                        ; Copyright (C) 2012-2020  Klaus Dormann
                        ;
                        ; This program is free software: you can redistribute 
                        ; it under the terms of the GNU General Public License
                        ; the Free Software Foundation, either version 3 of th
                        ; (at your option) any later version.
                        ;
                        ; This program is distributed in the hope that it will
                        ; but WITHOUT ANY WARRANTY; without even the implied w
                        ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
                        ; GNU General Public License for more details.
                        ;
                        ; You should have received a copy of the GNU General P
                        ; along with this program.  If not, see <http://www.gn
                        
                        
                        ; This program is designed to test all opcodes of a 65
                        ; addressing modes with focus on propper setting of th
                        ; register bits.
                        ; 
                        ; version 05-jan-2020
                        ; contact info at http://2m5.de or email K@2m5.de
                        ;
                        ; assembled with AS65 written by Frank A. Kingswood
                        ; The assembler as65_142.zip can be obtained from my G
                        ; command line switches: -l -m -s2 -w -h0
                        ;                         |  |  |   |  no page headers
                        ;                         |  |  |   wide listing (133 
                        ;                         |  |  write intel hex file i
                        ;                         |  expand macros in listing
                        ;                         generate pass2 listing
                        ;
                        ; No IO - should be run from a monitor with access to 
                        ; To run load intel hex image with a load command, tha
                        ; (code_segment) and enter a go command.
                        ; Loop on program counter determines error or successf
                        ; Check listing for relevant traps (jump/branch *).
                        ; Please note that in early tests some instructions wi
                        ; they are actually tested!
                        ;
                        ; RESET, NMI or IRQ should not occur and will be trapp
                        ; Tests documented behavior of the original NMOS 6502 
                        ; opcodes. Additional opcodes of newer versions of the
                        ; not be tested. Decimal ops will only be tested with 
                        ; N V Z flags will be ignored.
                        ;
                        ; Debugging hints:
                        ;     Most of the code is written sequentially. if you
                        ;   immediately preceeding code for the instruction to
                        ;   tested first, flags are checked second by pushing 
                        ;   pulling them to the accumulator after the result w
                        ;   flags are no longer valid for the tested instructi
                        ;     If the tested instruction was indexed, the relev
                        ;   also be checked. Opposed to the flags, X and Y reg
                        ;
                        ; versions:
                        ;   28-jul-2012  1st version distributed for testing
                        ;   29-jul-2012  fixed references to location 0, now #
                        ;                added license - GPLv3
AS65 Assembler for R6502 [1.42].                                     Page   10
-------------------------- 6502_functional_test.a65 --------------------------

                        ;   30-jul-2012  added configuration options
                        ;   01-aug-2012  added trap macro to allow user to cha
                        ;   01-dec-2012  fixed trap in branch field must be a 
                        ;   02-mar-2013  fixed PLA flags not tested
                        ;   19-jul-2013  allowed ROM vectors to be loaded when
                        ;                added test sequence check to detect i
                        ;   23-jul-2013  added RAM integrity check option
                        ;   16-aug-2013  added error report to standard output
                        ;   13-dec-2014  added binary/decimal opcode table swi
                        ;   14-dec-2014  improved relative address test
                        ;   23-aug-2015  added option to disable self modifyin
                        ;   24-aug-2015  all self modifying immediate opcodes 
                        ;                added small branch offset pretest
                        ;   21-oct-2015  added option to disable decimal mode 
                        ;   04-dec-2017  fixed BRK only tested with interrupts
                        ;                added option to skip the remainder of
                        ;                in report.i65
                        ;   05-jan-2020  fixed shifts not testing zero result 
                        ;                is shifted out
                        
                        ; C O N F I G U R A T I O N
                        
                        ;ROM_vectors writable (0=no, 1=yes)
                        ;if ROM vectors can not be used interrupts will not be
                        ;as a consequence BRK can not be tested but will be em
0000 =                  ROM_vectors = 0
                        
                        ;load_data_direct (0=move from code segment, 1=load di
                        ;loading directly is preferred but may not be supporte
                        ;0 produces only consecutive object code, 1 is not sui
0001 =                  load_data_direct = 1
                        
                        ;I_flag behavior (0=force enabled, 1=force disabled, 2
                        ;change) 2 requires extra code and is not recommended.
                        ;tested if you allow changing the interrupt status (I_
0003 =                  I_flag = 3
                        
                        ;configure memory - try to stay away from memory used 
                        ;zero_page memory start address, $52 (82) consecutive 
                        ;                                add 2 if I_flag = 2
000a =                  zero_page = $a  
                        
                        ;data_segment memory start address, $7B (123) consecut
0200 =                  data_segment = $200  
                            if (data_segment & $ff) != 0
                                ERROR ERROR ERROR low byte of data_segment MUS
                            endif  
                        
                        ;code_segment memory start address, 13.1kB of consecut
                        ;                                   add 2.5 kB if I_fl
0400 =                  code_segment = $400  
                        
                        ;self modifying code may be disabled to allow running 
                        ;0=part of the code is self modifying and must reside 
                        ;1=tests disabled: branch range
0000 =                  disable_selfmod = 0
                        
                        ;report errors through I/O channel (0=use standard sel
                        ;report.i65 as I/O channel, add 3.5 kB)
0000 =                  report = 0
                        
                        ;RAM integrity test option. Checks for undesired RAM w
AS65 Assembler for R6502 [1.42].                                     Page   11
-------------------------- 6502_functional_test.a65 --------------------------

                        ;set lowest non RAM or RAM mirror address page (-1=dis
                        ;leave disabled if a monitor, OS or background interru
ffff =                  ram_top = -1
                        
                        ;disable test decimal mode ADC & SBC, 0=enable, 1=disa
                        ;2=disable including decimal flag in processor status
0000 =                  disable_decimal = 0
                        
                                noopt       ;do not take shortcuts
                        
                        ;macros for error & success traps to allow user modifi
                        ;example:
                        ;trap    macro
                        ;        jsr my_error_handler
                        ;        endm
                        ;trap_eq macro
                        ;        bne skip\?
                        ;        trap           ;failed equal (zero)
                        ;skip\?
                        ;        endm
                        ;
                        ; my_error_handler should pop the calling address from
                        ; putting larger portions of code (more than 3 bytes) 
                        ; may lead to branch range problems for some tests.
                            if report = 0
                        trap    macro
                                jmp *           ;failed anyway
                                endm
                        trap_eq macro
                                beq *           ;failed equal (zero)
                                endm
                        trap_ne macro
                                bne *           ;failed not equal (non zero)
                                endm
                        trap_cs macro
                                bcs *           ;failed carry set
                                endm
                        trap_cc macro
                                bcc *           ;failed carry clear
                                endm
                        trap_mi macro
                                bmi *           ;failed minus (bit 7 set)
                                endm
                        trap_pl macro
                                bpl *           ;failed plus (bit 7 clear)
                                endm
                        trap_vs macro
                                bvs *           ;failed overflow set
                                endm
                        trap_vc macro
                                bvc *           ;failed overflow clear
                                endm
                        ; please observe that during the test the stack gets i
                        ; therefore a RTS inside the success macro is not poss
                        success macro
                                jmp *           ;test passed, no errors
                                endm
                            endif
                            if report = 1
                        trap    macro
                                jsr report_error
                                endm
AS65 Assembler for R6502 [1.42].                                     Page   12
-------------------------- 6502_functional_test.a65 --------------------------

                        trap_eq macro
                                bne skip\?
                                trap           ;failed equal (zero)
                        skip\?
                                endm
                        trap_ne macro
                                beq skip\?
                                trap            ;failed not equal (non zero)
                        skip\?
                                endm
                        trap_cs macro
                                bcc skip\?
                                trap            ;failed carry set
                        skip\?
                                endm
                        trap_cc macro
                                bcs skip\?
                                trap            ;failed carry clear
                        skip\?
                                endm
                        trap_mi macro
                                bpl skip\?
                                trap            ;failed minus (bit 7 set)
                        skip\?
                                endm
                        trap_pl macro
                                bmi skip\?
                                trap            ;failed plus (bit 7 clear)
                        skip\?
                                endm
                        trap_vs macro
                                bvc skip\?
                                trap            ;failed overflow set
                        skip\?
                                endm
                        trap_vc macro
                                bvs skip\?
                                trap            ;failed overflow clear
                        skip\?
                                endm
                        ; please observe that during the test the stack gets i
                        ; therefore a RTS inside the success macro is not poss
                        success macro
                                jsr report_success
                                endm
                            endif
                        
                        
0001 =                  carry   equ %00000001   ;flag bits in status
0002 =                  zero    equ %00000010
0004 =                  intdis  equ %00000100
0008 =                  decmode equ %00001000
0010 =                  break   equ %00010000
0020 =                  reserv  equ %00100000
0040 =                  overfl  equ %01000000
0080 =                  minus   equ %10000000
                        
0001 =                  fc      equ carry
0002 =                  fz      equ zero
0003 =                  fzc     equ carry+zero
0040 =                  fv      equ overfl
0042 =                  fvz     equ overfl+zero
AS65 Assembler for R6502 [1.42].                                     Page   13
-------------------------- 6502_functional_test.a65 --------------------------

0080 =                  fn      equ minus
0081 =                  fnc     equ minus+carry
0082 =                  fnz     equ minus+zero
0083 =                  fnzc    equ minus+zero+carry
00c0 =                  fnv     equ minus+overfl
                        
0030 =                  fao     equ break+reserv    ;bits always on after PHP,
0034 =                  fai     equ fao+intdis      ;+ forced interrupt disabl
0038 =                  faod    equ fao+decmode     ;+ ignore decimal
003c =                  faid    equ fai+decmode     ;+ ignore decimal
00ff =                  m8      equ $ff             ;8 bit mask
00fb =                  m8i     equ $ff&~intdis     ;8 bit mask - interrupt di
                        
                        ;macros to allow masking of status bits.
                        ;masking test of decimal bit
                        ;masking of interrupt enable/disable on load and compa
                        ;masking of always on bits after PHP or BRK (unused & 
                            if disable_decimal < 2
                                if I_flag = 0
                        load_flag   macro
                                    lda #\1&m8i         ;force enable interrup
                                    endm
                        cmp_flag    macro
                                    cmp #(\1|fao)&m8i   ;I_flag is always enab
                                    endm
                        eor_flag    macro
                                    eor #(\1&m8i|fao)   ;mask I, invert expect
                                    endm
                                endif
                                if I_flag = 1
                        load_flag   macro
                                    lda #\1|intdis      ;force disable interru
                                    endm
                        cmp_flag    macro
                                    cmp #(\1|fai)&m8    ;I_flag is always disa
                                    endm
                        eor_flag    macro
                                    eor #(\1|fai)       ;invert expected flags
                                    endm
                                endif
                                if I_flag = 2
                        load_flag   macro
                                    lda #\1
                                    ora flag_I_on       ;restore I-flag
                                    and flag_I_off
                                    endm
                        cmp_flag    macro
                                    eor flag_I_on       ;I_flag is never chang
                                    cmp #(\1|fao)&m8i   ;expected flags + alwa
                                    endm
                        eor_flag    macro
                                    eor flag_I_on       ;I_flag is never chang
                                    eor #(\1&m8i|fao)   ;mask I, invert expect
                                    endm
                                endif
                                if I_flag = 3
                        load_flag   macro
                                    lda #\1             ;allow test to change 
                                    endm
                        cmp_flag    macro
                                    cmp #(\1|fao)&m8    ;expected flags + alwa
                                    endm
AS65 Assembler for R6502 [1.42].                                     Page   14
-------------------------- 6502_functional_test.a65 --------------------------

                        eor_flag    macro
                                    eor #\1|fao         ;invert expected flags
                                    endm
                                endif
                            else
                                if I_flag = 0
                        load_flag   macro
                                    lda #\1&m8i         ;force enable interrup
                                    endm
                        cmp_flag    macro
                                    ora #decmode        ;ignore decimal mode b
                                    cmp #(\1|faod)&m8i  ;I_flag is always enab
                                    endm
                        eor_flag    macro
                                    ora #decmode        ;ignore decimal mode b
                                    eor #(\1&m8i|faod)  ;mask I, invert expect
                                    endm
                                endif
                                if I_flag = 1
                        load_flag   macro
                                    lda #\1|intdis      ;force disable interru
                                    endm
                        cmp_flag    macro
                                    ora #decmode        ;ignore decimal mode b
                                    cmp #(\1|faid)&m8   ;I_flag is always disa
                                    endm
                        eor_flag    macro
                                    ora #decmode        ;ignore decimal mode b
                                    eor #(\1|faid)      ;invert expected flags
                                    endm
                                endif
                                if I_flag = 2
                        load_flag   macro
                                    lda #\1
                                    ora flag_I_on       ;restore I-flag
                                    and flag_I_off
                                    endm
                        cmp_flag    macro
                                    eor flag_I_on       ;I_flag is never chang
                                    ora #decmode        ;ignore decimal mode b
                                    cmp #(\1|faod)&m8i  ;expected flags + alwa
                                    endm
                        eor_flag    macro
                                    eor flag_I_on       ;I_flag is never chang
                                    ora #decmode        ;ignore decimal mode b
                                    eor #(\1&m8i|faod)  ;mask I, invert expect
                                    endm
                                endif
                                if I_flag = 3
                        load_flag   macro
                                    lda #\1             ;allow test to change 
                                    endm
                        cmp_flag    macro
                                    ora #decmode        ;ignore decimal mode b
                                    cmp #(\1|faod)&m8   ;expected flags + alwa
                                    endm
                        eor_flag    macro
                                    ora #decmode        ;ignore decimal mode b
                                    eor #\1|faod        ;invert expected flags
                                    endm
                                endif
                            endif
AS65 Assembler for R6502 [1.42].                                     Page   15
-------------------------- 6502_functional_test.a65 --------------------------

                        
                        ;macros to set (register|memory|zeropage) & status
                        set_stat    macro       ;setting flags in the processo
                                    load_flag \1
                                    pha         ;use stack to load status
                                    plp
                                    endm
                        
                        set_a       macro       ;precharging accu & status
                                    load_flag \2
                                    pha         ;use stack to load status
                                    lda #\1     ;precharge accu
                                    plp
                                    endm
                        
                        set_x       macro       ;precharging index & status
                                    load_flag \2
                                    pha         ;use stack to load status
                                    ldx #\1     ;precharge index x
                                    plp
                                    endm
                        
                        set_y       macro       ;precharging index & status
                                    load_flag \2
                                    pha         ;use stack to load status
                                    ldy #\1     ;precharge index y
                                    plp
                                    endm
                        
                        set_ax      macro       ;precharging indexed accu & im
                                    load_flag \2
                                    pha         ;use stack to load status
                                    lda \1,x    ;precharge accu
                                    plp
                                    endm
                        
                        set_ay      macro       ;precharging indexed accu & im
                                    load_flag \2
                                    pha         ;use stack to load status
                                    lda \1,y    ;precharge accu
                                    plp
                                    endm
                        
                        set_z       macro       ;precharging indexed zp & imme
                                    load_flag \2
                                    pha         ;use stack to load status
                                    lda \1,x    ;load to zeropage
                                    sta zpt
                                    plp
                                    endm
                        
                        set_zx      macro       ;precharging zp,x & immediate 
                                    load_flag \2
                                    pha         ;use stack to load status
                                    lda \1,x    ;load to indexed zeropage
                                    sta zpt,x
                                    plp
                                    endm
                        
                        set_abs     macro       ;precharging indexed memory & 
                                    load_flag \2
                                    pha         ;use stack to load status
AS65 Assembler for R6502 [1.42].                                     Page   16
-------------------------- 6502_functional_test.a65 --------------------------

                                    lda \1,x    ;load to memory
                                    sta abst
                                    plp
                                    endm
                        
                        set_absx    macro       ;precharging abs,x & immediate
                                    load_flag \2
                                    pha         ;use stack to load status
                                    lda \1,x    ;load to indexed memory
                                    sta abst,x
                                    plp
                                    endm
                        
                        ;macros to test (register|memory|zeropage) & status & 
                        tst_stat    macro       ;testing flags in the processo
                                    php         ;save status
                                    pla         ;use stack to retrieve status
                                    pha
                                    cmp_flag \1
                                    trap_ne
                                    plp         ;restore status
                                    endm
                                    
                        tst_a       macro       ;testing result in accu & flag
                                    php         ;save flags
                                    cmp #\1     ;test result
                                    trap_ne
                                    pla         ;load status
                                    pha
                                    cmp_flag \2
                                    trap_ne
                                    plp         ;restore status
                                    endm
                        
                        tst_x       macro       ;testing result in x index & f
                                    php         ;save flags
                                    cpx #\1     ;test result
                                    trap_ne
                                    pla         ;load status
                                    pha
                                    cmp_flag \2
                                    trap_ne
                                    plp         ;restore status
                                    endm
                        
                        tst_y       macro       ;testing result in y index & f
                                    php         ;save flags
                                    cpy #\1     ;test result
                                    trap_ne
                                    pla         ;load status
                                    pha
                                    cmp_flag \2
                                    trap_ne
                                    plp         ;restore status
                                    endm
                        
                        tst_ax      macro       ;indexed testing result in acc
                                    php         ;save flags
                                    cmp \1,x    ;test result
                                    trap_ne
                                    pla         ;load status
                                    eor_flag \3
AS65 Assembler for R6502 [1.42].                                     Page   17
-------------------------- 6502_functional_test.a65 --------------------------

                                    cmp \2,x    ;test flags
                                    trap_ne     ;
                                    endm
                        
                        tst_ay      macro       ;indexed testing result in acc
                                    php         ;save flags
                                    cmp \1,y    ;test result
                                    trap_ne     ;
                                    pla         ;load status
                                    eor_flag \3
                                    cmp \2,y    ;test flags
                                    trap_ne
                                    endm
                                
                        tst_z       macro       ;indexed testing result in zp 
                                    php         ;save flags
                                    lda zpt
                                    cmp \1,x    ;test result
                                    trap_ne
                                    pla         ;load status
                                    eor_flag \3
                                    cmp \2,x    ;test flags
                                    trap_ne
                                    endm
                        
                        tst_zx      macro       ;testing result in zp,x & flag
                                    php         ;save flags
                                    lda zpt,x
                                    cmp \1,x    ;test result
                                    trap_ne
                                    pla         ;load status
                                    eor_flag \3
                                    cmp \2,x    ;test flags
                                    trap_ne
                                    endm
                        
                        tst_abs     macro       ;indexed testing result in mem
                                    php         ;save flags
                                    lda abst
                                    cmp \1,x    ;test result
                                    trap_ne
                                    pla         ;load status
                                    eor_flag \3
                                    cmp \2,x    ;test flags
                                    trap_ne
                                    endm
                        
                        tst_absx    macro       ;testing result in abs,x & fla
                                    php         ;save flags
                                    lda abst,x
                                    cmp \1,x    ;test result
                                    trap_ne
                                    pla         ;load status
                                    eor_flag \3
                                    cmp \2,x    ;test flags
                                    trap_ne
                                    endm
                                    
                        ; RAM integrity test
                        ;   verifies that none of the previous tests has alter
                        ;   designated write areas.
                        ;   uses zpt word as indirect pointer, zpt+2 word as c
AS65 Assembler for R6502 [1.42].                                     Page   18
-------------------------- 6502_functional_test.a65 --------------------------

                                if ram_top > -1
                        check_ram   macro 
                                    cld
                                    lda #0
                                    sta zpt         ;set low byte of indirect 
                                    sta zpt+3       ;checksum high byte
                                  if disable_selfmod = 0
                                    sta range_adr   ;reset self modifying code
                                  endif
                                    clc
                                    ldx #zp_bss-zero_page ;zeropage - write te
                        ccs3\?      adc zero_page,x
                                    bcc ccs2\?
                                    inc zpt+3       ;carry to high byte
                                    clc
                        ccs2\?      inx
                                    bne ccs3\?
                                    ldx #hi(abs1)   ;set high byte of indirect
                                    stx zpt+1
                                    ldy #lo(abs1)   ;data after write & execut
                        ccs5\?      adc (zpt),y
                                    bcc ccs4\?
                                    inc zpt+3       ;carry to high byte
                                    clc
                        ccs4\?      iny
                                    bne ccs5\?
                                    inx             ;advance RAM high address
                                    stx zpt+1
                                    cpx #ram_top
                                    bne ccs5\?
                                    sta zpt+2       ;checksum low is
                                    cmp ram_chksm   ;checksum low expected
                                    trap_ne         ;checksum mismatch
                                    lda zpt+3       ;checksum high is
                                    cmp ram_chksm+1 ;checksum high expected
                                    trap_ne         ;checksum mismatch
                                    endm            
                                else
                        check_ram   macro
                                    ;RAM check disabled - RAM size not set
                                    endm
                                endif
                        
                        next_test   macro           ;make sure, tests don't ju
                                    lda test_case   ;previous test
                                    cmp #test_num
                                    trap_ne         ;test is out of sequence
                        test_num = test_num + 1
                                    lda #test_num   ;*** next tests' number
                                    sta test_case
                                    ;check_ram       ;uncomment to find altere
                                    endm
                        
                            if load_data_direct = 1
                                data
                            else
                                bss                 ;uninitialized segment, co
                            endif
000a =                          org zero_page
                        ;break test interrupt save
000a : 00               irq_a   ds  1               ;a register
000b : 00               irq_x   ds  1               ;x register
AS65 Assembler for R6502 [1.42].                                     Page   19
-------------------------- 6502_functional_test.a65 --------------------------

                            if I_flag = 2
                        ;masking for I bit in status
                        flag_I_on   ds  1           ;or mask to load flags   
                        flag_I_off  ds  1           ;and mask to load flags
                            endif
000c :                  zpt                         ;6 bytes store/modify test
                        ;add/subtract operand generation and result/flag predi
000c : 00               adfc    ds  1               ;carry flag before op
000d : 00               ad1     ds  1               ;operand 1 - accumulator
000e : 00               ad2     ds  1               ;operand 2 - memory / imme
000f : 00               adrl    ds  1               ;expected result bits 0-7
0010 : 00               adrh    ds  1               ;expected result bit 8 (ca
0011 : 00               adrf    ds  1               ;expected flags NV0000ZC (
0012 : 00               sb2     ds  1               ;operand 2 complemented fo
0013 :                  zp_bss
0013 : 8001             zps     db  $80,1           ;additional shift pattern 
0015 : c3824100         zp1     db  $c3,$82,$41,0   ;test patterns for LDx BIT
0019 : 7f               zp7f    db  $7f             ;test pattern for compare 
                        ;logical zeropage operands
001a : 001f7180         zpOR    db  0,$1f,$71,$80   ;test pattern for OR
001e : 0fff7f80         zpAN    db  $0f,$ff,$7f,$80 ;test pattern for AND
0022 : ff0f8f8f         zpEO    db  $ff,$0f,$8f,$8f ;test pattern for EOR
                        ;indirect addressing pointers
0026 : 1802             ind1    dw  abs1            ;indirect pointer to patte
0028 : 1902                     dw  abs1+1
002a : 1a02                     dw  abs1+2
002c : 1b02                     dw  abs1+3
002e : 1c02                     dw  abs7f
0030 : 2001             inw1    dw  abs1-$f8        ;indirect pointer for wrap
0032 : 0302             indt    dw  abst            ;indirect pointer to store
0034 : 0402                     dw  abst+1
0036 : 0502                     dw  abst+2
0038 : 0602                     dw  abst+3
003a : 0b01             inwt    dw  abst-$f8        ;indirect pointer for wrap
003c : 5f02             indAN   dw  absAN           ;indirect pointer to AND p
003e : 6002                     dw  absAN+1
0040 : 6102                     dw  absAN+2
0042 : 6202                     dw  absAN+3
0044 : 6302             indEO   dw  absEO           ;indirect pointer to EOR p
0046 : 6402                     dw  absEO+1
0048 : 6502                     dw  absEO+2
004a : 6602                     dw  absEO+3
004c : 5b02             indOR   dw  absOR           ;indirect pointer to OR pa
004e : 5c02                     dw  absOR+1
0050 : 5d02                     dw  absOR+2
0052 : 5e02                     dw  absOR+3
                        ;add/subtract indirect pointers
0054 : 0302             adi2    dw  ada2            ;indirect pointer to opera
0056 : 0402             sbi2    dw  sba2            ;indirect pointer to compl
0058 : 0401             adiy2   dw  ada2-$ff        ;with offset for indirect 
005a : 0501             sbiy2   dw  sba2-$ff
005c :                  zp_bss_end
                           
0200 =                          org data_segment
0200 : 00               test_case   ds  1           ;current test number
0201 : 0000             ram_chksm   ds  2           ;checksum for RAM integrit
                        ;add/subtract operand copy - abs tests write area
0203 :                  abst                        ;6 bytes store/modify test
0203 : 00               ada2    ds  1               ;operand 2
0204 : 00               sba2    ds  1               ;operand 2 complemented fo
0205 : 00000000                 ds  4               ;fill remaining bytes
0209 :                  data_bss
AS65 Assembler for R6502 [1.42].                                     Page   20
-------------------------- 6502_functional_test.a65 --------------------------

                            if load_data_direct = 1
0209 : 2900             ex_andi and #0              ;execute immediate opcodes
020b : 60                       rts
020c : 4900             ex_eori eor #0              ;execute immediate opcodes
020e : 60                       rts
020f : 0900             ex_orai ora #0              ;execute immediate opcodes
0211 : 60                       rts
0212 : 6900             ex_adci adc #0              ;execute immediate opcodes
0214 : 60                       rts
0215 : e900             ex_sbci sbc #0              ;execute immediate opcodes
0217 : 60                       rts
                            else
                        ex_andi ds  3
                        ex_eori ds  3
                        ex_orai ds  3
                        ex_adci ds  3
                        ex_sbci ds  3
                            endif
                        ;zps    db  $80,1           ;additional shift patterns
0218 : c3824100         abs1    db  $c3,$82,$41,0   ;test patterns for LDx BIT
021c : 7f               abs7f   db  $7f             ;test pattern for compare
                        ;loads
021d : 80800002         fLDx    db  fn,fn,0,fz              ;expected flags fo
                        ;shifts
0221 :                  rASL                                ;expected result A
0221 : 000286048200     rROL    db  0,2,$86,$04,$82,0
0227 : 010387058301     rROLc   db  1,3,$87,$05,$83,1       ;expected result R
022d :                  rLSR                                ;expected result L
022d : 400061412000     rROR    db  $40,0,$61,$41,$20,0
0233 : c080e1c1a080     rRORc   db  $c0,$80,$e1,$c1,$a0,$80 ;expected result R
0239 :                  fASL                                ;expected flags fo
0239 : 030081018002     fROL    db  fzc,0,fnc,fc,fn,fz      ;no carry in
023f : 010081018000     fROLc   db  fc,0,fnc,fc,fn,0        ;carry in 
0245 :                  fLSR 
0245 : 000301000102     fROR    db  0,fzc,fc,0,fc,fz        ;no carry in
024b : 808181808180     fRORc   db  fn,fnc,fnc,fn,fnc,fn    ;carry in
                        ;increments (decrements)
0251 : 7f80ff0001       rINC    db  $7f,$80,$ff,0,1         ;expected result f
0256 : 0080800200       fINC    db  0,fn,fn,fz,0            ;expected flags fo
                        ;logical memory operand
025b : 001f7180         absOR   db  0,$1f,$71,$80           ;test pattern for 
025f : 0fff7f80         absAN   db  $0f,$ff,$7f,$80         ;test pattern for 
0263 : ff0f8f8f         absEO   db  $ff,$0f,$8f,$8f         ;test pattern for 
                        ;logical accu operand
0267 : 00f11f00         absORa  db  0,$f1,$1f,0             ;test pattern for 
026b : f0ffffff         absANa  db  $f0,$ff,$ff,$ff         ;test pattern for 
026f : fff0f00f         absEOa  db  $ff,$f0,$f0,$0f         ;test pattern for 
                        ;logical results
0273 : 00ff7f80         absrlo  db  0,$ff,$7f,$80
0277 : 02800080         absflo  db  fz,fn,0,fn
027b :                  data_bss_end
                        
                        
                                code
0400 =                          org code_segment
0400 : d8               start   cld
0401 : a2ff                     ldx #$ff
0403 : 9a                       txs
0404 : a900                     lda #0          ;*** test 0 = initialize
0406 : 8d0002                   sta test_case
0000 =                  test_num = 0
                        
AS65 Assembler for R6502 [1.42].                                     Page   21
-------------------------- 6502_functional_test.a65 --------------------------

                        ;stop interrupts before initializing BSS
                            if I_flag = 1
                                sei
                            endif
                            
                        ;initialize I/O for report channel
                            if report = 1
                                jsr report_init
                            endif
                            
                        ;pretest small branch offset
0409 : a205                     ldx #5
040b : 4c3304                   jmp psb_test
040e :                  psb_bwok
040e : a005                     ldy #5
0410 : d008                     bne psb_forw
                                trap        ;branch should be taken
0412 : 4c1204          >        jmp *           ;failed anyway
                        
0415 : 88                       dey         ;forward landing zone
0416 : 88                       dey
0417 : 88                       dey
0418 : 88                       dey
0419 : 88                       dey
041a :                  psb_forw
041a : 88                       dey
041b : 88                       dey
041c : 88                       dey
041d : 88                       dey
041e : 88                       dey
041f : f017                     beq psb_fwok
                                trap        ;forward offset
0421 : 4c2104          >        jmp *           ;failed anyway
                        
                        
0424 : ca                       dex         ;backward landing zone
0425 : ca                       dex
0426 : ca                       dex
0427 : ca                       dex
0428 : ca                       dex
0429 :                  psb_back
0429 : ca                       dex
042a : ca                       dex
042b : ca                       dex
042c : ca                       dex
042d : ca                       dex
042e : f0de                     beq psb_bwok
                                trap        ;backward offset
0430 : 4c3004          >        jmp *           ;failed anyway
                        
0433 :                  psb_test
0433 : d0f4                     bne psb_back
                                trap        ;branch should be taken
0435 : 4c3504          >        jmp *           ;failed anyway
                        
0438 :                  psb_fwok
                                
                        ;initialize BSS segment
                            if load_data_direct != 1
                                ldx #zp_end-zp_init-1
                        ld_zp   lda zp_init,x
                                sta zp_bss,x
AS65 Assembler for R6502 [1.42].                                     Page   22
-------------------------- 6502_functional_test.a65 --------------------------

                                dex
                                bpl ld_zp
                                ldx #data_end-data_init-1
                        ld_data lda data_init,x
                                sta data_bss,x
                                dex
                                bpl ld_data
                              if ROM_vectors = 1
                                ldx #5
                        ld_vect lda vec_init,x
                                sta vec_bss,x
                                dex
                                bpl ld_vect
                              endif
                            endif
                        
                        ;retain status of interrupt flag
                            if I_flag = 2
                                php
                                pla
                                and #4          ;isolate flag
                                sta flag_I_on   ;or mask
                                eor #lo(~4)     ;reverse
                                sta flag_I_off  ;and mask
                            endif
                                
                        ;generate checksum for RAM integrity test
                            if ram_top > -1
                                lda #0 
                                sta zpt         ;set low byte of indirect poin
                                sta ram_chksm+1 ;checksum high byte
                              if disable_selfmod = 0
                                sta range_adr   ;reset self modifying code
                              endif
                                clc
                                ldx #zp_bss-zero_page ;zeropage - write test a
                        gcs3    adc zero_page,x
                                bcc gcs2
                                inc ram_chksm+1 ;carry to high byte
                                clc
                        gcs2    inx
                                bne gcs3
                                ldx #hi(abs1)   ;set high byte of indirect poi
                                stx zpt+1
                                ldy #lo(abs1)   ;data after write & execute te
                        gcs5    adc (zpt),y
                                bcc gcs4
                                inc ram_chksm+1 ;carry to high byte
                                clc
                        gcs4    iny
                                bne gcs5
                                inx             ;advance RAM high address
                                stx zpt+1
                                cpx #ram_top
                                bne gcs5
                                sta ram_chksm   ;checksum complete
                            endif
                                next_test            
0438 : ad0002          >            lda test_case   ;previous test
043b : c900            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
043d : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page   23
-------------------------- 6502_functional_test.a65 --------------------------

                       >
0001 =                 >test_num = test_num + 1
043f : a901            >            lda #test_num   ;*** next tests' number
0441 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                            if disable_selfmod = 0
                        ;testing relative addressing with BEQ
0444 : a0fe                     ldy #$fe        ;testing maximum range, not -1
0446 :                  range_loop
0446 : 88                       dey             ;next relative address
0447 : 98                       tya
0448 : aa                       tax             ;precharge count to end of loo
0449 : 1008                     bpl range_fw    ;calculate relative address
044b : 18                       clc             ;avoid branch self or to relat
044c : 6902                     adc #2
044e : ea                       nop             ;offset landing zone - tolerat
044f : ea                       nop
0450 : ea                       nop
0451 : ea                       nop
0452 : ea                       nop
0453 :                  range_fw
0453 : ea                       nop
0454 : ea                       nop
0455 : ea                       nop
0456 : ea                       nop
0457 : ea                       nop
0458 : 497f                     eor #$7f        ;complement except sign
045a : 8de604                   sta range_adr   ;load into test target
045d : a900                     lda #0          ;should set zero flag in statu
045f : 4ce504                   jmp range_op
                                
0462 : ca                       dex             ; offset landing zone - backwa
0463 : ca                       dex
0464 : ca                       dex
0465 : ca                       dex
0466 : ca                       dex
                                ;relative address target field with branch und
0467 : ca                       dex             ;-128 - max backward
0468 : ca                       dex
0469 : ca                       dex
046a : ca                       dex
046b : ca                       dex
046c : ca                       dex
046d : ca                       dex
046e : ca                       dex
046f : ca                       dex             ;-120
0470 : ca                       dex
0471 : ca                       dex
0472 : ca                       dex
0473 : ca                       dex
0474 : ca                       dex
0475 : ca                       dex
0476 : ca                       dex
0477 : ca                       dex
0478 : ca                       dex
0479 : ca                       dex             ;-110
047a : ca                       dex
047b : ca                       dex
047c : ca                       dex
047d : ca                       dex
AS65 Assembler for R6502 [1.42].                                     Page   24
-------------------------- 6502_functional_test.a65 --------------------------

047e : ca                       dex
047f : ca                       dex
0480 : ca                       dex
0481 : ca                       dex
0482 : ca                       dex
0483 : ca                       dex             ;-100
0484 : ca                       dex
0485 : ca                       dex
0486 : ca                       dex
0487 : ca                       dex
0488 : ca                       dex
0489 : ca                       dex
048a : ca                       dex
048b : ca                       dex
048c : ca                       dex
048d : ca                       dex             ;-90
048e : ca                       dex
048f : ca                       dex
0490 : ca                       dex
0491 : ca                       dex
0492 : ca                       dex
0493 : ca                       dex
0494 : ca                       dex
0495 : ca                       dex
0496 : ca                       dex
0497 : ca                       dex             ;-80
0498 : ca                       dex
0499 : ca                       dex
049a : ca                       dex
049b : ca                       dex
049c : ca                       dex
049d : ca                       dex
049e : ca                       dex
049f : ca                       dex
04a0 : ca                       dex
04a1 : ca                       dex             ;-70
04a2 : ca                       dex
04a3 : ca                       dex
04a4 : ca                       dex
04a5 : ca                       dex
04a6 : ca                       dex
04a7 : ca                       dex
04a8 : ca                       dex
04a9 : ca                       dex
04aa : ca                       dex
04ab : ca                       dex             ;-60
04ac : ca                       dex
04ad : ca                       dex
04ae : ca                       dex
04af : ca                       dex
04b0 : ca                       dex
04b1 : ca                       dex
04b2 : ca                       dex
04b3 : ca                       dex
04b4 : ca                       dex
04b5 : ca                       dex             ;-50
04b6 : ca                       dex
04b7 : ca                       dex
04b8 : ca                       dex
04b9 : ca                       dex
04ba : ca                       dex
04bb : ca                       dex
AS65 Assembler for R6502 [1.42].                                     Page   25
-------------------------- 6502_functional_test.a65 --------------------------

04bc : ca                       dex
04bd : ca                       dex
04be : ca                       dex
04bf : ca                       dex             ;-40
04c0 : ca                       dex
04c1 : ca                       dex
04c2 : ca                       dex
04c3 : ca                       dex
04c4 : ca                       dex
04c5 : ca                       dex
04c6 : ca                       dex
04c7 : ca                       dex
04c8 : ca                       dex
04c9 : ca                       dex             ;-30
04ca : ca                       dex
04cb : ca                       dex
04cc : ca                       dex
04cd : ca                       dex
04ce : ca                       dex
04cf : ca                       dex
04d0 : ca                       dex
04d1 : ca                       dex
04d2 : ca                       dex
04d3 : ca                       dex             ;-20
04d4 : ca                       dex
04d5 : ca                       dex
04d6 : ca                       dex
04d7 : ca                       dex
04d8 : ca                       dex
04d9 : ca                       dex
04da : ca                       dex
04db : ca                       dex
04dc : ca                       dex
04dd : ca                       dex             ;-10
04de : ca                       dex
04df : ca                       dex
04e0 : ca                       dex
04e1 : ca                       dex
04e2 : ca                       dex
04e3 : ca                       dex
04e4 : ca                       dex             ;-3
04e5 :                  range_op                ;test target with zero flag=0,
04e6 =                  range_adr   = *+1       ;modifiable relative address
04e5 : f03e                     beq *+64        ;+64 if called without modific
04e7 : ca                       dex             ;+0
04e8 : ca                       dex
04e9 : ca                       dex
04ea : ca                       dex
04eb : ca                       dex
04ec : ca                       dex
04ed : ca                       dex
04ee : ca                       dex
04ef : ca                       dex
04f0 : ca                       dex
04f1 : ca                       dex             ;+10
04f2 : ca                       dex
04f3 : ca                       dex
04f4 : ca                       dex
04f5 : ca                       dex
04f6 : ca                       dex
04f7 : ca                       dex
04f8 : ca                       dex
AS65 Assembler for R6502 [1.42].                                     Page   26
-------------------------- 6502_functional_test.a65 --------------------------

04f9 : ca                       dex
04fa : ca                       dex
04fb : ca                       dex             ;+20
04fc : ca                       dex
04fd : ca                       dex
04fe : ca                       dex
04ff : ca                       dex
0500 : ca                       dex
0501 : ca                       dex
0502 : ca                       dex
0503 : ca                       dex
0504 : ca                       dex
0505 : ca                       dex             ;+30
0506 : ca                       dex
0507 : ca                       dex
0508 : ca                       dex
0509 : ca                       dex
050a : ca                       dex
050b : ca                       dex
050c : ca                       dex
050d : ca                       dex
050e : ca                       dex
050f : ca                       dex             ;+40
0510 : ca                       dex
0511 : ca                       dex
0512 : ca                       dex
0513 : ca                       dex
0514 : ca                       dex
0515 : ca                       dex
0516 : ca                       dex
0517 : ca                       dex
0518 : ca                       dex
0519 : ca                       dex             ;+50
051a : ca                       dex
051b : ca                       dex
051c : ca                       dex
051d : ca                       dex
051e : ca                       dex
051f : ca                       dex
0520 : ca                       dex
0521 : ca                       dex
0522 : ca                       dex
0523 : ca                       dex             ;+60
0524 : ca                       dex
0525 : ca                       dex
0526 : ca                       dex
0527 : ca                       dex
0528 : ca                       dex
0529 : ca                       dex
052a : ca                       dex
052b : ca                       dex
052c : ca                       dex
052d : ca                       dex             ;+70
052e : ca                       dex
052f : ca                       dex
0530 : ca                       dex
0531 : ca                       dex
0532 : ca                       dex
0533 : ca                       dex
0534 : ca                       dex
0535 : ca                       dex
0536 : ca                       dex
AS65 Assembler for R6502 [1.42].                                     Page   27
-------------------------- 6502_functional_test.a65 --------------------------

0537 : ca                       dex             ;+80
0538 : ca                       dex
0539 : ca                       dex
053a : ca                       dex
053b : ca                       dex
053c : ca                       dex
053d : ca                       dex
053e : ca                       dex
053f : ca                       dex
0540 : ca                       dex
0541 : ca                       dex             ;+90
0542 : ca                       dex
0543 : ca                       dex
0544 : ca                       dex
0545 : ca                       dex
0546 : ca                       dex
0547 : ca                       dex
0548 : ca                       dex
0549 : ca                       dex
054a : ca                       dex
054b : ca                       dex             ;+100
054c : ca                       dex
054d : ca                       dex
054e : ca                       dex
054f : ca                       dex
0550 : ca                       dex
0551 : ca                       dex
0552 : ca                       dex
0553 : ca                       dex
0554 : ca                       dex
0555 : ca                       dex             ;+110
0556 : ca                       dex
0557 : ca                       dex
0558 : ca                       dex
0559 : ca                       dex
055a : ca                       dex
055b : ca                       dex
055c : ca                       dex
055d : ca                       dex
055e : ca                       dex
055f : ca                       dex             ;+120
0560 : ca                       dex
0561 : ca                       dex
0562 : ca                       dex
0563 : ca                       dex
0564 : ca                       dex
0565 : ca                       dex
0566 : ea                       nop             ;offset landing zone - forward
0567 : ea                       nop
0568 : ea                       nop
0569 : ea                       nop
056a : ea                       nop
056b : f008                     beq range_ok    ;+127 - max forward
                                trap            ; bad range
056d : 4c6d05          >        jmp *           ;failed anyway
                        
0570 : ea                       nop             ;offset landing zone - tolerat
0571 : ea                       nop
0572 : ea                       nop
0573 : ea                       nop
0574 : ea                       nop
0575 :                  range_ok
AS65 Assembler for R6502 [1.42].                                     Page   28
-------------------------- 6502_functional_test.a65 --------------------------

0575 : ea                       nop
0576 : ea                       nop
0577 : ea                       nop
0578 : ea                       nop
0579 : ea                       nop
057a : c000                     cpy #0
057c : f003                     beq range_end   
057e : 4c4604                   jmp range_loop
0581 :                  range_end               ;range test successful
                            endif
                                next_test
0581 : ad0002          >            lda test_case   ;previous test
0584 : c901            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0586 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0002 =                 >test_num = test_num + 1
0588 : a902            >            lda #test_num   ;*** next tests' number
058a : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ;partial test BNE & CMP, CPX, CPY immediate
058d : c001                     cpy #1          ;testing BNE true
058f : d003                     bne test_bne
                                trap 
0591 : 4c9105          >        jmp *           ;failed anyway
                        
0594 :                  test_bne
0594 : a900                     lda #0 
0596 : c900                     cmp #0          ;test compare immediate 
                                trap_ne
0598 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                trap_cc
059a : 90fe            >        bcc *           ;failed carry clear
                        
                                trap_mi
059c : 30fe            >        bmi *           ;failed minus (bit 7 set)
                        
059e : c901                     cmp #1
                                trap_eq 
05a0 : f0fe            >        beq *           ;failed equal (zero)
                        
                                trap_cs
05a2 : b0fe            >        bcs *           ;failed carry set
                        
                                trap_pl
05a4 : 10fe            >        bpl *           ;failed plus (bit 7 clear)
                        
05a6 : aa                       tax 
05a7 : e000                     cpx #0          ;test compare x immediate
                                trap_ne
05a9 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                trap_cc
05ab : 90fe            >        bcc *           ;failed carry clear
                        
                                trap_mi
05ad : 30fe            >        bmi *           ;failed minus (bit 7 set)
                        
05af : e001                     cpx #1
AS65 Assembler for R6502 [1.42].                                     Page   29
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_eq 
05b1 : f0fe            >        beq *           ;failed equal (zero)
                        
                                trap_cs
05b3 : b0fe            >        bcs *           ;failed carry set
                        
                                trap_pl
05b5 : 10fe            >        bpl *           ;failed plus (bit 7 clear)
                        
05b7 : a8                       tay 
05b8 : c000                     cpy #0          ;test compare y immediate
                                trap_ne
05ba : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                trap_cc
05bc : 90fe            >        bcc *           ;failed carry clear
                        
                                trap_mi
05be : 30fe            >        bmi *           ;failed minus (bit 7 set)
                        
05c0 : c001                     cpy #1
                                trap_eq 
05c2 : f0fe            >        beq *           ;failed equal (zero)
                        
                                trap_cs
05c4 : b0fe            >        bcs *           ;failed carry set
                        
                                trap_pl
05c6 : 10fe            >        bpl *           ;failed plus (bit 7 clear)
                        
                                next_test
05c8 : ad0002          >            lda test_case   ;previous test
05cb : c902            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
05cd : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0003 =                 >test_num = test_num + 1
05cf : a903            >            lda #test_num   ;*** next tests' number
05d1 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        ;testing stack operations PHA PHP PLA PLP
                                    
05d4 : a2ff                     ldx #$ff        ;initialize stack
05d6 : 9a                       txs
05d7 : a955                     lda #$55
05d9 : 48                       pha
05da : a9aa                     lda #$aa
05dc : 48                       pha
05dd : cdfe01                   cmp $1fe        ;on stack ?
                                trap_ne
05e0 : d0fe            >        bne *           ;failed not equal (non zero)
                        
05e2 : ba                       tsx
05e3 : 8a                       txa             ;overwrite accu
05e4 : c9fd                     cmp #$fd        ;sp decremented?
                                trap_ne
05e6 : d0fe            >        bne *           ;failed not equal (non zero)
                        
05e8 : 68                       pla
05e9 : c9aa                     cmp #$aa        ;successful retreived from sta
                                trap_ne
AS65 Assembler for R6502 [1.42].                                     Page   30
-------------------------- 6502_functional_test.a65 --------------------------

05eb : d0fe            >        bne *           ;failed not equal (non zero)
                        
05ed : 68                       pla
05ee : c955                     cmp #$55
                                trap_ne
05f0 : d0fe            >        bne *           ;failed not equal (non zero)
                        
05f2 : cdff01                   cmp $1ff        ;remains on stack?
                                trap_ne
05f5 : d0fe            >        bne *           ;failed not equal (non zero)
                        
05f7 : ba                       tsx
05f8 : e0ff                     cpx #$ff        ;sp incremented?
                                trap_ne
05fa : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                next_test
05fc : ad0002          >            lda test_case   ;previous test
05ff : c903            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0601 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0004 =                 >test_num = test_num + 1
0603 : a904            >            lda #test_num   ;*** next tests' number
0605 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ;testing branch decisions BPL BMI BVC BVS BCC BCS BNE 
                                set_stat $ff    ;all on
                       >            load_flag $ff    
0608 : a9ff            >            lda #$ff                 ;allow test to ch
                       >
060a : 48              >            pha         ;use stack to load status
060b : 28              >            plp
                        
060c : 101a                     bpl nbr1        ;branches should not be taken
060e : 501b                     bvc nbr2
0610 : 901c                     bcc nbr3
0612 : d01d                     bne nbr4
0614 : 3003                     bmi br1         ;branches should be taken
                                trap 
0616 : 4c1606          >        jmp *           ;failed anyway
                        
0619 : 7003             br1     bvs br2
                                trap 
061b : 4c1b06          >        jmp *           ;failed anyway
                        
061e : b003             br2     bcs br3
                                trap 
0620 : 4c2006          >        jmp *           ;failed anyway
                        
0623 : f00f             br3     beq br4
                                trap 
0625 : 4c2506          >        jmp *           ;failed anyway
                        
0628 :                  nbr1
                                trap            ;previous bpl taken 
0628 : 4c2806          >        jmp *           ;failed anyway
                        
062b :                  nbr2
                                trap            ;previous bvc taken
AS65 Assembler for R6502 [1.42].                                     Page   31
-------------------------- 6502_functional_test.a65 --------------------------

062b : 4c2b06          >        jmp *           ;failed anyway
                        
062e :                  nbr3
                                trap            ;previous bcc taken
062e : 4c2e06          >        jmp *           ;failed anyway
                        
0631 :                  nbr4
                                trap            ;previous bne taken
0631 : 4c3106          >        jmp *           ;failed anyway
                        
0634 : 08               br4     php
0635 : ba                       tsx
0636 : e0fe                     cpx #$fe        ;sp after php?
                                trap_ne
0638 : d0fe            >        bne *           ;failed not equal (non zero)
                        
063a : 68                       pla
                                cmp_flag $ff    ;returned all flags on?
063b : c9ff            >            cmp #($ff    |fao)&m8    ;expected flags +
                        
                                trap_ne
063d : d0fe            >        bne *           ;failed not equal (non zero)
                        
063f : ba                       tsx
0640 : e0ff                     cpx #$ff        ;sp after php?
                                trap_ne
0642 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0      ;all off
                       >            load_flag 0      
0644 : a900            >            lda #0                   ;allow test to ch
                       >
0646 : 48              >            pha         ;use stack to load status
0647 : 28              >            plp
                        
0648 : 301a                     bmi nbr11       ;branches should not be taken
064a : 701b                     bvs nbr12
064c : b01c                     bcs nbr13
064e : f01d                     beq nbr14
0650 : 1003                     bpl br11        ;branches should be taken
                                trap 
0652 : 4c5206          >        jmp *           ;failed anyway
                        
0655 : 5003             br11    bvc br12
                                trap 
0657 : 4c5706          >        jmp *           ;failed anyway
                        
065a : 9003             br12    bcc br13
                                trap 
065c : 4c5c06          >        jmp *           ;failed anyway
                        
065f : d00f             br13    bne br14
                                trap 
0661 : 4c6106          >        jmp *           ;failed anyway
                        
0664 :                  nbr11
                                trap            ;previous bmi taken 
0664 : 4c6406          >        jmp *           ;failed anyway
                        
0667 :                  nbr12
                                trap            ;previous bvs taken 
0667 : 4c6706          >        jmp *           ;failed anyway
AS65 Assembler for R6502 [1.42].                                     Page   32
-------------------------- 6502_functional_test.a65 --------------------------

                        
066a :                  nbr13
                                trap            ;previous bcs taken 
066a : 4c6a06          >        jmp *           ;failed anyway
                        
066d :                  nbr14
                                trap            ;previous beq taken 
066d : 4c6d06          >        jmp *           ;failed anyway
                        
0670 : 08               br14    php
0671 : 68                       pla
                                cmp_flag 0      ;flags off except break (pushe
0672 : c930            >            cmp #(0      |fao)&m8    ;expected flags +
                        
                                trap_ne
0674 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                ;crosscheck flags
                                set_stat zero
                       >            load_flag zero
0676 : a902            >            lda #zero             ;allow test to chang
                       >
0678 : 48              >            pha         ;use stack to load status
0679 : 28              >            plp
                        
067a : d002                     bne brzs1
067c : f003                     beq brzs2
067e :                  brzs1
                                trap            ;branch zero/non zero
067e : 4c7e06          >        jmp *           ;failed anyway
                        
0681 : b002             brzs2   bcs brzs3
0683 : 9003                     bcc brzs4
0685 :                  brzs3
                                trap            ;branch carry/no carry
0685 : 4c8506          >        jmp *           ;failed anyway
                        
0688 : 3002             brzs4   bmi brzs5
068a : 1003                     bpl brzs6
068c :                  brzs5
                                trap            ;branch minus/plus
068c : 4c8c06          >        jmp *           ;failed anyway
                        
068f : 7002             brzs6   bvs brzs7
0691 : 5003                     bvc brzs8
0693 :                  brzs7
                                trap            ;branch overflow/no overflow
0693 : 4c9306          >        jmp *           ;failed anyway
                        
0696 :                  brzs8
                                set_stat carry
                       >            load_flag carry
0696 : a901            >            lda #carry             ;allow test to chan
                       >
0698 : 48              >            pha         ;use stack to load status
0699 : 28              >            plp
                        
069a : f002                     beq brcs1
069c : d003                     bne brcs2
069e :                  brcs1
                                trap            ;branch zero/non zero
069e : 4c9e06          >        jmp *           ;failed anyway
AS65 Assembler for R6502 [1.42].                                     Page   33
-------------------------- 6502_functional_test.a65 --------------------------

                        
06a1 : 9002             brcs2   bcc brcs3
06a3 : b003                     bcs brcs4
06a5 :                  brcs3
                                trap            ;branch carry/no carry
06a5 : 4ca506          >        jmp *           ;failed anyway
                        
06a8 : 3002             brcs4   bmi brcs5
06aa : 1003                     bpl brcs6
06ac :                  brcs5
                                trap            ;branch minus/plus
06ac : 4cac06          >        jmp *           ;failed anyway
                        
06af : 7002             brcs6   bvs brcs7
06b1 : 5003                     bvc brcs8
06b3 :                  brcs7
                                trap            ;branch overflow/no overflow
06b3 : 4cb306          >        jmp *           ;failed anyway
                        
                        
06b6 :                  brcs8
                                set_stat minus
                       >            load_flag minus
06b6 : a980            >            lda #minus             ;allow test to chan
                       >
06b8 : 48              >            pha         ;use stack to load status
06b9 : 28              >            plp
                        
06ba : f002                     beq brmi1
06bc : d003                     bne brmi2
06be :                  brmi1
                                trap            ;branch zero/non zero
06be : 4cbe06          >        jmp *           ;failed anyway
                        
06c1 : b002             brmi2   bcs brmi3
06c3 : 9003                     bcc brmi4
06c5 :                  brmi3
                                trap            ;branch carry/no carry
06c5 : 4cc506          >        jmp *           ;failed anyway
                        
06c8 : 1002             brmi4   bpl brmi5
06ca : 3003                     bmi brmi6
06cc :                  brmi5
                                trap            ;branch minus/plus
06cc : 4ccc06          >        jmp *           ;failed anyway
                        
06cf : 7002             brmi6   bvs brmi7
06d1 : 5003                     bvc brmi8
06d3 :                  brmi7
                                trap            ;branch overflow/no overflow
06d3 : 4cd306          >        jmp *           ;failed anyway
                        
06d6 :                  brmi8
                                set_stat overfl
                       >            load_flag overfl
06d6 : a940            >            lda #overfl             ;allow test to cha
                       >
06d8 : 48              >            pha         ;use stack to load status
06d9 : 28              >            plp
                        
06da : f002                     beq brvs1
06dc : d003                     bne brvs2
AS65 Assembler for R6502 [1.42].                                     Page   34
-------------------------- 6502_functional_test.a65 --------------------------

06de :                  brvs1
                                trap            ;branch zero/non zero
06de : 4cde06          >        jmp *           ;failed anyway
                        
06e1 : b002             brvs2   bcs brvs3
06e3 : 9003                     bcc brvs4
06e5 :                  brvs3
                                trap            ;branch carry/no carry
06e5 : 4ce506          >        jmp *           ;failed anyway
                        
06e8 : 3002             brvs4   bmi brvs5
06ea : 1003                     bpl brvs6
06ec :                  brvs5
                                trap            ;branch minus/plus
06ec : 4cec06          >        jmp *           ;failed anyway
                        
06ef : 5002             brvs6   bvc brvs7
06f1 : 7003                     bvs brvs8
06f3 :                  brvs7
                                trap            ;branch overflow/no overflow
06f3 : 4cf306          >        jmp *           ;failed anyway
                        
06f6 :                  brvs8
                                set_stat $ff-zero
                       >            load_flag $ff-zero
06f6 : a9fd            >            lda #$ff-zero             ;allow test to c
                       >
06f8 : 48              >            pha         ;use stack to load status
06f9 : 28              >            plp
                        
06fa : f002                     beq brzc1
06fc : d003                     bne brzc2
06fe :                  brzc1
                                trap            ;branch zero/non zero
06fe : 4cfe06          >        jmp *           ;failed anyway
                        
0701 : 9002             brzc2   bcc brzc3
0703 : b003                     bcs brzc4
0705 :                  brzc3
                                trap            ;branch carry/no carry
0705 : 4c0507          >        jmp *           ;failed anyway
                        
0708 : 1002             brzc4   bpl brzc5
070a : 3003                     bmi brzc6
070c :                  brzc5
                                trap            ;branch minus/plus
070c : 4c0c07          >        jmp *           ;failed anyway
                        
070f : 5002             brzc6   bvc brzc7
0711 : 7003                     bvs brzc8
0713 :                  brzc7
                                trap            ;branch overflow/no overflow
0713 : 4c1307          >        jmp *           ;failed anyway
                        
0716 :                  brzc8
                                set_stat $ff-carry
                       >            load_flag $ff-carry
0716 : a9fe            >            lda #$ff-carry             ;allow test to 
                       >
0718 : 48              >            pha         ;use stack to load status
0719 : 28              >            plp
                        
AS65 Assembler for R6502 [1.42].                                     Page   35
-------------------------- 6502_functional_test.a65 --------------------------

071a : d002                     bne brcc1
071c : f003                     beq brcc2
071e :                  brcc1
                                trap            ;branch zero/non zero
071e : 4c1e07          >        jmp *           ;failed anyway
                        
0721 : b002             brcc2   bcs brcc3
0723 : 9003                     bcc brcc4
0725 :                  brcc3
                                trap            ;branch carry/no carry
0725 : 4c2507          >        jmp *           ;failed anyway
                        
0728 : 1002             brcc4   bpl brcc5
072a : 3003                     bmi brcc6
072c :                  brcc5
                                trap            ;branch minus/plus
072c : 4c2c07          >        jmp *           ;failed anyway
                        
072f : 5002             brcc6   bvc brcc7
0731 : 7003                     bvs brcc8
0733 :                  brcc7
                                trap            ;branch overflow/no overflow
0733 : 4c3307          >        jmp *           ;failed anyway
                        
0736 :                  brcc8
                                set_stat $ff-minus
                       >            load_flag $ff-minus
0736 : a97f            >            lda #$ff-minus             ;allow test to 
                       >
0738 : 48              >            pha         ;use stack to load status
0739 : 28              >            plp
                        
073a : d002                     bne brpl1
073c : f003                     beq brpl2
073e :                  brpl1
                                trap            ;branch zero/non zero
073e : 4c3e07          >        jmp *           ;failed anyway
                        
0741 : 9002             brpl2   bcc brpl3
0743 : b003                     bcs brpl4
0745 :                  brpl3
                                trap            ;branch carry/no carry
0745 : 4c4507          >        jmp *           ;failed anyway
                        
0748 : 3002             brpl4   bmi brpl5
074a : 1003                     bpl brpl6
074c :                  brpl5
                                trap            ;branch minus/plus
074c : 4c4c07          >        jmp *           ;failed anyway
                        
074f : 5002             brpl6   bvc brpl7
0751 : 7003                     bvs brpl8
0753 :                  brpl7
                                trap            ;branch overflow/no overflow
0753 : 4c5307          >        jmp *           ;failed anyway
                        
0756 :                  brpl8
                                set_stat $ff-overfl
                       >            load_flag $ff-overfl
0756 : a9bf            >            lda #$ff-overfl             ;allow test to
                       >
0758 : 48              >            pha         ;use stack to load status
AS65 Assembler for R6502 [1.42].                                     Page   36
-------------------------- 6502_functional_test.a65 --------------------------

0759 : 28              >            plp
                        
075a : d002                     bne brvc1
075c : f003                     beq brvc2
075e :                  brvc1
                                trap            ;branch zero/non zero
075e : 4c5e07          >        jmp *           ;failed anyway
                        
0761 : 9002             brvc2   bcc brvc3
0763 : b003                     bcs brvc4
0765 :                  brvc3
                                trap            ;branch carry/no carry
0765 : 4c6507          >        jmp *           ;failed anyway
                        
0768 : 1002             brvc4   bpl brvc5
076a : 3003                     bmi brvc6
076c :                  brvc5
                                trap            ;branch minus/plus
076c : 4c6c07          >        jmp *           ;failed anyway
                        
076f : 7002             brvc6   bvs brvc7
0771 : 5003                     bvc brvc8
0773 :                  brvc7
                                trap            ;branch overflow/no overflow
0773 : 4c7307          >        jmp *           ;failed anyway
                        
0776 :                  brvc8
                                next_test
0776 : ad0002          >            lda test_case   ;previous test
0779 : c904            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
077b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0005 =                 >test_num = test_num + 1
077d : a905            >            lda #test_num   ;*** next tests' number
077f : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; test PHA does not alter flags or accumulator but PLA
0782 : a255                     ldx #$55        ;x & y protected
0784 : a0aa                     ldy #$aa
                                set_a 1,$ff     ;push
                       >            load_flag $ff     
0786 : a9ff            >            lda #$ff                  ;allow test to c
                       >
0788 : 48              >            pha         ;use stack to load status
0789 : a901            >            lda #1     ;precharge accu
078b : 28              >            plp
                        
078c : 48                       pha
                                tst_a 1,$ff
078d : 08              >            php         ;save flags
078e : c901            >            cmp #1     ;test result
                       >            trap_ne
0790 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0792 : 68              >            pla         ;load status
0793 : 48              >            pha
                       >            cmp_flag $ff
0794 : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                       >
AS65 Assembler for R6502 [1.42].                                     Page   37
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
0796 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0798 : 28              >            plp         ;restore status
                        
                                set_a 0,0
                       >            load_flag 0
0799 : a900            >            lda #0             ;allow test to change I
                       >
079b : 48              >            pha         ;use stack to load status
079c : a900            >            lda #0     ;precharge accu
079e : 28              >            plp
                        
079f : 48                       pha
                                tst_a 0,0
07a0 : 08              >            php         ;save flags
07a1 : c900            >            cmp #0     ;test result
                       >            trap_ne
07a3 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07a5 : 68              >            pla         ;load status
07a6 : 48              >            pha
                       >            cmp_flag 0
07a7 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
07a9 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07ab : 28              >            plp         ;restore status
                        
                                set_a $ff,$ff
                       >            load_flag $ff
07ac : a9ff            >            lda #$ff             ;allow test to change
                       >
07ae : 48              >            pha         ;use stack to load status
07af : a9ff            >            lda #$ff     ;precharge accu
07b1 : 28              >            plp
                        
07b2 : 48                       pha
                                tst_a $ff,$ff
07b3 : 08              >            php         ;save flags
07b4 : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
07b6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07b8 : 68              >            pla         ;load status
07b9 : 48              >            pha
                       >            cmp_flag $ff
07ba : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
07bc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07be : 28              >            plp         ;restore status
                        
                                set_a 1,0
                       >            load_flag 0
07bf : a900            >            lda #0             ;allow test to change I
                       >
07c1 : 48              >            pha         ;use stack to load status
07c2 : a901            >            lda #1     ;precharge accu
07c4 : 28              >            plp
AS65 Assembler for R6502 [1.42].                                     Page   38
-------------------------- 6502_functional_test.a65 --------------------------

                        
07c5 : 48                       pha
                                tst_a 1,0
07c6 : 08              >            php         ;save flags
07c7 : c901            >            cmp #1     ;test result
                       >            trap_ne
07c9 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07cb : 68              >            pla         ;load status
07cc : 48              >            pha
                       >            cmp_flag 0
07cd : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
07cf : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07d1 : 28              >            plp         ;restore status
                        
                                set_a 0,$ff
                       >            load_flag $ff
07d2 : a9ff            >            lda #$ff             ;allow test to change
                       >
07d4 : 48              >            pha         ;use stack to load status
07d5 : a900            >            lda #0     ;precharge accu
07d7 : 28              >            plp
                        
07d8 : 48                       pha
                                tst_a 0,$ff
07d9 : 08              >            php         ;save flags
07da : c900            >            cmp #0     ;test result
                       >            trap_ne
07dc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07de : 68              >            pla         ;load status
07df : 48              >            pha
                       >            cmp_flag $ff
07e0 : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
07e2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07e4 : 28              >            plp         ;restore status
                        
                                set_a $ff,0
                       >            load_flag 0
07e5 : a900            >            lda #0             ;allow test to change I
                       >
07e7 : 48              >            pha         ;use stack to load status
07e8 : a9ff            >            lda #$ff     ;precharge accu
07ea : 28              >            plp
                        
07eb : 48                       pha
                                tst_a $ff,0
07ec : 08              >            php         ;save flags
07ed : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
07ef : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07f1 : 68              >            pla         ;load status
07f2 : 48              >            pha
                       >            cmp_flag 0
07f3 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
AS65 Assembler for R6502 [1.42].                                     Page   39
-------------------------- 6502_functional_test.a65 --------------------------

                       >
                       >            trap_ne
07f5 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
07f7 : 28              >            plp         ;restore status
                        
                                set_a 0,$ff     ;pull
                       >            load_flag $ff     
07f8 : a9ff            >            lda #$ff                  ;allow test to c
                       >
07fa : 48              >            pha         ;use stack to load status
07fb : a900            >            lda #0     ;precharge accu
07fd : 28              >            plp
                        
07fe : 68                       pla
                                tst_a $ff,$ff-zero
07ff : 08              >            php         ;save flags
0800 : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
0802 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0804 : 68              >            pla         ;load status
0805 : 48              >            pha
                       >            cmp_flag $ff-zero
0806 : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                       >
                       >            trap_ne
0808 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
080a : 28              >            plp         ;restore status
                        
                                set_a $ff,0
                       >            load_flag 0
080b : a900            >            lda #0             ;allow test to change I
                       >
080d : 48              >            pha         ;use stack to load status
080e : a9ff            >            lda #$ff     ;precharge accu
0810 : 28              >            plp
                        
0811 : 68                       pla
                                tst_a 0,zero
0812 : 08              >            php         ;save flags
0813 : c900            >            cmp #0     ;test result
                       >            trap_ne
0815 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0817 : 68              >            pla         ;load status
0818 : 48              >            pha
                       >            cmp_flag zero
0819 : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
081b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
081d : 28              >            plp         ;restore status
                        
                                set_a $fe,$ff
                       >            load_flag $ff
081e : a9ff            >            lda #$ff             ;allow test to change
                       >
0820 : 48              >            pha         ;use stack to load status
0821 : a9fe            >            lda #$fe     ;precharge accu
AS65 Assembler for R6502 [1.42].                                     Page   40
-------------------------- 6502_functional_test.a65 --------------------------

0823 : 28              >            plp
                        
0824 : 68                       pla
                                tst_a 1,$ff-zero-minus
0825 : 08              >            php         ;save flags
0826 : c901            >            cmp #1     ;test result
                       >            trap_ne
0828 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
082a : 68              >            pla         ;load status
082b : 48              >            pha
                       >            cmp_flag $ff-zero-minus
082c : c97d            >            cmp #($ff-zero-minus|fao)&m8    ;expected 
                       >
                       >            trap_ne
082e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0830 : 28              >            plp         ;restore status
                        
                                set_a 0,0
                       >            load_flag 0
0831 : a900            >            lda #0             ;allow test to change I
                       >
0833 : 48              >            pha         ;use stack to load status
0834 : a900            >            lda #0     ;precharge accu
0836 : 28              >            plp
                        
0837 : 68                       pla
                                tst_a $ff,minus
0838 : 08              >            php         ;save flags
0839 : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
083b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
083d : 68              >            pla         ;load status
083e : 48              >            pha
                       >            cmp_flag minus
083f : c9b0            >            cmp #(minus|fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
0841 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0843 : 28              >            plp         ;restore status
                        
                                set_a $ff,$ff
                       >            load_flag $ff
0844 : a9ff            >            lda #$ff             ;allow test to change
                       >
0846 : 48              >            pha         ;use stack to load status
0847 : a9ff            >            lda #$ff     ;precharge accu
0849 : 28              >            plp
                        
084a : 68                       pla
                                tst_a 0,$ff-minus
084b : 08              >            php         ;save flags
084c : c900            >            cmp #0     ;test result
                       >            trap_ne
084e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0850 : 68              >            pla         ;load status
0851 : 48              >            pha
                       >            cmp_flag $ff-minus
AS65 Assembler for R6502 [1.42].                                     Page   41
-------------------------- 6502_functional_test.a65 --------------------------

0852 : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                       >
                       >            trap_ne
0854 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0856 : 28              >            plp         ;restore status
                        
                                set_a $fe,0
                       >            load_flag 0
0857 : a900            >            lda #0             ;allow test to change I
                       >
0859 : 48              >            pha         ;use stack to load status
085a : a9fe            >            lda #$fe     ;precharge accu
085c : 28              >            plp
                        
085d : 68                       pla
                                tst_a 1,0
085e : 08              >            php         ;save flags
085f : c901            >            cmp #1     ;test result
                       >            trap_ne
0861 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0863 : 68              >            pla         ;load status
0864 : 48              >            pha
                       >            cmp_flag 0
0865 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0867 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0869 : 28              >            plp         ;restore status
                        
086a : e055                     cpx #$55        ;x & y unchanged?
                                trap_ne
086c : d0fe            >        bne *           ;failed not equal (non zero)
                        
086e : c0aa                     cpy #$aa
                                trap_ne
0870 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                next_test
0872 : ad0002          >            lda test_case   ;previous test
0875 : c905            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0877 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0006 =                 >test_num = test_num + 1
0879 : a906            >            lda #test_num   ;*** next tests' number
087b : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                         
                        ; partial pretest EOR #
                                set_a $3c,0
                       >            load_flag 0
087e : a900            >            lda #0             ;allow test to change I
                       >
0880 : 48              >            pha         ;use stack to load status
0881 : a93c            >            lda #$3c     ;precharge accu
0883 : 28              >            plp
                        
0884 : 49c3                     eor #$c3
AS65 Assembler for R6502 [1.42].                                     Page   42
-------------------------- 6502_functional_test.a65 --------------------------

                                tst_a $ff,fn
0886 : 08              >            php         ;save flags
0887 : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
0889 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
088b : 68              >            pla         ;load status
088c : 48              >            pha
                       >            cmp_flag fn
088d : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
088f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0891 : 28              >            plp         ;restore status
                        
                                set_a $c3,0
                       >            load_flag 0
0892 : a900            >            lda #0             ;allow test to change I
                       >
0894 : 48              >            pha         ;use stack to load status
0895 : a9c3            >            lda #$c3     ;precharge accu
0897 : 28              >            plp
                        
0898 : 49c3                     eor #$c3
                                tst_a 0,fz
089a : 08              >            php         ;save flags
089b : c900            >            cmp #0     ;test result
                       >            trap_ne
089d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
089f : 68              >            pla         ;load status
08a0 : 48              >            pha
                       >            cmp_flag fz
08a1 : c932            >            cmp #(fz|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
08a3 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
08a5 : 28              >            plp         ;restore status
                        
                                next_test
08a6 : ad0002          >            lda test_case   ;previous test
08a9 : c906            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
08ab : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0007 =                 >test_num = test_num + 1
08ad : a907            >            lda #test_num   ;*** next tests' number
08af : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; PC modifying instructions except branches (NOP, JMP,
                        ; testing NOP
08b2 : a224                     ldx #$24
08b4 : a042                     ldy #$42
                                set_a $18,0
                       >            load_flag 0
08b6 : a900            >            lda #0             ;allow test to change I
                       >
08b8 : 48              >            pha         ;use stack to load status
AS65 Assembler for R6502 [1.42].                                     Page   43
-------------------------- 6502_functional_test.a65 --------------------------

08b9 : a918            >            lda #$18     ;precharge accu
08bb : 28              >            plp
                        
08bc : ea                       nop
                                tst_a $18,0
08bd : 08              >            php         ;save flags
08be : c918            >            cmp #$18     ;test result
                       >            trap_ne
08c0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
08c2 : 68              >            pla         ;load status
08c3 : 48              >            pha
                       >            cmp_flag 0
08c4 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
08c6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
08c8 : 28              >            plp         ;restore status
                        
08c9 : e024                     cpx #$24
                                trap_ne
08cb : d0fe            >        bne *           ;failed not equal (non zero)
                        
08cd : c042                     cpy #$42
                                trap_ne
08cf : d0fe            >        bne *           ;failed not equal (non zero)
                        
08d1 : a2db                     ldx #$db
08d3 : a0bd                     ldy #$bd
                                set_a $e7,$ff
                       >            load_flag $ff
08d5 : a9ff            >            lda #$ff             ;allow test to change
                       >
08d7 : 48              >            pha         ;use stack to load status
08d8 : a9e7            >            lda #$e7     ;precharge accu
08da : 28              >            plp
                        
08db : ea                       nop
                                tst_a $e7,$ff
08dc : 08              >            php         ;save flags
08dd : c9e7            >            cmp #$e7     ;test result
                       >            trap_ne
08df : d0fe            >        bne *           ;failed not equal (non zero)
                       >
08e1 : 68              >            pla         ;load status
08e2 : 48              >            pha
                       >            cmp_flag $ff
08e3 : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
08e5 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
08e7 : 28              >            plp         ;restore status
                        
08e8 : e0db                     cpx #$db
                                trap_ne
08ea : d0fe            >        bne *           ;failed not equal (non zero)
                        
08ec : c0bd                     cpy #$bd
                                trap_ne
08ee : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page   44
-------------------------- 6502_functional_test.a65 --------------------------

                        
                                next_test
08f0 : ad0002          >            lda test_case   ;previous test
08f3 : c907            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
08f5 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0008 =                 >test_num = test_num + 1
08f7 : a908            >            lda #test_num   ;*** next tests' number
08f9 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                                
                        ; jump absolute
                                set_stat $0
                       >            load_flag $0
08fc : a900            >            lda #$0             ;allow test to change 
                       >
08fe : 48              >            pha         ;use stack to load status
08ff : 28              >            plp
                        
0900 : a946                     lda #'F'
0902 : a241                     ldx #'A'
0904 : a052                     ldy #'R'        ;N=0, V=0, Z=0, C=0
0906 : 4c0337                   jmp test_far
0909 : ea                       nop
090a : ea                       nop
                                trap_ne         ;runover protection
090b : d0fe            >        bne *           ;failed not equal (non zero)
                        
090d : e8                       inx
090e : e8                       inx
090f :                  far_ret 
                                trap_eq         ;returned flags OK?
090f : f0fe            >        beq *           ;failed equal (zero)
                        
                                trap_pl
0911 : 10fe            >        bpl *           ;failed plus (bit 7 clear)
                        
                                trap_cc
0913 : 90fe            >        bcc *           ;failed carry clear
                        
                                trap_vc
0915 : 50fe            >        bvc *           ;failed overflow clear
                        
0917 : c9ec                     cmp #('F'^$aa)  ;returned registers OK?
                                trap_ne
0919 : d0fe            >        bne *           ;failed not equal (non zero)
                        
091b : e042                     cpx #('A'+1)
                                trap_ne
091d : d0fe            >        bne *           ;failed not equal (non zero)
                        
091f : c04f                     cpy #('R'-3)
                                trap_ne
0921 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0923 : ca                       dex
0924 : c8                       iny
0925 : c8                       iny
0926 : c8                       iny
0927 : 49aa                     eor #$aa        ;N=0, V=1, Z=0, C=1
AS65 Assembler for R6502 [1.42].                                     Page   45
-------------------------- 6502_functional_test.a65 --------------------------

0929 : 4c3209                   jmp test_near
092c : ea                       nop
092d : ea                       nop
                                trap_ne         ;runover protection
092e : d0fe            >        bne *           ;failed not equal (non zero)
                        
0930 : e8                       inx
0931 : e8                       inx
0932 :                  test_near
                                trap_eq         ;passed flags OK?
0932 : f0fe            >        beq *           ;failed equal (zero)
                        
                                trap_mi
0934 : 30fe            >        bmi *           ;failed minus (bit 7 set)
                        
                                trap_cc
0936 : 90fe            >        bcc *           ;failed carry clear
                        
                                trap_vc
0938 : 50fe            >        bvc *           ;failed overflow clear
                        
093a : c946                     cmp #'F'        ;passed registers OK?
                                trap_ne
093c : d0fe            >        bne *           ;failed not equal (non zero)
                        
093e : e041                     cpx #'A'
                                trap_ne
0940 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0942 : c052                     cpy #'R'
                                trap_ne
0944 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                next_test
0946 : ad0002          >            lda test_case   ;previous test
0949 : c908            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
094b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0009 =                 >test_num = test_num + 1
094d : a909            >            lda #test_num   ;*** next tests' number
094f : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                                
                        ; jump indirect
                                set_stat 0
                       >            load_flag 0
0952 : a900            >            lda #0             ;allow test to change I
                       >
0954 : 48              >            pha         ;use stack to load status
0955 : 28              >            plp
                        
0956 : a949                     lda #'I'
0958 : a24e                     ldx #'N'
095a : a044                     ldy #'D'        ;N=0, V=0, Z=0, C=0
095c : 6c3237                   jmp (ptr_tst_ind)
095f : ea                       nop
                                trap_ne         ;runover protection
0960 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0962 : 88                       dey
AS65 Assembler for R6502 [1.42].                                     Page   46
-------------------------- 6502_functional_test.a65 --------------------------

0963 : 88                       dey
0964 :                  ind_ret 
0964 : 08                       php             ;either SP or Y count will fai
0965 : 88                       dey
0966 : 88                       dey
0967 : 88                       dey
0968 : 28                       plp
                                trap_eq         ;returned flags OK?
0969 : f0fe            >        beq *           ;failed equal (zero)
                        
                                trap_pl
096b : 10fe            >        bpl *           ;failed plus (bit 7 clear)
                        
                                trap_cc
096d : 90fe            >        bcc *           ;failed carry clear
                        
                                trap_vc
096f : 50fe            >        bvc *           ;failed overflow clear
                        
0971 : c9e3                     cmp #('I'^$aa)  ;returned registers OK?
                                trap_ne
0973 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0975 : e04f                     cpx #('N'+1)
                                trap_ne
0977 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0979 : c03e                     cpy #('D'-6)
                                trap_ne
097b : d0fe            >        bne *           ;failed not equal (non zero)
                        
097d : ba                       tsx             ;SP check
097e : e0ff                     cpx #$ff
                                trap_ne
0980 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                next_test
0982 : ad0002          >            lda test_case   ;previous test
0985 : c909            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0987 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
000a =                 >test_num = test_num + 1
0989 : a90a            >            lda #test_num   ;*** next tests' number
098b : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; jump subroutine & return from subroutine
                                set_stat 0
                       >            load_flag 0
098e : a900            >            lda #0             ;allow test to change I
                       >
0990 : 48              >            pha         ;use stack to load status
0991 : 28              >            plp
                        
0992 : a94a                     lda #'J'
0994 : a253                     ldx #'S'
0996 : a052                     ldy #'R'        ;N=0, V=0, Z=0, C=0
0998 : 207137                   jsr test_jsr
099a =                  jsr_ret = *-1           ;last address of jsr = return 
099b : 08                       php             ;either SP or Y count will fai
AS65 Assembler for R6502 [1.42].                                     Page   47
-------------------------- 6502_functional_test.a65 --------------------------

099c : 88                       dey
099d : 88                       dey
099e : 88                       dey
099f : 28                       plp
                                trap_eq         ;returned flags OK?
09a0 : f0fe            >        beq *           ;failed equal (zero)
                        
                                trap_pl
09a2 : 10fe            >        bpl *           ;failed plus (bit 7 clear)
                        
                                trap_cc
09a4 : 90fe            >        bcc *           ;failed carry clear
                        
                                trap_vc
09a6 : 50fe            >        bvc *           ;failed overflow clear
                        
09a8 : c9e0                     cmp #('J'^$aa)  ;returned registers OK?
                                trap_ne
09aa : d0fe            >        bne *           ;failed not equal (non zero)
                        
09ac : e054                     cpx #('S'+1)
                                trap_ne
09ae : d0fe            >        bne *           ;failed not equal (non zero)
                        
09b0 : c04c                     cpy #('R'-6)
                                trap_ne
09b2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
09b4 : ba                       tsx             ;sp?
09b5 : e0ff                     cpx #$ff
                                trap_ne
09b7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                next_test
09b9 : ad0002          >            lda test_case   ;previous test
09bc : c90a            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
09be : d0fe            >        bne *           ;failed not equal (non zero)
                       >
000b =                 >test_num = test_num + 1
09c0 : a90b            >            lda #test_num   ;*** next tests' number
09c2 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; break & return from interrupt
                            if ROM_vectors = 1
                                load_flag 0     ;with interrupts enabled if al
                                pha
                                lda #'B'
                                ldx #'R'
                                ldy #'K'
                                plp             ;N=0, V=0, Z=0, C=0
                                brk
                            else
09c5 : a909                     lda #hi brk_ret0 ;emulated break
09c7 : 48                       pha
09c8 : a9dc                     lda #lo brk_ret0
09ca : 48                       pha
                                load_flag fao    ;set break & unused on stack
09cb : a930            >            lda #fao                 ;allow test to ch
                        
AS65 Assembler for R6502 [1.42].                                     Page   48
-------------------------- 6502_functional_test.a65 --------------------------

09cd : 48                       pha
                                load_flag intdis ;during interrupt
09ce : a904            >            lda #intdis              ;allow test to ch
                        
09d0 : 48                       pha
09d1 : a942                     lda #'B'
09d3 : a252                     ldx #'R'
09d5 : a04b                     ldy #'K'
09d7 : 28                       plp             ;N=0, V=0, Z=0, C=0
09d8 : 4cbf37                   jmp irq_trap
                            endif
09db : 88                       dey             ;should not be executed
09dc :                  brk_ret0                ;address of break return
09dc : 08                       php             ;either SP or Y count will fai
09dd : 88                       dey
09de : 88                       dey
09df : 88                       dey
09e0 : c9e8                     cmp #'B'^$aa    ;returned registers OK?
                                ;the IRQ vector was never executed if A & X st
                                trap_ne
09e2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
09e4 : e053                     cpx #'R'+1
                                trap_ne
09e6 : d0fe            >        bne *           ;failed not equal (non zero)
                        
09e8 : c045                     cpy #'K'-6
                                trap_ne
09ea : d0fe            >        bne *           ;failed not equal (non zero)
                        
09ec : 68                       pla             ;returned flags OK (unchanged)
                                cmp_flag 0
09ed : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                        
                                trap_ne
09ef : d0fe            >        bne *           ;failed not equal (non zero)
                        
09f1 : ba                       tsx             ;sp?
09f2 : e0ff                     cpx #$ff
                                trap_ne
09f4 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                            if ROM_vectors = 1
                                load_flag $ff   ;with interrupts disabled if a
                                pha
                                lda #$ff-'B'
                                ldx #$ff-'R'
                                ldy #$ff-'K'
                                plp             ;N=1, V=1, Z=1, C=1
                                brk
                            else
09f6 : a90a                     lda #hi brk_ret1 ;emulated break
09f8 : 48                       pha
09f9 : a90b                     lda #lo brk_ret1
09fb : 48                       pha
                                load_flag $ff
09fc : a9ff            >            lda #$ff             ;allow test to change
                        
09fe : 48                       pha             ;set break & unused on stack
09ff : 48                       pha             ;actual flags
0a00 : a9bd                     lda #$ff-'B'
0a02 : a2ad                     ldx #$ff-'R'
AS65 Assembler for R6502 [1.42].                                     Page   49
-------------------------- 6502_functional_test.a65 --------------------------

0a04 : a0b4                     ldy #$ff-'K'
0a06 : 28                       plp             ;N=1, V=1, Z=1, C=1
0a07 : 4cbf37                   jmp irq_trap
                            endif
0a0a : 88                       dey             ;should not be executed
0a0b :                  brk_ret1                ;address of break return
0a0b : 08                       php             ;either SP or Y count will fai
0a0c : 88                       dey
0a0d : 88                       dey
0a0e : 88                       dey
0a0f : c917                     cmp #($ff-'B')^$aa  ;returned registers OK?
                                ;the IRQ vector was never executed if A & X st
                                trap_ne
0a11 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0a13 : e0ae                     cpx #$ff-'R'+1
                                trap_ne
0a15 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0a17 : c0ae                     cpy #$ff-'K'-6
                                trap_ne
0a19 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0a1b : 68                       pla             ;returned flags OK (unchanged)
                                cmp_flag $ff
0a1c : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                        
                                trap_ne
0a1e : d0fe            >        bne *           ;failed not equal (non zero)
                        
0a20 : ba                       tsx             ;sp?
0a21 : e0ff                     cpx #$ff
                                trap_ne
0a23 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                next_test
0a25 : ad0002          >            lda test_case   ;previous test
0a28 : c90b            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0a2a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
000c =                 >test_num = test_num + 1
0a2c : a90c            >            lda #test_num   ;*** next tests' number
0a2e : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                         
                        ; test set and clear flags CLC CLI CLD CLV SEC SEI SED
                                set_stat $ff
                       >            load_flag $ff
0a31 : a9ff            >            lda #$ff             ;allow test to change
                       >
0a33 : 48              >            pha         ;use stack to load status
0a34 : 28              >            plp
                        
0a35 : 18                       clc
                                tst_stat $ff-carry
0a36 : 08              >            php         ;save status
0a37 : 68              >            pla         ;use stack to retrieve status
0a38 : 48              >            pha
                       >            cmp_flag $ff-carry
0a39 : c9fe            >            cmp #($ff-carry|fao)&m8    ;expected flags
AS65 Assembler for R6502 [1.42].                                     Page   50
-------------------------- 6502_functional_test.a65 --------------------------

                       >
                       >            trap_ne
0a3b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a3d : 28              >            plp         ;restore status
                        
0a3e : 38                       sec
                                tst_stat $ff
0a3f : 08              >            php         ;save status
0a40 : 68              >            pla         ;use stack to retrieve status
0a41 : 48              >            pha
                       >            cmp_flag $ff
0a42 : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
0a44 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a46 : 28              >            plp         ;restore status
                        
                            if I_flag = 3
0a47 : 58                       cli
                                tst_stat $ff-intdis
0a48 : 08              >            php         ;save status
0a49 : 68              >            pla         ;use stack to retrieve status
0a4a : 48              >            pha
                       >            cmp_flag $ff-intdis
0a4b : c9fb            >            cmp #($ff-intdis|fao)&m8    ;expected flag
                       >
                       >            trap_ne
0a4d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a4f : 28              >            plp         ;restore status
                        
0a50 : 78                       sei
                                tst_stat $ff
0a51 : 08              >            php         ;save status
0a52 : 68              >            pla         ;use stack to retrieve status
0a53 : 48              >            pha
                       >            cmp_flag $ff
0a54 : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
0a56 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a58 : 28              >            plp         ;restore status
                        
                            endif
0a59 : d8                       cld
                                tst_stat $ff-decmode
0a5a : 08              >            php         ;save status
0a5b : 68              >            pla         ;use stack to retrieve status
0a5c : 48              >            pha
                       >            cmp_flag $ff-decmode
0a5d : c9f7            >            cmp #($ff-decmode|fao)&m8    ;expected fla
                       >
                       >            trap_ne
0a5f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a61 : 28              >            plp         ;restore status
                        
0a62 : f8                       sed
                                tst_stat $ff
AS65 Assembler for R6502 [1.42].                                     Page   51
-------------------------- 6502_functional_test.a65 --------------------------

0a63 : 08              >            php         ;save status
0a64 : 68              >            pla         ;use stack to retrieve status
0a65 : 48              >            pha
                       >            cmp_flag $ff
0a66 : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
0a68 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a6a : 28              >            plp         ;restore status
                        
0a6b : b8                       clv
                                tst_stat $ff-overfl
0a6c : 08              >            php         ;save status
0a6d : 68              >            pla         ;use stack to retrieve status
0a6e : 48              >            pha
                       >            cmp_flag $ff-overfl
0a6f : c9bf            >            cmp #($ff-overfl|fao)&m8    ;expected flag
                       >
                       >            trap_ne
0a71 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a73 : 28              >            plp         ;restore status
                        
                                set_stat 0
                       >            load_flag 0
0a74 : a900            >            lda #0             ;allow test to change I
                       >
0a76 : 48              >            pha         ;use stack to load status
0a77 : 28              >            plp
                        
                                tst_stat 0
0a78 : 08              >            php         ;save status
0a79 : 68              >            pla         ;use stack to retrieve status
0a7a : 48              >            pha
                       >            cmp_flag 0
0a7b : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0a7d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a7f : 28              >            plp         ;restore status
                        
0a80 : 38                       sec
                                tst_stat carry
0a81 : 08              >            php         ;save status
0a82 : 68              >            pla         ;use stack to retrieve status
0a83 : 48              >            pha
                       >            cmp_flag carry
0a84 : c931            >            cmp #(carry|fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
0a86 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a88 : 28              >            plp         ;restore status
                        
0a89 : 18                       clc
                                tst_stat 0  
0a8a : 08              >            php         ;save status
0a8b : 68              >            pla         ;use stack to retrieve status
0a8c : 48              >            pha
                       >            cmp_flag 0  
AS65 Assembler for R6502 [1.42].                                     Page   52
-------------------------- 6502_functional_test.a65 --------------------------

0a8d : c930            >            cmp #(0  |fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
0a8f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a91 : 28              >            plp         ;restore status
                        
                            if I_flag = 3
0a92 : 78                       sei
                                tst_stat intdis
0a93 : 08              >            php         ;save status
0a94 : 68              >            pla         ;use stack to retrieve status
0a95 : 48              >            pha
                       >            cmp_flag intdis
0a96 : c934            >            cmp #(intdis|fao)&m8    ;expected flags + 
                       >
                       >            trap_ne
0a98 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0a9a : 28              >            plp         ;restore status
                        
0a9b : 58                       cli
                                tst_stat 0
0a9c : 08              >            php         ;save status
0a9d : 68              >            pla         ;use stack to retrieve status
0a9e : 48              >            pha
                       >            cmp_flag 0
0a9f : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0aa1 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0aa3 : 28              >            plp         ;restore status
                        
                            endif  
0aa4 : f8                       sed
                                tst_stat decmode
0aa5 : 08              >            php         ;save status
0aa6 : 68              >            pla         ;use stack to retrieve status
0aa7 : 48              >            pha
                       >            cmp_flag decmode
0aa8 : c938            >            cmp #(decmode|fao)&m8    ;expected flags +
                       >
                       >            trap_ne
0aaa : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0aac : 28              >            plp         ;restore status
                        
0aad : d8                       cld
                                tst_stat 0  
0aae : 08              >            php         ;save status
0aaf : 68              >            pla         ;use stack to retrieve status
0ab0 : 48              >            pha
                       >            cmp_flag 0  
0ab1 : c930            >            cmp #(0  |fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
0ab3 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0ab5 : 28              >            plp         ;restore status
                        
                                set_stat overfl
AS65 Assembler for R6502 [1.42].                                     Page   53
-------------------------- 6502_functional_test.a65 --------------------------

                       >            load_flag overfl
0ab6 : a940            >            lda #overfl             ;allow test to cha
                       >
0ab8 : 48              >            pha         ;use stack to load status
0ab9 : 28              >            plp
                        
                                tst_stat overfl
0aba : 08              >            php         ;save status
0abb : 68              >            pla         ;use stack to retrieve status
0abc : 48              >            pha
                       >            cmp_flag overfl
0abd : c970            >            cmp #(overfl|fao)&m8    ;expected flags + 
                       >
                       >            trap_ne
0abf : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0ac1 : 28              >            plp         ;restore status
                        
0ac2 : b8                       clv
                                tst_stat 0
0ac3 : 08              >            php         ;save status
0ac4 : 68              >            pla         ;use stack to retrieve status
0ac5 : 48              >            pha
                       >            cmp_flag 0
0ac6 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0ac8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0aca : 28              >            plp         ;restore status
                        
                                next_test
0acb : ad0002          >            lda test_case   ;previous test
0ace : c90c            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0ad0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
000d =                 >test_num = test_num + 1
0ad2 : a90d            >            lda #test_num   ;*** next tests' number
0ad4 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        ; testing index register increment/decrement and trans
                        ; INX INY DEX DEY TAX TXA TAY TYA 
0ad7 : a2fe                     ldx #$fe
                                set_stat $ff
                       >            load_flag $ff
0ad9 : a9ff            >            lda #$ff             ;allow test to change
                       >
0adb : 48              >            pha         ;use stack to load status
0adc : 28              >            plp
                        
0add : e8                       inx             ;ff
                                tst_x $ff,$ff-zero
0ade : 08              >            php         ;save flags
0adf : e0ff            >            cpx #$ff     ;test result
                       >            trap_ne
0ae1 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0ae3 : 68              >            pla         ;load status
0ae4 : 48              >            pha
                       >            cmp_flag $ff-zero
AS65 Assembler for R6502 [1.42].                                     Page   54
-------------------------- 6502_functional_test.a65 --------------------------

0ae5 : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                       >
                       >            trap_ne
0ae7 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0ae9 : 28              >            plp         ;restore status
                        
0aea : e8                       inx             ;00
                                tst_x 0,$ff-minus
0aeb : 08              >            php         ;save flags
0aec : e000            >            cpx #0     ;test result
                       >            trap_ne
0aee : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0af0 : 68              >            pla         ;load status
0af1 : 48              >            pha
                       >            cmp_flag $ff-minus
0af2 : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                       >
                       >            trap_ne
0af4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0af6 : 28              >            plp         ;restore status
                        
0af7 : e8                       inx             ;01
                                tst_x 1,$ff-minus-zero
0af8 : 08              >            php         ;save flags
0af9 : e001            >            cpx #1     ;test result
                       >            trap_ne
0afb : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0afd : 68              >            pla         ;load status
0afe : 48              >            pha
                       >            cmp_flag $ff-minus-zero
0aff : c97d            >            cmp #($ff-minus-zero|fao)&m8    ;expected 
                       >
                       >            trap_ne
0b01 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b03 : 28              >            plp         ;restore status
                        
0b04 : ca                       dex             ;00
                                tst_x 0,$ff-minus
0b05 : 08              >            php         ;save flags
0b06 : e000            >            cpx #0     ;test result
                       >            trap_ne
0b08 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b0a : 68              >            pla         ;load status
0b0b : 48              >            pha
                       >            cmp_flag $ff-minus
0b0c : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                       >
                       >            trap_ne
0b0e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b10 : 28              >            plp         ;restore status
                        
0b11 : ca                       dex             ;ff
                                tst_x $ff,$ff-zero
0b12 : 08              >            php         ;save flags
0b13 : e0ff            >            cpx #$ff     ;test result
AS65 Assembler for R6502 [1.42].                                     Page   55
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
0b15 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b17 : 68              >            pla         ;load status
0b18 : 48              >            pha
                       >            cmp_flag $ff-zero
0b19 : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                       >
                       >            trap_ne
0b1b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b1d : 28              >            plp         ;restore status
                        
0b1e : ca                       dex             ;fe
                                set_stat 0
                       >            load_flag 0
0b1f : a900            >            lda #0             ;allow test to change I
                       >
0b21 : 48              >            pha         ;use stack to load status
0b22 : 28              >            plp
                        
0b23 : e8                       inx             ;ff
                                tst_x $ff,minus
0b24 : 08              >            php         ;save flags
0b25 : e0ff            >            cpx #$ff     ;test result
                       >            trap_ne
0b27 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b29 : 68              >            pla         ;load status
0b2a : 48              >            pha
                       >            cmp_flag minus
0b2b : c9b0            >            cmp #(minus|fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
0b2d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b2f : 28              >            plp         ;restore status
                        
0b30 : e8                       inx             ;00
                                tst_x 0,zero
0b31 : 08              >            php         ;save flags
0b32 : e000            >            cpx #0     ;test result
                       >            trap_ne
0b34 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b36 : 68              >            pla         ;load status
0b37 : 48              >            pha
                       >            cmp_flag zero
0b38 : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
0b3a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b3c : 28              >            plp         ;restore status
                        
0b3d : e8                       inx             ;01
                                tst_x 1,0
0b3e : 08              >            php         ;save flags
0b3f : e001            >            cpx #1     ;test result
                       >            trap_ne
0b41 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
AS65 Assembler for R6502 [1.42].                                     Page   56
-------------------------- 6502_functional_test.a65 --------------------------

0b43 : 68              >            pla         ;load status
0b44 : 48              >            pha
                       >            cmp_flag 0
0b45 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0b47 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b49 : 28              >            plp         ;restore status
                        
0b4a : ca                       dex             ;00
                                tst_x 0,zero
0b4b : 08              >            php         ;save flags
0b4c : e000            >            cpx #0     ;test result
                       >            trap_ne
0b4e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b50 : 68              >            pla         ;load status
0b51 : 48              >            pha
                       >            cmp_flag zero
0b52 : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
0b54 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b56 : 28              >            plp         ;restore status
                        
0b57 : ca                       dex             ;ff
                                tst_x $ff,minus
0b58 : 08              >            php         ;save flags
0b59 : e0ff            >            cpx #$ff     ;test result
                       >            trap_ne
0b5b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b5d : 68              >            pla         ;load status
0b5e : 48              >            pha
                       >            cmp_flag minus
0b5f : c9b0            >            cmp #(minus|fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
0b61 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b63 : 28              >            plp         ;restore status
                        
                        
0b64 : a0fe                     ldy #$fe
                                set_stat $ff
                       >            load_flag $ff
0b66 : a9ff            >            lda #$ff             ;allow test to change
                       >
0b68 : 48              >            pha         ;use stack to load status
0b69 : 28              >            plp
                        
0b6a : c8                       iny             ;ff
                                tst_y $ff,$ff-zero
0b6b : 08              >            php         ;save flags
0b6c : c0ff            >            cpy #$ff     ;test result
                       >            trap_ne
0b6e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b70 : 68              >            pla         ;load status
0b71 : 48              >            pha
AS65 Assembler for R6502 [1.42].                                     Page   57
-------------------------- 6502_functional_test.a65 --------------------------

                       >            cmp_flag $ff-zero
0b72 : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                       >
                       >            trap_ne
0b74 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b76 : 28              >            plp         ;restore status
                        
0b77 : c8                       iny             ;00
                                tst_y 0,$ff-minus
0b78 : 08              >            php         ;save flags
0b79 : c000            >            cpy #0     ;test result
                       >            trap_ne
0b7b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b7d : 68              >            pla         ;load status
0b7e : 48              >            pha
                       >            cmp_flag $ff-minus
0b7f : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                       >
                       >            trap_ne
0b81 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b83 : 28              >            plp         ;restore status
                        
0b84 : c8                       iny             ;01
                                tst_y 1,$ff-minus-zero
0b85 : 08              >            php         ;save flags
0b86 : c001            >            cpy #1     ;test result
                       >            trap_ne
0b88 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b8a : 68              >            pla         ;load status
0b8b : 48              >            pha
                       >            cmp_flag $ff-minus-zero
0b8c : c97d            >            cmp #($ff-minus-zero|fao)&m8    ;expected 
                       >
                       >            trap_ne
0b8e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b90 : 28              >            plp         ;restore status
                        
0b91 : 88                       dey             ;00
                                tst_y 0,$ff-minus
0b92 : 08              >            php         ;save flags
0b93 : c000            >            cpy #0     ;test result
                       >            trap_ne
0b95 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b97 : 68              >            pla         ;load status
0b98 : 48              >            pha
                       >            cmp_flag $ff-minus
0b99 : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                       >
                       >            trap_ne
0b9b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0b9d : 28              >            plp         ;restore status
                        
0b9e : 88                       dey             ;ff
                                tst_y $ff,$ff-zero
0b9f : 08              >            php         ;save flags
AS65 Assembler for R6502 [1.42].                                     Page   58
-------------------------- 6502_functional_test.a65 --------------------------

0ba0 : c0ff            >            cpy #$ff     ;test result
                       >            trap_ne
0ba2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0ba4 : 68              >            pla         ;load status
0ba5 : 48              >            pha
                       >            cmp_flag $ff-zero
0ba6 : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                       >
                       >            trap_ne
0ba8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0baa : 28              >            plp         ;restore status
                        
0bab : 88                       dey             ;fe
                                set_stat 0
                       >            load_flag 0
0bac : a900            >            lda #0             ;allow test to change I
                       >
0bae : 48              >            pha         ;use stack to load status
0baf : 28              >            plp
                        
0bb0 : c8                       iny             ;ff
                                tst_y $ff,0+minus
0bb1 : 08              >            php         ;save flags
0bb2 : c0ff            >            cpy #$ff     ;test result
                       >            trap_ne
0bb4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0bb6 : 68              >            pla         ;load status
0bb7 : 48              >            pha
                       >            cmp_flag 0+minus
0bb8 : c9b0            >            cmp #(0+minus|fao)&m8    ;expected flags +
                       >
                       >            trap_ne
0bba : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0bbc : 28              >            plp         ;restore status
                        
0bbd : c8                       iny             ;00
                                tst_y 0,zero
0bbe : 08              >            php         ;save flags
0bbf : c000            >            cpy #0     ;test result
                       >            trap_ne
0bc1 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0bc3 : 68              >            pla         ;load status
0bc4 : 48              >            pha
                       >            cmp_flag zero
0bc5 : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
0bc7 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0bc9 : 28              >            plp         ;restore status
                        
0bca : c8                       iny             ;01
                                tst_y 1,0
0bcb : 08              >            php         ;save flags
0bcc : c001            >            cpy #1     ;test result
                       >            trap_ne
0bce : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page   59
-------------------------- 6502_functional_test.a65 --------------------------

                       >
0bd0 : 68              >            pla         ;load status
0bd1 : 48              >            pha
                       >            cmp_flag 0
0bd2 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0bd4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0bd6 : 28              >            plp         ;restore status
                        
0bd7 : 88                       dey             ;00
                                tst_y 0,zero
0bd8 : 08              >            php         ;save flags
0bd9 : c000            >            cpy #0     ;test result
                       >            trap_ne
0bdb : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0bdd : 68              >            pla         ;load status
0bde : 48              >            pha
                       >            cmp_flag zero
0bdf : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
0be1 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0be3 : 28              >            plp         ;restore status
                        
0be4 : 88                       dey             ;ff
                                tst_y $ff,minus
0be5 : 08              >            php         ;save flags
0be6 : c0ff            >            cpy #$ff     ;test result
                       >            trap_ne
0be8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0bea : 68              >            pla         ;load status
0beb : 48              >            pha
                       >            cmp_flag minus
0bec : c9b0            >            cmp #(minus|fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
0bee : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0bf0 : 28              >            plp         ;restore status
                        
                                        
0bf1 : a2ff                     ldx #$ff
                                set_stat $ff
                       >            load_flag $ff
0bf3 : a9ff            >            lda #$ff             ;allow test to change
                       >
0bf5 : 48              >            pha         ;use stack to load status
0bf6 : 28              >            plp
                        
0bf7 : 8a                       txa
                                tst_a $ff,$ff-zero
0bf8 : 08              >            php         ;save flags
0bf9 : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
0bfb : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0bfd : 68              >            pla         ;load status
AS65 Assembler for R6502 [1.42].                                     Page   60
-------------------------- 6502_functional_test.a65 --------------------------

0bfe : 48              >            pha
                       >            cmp_flag $ff-zero
0bff : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                       >
                       >            trap_ne
0c01 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c03 : 28              >            plp         ;restore status
                        
0c04 : 08                       php
0c05 : e8                       inx             ;00
0c06 : 28                       plp
0c07 : 8a                       txa
                                tst_a 0,$ff-minus
0c08 : 08              >            php         ;save flags
0c09 : c900            >            cmp #0     ;test result
                       >            trap_ne
0c0b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c0d : 68              >            pla         ;load status
0c0e : 48              >            pha
                       >            cmp_flag $ff-minus
0c0f : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                       >
                       >            trap_ne
0c11 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c13 : 28              >            plp         ;restore status
                        
0c14 : 08                       php
0c15 : e8                       inx             ;01
0c16 : 28                       plp
0c17 : 8a                       txa
                                tst_a 1,$ff-minus-zero
0c18 : 08              >            php         ;save flags
0c19 : c901            >            cmp #1     ;test result
                       >            trap_ne
0c1b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c1d : 68              >            pla         ;load status
0c1e : 48              >            pha
                       >            cmp_flag $ff-minus-zero
0c1f : c97d            >            cmp #($ff-minus-zero|fao)&m8    ;expected 
                       >
                       >            trap_ne
0c21 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c23 : 28              >            plp         ;restore status
                        
                                set_stat 0
                       >            load_flag 0
0c24 : a900            >            lda #0             ;allow test to change I
                       >
0c26 : 48              >            pha         ;use stack to load status
0c27 : 28              >            plp
                        
0c28 : 8a                       txa
                                tst_a 1,0
0c29 : 08              >            php         ;save flags
0c2a : c901            >            cmp #1     ;test result
                       >            trap_ne
0c2c : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page   61
-------------------------- 6502_functional_test.a65 --------------------------

                       >
0c2e : 68              >            pla         ;load status
0c2f : 48              >            pha
                       >            cmp_flag 0
0c30 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0c32 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c34 : 28              >            plp         ;restore status
                        
0c35 : 08                       php
0c36 : ca                       dex             ;00
0c37 : 28                       plp
0c38 : 8a                       txa
                                tst_a 0,zero
0c39 : 08              >            php         ;save flags
0c3a : c900            >            cmp #0     ;test result
                       >            trap_ne
0c3c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c3e : 68              >            pla         ;load status
0c3f : 48              >            pha
                       >            cmp_flag zero
0c40 : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
0c42 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c44 : 28              >            plp         ;restore status
                        
0c45 : 08                       php
0c46 : ca                       dex             ;ff
0c47 : 28                       plp
0c48 : 8a                       txa
                                tst_a $ff,minus
0c49 : 08              >            php         ;save flags
0c4a : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
0c4c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c4e : 68              >            pla         ;load status
0c4f : 48              >            pha
                       >            cmp_flag minus
0c50 : c9b0            >            cmp #(minus|fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
0c52 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c54 : 28              >            plp         ;restore status
                        
                                                
0c55 : a0ff                     ldy #$ff
                                set_stat $ff
                       >            load_flag $ff
0c57 : a9ff            >            lda #$ff             ;allow test to change
                       >
0c59 : 48              >            pha         ;use stack to load status
0c5a : 28              >            plp
                        
0c5b : 98                       tya
                                tst_a $ff,$ff-zero
AS65 Assembler for R6502 [1.42].                                     Page   62
-------------------------- 6502_functional_test.a65 --------------------------

0c5c : 08              >            php         ;save flags
0c5d : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
0c5f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c61 : 68              >            pla         ;load status
0c62 : 48              >            pha
                       >            cmp_flag $ff-zero
0c63 : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                       >
                       >            trap_ne
0c65 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c67 : 28              >            plp         ;restore status
                        
0c68 : 08                       php
0c69 : c8                       iny             ;00
0c6a : 28                       plp
0c6b : 98                       tya
                                tst_a 0,$ff-minus
0c6c : 08              >            php         ;save flags
0c6d : c900            >            cmp #0     ;test result
                       >            trap_ne
0c6f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c71 : 68              >            pla         ;load status
0c72 : 48              >            pha
                       >            cmp_flag $ff-minus
0c73 : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                       >
                       >            trap_ne
0c75 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c77 : 28              >            plp         ;restore status
                        
0c78 : 08                       php
0c79 : c8                       iny             ;01
0c7a : 28                       plp
0c7b : 98                       tya
                                tst_a 1,$ff-minus-zero
0c7c : 08              >            php         ;save flags
0c7d : c901            >            cmp #1     ;test result
                       >            trap_ne
0c7f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c81 : 68              >            pla         ;load status
0c82 : 48              >            pha
                       >            cmp_flag $ff-minus-zero
0c83 : c97d            >            cmp #($ff-minus-zero|fao)&m8    ;expected 
                       >
                       >            trap_ne
0c85 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c87 : 28              >            plp         ;restore status
                        
                                set_stat 0
                       >            load_flag 0
0c88 : a900            >            lda #0             ;allow test to change I
                       >
0c8a : 48              >            pha         ;use stack to load status
0c8b : 28              >            plp
                        
AS65 Assembler for R6502 [1.42].                                     Page   63
-------------------------- 6502_functional_test.a65 --------------------------

0c8c : 98                       tya
                                tst_a 1,0
0c8d : 08              >            php         ;save flags
0c8e : c901            >            cmp #1     ;test result
                       >            trap_ne
0c90 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c92 : 68              >            pla         ;load status
0c93 : 48              >            pha
                       >            cmp_flag 0
0c94 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0c96 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0c98 : 28              >            plp         ;restore status
                        
0c99 : 08                       php
0c9a : 88                       dey             ;00
0c9b : 28                       plp
0c9c : 98                       tya
                                tst_a 0,zero
0c9d : 08              >            php         ;save flags
0c9e : c900            >            cmp #0     ;test result
                       >            trap_ne
0ca0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0ca2 : 68              >            pla         ;load status
0ca3 : 48              >            pha
                       >            cmp_flag zero
0ca4 : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
0ca6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0ca8 : 28              >            plp         ;restore status
                        
0ca9 : 08                       php
0caa : 88                       dey             ;ff
0cab : 28                       plp
0cac : 98                       tya
                                tst_a $ff,minus
0cad : 08              >            php         ;save flags
0cae : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
0cb0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0cb2 : 68              >            pla         ;load status
0cb3 : 48              >            pha
                       >            cmp_flag minus
0cb4 : c9b0            >            cmp #(minus|fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
0cb6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0cb8 : 28              >            plp         ;restore status
                        
                        
                                load_flag $ff
0cb9 : a9ff            >            lda #$ff             ;allow test to change
                        
0cbb : 48                       pha
AS65 Assembler for R6502 [1.42].                                     Page   64
-------------------------- 6502_functional_test.a65 --------------------------

0cbc : a2ff                     ldx #$ff        ;ff
0cbe : 8a                       txa
0cbf : 28                       plp             
0cc0 : a8                       tay
                                tst_y $ff,$ff-zero
0cc1 : 08              >            php         ;save flags
0cc2 : c0ff            >            cpy #$ff     ;test result
                       >            trap_ne
0cc4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0cc6 : 68              >            pla         ;load status
0cc7 : 48              >            pha
                       >            cmp_flag $ff-zero
0cc8 : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                       >
                       >            trap_ne
0cca : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0ccc : 28              >            plp         ;restore status
                        
0ccd : 08                       php
0cce : e8                       inx             ;00
0ccf : 8a                       txa
0cd0 : 28                       plp
0cd1 : a8                       tay
                                tst_y 0,$ff-minus
0cd2 : 08              >            php         ;save flags
0cd3 : c000            >            cpy #0     ;test result
                       >            trap_ne
0cd5 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0cd7 : 68              >            pla         ;load status
0cd8 : 48              >            pha
                       >            cmp_flag $ff-minus
0cd9 : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                       >
                       >            trap_ne
0cdb : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0cdd : 28              >            plp         ;restore status
                        
0cde : 08                       php
0cdf : e8                       inx             ;01
0ce0 : 8a                       txa
0ce1 : 28                       plp
0ce2 : a8                       tay
                                tst_y 1,$ff-minus-zero
0ce3 : 08              >            php         ;save flags
0ce4 : c001            >            cpy #1     ;test result
                       >            trap_ne
0ce6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0ce8 : 68              >            pla         ;load status
0ce9 : 48              >            pha
                       >            cmp_flag $ff-minus-zero
0cea : c97d            >            cmp #($ff-minus-zero|fao)&m8    ;expected 
                       >
                       >            trap_ne
0cec : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0cee : 28              >            plp         ;restore status
                        
AS65 Assembler for R6502 [1.42].                                     Page   65
-------------------------- 6502_functional_test.a65 --------------------------

                                load_flag 0
0cef : a900            >            lda #0             ;allow test to change I
                        
0cf1 : 48                       pha
0cf2 : a900                     lda #0
0cf4 : 8a                       txa
0cf5 : 28                       plp
0cf6 : a8                       tay
                                tst_y 1,0
0cf7 : 08              >            php         ;save flags
0cf8 : c001            >            cpy #1     ;test result
                       >            trap_ne
0cfa : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0cfc : 68              >            pla         ;load status
0cfd : 48              >            pha
                       >            cmp_flag 0
0cfe : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0d00 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d02 : 28              >            plp         ;restore status
                        
0d03 : 08                       php
0d04 : ca                       dex             ;00
0d05 : 8a                       txa
0d06 : 28                       plp
0d07 : a8                       tay
                                tst_y 0,zero
0d08 : 08              >            php         ;save flags
0d09 : c000            >            cpy #0     ;test result
                       >            trap_ne
0d0b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d0d : 68              >            pla         ;load status
0d0e : 48              >            pha
                       >            cmp_flag zero
0d0f : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
0d11 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d13 : 28              >            plp         ;restore status
                        
0d14 : 08                       php
0d15 : ca                       dex             ;ff
0d16 : 8a                       txa
0d17 : 28                       plp
0d18 : a8                       tay
                                tst_y $ff,minus
0d19 : 08              >            php         ;save flags
0d1a : c0ff            >            cpy #$ff     ;test result
                       >            trap_ne
0d1c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d1e : 68              >            pla         ;load status
0d1f : 48              >            pha
                       >            cmp_flag minus
0d20 : c9b0            >            cmp #(minus|fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
AS65 Assembler for R6502 [1.42].                                     Page   66
-------------------------- 6502_functional_test.a65 --------------------------

0d22 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d24 : 28              >            plp         ;restore status
                        
                        
                        
                                load_flag $ff
0d25 : a9ff            >            lda #$ff             ;allow test to change
                        
0d27 : 48                       pha
0d28 : a0ff                     ldy #$ff        ;ff
0d2a : 98                       tya
0d2b : 28                       plp
0d2c : aa                       tax
                                tst_x $ff,$ff-zero
0d2d : 08              >            php         ;save flags
0d2e : e0ff            >            cpx #$ff     ;test result
                       >            trap_ne
0d30 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d32 : 68              >            pla         ;load status
0d33 : 48              >            pha
                       >            cmp_flag $ff-zero
0d34 : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                       >
                       >            trap_ne
0d36 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d38 : 28              >            plp         ;restore status
                        
0d39 : 08                       php
0d3a : c8                       iny             ;00
0d3b : 98                       tya
0d3c : 28                       plp
0d3d : aa                       tax
                                tst_x 0,$ff-minus
0d3e : 08              >            php         ;save flags
0d3f : e000            >            cpx #0     ;test result
                       >            trap_ne
0d41 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d43 : 68              >            pla         ;load status
0d44 : 48              >            pha
                       >            cmp_flag $ff-minus
0d45 : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                       >
                       >            trap_ne
0d47 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d49 : 28              >            plp         ;restore status
                        
0d4a : 08                       php
0d4b : c8                       iny             ;01
0d4c : 98                       tya
0d4d : 28                       plp
0d4e : aa                       tax
                                tst_x 1,$ff-minus-zero
0d4f : 08              >            php         ;save flags
0d50 : e001            >            cpx #1     ;test result
                       >            trap_ne
0d52 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
AS65 Assembler for R6502 [1.42].                                     Page   67
-------------------------- 6502_functional_test.a65 --------------------------

0d54 : 68              >            pla         ;load status
0d55 : 48              >            pha
                       >            cmp_flag $ff-minus-zero
0d56 : c97d            >            cmp #($ff-minus-zero|fao)&m8    ;expected 
                       >
                       >            trap_ne
0d58 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d5a : 28              >            plp         ;restore status
                        
                                load_flag 0
0d5b : a900            >            lda #0             ;allow test to change I
                        
0d5d : 48                       pha
0d5e : a900                     lda #0          ;preset status
0d60 : 98                       tya
0d61 : 28                       plp
0d62 : aa                       tax
                                tst_x 1,0
0d63 : 08              >            php         ;save flags
0d64 : e001            >            cpx #1     ;test result
                       >            trap_ne
0d66 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d68 : 68              >            pla         ;load status
0d69 : 48              >            pha
                       >            cmp_flag 0
0d6a : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                       >
                       >            trap_ne
0d6c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d6e : 28              >            plp         ;restore status
                        
0d6f : 08                       php
0d70 : 88                       dey             ;00
0d71 : 98                       tya
0d72 : 28                       plp
0d73 : aa                       tax
                                tst_x 0,zero
0d74 : 08              >            php         ;save flags
0d75 : e000            >            cpx #0     ;test result
                       >            trap_ne
0d77 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d79 : 68              >            pla         ;load status
0d7a : 48              >            pha
                       >            cmp_flag zero
0d7b : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
0d7d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d7f : 28              >            plp         ;restore status
                        
0d80 : 08                       php
0d81 : 88                       dey             ;ff
0d82 : 98                       tya
0d83 : 28                       plp
0d84 : aa                       tax
                                tst_x $ff,minus
0d85 : 08              >            php         ;save flags
AS65 Assembler for R6502 [1.42].                                     Page   68
-------------------------- 6502_functional_test.a65 --------------------------

0d86 : e0ff            >            cpx #$ff     ;test result
                       >            trap_ne
0d88 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d8a : 68              >            pla         ;load status
0d8b : 48              >            pha
                       >            cmp_flag minus
0d8c : c9b0            >            cmp #(minus|fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
0d8e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0d90 : 28              >            plp         ;restore status
                        
                                next_test
0d91 : ad0002          >            lda test_case   ;previous test
0d94 : c90d            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0d96 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
000e =                 >test_num = test_num + 1
0d98 : a90e            >            lda #test_num   ;*** next tests' number
0d9a : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                             
                        ;TSX sets NZ - TXS does not
                        ;  This section also tests for proper stack wrap aroun
0d9d : a201                     ldx #1          ;01
                                set_stat $ff
                       >            load_flag $ff
0d9f : a9ff            >            lda #$ff             ;allow test to change
                       >
0da1 : 48              >            pha         ;use stack to load status
0da2 : 28              >            plp
                        
0da3 : 9a                       txs
0da4 : 08                       php
0da5 : ad0101                   lda $101
                                cmp_flag $ff
0da8 : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                        
                                trap_ne
0daa : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
0dac : a900            >            lda #0             ;allow test to change I
                       >
0dae : 48              >            pha         ;use stack to load status
0daf : 28              >            plp
                        
0db0 : 9a                       txs
0db1 : 08                       php
0db2 : ad0101                   lda $101
                                cmp_flag 0
0db5 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                        
                                trap_ne
0db7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0db9 : ca                       dex             ;00
AS65 Assembler for R6502 [1.42].                                     Page   69
-------------------------- 6502_functional_test.a65 --------------------------

                                set_stat $ff
                       >            load_flag $ff
0dba : a9ff            >            lda #$ff             ;allow test to change
                       >
0dbc : 48              >            pha         ;use stack to load status
0dbd : 28              >            plp
                        
0dbe : 9a                       txs
0dbf : 08                       php
0dc0 : ad0001                   lda $100
                                cmp_flag $ff
0dc3 : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                        
                                trap_ne
0dc5 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
0dc7 : a900            >            lda #0             ;allow test to change I
                       >
0dc9 : 48              >            pha         ;use stack to load status
0dca : 28              >            plp
                        
0dcb : 9a                       txs
0dcc : 08                       php
0dcd : ad0001                   lda $100
                                cmp_flag 0
0dd0 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                        
                                trap_ne
0dd2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0dd4 : ca                       dex             ;ff
                                set_stat $ff
                       >            load_flag $ff
0dd5 : a9ff            >            lda #$ff             ;allow test to change
                       >
0dd7 : 48              >            pha         ;use stack to load status
0dd8 : 28              >            plp
                        
0dd9 : 9a                       txs
0dda : 08                       php
0ddb : adff01                   lda $1ff
                                cmp_flag $ff
0dde : c9ff            >            cmp #($ff|fao)&m8    ;expected flags + alw
                        
                                trap_ne
0de0 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
0de2 : a900            >            lda #0             ;allow test to change I
                       >
0de4 : 48              >            pha         ;use stack to load status
0de5 : 28              >            plp
                        
0de6 : 9a                       txs
0de7 : 08                       php
0de8 : adff01                   lda $1ff
                                cmp_flag 0
0deb : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                        
AS65 Assembler for R6502 [1.42].                                     Page   70
-------------------------- 6502_functional_test.a65 --------------------------

                                
0ded : a201                     ldx #1
0def : 9a                       txs             ;sp=01
                                set_stat $ff
                       >            load_flag $ff
0df0 : a9ff            >            lda #$ff             ;allow test to change
                       >
0df2 : 48              >            pha         ;use stack to load status
0df3 : 28              >            plp
                        
0df4 : ba                       tsx             ;clears Z, N
0df5 : 08                       php             ;sp=00
0df6 : e001                     cpx #1
                                trap_ne
0df8 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0dfa : ad0101                   lda $101
                                cmp_flag $ff-minus-zero
0dfd : c97d            >            cmp #($ff-minus-zero|fao)&m8    ;expected 
                        
                                trap_ne
0dff : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
0e01 : a9ff            >            lda #$ff             ;allow test to change
                       >
0e03 : 48              >            pha         ;use stack to load status
0e04 : 28              >            plp
                        
0e05 : ba                       tsx             ;clears N, sets Z
0e06 : 08                       php             ;sp=ff
0e07 : e000                     cpx #0
                                trap_ne
0e09 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0e0b : ad0001                   lda $100
                                cmp_flag $ff-minus
0e0e : c97f            >            cmp #($ff-minus|fao)&m8    ;expected flags
                        
                                trap_ne
0e10 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
0e12 : a9ff            >            lda #$ff             ;allow test to change
                       >
0e14 : 48              >            pha         ;use stack to load status
0e15 : 28              >            plp
                        
0e16 : ba                       tsx             ;clears N, sets Z
0e17 : 08                       php             ;sp=fe
0e18 : e0ff                     cpx #$ff
                                trap_ne
0e1a : d0fe            >        bne *           ;failed not equal (non zero)
                        
0e1c : adff01                   lda $1ff
                                cmp_flag $ff-zero
0e1f : c9fd            >            cmp #($ff-zero|fao)&m8    ;expected flags 
                        
                                trap_ne
0e21 : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page   71
-------------------------- 6502_functional_test.a65 --------------------------

                        
                                
0e23 : a201                     ldx #1
0e25 : 9a                       txs             ;sp=01
                                set_stat 0
                       >            load_flag 0
0e26 : a900            >            lda #0             ;allow test to change I
                       >
0e28 : 48              >            pha         ;use stack to load status
0e29 : 28              >            plp
                        
0e2a : ba                       tsx             ;clears Z, N
0e2b : 08                       php             ;sp=00
0e2c : e001                     cpx #1
                                trap_ne
0e2e : d0fe            >        bne *           ;failed not equal (non zero)
                        
0e30 : ad0101                   lda $101
                                cmp_flag 0
0e33 : c930            >            cmp #(0|fao)&m8    ;expected flags + alway
                        
                                trap_ne
0e35 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
0e37 : a900            >            lda #0             ;allow test to change I
                       >
0e39 : 48              >            pha         ;use stack to load status
0e3a : 28              >            plp
                        
0e3b : ba                       tsx             ;clears N, sets Z
0e3c : 08                       php             ;sp=ff
0e3d : e000                     cpx #0
                                trap_ne
0e3f : d0fe            >        bne *           ;failed not equal (non zero)
                        
0e41 : ad0001                   lda $100
                                cmp_flag zero
0e44 : c932            >            cmp #(zero|fao)&m8    ;expected flags + al
                        
                                trap_ne
0e46 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
0e48 : a900            >            lda #0             ;allow test to change I
                       >
0e4a : 48              >            pha         ;use stack to load status
0e4b : 28              >            plp
                        
0e4c : ba                       tsx             ;clears N, sets Z
0e4d : 08                       php             ;sp=fe
0e4e : e0ff                     cpx #$ff
                                trap_ne
0e50 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0e52 : adff01                   lda $1ff
                                cmp_flag minus
0e55 : c9b0            >            cmp #(minus|fao)&m8    ;expected flags + a
                        
                                trap_ne
AS65 Assembler for R6502 [1.42].                                     Page   72
-------------------------- 6502_functional_test.a65 --------------------------

0e57 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0e59 : 68                       pla             ;sp=ff
                                next_test
0e5a : ad0002          >            lda test_case   ;previous test
0e5d : c90e            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0e5f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
000f =                 >test_num = test_num + 1
0e61 : a90f            >            lda #test_num   ;*** next tests' number
0e63 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                                
                        ; testing index register load & store LDY LDX STY STX 
                        ; LDX / STX - zp,y / abs,y
0e66 : a003                     ldy #3
0e68 :                  tldx    
                                set_stat 0
                       >            load_flag 0
0e68 : a900            >            lda #0             ;allow test to change I
                       >
0e6a : 48              >            pha         ;use stack to load status
0e6b : 28              >            plp
                        
0e6c : b615                     ldx zp1,y
0e6e : 08                       php         ;test stores do not alter flags
0e6f : 8a                       txa
0e70 : 49c3                     eor #$c3
0e72 : 28                       plp
0e73 : 990302                   sta abst,y
0e76 : 08                       php         ;flags after load/store sequence
0e77 : 49c3                     eor #$c3
0e79 : d91802                   cmp abs1,y  ;test result
                                trap_ne
0e7c : d0fe            >        bne *           ;failed not equal (non zero)
                        
0e7e : 68                       pla         ;load status
                                eor_flag 0
0e7f : 4930            >            eor #0|fao         ;invert expected flags 
                        
0e81 : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
0e84 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0e86 : 88                       dey
0e87 : 10df                     bpl tldx                  
                        
0e89 : a003                     ldy #3
0e8b :                  tldx1   
                                set_stat $ff
                       >            load_flag $ff
0e8b : a9ff            >            lda #$ff             ;allow test to change
                       >
0e8d : 48              >            pha         ;use stack to load status
0e8e : 28              >            plp
                        
0e8f : b615                     ldx zp1,y
0e91 : 08                       php         ;test stores do not alter flags
0e92 : 8a                       txa
0e93 : 49c3                     eor #$c3
AS65 Assembler for R6502 [1.42].                                     Page   73
-------------------------- 6502_functional_test.a65 --------------------------

0e95 : 28                       plp
0e96 : 990302                   sta abst,y
0e99 : 08                       php         ;flags after load/store sequence
0e9a : 49c3                     eor #$c3
0e9c : d91802                   cmp abs1,y  ;test result
                                trap_ne
0e9f : d0fe            >        bne *           ;failed not equal (non zero)
                        
0ea1 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
0ea2 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
0ea4 : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
0ea7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0ea9 : 88                       dey
0eaa : 10df                     bpl tldx1                  
                        
0eac : a003                     ldy #3
0eae :                  tldx2   
                                set_stat 0
                       >            load_flag 0
0eae : a900            >            lda #0             ;allow test to change I
                       >
0eb0 : 48              >            pha         ;use stack to load status
0eb1 : 28              >            plp
                        
0eb2 : be1802                   ldx abs1,y
0eb5 : 08                       php         ;test stores do not alter flags
0eb6 : 8a                       txa
0eb7 : 49c3                     eor #$c3
0eb9 : aa                       tax
0eba : 28                       plp
0ebb : 960c                     stx zpt,y
0ebd : 08                       php         ;flags after load/store sequence
0ebe : 49c3                     eor #$c3
0ec0 : d91500                   cmp zp1,y   ;test result
                                trap_ne
0ec3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0ec5 : 68                       pla         ;load status
                                eor_flag 0
0ec6 : 4930            >            eor #0|fao         ;invert expected flags 
                        
0ec8 : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
0ecb : d0fe            >        bne *           ;failed not equal (non zero)
                        
0ecd : 88                       dey
0ece : 10de                     bpl tldx2                  
                        
0ed0 : a003                     ldy #3
0ed2 :                  tldx3   
                                set_stat $ff
                       >            load_flag $ff
0ed2 : a9ff            >            lda #$ff             ;allow test to change
                       >
0ed4 : 48              >            pha         ;use stack to load status
0ed5 : 28              >            plp
                        
0ed6 : be1802                   ldx abs1,y
AS65 Assembler for R6502 [1.42].                                     Page   74
-------------------------- 6502_functional_test.a65 --------------------------

0ed9 : 08                       php         ;test stores do not alter flags
0eda : 8a                       txa
0edb : 49c3                     eor #$c3
0edd : aa                       tax
0ede : 28                       plp
0edf : 960c                     stx zpt,y
0ee1 : 08                       php         ;flags after load/store sequence
0ee2 : 49c3                     eor #$c3
0ee4 : d91500                   cmp zp1,y   ;test result
                                trap_ne
0ee7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0ee9 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
0eea : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
0eec : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
0eef : d0fe            >        bne *           ;failed not equal (non zero)
                        
0ef1 : 88                       dey
0ef2 : 10de                     bpl tldx3
                                
0ef4 : a003                     ldy #3      ;testing store result
0ef6 : a200                     ldx #0
0ef8 : b90c00           tstx    lda zpt,y
0efb : 49c3                     eor #$c3
0efd : d91500                   cmp zp1,y
                                trap_ne     ;store to zp data
0f00 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0f02 : 960c                     stx zpt,y   ;clear                
0f04 : b90302                   lda abst,y
0f07 : 49c3                     eor #$c3
0f09 : d91802                   cmp abs1,y
                                trap_ne     ;store to abs data
0f0c : d0fe            >        bne *           ;failed not equal (non zero)
                        
0f0e : 8a                       txa
0f0f : 990302                   sta abst,y  ;clear                
0f12 : 88                       dey
0f13 : 10e3                     bpl tstx
                                next_test
0f15 : ad0002          >            lda test_case   ;previous test
0f18 : c90f            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0f1a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0010 =                 >test_num = test_num + 1
0f1c : a910            >            lda #test_num   ;*** next tests' number
0f1e : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                                
                        ; indexed wraparound test (only zp should wrap)
0f21 : a0fd                     ldy #3+$fa
0f23 : b61b             tldx4   ldx zp1-$fa&$ff,y   ;wrap on indexed zp
0f25 : 8a                       txa
0f26 : 990901                   sta abst-$fa,y      ;no STX abs,y!
0f29 : 88                       dey
0f2a : c0fa                     cpy #$fa
0f2c : b0f5                     bcs tldx4                  
AS65 Assembler for R6502 [1.42].                                     Page   75
-------------------------- 6502_functional_test.a65 --------------------------

0f2e : a0fd                     ldy #3+$fa
0f30 : be1e01           tldx5   ldx abs1-$fa,y      ;no wrap on indexed abs
0f33 : 9612                     stx zpt-$fa&$ff,y
0f35 : 88                       dey
0f36 : c0fa                     cpy #$fa
0f38 : b0f6                     bcs tldx5                  
0f3a : a003                     ldy #3      ;testing wraparound result
0f3c : a200                     ldx #0
0f3e : b90c00           tstx1   lda zpt,y
0f41 : d91500                   cmp zp1,y
                                trap_ne     ;store to zp data
0f44 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0f46 : 960c                     stx zpt,y   ;clear                
0f48 : b90302                   lda abst,y
0f4b : d91802                   cmp abs1,y
                                trap_ne     ;store to abs data
0f4e : d0fe            >        bne *           ;failed not equal (non zero)
                        
0f50 : 8a                       txa
0f51 : 990302                   sta abst,y  ;clear                
0f54 : 88                       dey
0f55 : 10e7                     bpl tstx1
                                next_test
0f57 : ad0002          >            lda test_case   ;previous test
0f5a : c910            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
0f5c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0011 =                 >test_num = test_num + 1
0f5e : a911            >            lda #test_num   ;*** next tests' number
0f60 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                                
                        ; LDY / STY - zp,x / abs,x
0f63 : a203                     ldx #3
0f65 :                  tldy    
                                set_stat 0
                       >            load_flag 0
0f65 : a900            >            lda #0             ;allow test to change I
                       >
0f67 : 48              >            pha         ;use stack to load status
0f68 : 28              >            plp
                        
0f69 : b415                     ldy zp1,x
0f6b : 08                       php         ;test stores do not alter flags
0f6c : 98                       tya
0f6d : 49c3                     eor #$c3
0f6f : 28                       plp
0f70 : 9d0302                   sta abst,x
0f73 : 08                       php         ;flags after load/store sequence
0f74 : 49c3                     eor #$c3
0f76 : dd1802                   cmp abs1,x  ;test result
                                trap_ne
0f79 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0f7b : 68                       pla         ;load status
                                eor_flag 0
0f7c : 4930            >            eor #0|fao         ;invert expected flags 
                        
0f7e : dd1d02                   cmp fLDx,x  ;test flags
AS65 Assembler for R6502 [1.42].                                     Page   76
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_ne
0f81 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0f83 : ca                       dex
0f84 : 10df                     bpl tldy                  
                        
0f86 : a203                     ldx #3
0f88 :                  tldy1   
                                set_stat $ff
                       >            load_flag $ff
0f88 : a9ff            >            lda #$ff             ;allow test to change
                       >
0f8a : 48              >            pha         ;use stack to load status
0f8b : 28              >            plp
                        
0f8c : b415                     ldy zp1,x
0f8e : 08                       php         ;test stores do not alter flags
0f8f : 98                       tya
0f90 : 49c3                     eor #$c3
0f92 : 28                       plp
0f93 : 9d0302                   sta abst,x
0f96 : 08                       php         ;flags after load/store sequence
0f97 : 49c3                     eor #$c3
0f99 : dd1802                   cmp abs1,x  ;test result
                                trap_ne
0f9c : d0fe            >        bne *           ;failed not equal (non zero)
                        
0f9e : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
0f9f : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
0fa1 : dd1d02                   cmp fLDx,x  ;test flags
                                trap_ne
0fa4 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0fa6 : ca                       dex
0fa7 : 10df                     bpl tldy1                  
                        
0fa9 : a203                     ldx #3
0fab :                  tldy2   
                                set_stat 0
                       >            load_flag 0
0fab : a900            >            lda #0             ;allow test to change I
                       >
0fad : 48              >            pha         ;use stack to load status
0fae : 28              >            plp
                        
0faf : bc1802                   ldy abs1,x
0fb2 : 08                       php         ;test stores do not alter flags
0fb3 : 98                       tya
0fb4 : 49c3                     eor #$c3
0fb6 : a8                       tay
0fb7 : 28                       plp
0fb8 : 940c                     sty zpt,x
0fba : 08                       php         ;flags after load/store sequence
0fbb : 49c3                     eor #$c3
0fbd : d515                     cmp zp1,x   ;test result
                                trap_ne
0fbf : d0fe            >        bne *           ;failed not equal (non zero)
                        
0fc1 : 68                       pla         ;load status
                                eor_flag 0
AS65 Assembler for R6502 [1.42].                                     Page   77
-------------------------- 6502_functional_test.a65 --------------------------

0fc2 : 4930            >            eor #0|fao         ;invert expected flags 
                        
0fc4 : dd1d02                   cmp fLDx,x  ;test flags
                                trap_ne
0fc7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0fc9 : ca                       dex
0fca : 10df                     bpl tldy2                  
                        
0fcc : a203                     ldx #3
0fce :                  tldy3
                                set_stat $ff
                       >            load_flag $ff
0fce : a9ff            >            lda #$ff             ;allow test to change
                       >
0fd0 : 48              >            pha         ;use stack to load status
0fd1 : 28              >            plp
                        
0fd2 : bc1802                   ldy abs1,x
0fd5 : 08                       php         ;test stores do not alter flags
0fd6 : 98                       tya
0fd7 : 49c3                     eor #$c3
0fd9 : a8                       tay
0fda : 28                       plp
0fdb : 940c                     sty zpt,x
0fdd : 08                       php         ;flags after load/store sequence
0fde : 49c3                     eor #$c3
0fe0 : d515                     cmp zp1,x   ;test result
                                trap_ne
0fe2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0fe4 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
0fe5 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
0fe7 : dd1d02                   cmp fLDx,x  ;test flags
                                trap_ne
0fea : d0fe            >        bne *           ;failed not equal (non zero)
                        
0fec : ca                       dex
0fed : 10df                     bpl tldy3
                        
0fef : a203                     ldx #3      ;testing store result
0ff1 : a000                     ldy #0
0ff3 : b50c             tsty    lda zpt,x
0ff5 : 49c3                     eor #$c3
0ff7 : d515                     cmp zp1,x
                                trap_ne     ;store to zp,x data
0ff9 : d0fe            >        bne *           ;failed not equal (non zero)
                        
0ffb : 940c                     sty zpt,x   ;clear                
0ffd : bd0302                   lda abst,x
1000 : 49c3                     eor #$c3
1002 : dd1802                   cmp abs1,x
                                trap_ne     ;store to abs,x data
1005 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1007 : 8a                       txa
1008 : 9d0302                   sta abst,x  ;clear                
100b : ca                       dex
100c : 10e5                     bpl tsty
                                next_test
AS65 Assembler for R6502 [1.42].                                     Page   78
-------------------------- 6502_functional_test.a65 --------------------------

100e : ad0002          >            lda test_case   ;previous test
1011 : c911            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
1013 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0012 =                 >test_num = test_num + 1
1015 : a912            >            lda #test_num   ;*** next tests' number
1017 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; indexed wraparound test (only zp should wrap)
101a : a2fd                     ldx #3+$fa
101c : b41b             tldy4   ldy zp1-$fa&$ff,x   ;wrap on indexed zp
101e : 98                       tya
101f : 9d0901                   sta abst-$fa,x      ;no STX abs,x!
1022 : ca                       dex
1023 : e0fa                     cpx #$fa
1025 : b0f5                     bcs tldy4                  
1027 : a2fd                     ldx #3+$fa
1029 : bc1e01           tldy5   ldy abs1-$fa,x      ;no wrap on indexed abs
102c : 9412                     sty zpt-$fa&$ff,x
102e : ca                       dex
102f : e0fa                     cpx #$fa
1031 : b0f6                     bcs tldy5                  
1033 : a203                     ldx #3      ;testing wraparound result
1035 : a000                     ldy #0
1037 : b50c             tsty1   lda zpt,x
1039 : d515                     cmp zp1,x
                                trap_ne     ;store to zp,x data
103b : d0fe            >        bne *           ;failed not equal (non zero)
                        
103d : 940c                     sty zpt,x   ;clear                
103f : bd0302                   lda abst,x
1042 : dd1802                   cmp abs1,x
                                trap_ne     ;store to abs,x data
1045 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1047 : 8a                       txa
1048 : 9d0302                   sta abst,x  ;clear                
104b : ca                       dex
104c : 10e9                     bpl tsty1
                                next_test
104e : ad0002          >            lda test_case   ;previous test
1051 : c912            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
1053 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0013 =                 >test_num = test_num + 1
1055 : a913            >            lda #test_num   ;*** next tests' number
1057 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; LDX / STX - zp / abs / #
                                set_stat 0  
                       >            load_flag 0  
105a : a900            >            lda #0               ;allow test to change
                       >
105c : 48              >            pha         ;use stack to load status
105d : 28              >            plp
                        
AS65 Assembler for R6502 [1.42].                                     Page   79
-------------------------- 6502_functional_test.a65 --------------------------

105e : a615                     ldx zp1
1060 : 08                       php         ;test stores do not alter flags
1061 : 8a                       txa
1062 : 49c3                     eor #$c3
1064 : aa                       tax
1065 : 28                       plp
1066 : 8e0302                   stx abst
1069 : 08                       php         ;flags after load/store sequence
106a : 49c3                     eor #$c3
106c : aa                       tax
106d : e0c3                     cpx #$c3    ;test result
                                trap_ne
106f : d0fe            >        bne *           ;failed not equal (non zero)
                        
1071 : 68                       pla         ;load status
                                eor_flag 0
1072 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1074 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
1077 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1079 : a900            >            lda #0             ;allow test to change I
                       >
107b : 48              >            pha         ;use stack to load status
107c : 28              >            plp
                        
107d : a616                     ldx zp1+1
107f : 08                       php         ;test stores do not alter flags
1080 : 8a                       txa
1081 : 49c3                     eor #$c3
1083 : aa                       tax
1084 : 28                       plp
1085 : 8e0402                   stx abst+1
1088 : 08                       php         ;flags after load/store sequence
1089 : 49c3                     eor #$c3
108b : aa                       tax
108c : e082                     cpx #$82    ;test result
                                trap_ne
108e : d0fe            >        bne *           ;failed not equal (non zero)
                        
1090 : 68                       pla         ;load status
                                eor_flag 0
1091 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1093 : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1096 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1098 : a900            >            lda #0             ;allow test to change I
                       >
109a : 48              >            pha         ;use stack to load status
109b : 28              >            plp
                        
109c : a617                     ldx zp1+2
109e : 08                       php         ;test stores do not alter flags
109f : 8a                       txa
10a0 : 49c3                     eor #$c3
AS65 Assembler for R6502 [1.42].                                     Page   80
-------------------------- 6502_functional_test.a65 --------------------------

10a2 : aa                       tax
10a3 : 28                       plp
10a4 : 8e0502                   stx abst+2
10a7 : 08                       php         ;flags after load/store sequence
10a8 : 49c3                     eor #$c3
10aa : aa                       tax
10ab : e041                     cpx #$41    ;test result
                                trap_ne
10ad : d0fe            >        bne *           ;failed not equal (non zero)
                        
10af : 68                       pla         ;load status
                                eor_flag 0
10b0 : 4930            >            eor #0|fao         ;invert expected flags 
                        
10b2 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
10b5 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
10b7 : a900            >            lda #0             ;allow test to change I
                       >
10b9 : 48              >            pha         ;use stack to load status
10ba : 28              >            plp
                        
10bb : a618                     ldx zp1+3
10bd : 08                       php         ;test stores do not alter flags
10be : 8a                       txa
10bf : 49c3                     eor #$c3
10c1 : aa                       tax
10c2 : 28                       plp
10c3 : 8e0602                   stx abst+3
10c6 : 08                       php         ;flags after load/store sequence
10c7 : 49c3                     eor #$c3
10c9 : aa                       tax
10ca : e000                     cpx #0      ;test result
                                trap_ne
10cc : d0fe            >        bne *           ;failed not equal (non zero)
                        
10ce : 68                       pla         ;load status
                                eor_flag 0
10cf : 4930            >            eor #0|fao         ;invert expected flags 
                        
10d1 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
10d4 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                                set_stat $ff
                       >            load_flag $ff
10d6 : a9ff            >            lda #$ff             ;allow test to change
                       >
10d8 : 48              >            pha         ;use stack to load status
10d9 : 28              >            plp
                        
10da : a615                     ldx zp1  
10dc : 08                       php         ;test stores do not alter flags
10dd : 8a                       txa
10de : 49c3                     eor #$c3
10e0 : aa                       tax
10e1 : 28                       plp
10e2 : 8e0302                   stx abst  
AS65 Assembler for R6502 [1.42].                                     Page   81
-------------------------- 6502_functional_test.a65 --------------------------

10e5 : 08                       php         ;flags after load/store sequence
10e6 : 49c3                     eor #$c3
10e8 : aa                       tax
10e9 : e0c3                     cpx #$c3    ;test result
                                trap_ne     ;
10eb : d0fe            >        bne *           ;failed not equal (non zero)
                        
10ed : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
10ee : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
10f0 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
10f3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
10f5 : a9ff            >            lda #$ff             ;allow test to change
                       >
10f7 : 48              >            pha         ;use stack to load status
10f8 : 28              >            plp
                        
10f9 : a616                     ldx zp1+1
10fb : 08                       php         ;test stores do not alter flags
10fc : 8a                       txa
10fd : 49c3                     eor #$c3
10ff : aa                       tax
1100 : 28                       plp
1101 : 8e0402                   stx abst+1
1104 : 08                       php         ;flags after load/store sequence
1105 : 49c3                     eor #$c3
1107 : aa                       tax
1108 : e082                     cpx #$82    ;test result
                                trap_ne
110a : d0fe            >        bne *           ;failed not equal (non zero)
                        
110c : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
110d : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
110f : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1112 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1114 : a9ff            >            lda #$ff             ;allow test to change
                       >
1116 : 48              >            pha         ;use stack to load status
1117 : 28              >            plp
                        
1118 : a617                     ldx zp1+2
111a : 08                       php         ;test stores do not alter flags
111b : 8a                       txa
111c : 49c3                     eor #$c3
111e : aa                       tax
111f : 28                       plp
1120 : 8e0502                   stx abst+2
1123 : 08                       php         ;flags after load/store sequence
1124 : 49c3                     eor #$c3
1126 : aa                       tax
1127 : e041                     cpx #$41    ;test result
AS65 Assembler for R6502 [1.42].                                     Page   82
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_ne     ;
1129 : d0fe            >        bne *           ;failed not equal (non zero)
                        
112b : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
112c : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
112e : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
1131 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1133 : a9ff            >            lda #$ff             ;allow test to change
                       >
1135 : 48              >            pha         ;use stack to load status
1136 : 28              >            plp
                        
1137 : a618                     ldx zp1+3
1139 : 08                       php         ;test stores do not alter flags
113a : 8a                       txa
113b : 49c3                     eor #$c3
113d : aa                       tax
113e : 28                       plp
113f : 8e0602                   stx abst+3
1142 : 08                       php         ;flags after load/store sequence
1143 : 49c3                     eor #$c3
1145 : aa                       tax
1146 : e000                     cpx #0      ;test result
                                trap_ne
1148 : d0fe            >        bne *           ;failed not equal (non zero)
                        
114a : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
114b : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
114d : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1150 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                                set_stat 0
                       >            load_flag 0
1152 : a900            >            lda #0             ;allow test to change I
                       >
1154 : 48              >            pha         ;use stack to load status
1155 : 28              >            plp
                        
1156 : ae1802                   ldx abs1  
1159 : 08                       php         ;test stores do not alter flags
115a : 8a                       txa
115b : 49c3                     eor #$c3
115d : aa                       tax
115e : 28                       plp
115f : 860c                     stx zpt  
1161 : 08                       php         ;flags after load/store sequence
1162 : 49c3                     eor #$c3
1164 : c515                     cmp zp1     ;test result
                                trap_ne
1166 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1168 : 68                       pla         ;load status
AS65 Assembler for R6502 [1.42].                                     Page   83
-------------------------- 6502_functional_test.a65 --------------------------

                                eor_flag 0
1169 : 4930            >            eor #0|fao         ;invert expected flags 
                        
116b : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
116e : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1170 : a900            >            lda #0             ;allow test to change I
                       >
1172 : 48              >            pha         ;use stack to load status
1173 : 28              >            plp
                        
1174 : ae1902                   ldx abs1+1
1177 : 08                       php         ;test stores do not alter flags
1178 : 8a                       txa
1179 : 49c3                     eor #$c3
117b : aa                       tax
117c : 28                       plp
117d : 860d                     stx zpt+1
117f : 08                       php         ;flags after load/store sequence
1180 : 49c3                     eor #$c3
1182 : c516                     cmp zp1+1   ;test result
                                trap_ne
1184 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1186 : 68                       pla         ;load status
                                eor_flag 0
1187 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1189 : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
118c : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
118e : a900            >            lda #0             ;allow test to change I
                       >
1190 : 48              >            pha         ;use stack to load status
1191 : 28              >            plp
                        
1192 : ae1a02                   ldx abs1+2
1195 : 08                       php         ;test stores do not alter flags
1196 : 8a                       txa
1197 : 49c3                     eor #$c3
1199 : aa                       tax
119a : 28                       plp
119b : 860e                     stx zpt+2
119d : 08                       php         ;flags after load/store sequence
119e : 49c3                     eor #$c3
11a0 : c517                     cmp zp1+2   ;test result
                                trap_ne
11a2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
11a4 : 68                       pla         ;load status
                                eor_flag 0
11a5 : 4930            >            eor #0|fao         ;invert expected flags 
                        
11a7 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
11aa : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page   84
-------------------------- 6502_functional_test.a65 --------------------------

                        
                                set_stat 0
                       >            load_flag 0
11ac : a900            >            lda #0             ;allow test to change I
                       >
11ae : 48              >            pha         ;use stack to load status
11af : 28              >            plp
                        
11b0 : ae1b02                   ldx abs1+3
11b3 : 08                       php         ;test stores do not alter flags
11b4 : 8a                       txa
11b5 : 49c3                     eor #$c3
11b7 : aa                       tax
11b8 : 28                       plp
11b9 : 860f                     stx zpt+3
11bb : 08                       php         ;flags after load/store sequence
11bc : 49c3                     eor #$c3
11be : c518                     cmp zp1+3   ;test result
                                trap_ne
11c0 : d0fe            >        bne *           ;failed not equal (non zero)
                        
11c2 : 68                       pla         ;load status
                                eor_flag 0
11c3 : 4930            >            eor #0|fao         ;invert expected flags 
                        
11c5 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
11c8 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                                set_stat $ff
                       >            load_flag $ff
11ca : a9ff            >            lda #$ff             ;allow test to change
                       >
11cc : 48              >            pha         ;use stack to load status
11cd : 28              >            plp
                        
11ce : ae1802                   ldx abs1  
11d1 : 08                       php         ;test stores do not alter flags
11d2 : 8a                       txa
11d3 : 49c3                     eor #$c3
11d5 : aa                       tax
11d6 : 28                       plp
11d7 : 860c                     stx zpt  
11d9 : 08                       php         ;flags after load/store sequence
11da : 49c3                     eor #$c3
11dc : aa                       tax
11dd : e415                     cpx zp1     ;test result
                                trap_ne
11df : d0fe            >        bne *           ;failed not equal (non zero)
                        
11e1 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
11e2 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
11e4 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
11e7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
11e9 : a9ff            >            lda #$ff             ;allow test to change
AS65 Assembler for R6502 [1.42].                                     Page   85
-------------------------- 6502_functional_test.a65 --------------------------

                       >
11eb : 48              >            pha         ;use stack to load status
11ec : 28              >            plp
                        
11ed : ae1902                   ldx abs1+1
11f0 : 08                       php         ;test stores do not alter flags
11f1 : 8a                       txa
11f2 : 49c3                     eor #$c3
11f4 : aa                       tax
11f5 : 28                       plp
11f6 : 860d                     stx zpt+1
11f8 : 08                       php         ;flags after load/store sequence
11f9 : 49c3                     eor #$c3
11fb : aa                       tax
11fc : e416                     cpx zp1+1   ;test result
                                trap_ne
11fe : d0fe            >        bne *           ;failed not equal (non zero)
                        
1200 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1201 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1203 : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1206 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1208 : a9ff            >            lda #$ff             ;allow test to change
                       >
120a : 48              >            pha         ;use stack to load status
120b : 28              >            plp
                        
120c : ae1a02                   ldx abs1+2
120f : 08                       php         ;test stores do not alter flags
1210 : 8a                       txa
1211 : 49c3                     eor #$c3
1213 : aa                       tax
1214 : 28                       plp
1215 : 860e                     stx zpt+2
1217 : 08                       php         ;flags after load/store sequence
1218 : 49c3                     eor #$c3
121a : aa                       tax
121b : e417                     cpx zp1+2   ;test result
                                trap_ne
121d : d0fe            >        bne *           ;failed not equal (non zero)
                        
121f : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1220 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1222 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
1225 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1227 : a9ff            >            lda #$ff             ;allow test to change
                       >
1229 : 48              >            pha         ;use stack to load status
122a : 28              >            plp
                        
AS65 Assembler for R6502 [1.42].                                     Page   86
-------------------------- 6502_functional_test.a65 --------------------------

122b : ae1b02                   ldx abs1+3
122e : 08                       php         ;test stores do not alter flags
122f : 8a                       txa
1230 : 49c3                     eor #$c3
1232 : aa                       tax
1233 : 28                       plp
1234 : 860f                     stx zpt+3
1236 : 08                       php         ;flags after load/store sequence
1237 : 49c3                     eor #$c3
1239 : aa                       tax
123a : e418                     cpx zp1+3   ;test result
                                trap_ne
123c : d0fe            >        bne *           ;failed not equal (non zero)
                        
123e : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
123f : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1241 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1244 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                                set_stat 0  
                       >            load_flag 0  
1246 : a900            >            lda #0               ;allow test to change
                       >
1248 : 48              >            pha         ;use stack to load status
1249 : 28              >            plp
                        
124a : a2c3                     ldx #$c3
124c : 08                       php
124d : ec1802                   cpx abs1    ;test result
                                trap_ne
1250 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1252 : 68                       pla         ;load status
                                eor_flag 0
1253 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1255 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
1258 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
125a : a900            >            lda #0             ;allow test to change I
                       >
125c : 48              >            pha         ;use stack to load status
125d : 28              >            plp
                        
125e : a282                     ldx #$82
1260 : 08                       php
1261 : ec1902                   cpx abs1+1  ;test result
                                trap_ne
1264 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1266 : 68                       pla         ;load status
                                eor_flag 0
1267 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1269 : cd1e02                   cmp fLDx+1  ;test flags
AS65 Assembler for R6502 [1.42].                                     Page   87
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_ne
126c : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
126e : a900            >            lda #0             ;allow test to change I
                       >
1270 : 48              >            pha         ;use stack to load status
1271 : 28              >            plp
                        
1272 : a241                     ldx #$41
1274 : 08                       php
1275 : ec1a02                   cpx abs1+2  ;test result
                                trap_ne
1278 : d0fe            >        bne *           ;failed not equal (non zero)
                        
127a : 68                       pla         ;load status
                                eor_flag 0
127b : 4930            >            eor #0|fao         ;invert expected flags 
                        
127d : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
1280 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1282 : a900            >            lda #0             ;allow test to change I
                       >
1284 : 48              >            pha         ;use stack to load status
1285 : 28              >            plp
                        
1286 : a200                     ldx #0
1288 : 08                       php
1289 : ec1b02                   cpx abs1+3  ;test result
                                trap_ne
128c : d0fe            >        bne *           ;failed not equal (non zero)
                        
128e : 68                       pla         ;load status
                                eor_flag 0
128f : 4930            >            eor #0|fao         ;invert expected flags 
                        
1291 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1294 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                                set_stat $ff
                       >            load_flag $ff
1296 : a9ff            >            lda #$ff             ;allow test to change
                       >
1298 : 48              >            pha         ;use stack to load status
1299 : 28              >            plp
                        
129a : a2c3                     ldx #$c3  
129c : 08                       php
129d : ec1802                   cpx abs1    ;test result
                                trap_ne
12a0 : d0fe            >        bne *           ;failed not equal (non zero)
                        
12a2 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
12a3 : 497d            >            eor #lo~fnz |fao         ;invert expected 
AS65 Assembler for R6502 [1.42].                                     Page   88
-------------------------- 6502_functional_test.a65 --------------------------

                        
12a5 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
12a8 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
12aa : a9ff            >            lda #$ff             ;allow test to change
                       >
12ac : 48              >            pha         ;use stack to load status
12ad : 28              >            plp
                        
12ae : a282                     ldx #$82
12b0 : 08                       php
12b1 : ec1902                   cpx abs1+1  ;test result
                                trap_ne
12b4 : d0fe            >        bne *           ;failed not equal (non zero)
                        
12b6 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
12b7 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
12b9 : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
12bc : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
12be : a9ff            >            lda #$ff             ;allow test to change
                       >
12c0 : 48              >            pha         ;use stack to load status
12c1 : 28              >            plp
                        
12c2 : a241                     ldx #$41
12c4 : 08                       php
12c5 : ec1a02                   cpx abs1+2  ;test result
                                trap_ne
12c8 : d0fe            >        bne *           ;failed not equal (non zero)
                        
12ca : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
12cb : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
12cd : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
12d0 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
12d2 : a9ff            >            lda #$ff             ;allow test to change
                       >
12d4 : 48              >            pha         ;use stack to load status
12d5 : 28              >            plp
                        
12d6 : a200                     ldx #0
12d8 : 08                       php
12d9 : ec1b02                   cpx abs1+3  ;test result
                                trap_ne
12dc : d0fe            >        bne *           ;failed not equal (non zero)
                        
12de : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
AS65 Assembler for R6502 [1.42].                                     Page   89
-------------------------- 6502_functional_test.a65 --------------------------

12df : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
12e1 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
12e4 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
12e6 : a200                     ldx #0
12e8 : a50c                     lda zpt  
12ea : 49c3                     eor #$c3
12ec : c515                     cmp zp1  
                                trap_ne     ;store to zp data
12ee : d0fe            >        bne *           ;failed not equal (non zero)
                        
12f0 : 860c                     stx zpt     ;clear                
12f2 : ad0302                   lda abst  
12f5 : 49c3                     eor #$c3
12f7 : cd1802                   cmp abs1  
                                trap_ne     ;store to abs data
12fa : d0fe            >        bne *           ;failed not equal (non zero)
                        
12fc : 8e0302                   stx abst    ;clear                
12ff : a50d                     lda zpt+1
1301 : 49c3                     eor #$c3
1303 : c516                     cmp zp1+1
                                trap_ne     ;store to zp data
1305 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1307 : 860d                     stx zpt+1   ;clear                
1309 : ad0402                   lda abst+1
130c : 49c3                     eor #$c3
130e : cd1902                   cmp abs1+1
                                trap_ne     ;store to abs data
1311 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1313 : 8e0402                   stx abst+1  ;clear                
1316 : a50e                     lda zpt+2
1318 : 49c3                     eor #$c3
131a : c517                     cmp zp1+2
                                trap_ne     ;store to zp data
131c : d0fe            >        bne *           ;failed not equal (non zero)
                        
131e : 860e                     stx zpt+2   ;clear                
1320 : ad0502                   lda abst+2
1323 : 49c3                     eor #$c3
1325 : cd1a02                   cmp abs1+2
                                trap_ne     ;store to abs data
1328 : d0fe            >        bne *           ;failed not equal (non zero)
                        
132a : 8e0502                   stx abst+2  ;clear                
132d : a50f                     lda zpt+3
132f : 49c3                     eor #$c3
1331 : c518                     cmp zp1+3
                                trap_ne     ;store to zp data
1333 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1335 : 860f                     stx zpt+3   ;clear                
1337 : ad0602                   lda abst+3
133a : 49c3                     eor #$c3
133c : cd1b02                   cmp abs1+3
                                trap_ne     ;store to abs data
133f : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page   90
-------------------------- 6502_functional_test.a65 --------------------------

                        
1341 : 8e0602                   stx abst+3  ;clear                
                                next_test
1344 : ad0002          >            lda test_case   ;previous test
1347 : c913            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
1349 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0014 =                 >test_num = test_num + 1
134b : a914            >            lda #test_num   ;*** next tests' number
134d : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; LDY / STY - zp / abs / #
                                set_stat 0
                       >            load_flag 0
1350 : a900            >            lda #0             ;allow test to change I
                       >
1352 : 48              >            pha         ;use stack to load status
1353 : 28              >            plp
                        
1354 : a415                     ldy zp1  
1356 : 08                       php         ;test stores do not alter flags
1357 : 98                       tya
1358 : 49c3                     eor #$c3
135a : a8                       tay
135b : 28                       plp
135c : 8c0302                   sty abst  
135f : 08                       php         ;flags after load/store sequence
1360 : 49c3                     eor #$c3
1362 : a8                       tay
1363 : c0c3                     cpy #$c3    ;test result
                                trap_ne
1365 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1367 : 68                       pla         ;load status
                                eor_flag 0
1368 : 4930            >            eor #0|fao         ;invert expected flags 
                        
136a : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
136d : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
136f : a900            >            lda #0             ;allow test to change I
                       >
1371 : 48              >            pha         ;use stack to load status
1372 : 28              >            plp
                        
1373 : a416                     ldy zp1+1
1375 : 08                       php         ;test stores do not alter flags
1376 : 98                       tya
1377 : 49c3                     eor #$c3
1379 : a8                       tay
137a : 28                       plp
137b : 8c0402                   sty abst+1
137e : 08                       php         ;flags after load/store sequence
137f : 49c3                     eor #$c3
1381 : a8                       tay
1382 : c082                     cpy #$82    ;test result
AS65 Assembler for R6502 [1.42].                                     Page   91
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_ne
1384 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1386 : 68                       pla         ;load status
                                eor_flag 0
1387 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1389 : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
138c : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
138e : a900            >            lda #0             ;allow test to change I
                       >
1390 : 48              >            pha         ;use stack to load status
1391 : 28              >            plp
                        
1392 : a417                     ldy zp1+2
1394 : 08                       php         ;test stores do not alter flags
1395 : 98                       tya
1396 : 49c3                     eor #$c3
1398 : a8                       tay
1399 : 28                       plp
139a : 8c0502                   sty abst+2
139d : 08                       php         ;flags after load/store sequence
139e : 49c3                     eor #$c3
13a0 : a8                       tay
13a1 : c041                     cpy #$41    ;test result
                                trap_ne
13a3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
13a5 : 68                       pla         ;load status
                                eor_flag 0
13a6 : 4930            >            eor #0|fao         ;invert expected flags 
                        
13a8 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
13ab : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
13ad : a900            >            lda #0             ;allow test to change I
                       >
13af : 48              >            pha         ;use stack to load status
13b0 : 28              >            plp
                        
13b1 : a418                     ldy zp1+3
13b3 : 08                       php         ;test stores do not alter flags
13b4 : 98                       tya
13b5 : 49c3                     eor #$c3
13b7 : a8                       tay
13b8 : 28                       plp
13b9 : 8c0602                   sty abst+3
13bc : 08                       php         ;flags after load/store sequence
13bd : 49c3                     eor #$c3
13bf : a8                       tay
13c0 : c000                     cpy #0      ;test result
                                trap_ne
13c2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
13c4 : 68                       pla         ;load status
AS65 Assembler for R6502 [1.42].                                     Page   92
-------------------------- 6502_functional_test.a65 --------------------------

                                eor_flag 0
13c5 : 4930            >            eor #0|fao         ;invert expected flags 
                        
13c7 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
13ca : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                                set_stat $ff
                       >            load_flag $ff
13cc : a9ff            >            lda #$ff             ;allow test to change
                       >
13ce : 48              >            pha         ;use stack to load status
13cf : 28              >            plp
                        
13d0 : a415                     ldy zp1  
13d2 : 08                       php         ;test stores do not alter flags
13d3 : 98                       tya
13d4 : 49c3                     eor #$c3
13d6 : a8                       tay
13d7 : 28                       plp
13d8 : 8c0302                   sty abst  
13db : 08                       php         ;flags after load/store sequence
13dc : 49c3                     eor #$c3
13de : a8                       tay
13df : c0c3                     cpy #$c3    ;test result
                                trap_ne
13e1 : d0fe            >        bne *           ;failed not equal (non zero)
                        
13e3 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
13e4 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
13e6 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
13e9 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
13eb : a9ff            >            lda #$ff             ;allow test to change
                       >
13ed : 48              >            pha         ;use stack to load status
13ee : 28              >            plp
                        
13ef : a416                     ldy zp1+1
13f1 : 08                       php         ;test stores do not alter flags
13f2 : 98                       tya
13f3 : 49c3                     eor #$c3
13f5 : a8                       tay
13f6 : 28                       plp
13f7 : 8c0402                   sty abst+1
13fa : 08                       php         ;flags after load/store sequence
13fb : 49c3                     eor #$c3
13fd : a8                       tay
13fe : c082                     cpy #$82   ;test result
                                trap_ne
1400 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1402 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1403 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
AS65 Assembler for R6502 [1.42].                                     Page   93
-------------------------- 6502_functional_test.a65 --------------------------

1405 : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1408 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
140a : a9ff            >            lda #$ff             ;allow test to change
                       >
140c : 48              >            pha         ;use stack to load status
140d : 28              >            plp
                        
140e : a417                     ldy zp1+2
1410 : 08                       php         ;test stores do not alter flags
1411 : 98                       tya
1412 : 49c3                     eor #$c3
1414 : a8                       tay
1415 : 28                       plp
1416 : 8c0502                   sty abst+2
1419 : 08                       php         ;flags after load/store sequence
141a : 49c3                     eor #$c3
141c : a8                       tay
141d : c041                     cpy #$41    ;test result
                                trap_ne
141f : d0fe            >        bne *           ;failed not equal (non zero)
                        
1421 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1422 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1424 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
1427 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1429 : a9ff            >            lda #$ff             ;allow test to change
                       >
142b : 48              >            pha         ;use stack to load status
142c : 28              >            plp
                        
142d : a418                     ldy zp1+3
142f : 08                       php         ;test stores do not alter flags
1430 : 98                       tya
1431 : 49c3                     eor #$c3
1433 : a8                       tay
1434 : 28                       plp
1435 : 8c0602                   sty abst+3
1438 : 08                       php         ;flags after load/store sequence
1439 : 49c3                     eor #$c3
143b : a8                       tay
143c : c000                     cpy #0      ;test result
                                trap_ne
143e : d0fe            >        bne *           ;failed not equal (non zero)
                        
1440 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1441 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1443 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1446 : d0fe            >        bne *           ;failed not equal (non zero)
                        
AS65 Assembler for R6502 [1.42].                                     Page   94
-------------------------- 6502_functional_test.a65 --------------------------

                                
                                set_stat 0
                       >            load_flag 0
1448 : a900            >            lda #0             ;allow test to change I
                       >
144a : 48              >            pha         ;use stack to load status
144b : 28              >            plp
                        
144c : ac1802                   ldy abs1  
144f : 08                       php         ;test stores do not alter flags
1450 : 98                       tya
1451 : 49c3                     eor #$c3
1453 : a8                       tay
1454 : 28                       plp
1455 : 840c                     sty zpt  
1457 : 08                       php         ;flags after load/store sequence
1458 : 49c3                     eor #$c3
145a : a8                       tay
145b : c415                     cpy zp1     ;test result
                                trap_ne
145d : d0fe            >        bne *           ;failed not equal (non zero)
                        
145f : 68                       pla         ;load status
                                eor_flag 0
1460 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1462 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
1465 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1467 : a900            >            lda #0             ;allow test to change I
                       >
1469 : 48              >            pha         ;use stack to load status
146a : 28              >            plp
                        
146b : ac1902                   ldy abs1+1
146e : 08                       php         ;test stores do not alter flags
146f : 98                       tya
1470 : 49c3                     eor #$c3
1472 : a8                       tay
1473 : 28                       plp
1474 : 840d                     sty zpt+1
1476 : 08                       php         ;flags after load/store sequence
1477 : 49c3                     eor #$c3
1479 : a8                       tay
147a : c416                     cpy zp1+1   ;test result
                                trap_ne
147c : d0fe            >        bne *           ;failed not equal (non zero)
                        
147e : 68                       pla         ;load status
                                eor_flag 0
147f : 4930            >            eor #0|fao         ;invert expected flags 
                        
1481 : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1484 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1486 : a900            >            lda #0             ;allow test to change I
AS65 Assembler for R6502 [1.42].                                     Page   95
-------------------------- 6502_functional_test.a65 --------------------------

                       >
1488 : 48              >            pha         ;use stack to load status
1489 : 28              >            plp
                        
148a : ac1a02                   ldy abs1+2
148d : 08                       php         ;test stores do not alter flags
148e : 98                       tya
148f : 49c3                     eor #$c3
1491 : a8                       tay
1492 : 28                       plp
1493 : 840e                     sty zpt+2
1495 : 08                       php         ;flags after load/store sequence
1496 : 49c3                     eor #$c3
1498 : a8                       tay
1499 : c417                     cpy zp1+2   ;test result
                                trap_ne
149b : d0fe            >        bne *           ;failed not equal (non zero)
                        
149d : 68                       pla         ;load status
                                eor_flag 0
149e : 4930            >            eor #0|fao         ;invert expected flags 
                        
14a0 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
14a3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
14a5 : a900            >            lda #0             ;allow test to change I
                       >
14a7 : 48              >            pha         ;use stack to load status
14a8 : 28              >            plp
                        
14a9 : ac1b02                   ldy abs1+3
14ac : 08                       php         ;test stores do not alter flags
14ad : 98                       tya
14ae : 49c3                     eor #$c3
14b0 : a8                       tay
14b1 : 28                       plp
14b2 : 840f                     sty zpt+3
14b4 : 08                       php         ;flags after load/store sequence
14b5 : 49c3                     eor #$c3
14b7 : a8                       tay
14b8 : c418                     cpy zp1+3   ;test result
                                trap_ne
14ba : d0fe            >        bne *           ;failed not equal (non zero)
                        
14bc : 68                       pla         ;load status
                                eor_flag 0
14bd : 4930            >            eor #0|fao         ;invert expected flags 
                        
14bf : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
14c2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                                set_stat $ff
                       >            load_flag $ff
14c4 : a9ff            >            lda #$ff             ;allow test to change
                       >
14c6 : 48              >            pha         ;use stack to load status
14c7 : 28              >            plp
AS65 Assembler for R6502 [1.42].                                     Page   96
-------------------------- 6502_functional_test.a65 --------------------------

                        
14c8 : ac1802                   ldy abs1  
14cb : 08                       php         ;test stores do not alter flags
14cc : 98                       tya
14cd : 49c3                     eor #$c3
14cf : a8                       tay
14d0 : 28                       plp
14d1 : 840c                     sty zpt  
14d3 : 08                       php         ;flags after load/store sequence
14d4 : 49c3                     eor #$c3
14d6 : a8                       tay
14d7 : c515                     cmp zp1     ;test result
                                trap_ne
14d9 : d0fe            >        bne *           ;failed not equal (non zero)
                        
14db : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
14dc : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
14de : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
14e1 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
14e3 : a9ff            >            lda #$ff             ;allow test to change
                       >
14e5 : 48              >            pha         ;use stack to load status
14e6 : 28              >            plp
                        
14e7 : ac1902                   ldy abs1+1
14ea : 08                       php         ;test stores do not alter flags
14eb : 98                       tya
14ec : 49c3                     eor #$c3
14ee : a8                       tay
14ef : 28                       plp
14f0 : 840d                     sty zpt+1
14f2 : 08                       php         ;flags after load/store sequence
14f3 : 49c3                     eor #$c3
14f5 : a8                       tay
14f6 : c516                     cmp zp1+1   ;test result
                                trap_ne
14f8 : d0fe            >        bne *           ;failed not equal (non zero)
                        
14fa : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
14fb : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
14fd : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1500 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1502 : a9ff            >            lda #$ff             ;allow test to change
                       >
1504 : 48              >            pha         ;use stack to load status
1505 : 28              >            plp
                        
1506 : ac1a02                   ldy abs1+2
1509 : 08                       php         ;test stores do not alter flags
150a : 98                       tya
AS65 Assembler for R6502 [1.42].                                     Page   97
-------------------------- 6502_functional_test.a65 --------------------------

150b : 49c3                     eor #$c3
150d : a8                       tay
150e : 28                       plp
150f : 840e                     sty zpt+2
1511 : 08                       php         ;flags after load/store sequence
1512 : 49c3                     eor #$c3
1514 : a8                       tay
1515 : c517                     cmp zp1+2   ;test result
                                trap_ne
1517 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1519 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
151a : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
151c : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
151f : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1521 : a9ff            >            lda #$ff             ;allow test to change
                       >
1523 : 48              >            pha         ;use stack to load status
1524 : 28              >            plp
                        
1525 : ac1b02                   ldy abs1+3
1528 : 08                       php         ;test stores do not alter flags
1529 : 98                       tya
152a : 49c3                     eor #$c3
152c : a8                       tay
152d : 28                       plp
152e : 840f                     sty zpt+3
1530 : 08                       php         ;flags after load/store sequence
1531 : 49c3                     eor #$c3
1533 : a8                       tay
1534 : c518                     cmp zp1+3   ;test result
                                trap_ne
1536 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1538 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1539 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
153b : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
153e : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                        
                                set_stat 0
                       >            load_flag 0
1540 : a900            >            lda #0             ;allow test to change I
                       >
1542 : 48              >            pha         ;use stack to load status
1543 : 28              >            plp
                        
1544 : a0c3                     ldy #$c3  
1546 : 08                       php
1547 : cc1802                   cpy abs1    ;test result
                                trap_ne
154a : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page   98
-------------------------- 6502_functional_test.a65 --------------------------

                        
154c : 68                       pla         ;load status
                                eor_flag 0
154d : 4930            >            eor #0|fao         ;invert expected flags 
                        
154f : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
1552 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1554 : a900            >            lda #0             ;allow test to change I
                       >
1556 : 48              >            pha         ;use stack to load status
1557 : 28              >            plp
                        
1558 : a082                     ldy #$82
155a : 08                       php
155b : cc1902                   cpy abs1+1  ;test result
                                trap_ne
155e : d0fe            >        bne *           ;failed not equal (non zero)
                        
1560 : 68                       pla         ;load status
                                eor_flag 0
1561 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1563 : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1566 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1568 : a900            >            lda #0             ;allow test to change I
                       >
156a : 48              >            pha         ;use stack to load status
156b : 28              >            plp
                        
156c : a041                     ldy #$41
156e : 08                       php
156f : cc1a02                   cpy abs1+2  ;test result
                                trap_ne
1572 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1574 : 68                       pla         ;load status
                                eor_flag 0
1575 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1577 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
157a : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
157c : a900            >            lda #0             ;allow test to change I
                       >
157e : 48              >            pha         ;use stack to load status
157f : 28              >            plp
                        
1580 : a000                     ldy #0
1582 : 08                       php
1583 : cc1b02                   cpy abs1+3  ;test result
                                trap_ne
AS65 Assembler for R6502 [1.42].                                     Page   99
-------------------------- 6502_functional_test.a65 --------------------------

1586 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1588 : 68                       pla         ;load status
                                eor_flag 0
1589 : 4930            >            eor #0|fao         ;invert expected flags 
                        
158b : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
158e : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                                set_stat $ff
                       >            load_flag $ff
1590 : a9ff            >            lda #$ff             ;allow test to change
                       >
1592 : 48              >            pha         ;use stack to load status
1593 : 28              >            plp
                        
1594 : a0c3                     ldy #$c3  
1596 : 08                       php
1597 : cc1802                   cpy abs1    ;test result
                                trap_ne
159a : d0fe            >        bne *           ;failed not equal (non zero)
                        
159c : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
159d : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
159f : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
15a2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
15a4 : a9ff            >            lda #$ff             ;allow test to change
                       >
15a6 : 48              >            pha         ;use stack to load status
15a7 : 28              >            plp
                        
15a8 : a082                     ldy #$82
15aa : 08                       php
15ab : cc1902                   cpy abs1+1  ;test result
                                trap_ne
15ae : d0fe            >        bne *           ;failed not equal (non zero)
                        
15b0 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
15b1 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
15b3 : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
15b6 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
15b8 : a9ff            >            lda #$ff             ;allow test to change
                       >
15ba : 48              >            pha         ;use stack to load status
15bb : 28              >            plp
                        
15bc : a041                     ldy #$41
15be : 08                       php
AS65 Assembler for R6502 [1.42].                                     Page  100
-------------------------- 6502_functional_test.a65 --------------------------

15bf : cc1a02                   cpy abs1+2   ;test result
                                trap_ne
15c2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
15c4 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
15c5 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
15c7 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
15ca : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
15cc : a9ff            >            lda #$ff             ;allow test to change
                       >
15ce : 48              >            pha         ;use stack to load status
15cf : 28              >            plp
                        
15d0 : a000                     ldy #0
15d2 : 08                       php
15d3 : cc1b02                   cpy abs1+3  ;test result
                                trap_ne
15d6 : d0fe            >        bne *           ;failed not equal (non zero)
                        
15d8 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
15d9 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
15db : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
15de : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                
15e0 : a000                     ldy #0
15e2 : a50c                     lda zpt  
15e4 : 49c3                     eor #$c3
15e6 : c515                     cmp zp1  
                                trap_ne     ;store to zp   data
15e8 : d0fe            >        bne *           ;failed not equal (non zero)
                        
15ea : 840c                     sty zpt     ;clear                
15ec : ad0302                   lda abst  
15ef : 49c3                     eor #$c3
15f1 : cd1802                   cmp abs1  
                                trap_ne     ;store to abs   data
15f4 : d0fe            >        bne *           ;failed not equal (non zero)
                        
15f6 : 8c0302                   sty abst    ;clear                
15f9 : a50d                     lda zpt+1
15fb : 49c3                     eor #$c3
15fd : c516                     cmp zp1+1
                                trap_ne     ;store to zp+1 data
15ff : d0fe            >        bne *           ;failed not equal (non zero)
                        
1601 : 840d                     sty zpt+1   ;clear                
1603 : ad0402                   lda abst+1
1606 : 49c3                     eor #$c3
1608 : cd1902                   cmp abs1+1
                                trap_ne     ;store to abs+1 data
160b : d0fe            >        bne *           ;failed not equal (non zero)
                        
AS65 Assembler for R6502 [1.42].                                     Page  101
-------------------------- 6502_functional_test.a65 --------------------------

160d : 8c0402                   sty abst+1  ;clear                
1610 : a50e                     lda zpt+2
1612 : 49c3                     eor #$c3
1614 : c517                     cmp zp1+2
                                trap_ne     ;store to zp+2 data
1616 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1618 : 840e                     sty zpt+2   ;clear                
161a : ad0502                   lda abst+2
161d : 49c3                     eor #$c3
161f : cd1a02                   cmp abs1+2
                                trap_ne     ;store to abs+2 data
1622 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1624 : 8c0502                   sty abst+2  ;clear                
1627 : a50f                     lda zpt+3
1629 : 49c3                     eor #$c3
162b : c518                     cmp zp1+3
                                trap_ne     ;store to zp+3 data
162d : d0fe            >        bne *           ;failed not equal (non zero)
                        
162f : 840f                     sty zpt+3   ;clear                
1631 : ad0602                   lda abst+3
1634 : 49c3                     eor #$c3
1636 : cd1b02                   cmp abs1+3
                                trap_ne     ;store to abs+3 data
1639 : d0fe            >        bne *           ;failed not equal (non zero)
                        
163b : 8c0602                   sty abst+3  ;clear                
                                next_test
163e : ad0002          >            lda test_case   ;previous test
1641 : c914            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
1643 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0015 =                 >test_num = test_num + 1
1645 : a915            >            lda #test_num   ;*** next tests' number
1647 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; testing load / store accumulator LDA / STA all addre
                        ; LDA / STA - zp,x / abs,x
164a : a203                     ldx #3
164c :                  tldax    
                                set_stat 0
                       >            load_flag 0
164c : a900            >            lda #0             ;allow test to change I
                       >
164e : 48              >            pha         ;use stack to load status
164f : 28              >            plp
                        
1650 : b515                     lda zp1,x
1652 : 08                       php         ;test stores do not alter flags
1653 : 49c3                     eor #$c3
1655 : 28                       plp
1656 : 9d0302                   sta abst,x
1659 : 08                       php         ;flags after load/store sequence
165a : 49c3                     eor #$c3
165c : dd1802                   cmp abs1,x  ;test result
                                trap_ne
165f : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  102
-------------------------- 6502_functional_test.a65 --------------------------

                        
1661 : 68                       pla         ;load status
                                eor_flag 0
1662 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1664 : dd1d02                   cmp fLDx,x  ;test flags
                                trap_ne
1667 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1669 : ca                       dex
166a : 10e0                     bpl tldax                  
                        
166c : a203                     ldx #3
166e :                  tldax1   
                                set_stat $ff
                       >            load_flag $ff
166e : a9ff            >            lda #$ff             ;allow test to change
                       >
1670 : 48              >            pha         ;use stack to load status
1671 : 28              >            plp
                        
1672 : b515                     lda zp1,x
1674 : 08                       php         ;test stores do not alter flags
1675 : 49c3                     eor #$c3
1677 : 28                       plp
1678 : 9d0302                   sta abst,x
167b : 08                       php         ;flags after load/store sequence
167c : 49c3                     eor #$c3
167e : dd1802                   cmp abs1,x   ;test result
                                trap_ne
1681 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1683 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1684 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1686 : dd1d02                   cmp fLDx,x  ;test flags
                                trap_ne
1689 : d0fe            >        bne *           ;failed not equal (non zero)
                        
168b : ca                       dex
168c : 10e0                     bpl tldax1                  
                        
168e : a203                     ldx #3
1690 :                  tldax2   
                                set_stat 0
                       >            load_flag 0
1690 : a900            >            lda #0             ;allow test to change I
                       >
1692 : 48              >            pha         ;use stack to load status
1693 : 28              >            plp
                        
1694 : bd1802                   lda abs1,x
1697 : 08                       php         ;test stores do not alter flags
1698 : 49c3                     eor #$c3
169a : 28                       plp
169b : 950c                     sta zpt,x
169d : 08                       php         ;flags after load/store sequence
169e : 49c3                     eor #$c3
16a0 : d515                     cmp zp1,x   ;test result
                                trap_ne
16a2 : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  103
-------------------------- 6502_functional_test.a65 --------------------------

                        
16a4 : 68                       pla         ;load status
                                eor_flag 0
16a5 : 4930            >            eor #0|fao         ;invert expected flags 
                        
16a7 : dd1d02                   cmp fLDx,x  ;test flags
                                trap_ne
16aa : d0fe            >        bne *           ;failed not equal (non zero)
                        
16ac : ca                       dex
16ad : 10e1                     bpl tldax2                  
                        
16af : a203                     ldx #3
16b1 :                  tldax3
                                set_stat $ff
                       >            load_flag $ff
16b1 : a9ff            >            lda #$ff             ;allow test to change
                       >
16b3 : 48              >            pha         ;use stack to load status
16b4 : 28              >            plp
                        
16b5 : bd1802                   lda abs1,x
16b8 : 08                       php         ;test stores do not alter flags
16b9 : 49c3                     eor #$c3
16bb : 28                       plp
16bc : 950c                     sta zpt,x
16be : 08                       php         ;flags after load/store sequence
16bf : 49c3                     eor #$c3
16c1 : d515                     cmp zp1,x   ;test result
                                trap_ne
16c3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
16c5 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
16c6 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
16c8 : dd1d02                   cmp fLDx,x  ;test flags
                                trap_ne
16cb : d0fe            >        bne *           ;failed not equal (non zero)
                        
16cd : ca                       dex
16ce : 10e1                     bpl tldax3
                        
16d0 : a203                     ldx #3      ;testing store result
16d2 : a000                     ldy #0
16d4 : b50c             tstax   lda zpt,x
16d6 : 49c3                     eor #$c3
16d8 : d515                     cmp zp1,x
                                trap_ne     ;store to zp,x data
16da : d0fe            >        bne *           ;failed not equal (non zero)
                        
16dc : 940c                     sty zpt,x   ;clear                
16de : bd0302                   lda abst,x
16e1 : 49c3                     eor #$c3
16e3 : dd1802                   cmp abs1,x
                                trap_ne     ;store to abs,x data
16e6 : d0fe            >        bne *           ;failed not equal (non zero)
                        
16e8 : 8a                       txa
16e9 : 9d0302                   sta abst,x  ;clear                
16ec : ca                       dex
16ed : 10e5                     bpl tstax
AS65 Assembler for R6502 [1.42].                                     Page  104
-------------------------- 6502_functional_test.a65 --------------------------

                                next_test
16ef : ad0002          >            lda test_case   ;previous test
16f2 : c915            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
16f4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0016 =                 >test_num = test_num + 1
16f6 : a916            >            lda #test_num   ;*** next tests' number
16f8 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; LDA / STA - (zp),y / abs,y / (zp,x)
16fb : a003                     ldy #3
16fd :                  tlday    
                                set_stat 0
                       >            load_flag 0
16fd : a900            >            lda #0             ;allow test to change I
                       >
16ff : 48              >            pha         ;use stack to load status
1700 : 28              >            plp
                        
1701 : b126                     lda (ind1),y
1703 : 08                       php         ;test stores do not alter flags
1704 : 49c3                     eor #$c3
1706 : 28                       plp
1707 : 990302                   sta abst,y
170a : 08                       php         ;flags after load/store sequence
170b : 49c3                     eor #$c3
170d : d91802                   cmp abs1,y  ;test result
                                trap_ne
1710 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1712 : 68                       pla         ;load status
                                eor_flag 0
1713 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1715 : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
1718 : d0fe            >        bne *           ;failed not equal (non zero)
                        
171a : 88                       dey
171b : 10e0                     bpl tlday                  
                        
171d : a003                     ldy #3
171f :                  tlday1   
                                set_stat $ff
                       >            load_flag $ff
171f : a9ff            >            lda #$ff             ;allow test to change
                       >
1721 : 48              >            pha         ;use stack to load status
1722 : 28              >            plp
                        
1723 : b126                     lda (ind1),y
1725 : 08                       php         ;test stores do not alter flags
1726 : 49c3                     eor #$c3
1728 : 28                       plp
1729 : 990302                   sta abst,y
172c : 08                       php         ;flags after load/store sequence
172d : 49c3                     eor #$c3
172f : d91802                   cmp abs1,y  ;test result
                                trap_ne
AS65 Assembler for R6502 [1.42].                                     Page  105
-------------------------- 6502_functional_test.a65 --------------------------

1732 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1734 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1735 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1737 : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
173a : d0fe            >        bne *           ;failed not equal (non zero)
                        
173c : 88                       dey
173d : 10e0                     bpl tlday1                  
                        
173f : a003                     ldy #3      ;testing store result
1741 : a200                     ldx #0
1743 : b90302           tstay   lda abst,y
1746 : 49c3                     eor #$c3
1748 : d91802                   cmp abs1,y
                                trap_ne     ;store to abs data
174b : d0fe            >        bne *           ;failed not equal (non zero)
                        
174d : 8a                       txa
174e : 990302                   sta abst,y  ;clear                
1751 : 88                       dey
1752 : 10ef                     bpl tstay
                        
1754 : a003                     ldy #3
1756 :                  tlday2   
                                set_stat 0
                       >            load_flag 0
1756 : a900            >            lda #0             ;allow test to change I
                       >
1758 : 48              >            pha         ;use stack to load status
1759 : 28              >            plp
                        
175a : b91802                   lda abs1,y
175d : 08                       php         ;test stores do not alter flags
175e : 49c3                     eor #$c3
1760 : 28                       plp
1761 : 9132                     sta (indt),y
1763 : 08                       php         ;flags after load/store sequence
1764 : 49c3                     eor #$c3
1766 : d126                     cmp (ind1),y    ;test result
                                trap_ne
1768 : d0fe            >        bne *           ;failed not equal (non zero)
                        
176a : 68                       pla         ;load status
                                eor_flag 0
176b : 4930            >            eor #0|fao         ;invert expected flags 
                        
176d : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
1770 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1772 : 88                       dey
1773 : 10e1                     bpl tlday2                  
                        
1775 : a003                     ldy #3
1777 :                  tlday3   
                                set_stat $ff
                       >            load_flag $ff
1777 : a9ff            >            lda #$ff             ;allow test to change
AS65 Assembler for R6502 [1.42].                                     Page  106
-------------------------- 6502_functional_test.a65 --------------------------

                       >
1779 : 48              >            pha         ;use stack to load status
177a : 28              >            plp
                        
177b : b91802                   lda abs1,y
177e : 08                       php         ;test stores do not alter flags
177f : 49c3                     eor #$c3
1781 : 28                       plp
1782 : 9132                     sta (indt),y
1784 : 08                       php         ;flags after load/store sequence
1785 : 49c3                     eor #$c3
1787 : d126                     cmp (ind1),y   ;test result
                                trap_ne
1789 : d0fe            >        bne *           ;failed not equal (non zero)
                        
178b : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
178c : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
178e : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
1791 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1793 : 88                       dey
1794 : 10e1                     bpl tlday3
                                
1796 : a003                     ldy #3      ;testing store result
1798 : a200                     ldx #0
179a : b90302           tstay1  lda abst,y
179d : 49c3                     eor #$c3
179f : d91802                   cmp abs1,y
                                trap_ne     ;store to abs data
17a2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
17a4 : 8a                       txa
17a5 : 990302                   sta abst,y  ;clear                
17a8 : 88                       dey
17a9 : 10ef                     bpl tstay1
                                
17ab : a206                     ldx #6
17ad : a003                     ldy #3
17af :                  tldax4   
                                set_stat 0
                       >            load_flag 0
17af : a900            >            lda #0             ;allow test to change I
                       >
17b1 : 48              >            pha         ;use stack to load status
17b2 : 28              >            plp
                        
17b3 : a126                     lda (ind1,x)
17b5 : 08                       php         ;test stores do not alter flags
17b6 : 49c3                     eor #$c3
17b8 : 28                       plp
17b9 : 8132                     sta (indt,x)
17bb : 08                       php         ;flags after load/store sequence
17bc : 49c3                     eor #$c3
17be : d91802                   cmp abs1,y  ;test result
                                trap_ne
17c1 : d0fe            >        bne *           ;failed not equal (non zero)
                        
17c3 : 68                       pla         ;load status
                                eor_flag 0
AS65 Assembler for R6502 [1.42].                                     Page  107
-------------------------- 6502_functional_test.a65 --------------------------

17c4 : 4930            >            eor #0|fao         ;invert expected flags 
                        
17c6 : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
17c9 : d0fe            >        bne *           ;failed not equal (non zero)
                        
17cb : ca                       dex
17cc : ca                       dex
17cd : 88                       dey
17ce : 10df                     bpl tldax4                  
                        
17d0 : a206                     ldx #6
17d2 : a003                     ldy #3
17d4 :                  tldax5
                                set_stat $ff
                       >            load_flag $ff
17d4 : a9ff            >            lda #$ff             ;allow test to change
                       >
17d6 : 48              >            pha         ;use stack to load status
17d7 : 28              >            plp
                        
17d8 : a126                     lda (ind1,x)
17da : 08                       php         ;test stores do not alter flags
17db : 49c3                     eor #$c3
17dd : 28                       plp
17de : 8132                     sta (indt,x)
17e0 : 08                       php         ;flags after load/store sequence
17e1 : 49c3                     eor #$c3
17e3 : d91802                   cmp abs1,y  ;test result
                                trap_ne
17e6 : d0fe            >        bne *           ;failed not equal (non zero)
                        
17e8 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
17e9 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
17eb : d91d02                   cmp fLDx,y  ;test flags
                                trap_ne
17ee : d0fe            >        bne *           ;failed not equal (non zero)
                        
17f0 : ca                       dex
17f1 : ca                       dex
17f2 : 88                       dey
17f3 : 10df                     bpl tldax5
                        
17f5 : a003                     ldy #3      ;testing store result
17f7 : a200                     ldx #0
17f9 : b90302           tstay2  lda abst,y
17fc : 49c3                     eor #$c3
17fe : d91802                   cmp abs1,y
                                trap_ne     ;store to abs data
1801 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1803 : 8a                       txa
1804 : 990302                   sta abst,y  ;clear                
1807 : 88                       dey
1808 : 10ef                     bpl tstay2
                                next_test
180a : ad0002          >            lda test_case   ;previous test
180d : c916            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
180f : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  108
-------------------------- 6502_functional_test.a65 --------------------------

                       >
0017 =                 >test_num = test_num + 1
1811 : a917            >            lda #test_num   ;*** next tests' number
1813 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; indexed wraparound test (only zp should wrap)
1816 : a2fd                     ldx #3+$fa
1818 : b51b             tldax6  lda zp1-$fa&$ff,x   ;wrap on indexed zp
181a : 9d0901                   sta abst-$fa,x      ;no STX abs,x!
181d : ca                       dex
181e : e0fa                     cpx #$fa
1820 : b0f6                     bcs tldax6                  
1822 : a2fd                     ldx #3+$fa
1824 : bd1e01           tldax7  lda abs1-$fa,x      ;no wrap on indexed abs
1827 : 9512                     sta zpt-$fa&$ff,x
1829 : ca                       dex
182a : e0fa                     cpx #$fa
182c : b0f6                     bcs tldax7
                                                  
182e : a203                     ldx #3      ;testing wraparound result
1830 : a000                     ldy #0
1832 : b50c             tstax1  lda zpt,x
1834 : d515                     cmp zp1,x
                                trap_ne     ;store to zp,x data
1836 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1838 : 940c                     sty zpt,x   ;clear                
183a : bd0302                   lda abst,x
183d : dd1802                   cmp abs1,x
                                trap_ne     ;store to abs,x data
1840 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1842 : 8a                       txa
1843 : 9d0302                   sta abst,x  ;clear                
1846 : ca                       dex
1847 : 10e9                     bpl tstax1
                        
1849 : a0fb                     ldy #3+$f8
184b : a2fe                     ldx #6+$f8
184d : a12e             tlday4  lda (ind1-$f8&$ff,x) ;wrap on indexed zp indir
184f : 990b01                   sta abst-$f8,y
1852 : ca                       dex
1853 : ca                       dex
1854 : 88                       dey
1855 : c0f8                     cpy #$f8
1857 : b0f4                     bcs tlday4
1859 : a003                     ldy #3      ;testing wraparound result
185b : a200                     ldx #0
185d : b90302           tstay4  lda abst,y
1860 : d91802                   cmp abs1,y
                                trap_ne     ;store to abs data
1863 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1865 : 8a                       txa
1866 : 990302                   sta abst,y  ;clear                
1869 : 88                       dey
186a : 10f1                     bpl tstay4
                                
186c : a0fb                     ldy #3+$f8
186e : b92001           tlday5  lda abs1-$f8,y  ;no wrap on indexed abs
AS65 Assembler for R6502 [1.42].                                     Page  109
-------------------------- 6502_functional_test.a65 --------------------------

1871 : 913a                     sta (inwt),y
1873 : 88                       dey
1874 : c0f8                     cpy #$f8
1876 : b0f6                     bcs tlday5                  
1878 : a003                     ldy #3      ;testing wraparound result
187a : a200                     ldx #0
187c : b90302           tstay5  lda abst,y
187f : d91802                   cmp abs1,y
                                trap_ne     ;store to abs data
1882 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1884 : 8a                       txa
1885 : 990302                   sta abst,y  ;clear                
1888 : 88                       dey
1889 : 10f1                     bpl tstay5
                        
188b : a0fb                     ldy #3+$f8
188d : a2fe                     ldx #6+$f8
188f : b130             tlday6  lda (inw1),y    ;no wrap on zp indirect indexe
1891 : 813a                     sta (indt-$f8&$ff,x)
1893 : ca                       dex
1894 : ca                       dex
1895 : 88                       dey
1896 : c0f8                     cpy #$f8
1898 : b0f5                     bcs tlday6
189a : a003                     ldy #3      ;testing wraparound result
189c : a200                     ldx #0
189e : b90302           tstay6  lda abst,y
18a1 : d91802                   cmp abs1,y
                                trap_ne     ;store to abs data
18a4 : d0fe            >        bne *           ;failed not equal (non zero)
                        
18a6 : 8a                       txa
18a7 : 990302                   sta abst,y  ;clear                
18aa : 88                       dey
18ab : 10f1                     bpl tstay6
                                next_test
18ad : ad0002          >            lda test_case   ;previous test
18b0 : c917            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
18b2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0018 =                 >test_num = test_num + 1
18b4 : a918            >            lda #test_num   ;*** next tests' number
18b6 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; LDA / STA - zp / abs / #
                                set_stat 0  
                       >            load_flag 0  
18b9 : a900            >            lda #0               ;allow test to change
                       >
18bb : 48              >            pha         ;use stack to load status
18bc : 28              >            plp
                        
18bd : a515                     lda zp1
18bf : 08                       php         ;test stores do not alter flags
18c0 : 49c3                     eor #$c3
18c2 : 28                       plp
18c3 : 8d0302                   sta abst
18c6 : 08                       php         ;flags after load/store sequence
AS65 Assembler for R6502 [1.42].                                     Page  110
-------------------------- 6502_functional_test.a65 --------------------------

18c7 : 49c3                     eor #$c3
18c9 : c9c3                     cmp #$c3    ;test result
                                trap_ne
18cb : d0fe            >        bne *           ;failed not equal (non zero)
                        
18cd : 68                       pla         ;load status
                                eor_flag 0
18ce : 4930            >            eor #0|fao         ;invert expected flags 
                        
18d0 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
18d3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
18d5 : a900            >            lda #0             ;allow test to change I
                       >
18d7 : 48              >            pha         ;use stack to load status
18d8 : 28              >            plp
                        
18d9 : a516                     lda zp1+1
18db : 08                       php         ;test stores do not alter flags
18dc : 49c3                     eor #$c3
18de : 28                       plp
18df : 8d0402                   sta abst+1
18e2 : 08                       php         ;flags after load/store sequence
18e3 : 49c3                     eor #$c3
18e5 : c982                     cmp #$82    ;test result
                                trap_ne
18e7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
18e9 : 68                       pla         ;load status
                                eor_flag 0
18ea : 4930            >            eor #0|fao         ;invert expected flags 
                        
18ec : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
18ef : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
18f1 : a900            >            lda #0             ;allow test to change I
                       >
18f3 : 48              >            pha         ;use stack to load status
18f4 : 28              >            plp
                        
18f5 : a517                     lda zp1+2
18f7 : 08                       php         ;test stores do not alter flags
18f8 : 49c3                     eor #$c3
18fa : 28                       plp
18fb : 8d0502                   sta abst+2
18fe : 08                       php         ;flags after load/store sequence
18ff : 49c3                     eor #$c3
1901 : c941                     cmp #$41    ;test result
                                trap_ne
1903 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1905 : 68                       pla         ;load status
                                eor_flag 0
1906 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1908 : cd1f02                   cmp fLDx+2  ;test flags
AS65 Assembler for R6502 [1.42].                                     Page  111
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_ne
190b : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
190d : a900            >            lda #0             ;allow test to change I
                       >
190f : 48              >            pha         ;use stack to load status
1910 : 28              >            plp
                        
1911 : a518                     lda zp1+3
1913 : 08                       php         ;test stores do not alter flags
1914 : 49c3                     eor #$c3
1916 : 28                       plp
1917 : 8d0602                   sta abst+3
191a : 08                       php         ;flags after load/store sequence
191b : 49c3                     eor #$c3
191d : c900                     cmp #0      ;test result
                                trap_ne
191f : d0fe            >        bne *           ;failed not equal (non zero)
                        
1921 : 68                       pla         ;load status
                                eor_flag 0
1922 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1924 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1927 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1929 : a9ff            >            lda #$ff             ;allow test to change
                       >
192b : 48              >            pha         ;use stack to load status
192c : 28              >            plp
                        
192d : a515                     lda zp1  
192f : 08                       php         ;test stores do not alter flags
1930 : 49c3                     eor #$c3
1932 : 28                       plp
1933 : 8d0302                   sta abst  
1936 : 08                       php         ;flags after load/store sequence
1937 : 49c3                     eor #$c3
1939 : c9c3                     cmp #$c3    ;test result
                                trap_ne
193b : d0fe            >        bne *           ;failed not equal (non zero)
                        
193d : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
193e : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1940 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
1943 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1945 : a9ff            >            lda #$ff             ;allow test to change
                       >
1947 : 48              >            pha         ;use stack to load status
1948 : 28              >            plp
                        
AS65 Assembler for R6502 [1.42].                                     Page  112
-------------------------- 6502_functional_test.a65 --------------------------

1949 : a516                     lda zp1+1
194b : 08                       php         ;test stores do not alter flags
194c : 49c3                     eor #$c3
194e : 28                       plp
194f : 8d0402                   sta abst+1
1952 : 08                       php         ;flags after load/store sequence
1953 : 49c3                     eor #$c3
1955 : c982                     cmp #$82    ;test result
                                trap_ne
1957 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1959 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
195a : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
195c : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
195f : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1961 : a9ff            >            lda #$ff             ;allow test to change
                       >
1963 : 48              >            pha         ;use stack to load status
1964 : 28              >            plp
                        
1965 : a517                     lda zp1+2
1967 : 08                       php         ;test stores do not alter flags
1968 : 49c3                     eor #$c3
196a : 28                       plp
196b : 8d0502                   sta abst+2
196e : 08                       php         ;flags after load/store sequence
196f : 49c3                     eor #$c3
1971 : c941                     cmp #$41    ;test result
                                trap_ne
1973 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1975 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1976 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1978 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
197b : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
197d : a9ff            >            lda #$ff             ;allow test to change
                       >
197f : 48              >            pha         ;use stack to load status
1980 : 28              >            plp
                        
1981 : a518                     lda zp1+3
1983 : 08                       php         ;test stores do not alter flags
1984 : 49c3                     eor #$c3
1986 : 28                       plp
1987 : 8d0602                   sta abst+3
198a : 08                       php         ;flags after load/store sequence
198b : 49c3                     eor #$c3
198d : c900                     cmp #0      ;test result
                                trap_ne
198f : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  113
-------------------------- 6502_functional_test.a65 --------------------------

                        
1991 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1992 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1994 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1997 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1999 : a900            >            lda #0             ;allow test to change I
                       >
199b : 48              >            pha         ;use stack to load status
199c : 28              >            plp
                        
199d : ad1802                   lda abs1  
19a0 : 08                       php         ;test stores do not alter flags
19a1 : 49c3                     eor #$c3
19a3 : 28                       plp
19a4 : 850c                     sta zpt  
19a6 : 08                       php         ;flags after load/store sequence
19a7 : 49c3                     eor #$c3
19a9 : c515                     cmp zp1     ;test result
                                trap_ne
19ab : d0fe            >        bne *           ;failed not equal (non zero)
                        
19ad : 68                       pla         ;load status
                                eor_flag 0
19ae : 4930            >            eor #0|fao         ;invert expected flags 
                        
19b0 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
19b3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
19b5 : a900            >            lda #0             ;allow test to change I
                       >
19b7 : 48              >            pha         ;use stack to load status
19b8 : 28              >            plp
                        
19b9 : ad1902                   lda abs1+1
19bc : 08                       php         ;test stores do not alter flags
19bd : 49c3                     eor #$c3
19bf : 28                       plp
19c0 : 850d                     sta zpt+1
19c2 : 08                       php         ;flags after load/store sequence
19c3 : 49c3                     eor #$c3
19c5 : c516                     cmp zp1+1   ;test result
                                trap_ne
19c7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
19c9 : 68                       pla         ;load status
                                eor_flag 0
19ca : 4930            >            eor #0|fao         ;invert expected flags 
                        
19cc : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
19cf : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
AS65 Assembler for R6502 [1.42].                                     Page  114
-------------------------- 6502_functional_test.a65 --------------------------

                       >            load_flag 0
19d1 : a900            >            lda #0             ;allow test to change I
                       >
19d3 : 48              >            pha         ;use stack to load status
19d4 : 28              >            plp
                        
19d5 : ad1a02                   lda abs1+2
19d8 : 08                       php         ;test stores do not alter flags
19d9 : 49c3                     eor #$c3
19db : 28                       plp
19dc : 850e                     sta zpt+2
19de : 08                       php         ;flags after load/store sequence
19df : 49c3                     eor #$c3
19e1 : c517                     cmp zp1+2   ;test result
                                trap_ne
19e3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
19e5 : 68                       pla         ;load status
                                eor_flag 0
19e6 : 4930            >            eor #0|fao         ;invert expected flags 
                        
19e8 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
19eb : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
19ed : a900            >            lda #0             ;allow test to change I
                       >
19ef : 48              >            pha         ;use stack to load status
19f0 : 28              >            plp
                        
19f1 : ad1b02                   lda abs1+3
19f4 : 08                       php         ;test stores do not alter flags
19f5 : 49c3                     eor #$c3
19f7 : 28                       plp
19f8 : 850f                     sta zpt+3
19fa : 08                       php         ;flags after load/store sequence
19fb : 49c3                     eor #$c3
19fd : c518                     cmp zp1+3   ;test result
                                trap_ne
19ff : d0fe            >        bne *           ;failed not equal (non zero)
                        
1a01 : 68                       pla         ;load status
                                eor_flag 0
1a02 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1a04 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1a07 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1a09 : a9ff            >            lda #$ff             ;allow test to change
                       >
1a0b : 48              >            pha         ;use stack to load status
1a0c : 28              >            plp
                        
1a0d : ad1802                   lda abs1  
1a10 : 08                       php         ;test stores do not alter flags
1a11 : 49c3                     eor #$c3
1a13 : 28                       plp
AS65 Assembler for R6502 [1.42].                                     Page  115
-------------------------- 6502_functional_test.a65 --------------------------

1a14 : 850c                     sta zpt  
1a16 : 08                       php         ;flags after load/store sequence
1a17 : 49c3                     eor #$c3
1a19 : c515                     cmp zp1     ;test result
                                trap_ne
1a1b : d0fe            >        bne *           ;failed not equal (non zero)
                        
1a1d : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1a1e : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1a20 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
1a23 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1a25 : a9ff            >            lda #$ff             ;allow test to change
                       >
1a27 : 48              >            pha         ;use stack to load status
1a28 : 28              >            plp
                        
1a29 : ad1902                   lda abs1+1
1a2c : 08                       php         ;test stores do not alter flags
1a2d : 49c3                     eor #$c3
1a2f : 28                       plp
1a30 : 850d                     sta zpt+1
1a32 : 08                       php         ;flags after load/store sequence
1a33 : 49c3                     eor #$c3
1a35 : c516                     cmp zp1+1   ;test result
                                trap_ne
1a37 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1a39 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1a3a : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1a3c : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1a3f : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1a41 : a9ff            >            lda #$ff             ;allow test to change
                       >
1a43 : 48              >            pha         ;use stack to load status
1a44 : 28              >            plp
                        
1a45 : ad1a02                   lda abs1+2
1a48 : 08                       php         ;test stores do not alter flags
1a49 : 49c3                     eor #$c3
1a4b : 28                       plp
1a4c : 850e                     sta zpt+2
1a4e : 08                       php         ;flags after load/store sequence
1a4f : 49c3                     eor #$c3
1a51 : c517                     cmp zp1+2   ;test result
                                trap_ne
1a53 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1a55 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1a56 : 497d            >            eor #lo~fnz |fao         ;invert expected 
AS65 Assembler for R6502 [1.42].                                     Page  116
-------------------------- 6502_functional_test.a65 --------------------------

                        
1a58 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
1a5b : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1a5d : a9ff            >            lda #$ff             ;allow test to change
                       >
1a5f : 48              >            pha         ;use stack to load status
1a60 : 28              >            plp
                        
1a61 : ad1b02                   lda abs1+3
1a64 : 08                       php         ;test stores do not alter flags
1a65 : 49c3                     eor #$c3
1a67 : 28                       plp
1a68 : 850f                     sta zpt+3
1a6a : 08                       php         ;flags after load/store sequence
1a6b : 49c3                     eor #$c3
1a6d : c518                     cmp zp1+3   ;test result
                                trap_ne
1a6f : d0fe            >        bne *           ;failed not equal (non zero)
                        
1a71 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1a72 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1a74 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1a77 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0  
                       >            load_flag 0  
1a79 : a900            >            lda #0               ;allow test to change
                       >
1a7b : 48              >            pha         ;use stack to load status
1a7c : 28              >            plp
                        
1a7d : a9c3                     lda #$c3
1a7f : 08                       php
1a80 : cd1802                   cmp abs1    ;test result
                                trap_ne
1a83 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1a85 : 68                       pla         ;load status
                                eor_flag 0
1a86 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1a88 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
1a8b : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1a8d : a900            >            lda #0             ;allow test to change I
                       >
1a8f : 48              >            pha         ;use stack to load status
1a90 : 28              >            plp
                        
1a91 : a982                     lda #$82
1a93 : 08                       php
1a94 : cd1902                   cmp abs1+1  ;test result
AS65 Assembler for R6502 [1.42].                                     Page  117
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_ne
1a97 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1a99 : 68                       pla         ;load status
                                eor_flag 0
1a9a : 4930            >            eor #0|fao         ;invert expected flags 
                        
1a9c : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1a9f : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1aa1 : a900            >            lda #0             ;allow test to change I
                       >
1aa3 : 48              >            pha         ;use stack to load status
1aa4 : 28              >            plp
                        
1aa5 : a941                     lda #$41
1aa7 : 08                       php
1aa8 : cd1a02                   cmp abs1+2  ;test result
                                trap_ne
1aab : d0fe            >        bne *           ;failed not equal (non zero)
                        
1aad : 68                       pla         ;load status
                                eor_flag 0
1aae : 4930            >            eor #0|fao         ;invert expected flags 
                        
1ab0 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
1ab3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat 0
                       >            load_flag 0
1ab5 : a900            >            lda #0             ;allow test to change I
                       >
1ab7 : 48              >            pha         ;use stack to load status
1ab8 : 28              >            plp
                        
1ab9 : a900                     lda #0
1abb : 08                       php
1abc : cd1b02                   cmp abs1+3  ;test result
                                trap_ne
1abf : d0fe            >        bne *           ;failed not equal (non zero)
                        
1ac1 : 68                       pla         ;load status
                                eor_flag 0
1ac2 : 4930            >            eor #0|fao         ;invert expected flags 
                        
1ac4 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1ac7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
                                set_stat $ff
                       >            load_flag $ff
1ac9 : a9ff            >            lda #$ff             ;allow test to change
                       >
1acb : 48              >            pha         ;use stack to load status
1acc : 28              >            plp
                        
1acd : a9c3                     lda #$c3  
AS65 Assembler for R6502 [1.42].                                     Page  118
-------------------------- 6502_functional_test.a65 --------------------------

1acf : 08                       php
1ad0 : cd1802                   cmp abs1    ;test result
                                trap_ne
1ad3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1ad5 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1ad6 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1ad8 : cd1d02                   cmp fLDx    ;test flags
                                trap_ne
1adb : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1add : a9ff            >            lda #$ff             ;allow test to change
                       >
1adf : 48              >            pha         ;use stack to load status
1ae0 : 28              >            plp
                        
1ae1 : a982                     lda #$82
1ae3 : 08                       php
1ae4 : cd1902                   cmp abs1+1  ;test result
                                trap_ne
1ae7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1ae9 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1aea : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1aec : cd1e02                   cmp fLDx+1  ;test flags
                                trap_ne
1aef : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1af1 : a9ff            >            lda #$ff             ;allow test to change
                       >
1af3 : 48              >            pha         ;use stack to load status
1af4 : 28              >            plp
                        
1af5 : a941                     lda #$41
1af7 : 08                       php
1af8 : cd1a02                   cmp abs1+2  ;test result
                                trap_ne
1afb : d0fe            >        bne *           ;failed not equal (non zero)
                        
1afd : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1afe : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1b00 : cd1f02                   cmp fLDx+2  ;test flags
                                trap_ne
1b03 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
1b05 : a9ff            >            lda #$ff             ;allow test to change
                       >
1b07 : 48              >            pha         ;use stack to load status
1b08 : 28              >            plp
                        
AS65 Assembler for R6502 [1.42].                                     Page  119
-------------------------- 6502_functional_test.a65 --------------------------

1b09 : a900                     lda #0
1b0b : 08                       php
1b0c : cd1b02                   cmp abs1+3  ;test result
                                trap_ne
1b0f : d0fe            >        bne *           ;failed not equal (non zero)
                        
1b11 : 68                       pla         ;load status
                                eor_flag lo~fnz ;mask bits not altered
1b12 : 497d            >            eor #lo~fnz |fao         ;invert expected 
                        
1b14 : cd2002                   cmp fLDx+3  ;test flags
                                trap_ne
1b17 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                        
1b19 : a200                     ldx #0
1b1b : a50c                     lda zpt  
1b1d : 49c3                     eor #$c3
1b1f : c515                     cmp zp1  
                                trap_ne     ;store to zp data
1b21 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1b23 : 860c                     stx zpt     ;clear                
1b25 : ad0302                   lda abst  
1b28 : 49c3                     eor #$c3
1b2a : cd1802                   cmp abs1  
                                trap_ne     ;store to abs data
1b2d : d0fe            >        bne *           ;failed not equal (non zero)
                        
1b2f : 8e0302                   stx abst    ;clear                
1b32 : a50d                     lda zpt+1
1b34 : 49c3                     eor #$c3
1b36 : c516                     cmp zp1+1
                                trap_ne     ;store to zp data
1b38 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1b3a : 860d                     stx zpt+1   ;clear                
1b3c : ad0402                   lda abst+1
1b3f : 49c3                     eor #$c3
1b41 : cd1902                   cmp abs1+1
                                trap_ne     ;store to abs data
1b44 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1b46 : 8e0402                   stx abst+1  ;clear                
1b49 : a50e                     lda zpt+2
1b4b : 49c3                     eor #$c3
1b4d : c517                     cmp zp1+2
                                trap_ne     ;store to zp data
1b4f : d0fe            >        bne *           ;failed not equal (non zero)
                        
1b51 : 860e                     stx zpt+2   ;clear                
1b53 : ad0502                   lda abst+2
1b56 : 49c3                     eor #$c3
1b58 : cd1a02                   cmp abs1+2
                                trap_ne     ;store to abs data
1b5b : d0fe            >        bne *           ;failed not equal (non zero)
                        
1b5d : 8e0502                   stx abst+2  ;clear                
1b60 : a50f                     lda zpt+3
1b62 : 49c3                     eor #$c3
1b64 : c518                     cmp zp1+3
                                trap_ne     ;store to zp data
AS65 Assembler for R6502 [1.42].                                     Page  120
-------------------------- 6502_functional_test.a65 --------------------------

1b66 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1b68 : 860f                     stx zpt+3   ;clear                
1b6a : ad0602                   lda abst+3
1b6d : 49c3                     eor #$c3
1b6f : cd1b02                   cmp abs1+3
                                trap_ne     ;store to abs data
1b72 : d0fe            >        bne *           ;failed not equal (non zero)
                        
1b74 : 8e0602                   stx abst+3  ;clear                
                                next_test
1b77 : ad0002          >            lda test_case   ;previous test
1b7a : c918            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
1b7c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0019 =                 >test_num = test_num + 1
1b7e : a919            >            lda #test_num   ;*** next tests' number
1b80 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; testing bit test & compares BIT CPX CPY CMP all addr
                        ; BIT - zp / abs
                                set_a $ff,0
                       >            load_flag 0
1b83 : a900            >            lda #0             ;allow test to change I
                       >
1b85 : 48              >            pha         ;use stack to load status
1b86 : a9ff            >            lda #$ff     ;precharge accu
1b88 : 28              >            plp
                        
1b89 : 2418                     bit zp1+3   ;00 - should set Z / clear  NV
                                tst_a $ff,fz 
1b8b : 08              >            php         ;save flags
1b8c : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
1b8e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1b90 : 68              >            pla         ;load status
1b91 : 48              >            pha
                       >            cmp_flag fz 
1b92 : c932            >            cmp #(fz |fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1b94 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1b96 : 28              >            plp         ;restore status
                        
                                set_a 1,0
                       >            load_flag 0
1b97 : a900            >            lda #0             ;allow test to change I
                       >
1b99 : 48              >            pha         ;use stack to load status
1b9a : a901            >            lda #1     ;precharge accu
1b9c : 28              >            plp
                        
1b9d : 2417                     bit zp1+2   ;41 - should set V (M6) / clear NZ
                                tst_a 1,fv
1b9f : 08              >            php         ;save flags
1ba0 : c901            >            cmp #1     ;test result
                       >            trap_ne
AS65 Assembler for R6502 [1.42].                                     Page  121
-------------------------- 6502_functional_test.a65 --------------------------

1ba2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ba4 : 68              >            pla         ;load status
1ba5 : 48              >            pha
                       >            cmp_flag fv
1ba6 : c970            >            cmp #(fv|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1ba8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1baa : 28              >            plp         ;restore status
                        
                                set_a 1,0
                       >            load_flag 0
1bab : a900            >            lda #0             ;allow test to change I
                       >
1bad : 48              >            pha         ;use stack to load status
1bae : a901            >            lda #1     ;precharge accu
1bb0 : 28              >            plp
                        
1bb1 : 2416                     bit zp1+1   ;82 - should set N (M7) & Z / clea
                                tst_a 1,fnz
1bb3 : 08              >            php         ;save flags
1bb4 : c901            >            cmp #1     ;test result
                       >            trap_ne
1bb6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1bb8 : 68              >            pla         ;load status
1bb9 : 48              >            pha
                       >            cmp_flag fnz
1bba : c9b2            >            cmp #(fnz|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1bbc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1bbe : 28              >            plp         ;restore status
                        
                                set_a 1,0
                       >            load_flag 0
1bbf : a900            >            lda #0             ;allow test to change I
                       >
1bc1 : 48              >            pha         ;use stack to load status
1bc2 : a901            >            lda #1     ;precharge accu
1bc4 : 28              >            plp
                        
1bc5 : 2415                     bit zp1     ;c3 - should set N (M7) & V (M6) /
                                tst_a 1,fnv
1bc7 : 08              >            php         ;save flags
1bc8 : c901            >            cmp #1     ;test result
                       >            trap_ne
1bca : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1bcc : 68              >            pla         ;load status
1bcd : 48              >            pha
                       >            cmp_flag fnv
1bce : c9f0            >            cmp #(fnv|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1bd0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1bd2 : 28              >            plp         ;restore status
                        
AS65 Assembler for R6502 [1.42].                                     Page  122
-------------------------- 6502_functional_test.a65 --------------------------

                                
                                set_a $ff,$ff
                       >            load_flag $ff
1bd3 : a9ff            >            lda #$ff             ;allow test to change
                       >
1bd5 : 48              >            pha         ;use stack to load status
1bd6 : a9ff            >            lda #$ff     ;precharge accu
1bd8 : 28              >            plp
                        
1bd9 : 2418                     bit zp1+3   ;00 - should set Z / clear  NV
                                tst_a $ff,~fnv 
1bdb : 08              >            php         ;save flags
1bdc : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
1bde : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1be0 : 68              >            pla         ;load status
1be1 : 48              >            pha
                       >            cmp_flag ~fnv 
1be2 : c93f            >            cmp #(~fnv |fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
1be4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1be6 : 28              >            plp         ;restore status
                        
                                set_a 1,$ff
                       >            load_flag $ff
1be7 : a9ff            >            lda #$ff             ;allow test to change
                       >
1be9 : 48              >            pha         ;use stack to load status
1bea : a901            >            lda #1     ;precharge accu
1bec : 28              >            plp
                        
1bed : 2417                     bit zp1+2   ;41 - should set V (M6) / clear NZ
                                tst_a 1,~fnz
1bef : 08              >            php         ;save flags
1bf0 : c901            >            cmp #1     ;test result
                       >            trap_ne
1bf2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1bf4 : 68              >            pla         ;load status
1bf5 : 48              >            pha
                       >            cmp_flag ~fnz
1bf6 : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1bf8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1bfa : 28              >            plp         ;restore status
                        
                                set_a 1,$ff
                       >            load_flag $ff
1bfb : a9ff            >            lda #$ff             ;allow test to change
                       >
1bfd : 48              >            pha         ;use stack to load status
1bfe : a901            >            lda #1     ;precharge accu
1c00 : 28              >            plp
                        
1c01 : 2416                     bit zp1+1   ;82 - should set N (M7) & Z / clea
                                tst_a 1,~fv
1c03 : 08              >            php         ;save flags
AS65 Assembler for R6502 [1.42].                                     Page  123
-------------------------- 6502_functional_test.a65 --------------------------

1c04 : c901            >            cmp #1     ;test result
                       >            trap_ne
1c06 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c08 : 68              >            pla         ;load status
1c09 : 48              >            pha
                       >            cmp_flag ~fv
1c0a : c9bf            >            cmp #(~fv|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1c0c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c0e : 28              >            plp         ;restore status
                        
                                set_a 1,$ff
                       >            load_flag $ff
1c0f : a9ff            >            lda #$ff             ;allow test to change
                       >
1c11 : 48              >            pha         ;use stack to load status
1c12 : a901            >            lda #1     ;precharge accu
1c14 : 28              >            plp
                        
1c15 : 2415                     bit zp1     ;c3 - should set N (M7) & V (M6) /
                                tst_a 1,~fz
1c17 : 08              >            php         ;save flags
1c18 : c901            >            cmp #1     ;test result
                       >            trap_ne
1c1a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c1c : 68              >            pla         ;load status
1c1d : 48              >            pha
                       >            cmp_flag ~fz
1c1e : c9fd            >            cmp #(~fz|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1c20 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c22 : 28              >            plp         ;restore status
                        
                                
                                set_a $ff,0
                       >            load_flag 0
1c23 : a900            >            lda #0             ;allow test to change I
                       >
1c25 : 48              >            pha         ;use stack to load status
1c26 : a9ff            >            lda #$ff     ;precharge accu
1c28 : 28              >            plp
                        
1c29 : 2c1b02                   bit abs1+3  ;00 - should set Z / clear  NV
                                tst_a $ff,fz 
1c2c : 08              >            php         ;save flags
1c2d : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
1c2f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c31 : 68              >            pla         ;load status
1c32 : 48              >            pha
                       >            cmp_flag fz 
1c33 : c932            >            cmp #(fz |fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1c35 : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  124
-------------------------- 6502_functional_test.a65 --------------------------

                       >
1c37 : 28              >            plp         ;restore status
                        
                                set_a 1,0
                       >            load_flag 0
1c38 : a900            >            lda #0             ;allow test to change I
                       >
1c3a : 48              >            pha         ;use stack to load status
1c3b : a901            >            lda #1     ;precharge accu
1c3d : 28              >            plp
                        
1c3e : 2c1a02                   bit abs1+2  ;41 - should set V (M6) / clear NZ
                                tst_a 1,fv
1c41 : 08              >            php         ;save flags
1c42 : c901            >            cmp #1     ;test result
                       >            trap_ne
1c44 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c46 : 68              >            pla         ;load status
1c47 : 48              >            pha
                       >            cmp_flag fv
1c48 : c970            >            cmp #(fv|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1c4a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c4c : 28              >            plp         ;restore status
                        
                                set_a 1,0
                       >            load_flag 0
1c4d : a900            >            lda #0             ;allow test to change I
                       >
1c4f : 48              >            pha         ;use stack to load status
1c50 : a901            >            lda #1     ;precharge accu
1c52 : 28              >            plp
                        
1c53 : 2c1902                   bit abs1+1  ;82 - should set N (M7) & Z / clea
                                tst_a 1,fnz
1c56 : 08              >            php         ;save flags
1c57 : c901            >            cmp #1     ;test result
                       >            trap_ne
1c59 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c5b : 68              >            pla         ;load status
1c5c : 48              >            pha
                       >            cmp_flag fnz
1c5d : c9b2            >            cmp #(fnz|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1c5f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c61 : 28              >            plp         ;restore status
                        
                                set_a 1,0
                       >            load_flag 0
1c62 : a900            >            lda #0             ;allow test to change I
                       >
1c64 : 48              >            pha         ;use stack to load status
1c65 : a901            >            lda #1     ;precharge accu
1c67 : 28              >            plp
                        
1c68 : 2c1802                   bit abs1    ;c3 - should set N (M7) & V (M6) /
AS65 Assembler for R6502 [1.42].                                     Page  125
-------------------------- 6502_functional_test.a65 --------------------------

                                tst_a 1,fnv
1c6b : 08              >            php         ;save flags
1c6c : c901            >            cmp #1     ;test result
                       >            trap_ne
1c6e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c70 : 68              >            pla         ;load status
1c71 : 48              >            pha
                       >            cmp_flag fnv
1c72 : c9f0            >            cmp #(fnv|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1c74 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c76 : 28              >            plp         ;restore status
                        
                                
                                set_a $ff,$ff
                       >            load_flag $ff
1c77 : a9ff            >            lda #$ff             ;allow test to change
                       >
1c79 : 48              >            pha         ;use stack to load status
1c7a : a9ff            >            lda #$ff     ;precharge accu
1c7c : 28              >            plp
                        
1c7d : 2c1b02                   bit abs1+3  ;00 - should set Z / clear  NV
                                tst_a $ff,~fnv 
1c80 : 08              >            php         ;save flags
1c81 : c9ff            >            cmp #$ff     ;test result
                       >            trap_ne
1c83 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c85 : 68              >            pla         ;load status
1c86 : 48              >            pha
                       >            cmp_flag ~fnv 
1c87 : c93f            >            cmp #(~fnv |fao)&m8    ;expected flags + a
                       >
                       >            trap_ne
1c89 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c8b : 28              >            plp         ;restore status
                        
                                set_a 1,$ff
                       >            load_flag $ff
1c8c : a9ff            >            lda #$ff             ;allow test to change
                       >
1c8e : 48              >            pha         ;use stack to load status
1c8f : a901            >            lda #1     ;precharge accu
1c91 : 28              >            plp
                        
1c92 : 2c1a02                   bit abs1+2  ;41 - should set V (M6) / clear NZ
                                tst_a 1,~fnz
1c95 : 08              >            php         ;save flags
1c96 : c901            >            cmp #1     ;test result
                       >            trap_ne
1c98 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1c9a : 68              >            pla         ;load status
1c9b : 48              >            pha
                       >            cmp_flag ~fnz
1c9c : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
AS65 Assembler for R6502 [1.42].                                     Page  126
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
1c9e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ca0 : 28              >            plp         ;restore status
                        
                                set_a 1,$ff
                       >            load_flag $ff
1ca1 : a9ff            >            lda #$ff             ;allow test to change
                       >
1ca3 : 48              >            pha         ;use stack to load status
1ca4 : a901            >            lda #1     ;precharge accu
1ca6 : 28              >            plp
                        
1ca7 : 2c1902                   bit abs1+1  ;82 - should set N (M7) & Z / clea
                                tst_a 1,~fv
1caa : 08              >            php         ;save flags
1cab : c901            >            cmp #1     ;test result
                       >            trap_ne
1cad : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1caf : 68              >            pla         ;load status
1cb0 : 48              >            pha
                       >            cmp_flag ~fv
1cb1 : c9bf            >            cmp #(~fv|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1cb3 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1cb5 : 28              >            plp         ;restore status
                        
                                set_a 1,$ff
                       >            load_flag $ff
1cb6 : a9ff            >            lda #$ff             ;allow test to change
                       >
1cb8 : 48              >            pha         ;use stack to load status
1cb9 : a901            >            lda #1     ;precharge accu
1cbb : 28              >            plp
                        
1cbc : 2c1802                   bit abs1    ;c3 - should set N (M7) & V (M6) /
                                tst_a 1,~fz
1cbf : 08              >            php         ;save flags
1cc0 : c901            >            cmp #1     ;test result
                       >            trap_ne
1cc2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1cc4 : 68              >            pla         ;load status
1cc5 : 48              >            pha
                       >            cmp_flag ~fz
1cc6 : c9fd            >            cmp #(~fz|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1cc8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1cca : 28              >            plp         ;restore status
                        
                                next_test
1ccb : ad0002          >            lda test_case   ;previous test
1cce : c919            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
1cd0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
001a =                 >test_num = test_num + 1
AS65 Assembler for R6502 [1.42].                                     Page  127
-------------------------- 6502_functional_test.a65 --------------------------

1cd2 : a91a            >            lda #test_num   ;*** next tests' number
1cd4 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                                
                        ; CPX - zp / abs / #         
                                set_x $80,0
                       >            load_flag 0
1cd7 : a900            >            lda #0             ;allow test to change I
                       >
1cd9 : 48              >            pha         ;use stack to load status
1cda : a280            >            ldx #$80     ;precharge index x
1cdc : 28              >            plp
                        
1cdd : e419                     cpx zp7f
                                tst_stat fc
1cdf : 08              >            php         ;save status
1ce0 : 68              >            pla         ;use stack to retrieve status
1ce1 : 48              >            pha
                       >            cmp_flag fc
1ce2 : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1ce4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ce6 : 28              >            plp         ;restore status
                        
1ce7 : ca                       dex
1ce8 : e419                     cpx zp7f
                                tst_stat fzc
1cea : 08              >            php         ;save status
1ceb : 68              >            pla         ;use stack to retrieve status
1cec : 48              >            pha
                       >            cmp_flag fzc
1ced : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1cef : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1cf1 : 28              >            plp         ;restore status
                        
1cf2 : ca                       dex
1cf3 : e419                     cpx zp7f
                                tst_x $7e,fn
1cf5 : 08              >            php         ;save flags
1cf6 : e07e            >            cpx #$7e     ;test result
                       >            trap_ne
1cf8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1cfa : 68              >            pla         ;load status
1cfb : 48              >            pha
                       >            cmp_flag fn
1cfc : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1cfe : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d00 : 28              >            plp         ;restore status
                        
                                set_x $80,$ff
                       >            load_flag $ff
1d01 : a9ff            >            lda #$ff             ;allow test to change
AS65 Assembler for R6502 [1.42].                                     Page  128
-------------------------- 6502_functional_test.a65 --------------------------

                       >
1d03 : 48              >            pha         ;use stack to load status
1d04 : a280            >            ldx #$80     ;precharge index x
1d06 : 28              >            plp
                        
1d07 : e419                     cpx zp7f
                                tst_stat ~fnz
1d09 : 08              >            php         ;save status
1d0a : 68              >            pla         ;use stack to retrieve status
1d0b : 48              >            pha
                       >            cmp_flag ~fnz
1d0c : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1d0e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d10 : 28              >            plp         ;restore status
                        
1d11 : ca                       dex
1d12 : e419                     cpx zp7f
                                tst_stat ~fn
1d14 : 08              >            php         ;save status
1d15 : 68              >            pla         ;use stack to retrieve status
1d16 : 48              >            pha
                       >            cmp_flag ~fn
1d17 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1d19 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d1b : 28              >            plp         ;restore status
                        
1d1c : ca                       dex
1d1d : e419                     cpx zp7f
                                tst_x $7e,~fzc
1d1f : 08              >            php         ;save flags
1d20 : e07e            >            cpx #$7e     ;test result
                       >            trap_ne
1d22 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d24 : 68              >            pla         ;load status
1d25 : 48              >            pha
                       >            cmp_flag ~fzc
1d26 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1d28 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d2a : 28              >            plp         ;restore status
                        
                        
                                set_x $80,0
                       >            load_flag 0
1d2b : a900            >            lda #0             ;allow test to change I
                       >
1d2d : 48              >            pha         ;use stack to load status
1d2e : a280            >            ldx #$80     ;precharge index x
1d30 : 28              >            plp
                        
1d31 : ec1c02                   cpx abs7f
                                tst_stat fc
1d34 : 08              >            php         ;save status
AS65 Assembler for R6502 [1.42].                                     Page  129
-------------------------- 6502_functional_test.a65 --------------------------

1d35 : 68              >            pla         ;use stack to retrieve status
1d36 : 48              >            pha
                       >            cmp_flag fc
1d37 : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1d39 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d3b : 28              >            plp         ;restore status
                        
1d3c : ca                       dex
1d3d : ec1c02                   cpx abs7f
                                tst_stat fzc
1d40 : 08              >            php         ;save status
1d41 : 68              >            pla         ;use stack to retrieve status
1d42 : 48              >            pha
                       >            cmp_flag fzc
1d43 : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1d45 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d47 : 28              >            plp         ;restore status
                        
1d48 : ca                       dex
1d49 : ec1c02                   cpx abs7f
                                tst_x $7e,fn
1d4c : 08              >            php         ;save flags
1d4d : e07e            >            cpx #$7e     ;test result
                       >            trap_ne
1d4f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d51 : 68              >            pla         ;load status
1d52 : 48              >            pha
                       >            cmp_flag fn
1d53 : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1d55 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d57 : 28              >            plp         ;restore status
                        
                                set_x $80,$ff
                       >            load_flag $ff
1d58 : a9ff            >            lda #$ff             ;allow test to change
                       >
1d5a : 48              >            pha         ;use stack to load status
1d5b : a280            >            ldx #$80     ;precharge index x
1d5d : 28              >            plp
                        
1d5e : ec1c02                   cpx abs7f
                                tst_stat ~fnz
1d61 : 08              >            php         ;save status
1d62 : 68              >            pla         ;use stack to retrieve status
1d63 : 48              >            pha
                       >            cmp_flag ~fnz
1d64 : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1d66 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d68 : 28              >            plp         ;restore status
AS65 Assembler for R6502 [1.42].                                     Page  130
-------------------------- 6502_functional_test.a65 --------------------------

                        
1d69 : ca                       dex
1d6a : ec1c02                   cpx abs7f
                                tst_stat ~fn
1d6d : 08              >            php         ;save status
1d6e : 68              >            pla         ;use stack to retrieve status
1d6f : 48              >            pha
                       >            cmp_flag ~fn
1d70 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1d72 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d74 : 28              >            plp         ;restore status
                        
1d75 : ca                       dex
1d76 : ec1c02                   cpx abs7f
                                tst_x $7e,~fzc
1d79 : 08              >            php         ;save flags
1d7a : e07e            >            cpx #$7e     ;test result
                       >            trap_ne
1d7c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d7e : 68              >            pla         ;load status
1d7f : 48              >            pha
                       >            cmp_flag ~fzc
1d80 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1d82 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d84 : 28              >            plp         ;restore status
                        
                        
                                set_x $80,0
                       >            load_flag 0
1d85 : a900            >            lda #0             ;allow test to change I
                       >
1d87 : 48              >            pha         ;use stack to load status
1d88 : a280            >            ldx #$80     ;precharge index x
1d8a : 28              >            plp
                        
1d8b : e07f                     cpx #$7f
                                tst_stat fc
1d8d : 08              >            php         ;save status
1d8e : 68              >            pla         ;use stack to retrieve status
1d8f : 48              >            pha
                       >            cmp_flag fc
1d90 : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1d92 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d94 : 28              >            plp         ;restore status
                        
1d95 : ca                       dex
1d96 : e07f                     cpx #$7f
                                tst_stat fzc
1d98 : 08              >            php         ;save status
1d99 : 68              >            pla         ;use stack to retrieve status
1d9a : 48              >            pha
                       >            cmp_flag fzc
AS65 Assembler for R6502 [1.42].                                     Page  131
-------------------------- 6502_functional_test.a65 --------------------------

1d9b : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1d9d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1d9f : 28              >            plp         ;restore status
                        
1da0 : ca                       dex
1da1 : e07f                     cpx #$7f
                                tst_x $7e,fn
1da3 : 08              >            php         ;save flags
1da4 : e07e            >            cpx #$7e     ;test result
                       >            trap_ne
1da6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1da8 : 68              >            pla         ;load status
1da9 : 48              >            pha
                       >            cmp_flag fn
1daa : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1dac : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1dae : 28              >            plp         ;restore status
                        
                                set_x $80,$ff
                       >            load_flag $ff
1daf : a9ff            >            lda #$ff             ;allow test to change
                       >
1db1 : 48              >            pha         ;use stack to load status
1db2 : a280            >            ldx #$80     ;precharge index x
1db4 : 28              >            plp
                        
1db5 : e07f                     cpx #$7f
                                tst_stat ~fnz
1db7 : 08              >            php         ;save status
1db8 : 68              >            pla         ;use stack to retrieve status
1db9 : 48              >            pha
                       >            cmp_flag ~fnz
1dba : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1dbc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1dbe : 28              >            plp         ;restore status
                        
1dbf : ca                       dex
1dc0 : e07f                     cpx #$7f
                                tst_stat ~fn
1dc2 : 08              >            php         ;save status
1dc3 : 68              >            pla         ;use stack to retrieve status
1dc4 : 48              >            pha
                       >            cmp_flag ~fn
1dc5 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1dc7 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1dc9 : 28              >            plp         ;restore status
                        
1dca : ca                       dex
1dcb : e07f                     cpx #$7f
AS65 Assembler for R6502 [1.42].                                     Page  132
-------------------------- 6502_functional_test.a65 --------------------------

                                tst_x $7e,~fzc
1dcd : 08              >            php         ;save flags
1dce : e07e            >            cpx #$7e     ;test result
                       >            trap_ne
1dd0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1dd2 : 68              >            pla         ;load status
1dd3 : 48              >            pha
                       >            cmp_flag ~fzc
1dd4 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1dd6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1dd8 : 28              >            plp         ;restore status
                        
                                next_test
1dd9 : ad0002          >            lda test_case   ;previous test
1ddc : c91a            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
1dde : d0fe            >        bne *           ;failed not equal (non zero)
                       >
001b =                 >test_num = test_num + 1
1de0 : a91b            >            lda #test_num   ;*** next tests' number
1de2 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; CPY - zp / abs / #         
                                set_y $80,0
                       >            load_flag 0
1de5 : a900            >            lda #0             ;allow test to change I
                       >
1de7 : 48              >            pha         ;use stack to load status
1de8 : a080            >            ldy #$80     ;precharge index y
1dea : 28              >            plp
                        
1deb : c419                     cpy zp7f
                                tst_stat fc
1ded : 08              >            php         ;save status
1dee : 68              >            pla         ;use stack to retrieve status
1def : 48              >            pha
                       >            cmp_flag fc
1df0 : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1df2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1df4 : 28              >            plp         ;restore status
                        
1df5 : 88                       dey
1df6 : c419                     cpy zp7f
                                tst_stat fzc
1df8 : 08              >            php         ;save status
1df9 : 68              >            pla         ;use stack to retrieve status
1dfa : 48              >            pha
                       >            cmp_flag fzc
1dfb : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1dfd : d0fe            >        bne *           ;failed not equal (non zero)
                       >
AS65 Assembler for R6502 [1.42].                                     Page  133
-------------------------- 6502_functional_test.a65 --------------------------

1dff : 28              >            plp         ;restore status
                        
1e00 : 88                       dey
1e01 : c419                     cpy zp7f
                                tst_y $7e,fn
1e03 : 08              >            php         ;save flags
1e04 : c07e            >            cpy #$7e     ;test result
                       >            trap_ne
1e06 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e08 : 68              >            pla         ;load status
1e09 : 48              >            pha
                       >            cmp_flag fn
1e0a : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1e0c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e0e : 28              >            plp         ;restore status
                        
                                set_y $80,$ff
                       >            load_flag $ff
1e0f : a9ff            >            lda #$ff             ;allow test to change
                       >
1e11 : 48              >            pha         ;use stack to load status
1e12 : a080            >            ldy #$80     ;precharge index y
1e14 : 28              >            plp
                        
1e15 : c419                     cpy zp7f
                                tst_stat ~fnz
1e17 : 08              >            php         ;save status
1e18 : 68              >            pla         ;use stack to retrieve status
1e19 : 48              >            pha
                       >            cmp_flag ~fnz
1e1a : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1e1c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e1e : 28              >            plp         ;restore status
                        
1e1f : 88                       dey
1e20 : c419                     cpy zp7f
                                tst_stat ~fn
1e22 : 08              >            php         ;save status
1e23 : 68              >            pla         ;use stack to retrieve status
1e24 : 48              >            pha
                       >            cmp_flag ~fn
1e25 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1e27 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e29 : 28              >            plp         ;restore status
                        
1e2a : 88                       dey
1e2b : c419                     cpy zp7f
                                tst_y $7e,~fzc
1e2d : 08              >            php         ;save flags
1e2e : c07e            >            cpy #$7e     ;test result
                       >            trap_ne
1e30 : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  134
-------------------------- 6502_functional_test.a65 --------------------------

                       >
1e32 : 68              >            pla         ;load status
1e33 : 48              >            pha
                       >            cmp_flag ~fzc
1e34 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1e36 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e38 : 28              >            plp         ;restore status
                        
                        
                                set_y $80,0
                       >            load_flag 0
1e39 : a900            >            lda #0             ;allow test to change I
                       >
1e3b : 48              >            pha         ;use stack to load status
1e3c : a080            >            ldy #$80     ;precharge index y
1e3e : 28              >            plp
                        
1e3f : cc1c02                   cpy abs7f
                                tst_stat fc
1e42 : 08              >            php         ;save status
1e43 : 68              >            pla         ;use stack to retrieve status
1e44 : 48              >            pha
                       >            cmp_flag fc
1e45 : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1e47 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e49 : 28              >            plp         ;restore status
                        
1e4a : 88                       dey
1e4b : cc1c02                   cpy abs7f
                                tst_stat fzc
1e4e : 08              >            php         ;save status
1e4f : 68              >            pla         ;use stack to retrieve status
1e50 : 48              >            pha
                       >            cmp_flag fzc
1e51 : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1e53 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e55 : 28              >            plp         ;restore status
                        
1e56 : 88                       dey
1e57 : cc1c02                   cpy abs7f
                                tst_y $7e,fn
1e5a : 08              >            php         ;save flags
1e5b : c07e            >            cpy #$7e     ;test result
                       >            trap_ne
1e5d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e5f : 68              >            pla         ;load status
1e60 : 48              >            pha
                       >            cmp_flag fn
1e61 : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1e63 : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  135
-------------------------- 6502_functional_test.a65 --------------------------

                       >
1e65 : 28              >            plp         ;restore status
                        
                                set_y $80,$ff
                       >            load_flag $ff
1e66 : a9ff            >            lda #$ff             ;allow test to change
                       >
1e68 : 48              >            pha         ;use stack to load status
1e69 : a080            >            ldy #$80     ;precharge index y
1e6b : 28              >            plp
                        
1e6c : cc1c02                   cpy abs7f
                                tst_stat ~fnz
1e6f : 08              >            php         ;save status
1e70 : 68              >            pla         ;use stack to retrieve status
1e71 : 48              >            pha
                       >            cmp_flag ~fnz
1e72 : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1e74 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e76 : 28              >            plp         ;restore status
                        
1e77 : 88                       dey
1e78 : cc1c02                   cpy abs7f
                                tst_stat ~fn
1e7b : 08              >            php         ;save status
1e7c : 68              >            pla         ;use stack to retrieve status
1e7d : 48              >            pha
                       >            cmp_flag ~fn
1e7e : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1e80 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e82 : 28              >            plp         ;restore status
                        
1e83 : 88                       dey
1e84 : cc1c02                   cpy abs7f
                                tst_y $7e,~fzc
1e87 : 08              >            php         ;save flags
1e88 : c07e            >            cpy #$7e     ;test result
                       >            trap_ne
1e8a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e8c : 68              >            pla         ;load status
1e8d : 48              >            pha
                       >            cmp_flag ~fzc
1e8e : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1e90 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1e92 : 28              >            plp         ;restore status
                        
                        
                                set_y $80,0
                       >            load_flag 0
1e93 : a900            >            lda #0             ;allow test to change I
                       >
1e95 : 48              >            pha         ;use stack to load status
AS65 Assembler for R6502 [1.42].                                     Page  136
-------------------------- 6502_functional_test.a65 --------------------------

1e96 : a080            >            ldy #$80     ;precharge index y
1e98 : 28              >            plp
                        
1e99 : c07f                     cpy #$7f
                                tst_stat fc
1e9b : 08              >            php         ;save status
1e9c : 68              >            pla         ;use stack to retrieve status
1e9d : 48              >            pha
                       >            cmp_flag fc
1e9e : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1ea0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ea2 : 28              >            plp         ;restore status
                        
1ea3 : 88                       dey
1ea4 : c07f                     cpy #$7f
                                tst_stat fzc
1ea6 : 08              >            php         ;save status
1ea7 : 68              >            pla         ;use stack to retrieve status
1ea8 : 48              >            pha
                       >            cmp_flag fzc
1ea9 : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1eab : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ead : 28              >            plp         ;restore status
                        
1eae : 88                       dey
1eaf : c07f                     cpy #$7f
                                tst_y $7e,fn
1eb1 : 08              >            php         ;save flags
1eb2 : c07e            >            cpy #$7e     ;test result
                       >            trap_ne
1eb4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1eb6 : 68              >            pla         ;load status
1eb7 : 48              >            pha
                       >            cmp_flag fn
1eb8 : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1eba : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ebc : 28              >            plp         ;restore status
                        
                                set_y $80,$ff
                       >            load_flag $ff
1ebd : a9ff            >            lda #$ff             ;allow test to change
                       >
1ebf : 48              >            pha         ;use stack to load status
1ec0 : a080            >            ldy #$80     ;precharge index y
1ec2 : 28              >            plp
                        
1ec3 : c07f                     cpy #$7f
                                tst_stat ~fnz
1ec5 : 08              >            php         ;save status
1ec6 : 68              >            pla         ;use stack to retrieve status
1ec7 : 48              >            pha
                       >            cmp_flag ~fnz
AS65 Assembler for R6502 [1.42].                                     Page  137
-------------------------- 6502_functional_test.a65 --------------------------

1ec8 : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1eca : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ecc : 28              >            plp         ;restore status
                        
1ecd : 88                       dey
1ece : c07f                     cpy #$7f
                                tst_stat ~fn
1ed0 : 08              >            php         ;save status
1ed1 : 68              >            pla         ;use stack to retrieve status
1ed2 : 48              >            pha
                       >            cmp_flag ~fn
1ed3 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1ed5 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ed7 : 28              >            plp         ;restore status
                        
1ed8 : 88                       dey
1ed9 : c07f                     cpy #$7f
                                tst_y $7e,~fzc
1edb : 08              >            php         ;save flags
1edc : c07e            >            cpy #$7e     ;test result
                       >            trap_ne
1ede : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ee0 : 68              >            pla         ;load status
1ee1 : 48              >            pha
                       >            cmp_flag ~fzc
1ee2 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1ee4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ee6 : 28              >            plp         ;restore status
                        
                                next_test
1ee7 : ad0002          >            lda test_case   ;previous test
1eea : c91b            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
1eec : d0fe            >        bne *           ;failed not equal (non zero)
                       >
001c =                 >test_num = test_num + 1
1eee : a91c            >            lda #test_num   ;*** next tests' number
1ef0 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; CMP - zp / abs / #         
                                set_a $80,0
                       >            load_flag 0
1ef3 : a900            >            lda #0             ;allow test to change I
                       >
1ef5 : 48              >            pha         ;use stack to load status
1ef6 : a980            >            lda #$80     ;precharge accu
1ef8 : 28              >            plp
                        
1ef9 : c519                     cmp zp7f
                                tst_a $80,fc
AS65 Assembler for R6502 [1.42].                                     Page  138
-------------------------- 6502_functional_test.a65 --------------------------

1efb : 08              >            php         ;save flags
1efc : c980            >            cmp #$80     ;test result
                       >            trap_ne
1efe : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f00 : 68              >            pla         ;load status
1f01 : 48              >            pha
                       >            cmp_flag fc
1f02 : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1f04 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f06 : 28              >            plp         ;restore status
                        
                                set_a $7f,0
                       >            load_flag 0
1f07 : a900            >            lda #0             ;allow test to change I
                       >
1f09 : 48              >            pha         ;use stack to load status
1f0a : a97f            >            lda #$7f     ;precharge accu
1f0c : 28              >            plp
                        
1f0d : c519                     cmp zp7f
                                tst_a $7f,fzc
1f0f : 08              >            php         ;save flags
1f10 : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
1f12 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f14 : 68              >            pla         ;load status
1f15 : 48              >            pha
                       >            cmp_flag fzc
1f16 : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1f18 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f1a : 28              >            plp         ;restore status
                        
                                set_a $7e,0
                       >            load_flag 0
1f1b : a900            >            lda #0             ;allow test to change I
                       >
1f1d : 48              >            pha         ;use stack to load status
1f1e : a97e            >            lda #$7e     ;precharge accu
1f20 : 28              >            plp
                        
1f21 : c519                     cmp zp7f
                                tst_a $7e,fn
1f23 : 08              >            php         ;save flags
1f24 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
1f26 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f28 : 68              >            pla         ;load status
1f29 : 48              >            pha
                       >            cmp_flag fn
1f2a : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1f2c : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  139
-------------------------- 6502_functional_test.a65 --------------------------

                       >
1f2e : 28              >            plp         ;restore status
                        
                                set_a $80,$ff
                       >            load_flag $ff
1f2f : a9ff            >            lda #$ff             ;allow test to change
                       >
1f31 : 48              >            pha         ;use stack to load status
1f32 : a980            >            lda #$80     ;precharge accu
1f34 : 28              >            plp
                        
1f35 : c519                     cmp zp7f
                                tst_a $80,~fnz
1f37 : 08              >            php         ;save flags
1f38 : c980            >            cmp #$80     ;test result
                       >            trap_ne
1f3a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f3c : 68              >            pla         ;load status
1f3d : 48              >            pha
                       >            cmp_flag ~fnz
1f3e : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1f40 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f42 : 28              >            plp         ;restore status
                        
                                set_a $7f,$ff
                       >            load_flag $ff
1f43 : a9ff            >            lda #$ff             ;allow test to change
                       >
1f45 : 48              >            pha         ;use stack to load status
1f46 : a97f            >            lda #$7f     ;precharge accu
1f48 : 28              >            plp
                        
1f49 : c519                     cmp zp7f
                                tst_a $7f,~fn
1f4b : 08              >            php         ;save flags
1f4c : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
1f4e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f50 : 68              >            pla         ;load status
1f51 : 48              >            pha
                       >            cmp_flag ~fn
1f52 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1f54 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f56 : 28              >            plp         ;restore status
                        
                                set_a $7e,$ff
                       >            load_flag $ff
1f57 : a9ff            >            lda #$ff             ;allow test to change
                       >
1f59 : 48              >            pha         ;use stack to load status
1f5a : a97e            >            lda #$7e     ;precharge accu
1f5c : 28              >            plp
                        
1f5d : c519                     cmp zp7f
AS65 Assembler for R6502 [1.42].                                     Page  140
-------------------------- 6502_functional_test.a65 --------------------------

                                tst_a $7e,~fzc
1f5f : 08              >            php         ;save flags
1f60 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
1f62 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f64 : 68              >            pla         ;load status
1f65 : 48              >            pha
                       >            cmp_flag ~fzc
1f66 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1f68 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f6a : 28              >            plp         ;restore status
                        
                        
                                set_a $80,0
                       >            load_flag 0
1f6b : a900            >            lda #0             ;allow test to change I
                       >
1f6d : 48              >            pha         ;use stack to load status
1f6e : a980            >            lda #$80     ;precharge accu
1f70 : 28              >            plp
                        
1f71 : cd1c02                   cmp abs7f
                                tst_a $80,fc
1f74 : 08              >            php         ;save flags
1f75 : c980            >            cmp #$80     ;test result
                       >            trap_ne
1f77 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f79 : 68              >            pla         ;load status
1f7a : 48              >            pha
                       >            cmp_flag fc
1f7b : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1f7d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f7f : 28              >            plp         ;restore status
                        
                                set_a $7f,0
                       >            load_flag 0
1f80 : a900            >            lda #0             ;allow test to change I
                       >
1f82 : 48              >            pha         ;use stack to load status
1f83 : a97f            >            lda #$7f     ;precharge accu
1f85 : 28              >            plp
                        
1f86 : cd1c02                   cmp abs7f
                                tst_a $7f,fzc
1f89 : 08              >            php         ;save flags
1f8a : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
1f8c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f8e : 68              >            pla         ;load status
1f8f : 48              >            pha
                       >            cmp_flag fzc
1f90 : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
AS65 Assembler for R6502 [1.42].                                     Page  141
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
1f92 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1f94 : 28              >            plp         ;restore status
                        
                                set_a $7e,0
                       >            load_flag 0
1f95 : a900            >            lda #0             ;allow test to change I
                       >
1f97 : 48              >            pha         ;use stack to load status
1f98 : a97e            >            lda #$7e     ;precharge accu
1f9a : 28              >            plp
                        
1f9b : cd1c02                   cmp abs7f
                                tst_a $7e,fn
1f9e : 08              >            php         ;save flags
1f9f : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
1fa1 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1fa3 : 68              >            pla         ;load status
1fa4 : 48              >            pha
                       >            cmp_flag fn
1fa5 : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1fa7 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1fa9 : 28              >            plp         ;restore status
                        
                                set_a $80,$ff
                       >            load_flag $ff
1faa : a9ff            >            lda #$ff             ;allow test to change
                       >
1fac : 48              >            pha         ;use stack to load status
1fad : a980            >            lda #$80     ;precharge accu
1faf : 28              >            plp
                        
1fb0 : cd1c02                   cmp abs7f
                                tst_a $80,~fnz
1fb3 : 08              >            php         ;save flags
1fb4 : c980            >            cmp #$80     ;test result
                       >            trap_ne
1fb6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1fb8 : 68              >            pla         ;load status
1fb9 : 48              >            pha
                       >            cmp_flag ~fnz
1fba : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1fbc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1fbe : 28              >            plp         ;restore status
                        
                                set_a $7f,$ff
                       >            load_flag $ff
1fbf : a9ff            >            lda #$ff             ;allow test to change
                       >
1fc1 : 48              >            pha         ;use stack to load status
1fc2 : a97f            >            lda #$7f     ;precharge accu
1fc4 : 28              >            plp
AS65 Assembler for R6502 [1.42].                                     Page  142
-------------------------- 6502_functional_test.a65 --------------------------

                        
1fc5 : cd1c02                   cmp abs7f
                                tst_a $7f,~fn
1fc8 : 08              >            php         ;save flags
1fc9 : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
1fcb : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1fcd : 68              >            pla         ;load status
1fce : 48              >            pha
                       >            cmp_flag ~fn
1fcf : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
1fd1 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1fd3 : 28              >            plp         ;restore status
                        
                                set_a $7e,$ff
                       >            load_flag $ff
1fd4 : a9ff            >            lda #$ff             ;allow test to change
                       >
1fd6 : 48              >            pha         ;use stack to load status
1fd7 : a97e            >            lda #$7e     ;precharge accu
1fd9 : 28              >            plp
                        
1fda : cd1c02                   cmp abs7f
                                tst_a $7e,~fzc
1fdd : 08              >            php         ;save flags
1fde : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
1fe0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1fe2 : 68              >            pla         ;load status
1fe3 : 48              >            pha
                       >            cmp_flag ~fzc
1fe4 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
1fe6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1fe8 : 28              >            plp         ;restore status
                        
                        
                                set_a $80,0
                       >            load_flag 0
1fe9 : a900            >            lda #0             ;allow test to change I
                       >
1feb : 48              >            pha         ;use stack to load status
1fec : a980            >            lda #$80     ;precharge accu
1fee : 28              >            plp
                        
1fef : c97f                     cmp #$7f
                                tst_a $80,fc
1ff1 : 08              >            php         ;save flags
1ff2 : c980            >            cmp #$80     ;test result
                       >            trap_ne
1ff4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ff6 : 68              >            pla         ;load status
1ff7 : 48              >            pha
                       >            cmp_flag fc
AS65 Assembler for R6502 [1.42].                                     Page  143
-------------------------- 6502_functional_test.a65 --------------------------

1ff8 : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
1ffa : d0fe            >        bne *           ;failed not equal (non zero)
                       >
1ffc : 28              >            plp         ;restore status
                        
                                set_a $7f,0
                       >            load_flag 0
1ffd : a900            >            lda #0             ;allow test to change I
                       >
1fff : 48              >            pha         ;use stack to load status
2000 : a97f            >            lda #$7f     ;precharge accu
2002 : 28              >            plp
                        
2003 : c97f                     cmp #$7f
                                tst_a $7f,fzc
2005 : 08              >            php         ;save flags
2006 : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
2008 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
200a : 68              >            pla         ;load status
200b : 48              >            pha
                       >            cmp_flag fzc
200c : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
200e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2010 : 28              >            plp         ;restore status
                        
                                set_a $7e,0
                       >            load_flag 0
2011 : a900            >            lda #0             ;allow test to change I
                       >
2013 : 48              >            pha         ;use stack to load status
2014 : a97e            >            lda #$7e     ;precharge accu
2016 : 28              >            plp
                        
2017 : c97f                     cmp #$7f
                                tst_a $7e,fn
2019 : 08              >            php         ;save flags
201a : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
201c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
201e : 68              >            pla         ;load status
201f : 48              >            pha
                       >            cmp_flag fn
2020 : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
2022 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2024 : 28              >            plp         ;restore status
                        
                                set_a $80,$ff
                       >            load_flag $ff
2025 : a9ff            >            lda #$ff             ;allow test to change
                       >
2027 : 48              >            pha         ;use stack to load status
AS65 Assembler for R6502 [1.42].                                     Page  144
-------------------------- 6502_functional_test.a65 --------------------------

2028 : a980            >            lda #$80     ;precharge accu
202a : 28              >            plp
                        
202b : c97f                     cmp #$7f
                                tst_a $80,~fnz
202d : 08              >            php         ;save flags
202e : c980            >            cmp #$80     ;test result
                       >            trap_ne
2030 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2032 : 68              >            pla         ;load status
2033 : 48              >            pha
                       >            cmp_flag ~fnz
2034 : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
2036 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2038 : 28              >            plp         ;restore status
                        
                                set_a $7f,$ff
                       >            load_flag $ff
2039 : a9ff            >            lda #$ff             ;allow test to change
                       >
203b : 48              >            pha         ;use stack to load status
203c : a97f            >            lda #$7f     ;precharge accu
203e : 28              >            plp
                        
203f : c97f                     cmp #$7f
                                tst_a $7f,~fn
2041 : 08              >            php         ;save flags
2042 : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
2044 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2046 : 68              >            pla         ;load status
2047 : 48              >            pha
                       >            cmp_flag ~fn
2048 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
204a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
204c : 28              >            plp         ;restore status
                        
                                set_a $7e,$ff
                       >            load_flag $ff
204d : a9ff            >            lda #$ff             ;allow test to change
                       >
204f : 48              >            pha         ;use stack to load status
2050 : a97e            >            lda #$7e     ;precharge accu
2052 : 28              >            plp
                        
2053 : c97f                     cmp #$7f
                                tst_a $7e,~fzc
2055 : 08              >            php         ;save flags
2056 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
2058 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
205a : 68              >            pla         ;load status
205b : 48              >            pha
AS65 Assembler for R6502 [1.42].                                     Page  145
-------------------------- 6502_functional_test.a65 --------------------------

                       >            cmp_flag ~fzc
205c : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
205e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2060 : 28              >            plp         ;restore status
                        
                        
2061 : a204                     ldx #4          ;with indexing by X
                                set_a $80,0
                       >            load_flag 0
2063 : a900            >            lda #0             ;allow test to change I
                       >
2065 : 48              >            pha         ;use stack to load status
2066 : a980            >            lda #$80     ;precharge accu
2068 : 28              >            plp
                        
2069 : d515                     cmp zp1,x
                                tst_a $80,fc
206b : 08              >            php         ;save flags
206c : c980            >            cmp #$80     ;test result
                       >            trap_ne
206e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2070 : 68              >            pla         ;load status
2071 : 48              >            pha
                       >            cmp_flag fc
2072 : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
2074 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2076 : 28              >            plp         ;restore status
                        
                                set_a $7f,0
                       >            load_flag 0
2077 : a900            >            lda #0             ;allow test to change I
                       >
2079 : 48              >            pha         ;use stack to load status
207a : a97f            >            lda #$7f     ;precharge accu
207c : 28              >            plp
                        
207d : d515                     cmp zp1,x
                                tst_a $7f,fzc
207f : 08              >            php         ;save flags
2080 : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
2082 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2084 : 68              >            pla         ;load status
2085 : 48              >            pha
                       >            cmp_flag fzc
2086 : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
2088 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
208a : 28              >            plp         ;restore status
                        
                                set_a $7e,0
                       >            load_flag 0
AS65 Assembler for R6502 [1.42].                                     Page  146
-------------------------- 6502_functional_test.a65 --------------------------

208b : a900            >            lda #0             ;allow test to change I
                       >
208d : 48              >            pha         ;use stack to load status
208e : a97e            >            lda #$7e     ;precharge accu
2090 : 28              >            plp
                        
2091 : d515                     cmp zp1,x
                                tst_a $7e,fn
2093 : 08              >            php         ;save flags
2094 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
2096 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2098 : 68              >            pla         ;load status
2099 : 48              >            pha
                       >            cmp_flag fn
209a : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
209c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
209e : 28              >            plp         ;restore status
                        
                                set_a $80,$ff
                       >            load_flag $ff
209f : a9ff            >            lda #$ff             ;allow test to change
                       >
20a1 : 48              >            pha         ;use stack to load status
20a2 : a980            >            lda #$80     ;precharge accu
20a4 : 28              >            plp
                        
20a5 : d515                     cmp zp1,x
                                tst_a $80,~fnz
20a7 : 08              >            php         ;save flags
20a8 : c980            >            cmp #$80     ;test result
                       >            trap_ne
20aa : d0fe            >        bne *           ;failed not equal (non zero)
                       >
20ac : 68              >            pla         ;load status
20ad : 48              >            pha
                       >            cmp_flag ~fnz
20ae : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
20b0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
20b2 : 28              >            plp         ;restore status
                        
                                set_a $7f,$ff
                       >            load_flag $ff
20b3 : a9ff            >            lda #$ff             ;allow test to change
                       >
20b5 : 48              >            pha         ;use stack to load status
20b6 : a97f            >            lda #$7f     ;precharge accu
20b8 : 28              >            plp
                        
20b9 : d515                     cmp zp1,x
                                tst_a $7f,~fn
20bb : 08              >            php         ;save flags
20bc : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
20be : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  147
-------------------------- 6502_functional_test.a65 --------------------------

                       >
20c0 : 68              >            pla         ;load status
20c1 : 48              >            pha
                       >            cmp_flag ~fn
20c2 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
20c4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
20c6 : 28              >            plp         ;restore status
                        
                                set_a $7e,$ff
                       >            load_flag $ff
20c7 : a9ff            >            lda #$ff             ;allow test to change
                       >
20c9 : 48              >            pha         ;use stack to load status
20ca : a97e            >            lda #$7e     ;precharge accu
20cc : 28              >            plp
                        
20cd : d515                     cmp zp1,x
                                tst_a $7e,~fzc
20cf : 08              >            php         ;save flags
20d0 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
20d2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
20d4 : 68              >            pla         ;load status
20d5 : 48              >            pha
                       >            cmp_flag ~fzc
20d6 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
20d8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
20da : 28              >            plp         ;restore status
                        
                        
                                set_a $80,0
                       >            load_flag 0
20db : a900            >            lda #0             ;allow test to change I
                       >
20dd : 48              >            pha         ;use stack to load status
20de : a980            >            lda #$80     ;precharge accu
20e0 : 28              >            plp
                        
20e1 : dd1802                   cmp abs1,x
                                tst_a $80,fc
20e4 : 08              >            php         ;save flags
20e5 : c980            >            cmp #$80     ;test result
                       >            trap_ne
20e7 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
20e9 : 68              >            pla         ;load status
20ea : 48              >            pha
                       >            cmp_flag fc
20eb : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
20ed : d0fe            >        bne *           ;failed not equal (non zero)
                       >
20ef : 28              >            plp         ;restore status
                        
AS65 Assembler for R6502 [1.42].                                     Page  148
-------------------------- 6502_functional_test.a65 --------------------------

                                set_a $7f,0
                       >            load_flag 0
20f0 : a900            >            lda #0             ;allow test to change I
                       >
20f2 : 48              >            pha         ;use stack to load status
20f3 : a97f            >            lda #$7f     ;precharge accu
20f5 : 28              >            plp
                        
20f6 : dd1802                   cmp abs1,x
                                tst_a $7f,fzc
20f9 : 08              >            php         ;save flags
20fa : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
20fc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
20fe : 68              >            pla         ;load status
20ff : 48              >            pha
                       >            cmp_flag fzc
2100 : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
2102 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2104 : 28              >            plp         ;restore status
                        
                                set_a $7e,0
                       >            load_flag 0
2105 : a900            >            lda #0             ;allow test to change I
                       >
2107 : 48              >            pha         ;use stack to load status
2108 : a97e            >            lda #$7e     ;precharge accu
210a : 28              >            plp
                        
210b : dd1802                   cmp abs1,x
                                tst_a $7e,fn
210e : 08              >            php         ;save flags
210f : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
2111 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2113 : 68              >            pla         ;load status
2114 : 48              >            pha
                       >            cmp_flag fn
2115 : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
2117 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2119 : 28              >            plp         ;restore status
                        
                                set_a $80,$ff
                       >            load_flag $ff
211a : a9ff            >            lda #$ff             ;allow test to change
                       >
211c : 48              >            pha         ;use stack to load status
211d : a980            >            lda #$80     ;precharge accu
211f : 28              >            plp
                        
2120 : dd1802                   cmp abs1,x
                                tst_a $80,~fnz
2123 : 08              >            php         ;save flags
2124 : c980            >            cmp #$80     ;test result
AS65 Assembler for R6502 [1.42].                                     Page  149
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
2126 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2128 : 68              >            pla         ;load status
2129 : 48              >            pha
                       >            cmp_flag ~fnz
212a : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
212c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
212e : 28              >            plp         ;restore status
                        
                                set_a $7f,$ff
                       >            load_flag $ff
212f : a9ff            >            lda #$ff             ;allow test to change
                       >
2131 : 48              >            pha         ;use stack to load status
2132 : a97f            >            lda #$7f     ;precharge accu
2134 : 28              >            plp
                        
2135 : dd1802                   cmp abs1,x
                                tst_a $7f,~fn
2138 : 08              >            php         ;save flags
2139 : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
213b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
213d : 68              >            pla         ;load status
213e : 48              >            pha
                       >            cmp_flag ~fn
213f : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
2141 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2143 : 28              >            plp         ;restore status
                        
                                set_a $7e,$ff
                       >            load_flag $ff
2144 : a9ff            >            lda #$ff             ;allow test to change
                       >
2146 : 48              >            pha         ;use stack to load status
2147 : a97e            >            lda #$7e     ;precharge accu
2149 : 28              >            plp
                        
214a : dd1802                   cmp abs1,x
                                tst_a $7e,~fzc
214d : 08              >            php         ;save flags
214e : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
2150 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2152 : 68              >            pla         ;load status
2153 : 48              >            pha
                       >            cmp_flag ~fzc
2154 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
2156 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2158 : 28              >            plp         ;restore status
AS65 Assembler for R6502 [1.42].                                     Page  150
-------------------------- 6502_functional_test.a65 --------------------------

                        
                        
2159 : a004                     ldy #4          ;with indexing by Y
215b : a208                     ldx #8          ;with indexed indirect
                                set_a $80,0
                       >            load_flag 0
215d : a900            >            lda #0             ;allow test to change I
                       >
215f : 48              >            pha         ;use stack to load status
2160 : a980            >            lda #$80     ;precharge accu
2162 : 28              >            plp
                        
2163 : d91802                   cmp abs1,y
                                tst_a $80,fc
2166 : 08              >            php         ;save flags
2167 : c980            >            cmp #$80     ;test result
                       >            trap_ne
2169 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
216b : 68              >            pla         ;load status
216c : 48              >            pha
                       >            cmp_flag fc
216d : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
216f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2171 : 28              >            plp         ;restore status
                        
                                set_a $7f,0
                       >            load_flag 0
2172 : a900            >            lda #0             ;allow test to change I
                       >
2174 : 48              >            pha         ;use stack to load status
2175 : a97f            >            lda #$7f     ;precharge accu
2177 : 28              >            plp
                        
2178 : d91802                   cmp abs1,y
                                tst_a $7f,fzc
217b : 08              >            php         ;save flags
217c : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
217e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2180 : 68              >            pla         ;load status
2181 : 48              >            pha
                       >            cmp_flag fzc
2182 : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
2184 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2186 : 28              >            plp         ;restore status
                        
                                set_a $7e,0
                       >            load_flag 0
2187 : a900            >            lda #0             ;allow test to change I
                       >
2189 : 48              >            pha         ;use stack to load status
218a : a97e            >            lda #$7e     ;precharge accu
218c : 28              >            plp
                        
AS65 Assembler for R6502 [1.42].                                     Page  151
-------------------------- 6502_functional_test.a65 --------------------------

218d : d91802                   cmp abs1,y
                                tst_a $7e,fn
2190 : 08              >            php         ;save flags
2191 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
2193 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2195 : 68              >            pla         ;load status
2196 : 48              >            pha
                       >            cmp_flag fn
2197 : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
2199 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
219b : 28              >            plp         ;restore status
                        
                                set_a $80,$ff
                       >            load_flag $ff
219c : a9ff            >            lda #$ff             ;allow test to change
                       >
219e : 48              >            pha         ;use stack to load status
219f : a980            >            lda #$80     ;precharge accu
21a1 : 28              >            plp
                        
21a2 : d91802                   cmp abs1,y
                                tst_a $80,~fnz
21a5 : 08              >            php         ;save flags
21a6 : c980            >            cmp #$80     ;test result
                       >            trap_ne
21a8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
21aa : 68              >            pla         ;load status
21ab : 48              >            pha
                       >            cmp_flag ~fnz
21ac : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
21ae : d0fe            >        bne *           ;failed not equal (non zero)
                       >
21b0 : 28              >            plp         ;restore status
                        
                                set_a $7f,$ff
                       >            load_flag $ff
21b1 : a9ff            >            lda #$ff             ;allow test to change
                       >
21b3 : 48              >            pha         ;use stack to load status
21b4 : a97f            >            lda #$7f     ;precharge accu
21b6 : 28              >            plp
                        
21b7 : d91802                   cmp abs1,y
                                tst_a $7f,~fn
21ba : 08              >            php         ;save flags
21bb : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
21bd : d0fe            >        bne *           ;failed not equal (non zero)
                       >
21bf : 68              >            pla         ;load status
21c0 : 48              >            pha
                       >            cmp_flag ~fn
21c1 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
AS65 Assembler for R6502 [1.42].                                     Page  152
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
21c3 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
21c5 : 28              >            plp         ;restore status
                        
                                set_a $7e,$ff
                       >            load_flag $ff
21c6 : a9ff            >            lda #$ff             ;allow test to change
                       >
21c8 : 48              >            pha         ;use stack to load status
21c9 : a97e            >            lda #$7e     ;precharge accu
21cb : 28              >            plp
                        
21cc : d91802                   cmp abs1,y
                                tst_a $7e,~fzc
21cf : 08              >            php         ;save flags
21d0 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
21d2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
21d4 : 68              >            pla         ;load status
21d5 : 48              >            pha
                       >            cmp_flag ~fzc
21d6 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
21d8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
21da : 28              >            plp         ;restore status
                        
                        
                                set_a $80,0
                       >            load_flag 0
21db : a900            >            lda #0             ;allow test to change I
                       >
21dd : 48              >            pha         ;use stack to load status
21de : a980            >            lda #$80     ;precharge accu
21e0 : 28              >            plp
                        
21e1 : c126                     cmp (ind1,x)
                                tst_a $80,fc
21e3 : 08              >            php         ;save flags
21e4 : c980            >            cmp #$80     ;test result
                       >            trap_ne
21e6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
21e8 : 68              >            pla         ;load status
21e9 : 48              >            pha
                       >            cmp_flag fc
21ea : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
21ec : d0fe            >        bne *           ;failed not equal (non zero)
                       >
21ee : 28              >            plp         ;restore status
                        
                                set_a $7f,0
                       >            load_flag 0
21ef : a900            >            lda #0             ;allow test to change I
                       >
21f1 : 48              >            pha         ;use stack to load status
21f2 : a97f            >            lda #$7f     ;precharge accu
AS65 Assembler for R6502 [1.42].                                     Page  153
-------------------------- 6502_functional_test.a65 --------------------------

21f4 : 28              >            plp
                        
21f5 : c126                     cmp (ind1,x)
                                tst_a $7f,fzc
21f7 : 08              >            php         ;save flags
21f8 : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
21fa : d0fe            >        bne *           ;failed not equal (non zero)
                       >
21fc : 68              >            pla         ;load status
21fd : 48              >            pha
                       >            cmp_flag fzc
21fe : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
2200 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2202 : 28              >            plp         ;restore status
                        
                                set_a $7e,0
                       >            load_flag 0
2203 : a900            >            lda #0             ;allow test to change I
                       >
2205 : 48              >            pha         ;use stack to load status
2206 : a97e            >            lda #$7e     ;precharge accu
2208 : 28              >            plp
                        
2209 : c126                     cmp (ind1,x)
                                tst_a $7e,fn
220b : 08              >            php         ;save flags
220c : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
220e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2210 : 68              >            pla         ;load status
2211 : 48              >            pha
                       >            cmp_flag fn
2212 : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
2214 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2216 : 28              >            plp         ;restore status
                        
                                set_a $80,$ff
                       >            load_flag $ff
2217 : a9ff            >            lda #$ff             ;allow test to change
                       >
2219 : 48              >            pha         ;use stack to load status
221a : a980            >            lda #$80     ;precharge accu
221c : 28              >            plp
                        
221d : c126                     cmp (ind1,x)
                                tst_a $80,~fnz
221f : 08              >            php         ;save flags
2220 : c980            >            cmp #$80     ;test result
                       >            trap_ne
2222 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2224 : 68              >            pla         ;load status
2225 : 48              >            pha
                       >            cmp_flag ~fnz
AS65 Assembler for R6502 [1.42].                                     Page  154
-------------------------- 6502_functional_test.a65 --------------------------

2226 : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
2228 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
222a : 28              >            plp         ;restore status
                        
                                set_a $7f,$ff
                       >            load_flag $ff
222b : a9ff            >            lda #$ff             ;allow test to change
                       >
222d : 48              >            pha         ;use stack to load status
222e : a97f            >            lda #$7f     ;precharge accu
2230 : 28              >            plp
                        
2231 : c126                     cmp (ind1,x)
                                tst_a $7f,~fn
2233 : 08              >            php         ;save flags
2234 : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
2236 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2238 : 68              >            pla         ;load status
2239 : 48              >            pha
                       >            cmp_flag ~fn
223a : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
223c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
223e : 28              >            plp         ;restore status
                        
                                set_a $7e,$ff
                       >            load_flag $ff
223f : a9ff            >            lda #$ff             ;allow test to change
                       >
2241 : 48              >            pha         ;use stack to load status
2242 : a97e            >            lda #$7e     ;precharge accu
2244 : 28              >            plp
                        
2245 : c126                     cmp (ind1,x)
                                tst_a $7e,~fzc
2247 : 08              >            php         ;save flags
2248 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
224a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
224c : 68              >            pla         ;load status
224d : 48              >            pha
                       >            cmp_flag ~fzc
224e : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
2250 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2252 : 28              >            plp         ;restore status
                        
                        
                                set_a $80,0
                       >            load_flag 0
2253 : a900            >            lda #0             ;allow test to change I
                       >
AS65 Assembler for R6502 [1.42].                                     Page  155
-------------------------- 6502_functional_test.a65 --------------------------

2255 : 48              >            pha         ;use stack to load status
2256 : a980            >            lda #$80     ;precharge accu
2258 : 28              >            plp
                        
2259 : d126                     cmp (ind1),y
                                tst_a $80,fc
225b : 08              >            php         ;save flags
225c : c980            >            cmp #$80     ;test result
                       >            trap_ne
225e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2260 : 68              >            pla         ;load status
2261 : 48              >            pha
                       >            cmp_flag fc
2262 : c931            >            cmp #(fc|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
2264 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2266 : 28              >            plp         ;restore status
                        
                                set_a $7f,0
                       >            load_flag 0
2267 : a900            >            lda #0             ;allow test to change I
                       >
2269 : 48              >            pha         ;use stack to load status
226a : a97f            >            lda #$7f     ;precharge accu
226c : 28              >            plp
                        
226d : d126                     cmp (ind1),y
                                tst_a $7f,fzc
226f : 08              >            php         ;save flags
2270 : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
2272 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2274 : 68              >            pla         ;load status
2275 : 48              >            pha
                       >            cmp_flag fzc
2276 : c933            >            cmp #(fzc|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
2278 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
227a : 28              >            plp         ;restore status
                        
                                set_a $7e,0
                       >            load_flag 0
227b : a900            >            lda #0             ;allow test to change I
                       >
227d : 48              >            pha         ;use stack to load status
227e : a97e            >            lda #$7e     ;precharge accu
2280 : 28              >            plp
                        
2281 : d126                     cmp (ind1),y
                                tst_a $7e,fn
2283 : 08              >            php         ;save flags
2284 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
2286 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2288 : 68              >            pla         ;load status
AS65 Assembler for R6502 [1.42].                                     Page  156
-------------------------- 6502_functional_test.a65 --------------------------

2289 : 48              >            pha
                       >            cmp_flag fn
228a : c9b0            >            cmp #(fn|fao)&m8    ;expected flags + alwa
                       >
                       >            trap_ne
228c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
228e : 28              >            plp         ;restore status
                        
                                set_a $80,$ff
                       >            load_flag $ff
228f : a9ff            >            lda #$ff             ;allow test to change
                       >
2291 : 48              >            pha         ;use stack to load status
2292 : a980            >            lda #$80     ;precharge accu
2294 : 28              >            plp
                        
2295 : d126                     cmp (ind1),y
                                tst_a $80,~fnz
2297 : 08              >            php         ;save flags
2298 : c980            >            cmp #$80     ;test result
                       >            trap_ne
229a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
229c : 68              >            pla         ;load status
229d : 48              >            pha
                       >            cmp_flag ~fnz
229e : c97d            >            cmp #(~fnz|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
22a0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
22a2 : 28              >            plp         ;restore status
                        
                                set_a $7f,$ff
                       >            load_flag $ff
22a3 : a9ff            >            lda #$ff             ;allow test to change
                       >
22a5 : 48              >            pha         ;use stack to load status
22a6 : a97f            >            lda #$7f     ;precharge accu
22a8 : 28              >            plp
                        
22a9 : d126                     cmp (ind1),y
                                tst_a $7f,~fn
22ab : 08              >            php         ;save flags
22ac : c97f            >            cmp #$7f     ;test result
                       >            trap_ne
22ae : d0fe            >        bne *           ;failed not equal (non zero)
                       >
22b0 : 68              >            pla         ;load status
22b1 : 48              >            pha
                       >            cmp_flag ~fn
22b2 : c97f            >            cmp #(~fn|fao)&m8    ;expected flags + alw
                       >
                       >            trap_ne
22b4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
22b6 : 28              >            plp         ;restore status
                        
                                set_a $7e,$ff
                       >            load_flag $ff
22b7 : a9ff            >            lda #$ff             ;allow test to change
AS65 Assembler for R6502 [1.42].                                     Page  157
-------------------------- 6502_functional_test.a65 --------------------------

                       >
22b9 : 48              >            pha         ;use stack to load status
22ba : a97e            >            lda #$7e     ;precharge accu
22bc : 28              >            plp
                        
22bd : d126                     cmp (ind1),y
                                tst_a $7e,~fzc
22bf : 08              >            php         ;save flags
22c0 : c97e            >            cmp #$7e     ;test result
                       >            trap_ne
22c2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
22c4 : 68              >            pla         ;load status
22c5 : 48              >            pha
                       >            cmp_flag ~fzc
22c6 : c9fc            >            cmp #(~fzc|fao)&m8    ;expected flags + al
                       >
                       >            trap_ne
22c8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
22ca : 28              >            plp         ;restore status
                        
                                next_test
22cb : ad0002          >            lda test_case   ;previous test
22ce : c91c            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
22d0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
001d =                 >test_num = test_num + 1
22d2 : a91d            >            lda #test_num   ;*** next tests' number
22d4 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; testing shifts - ASL LSR ROL ROR all addressing mode
                        ; shifts - accumulator
22d7 : a205                     ldx #5
22d9 :                  tasl
                                set_ax zps,0
                       >            load_flag 0
22d9 : a900            >            lda #0             ;allow test to change I
                       >
22db : 48              >            pha         ;use stack to load status
22dc : b513            >            lda zps,x    ;precharge accu
22de : 28              >            plp
                        
22df : 0a                       asl a
                                tst_ax rASL,fASL,0
22e0 : 08              >            php         ;save flags
22e1 : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
22e4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
22e6 : 68              >            pla         ;load status
                       >            eor_flag 0
22e7 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
22e9 : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne     ;
22ec : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
AS65 Assembler for R6502 [1.42].                                     Page  158
-------------------------- 6502_functional_test.a65 --------------------------

22ee : ca                       dex
22ef : 10e8                     bpl tasl
22f1 : a205                     ldx #5
22f3 :                  tasl1
                                set_ax zps,$ff
                       >            load_flag $ff
22f3 : a9ff            >            lda #$ff             ;allow test to change
                       >
22f5 : 48              >            pha         ;use stack to load status
22f6 : b513            >            lda zps,x    ;precharge accu
22f8 : 28              >            plp
                        
22f9 : 0a                       asl a
                                tst_ax rASL,fASL,$ff-fnzc
22fa : 08              >            php         ;save flags
22fb : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
22fe : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2300 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2301 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2303 : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne     ;
2306 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2308 : ca                       dex
2309 : 10e8                     bpl tasl1
                        
230b : a205                     ldx #5
230d :                  tlsr
                                set_ax zps,0
                       >            load_flag 0
230d : a900            >            lda #0             ;allow test to change I
                       >
230f : 48              >            pha         ;use stack to load status
2310 : b513            >            lda zps,x    ;precharge accu
2312 : 28              >            plp
                        
2313 : 4a                       lsr a
                                tst_ax rLSR,fLSR,0
2314 : 08              >            php         ;save flags
2315 : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
2318 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
231a : 68              >            pla         ;load status
                       >            eor_flag 0
231b : 4930            >            eor #0|fao         ;invert expected flags 
                       >
231d : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne     ;
2320 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2322 : ca                       dex
2323 : 10e8                     bpl tlsr
2325 : a205                     ldx #5
2327 :                  tlsr1
                                set_ax zps,$ff
AS65 Assembler for R6502 [1.42].                                     Page  159
-------------------------- 6502_functional_test.a65 --------------------------

                       >            load_flag $ff
2327 : a9ff            >            lda #$ff             ;allow test to change
                       >
2329 : 48              >            pha         ;use stack to load status
232a : b513            >            lda zps,x    ;precharge accu
232c : 28              >            plp
                        
232d : 4a                       lsr a
                                tst_ax rLSR,fLSR,$ff-fnzc
232e : 08              >            php         ;save flags
232f : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
2332 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2334 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2335 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2337 : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne     ;
233a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
233c : ca                       dex
233d : 10e8                     bpl tlsr1
                        
233f : a205                     ldx #5
2341 :                  trol
                                set_ax zps,0
                       >            load_flag 0
2341 : a900            >            lda #0             ;allow test to change I
                       >
2343 : 48              >            pha         ;use stack to load status
2344 : b513            >            lda zps,x    ;precharge accu
2346 : 28              >            plp
                        
2347 : 2a                       rol a
                                tst_ax rROL,fROL,0
2348 : 08              >            php         ;save flags
2349 : dd2102          >            cmp rROL,x    ;test result
                       >            trap_ne
234c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
234e : 68              >            pla         ;load status
                       >            eor_flag 0
234f : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2351 : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne     ;
2354 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2356 : ca                       dex
2357 : 10e8                     bpl trol
2359 : a205                     ldx #5
235b :                  trol1
                                set_ax zps,$ff-fc
                       >            load_flag $ff-fc
235b : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
235d : 48              >            pha         ;use stack to load status
235e : b513            >            lda zps,x    ;precharge accu
AS65 Assembler for R6502 [1.42].                                     Page  160
-------------------------- 6502_functional_test.a65 --------------------------

2360 : 28              >            plp
                        
2361 : 2a                       rol a
                                tst_ax rROL,fROL,$ff-fnzc
2362 : 08              >            php         ;save flags
2363 : dd2102          >            cmp rROL,x    ;test result
                       >            trap_ne
2366 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2368 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2369 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
236b : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne     ;
236e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2370 : ca                       dex
2371 : 10e8                     bpl trol1
                        
2373 : a205                     ldx #5
2375 :                  trolc
                                set_ax zps,fc
                       >            load_flag fc
2375 : a901            >            lda #fc             ;allow test to change 
                       >
2377 : 48              >            pha         ;use stack to load status
2378 : b513            >            lda zps,x    ;precharge accu
237a : 28              >            plp
                        
237b : 2a                       rol a
                                tst_ax rROLc,fROLc,0
237c : 08              >            php         ;save flags
237d : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
2380 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2382 : 68              >            pla         ;load status
                       >            eor_flag 0
2383 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2385 : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne     ;
2388 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
238a : ca                       dex
238b : 10e8                     bpl trolc
238d : a205                     ldx #5
238f :                  trolc1
                                set_ax zps,$ff
                       >            load_flag $ff
238f : a9ff            >            lda #$ff             ;allow test to change
                       >
2391 : 48              >            pha         ;use stack to load status
2392 : b513            >            lda zps,x    ;precharge accu
2394 : 28              >            plp
                        
2395 : 2a                       rol a
                                tst_ax rROLc,fROLc,$ff-fnzc
2396 : 08              >            php         ;save flags
AS65 Assembler for R6502 [1.42].                                     Page  161
-------------------------- 6502_functional_test.a65 --------------------------

2397 : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
239a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
239c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
239d : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
239f : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne     ;
23a2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
23a4 : ca                       dex
23a5 : 10e8                     bpl trolc1
                        
23a7 : a205                     ldx #5
23a9 :                  tror
                                set_ax zps,0
                       >            load_flag 0
23a9 : a900            >            lda #0             ;allow test to change I
                       >
23ab : 48              >            pha         ;use stack to load status
23ac : b513            >            lda zps,x    ;precharge accu
23ae : 28              >            plp
                        
23af : 6a                       ror a
                                tst_ax rROR,fROR,0
23b0 : 08              >            php         ;save flags
23b1 : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
23b4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
23b6 : 68              >            pla         ;load status
                       >            eor_flag 0
23b7 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
23b9 : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne     ;
23bc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
23be : ca                       dex
23bf : 10e8                     bpl tror
23c1 : a205                     ldx #5
23c3 :                  tror1
                                set_ax zps,$ff-fc
                       >            load_flag $ff-fc
23c3 : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
23c5 : 48              >            pha         ;use stack to load status
23c6 : b513            >            lda zps,x    ;precharge accu
23c8 : 28              >            plp
                        
23c9 : 6a                       ror a
                                tst_ax rROR,fROR,$ff-fnzc
23ca : 08              >            php         ;save flags
23cb : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
23ce : d0fe            >        bne *           ;failed not equal (non zero)
                       >
23d0 : 68              >            pla         ;load status
AS65 Assembler for R6502 [1.42].                                     Page  162
-------------------------- 6502_functional_test.a65 --------------------------

                       >            eor_flag $ff-fnzc
23d1 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
23d3 : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne     ;
23d6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
23d8 : ca                       dex
23d9 : 10e8                     bpl tror1
                        
23db : a205                     ldx #5
23dd :                  trorc
                                set_ax zps,fc
                       >            load_flag fc
23dd : a901            >            lda #fc             ;allow test to change 
                       >
23df : 48              >            pha         ;use stack to load status
23e0 : b513            >            lda zps,x    ;precharge accu
23e2 : 28              >            plp
                        
23e3 : 6a                       ror a
                                tst_ax rRORc,fRORc,0
23e4 : 08              >            php         ;save flags
23e5 : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
23e8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
23ea : 68              >            pla         ;load status
                       >            eor_flag 0
23eb : 4930            >            eor #0|fao         ;invert expected flags 
                       >
23ed : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne     ;
23f0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
23f2 : ca                       dex
23f3 : 10e8                     bpl trorc
23f5 : a205                     ldx #5
23f7 :                  trorc1
                                set_ax zps,$ff
                       >            load_flag $ff
23f7 : a9ff            >            lda #$ff             ;allow test to change
                       >
23f9 : 48              >            pha         ;use stack to load status
23fa : b513            >            lda zps,x    ;precharge accu
23fc : 28              >            plp
                        
23fd : 6a                       ror a
                                tst_ax rRORc,fRORc,$ff-fnzc
23fe : 08              >            php         ;save flags
23ff : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
2402 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2404 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2405 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2407 : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne     ;
AS65 Assembler for R6502 [1.42].                                     Page  163
-------------------------- 6502_functional_test.a65 --------------------------

240a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
240c : ca                       dex
240d : 10e8                     bpl trorc1
                                next_test
240f : ad0002          >            lda test_case   ;previous test
2412 : c91d            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
2414 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
001e =                 >test_num = test_num + 1
2416 : a91e            >            lda #test_num   ;*** next tests' number
2418 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; shifts - zeropage
241b : a205                     ldx #5
241d :                  tasl2
                                set_z zps,0
                       >            load_flag 0
241d : a900            >            lda #0             ;allow test to change I
                       >
241f : 48              >            pha         ;use stack to load status
2420 : b513            >            lda zps,x    ;load to zeropage
2422 : 850c            >            sta zpt
2424 : 28              >            plp
                        
2425 : 060c                     asl zpt
                                tst_z rASL,fASL,0
2427 : 08              >            php         ;save flags
2428 : a50c            >            lda zpt
242a : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
242d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
242f : 68              >            pla         ;load status
                       >            eor_flag 0
2430 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2432 : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne
2435 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2437 : ca                       dex
2438 : 10e3                     bpl tasl2
243a : a205                     ldx #5
243c :                  tasl3
                                set_z zps,$ff
                       >            load_flag $ff
243c : a9ff            >            lda #$ff             ;allow test to change
                       >
243e : 48              >            pha         ;use stack to load status
243f : b513            >            lda zps,x    ;load to zeropage
2441 : 850c            >            sta zpt
2443 : 28              >            plp
                        
2444 : 060c                     asl zpt
                                tst_z rASL,fASL,$ff-fnzc
2446 : 08              >            php         ;save flags
AS65 Assembler for R6502 [1.42].                                     Page  164
-------------------------- 6502_functional_test.a65 --------------------------

2447 : a50c            >            lda zpt
2449 : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
244c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
244e : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
244f : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2451 : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne
2454 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2456 : ca                       dex
2457 : 10e3                     bpl tasl3
                        
2459 : a205                     ldx #5
245b :                  tlsr2
                                set_z zps,0
                       >            load_flag 0
245b : a900            >            lda #0             ;allow test to change I
                       >
245d : 48              >            pha         ;use stack to load status
245e : b513            >            lda zps,x    ;load to zeropage
2460 : 850c            >            sta zpt
2462 : 28              >            plp
                        
2463 : 460c                     lsr zpt
                                tst_z rLSR,fLSR,0
2465 : 08              >            php         ;save flags
2466 : a50c            >            lda zpt
2468 : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
246b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
246d : 68              >            pla         ;load status
                       >            eor_flag 0
246e : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2470 : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne
2473 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2475 : ca                       dex
2476 : 10e3                     bpl tlsr2
2478 : a205                     ldx #5
247a :                  tlsr3
                                set_z zps,$ff
                       >            load_flag $ff
247a : a9ff            >            lda #$ff             ;allow test to change
                       >
247c : 48              >            pha         ;use stack to load status
247d : b513            >            lda zps,x    ;load to zeropage
247f : 850c            >            sta zpt
2481 : 28              >            plp
                        
2482 : 460c                     lsr zpt
                                tst_z rLSR,fLSR,$ff-fnzc
2484 : 08              >            php         ;save flags
2485 : a50c            >            lda zpt
AS65 Assembler for R6502 [1.42].                                     Page  165
-------------------------- 6502_functional_test.a65 --------------------------

2487 : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
248a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
248c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
248d : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
248f : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne
2492 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2494 : ca                       dex
2495 : 10e3                     bpl tlsr3
                        
2497 : a205                     ldx #5
2499 :                  trol2
                                set_z zps,0
                       >            load_flag 0
2499 : a900            >            lda #0             ;allow test to change I
                       >
249b : 48              >            pha         ;use stack to load status
249c : b513            >            lda zps,x    ;load to zeropage
249e : 850c            >            sta zpt
24a0 : 28              >            plp
                        
24a1 : 260c                     rol zpt
                                tst_z rROL,fROL,0
24a3 : 08              >            php         ;save flags
24a4 : a50c            >            lda zpt
24a6 : dd2102          >            cmp rROL,x    ;test result
                       >            trap_ne
24a9 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
24ab : 68              >            pla         ;load status
                       >            eor_flag 0
24ac : 4930            >            eor #0|fao         ;invert expected flags 
                       >
24ae : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne
24b1 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
24b3 : ca                       dex
24b4 : 10e3                     bpl trol2
24b6 : a205                     ldx #5
24b8 :                  trol3
                                set_z zps,$ff-fc
                       >            load_flag $ff-fc
24b8 : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
24ba : 48              >            pha         ;use stack to load status
24bb : b513            >            lda zps,x    ;load to zeropage
24bd : 850c            >            sta zpt
24bf : 28              >            plp
                        
24c0 : 260c                     rol zpt
                                tst_z rROL,fROL,$ff-fnzc
24c2 : 08              >            php         ;save flags
24c3 : a50c            >            lda zpt
24c5 : dd2102          >            cmp rROL,x    ;test result
AS65 Assembler for R6502 [1.42].                                     Page  166
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
24c8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
24ca : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
24cb : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
24cd : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne
24d0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
24d2 : ca                       dex
24d3 : 10e3                     bpl trol3
                        
24d5 : a205                     ldx #5
24d7 :                  trolc2
                                set_z zps,fc
                       >            load_flag fc
24d7 : a901            >            lda #fc             ;allow test to change 
                       >
24d9 : 48              >            pha         ;use stack to load status
24da : b513            >            lda zps,x    ;load to zeropage
24dc : 850c            >            sta zpt
24de : 28              >            plp
                        
24df : 260c                     rol zpt
                                tst_z rROLc,fROLc,0
24e1 : 08              >            php         ;save flags
24e2 : a50c            >            lda zpt
24e4 : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
24e7 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
24e9 : 68              >            pla         ;load status
                       >            eor_flag 0
24ea : 4930            >            eor #0|fao         ;invert expected flags 
                       >
24ec : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne
24ef : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
24f1 : ca                       dex
24f2 : 10e3                     bpl trolc2
24f4 : a205                     ldx #5
24f6 :                  trolc3
                                set_z zps,$ff
                       >            load_flag $ff
24f6 : a9ff            >            lda #$ff             ;allow test to change
                       >
24f8 : 48              >            pha         ;use stack to load status
24f9 : b513            >            lda zps,x    ;load to zeropage
24fb : 850c            >            sta zpt
24fd : 28              >            plp
                        
24fe : 260c                     rol zpt
                                tst_z rROLc,fROLc,$ff-fnzc
2500 : 08              >            php         ;save flags
2501 : a50c            >            lda zpt
2503 : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
AS65 Assembler for R6502 [1.42].                                     Page  167
-------------------------- 6502_functional_test.a65 --------------------------

2506 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2508 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2509 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
250b : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne
250e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2510 : ca                       dex
2511 : 10e3                     bpl trolc3
                        
2513 : a205                     ldx #5
2515 :                  tror2
                                set_z zps,0
                       >            load_flag 0
2515 : a900            >            lda #0             ;allow test to change I
                       >
2517 : 48              >            pha         ;use stack to load status
2518 : b513            >            lda zps,x    ;load to zeropage
251a : 850c            >            sta zpt
251c : 28              >            plp
                        
251d : 660c                     ror zpt
                                tst_z rROR,fROR,0
251f : 08              >            php         ;save flags
2520 : a50c            >            lda zpt
2522 : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
2525 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2527 : 68              >            pla         ;load status
                       >            eor_flag 0
2528 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
252a : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne
252d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
252f : ca                       dex
2530 : 10e3                     bpl tror2
2532 : a205                     ldx #5
2534 :                  tror3
                                set_z zps,$ff-fc
                       >            load_flag $ff-fc
2534 : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
2536 : 48              >            pha         ;use stack to load status
2537 : b513            >            lda zps,x    ;load to zeropage
2539 : 850c            >            sta zpt
253b : 28              >            plp
                        
253c : 660c                     ror zpt
                                tst_z rROR,fROR,$ff-fnzc
253e : 08              >            php         ;save flags
253f : a50c            >            lda zpt
2541 : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
2544 : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  168
-------------------------- 6502_functional_test.a65 --------------------------

                       >
2546 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2547 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2549 : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne
254c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
254e : ca                       dex
254f : 10e3                     bpl tror3
                        
2551 : a205                     ldx #5
2553 :                  trorc2
                                set_z zps,fc
                       >            load_flag fc
2553 : a901            >            lda #fc             ;allow test to change 
                       >
2555 : 48              >            pha         ;use stack to load status
2556 : b513            >            lda zps,x    ;load to zeropage
2558 : 850c            >            sta zpt
255a : 28              >            plp
                        
255b : 660c                     ror zpt
                                tst_z rRORc,fRORc,0
255d : 08              >            php         ;save flags
255e : a50c            >            lda zpt
2560 : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
2563 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2565 : 68              >            pla         ;load status
                       >            eor_flag 0
2566 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2568 : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne
256b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
256d : ca                       dex
256e : 10e3                     bpl trorc2
2570 : a205                     ldx #5
2572 :                  trorc3
                                set_z zps,$ff
                       >            load_flag $ff
2572 : a9ff            >            lda #$ff             ;allow test to change
                       >
2574 : 48              >            pha         ;use stack to load status
2575 : b513            >            lda zps,x    ;load to zeropage
2577 : 850c            >            sta zpt
2579 : 28              >            plp
                        
257a : 660c                     ror zpt
                                tst_z rRORc,fRORc,$ff-fnzc
257c : 08              >            php         ;save flags
257d : a50c            >            lda zpt
257f : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
2582 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
AS65 Assembler for R6502 [1.42].                                     Page  169
-------------------------- 6502_functional_test.a65 --------------------------

2584 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2585 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2587 : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne
258a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
258c : ca                       dex
258d : 10e3                     bpl trorc3
                                next_test
258f : ad0002          >            lda test_case   ;previous test
2592 : c91e            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
2594 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
001f =                 >test_num = test_num + 1
2596 : a91f            >            lda #test_num   ;*** next tests' number
2598 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; shifts - absolute
259b : a205                     ldx #5
259d :                  tasl4
                                set_abs zps,0
                       >            load_flag 0
259d : a900            >            lda #0             ;allow test to change I
                       >
259f : 48              >            pha         ;use stack to load status
25a0 : b513            >            lda zps,x    ;load to memory
25a2 : 8d0302          >            sta abst
25a5 : 28              >            plp
                        
25a6 : 0e0302                   asl abst
                                tst_abs rASL,fASL,0
25a9 : 08              >            php         ;save flags
25aa : ad0302          >            lda abst
25ad : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
25b0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
25b2 : 68              >            pla         ;load status
                       >            eor_flag 0
25b3 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
25b5 : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne
25b8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
25ba : ca                       dex
25bb : 10e0                     bpl tasl4
25bd : a205                     ldx #5
25bf :                  tasl5
                                set_abs zps,$ff
                       >            load_flag $ff
25bf : a9ff            >            lda #$ff             ;allow test to change
                       >
25c1 : 48              >            pha         ;use stack to load status
25c2 : b513            >            lda zps,x    ;load to memory
AS65 Assembler for R6502 [1.42].                                     Page  170
-------------------------- 6502_functional_test.a65 --------------------------

25c4 : 8d0302          >            sta abst
25c7 : 28              >            plp
                        
25c8 : 0e0302                   asl abst
                                tst_abs rASL,fASL,$ff-fnzc
25cb : 08              >            php         ;save flags
25cc : ad0302          >            lda abst
25cf : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
25d2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
25d4 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
25d5 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
25d7 : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne
25da : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
25dc : ca                       dex
25dd : 10e0                     bpl tasl5
                        
25df : a205                     ldx #5
25e1 :                  tlsr4
                                set_abs zps,0
                       >            load_flag 0
25e1 : a900            >            lda #0             ;allow test to change I
                       >
25e3 : 48              >            pha         ;use stack to load status
25e4 : b513            >            lda zps,x    ;load to memory
25e6 : 8d0302          >            sta abst
25e9 : 28              >            plp
                        
25ea : 4e0302                   lsr abst
                                tst_abs rLSR,fLSR,0
25ed : 08              >            php         ;save flags
25ee : ad0302          >            lda abst
25f1 : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
25f4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
25f6 : 68              >            pla         ;load status
                       >            eor_flag 0
25f7 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
25f9 : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne
25fc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
25fe : ca                       dex
25ff : 10e0                     bpl tlsr4
2601 : a205                     ldx #5
2603 :                  tlsr5
                                set_abs zps,$ff
                       >            load_flag $ff
2603 : a9ff            >            lda #$ff             ;allow test to change
                       >
2605 : 48              >            pha         ;use stack to load status
2606 : b513            >            lda zps,x    ;load to memory
2608 : 8d0302          >            sta abst
AS65 Assembler for R6502 [1.42].                                     Page  171
-------------------------- 6502_functional_test.a65 --------------------------

260b : 28              >            plp
                        
260c : 4e0302                   lsr abst
                                tst_abs rLSR,fLSR,$ff-fnzc
260f : 08              >            php         ;save flags
2610 : ad0302          >            lda abst
2613 : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
2616 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2618 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2619 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
261b : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne
261e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2620 : ca                       dex
2621 : 10e0                     bpl tlsr5
                        
2623 : a205                     ldx #5
2625 :                  trol4
                                set_abs zps,0
                       >            load_flag 0
2625 : a900            >            lda #0             ;allow test to change I
                       >
2627 : 48              >            pha         ;use stack to load status
2628 : b513            >            lda zps,x    ;load to memory
262a : 8d0302          >            sta abst
262d : 28              >            plp
                        
262e : 2e0302                   rol abst
                                tst_abs rROL,fROL,0
2631 : 08              >            php         ;save flags
2632 : ad0302          >            lda abst
2635 : dd2102          >            cmp rROL,x    ;test result
                       >            trap_ne
2638 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
263a : 68              >            pla         ;load status
                       >            eor_flag 0
263b : 4930            >            eor #0|fao         ;invert expected flags 
                       >
263d : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne
2640 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2642 : ca                       dex
2643 : 10e0                     bpl trol4
2645 : a205                     ldx #5
2647 :                  trol5
                                set_abs zps,$ff-fc
                       >            load_flag $ff-fc
2647 : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
2649 : 48              >            pha         ;use stack to load status
264a : b513            >            lda zps,x    ;load to memory
264c : 8d0302          >            sta abst
264f : 28              >            plp
AS65 Assembler for R6502 [1.42].                                     Page  172
-------------------------- 6502_functional_test.a65 --------------------------

                        
2650 : 2e0302                   rol abst
                                tst_abs rROL,fROL,$ff-fnzc
2653 : 08              >            php         ;save flags
2654 : ad0302          >            lda abst
2657 : dd2102          >            cmp rROL,x    ;test result
                       >            trap_ne
265a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
265c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
265d : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
265f : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne
2662 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2664 : ca                       dex
2665 : 10e0                     bpl trol5
                        
2667 : a205                     ldx #5
2669 :                  trolc4
                                set_abs zps,fc
                       >            load_flag fc
2669 : a901            >            lda #fc             ;allow test to change 
                       >
266b : 48              >            pha         ;use stack to load status
266c : b513            >            lda zps,x    ;load to memory
266e : 8d0302          >            sta abst
2671 : 28              >            plp
                        
2672 : 2e0302                   rol abst
                                tst_abs rROLc,fROLc,0
2675 : 08              >            php         ;save flags
2676 : ad0302          >            lda abst
2679 : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
267c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
267e : 68              >            pla         ;load status
                       >            eor_flag 0
267f : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2681 : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne
2684 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2686 : ca                       dex
2687 : 10e0                     bpl trolc4
2689 : a205                     ldx #5
268b :                  trolc5
                                set_abs zps,$ff
                       >            load_flag $ff
268b : a9ff            >            lda #$ff             ;allow test to change
                       >
268d : 48              >            pha         ;use stack to load status
268e : b513            >            lda zps,x    ;load to memory
2690 : 8d0302          >            sta abst
2693 : 28              >            plp
                        
AS65 Assembler for R6502 [1.42].                                     Page  173
-------------------------- 6502_functional_test.a65 --------------------------

2694 : 2e0302                   rol abst
                                tst_abs rROLc,fROLc,$ff-fnzc
2697 : 08              >            php         ;save flags
2698 : ad0302          >            lda abst
269b : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
269e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
26a0 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
26a1 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
26a3 : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne
26a6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
26a8 : ca                       dex
26a9 : 10e0                     bpl trolc5
                        
26ab : a205                     ldx #5
26ad :                  tror4
                                set_abs zps,0
                       >            load_flag 0
26ad : a900            >            lda #0             ;allow test to change I
                       >
26af : 48              >            pha         ;use stack to load status
26b0 : b513            >            lda zps,x    ;load to memory
26b2 : 8d0302          >            sta abst
26b5 : 28              >            plp
                        
26b6 : 6e0302                   ror abst
                                tst_abs rROR,fROR,0
26b9 : 08              >            php         ;save flags
26ba : ad0302          >            lda abst
26bd : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
26c0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
26c2 : 68              >            pla         ;load status
                       >            eor_flag 0
26c3 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
26c5 : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne
26c8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
26ca : ca                       dex
26cb : 10e0                     bpl tror4
26cd : a205                     ldx #5
26cf :                  tror5
                                set_abs zps,$ff-fc
                       >            load_flag $ff-fc
26cf : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
26d1 : 48              >            pha         ;use stack to load status
26d2 : b513            >            lda zps,x    ;load to memory
26d4 : 8d0302          >            sta abst
26d7 : 28              >            plp
                        
26d8 : 6e0302                   ror abst
AS65 Assembler for R6502 [1.42].                                     Page  174
-------------------------- 6502_functional_test.a65 --------------------------

                                tst_abs rROR,fROR,$ff-fnzc
26db : 08              >            php         ;save flags
26dc : ad0302          >            lda abst
26df : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
26e2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
26e4 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
26e5 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
26e7 : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne
26ea : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
26ec : ca                       dex
26ed : 10e0                     bpl tror5
                        
26ef : a205                     ldx #5
26f1 :                  trorc4
                                set_abs zps,fc
                       >            load_flag fc
26f1 : a901            >            lda #fc             ;allow test to change 
                       >
26f3 : 48              >            pha         ;use stack to load status
26f4 : b513            >            lda zps,x    ;load to memory
26f6 : 8d0302          >            sta abst
26f9 : 28              >            plp
                        
26fa : 6e0302                   ror abst
                                tst_abs rRORc,fRORc,0
26fd : 08              >            php         ;save flags
26fe : ad0302          >            lda abst
2701 : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
2704 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2706 : 68              >            pla         ;load status
                       >            eor_flag 0
2707 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2709 : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne
270c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
270e : ca                       dex
270f : 10e0                     bpl trorc4
2711 : a205                     ldx #5
2713 :                  trorc5
                                set_abs zps,$ff
                       >            load_flag $ff
2713 : a9ff            >            lda #$ff             ;allow test to change
                       >
2715 : 48              >            pha         ;use stack to load status
2716 : b513            >            lda zps,x    ;load to memory
2718 : 8d0302          >            sta abst
271b : 28              >            plp
                        
271c : 6e0302                   ror abst
                                tst_abs rRORc,fRORc,$ff-fnzc
AS65 Assembler for R6502 [1.42].                                     Page  175
-------------------------- 6502_functional_test.a65 --------------------------

271f : 08              >            php         ;save flags
2720 : ad0302          >            lda abst
2723 : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
2726 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2728 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2729 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
272b : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne
272e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2730 : ca                       dex
2731 : 10e0                     bpl trorc5
                                next_test
2733 : ad0002          >            lda test_case   ;previous test
2736 : c91f            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
2738 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0020 =                 >test_num = test_num + 1
273a : a920            >            lda #test_num   ;*** next tests' number
273c : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; shifts - zp indexed
273f : a205                     ldx #5
2741 :                  tasl6
                                set_zx zps,0
                       >            load_flag 0
2741 : a900            >            lda #0             ;allow test to change I
                       >
2743 : 48              >            pha         ;use stack to load status
2744 : b513            >            lda zps,x    ;load to indexed zeropage
2746 : 950c            >            sta zpt,x
2748 : 28              >            plp
                        
2749 : 160c                     asl zpt,x
                                tst_zx rASL,fASL,0
274b : 08              >            php         ;save flags
274c : b50c            >            lda zpt,x
274e : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
2751 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2753 : 68              >            pla         ;load status
                       >            eor_flag 0
2754 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2756 : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne
2759 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
275b : ca                       dex
275c : 10e3                     bpl tasl6
275e : a205                     ldx #5
2760 :                  tasl7
AS65 Assembler for R6502 [1.42].                                     Page  176
-------------------------- 6502_functional_test.a65 --------------------------

                                set_zx zps,$ff
                       >            load_flag $ff
2760 : a9ff            >            lda #$ff             ;allow test to change
                       >
2762 : 48              >            pha         ;use stack to load status
2763 : b513            >            lda zps,x    ;load to indexed zeropage
2765 : 950c            >            sta zpt,x
2767 : 28              >            plp
                        
2768 : 160c                     asl zpt,x
                                tst_zx rASL,fASL,$ff-fnzc
276a : 08              >            php         ;save flags
276b : b50c            >            lda zpt,x
276d : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
2770 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2772 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2773 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2775 : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne
2778 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
277a : ca                       dex
277b : 10e3                     bpl tasl7
                        
277d : a205                     ldx #5
277f :                  tlsr6
                                set_zx zps,0
                       >            load_flag 0
277f : a900            >            lda #0             ;allow test to change I
                       >
2781 : 48              >            pha         ;use stack to load status
2782 : b513            >            lda zps,x    ;load to indexed zeropage
2784 : 950c            >            sta zpt,x
2786 : 28              >            plp
                        
2787 : 560c                     lsr zpt,x
                                tst_zx rLSR,fLSR,0
2789 : 08              >            php         ;save flags
278a : b50c            >            lda zpt,x
278c : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
278f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2791 : 68              >            pla         ;load status
                       >            eor_flag 0
2792 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2794 : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne
2797 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2799 : ca                       dex
279a : 10e3                     bpl tlsr6
279c : a205                     ldx #5
279e :                  tlsr7
                                set_zx zps,$ff
AS65 Assembler for R6502 [1.42].                                     Page  177
-------------------------- 6502_functional_test.a65 --------------------------

                       >            load_flag $ff
279e : a9ff            >            lda #$ff             ;allow test to change
                       >
27a0 : 48              >            pha         ;use stack to load status
27a1 : b513            >            lda zps,x    ;load to indexed zeropage
27a3 : 950c            >            sta zpt,x
27a5 : 28              >            plp
                        
27a6 : 560c                     lsr zpt,x
                                tst_zx rLSR,fLSR,$ff-fnzc
27a8 : 08              >            php         ;save flags
27a9 : b50c            >            lda zpt,x
27ab : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
27ae : d0fe            >        bne *           ;failed not equal (non zero)
                       >
27b0 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
27b1 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
27b3 : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne
27b6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
27b8 : ca                       dex
27b9 : 10e3                     bpl tlsr7
                        
27bb : a205                     ldx #5
27bd :                  trol6
                                set_zx zps,0
                       >            load_flag 0
27bd : a900            >            lda #0             ;allow test to change I
                       >
27bf : 48              >            pha         ;use stack to load status
27c0 : b513            >            lda zps,x    ;load to indexed zeropage
27c2 : 950c            >            sta zpt,x
27c4 : 28              >            plp
                        
27c5 : 360c                     rol zpt,x
                                tst_zx rROL,fROL,0
27c7 : 08              >            php         ;save flags
27c8 : b50c            >            lda zpt,x
27ca : dd2102          >            cmp rROL,x    ;test result
                       >            trap_ne
27cd : d0fe            >        bne *           ;failed not equal (non zero)
                       >
27cf : 68              >            pla         ;load status
                       >            eor_flag 0
27d0 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
27d2 : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne
27d5 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
27d7 : ca                       dex
27d8 : 10e3                     bpl trol6
27da : a205                     ldx #5
27dc :                  trol7
                                set_zx zps,$ff-fc
                       >            load_flag $ff-fc
AS65 Assembler for R6502 [1.42].                                     Page  178
-------------------------- 6502_functional_test.a65 --------------------------

27dc : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
27de : 48              >            pha         ;use stack to load status
27df : b513            >            lda zps,x    ;load to indexed zeropage
27e1 : 950c            >            sta zpt,x
27e3 : 28              >            plp
                        
27e4 : 360c                     rol zpt,x
                                tst_zx rROL,fROL,$ff-fnzc
27e6 : 08              >            php         ;save flags
27e7 : b50c            >            lda zpt,x
27e9 : dd2102          >            cmp rROL,x    ;test result
                       >            trap_ne
27ec : d0fe            >        bne *           ;failed not equal (non zero)
                       >
27ee : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
27ef : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
27f1 : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne
27f4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
27f6 : ca                       dex
27f7 : 10e3                     bpl trol7
                        
27f9 : a205                     ldx #5
27fb :                  trolc6
                                set_zx zps,fc
                       >            load_flag fc
27fb : a901            >            lda #fc             ;allow test to change 
                       >
27fd : 48              >            pha         ;use stack to load status
27fe : b513            >            lda zps,x    ;load to indexed zeropage
2800 : 950c            >            sta zpt,x
2802 : 28              >            plp
                        
2803 : 360c                     rol zpt,x
                                tst_zx rROLc,fROLc,0
2805 : 08              >            php         ;save flags
2806 : b50c            >            lda zpt,x
2808 : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
280b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
280d : 68              >            pla         ;load status
                       >            eor_flag 0
280e : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2810 : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne
2813 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2815 : ca                       dex
2816 : 10e3                     bpl trolc6
2818 : a205                     ldx #5
281a :                  trolc7
                                set_zx zps,$ff
                       >            load_flag $ff
281a : a9ff            >            lda #$ff             ;allow test to change
AS65 Assembler for R6502 [1.42].                                     Page  179
-------------------------- 6502_functional_test.a65 --------------------------

                       >
281c : 48              >            pha         ;use stack to load status
281d : b513            >            lda zps,x    ;load to indexed zeropage
281f : 950c            >            sta zpt,x
2821 : 28              >            plp
                        
2822 : 360c                     rol zpt,x
                                tst_zx rROLc,fROLc,$ff-fnzc
2824 : 08              >            php         ;save flags
2825 : b50c            >            lda zpt,x
2827 : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
282a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
282c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
282d : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
282f : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne
2832 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2834 : ca                       dex
2835 : 10e3                     bpl trolc7
                        
2837 : a205                     ldx #5
2839 :                  tror6
                                set_zx zps,0
                       >            load_flag 0
2839 : a900            >            lda #0             ;allow test to change I
                       >
283b : 48              >            pha         ;use stack to load status
283c : b513            >            lda zps,x    ;load to indexed zeropage
283e : 950c            >            sta zpt,x
2840 : 28              >            plp
                        
2841 : 760c                     ror zpt,x
                                tst_zx rROR,fROR,0
2843 : 08              >            php         ;save flags
2844 : b50c            >            lda zpt,x
2846 : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
2849 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
284b : 68              >            pla         ;load status
                       >            eor_flag 0
284c : 4930            >            eor #0|fao         ;invert expected flags 
                       >
284e : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne
2851 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2853 : ca                       dex
2854 : 10e3                     bpl tror6
2856 : a205                     ldx #5
2858 :                  tror7
                                set_zx zps,$ff-fc
                       >            load_flag $ff-fc
2858 : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
AS65 Assembler for R6502 [1.42].                                     Page  180
-------------------------- 6502_functional_test.a65 --------------------------

285a : 48              >            pha         ;use stack to load status
285b : b513            >            lda zps,x    ;load to indexed zeropage
285d : 950c            >            sta zpt,x
285f : 28              >            plp
                        
2860 : 760c                     ror zpt,x
                                tst_zx rROR,fROR,$ff-fnzc
2862 : 08              >            php         ;save flags
2863 : b50c            >            lda zpt,x
2865 : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
2868 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
286a : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
286b : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
286d : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne
2870 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2872 : ca                       dex
2873 : 10e3                     bpl tror7
                        
2875 : a205                     ldx #5
2877 :                  trorc6
                                set_zx zps,fc
                       >            load_flag fc
2877 : a901            >            lda #fc             ;allow test to change 
                       >
2879 : 48              >            pha         ;use stack to load status
287a : b513            >            lda zps,x    ;load to indexed zeropage
287c : 950c            >            sta zpt,x
287e : 28              >            plp
                        
287f : 760c                     ror zpt,x
                                tst_zx rRORc,fRORc,0
2881 : 08              >            php         ;save flags
2882 : b50c            >            lda zpt,x
2884 : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
2887 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2889 : 68              >            pla         ;load status
                       >            eor_flag 0
288a : 4930            >            eor #0|fao         ;invert expected flags 
                       >
288c : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne
288f : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2891 : ca                       dex
2892 : 10e3                     bpl trorc6
2894 : a205                     ldx #5
2896 :                  trorc7
                                set_zx zps,$ff
                       >            load_flag $ff
2896 : a9ff            >            lda #$ff             ;allow test to change
                       >
2898 : 48              >            pha         ;use stack to load status
AS65 Assembler for R6502 [1.42].                                     Page  181
-------------------------- 6502_functional_test.a65 --------------------------

2899 : b513            >            lda zps,x    ;load to indexed zeropage
289b : 950c            >            sta zpt,x
289d : 28              >            plp
                        
289e : 760c                     ror zpt,x
                                tst_zx rRORc,fRORc,$ff-fnzc
28a0 : 08              >            php         ;save flags
28a1 : b50c            >            lda zpt,x
28a3 : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
28a6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
28a8 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
28a9 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
28ab : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne
28ae : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
28b0 : ca                       dex
28b1 : 10e3                     bpl trorc7
                                next_test
28b3 : ad0002          >            lda test_case   ;previous test
28b6 : c920            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
28b8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0021 =                 >test_num = test_num + 1
28ba : a921            >            lda #test_num   ;*** next tests' number
28bc : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                                
                        ; shifts - abs indexed
28bf : a205                     ldx #5
28c1 :                  tasl8
                                set_absx zps,0
                       >            load_flag 0
28c1 : a900            >            lda #0             ;allow test to change I
                       >
28c3 : 48              >            pha         ;use stack to load status
28c4 : b513            >            lda zps,x    ;load to indexed memory
28c6 : 9d0302          >            sta abst,x
28c9 : 28              >            plp
                        
28ca : 1e0302                   asl abst,x
                                tst_absx rASL,fASL,0
28cd : 08              >            php         ;save flags
28ce : bd0302          >            lda abst,x
28d1 : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
28d4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
28d6 : 68              >            pla         ;load status
                       >            eor_flag 0
28d7 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
28d9 : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne
28dc : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  182
-------------------------- 6502_functional_test.a65 --------------------------

                       >
                        
28de : ca                       dex
28df : 10e0                     bpl tasl8
28e1 : a205                     ldx #5
28e3 :                  tasl9
                                set_absx zps,$ff
                       >            load_flag $ff
28e3 : a9ff            >            lda #$ff             ;allow test to change
                       >
28e5 : 48              >            pha         ;use stack to load status
28e6 : b513            >            lda zps,x    ;load to indexed memory
28e8 : 9d0302          >            sta abst,x
28eb : 28              >            plp
                        
28ec : 1e0302                   asl abst,x
                                tst_absx rASL,fASL,$ff-fnzc
28ef : 08              >            php         ;save flags
28f0 : bd0302          >            lda abst,x
28f3 : dd2102          >            cmp rASL,x    ;test result
                       >            trap_ne
28f6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
28f8 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
28f9 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
28fb : dd3902          >            cmp fASL,x    ;test flags
                       >            trap_ne
28fe : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2900 : ca                       dex
2901 : 10e0                     bpl tasl9
                        
2903 : a205                     ldx #5
2905 :                  tlsr8
                                set_absx zps,0
                       >            load_flag 0
2905 : a900            >            lda #0             ;allow test to change I
                       >
2907 : 48              >            pha         ;use stack to load status
2908 : b513            >            lda zps,x    ;load to indexed memory
290a : 9d0302          >            sta abst,x
290d : 28              >            plp
                        
290e : 5e0302                   lsr abst,x
                                tst_absx rLSR,fLSR,0
2911 : 08              >            php         ;save flags
2912 : bd0302          >            lda abst,x
2915 : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
2918 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
291a : 68              >            pla         ;load status
                       >            eor_flag 0
291b : 4930            >            eor #0|fao         ;invert expected flags 
                       >
291d : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne
2920 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
AS65 Assembler for R6502 [1.42].                                     Page  183
-------------------------- 6502_functional_test.a65 --------------------------

                        
2922 : ca                       dex
2923 : 10e0                     bpl tlsr8
2925 : a205                     ldx #5
2927 :                  tlsr9
                                set_absx zps,$ff
                       >            load_flag $ff
2927 : a9ff            >            lda #$ff             ;allow test to change
                       >
2929 : 48              >            pha         ;use stack to load status
292a : b513            >            lda zps,x    ;load to indexed memory
292c : 9d0302          >            sta abst,x
292f : 28              >            plp
                        
2930 : 5e0302                   lsr abst,x
                                tst_absx rLSR,fLSR,$ff-fnzc
2933 : 08              >            php         ;save flags
2934 : bd0302          >            lda abst,x
2937 : dd2d02          >            cmp rLSR,x    ;test result
                       >            trap_ne
293a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
293c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
293d : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
293f : dd4502          >            cmp fLSR,x    ;test flags
                       >            trap_ne
2942 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2944 : ca                       dex
2945 : 10e0                     bpl tlsr9
                        
2947 : a205                     ldx #5
2949 :                  trol8
                                set_absx zps,0
                       >            load_flag 0
2949 : a900            >            lda #0             ;allow test to change I
                       >
294b : 48              >            pha         ;use stack to load status
294c : b513            >            lda zps,x    ;load to indexed memory
294e : 9d0302          >            sta abst,x
2951 : 28              >            plp
                        
2952 : 3e0302                   rol abst,x
                                tst_absx rROL,fROL,0
2955 : 08              >            php         ;save flags
2956 : bd0302          >            lda abst,x
2959 : dd2102          >            cmp rROL,x    ;test result
                       >            trap_ne
295c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
295e : 68              >            pla         ;load status
                       >            eor_flag 0
295f : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2961 : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne
2964 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
AS65 Assembler for R6502 [1.42].                                     Page  184
-------------------------- 6502_functional_test.a65 --------------------------

2966 : ca                       dex
2967 : 10e0                     bpl trol8
2969 : a205                     ldx #5
296b :                  trol9
                                set_absx zps,$ff-fc
                       >            load_flag $ff-fc
296b : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
296d : 48              >            pha         ;use stack to load status
296e : b513            >            lda zps,x    ;load to indexed memory
2970 : 9d0302          >            sta abst,x
2973 : 28              >            plp
                        
2974 : 3e0302                   rol abst,x
                                tst_absx rROL,fROL,$ff-fnzc
2977 : 08              >            php         ;save flags
2978 : bd0302          >            lda abst,x
297b : dd2102          >            cmp rROL,x    ;test result
                       >            trap_ne
297e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2980 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2981 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2983 : dd3902          >            cmp fROL,x    ;test flags
                       >            trap_ne
2986 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2988 : ca                       dex
2989 : 10e0                     bpl trol9
                        
298b : a205                     ldx #5
298d :                  trolc8
                                set_absx zps,fc
                       >            load_flag fc
298d : a901            >            lda #fc             ;allow test to change 
                       >
298f : 48              >            pha         ;use stack to load status
2990 : b513            >            lda zps,x    ;load to indexed memory
2992 : 9d0302          >            sta abst,x
2995 : 28              >            plp
                        
2996 : 3e0302                   rol abst,x
                                tst_absx rROLc,fROLc,0
2999 : 08              >            php         ;save flags
299a : bd0302          >            lda abst,x
299d : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
29a0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
29a2 : 68              >            pla         ;load status
                       >            eor_flag 0
29a3 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
29a5 : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne
29a8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
29aa : ca                       dex
AS65 Assembler for R6502 [1.42].                                     Page  185
-------------------------- 6502_functional_test.a65 --------------------------

29ab : 10e0                     bpl trolc8
29ad : a205                     ldx #5
29af :                  trolc9
                                set_absx zps,$ff
                       >            load_flag $ff
29af : a9ff            >            lda #$ff             ;allow test to change
                       >
29b1 : 48              >            pha         ;use stack to load status
29b2 : b513            >            lda zps,x    ;load to indexed memory
29b4 : 9d0302          >            sta abst,x
29b7 : 28              >            plp
                        
29b8 : 3e0302                   rol abst,x
                                tst_absx rROLc,fROLc,$ff-fnzc
29bb : 08              >            php         ;save flags
29bc : bd0302          >            lda abst,x
29bf : dd2702          >            cmp rROLc,x    ;test result
                       >            trap_ne
29c2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
29c4 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
29c5 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
29c7 : dd3f02          >            cmp fROLc,x    ;test flags
                       >            trap_ne
29ca : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
29cc : ca                       dex
29cd : 10e0                     bpl trolc9
                        
29cf : a205                     ldx #5
29d1 :                  tror8
                                set_absx zps,0
                       >            load_flag 0
29d1 : a900            >            lda #0             ;allow test to change I
                       >
29d3 : 48              >            pha         ;use stack to load status
29d4 : b513            >            lda zps,x    ;load to indexed memory
29d6 : 9d0302          >            sta abst,x
29d9 : 28              >            plp
                        
29da : 7e0302                   ror abst,x
                                tst_absx rROR,fROR,0
29dd : 08              >            php         ;save flags
29de : bd0302          >            lda abst,x
29e1 : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
29e4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
29e6 : 68              >            pla         ;load status
                       >            eor_flag 0
29e7 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
29e9 : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne
29ec : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
29ee : ca                       dex
29ef : 10e0                     bpl tror8
AS65 Assembler for R6502 [1.42].                                     Page  186
-------------------------- 6502_functional_test.a65 --------------------------

29f1 : a205                     ldx #5
29f3 :                  tror9
                                set_absx zps,$ff-fc
                       >            load_flag $ff-fc
29f3 : a9fe            >            lda #$ff-fc             ;allow test to cha
                       >
29f5 : 48              >            pha         ;use stack to load status
29f6 : b513            >            lda zps,x    ;load to indexed memory
29f8 : 9d0302          >            sta abst,x
29fb : 28              >            plp
                        
29fc : 7e0302                   ror abst,x
                                tst_absx rROR,fROR,$ff-fnzc
29ff : 08              >            php         ;save flags
2a00 : bd0302          >            lda abst,x
2a03 : dd2d02          >            cmp rROR,x    ;test result
                       >            trap_ne
2a06 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2a08 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2a09 : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2a0b : dd4502          >            cmp fROR,x    ;test flags
                       >            trap_ne
2a0e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2a10 : ca                       dex
2a11 : 10e0                     bpl tror9
                        
2a13 : a205                     ldx #5
2a15 :                  trorc8
                                set_absx zps,fc
                       >            load_flag fc
2a15 : a901            >            lda #fc             ;allow test to change 
                       >
2a17 : 48              >            pha         ;use stack to load status
2a18 : b513            >            lda zps,x    ;load to indexed memory
2a1a : 9d0302          >            sta abst,x
2a1d : 28              >            plp
                        
2a1e : 7e0302                   ror abst,x
                                tst_absx rRORc,fRORc,0
2a21 : 08              >            php         ;save flags
2a22 : bd0302          >            lda abst,x
2a25 : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
2a28 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2a2a : 68              >            pla         ;load status
                       >            eor_flag 0
2a2b : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2a2d : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne
2a30 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2a32 : ca                       dex
2a33 : 10e0                     bpl trorc8
2a35 : a205                     ldx #5
AS65 Assembler for R6502 [1.42].                                     Page  187
-------------------------- 6502_functional_test.a65 --------------------------

2a37 :                  trorc9
                                set_absx zps,$ff
                       >            load_flag $ff
2a37 : a9ff            >            lda #$ff             ;allow test to change
                       >
2a39 : 48              >            pha         ;use stack to load status
2a3a : b513            >            lda zps,x    ;load to indexed memory
2a3c : 9d0302          >            sta abst,x
2a3f : 28              >            plp
                        
2a40 : 7e0302                   ror abst,x
                                tst_absx rRORc,fRORc,$ff-fnzc
2a43 : 08              >            php         ;save flags
2a44 : bd0302          >            lda abst,x
2a47 : dd3302          >            cmp rRORc,x    ;test result
                       >            trap_ne
2a4a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2a4c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnzc
2a4d : 497c            >            eor #$ff-fnzc|fao         ;invert expected
                       >
2a4f : dd4b02          >            cmp fRORc,x    ;test flags
                       >            trap_ne
2a52 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2a54 : ca                       dex
2a55 : 10e0                     bpl trorc9
                                next_test
2a57 : ad0002          >            lda test_case   ;previous test
2a5a : c921            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
2a5c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0022 =                 >test_num = test_num + 1
2a5e : a922            >            lda #test_num   ;*** next tests' number
2a60 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; testing memory increment/decrement - INC DEC all add
                        ; zeropage
2a63 : a200                     ldx #0
2a65 : a97e                     lda #$7e
2a67 : 850c                     sta zpt
2a69 :                  tinc    
                                set_stat 0
                       >            load_flag 0
2a69 : a900            >            lda #0             ;allow test to change I
                       >
2a6b : 48              >            pha         ;use stack to load status
2a6c : 28              >            plp
                        
2a6d : e60c                     inc zpt
                                tst_z rINC,fINC,0
2a6f : 08              >            php         ;save flags
2a70 : a50c            >            lda zpt
2a72 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2a75 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
AS65 Assembler for R6502 [1.42].                                     Page  188
-------------------------- 6502_functional_test.a65 --------------------------

2a77 : 68              >            pla         ;load status
                       >            eor_flag 0
2a78 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2a7a : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2a7d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2a7f : e8                       inx
2a80 : e002                     cpx #2
2a82 : d004                     bne tinc1
2a84 : a9fe                     lda #$fe
2a86 : 850c                     sta zpt
2a88 : e005             tinc1   cpx #5
2a8a : d0dd                     bne tinc
2a8c : ca                       dex
2a8d : e60c                     inc zpt
2a8f :                  tdec    
                                set_stat 0
                       >            load_flag 0
2a8f : a900            >            lda #0             ;allow test to change I
                       >
2a91 : 48              >            pha         ;use stack to load status
2a92 : 28              >            plp
                        
2a93 : c60c                     dec zpt
                                tst_z rINC,fINC,0
2a95 : 08              >            php         ;save flags
2a96 : a50c            >            lda zpt
2a98 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2a9b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2a9d : 68              >            pla         ;load status
                       >            eor_flag 0
2a9e : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2aa0 : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2aa3 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2aa5 : ca                       dex
2aa6 : 300a                     bmi tdec1
2aa8 : e001                     cpx #1
2aaa : d0e3                     bne tdec
2aac : a981                     lda #$81
2aae : 850c                     sta zpt
2ab0 : d0dd                     bne tdec
2ab2 :                  tdec1
2ab2 : a200                     ldx #0
2ab4 : a97e                     lda #$7e
2ab6 : 850c                     sta zpt
2ab8 :                  tinc10    
                                set_stat $ff
                       >            load_flag $ff
2ab8 : a9ff            >            lda #$ff             ;allow test to change
                       >
2aba : 48              >            pha         ;use stack to load status
2abb : 28              >            plp
                        
AS65 Assembler for R6502 [1.42].                                     Page  189
-------------------------- 6502_functional_test.a65 --------------------------

2abc : e60c                     inc zpt
                                tst_z rINC,fINC,$ff-fnz
2abe : 08              >            php         ;save flags
2abf : a50c            >            lda zpt
2ac1 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2ac4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2ac6 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2ac7 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2ac9 : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2acc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2ace : e8                       inx
2acf : e002                     cpx #2
2ad1 : d004                     bne tinc11
2ad3 : a9fe                     lda #$fe
2ad5 : 850c                     sta zpt
2ad7 : e005             tinc11  cpx #5
2ad9 : d0dd                     bne tinc10
2adb : ca                       dex
2adc : e60c                     inc zpt
2ade :                  tdec10    
                                set_stat $ff
                       >            load_flag $ff
2ade : a9ff            >            lda #$ff             ;allow test to change
                       >
2ae0 : 48              >            pha         ;use stack to load status
2ae1 : 28              >            plp
                        
2ae2 : c60c                     dec zpt
                                tst_z rINC,fINC,$ff-fnz
2ae4 : 08              >            php         ;save flags
2ae5 : a50c            >            lda zpt
2ae7 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2aea : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2aec : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2aed : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2aef : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2af2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2af4 : ca                       dex
2af5 : 300a                     bmi tdec11
2af7 : e001                     cpx #1
2af9 : d0e3                     bne tdec10
2afb : a981                     lda #$81
2afd : 850c                     sta zpt
2aff : d0dd                     bne tdec10
2b01 :                  tdec11
                                next_test
2b01 : ad0002          >            lda test_case   ;previous test
2b04 : c922            >            cmp #test_num
AS65 Assembler for R6502 [1.42].                                     Page  190
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne         ;test is out of sequence
2b06 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0023 =                 >test_num = test_num + 1
2b08 : a923            >            lda #test_num   ;*** next tests' number
2b0a : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; absolute memory
2b0d : a200                     ldx #0
2b0f : a97e                     lda #$7e
2b11 : 8d0302                   sta abst
2b14 :                  tinc2    
                                set_stat 0
                       >            load_flag 0
2b14 : a900            >            lda #0             ;allow test to change I
                       >
2b16 : 48              >            pha         ;use stack to load status
2b17 : 28              >            plp
                        
2b18 : ee0302                   inc abst
                                tst_abs rINC,fINC,0
2b1b : 08              >            php         ;save flags
2b1c : ad0302          >            lda abst
2b1f : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2b22 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2b24 : 68              >            pla         ;load status
                       >            eor_flag 0
2b25 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2b27 : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2b2a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2b2c : e8                       inx
2b2d : e002                     cpx #2
2b2f : d005                     bne tinc3
2b31 : a9fe                     lda #$fe
2b33 : 8d0302                   sta abst
2b36 : e005             tinc3   cpx #5
2b38 : d0da                     bne tinc2
2b3a : ca                       dex
2b3b : ee0302                   inc abst
2b3e :                  tdec2    
                                set_stat 0
                       >            load_flag 0
2b3e : a900            >            lda #0             ;allow test to change I
                       >
2b40 : 48              >            pha         ;use stack to load status
2b41 : 28              >            plp
                        
2b42 : ce0302                   dec abst
                                tst_abs rINC,fINC,0
2b45 : 08              >            php         ;save flags
2b46 : ad0302          >            lda abst
2b49 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2b4c : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  191
-------------------------- 6502_functional_test.a65 --------------------------

                       >
2b4e : 68              >            pla         ;load status
                       >            eor_flag 0
2b4f : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2b51 : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2b54 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2b56 : ca                       dex
2b57 : 300b                     bmi tdec3
2b59 : e001                     cpx #1
2b5b : d0e1                     bne tdec2
2b5d : a981                     lda #$81
2b5f : 8d0302                   sta abst
2b62 : d0da                     bne tdec2
2b64 :                  tdec3
2b64 : a200                     ldx #0
2b66 : a97e                     lda #$7e
2b68 : 8d0302                   sta abst
2b6b :                  tinc12    
                                set_stat $ff
                       >            load_flag $ff
2b6b : a9ff            >            lda #$ff             ;allow test to change
                       >
2b6d : 48              >            pha         ;use stack to load status
2b6e : 28              >            plp
                        
2b6f : ee0302                   inc abst
                                tst_abs rINC,fINC,$ff-fnz
2b72 : 08              >            php         ;save flags
2b73 : ad0302          >            lda abst
2b76 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2b79 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2b7b : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2b7c : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2b7e : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2b81 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2b83 : e8                       inx
2b84 : e002                     cpx #2
2b86 : d005                     bne tinc13
2b88 : a9fe                     lda #$fe
2b8a : 8d0302                   sta abst
2b8d : e005             tinc13   cpx #5
2b8f : d0da                     bne tinc12
2b91 : ca                       dex
2b92 : ee0302                   inc abst
2b95 :                  tdec12    
                                set_stat $ff
                       >            load_flag $ff
2b95 : a9ff            >            lda #$ff             ;allow test to change
                       >
2b97 : 48              >            pha         ;use stack to load status
2b98 : 28              >            plp
AS65 Assembler for R6502 [1.42].                                     Page  192
-------------------------- 6502_functional_test.a65 --------------------------

                        
2b99 : ce0302                   dec abst
                                tst_abs rINC,fINC,$ff-fnz
2b9c : 08              >            php         ;save flags
2b9d : ad0302          >            lda abst
2ba0 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2ba3 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2ba5 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2ba6 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2ba8 : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2bab : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2bad : ca                       dex
2bae : 300b                     bmi tdec13
2bb0 : e001                     cpx #1
2bb2 : d0e1                     bne tdec12
2bb4 : a981                     lda #$81
2bb6 : 8d0302                   sta abst
2bb9 : d0da                     bne tdec12
2bbb :                  tdec13
                                next_test
2bbb : ad0002          >            lda test_case   ;previous test
2bbe : c923            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
2bc0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0024 =                 >test_num = test_num + 1
2bc2 : a924            >            lda #test_num   ;*** next tests' number
2bc4 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; zeropage indexed
2bc7 : a200                     ldx #0
2bc9 : a97e                     lda #$7e
2bcb : 950c             tinc4   sta zpt,x
                                set_stat 0
                       >            load_flag 0
2bcd : a900            >            lda #0             ;allow test to change I
                       >
2bcf : 48              >            pha         ;use stack to load status
2bd0 : 28              >            plp
                        
2bd1 : f60c                     inc zpt,x
                                tst_zx rINC,fINC,0
2bd3 : 08              >            php         ;save flags
2bd4 : b50c            >            lda zpt,x
2bd6 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2bd9 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2bdb : 68              >            pla         ;load status
                       >            eor_flag 0
2bdc : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2bde : dd5602          >            cmp fINC,x    ;test flags
AS65 Assembler for R6502 [1.42].                                     Page  193
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
2be1 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2be3 : b50c                     lda zpt,x
2be5 : e8                       inx
2be6 : e002                     cpx #2
2be8 : d002                     bne tinc5
2bea : a9fe                     lda #$fe
2bec : e005             tinc5   cpx #5
2bee : d0db                     bne tinc4
2bf0 : ca                       dex
2bf1 : a902                     lda #2
2bf3 : 950c             tdec4   sta zpt,x 
                                set_stat 0
                       >            load_flag 0
2bf5 : a900            >            lda #0             ;allow test to change I
                       >
2bf7 : 48              >            pha         ;use stack to load status
2bf8 : 28              >            plp
                        
2bf9 : d60c                     dec zpt,x
                                tst_zx rINC,fINC,0
2bfb : 08              >            php         ;save flags
2bfc : b50c            >            lda zpt,x
2bfe : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2c01 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2c03 : 68              >            pla         ;load status
                       >            eor_flag 0
2c04 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2c06 : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2c09 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2c0b : b50c                     lda zpt,x
2c0d : ca                       dex
2c0e : 3008                     bmi tdec5
2c10 : e001                     cpx #1
2c12 : d0df                     bne tdec4
2c14 : a981                     lda #$81
2c16 : d0db                     bne tdec4
2c18 :                  tdec5
2c18 : a200                     ldx #0
2c1a : a97e                     lda #$7e
2c1c : 950c             tinc14  sta zpt,x
                                set_stat $ff
                       >            load_flag $ff
2c1e : a9ff            >            lda #$ff             ;allow test to change
                       >
2c20 : 48              >            pha         ;use stack to load status
2c21 : 28              >            plp
                        
2c22 : f60c                     inc zpt,x
                                tst_zx rINC,fINC,$ff-fnz
2c24 : 08              >            php         ;save flags
2c25 : b50c            >            lda zpt,x
2c27 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
AS65 Assembler for R6502 [1.42].                                     Page  194
-------------------------- 6502_functional_test.a65 --------------------------

2c2a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2c2c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2c2d : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2c2f : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2c32 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2c34 : b50c                     lda zpt,x
2c36 : e8                       inx
2c37 : e002                     cpx #2
2c39 : d002                     bne tinc15
2c3b : a9fe                     lda #$fe
2c3d : e005             tinc15  cpx #5
2c3f : d0db                     bne tinc14
2c41 : ca                       dex
2c42 : a902                     lda #2
2c44 : 950c             tdec14  sta zpt,x 
                                set_stat $ff
                       >            load_flag $ff
2c46 : a9ff            >            lda #$ff             ;allow test to change
                       >
2c48 : 48              >            pha         ;use stack to load status
2c49 : 28              >            plp
                        
2c4a : d60c                     dec zpt,x
                                tst_zx rINC,fINC,$ff-fnz
2c4c : 08              >            php         ;save flags
2c4d : b50c            >            lda zpt,x
2c4f : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2c52 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2c54 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2c55 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2c57 : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2c5a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2c5c : b50c                     lda zpt,x
2c5e : ca                       dex
2c5f : 3008                     bmi tdec15
2c61 : e001                     cpx #1
2c63 : d0df                     bne tdec14
2c65 : a981                     lda #$81
2c67 : d0db                     bne tdec14
2c69 :                  tdec15
                                next_test
2c69 : ad0002          >            lda test_case   ;previous test
2c6c : c924            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
2c6e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0025 =                 >test_num = test_num + 1
2c70 : a925            >            lda #test_num   ;*** next tests' number
2c72 : 8d0002          >            sta test_case
AS65 Assembler for R6502 [1.42].                                     Page  195
-------------------------- 6502_functional_test.a65 --------------------------

                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; memory indexed
2c75 : a200                     ldx #0
2c77 : a97e                     lda #$7e
2c79 : 9d0302           tinc6   sta abst,x
                                set_stat 0
                       >            load_flag 0
2c7c : a900            >            lda #0             ;allow test to change I
                       >
2c7e : 48              >            pha         ;use stack to load status
2c7f : 28              >            plp
                        
2c80 : fe0302                   inc abst,x
                                tst_absx rINC,fINC,0
2c83 : 08              >            php         ;save flags
2c84 : bd0302          >            lda abst,x
2c87 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2c8a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2c8c : 68              >            pla         ;load status
                       >            eor_flag 0
2c8d : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2c8f : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2c92 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2c94 : bd0302                   lda abst,x
2c97 : e8                       inx
2c98 : e002                     cpx #2
2c9a : d002                     bne tinc7
2c9c : a9fe                     lda #$fe
2c9e : e005             tinc7   cpx #5
2ca0 : d0d7                     bne tinc6
2ca2 : ca                       dex
2ca3 : a902                     lda #2
2ca5 : 9d0302           tdec6   sta abst,x 
                                set_stat 0
                       >            load_flag 0
2ca8 : a900            >            lda #0             ;allow test to change I
                       >
2caa : 48              >            pha         ;use stack to load status
2cab : 28              >            plp
                        
2cac : de0302                   dec abst,x
                                tst_absx rINC,fINC,0
2caf : 08              >            php         ;save flags
2cb0 : bd0302          >            lda abst,x
2cb3 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2cb6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2cb8 : 68              >            pla         ;load status
                       >            eor_flag 0
2cb9 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2cbb : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
AS65 Assembler for R6502 [1.42].                                     Page  196
-------------------------- 6502_functional_test.a65 --------------------------

2cbe : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2cc0 : bd0302                   lda abst,x
2cc3 : ca                       dex
2cc4 : 3008                     bmi tdec7
2cc6 : e001                     cpx #1
2cc8 : d0db                     bne tdec6
2cca : a981                     lda #$81
2ccc : d0d7                     bne tdec6
2cce :                  tdec7
2cce : a200                     ldx #0
2cd0 : a97e                     lda #$7e
2cd2 : 9d0302           tinc16  sta abst,x
                                set_stat $ff
                       >            load_flag $ff
2cd5 : a9ff            >            lda #$ff             ;allow test to change
                       >
2cd7 : 48              >            pha         ;use stack to load status
2cd8 : 28              >            plp
                        
2cd9 : fe0302                   inc abst,x
                                tst_absx rINC,fINC,$ff-fnz
2cdc : 08              >            php         ;save flags
2cdd : bd0302          >            lda abst,x
2ce0 : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2ce3 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2ce5 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2ce6 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2ce8 : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2ceb : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2ced : bd0302                   lda abst,x
2cf0 : e8                       inx
2cf1 : e002                     cpx #2
2cf3 : d002                     bne tinc17
2cf5 : a9fe                     lda #$fe
2cf7 : e005             tinc17  cpx #5
2cf9 : d0d7                     bne tinc16
2cfb : ca                       dex
2cfc : a902                     lda #2
2cfe : 9d0302           tdec16  sta abst,x 
                                set_stat $ff
                       >            load_flag $ff
2d01 : a9ff            >            lda #$ff             ;allow test to change
                       >
2d03 : 48              >            pha         ;use stack to load status
2d04 : 28              >            plp
                        
2d05 : de0302                   dec abst,x
                                tst_absx rINC,fINC,$ff-fnz
2d08 : 08              >            php         ;save flags
2d09 : bd0302          >            lda abst,x
2d0c : dd5102          >            cmp rINC,x    ;test result
                       >            trap_ne
2d0f : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  197
-------------------------- 6502_functional_test.a65 --------------------------

                       >
2d11 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2d12 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2d14 : dd5602          >            cmp fINC,x    ;test flags
                       >            trap_ne
2d17 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2d19 : bd0302                   lda abst,x
2d1c : ca                       dex
2d1d : 3008                     bmi tdec17
2d1f : e001                     cpx #1
2d21 : d0db                     bne tdec16
2d23 : a981                     lda #$81
2d25 : d0d7                     bne tdec16
2d27 :                  tdec17
                                next_test
2d27 : ad0002          >            lda test_case   ;previous test
2d2a : c925            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
2d2c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0026 =                 >test_num = test_num + 1
2d2e : a926            >            lda #test_num   ;*** next tests' number
2d30 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; testing logical instructions - AND EOR ORA all addre
                        ; AND
2d33 : a203                     ldx #3          ;immediate
2d35 : b51e             tand    lda zpAN,x
2d37 : 8d0a02                   sta ex_andi+1   ;set AND # operand
                                set_ax  absANa,0
                       >            load_flag 0
2d3a : a900            >            lda #0             ;allow test to change I
                       >
2d3c : 48              >            pha         ;use stack to load status
2d3d : bd6b02          >            lda absANa,x    ;precharge accu
2d40 : 28              >            plp
                        
2d41 : 200902                   jsr ex_andi     ;execute AND # in RAM
                                tst_ax  absrlo,absflo,0
2d44 : 08              >            php         ;save flags
2d45 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2d48 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2d4a : 68              >            pla         ;load status
                       >            eor_flag 0
2d4b : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2d4d : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2d50 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2d52 : ca                       dex
2d53 : 10e0                     bpl tand
2d55 : a203                     ldx #3
AS65 Assembler for R6502 [1.42].                                     Page  198
-------------------------- 6502_functional_test.a65 --------------------------

2d57 : b51e             tand1   lda zpAN,x
2d59 : 8d0a02                   sta ex_andi+1   ;set AND # operand
                                set_ax  absANa,$ff
                       >            load_flag $ff
2d5c : a9ff            >            lda #$ff             ;allow test to change
                       >
2d5e : 48              >            pha         ;use stack to load status
2d5f : bd6b02          >            lda absANa,x    ;precharge accu
2d62 : 28              >            plp
                        
2d63 : 200902                   jsr ex_andi     ;execute AND # in RAM
                                tst_ax  absrlo,absflo,$ff-fnz
2d66 : 08              >            php         ;save flags
2d67 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2d6a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2d6c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2d6d : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2d6f : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2d72 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2d74 : ca                       dex
2d75 : 10e0                     bpl tand1
                            
2d77 : a203                     ldx #3      ;zp
2d79 : b51e             tand2   lda zpAN,x
2d7b : 850c                     sta zpt
                                set_ax  absANa,0
                       >            load_flag 0
2d7d : a900            >            lda #0             ;allow test to change I
                       >
2d7f : 48              >            pha         ;use stack to load status
2d80 : bd6b02          >            lda absANa,x    ;precharge accu
2d83 : 28              >            plp
                        
2d84 : 250c                     and zpt
                                tst_ax  absrlo,absflo,0
2d86 : 08              >            php         ;save flags
2d87 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2d8a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2d8c : 68              >            pla         ;load status
                       >            eor_flag 0
2d8d : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2d8f : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2d92 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2d94 : ca                       dex
2d95 : 10e2                     bpl tand2
2d97 : a203                     ldx #3
2d99 : b51e             tand3   lda zpAN,x
2d9b : 850c                     sta zpt
                                set_ax  absANa,$ff
AS65 Assembler for R6502 [1.42].                                     Page  199
-------------------------- 6502_functional_test.a65 --------------------------

                       >            load_flag $ff
2d9d : a9ff            >            lda #$ff             ;allow test to change
                       >
2d9f : 48              >            pha         ;use stack to load status
2da0 : bd6b02          >            lda absANa,x    ;precharge accu
2da3 : 28              >            plp
                        
2da4 : 250c                     and zpt
                                tst_ax  absrlo,absflo,$ff-fnz
2da6 : 08              >            php         ;save flags
2da7 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2daa : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2dac : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2dad : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2daf : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2db2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2db4 : ca                       dex
2db5 : 10e2                     bpl tand3
                        
2db7 : a203                     ldx #3      ;abs
2db9 : b51e             tand4   lda zpAN,x
2dbb : 8d0302                   sta abst
                                set_ax  absANa,0
                       >            load_flag 0
2dbe : a900            >            lda #0             ;allow test to change I
                       >
2dc0 : 48              >            pha         ;use stack to load status
2dc1 : bd6b02          >            lda absANa,x    ;precharge accu
2dc4 : 28              >            plp
                        
2dc5 : 2d0302                   and abst
                                tst_ax  absrlo,absflo,0
2dc8 : 08              >            php         ;save flags
2dc9 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2dcc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2dce : 68              >            pla         ;load status
                       >            eor_flag 0
2dcf : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2dd1 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2dd4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2dd6 : ca                       dex
2dd7 : 10e0                     bpl tand4
2dd9 : a203                     ldx #3
2ddb : b51e             tand5   lda zpAN,x
2ddd : 8d0302                   sta abst
                                set_ax  absANa,$ff
                       >            load_flag $ff
2de0 : a9ff            >            lda #$ff             ;allow test to change
                       >
AS65 Assembler for R6502 [1.42].                                     Page  200
-------------------------- 6502_functional_test.a65 --------------------------

2de2 : 48              >            pha         ;use stack to load status
2de3 : bd6b02          >            lda absANa,x    ;precharge accu
2de6 : 28              >            plp
                        
2de7 : 2d0302                   and abst
                                tst_ax  absrlo,absflo,$ff-fnz
2dea : 08              >            php         ;save flags
2deb : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2dee : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2df0 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2df1 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2df3 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2df6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2df8 : ca                       dex
2df9 : 1002                     bpl tand6
                        
2dfb : a203                     ldx #3      ;zp,x
2dfd :                  tand6
                                set_ax  absANa,0
                       >            load_flag 0
2dfd : a900            >            lda #0             ;allow test to change I
                       >
2dff : 48              >            pha         ;use stack to load status
2e00 : bd6b02          >            lda absANa,x    ;precharge accu
2e03 : 28              >            plp
                        
2e04 : 351e                     and zpAN,x
                                tst_ax  absrlo,absflo,0
2e06 : 08              >            php         ;save flags
2e07 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2e0a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2e0c : 68              >            pla         ;load status
                       >            eor_flag 0
2e0d : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2e0f : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2e12 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2e14 : ca                       dex
2e15 : 10e6                     bpl tand6
2e17 : a203                     ldx #3
2e19 :                  tand7
                                set_ax  absANa,$ff
                       >            load_flag $ff
2e19 : a9ff            >            lda #$ff             ;allow test to change
                       >
2e1b : 48              >            pha         ;use stack to load status
2e1c : bd6b02          >            lda absANa,x    ;precharge accu
2e1f : 28              >            plp
                        
2e20 : 351e                     and zpAN,x
AS65 Assembler for R6502 [1.42].                                     Page  201
-------------------------- 6502_functional_test.a65 --------------------------

                                tst_ax  absrlo,absflo,$ff-fnz
2e22 : 08              >            php         ;save flags
2e23 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2e26 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2e28 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2e29 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2e2b : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2e2e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2e30 : ca                       dex
2e31 : 10e6                     bpl tand7
                        
2e33 : a203                     ldx #3      ;abs,x
2e35 :                  tand8
                                set_ax  absANa,0
                       >            load_flag 0
2e35 : a900            >            lda #0             ;allow test to change I
                       >
2e37 : 48              >            pha         ;use stack to load status
2e38 : bd6b02          >            lda absANa,x    ;precharge accu
2e3b : 28              >            plp
                        
2e3c : 3d5f02                   and absAN,x
                                tst_ax  absrlo,absflo,0
2e3f : 08              >            php         ;save flags
2e40 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2e43 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2e45 : 68              >            pla         ;load status
                       >            eor_flag 0
2e46 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2e48 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2e4b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2e4d : ca                       dex
2e4e : 10e5                     bpl tand8
2e50 : a203                     ldx #3
2e52 :                  tand9
                                set_ax  absANa,$ff
                       >            load_flag $ff
2e52 : a9ff            >            lda #$ff             ;allow test to change
                       >
2e54 : 48              >            pha         ;use stack to load status
2e55 : bd6b02          >            lda absANa,x    ;precharge accu
2e58 : 28              >            plp
                        
2e59 : 3d5f02                   and absAN,x
                                tst_ax  absrlo,absflo,$ff-fnz
2e5c : 08              >            php         ;save flags
2e5d : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2e60 : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  202
-------------------------- 6502_functional_test.a65 --------------------------

                       >
2e62 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2e63 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2e65 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2e68 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2e6a : ca                       dex
2e6b : 10e5                     bpl tand9
                        
2e6d : a003                     ldy #3      ;abs,y
2e6f :                  tand10
                                set_ay  absANa,0
                       >            load_flag 0
2e6f : a900            >            lda #0             ;allow test to change I
                       >
2e71 : 48              >            pha         ;use stack to load status
2e72 : b96b02          >            lda absANa,y    ;precharge accu
2e75 : 28              >            plp
                        
2e76 : 395f02                   and absAN,y
                                tst_ay  absrlo,absflo,0
2e79 : 08              >            php         ;save flags
2e7a : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
2e7d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2e7f : 68              >            pla         ;load status
                       >            eor_flag 0
2e80 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2e82 : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
2e85 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2e87 : 88                       dey
2e88 : 10e5                     bpl tand10
2e8a : a003                     ldy #3
2e8c :                  tand11
                                set_ay  absANa,$ff
                       >            load_flag $ff
2e8c : a9ff            >            lda #$ff             ;allow test to change
                       >
2e8e : 48              >            pha         ;use stack to load status
2e8f : b96b02          >            lda absANa,y    ;precharge accu
2e92 : 28              >            plp
                        
2e93 : 395f02                   and absAN,y
                                tst_ay  absrlo,absflo,$ff-fnz
2e96 : 08              >            php         ;save flags
2e97 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
2e9a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2e9c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2e9d : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
AS65 Assembler for R6502 [1.42].                                     Page  203
-------------------------- 6502_functional_test.a65 --------------------------

2e9f : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
2ea2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2ea4 : 88                       dey
2ea5 : 10e5                     bpl tand11
                        
2ea7 : a206                     ldx #6      ;(zp,x)
2ea9 : a003                     ldy #3
2eab :                  tand12
                                set_ay  absANa,0
                       >            load_flag 0
2eab : a900            >            lda #0             ;allow test to change I
                       >
2ead : 48              >            pha         ;use stack to load status
2eae : b96b02          >            lda absANa,y    ;precharge accu
2eb1 : 28              >            plp
                        
2eb2 : 213c                     and (indAN,x)
                                tst_ay  absrlo,absflo,0
2eb4 : 08              >            php         ;save flags
2eb5 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
2eb8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2eba : 68              >            pla         ;load status
                       >            eor_flag 0
2ebb : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2ebd : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
2ec0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2ec2 : ca                       dex
2ec3 : ca                       dex
2ec4 : 88                       dey
2ec5 : 10e4                     bpl tand12
2ec7 : a206                     ldx #6
2ec9 : a003                     ldy #3
2ecb :                  tand13
                                set_ay  absANa,$ff
                       >            load_flag $ff
2ecb : a9ff            >            lda #$ff             ;allow test to change
                       >
2ecd : 48              >            pha         ;use stack to load status
2ece : b96b02          >            lda absANa,y    ;precharge accu
2ed1 : 28              >            plp
                        
2ed2 : 213c                     and (indAN,x)
                                tst_ay  absrlo,absflo,$ff-fnz
2ed4 : 08              >            php         ;save flags
2ed5 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
2ed8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2eda : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2edb : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2edd : d97702          >            cmp absflo,y    ;test flags
AS65 Assembler for R6502 [1.42].                                     Page  204
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
2ee0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2ee2 : ca                       dex
2ee3 : ca                       dex
2ee4 : 88                       dey
2ee5 : 10e4                     bpl tand13
                        
2ee7 : a003                     ldy #3      ;(zp),y
2ee9 :                  tand14
                                set_ay  absANa,0
                       >            load_flag 0
2ee9 : a900            >            lda #0             ;allow test to change I
                       >
2eeb : 48              >            pha         ;use stack to load status
2eec : b96b02          >            lda absANa,y    ;precharge accu
2eef : 28              >            plp
                        
2ef0 : 313c                     and (indAN),y
                                tst_ay  absrlo,absflo,0
2ef2 : 08              >            php         ;save flags
2ef3 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
2ef6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2ef8 : 68              >            pla         ;load status
                       >            eor_flag 0
2ef9 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2efb : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
2efe : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2f00 : 88                       dey
2f01 : 10e6                     bpl tand14
2f03 : a003                     ldy #3
2f05 :                  tand15
                                set_ay  absANa,$ff
                       >            load_flag $ff
2f05 : a9ff            >            lda #$ff             ;allow test to change
                       >
2f07 : 48              >            pha         ;use stack to load status
2f08 : b96b02          >            lda absANa,y    ;precharge accu
2f0b : 28              >            plp
                        
2f0c : 313c                     and (indAN),y
                                tst_ay  absrlo,absflo,$ff-fnz
2f0e : 08              >            php         ;save flags
2f0f : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
2f12 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2f14 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2f15 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2f17 : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
2f1a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
AS65 Assembler for R6502 [1.42].                                     Page  205
-------------------------- 6502_functional_test.a65 --------------------------

                        
2f1c : 88                       dey
2f1d : 10e6                     bpl tand15
                                next_test
2f1f : ad0002          >            lda test_case   ;previous test
2f22 : c926            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
2f24 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0027 =                 >test_num = test_num + 1
2f26 : a927            >            lda #test_num   ;*** next tests' number
2f28 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; EOR
2f2b : a203                     ldx #3          ;immediate - self modifying co
2f2d : b522             teor    lda zpEO,x
2f2f : 8d0d02                   sta ex_eori+1   ;set EOR # operand
                                set_ax  absEOa,0
                       >            load_flag 0
2f32 : a900            >            lda #0             ;allow test to change I
                       >
2f34 : 48              >            pha         ;use stack to load status
2f35 : bd6f02          >            lda absEOa,x    ;precharge accu
2f38 : 28              >            plp
                        
2f39 : 200c02                   jsr ex_eori     ;execute EOR # in RAM
                                tst_ax  absrlo,absflo,0
2f3c : 08              >            php         ;save flags
2f3d : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2f40 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2f42 : 68              >            pla         ;load status
                       >            eor_flag 0
2f43 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2f45 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2f48 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2f4a : ca                       dex
2f4b : 10e0                     bpl teor
2f4d : a203                     ldx #3
2f4f : b522             teor1   lda zpEO,x
2f51 : 8d0d02                   sta ex_eori+1   ;set EOR # operand
                                set_ax  absEOa,$ff
                       >            load_flag $ff
2f54 : a9ff            >            lda #$ff             ;allow test to change
                       >
2f56 : 48              >            pha         ;use stack to load status
2f57 : bd6f02          >            lda absEOa,x    ;precharge accu
2f5a : 28              >            plp
                        
2f5b : 200c02                   jsr ex_eori     ;execute EOR # in RAM
                                tst_ax  absrlo,absflo,$ff-fnz
2f5e : 08              >            php         ;save flags
2f5f : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2f62 : d0fe            >        bne *           ;failed not equal (non zero)
AS65 Assembler for R6502 [1.42].                                     Page  206
-------------------------- 6502_functional_test.a65 --------------------------

                       >
2f64 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2f65 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2f67 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2f6a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2f6c : ca                       dex
2f6d : 10e0                     bpl teor1
                            
2f6f : a203                     ldx #3      ;zp
2f71 : b522             teor2    lda zpEO,x
2f73 : 850c                     sta zpt
                                set_ax  absEOa,0
                       >            load_flag 0
2f75 : a900            >            lda #0             ;allow test to change I
                       >
2f77 : 48              >            pha         ;use stack to load status
2f78 : bd6f02          >            lda absEOa,x    ;precharge accu
2f7b : 28              >            plp
                        
2f7c : 450c                     eor zpt
                                tst_ax  absrlo,absflo,0
2f7e : 08              >            php         ;save flags
2f7f : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2f82 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2f84 : 68              >            pla         ;load status
                       >            eor_flag 0
2f85 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2f87 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2f8a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2f8c : ca                       dex
2f8d : 10e2                     bpl teor2
2f8f : a203                     ldx #3
2f91 : b522             teor3   lda zpEO,x
2f93 : 850c                     sta zpt
                                set_ax  absEOa,$ff
                       >            load_flag $ff
2f95 : a9ff            >            lda #$ff             ;allow test to change
                       >
2f97 : 48              >            pha         ;use stack to load status
2f98 : bd6f02          >            lda absEOa,x    ;precharge accu
2f9b : 28              >            plp
                        
2f9c : 450c                     eor zpt
                                tst_ax  absrlo,absflo,$ff-fnz
2f9e : 08              >            php         ;save flags
2f9f : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2fa2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2fa4 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
AS65 Assembler for R6502 [1.42].                                     Page  207
-------------------------- 6502_functional_test.a65 --------------------------

2fa5 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2fa7 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2faa : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2fac : ca                       dex
2fad : 10e2                     bpl teor3
                        
2faf : a203                     ldx #3      ;abs
2fb1 : b522             teor4   lda zpEO,x
2fb3 : 8d0302                   sta abst
                                set_ax  absEOa,0
                       >            load_flag 0
2fb6 : a900            >            lda #0             ;allow test to change I
                       >
2fb8 : 48              >            pha         ;use stack to load status
2fb9 : bd6f02          >            lda absEOa,x    ;precharge accu
2fbc : 28              >            plp
                        
2fbd : 4d0302                   eor abst
                                tst_ax  absrlo,absflo,0
2fc0 : 08              >            php         ;save flags
2fc1 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2fc4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2fc6 : 68              >            pla         ;load status
                       >            eor_flag 0
2fc7 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
2fc9 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
2fcc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2fce : ca                       dex
2fcf : 10e0                     bpl teor4
2fd1 : a203                     ldx #3
2fd3 : b522             teor5   lda zpEO,x
2fd5 : 8d0302                   sta abst
                                set_ax  absEOa,$ff
                       >            load_flag $ff
2fd8 : a9ff            >            lda #$ff             ;allow test to change
                       >
2fda : 48              >            pha         ;use stack to load status
2fdb : bd6f02          >            lda absEOa,x    ;precharge accu
2fde : 28              >            plp
                        
2fdf : 4d0302                   eor abst
                                tst_ax  absrlo,absflo,$ff-fnz
2fe2 : 08              >            php         ;save flags
2fe3 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
2fe6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
2fe8 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
2fe9 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
2feb : dd7702          >            cmp absflo,x    ;test flags
AS65 Assembler for R6502 [1.42].                                     Page  208
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne     ;
2fee : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
2ff0 : ca                       dex
2ff1 : 1002                     bpl teor6
                        
2ff3 : a203                     ldx #3      ;zp,x
2ff5 :                  teor6
                                set_ax  absEOa,0
                       >            load_flag 0
2ff5 : a900            >            lda #0             ;allow test to change I
                       >
2ff7 : 48              >            pha         ;use stack to load status
2ff8 : bd6f02          >            lda absEOa,x    ;precharge accu
2ffb : 28              >            plp
                        
2ffc : 5522                     eor zpEO,x
                                tst_ax  absrlo,absflo,0
2ffe : 08              >            php         ;save flags
2fff : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
3002 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
3004 : 68              >            pla         ;load status
                       >            eor_flag 0
3005 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
3007 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
300a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
300c : ca                       dex
300d : 10e6                     bpl teor6
300f : a203                     ldx #3
3011 :                  teor7
                                set_ax  absEOa,$ff
                       >            load_flag $ff
3011 : a9ff            >            lda #$ff             ;allow test to change
                       >
3013 : 48              >            pha         ;use stack to load status
3014 : bd6f02          >            lda absEOa,x    ;precharge accu
3017 : 28              >            plp
                        
3018 : 5522                     eor zpEO,x
                                tst_ax  absrlo,absflo,$ff-fnz
301a : 08              >            php         ;save flags
301b : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
301e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
3020 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
3021 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
3023 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
3026 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3028 : ca                       dex
AS65 Assembler for R6502 [1.42].                                     Page  209
-------------------------- 6502_functional_test.a65 --------------------------

3029 : 10e6                     bpl teor7
                        
302b : a203                     ldx #3      ;abs,x
302d :                  teor8
                                set_ax  absEOa,0
                       >            load_flag 0
302d : a900            >            lda #0             ;allow test to change I
                       >
302f : 48              >            pha         ;use stack to load status
3030 : bd6f02          >            lda absEOa,x    ;precharge accu
3033 : 28              >            plp
                        
3034 : 5d6302                   eor absEO,x
                                tst_ax  absrlo,absflo,0
3037 : 08              >            php         ;save flags
3038 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
303b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
303d : 68              >            pla         ;load status
                       >            eor_flag 0
303e : 4930            >            eor #0|fao         ;invert expected flags 
                       >
3040 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
3043 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3045 : ca                       dex
3046 : 10e5                     bpl teor8
3048 : a203                     ldx #3
304a :                  teor9
                                set_ax  absEOa,$ff
                       >            load_flag $ff
304a : a9ff            >            lda #$ff             ;allow test to change
                       >
304c : 48              >            pha         ;use stack to load status
304d : bd6f02          >            lda absEOa,x    ;precharge accu
3050 : 28              >            plp
                        
3051 : 5d6302                   eor absEO,x
                                tst_ax  absrlo,absflo,$ff-fnz
3054 : 08              >            php         ;save flags
3055 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
3058 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
305a : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
305b : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
305d : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
3060 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3062 : ca                       dex
3063 : 10e5                     bpl teor9
                        
3065 : a003                     ldy #3      ;abs,y
3067 :                  teor10
                                set_ay  absEOa,0
AS65 Assembler for R6502 [1.42].                                     Page  210
-------------------------- 6502_functional_test.a65 --------------------------

                       >            load_flag 0
3067 : a900            >            lda #0             ;allow test to change I
                       >
3069 : 48              >            pha         ;use stack to load status
306a : b96f02          >            lda absEOa,y    ;precharge accu
306d : 28              >            plp
                        
306e : 596302                   eor absEO,y
                                tst_ay  absrlo,absflo,0
3071 : 08              >            php         ;save flags
3072 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
3075 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
3077 : 68              >            pla         ;load status
                       >            eor_flag 0
3078 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
307a : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
307d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
307f : 88                       dey
3080 : 10e5                     bpl teor10
3082 : a003                     ldy #3
3084 :                  teor11
                                set_ay  absEOa,$ff
                       >            load_flag $ff
3084 : a9ff            >            lda #$ff             ;allow test to change
                       >
3086 : 48              >            pha         ;use stack to load status
3087 : b96f02          >            lda absEOa,y    ;precharge accu
308a : 28              >            plp
                        
308b : 596302                   eor absEO,y
                                tst_ay  absrlo,absflo,$ff-fnz
308e : 08              >            php         ;save flags
308f : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
3092 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
3094 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
3095 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
3097 : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
309a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
309c : 88                       dey
309d : 10e5                     bpl teor11
                        
309f : a206                     ldx #6      ;(zp,x)
30a1 : a003                     ldy #3
30a3 :                  teor12
                                set_ay  absEOa,0
                       >            load_flag 0
30a3 : a900            >            lda #0             ;allow test to change I
                       >
30a5 : 48              >            pha         ;use stack to load status
AS65 Assembler for R6502 [1.42].                                     Page  211
-------------------------- 6502_functional_test.a65 --------------------------

30a6 : b96f02          >            lda absEOa,y    ;precharge accu
30a9 : 28              >            plp
                        
30aa : 4144                     eor (indEO,x)
                                tst_ay  absrlo,absflo,0
30ac : 08              >            php         ;save flags
30ad : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
30b0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
30b2 : 68              >            pla         ;load status
                       >            eor_flag 0
30b3 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
30b5 : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
30b8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
30ba : ca                       dex
30bb : ca                       dex
30bc : 88                       dey
30bd : 10e4                     bpl teor12
30bf : a206                     ldx #6
30c1 : a003                     ldy #3
30c3 :                  teor13
                                set_ay  absEOa,$ff
                       >            load_flag $ff
30c3 : a9ff            >            lda #$ff             ;allow test to change
                       >
30c5 : 48              >            pha         ;use stack to load status
30c6 : b96f02          >            lda absEOa,y    ;precharge accu
30c9 : 28              >            plp
                        
30ca : 4144                     eor (indEO,x)
                                tst_ay  absrlo,absflo,$ff-fnz
30cc : 08              >            php         ;save flags
30cd : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
30d0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
30d2 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
30d3 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
30d5 : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
30d8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
30da : ca                       dex
30db : ca                       dex
30dc : 88                       dey
30dd : 10e4                     bpl teor13
                        
30df : a003                     ldy #3      ;(zp),y
30e1 :                  teor14
                                set_ay  absEOa,0
                       >            load_flag 0
30e1 : a900            >            lda #0             ;allow test to change I
                       >
30e3 : 48              >            pha         ;use stack to load status
AS65 Assembler for R6502 [1.42].                                     Page  212
-------------------------- 6502_functional_test.a65 --------------------------

30e4 : b96f02          >            lda absEOa,y    ;precharge accu
30e7 : 28              >            plp
                        
30e8 : 5144                     eor (indEO),y
                                tst_ay  absrlo,absflo,0
30ea : 08              >            php         ;save flags
30eb : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
30ee : d0fe            >        bne *           ;failed not equal (non zero)
                       >
30f0 : 68              >            pla         ;load status
                       >            eor_flag 0
30f1 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
30f3 : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
30f6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
30f8 : 88                       dey
30f9 : 10e6                     bpl teor14
30fb : a003                     ldy #3
30fd :                  teor15
                                set_ay  absEOa,$ff
                       >            load_flag $ff
30fd : a9ff            >            lda #$ff             ;allow test to change
                       >
30ff : 48              >            pha         ;use stack to load status
3100 : b96f02          >            lda absEOa,y    ;precharge accu
3103 : 28              >            plp
                        
3104 : 5144                     eor (indEO),y
                                tst_ay  absrlo,absflo,$ff-fnz
3106 : 08              >            php         ;save flags
3107 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
310a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
310c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
310d : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
310f : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
3112 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3114 : 88                       dey
3115 : 10e6                     bpl teor15
                                next_test
3117 : ad0002          >            lda test_case   ;previous test
311a : c927            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
311c : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0028 =                 >test_num = test_num + 1
311e : a928            >            lda #test_num   ;*** next tests' number
3120 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; OR
AS65 Assembler for R6502 [1.42].                                     Page  213
-------------------------- 6502_functional_test.a65 --------------------------

3123 : a203                     ldx #3          ;immediate - self modifying co
3125 : b51a             tora    lda zpOR,x
3127 : 8d1002                   sta ex_orai+1   ;set ORA # operand
                                set_ax  absORa,0
                       >            load_flag 0
312a : a900            >            lda #0             ;allow test to change I
                       >
312c : 48              >            pha         ;use stack to load status
312d : bd6702          >            lda absORa,x    ;precharge accu
3130 : 28              >            plp
                        
3131 : 200f02                   jsr ex_orai     ;execute ORA # in RAM
                                tst_ax  absrlo,absflo,0
3134 : 08              >            php         ;save flags
3135 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
3138 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
313a : 68              >            pla         ;load status
                       >            eor_flag 0
313b : 4930            >            eor #0|fao         ;invert expected flags 
                       >
313d : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
3140 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3142 : ca                       dex
3143 : 10e0                     bpl tora
3145 : a203                     ldx #3
3147 : b51a             tora1   lda zpOR,x
3149 : 8d1002                   sta ex_orai+1   ;set ORA # operand
                                set_ax  absORa,$ff
                       >            load_flag $ff
314c : a9ff            >            lda #$ff             ;allow test to change
                       >
314e : 48              >            pha         ;use stack to load status
314f : bd6702          >            lda absORa,x    ;precharge accu
3152 : 28              >            plp
                        
3153 : 200f02                   jsr ex_orai     ;execute ORA # in RAM
                                tst_ax  absrlo,absflo,$ff-fnz
3156 : 08              >            php         ;save flags
3157 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
315a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
315c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
315d : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
315f : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
3162 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3164 : ca                       dex
3165 : 10e0                     bpl tora1
                            
3167 : a203                     ldx #3      ;zp
3169 : b51a             tora2   lda zpOR,x
316b : 850c                     sta zpt
AS65 Assembler for R6502 [1.42].                                     Page  214
-------------------------- 6502_functional_test.a65 --------------------------

                                set_ax  absORa,0
                       >            load_flag 0
316d : a900            >            lda #0             ;allow test to change I
                       >
316f : 48              >            pha         ;use stack to load status
3170 : bd6702          >            lda absORa,x    ;precharge accu
3173 : 28              >            plp
                        
3174 : 050c                     ora zpt
                                tst_ax  absrlo,absflo,0
3176 : 08              >            php         ;save flags
3177 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
317a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
317c : 68              >            pla         ;load status
                       >            eor_flag 0
317d : 4930            >            eor #0|fao         ;invert expected flags 
                       >
317f : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
3182 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3184 : ca                       dex
3185 : 10e2                     bpl tora2
3187 : a203                     ldx #3
3189 : b51a             tora3   lda zpOR,x
318b : 850c                     sta zpt
                                set_ax  absORa,$ff
                       >            load_flag $ff
318d : a9ff            >            lda #$ff             ;allow test to change
                       >
318f : 48              >            pha         ;use stack to load status
3190 : bd6702          >            lda absORa,x    ;precharge accu
3193 : 28              >            plp
                        
3194 : 050c                     ora zpt
                                tst_ax  absrlo,absflo,$ff-fnz
3196 : 08              >            php         ;save flags
3197 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
319a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
319c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
319d : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
319f : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
31a2 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
31a4 : ca                       dex
31a5 : 10e2                     bpl tora3
                        
31a7 : a203                     ldx #3      ;abs
31a9 : b51a             tora4   lda zpOR,x
31ab : 8d0302                   sta abst
                                set_ax  absORa,0
                       >            load_flag 0
31ae : a900            >            lda #0             ;allow test to change I
AS65 Assembler for R6502 [1.42].                                     Page  215
-------------------------- 6502_functional_test.a65 --------------------------

                       >
31b0 : 48              >            pha         ;use stack to load status
31b1 : bd6702          >            lda absORa,x    ;precharge accu
31b4 : 28              >            plp
                        
31b5 : 0d0302                   ora abst
                                tst_ax  absrlo,absflo,0
31b8 : 08              >            php         ;save flags
31b9 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
31bc : d0fe            >        bne *           ;failed not equal (non zero)
                       >
31be : 68              >            pla         ;load status
                       >            eor_flag 0
31bf : 4930            >            eor #0|fao         ;invert expected flags 
                       >
31c1 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
31c4 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
31c6 : ca                       dex
31c7 : 10e0                     bpl tora4
31c9 : a203                     ldx #3
31cb : b51a             tora5   lda zpOR,x
31cd : 8d0302                   sta abst
                                set_ax  absORa,$ff
                       >            load_flag $ff
31d0 : a9ff            >            lda #$ff             ;allow test to change
                       >
31d2 : 48              >            pha         ;use stack to load status
31d3 : bd6702          >            lda absORa,x    ;precharge accu
31d6 : 28              >            plp
                        
31d7 : 0d0302                   ora abst
                                tst_ax  absrlo,absflo,$ff-fnz
31da : 08              >            php         ;save flags
31db : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
31de : d0fe            >        bne *           ;failed not equal (non zero)
                       >
31e0 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
31e1 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
31e3 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
31e6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
31e8 : ca                       dex
31e9 : 1002                     bpl tora6
                        
31eb : a203                     ldx #3      ;zp,x
31ed :                  tora6
                                set_ax  absORa,0
                       >            load_flag 0
31ed : a900            >            lda #0             ;allow test to change I
                       >
31ef : 48              >            pha         ;use stack to load status
31f0 : bd6702          >            lda absORa,x    ;precharge accu
31f3 : 28              >            plp
AS65 Assembler for R6502 [1.42].                                     Page  216
-------------------------- 6502_functional_test.a65 --------------------------

                        
31f4 : 151a                     ora zpOR,x
                                tst_ax  absrlo,absflo,0
31f6 : 08              >            php         ;save flags
31f7 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
31fa : d0fe            >        bne *           ;failed not equal (non zero)
                       >
31fc : 68              >            pla         ;load status
                       >            eor_flag 0
31fd : 4930            >            eor #0|fao         ;invert expected flags 
                       >
31ff : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
3202 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3204 : ca                       dex
3205 : 10e6                     bpl tora6
3207 : a203                     ldx #3
3209 :                  tora7
                                set_ax  absORa,$ff
                       >            load_flag $ff
3209 : a9ff            >            lda #$ff             ;allow test to change
                       >
320b : 48              >            pha         ;use stack to load status
320c : bd6702          >            lda absORa,x    ;precharge accu
320f : 28              >            plp
                        
3210 : 151a                     ora zpOR,x
                                tst_ax  absrlo,absflo,$ff-fnz
3212 : 08              >            php         ;save flags
3213 : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
3216 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
3218 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
3219 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
321b : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
321e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3220 : ca                       dex
3221 : 10e6                     bpl tora7
                        
3223 : a203                     ldx #3      ;abs,x
3225 :                  tora8
                                set_ax  absORa,0
                       >            load_flag 0
3225 : a900            >            lda #0             ;allow test to change I
                       >
3227 : 48              >            pha         ;use stack to load status
3228 : bd6702          >            lda absORa,x    ;precharge accu
322b : 28              >            plp
                        
322c : 1d5b02                   ora absOR,x
                                tst_ax  absrlo,absflo,0
322f : 08              >            php         ;save flags
3230 : dd7302          >            cmp absrlo,x    ;test result
AS65 Assembler for R6502 [1.42].                                     Page  217
-------------------------- 6502_functional_test.a65 --------------------------

                       >            trap_ne
3233 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
3235 : 68              >            pla         ;load status
                       >            eor_flag 0
3236 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
3238 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
323b : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
323d : ca                       dex
323e : 10e5                     bpl tora8
3240 : a203                     ldx #3
3242 :                  tora9
                                set_ax  absORa,$ff
                       >            load_flag $ff
3242 : a9ff            >            lda #$ff             ;allow test to change
                       >
3244 : 48              >            pha         ;use stack to load status
3245 : bd6702          >            lda absORa,x    ;precharge accu
3248 : 28              >            plp
                        
3249 : 1d5b02                   ora absOR,x
                                tst_ax  absrlo,absflo,$ff-fnz
324c : 08              >            php         ;save flags
324d : dd7302          >            cmp absrlo,x    ;test result
                       >            trap_ne
3250 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
3252 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
3253 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
3255 : dd7702          >            cmp absflo,x    ;test flags
                       >            trap_ne     ;
3258 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
325a : ca                       dex
325b : 10e5                     bpl tora9
                        
325d : a003                     ldy #3      ;abs,y
325f :                  tora10
                                set_ay  absORa,0
                       >            load_flag 0
325f : a900            >            lda #0             ;allow test to change I
                       >
3261 : 48              >            pha         ;use stack to load status
3262 : b96702          >            lda absORa,y    ;precharge accu
3265 : 28              >            plp
                        
3266 : 195b02                   ora absOR,y
                                tst_ay  absrlo,absflo,0
3269 : 08              >            php         ;save flags
326a : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
326d : d0fe            >        bne *           ;failed not equal (non zero)
                       >
326f : 68              >            pla         ;load status
                       >            eor_flag 0
AS65 Assembler for R6502 [1.42].                                     Page  218
-------------------------- 6502_functional_test.a65 --------------------------

3270 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
3272 : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
3275 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3277 : 88                       dey
3278 : 10e5                     bpl tora10
327a : a003                     ldy #3
327c :                  tora11
                                set_ay  absORa,$ff
                       >            load_flag $ff
327c : a9ff            >            lda #$ff             ;allow test to change
                       >
327e : 48              >            pha         ;use stack to load status
327f : b96702          >            lda absORa,y    ;precharge accu
3282 : 28              >            plp
                        
3283 : 195b02                   ora absOR,y
                                tst_ay  absrlo,absflo,$ff-fnz
3286 : 08              >            php         ;save flags
3287 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
328a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
328c : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
328d : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
328f : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
3292 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
3294 : 88                       dey
3295 : 10e5                     bpl tora11
                        
3297 : a206                     ldx #6      ;(zp,x)
3299 : a003                     ldy #3
329b :                  tora12
                                set_ay  absORa,0
                       >            load_flag 0
329b : a900            >            lda #0             ;allow test to change I
                       >
329d : 48              >            pha         ;use stack to load status
329e : b96702          >            lda absORa,y    ;precharge accu
32a1 : 28              >            plp
                        
32a2 : 014c                     ora (indOR,x)
                                tst_ay  absrlo,absflo,0
32a4 : 08              >            php         ;save flags
32a5 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
32a8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
32aa : 68              >            pla         ;load status
                       >            eor_flag 0
32ab : 4930            >            eor #0|fao         ;invert expected flags 
                       >
32ad : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
AS65 Assembler for R6502 [1.42].                                     Page  219
-------------------------- 6502_functional_test.a65 --------------------------

32b0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
32b2 : ca                       dex
32b3 : ca                       dex
32b4 : 88                       dey
32b5 : 10e4                     bpl tora12
32b7 : a206                     ldx #6
32b9 : a003                     ldy #3
32bb :                  tora13
                                set_ay  absORa,$ff
                       >            load_flag $ff
32bb : a9ff            >            lda #$ff             ;allow test to change
                       >
32bd : 48              >            pha         ;use stack to load status
32be : b96702          >            lda absORa,y    ;precharge accu
32c1 : 28              >            plp
                        
32c2 : 014c                     ora (indOR,x)
                                tst_ay  absrlo,absflo,$ff-fnz
32c4 : 08              >            php         ;save flags
32c5 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
32c8 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
32ca : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
32cb : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
32cd : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
32d0 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
32d2 : ca                       dex
32d3 : ca                       dex
32d4 : 88                       dey
32d5 : 10e4                     bpl tora13
                        
32d7 : a003                     ldy #3      ;(zp),y
32d9 :                  tora14
                                set_ay  absORa,0
                       >            load_flag 0
32d9 : a900            >            lda #0             ;allow test to change I
                       >
32db : 48              >            pha         ;use stack to load status
32dc : b96702          >            lda absORa,y    ;precharge accu
32df : 28              >            plp
                        
32e0 : 114c                     ora (indOR),y
                                tst_ay  absrlo,absflo,0
32e2 : 08              >            php         ;save flags
32e3 : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
32e6 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
32e8 : 68              >            pla         ;load status
                       >            eor_flag 0
32e9 : 4930            >            eor #0|fao         ;invert expected flags 
                       >
32eb : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
AS65 Assembler for R6502 [1.42].                                     Page  220
-------------------------- 6502_functional_test.a65 --------------------------

32ee : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
32f0 : 88                       dey
32f1 : 10e6                     bpl tora14
32f3 : a003                     ldy #3
32f5 :                  tora15
                                set_ay  absORa,$ff
                       >            load_flag $ff
32f5 : a9ff            >            lda #$ff             ;allow test to change
                       >
32f7 : 48              >            pha         ;use stack to load status
32f8 : b96702          >            lda absORa,y    ;precharge accu
32fb : 28              >            plp
                        
32fc : 114c                     ora (indOR),y
                                tst_ay  absrlo,absflo,$ff-fnz
32fe : 08              >            php         ;save flags
32ff : d97302          >            cmp absrlo,y    ;test result
                       >            trap_ne     ;
3302 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
3304 : 68              >            pla         ;load status
                       >            eor_flag $ff-fnz
3305 : 497d            >            eor #$ff-fnz|fao         ;invert expected 
                       >
3307 : d97702          >            cmp absflo,y    ;test flags
                       >            trap_ne
330a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
                        
330c : 88                       dey
330d : 10e6                     bpl tora15
                            if I_flag = 3
330f : 58                       cli
                            endif                
                                next_test
3310 : ad0002          >            lda test_case   ;previous test
3313 : c928            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
3315 : d0fe            >        bne *           ;failed not equal (non zero)
                       >
0029 =                 >test_num = test_num + 1
3317 : a929            >            lda #test_num   ;*** next tests' number
3319 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; full binary add/subtract test
                        ; iterates through all combinations of operands and ca
                        ; uses increments/decrements to predict result & resul
331c : d8                       cld
331d : a20e                     ldx #ad2        ;for indexed test
331f : a0ff                     ldy #$ff        ;max range
3321 : a900                     lda #0          ;start with adding zeroes & no
3323 : 850c                     sta adfc        ;carry in - for diag
3325 : 850d                     sta ad1         ;operand 1 - accumulator
3327 : 850e                     sta ad2         ;operand 2 - memory or immedia
3329 : 8d0302                   sta ada2        ;non zp
332c : 850f                     sta adrl        ;expected result bits 0-7
332e : 8510                     sta adrh        ;expected result bit 8 (carry 
3330 : a9ff                     lda #$ff        ;complemented operand 2 for su
AS65 Assembler for R6502 [1.42].                                     Page  221
-------------------------- 6502_functional_test.a65 --------------------------

3332 : 8512                     sta sb2
3334 : 8d0402                   sta sba2        ;non zp
3337 : a902                     lda #2          ;expected Z-flag
3339 : 8511                     sta adrf
333b : 18               tadd    clc             ;test with carry clear
333c : 20b635                   jsr chkadd
333f : e60c                     inc adfc        ;now with carry
3341 : e60f                     inc adrl        ;result +1
3343 : 08                       php             ;save N & Z from low result
3344 : 08                       php
3345 : 68                       pla             ;accu holds expected flags
3346 : 2982                     and #$82        ;mask N & Z
3348 : 28                       plp
3349 : d002                     bne tadd1
334b : e610                     inc adrh        ;result bit 8 - carry
334d : 0510             tadd1   ora adrh        ;merge C to expected flags
334f : 8511                     sta adrf        ;save expected flags except ov
3351 : 38                       sec             ;test with carry set
3352 : 20b635                   jsr chkadd
3355 : c60c                     dec adfc        ;same for operand +1 but no ca
3357 : e60d                     inc ad1
3359 : d0e0                     bne tadd        ;iterate op1
335b : a900                     lda #0          ;preset result to op2 when op1
335d : 8510                     sta adrh
335f : ee0302                   inc ada2
3362 : e60e                     inc ad2
3364 : 08                       php             ;save NZ as operand 2 becomes 
3365 : 68                       pla
3366 : 2982                     and #$82        ;mask N00000Z0
3368 : 8511                     sta adrf        ;no need to check carry as we 
336a : c612                     dec sb2         ;complement subtract operand 2
336c : ce0402                   dec sba2
336f : a50e                     lda ad2         
3371 : 850f                     sta adrl
3373 : d0c6                     bne tadd        ;iterate op2
                            if disable_decimal < 1
                                next_test
3375 : ad0002          >            lda test_case   ;previous test
3378 : c929            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
337a : d0fe            >        bne *           ;failed not equal (non zero)
                       >
002a =                 >test_num = test_num + 1
337c : a92a            >            lda #test_num   ;*** next tests' number
337e : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; decimal add/subtract test
                        ; *** WARNING - tests documented behavior only! ***
                        ;   only valid BCD operands are tested, N V Z flags ar
                        ; iterates through all valid combinations of operands 
                        ; uses increments/decrements to predict result & carry
3381 : f8                       sed 
3382 : a20e                     ldx #ad2        ;for indexed test
3384 : a0ff                     ldy #$ff        ;max range
3386 : a999                     lda #$99        ;start with adding 99 to 99 wi
3388 : 850d                     sta ad1         ;operand 1 - accumulator
338a : 850e                     sta ad2         ;operand 2 - memory or immedia
338c : 8d0302                   sta ada2        ;non zp
338f : 850f                     sta adrl        ;expected result bits 0-7
3391 : a901                     lda #1          ;set carry in & out
AS65 Assembler for R6502 [1.42].                                     Page  222
-------------------------- 6502_functional_test.a65 --------------------------

3393 : 850c                     sta adfc        ;carry in - for diag
3395 : 8510                     sta adrh        ;expected result bit 8 (carry 
3397 : a900                     lda #0          ;complemented operand 2 for su
3399 : 8512                     sta sb2
339b : 8d0402                   sta sba2        ;non zp
339e : 38               tdad    sec             ;test with carry set
339f : 208334                   jsr chkdad
33a2 : c60c                     dec adfc        ;now with carry clear
33a4 : a50f                     lda adrl        ;decimal adjust result
33a6 : d008                     bne tdad1       ;skip clear carry & preset res
33a8 : c610                     dec adrh
33aa : a999                     lda #$99
33ac : 850f                     sta adrl
33ae : d012                     bne tdad3
33b0 : 290f             tdad1   and #$f         ;lower nibble mask
33b2 : d00c                     bne tdad2       ;no decimal adjust needed
33b4 : c60f                     dec adrl        ;decimal adjust (?0-6)
33b6 : c60f                     dec adrl
33b8 : c60f                     dec adrl
33ba : c60f                     dec adrl
33bc : c60f                     dec adrl
33be : c60f                     dec adrl
33c0 : c60f             tdad2   dec adrl        ;result -1
33c2 : 18               tdad3   clc             ;test with carry clear
33c3 : 208334                   jsr chkdad
33c6 : e60c                     inc adfc        ;same for operand -1 but with 
33c8 : a50d                     lda ad1         ;decimal adjust operand 1
33ca : f015                     beq tdad5       ;iterate operand 2
33cc : 290f                     and #$f         ;lower nibble mask
33ce : d00c                     bne tdad4       ;skip decimal adjust
33d0 : c60d                     dec ad1         ;decimal adjust (?0-6)
33d2 : c60d                     dec ad1
33d4 : c60d                     dec ad1
33d6 : c60d                     dec ad1
33d8 : c60d                     dec ad1
33da : c60d                     dec ad1
33dc : c60d             tdad4   dec ad1         ;operand 1 -1
33de : 4c9e33                   jmp tdad        ;iterate op1
                        
33e1 : a999             tdad5   lda #$99        ;precharge op1 max
33e3 : 850d                     sta ad1
33e5 : a50e                     lda ad2         ;decimal adjust operand 2
33e7 : f030                     beq tdad7       ;end of iteration
33e9 : 290f                     and #$f         ;lower nibble mask
33eb : d018                     bne tdad6       ;skip decimal adjust
33ed : c60e                     dec ad2         ;decimal adjust (?0-6)
33ef : c60e                     dec ad2
33f1 : c60e                     dec ad2
33f3 : c60e                     dec ad2
33f5 : c60e                     dec ad2
33f7 : c60e                     dec ad2
33f9 : e612                     inc sb2         ;complemented decimal adjust f
33fb : e612                     inc sb2
33fd : e612                     inc sb2
33ff : e612                     inc sb2
3401 : e612                     inc sb2
3403 : e612                     inc sb2
3405 : c60e             tdad6   dec ad2         ;operand 2 -1
3407 : e612                     inc sb2         ;complemented operand for subt
3409 : a512                     lda sb2
340b : 8d0402                   sta sba2        ;copy as non zp operand
340e : a50e                     lda ad2
AS65 Assembler for R6502 [1.42].                                     Page  223
-------------------------- 6502_functional_test.a65 --------------------------

3410 : 8d0302                   sta ada2        ;copy as non zp operand
3413 : 850f                     sta adrl        ;new result since op1+carry=00
3415 : e610                     inc adrh        ;result carry
3417 : d085                     bne tdad        ;iterate op2
3419 :                  tdad7
                                next_test
3419 : ad0002          >            lda test_case   ;previous test
341c : c92a            >            cmp #test_num
                       >            trap_ne         ;test is out of sequence
341e : d0fe            >        bne *           ;failed not equal (non zero)
                       >
002b =                 >test_num = test_num + 1
3420 : a92b            >            lda #test_num   ;*** next tests' number
3422 : 8d0002          >            sta test_case
                       >            ;check_ram       ;uncomment to find altere
                        
                        
                        ; decimal/binary switch test
                        ; tests CLD, SED, PLP, RTI to properly switch between 
                        ;   tables
3425 : 18                       clc
3426 : d8                       cld
3427 : 08                       php
3428 : a955                     lda #$55
342a : 6955                     adc #$55
342c : c9aa                     cmp #$aa
                                trap_ne         ;expected binary result after 
342e : d0fe            >        bne *           ;failed not equal (non zero)
                        
3430 : 18                       clc
3431 : f8                       sed
3432 : 08                       php
3433 : a955                     lda #$55
3435 : 6955                     adc #$55
3437 : c910                     cmp #$10
                                trap_ne         ;expected decimal result after
3439 : d0fe            >        bne *           ;failed not equal (non zero)
                        
343b : d8                       cld
343c : 28                       plp
343d : a955                     lda #$55
343f : 6955                     adc #$55
3441 : c910                     cmp #$10
                                trap_ne         ;expected decimal result after
3443 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3445 : 28                       plp
3446 : a955                     lda #$55
3448 : 6955                     adc #$55
344a : c9aa                     cmp #$aa
                                trap_ne         ;expected binary result after 
344c : d0fe            >        bne *           ;failed not equal (non zero)
                        
344e : 18                       clc
344f : a934                     lda #hi bin_rti_ret ;emulated interrupt for rt
3451 : 48                       pha
3452 : a969                     lda #lo bin_rti_ret
3454 : 48                       pha
3455 : 08                       php
3456 : f8                       sed
3457 : a934                     lda #hi dec_rti_ret ;emulated interrupt for rt
3459 : 48                       pha
AS65 Assembler for R6502 [1.42].                                     Page  224
-------------------------- 6502_functional_test.a65 --------------------------

345a : a960                     lda #lo dec_rti_ret
345c : 48                       pha
345d : 08                       php
345e : d8                       cld
345f : 40                       rti
3460 :                  dec_rti_ret
3460 : a955                     lda #$55
3462 : 6955                     adc #$55
3464 : c910                     cmp #$10
                                trap_ne         ;expected decimal result after
3466 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3468 : 40                       rti
3469 :                  bin_rti_ret        
3469 : a955                     lda #$55
346b : 6955                     adc #$55
346d : c9aa                     cmp #$aa
                                trap_ne         ;expected binary result after 
346f : d0fe            >        bne *           ;failed not equal (non zero)
                        
                            endif
                            
3471 : ad0002                   lda test_case
3474 : c92b                     cmp #test_num
                                trap_ne         ;previous test is out of seque
3476 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3478 : a9f0                     lda #$f0        ;mark opcode testing complete
347a : 8d0002                   sta test_case
                                
                        ; final RAM integrity test
                        ;   verifies that none of the previous tests has alter
                        ;   designated write areas.
                                check_ram
                       >            ;RAM check disabled - RAM size not set
                        
                        ; *** DEBUG INFO ***
                        ; to debug checksum errors uncomment check_ram in the 
                        ; narrow down the responsible opcode.
                        ; may give false errors when monitor, OS or other back
                        ; allowed during previous tests.
                        
                        
                        ; S U C C E S S **************************************
                        ; -------------       
                                success         ;if you get here everything we
347d : 4c7d34          >        jmp *           ;test passed, no errors
                        
                        ; -------------       
                        ; S U C C E S S **************************************
3480 : 4c0004                   jmp start       ;run again      
                        
                            if disable_decimal < 1
                        ; core subroutine of the decimal add/subtract test
                        ; *** WARNING - tests documented behavior only! ***
                        ;   only valid BCD operands are tested, N V Z flags ar
                        ; iterates through all valid combinations of operands 
                        ; uses increments/decrements to predict result & carry
3483 :                  chkdad
                        ; decimal ADC / SBC zp
3483 : 08                       php             ;save carry for subtract
3484 : a50d                     lda ad1
AS65 Assembler for R6502 [1.42].                                     Page  225
-------------------------- 6502_functional_test.a65 --------------------------

3486 : 650e                     adc ad2         ;perform add
3488 : 08                       php          
3489 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
348b : d0fe            >        bne *           ;failed not equal (non zero)
                        
348d : 68                       pla             ;check flags
348e : 2901                     and #1          ;mask carry
3490 : c510                     cmp adrh
                                trap_ne         ;bad carry
3492 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3494 : 28                       plp
3495 : 08                       php             ;save carry for next add
3496 : a50d                     lda ad1
3498 : e512                     sbc sb2         ;perform subtract
349a : 08                       php          
349b : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
349d : d0fe            >        bne *           ;failed not equal (non zero)
                        
349f : 68                       pla             ;check flags
34a0 : 2901                     and #1          ;mask carry
34a2 : c510                     cmp adrh
                                trap_ne         ;bad flags
34a4 : d0fe            >        bne *           ;failed not equal (non zero)
                        
34a6 : 28                       plp
                        ; decimal ADC / SBC abs
34a7 : 08                       php             ;save carry for subtract
34a8 : a50d                     lda ad1
34aa : 6d0302                   adc ada2        ;perform add
34ad : 08                       php          
34ae : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
34b0 : d0fe            >        bne *           ;failed not equal (non zero)
                        
34b2 : 68                       pla             ;check flags
34b3 : 2901                     and #1          ;mask carry
34b5 : c510                     cmp adrh
                                trap_ne         ;bad carry
34b7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
34b9 : 28                       plp
34ba : 08                       php             ;save carry for next add
34bb : a50d                     lda ad1
34bd : ed0402                   sbc sba2        ;perform subtract
34c0 : 08                       php          
34c1 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
34c3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
34c5 : 68                       pla             ;check flags
34c6 : 2901                     and #1          ;mask carry
34c8 : c510                     cmp adrh
                                trap_ne         ;bad carry
34ca : d0fe            >        bne *           ;failed not equal (non zero)
                        
34cc : 28                       plp
                        ; decimal ADC / SBC #
34cd : 08                       php             ;save carry for subtract
34ce : a50e                     lda ad2
AS65 Assembler for R6502 [1.42].                                     Page  226
-------------------------- 6502_functional_test.a65 --------------------------

34d0 : 8d1302                   sta ex_adci+1   ;set ADC # operand
34d3 : a50d                     lda ad1
34d5 : 201202                   jsr ex_adci     ;execute ADC # in RAM
34d8 : 08                       php          
34d9 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
34db : d0fe            >        bne *           ;failed not equal (non zero)
                        
34dd : 68                       pla             ;check flags
34de : 2901                     and #1          ;mask carry
34e0 : c510                     cmp adrh
                                trap_ne         ;bad carry
34e2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
34e4 : 28                       plp
34e5 : 08                       php             ;save carry for next add
34e6 : a512                     lda sb2
34e8 : 8d1602                   sta ex_sbci+1   ;set SBC # operand
34eb : a50d                     lda ad1
34ed : 201502                   jsr ex_sbci     ;execute SBC # in RAM
34f0 : 08                       php          
34f1 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
34f3 : d0fe            >        bne *           ;failed not equal (non zero)
                        
34f5 : 68                       pla             ;check flags
34f6 : 2901                     and #1          ;mask carry
34f8 : c510                     cmp adrh
                                trap_ne         ;bad carry
34fa : d0fe            >        bne *           ;failed not equal (non zero)
                        
34fc : 28                       plp
                        ; decimal ADC / SBC zp,x
34fd : 08                       php             ;save carry for subtract
34fe : a50d                     lda ad1
3500 : 7500                     adc 0,x         ;perform add
3502 : 08                       php          
3503 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3505 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3507 : 68                       pla             ;check flags
3508 : 2901                     and #1          ;mask carry
350a : c510                     cmp adrh
                                trap_ne         ;bad carry
350c : d0fe            >        bne *           ;failed not equal (non zero)
                        
350e : 28                       plp
350f : 08                       php             ;save carry for next add
3510 : a50d                     lda ad1
3512 : f504                     sbc sb2-ad2,x   ;perform subtract
3514 : 08                       php          
3515 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3517 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3519 : 68                       pla             ;check flags
351a : 2901                     and #1          ;mask carry
351c : c510                     cmp adrh
                                trap_ne         ;bad carry
351e : d0fe            >        bne *           ;failed not equal (non zero)
                        
AS65 Assembler for R6502 [1.42].                                     Page  227
-------------------------- 6502_functional_test.a65 --------------------------

3520 : 28                       plp
                        ; decimal ADC / SBC abs,x
3521 : 08                       php             ;save carry for subtract
3522 : a50d                     lda ad1
3524 : 7df501                   adc ada2-ad2,x  ;perform add
3527 : 08                       php          
3528 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
352a : d0fe            >        bne *           ;failed not equal (non zero)
                        
352c : 68                       pla             ;check flags
352d : 2901                     and #1          ;mask carry
352f : c510                     cmp adrh
                                trap_ne         ;bad carry
3531 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3533 : 28                       plp
3534 : 08                       php             ;save carry for next add
3535 : a50d                     lda ad1
3537 : fdf601                   sbc sba2-ad2,x  ;perform subtract
353a : 08                       php          
353b : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
353d : d0fe            >        bne *           ;failed not equal (non zero)
                        
353f : 68                       pla             ;check flags
3540 : 2901                     and #1          ;mask carry
3542 : c510                     cmp adrh
                                trap_ne         ;bad carry
3544 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3546 : 28                       plp
                        ; decimal ADC / SBC abs,y
3547 : 08                       php             ;save carry for subtract
3548 : a50d                     lda ad1
354a : 790401                   adc ada2-$ff,y  ;perform add
354d : 08                       php          
354e : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3550 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3552 : 68                       pla             ;check flags
3553 : 2901                     and #1          ;mask carry
3555 : c510                     cmp adrh
                                trap_ne         ;bad carry
3557 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3559 : 28                       plp
355a : 08                       php             ;save carry for next add
355b : a50d                     lda ad1
355d : f90501                   sbc sba2-$ff,y  ;perform subtract
3560 : 08                       php          
3561 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3563 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3565 : 68                       pla             ;check flags
3566 : 2901                     and #1          ;mask carry
3568 : c510                     cmp adrh
                                trap_ne         ;bad carry
356a : d0fe            >        bne *           ;failed not equal (non zero)
                        
AS65 Assembler for R6502 [1.42].                                     Page  228
-------------------------- 6502_functional_test.a65 --------------------------

356c : 28                       plp
                        ; decimal ADC / SBC (zp,x)
356d : 08                       php             ;save carry for subtract
356e : a50d                     lda ad1
3570 : 6146                     adc (lo adi2-ad2,x) ;perform add
3572 : 08                       php          
3573 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3575 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3577 : 68                       pla             ;check flags
3578 : 2901                     and #1          ;mask carry
357a : c510                     cmp adrh
                                trap_ne         ;bad carry
357c : d0fe            >        bne *           ;failed not equal (non zero)
                        
357e : 28                       plp
357f : 08                       php             ;save carry for next add
3580 : a50d                     lda ad1
3582 : e148                     sbc (lo sbi2-ad2,x) ;perform subtract
3584 : 08                       php          
3585 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3587 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3589 : 68                       pla             ;check flags
358a : 2901                     and #1          ;mask carry
358c : c510                     cmp adrh
                                trap_ne         ;bad carry
358e : d0fe            >        bne *           ;failed not equal (non zero)
                        
3590 : 28                       plp
                        ; decimal ADC / SBC (abs),y
3591 : 08                       php             ;save carry for subtract
3592 : a50d                     lda ad1
3594 : 7158                     adc (adiy2),y   ;perform add
3596 : 08                       php          
3597 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3599 : d0fe            >        bne *           ;failed not equal (non zero)
                        
359b : 68                       pla             ;check flags
359c : 2901                     and #1          ;mask carry
359e : c510                     cmp adrh
                                trap_ne         ;bad carry
35a0 : d0fe            >        bne *           ;failed not equal (non zero)
                        
35a2 : 28                       plp
35a3 : 08                       php             ;save carry for next add
35a4 : a50d                     lda ad1
35a6 : f15a                     sbc (sbiy2),y   ;perform subtract
35a8 : 08                       php          
35a9 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
35ab : d0fe            >        bne *           ;failed not equal (non zero)
                        
35ad : 68                       pla             ;check flags
35ae : 2901                     and #1          ;mask carry
35b0 : c510                     cmp adrh
                                trap_ne         ;bad carry
35b2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
AS65 Assembler for R6502 [1.42].                                     Page  229
-------------------------- 6502_functional_test.a65 --------------------------

35b4 : 28                       plp
35b5 : 60                       rts
                            endif
                        
                        ; core subroutine of the full binary add/subtract test
                        ; iterates through all combinations of operands and ca
                        ; uses increments/decrements to predict result & resul
35b6 : a511             chkadd  lda adrf        ;add V-flag if overflow
35b8 : 2983                     and #$83        ;keep N-----ZC / clear V
35ba : 48                       pha
35bb : a50d                     lda ad1         ;test sign unequal between ope
35bd : 450e                     eor ad2
35bf : 300a                     bmi ckad1       ;no overflow possible - operan
35c1 : a50d                     lda ad1         ;test sign equal between opera
35c3 : 450f                     eor adrl
35c5 : 1004                     bpl ckad1       ;no overflow occured - operand
35c7 : 68                       pla
35c8 : 0940                     ora #$40        ;set V
35ca : 48                       pha
35cb : 68               ckad1   pla
35cc : 8511                     sta adrf        ;save expected flags
                        ; binary ADC / SBC zp
35ce : 08                       php             ;save carry for subtract
35cf : a50d                     lda ad1
35d1 : 650e                     adc ad2         ;perform add
35d3 : 08                       php          
35d4 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
35d6 : d0fe            >        bne *           ;failed not equal (non zero)
                        
35d8 : 68                       pla             ;check flags
35d9 : 29c3                     and #$c3        ;mask NV----ZC
35db : c511                     cmp adrf
                                trap_ne         ;bad flags
35dd : d0fe            >        bne *           ;failed not equal (non zero)
                        
35df : 28                       plp
35e0 : 08                       php             ;save carry for next add
35e1 : a50d                     lda ad1
35e3 : e512                     sbc sb2         ;perform subtract
35e5 : 08                       php          
35e6 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
35e8 : d0fe            >        bne *           ;failed not equal (non zero)
                        
35ea : 68                       pla             ;check flags
35eb : 29c3                     and #$c3        ;mask NV----ZC
35ed : c511                     cmp adrf
                                trap_ne         ;bad flags
35ef : d0fe            >        bne *           ;failed not equal (non zero)
                        
35f1 : 28                       plp
                        ; binary ADC / SBC abs
35f2 : 08                       php             ;save carry for subtract
35f3 : a50d                     lda ad1
35f5 : 6d0302                   adc ada2        ;perform add
35f8 : 08                       php          
35f9 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
35fb : d0fe            >        bne *           ;failed not equal (non zero)
                        
35fd : 68                       pla             ;check flags
AS65 Assembler for R6502 [1.42].                                     Page  230
-------------------------- 6502_functional_test.a65 --------------------------

35fe : 29c3                     and #$c3        ;mask NV----ZC
3600 : c511                     cmp adrf
                                trap_ne         ;bad flags
3602 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3604 : 28                       plp
3605 : 08                       php             ;save carry for next add
3606 : a50d                     lda ad1
3608 : ed0402                   sbc sba2        ;perform subtract
360b : 08                       php          
360c : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
360e : d0fe            >        bne *           ;failed not equal (non zero)
                        
3610 : 68                       pla             ;check flags
3611 : 29c3                     and #$c3        ;mask NV----ZC
3613 : c511                     cmp adrf
                                trap_ne         ;bad flags
3615 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3617 : 28                       plp
                        ; binary ADC / SBC #
3618 : 08                       php             ;save carry for subtract
3619 : a50e                     lda ad2
361b : 8d1302                   sta ex_adci+1   ;set ADC # operand
361e : a50d                     lda ad1
3620 : 201202                   jsr ex_adci     ;execute ADC # in RAM
3623 : 08                       php          
3624 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3626 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3628 : 68                       pla             ;check flags
3629 : 29c3                     and #$c3        ;mask NV----ZC
362b : c511                     cmp adrf
                                trap_ne         ;bad flags
362d : d0fe            >        bne *           ;failed not equal (non zero)
                        
362f : 28                       plp
3630 : 08                       php             ;save carry for next add
3631 : a512                     lda sb2
3633 : 8d1602                   sta ex_sbci+1   ;set SBC # operand
3636 : a50d                     lda ad1
3638 : 201502                   jsr ex_sbci     ;execute SBC # in RAM
363b : 08                       php          
363c : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
363e : d0fe            >        bne *           ;failed not equal (non zero)
                        
3640 : 68                       pla             ;check flags
3641 : 29c3                     and #$c3        ;mask NV----ZC
3643 : c511                     cmp adrf
                                trap_ne         ;bad flags
3645 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3647 : 28                       plp
                        ; binary ADC / SBC zp,x
3648 : 08                       php             ;save carry for subtract
3649 : a50d                     lda ad1
364b : 7500                     adc 0,x         ;perform add
364d : 08                       php          
364e : c50f                     cmp adrl        ;check result
AS65 Assembler for R6502 [1.42].                                     Page  231
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_ne         ;bad result
3650 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3652 : 68                       pla             ;check flags
3653 : 29c3                     and #$c3        ;mask NV----ZC
3655 : c511                     cmp adrf
                                trap_ne         ;bad flags
3657 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3659 : 28                       plp
365a : 08                       php             ;save carry for next add
365b : a50d                     lda ad1
365d : f504                     sbc sb2-ad2,x   ;perform subtract
365f : 08                       php          
3660 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3662 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3664 : 68                       pla             ;check flags
3665 : 29c3                     and #$c3        ;mask NV----ZC
3667 : c511                     cmp adrf
                                trap_ne         ;bad flags
3669 : d0fe            >        bne *           ;failed not equal (non zero)
                        
366b : 28                       plp
                        ; binary ADC / SBC abs,x
366c : 08                       php             ;save carry for subtract
366d : a50d                     lda ad1
366f : 7df501                   adc ada2-ad2,x  ;perform add
3672 : 08                       php          
3673 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3675 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3677 : 68                       pla             ;check flags
3678 : 29c3                     and #$c3        ;mask NV----ZC
367a : c511                     cmp adrf
                                trap_ne         ;bad flags
367c : d0fe            >        bne *           ;failed not equal (non zero)
                        
367e : 28                       plp
367f : 08                       php             ;save carry for next add
3680 : a50d                     lda ad1
3682 : fdf601                   sbc sba2-ad2,x  ;perform subtract
3685 : 08                       php          
3686 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
3688 : d0fe            >        bne *           ;failed not equal (non zero)
                        
368a : 68                       pla             ;check flags
368b : 29c3                     and #$c3        ;mask NV----ZC
368d : c511                     cmp adrf
                                trap_ne         ;bad flags
368f : d0fe            >        bne *           ;failed not equal (non zero)
                        
3691 : 28                       plp
                        ; binary ADC / SBC abs,y
3692 : 08                       php             ;save carry for subtract
3693 : a50d                     lda ad1
3695 : 790401                   adc ada2-$ff,y  ;perform add
3698 : 08                       php          
3699 : c50f                     cmp adrl        ;check result
AS65 Assembler for R6502 [1.42].                                     Page  232
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_ne         ;bad result
369b : d0fe            >        bne *           ;failed not equal (non zero)
                        
369d : 68                       pla             ;check flags
369e : 29c3                     and #$c3        ;mask NV----ZC
36a0 : c511                     cmp adrf
                                trap_ne         ;bad flags
36a2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
36a4 : 28                       plp
36a5 : 08                       php             ;save carry for next add
36a6 : a50d                     lda ad1
36a8 : f90501                   sbc sba2-$ff,y  ;perform subtract
36ab : 08                       php          
36ac : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
36ae : d0fe            >        bne *           ;failed not equal (non zero)
                        
36b0 : 68                       pla             ;check flags
36b1 : 29c3                     and #$c3        ;mask NV----ZC
36b3 : c511                     cmp adrf
                                trap_ne         ;bad flags
36b5 : d0fe            >        bne *           ;failed not equal (non zero)
                        
36b7 : 28                       plp
                        ; binary ADC / SBC (zp,x)
36b8 : 08                       php             ;save carry for subtract
36b9 : a50d                     lda ad1
36bb : 6146                     adc (lo adi2-ad2,x) ;perform add
36bd : 08                       php          
36be : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
36c0 : d0fe            >        bne *           ;failed not equal (non zero)
                        
36c2 : 68                       pla             ;check flags
36c3 : 29c3                     and #$c3        ;mask NV----ZC
36c5 : c511                     cmp adrf
                                trap_ne         ;bad flags
36c7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
36c9 : 28                       plp
36ca : 08                       php             ;save carry for next add
36cb : a50d                     lda ad1
36cd : e148                     sbc (lo sbi2-ad2,x) ;perform subtract
36cf : 08                       php          
36d0 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
36d2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
36d4 : 68                       pla             ;check flags
36d5 : 29c3                     and #$c3        ;mask NV----ZC
36d7 : c511                     cmp adrf
                                trap_ne         ;bad flags
36d9 : d0fe            >        bne *           ;failed not equal (non zero)
                        
36db : 28                       plp
                        ; binary ADC / SBC (abs),y
36dc : 08                       php             ;save carry for subtract
36dd : a50d                     lda ad1
36df : 7158                     adc (adiy2),y   ;perform add
36e1 : 08                       php          
36e2 : c50f                     cmp adrl        ;check result
AS65 Assembler for R6502 [1.42].                                     Page  233
-------------------------- 6502_functional_test.a65 --------------------------

                                trap_ne         ;bad result
36e4 : d0fe            >        bne *           ;failed not equal (non zero)
                        
36e6 : 68                       pla             ;check flags
36e7 : 29c3                     and #$c3        ;mask NV----ZC
36e9 : c511                     cmp adrf
                                trap_ne         ;bad flags
36eb : d0fe            >        bne *           ;failed not equal (non zero)
                        
36ed : 28                       plp
36ee : 08                       php             ;save carry for next add
36ef : a50d                     lda ad1
36f1 : f15a                     sbc (sbiy2),y   ;perform subtract
36f3 : 08                       php          
36f4 : c50f                     cmp adrl        ;check result
                                trap_ne         ;bad result
36f6 : d0fe            >        bne *           ;failed not equal (non zero)
                        
36f8 : 68                       pla             ;check flags
36f9 : 29c3                     and #$c3        ;mask NV----ZC
36fb : c511                     cmp adrf
                                trap_ne         ;bad flags
36fd : d0fe            >        bne *           ;failed not equal (non zero)
                        
36ff : 28                       plp
3700 : 60                       rts
                        
                        ; target for the jump absolute test
3701 : 88                       dey
3702 : 88                       dey
3703 :                  test_far
3703 : 08                       php             ;either SP or Y count will fai
3704 : 88                       dey
3705 : 88                       dey
3706 : 88                       dey
3707 : 28                       plp
                                trap_cs         ;flags loaded?
3708 : b0fe            >        bcs *           ;failed carry set
                        
                                trap_vs
370a : 70fe            >        bvs *           ;failed overflow set
                        
                                trap_mi
370c : 30fe            >        bmi *           ;failed minus (bit 7 set)
                        
                                trap_eq 
370e : f0fe            >        beq *           ;failed equal (zero)
                        
3710 : c946                     cmp #'F'        ;registers loaded?
                                trap_ne
3712 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3714 : e041                     cpx #'A'
                                trap_ne        
3716 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3718 : c04f                     cpy #('R'-3)
                                trap_ne
371a : d0fe            >        bne *           ;failed not equal (non zero)
                        
371c : 48                       pha             ;save a,x
371d : 8a                       txa
AS65 Assembler for R6502 [1.42].                                     Page  234
-------------------------- 6502_functional_test.a65 --------------------------

371e : 48                       pha
371f : ba                       tsx
3720 : e0fd                     cpx #$fd        ;check SP
                                trap_ne
3722 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3724 : 68                       pla             ;restore x
3725 : aa                       tax
                                set_stat $ff
                       >            load_flag $ff
3726 : a9ff            >            lda #$ff             ;allow test to change
                       >
3728 : 48              >            pha         ;use stack to load status
3729 : 28              >            plp
                        
372a : 68                       pla             ;restore a
372b : e8                       inx             ;return registers with modific
372c : 49aa                     eor #$aa        ;N=1, V=1, Z=0, C=1
372e : 4c0f09                   jmp far_ret
                                
                        ; target for the jump indirect test
3731 : 00                       align
3732 : 3b37             ptr_tst_ind dw test_ind
3734 : 6409             ptr_ind_ret dw ind_ret
                                trap            ;runover protection
3736 : 4c3637          >        jmp *           ;failed anyway
                        
3739 : 88                       dey
373a : 88                       dey
373b :                  test_ind
373b : 08                       php             ;either SP or Y count will fai
373c : 88                       dey
373d : 88                       dey
373e : 88                       dey
373f : 28                       plp
                                trap_cs         ;flags loaded?
3740 : b0fe            >        bcs *           ;failed carry set
                        
                                trap_vs
3742 : 70fe            >        bvs *           ;failed overflow set
                        
                                trap_mi
3744 : 30fe            >        bmi *           ;failed minus (bit 7 set)
                        
                                trap_eq 
3746 : f0fe            >        beq *           ;failed equal (zero)
                        
3748 : c949                     cmp #'I'        ;registers loaded?
                                trap_ne
374a : d0fe            >        bne *           ;failed not equal (non zero)
                        
374c : e04e                     cpx #'N'
                                trap_ne        
374e : d0fe            >        bne *           ;failed not equal (non zero)
                        
3750 : c041                     cpy #('D'-3)
                                trap_ne
3752 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3754 : 48                       pha             ;save a,x
3755 : 8a                       txa
3756 : 48                       pha
AS65 Assembler for R6502 [1.42].                                     Page  235
-------------------------- 6502_functional_test.a65 --------------------------

3757 : ba                       tsx
3758 : e0fd                     cpx #$fd        ;check SP
                                trap_ne
375a : d0fe            >        bne *           ;failed not equal (non zero)
                        
375c : 68                       pla             ;restore x
375d : aa                       tax
                                set_stat $ff
                       >            load_flag $ff
375e : a9ff            >            lda #$ff             ;allow test to change
                       >
3760 : 48              >            pha         ;use stack to load status
3761 : 28              >            plp
                        
3762 : 68                       pla             ;restore a
3763 : e8                       inx             ;return registers with modific
3764 : 49aa                     eor #$aa        ;N=1, V=1, Z=0, C=1
3766 : 6c3437                   jmp (ptr_ind_ret)
                                trap            ;runover protection
3769 : 4c6937          >        jmp *           ;failed anyway
                        
376c : 4c0004                   jmp start       ;catastrophic error - cannot c
                        
                        ; target for the jump subroutine test
376f : 88                       dey
3770 : 88                       dey
3771 :                  test_jsr
3771 : 08                       php             ;either SP or Y count will fai
3772 : 88                       dey
3773 : 88                       dey
3774 : 88                       dey
3775 : 28                       plp
                                trap_cs         ;flags loaded?
3776 : b0fe            >        bcs *           ;failed carry set
                        
                                trap_vs
3778 : 70fe            >        bvs *           ;failed overflow set
                        
                                trap_mi
377a : 30fe            >        bmi *           ;failed minus (bit 7 set)
                        
                                trap_eq 
377c : f0fe            >        beq *           ;failed equal (zero)
                        
377e : c94a                     cmp #'J'        ;registers loaded?
                                trap_ne
3780 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3782 : e053                     cpx #'S'
                                trap_ne        
3784 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3786 : c04f                     cpy #('R'-3)
                                trap_ne
3788 : d0fe            >        bne *           ;failed not equal (non zero)
                        
378a : 48                       pha             ;save a,x
378b : 8a                       txa
378c : 48                       pha       
378d : ba                       tsx             ;sp -4? (return addr,a,x)
378e : e0fb                     cpx #$fb
                                trap_ne
AS65 Assembler for R6502 [1.42].                                     Page  236
-------------------------- 6502_functional_test.a65 --------------------------

3790 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3792 : adff01                   lda $1ff        ;propper return on stack
3795 : c909                     cmp #hi(jsr_ret)
                                trap_ne
3797 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3799 : adfe01                   lda $1fe
379c : c99a                     cmp #lo(jsr_ret)
                                trap_ne
379e : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                set_stat $ff
                       >            load_flag $ff
37a0 : a9ff            >            lda #$ff             ;allow test to change
                       >
37a2 : 48              >            pha         ;use stack to load status
37a3 : 28              >            plp
                        
37a4 : 68                       pla             ;pull x,a
37a5 : aa                       tax
37a6 : 68                       pla
37a7 : e8                       inx             ;return registers with modific
37a8 : 49aa                     eor #$aa        ;N=1, V=1, Z=0, C=1
37aa : 60                       rts
                                trap            ;runover protection
37ab : 4cab37          >        jmp *           ;failed anyway
                        
37ae : 4c0004                   jmp start       ;catastrophic error - cannot c
                                
                        ;trap in case of unexpected IRQ, NMI, BRK, RESET - BRK
37b1 :                  nmi_trap
                                trap            ;check stack for conditions at
37b1 : 4cb137          >        jmp *           ;failed anyway
                        
37b4 : 4c0004                   jmp start       ;catastrophic error - cannot c
37b7 :                  res_trap
                                trap            ;unexpected RESET
37b7 : 4cb737          >        jmp *           ;failed anyway
                        
37ba : 4c0004                   jmp start       ;catastrophic error - cannot c
                                
37bd : 88                       dey
37be : 88                       dey
37bf :                  irq_trap                ;BRK test or unextpected BRK o
37bf : 08                       php             ;either SP or Y count will fai
37c0 : 88                       dey
37c1 : 88                       dey
37c2 : 88                       dey
                                ;next traps could be caused by unexpected BRK 
                                ;check stack for BREAK and originating locatio
                                ;possible jump/branch into weeds (uninitialize
37c3 : c9bd                     cmp #$ff-'B'    ;BRK pass 2 registers loaded?
37c5 : f042                     beq break2
37c7 : c942                     cmp #'B'        ;BRK pass 1 registers loaded?
                                trap_ne
37c9 : d0fe            >        bne *           ;failed not equal (non zero)
                        
37cb : e052                     cpx #'R'
                                trap_ne        
37cd : d0fe            >        bne *           ;failed not equal (non zero)
                        
AS65 Assembler for R6502 [1.42].                                     Page  237
-------------------------- 6502_functional_test.a65 --------------------------

37cf : c048                     cpy #'K'-3
                                trap_ne
37d1 : d0fe            >        bne *           ;failed not equal (non zero)
                        
37d3 : 850a                     sta irq_a       ;save registers during break t
37d5 : 860b                     stx irq_x
37d7 : ba                       tsx             ;test break on stack
37d8 : bd0201                   lda $102,x
                                cmp_flag 0      ;break test should have B=1 & 
37db : c930            >            cmp #(0      |fao)&m8    ;expected flags +
                        
                                trap_ne         ; - no break flag on stack
37dd : d0fe            >        bne *           ;failed not equal (non zero)
                        
37df : 68                       pla
                                cmp_flag intdis ;should have added interrupt d
37e0 : c934            >            cmp #(intdis |fao)&m8    ;expected flags +
                        
                                trap_ne
37e2 : d0fe            >        bne *           ;failed not equal (non zero)
                        
37e4 : ba                       tsx
37e5 : e0fc                     cpx #$fc        ;sp -3? (return addr, flags)
                                trap_ne
37e7 : d0fe            >        bne *           ;failed not equal (non zero)
                        
37e9 : adff01                   lda $1ff        ;propper return on stack
37ec : c909                     cmp #hi(brk_ret0)
                                trap_ne
37ee : d0fe            >        bne *           ;failed not equal (non zero)
                        
37f0 : adfe01                   lda $1fe
37f3 : c9dc                     cmp #lo(brk_ret0)
                                trap_ne
37f5 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                load_flag $ff
37f7 : a9ff            >            lda #$ff             ;allow test to change
                        
37f9 : 48                       pha
37fa : a60b                     ldx irq_x
37fc : e8                       inx             ;return registers with modific
37fd : a50a                     lda irq_a
37ff : 49aa                     eor #$aa
3801 : 28                       plp             ;N=1, V=1, Z=1, C=1 but origin
3802 : 40                       rti
                                trap            ;runover protection
3803 : 4c0338          >        jmp *           ;failed anyway
                        
3806 : 4c0004                   jmp start       ;catastrophic error - cannot c
                                
3809 :                  break2                  ;BRK pass 2        
3809 : e0ad                     cpx #$ff-'R'
                                trap_ne        
380b : d0fe            >        bne *           ;failed not equal (non zero)
                        
380d : c0b1                     cpy #$ff-'K'-3
                                trap_ne
380f : d0fe            >        bne *           ;failed not equal (non zero)
                        
3811 : 850a                     sta irq_a       ;save registers during break t
3813 : 860b                     stx irq_x
AS65 Assembler for R6502 [1.42].                                     Page  238
-------------------------- 6502_functional_test.a65 --------------------------

3815 : ba                       tsx             ;test break on stack
3816 : bd0201                   lda $102,x
                                cmp_flag $ff    ;break test should have B=1
3819 : c9ff            >            cmp #($ff    |fao)&m8    ;expected flags +
                        
                                trap_ne         ; - no break flag on stack
381b : d0fe            >        bne *           ;failed not equal (non zero)
                        
381d : 68                       pla
381e : 0908                     ora #decmode    ;ignore decmode cleared if 65c
                                cmp_flag $ff    ;actual passed flags
3820 : c9ff            >            cmp #($ff    |fao)&m8    ;expected flags +
                        
                                trap_ne
3822 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3824 : ba                       tsx
3825 : e0fc                     cpx #$fc        ;sp -3? (return addr, flags)
                                trap_ne
3827 : d0fe            >        bne *           ;failed not equal (non zero)
                        
3829 : adff01                   lda $1ff        ;propper return on stack
382c : c90a                     cmp #hi(brk_ret1)
                                trap_ne
382e : d0fe            >        bne *           ;failed not equal (non zero)
                        
3830 : adfe01                   lda $1fe
3833 : c90b                     cmp #lo(brk_ret1)
                                trap_ne
3835 : d0fe            >        bne *           ;failed not equal (non zero)
                        
                                load_flag intdis
3837 : a904            >            lda #intdis             ;allow test to cha
                        
3839 : 48                       pha      
383a : a60b                     ldx irq_x
383c : e8                       inx             ;return registers with modific
383d : a50a                     lda irq_a
383f : 49aa                     eor #$aa
3841 : 28                       plp             ;N=0, V=0, Z=0, C=0 but origin
3842 : 40                       rti
                                trap            ;runover protection
3843 : 4c4338          >        jmp *           ;failed anyway
                        
3846 : 4c0004                   jmp start       ;catastrophic error - cannot c
                        
                            if report = 1
                                include "report.i65"
                            endif
                                
                        ;copy of data to initialize BSS segment
                            if load_data_direct != 1
                        zp_init
                        zps_    db  $80,1           ;additional shift pattern 
                        zp1_    db  $c3,$82,$41,0   ;test patterns for LDx BIT
                        zp7f_   db  $7f             ;test pattern for compare
                        ;logical zeropage operands
                        zpOR_   db  0,$1f,$71,$80   ;test pattern for OR
                        zpAN_   db  $0f,$ff,$7f,$80 ;test pattern for AND
                        zpEO_   db  $ff,$0f,$8f,$8f ;test pattern for EOR
                        ;indirect addressing pointers
                        ind1_   dw  abs1            ;indirect pointer to patte
AS65 Assembler for R6502 [1.42].                                     Page  239
-------------------------- 6502_functional_test.a65 --------------------------

                                dw  abs1+1
                                dw  abs1+2
                                dw  abs1+3
                                dw  abs7f
                        inw1_   dw  abs1-$f8        ;indirect pointer for wrap
                        indt_   dw  abst            ;indirect pointer to store
                                dw  abst+1
                                dw  abst+2
                                dw  abst+3
                        inwt_   dw  abst-$f8        ;indirect pointer for wrap
                        indAN_  dw  absAN           ;indirect pointer to AND p
                                dw  absAN+1
                                dw  absAN+2
                                dw  absAN+3
                        indEO_  dw  absEO           ;indirect pointer to EOR p
                                dw  absEO+1
                                dw  absEO+2
                                dw  absEO+3
                        indOR_  dw  absOR           ;indirect pointer to OR pa
                                dw  absOR+1
                                dw  absOR+2
                                dw  absOR+3
                        ;add/subtract indirect pointers
                        adi2_   dw  ada2            ;indirect pointer to opera
                        sbi2_   dw  sba2            ;indirect pointer to compl
                        adiy2_  dw  ada2-$ff        ;with offset for indirect 
                        sbiy2_  dw  sba2-$ff
                        zp_end
                            if (zp_end - zp_init) != (zp_bss_end - zp_bss)   
                                ;force assembler error if size is different   
                                ERROR ERROR ERROR   ;mismatch between bss and 
                            endif 
                        data_init
                        ex_and_ and #0              ;execute immediate opcodes
                                rts
                        ex_eor_ eor #0              ;execute immediate opcodes
                                rts
                        ex_ora_ ora #0              ;execute immediate opcodes
                                rts
                        ex_adc_ adc #0              ;execute immediate opcodes
                                rts
                        ex_sbc_ sbc #0              ;execute immediate opcodes
                                rts
                        ;zps    db  $80,1           ;additional shift patterns
                        abs1_   db  $c3,$82,$41,0   ;test patterns for LDx BIT
                        abs7f_  db  $7f             ;test pattern for compare
                        ;loads
                        fLDx_   db  fn,fn,0,fz              ;expected flags fo
                        ;shifts
                        rASL_                               ;expected result A
                        rROL_   db  0,2,$86,$04,$82,0
                        rROLc_  db  1,3,$87,$05,$83,1       ;expected result R
                        rLSR_                               ;expected result L
                        rROR_   db  $40,0,$61,$41,$20,0
                        rRORc_  db  $c0,$80,$e1,$c1,$a0,$80 ;expected result R
                        fASL_                               ;expected flags fo
                        fROL_   db  fzc,0,fnc,fc,fn,fz      ;no carry in
                        fROLc_  db  fc,0,fnc,fc,fn,0        ;carry in 
                        fLSR_
                        fROR_   db  0,fzc,fc,0,fc,fz        ;no carry in
                        fRORc_  db  fn,fnc,fnc,fn,fnc,fn    ;carry in
                        ;increments (decrements)
AS65 Assembler for R6502 [1.42].                                     Page  240
-------------------------- 6502_functional_test.a65 --------------------------

                        rINC_   db  $7f,$80,$ff,0,1         ;expected result f
                        fINC_   db  0,fn,fn,fz,0            ;expected flags fo
                        ;logical memory operand
                        absOR_  db  0,$1f,$71,$80           ;test pattern for 
                        absAN_  db  $0f,$ff,$7f,$80         ;test pattern for 
                        absEO_  db  $ff,$0f,$8f,$8f         ;test pattern for 
                        ;logical accu operand
                        absORa_ db  0,$f1,$1f,0             ;test pattern for 
                        absANa_ db  $f0,$ff,$ff,$ff         ;test pattern for 
                        absEOa_ db  $ff,$f0,$f0,$0f         ;test pattern for 
                        ;logical results
                        absrlo_ db  0,$ff,$7f,$80
                        absflo_ db  fz,fn,0,fn
                        data_end
                            if (data_end - data_init) != (data_bss_end - data_
                                ;force assembler error if size is different   
                                ERROR ERROR ERROR   ;mismatch between bss and 
                            endif 
                        
                        vec_init
                                dw  nmi_trap
                                dw  res_trap
                                dw  irq_trap
                        vec_bss equ $fffa
                            endif                   ;end of RAM init data
                            
                            if (load_data_direct = 1) & (ROM_vectors = 1)  
                                org $fffa       ;vectors
                                dw  nmi_trap
                                dw  res_trap
                                dw  irq_trap
                            endif
                        
3809 =                          end start
                                    
                        
No errors in pass 2.
Wrote binary from address $000a through $3848.
Total size 14399 bytes.
Program start address is at $0400 (1024).
