Skip to content

Instantly share code, notes, and snippets.

@Karl-Han
Created April 15, 2019 14:16
Show Gist options
  • Save Karl-Han/f7603e5b9ec9f4a6b13b30dcfe10289b to your computer and use it in GitHub Desktop.
Save Karl-Han/f7603e5b9ec9f4a6b13b30dcfe10289b to your computer and use it in GitHub Desktop.
data segment
BCD db 04h
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
; All initialized.
mov dl, BCD
; High 4 bits, 0 will be discard
test dl, 0f0h
jz done
mov cl, 4
shr dl, cl
and dl, 00fh
add dl, 30h
mov ah, 2
int 21h
; Low 4 bits
mov dl, BCD
and dl, 00fh
add dl, 30h
mov ah, 2
int 21h
done:
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