Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Source Help

How would i Use the Div and iDiv in ziron?

A community discussion post from the original code:zIRON forum.

Molotov member
Posts
49
Threads
21
Location
Behind Keyboard

How would i Use the Div and iDiv in ziron?

I was trying to test div and idiv a few days ago but got stuck.

Can you post an example on how i should use it in Ziron?

"Lerning new things is what life is all about, if you are always doing the same old things day in and day out you might aswell just kill yourself." - ME d^_^b

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Hi Molotov,

here is a small example of using div

program WIN32CUI 'Test';

#include 'ch.zir';

//your denominator
ecx = 4;

//edx:eax is your qword number to divide up.
edx = 0;
eax = 25;

div ecx;

//eax is your result
print('Result = ', eax:int, '\r\n');
//edx is your remainder
print('Remainder = ', edx:int, '\r\n');

wait_key(nil);

ExitProcess(0);

as for idiv, it is the same as div only it is for signed division, and div is for unsigned

hope that helps.

Molotov member
Posts
49
Threads
21
Location
Behind Keyboard

ok.. thanks. :)

"Lerning new things is what life is all about, if you are always doing the same old things day in and day out you might aswell just kill yourself." - ME d^_^b