Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
975 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...