个人实现如下:
assume cs:code
a segment
dw 1,2,3,4,5,6,7,8,9,0ah,0bh,0ch,0dh,0eh,0fh,0ffh
a ends
b segment
dw 0,0,0,0,0,0,0,0
b ends
code segment
start:
mov ax, a
mov ds, ax
; ss 指向b段
mov ax, b
mov ss, ax
mov sp, 16 ; 因为有8个字, sp指向最大字节数+1
mov bx, 0
mov cx, 8
s: mov ax, ds:[bx]
push ax
add bx, 2 ; 操作单元为字, 两个字节
loop s
mov ax, 4c00h
int 21h
code ends
end start
运行前后对比
注: push放置数据时, 从高地址向低地址