ack/plat/msdos386/libsys/isatty.s
David Given dc1f69be83 Most of read and write now works; filename-based operations partially work; but
there's a nasty memory corruption somewhere which needs investigating.
2022-08-19 00:08:57 +02:00

38 lines
479 B
ArmAsm

#
! $Source$
! $State$
! $Revision$
! Declare segments (the order is important).
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! Say whether a given file descriptor number refers to a terminal.
.define _isatty
_isatty:
mov ebx, esp
mov ebx, 4(ebx)
o16 mov ax, 0x4400
int 0x21
jc error
testb dl, dl
jz not_tty
mov eax, 1
ret
not_tty:
mov (_errno), 25 ! ENOTTY
not_tty_2:
xor eax, eax
ret
error:
push eax
call __sys_seterrno
pop ecx
jmp not_tty_2