注册 登录
编程论坛 汇编论坛

紧急求助如何编写5+3在屏幕输出结果8?

TigerLv 发布于 2007-09-19 10:50, 1229 次点击
紧急求助如何编写5+3在屏幕输出结果8?
9 回复
#2
TigerLv2007-09-19 11:05
各位高手帮帮忙哈,小弟刚学的,不会在屏幕上显示结果的操作!
#3
cham2007-09-19 11:32

.386
.model flat,stdcall
option casemap:none

include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib

.const
@szText db '5+3的和:%d',0
@szCaption db '结果',0

.data?
@szNum db 30 dup(?)
.code
start:
xor eax,eax
xor edx,edx
mov eax,3h
mov edx,5h
add eax,edx
invoke wsprintf,addr @szNum,addr @szText,eax
invoke MessageBox,NULL,addr @szNum,addr @szCaption,MB_OK
invoke ExitProcess,NULL
end start

#4
TigerLv2007-09-19 11:39
请问下这是标准的汇编格式吗?感觉上有好多c语言的东西哦,输出不是调用9号命令吗?
#5
爱以走远2007-09-19 11:55
哪个是windows的汇编
直接用两个寄存器里加
加后把数放到dl里
在将ASCII-30H 在输出
over
#6
无理取闹2007-09-19 20:00
16的汇编 我不会
#7
cham2007-09-20 08:49
以下是引用无理取闹在2007-9-19 20:00:13的发言:
16的汇编 我不会

汗,我也忘的差不多了!

#8
zhulei19782007-09-21 18:26
code segment
main proc far
assume cs:code
start:
push ds
sub ax,ax
push ax
mov al,5
mov ah,3
add al,ah
add al,30h
mov dl,al
mov ah,2
int 21h
ret
main endp
code ends
end
#9
TigerLv2007-09-26 11:07
调不通哦,还是无法在屏幕上打印出来呀?
再帮忙看下哦,我那个调用的指令不会使用哦?
谢谢
#10
c3053032272007-09-26 16:21
code segment
main proc far
assume cs:code
start:
push ds
sub ax,ax
push ax
mov al,5
mov ah,3
add al,ah
add al,30h
mov dl,al
mov ah,2
int 21h
ret
main endp
code ends
end start
可以调试出来哦!
1