16位有符号整型数据的输出~~~~
来源:互联网 发布:昆山ug编程培训学费 编辑:程序博客网 时间:2024/06/04 18:34
;-----------------------------------------------------------------------------
; __write_int_
; ==========================
;
;Proc For write a int decimal to screen, int data in BX
;-----------------------------------------------------------------------------
__write_int_ proc near
push cx
push ax
;process if negtive
mov ax, bx
not ax
test ah, 10000000B
jne not_negative_w ;not negative
mov dl, '-'
mov ah, 02h
int 21h
neg bx
not_negative_w:
mov cx, 10000d ;divide by 10000
mov ax, bx ;data in bx, mov to ax
call __dec_div_
mov cx, 1000d
mov ax, bx
call __dec_div_
mov cx, 100d
mov ax, bx
call __dec_div_
mov cx, 10d
mov ax, bx
call __dec_div_
mov cx, 1d
mov ax, bx
call __dec_div_
;linefeed and carriage after out put a data
mov ah, 2h
mov dl, 0ah ;linefeed
int 21h
mov dl, 0dh ;carriage return after read
int 21h
;
pop ax
pop cx
ret ;return form _write_int_
;-----------------------------------------------------------------------------
; __dec_div_
; ==========================
;
;Subroutine to divide number in BX by number in CX
;print quotient on screen, (numberator in DX+AX, denom in CX)
;-----------------------------------------------------------------------------
__dec_div_ proc near
;
mov ax, bx ;number low half
mov dx, 0 ;zero out high half
div cx ;divide by CX
mov bx, dx ;remainder into BX
mov dl, al ;quotient into DL
;print the contents of DL on screen
add dl, 30h ;convert to ASCII
mov ah, 2h
int 21h
ret
__dec_div_ endp ;end of proc __dec_div_
;-----------------------------------------------------------------------------
__write_int_ endp ;end of proc __write_int_
;
;-----------------------------------------------------------------------------
;
codesg ends ;end of code segment
;*****************************************************************************
end begin ;end assembly
;
; __write_int_
; ==========================
;
;Proc For write a int decimal to screen, int data in BX
;-----------------------------------------------------------------------------
__write_int_ proc near
push cx
push ax
;process if negtive
mov ax, bx
not ax
test ah, 10000000B
jne not_negative_w ;not negative
mov dl, '-'
mov ah, 02h
int 21h
neg bx
not_negative_w:
mov cx, 10000d ;divide by 10000
mov ax, bx ;data in bx, mov to ax
call __dec_div_
mov cx, 1000d
mov ax, bx
call __dec_div_
mov cx, 100d
mov ax, bx
call __dec_div_
mov cx, 10d
mov ax, bx
call __dec_div_
mov cx, 1d
mov ax, bx
call __dec_div_
;linefeed and carriage after out put a data
mov ah, 2h
mov dl, 0ah ;linefeed
int 21h
mov dl, 0dh ;carriage return after read
int 21h
;
pop ax
pop cx
ret ;return form _write_int_
;-----------------------------------------------------------------------------
; __dec_div_
; ==========================
;
;Subroutine to divide number in BX by number in CX
;print quotient on screen, (numberator in DX+AX, denom in CX)
;-----------------------------------------------------------------------------
__dec_div_ proc near
;
mov ax, bx ;number low half
mov dx, 0 ;zero out high half
div cx ;divide by CX
mov bx, dx ;remainder into BX
mov dl, al ;quotient into DL
;print the contents of DL on screen
add dl, 30h ;convert to ASCII
mov ah, 2h
int 21h
ret
__dec_div_ endp ;end of proc __dec_div_
;-----------------------------------------------------------------------------
__write_int_ endp ;end of proc __write_int_
;
;-----------------------------------------------------------------------------
;
codesg ends ;end of code segment
;*****************************************************************************
end begin ;end assembly
;
- 16位有符号整型数据的输出~~~~
- 有符号数据的符号位扩展
- 带符号8位整型向带符号16位整型的强制转换
- 关于整型数据符号位扩展的问题
- 关于整型数据符号位扩展的问题 .
- 关于整型数据符号位扩展的问题
- 关于整型数据符号位扩展的问题
- 关于整型数据符号位扩展的问题
- 32位有符号整型举例
- 有符号整型和无符号整型的计算
- 0<0x80000000与0x80000000是32位有符号整型最小值的随记
- 有符号和无符号整型数据溢出问题
- C语言无符号整型的输出
- 16位有符号
- 无符号整型与有符号整型
- 有符号和无符号整型的临界点
- 输入有符号整型数组,去掉重复值后,按照升序输出整型数组
- 如何在FPGA中将AD输出的无符号数据转换为有符号数据
- 吴式太极拳初学答疑难惑
- DarkSpy V1.0.4 by cardmagic
- varchar[(n)] 和nvarchar(n) 及使用unicode的意义
- 汇编实现16位有符号数的输入~~~~~~
- Linux环境下用Java获取CPU的使用率
- 16位有符号整型数据的输出~~~~
- eclipse安装及汉化全过程
- 一些技术文章的收藏链接
- 中关村2小时游^_^
- Windows 程序设计(第5版)不完全勘误表(添加中……)
- 面向对象编程技术(作业题二)
- Vim的行号、语法显示等设置,即.vimrc文件的配置
- 努力的方向
- 第一笔首付款