{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

programb56

# programb56 - dispchar al m2 endm dispchar macro arg 11 mov...

This preview shows pages 1–2. Sign up to view the full content.

Microprocessors & Applications (UPTU) Appendix B Explanation : For Binary-ASCII conversion. (i) Multiply the binary number by increasing powers of 2 i.e.2 0 , 2 1 , 2 2 …. Starting from LSB e.g. to convert “0000 1010” to ASCII = 0* 2 0 + 1*2 1 + 0 * 2 2 + 1*2 3 + 0*2 4 + 0*2 5 + 0*2 6 + 0*2 7 = 0 + 2 + 0 + 8 + 0 + 0 + 0 + 0 = 10 10 is the ASCII equivalent of “(0000 1010 B)”. ØØ Algorithm : Step I : Get the number whose ascii code equivalent is to be found. Step II : Multiply the number by powers of 2. Step III : Stop. ØØ Flowchart : Refer flowchart 56. ØØ Program : ;Program for ASCII to Binary conversion .model small disp macro arg mov al, arg and al, 0f0H mov cl, 04H ror al, cl dispchar al, m1 mov al, arg and al, 0fH

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: dispchar al, m2 endm dispchar macro arg, 11 mov dl, arg cmp dl, 09H jle l1 add dl, 07H l1: add dl, 30h mov ah, 02H int 21h endm .data a db "00001010B" res db ? ans db ? cnt db ? Flowchart 56 .code Microprocessors & Applications (UPTU) Appendix B mov ax, @data ; Initialize data section mov ds, ax mov al, a ; Load number1 in al mov cl, 07H lea si, a up : mov cnt, cl call power mov bl, res mov al, [si] sub al, 30H mul bl add ans, al inc si dec cl jnz up disp ans mov ah, 4Ch int 21h power proc near mov ch, cnt mov bl, 01 up1: mov al, 02h mul bl mov bl, al dec ch cmp ch, 00 jnz up1 mov res, bl ret power endp end ØØ Result : 0A...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

programb56 - dispchar al m2 endm dispchar macro arg 11 mov...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online