Not sure if it’s bad etiquette to reply to your own post, but… I may just need 
to change out my “iret” with “ret 2”. I’m doing some testing…




From: <> 
Sent: Sunday, April 30, 2023 4:53 PM
Subject: CPU flags register not updating on interrupt calls


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 


void test_interrupt()


    iregs regs;

    regs.a.x = 0x1122;

    regs.b.x = 0x0033;


    regs.c.x = 0x4455;

    regs.d.x = 0x6677;

    regs.di = 0x8899; = 0xaabb;


    init_call_intr(0x15, &regs);


    printf("\nInt test: ");

    printf("ax=%04X  bx=%04X  cx=%04X  dx=%04X  di=%04X  si=%04X  



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




In, kernel/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 
 , including a video walk-through of what I am seeing.


Thank you!



Freedos-devel mailing list

Reply via email to