Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Valor1: .dw -5 ; Guardem valor 1
- Valor2: .dw -6 ; Guardem valor 2
- Resultat: .rw 1 ; Reservem 1 espai de memoria
- .begin inici ; Començem programa
- negneg: ; Etiqueta negatiu, negatiu
- SUB R0, R1, R1 ; R1 a positiu
- SUB R0, R2, R2 ; R2 a positiu
- BR loop
- neg: ; Etiqueta 1 negatiu;
- ADD R0, R2, R2
- BL negneg ; Si el segon negatiu saltem a negneg
- BR loop ; Saltem a loop
- inici:
- LOAD Valor1(R0), R1
- LOAD Valor2(R0), R2
- ADD R0, R1, R1
- BL neg
- loop:
- ADD R3, R2, R3
- SUBI R1, #1, R1
- BG loop
- STORE R3, Resultat(R0)
- .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement