I was wondering whether or not I should create a new post about this project (you can read it's introduction here). In my previous one I recieved lots of feedback from other programmers and I learned quite a lot. After (briefly) reading the instruction manual for the ATMega128 and breaking up the project in simple parts I managed to understand the exercise better and did some lines of code (attached to this post).
I failed at doing a state diagram physically because my mind gets blown away by the ammount of loops and redirections that the program suffers but I managed to understand the flow of the project.
At the moment I'm currently stuck:
- I'm failing to understand how to define a max value for a register. (In this case, I'm only considering the maximum value of capsules as 9). The in instruction isn't corrent nor is the ldi one (from what I've read on the manual).
- I'm also failing to figure out how to read a constant value from a register. (In this case, I'm considering r22 as the place where I'll store the number of capsules at the current time).
Besides that, the code is pretty solid at the moment. It's pretty far away from the final thing but it's more than nothing. In my opinion, if I understand how to read the register value, I can proceed with the code becasue (even though the commentaries are in portuguese) the code is basically dependent on the "what's the number in r22" as I'm implementing conditions on my labels.
For now that's it. Hopefully the feedback will be great once again and I can learn even more. I know it's probably a very basic code but I enjoyed it actually !
(I'm without time as I have other projects to do but if it's needed I can translate what's in the commentaries. I don't think it is anything important besides explanations for me to know what I'm doing).
EDIT1: Added english translations.