flat assembler
Message board for the users of flat assembler.

Index > OS Construction > calling interrupts directly

Author
Thread Post new topic Reply to topic
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden
Doe's anyone know the correct procedure to make a far call to an interrupt?
I've been reading the 'intel software developers manual' but its just all a bit to cumbersome for me at the moment.

Code:
ORG 100H
USE16

start:

    mov bx, 10h
    add bx, bx
    add bx, bx

    sidt [IDTDesc]

    les di, [IDTBase + bx]

    mov ax, 19
;    int 10h

;    pushf
    call far [es:di]

    xor ax, ax
    int 16h
    int 20h

IDTDesc:
    IDTLimit dw ?
    IDTBase  dd ?
    

_________________
New User.. Hayden McKay.
Post 15 Mar 2007, 20:55
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
what's wrong about using "int" instruction?
Post 15 Mar 2007, 21:25
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden
just playin' around with unfamiliar instructions LGDT, LIDT etc... and this
was my first attempt to try something dumb.
Post 15 Mar 2007, 21:48
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
LES won't work for you here, and why do you add BX to IDTBase offset? You should rather add it to contents of [IDTBase]. This may look like:
Code:
ORG 100H
USE16

start:

    mov ebx,10h
    add ebx,ebx
    add ebx,ebx

    sidt [IDTDesc]

    mov eax,[IDTBase]
    add eax,ebx
    mov di,ax
    and di,0FFFh
    shr eax,16-4
    mov es,ax

    mov ax, 19
;    int 10h

    pushf
    call far dword [es:di]

    xor ax, ax
    int 16h
    int 20h

IDTDesc:
    IDTLimit dw ?
    IDTBase  dd ?    


Well, cannot test it under Windows environment, because SIDT gives the Windows' IDT instead of the 16-bit one - which is by standard at 0 address anyway. Wink
Post 15 Mar 2007, 22:00
View user's profile Send private message Visit poster's website Reply with quote
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden
i've created some dos interrupt code that chains to the last handler via the pushf far call method wich led me back to this thread.

Quote:

LES won't work for you here, and why do you add BX to IDTBase offset? You should rather add it to contents of [IDTBase].


Thanks TG. I can now see the error of my ways Laughing

_________________
New User.. Hayden McKay.
Post 30 Apr 2007, 16:24
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.