Skip to content

Instantly share code, notes, and snippets.

@PhiBabin
Created March 13, 2014 16:55
Show Gist options
  • Select an option

  • Save PhiBabin/9532290 to your computer and use it in GitHub Desktop.

Select an option

Save PhiBabin/9532290 to your computer and use it in GitHub Desktop.
dsda
;Philippe Babin PHBAB1 - Mathieu Cloutier MACLO245
NAME main
PUBLIC __iar_program_start
SECTION .intvec : CODE (2)
CODE32
__iar_program_start
B main ;
Mapile DS32 64
MaChaine DC8 "[allojdkasjldk" , 0x00
SECTION .text : CODE (2)
CODE32
main
;MOV SP, #1
;MOV SP, SP, LSL#21
LDR R0, =MaChaine
LDR SP, =Mapile
ADD SP, SP, #256
PUSH {R0} ;Passage de paramètre par la pile
BL VerifieParentheses
POP {R0} ; Récupération du résultat
;---------------------------------------
VerifieParentheses
MOV R2, #0
Boucle
LDRB R1, [R0, R2]
CMP R1, #0x28 ; ( 28
PUSHEQ {R1}
CMP R1, #0x7B ; { 7B
PUSHEQ {R1}
CMP R1, #0x5B ; [ 5B
PUSHEQ {R1}
CMP R1, #0x29 ; ) 29
POPEQ {R1}
CMPEQ R1, #0x28
BEQ
CMP R1, #0x7B ; } 7D
PUSHEQ {R1}
CMP R1, #0x5B ; ] 5D
PUSHEQ {R1}
ADD R2, R2, #1
CMP R1, #0
BNE Boucle
BX LR
;--------------------------------------
;SECTION `.noinit`:DATA(2)
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment