Bonjour, voici mon code, je comprend pas pourquoi le cmp ebx,'A' ne fonctionne pas.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
global main
 
extern printf
extern scanf
extern malloc
extern free
extern fopen
extern fclose
extern fscanf
extern fgets
 
section .data
	SIZE EQU 256
	buffer times SIZE db 0
	c dd 0
	com db 'A'
	_in_ dd 0
	opening_mode db "r",0
	nom_fichier db "val.txt",0
	msg db "valeur:%s",10,0
	msg_testc db "car:%c",10,0
	msg_vect db "[%f, %f, %f, %f]",10,0
	msg_fscanf db "%c",10,0
	msg_com db "ceci est un commentaire",10,0
	msg_test db "bug",10,0
	struc Vector
		v_1: resd 1
		v_2: resd 1
		v_3: resd 1
		v_4: resd 1
		v_suivant: resd 1
	endstruc
section .text
 
;------------------------------------------------------------------------------------------------------------------------------
traite_fichier:
	push ebp
	mov ebp,esp
	push dword [_in_]
	push dword SIZE
	push dword buffer
	call fgets
	add esp,12
 
	push dword buffer
	push dword msg
	call printf
	mov ebx,[buffer]
	push dword ebx
	push dword msg_testc
	call printf
 
	cmp ebx,'A'
	jne .endcom
	push dword msg_com
	call printf
	jmp .endcom2
.endcom:
	push dword msg_test
	call printf
.endcom2:
	mov esp,ebp
	pop ebp
	ret
;------------------------------------------------------------------------------------------------------------------------------
main:
	push ebp
	mov ebp,esp
	pushad
	push dword opening_mode
	push dword nom_fichier
	call fopen
	add esp,8
	mov [_in_],eax
	cmp eax,0
	je .end
	call traite_fichier
 
.end:
 
	popad
	mov esp,ebp
	pop ebp