Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I left a list using a load of instructions here that was used during a rookie programming session, so, let’s see how well I did.
- Results
- move.w #$0010,d0
- mulu.w #$0003,d0
- neg.w d0
- ext.l d0
- asr.l #$01,d0
- ror.w #$01,d0
- ext.l d0
- divu.w #$0002,d0
- d0 starts with 00000000.
- move.w #$0010,d0
- d0 now contains 00000010.
- mulu.w #$0003,d0
- 0010 x 0003 = 00000030
- d0 now contains 00000030.
- neg.w d0
- 0030 is changed to -0030 (FFD0). Now d0 contains 0000FFD0.
- ext.l d0
- The word FFD0 inside d0 is extended to long-word, currently d0 contains:
- 0000 0000 0000 0000 1111 1111 1101 0000
- The MSB of FFD0 is 1 (set), so d0 is extended to:
- 1111 1111 1111 1111 1111 1111 1101 0000
- Now d0 contains FFFFFFD0.
- asr.l #$01,d0
- d0 contains FFFFFFD0 in binary:
- 1111 1111 1111 1111 1111 1111 1101 0000
- Arithmetically shifting right by 1 will give us:
- > 1111 1111 1111 1111 1111 1111 1110 1000 >
- Now d0 contains FFFFFFE8.
- ror.w #$01,d0
- The word FFE8 of d0 is now rotated right by 01 bit:
- > 0111 1111 1111 0100 v
- ^ < < < < < < < < < < <
- Now d0 contains FFFF7FF4.
- ext.l d0
- The word 7FF4 inside d0 is extended to long-word, currently d0 contains:
- 1111 1111 1111 1111 0111 1111 1111 0100
- The MSB of 7FF4 is 0 (clear), so d0 is extended to:
- 0000 0000 0000 0000 0111 1111 1111 0100
- Now d0 contains 00007FF4.
- divu.w #$0002,d0
- 00007FF4 ÷ 0002 = 3FFA r0000
- Now d0 contains 00003FFA.
- And there is my answer, d0 contains 00003FFA afterwards. Please remember, I don’t expect myself to work these all out in my head, if I’d prefer to use a calculator, that’s fine. -APU
Add Comment
Please, Sign In to add comment