Register | Login
Forum Index > Source Help > Help with an "Array"
Author Message
Pages: 1 2
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1260] - posted: 2012-12-12 16:10:53
sorry my mistake i forgot 1 thing *4

Code:
procedure printdeck(int32* deck) {
  edx = deck;

  for (ecx = 0 to 52) {    
    eax = [edx+ecx*4];
    print(eax, '\r\n'); 
  }
}


because ecx goes up by 1, this is an offset of address of edx, so +1 is only by 1 byte

edx+1 = byte 2, you want to go up in intervals of 4 since it is an integer smile

a small example:

Code:
program WIN32CUI 'test';

#include 'ch.zir';

type DECK = int32;

procedure printdeck(DECK* cards) {
  edx = cards;
  
  for (ecx = 0 to 5) {
    eax = [edx+ecx*4];
    print(eax, '\r\n');
  }
}


DECK mydeck[6];
mydeck[1] = 13;

printdeck(@mydeck);

wait_key();
ExitProcess(0);


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

Posts: 49
Topics: 21

Location:
Behind Keyboard
[1261] - posted: 2012-12-13 02:55:05
ah yeah works perfectly.. how in the name of me did i miss that shit..

"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
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1262] - posted: 2012-12-13 16:39:52
Glad to hear,

If you need any more help just let me know.

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


Quick reply:

Message:



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