Click to See Complete Forum and Search --> : Neander


Apprentice123
June 19th, 2009, 07:53 PM
What are the instructions in Neander ?

Have example ?

Apprentice123
June 20th, 2009, 06:16 PM
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

ultddave
June 22nd, 2009, 05:29 AM
I don't understand your question. Do you want to know what each instruction does?

Apprentice123
June 22nd, 2009, 10:36 AM
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

ultddave
June 22nd, 2009, 11:15 AM
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

Apprentice123
June 22nd, 2009, 01:50 PM
NOT -> not reverse the numbers in binary ?

Acc = 0101
Not Acc = 1010

?

Doing nothing not is NOP ?

ultddave
June 22nd, 2009, 03:50 PM
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_language_tutorial_assembler_reference/asm_tutorial_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/sms32v50/sms32v50_manual/270-Jumps.htm

And
http://www.softwareforeducation.com/sms32v50/sms32v50_manual/370-Pop-up-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.

Apprentice123
June 22nd, 2009, 04:25 PM
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_language_tutorial_assembler_reference/asm_tutorial_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/sms32v50/sms32v50_manual/270-Jumps.htm

And
http://www.softwareforeducation.com/sms32v50/sms32v50_manual/370-Pop-up-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