Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * Napisati asemblerski program koji unosi
- znakove preko tipkovnice dok se ne
- unese broj 0 (nula). Program broji koliko
- unesenih znakova su velika ili mala slova
- engleske abecede. Ukoliko je taj broj veæi
- od 5 ispisati poruku:“Nemoj pritiskati
- samo slova! Ima jos znakova na tipkovnici.”
- .global _start
- .text
- _start:
- LDR r0,a
- LDR R1,b
- LDR R2,c
- LDR R3,d
- LDR R4,e
- LDR R5,f
- loop:
- CMP R1,#5
- BHI tekst
- veliko1:
- CMP R2,#'A'
- BEQ velikazb1
- malo1:
- CMP R3,#'a'
- BEQ malozb1
- veliko2:
- CMP R4,#'Z'
- BEQ velikazb2
- malo2:
- CMP R5,#'z'
- BEQ malozb2
- nula:
- CMP R0,#0
- BEQ stop
- malozb1:
- ADD R6,R6,#1
- b veliko2
- malozb2:
- ADD R6,R6,#1
- b nula
- velikazb1:
- ADD R7,R7,#1
- b malo1
- velikazb2:
- ADD R7,R7,#1
- b malo2
- ispisk:
- LDR R8,=tekst
- b veliko1
- stop:
- b stop
- a: .word 0
- b: .word 6
- c: .word 'A'
- d: .word 'a'
- e: .word 'Z'
- f: .word 'z'
- tekst:
- .asciz "Nemoj pritiskati samo slova! Ima jos znakova na tipkovnici."
- * Napisati asemblerski program koji unosi 5
- jednoznamenkastih brojeva (0-9) te
- nakon toga ispisati najveæi i najmanji
- uneseni broj. Pri unosu potrebno je
- zanemariti znakove koji nisu brojevi.
- Traženje najveæeg i najmanjeg broja
- realizirati kroz procedure.
- .global _start
- .text
- _start:
- MOV sp, #stack_top
- LDR R0,br1
- LDR R1,br2
- LDR R2,br3
- LDR R3,br4
- LDR R4,br5
- LDR R14,a
- CMP R14,#'a'
- BEQ min
- min:
- CMP R0,R1
- MOVLT R9,R0
- CMP R1,R0
- MOVLT R9,R1
- CMP R2,R3
- MOVLT R5,R2
- CMP R3,R2
- MOVLT R5,R3
- CMP R5,R9
- MOVLT R10,R5
- CMP R9,R5
- MOVLT R10,R9
- CMP R4,R10
- MOVLT R11,R4
- CMP R10,R4
- MOVLT R11,R10 /*min je u R11*/
- b max
- max:
- CMP R0,R1
- MOVHI R6,R0
- CMP R1,R0
- MOVHI R6,R1
- CMP R2,R3
- MOVHI R7,R2
- CMP R3,R2
- MOVHI R7,R3
- CMP R6,R7
- MOVHI R8,R6
- CMP R7,R6
- MOVHI R8,R7
- CMP R4,R8
- MOVHI R12,R4
- CMP R8,R4
- MOVHI R12,R8 /*max u R12*/
- b stop
- stop:
- b stop
- br1: .word 2
- br2: .word 7
- br3: .word 6
- br4: .word 5
- br5: .word 1
- a: .asciz "a"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement