ldi.s 478 B

1234567891011121314151617181920212223242526272829
  1. .define Ldi, Ldo
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! The subroutine Ldi pushes a four byte object onto the stack.
  8. ! The address is in registerpair AX.
  9. ! If the address is already in zeropage Ldo is used.
  10. Ldi:
  11. stx ADDR ! address of object (lowbyte)
  12. sta ADDR+1 ! address of object (highbyte)
  13. Ldo:
  14. ldy #3
  15. 1: lda (ADDR),y ! get lowbyte
  16. pha
  17. dey
  18. lda (ADDR),y ! get highbyte
  19. tax
  20. pla
  21. jsr Push ! do the push
  22. dey
  23. bpl 1b ! perform 2 times
  24. rts