;功能:在数据段定义一个DW类型的数据,编写程序将其以十进制形式在屏幕上显示。
;编程:fasmfan
;时间:2018.12.14
;---------------
TITLE t9999.asm
NAME t9999
PAGE 55,132
STACK segment para STACK 'STACK'
db 4 dup('mystacks')
STACK ends
_DATA segment word public 'DATA'
dat1 dw 5678h
_DATA ends
_TEXT segment word public 'CODE'
assume cs:_TEXT,ds:_DATA,ss:STACK
main proc far
mov ax,_DATA
mov ds,ax
mov ax,[dat1]
call disp_decimal
mov ah,4ch
mov al,0
int 21h
main endp
;================================================
disp_decimal proc near
mov bx,10
xor cx,cx
lab9078:
xor dx,dx
div bx
push dx
inc cx
cmp ax,0
jnz lab9078
mov ah,2h
lab9079:
pop dx
add dl,'0'
int 21h
loop lab9079
ret
disp_decimal endp
_TEXT ends
end main
;编程:fasmfan
;时间:2018.12.14
;---------------
TITLE t9999.asm
NAME t9999
PAGE 55,132
STACK segment para STACK 'STACK'
db 4 dup('mystacks')
STACK ends
_DATA segment word public 'DATA'
dat1 dw 5678h
_DATA ends
_TEXT segment word public 'CODE'
assume cs:_TEXT,ds:_DATA,ss:STACK
main proc far
mov ax,_DATA
mov ds,ax
mov ax,[dat1]
call disp_decimal
mov ah,4ch
mov al,0
int 21h
main endp
;================================================
disp_decimal proc near
mov bx,10
xor cx,cx
lab9078:
xor dx,dx
div bx
push dx
inc cx
cmp ax,0
jnz lab9078
mov ah,2h
lab9079:
pop dx
add dl,'0'
int 21h
loop lab9079
ret
disp_decimal endp
_TEXT ends
end main