Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

BIOS 10h error

stalinsoftstalinsoft Member Posts: 24
this program is working fine

#include
int main()
{
union REGS regs;

regs.h.ah = 0x00;
regs.h.al = 0x13;
int86(0x10,&regs,&regs);
regs.h.ah = 0x0c;
regs.h.al = 8;
regs.x.cx = 50;
regs.x.dx = 50;
int86(0x10,&regs,&regs);

}

but this program is not working why anyone can please tell me ?

and explain the reason also.



org 0x100

mov ah,0
mov al,0x13
int 0x10
mov ah,0x0c
mov al,9
mov cx,50
mov dx,50
int 0x10

ret

the above program compiled as : nasm -o s.com s.asm


advanc thanx

Comments

  • BretBret Member Posts: 114
    : this program is working fine
    :
    : #include
    : int main()
    : {
    : union REGS regs;
    :
    : regs.h.ah = 0x00;
    : regs.h.al = 0x13;
    : int86(0x10,&regs,&regs);
    : regs.h.ah = 0x0c;
    : regs.h.al = 8;
    : regs.x.cx = 50;
    : regs.x.dx = 50;
    : int86(0x10,&regs,&regs);
    :
    : }
    :
    : but this program is not working why anyone can please tell me ?
    :
    : and explain the reason also.
    :
    :
    :
    : org 0x100
    :
    : mov ah,0
    : mov al,0x13
    : int 0x10
    : mov ah,0x0c
    : mov al,9
    : mov cx,50
    : mov dx,50
    : int 0x10
    :
    : ret
    :
    : the above program compiled as : nasm -o s.com s.asm
    :
    :
    : advanc thanx

    Starting and stopping any program, including a DOS program, is a very complicated process. Ending the program with a simple "ret" doesn't do the job. You need to issue a call to DOS to tell it the program is done:

    mov ax,0x4C00 ;AH = DOS Function = 4Ch = Terminate Program
    ;AL = Return Code (ErrorLevel) = 0
    int 0x21 ;DOS Interrupt

    Replace the "ret" with this and it should work.
  • MT2002MT2002 Member Posts: 1,444
    : Starting and stopping any program, including a DOS program, is a
    : very complicated process. Ending the program with a simple "ret"
    : doesn't do the job. You need to issue a call to DOS to tell it the
    : program is done:
    :
    : mov ax,0x4C00 ;AH = DOS Function = 4Ch = Terminate Program
    : ;AL = Return Code (ErrorLevel) = 0
    : int 0x21 ;DOS Interrupt
    :
    : Replace the "ret" with this and it should work.

    Or, use a [b]hlt[/b] instruction in place of the [b]ret[/b].
    Note this wont terminate the program, but stop it so the user can
    terminate it.
  • stalinsoftstalinsoft Member Posts: 24
    Thanx buddy. its working.




    : : Starting and stopping any program, including a DOS program, is a
    : : very complicated process. Ending the program with a simple "ret"
    : : doesn't do the job. You need to issue a call to DOS to tell it the
    : : program is done:
    : :
    : : mov ax,0x4C00 ;AH = DOS Function = 4Ch = Terminate Program
    : : ;AL = Return Code (ErrorLevel) = 0
    : : int 0x21 ;DOS Interrupt
    : :
    : : Replace the "ret" with this and it should work.
    :
    : Or, use a [b]hlt[/b] instruction in place of the [b]ret[/b].
    : Note this wont terminate the program, but stop it so the user can
    : terminate it.

  • m34tb34tm34tb34t Member Posts: 25
    Original C program says:
    "regs.h.al = 8;"
    Asm program says:
    "mov al,9"

    It should say "mov al,8" instead and your code will be the same.
    Although this is just the color to set the pixel...

    "Ending the program with a simple "ret" simply doesn't do the job."

    Since you are using "org 100h" you are apparently running a dos .com file and therefor the "ret" IS a perfectly valid way to exit the program as it simply jumps to an INT 20H opcode (assuming your program segment prefix and stack haven't been corrupted somehow...)

    If your program is not running *AT ALL* I would guess you must be running it under some type of emulator which does not fully support the CP/M style .com file format that dos uses....
Sign In or Register to comment.