Question: Use a nasm program that uses two subprograms void writeString(String str, int strLen) (Copy this subprogram down here and paste it in your code first)

Use a nasm program that uses two subprograms
void writeString(String str, int strLen)
(Copy this subprogram down here and paste it in your code first)
; hello world program
section .data
msg1 db 'hello world; passing two parameters using stack!!', 10
msg1_len equ $-msg1
msg2 db 'it is real fun learning assembly language', 10
msg2_len equ $-msg2
section .bss
section .text
global _start
_start:
push msg1
push msg1_len
call writeString
push msg2
push msg2_len
call writeString
mov eax, 1
mov ebx, 0
int 80h
;;; void writeString(String str, int strLen)
;; function: outputs characters at str (strLen of them) to stdout
;; recieves: str, a String address, at which a string of length, strLen, is stored.
;; returns: nothing.
writeString:
push ebp ; sets basepointer
mov ebp, esp
mov edx, [ebp+8]
mov ecx, [ebp+12]
mov eax, 4
mov ebx, 1
int 80h
pop ebp ; returns ebp to previous point.
ret 8
- end of the subprogram code !!
int isDivisible(int number1, int number2)
divides number1 by number2.
If it is fully divisible returns a 1; else, returns a 0
It is customary to return the value in eax register
Write the main program in which you will create two variables
num1 = 125
num2 = 6
Call the isDivisible subprogram with these two values
Check the return value in eax
Based on the return value, print in standard output either one of these two messages
Yes! It is divisible
No! it is not NOT divisible
Use the writeString method to print the message

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!