Results 1 to 14 of 14
  1. #1
    meromarololo2's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    23
    Reputation
    10
    Thanks
    2

    COULD SOME1 ANSWER MY QUESTIONS ABOUT THIS ASM CODE?

    This is the cpp file:
    Code:
     #include <iostream>
    #include <conio.h>
    #include <ctime>
    
    #include "headerfile.h"
    
    using namespace std;
    
    int main()
    {
    	int count = 1024;
    	char *arr = new char[count];
    
    	/* init the array to contain random numbers just so it's easy to tell that our procedure has worked*/
    	for(int i = 0; i < count; i++) arr[i] = (char)rand();
    
    	//Print down the initial values
    	for(int j = 0; j < count;j++) cout<<(int)arr[j]<<" ";
    
    	//Call our procedure
    	ZeroArray(arr, count*sizeof(char));
    
    	//Print out the values again to make sure they are all 0
    	for(int j = 0; j < count;j++) cout<<(int)arr[j]<<" ";
    	_getch();        //Prevent the window from closing
    	delete[] arr;    //Free our memory	
    	return 0;
    }
    This is the asm file
    Code:
     .code
    ; void ZeroArray(void* RCX, int EDX)
    ;Sets all bytes from *RCX to *RCX+EDX to 0
    ZeroArray proc
    cmp edx, 0        ;Check for 0 or less
    jle Finished
    
    cmp edx, 1        ;Check for 1
    je SetFinalByte
    
    mov ax, 0         ;Set ax to 00
    mov r8d, edx      ;Save the original count to r8d
    shr edx, 1        ;Halve the count because we are using AX, not AL
    
    MainLoop:
    mov word ptr [rcx], ax      ;Sets 2 bytes to 0
    add rcx, 2                  ;Moves rcx to the next 2 bytes
    dec edx                     ;Decrement our counter
    jnz MainLoop                ;Jump if we have more to set
    
    and r8d, 1                  ;Check if there was an even number
    jz Finished                 ;If ther was, we are done.
    
    SetFinalByte:
    	mov byte ptr [rcx], 0
    
    Finished:
     ret
     ZeroArray endp
     end
    This is the header file
    Code:
     #ifndef ZERYARRAY_H
    #define ZEROARRAY_H
    
    // Set CountInBytes bytes to 0 starting from &arr and moving to &arr + CountInBytes
    
    extern "C" void ZeroArray(void *arr, int CountInBytes);
    
    #endif
    Now my Questions:
    First : the ASM file:
    1:
    Code:
     ; void ZeroArray(void* RCX, int EDX)
    ;Sets all bytes from *RCX to *RCX+EDX to 0
    What does he means by those comments?
    2:
    Code:
     mov ax, 0         ;Set ax to 00
    , What does he mean by 00? why not 0?
    3:
    Code:
     mov r8d, edx      ;Save the original count to r8d
    Original count? what does he mean by that? also we don't know what's the value of edx right?
    4:
    Code:
    shr edx, 1        ;Halve the count because we are using AX, not AL
    What does he mean by his comment? hauving a 1? what the..??
    5:
    Code:
    mov word ptr [rcx], ax      ;Sets 2 bytes to 0
    this one i want u to explain every single code of it , in the commenet why he writes "sets 2 bytes"? i know that in asm "word"=2bytes,"dword"=4bytes, and so on.. , but does he mean by that code: (move the value of ax which has type word to the pointer rcx?) or im wrong? if im wrong PLEASEE explain this code correctly
    6:
    Code:
    add rcx, 2                  ;Moves rcx to the next 2 bytes
    Doesn't that mean that he adds 2 to the value of rcx? Why then he says in comment "MOVE TO NEXT 2 BYTES"?? correct me guys and tell me what's the right explanation
    7:
    Code:
     dec edx                     ;Decrement our counter
    Why in the comment he said "counter"? isnt the counter>> cx? why he says dx is the counter?
    8:
    Code:
     and r8d, 1                  ;Check if there was an even number
    What does that mean?

    Few little questions hah?
    NB: I Finished C++ by watching 75 vidoe tuts, and made lots of project where their folder is 1 gega+, but im newbie to assembly..
    Last edited by meromarololo2; 07-07-2013 at 08:51 AM.

  2. #2
    Frought's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    In the dark island
    Posts
    3,403
    Reputation
    156
    Thanks
    5,980
    My Mood
    Cool
    Too many questions , I'm busy but I will answer you ..

    First take a look at google in asm in C++...

    Second thing to answer you about 00 , you must learn CE to know about the bytes..

    I can't really help you because I'm busy coding atm...

  3. #3
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    I could answer all of these questions but these are things you would know if you knew the basics of assembly. If you want to learn assembly, don't start with this, this is too much for someone who knows nothing of assembly.

  4. #4
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    [QUOTE=meromarololo2]...
    Now my Questions:
    1:
    Code:
    void ZeroArray(void* RCX, int EDX);Sets all bytes from *RCX to *RCX+EDX to 0 What does he means by those comments?
    Ram is a large continuous row of boxes, numbered 1 - some huge number which is how much ram you have (1 gig, 2, 8, 16 etc).
    Set all bytes (starting at some #, and stopping at some #), so like from box # 1,000,000 to # 3,000,00, will all get set to 0.
    EDX = the size of the array (ie. the number of bytes to clear)
    So RCX to RCX+EDX is like saying 1,000,000 to (1,000,000 + 100) -- for a 100 byte array. Point being, rcx = start address, rcx+edx = stop address.

    2:
    Code:
     mov ax, 0         ;Set ax to 00  , What does he mean by 00? why not 0?
    Anything after the semi-colon is a comment. 00 is the same as 0. The programmer's preference/ typo - not significant. 00 = 0 = 00000000

    3:
    Code:
     mov r8d, edx      ;Save the original count to r8d  Original count? what does he mean by that? also we don't know what's the value of edx right?
    The instruction basically translates to "MOVE into r8d, the value of edx" - ie. make a COPY of edx and store it in r8d.
    False. We DO know the value of edx --> in C++ when you pass in arguments to a function, it will place them in registers (first rcx, then rdx -- I don't know off top of my head -- the videos explain calling convention / passing parameters). So in this example, we know...rcx = the first parameter (a memory address to the beginning of the array) and edx = the 2nd parameter, the # of items in the array.

    4:
    Code:
    shr edx, 1        ;Halve the count because we are using AX, not AL What does he mean by his comment? hauving a 1? what the..??
    Shifting right 1 bit is the same as dividing by 2. Shifting right 2 bits is dividing by 4, 3 bits = 8, 4 bits = 16 etc etc.
    He divides by 2 because we're working with WORDS, which is 2 bytes at a time. So if count was 100, we only need to move 2 bytes 50 times. The more bytes you move at a time, the less times you have to move bytes. If we were doing 4 bytes at a time we'd use "mov dword ptr [rcx], eax ;Sets 4 bytes to 0" and "add rcx 4".

    5:
    Code:
    mov word ptr [rcx], ax      ; but does he mean by that code: (move the value of ax which has type word to the pointer rcx?) or im wrong? if im wrong PLEASEE explain this code correctly
    You're correct. So, a WORD is 2 bytes. Assume RCX = some random number --> that number box will get the FIRST BYTE of ax, and that number box + 1 will get the SECOND byte of ax. 2 boxes of ram are used to store the value of ax.

    6:
    Code:
    add rcx, 2                  ;Moves rcx to the next 2 bytes Doesn't that mean that he adds 2 to the value of rcx? Why then he says in comment "MOVE TO NEXT 2 BYTES"??
    Registers store numbers. Ram boxes have a number associated with them. See the connection?? If RCX = 5 then reading [rcx] is the same as [5] which will read the value of box 5. By increasing the register, the next time you use [reg], it will point to a different box.

    7:
    Code:
     dec edx                     ;Decrement our counter ; Why in the comment he said "counter"? isnt the counter>> cx? why he says dx is the counter?
    Not sure, haven't looked over the code as a whole. If he said, I'm sure he's using it as a counter...or a typo..idk. Translates to "subtract 1 from register"..basic. edit: looking at his asm prototype, he shows which registers get the values passed in.
    "; void ZeroArray(void* RCX, int EDX)" ie rcx = start address, edx = count (size of array)

    8:
    Code:
     and r8d, 1                  ;Check if there was an even number
    What does that mean?[/code]
    in BINARY, the RIGHTMOST digit (ie digit 0) can only have a value of 0 or 1 --> if that BIT is set, it means that number is odd. Any odd number will always have the very first bit set to 1. And any even number will always have that bit set to 0. Basic Binary. Calling "and r8d, 1" will check if that bit is set and set the FLAGS register.

    -Hope that helps a little. His videos explain it better than I can.
    Last edited by abuckau907; 07-07-2013 at 12:32 PM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  5. The Following 2 Users Say Thank You to abuckau907 For This Useful Post:

    meromarololo (07-07-2013),meromarololo2 (07-07-2013)

  6. #5
    meromarololo's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    39
    Reputation
    10
    Thanks
    1
    @abuckau907
    Thanks,thanks, and thanks, i understand 80% of what u explained, but if just u could explain 3 points also on asm?(at the end of the post)

    First : My Questions in the .cpp file :
    1:
    Code:
    void ZeroArray(void* RCX, int EDX)
    i understand it except for void* RCX, in c++ i never put void in a parameter, i used it only as a funtion that doesn't return a value , so what does RCX of TYPE void mean?

    2:
    Code:
    ZeroArray(arr, count*sizeof(char));
    Here, First: does this arr means the address which *arr points to ? Second: What does he mean by that count* ? Why it's a pointer??

    Now the 3 points i wanted to ask about in the asm:
    _ First: in Question 5:
    why wrote (move word ptr [rcx],ax) ?? why did he point to an address? why not just write mov rcx,ax .. please explain why is the usage of pointer?

    _Second in Question1:
    Sets all bytes from *RCX to *RCX+EDX to 0
    So RCX to RCX+EDX is like saying 1,000,000 to (1,000,000 + 100) -- for a 100 byte array. Point being, rcx = start address, rcx+edx = stop address.
    u explained these things ,, but where are they in the code itself??

    _Third : in this code:
    Code:
     mov ax, 0         ;Set ax to 00
    , what he means is that he saves 0 in AL and 0 in AH right?,
    if im right, -(and i think im right as in this code
    Code:
    mov word ptr [rcx], ax
    we set 2 BYTES to 0, as we copied the 0 of AL and the 0 of AH)- then if so,
    1: What will happen if i wrote
    Code:
    mov eax, 1
    , he will put 1 in AL and 1 in AH, or just 1 in AL, and AX stays 0?
    2:
    Code:
    mov eax, 0
    ? What will this code do? (since eax dons't consist of 2 parts as AX..{AL,AH}) and
    3:What will happen if i wrote this one
    Code:
    mov eax, 1
    Thanks a lot u were really helpful,
    Last edited by meromarololo; 07-07-2013 at 05:29 PM.

  7. #6
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    [QUOTE=meromarololo;]...

    1:
    Code:
    void ZeroArray(void* RCX, int EDX)
     i understand it except for void* RCX, in c++ i never put void in a parameter, i used it only as a funtion that doesn't return a value , so what does RCX of TYPE void mean?
    C++ does it for you. It's a huge complicated subject, and the videos explain it better than I could. Again, anything after a semi-colon is a comment so, "; void ZeroArray(void* RCX, int EDX)" is a comment. It looks VERY similar to a C++ prototype. He did that on purpose, to shows us which 2 registers the 2 parameters would be passed in. That's all dictated by the C++ compiler. RCX has no type, it's just 64 bits of storage. He was just indicating that the first parameter is a void*, ie a memory address, and the 2nd parameters is an 32 bit signed int.

    2:
    Code:
    ZeroArray(arr, count*sizeof(char));
     Here, First: does this arr means the address which *arr points to ? Second: What does he mean by that count* ? Why it's a pointer??
    Basic C++ here --> an array name may be used just like a pointer, because it is one.
    count = "the numbers of items in the array" * "sizeof(each item)" = the total number of bytes required for the array. If you have 100 integers, that's 100 * 4 = 400 bytes. Since sizeof(char) = 1, in this example it's pointless, but that's how the code would look if you were using a bigger datatype. edit: *, in this case, is not pointer operator, is multiplication.

    Now the 3 points i wanted to ask about in the asm:
    First: in Question 5:
    Code:
     why wrote (move word ptr [rcx],ax) ?? why did he point to an address? why not just write mov rcx,ax .. please explain why is the usage of pointer?
    mov rax, 5
    mov [rax], 5

    See the difference? it's all about the [ ] 's. The []'s mean "move into a memory box" basically. So, the top line just moves the value 5 into rax. The bottom line moves the value 5 into whatever memorybox rax is pointing at (so if rax = 1,000,000 then mov [rax],5 will put the value 5 in box one million). (edit: Actually 4 memory boxes are filled : rax, rax+1, rax+2, rax+3, because we didn't put a size specifier, 5 is stored in 32 bits - 4 bytes).

    Code:
     mov ax, 0         ;Set ax to 00 , what he means is that he saves 0 in AL and 0 in AH right?
    Yes. Essentially. Since ax is a 16 bit register, and no size specifiers are used, 0 is assumed to be a 16 bit value, so 16 0's are put into ax. I'm not sure it breaks it into a 2 part operation of doing AL, then AH, but maybe. Either way, all 16 bits of ax are set to 0.

    Code:
    mov word ptr [rcx], ax ;  we set 2 BYTES to 0, as we copied the 0 of AL and the 0 of AH)
    Yes.

    - then if so,
    1: What will happen if i wrote
    Code:
    mov eax, 1 ; he will put 1 in AL and 1 in AH, or just 1 in AL, and AX stays 0?
    No. Since no SIZE SPECIFIERS were used, and since eax = 32 bit, compiler assumes 1 is supposed to take up 32 bits. So it'll be 31 0's and the rightmost bit of 1 that get stored into eax.
    Also, AL/AH are only the bottom 16 bits of eax. Since you said mov eax, it's effecting all 4 bytes of eax, not just the bottom 2 that make up al/ah.

    2:
    Code:
    mov eax, 0 ; What will this code do? (since eax dons't consist of 2 parts as AX..{AL,AH})
    Same as above -> since no size specifiers were used, the value "0" takes up 32 bits (same as the register) and all 32 bits get copied over. All 0's.

    3:What will happen if i wrote this one
    Code:
    mov eax, 1
    Same as above. 1 is assumed to be a 32 bit value. The top 3 bytes of eax = 0 and the bottom byte = 1
    eax = 00000000 00000000 00000000 00000001 just like you'd write it in normal binary. Well in normal binary you might just put "01"..or put it at a byte and say "00000001", but since we're using the EAX register, which is 32 bits, and didn't use a size specifier, it assumes (makes!) the data the correct size to fill the register being used. So even though the value 1 only needs 1 bit techincally, because you didn't use size specifier, it bumps it up to the required size (of the register) and makes it 32 bits.
    Last edited by abuckau907; 07-08-2013 at 01:31 AM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  8. #7
    atom0s's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    403
    Reputation
    139
    Thanks
    104
    Quote Originally Posted by meromarololo2 View Post
    Now my Questions:
    First : the ASM file:
    1:
    Code:
     ; void ZeroArray(void* RCX, int EDX)
    ;Sets all bytes from *RCX to *RCX+EDX to 0
    What does he means by those comments?
    It means the memory range pointing from the address of RCX to RCX+EDX will be set to 0. In his prototype RCX is the pointer of the address to start writing zero's to. EDX is the count/size of zeros to write. So if EDX was 4, it would be the same thing as:

    *(BYTE*)((DWORD_PTR)RCX + 0) = 0;
    *(BYTE*)((DWORD_PTR)RCX + 1) = 0;
    *(BYTE*)((DWORD_PTR)RCX + 2) = 0;
    *(BYTE*)((DWORD_PTR)RCX + 3) = 0;

    And so on for however long the size is set to.


    Quote Originally Posted by meromarololo2 View Post
    2:
    Code:
     mov ax, 0         ;Set ax to 00
    , What does he mean by 00? why not 0?
    It's the same thing. 00 is the same as 0 in this case. So just ignore the extra 0 in the comment.


    Quote Originally Posted by meromarololo2 View Post
    3:
    Code:
     mov r8d, edx      ;Save the original count to r8d
    Original count? what does he mean by that? also we don't know what's the value of edx right?
    EDX was the size param in the function call. It is being stored r8d to be used later checking if it has completed writing to the array.


    Quote Originally Posted by meromarololo2 View Post
    4:
    Code:
    shr edx, 1        ;Halve the count because we are using AX, not AL
    What does he mean by his comment? hauving a 1? what the..??
    SHR stands for shift-right. It is a short-hand method of dividing. Doing a SHR with 1 as the right-hand operator states to divide the left-hand operator by 2.
    So this is saying:
    EDX = EDX / 2


    Quote Originally Posted by meromarololo2 View Post
    5:
    Code:
    mov word ptr [rcx], ax      ;Sets 2 bytes to 0
    this one i want u to explain every single code of it , in the commenet why he writes "sets 2 bytes"? i know that in asm "word"=2bytes,"dword"=4bytes, and so on.. , but does he mean by that code: (move the value of ax which has type word to the pointer rcx?) or im wrong? if im wrong PLEASEE explain this code correctly
    mov is the move/copy instruction. It takes the right-hand operators value and copies it into the left-hand location.
    word ptr means that the value being copied from the right is being stored as a word (word is 2 bytes long).

    ax is 16bits of the EAX register. In the 32bit instruction family, the registers: EAX EBX ECX EDX ESI EDI EBP EIP ESP are all made up of 32bits. (32bits = 4 bytes = DWORD)
    Each data register also has a 16bit and two 8bit representations. (EAX EBX ECX EDX)
    For example EAX is made up of: EAX (32bit) -> AX (16bit) -> AH and AL (8bit)

    To explain it better, if you set EAX to 0x12345678 then this is what each value would be:
    EAX = 0x12345678
    AX = 0x5678
    AH = 0x56
    AL = 0x78



    Quote Originally Posted by meromarololo2 View Post
    6:
    Code:
    add rcx, 2                  ;Moves rcx to the next 2 bytes
    Doesn't that mean that he adds 2 to the value of rcx? Why then he says in comment "MOVE TO NEXT 2 BYTES"?? correct me guys and tell me what's the right explanation
    RCX is currently a pointer, adding 2 will adjust the pointer position by 2 places. But yes, it is just adding two to the value of what RCX holds.


    Quote Originally Posted by meromarololo2 View Post
    7:
    Code:
     dec edx                     ;Decrement our counter
    Why in the comment he said "counter"? isnt the counter>> cx? why he says dx is the counter?
    EDX holds the count of bytes to zero in the array. He used the word counter pertaining to the variable, not the register.


    Quote Originally Posted by meromarololo2 View Post
    8:
    Code:
     and r8d, 1                  ;Check if there was an even number
    What does that mean?
    Because he is stepping two bytes each write (hes writing 0x00 0x00 each time) he checks if the overall count is odd or even. If it is odd, he needs to write the last byte alone as a single byte and not a word.
    - Gone; this is another shit forum with children as administrators. Not worth contributing to.

  9. The Following User Says Thank You to atom0s For This Useful Post:

    meromarololo (07-08-2013)

  10. #8
    meromarololo's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    39
    Reputation
    10
    Thanks
    1
    @abuckau907 @atom0s
    Thanks Aloooooot Guys, now i understand 95% of it, even check the comments i wrote on the ASM : (copy the img link and paste it in a new tab to see full img)


    and this one is the cpp



    ,anyway, ima ask about the 5% i don't understand:

    1:
    Code:
    char *arr = new char[count];
    This one, i took in C++ about the char type, it's like: char Apple = 'A' ,,so when we call 'A' the Apple will appear , so can u explain that in code

    2:
    Code:
    mov word ptr [rcx], ax      ;;Sets 2 bytes to 0 (as we chose ax(which has 2 zeros) and word(whichs means we save the 2 zeros in 2 bytes)  we cant say [rcx] only, as by that we will change the memory address of rcx to 0.., but ptr[rcx] means the to change the value of that memory address to 0.
    Is my comment right?


    Thx aloot now im over with this shitty project
    Last edited by meromarololo; 07-08-2013 at 08:03 PM.

  11. #9
    Transformer-'s Avatar
    Join Date
    Jul 2013
    Gender
    male
    Posts
    39
    Reputation
    10
    Thanks
    3
    1:
    Code:
    char *arr = new char[count];
    char *arr = new char[count]; char* is a pointer to the content of the string which is = new char[count] , new char is casting / converting count to char if it wasn't and allocating an new char in your RAM , but after using it I recommended to free the memory with delete[] arr;

    2:
    Code:
    mov word ptr [rcx], ax ;Sets 2 bytes to 0
    A bytes is as normal looking like this , A0 this is a single byte , A0 00 = 2 bytes.


    &
    Code:
    add rcx, 2 ;Moves rcx to the next 2 bytes
    Same as the second explanation .
    Last edited by Transformer-; 07-08-2013 at 06:41 PM.

  12. #10
    meromarololo's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    39
    Reputation
    10
    Thanks
    1
    @Transformer-
    1:
    char* is a pointer to the
    WTF?? char is a pointer?? isn't char a type and arr is the pointer???? ??? how could char be the pointer? did u misunderstand or am i wrong??
    content of the string
    What string? we didn't even define one..

    i still don't understand this code..

    & nvm abt the other 2 questions, i deleted em from ma post.

    2:
    BTW, is my comment here Right?? :
    Code:
    mov word ptr [rcx], ax      ;Sets 2 bytes to 0 (as we chose ax(which has 2 zeros) and word(whichs means we save the 2 zeros in 2 bytes)  we cant say [rcx] only, as by that we will change the memory address of rcx to 0.., but ptr[rcx] means that we change the value of that memory address to 0.
    NB: THE COMMENT IS 3 LINES LOL, SCROLL DOWN TO CHECK THE LAST LINE
    Last edited by meromarololo; 07-08-2013 at 08:30 PM.

  13. #11
    pedbera's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Posts
    261
    Reputation
    15
    Thanks
    43
    My Mood
    Happy
    Quote Originally Posted by meromarololo View Post
    @Transformer-
    BTW, is my comment here Right?? :
    Code:
    mov word ptr [rcx], ax      ;Sets 2 bytes to 0 (as we chose ax(which has 2 zeros) and word(whichs means we save the 2 zeros in 2 bytes)  we cant say [rcx] only, as by that we will change the memory address of rcx to 0.., but ptr[rcx] means that we change the value of that memory address to 0.
    i think it is right as we know byte is 1 byte, word is 2 bytes, great job !

    as long as the value in the register 'ax' contains 00, it will set the address's value to 0.
    else it will just set it to the value that contains it
    Last edited by pedbera; 07-08-2013 at 08:25 PM.

  14. #12
    PrettyLights's Avatar
    Join Date
    Sep 2012
    Gender
    male
    Posts
    143
    Reputation
    56
    Thanks
    19
    lol hes banned?
    If only i could code


  15. #13
    atom0s's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    403
    Reputation
    139
    Thanks
    104
    Quote Originally Posted by meromarololo View Post
    1:
    Code:
    char *arr = new char[count];
    This one, i took in C++ about the char type, it's like: char Apple = 'A' ,,so when we call 'A' the Apple will appear , so can u explain that in code
    char is a single character.
    char* is a pointer to a character array.

    Using the 'new' keyword states that you want to create an array of the right-hand type, which will return a pointer to that array after it is created.
    So with 'new char[count]', if count is set to 10, it will allocate 10 bytes of space and return the pointer to it to be used as a char array.


    Quote Originally Posted by meromarololo View Post
    2:
    Code:
    mov word ptr [rcx], ax      ;;Sets 2 bytes to 0 (as we chose ax(which has 2 zeros) and word(whichs means we save the 2 zeros in 2 bytes)  we cant say [rcx] only, as by that we will change the memory address of rcx to 0.., but ptr[rcx] means the to change the value of that memory address to 0.
    Is my comment right?
    Keep in mind ax is not always going to be 0. You have to set it to 0 yourself if you want it to be. Hence the line:
    mov ax, 0
    - Gone; this is another shit forum with children as administrators. Not worth contributing to.

  16. #14
    _corn_'s Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    0x0C482BF2
    Posts
    673
    Reputation
    13
    Thanks
    294
    My Mood
    Brooding
    Quote Originally Posted by abuckau907 View Post
    Ram is a large continuous row of boxes, numbered 1 - some huge number which is how much ram you have (1 gig, 2, 8, 16 etc).
    Hi,

    Memory addressing is zero-based. This means the first memory location is at 0, not 1.

Similar Threads

  1. Question About This Section
    By Royce in forum Art & Graphic Design
    Replies: 2
    Last Post: 04-30-2012, 02:39 AM
  2. question about this forum
    By MohNeuker in forum Suggestions, Requests & General Help
    Replies: 6
    Last Post: 07-03-2011, 08:25 AM
  3. question about this account
    By follower in forum Marketplace Price Check / Questions
    Replies: 17
    Last Post: 05-24-2011, 04:38 AM
  4. [Help] can some1 answer my question?
    By thisguypwn in forum WarRock Discussions
    Replies: 1
    Last Post: 09-14-2010, 06:27 AM
  5. Question about this section
    By noobnuker in forum General Hacking
    Replies: 1
    Last Post: 07-19-2009, 04:15 PM