assembly - Tasm int 21h ah=02h outputs more than one character -


i need string length number, program succeeds in doing, outputs initial string without first letter.

.model small .stack 200h  .data     nuskaitymobuferis  db 11  .code pr1:  mov ax, @data mov ds, ax  mov dx, offset nuskaitymobuferis mov ah, 0ah int 21h  mov nuskaitymobuferis+11, '$'  mov dl, nuskaitymobuferis+1 add dl, 30h mov ah, 02h int 21h   mov ah, 4ch mov al, 00h int 21h  end pr1 

for example if input is: 'test', program outputs: '4est'

in msdos "goto start of next line" performed in 2 steps "goto start column" , "goto next line", hexadecimal: 0dh (carriage return = cr), 0ah (line feed = lf). when press enter button computer gets cr, performed int 21h / ah=0ah , stored nuskaitymobuferis. cursor @ beginning of line, not @ next line - , there '4' printed.

tl;dr... insert line feed behind int 21h / ah=0ah:

... mov dx, offset nuskaitymobuferis mov ah, 0ah int 21h mov nuskaitymobuferis+11, '$'           ; not ;-)  mov dl, 0ah mov ah, 02h int 21h ... 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -