not setting carry (Developers)
> To ensure that these odd "error codes" are detected properly, callers
> should ensure to stc before the int 21h call. Int 21h hooks
> ideally should preserve this Carry Flag status when chaining or calling
> their downlinks.
>
> Unfortunately, this isn't properly documented much, including in the
> Interrupt List.
As you indicate, "ideally" INT 21h chains should preserve ALL flags (not just Carry) when passing though, and when using CF as a return flag should preserve ALL flags except Carry. This means NOT simply issuing a STC/CLC followed by a RETF 2 (I've seen that done) at the end of the handler but instead manipulating the the Carry bit in the Flags register (on the stack) for the return. This is important because an Interrupt call also manipulates the Interrupt flag for entry into the Interrupt handler and you definitely want to preserve the callers Interrupt flag on the return. The other really critical Flag you absolutely don't want to mess with is the Direction flag.
When issuing a call that uses CF for the return, the caller should always set CF before the call in case of incompatibility, and set the values of the return registers (if there are any) to some value that should never be returned by the handling routine.
That's all just good programming practice.
Complete thread:
- not setting carry - kerravon, 16.10.2025, 10:29
![Open in board view [Board]](img/board_d.gif)
![Open in mix view [Mix]](img/mix_d.gif)
- not setting carry - ecm, 16.10.2025, 16:17
- not setting carry - bretjohn, 16.10.2025, 23:59
- not setting carry - ecm, 17.10.2025, 09:30
- not setting carry - kerravon, 17.10.2025, 07:58
- not setting carry - ecm, 17.10.2025, 10:29
- not setting carry - kerravon, 17.10.2025, 10:55
- not setting carry - ecm, 17.10.2025, 11:31
- not setting carry - kerravon, 17.10.2025, 16:51
- not setting carry - ecm, 17.10.2025, 18:43
- not setting carry - kerravon, 17.10.2025, 19:05
- not setting carry - ecm, 17.10.2025, 18:43
- not setting carry - kerravon, 17.10.2025, 16:51
- not setting carry - ecm, 17.10.2025, 11:31
- not setting carry - kerravon, 17.10.2025, 10:55
- not setting carry - ecm, 17.10.2025, 10:29
- not setting carry - bretjohn, 16.10.2025, 23:59
- not setting carry - ecm, 16.10.2025, 16:17
Mix view