Annotation of researchv9/jerq/src/lib/sys/cursblt.s, revision 1.1

1.1     ! root        1:        # cursblt draws the cursor.  It is assumed that
        !             2:        #       the cursor is 16x16 in a texture16
        !             3:        #       the move is in XOR mode
        !             4:        #       the destination is on the screen
        !             5:        # arguments are &display, &texture, destination point
        !             6: 
        !             7:        .globl  cursblt
        !             8:        .align  8
        !             9: cursblt:
        !            10:        SAVE  %r6
        !            11:        MOVW  &16,%r7   # scan count and source position value
        !            12:        MOVW 0(%ap),%r2         # get screen bitmap pointer
        !            13:        ARSH3 &4,8(%ap),%r0     # p.x >> 4 -> r0  (half word address)
        !            14:        MOVH  10(%ap),%r1       # p.y -> r1
        !            15:        MULW2 &50,%r1           # p.y * 50 = # of words from base of display
        !            16:                                # to start of scan line
        !            17:        ADDW2 %r1,%r0           # x + y
        !            18:        ADDW2 %r0,%r0           # convert words to bytes
        !            19:        ADDW2 0(%r2),%r0        # add in the base of display for address of dest
        !            20:        MOVW  4(%ap),%r1        # start of cursor to move
        !            21:        ANDH3 &31,8(%ap),%r2    # need the shift distance
        !            22:        SUBW2 %r7,%r2           # r2 - 16
        !            23:        BEB  CB_ALIGNED         # No shift at all, will we be quick
        !            24:        MOVW  &0xFFFF0000,%r6   # load a mask needed in loop
        !            25:        BITB  &2,%r0            # if set, we are dest straddling
        !            26:        BNEB   CB_DEST_ST
        !            27:        .align 4
        !            28: CB_NO_STRADDLE:                        # just rotate the 16 bits, other bits are 0's
        !            29:        ROTW %r2,{uhalf}0(%r1),%r8
        !            30:        XORW2 %r8,0(%r0)        # and store
        !            31:        ADDW2 &100,%r0          # next scanline 100bytes=display width=800 bits
        !            32:        ADDW2 &2,%r1
        !            33:        DECW  %r7               # for count of 16
        !            34:        BNEB  CB_NO_STRADDLE
        !            35:        RESTORE %r6
        !            36:        RET
        !            37:        .align 4
        !            38: CB_ALIGNED:                    # no shift, so just xor mem to mem..
        !            39:        XORH2 0(%r1),0(%r0)     # and store
        !            40:        ADDW2 &100,%r0          # next scanline 100bytes=display width=800 bits
        !            41:        ADDW2 &2,%r1
        !            42:        DECW  %r7               # for count of 16
        !            43:        BNEB  CB_ALIGNED
        !            44:        RESTORE %r6
        !            45:        RET
        !            46:        .align 4
        !            47: CB_DEST_ST:                    # we straddle, so rotw the halfword...
        !            48:        ROTW %r2,{uhalf}0(%r1),%r8
        !            49:        XORH2 %r8,0(%r0)        # xor the left half of the straddling dest
        !            50:        ANDW2 %r6,%r8           # now mask out what you just wrote &
        !            51:        XORW2 %r8,2(%r0)        # xor the right half as a full word (faster)
        !            52:        ADDW2 &2,%r1
        !            53:        ADDW2 &100,%r0          # next scanline 100bytes=display width=800 bits
        !            54:        DECW  %r7
        !            55:        BNEB   CB_DEST_ST
        !            56:        RESTORE %r6
        !            57:        RET

unix.superglobalmegacorp.com

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