lcs.s 386 B

123456789101112131415161718192021222324
  1. .define Lcs
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine creates space for locals on procedure entry
  8. ! by lowering the stackpointer.
  9. Lcs:
  10. sta ARTH ! number of locals (lowbyte)
  11. stx ARTH+1 ! number of locals (highbyte)
  12. sec
  13. lda SP+2
  14. sbc ARTH
  15. sta SP+2 ! new stackpointer (lowbyte)
  16. lda SP+1
  17. sbc ARTH+1
  18. sta SP+1 ! new stackpointer (highbyte)
  19. rts