Reputation: 43
Writing a program in assembly to print two characters from input, by first comparing them and printing the one with the larger ASCII code first. I wrote what makes sense to me, but the assembler is giving me the error "Duplicate label(R2)". Does anyone have any idea why this wouldn't work?
.orig 3000
GETC
LD R1,R0
GETC
LD R2,R0
NOT R0,R2
ADD R0,R0,#1
ADD R0,R1,R0
BRN #3
OUT R1
OUT R2
BRNZP #2
OUT R2
OUT R1
HALT
.end
Would also add that when I break the code and just take out the lines with R2, it spits out errors for the other registers. It's like the assembler is recognizing the registers as labels.
Upvotes: 0
Views: 1737
Reputation: 438
LD R2,R0
You don't use LD this way.
The syntax is LD DR, Label
or LD DR, PCOffset9
Also
OUT R1
OUT is a trap that prints out the character in R0 and only R0
Perhaps the assembler has a bug that isn't marking these mistakes as syntax errors?
Upvotes: 1