Initial commit

This commit is contained in:
2023-05-25 18:39:26 -03:00
commit 9804827a09
41 changed files with 278 additions and 0 deletions

32
Assigments/2/A2.asm Normal file
View File

@ -0,0 +1,32 @@
.ORIG x3000 ;start point
AND R6, R6, #0 ;clean R6
AND R5, R5, #0 ;clean R5
;load memory addresses into registers
LDI R3, x00D
LDI R4, x00D
;NOT the divident to get negative value and then add one
NOT R5, R4 ; NOT(R4) => R5
ADD R5, R5, #1 ; R5+1 => R5;
BR #1; skip first increment
ADD R6, R6, #1 ;increment divison count
ADD R3, R3, R5 ;subtract
BRz #-3 ;if exact division we can skip final loop
BRp #-4 ;loop back 3 instructions to keep dividing
ADD R3, R3, R4 ; get the remainder of the division
;store values in memory;
STI R6, x005
STI R3, x005
HALT
.fill x0000
.fill x4000
.fill x4001
.fill x5000
.fill x5001
.end

24
Assigments/2/A2.bin Normal file
View File

@ -0,0 +1,24 @@
0011 000 000000000 ;start point x3000
0101 110 110 1 00000 ;clean R6
0101 101 101 1 00000 ;clean R5
;load memory addresses into registers
1010 011 000001101
1010 100 000001101
;NOT the divident to get negative value and then add one
1001 101 100 1 11111 ; NOT(R4) => R5
0001 101 101 1 00001 ; R5+1 => R5;
0000 1 1 1 000000001 ; skip first increment
0001 110 110 1 00001 ;increment divison count
0001 011 011 000 101 ;subtract
0000 0 1 0 111111101 ;if exact division we can skip final loop
0000 0 0 1 111111100 ;loop back 3 instructions to keep dividing
0001 011 011 000 100 ; get the remainder of the division
;store values in memory;
1011 110 000000101
1011 011 000000101
1111 0000 00100101 ;halt

BIN
Assigments/2/A2.obj Normal file

Binary file not shown.

BIN
Assigments/2/A2.pdf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

24
Assigments/2/divide.bin Normal file
View File

@ -0,0 +1,24 @@
0011 000 000000000 ;start point x3000
0101 110 110 1 00000 ;clean R6
0101 101 101 1 00000 ;clean R5
;load memory addresses into registers
1010 011 000001101
1010 100 000001101
;NOT the divident to get negative value and then add one
1001 101 100 1 11111 ; NOT(R4) => R5
0001 101 101 1 00001 ; R5+1 => R5;
0000 1 1 1 000000001 ; skip first increment
0001 110 110 1 00001 ;increment divison count
0001 011 011 000 101 ;subtract
0000 0 1 0 111111101 ;if exact division we can skip final loop
0000 0 0 1 111111100 ;loop back 3 instructions to keep dividing
0001 011 011 000 100 ; get the remainder of the division
;store values in memory;
1011 110 000000101
1011 011 000000101
1111 0000 00100101 ;halt

View File

@ -0,0 +1,30 @@
0011 000 000000000 ;start point x3000
0101 110 110 1 00000 ;clean R6
0101 101 101 1 00000 ;clean R5
;load memory addresses into registers
1010 011 000001101
1010 100 000001101
;NOT the divident to get negative value and then add one
1001 101 100 1 11111 ; NOT(R4) => R5
0001 101 101 1 00001 ; R5+1 => R5;
0000 1 1 1 000000001 ; skip first increment
0001 110 110 1 00001 ;increment divison count
0001 011 011 000 101 ;subtract
0000 0 1 0 111111101 ;if exact division we can skip final loop
0000 0 0 1 111111100 ;loop back 3 instructions to keep dividing
0001 011 011 000 100 ; get the remainder of the division
;store values in memory;
1011 110 000000101
1011 011 000000101
1111 0000 00100101 ;halt
0000 0000 0000 0000
1100 0000 0000 0000
1011 1111 1111 1111
1011 0000 0000 0000
1010 1111 1111 1111