Register | Login
Forum Index > Requests and Feedback > get entire line
Author Message
Pages: 1 2 3 4 5 6 7 8
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[478] - posted: 2011-11-08 16:25:43
not sure you maybe have missed something, what did you change?

also you may want to lowercase the line buffer

in strings.zir, procedure strLower change to a function and add at bottom
Code:
function strLower(char* str) {
  uses esi;
  esi = str;
  edx = esi;

  repeat {
    lodsb
    if (al == 0) {
      break;
    } elseif ((al => "A") and (al <= "Z")) {
      add al, 0x20
      [esi-1] = al;
    }
  };
  
  eax = str;
}


then you can do:

Code:
  eax = strIndexOf(strLower(@line), 'into');            // see if the line have to pares with the plugin
  if(eax != -1)
   { 
      Ziron_ShowMessage(@line);                // show our entire line for debug purpose
      buf=0;
      Ziron_GetNextToken();                    // so what is after 'mov'
      H_strcpy(@val,Ziron_GetStringValue());   // and save it in val  
                        
      eax = Ziron_ExpectNextToken(zirINTO);        // remove into 
      if (eax == zirUnexpected) {
          return false;                        // let Ziron handle the line 
       }

   ....


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
[479] - posted: 2011-11-08 16:28:31
i have changed nothing , only update the package.

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

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[480] - posted: 2011-11-08 16:31:47
with lowercas got that error

--------------------------------------------

PlugSys: Emit plugin has loaded!
PlugSys: Mov plugin has loaded!
--------------------------------------------


[6,8]: Expected register or segment or segment:offset or [expression] or variable or local variable or local parameter but found 10 in [testprg.zir]
Code:
mov 10 into eax




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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[481] - posted: 2011-11-08 16:38:26
and you changed the strings lowercase function? you can also remove edx = esi

you added the eax = str at the bottom?

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
[482] - posted: 2011-11-08 16:43:17

after changes as you suggested , the same error as post #[477]

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[483] - posted: 2011-11-08 16:49:42
lol my mistake, i didnt read the code properly, actually when i wrote into ax, this syntax is incorrect anyways because into does not take a parameter.... lol

Code:
mov 10 into eax; into eax = 5;


this is 3 different operations 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
[484] - posted: 2011-11-08 16:53:20
ok ,works fine , here is the final code
Code:
//******************************************************//
//                                                      //
//                 Mov Plugin                           //
//                                                      //
//               By Emil Halim                          //
//               7 / 11 / 2011                          //
//                                                      //
//******************************************************//

program WIN32DLL 'Mov PLUGIN';

#include 'zirplug/framework.zir';
#include 'strings.zir';

//////////////////////////////

const strLoaded = 'Mov plugin has loaded!';

//////////////////////////////
function H_strlen(char* str) {
  Eax = str;
  while(char[eax] != 0) {
    Eax++;
  }
  sub eax, str
}

function  H_strcpy(Dword dst,src)
{ 
  Eax = dst; 
  Edx = src; 
  push Eax;
  BL =  [Edx]; 
  while ( BL != 0)  
   { 
      [Eax] = BL; 
      Eax++; Edx++; 
      BL =  [Edx]; 
   }  
  [Eax] = 0;
  pop Eax;
} 

function H_strcat(Dword dst,src) 
{ 
  Eax = dst; 
  Edx = src;
  push Eax;
  while (byte [Eax] != 0) { Eax++; } 
  while (byte [Edx] != 0)  
   { 
      BL =  [Edx]; 
      [Eax] = BL;  
      Edx++; Eax++; 
   } 
  [Eax] = 0;
  pop Eax;
} 

inline procedure  H_strjoin(;)
{
  $temp = 1;
  $to = $argc - 1;  
  $repeat $to:  
     H_strcat($arg[0],$arg[$temp]);  
  $temp++;
  $end
}

inline procedure Ziron_ExecuteF(m_st)
{
   Ziron_Execute($m_st,H_strlen($m_st));
}

inline procedure Ziron_GotoNextLine()
{
  eax = Ziron_IsNextLineBreak();
  while(!eax)
   {
      ecx = Ziron_GetNextToken();
      eax = Ziron_IsNextLineBreak();
   }
}

//
// event_mov()
// return false to allow the assembler to process this keyword internally.
// return true to tell the assembler this keyword has been processed.
//
function event_mov()
{
  uses edi;
  char buf[2048];
  char line[2048];
  char val[255];
  Dword Len;
         
  len = Ziron_ExtractLine(@line, 2048);  
  eax = strIndexOf(strLower(@line), 'into');   // see if the line have to pares with the plugin
  if(eax != -1)
   { 
      Ziron_ShowMessage(@line);                // show our entire line for debug purpose
@lop:
      buf=0;
      Ziron_GetNextToken();                    // so what is after 'mov'
      H_strcpy(@val,Ziron_GetStringValue());   // and save it in val  
                        
      eax = Ziron_ExpectNextToken(zirINTO);    // remove into 
      if (eax == -1) {
          return false;                        // let Ziron handle the line 
       }
       
      Ziron_GetNextToken();                    // get the register 
      eax =  Ziron_GetStringValue();
      H_strjoin(@buf, eax, ' = ', @val, ';');
      Ziron_ShowMessage(@buf);                 // show our new line that Ziron will understand it for debug purpose
            
      eax = Ziron_ExecuteF(@buf);
      if (eax == false) {
          Ziron_FatalError('Error plugin');
         return true;
       }
       
      eax = Ziron_PeekNextToken(); 
      if (eax == zirCOMMA) 
      {
         Ziron_GetNextToken();
         goto @lop;
      } 
       
      return true;
   }
  else
   {
      return false;                           // let Ziron handle the line  
   }   
}


function InitPlugin(pointer pGetF) {
  Ziron_LoadAll(pGetF); //use framework utility function to load all

  //register our keyword
  Ziron_RegisterKeyword('mov', @event_mov);
  
  return strLoaded;
}

entry function DLLMain(DWord iDLL; DWord iReason; Pointer iResult) {
  if (iReason == DLL_PROCESS_ATTACH) {
    return true;
  }

  return false;
}

exports InitPlugin;


test program
Code:
program WIN32CUI 'mov plugin test';

#include 'console.zir';

// this will pares with mov plugin
mov 10 into eax
 
// this will pares by Ziron 
mov ebx, 30
 
print('eax = ', eax:int, '\r\n');


mov 100 into edx; print('edx = ', 
                   edx:int, '\r\n');
                   
mov 300 into esi  print('esi = ', 
                   esi:int, '\r\n');  
                   
mov 10 into eax, 20 into ebx, 30 into ecx 
         
print('eax = ', eax:int, '\r\n');
print('ebx = ', ebx:int, '\r\n');
print('ecx = ', ecx:int, '\r\n');

mov eax, 10; into eax = 5;                        

wait_key(nil);
ExitProcess(0);


any suggestion you want to add?


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[486] - posted: 2011-11-08 20:41:11
not for now smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2 3 4 5 6 7 8
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