Monday, January 26, 2009
8086 Programming: TITLE MULTIPLICATION PROGRAM .MODEL SMALL .STACK 100H .DATA MSG1 DB 'ENTER FIRST NUMBER:$' MSG2 DB 'ENTER DECOND NUMBER:$' MSG3 DB 'RESULT IS:$' NUM1 DB ? NUM2 DB ? .CODE MAIN PROC MOV AX,@DATA ;INITIALIZE DAS MOV DS,AX LEA DX,MSG1 ; DISPLAY PROMPT FOR FIRST NUMBER MOV AH,9H INT 21H MOV AH,01H ; READ FIRST NUMBER INT 21H SUB AL,30H ;ASCII ADJUST MOV NUM1,AL CALL NEWLINE LEA DX,MSG2 ; DISPLAY PROMPT FOR FIRST NUMBER MOV AH,9H INT 21H MOV AH,01H ; READ SECOND NUMBER INT 21H SUB AL,30H MOV NUM2,AL MOV AL,NUM1 IMUL NUM2 MOV DL,AL ADD DL,30H MOV NUM2,DL CALL NEWLINE LEA DX,MSG3 ;RESULT PROMPT DISPLAY MOV AH,9H INT 21H MOV AH,02H ;DISPLAY RESULT MOV DL,NUM2 INT 21H MOV AH,4CH ;EXIT DS INT 21H MAIN ENDP NEWLINE PROC MOV AH,02H MOV DL,0DH INT 21H MOV DL,0AH INT 21H RET NEWLINE ENDP END MAIN
0 comments:
Post a Comment