Author Topic: far call  (Read 10124 times)

Alfonso V

  • Guest
far call
« on: June 05, 2006, 10:34:10 AM »
Hi all

I need to know how can i do a fall call to an ISR

I've tried with:
PUSHF
CALL FAR DWORD [direction]

But it crashed... :-(

There's a posibility with
JMP FAR [direction]

But I don't want it, because i need a far call, not a far jump.

There's another posibility with:
DB 9Ah
farlabel DD [direction]

¿How can i put my direction in "[direction]"

Nevertheless I'd like something like "CALL FAR DWORD"

Thank you

nobody

  • Guest
Re: far call
« Reply #1 on: June 05, 2006, 01:22:55 PM »
Not enough information. What's our environment? Looks like 32 bit? Homemade? Or some existing OS? What are you using for target cs?

I would have said that existing OSen wouldn't let you do a far call at all (from userland), but I just tried it, and if I use *same* cs - 23h - it works! Rather pointless, but it works. Something like:

target dd subbie
       dw 23h

_start:
call far [target]
(exit)

subbie:
(say hi)
retf

Pushing flags first ought to "fake" an isr - I didn't try that.

I think you're on the right track with your first try, and something else is wrong...

If all else fails, post the code (and may God forgive SF for what they do to it :)

Best,
Frank

Alfonso V

  • Guest
Re: far call
« Reply #2 on: June 06, 2006, 10:06:20 AM »
Hello, Frank

I'm working in a 16 bit MS-DOS system and I'm trying when a BIOS int is working. I'm using this procedure:

NewInt10h:
    INC       BYTE [CS:InBios]            ; Increment InBios flag
    PUSHF
    CALL      FAR DWORD [CS:INT10+IsrAnterior]; Call to old Int 10h ISR
;     DB        2Eh,0FFh,1Eh,21h,01h      ; What previos line must be
    DEC       BYTE [CS:InBios]            ; Decrement InBios flag
  IRET

Where InBios is a byte variable that "knows" if BIOS is working.

I've done this program in MASM yet, but I'm stopped in nasm far call to an ISR.

If I do a far call to a far procedure that ends with "RETF", I can use:
PUSH CS
CALL ProcName   ; this push IP
[...]

ProcName:
[...]
RETF            ; this pop CS:IP

So this work fine. But push cs and call ISR doesn't work with a far call to an ISR.

Before doing a far call to an ISR we need do a PUSHF because IRET do a POPF also.

Thank you

nobody

  • Guest
Re: far call
« Reply #3 on: June 06, 2006, 10:30:42 AM »
Ah! 16-bit! The "dword" fooled me (and you). Get rid of that, and I think it'll work. That makes it a 32-bit far call, inserting a 66h byte.

Best,
Frank