将字节数组求和到 ax 寄存器
Sum a byte array to ax register
我有一个关于将一个字节数组求和到 ax 的问题,这是我的代码:
IDEAL
MODEL small
STACK 100h
DATASEG
; --------------------------
arr db 6 dup (200)
; --------------------------
CODESEG
start:
mov ax, @data
mov ds, ax
; --------------------------
xor ax, ax
add ax, [arr]
add ax, [arr + 1]
add ax, [arr + 2]
add ax, [arr + 3]
add ax, [arr + 4]
add ax, [arr + 5]
; --------------------------
exit:
mov ax, 4c00h
int 21h
END start
汇编器returns"Operand types do not match"
我是装配新手,我该如何克服呢?
谢谢
最终我这样做是为了解决我的问题:
IDEAL
MODEL small
STACK 100h
DATASEG
; --------------------------
arr db 6 dup (200)
; --------------------------
CODESEG
start:
mov ax, @data
mov ds, ax
; --------------------------
xor ax, ax
xor bh, bh
mov bl, [arr]
add ax, bx
mov bl, [arr + 1]
add ax, bx
mov bl, [arr + 2]
add ax, bx
mov bl, [arr + 3]
add ax, bx
mov bl, [arr + 4]
add ax, bx
mov bl, [arr + 5]
add ax, bx
; --------------------------
exit:
mov ax, 4c00h
int 21h
END start
我有一个关于将一个字节数组求和到 ax 的问题,这是我的代码:
IDEAL
MODEL small
STACK 100h
DATASEG
; --------------------------
arr db 6 dup (200)
; --------------------------
CODESEG
start:
mov ax, @data
mov ds, ax
; --------------------------
xor ax, ax
add ax, [arr]
add ax, [arr + 1]
add ax, [arr + 2]
add ax, [arr + 3]
add ax, [arr + 4]
add ax, [arr + 5]
; --------------------------
exit:
mov ax, 4c00h
int 21h
END start
汇编器returns"Operand types do not match" 我是装配新手,我该如何克服呢? 谢谢
最终我这样做是为了解决我的问题:
IDEAL
MODEL small
STACK 100h
DATASEG
; --------------------------
arr db 6 dup (200)
; --------------------------
CODESEG
start:
mov ax, @data
mov ds, ax
; --------------------------
xor ax, ax
xor bh, bh
mov bl, [arr]
add ax, bx
mov bl, [arr + 1]
add ax, bx
mov bl, [arr + 2]
add ax, bx
mov bl, [arr + 3]
add ax, bx
mov bl, [arr + 4]
add ax, bx
mov bl, [arr + 5]
add ax, bx
; --------------------------
exit:
mov ax, 4c00h
int 21h
END start