assembly - Type character and print its code with Assembler -
i trying print code of character(in latin) has been typed in console. here code (using tasm):
.model tiny .code org 100h begin: mov ah,01h int 21h or al,30h mov ah,2 mov dl,al int 21h ret end begin
but doesn't work, see screenshot below( first character input , output)
thanks in advance!
my os: windows xp 32-bit
processor: intel(r) core(tm) i3 cpu m 350 x86_64
this simple code output ascii's 0 99.
mov ah,01h int 21h aam xchg al, ah add ax, 3030h mov dx, ax mov ah,2 int 21h mov dl, dh int 21h
to output in hex (allows 256 codes shown) use
mov ah, 01h int 21h aam 16 xchg al, ah add ax, 3030h mov dx, ax cmp dl, "9" jbe ok1 add dl, 7 ok1: mov ah, 02h int 21h mov dl, dh cmp dl, "9" jbe ok2 add dl, 7 ok2: int 21h
if assembler doesn't know aam 16
can replace db 0d4h,10h
Comments
Post a Comment