Skip to content

Instantly share code, notes, and snippets.

@OtavioHenrique
Last active August 27, 2018 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OtavioHenrique/c1697b30d8b56ef765b1c55fc579531e to your computer and use it in GitHub Desktop.
Save OtavioHenrique/c1697b30d8b56ef765b1c55fc579531e to your computer and use it in GitHub Desktop.
so.md
Command Operator Usage
00000000 stop
00000001 load memória -> acumulador
00000010 store acumulador -> memória
00000100 add acumulador -> acumulador + memória
00000101 negativo inverte sinal do acumulador
00001000 jump desvia em condicional
00001001 jle desvia se acum = 0
00001010 jgt desvia se acum > 0
00001011 read inicia e/s do dado digitado
00001100 write inicia e/s para monitor
00001101 wait poem a execucao em espera
Var Address
A 00010000
B 00010010
C 11000000

Ex1. A = B + C

Command Memory Command Operation
00000001 00010010 LOAD B
00000100 11000000 ADD C
00000010 00010000 STORE A
00000000 xxxxxxxx STOP

Ex2. A = B + 2

Command Memory Command Operation
00000001 00000010 LOAD 2
00000100 00010010 ADD B
00000010 00010000 STORE A
00000000 xxxxxxxx STOP

Ex3. A = B * 2

Command Memory Command Operation
00000001 00010010 LOAD B
00000100 00010010 ADD B
00000010 00010000 STORE A
00000000 xxxxxxxx STOP

Ex4. A = A + B - C

Command Memory Command Operation
00000001 11000000 LOAD C
00000101 xxxxxxxx NEG C
00000100 00010010 ADD B
00000100 00010000 ADD A
00000010 00010000 STORE A
00000000 xxxxxxxx STOP

Ex. A=B * C

------- Command Memory Command Operation
00001 00001011 00010010 READ B
00010 00001101 xxxxxxxx WAIT B
00011 00001011 11000000 READ C
00100 00001101 xxxxxxxx WAIT C
----- -------- -------- ------
00101 00000001 11000000 LOAD C
00110 00000100 11000000 ADD C
00111 00000010 00010000 STORE A
01000 00000001 00000001 LOAD 1
01001 00000101 xxxxxxxx NEG 1
01010 00000100 00010010 ADD B
01011 00000010 00010010 STORE B
01100 00001010 00101 JGT 00101
----- -------- -------- ---------
01101 00001100 00010000 WRITE A
01110 00001101 xxxxxxxx WAIT A
01111 00000000 xxxxxxxx STOP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment