Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Byte To code procedure

byte code procedure codecave

This topic has been archived. This means that you cannot reply to this topic.
14 replies to this topic

#13 Luthfi


    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1320 posts

Posted 22 February 2013 - 12:51 AM

What you have mentioned above is very important, but little diffcult.
So, as I dont have enough expereince, i tried the traditional method and i think it will work.

  TDisas = class
    { Private declarations }
    { Public declarations }
      Procedure PUSH_AX(B1:Byte; B2:Byte; MemoDisas:TMemo; VA:String);


Every thing work fine till Push AX (opcode 66:50)
      case B[II] of
        $50 : Disass.PUSHEAX(B[II], MemoDisas, IntToHex(Loc,8));
        $66 :
              case B[II + 1] of
                 $50 :
                      Disass.PUSH_AX(B[II], B[II + 1], MemoDisas, IntToHex(Loc,8));
                      II := II + 1;

When i run the above code, and when it reach II := II + 1, it gave me the following error:
Any idea how can i increase the value of II by one inside the case of?
Thanks and Regards

Good if you already solved it. Just in case you are wondering, that error was caused by your attempt to alter a FOR counter inside the loop. You should not alter the counter. I believe in your old codes you were using II for FOR counter. That's why the following line is illegal in that context.
II := II + 1;
And the solution is to use either repeat-until, or while-do. These loop options do not rely on counter. Therefore you are free to alter any variable. But it's also your responsibility to increment your counter.

Edited by LuthfiHakim, 23 February 2013 - 04:49 AM.

#14 leecan


    CC Newcomer

  • Member
  • PipPip
  • 16 posts

Posted 22 February 2013 - 10:39 AM

Thanks a lot Luthfi,


Now, everything is okay, i can proceed forward.

But it will take lot of time cause i have to define all Bytes.


Thanks again man, without your help i couldn't proceed.



Edited by leecan, 22 February 2013 - 10:45 AM.

#15 Luthfi


    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1320 posts

Posted 23 February 2013 - 04:54 AM

That's great! Yes, you need to translate all know opcodes into classes. But it will be very satisfying after you finished.

Final note, please learn more about TStream and its descendant. This class(es) is very important in Delphi programming since they provide abstractions in reading and writing byte values. The sooner you learn it, the better. Most Delphi libraries (including third party ones) will give you TStream descendant if you need to get/give byte values.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download