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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| .386
ASSUME ss:pile, cs:code, DS:donnees
pile segment stack use16
DB 1024 Dup(0)
Pile ends
donnees segment use16
acmsg DB "34ee2y7g5$"
donnees ends
code segment use16
main:
mov ax,donnees
mov ds,ax
push ax
push 8
call distinct_ch
mov ah,9
lea dx,acmsg
int 21h
mov ah,4ch
int 21h
distinct_ch:
push bp
mov bp,sp
mov bx,0
debut:
cmp acmsg[bx],'$'
je dist_fin
cmp acmsg[bx],'9'
jbe cond2
jmp inversion
cond2:
cmp acmsg[bx],'0'
jae incre
jmp inversion
incre:
inc bx
jmp debut
inversion:
mov ch,byte ptr acmsg[bx]
mov si,bx
mov di,si
add di,1
bcl_invers:
cmp acmsg[di],'$'
je fait_ret
mov dh,byte ptr acmsg[di]
mov byte ptr acmsg[si],dh
inc si
inc di
jmp bcl_invers
fait_ret:
mov byte ptr acmsg[si],ch
jmp debut
dist_fin:
pop bp
ret 4
code ends
end main |
Partager