hello if anyone can help me with this code that im facing a problem with i dont know where exactly is the error but its only working with the first few steps then when it coms to letting the user input a message its causing an error
; multi-segment executable file template.
data segment
; add your data here!
pkey db "press any key...$"
prompt1 db "if u want to encrypt,type E,if u want to decrypt,type D:",0Ah,0Dh,"$"
prompt2 db "enter the encryption key(a single digit from 1 to 9):",0Ah,0Dh,"$"
prompt3 db "input a message of no more than 20 characters ,when done press <ENTER>:",0Ah,0Dh,"$"
message db 20 dup(?)
result db 20 dup(?)
ends
stack segment
dw 128 dup(0)
ends
code segment
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
; add your code here
; prompt the user for input
mov ah, 09h
mov dx, offset prompt1
int 21h
; read the user's input and store it in x3100
mov ah, 01h
int 21h
mov [3100H], al
; prompt the user for the encryption key
mov ah, 09h
mov dx, offset prompt2
int 21h
; read the encryption key and store it in x3101
mov ah, 01h
int 21h
mov [3101H], al
; prompt the user for the message
mov ah, 09h
mov dx, offset prompt3
int 21h
; read the message and store it in x3102
mov ah, 0ah
mov dx, offset message
int 21h
; encrypt/decrypt the message based on the user's input
mov al, [3100H]
cmp al, 'E'
je encrypt
cmp al, 'D'
je decrypt
; encrypt the message
encrypt:
mov si, offset message
mov di, offset result
mov bx, [3101H] ; encryption key
mov cx, 20 ; number of characters to process
encrypt_loop:
; toggle the low-order bit of the ASCII code
mov al, [si]
xor al, 1
add al, [bx] ; add the encryption key
mov [di], al
inc si
inc di
loop encrypt_loop
; output the encrypted message
mov ah, 09h
mov dx, offset result
int 21h
; decrypt the message
decrypt:
mov si, offset message
mov di, offset result
mov bx, [3101H] ; encryption key
mov cx, 20 ; number of characters to process
decrypt_loop:
; subtract the encryption key from the ASCII code
mov al, [si]
sub al,[ bx]
; toggle the low-order bit of the result
xor al, 1
mov [di], al
inc si
inc di
loop decrypt_loop
; output the decrypted message
mov ah, 09h
mov dx, offset result
int 21h
lea dx, pkey
mov ah, 9
int 21h ; output string at ds:dx
; wait for any key....
mov ah, 1
int 21h
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.
its telling me to correct example of int21/9h
mov dx,offset message
mov ah,9
i dont even know where the error is