Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

inline assembly

0 views
Skip to first unread message

Jrdman

unread,
Jul 9, 2008, 2:11:11 PM7/9/08
to
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?

Terence

unread,
Jul 9, 2008, 6:16:15 PM7/9/08
to

The code syntax is not symmetric.
Some lines start with double quotes, some do not.
Some lines terminate with \n" and some do not.
And the whole section starts with (" so it should end with ").

Bill Leary

unread,
Jul 9, 2008, 6:33:56 PM7/9/08
to
"Jrdman" <ahmed...@gmail.com> wrote in message
news:d8217a76-baf8-477e...@z72g2000hsb.googlegroups.com...

What compiler are you doing this with?

For most of the popular MS-DOS targeted ones there are "int" routines you
can use rather than doing in-line assembler. For example, under Microsoft C
v8.00c this changes the cursor to a block.

Your code, by the way, won't make the cursor disappear. You're calling "set
video mode", by specifying AH = 0x00 and trying to select 320 X 200 16
color EGA by using AL = 0x0D.

The "select cursor type" is AH = 0x01 with CH specifying the start line and
CL specifying the end line. Depending on the hardware, you can often set
the start and end lines to something impossible to make the cursor
disappear.

/* Set the cursor to a block */
#include <dos.h>

main( int argc, char *argv[] )
{
int i;

union REGS r;

r.h.ah = 0x01; /* Select Cursor Type */
r.h.ch = 1; /* Start scan line */
r.h.cl = 8; /* End scan line */
int86( 0x10, &r, &r ); /* Call BIOS */
}

- Bill

Message has been deleted

Hendrik Schmieder

unread,
Jul 13, 2008, 4:07:48 PM7/13/08
to
Jrdman schrieb:

What C-compiler do you use ?

Hendrik

0 new messages