Ajouter un commentaire

tiger360

voici l'enonce http://www.yaronet.com/mirari/get.php?c=78JS

j ai pas fais grand chose
mais j galere un peu pour la mise a jour du plateau
en fait il faut que lorsque le pion ecrase une valeur
qu il la remette a sa place :
au depart le pion est est a la premiere case
ensuite le pion avance et remet bien le nombre precedent
mais apres ca foire


  $  2  3  4  5  6  7  8  9 10
 36 37 38 39 40 41 42 43 44 11
 35 64 65 66 67 68 69 70 45 12
 34 63 84 85 86 87 88 71 46 13
 33 62 83 96 97 98 89 72 47 14
 32 61 82 95 *  99 90 73 48 15
 31 60 81 94 93 92 91 74 49 16
 30 59 80 79 78 77 76 75 50 17
 29 58 57 56 55 54 53 52 51 18
 28 27 26 25 24 23 22 21 20 19
 Introduisez une valeur entre 1 et 6
5
  1  2  3  4  5 $   7  8  9 10
 36 37 38 39 40 41 42 43 44 11
 35 64 65 66 67 68 69 70 45 12
 34 63 84 85 86 87 88 71 46 13
 33 62 83 96 97 98 89 72 47 14
 32 61 82 95 *  99 90 73 48 15
 31 60 81 94 93 92 91 74 49 16
 30 59 80 79 78 77 76 75 50 17
 29 58 57 56 55 54 53 52 51 18
 28 27 26 25 24 23 22 21 20 19
 Introduisez une valeur entre 1 et 6
1
  1  2  3  4  5 $  $   8  9 10
 36 37 38 39 40 41 42 43 44 11
 35 64 65 66 67 68 69 70 45 12
 34 63 84 85 86 87 88 71 46 13
 33 62 83 96 97 98 89 72 47 14
 32 61 82 95 *  99 90 73 48 15
 31 60 81 94 93 92 91 74 49 16
 30 59 80 79 78 77 76 75 50 17
 29 58 57 56 55 54 53 52 51 18
 28 27 26 25 24 23 22 21 20 19

et voila le fichier


section .data

plateau  db   "  1","  2","  3","  4","  5","  6","  7","  8","  9"," 10","  ",10
		   db	" 36"," 37"," 38"," 39"," 40"," 41"," 42"," 43"," 44"," 11","  ",10
		   db	" 35"," 64"," 65"," 66"," 67"," 68"," 69"," 70"," 45"," 12","  ",10
		   db	" 34"," 63"," 84"," 85"," 86"," 87"," 88"," 71"," 46"," 13","  ",10
		   db	" 33"," 62"," 83"," 96"," 97"," 98"," 89"," 72"," 47"," 14","  ",10
		   db   " 32"," 61"," 82"," 95"," * "," 99"," 90"," 73"," 48"," 15","  ",10
		   db	" 31"," 60"," 81"," 94"," 93"," 92"," 91"," 74"," 49"," 16","  ",10
	      db	" 30"," 59"," 80"," 79"," 78"," 77"," 76"," 75"," 50"," 17","  ",10
		   db	" 29"," 58"," 57"," 56"," 55"," 54"," 53"," 52"," 51"," 18","  ",10
		   db	" 28"," 27"," 26"," 25"," 24"," 23"," 22"," 21"," 20"," 19","  ",10

taille   equ $-plateau

parcours db 0,1,2,3,4,5,6,7,8,9,20,31,42,53,64,75,86,97,108,107,
         db 106,105,104,103,102,101,100,99,88,77,66,55,44,33,22,11,12,13,14,
			db 15,16,17,18,19,30,41,52,63,74,85,96,95,94,93,92,91,90,89,78,
			db 67,56,45,34,23,24,25,26,27,28,29,40,51,62,73,84,83,82,81,80,
			db	79,68,57,46,35,36,37,38,39,50,61,72,71,70,69,58,47,48,49,60,59
																

phr   	db	" Introduisez une valeur entre 1 et 6 ", 10
tai      equ $-phr
TROIS    equ 3 
position  db  0


section .bss

valde	resb	1		
;position resb	1
tmp resw  1

section .code

global main

main: 

;******************************** 
; pour la sauvegarde du plateau initiale                                            
xor ebp,ebp                                                                     
mov  ebp,[plateau]                                                            
;********************************																		 
mov  ebp,[plateau] 																	
; plateau avec le pion a la case 0
mov bh,'$'
mov bl,' '
mov eax,0
mov [plateau],bl
mov [plateau+1],bl
mov [plateau+2],bh

mov eax, 4           ;  affichage du plateau
mov ebx, 1
mov ecx,plateau
mov edx,taille
int 0x80



NOK:

mov [plateau],ebp

mov eax, 4           ;  affichage  de la phrase 
mov ebx, 1				
mov ecx,phr		
mov edx,tai		
int 0x80			

mov eax,3           ; lecture au clavier de la valeur du de
mov ebx,0		
mov ecx,valde 			
mov edx,100			
int 0x80


@si:
    
	cmp eax,2
	ja NOK
	cmp byte[valde],'1'
   jb NOK
	suite:
	cmp byte[valde],'6'
   ja NOK


mov bh,'$'
mov bl,' '

;mov byte [position],0
mov al,byte [valde]
sub byte al ,30h   ; Permet le passage du code ascii au code normal
add byte [position],al 
mov al,byte [position]


; parcours du tableau "parcours"
xor ecx,ecx
mov cl,[parcours+eax]   


mov [plateau+ecx*TROIS],bl
mov [plateau+ecx*TROIS+1],bh
mov [plateau+ecx*TROIS+2],bl

mov eax, 4           ;  affichage du plateau
mov ebx, 1
mov ecx,plateau
mov edx,taille
int 0x80


jmp NOK

mov eax,1
mov ebx,0
int 0x80

Filtered HTML

Plain text

CAPTCHA
Cette question permet de vérifier que vous n'êtes pas un robot spammeur :-)
 ZZZZZ   QQQ    PPPP   M   M  III 
Z Q Q P P MM MM I
Z Q Q PPPP M M M I
Z Q QQ P M M I
ZZZZZ QQQQ P M M III
Q