adi4.s 528 B

12345678910111213141516171819202122232425
  1. .define Adi4
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine adds two fourbyte integers, which are on the stack.
  8. ! The addresses are initiated by the subroutine Addsub.
  9. ! Also the loopvariable (register X) is initiated by that routine.
  10. ! The result is pushed back onto the stack
  11. Adi4:
  12. jsr Addsub ! initiate addresses
  13. clc
  14. 1: lda (ADDR+2),y ! get byte first operand
  15. adc (ADDR),y ! add to byte second operand
  16. sta (ADDR+2),y ! push on real stack
  17. iny
  18. inx
  19. bne 1b ! do it 4 times
  20. rts