Here is the code i wrote I'm trying to write on assembly 8086 like on a regular keyboard but every time i press on enter it goes down a line and writes the second letter in the RAM how do i fix it without resetting the ram lets the user write from the keyboard.
data segment
; add your data here!
msg db ?
nxtline db 10,13,'$'
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
xor ax,ax
mov ah,1
xor bx,bx
mov bx,offset msg
ifpressed:
;pusha
mov ah,1
int 21h
cmp al,0Dh ;check when enter is pressed
jz nextline
mov [bx],al
add bx,2
;popa
jmp ifpressed
nextline:
lea dx, nxtline
mov ah, 9
int 21h
jmp ifpressed
reapet:
mov ax, 4c00h ; exit to operating system.
int 21h
ends
end start ; set entry point and stop the assembler.
`
...but every time i press on enter it goes down a line...
That's exactly what the program was created for. If you don't want this to happen then either remove the next 2 lines from your program:
cmp al,0Dh ;check when enter is pressed
jz nextline
or keep these 2 lines but alter the definition of nxtline (remove the 13):
nxtline db 10,'$'