试题详情
简答题为下列数据段中的数组编制一程序,调用题7.16的宏定义SUMMING,求出该数组中各元素之和。DATADD 101246,274365,843250,475536SUMDQ?
  • 程序如下:
    SUMMING MACRO ARRAY,COUNT,RESULT
    LOCAL ADDITION
    MOV ESI,0
    MOV ECX,COUNT
    ADDITION:MOV EAX,ARRAY[ESI*4];;双字为4字节
    ADD RESULT,EAX
    ADC RESULT+4,0;;将进位加到结果的高位双字中
    INC ESI
    LOOP ADDITION
    ENDM
    .MODEL SMALL
    .386
    .DATA
    DATADD101246,274365,843250,475536
    SUMDQ?
    .CODE
    START:MOV AX,@DATA
    MOV DS,AX
    SUMMING DATA,4,SUM
    MOV AX,4C00H
    INT 21H
    END START
  • 关注下方微信公众号,在线模考后查看

热门试题