Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Bugs and Fixes

Not included in output file

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

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I have now implemented this for next release.

byte b1[] = 'Hello World!';
0CodErr member
Posts
201
Threads
37
Location
Unknown
// not included because not used
dword d1 = 0x12345678;
// not included BUT used
dword d1 = 0x12345678;
eax = 0;
eax = [eax + @d1];
// included BUT NOT used(only address used, not value)
dword d1 = 0x12345678;
eax = @d1;

What would can be recommended?

first way: add extra option for this

second way: use option #optimise for this

third way: always include all data

As for third way then it similar to usual behavior of many other assemblers.

Just compare:

Ziron:

dword MyVariable = 0x12345678;
MyVariable; // <<-- this also need to write

Other:

MyVariable dd 0x12345678 // <<-- that's all enough!

It may be hard to determine is value used or not.

For example if programmer already knows address. He can use direct address.

Anyway such assembler restrictions not so useable. I think that programmer would like more easy way without extra actions.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Second code, I will correct, this was a small overlook, I forgot to set var as used. I will also add directive to always write data.

Of course using vars to write data is not the norm....

Asm

MyVariable dd 0x12345678

Ziron

emit dword 0x12345678;
Colin admin
Posts
928
Threads
49
Location
Bulgaria

OK, I have corrected [@d] setting variable active and I have also added a new directive "awd" - always write data.

program RAW_IMAGE 'test';

#set bits 32;
#set awd true;

byte b1[] = 'Hello World!';
0CodErr member
Posts
201
Threads
37
Location
Unknown

Optimizations on high level ofcourse very useful. But not on LOW level.

i.e. for example

mov al, al

Because programmer wrote it not just for fun. Therefore he need it.

May be you also will remove

xchg eax, eax; (NOP)

?

My point -- optimizations need only on high level.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I have fixed this.

eax = eax;

will be optimised by default

mov eax, eax

will be output as written.

0CodErr member
Posts
201
Threads
37
Location
Unknown

Here is 'dword d1' not included in output mscoff file:

program MSCOFF 'test';   
#set bits 32;
dword d1 = 1;
d1;

http://pastebin.com/Szq8Q1B3

But here is included:

program MSCOFF 'test';   
#set bits 32;
dword d1 = 1;
eax = d1;

http://pastebin.com/E180MVAr

Also seems there are unnecessary

_GetProcessHeap@0
__smm_hHeap