asm problem

This is a discussion on asm problem within the Linux Programming forums, part of the Platform Specific Boards category; Hi! I compile this code: Code: #include <stdio.h> typedef unsigned int word; typedef unsigned char byte; static byte ch; int ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    13

    asm problem

    Hi!

    I compile this code:
    Code:
    #include <stdio.h>
    typedef unsigned int word;
    typedef unsigned char byte;
    
    static byte ch;
    
    int main()
    {
        ch = 'a';
        // izpise crko 'a' na zaslon.
        asm(".intel_syntax noprefix
             mov ah, 0xA
    	 mov al, [ch]
    	 mov bh, 0x0
             mov bl, 0x0
             mov cx, 0x01
    	 int 10");
        return(0);
    }
    This should print one 'a' on the screen. But instead of that it segfault. Why?

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    13
    1. Linux isn't likely to be using BIOS interrupts
    Somewhere I spotted kernel interrupt 80, what can it do and where can i get detailed info about it?

  3. #3
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Location
    Still in the egg
    Posts
    269
    hi
    try to use system calls. just move the required data to registers and call "int 0x80". That's all....
    see the unistd.h file for the system call numbers.
    They make life easier

    visit http://linuxassembly.org for asm usage under UNIX systems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. gcc asm code syntax
    By Uberapa in forum C Programming
    Replies: 4
    Last Post: 06-15-2007, 01:16 AM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21