Register | Login
Forum Index > Source Help > arithmetic expression
Author Message
Pages: 1 2 3
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[691] arithmetic expression - posted: 2011-11-15 19:47:43

hi i need to calculate index of array like this
Code:
pointer addr; 
addr = @right + indx * 255;

but Ziron did not yet understand it so i start to make it like this
Code:
eax = indx
eax *= 255
eax +=  @right

or that
Code:
eax = indx
imul eax,255
eax +=  @right

but still ziron can not understand that , any help please?

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[694] - posted: 2011-11-15 19:55:31
Code:
DWord myarr[512];

ecx = myarr;

//set item 100
DWord[ecx*4+100] = 1111;

//get item 100
eax = [ecx*4+100];


not sure if the scalar will work in current beta version, i'm almost finished with the new MOV handler which will be able to handle this.

The reason i did not add *= as i stated in changelog is because alot of the int math opcodes are incomplete, once i finish the new mov and lea handler, i will work on updating add, sub, mul etc etc

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
[695] - posted: 2011-11-15 20:02:12

ok , but how to calculate my state.

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[696] - posted: 2011-11-15 20:12:27
how do you mean state? 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
[697] - posted: 2011-11-15 20:23:41

i meant , my first post example

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[698] - posted: 2011-11-15 20:36:13
from the code you posted, i do not understand what it is you are trying to do.

if you require maths functions, for now you could use the fpu maths opcodes.

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
[699] - posted: 2011-11-15 20:41:02

ok , here is the code example
Code:
char right[5000];
dword indx;

indx = 5;

pointer addr = @right + indx * 255 // how to calculate this line
 


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[700] - posted: 2011-11-15 20:58:02
well you could using fpu do something like.... hmm well:

Code:
DWord myArr[512];
dword addr;

finit;

//5 = index
eax = @myArr;
push eax
fild [esp]
pop eax
fpush 5
fpush sizeof DWord
fmulp;
faddp;
fistp addr;

//addr now holds the offset address


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2 3
create new reply


Quick reply:

Message:



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