ior.s 753 B

12345678910111213141516171819202122232425262728293031323334
  1. .define Ior
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine performs the logical inclusive or on two
  8. ! groups of bytes. The groups may consist of atmost 254 bytes.
  9. ! The two groups are on the stack.
  10. Ior:
  11. lda SP+1
  12. sta ADDR+1 ! address of the first group (highbyte)
  13. lda SP+2
  14. sta ADDR ! address of the first group (lowbyte)
  15. clc
  16. tya
  17. adc SP+2
  18. sta SP+2 ! new stackpointer (lowbyte)
  19. sta ADDR+2 ! address of second group (lowbyte)
  20. lda #0
  21. adc SP+1
  22. sta SP+1 ! new stackpointer (highbyte)
  23. sta ADDR+3 ! address of second group (highbyte)
  24. 1: dey
  25. lda (ADDR),y ! get byte first group
  26. ora (ADDR+2),y ! inclusive or with byte second group
  27. sta (ADDR+2),y ! restore result on stack
  28. tya
  29. bne 1b ! perform n times
  30. rts