sample3 - hex to ascii
title SAMPLE3
subttl Segment/Offset and data example
.model small
.586
cr equ 0dh
lf equ 0ah
data segment ; Data segment
mess1 db ' Data segment value -- $'
crlf db CR,LF,'$'
mess2 db ' Data offset value -- $'
mess3 db ' Data content value -- $'
phyMsg db ' Physical address of Data -- $'
even
data1 dw 1234h
dw 512 dup (?)
tos label word
data ends
code segment
assume cs:code, ds:data, ss:data
sizak:
mov ax,data ; set DS
mov ds,ax
cli ; disable interrupt
mov ss,ax
mov sp,offset tos
sti ; back on interrupt
mov dx,offset mess1
mov ah,9
int 21h
mov ax,seg data1
call ascii
mov dx,offset crlf
mov ah,9
int 21h
mov dx,offset mess2
mov ah,9
int 21h
mov ax,offset data1
call ascii
mov dx,offset crlf
mov ah,9
int 21h
mov dx,offset mess3
mov ah,9
int 21h
mov ax,data1
call ascii
mov dx,offset crlf
mov ah,9
int 21h
mov dx,offset phyMsg
mov ah,9
int 21h
; xor eax, eax
; mov ax, seg data1
mov eax, seg data1
shl eax, 4h
add eax, offset data1
call asciie
mov dx,offset crlf
mov ah,9
int 21h
mov ax,4c00h
int 21h
asciie proc near
push eax
shr eax, 10h
call ascii
pop eax
asciie endp
ascii proc near
push ax
mov al,ah
call asciib
pop ax
asciib proc near
push ax
mov cl,4
shr al,cl
call asciin
pop ax
asciin proc near
and al,0fh
add al,30h
cmp al,3ah
jb ascii1
add al,7
ascii1: mov ah,2
mov dl,al
int 21h
ret
asciin endp
asciib endp
ascii endp
code ends
end sizak
History
Last edited on 05/01/2007 11:06 by persona
Comments (0)