ngi4.s 445 B

1234567891011121314151617181920212223242526272829303132333435
  1. .define Ngi4
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine takes a fourbyte interger and negates it.
  8. ! For more details see ngi2.s
  9. Ngi4:
  10. sta ADDR+1
  11. stx ADDR
  12. ldy #3
  13. 1: lda (ADDR),y
  14. eor #0x0FF ! one's complement lowbyte+y
  15. sta (ADDR),y
  16. dey
  17. bpl 1b
  18. ldx #0x0FD
  19. iny
  20. clc
  21. lda (ADDR),y
  22. adc #1
  23. sta (ADDR),y ! lowbyte+y
  24. 1: iny
  25. lda (ADDR),y
  26. adc #0
  27. sta (ADDR),y ! (lowbyte+y)+0
  28. inx
  29. bne 1b
  30. rts