本人最近刚开始学汇编,装的是 masm8.2 安装完后,不知如何使用???
在 project 菜单下点击命令来运行过例题,但输入的书上的程序不能运行,没有任何反应.
书上的例题是以masm5.0为基础.
附程序如下:
prognam segment ;define code segment
main proc far
assume cs: prognam
start: ;starting execution addr
;set up stack for return
push ds ;save old data segment
sub ax,ax ;put zero in AX
push ax ;save zero on stack
;main part of program
mov ch,4 ;number of digits
rotate: mov cl,4 ;set count to 4 bits
rol bx,cl ;left digit to right
mov al,bl ;move to AL
and al,0fh ;mask off left digit
add al,30h ;convert hex to ASCII
cmp al,3ah ;is it>9?
jl printit ;jump if digit = 0 to 9
add al,7h ;digit is A to F
printit:
mov dl,al ;put ASCII char in DL
mov ah,2 ;display output funct
int 21h ;call DOS
dec ch ;done 4 digits?
jnz rotate ;not yet
ret ;return to DOS
main endp ;end of main part of prog.
prognam ends ;end of segment
end ;end of assembly