Assembler Systime Giving Error on Executing

Assembler sysTime giving error on executing

You have int 80 instead of int 80h on one line. And ecx/edx have the values other way.

After printing msg the next code should be:

mov eax, 4
mov ebx, 1
mov ecx, time
mov edx, 30
int 80h

(It will not do, what you expect, anyway, as the sys_time does not return string, so you can't display it directly).


Checking the sys_time docs on internet... you should call it rather with xor ebx,ebx (NULL buffer pointer), and use the returned eax value. Giving it the buffer pointer is now obsolete way of call. It's number of seconds since Epoch (1970-01-01 00:00:00 +0000 (UTC)).

So at the beginning of your code you can do:

mov eax, 13
xor ebx,ebx
int 80h
mov [time],eax

It's still not solving how to display it (nor I will even try, depends what you really want to achieve, whether just linking against clib is enough for you, and then use the C functions to format the time, or you want to create the seconds_number->time_string formatter from scratch on your own).

Correct User Input - x86 Linux Assembly

After int80 in getname returns, EAX will contain the number of bytes actually read, or a negative error indication.

You should

  1. check for error return
  2. store the return value, as it gives you the length of input

Equivalent code in C:

char name[20];
int rc;

rc = syscall(SYS_read, 0, name, 20-1); // leave space for terminating NUL
if (rc < 0) {
// handle error
} else {
name[rc] = '\0'; // NUL terminate the string
}

Could not load type from assembly error

Is the assembly in the Global Assembly Cache (GAC) or any place the might be overriding the assembly that you think is being loaded? This is usually the result of an incorrect assembly being loaded, for me it means I usually have something in the GAC overriding the version I have in bin/Debug.

Could not load file or assembly ... An attempt was made to load a program with an incorrect format (System.BadImageFormatException)

I am pretty sure you're having a 32-bit / 64-bit conflict. It sounds like your main project might be set to 32-bit while the class its referencing is set to 64-bit. Try looking at this SO question and this one too. Between the two of them, you should be able to figure out your problem.



Related Topics



Leave a reply



Submit