The task is to rearrange the numbers in the reverse order, an array of bytes is given. I start via dos, there are no errors in the program, but it does not work that way, that is, the numbers are not rearranged. Look where it’s an error.

data segment kols db 10 mass db 0,1,2,3,4,5,6,7,8,9 data ebds code segment assume cs:code,ds:code org 100h start: push cs pop ds ; меняем местами mov si,offset mass ; запоминаем адрес начала массива с числами mov bh,0 mov bl,cols add bx,si sub bx,i go: mov al,[si] mov ah,[bx] mov [si],ah mov[bx],al add si,1 sub bx,1 cmp si,bx jl go mov ah,4ch mov ah,31h mov al,0 int 21,h code ends end start 
  • @Nastena Antipova To format the code, select it with the mouse and click on the {} button of the editor. - ReinRaus
  • Fixed formatting, but the code has explicit jambs: data ebds , sub bx,i , int 21,h . As such, the program is not compiled. - insolor

2 answers 2

For example (slightly shortened the first option):

 .model tiny .code org 100h start: mov di,offset numbers mov si,di add si,nlength go: mov al,[si] mov ah,[di] mov [si],ah dec si stosb cmp di,si jl go ret numbers db 0,1,2,3,4,5,6,7,8,9 nlength equ $-numbers-1 end start 

    There are no errors in the program

     mov bl,cols sub bx,i 

    What's this? No complaints about this code:

     go: mov al,[si] mov ah,[bx] mov [si],ah mov [bx],al add si,1 sub bx,1 cmp si,bx jl go 

    Register bx where points to?

    • You are unlikely to be answered: the question was asked about 2 years ago. The question was raised in the “Community Spirit” list, as having no answers with a non-zero number of votes. I corrected the formatting, did not correct the syntax, although there are obvious jambs ( data ebds , int 21,h ). - insolor