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

avatar

(send private message)

Posts: 932
Topics: 54

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: 932
Topics: 54

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 72 user(s) online. 0 member(s) and 72 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 224 | Posts: 1847 | Members: 50 | Active Members: 50
Welcome to our newest member, NobodyAtWork
const Copyright = '2011-2022 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd