| RayeR  CZ, 10.05.2012, 10:46 | indirect far jmp in NASM (Developers) | 
| Hi, --- | 
| RayeR  CZ, 10.05.2012, 13:16 @ RayeR | indirect far jmp in NASM | 
| Well OK, it seems not possible, only via segment registers JMP [CS/ES/DS/SS:xxxx] but I don't want to modify this regs before jump. --- | 
| ecm    Düsseldorf, Germany, 10.05.2012, 13:26 @ RayeR | indirect far jmp | 
| this isn't NASM-specific. you have to load a segment register to access data there. you can use the stack to preserve it though; in that case, use a far return instead of the far jump instruction. example: --- | 
| Rugxulo  Usono, 10.05.2012, 13:26 @ RayeR | indirect far jmp in NASM | 
| > Well OK, it seems not possible, only via segment registers JMP | 
| RayeR  CZ, 10.05.2012, 14:07 @ Rugxulo | indirect far jmp in NASM | 
| >  --- | 
| ecm    Düsseldorf, Germany, 10.05.2012, 15:17 @ RayeR | indirect far jmp | 
| > I need to --- | 
| RayeR  CZ, 11.05.2012, 00:47 @ ecm | indirect far jmp | 
| > What exactly is it that you want to jump at anyway? --- | 
| ecm    Düsseldorf, Germany, 11.05.2012, 12:46 @ RayeR | indirect far jmp | 
| > > What exactly is it that you want to jump at anyway? --- | 
| bretjohn    Rio Rancho, NM, 11.05.2012, 18:53 @ RayeR | indirect far jmp | 
| > > What exactly is it that you want to jump at anyway? | 
| RayeR  CZ, 11.05.2012, 19:31 @ bretjohn | indirect far jmp | 
| > So, your code is part of a new/modified interrupt handler but you haven't --- | 
| bretjohn    Rio Rancho, NM, 11.05.2012, 22:31 @ RayeR | indirect far jmp | 
| > I placed old vector at INT 85h, I'm not sure if it's safe to call int from | 
| ecm    Düsseldorf, Germany, 11.05.2012, 22:33 @ bretjohn | indirect far jmp | 
| > That being said, what you're doing is probably not a good idea -- using the --- | 
| RayeR  CZ, 12.05.2012, 00:33 @ ecm | indirect far jmp | 
| > iirc rayer does some rom programming stuffs, maybe it's for that? in that --- | 
| Arjay 12.05.2012, 01:07 @ RayeR | indirect far jmp | 
| > > iirc rayer does some rom programming stuffs, maybe it's for that? | 
| ecm    Düsseldorf, Germany, 12.05.2012, 01:27 @ Arjay | indirect far jmp | 
| > Depending on what it is you need to do you could also use a FAR CALL to --- | 
| Arjay 12.05.2012, 11:09 @ ecm | indirect far jmp | 
| > That doesn't seem to have any advantages over just executing the | 
| ecm    Düsseldorf, Germany, 12.05.2012, 21:18 @ Arjay | indirect far jmp | 
| > > That doesn't seem to have any advantages over just executing the --- | 
| RayeR  CZ, 12.05.2012, 21:17 @ Arjay | indirect far jmp | 
| >  --- | 
| Arjay 13.05.2012, 13:16 @ RayeR | indirect far jmp/call - Chaining Interrupt Service Routines | 
| > > pushf | 
| RayeR  CZ, 13.05.2012, 04:01 (edited by RayeR, 13.05.2012, 04:19) @ RayeR | indirect far jmp - calling old INT problem | 
| > OK I'll rewrite it to call old ISR via INT. --- | 
| ecm    Düsseldorf, Germany, 13.05.2012, 04:27 @ RayeR | indirect far jmp - calling old INT problem | 
| > --- | 
| RayeR  CZ, 13.05.2012, 15:33 (edited by RayeR, 13.05.2012, 16:37) @ ecm | indirect far jmp - calling old INT problem | 
| > This way, you're not passing the returned CF (Carry Flag) back to the --- | 
| bretjohn    Rio Rancho, NM, 13.05.2012, 17:05 @ RayeR | indirect far jmp - calling old INT problem | 
| In general, I pass the entire original callers flags register, unchanged, to the old interrupt handler (whether I CALL it or JMP to it). I don't assume that the only thing that matters is one or two of the flags (like CF or ZF). In particular, modifying the Interrupt Flag or Direction flag can cause all kinds of problems, though modifying any flag other than the one(s) used to pass parameter(s) as defined by the API are potentially disastrous. | 
| RayeR  CZ, 13.05.2012, 17:15 @ bretjohn | indirect far jmp - calling old INT problem | 
| > In general, I pass the entire original callers flags register, unchanged, --- | 
| RayeR  CZ, 13.05.2012, 19:19 @ RayeR | indirect far jmp - calling old INT problem | 
| OK, I optimized it a bit, now just 1 byte greater than old code, not bad, I leave it... --- | 
| Rugxulo  Usono, 13.05.2012, 20:02 @ RayeR | indirect far jmp - calling old INT problem | 
| > OK, I optimized it a bit, now just 1 byte greater than old code, not bad, I | 
| RayeR  CZ, 13.05.2012, 20:49 (edited by RayeR, 13.05.2012, 21:00) @ Rugxulo | indirect far jmp - calling old INT problem | 
| > What, worried about one byte? --- | 
| ecm    Düsseldorf, Germany, 13.05.2012, 23:49 @ Rugxulo | indirect far jmp - calling old INT problem | 
| >  --- | 
| ecm    Düsseldorf, Germany, 13.05.2012, 23:40 @ RayeR | indirect far jmp - calling old INT problem | 
| This appears to clear the caller's interrupt flag (and trap flag, but that's not as important). It shouldn't do that. --- | 
| ecm    Düsseldorf, Germany, 14.05.2012, 00:07 @ ecm | indirect far jmp - calling old INT problem | 
| Here's a better one I came up with just now. Note that it takes 2 more bytes than your last suggestion, but importantly it correctly preserves the caller's interrupt flag. It also preserves their trace, direction, and overflow flags. Which happen to be the flags stored in the high byte of the flag word. Look for yourself: --- | 
| RayeR  CZ, 14.05.2012, 01:19 @ ecm | indirect far jmp - calling old INT problem | 
| > Here's a better one I came up with just now. Note that it takes 2 more --- | 
| ecm    Düsseldorf, Germany, 13.05.2012, 23:44 (edited by cm, 13.05.2012, 23:56) @ RayeR | indirect far jmp - calling old INT problem | 
| > Hm some magic with rotating saved flags on stack through carry... --- | 
| bretjohn    Rio Rancho, NM, 14.05.2012, 18:30 @ ecm | indirect far jmp - calling old INT problem | 
| FWIW, these days (I didn't used to do this) most of my ISR's start as follows: | 
| ecm    Düsseldorf, Germany, 14.05.2012, 18:47 @ bretjohn | redundant override in "ss:bp" for clarity | 
| > My assembler does not insert them, so in my code I put the --- | 
| RayeR  CZ, 14.05.2012, 18:50 @ bretjohn | indirect far jmp - calling old INT problem | 
| > (or whatever).  But, it is important that you do not simply CALL the old --- | 
| bretjohn    Rio Rancho, NM, 14.05.2012, 20:16 @ RayeR | indirect far jmp - calling old INT problem | 
| > Anyway In my case I cannot store old vector in my code segment, it's rom | 
| ecm    Düsseldorf, Germany, 14.05.2012, 20:21 @ bretjohn | indirect far jmp - calling old INT problem | 
| > Which is why you may need to be careful when using the INT 85h approach, --- | 
| bretjohn    Rio Rancho, NM, 14.05.2012, 21:42 @ ecm | indirect far jmp - calling old INT problem | 
| > This will set the Interrupt Flag and/or Trap Flag too early (inside your | 
| bretjohn    Rio Rancho, NM, 15.05.2012, 18:45 @ bretjohn | indirect far jmp - calling old INT problem | 
| This morning I thought of an even smaller way to "clean up" after the INT 85h: | 
| ecm    Düsseldorf, Germany, 15.05.2012, 18:53 (edited by cm, 15.05.2012, 19:10) @ bretjohn | indirect far jmp - calling old INT problem | 
| > INT 85h --- | 
| bretjohn    Rio Rancho, NM, 15.05.2012, 20:13 @ ecm | indirect far jmp - calling old INT problem | 
| > This only works if you restore the flags from [bp+6] into the actual flags | 
| RayeR  CZ, 17.05.2012, 01:25 @ bretjohn | indirect far jmp - calling old INT problem | 
| Sorry guys, I'm little bit loosing in your high-tech discussion. Just asking if I have to modify something in cm's code? I checked in BOCHS and on real PC too. --- | 
 Thread view
Thread view Board view
Board view
