为什么输出的字符有乱码?
.386
.model small
.stack 4096
code segment
assumecs:code, ds:code
org 100h
start:jmp begin
string db 'Hello world! ', '$ '
begin:movax, code
movds, ax
leadx,string
movah, 09h
int21h
movah, 4Ch
int21h
codeends
endstart
我在XP的控制台下编译链接都通过,但执行时除了输出Hello world!外还输出一些乱码?用的是MASM6.15+XPSP2.这种16位的MS-DOS程序是不是XP下执行有问题?
谢谢
[解决办法]
datasegment
string db 'Hello world! ', '$ '
dataends
code segment
assumecs:code,ds:data
start:
mov ax,seg string
mov ds,ax
mov dx,offset string
mov ah,09h ;输出字符串 DS:DX=字符串
int 21h
movah, 4Ch
int21h
codeends
endstart
你试试这个吧~~
[解决办法]
楼上的,我试了一下,还是不行啊
[解决办法]
;.386
.model small
.stack 4096
code segment
assume cs:code, ds:code
org 100h
start:jmp begin
string db 'Hello world! ', '$ '
begin: mov ax, code
mov ds, ax
lea dx,string
mov ah, 09h
int 21h
mov ah, 4Ch
int 21h
code ends
end start
这样[把.386去掉]即可。。