sbi.s 474 B

1234567891011121314151617181920212223242526
  1. .define Sbi2
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! This subroutine subtracts two twobyte signed integers
  8. ! and returnes the result in registerpair AX.
  9. Sbi2:
  10. stx ARTH ! save second operand (lowbyte)
  11. sta ARTH+1 ! save second operand (highbyte)
  12. jsr Pop
  13. pha
  14. sec
  15. txa ! get first operand (lowbyte)
  16. sbc ARTH ! subtract second operand (lowbyte)
  17. tax
  18. iny
  19. pla ! get first operand (highbyte)
  20. sbc ARTH+1 ! subtract second operand (highbyte)
  21. rts