Popular posts from this blog
Processor state after reset of 80386
Write an X86/64 ALP to accept a string and to display its length.
 ;String length in Assembly Lanuguage ;macros begin %macro write 2    ;will be used to write on the screen mov rax,01h mov rdi,0h mov rsi,%1 mov rdx,%2 syscall %endmacro %macro read 2    ;will be used to read from the screen mov rax,0h mov rdi,1h mov rsi,%1 mov rdx,%2 syscall %endmacro ;macros end section .data len1: equ $-msg1 msg2: db "Enter the string ",10 len2: equ $-msg2 msg3 : db "The length of the string is " len3: equ $-msg3 section .bss orgstr resb 50  ;original string wordlen resb 1  ;length of the string ascii resb 2  ;len in ascii count resb 1 section .text global _start: _start: write msg2,len2   ;display message length:   ;the length option mov al,0  ;initialize al with zero read orgstr,50 mov byte[wordlen],al dec byte[wordlen] ;now len has the length of the string without the null character mov esi,wordlen mov edi,ascii mov byte[count],2 mov al,byte[esi] loop: rol al,04 mov bl,al and bl,0Fh cmp bl,09h jbe no...
 
Comments
Post a Comment