Created
April 15, 2019 14:28
-
-
Save Karl-Han/0887f6242c1e82859a39232407cb6946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data segment | |
one_word dw 0110111000101001B | |
data ends | |
stack1 segment para stack | |
dw 10h dup(0) | |
stack1 ends | |
codeseg segment | |
start: | |
assume cs:codeseg, ds:data, ss:stack1 | |
mov ax, data | |
mov ds, ax | |
xor dx, dx | |
mov cx, 16 | |
mov bx, one_word | |
lower: | |
shl bx, 1 | |
adc dx, 0 | |
loop lower | |
cmp dx, 10 | |
jl single | |
two_char: | |
push dx | |
mov dx, '1' | |
mov ah, 02h | |
int 21h | |
pop dx | |
sub dx, 10 | |
single: | |
add dx, '0' | |
mov ah, 02h | |
int 21h | |
mov ah, 4ch | |
int 21h | |
codeseg ends | |
end start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment