Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. eight_digits: mov #digit0,digit_pointer ;Start digit_pointer at digit0
  2. eight_loop: lda display_pointer ;Load LSD
  3. sec
  4. rora ;Convert to actual mem address
  5. tax ;and load into h:x register
  6. clrh
  7. lda ,x ;to get data at display_pointer
  8. bcc isolate_nibble ;If accessing lower nibble don't nsa
  9. nsa
  10. isolate_nibble: and #$0F
  11. jsr ascii_7seg ;Convert to ASCII
  12. ldx digit_pointer ;Load the digit pointer
  13. sta ,x ;and store ASCII value
  14. ;at where x points to
  15. inc display_pointer
  16. inc digit_pointer
  17. lda digit_pointer
  18. cmp #{digit7 + 1} ;Check to see if all eight
  19. bne eight_loop ;digits have been filled
  20. rts
  21.  
  22.  
  23.  
  24. addition: mov #sum,display_pointer ;After the operation is applied
  25. lsl display_pointer ;display_pointer will have to
  26. bclr 0,display_pointer ;point to sum -- display_pointer
  27. ;is not needed for the rest
  28. ;of operation
  29. clc ;Clear carry for first digit
  30. ldx #in_1
  31. add_loop: lda ,x
  32. adc max_digits,x ;Add the first 2 numbers together
  33. ;which are spaced apart by max_digits
  34. daa
  35. sta {max_digits + max_digits},x ;Sum is spaced 2*max_digits
  36. ;away from in_1
  37. incx
  38. cbeqx #{in_1 + max_digits},display
  39. bra add_loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement