T
T
Tesla4o2021-04-27 10:45:07
C++ / C#
Tesla4o, 2021-04-27 10:45:07

How to write a function const cahr* to hex NASM compiler in assembler?

I want to measure the execution time of the code for converting an SI string to a hex using assembler.
There is a serialize.h file in which the global function from hexconvert.asm is called

extern "C" {
    const char* hex(const char* data);
}

in the assembler file:

[bits 64]

global hex

section .text

hex:
        pusha
        ...


since I don’t know assembler, I ask for help on how to convert or poke my nose into literature, I googled a lot.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AK, 2021-05-01
@andk

In general, time is measured by a timer ...
I don’t quite understand what this function has to do with it.
Initialize the timer.
Call the desired function.
Then stop and analyze the timer.
You have a function that takes a pointer to char(byte) as input and returns a pointer to char(byte).
You need to find the convention for passing parameters to/from a function as it applies to your system.
In dos/windows - https://docs.microsoft.com/ru-ru/cpp/cpp/argument-...
or https://ru.wikipedia.org/wiki/Calling
convention Then it will become clear with which registers/ operands to work in assembler.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question