diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-02-18 08:10:10 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-02-18 08:10:10 -0500 |
commit | b4dbd2cfa724476162fa6d35941a5d7cdc9c9524 (patch) | |
tree | 431af0b75efa29dfa3bab2868a78ab0eb29173c7 /CS2771 | |
parent | e8b1808eaf87a49e4c34ebbfb66854baa627418c (diff) |
Adds all assignments not previously in a git repo
Diffstat (limited to 'CS2771')
-rw-r--r-- | CS2771/Assmbly1.s | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/CS2771/Assmbly1.s b/CS2771/Assmbly1.s new file mode 100644 index 0000000..4719280 --- /dev/null +++ b/CS2771/Assmbly1.s @@ -0,0 +1,84 @@ +;Tucker Evans +;CS3871 +;A collection of Assembly programs written from c code + + +;1 +; char i,j; +; +; i=3; +; j = i+i; + +start: + MOV A, #0 + MOV R0, #3 + MOV A, R0 + ADD A, R0 + MOV R1, A + JMP start + + +;2 +; char a,b; +; +; a=64; +; while (a > 0) { +; b = a; +; a--; +; } + +start: + MOV A, #64 +test: + JNZ loop + JMP start + + +loop: + MOV R0, A + DEC A + JMP test + +;3 +; char i,j,k; +; i=3; +; j=5; +; if (i == j) +; k=8; +; else +; k=9; + +start: + + MOV R0, #3 + MOV R1, #5 + + MOV A, R0 + MOV #40h, A + CJNE R1, #40h, false + MOV R3, #8 + JMP start + +false: + MOV R3, #9 + JMP start + +;4 +; char buf[64]; +; char i; +; +; for (i=0; i<64; i++) +; buf[i]=i; + +start: + MOV R0, #0 + MOV R1, #20h + MOV A, R0 +l1: + CJNE A, #64, l2 + JMP start +l2: + MOV @R1, A + INC A + INC R1 + JMP l1 |