Register | Login
Forum Index > General Discussion > Ideas for internal macros
Author Message
Pages: 1 2
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1535] Ideas for internal macros - posted: 2015-01-29 12:49:16
So far Ziron has some internal macros such as $substr, $strindex etc.... does anyone have ideas or requests for additional macro functions?

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1536] - posted: 2015-01-29 14:14:56
Builtin functions -- are useful things smile

I think that would be good to have converting functions like $int2str, $uint2str, $hex2str, $bin2str, etc...

Also think that would be useable add integer logarithm base 2 function. Currently we can do:
Code:
const BIT_CONST = 1 << 6;
Code:
test eax, MY_CONST3;
jnz bit_set;

We will able to do like:
Code:
bt eax, $log2(MY_CONST3)
jc bit_set
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1547] - posted: 2015-01-30 01:09:57
Maybe would be useable to have directive which set default type of value in registers i.e. signed|unsigned.
Then can be written:
Code:
if (eax => ebx){}
while (ax < bx){}

instead of
Code:
if ([int32]eax => ebx){}
while ([int16]ax < bx){}

it will make code more readable.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1548] - posted: 2015-01-30 02:56:36
Maybe would be useable to have directive which set default type of value in registers i.e. signed|unsigned


This actually was supposed to work, but I think i broke it in some earlier release.

Code:
eax as int32;

//etc...


I will correct this.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1561] - posted: 2015-01-30 23:37:50
Fixed continuous casting:

Code:
eax = -5 as int32;

if (eax < 1) {
  eax = 512;
}

eax as dword;
if (eax < 1) {
  eax = 512;
}


as for $str2int etc, these can be written as direct macros, when i rewrite RTL i will include a macro include file for system macros, if you have ideas for more or have any you would like to submit, let me know.

Code:
$int2str = inline function ($i) {
  $return tokentext($i);
}

$str2int = inline function ($i) {
  $return $_e($i);
}


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1692] - posted: 2015-02-14 11:26:47
Above I asked you about integer logarithm base 2 function
Is it possible to add this builtin macro?
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1694] - posted: 2015-02-14 16:35:17
I will add log2 but as you know it is usually a floating point result, I will instead improve a few things in the macro system and then write a macro based version of log2. I will get back to you soon.

Edit: Actually I implemented log2 and log2i for next release, but I will still improve macro system anyways smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1701] - posted: 2015-02-14 19:26:37
Seems log2i is not works.
Code:
program RAW_IMAGE 'test';

#set bits 32;

const i00 = 1 << 0;
const i01 = 1 << 1;
const i02 = 1 << 2;
const i03 = 1 << 3;
const i04 = 1 << 4;
const i05 = 1 << 5;
const i06 = 1 << 6;
const i07 = 1 << 7;
const i08 = 1 << 8;
const i09 = 1 << 9;
const i10 = 1 << 10;
const i11 = 1 << 11;
const i12 = 1 << 12;
const i13 = 1 << 13;
const i14 = 1 << 14;
const i15 = 1 << 15;
const i16 = 1 << 16;

$echof 'log2i(', i00, ') = ', $log2i(i00);
$echof 'log2i(', i01, ') = ', $log2i(i01);
$echof 'log2i(', i02, ') = ', $log2i(i02);
$echof 'log2i(', i03, ') = ', $log2i(i03);
$echof 'log2i(', i04, ') = ', $log2i(i04);
$echof 'log2i(', i05, ') = ', $log2i(i05);
$echof 'log2i(', i06, ') = ', $log2i(i06);
$echof 'log2i(', i07, ') = ', $log2i(i07);
$echof 'log2i(', i08, ') = ', $log2i(i08);
$echof 'log2i(', i09, ') = ', $log2i(i09);
$echof 'log2i(', i10, ') = ', $log2i(i10);
$echof 'log2i(', i11, ') = ', $log2i(i11);
$echof 'log2i(', i12, ') = ', $log2i(i12);
$echof 'log2i(', i13, ') = ', $log2i(i13);
$echof 'log2i(', i14, ') = ', $log2i(i14);
$echof 'log2i(', i15, ') = ', $log2i(i15);
$echof 'log2i(', i16, ') = ', $log2i(i16);

$echo received invalid parameters!

Code:
program RAW_IMAGE 'test';

#set bits 32;

const i00 = 1 << 0;
const i01 = 1 << 1;
const i02 = 1 << 2;
const i03 = 1 << 3;
const i04 = 1 << 4;
const i05 = 1 << 5;
const i06 = 1 << 6;
const i07 = 1 << 7;
const i08 = 1 << 8;
const i09 = 1 << 9;
const i10 = 1 << 10;
const i11 = 1 << 11;
const i12 = 1 << 12;
const i13 = 1 << 13;
const i14 = 1 << 14;
const i15 = 1 << 15;
const i16 = 1 << 16;

dword d00 = $log2i(i00);
dword d01 = $log2i(i01);
dword d02 = $log2i(i02);
dword d03 = $log2i(i03);
dword d04 = $log2i(i04);
dword d05 = $log2i(i05);
dword d06 = $log2i(i06);
dword d07 = $log2i(i07);
dword d08 = $log2i(i08);
dword d09 = $log2i(i09);
dword d10 = $log2i(i10);
dword d11 = $log2i(i11);
dword d12 = $log2i(i12);
dword d13 = $log2i(i13);
dword d14 = $log2i(i14);
dword d15 = $log2i(i15);
dword d16 = $log2i(i16);

Unexpected EOF
Pages: 1 2
create new reply


Quick reply:

Message:



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