First thing to note is that assembly is specific to the architecture you're working on. MIPS assembly is different from Atmel assembly is different from what you're using, etc.
Every form of assembly should be well documented, including how the assembly is formatted into machine code. I googled "NIOS II assembly" and this datasheet was the first thing I clicked on. It seems to be what you should be using. http://www.altera.com/literature/hb/...u_nii51017.pdf
movia is indeed a pseudo instruction. However since it stands for two instructions you should have a grand total of 4 lines of machine code. subI is also a pseudo instruction.
Code:
movia r8, 50000
subi r8, r8, 1
bne r8, r0, START_TIMER
This can be re-written as:
Code:
orhi r8, r0, %hiadj(50000)
addi, r8, r0, %lo(50000)
addi r8, r8, (-1)
bne r8, r0, START_TIMER
The next important thing you need to figure out is what type each instruction is. Is it an R-type, an I-type, or a J-type. The datasheet will usually tell you this and more. In fact the one linked gives you the proper layout for every instruction.
orhi rB, rA, IMM16 = [A][B][IMM16][0x34]
addi rB, rA, IMM16 = [A][B][IMM16][0x04]
addi rB, rA, IMM16 = [A][B][IMM16][0x04]
bne rA, rB, label = [A][B][label][0x1e]
So with the values you were given you plug them in and end up with...
Code:
[0x00][0x08][0x0001][0x34]
[0x00][0x08][0xC350][0x04]
[0x08][0x08][0xFFFF][0x04]
[0x08][0x00][0xF68C][0x1e]
Which when turned into machine code, matching the proper amount of bits should be..
Code:
00000 01000 0000000000000001 110100
00000 01000 1100001101010000 000100
01000 01000 1111111111111111 000100
01000 00000 1111011010001100 011110
Your answers seem to match mine so I believe you did everything correctly. As for your question about your reasoning at the end. Typically in assembly the first register is the register that you'll be writing too. That's why it's in the form of "blah rB, rA, IMM16" even though the machine code is "[A][B][IMM16][opcode]". So you aren't actually writing to r0 in any of those instructions. (The bne instruction is a compare so it doesn't write to B).
You also correctly handled the %hiadj macro. I probably would have mistaken it for the %hi macro if I didn't notice the macro explanations in the datasheet.
-------------------------
Unless you start working with architecture design or stuff like that, transforming assembly into machine code can be a very simple process. If you're required to memorize layouts, only memorize the layout for the generic types: R-type (Register), I-type (Immediate), and J-type (Jump). Then you just have to use context/knowledge to figure out which type each instruction is and move the arguments into the correct order. The only tricky parts would be dealing with pseudo instructions.
If you have any other questions, or if I didn't properly explain something (4:00AM here and all) let me know.