2 ; Ullrich von Bassewitz, 05.08.1998
4 ; CC65 runtime: left shift support for ints
7 .export tosasla0, tosaslax, tosshla0, tosshlax
8 .import popsreg, return0
16 jsr popsreg ; get TOS into sreg
22 cmp #8 ; Shift count greater 8?
23 beq L3 ; Jump if exactly 8
26 ; Shift count is greater 8. Do the first 8 bits the fast way
30 stx sreg ; Low byte = 0
34 ; Shift count less than 8 if we come here
36 L1: tay ; Shift count --> Y
37 beq Zero ; Done if shift count zero
39 lda sreg ; get low byte for faster shift
55 L3: txa ; X == 0, now A == 0
59 ; Shift count was zero
65 ; Shift count too large, result is zero