나는 벽에 부딪쳤을 것으로 보이며 이것에 관해서는 어떤 예제도 찾을 수 없습니다. 아스키 문자를 숫자로 변환해야합니다. 즉, 사용자 유형이 150 + 123
이므로 아스키의 첫 번째 숫자를 읽은 다음 각 숫자에서 0을 빼서 dec로 변환해야합니다. 그러나 여기에 문제가 있습니다. 사용자가 1 자리 또는 5 자리를 입력 할 수 있기 때문에 실제 숫자를 만드는 방법을 모르겠습니다. 코드에서 외국 주석을 무시하십시오. 당신은 (10)에 의해 누적를 곱해야은 숫자 8086 어셈블리에 아스키 숫자를 더할 수 없습니다
.model small
.stack 100h
.data
prompt1 db "Please enter an action: ", 10, 13, "$"
prompt2 db "Answer: ", 10, 13, "$"
newline db 10, 13, '$'
buffer db 255 ; Denotes the number of maximal symbols hope
sizeread db 0 ; It will be available on how many characters scanned
buffer_data db 255 dup (?) ; It will be hosted on-line scanned data to fill 255 characters $
.code
start:
mov dx, @data ;
mov ds, dx ;
print_prompt:
mov ah, 9
mov dx, offset prompt1 ; Messages placed in the DX register address
int 21h ; welcome petraukimą
ret
input:
mov ah, 0Ah
mov dx, offset buffer
int 21h
ret
number:
xor bx,bx
xor ax,ax
mov al, 10 ;set al to 0 so i can MUL
mov cx, 5
loopstart: ;start the cycle
cmp [buffer_data+bx], ' ' ;check if I reached a space
je space ; jump to space (the space func will read the + or - sign later on)
mov bx, [bx+1] ; bx++
;Now i got no idea how to go about this....
space:
end start
[이 질문을 참조하십시오 (http://stackoverflow.com/questions/26337518/how-can-i-make-10000-1000-100-from-10-the-easiest-way/26339409). – Jester