Assembleur 8086_saisie au clavier

Fermé
geraud fj - 4 août 2011 à 18:22
Bonjour

voici mon problème:
j'essaie d'écrire un programme qui réalise une soustraction entre deux nombres entrés au clavier. Pour entrer ces nombres, j'ai essayé d'utiliser le sous programme "scan_num proc near ", un post de Karim66 intitulé Assembleur 8086 présent sur ce forum mais mon compilateur (TASM) ne reconnait pas les instructions "putc ' ' ou putc 8".
Je voudrais savoir que signifient ces instructions et comment corriger mon programme pour qu'il marche avec le compilateur TASM.
voici le programme que j'ai commencé par écrire:

" ;q = ex - dy
.model small
.stack 100h
.data
msg db "Programme qui fait : Q = EX - DY ",10,13,'$'
msge db "Veuillez taper la valeur de E ",10,13,'$'
msgx db "Veuillez taper la valeur de X ",10,13,'$'
msgd db "Veuillez taper la valeur de D ",10,13,'$'
msgy db "Veuillez taper la valeur de Y ",10,13,'$'
msgq db "le resultat est : ",10,13,'$'
e dw ?
x dw ?
d dw ?
y dw ?
q dw ?
make_minus db ?
ten dw 10

.code
main :
mov ax, @data
mov ds, ax

mov dx, offset msg
mov ah, 09h
int 21h

mov dx, offset msge
mov ah, 09h
int 21h
call scan_num
mov e, cx

mov dx, offset msgx
mov ah, 09h
int 21h
call scan_num
mov x, cx

mov dx, offset msgd
mov ah, 09h
int 21h
call scan_num
mov d, cx

mov dx, offset msgy
mov ah, 09h
int 21h
call scan_num
mov y, cx

scan_num proc near
push dx
push ax
push si

mov cx, 0

mov cs:make_minus, 0

next_digit:

mov ah, 00h
int 16h

mov ah, 0eh
int 10h


cmp al, '-'
je set_minus


cmp al, 13
jne not_cr
jmp stop_input

not_cr:
cmp al, 8
jne backspace_checked
mov dx, 0
mov ax, cx
div cs:ten
mov cx, ax
putc ' '
putc 8
jmp next_digit

backspace_checked:
cmp al, '0'
jae ok_ae_0
jmp remove_not_digit

ok_ae_0:
cmp al, '9'
jbe ok_digit

remove_not_digit:
putc 8
putc ' '
putc 8
jmp next_digit

ok_digit:
push ax
mov ax, cx
mul cs:ten
mov cx, ax
pop ax
cmp dx, 0
jne too_big
sub al, 30h
mov ah, 0
mov dx, cx
add cx, ax
jc too_big2
jmp next_digit

set_minus:
mov cs:make_minus, 1
jmp next_digit

too_big2:
mov cx, dx
mov dx, 0

too_big:
mov ax, cx
div cs:ten
mov cx, ax
putc 8
putc ' '
putc 8
jmp next_digit


stop_input:

cmp cs:make_minus, 0
je not_minus
neg cx

not_minus:
pop si
pop ax
pop dx
ret

scan_num endp

mov ax, d
mul y
mov bx, ax
mov ax, e
mul x
sub ax, bx
mov q, ax

mov dx, offset msgq
mov ah, 09h
int 21h
mov dx, q
mov ah, 02h
int 21h

mov ah, 4Ch
int 21h
end main