I'm trying to translate assembly code, which gets system date and time into inline-assembly code in C.
The assembly code I'm trying to translate looks something like this (just a part of the actual code)
MOV AH, 2AH
INT 21H
MOV BL, DL
MOV BH, 0
PUSH BX
CALL P_PRINT_NUM ; function to print number
The C code I made looks like
uint8_t test;
asm("movb $0x2A, %%ah;"
"int $0x21;"
"movb %0, %%dl;"
: "=r"(test));
which compiles just fine using GCC. However, when I run the program I get a segmentation fault error. I tried some things like change the constraint or the type of variable but without success. I'm pretty new to inline-assembly. Any help will be greatly appreciated. Thanks.