Beginner here, I am missing a few lines to modify the code I already have to wor
ID: 3766647 • Letter: B
Question
Beginner here, I am missing a few lines to modify the code I already have to work with an argument. What I need is very easy, but I'm new and confused -- would probably only take a few minutes of time from someone who is experienced (I think?!).
I only need a portion of NASM assembly code please (using I/O asm_io.asm routines). Nothing too complicated, just very simple, beginner code (like the Hello World stuff used in someone's first course). I already have my .asm, .inc, makefile, cdecl.h, driver.c etc etc. All I am missing is the few lines of code to modify it and make it do what is specifically described below.
For example: make argv, then argv banana. I need to go through the 2nd line argument banana in a loop and then print it out like this: b a n a n a. Then find the index of the last letter in a second loop and check if it is upper case, if so change it to lower case. (ie: change bananA and display b a n a n a, or banana is fine change nothing and display b a n a n a. What lines of code will make it do this? What makes it leave a space or locate the last letter?
Again, I do not need anything complicated, just a few basic lines using simple language to perform these loops using asm_io.asm routines (ie: mov ebx, dword [ebp+12] or call print_nl etc etc, this is the type of code I am missing in my .asm). I am new to this and appreciate help.
Can you please give a brief outline of each line so I understand and can write my own final code, thanks. (ie: mov [str1+1] ; means this and that will happen) Thank you!
Explanation / Answer
message: db 'hello world'
msglength: equ 12
buffersize: dw 1024
start
mov eax 3
mov ebx,2
mov ecx ,hello
mov edx,hellolen
int 80th
mov eax,1
mov ebx,0
section .txt
pop ebx ;argc
pop ebx argv[5];
pop ebx banana;
int 80th ;
mov ecx,5
loop:
dec ecx
jne loop
push ebp
mov ebp,esp
push ebx;
mov ebx,[ebp+12]; argv
mov eax ;argv[1]
call printf
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.