assembly - Assembly80x86 filling array with user input(names), but no repeating them -


i need fill array names user input, keep out names stored in array(ex, john,jaina,tom,bob). got this, it's not working.

data segment numbers db 0 names db 220 dup (?) buffer db 10 dup (?)  code segment start:  mov ah, 1;  int 21h  mov numbers, ax  mov cx, numbers  lea bx, [names]  names:        onename:          lea si, [buffer]         mov ah,1;character character         int 21h          mov [bx], al         inc bx         mov [si], al         inc si         cmp al, ',' ;end of name         je compare;        loop onename        compare:;buffer names        lea di, [names]             check:             lea si, [buffer]             cmp si, di             jne nextname             inc si             inc di             jmp check        nextname:        cmp di, ','        je check        inc di        jmp nextname   loop names     

mov ah, 1; int 21h mov numbers, ax 
  • you don't initialize counter correctly. dos function 01h gives ascii code in al, treat number in ax.
  • you've defined variable numbers of type byte later on process if word.
  • the instruction loop onename should have been jmp onename
  • the label onename must placed 1 line lower, under assignment si.

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -