Hi;
I'd just add a few remarks, if you allow me to:
Key Code MNEMOMICS Merge Commands Remarks
001-42,21,11 LBL A "A" Sub-program "A"
002- 2 2
003- 36 ENTER
004- 2 2 (unnecessary)
005-42,23,11 DIM A (2,2) DIM A Dimension Data Matrix A to 2x2
006- 2 2 (unnecessary)
007- 36 ENTER (unnecessary)
008- 1 1
009-42,23,12 DIM B (2,1) DIM B Dimension Data Matrix B to 2x1
010-42,26,13 RESULT C Result in C Designates Matrix C for storing result
011-42,16, 1 MATRIX 1 Matrix Entry Restart entry from home position (1,1)
012- 0 0
013-u 44 11 STO A A(1,1) <-- 0 Matrix A Entry
014- 1 1
015-u 44 11 STO A A(1,2) <-- 1
016- 1 1 (unnecessary)
017- 16 CHS
018-u 44 11 STO A A(2,1) <-- -1
019- 0 0
020-u 44 11 STO A A(2,2) <-- 0
021- 43 32 RTN ............ step skiped since 'End of Matrix reached' (roll over)
022- 43 32 RTN End of "A"
023-42,21,15 LBL E "E" Sub-Program "E"
024-45,16,11 RCL MATRIX A
025- 36 ENTER ? ? ?
026-45,16,12 RCL MATRIX B
027- 20 × C <-- A × B Matrix Product
028- 43 32 RTN End of "E"
Step #4: after [ENTER] both X and Y registers already filled with 2.00, no need to enter again;
Steps #6 and #7: Same as above
Step #16: there is a copy of 1 still in the X-register, a single CHS suffices to let -1 in the X-register
And you are correct: step #25 is not needed.
Since the elements and the indexes for the matrices are not used after their contents are set, reusing them instead of introducing them back once they are still in the memory stack reduces the number of program steps. And allow the extra few bytes to be used in other programs.
Cheers.
Luiz (Brazil)
Edited: 28 Mar 2012, 5:52 a.m.