473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

inline assembly

i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches with
the message "the memory can not be writen" what's wrong with this
code?
Jul 9 '08 #1
15 1252
In article <52**********************************@m45g2000hsb. googlegroups.com>,
Jrdman <ah*********@gmail.comwrote:
>i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches with
the message "the memory can not be writen" what's wrong with this
code?
inline assembly is not part of the C standard. Whatever your compiler
does with it is compiler specific, and needs to be inquired about
in a newgroup that deals with your development environment.
As far as the C language is concerned, your code is just a normal
framework for main() that contains as its body a call to an
unprototyped routine named 'asm' (that is not part of the
C standard library) that is to be passed in a pointer
to a single static string.

--
"The slogans of an inadequate criticism peddle ideas to fashion"
-- Walter Benjamin
Jul 9 '08 #2
Jrdman wrote:
i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches with
the message "the memory can not be writen" what's wrong with this
code?
Better ask in alt.lang.asm or comp.lang.asm.x86.

Jul 9 '08 #3

"Jrdman" <ah*********@gmail.comwrote in message
news:52**********************************@m45g2000 hsb.googlegroups.com...
>i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches with
the message "the memory can not be writen" what's wrong with this
code?
This is not a C issue.

Looks like some code that runs under DOS, so even less on-topic. (However
those parameters to INT don't look right; you may want to double check the
0x10, 0x0D, 0x00, and which registers you put those in.)

Might be more familiar to the guys in comp.lang.asm.x86
--
Bartc
Jul 9 '08 #4
Jrdman wrote:
>
i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches
with the message "the memory can not be writen" what's wrong with
this code?
The word 'asm' is a syntax error. It doesn't exist in standard C.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

Jul 9 '08 #5
CBFalconer said:
Jrdman wrote:
>>
i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches
with the message "the memory can not be writen" what's wrong with
this code?

The word 'asm' is a syntax error.
No, it isn't. In the above case, it is being used to call a function named
asm which takes char * (or perhaps const char *) and returns int, and the
syntax looks just fine to me.
It doesn't exist in standard C.
The failure of a function name to be listed in the standard library is
insufficient to make the use of that name a syntax error.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 9 '08 #6
"Richard Heathfield" <rj*@see.sig.invalidwrote in message
news:h5******************************@bt.com...
CBFalconer said:
>Jrdman wrote:
>>>
i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches
with the message "the memory can not be writen" what's wrong with
this code?

The word 'asm' is a syntax error.

No, it isn't. In the above case, it is being used to call a function named
asm which takes char * (or perhaps const char *) and returns int, and the
syntax looks just fine to me.
>It doesn't exist in standard C.

The failure of a function name to be listed in the standard library is
insufficient to make the use of that name a syntax error.
The keyword asm has been a part of the C language for a long time. Exactly
what that keyword does or how it should be used is something more of a
mystery. However, in C99 we have this:

J.5.10 The asm keyword

1 The asm keyword may be used to insert assembly language directly into the
translator output (6.8). The most common implementation is via a statement
of the form:

asm ( character-string-literal );

Page 512 Portability issues §J.5.13


** Posted from http://www.teranews.com **
Jul 10 '08 #7
Dann Corbit said:
"Richard Heathfield" <rj*@see.sig.invalidwrote in message
news:h5******************************@bt.com...
>CBFalconer said:
>>Jrdman wrote:

i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches
with the message "the memory can not be writen" what's wrong with
this code?

The word 'asm' is a syntax error.

No, it isn't. In the above case, it is being used to call a function
named asm which takes char * (or perhaps const char *) and returns int,
and the syntax looks just fine to me.
>>It doesn't exist in standard C.

The failure of a function name to be listed in the standard library is
insufficient to make the use of that name a syntax error.

The keyword asm has been a part of the C language for a long time.
Exactly what that keyword does or how it should be used is something more
of a
mystery. However, in C99 we have this:

J.5.10 The asm keyword

1 The asm keyword may be used to insert assembly language directly into
the translator output (6.8). The most common implementation is via a
statement of the form:

asm ( character-string-literal );
Right, but of course that's in a non-normative appendix, and the following
text is relevant:

J.5 Common extensions
1 The following extensions are widely used in many systems, but are not
portable to all implementations. The inclusion of any extension that may
cause a strictly conforming program to become invalid renders an
implementation nonconforming. Examples of such extensions are new
keywords, extra library functions declared in standard headers, or
predefined macros with names that do not begin with an underscore.

The asm keyword is /not/ a standard keyword. C99 implementations must be
able to translate the following code correctly:

#include <stdio.h>

int asm(const char *s)
{
puts(s);
}

int main(void)
{
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jul 10 '08 #8
Richard Heathfield wrote:
CBFalconer said:
>Jrdman wrote:
>>>
i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches
with the message "the memory can not be writen" what's wrong
with this code?

The word 'asm' is a syntax error.

No, it isn't. In the above case, it is being used to call a
function named asm which takes char * (or perhaps const char *)
and returns int, and the syntax looks just fine to me.
Yes, nailed in a sloppy statement again. However I maintain the
sloppy one will do a better job of alerting the OP to the real
problem than this one will.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Jul 10 '08 #9
On 10 Jul 2008 at 3:32, CBFalconer wrote:
Richard Heathfield wrote:
>CBFalconer said:
>>The word 'asm' is a syntax error.

No, it isn't.

Yes, nailed in a sloppy statement again. However I maintain the
sloppy one will do a better job of alerting the OP to the real
problem than this one will.
It will certainly do a good job of alerting him to the fact that you're
a dick, and that he would to well to ignore all the nonsense you
dribble.

Jul 10 '08 #10
CBFalconer <cb********@yahoo.comwrites:
Richard Heathfield wrote:
>CBFalconer said:
>>Jrdman wrote:

i wrote this code
int main(void){
asm("movb $0x00,%ah \n"
"movb $0x0d,%al \n"
"int $0x10");
return 0;
}
to disappair the cursor but when it excutes the program craches
with the message "the memory can not be writen" what's wrong
with this code?

The word 'asm' is a syntax error.

No, it isn't. In the above case, it is being used to call a
function named asm which takes char * (or perhaps const char *)
and returns int, and the syntax looks just fine to me.

Yes, nailed in a sloppy statement again. However I maintain the
sloppy one will do a better job of alerting the OP to the real
problem than this one will.
And of course you did not notice the plethora of other "warnings" from
the jobsworths already mentioning this?
Jul 10 '08 #11
On Jul 10, 9:41*am, Richard<rgr...@gmail.comwrote:
CBFalconer <cbfalco...@yahoo.comwrites:
Richard Heathfield wrote:
CBFalconer said:
Jrdman wrote:
>>i wrote this code
int main(void){
* * asm("movb $0x00,%ah \n"
* * * * "movb $0x0d,%al \n"
* * * * "int $0x10");
* * * * return 0;
* * * * }
to disappair the cursor but when it excutes the program craches
with the message "the memory can not be writen" what's wrong
with this code?
>The word 'asm' is a syntax error.
No, it isn't. In the above case, it is being used to call a
function named asm which takes char * (or perhaps const char *)
and returns int, and the syntax looks just fine to me.
Yes, nailed in a sloppy statement again. *However I maintain the
sloppy one will do a better job of alerting the OP to the real
problem than this one will.

And of course you did not notice the plethora of other "warnings" from
the jobsworths already mentioning this?
What happened to this once peaceful group???
Jul 10 '08 #12
On 10 Jul 2008 at 17:32, no*************@gmail.com wrote:
What happened to this once peaceful group???
In one word: Heathfield.

He has poisioned the atmosphere in this group, and overseen it going
further and further from its original charter by trying to bully people
into refusing to discuss all of C, but instead restrict "topicality" to
the subset defined in the last-but-one ISO Standard.

Jul 10 '08 #13
"no*************@gmail.com" <no*************@gmail.comwrites:
[...
What happened to this once peaceful group???
Trolls.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jul 10 '08 #14
"no*************@gmail.com" wrote:
Richard<rgr...@gmail.comwrote:
>CBFalconer <cbfalco...@yahoo.comwrites:
.... snip ...
>>
>>Yes, nailed in a sloppy statement again. However I maintain the
sloppy one will do a better job of alerting the OP to the real
problem than this one will.

And of course you did not notice the plethora of other "warnings"
from the jobsworths already mentioning this?

What happened to this once peaceful group???
FYI that particular Richard (<rg****@gmail.com\>) and Antoninus
Twink are known dedicated trolls, and should always be ignored,
preferably plonked. Their sole objective is to disrupt the
newsgroup.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Jul 10 '08 #15
CBFalconer <cb********@yahoo.comwrites:
"no*************@gmail.com" wrote:
>Richard<rgr...@gmail.comwrote:
>>CBFalconer <cbfalco...@yahoo.comwrites:
... snip ...
>>>
Yes, nailed in a sloppy statement again. However I maintain the
sloppy one will do a better job of alerting the OP to the real
problem than this one will.

And of course you did not notice the plethora of other "warnings"
from the jobsworths already mentioning this?

What happened to this once peaceful group???

FYI that particular Richard (<rg****@gmail.com\>) and Antoninus
Twink are known dedicated trolls, and should always be ignored,
preferably plonked. Their sole objective is to disrupt the
newsgroup.
Commenting on your ludicrous net nannying and penchant for messing up
even the simplest solutions is not "trolling". I comment on C/C
development in other threads when I feel there is something I can
contribute or feel strongly enough about where others have not already
echoed those views. You should try it sometime - you might make less
mistakes and not appear so foolish with your rants and ill considered
responses.

Jul 10 '08 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ganesh Tawde | last post by:
Hi. I am trying to use the below pure assembly code as inline assembly in C. The pure assembly code gives proper data but the inline assembly code gives me distorted data. I am not able to...
25
by: Brian Lindahl | last post by:
I'm using a temporary buffer to transfer some data and would rather not allocate it on the heap. The problem is that the size of the buffer is only known upon entry into the function that utilizes...
18
by: Method Man | last post by:
If I don't care about the size of my executable or compile time, is there any reason why I wouldn't want to inline every function in my code to make the program run more efficient?
30
by: Will Pittenger | last post by:
Does C# inline functions? I do not see a inline keyword. Is there an implicit inline? Can the compiler select functions for auto-inlining? I am more used to C++ where all these things are...
6
by: ThomasR | last post by:
I was wondering on the breadth of optimization with .NET JIT compiler. Let's presume I have an assembly of static classes - mostly helper functions. Some of these functions may be very small...
8
by: neilmcguigan | last post by:
I just wanted to list some reasons why I prefer inline code to code-behind. 1. you can fix some bugs more quickly. remote desktop into server, change the aspx file, and she's good to go. I'd say...
9
by: chinu | last post by:
hi all, i did a small experiment to grasp the advantages of declaring a function as inline. inline int fun1(); int main(){ unsigned int start=0,end=0; asm("rdtsc\n\t"
2
by: =?Utf-8?B?TWljayBPJ05laWxs?= | last post by:
I am currently trying to wrap an old library (ImageMagick) in .NET, and am having problems with inline expansions. I have recompiled the library in vc++ 2005 OK. However, when I try to access any...
15
by: Chris Peters | last post by:
Hello Group Can anyone confirm or suggest workrounds for the following bug in lccwin32. If an inline assembly statement immediately follows a for loop and you try to set a breakpoint on it, then...
4
by: raashid bhatt | last post by:
hi by the definition of inline functions "In computer science, an inline function is a programming language construct used to suggest to a compiler that a particular function be subjected to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.