2 ; Ullrich von Bassewitz, 1998-08-05, 2004-06-25
4 ; CC65 runtime: left shift support for ints and unsigneds
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 tosaslax, tosshlax
20 and #$0F ; Bring the shift count into a valid range
23 jsr popax ; Get the left hand operand
25 ldy tmp1 ; Get shift count
26 beq L9 ; Bail out if shift count zero
28 cpy #8 ; Shift count 8 or greater?
31 ; Shift count is greater 7. The carry is set when we enter here.
46 ; Shift count is less than 8.
48 L3: stx tmp1 ; Save high byte of lhs