- 68
- 0
- 约2.77千字
- 约 3页
- 2017-06-08 发布于重庆
- 举报
汇编32位无符号整数转字符串输出
字体放大即可看清源代码,缩小是为了排版
.386
.model flat, stdcall
option casemap :none
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
include \masm32\macros\macros.asm
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\kernel32.lib
.data
buffer db 256 dup ? ;
message db value overflow,please check code,0;
message1 db The unsigned 32bit value ,0;
message2 db represented by decimal string is ,0;
number_of_32bit dd 1座机电话号码h ;You can change the value of unsigned number in here.
.code
int_to_string proc value:DWORD ;Design a function that exchange unsigned 32bit number to string and output mov edi,offset buffer; ;Transmit the address of buffer to edi; mov eax,value; ;Transmit unsigned 32bit number to eax xor ecx,ecx; ;Reset the ecx mov ebx,10; ;Transmit 10 to ebx and ebx used to be divisor again: xor edx,edx; ;Reset the edx div ebx; ;eax/ebx,The quotient is transmited to eax and remainder is transmited to edx jo overflow; ;check overflow push edx; ;push the edx remainder into stack inc ecx; ;ecx ecx+1 test eax,0ffffffffh; ;cmp eax,0 je output; ;if eax 0,goto output jmp again; ;circulate overflow: print ADDR message; ;Handle overflow interrupt:jmp interrupt; ;drop-dead halt,express message to user and wait user to handle; output: pop edx; ;pop data to edx; add edx,30h; ;Exchange edx to string exploit the ASCII mov [edi],edx; ;Move edx to memory address edi inc edi; ;address+1 loop output; ;if ecx 0,circulate print ADDR message1; ;Print message print ADDR buffer; print ADDR message2; print ADDR buffer; jmp interrupt; ;Goto drop-dead halt,express message to user and wait user to handle; ret;
int_to_string endp;
start: invoke int_to_string,number_of_32bit; invoke ExitProcess,0;
end start;
Lab1-Report
My application does’nt support input the unsigned 32-bit number from keybored.But you can change the value by modify source ,it’s so easy.
It’s a pity ,my source code only can pass the compile in masm32,I try compile it in masm5.0 and masm611,But there are many e
您可能关注的文档
最近下载
- (高清版)DB31∕T 1487-2024 国际医疗服务规范.docx VIP
- 精益管理措施在医院手术室医用耗材管理中的应用.pdf VIP
- 2026及未来5年中国商务男装市场运行态势及战略咨询报告.docx
- 泸州市高2023级(2026届)高三(一诊)数学试题(含标准答案).pdf
- 新城地产商开目标成本主要科目价格测算标准-定稿.pptx VIP
- 12月1日艾滋病宣传日活动方案模板(集锦5篇).docx VIP
- 2024年湖南铁道职业技术学院单招计算机测试模拟题库必考题.docx VIP
- 遗产分割起诉状.docx VIP
- 2021年重庆市中考物理真题(a卷).pdf VIP
- 2025年度民主生活会对照检查材料8篇五个带头合集.docx VIP
原创力文档

文档评论(0)