sli4.s 576 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. .define Sli4
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine shift a signed or unsigned fourbyte integer
  8. ! n times left. N is in register X.
  9. Sli4:
  10. cpx #0
  11. beq 9f ! zero shift, return input
  12. lda SP+2 ! the shifting is done on the stack
  13. sta ADDR ! address of integer (lowbyte)
  14. lda SP+1
  15. sta ADDR+1 ! address of integer (highbyte)
  16. 2: ldy #0
  17. clc
  18. lda (ADDR),y
  19. rol a
  20. sta (ADDR),y
  21. iny
  22. lda (ADDR),y
  23. rol a
  24. sta (ADDR),y
  25. iny
  26. lda (ADDR),y
  27. rol a
  28. sta (ADDR),y
  29. iny
  30. lda (ADDR),y
  31. rol a
  32. sta (ADDR),y ! shift left
  33. dex
  34. bne 2b
  35. 9: rts