load.asm

来自「《DSP系统入门与实践》」· 汇编 代码 · 共 62 行

ASM
62
字号
;;  Copyright 2001 by Texas Instruments Incorporated.;  All rights reserved. Property of Texas Instruments Incorporated.;  Restricted rights to use, duplicate or disclose this code are;  granted through contract.;  U.S. Patent Nos. 5,283,900  5,392,448;; "@(#) DSP/BIOS 4.51.0 05-23-01 (barracuda-i10)";
;  ======== load.asm ========
;
;  C-callable interface to assembly language utility functions for the
;  volume example.

    .mmregs

    .global _load

    .text

N   .set        1000          ; multiple of four.

;
;  ======== _load ========
;  This function simulates a load on the DSP by executing N * loadValue
;  instructions, where loadValue is the input parameter to load().
;
;  true execution time: (loadValue)*((N/4 + 25) + 13
;
;  Preconditions:        a = loadValue
;
;  Postconditions:       none.
;
;  Modifies:             a
;
;  void load(unsigned int loadValue)
;
_load:
    bc  done, aeq       ; done if a = 0
    sub  #1, a
    stlm a, ar4         ; ar4 = loopCount - 1
    ld   #(N/4-2), a    ; a = (N / 4) - 2
loop:   
    stlm a,brc          ; initialize count register for block rpt
    nop
    nop
    rptb $1
    nop
    nop
    nop
$1  nop
    banz loop, *ar4-

done:
    .if __far_mode      ; -mf flag will assemble far mode return opcode
        fret
    .else
        ret
    .endif
                        ;/* end load() */
    .end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?