Problem with interruptions in hybridization in C and Assembler

0

I have a problem I want to use assembler interrupts with C but it says

  

Unhandled exception in 0x009B1F01 in ConsoleApplication3.exe: 0xC0000005: Access violation when reading location 0xFFFFFFFF.

the code is as follows

long random() {
    int R = 0;
    _asm {
        MOV AH, 2CH
        INT 21H
        MOV AH,DH
        MOV R, EAX
    }

    return R;
}
    
asked by Adrian Hernandez Islas 13.06.2018 в 03:44
source

1 answer

0

_asm is unique to Microsoft, so I understand that you are programming in Windows.

Under Windows it is not allowed to use interrupts lightly, as was the case with MS-DOS.

The simplest conversion would happen to use time(NULL)

long random() {
  return time(NULL);
}
    
answered by 13.06.2018 в 08:10