Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. Valor1: .dw -5 ; Guardem valor 1
  2. Valor2: .dw -6 ; Guardem valor 2
  3. Resultat: .rw 1 ; Reservem 1 espai de memoria
  4. .begin inici ; Començem programa
  5. negneg: ; Etiqueta negatiu, negatiu
  6. SUB R0, R1, R1 ; R1 a positiu
  7. SUB R0, R2, R2 ; R2 a positiu
  8. BR loop
  9. neg: ; Etiqueta 1 negatiu;
  10. ADD R0, R2, R2
  11. BL negneg ; Si el segon negatiu saltem a negneg
  12. BR loop ; Saltem a loop
  13. inici:
  14. LOAD Valor1(R0), R1
  15. LOAD Valor2(R0), R2
  16. ADD R0, R1, R1
  17. BL neg
  18. loop:
  19. ADD R3, R2, R3
  20. SUBI R1, #1, R1
  21. BG loop
  22. STORE R3, Resultat(R0)
  23. .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement