分离字数组ARRAY中的正,负数,把其中的正数复制到PDATA数组:负数复制到NDATA数组,并分别统计正、负数个数。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
DATAS SEGMENT array dw 1,2,3,-4,5,-6,7,-8 DATAS ENDS ext segment pdata dw 8 dup(?) ndata dw 8 dup(?) a db 30h b db 30h ext ends CODES SEGMENT ASSUME CS:CODES,DS:DATAS,es:ext START: MOV AX,DATAS MOV DS,AX mov ax,ext mov es,ax lea bx,array lea si,pdata lea di,ndata mov cx,8 T: mov ax,[bx] test ax,8000h jz P mov es:[di],ax add a,1 add di,2 jmp L P: mov es:[si],ax add b,1 add si,2 L:add bx,2 loop T mov dl, a mov ah,2 int 21h mov dl,20h mov ah,2 int 21h mov dl, b mov ah,2 int 21h MOV AH,4CH INT 21H CODES ENDS end start |