Member 10021674 Ответов: 0

Как присвоить значение 2d массиву в сборке 8086


Hello,
I can not create a 2d array and set it to print.
The project I want to do: Save the name of 20 students and sort and print.
Thank you for your help


Что я уже пробовал:

.model small
.data     
    p1 db 'please enter name:$'
    maxlen db 25
    actlen db ?
    ;str db 20 dup(?),'$'
    str db 20 dup(25 dup(?)),'$'
    count db 0
    
    t1 db '        Student Names$'
    t2 db '-----------------------------$'
    t3 db 'No.             Names$'
.code
    main proc
        mov ax,@data
        mov ds,ax
        
        call cls
        m1:
        call read
        jz m2
        jmp m1          
        
        m2:
        call sort
        call print
        jz m3
        
        m3:
        mov ax,4ch
        int 21h
        
    main endp
    ;
    cls proc 
        mov ax,0b800h
        mov es,ax
        mov si,0
        mov al,' '
        mov cx,10
        
       c1:
        mov es:si,al
        add si,2
        loop c1  
     ret
    cls endp
    ;
     newline proc
       ;khate jadid
       MOV dl, 10
       MOV ah, 02h
       INT 21h
       ;ebteday khate jadid
       MOV dl, 13
       MOV ah, 02h
       INT 21h    
       ;
      ret
     newline endp
    ;
    read proc
        mov ah,09h
        lea dx,p1
        int 21h
       
        call newline 
    
        mov ah,0ah
        lea dx,maxlen
        int 21h 
    
        call newline
    
        inc count
        
        cmp count,5
        jne r1
    r1:
        ret   
    read endp
    ;
    sort proc
        
     ret  
    sort endp
    ;
    print proc
       mov ah,09h
       lea dx,t1
       int 21h
       
       call newline
       
       mov ah,09h
       lea dx,t2
       int 21h     
       
       call newline
       
       mov ah,09h
       lea dx,t3
       int 21h
       
       call newline
       
       mov ah,09h
       lea dx,t2
       int 21h
       call newline
       
       
      mov si,0
     mov al,' '
     mov cl,actlen
     mov ch,0
    b2:
        cmp str[si],al
        
        mov ah,09h
        lea dx,str[si][1]
        int 21h 
        
        jne b1
    b1:
       loop b2
  
        ret   
    print endp
    ;
end main

0 Ответов