;主程序
data segment
numb dd 12306
strbuf db 8 dup(0)
data ends
stack segment
db 128 dup(?)
stack ends
code segment
assume cs:code
start:
mov ax,numb
mov dx,numb+2
mov ax,seg strbuf
mov es,ax
mov ds,ax
mov di,offset strbuf
mov si,di
cli
call uN32toHex
PrintStr
mov ax,4c00h
int 21h
code ends
;converts an unsigned 32-bit value to its string
;未限制进制,就按简单的来吧!
;输入
;dx:ax<-unsigned 32-bit value
;es:di<-buffer for string
;设置DF
;输出
;none
uN32toHex pro
MOV CL,4
XCHG AX,DX
CALL AX2HEX
XCHG AX,DX
CALL AX2HEX
uN32toHex endp
AX2HEX pro
PUSH BX
MOV BX,AX
XCHG AL,AH
ROL AL,CL
CALL AL2Hex
MOV AL,AH
CALL AL2Hex
MOV AL,BL
ROL AL,CL
CALL AL2Hex
MOV AL,BL
CALL AL2Hex
POP BX
AX2HEX endp
AL2Hex pro
AND AL,0FH
CMP AL,9
JA L9
OR AL,30H
JMP exit
L9:
SUB AL,9
AND AL,40H
exit:
STOSB
AL2Hex endp
;print masm macro
PrintStr macro
mov ah,2
mov cx,8
dsploop:
lodsb
int 21h
loop dsploop
endm
楼主高分,赞一个.
这个问题是生成OBJ的时候报错还是什么时候报错?
要是有源码就更美了.