07-04-2015, 08:03 AM
The programme takes an integer from the stack & returns the bit reversed integer.
eg For input
65
the programme returns
65
or for input
888
the programme returns
123.
eg For input
65
the programme returns
65
or for input
888
the programme returns
123.
Code:
1 LBL M
2 X=0?
3 RTN
4 0
5 x<>y
6 IDIV(REGX,2)
7 REGZ*2+RMDR(REGY,2)
8 x<>y
9 x≠0?
10 GTO M006
11 R↓
12 RTN