美元终止的字符串 [英] dollar-terminated strings

查看:218
本文介绍了美元终止的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的汇编语言类中,我们的第一个任务是编写一个程序,在DOS中打印一个简单的美元终止字符串。它看起来像这样:

In my assembly language class, our first assignment was to write a program to print out a simple dollar-terminated string in DOS. It looked something like this:

BITS 32
    global _main

section .data
    msg db "Hello, world!", 13, 10, ’$’

section .text
_main:
mov ah, 9
mov edx, msg
int 21h
ret

根据我的理解,$ sign如果我想在字符串中插入一个美元符号,我该怎么办(就像我想打印出来的花费$ 30)?这似乎是一个简单的问题,但我的教授不知道答案,我似乎没有找到它使用google搜索。

As I understand it, the $ sign serves to terminate the sting like null does in C. But what do I do if I want to put a dollar sign in the string (like I want to print out "it costs $30")? This seems like a simple question, but my professor didn't know the answer and I don't seem to find it using a google search.

推荐答案

您不能使用DOS的 0x09 服务显示 $ 标志,您需要使用 0x02 。请参见此处

You can't use DOS's 0x09 service to display $ signs, you'll need to use 0x02. See here.

这篇关于美元终止的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆