Answer to Question #3081 in Assembler for Saeed

Question #3081
Hi , I wrote this assembly code in TASM but when "CL=11" output is "0;" . What is wrong in this code??? (And sorry for my bad english (((((-: ) MOV AL,CL MOV AH,0 I DB 10 DIV I MOV BL,AL MOV BH,AH ADD BL,48 ADD BH,48 MOV AH,02 MOV DL,BH INT 21H MOV DL,BL INT 21H
Expert's answer
MOV AL,CL
MOV AH,0 ;xor ah, ah looks much better
JMP DEF ;!!!!!!!!!!!!!!!!!!!!!
I DB 10 ;Later this memory was read and understood as operation. now it is data.
DEF: ;!!!!!!!!!!!!!!!!!
DIV I
MOV BL,AL
MOV BH,AH
ADD BL,48
ADD BH,48
;in this case number is reversed
MOV AH,02
MOV DL,BH ;change bh on BL
INT 21H
MOV DL,BL ;change bl on BH
INT 21H

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal