Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Null pointer assignment when using BSS

1 view
Skip to first unread message

mElo

unread,
May 5, 2002, 12:55:55 PM5/5/02
to
hi!
There's a problem that has been sticking to me for one week now, and I can't
figure out what's the cause: I'm coding a program that uses the BIOS EDD
interrupts (Fn41-4E) to access my hard drive (for now it just reads the
partition table).

There's a module coded in assembly (NASM0.98) and another coded in C (under
DOS, with BC++4). I link this little mess, with TLINK v7.1...
Here's the problem: when I execute the program it aborts with a "Null
pointer assignment" message.

It found that this problem comes from the declaration of variables in the
_BSS segment (in the assembly source), because when I move the declarations
in the _DATA segment it works well !

;For example this doesn't work
SEGMENT _BSS CLASS=BSS
cylinders resw 1
heads resw 1
sectors resw 1
lba resd 1

SEGMENT _DATA CLASS=DATA
drive dw 80h

Here's the link where I uploaded the source:
http://www.guetali.fr/home/nirvana8/melo/files/diskio006.zip

That's all,
forgive my english, it may be bad sometimes (frensh people!),
have fun coding,
bye...
mElo
EDIT, my old old friend... :-)

david lindauer

unread,
May 10, 2002, 2:56:02 PM5/10/02
to
do you have your data and BSS segments in the same group? If not you may be
accessing an area of memory you don't think you are accessing.

David

mElo

unread,
May 11, 2002, 4:55:52 AM5/11/02
to
david lindauer <dlin...@notifier-is.net> wrote in message news:<3CDC1775...@notifier-is.net>...

> do you have your data and BSS segments in the same group? If not you may be
> accessing an area of memory you don't think you are accessing.

In fact, yes they are in the same group, I checked it in the MAP
file. It may be because I declare my CODE, DATA and BSS segment with
the same name as the OBJ files produced by the C compiler (BCC++4),
what is to say: _TEXT, _DATA, _BSS.

Anyway as you and Geezer noticed me, I should GROUP my segments in the
assembly files, like the compiler does: CGROUP and DGROUP.

Geezer wrote to me the solution:
>Here is your CC.BAT file:
> nasm -f obj diskio.asm
> nasm -f obj timer.asm
> bcc -3 -c -mt -v main.c partable.c
>
>-mt is for TINY memory model
>
>Here is your LK.BAT file:
> tlink /Tde /c /C /Lc:\tc\lib /s /v c0s diskio timer partable >main,t,,cs.lib
>
>c0s is for SMALL memory model
>
>You must change one of these!
>
>Also, maybe you need a GROUP statement in the .ASM files
>
>--
>geezer@ | http://www.execpc.com/~geezer
>execpc.com | http://www.execpc.com/~geezer/osd

Thanks
bye
mElo


> mElo wrote:
>
> > hi!
> ...

0 new messages