Red de conocimiento informático - Material del sitio web - ¿Cómo implementar la salida ASCII en ensamblaje?

¿Cómo implementar la salida ASCII en ensamblaje?

segmento de código público

assume cs:code, ds:code

jmp start

msg db 'Este programa puede mostrarte el ASCII de caracteres o combinaciones de teclas' , 0dh, 0ah

db 'Espero que te ayude', 0dh, 0ah

db 'presiona ESC (ASCII 1bh) para salir. ~~', 0dh, 0ah

db ' kinglin 03.11.27', 0dh, 0ah

db 0dh, 0ah, 24h

¿guardar db ?

Inicio:

mov ax, cs

mov ds, ax

lea dx, msg

mov ah, 09h

int 21h

bucle1:

mov ah, 07h; ingresa caracteres

int 21h

mov guardar, al

cmp save, 01bh; ¿es ESC?

jz está hecho; sí, jmp está hecho

cmp save, 00h ¿es una combinación de teclas?

cmp save, 01bh; p> p>

jnz show; no, jmp

mov ah, 07h

int 21h

mov save, al

mostrar:

mov bl, guardar; guardar al

mov cl, 04h; subir 4 bits

shr bl, cl

cmp bl,09h ;¿es mayor que 09h?

jbe changdec ;inferior o igual, luego jmp

agregue bl,07h ;mayor y luego agregue 07h

changdec:

add bl, 30h; show

mov dl, bl

mov ah, 02h

int 21h

mov al, save

y al, 0fh; bajar 4 bits

cmp al .09h

jbe chdec

añadir al, 07h

chdec:

añadir al, 30h

mov dl, al

mov ah, 02h

int 21h mov dl, ' '

mov ah, 02h

int 21h

bucle loop1

hecho:

mov ah, 4ch

int 21h

el código termina

fin de inicio<

fin de inicio