Ich habe ein Problem mit meinem einfachen Programm in der Montage. Ich benutze DOSbox und TASM. Ich habe ein Problem mit dem Programm. Operandentypen passen nicht zu Zeile 76 78 80. Dies ist nach der Multiplikation. Ich habe versucht, einige Änderungen vornehmen, indem Sie difftrent variabler GrößeProgramm lösen Gleichung in Assembly
; --------------------------------------------
; Equation=(a+c*b)/d-2*c,
; --------------------------------------------
.model small
.stack 100h
.data
a db 0
b db 0
c db 0
d db 0
result1 db ?
result2 db ?
message1 db "Equation: (a+c*b)/d-2*c a=$"
message2 db "b=$"
message3 db "c=$"
message4 db "d=$"
message5 db "Result=$"
.code
start: mov ax,@data
mov ds,ax
mov ax, seg message1 ;get a and save to a variable
mov ds,ax
mov dx,offset message1
mov ah, 9h
int 21h
mov ah, 1h
int 21h
sub al,30h ;converting to real number
mov a,al
mov ax, seg message2 ;get b and save to a variable
mov ds,ax
mov dx,offset message2
mov ah, 9h
int 21h
mov ah, 1h
int 21h
sub al,30h ;converting to real number
mov b,al
mov ax, seg message3 ;get c and save to a variable
mov ds,ax
mov dx,offset message3
mov ah, 9h
int 21h
mov ah, 1h
int 21h
sub al,30h ;converting to real number
mov c,al
mov ax, seg message4 ;get d and save to a variable
mov ds,ax
mov dx,offset message4
mov ah, 9h
int 21h
mov ah, 1h
int 21h
sub al,30h ;converting to real number
mov d,al
mov al,b ; (a+c*b) ------------------------error
mul c
add ax,a ; ------------------------error
push ax ;save current ax
mov ax,c ;d-2*c------------------------error
shl ax,2
sub d,ax
pop bx ;get previous ax to bx
div bx ; div ax:bx
mov result1,al
mov result2,ah
add result1,30h ;converting to string
add result2,30h ;converting to string
mov al,result1
mov bl,result2
mov ax, seg message5
mov ds,ax
mov dx,offset message5
mov ah, 9h
int 21h
mov al,result1
mov bl,result2
mov dl, al
mov ah , 2h
int 21h
mov dl, bl
mov ah , 2h
int 21h
mov ax,4C00h
int 21h
end start
Post Code direkt hier. – Carcigenicate
.. und markieren Sie die Zeilen. In den Pasten sind beispielsweise die Zeilen 76 und 80 leer. Ich bezweifle irgendwie den Fehler dort ist ... – Jester
Was sind die größten Zahlen, die Ihr Programm handhaben soll? –