4136 Shares

Topic: Best-case scenarios
June 20, 2019 / By Hudde
Question: During weapons training in basic training,we were informed about the dangers of reassembling a weapon incorrectly particularly the trigger assembly. I know how to reassemble a weapon but I forgot what can happen if you do it wrong. I thought so. I know it won't fire without the firing pin, I figured it would explode but I wasn't sure.

Enoch | 4 days ago
Worst case scenario is a catastrophic malfunction leading to the weapon exploding and rendering you with serious injuries or death. Best case scenario, it doesn't work.
👍 96 | 👎 4

We found more questions related to the topic: Best-case scenarios

Originally Answered: Random number generator in assembly code?
I don't have any assembly code for the PIC18 written for this, nor do I know where to point you. But you only need the least significant four bits (0-15), so if you find one that can generate 8-bit values all you'd have to do is mask off the upper four to get your exact range. There are two basic kinds of very simple RNGs that are readily written in assembly code on a PIC18, though. They are called "linear congruential" and "xor shift" or LFSR (linear feedback shift register) methods. Either would probably do fine for you. The linear congruential types are of the form, x= m*x+b, and you have to find an appropriate m and b. Plus, you need to multiply. Luckily, the PIC18 has such an instruction. So it shouldn't be too hard to write the code. It's just a matter of picking good m and b values -- primes usually work okay, though. Just make m big enough to cause the low order bits to shuffle up well. The value 'x' will be some static value you probably keep on the base page for convenience (page 0.) It's value needs to be initialized at startup to something fixed or random (if you have a source for that.) The xorshift method is more for micros without a multiplication instruction. The code could look like: unsigned char xorshift() {     static unsigned char x= 1, y= 1;     unsigned char t= x ^ (x<<5);         x=y;     return y= (y^(y>>1)) ^ (t^(t>>3)); } Note the values of 5, 3, and 1 used for the right shift and left shift operations in the code. There are different combinations of these that all work out well. I just picked one of the sets, but there are papers written that discuss good groups of these three values. The rest of the code remains the same, though. If you can translate that into assembly for your circumstances (you will need two static values for this to hold the above 'x' and 'y' values and retain them, call to call), then you could go this route as well. Note that the (x<<5) operation, for example, could be implemented using a SWAPF to move the initial 4 bits and then one of the rotate instructions to get the 5th shift done. You'd need to mask off some bits to complete it. So something like 3 instructions to do the job just for that part of it. Anyway, that's what I'd do in your circumstance -- either find assembly code or write it after doing some reading and deciding. Try the following link to start:
Originally Answered: Random number generator in assembly code?
A Pseudo random generator: x = (a * x0 + b) the place a = 29 and b = fifty five Use learn the value of a strolling timer at a time of a keypress to set the "seed" (first x0). ; A is x0. Exits with A = new x0 random: mov B, A ; multiply x0 with the aid of 29 mov A, #13 mul AB ; influence in B,A as integer clr C addc A, #37 ; x = (a * x0 + b) mov B, #251 div AB ; the rest in B mov A, B ; modulo ret

Cody
One of the worst problems would be if the mis-assembled gun doesn't cock on closing the bolt. Then you get a 'slam fire' where the cartridge goes off in an unlocked chamber. This can ruin your whole day and then some.
👍 30 | 👎 -5

Antuan
What can happen if you do it wrong? Oh I remember the first time I went shooting with my brother. He took apart the M9 and he misplaced something, I can't recall what it was but the cock (the top part that houses the chamber) flew off and the remaining barrel of the pistol exploded. Luckily, his hands were barely burned and he only went to the hospital for first degree burns. Just read the manual and you should be fine, like I am :)
👍 27 | 👎 -14