10 replies
by epepke
You haven't given many details. What assembler? What processor? What environment?
WRT your project, though, by far the most difficult part is going to be taking the input from the user. Everything else is trivial. With a four-digit code, theeasiest thing to do is to pack it into a 32-bit word and use some sort of comparison (depending on the assembler and your preference: cmp, xor, or sub) and then do a conditional jump based on what is in the flags register. A handful of instructionsat the most. Some processors have instructions to do packing of BCD easily; some you will have to dink with using shift instructions. In any event, it's simple, conceptually like this:
Start with rWhatever = 0;
For each of four input digits Shift rWhatever left 8 bits
Or it with the input digit
At the end, rWhatever is the BCD expression. Then just do a comparison to the other register holding the check code, similarly built up.
by viper2k29
by ms_saini3302
by viper2k29
by viper2k29
by xorex
by viper2k29
by xorex
by viper2k29
by viper2k29
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending