| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 809 人关注过本帖
标题:[求助]这个程序哪出错了?
只看楼主 加入收藏
huhu520hh
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-5-16
收藏
 问题点数:0 回复次数:5 
[求助]这个程序哪出错了?


;EQU STATEMENTS GO HERE
;display equ 2h
;key_in equ 1h
;doscall equ 21h

;*********************************************
HEXIDEC segment
;---------------------------------------------
main proc far
assume cs:HEXIDEC
;Main part of program links subroutines together
START:
;set up stack for return
push ds
sub ax,ax
push ax
;MAIN PART OF PROGRAM GOES HERE
call hexibin
call crlf
;
call binidec
call crlf
;
jmp main
;
ret

main endp

;---------------------------------------------
hexibin proc near

;Sburoutine to convert hex on keybd to binary
; result is left in BX register
mov bx,0

;Get digit from keyboard,convert to binary
newchar:
mov ah,1
int 21H
sub al,30h
jl exit2
emp al,10D
jl add_to
;not digit (0-9),may be letter(a to f)
sub al,27h
cmp al,0ah
jl exit2
cmp al,10h
jge exit2
;is hex digit,add to number in BX
add_to:
mov cl,4
shl bx,cl
mov ah,0
add bx,ax
jmp newchar
exit2:
ret
hexibin endp
;---------------------------------------------
binidec proc near

;Subroutine to convert binary number in BX
; to decimal on console screen

mov cs,10000d
call dec_div
mov cx,1000d
call dec_div
mov cx,100d
call dec_div
mov cx,10d
call dec_div
mov cx,1d
call dec_div
ret

;-----------------------------------------------
dec_div proc near

;Subroutine to divide number in BX by number in CX
;print quotient on screen
;(numberator in DX+AX,denom in CX)

mov ax,bx
mov dx,0
div cs
mov bx,dx
mov dl,al
;print the contents of DL on screen
add dl,30h
mov ah,2H
int 21H
ret

dec_div endp
;-------------------------------------------------
binidec endp
;--------------------------------------------------
crlf proc near

;print carriage return and linefeed
mov dl,0ah
mov ah,2H
int 21H
;
mov dl,0ah
mov ah,2H
int 21H
ret

crlf endp
HEXIDEC ends
;***************************************************
;EDN MAIN
END START

这个是十六进制转十进制的程序

搜索更多相关主题的帖子: equ push part HEXIDEC 
2007-05-29 13:57
huhu520hh
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-5-16
收藏
得分:0 


;EQU STATEMENTS GO HERE
display equ 02h
key_in equ 1h
doscall equ 21h

;*********************************************
HEXIDEC segment
;---------------------------------------------
main proc far
assume cs:HEXIDEC
;Main part of program links subroutines together
START:
;set up stack for return
push ds
sub ax,ax
push ax
;MAIN PART OF PROGRAM GOES HERE
call hexibin
call crlf
;
call binidec
call crlf
;
jmp main
;
ret

main endp

;---------------------------------------------
hexibin proc near

;Sburoutine to convert hex on keybd to binary
; result is left in BX register
mov bx,0

;Get digit from keyboard,convert to binary
newchar:
mov ah,key_in
int doscall
sub al,30h
jl exit2
cmp al,10
jl add_to
;not digit (0-9),may be letter(a to f)
sub al,27h
cmp al,0ah
jl exit2
cmp al,10h
jge exit2
;is hex digit,add to number in BX
add_to:
mov cl,4
shl bx,cl
mov ah,0
add bx,ax
jmp newchar
exit2:
ret
hexibin endp
;---------------------------------------------
binidec proc near

;Subroutine to convert binary number in BX
; to decimal on console screen

mov cx,10000d
call dec_div
mov cx,1000d
call dec_div
mov cx,100d
call dec_div
mov cx,10d
call dec_div
mov cx,1d
call dec_div
ret

;-----------------------------------------------
dec_div proc near

;Subroutine to divide number in BX by number in CX
;print quotient on screen
;(numberator in DX+AX,denom in CX)

mov ax,bx
mov dx,0
div cx
mov bx,dx
mov dl,al
;print the contents of DL on screen
add dl,30h
mov ah,display
int doscall
ret

dec_div endp
;-------------------------------------------------
binidec endp
;--------------------------------------------------
crlf proc near

;print carriage return and linefeed
mov dl,0ah
mov ah,display
int doscall
;
mov dl,0ah
mov ah,display
int doscall
ret

crlf endp
HEXIDEC ends
;***************************************************
;EDN MAIN
END START

修改了小错误 正确的
哎 为什么我每次提问最后都只能被我自己解决呢?
为什么没人HELP呢?

2007-05-29 14:12
菜鸟上路
Rank: 4
等 级:贵宾
威 望:14
帖 子:1120
专家分:0
注 册:2006-3-21
收藏
得分:0 
因为你没讲代码的功能,而且代码很长

2007-05-29 14:20
爱以走远
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:52
帖 子:7542
专家分:21
注 册:2007-3-16
收藏
得分:0 

   好好活着,因为我们会死很久!!!
2007-05-29 18:08
huhu520hh
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-5-16
收藏
得分:0 
那不是有英文说明么  
2007-05-29 18:23
zhulei1978
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
收藏
得分:0 
是清华的<<BM-PC汇编语言程序设计>>里的

其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-05-29 21:53
快速回复:[求助]这个程序哪出错了?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017699 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved