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

entry keyword

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

entry keyword

Hi Mr Colin,

i think entry keyword will direct the execution to the position where it is in.

but this example below works incorrect way.

program PE32_CUI 'entry keyword';

#include 'platform_def.zir';
#include 'console.zir';

aa:    // this code executed 2 times ?????????????
  mov eax, 5
  print([dword]eax,'\n'); 
  lret 0;

entry procedure WINAPI main() {
  RTLMain();

  println('Hello, World!');
  
  call aa
   
  wait_key();
  ExitProcess(0);
}

also when decalr the subroutine in the end the lable will not be seen by Ziron, see this

program PE32_CUI 'entry keyword';

#include 'platform_def.zir';
#include 'console.zir';


entry procedure WINAPI main() {
  RTLMain();

  println('Hello, World!');
  
  call aa
   
  wait_key();
  ExitProcess(0);
}

aa:    
  mov eax, 5
  print([dword]eax,'\n'); 
  lret 0;

also in lret 0; term what '0' means , and if possible , you can use ret instead of lret key word

,you can check if we are in subroutine exec lert event.

thanks.

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

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Ziron is intended to be a high level assembler, why would you want to over complicate the source?

calling RTLMain() calls the whole file as a function since Ziron source is the default first function which can have numerous initialization code (I may arrange this different in a later version)

meanwhile, using a label like so is no point.

program PE32_CUI 'entry keyword';

#include 'platform_def.zir';
#include 'console.zir';

#set frame off;
procedure aa() {
  mov eax, 5
  print([dword]eax, '\n');
}
#set frame on;

entry procedure WINAPI main() {
  RTLMain();

  println('Hello, World!');
  
  call aa
   
  wait_key();
  ExitProcess(0);
}

Note that RTLmain will be obsolete in one of the following versions once i rewrite the RTL.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt
Ziron is intended to be a high level assembler, why would you want to over complicate the source?

actually , i am a big fan of Blitzbasic2 for amiga, i was playing with AmiBltz3 since two days so i want to revival it.

testing how Ziron can be close to amiblitz3 , i may write a plugin for that.

 

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