Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 程序在汇编8086中的程序之后无法继续_Assembly_Dosbox - Fatal编程技术网

Assembly 程序在汇编8086中的程序之后无法继续

Assembly 程序在汇编8086中的程序之后无法继续,assembly,dosbox,Assembly,Dosbox,嗨,朋友们,我不能在“上位”程序后返回到下一行,我不知道ip去了哪里 .MODEL SMALL .STACK 64 .DATA input db 30,?,30 dup('$'),'$' msg1 db "Please enter string to convert:", 0DH , '$' msg2 db "Your converted input :", 0DH , '$' TransFormsMan db 32 ; Going to use the dec value 32 to cha

嗨,朋友们,我不能在“上位”程序后返回到下一行,我不知道ip去了哪里

.MODEL SMALL
.STACK  64
.DATA
input db 30,?,30 dup('$'),'$'
msg1 db "Please enter string to convert:", 0DH , '$'
msg2 db "Your converted input :", 0DH , '$'
TransFormsMan db 32 ; Going to use the dec value 32 to change my lowers chars..


.Code

Main proc
    mov ax, @data
    mov ds, ax
    ; Printing Message1 with a lineBreak
    lea dx, msg1
    mov ah, 09
    int 21H
    mov dl,0AH
    mov ah, 02
    int 21H
    call getString
    xor ax,ax
    lea ax,input
    mov cl,input + 1
    mov ch,0
    add ax,2
    push ax
    push cx
    ; Printing Message2 with a lineBreak
    lea dx, msg2
    mov ah, 09
    int 21H
    mov dl,0AH
    mov ah, 02
    int 21H
    call upper

    mov ah, 4ch
    mov al, 0
    int 21H
endp Main

print proc
    ;Handle bp 
    push bp
    mov bp,sp
    add bp,2
    ;pushes
    push ax
    push bx
    push dx
    ;body:
    mov dx,[bp+2]
    ;add dx,2 ; we want to print without the size of the string. 
    xor ax,ax
    mov ah,9
    int 21H
    xor ax,ax
    xor dx,dx
    mov dx,13 ; Getting down line in the output
    mov ah,2
    int 21h  
    mov dx,10
    mov ah,2
    int 21h ; ^^
    ;pops
    pop dx
    pop bx
    pop ax
    pop bp
    ret 2
endp print

getString proc
    ;Handle bp 
    push bp
    mov bp,sp
    add bp,2
    ;pushes
    push ax
    push dx
    ;body:
    mov ah,0AH
    lea dx,input
    int 21H
    xor ax,ax
    xor dx,dx
    mov dx,13 ; Getting down line in the output
    mov ah,2
    int 21h  
    mov dx,10
    mov ah,2
    int 21h ; ^^
    ;pops
    pop dx
    pop ax
    pop bp
    ret
endp getString

Upper proc
    ;Handle bp 
    push bp
    mov bp,sp
    add bp,2
    ;pushes
    push ax
    push bx
    push cx
    push dx
    push si
    push di
    ;body:
    mov bx,[bp+4]
    mov cx,[bp+2]
    sub sp,[bp+2]
    mov si,sp
    mov di,si

    loopy:
        xor ax,ax
        mov al,[bx]
        cmp al,'z'
        ja notLower
        cmp al,'a'
        jl notLower
        sub al, 32
        mov [si],al
        inc si
        inc bx
        loop loopy
    notLower:
        cmp cx,0
        je stackPrint ; if the last letter was lower so we need to get out of here...
        inc bx
        loop loopy
    stackPrint:
    mov byte ptr [si],'$'
    push di
    call print
    add sp,[bp+2]
    ;pops
    pop di

    pop di
    pop si
    pop dx
    pop cx
    pop bx
    pop ax
    pop bp
    ret 4
endp Upper

END Main

正如我所说,代码运行良好,但每次“Upper”过程结束后,我都无法继续执行以下行,因为ret不会将我返回到调用该过程后的行

在上面的程序中,
pop di
是罪魁祸首。打印过程已返回,参数已从堆栈中删除(
ret 2
)。
只需删除
pop di

当心


如果程序中的
SS
DS
段寄存器不同,则需要进行许多其他更改才能使此“堆栈中的字符串”解决方案工作

谢谢你的解答和解释,对我帮助很大!!
mov byte ptr [si],'$'
push di
call print
add sp,[bp+2]
;pops
pop di