CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Neander

  1. #1
    Join Date
    Jun 2008
    Posts
    25

    Neander

    What are the instructions in Neander ?

    Have example ?

  2. #2
    Join Date
    Jun 2008
    Posts
    25

    Re: Neander

    example

    What makes this program?

    BEGIN:
    LDA 130
    NOT
    ADD 130
    ADD 128
    JN END1
    STA 128
    ADD 129
    STA 21
    LDA 132
    NOT
    ADD 130
    ADD 0
    JZ END2
    JMP BEGIN
    END2:
    LDA 131
    ADD 130
    STA 131
    JMP BEGIN
    END1:
    HLT


    in memory:

    --- 126
    --- 127
    10 128
    140 129
    1 130
    0 131
    x 132
    --- 133
    --- 134

  3. #3
    Join Date
    Jun 2009
    Location
    Belgium (Country in Europe)
    Posts
    44

    Re: Neander

    I don't understand your question. Do you want to know what each instruction does?

  4. #4
    Join Date
    Jun 2008
    Posts
    25

    Re: Neander

    Quote Originally Posted by ultddave View Post
    I don't understand your question. Do you want to know what each instruction does?
    Yes I wonder what makes the program, especially the part of the jump

  5. #5
    Join Date
    Jun 2009
    Location
    Belgium (Country in Europe)
    Posts
    44

    Re: Neander

    BEGIN: // Line indicated with a label
    LDA 130 // Load Accumulator:A with the value found on memory adress 130 (Number: 1)

    NOT // Do nothing

    ADD 130 // Add Accumulator:A with the value found on memory adress 130 (Number: 1) and putt the result back in Accumulator:A (So A = 1+1 = 2)

    ADD 128 //Add Accumulator:A with the value found on memory adress 128 (Number: 10) and putt the result back in Accumulator:A (So A = 2 + 10 = 12)

    JN END1 // Jump to the line with label END1 if Accumulator:A is negative (12 is not negative so it does nothing)

    STA 128 // Store the content of Accumulator:A (So 12) at memory address 128 (Overwriting number 10 that is)

    ADD 129 //Add Accumulator:A with the value found on memory adress 129 (Number: 140) and putt the result back in Accumulator:A (So A = 12 + 140 = 152)

    STA 21 // Store the content of Accumulator:A (So 152) at memory address 21

    LDA 132 // Load Accumulator:A with the value found on memory adress 132 (Number: x)

    NOT // Do nothing

    ADD 130 // Add Accumulator:A with the value found on memory adress 130 (Number: 1) and putt the result back in Accumulator:A (So A = x + 1)

    ADD 0 // Add Accumulator:A with the value found on memory adress 0 (Number: ?) and putt the result back in Accumulator:A (So A = x + 1 + ?)

    JZ END2 // Jump to the line with label END2 if Accumulator:A is zero.

    JMP BEGIN // Jump to the first line again. (This is only executed if 'JZ END2' was not executed because Accumulator:A was not zero.)

    END2:

    LDA 131
    ADD 130
    STA 131
    JMP BEGIN // Jump the first line again.
    END1:

    HLT // Stop the program


    in memory:

    --- 126
    --- 127
    10 128
    140 129
    1 130
    0 131
    x 132
    --- 133
    --- 134
    ||||||||||||||||||||||||||||||||||||||||||||||||||

    I hope I didn't make any mistakes.
    JMP 100 = Jump to address 100
    JN 100 = Jump to address 100 ONLY if Accumulator:A is negative
    JP 100 = Jump to address 100 ONLY if Accumulator:A is positive
    JZ 100 = Jump to address 100 ONLY if Accumulator:A is zero
    JO 100 = Jump to address 100 ONLY if an overflow occured

    I'm used to work with different Assembler command's, but the information above should be right .

    Keep in mind that the comments behind each line are only right for the first time the program runs through the code.

    The program runs into a loop untill "JN END1" occurs, which calls the HLT command.

    Greetz,
    Dave

  6. #6
    Join Date
    Jun 2008
    Posts
    25

    Re: Neander

    NOT -> not reverse the numbers in binary ?

    Acc = 0101
    Not Acc = 1010

    ?

    Doing nothing not is NOP ?

  7. #7
    Join Date
    Jun 2009
    Location
    Belgium (Country in Europe)
    Posts
    44

    Re: Neander

    Don't know :P Never used Neander before. But yes indeed NOP = No Operation.

    It's hard to find decent documentation for these languages to be honest.

    Here is some information: http://www.emu8086.com/assembly_lang...torial_07.html

    For example:
    Some assembler languages use:

    JOF
    JO
    ...
    For jump on overflow, making it quite confusing. :P

    Here is some more info about the Jumps:
    http://www.softwareforeducation.com/.../270-Jumps.htm

    And
    http://www.softwareforeducation.com/...p-help.htm#not

    You were right about the NOT command btw . Quote from the link: "Invert all the bits in DL.".

    Greetz,
    Dave

    Hope this information was of any help.

  8. #8
    Join Date
    Jun 2008
    Posts
    25

    Re: Neander

    Quote Originally Posted by ultddave View Post
    Don't know :P Never used Neander before. But yes indeed NOP = No Operation.

    It's hard to find decent documentation for these languages to be honest.

    Here is some information: http://www.emu8086.com/assembly_lang...torial_07.html

    For example:
    Some assembler languages use:

    JOF
    JO
    ...
    For jump on overflow, making it quite confusing. :P

    Here is some more info about the Jumps:
    http://www.softwareforeducation.com/.../270-Jumps.htm

    And
    http://www.softwareforeducation.com/...p-help.htm#not

    You were right about the NOT command btw . Quote from the link: "Invert all the bits in DL.".

    Greetz,
    Dave

    Hope this information was of any help.

    Ok. Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured