Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
+ 3

# ARM Assembly

if statement translation Using ARM assembly language, initialize the variables a, b, and c to consecutive integers starting at 1. Create your code so that a is in R0, b is in R1, and c is in R2. Build the following if statements, using the ARM Cortex-M0 instructions, if a == 1 b = b * 4 + 2 if a <= b b = c + 4 return b // make sure the return value ends up in R0

5th Oct 2020, 7:59 PM
12 Antworten
+ 13
Martin Taylor Your answer reminded me of some pretty great scenes from the TV show, Halt and Catch Fire. If you haven't watched it, I have a feeling you would really enjoy this show that takes place in the 80's where a company works to reverse engineer the IBM BIOS stored on microchips to create their own BIOS for a competing personal computer. It's about as authentic as I would imagine with so much I could relate to from my own experiences with tech firms in the latr 90s and early 2000s. If you do give it a watch on Netflix, let me know your thoughts. John Wells and BroFar... You guys might also really enjoy this series if you haven't seen it yet.
6th Oct 2020, 12:44 AM
David Carroll
6th Oct 2020, 4:29 AM
David Carroll
+ 7
Farid Mousazadeh Is this a challenge question, some homework assignment, or are you stuck at a certain point in this problem? Do you have some code we can review to see where you're stuck? Is there a REPL site where we can run this? Most of the people here aren't doing much with assembly. I actually thought Martin Taylor posted the best answer you're going to get here. Do you have any references you are working with to save people time if they were interested in helping? For me, I would probably write this in C, then compile to assembler output and review the output to get a feel for the commands, then modify from there.
6th Oct 2020, 2:39 AM
David Carroll
+ 5
Martin Taylor where do BIOS.COM and COMMAND.COM come from?
6th Oct 2020, 10:31 AM
Sonic
+ 4
--> BEQ isEqual Isn't this a logic error? I believe it should be BNE. And remember to add the isEqual label, although the name would be misleading. EDIT: Also check the logic of "BLO else1" to consider replacing it with "BGT else1".
6th Oct 2020, 3:29 AM
Brian
+ 4
Is the label missing a colon? done: B done
6th Oct 2020, 3:58 AM
Brian
+ 3
Martin Taylor is PIC assembly different than the rest? Cuz i tried to learn AVR atmega assembly and it was really different mnemonics, but I may have seen that assembly for others microcontrollers or even microprocesors are quite similar. Was a bad idea to start with PIC? I feel so.
5th Oct 2020, 11:36 PM
Arturop
+ 3
Martin Taylor thank you. I was uncertain whether this particular assembler needed a colon. The error reminded me of the many times when I had forgotten a colon in other assemblers, but I had doubt, since the __main label seemed to pass without having one.
6th Oct 2020, 9:43 AM
Brian
+ 2
6th Oct 2020, 2:01 AM