Confused about C program with assembly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ananthu
    New Member
    • Sep 2007
    • 87

    #1

    Confused about C program with assembly

    Hi

    In my college they have given me the following codings for implementing linker function.

    Codings:

    [CODE=c]#include<stdio. h>
    #include<conio. h>
    void cursoron();
    void cursoroff();
    void main()
    {
    clrscr();
    printf("LINKER\ n\n");
    printf("Cursor off state\n");
    cursoroff();
    getch();
    printf("\nCurso r on state\n");
    cursoron();
    getch();
    printf("\nCurso r off state\n");
    cursoroff();
    getch();
    printf("\nCurso r on state\n");
    cursoron();
    getch();
    }

    void cursoron()
    {
    asm MOV AH,3;
    asm XOR BX,BX;
    asm INT 0X10;
    asm XOR CH,0X3F;
    asm MOV AH,1;
    asm INT 0X10;
    }

    void cursoroff()
    {
    asm MOV AH,3;
    asm XOR BX,BX;
    asm INT 0X10;
    asm OR CH,0X3F;
    asm MOV AH,1;
    asm INT 0X10;
    }[/CODE]

    Output:

    Cursor off state

    Cursor on state
    -

    Cursor off state

    Cursor on state
    -


    - indicates blinking cursor in output.
    I know the assembly language codings only a little bit. Can you please explain me what each assembly language statements are doing for cursoron() function alone so that i can understand cursoroff() function also.

    I know the meaning of MOV,XOR,INT,OR etc.. But what is the purpose of moving values 3,1 in A register before and after cursor on/off stage and why we are clearing BX register,why we are moving 0X3F in CH register. What actually they do.

    Can u please explain me...
    Last edited by Ganon11; Oct 30 '07, 03:22 AM. Reason: Please use the [CODE] tags provided.
  • Cucumber
    New Member
    • Sep 2007
    • 90

    #2
    It is imperative to have the interruption's documentation prior to coding anything related to sowftare interruptions.

    In your case, you need to take a look to this link


    There you can lookup what does the software interruption 0x10 do when you "feed" it AH = 3 and so on.

    For instance, AH=3 means "VIDEO - GET CURSOR POSITION AND SIZE", AH=1 means "VIDEO - SET TEXT-MODE CURSOR SHAPE", and so on,

    Just click and read.

    Comment

    Working...