📜  汇编中奇数和偶数的总和 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:28.135000             🧑  作者: Mango

代码示例1
...
mov cx, 9               ; Count downward from 9 to 1
xor ax, ax              ; sum of even numbers
xor bx, bx              ; sum of odd numbers

l1:                     ; Entry point for the loop
test cx, 1              ; Is CX even?
jz l2                   ; Yes -> jump to the label l2
add bx, cx
jmp l3                  ; Skip the following instruction for even numbers
l2:
add ax, cx
l3:
loop l1                 ; Repeat until CX becomes 0
...