2 ; Ullrich von Bassewitz, 20.09.1998
4 ; CC65 runtime: left shift support for longs
8 .export tosasleax, tosshleax
10 .importzp sp, sreg, ptr1, ptr2
16 ; Get the lhs from stack into ptr1/ptr2
34 ; Check for shift overflow or zero shift
36 tay ; Low byte of shift count into y
39 ora sreg+1 ; Check high 24 bit
40 bne @L6 ; Shift count too large
44 cpy #0 ; Shift count zero?
47 ; We must shift. Shift by multiples of eight if possible
63 ; Shift count is now less than eight. Do a real shift.
65 @L3: tay ; Shift count to Y
66 lda ptr1 ; Get one byte into A for speed
68 beq @L4a ; Jump if done
76 ; Put the result in place
85 ; Jump here if shift count overflow