OK, lots of problems here.
The first thing you need to do is turn on compiler warnings. The compiler will print lots of helpful hints about potential problems in your code to the console, but only if you let it.
So set File > Preferences > Compiler warnings to "All".
Note that warnings are not errors. Don't freak out the moment you see a compiler warning. Just read it and try to understand what the compiler is telling you. You should always try to write your own code so that it doesn't produce warnings, but other developers won't have been so kind and so you will find that some libraries have warnings. Often these are safe to ignore (though annoying).
dannypapish:
byte byte1= 11;
byte byte2=13;
These variables don't have any purpose in your current code. You seem to think that you are passing those to the Multiply function just because they have the same name as the function parameters, but you're not. You really need to take some time to learn the basics of C++ before you start diving into writing assembly and libraries. I recommend this tutorial:
http://www.cplusplus.com/doc/tutorial/
Not all of it applies to embedded systems, so you will need to get a feel for which parts to skip over. You also don't need to go through the whole thing all at once. Just work through until you hit the parts that aren't immediately useful for your needs, then you can come back to those later.
dannypapish:
int Multiply(byte1,byte2);
This is a malformed function prototype. You need to specify the parameter types in function prototypes:
int Multiply(byte byte1, byte byte2);
And note that you could have used any names you like for the parameters (or none at all, as you did in Multiply.h):
int Multiply(byte foo, byte bar);
they have no relation to the variables of that name you declared above.
But you already have a prototype for this function in Multiply.h:
Worse, they have different return types!
So get rid of that unnecessary and wrong prototype in the sketch file.
I guess you think you are passing the return value of Multiply to Serial.print(), but you didn't use the right syntax for a function call to Multiply. What you're actually doing here is passing the function pointer to Serial.print(), which is not supported. The correct syntax looks like this:
Serial.print(Multiply(byte1, byte2);
Note that this is passing the value of the variables byte1 and byte2 to the Multiply function:
byte byte1= 11;
byte byte2=13;
This has nothing to do with the parameter names byte1 and byte2 that you used in the declaration of the function.
dannypapish:
S file:
.file "Multiply.s"
OK, this one is tricky. Even though Windows is filename case insensitive, the Arduino IDE is not. The extension of assembly files must be .S, not .s.
dannypapish:
int x = 4;
lds r21, x; // Load 4 into counter register
What's going on here?
dannypapish:
lds r21, x; // Load 4 into counter register
cpi r21,0; // compare value in r21 to 0
breq done; // if it is 0, done. if not, go into the loop
sbrc r22, 0; // if byte 0 of the multiplier(Q)==0, skip the next
adc r18,r24; // add multiplicand(M) to the result (A)
asr r18; // shift the result (A) right
asr r22; // shift the multiplier (Q) right
ld r21,-x; // count=count-1
done:
mov r24,r22;
mov r25,r18;
ret;
You forgot that you were trying to make a Multiply function. You do it like this in assembly:
Multiply:
lds r21, 4; // Load 4 into counter register
cpi r21,0; // compare value in r21 to 0
breq done; // if it is 0, done. if not, go into the loop
sbrc r22, 0; // if byte 0 of the multiplier(Q)==0, skip the next
adc r18,r24; // add multiplicand(M) to the result (A)
asr r18; // shift the result (A) right
asr r22; // shift the multiplier (Q) right
ld r21,-x; // count=count-1
done:
mov r24,r22;
mov r25,r18;
ret;