Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

data section.

A community discussion post from the original code:zIRON forum.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

data section.

how can i put something in data section , code section .... etc

Fasm uses that

section '.idata' import data readable writeable

masm uses that

 .data
        szDisplayName db "Direct Call DLL",0
        CommandLine   dd 0
        hWnd          dd 0
        hInstance     dd 0

    .code       

hlaAsm uses that

const
        XDIM := 300;
        YDIM := 300;         
static  
        align(4);
        hwnd : dword := NULL;     
storage
        align(4);
        hStdOut         :dword;    
readonly
        align(4);
        BasicTitle      :string := siteTitle_c;       

http://www.freewebs.com/ogremagic/index.htm

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

ziron manages this, all consts and global vars go into the data section.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

what about uninitialized section

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

currently there is no uninitialized data support

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , i asking for that because , i am planning to create masm plugin that will understand

that

program WIN32CUI 'Basic Syntax test';

#include 'console.zir';


.DATA			
var	    DB 64  	 ; Declare a byte, referred to as location var, containing the value 64.
var2	DB ?	 ; Declare an uninitialized byte, referred to as location var2.
        DB 10	 ; Declare a byte with no label, containing the value 10. Its location is var2 + 1.
X	    DW ?	 ; Declare a 2-byte uninitialized value, referred to as location X.
Y	    DD 30000 ; Declare a 4-byte value, referred to as location Y, initialized to 30000.

Z	    DD 1, 2, 3	   ; Declare three 4-byte values, initialized to 1, 2, and 3. The value of location Z + 8 will be 3.
bytes  	DB 10 DUP(?)   ; Declare 10 uninitialized bytes starting at location bytes.
arr	    DD 100 DUP(0)  ; Declare 100 4-byte words starting at location arr, all initialized to 0
str1    DB 'hello',0   ; Declare 6 bytes starting at the address str, initialized to the ASCII character values for hello and the null (0) byte.

.CODE
PUBLIC _myFunc
_myFunc PROC
  ; Subroutine Prologue
  
  mov eax,5
  ret
_myFunc ENDP

wait_key(nil);
ExitProcess(0);

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

aha :)

well i would suggest to init vars as 0x00 regardless of uninit. I will look into ununit data in good time ;)

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , can i register '.DATA' as Let and Dim in plugin Basic?

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

no because it contains special char "." i will have a think how it can be done :)