3
我的任務是比較ASM中的兩個數字。我輸入第一個數字(二進制)和第二個(二進制)。我必須比較Z1和Z2。如果Z1> = Z2,則顯示TRUE,否則顯示爲FALSEASM比較2個數字
dane segment
txt1 db 'First number: $'
txt2 db 'Secend number: $'
z1 dw 0
z2 dw 0
prawda db 'True!$'
falsz db 'False!$'
dane ends
sts segment stack
db 256 dup(?)
sts ends
program segment
assume cs:program, ss:sts, ds:dane
start:
mov ax, seg dane
mov ds,ax
mov dx, offset txt1
mov ah, 9
int 21h
mov cx, 16
mov bx, offset z1
petla1:
mov ah, 1
int 21h
mov [bx], al
inc bx
loop petla1
mov cx, 16
mov ax, 0
mov bx, offset z1
petla2:
shl ax, 1
mov dl, [bx]
cmp dl, 31h
jne dal1
add ax, 1
dal1:
inc bx
loop petla2
mov dx, offset txt2
mov ah, 9
int 21h
mov cx, 16
mov bx, offset z1
petla3:
mov ah, 1
int 21h
mov [bx], al
inc bx
loop petla3
mov cx, 16
mov ax, 0
mov bx, offset z1
petla4:
shl ax, 1
mov dl, [bx]
cmp dl, 31h
jne dal2
add ax, 1
dal2:
inc bx
loop petla4
;JGE, >= JNL not <
mov ax, [z1]
mov bx, [z2]
cmp ax,bx
jge ety
mov ah, 9
mov dx, offset falsz
int 21h
jae koniec
ety:
mov ah,9
mov dx, offset prawda
int 21h
koniec:
mov ah, 4ch
int 21h
program ends
end start
我做錯了什麼?這是我的第一個彙編程序項目