How To Get Nibble In Al Register
Explanation :
·
Allow the 8 bit number be in the AL register. Nosotros have to mask the lower nibble, ie we have to separate the lower nibble. In the consequence only MSB number should remain.
eg. : AL = 5B H. | 0101 | 1011 | |
Logically AND with F0 H | 1111 | 0000 | |
0101 | 0000 | = fifty H. |
Result = fifty H. B is masked
Display the issue.
ØØ Algorithm :
Footstep I : Load the number in AL.
Stride II : Mask belfry crumb i.east. AND AL, 0F0 H.
Step Iii : Display outcome.
Step IV : End.
ØØ Flowchart : Refer flowchart three.
ØØ Program :
.model modest Flowchart 3
.data
a dw 0012H
.lawmaking
mov ax, @information ; Initialize information section
mov ds, ax
mov ax, a ; Load number1 in ax
and al, 0f0h ; mask lower crumb.Result in al
mov ch, 02h ; Count of digits to exist displayed
mov cl, 04h ; Count to gyre by 4 bits
mov bh, al ; Result in reg bh
l2: rol bh, cl ; roll bl so that msb comes to lsb
mov dl, bh ; load dl with data to be displayed
and dl, 0fH ; get only lsb
cmp dl, 09 ; bank check if digit is 0-nine or letter A-F
jbe l4
add dl, 07 ; if letter add 37H else but add 30H
l4: add together dl, 30H
mov ah, 02 ; Role ii under INT 21H (Display character)
int 21H
dec ch ; Decrement Count
jnz l2
mov ah, 4ch
int 21h
end
ØØ Issue :
C:\programs>tasm lownib.asm
Turbo Assembler Version iii.0 Copyright (c) 1988, 1991 Borland International
Assembling file: lownib.asm
Error letters: None
Alert letters: None
Passes: 1
Remaining memory: 438k
C:\programs>tlink lownib.obj
Turbo Link Version 3.0 Copyright (c) 1987, 1990 Borland International
Alert: No stack
C:\programs>lownib
10
C:\programs>
Virtually The Author: admin
Source: http://codeables.blogspot.com/2013/08/8086-program-to-mask-lower-nibble.html
Posted by: mcgeecontaked.blogspot.com
0 Response to "How To Get Nibble In Al Register"
Post a Comment