NASM basics 
Author Message
 NASM basics

can someone please tell me what these directives mean using NASM for Win32?

 BITS 16
;----------------------
SECTION .bss

random: resb 2  ; Variable for random number generation
;--------------------------

--

-melocotones! ryan
www.dignified.dhs.org | www.irt.org | www.ucdavis.edu
uin: 797208, aol im: bruceius



Tue, 03 Dec 2002 03:00:00 GMT  
 NASM basics

Quote:

> can someone please tell me what these directives mean using NASM for Win32?

>  BITS 16

  That means the following code will be assembled in a way that assumes
it will be run in 16-bit mode.  DOS real mode and V86 mode and old win16
mode programs all run in 16-bit mode.  Win32 programs don't (though they
might include some V86 mode code).

Quote:
> SECTION .bss

  That means the following code and data will be in a segment named
".bss".  ".bss" is normally used to allocate space for variables which
are not initialized at compile/assembly time.  That allows the linker to
leave them out of the load image to make the EXE file smaller and
loading faster.  The loader must include them in the total space
required to start the program, but doesn't need to load anything into
that space.

  Depending on the obj format and linker you are using, the connection
of the name ".bss" to the above use might just be general convention
(using some other name would work as well and using the name .bss for
something else would also work) or it might be hard wired so that the
linker and/or obj format knows the meaning of ".bss"

Quote:
> random: resb 2  ; Variable for random number generation

  It means reserve 2 bytes of space for a variable named "random"
without doing any assembly time initialization of that space.

--
http://www.erols.com/johnfine/
http://www.geocities.com/SiliconValley/Peaks/8600/



Tue, 03 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. NASM grammar ::basic::

2. Basic (Very) Tutorial /Nasm help

3. basic question about using nasm

4. New official netwide assembler (NASM) mailing list -- NASM Advocate

5. NASM and nasm.sl for JED editor mode question

6. TASM to NASM and/or NASM to TASM

7. NASM help for newbie on NASM

8. Device Driver: from Apple III BASIC to IBM BASIC

9. Please help Visual Basic Programer with simple read/write text file routine---Real Basic 2.1

10. Visual basic or real basic?

11. UNIBASIC, PIC BASIC or Business Basic

12. Power Basic CC vs Power Basic for DOS

 

 
Powered by phpBB® Forum Software