03-30-2019, 09:27 PM
The 16C can set the word size from 1 to 64 bits but has no way to retrieve the value of that setting. So everyone ends up shifting a 1 leftward across a word until the carry is set. Here is a simple routine that only affects the X register, to which is returned the current word size.
Code:
(from DM16C)
001 LBL A | 43 22 A WSIZE?
002 CLX | 43 35 Don't disturb stack
003 STO I | 44 32 Counter initial value
004 CLX | 43 35 Don't disturb stack
005 1 | 1 Bit pattern to find word size
006 LBL 0 | 43 22 0
007 F? 4 | 43 6 4 Carry set?
008 GTO 1 | 22 1 Yes
009 SL | 42 A Shift bit across word into carry
010 ISZ | 43 24 Increment word size counter
011 GTO 0 | 22 0
012 GTO 0 | 22 0
013 LBL 1 | 43 22 1
014 CF 4 | 43 5 4 Don't leave carry set
015 CLX | 43 35 Don't disturb stack
016 RCL I | 45 32 Recall word size
017 RTN | 43 21