teq.s 335 B

12345678910111213141516171819202122232425
  1. .define Teq
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine test if the value in registerpair AX is zero
  8. ! or nonzero.
  9. ! The returned value, a 1 or a 0, is in AX.
  10. Teq:
  11. tay
  12. beq 1f ! A is zero
  13. 2: lda #0 ! AX is zero
  14. tax
  15. rts
  16. 1: txa
  17. bne 2b ! X is zero
  18. lda #0 ! AX is nonzero
  19. ldx #1
  20. rts