Annotation of researchv9/jerq/src/lib/j/texture32.s, revision 1.1.1.1

1.1       root        1:        .text
                      2:        .globl  texture32
                      3: # texture32(bp, r, tp, f)
                      4: #       0(ap) = bp
                      5: #       4(ap) = r.origin, r.origin.x
                      6: #       6(ap) =           r.origin.y
                      7: #       8(ap) = r.corner, r.corner.x
                      8: #      10(ap) =           r.corner.y
                      9: #      12(ap) = tp
                     10: #      16(ap) = f
                     11: 
                     12:        .align  8
                     13: texture32:
                     14:        SAVE    %r3                     # save all registers
                     15:        addw2   &8,%sp                  # local vars
                     16:                                        # rectclip(&r, bp->rect)
                     17:        movaw   4(%ap), %r0             # r0 = &r.origin.x
                     18:        addw3   &8, 0(%ap), %r1         # r1 = &bp->rect.origin.x
                     19:        cmph    0(%r0), 0(%r1)          # r.o.x < bp->r.o.x ?
                     20:        jge     .L1
                     21:        movh    0(%r1), 0(%r0)
                     22: .L1:
                     23:        addw2   &2, %r0
                     24:        addw2   &2, %r1
                     25:        cmph    0(%r0), 0(%r1)          # r.o.y < bp->r.o.y ?
                     26:        jge     .L2
                     27:        movh    0(%r1), 0(%r0)
                     28: .L2:
                     29:        addw2   &2, %r0
                     30:        addw2   &2, %r1
                     31:        cmph    0(%r0), 0(%r1)          # r.c.x > bp->r.c.x ?
                     32:        jle     .L3
                     33:        movh    0(%r1), 0(%r0)
                     34: .L3:
                     35:        addw2   &2, %r0
                     36:        addw2   &2, %r1
                     37:        cmph    0(%r0), 0(%r1)          # r.c.y > bp->r.c.y ?
                     38:        jle     .L4
                     39:        movh    0(%r1), 0(%r0)
                     40: .L4:
                     41:        cmph    8(%ap),4(%ap)           # width in bits
                     42:        jle     end                     # if <=0, forget it
                     43: 
                     44:                                        # %r8 = addr(bitmap,rect.origin)
                     45:        PUSHW   0(%ap)
                     46:        PUSHW   4(%ap)
                     47:        call    &2,addr
                     48:        MOVW    %r0,%r8
                     49: 
                     50:        movw    0(%ap),%r7              # pointer to bitmap
                     51:        llsw3   &2,4(%r7),%r7           # width of bitmap in bytes -> r7
                     52: 
                     53:        movw    12(%ap),%r6             # r6 = pointer to texture
                     54: 
                     55:        subh3   6(%ap),10(%ap),%r4      # dy
                     56: 
                     57:        andh3   &0x1f,6(%ap),%r0
                     58:        llsw3   &2,%r0,%r3              # bit index into texture = r3
                     59: 
                     60:        movh    4(%ap),%r2              # rec.origin.x -> r2
                     61:        lrsw3   %r2,&-1,0(%fp)          # generate mask1 -> 0(%fp)
                     62: 
                     63:        subh3   &1,8(%ap),%r5
                     64:        arsw3   %r5,&0x80000000,4(%fp)          # generate mask2 -> 4(%fp)
                     65: 
                     66:        arsw3   &5,%r5,%r5              # (x + dx -1) >> WORDSHIFT
                     67:        arsw3   &5,%r2,%r2              # x >> WORDSHIFT
                     68:        subw2   %r2,%r5         
                     69:        DECW    %r5                     # inner word count ii
                     70:        BGEB    notnarrow               # if ii == -1 then narrow
                     71:        andw2   4(%fp),0(%fp)           # narrow, combine both masks here
                     72:        mcomw   0(%fp),4(%fp)           # mask2 = ~mask1
                     73:        subw2   &4,%r7                  # amount to get to next line
                     74:        BRB     restcode
                     75: notnarrow:
                     76:        addw3   &1,%r5,%r0              # offset in words
                     77:        llsw3   &2,%r0,%r0              # offset in bytes
                     78:        subw2   %r0,%r7                 # amount to get to next line
                     79: restcode:
                     80:        ALSW3   &2,16(%ap),%r0          # code * 4 -> r0
                     81:        BLB     end                     # bad if code less than 0
                     82:        cmpw    %r0,&12                 # see if code greater than 3
                     83:        jle     *jmptbl(%r0)            # jump to correct routine if ok
                     84: end:   subw2   &8,%sp
                     85:        RESTORE %r3
                     86:        RET
                     87: 
                     88: 
                     89:        .data
                     90: jmptbl:        .word   FSTORE
                     91:        .word   FOR
                     92:        .word   FCLEAR
                     93:        .word   FXOR
                     94:        .text
                     95: FXOR:  DECW    %r4                     # number of lines
                     96:        jl      end                     # if neg. then done
                     97:        addw3   %r6,%r3,%r2
                     98:        movw    0(%r2),%r2              # bits = map[bitindex]
                     99:        addw2   &4,%r3                  #bitindex += 1;
                    100:        andw2   &0x7f,%r3               # bitindex = ( bitindex + 1) & WORDMASK
                    101:        andw3   0(%fp),%r2,%r0          #
                    102:        xorw2   %r0,0(%r8)              #screenp ^= bits & mask1
                    103:        addw2   &4,%r8                  # screenp++
                    104:        movw    %r5,%r1                 # i = ii
                    105:        BLB     restloop                # if i = -1 then narrow
                    106:        BEB     mask2ok                 # if i = 0 then no inner words
                    107:        lrsw3   &2,%r1,%r0              # i/4
                    108:        BLEB    less4                   # less than 4 inner words
                    109: more4: xorw2   %r2,0(%r8)              # screenp ^= bits
                    110:        xorw2   %r2,4(%r8)              # screenp ^= bits
                    111:        xorw2   %r2,8(%r8)              # screenp ^= bits
                    112:        xorw2   %r2,12(%r8)             # screenp ^= bits
                    113:        addw2   &16,%r8                 # screenp += 4
                    114:        DECW    %r0                     
                    115:        BGB     more4                   # more inner words
                    116:        andw2   &3,%r1                  # just how many are left
                    117:        BLEB    mask2ok                 # no more to do
                    118: less4: xorw2   %r2,0(%r8)              # screenp ^= bits
                    119:        addw2   &4,%r8                  # screenp++
                    120:        DECW    %r1                     
                    121:        BGB     less4                   # more inner words
                    122: mask2ok:
                    123:        andw3   4(%fp),%r2,%r0
                    124:        xorw2   %r0,0(%r8)              # screenp ^= (bits & mask2)
                    125: restloop:
                    126:        addw2   %r7,%r8                 # screenp += width
                    127:        BRB     FXOR
                    128: 
                    129: FCLEAR:        mcomw   0(%fp),0(%fp)
                    130:        mcomw   4(%fp),4(%fp)
                    131: FCLR: DECW     %r4                     # number of lines
                    132:        jl      end                     # if neg. then done
                    133:        addw3   %r6,%r3,%r2
                    134:        mcomw   0(%r2),%r2              # bits = ~map[bitindex]
                    135:        addw2   &4,%r3                  #bitindex += 1;
                    136:        andw2   &0x7f,%r3               # bitindex = ( bitindex + 1) & WORDMASK
                    137:        orw3    0(%fp),%r2,%r0          #
                    138:        andw2   %r0,0(%r8)              #screenp &= bits & mask1
                    139:        addw2   &4,%r8                  # screenp++
                    140:        movw    %r5,%r1                 # i = ii
                    141:        BLB     restclr         # if i = -1 then narrow
                    142:        BEB     msk2clr                 # if i = 0 then no inner words
                    143:        lrsw3   &2,%r1,%r0              # i/4
                    144:        BLEB    less4clr                        # less than 4 inner words
                    145: Fclr_4:        andw2   %r2,0(%r8)              # screenp ^= bits
                    146:        andw2   %r2,4(%r8)              # screenp ^= bits
                    147:        andw2   %r2,8(%r8)              # screenp ^= bits
                    148:        andw2   %r2,12(%r8)             # screenp ^= bits
                    149:        addw2   &16,%r8                 # screenp += 4
                    150:        DECW    %r0                     
                    151:        BGB     Fclr_4                  # more inner words
                    152:        andw2   &3,%r1                  # just how many are left
                    153:        BLEB    msk2clr                 # no more to do
                    154: less4clr:
                    155:        andw2   %r2,0(%r8)              # screenp ^= bits
                    156:        addw2   &4,%r8                  # screenp++
                    157:        DECW    %r1                     
                    158:        BGB     less4clr                        # more inner words
                    159: msk2clr:
                    160:        orw3    4(%fp),%r2,%r0
                    161:        andw2   %r0,0(%r8)              # screenp ^= (bits & mask2)
                    162: restclr:
                    163:        addw2   %r7,%r8                 # screenp += width
                    164:        BRB     FCLR
                    165: 
                    166: FOR:   DECW    %r4                     # number of lines
                    167:        jl      end                     # if neg. then done
                    168:        addw3   %r6,%r3,%r2
                    169:        movw    0(%r2),%r2              # bits = map[bitindex]
                    170:        addw2   &4,%r3                  #bitindex += 1;
                    171:        andw2   &0x7f,%r3               # bitindex = ( bitindex + 1) & WORDMASK
                    172:        andw3   0(%fp),%r2,%r0          #
                    173:        orw2    %r0,0(%r8)              #screenp ^= bits & mask1
                    174:        addw2   &4,%r8                  # screenp++
                    175:        movw    %r5,%r1                 # i = ii
                    176:        BLB     rest_or         # if i = -1 then narrow
                    177:        BEB     mask2or                 # if i = 0 then no inner words
                    178:        lrsw3   &2,%r1,%r0              # i/4
                    179:        BLEB    less4or                 # less than 4 inner words
                    180: For_4: orw2    %r2,0(%r8)              # screenp ^= bits
                    181:        orw2    %r2,4(%r8)              # screenp ^= bits
                    182:        orw2    %r2,8(%r8)              # screenp ^= bits
                    183:        orw2    %r2,12(%r8)             # screenp ^= bits
                    184:        addw2   &16,%r8                 # screenp += 4
                    185:        DECW    %r0                     
                    186:        BGB     For_4                   # more inner words
                    187:        andw2   &3,%r1                  # just how many are left
                    188:        BLEB    mask2or                 # no more to do
                    189: less4or:
                    190:        orw2    %r2,0(%r8)              # screenp ^= bits
                    191:        addw2   &4,%r8                  # screenp++
                    192:        DECW    %r1                     
                    193:        BGB     less4or                 # more inner words
                    194: mask2or:
                    195:        andw3   4(%fp),%r2,%r0
                    196:        orw2    %r0,0(%r8)              # screenp ^= (bits & mask2)
                    197: rest_or:
                    198:        addw2   %r7,%r8                 # screenp += width
                    199:        BRB     FOR
                    200: 
                    201: FSTORE: DECW   %r4                     # number of lines
                    202:        jl      end                     # if neg. then done
                    203:        addw3   %r6,%r3,%r2
                    204:        movw    0(%r2),%r2              # bits = map[bitindex]
                    205:        addw2   &4,%r3                  #bitindex += 1;
                    206:        andw2   &0x7f,%r3               # bitindex = ( bitindex + 1) & WORDMASK
                    207:        andw3   0(%fp),%r2,%r0          #
                    208:        xorw3   0(%r8),%r2,%r0          #screenp = bits & mask1
                    209:        andw2   0(%fp),%r0
                    210:        xorw2   %r0,0(%r8)              #
                    211:        addw2   &4,%r8                  # screenp++
                    212:        movw    %r5,%r1                 # i = ii
                    213:        BLB     stoloop                 # if i = -1 then narrow
                    214:        BEB     sto2ok                  # if i = 0 then no inner words
                    215:        lrsw3   &2,%r1,%r0              # i/4
                    216:        BLEB    st4less                 # less than 4 inner words
                    217: store4:        movw    %r2,0(%r8)              # screenp = bits
                    218:        movw    %r2,4(%r8)              # screenp = bits
                    219:        movw    %r2,8(%r8)              # screenp = bits
                    220:        movw    %r2,12(%r8)             # screenp = bits
                    221:        addw2   &16,%r8                 # screenp += 4
                    222:        DECW    %r0                     
                    223:        BGB     store4                  # more inner words
                    224:        andw2   &3,%r1                  # just how many are left
                    225:        BLEB    sto2ok                  # no more to do
                    226: st4less:
                    227:        movw    %r2,0(%r8)              # screenp ^= bits
                    228:        addw2   &4,%r8                  # screenp++
                    229:        DECW    %r1                     
                    230:        BGB     st4less                 # more inner words
                    231: sto2ok:
                    232:        xorw3   0(%r8),%r2,%r0          #screenp = bits & mask2
                    233:        andw2   4(%fp),%r0
                    234:        xorw2   %r0,0(%r8)              #
                    235: stoloop:
                    236:        addw2   %r7,%r8                 # screenp += width
                    237:        BRB     FSTORE

unix.superglobalmegacorp.com

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