You can do this manually, although its tedious.
You have to understand the machine instruction code for the processor
you are using, its instruction naming conventions, and how they operate.
Not all instructions, basic load/store/test/add/sub/and......because your
C code for conversion
If this is just a part of the overall C code you can do inline assembly, consult
the compile and linker manuals on how to do this.
Basically you take this one step at a time
0) If inline ASM look into how to save / restore machine state
1) Declare variables / registers to use in ASM
2) Find instructions to do a jump to label (this is the FOR loop in C
3) Look at instruction to load / test / store (flags will be set cleared in
machine by some of these like add/ sub......)
If you have never done ASM before do a simple task, like store a value
into memory or register, then load it into ACCUM, and then write that
out to a port register. Use debugger to verify, or put, for example, 4 leds
on the port, bits 0, 2, 4, 6, and write out to port 0b'01010101' to light them
all up, then write the complement of the ACCUM to turn them off.
Then do a simple test of a value, if its greater than another value, light
the LEDs...
Simple tests/operations will make it easy to maintain your sanity when learning
machine language....
Keep a programmers reference card next to you that shows
a summary of the instructions makes life easy. Note machine code instructions,
on the whole, are quite simple operations, add sub logical test jump .....so its
not rocket science to learn. You are not solving Maxwell's equations for boundary
layer conditions......in N dimensions....ugh.....
Watch a couple of youtube videos on ASM for starters for general principles....
Note you can always look at compiler code produced from your C, but be aware
that compilers can do certain optimization methods that may make the ASM
code a little more challenging to read than when you write it yourself as a newbie.
The file that shows you the compiler produced ASM code is typically named main.lst
and its ancillary list files.
Regards, Dana.