2 자리 또는 3 자리 숫자를 산출 할 2 자리 숫자 2 개를 추가하려고합니다. 여기 조립 부
내가 지금까지 가지고 있고, 내가 캐리를 인쇄하려고하면, 그것은 "부동에 대한 (코어 덤프) 부동 소수점 예외section .data
msg db "Enter 2 numbers: "
msgLen equ $-msg
section .bss
numa1 resb 1
numa2 resb 1
numb1 resb 1
numb2 resb 1
carry resb 1
section .text
global _start
_start:
;print message
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, msgLen
int 80h
;accept first number (1st digit)
mov eax, 3
mov ebx, 0
mov ecx, numa1
mov edx, 1
int 80h
;accept first number (2nd digit)
mov eax, 3
mov ebx, 0
mov ecx, numa2
mov edx, 2
int 80h
;accept second number (1st digit)
mov eax, 3
mov ebx, 0
mov ecx, numb1
mov edx, 1
int 80h
;accept second number (2nd digit)
mov eax, 3
mov ebx, 0
mov ecx, numb2
mov edx, 2
int 80h
;character to number conversion
sub byte[numa1], 30h
sub byte[numa2], 30h
sub byte[numb1], 30h
sub byte[numb2], 30h
sub byte[carry], 30h
;;;;;;;;;;;;;;;;;;;;;;;;;;
;add ones digit
mov al, [numa2]
add byte[numb2], al
add byte[numb2], 30h
;get carry of sum of ones digit
mov ax, [numb2]
mov byte[carry], 10
div byte[carry]
mov eax, 4
mov ebx, 1
mov ecx, carry
mov edx, 1
int 80h
mov eax, 1
mov ebx, 0
int 80h
carry
numa1 numa2
+ numb2 numb2
---------------
numb2
where numb2 = numb2 % 10
carry = numb2/10
어떤 OS입니까? 리눅스? –
예, 미안하다고 언급하는 것을 잊었습니다. 32bit Linux –
예외를 생성하는 행은 무엇입니까? 예외를 발생시킨 명령의 매개 변수는 무엇입니까? 일부 지침에는 암시 적 매개 변수가 있음에 유의하십시오. –