|
-
June 19th, 2009, 07:53 PM
#1
Neander
What are the instructions in Neander ?
Have example ?
-
June 20th, 2009, 06:16 PM
#2
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
-
June 22nd, 2009, 05:29 AM
#3
Re: Neander
I don't understand your question. Do you want to know what each instruction does?
-
June 22nd, 2009, 10:36 AM
#4
Re: Neander
 Originally Posted by ultddave
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
-
June 22nd, 2009, 11:15 AM
#5
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
-
June 22nd, 2009, 01:50 PM
#6
Re: Neander
NOT -> not reverse the numbers in binary ?
Acc = 0101
Not Acc = 1010
?
Doing nothing not is NOP ?
-
June 22nd, 2009, 03:50 PM
#7
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.
-
June 22nd, 2009, 04:25 PM
#8
Re: Neander
 Originally Posted by ultddave
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|