HERE IS MY C CODE Can you explain the assembly language if p

HERE IS MY C CODE:

Can you explain the assembly language if possible? Thank you. ( I am a beginner)

1- Write an assembly language function int tokilometers (int miles) that takes distance as miles and returns the distance in kilometers. Hi can you help me write an ASSEMBLY LANGUAGE for this function? The main is in C, and l am using SEGGER. Thank you.

Solution

DISTANCE PROC

        PUSH BP //Push the base pointer

        MOV BP,SP

        PUSH AX

        PUSH BX

        MOV AX,[BP+4]      

        MOV BX,[BP+6]

        MUL BL   // Multiplying 1.61 to the miles distance , AX= AL * BL

        MOV DX,AX //move data from AX to DX

        POP BX //pop the value from BX register

        POP AX // pop the AX register

        POP BP   //pop the base pointer

        RET // Return

         DISTANCE ENDP

HERE IS MY C CODE: Can you explain the assembly language if possible? Thank you. ( I am a beginner) 1- Write an assembly language function int tokilometers (int

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site