美元结尾的字符串 [英] dollar-terminated strings

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

问题描述

在我的汇编语言课,我们的第一项任务是写一个程序,打印出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

据我了解,$符号用于像空确实在C.但我做,如果我想提出一个美元符号的字符串(如我想打印出它的成本$ 30什么终止刺痛)?这似乎是一个简单的问题,但我的教授不知道答案,似乎我不使用谷歌搜索来找到它。

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的×09 服务以显示 $ 的迹象,你需要使用 0×02 。请参见这里

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

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

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