Cannot call interupts from C/Asm

1

So I'm trying to create an asm function I can run in C, but every time I use an interrupt it throws the following error: Exception thrown at 0x00541735 in Project1.exe: 0xC0000005: Access violation reading location 0xFFFFFFFF. I have tried returning values from asm functions without at all using interrupts just to test if the asm function itself was the problem, but that worked so I'm stuck. The interrupts seem to be the only problem. Here is my code

global _getkey

section .data

section .text

_getkey:
    push ebp
    mov ebp, esp
    mov ah, 01
    int 22
    mov eax, 16
    mov esp, ebp
    pop ebp
    ret

I am using Microsoft visual studio 2019 to run this as well as NASM. I am on windows 10.

c
windows
assembly
x86
nasm
asked on Stack Overflow Nov 25, 2020 by Sebastian Ehlke • edited Nov 25, 2020 by Michael Petch

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0