0

这是我在使用选项 3 时遇到问题的代码 我还通过此链接提供了代码,因此可以更好地检查 ASM中记事本 代码中的代码 如果您能帮我一把,将不胜感激

bits 16

; Comienzo del programa en $0100

org 0x0100

section .data
;variables
num1 db '0',10,13,'$'
char1 db '#',10,13,'$'
str1 db '                   ',0,13,10,'$'

;constants
intro db 10,13,10,13,'1. Enter a string',10,13,'2.Enter a symbol',10,13,'3.Enter a number',10,13,'4.Output result in variables',10,13,'5.Quit Program',10,13,'$'
string db 10,13,10,13,'Please Enter Letters (up to 20):',10,13, '$'
symbol db 10,13,10,13,'Please Enter a Symbol:',10,13,'$'
number db 10,13,10,13,'Please Enter a Number (4 digits):',10,13,'$'
display db 10,13,10,13,'Data stored in variables:',10,13,'$'
error4 db 10,13,10,13,'Please read program comments-- Was not able to run.',10,13,'$'

section .text
;Defina sus constantes aqui:




;Para acceso directo a memoria de pantalla use las siguientes instrucciones

begin:   mov ah, 9
    mov dx, intro
    int $21
    mov ah, 1
    int $21
    cmp al, '1'
    mov di, str1
    je opone
    cmp al, '2'
    mov di, char1
    je optwo
    cmp al, '3'
    mov di, num1
    je  opthree
    cmp al, '4'
    jp opfour
    cmp al, '5'
    jmp end


opone:
    mov ah, 9
    mov dx, string
    int $21
    mov cx, 0 ; loop counter


loopl:

    mov ah, 1
    int $21

    cmp al, 13
    je begin

    mov [di],al
    inc di
    cmp cx, 19
    je eloop
    inc cx
    jmp loopl
eloop:
    jmp begin

optwo:
    mov ah, 9
    mov dx, symbol
    int $21
    mov ah, 1
    int $21

    mov [di],al
    jmp begin



opfour:
    mov ah, 9
    mov dx, display
    int $21
    mov ah, 9
    mov dx, str1
    int $21
    mov ah, 9
    mov dx, char1
    int $21
    jmp begin

opthree:
    mov ah, 9
    mov dx, error4
    int $21
    jmp begin

    mov ah,7
    int $21
    cmp al, '9'
    je opthree
    sub al, 48 ;ascii 0
    mov ah, 0

    mov bx, 0
    add bx, ax
    cmp cx, 3 ;loop condition
    je begin


    add bx, bx ;multiply
    mov dx, bx
    add bx, bx
    add bx, dx
    jmp opthree ;loop


    mov bh, ah ;guarda el valor
    shr ah, 4
    add ah, '0'
    cmp ah, '9'
    je begin
    add ah, 7

    mov ah,$01
    int $21
    cmp al,'9'
    ja begin
    mov [di],al

    add [di],al
    cmp cx,3
    je begin
    inc cx
    jmp begin




; Para escribir un byte en modos de 80 columnas use una intruccion parecida
; a la siguiente
; el valor de DI debe ser fila * 160 + columna * 2, el simbolo en AL
;         mov  byte [es:di],al


;Debe usar estas instrucciones para terminar el programa
end:     mov  ax,$4C00
         int  $21
4

0 回答 0