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 RayeR Homepage, CZ, 13.05.2012, 15:33
(edited by RayeR on 13.05.2012, 16:37)

> 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

Aha, it was too late yesterday :)

> 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 ;)

Hm some magic with rotating saved flags on stack through carry... It works fine now. Anyway with this code it's still 3 bytes longer than my old method with placing FAR JMP byte opcode before saved vector and jumping on that...

EDIT:
I got some idea how to pass original int 13 flags:

        INT     OLD_INT13H      ;call old INT 13h handler / zavolej puvodni preruseni INT 13h
pushf
pop dx

add sp,6
push dx
sub sp,4
        IRET                    ;and return to caller program / a predej rizeni zpet volajicimu programu


but there's issue that ADD instruction also affect flags. so I temporarly use DX to save them and it works. But I must preserve DX too. To be continued...

---
DOS gives me freedom to unlimited HW access.

 

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