Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write an assembly program macro WordLength that finds the length of the 1st word in a given string. 1. The string does not contain
Write an assembly program macro WordLength that finds the length of the 1st word in a given string. 1. The string does not contain leading spaces (i.e. in the beginning). 2. A word is terminated by a single space or end of string. 3. The macro takes 2 parameters: P1 (the string label) and P2 (to store the length of the first word). 4. The macro should only modify the parameter P2. 5. Values of any registers used inside the macro should be retained. Code template: .686 model flat, stdcall option casemap: none .data VarS BYTE "Coding in MASM", 0 .code Write your macro here Sample IO data: Vars BYTE "Coding in MASM", 0 Final value in ebx 2 Vars BYTE "Hi machine-coders", 0 {{YOUR CODE COMES HERE }} End your macro before this line start: Final value in ebx 14 Vars BYTE "Have a nice day", 0 Final value in ebx 1 WordLength Vars, ebx Length of 1st. word word word lea eax, Vars add eax, ebx inc eax Index of 2nd WordLength [eax], ebx; Length of 2nd ret end start
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started