Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

indirect far jmp - calling old INT problem (Developers)

posted by ecm Homepage E-mail, Düsseldorf, Germany, 13.05.2012, 04:27

>  INT     85h             ;call old INT 13h handler
>  IRET                    ;and return to caller program
>
> If I call old ISR by direct far call or via cm's method (longer code than
> my old) it boots ok without error. What can be wrong?

This way, you're not passing the returned CF (Carry Flag) back to the caller, leaving theirs in their saved FL word unmodified instead. Here's some code that would return it correctly, it goes right before your iret instruction and needs to be entered with the CF that you want to return:

        push bp
        mov bp, sp
        rcr byte [bp+6], 1      ; flip
        rol byte [bp+6], 1      ; flop
        pop bp


Understanding what this does is left as an exercise to the reader ;)

Arguably though, jumping (by whatever method) to the old handler would be better. Not only will it execute the old handler with 6 bytes less on the stack as you have mentioned, it would also insure that, say, ZF is also passed back to the caller properly. I don't know of any Int13 functions modifying ZF off my head, but I suppose it's possible.

Maybe someone can optimise the code that uses retf as I suggested earlier more for you? By the way, it'd be trivial to optimise a bit or somewhat if you know that your code will only ever run on at least an 186 or 386 CPU.

---
l

 

Complete thread:

Back to the forum
Board view  Mix view
22762 Postings in 2122 Threads, 402 registered users (1 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum