Register | Login
Forum Index > Requests and Feedback > data section.
Author Message
Pages: 1 2 3 4 5 6 7 8 9 10 11
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[672] - posted: 2011-11-12 19:52:00

ok , i want to know your opinion in this

to allow plugin now when a block of data is befin and when it finished , i think the following syntax is good
Code:
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
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[673] - posted: 2011-11-12 20:00:14
It looks fine, but if you are going to change the syntax of masm, then what would be the point to changing syntax of ziron at all?

Unless it is intended to just make it easier and faster to convert masm projects to Ziron, then i think that will be a good option since it is a very little change to make 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
[674] - posted: 2011-11-12 20:05:29
i used the '{}' just to know the start of data and the end , without that it's hard to know
which line will belong to masm and which not.

the main reason of masm is that , if i found some masm snippet is wanted then insert it directly in Ziron code without the need of converting.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[675] - posted: 2011-11-12 20:09:18
ok then it's a good idea 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
[677] - posted: 2011-11-12 21:32:38

ok , this is what i have done till now , only understand DB
Code:
function event_Data() {
  uses edi;
  char buf[2048];
  char val[255];
  char var[255];
  boolean Flg = true;  
  
  if(Flg)
   {
      eax = Ziron_ExpectNextToken(zirBraceOpen);    
      if (eax == -1) {
          Ziron_FatalError('Expected { symbol');
          return true;
       }
       Ziron_ShowMessage(Ziron_GetStringValue());
       
       repeat { 
              // found '}' so let's finished
             eax = Ziron_PeekNextToken(); 
             if (eax == zirBraceClose)
              {
                 Ziron_GetNextToken(); 
                 Ziron_ShowMessage(Ziron_GetStringValue());
                 break;
              } 
              
              // get the variable name and hold it in Var 
              eax = Ziron_ExpectNextToken(zirIdent);
              if (eax == -1) {
                  Ziron_FatalError('Expected Variable Name');
                  return true;
               }
              H_strcpy(@var,Ziron_GetStringValue());     
              Ziron_ShowMessage(@var);
              
              // get DB or DW or DD or DQ
              eax = Ziron_ExpectNextToken(zirIdent);
              if (eax == -1) {
                  Ziron_FatalError('Expected Variable Name');
                  return true;
               }
              boolean TypeFlg;
              TypeFlg = strCmp('DB',Ziron_GetStringValue()); 
              if(TypeFlg)
               { 
                   eax = Ziron_GetNextToken();  
                   case (eax) {
                          state zirHEXADECIMAL:
                    state zirNUMBER:
                        H_strcpy(@val,Ziron_GetStringValue()); 
                        Ziron_ShowMessage(@val);  
                        buf=0;
                              H_strjoin(@buf, 'byte ' , @var, ' = ' , @val, ';' );
                              Ziron_ShowMessage(@buf);
                              Ziron_Exec(@buf);
                              break;       
                          default:
                              Ziron_FatalError('Expected number');
                              return true;
                    }      
               }
       };            
      return true;
   }
  else
   {   
      return false;                           // let Ziron handle the line  
   }  
}


test program
Code:
program WIN32CUI 'Basic Syntax test';

#include 'console.zir';


.DATA 
{

var      DB 64     

}

eax = 0;
al = var;
print('var = ', Eax); 

wait_key(nil);
ExitProcess(0);


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[678] - posted: 2011-11-12 21:37:37
why not include the masm compat file then you wont need to check for text DB DW, DD, DQ etc, you could just add them as data types.

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
[679] - posted: 2011-11-12 21:57:46

did you mean , ziron will convert 'DB' to byte before plugin will process that

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

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[680] - posted: 2011-11-12 22:12:19
can you please add '?' to ZirToken or if you tell me that how to detect '?' in our code?

http://www.freewebs.com/ogremagic/index.htm
Pages: 1 2 3 4 5 6 7 8 9 10 11
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 9 user(s) online. 0 member(s) and 9 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