2 ; Ullrich von Bassewitz, 2004-06-30
4 ; CC65 runtime: left shift support for long and unsigned long
6 ; Note: The standard declares a shift count that is negative or >= the
7 ; bitcount of the shifted type for undefined behaviour.
9 ; Note^2: The compiler knowns about the register/zero page usage of this
10 ; function, so you need to change the compiler source if you change it!
14 .export tosasleax, tosshleax
21 and #$1F ; Bring the shift count into a valid range
24 jsr popeax ; Get the left hand operand
26 ldy tmp1 ; Get shift count
27 beq L9 ; Bail out if shift count zero
28 stx tmp1 ; Save byte 1
30 ; Do the actual shift. Faster solutions are possible but need a lot more code.