Annotation of hatari/tests/cpu/int_shft.s, revision 1.1

1.1     ! root        1: 
        !             2: /* ASL: test that both C & X flags are set to the last bit shifted out */
        !             3: .global tst_shift_1
        !             4: tst_shift_1:
        !             5:        movem.l d3-d4,-(sp)
        !             6:        move.l  #0,d1
        !             7:        move.l  #1,d2
        !             8:        move.l  #1,d3
        !             9:        move.l  #0,d4
        !            10:        lsr.l   d2,d3   /* should set X & C */
        !            11:        scc     d0
        !            12:        asl     #1,d1   /* should clear C and X */
        !            13:        scs     d1
        !            14:        addx.l  d4,d4
        !            15:        tst.l   d4
        !            16:        sne     d4
        !            17:        or.b    d1,d0
        !            18:        or.b    d4,d0
        !            19:        movem.l (sp)+,d3-d4
        !            20:        rts
        !            21: 
        !            22: /* test that lsl is modulo 64 */
        !            23: .global tst_shift_2
        !            24: tst_shift_2:
        !            25:        move.l  #33,d1
        !            26:        move.l  #1,d2
        !            27:        lsl.l   d1,d2
        !            28:        sne     d0
        !            29:        rts
        !            30: 
        !            31: .global tst_shift_3
        !            32: tst_shift_3:
        !            33:        move.l  #65,d1
        !            34:        move.l  #1,d2
        !            35:        lsl.l   d1,d2
        !            36:        cmp.l   #2,d2
        !            37:        sne     d0
        !            38:        rts
        !            39: 
        !            40: /* test that zero shift does not affect X flag */
        !            41: .global tst_shift_4
        !            42: tst_shift_4:
        !            43:        movem.l d3-d4,-(sp)
        !            44:        move.l  #0,d1
        !            45:        move.l  #1,d2
        !            46:        move.l  #1,d3
        !            47:        move.l  #0,d4
        !            48:        lsr.l   d2,d3   /* should set X & C */
        !            49:        scc     d0
        !            50:        lsr.l   d1,d4   /* should not affect X & clear C */
        !            51:        scs     d1
        !            52:        addx.l  d4,d4
        !            53:        cmp.l   #1,d4
        !            54:        sne     d4
        !            55:        or.b    d1,d0
        !            56:        or.b    d4,d0
        !            57:        movem.l (sp)+,d3-d4
        !            58:        rts
        !            59: 
        !            60: /* LSL: test that both C & X flags are set to the last bit shifted out */
        !            61: .global tst_shift_5
        !            62: tst_shift_5:
        !            63:        movem.l d3-d4,-(sp)
        !            64:        move.l  #0x55555555,d1
        !            65:        move.l  #0,d2
        !            66:        lsl.l   #8,d1
        !            67:        scc     d0
        !            68:        addx.l  d2,d2
        !            69:        tst.l   d2
        !            70:        seq     d2
        !            71:        move.l  #0,d3
        !            72:        lsl.l   #1,d1
        !            73:        scs     d4
        !            74:        addx.l  d3,d3
        !            75:        tst.l   d3
        !            76:        sne     d3
        !            77:        cmp.l   #0xaaaaaa00,d1
        !            78:        sne     d1
        !            79:        or.b    d1,d0
        !            80:        or.b    d2,d0
        !            81:        or.b    d3,d0
        !            82:        or.b    d4,d0
        !            83:        movem.l (sp)+,d3-d4
        !            84:        rts
        !            85: 
        !            86: /* same as above, for word shifts */
        !            87: .global tst_shift_6
        !            88: tst_shift_6:
        !            89:        movem.l d3-d4,-(sp)
        !            90:        move.l  #0x55555555,d1
        !            91:        move.l  #0,d2
        !            92:        lsl.w   #8,d1
        !            93:        scc     d0
        !            94:        addx.l  d2,d2
        !            95:        cmp.l   #1,d2
        !            96:        sne     d2
        !            97:        move.l  #0,d3
        !            98:        lsl.w   #1,d1
        !            99:        scs     d4
        !           100:        addx.l  d3,d3
        !           101:        tst.l   d3
        !           102:        sne     d3
        !           103:        cmp.l   #0x5555aa00,d1
        !           104:        sne     d1
        !           105:        or.b    d1,d0
        !           106:        or.b    d2,d0
        !           107:        or.b    d3,d0
        !           108:        or.b    d4,d0
        !           109:        movem.l (sp)+,d3-d4
        !           110:        rts
        !           111: 
        !           112: /* same as above, for byte shifts */
        !           113: .global tst_shift_7
        !           114: tst_shift_7:
        !           115:        movem.l d3-d4,-(sp)
        !           116:        move.l  #0x55555555,d1
        !           117:        move.l  #0,d2
        !           118:        lsl.b   #8,d1
        !           119:        scc     d0
        !           120:        addx.l  d2,d2
        !           121:        cmp.l   #1,d2
        !           122:        sne     d2
        !           123:        moveq.l #0,d3
        !           124:        lsl.b   #1,d1
        !           125:        scs     d4
        !           126:        addx.l  d3,d3
        !           127:        tst.l   d3
        !           128:        sne     d3
        !           129:        cmp.l   #0x55555500,d1
        !           130:        sne     d1
        !           131:        or.b    d1,d0
        !           132:        or.b    d2,d0
        !           133:        or.b    d3,d0
        !           134:        or.b    d4,d0
        !           135:        movem.l (sp)+,d3-d4
        !           136:        rts
        !           137: 
        !           138: /* ROL: test that C is set to the last bit shifted out & that X is unaffected */
        !           139: .global tst_shift_8
        !           140: tst_shift_8:
        !           141:        movem.l d3-d5,-(sp)
        !           142:        moveq.l #0,d5
        !           143:        move.l  #0x80000000,d0
        !           144:        add.l   d0,d0   /* should set X, C and V, and clear d0 */
        !           145:        scc     d1
        !           146:        svc     d2
        !           147:        rol     #1,d0   /* should clear C and V, and leave X unaffected */
        !           148:        scs     d3
        !           149:        svs     d4
        !           150:        addx.l  d5,d5
        !           151:        cmp.l   #1,d5
        !           152:        sne     d0
        !           153:        or.b    d1,d0
        !           154:        or.b    d2,d0
        !           155:        or.b    d3,d0
        !           156:        or.b    d4,d0
        !           157:        movem.l (sp)+,d3-d5
        !           158:        rts

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.