Ecrire un programme qui affiche ton nom
Bonsoir Les amis et Merci a vous ,
bon , je suis presque nouveau concernant La programmation en assembleur
je veux créer un programme qui lit ton nom et ta ville est il écrit comme Exemple :
Je suis "X" et J'habite a y
voila ce que j'ai fait Jusqu'à maintenant.
Code:
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
| %include "asm_io.inc"
segment .data
msg1 db "What is your name : ", 0
msg2 db "where do you live : ", 0
msg3 db "you are ",0
msg4 db "and you Live at " ,0
segment .bss
nam: resd 10 ; Réserve moi 10 caract
city: resd 10
segment .text
global asm_main ; Equivaut a main()
asm_main:
enter 0,0
pusha
mov eax,msg1
call print_string ;affiche Le char dont l'adrres est dans Eax
mov eax,0
call read_char ;La saisi
mov dword [nam],eax ;
mov eax,msg2
call print_string
mov eax,0
call read_char
mov dword [city],eax
mov eax,msg3
call print_string
mov eax,dword [nam]
call print_string
mov eax,msg4
call print_string
mov eax,dword [city]
call print_string
call print_nl
popa
mov eax,0
leave
ret |
:)