Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

ctty/dup2 in DOS4 (Developers)

posted by ecm Homepage E-mail, Düsseldorf, Germany, 26.12.2025, 21:39

> In the DOS4 source code, I can see:
>
> cmd\command\tcmd2b.asm
>
> ICLLOOP:                                        ; Close basic
> handles
> MOV     AH,CLOSE
> INT     int_command
> INC     BX
> LOOP    ICLLOOP
> POP     BX                              ; Get handle
> MOV     AH,XDUP   
> INT     int_command                     ; Dup it to 0
> MOV     AH,XDUP   
> INT     int_command                     ; Dup to 1
> MOV     AH,XDUP
> INT     int_command                     ; Dup to 2
> MOV     AH,CLOSE                        ; Close initial handle
> INT     int_command

>
> Now according to RBIL:
>
> https://www.ctyme.com/intr/rb-2931.htm
>
> BX should have the file handle. But I see 3 executions of Int int_command,
> and I don't see BX changing from 0, to 1, to 2, between executions.
>
> Any idea how this works?
>
> Note - I'm trying to get "ctty com1:" to work on PDOS-generic, and I
> don't really have the concept yet.
>
> Thanks. Paul.

The bx input is the same for all three, the device opened earlier. Before using the duplicate handle calls, the first three handles are closed so that the output handles are 0, 1, 2. Then the new handle is closed.

---
l

 

Complete thread:

Back to the forum
Board view  Mix view
23153 Postings in 2179 Threads, 404 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum