Ok, here is the entire source for both of the programs:
ASM:
Code:
.486
.MODEL small
.CODE
PUBLIC _read_char
PUBLIC _write_char
PUBLIC _print_string
_read_char proc near
MOV AH,0h
INT 16h
RETN
_read_char endp
_write_char proc near
PUSH BP
MOV BP,SP
MOV DL,BYTE [BP+4]
MOV AH,02h
INT 21h
RETN
_write_char endp
_print_string proc near
PUSH BP
MOV BP,SP
MOV AH,09h
LDS DX,DWORD PTR [BP+4]
INT 21h
POP BP
RETN
_print_string endp
END
C:
Code:
extern int read_char (void);
extern void write_char (char);
extern void print_string (char *);
int main ()
{
char *line = "Hello, world!";
print_string (line);
return 0;
}
I get no compiler errors or assembler errors, but when i run the program, I get a message saying that the CPU detected an illegal instruction!!! This is really frustrating