Register | Login
Forum Index > General Discussion > goto statment
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1231] goto statment - posted: 2012-05-28 21:06:45

Hi Mr Colin.

as you know , with asm language you can make some tricks to preform something.

so i used goto to put some data after it , then when trying to use this data , we get NULL.

for Example:
Code:
imports('msvcrt.dll') 
{
  function printf(char* format[]): Int32; cdecl;
}

goto @end

char* str1 = 'this well not seen by ziron';
  ............
  ............

@end:

ebx=@str1;
printf('%s',[Ebx]);


this will print null , but this of course work

Code:
imports('msvcrt.dll') 
{
  function printf(char* format[]): Int32; cdecl;
}



char* str1 = 'this well not seen by ziron';
goto @end
    ........
    ........
@end:

ebx=@str1;
printf('%s',[Ebx]);


so why ziron did not execute what after goto.

http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1232] - posted: 2012-05-28 21:16:32

to be more specific ,i want to allow this
Code:
goto @end

@myStr:
Emit byte  'E','m','i','l',0,10,13;  // of course i will put useful data here    

@end:

ebx=@myStr;
printf('%s',[Ebx]);


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1233] - posted: 2012-05-28 21:30:22
with your first example you were confusing pointers and also mov operation

e.g.

Code:
char* str1 = 'this well not seen by ziron';


this is a mov op

and this:

Code:
printf('%s',[Ebx]);


here you are not passing a pointer by the value of the pointer

working example:

Code:
program WIN32CUI 'Test';

#include 'ch.zir';

imports('msvcrt.dll') 
{
  function printf(char* format[]): Int32; cdecl;
}

goto @end

const str = 'this is a test';

@end:

ebx = @str;
printf('%s\r\n', ebx);

wait_key();

ExitProcess(0);


as for emitting text between jumps, this is also possible:

Code:
program WIN32CUI 'Test';

#include 'ch.zir';

imports('msvcrt.dll') 
{
  function printf(char* format[]): Int32; cdecl;
}

goto @end
  @str: emit byte "t","e","s","t",0;
@end:

ebx = @str;
printf('%s\r\n', ebx);

wait_key();

ExitProcess(0);


emit plugin could be extended to support emit string '....';

or optionally a whole new plugin could be developed for handling strings emitted inside of code smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1234] - posted: 2012-05-28 21:50:38

ok , thanks for explanation.

http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1235] - posted: 2012-05-28 22:09:30

good news , this also working well.


Code:
program WIN32CUI 'Test';

#include 'ch.zir';

imports('msvcrt.dll') 
{
  function printf(char* format[]): Int32; cdecl;
}

ebx = @str;
printf('%s\r\n', ebx);

wait_key();

ExitProcess(0);

// we put data here for erasing goto statment.
 @str: 
    emit byte "t","e","s","t",0;


so the big trick here , can we use a label as a variable ?
eg. something like that
Code:
   al = str[2];
 


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1236] - posted: 2012-05-28 22:23:58
at current, not directly, but i need to work more on this.. else

Code:
eax = @lbl;
al = [eax+1];


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1237] - posted: 2012-05-28 23:17:43

ok , but how to put the address of another labels to make array of pointer.

for Example
Code:
@Str2:
     emit byte "t","e","s","t","2",13,10,0;
     
@Str3:
     emit byte "t","e","s","t","3",13,10,0;
     
@Str4:
     emit byte "t","e","s","t","4",13,10,0;     
     
@addr:
     emit dword @Str2,@Str3,@Str4,0;        // how can we make that
     


http://www.freewebs.com/ogremagic/index.htm
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd