V
Victor
hello,
I'm trying to write a C program that calls a function that written in
assembly language(X86), but I keeps getting undefined error. I used
paradigm C++ for linking and compiling.
------------------------------------------------------------
;this is output.asm
name output
..186
..MODEL small, c
assume cs: _TEXT
_TEXT segment public 'CODE'
public _output_word
_output_word proc C NEAR
push ax
push dx
push bp ; saves base pointer
mov bp, sp ; base pointer gets stack pointer
mov dx, [bp+4] ; moves port address to dx
mov ax, [bp+6] ; moves data to ax
out dx, ax
pop bp
pop dx
pop ax
ret
_output_word endp
_TEXT ends
end
---------------------------------------------------------------
//this is ccode.c
#define T2CON 0x1000
#define T2_Mode 0xC001
extern void output_word(int port_address, unsigned short data);
void main(void)
{
while(1)
{
output_word(T2CON, T2_Mode);
}
}
---------------------------------------------------------------------
The error message is as follows:
Info :Linking N:\ese476\C Phase 1\cphase1.rom
Warn : :Old-style user-defined stack - stack options ignored
Error: ccode.c(4): Undefined symbol _output_word in module ccode
Warn : rogram has no entry point
both files are compiled and assembled under one project and under .axe
files. both files passed the compiler and assembler, but error when I
tried to link them.
any help will be appreciated!
Thanks
-V-
I'm trying to write a C program that calls a function that written in
assembly language(X86), but I keeps getting undefined error. I used
paradigm C++ for linking and compiling.
------------------------------------------------------------
;this is output.asm
name output
..186
..MODEL small, c
assume cs: _TEXT
_TEXT segment public 'CODE'
public _output_word
_output_word proc C NEAR
push ax
push dx
push bp ; saves base pointer
mov bp, sp ; base pointer gets stack pointer
mov dx, [bp+4] ; moves port address to dx
mov ax, [bp+6] ; moves data to ax
out dx, ax
pop bp
pop dx
pop ax
ret
_output_word endp
_TEXT ends
end
---------------------------------------------------------------
//this is ccode.c
#define T2CON 0x1000
#define T2_Mode 0xC001
extern void output_word(int port_address, unsigned short data);
void main(void)
{
while(1)
{
output_word(T2CON, T2_Mode);
}
}
---------------------------------------------------------------------
The error message is as follows:
Info :Linking N:\ese476\C Phase 1\cphase1.rom
Warn : :Old-style user-defined stack - stack options ignored
Error: ccode.c(4): Undefined symbol _output_word in module ccode
Warn : rogram has no entry point
both files are compiled and assembled under one project and under .axe
files. both files passed the compiler and assembler, but error when I
tried to link them.
any help will be appreciated!
Thanks
-V-