FOURD=12345
FOURD=FOURD>>2 should return FOURD=123, right? but it returns 11419 !
FOURD=12345
FOURD=FOURD>>2 should return FOURD=123, right? but it returns 11419 !
Forgot to mention, startup shift fixed:
shiftout datapin,clockpin,1,[X-DLEN+DSTART, y]
Not sure how that happened. First, you wouldn't get "123", as Right Shift 2 (>> 2) is the same as Divide by 4; in which case 12345 >> 2 = 3086 and not 11419.
Since you're dealing with a display, you may have to treat each place holder as a unique byte (perhaps value + $30 to convert it to ASCii); "12345" would be saved as $31, $32, $33, $34, $35 in an array. You can then shift your pointer 2 places to look at 123 by itself (as 3 individual bytes, of course).
I've written a PC based converter, which deals with ASCII conversion. It generates PBP code for EEPROM.
![]()
So back to shift.
How to trim one variable from left to right, to value of another variable?
say trim 12345 by 3 - mean, make 123 digits from it.
12345 / 10 = 1234
12345 / 100 = 123
12345 / 1000 = 12
12345 / 10000 = 1
/Henrik.
This requires too many IFs....
On spectrum we had X=LEFT(Y,Z)....
You are mixing string with numeric values...
12345 is a decimal number.
LEN or any other similar command (LEFT, RIGHT, MID) will take as an input just string characters, not numeric values.
Ioannis
Look up DIG. It isolates single digit, as you need it, without IF...
Bookmarks