1.data segmentmystring db 'a sample for addressing'data endscode segmentassume ds:data,cs:codestart: mov ax,data;初始化mov ds,ax mov bx,0;将bx清0 mov bh,mystring+04h;送第五个字符 mov bl,mystring+0bh;送第十二个字符code endsend start2.data segmentmsg db 20,-3,0,-59,60,-46,-7 cunt1 equ $-msgcunt2 db 0 ;正数置初值cunt3 db 0 ;0数置初值cunt4 db 0 ;负数置初值buffer db 10h dup(0)data endscode segmentassume ds:data,cs:codemov ax,datamov ds,ax mov ax,0mov si,0mov cx,cunt;置循环值lp: mov al,msg[si]test al,ffh;测试是否为0jz lk1test al,10000000b;测试符号位jz lk2inc cunt4;负数计数加一lk1: inc cunt3;0数计数加一lk2: inc cunt2;正数计数加一inc si;指向下一个数据loop lpcode endsend start3.data segment buf1 dw -56,24,54,-1,89,-8,45,-23,43,76 buf2 dw 45,-23,124,345,-265,65,-23,87,-34,65 cunt equ $-buf2 sum dw 10 dup(0)len db ?data ends stack1 segment stackdw 20h dup(0)stack1 endscode segmentassume cs:code,ds:data,ss:stack1start: mov ax,datamov ds,axmov cx,0mov cx,cunt;送数据个数mov bx,-1;初始化地址lp: inc bxmov ax,buf1[bx]sub ax,buf2[bx];数据相减mov sum[bx],ax;存数据loop lp;循环code endsend start虽然没有经过调试但是应该没有问题的 20210311