Advertisement
Ed94

CharCounter WIP

Apr 5th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. ; PROGRAMMER: Edward R. Gonzalez 123-45-6789
  2. ;
  3. ; CLASS: COP 2210-02 MW 11:00 a.m.
  4. ;
  5. ; INSTRUCTOR: Norman Pestaina ECS 364
  6. ;
  7. ; ASSIGNMENT: #1 Arithmetic & Simple I/O. DUE Wendsday 4/5 Midnight.
  8. ;
  9. ; CERTIFICATION: I certify that this work is my own and that
  10. ; none of it is the work of any other person.
  11. ;
  12.  
  13. ;Character Counter 3
  14. 0011000000000000 ;Set PC to x3000.
  15.  
  16. 0010101000011000 ;Set R5 to value to jump store at x3500.
  17. 0101010010100000 ;Clear R2.
  18.  
  19. 0010011000010001 ;LD , dest is R3, src x3014
  20. 1111000000100011 ;Trap, empty, IN
  21.  
  22. 0110001011000000 ;LDR , dest is R1, base is 3, offset is 0.
  23. 0001100001111100 ;ADD, dest is R4, src 1 is R1, i, 11100
  24.  
  25. 0000010000001001 ;Brach to x300C if zero.
  26.  
  27. 1001001001111111 ;Not , R1, R1, 111111
  28. 0001001001100001 ;ADD, R1, R1, i, 00001
  29. 0001001001000000 ;ADD, R1, R1, R0
  30.  
  31. 0000101000000010 ;Bran, x300F
  32. 0000111000001010 ;BRN, x3016
  33.  
  34. 0101110110111111 ;Set focus to R6
  35. 0000001000001111 ;Branch if R6 is positive.
  36. 0001110110100001 ;Increment R6
  37.  
  38. 0001010010100001 ;ADD, R2, R2, i, 00001
  39. 0001011011100001 ;ADD, R3, R3, i, 00001
  40. 0110001011000000 ;LDR , R1, R3, 000000
  41.  
  42. 0000111111110101 ;Bran, nzp, 111110110 --> x3004
  43.  
  44. 0001110010000110 ;Add R2 to R6.
  45. 0010000000000100 ;LD , R0, 000000100 --> x3013
  46. 0001000000000010 ;ADD, R0, R0, R2
  47. 1111000000100001 ;Trap, empty, OUT
  48. 1111000000100101 ;Trap, Halt
  49. 0011000100000000 ;ST R0, 2F13
  50. 0000000000110000
  51.  
  52. ;Store Function
  53. 0111011101000000 ;Store where R5 + PC points.
  54. 0001101101100001 ;Increment R5.
  55. 0000111111110011 ;BRNZP x3005
  56. 0011010100000000 ; x3500...
  57.  
  58. ;Two-Digit Function
  59. 0010110000000000 ;Load HalfR2 into R6
  60. 0001110110100001 ;Incrament R6
  61. 0111110000000000 ;Store R6 into HalfR2
  62. 0101110110100000 ;Clear R6
  63. 0000111000000000 ;Branch Back;
  64. 0000000000010001 ;HalfR2 Counter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement