write a function B() in assembly lang programming which takes the argument as 64 bit integer. It should interpret that as a 8-byte ASCII string and print individual
characters on screen. You need to call the write() system call from assembly language using the syscall instruction, passing appropriate arguments.
Modify the stack in the function B() in such a way that when B() executes
the ret instruction, it jumps to a third function C(). C() must also be
written in C.
; que.asm
; Assemble: nasm -f elf64 -l que.lst que.asm
; Link: gcc -o que que.o
; Run: ./que
SECTION .data
strc: db 10,13,"func c()",10,13,0
str: dd 0
SECTION .text ; Code section.
global main
main:
mov rax,0x3031323334353637 ;;64 bits integer
mov rbx, c
push rbx
call b
;***************************
b:
;***************************
mov [str], rax
; sys_write
mov eax,4
mov ebx,1
mov ecx, str
mov edx,8
int 80h
pop rax
ret
;***************************
c:
;***************************
; sys_write: "func c()"
mov eax,4
mov ebx,1
mov ecx, strc
mov edx,13
int 80h
; sys_exit
mov rax,1
mov rbx,0
int 80h
Comments
Leave a comment