The Museum of HP Calculators

HP Articles Forum

HP41C MCODE MOVE

Posted by Doug Wilder on 5 Nov 2005, 2:19 a.m.

```
A More Usefull MOVE
C = bbbbeeeedddd  begining ending destination
The word at bbbb is always moved to dddd, all fields are arbitrary.
One can grab the bottom word and move the block by pulling the bottom
to dddd. That is, bbbb > eeee or eeee > bbbb is allowed. Keeping it
general requires considering four cases. Laying them out with higher
address on top (arrows indicate first move required):
1                 2                 3                 4
b>e + d>b         b>e + b>d         e>b + d>b         e>b + b>d
->dddd      bbbb                    ->aaaa      eeee
xxxx      xxxx                      xxxx      xxxx
xxxx      xxxx                      xxxx      xxxx
bbbb->  xxxx      xxxx    dddd      eeee->  xxxx      xxxx    aaaa
xxxx    xxxx      xxxx    xxxx      xxxx    xxxx      xxxx    xxxx
xxxx    aaaa      eeee->  xxxx      xxxx    dddd      bbbb->  xxxx
xxxx                      xxxx      xxxx                      xxxx
xxxx                      xxxx      xxxx                      xxxx
eeee                    ->aaaa      bbbb                    ->dddd
Notice that an upward move requires a decrementing counter, and a
downward move requires an incrementing counter.
C = bbbbeeeedddd  begining ending destination

92C2 0E 00E   A=0              ! initialize and test
92C3 1E 02E   B=0
92C4 70 0E0   SLCTQ
92C5 AS 15C   PT=   6
92C6 50 0A0   SLCTP
92C7 0S 01C   PT=   3
92C8 DS 1BC   RCR   11
92C9 5I 0B2   A<>C  PQ         dddd -> A(M)
92CA PS 33C   RCR   1
92CB N6 2E6   ?C#0  X          op input too many digits ?
92CC 37 067   JC    +0C
92CD LS 2BC   RCR   7
92CE 7I 0F2   B<>C  PQ         bbbb -> B(M)
92CF 7S 0FC   RCR   10
92D0 AO 158   STOM             eeee -> M(M)
92D1 GQ 21A   RC+A  M          C = dddd+eeee
92D2 5E 0AE   A<>C
92D3 CQ 19A   A=A-B M
92D4 17 027   JC    +04        trying to write below 0000 ?
92D5 5E 0AE   A<>C             C = aaaa = dddd+eeee-bbbb
92D6 KS 29C   PT=   7
92D7 J2 262   DECC  PT         trying to write above FFFF ?
92D8 5L 0B5
92D9 52 0A2   GONC  282D       "ERRDE"
92DA H2 222   INCC  PT
92DB EO 1D8   C<>M
92DC 3E 06E   A<>B
at this point       for both upmove and dnmove entry:
C(M) = eeee          C(M) = ssss = source   (eeee or bbbb)
B(M) = dddd          B(M) = rrrr = receiver (dddd or aaaa)
A(M) = bbbb          A(M) = tttt = terminis (bbbb or eeee)
M(M) = aaaa
92DD OQ 31A   ?A<C  M      ?e>b
92DE 1F 02F   JC    +05     "e>b"
b>e     92DF PQ 33A   ?A<B  M      ?d>b
92E0 2R 05B   JNC   +0B     "b>e+b>d"
1  b>e+d>b 92E1 5E 0AE   A<>C
92E2 5J 0B3   JNC   +16     "upmove"
e>b     92E3 PQ 33A   ?A<B  M      ?d>b
92E4 1B 02B   JNC   +05     "e>b+b>d"
3  e>b+d>b 92E5 EO 1D8   C<>M
92E6 7E 0EE   B<>C
92E7 EO 1D8   C<>M
92E8 43 083   JNC   +10     "upmove"
4  e>b+b>d 92E9 5E 0AE   A<>C
92EA 13 023   JNC   +04     "dnmove"
2  b>e+b>d 92EB EO 1D8   C<>M
92EC 7E 0EE   B<>C
92ED EO 1D8   C<>M
dnmove  92EE PG 330   FETCH     <-
92EF 7Q 0FA   B<>C  M
92F0 20 040   WROM
92F1 HQ 23A   INCC  M
92F2 7Q 0FA   B<>C  M
92F3 HQ 23A   INCC  M
92F4 OQ 31A   ?A<C  M
92F5 UB 3CB   JNC   -07 ->
92F6 V0 3E0   RTN
92F7 JQ 27A   DECC  M   <-
upmove  92F8 PG 330   FETCH
92F9 7Q 0FA   B<>C  M
92FA 20 040   WROM
92FB JQ 27A   DECC  M
92FC 7Q 0FA   B<>C  M
92FD RQ 37A   ?A#C  M
92FE UF 3CF   JC    -07 ->
92FF V0 3E0   RTN

```