2022-08-07 20:10:08 +00:00
|
|
|
#
|
|
|
|
! $Source$
|
|
|
|
! $State$
|
|
|
|
! $Revision$
|
|
|
|
|
|
|
|
! Declare segments (the order is important).
|
|
|
|
|
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
|
|
|
|
.sect .text
|
|
|
|
|
|
|
|
! .sys_zret: if the carry flag is set, then set `errno' from the DOS error
|
2022-08-17 20:34:06 +00:00
|
|
|
! code in ax, and return an int -1. If the carry flag is clear, just
|
|
|
|
! return an int zero.
|
2022-08-07 20:10:08 +00:00
|
|
|
!
|
|
|
|
! .sys_axret: if the carry flag is set, then set `errno' from the DOS error
|
|
|
|
! code in ax, and return a shortword -1. If the carry flag is clear, just
|
|
|
|
! return ax as a return value.
|
|
|
|
!
|
2022-08-24 15:17:04 +00:00
|
|
|
! .sys_dxaxret: same as .sys_axret, but return -1 or eax := dx:ax as a
|
|
|
|
! return value.
|
2022-08-07 20:10:08 +00:00
|
|
|
|
|
|
|
.extern .sys_zret
|
|
|
|
.extern .sys_axret
|
|
|
|
.extern .sys_dxaxret
|
|
|
|
.sys_zret:
|
|
|
|
jc error
|
2022-08-17 20:34:06 +00:00
|
|
|
xor eax, eax
|
2022-08-07 20:10:08 +00:00
|
|
|
no_error:
|
|
|
|
ret
|
2022-08-17 20:34:06 +00:00
|
|
|
|
2022-08-07 20:10:08 +00:00
|
|
|
.sys_axret:
|
2022-08-17 20:34:06 +00:00
|
|
|
jc error
|
|
|
|
ret
|
|
|
|
|
2022-08-07 20:10:08 +00:00
|
|
|
.sys_dxaxret:
|
2022-08-17 20:34:06 +00:00
|
|
|
jc error
|
|
|
|
shl edx, 16
|
|
|
|
o16 mov dx, ax
|
|
|
|
mov eax, edx
|
|
|
|
ret
|
|
|
|
|
2022-08-07 20:10:08 +00:00
|
|
|
error:
|
2022-08-17 20:34:06 +00:00
|
|
|
movzx eax, ax
|
|
|
|
push eax
|
2022-08-07 20:10:08 +00:00
|
|
|
call __sys_seterrno
|
2022-08-17 20:34:06 +00:00
|
|
|
pop ecx
|
2022-08-07 20:10:08 +00:00
|
|
|
ret
|