#汇编语言字符串的输出
dosbox运行时输出乱码,经过检查发现在定义字符串时忘记在后面加上$字符
代码一·
;This is the structure of a main module using complete segment directives
DATA SEGMENT
;......Place data declarations here
str1 DB 'abcdef$'
str2 DB '123456$'
;......
DATA ENDS
STACK SEGMENT STACK
DB 250 DUP(0)
STACK ENDS
CODE SEGMENT 'CODE'
ASSUME CS:CODE,DS:DATA,SS:STACK
START:
MOV AX,DATA
MOV DS,AX
;......Place instructions here
mov dx,offset str1
mov ah,09h
int 21h
mov dx,offset str2
mov ah,09h
int 21h
;......
MOV AH,4CH ;exit
INT 21H
CODE ENDS
END START
代码二
;This is the structure of a main module using simplified segment directives
.MODEL SMALL,C
.STACK 100
.DATA
;......Place data declarations here
str1 DB 'abcdef$'
str2 DB '123456$'
;......
.CODE
.STARTUP
;......Place instructions here
mov dx,offset str1
mov ah,09h
int 21h
mov dx,offset str2
mov ah,09h
int 21h
;......
.EXIT
END