我遇到問題。我必須在8086程序集中編寫一個程序,用字符串填充數組,然後僅打印字符「a,e,e,i,i,o,o,u,u」。
我已經成功地打印出數組內的每一個字符,但是當我開始加入條件和跳躍,我的程序剛剛進入一個無限循環:(僅識別和打印出字符串中的元音字母
Here's整個代碼:
org 100h
jmp main
;messsages to be shown:
msg1 db 'this is an example program.', 10, 13, 'made to show only the vocal letters of a string', 10, 13, 'write some words', 10, 10, 13, '$'
msg2 db 10, 10, 13, 'your phrase:', 10, 10, 13, '$'
;variables
aux db 0
vct dw 0
;program start
main:
lea dx, msg1
mov ah, 09h
int 21h
mov cx, 20
ingresarNumero:
mov ah, 08h
int 21h
cmp al, 08h
je borrar
cmp al, 0Dh
je enter
cmp al, 20h
je enter
mov ah, 0Eh
int 10h
mov ah, 0
mov vct[si], ax
inc si
loop ingresarNumero
ultimaPosicion:
mov ah, 08h
int 21h
cmp al, 08h
je borrar
cmp al, 0Dh
je finIngreso
jmp ultimaPosicion
borrar:
cmp cx, 20
je ingresarNumero
mov ah, 0Eh
int 10h
mov al, 0
int 10h
mov al, 8
int 10h
pop ax
inc cx
dec si
jmp ingresarNumero
enter:
cmp cx, 20
je ingresarNumero
jmp finIngreso
finIngreso:
lea dx, msg2
mov ah, 09h
int 21h
push cx
mov cx, si
mov si, 0
superloop:
mov ax, vct[si]
mov ah, 0Eh
int 10h
inc si
loop superloop
ret
你有沒有試過用調試器逐步完成它? –