TASM Program to MultiplyTwo 16 Bit Numbers
On-campus and online computer science courses to Learn the basic concepts of Computer Science.This tutorial will cover c ,c++, java, data structure and algorithm,computer graphics,microprocessor,analysis of algorithms,Digital Logic Design and Analysis,computer architecture,computer networks,operating system.
TASM Program :Data Segment msg db 0dh,0ah,"Enter a 16-bit number: $" result db 0dh,0ah,"The Result is: $" newl db 0dh,0ah," $" mul_res_h dw ? mul_res_l dw ? Data ends Code Segment assume CS:Code,DS:Data Start: mov ax,Data mov DS,ax mov dx,offset msg ;mul16 mov ah,09h int 21h call AcceptNum mov ch,bl call AcceptNum mov cl,bl mov dx,offset msg mov ah,09h int 21h call AcceptNum mov dh,bl call AcceptNum mov dl,bl mov ax,cx mov bx,dx mul bx mov mul_res_l,ax mov mul_res_h,dx mov dx,offset result mov ah,09h int 21h mov ax,mul_res_h mov bl,ah call DispNum mov ax,mul_res_h mov bl,al call DispNum mov ax,mul_res_l mov bl,ah call DispNum mov ax,mul_res_l mov bl,al call DispNum mov ah,4ch int 21h AcceptNum proc mov ah,01h int 21h call HexAccept mov bl,al rol bl,4 mov ah,01h int 21h call HexAccept add bl,al ret endp DispNum proc mov al,bl and al,0f0h ror al,4 mov dl,al call HexDisp mov ah,02h int 21h mov al,bl and al,0fh mov dl,al call HexDisp mov ah,02h int 21h endp HexAccept proc cmp al,41h jc norm sub al,07h norm: sub al,30h ret endp HexDisp proc cmp dl,0ah jc nothex add dl,07h nothex: add dl,30h ret endp Code ends end Startoutput:-
C:\TASM\BIN>tasm mul16.asm Turbo Assembler Version 4.1 Copyright (c) 1988, 1996 Borland International Assembling file: mul16.asm Error messages: None Warning messages: None Passes: 1 Remaining memory: 453k C:\TASM\BIN>tlink mul16.obj Turbo Link Version 7.1.30.1. Copyright (c) 1987, 1996 Borland International Warning: No stack C:\TASM\BIN>mul16 Enter a 16-bit number: 1312 Enter a 16-bit number: 1205 The Result is: 0157A35A --------------------------------
0 comments: