Hi, everyone. I’m new here. This is my first post.  😊

 

I am currently working on getting FreeDOS running on my homebrew 286 system. I 
am running into an issue where interrupt calls from FreeDOS to my BIOS are not 
showing updated values for the CPU flags register after the call. This happens 
with built-in interrupt calls in FreeDOS or custom calls I am making. Here’s a 
simple test function that I added to FreeDOS’s main.c (I call it just before 
signon()):

 

void test_interrupt()

{

    iregs regs;

    regs.a.x = 0x1122;

    regs.b.x = 0x0033;

  

    regs.c.x = 0x4455;

    regs.d.x = 0x6677;

    regs.di = 0x8899;

    regs.si = 0xaabb;

   

    init_call_intr(0x15, &regs);

    

    printf("\nInt test: ");

    printf("ax=%04X  bx=%04X  cx=%04X  dx=%04X  di=%04X  si=%04X  
flags=%04X\n",regs.a.x,regs.b.x,regs.c.x,regs.d.x,regs.di,regs.si,regs.flags);

}

 

In the assembly code for the BIOS interrupt service routine (I’m just using 
interrupt 0x15 for testing), I update the flags register. When I try to read 
the updated flags register back in FreeDOS, I am not getting the values that I 
expect. For example, if I use something like the following in my interrupt 
service routine, when I read regs.flags in test_interupt() above, the carry 
flag may or may not be set properly (same with the zero flag).

 

              mov      ah, 0b01000001              ;SF, ZF, AF, PF, and CF 
flags (bits 7, 6, 4, 2, and 0, respectively) – other flags are left unchanged 
by CPU

              sahf

              iret

 

In, kernel/pcb.h <https://github.com/FDOS/kernel/blob/master/hdr/pcb.h> , I see 
some notes about “offsets must match the assembly process” and a couple of 
different layouts for the offsets. Could this be related to the issue I am 
having? I am using NASM 2.16.01 and Watcom 1.9.

 

Suggestions or things I could look into?

 

I have posted additional details here 
<https://www.rehsdonline.com/post/troubleshooting-cpu-flags-register-between-bios-and-freedos>
 , including a video walk-through of what I am seeing.

 

Thank you!

 

Rich

_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to