Page 1 of 1

problem using long variables with jloc

Posted: Fri Sep 26, 2003 8:47 pm
by shahzad
hi,

i'm getting following error from jloc
undefined symbol N_LXMUL@ IN SYSTEM.C

my asm file is system.asm:

Code: Select all

[bits 16]
segment start

extern _main

jmp _main
my c file is system.c

Code: Select all

int main(void)
{
   long offset,start=66000,end=9;
   offset=start*end;
   for(;;);
}
my ctrl file is makefile.ctl

Code: Select all

ALL:
    system1.o
    system2.o

START: 0,000000000
   ,,,START
CODE: 0
   ,,code
DATA: 0,#10
   ,,data
BSS: 0,#10
   ,,bss

commands i'm using are

Code: Select all

nasm -f obj -osystem1.o system.c
tcc -c -osystem2.o syste.c

jloc makefile.ctl system.com
please help me to use long variables

Re:problem using long variables with jloc

Posted: Mon Sep 29, 2003 2:57 am
by Pype.Clicker
the problem is that TCC (turbo C compiler) is a 16 bits compiler. It does not know anything about 32 bits registers or operations. In order to multiply long integers (32 bits), it requires a library that will provide the multiplication, division, etc. algorithms.

You should either locate that library and link with it or try to find a "enable 386 code" option for the compiler ... and hope it will allow it to generate native opcodes for 32 bits division (that the processor can handle, but that your compiler obviously ignores)

Re:problem using long variables with jloc

Posted: Mon Sep 29, 2003 3:23 am
by Pype.Clicker
Reply from a duplicate thread ...
Tim Robinson wrote: Turbo C probably requires an external routine (whose name is N_LXMUL@) to multiply two 32-bit variables. Consider switching to a 32-bit compiler -- if you're running DOS, use DJGPP; if you're running Windows, use Cygwin or Mingw.

Re:problem using long variables with jloc

Posted: Mon Sep 29, 2003 7:43 pm
by shah
hi,


thanks for your reply.


should i include the 32 bit operations lirary in linker script.




should my linker script look like this now


{
ALL:


system1.o
ystem2.o
cs.lib /*cs.lib is 32 bit operations library*/


START: 0,000000000
,,,START
CODE: 0
,,code
DATA: 0,#10
,,data
BSS: 0,#10
,,bss

}



cs.lib in section "ALL" is 32 bit operations library

Re:problem using long variables with jloc

Posted: Tue Sep 30, 2003 5:48 am
by Tim
Maybe. I still think you're flogging a dead horse by using a 16-bit compiler. Move to 32 bits... :)

Re:problem using long variables with jloc

Posted: Sat Oct 04, 2003 5:53 pm
by shahzad
hi,

can you differnciate between 16 bit and 32 bit compiler.

and what are the disadvantages of using 16 bit compilers

Re:problem using long variables with jloc

Posted: Sat Oct 04, 2003 9:43 pm
by Slasher
it's like riding a bike in an F1 race. 16bit compilers are only capable of handling 16 bit data. To do 32bit stuff with a 16 bit compiler requires you to use an external assembler to compile the 32bit assembly code & data which the 16bit compiler can't handle.
eg 16 bit compilers on the x86 architecture can only handle registers ax,bx,.... and othe 16bit registers meaning the the upper 16bit part of the 32 bit registers like eax,ebx... can't be reached.
you might say but the compilers have long data types which are 32 bits. the compilers uses special library codes written in assembly which it links with your code to provide the needed support for the long data types. that why your having problems.
hope this helps