Hello.. I've been trying to create a simple postfix calculator..
Can anyone please tell me how I can input a char in assembly?
i tried using char as a data type but i found out that there's
no such thing as char in assembly..

Please help me.. thanks!

5 Years
Discussion Span
Last Post by loveMii

The "standard/common" lowest element is representing a standard (non-extended) character is the byte.

A byte converts to a char based on its placement in the character map/chart (ASCII if you're using ASCII).

What OS and Compiler are you using?

Edited by thines01: clarity


I'm using a 32-bit Linux and I'm using GNU compiler..

So db is equivalent to a char? so it's as easy as that?
I'll just have to declare a variable as a db data type?

What if I wanna use ASCII? Is that possible?

Thank you for helping me.


So you are using gnu c compiler? such as gcc or g++? How to do inline assembly with gnu compiler may be a little different than how it would be done in a pure assembly source file with *.asm extension. I don't know how its done with that compiler.

Don't confuse ASCII and db instruction. db declares a single byte of data, which can contain any value between 0 and 255. ascii is a character set that falls within that range. There are other character sets, but ascii is the most common for most of us. See this common ascii chart.


So I can't use db if I want to input a '+', '-', '*', '/' signs?


of course you can.

Addsign db '+','$'


Addsign db 2Bh

--> 2Bh being hex value of '+' in ascii character set.

In this way:
char ascii(hex)
'*' ---->2Ah


Is Addsign a label or is it a method or something?

Btw, thank you soo much! You've made things a lot easier for me! I really appreciate it...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.