BASED ADDRESSING反转输出
程序运行:
代码:
datas segmentstring db 'BASED ADDRESSING$'
count dw $-string-1 ;计算string的长度,$为当前地址,-1为去掉字符串结束符'$'srcsTip db 'SRC string:$'
dstsTip db 0dh,0ah,'DST string:$' ;0dh,0ah回车换行datas endsstacks segmentstacks endscodes segmentmain proc farassume cs:codes,ds:datas,ss:stacksstart: push dssub ax,axpush axmov ax,datas ;初始化dsmov ds,ax;输出源字符提示lea dx,srcsTip mov ah,9int 21h ;输出源字符lea dx,stringmov ah,9int 21h;输出目标字符提示lea dx,dstsTip mov ah,9int 21h;输出目标字符 mov cx,count mov ah,2mov bx,count dec bx ;获得最后一个字符的下标s1:mov dl,string[bx]int 21hdec bx ;bx-1,移至前一个字符loop s1retmain endpcodes endsend main