多个循环计数器公用cx的解决办法

时间:2022-12-08 20:32:07

简单 ,提前cx入栈

assume cs:codesg,ds:datssg,ss:stacksg

datasg segment
   db 'ibm             '
   db 'dec             '
   db 'dos             '
   db 'vax             '
data ends

stack segment
   dw 0,0,0,0,0,0,0,0
stack ends

codesg segment

   start:mov ax,stacksg
           mov ss,ax
           mov sp,16
           mov ax,datasg
           mov ds,ax
           mov bx,0

           mov cx,4
   

s0: push cx mov si,0 mov cx,3 s: mov al,[bx+si] and al,11011111b mov [bx+si],al inc si loop s add bx,16 pop cx loop s0 mov ax,4c00H int 21H codesg ends end start

 

用的时候直接出来完事,随用随建栈233