有8位IT菜鸟工程师,第一行数据是他们的基本工资,第二行是绩效工资,编程求出总工资放在第三行。
多多多多加工资哈。
data segment
dw 6290, 7230, 2943, 3360, 7469, 6871, 3067, 3086
dw 7288, 7160, 5733, 7030, 5281, 6891, 4853, 4539
dw 0,0,0,0,0,0,0,0
data ends
解法1:
assume cs:codesg, ds:datasg
datasg segment
dw 6290, 7230, 2943, 3360, 7469, 6871, 3067, 3086
dw 7288, 7160, 5733, 7030, 5281, 6891, 4853, 4539
dw 0,0,0,0,0,0,0,0
datasg ends
codesg segment
start: mov ax, datasg
mov ds, ax
mov cx, 8
mov bx, 0
next: mov ax, [bx]
add ax, [bx+16]
mov [bx+32], ax
inc bx
inc bx
loop next
mov ax,4c00h
int 21h
codesg ends
end start
解法2:(请自行补上缺失的部分)
assume cs:codesg, ds:datasg
datasg segment
dw 6290, 7230, 2943, 3360, 7469, 6871, 3067, 3086
dw 7288, 7160, 5733, 7030, 5281, 6891, 4853, 4539
dw 0,0,0,0,0,0,0,0
datasg ends
codesg segment
start: mov ax, datasg
mov ds, ax
mov cx, 8
mov bx, 0
mov si, 16
nov di, 32
next: mov ax, [...]
add ax, [...]
mov [...], ax
; 改变指示地址的寄存器
loop next
mov ax,4c00h
int 21h
codesg ends
end start