repo_id
stringlengths 5
115
| size
int64 590
5.01M
| file_path
stringlengths 4
212
| content
stringlengths 590
5.01M
|
|---|---|---|---|
stsp/libi86
| 1,792
|
host-ack/dos/dos-getfileattr.s
|
#
/*
* Copyright (c) 2019--2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_getfileattr
__dos_getfileattr:
mov bx, sp
mov dx, 2(bx)
mov bx, 4(bx)
mov ax, 0x4300
int 0x21
jc .0
mov (bx), cx
.0:
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,768
|
host-ack/dos/getswitchar.s
|
#
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __getswitchar
__getswitchar:
mov ax, 0x3700
int 0x21
testb al, al
xchg dx, ax
jz .0
movb al, '/'
.0:
movb ah, 0
ret
#endif /* __MSDOS__ */
|
stsp/libi86
| 1,767
|
host-ack/dos/dos-setfileattr.s
|
#
/*
* Copyright (c) 2019--2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_setfileattr
__dos_setfileattr:
mov bx, sp
mov dx, 2(bx)
mov cx, 4(bx)
mov ax, 0x4301
int 0x21
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,784
|
host-ack/dos/pokeb.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define ___libi86_pokeb
___libi86_pokeb:
mov bx, sp
mov cx, es
movb al, 6(bx)
mov es, 2(bx)
mov bx, 4(bx)
eseg movb (bx), al
mov es, cx
ret
#endif /* __MSDOS__ */
|
stsp/libi86
| 1,854
|
host-ack/dos/dos-write.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_write
__dos_write:
mov bx, sp
mov ax, 2(bx)
mov cx, 8(bx)
lds dx, 4(bx)
xchg bx, ax
movb ah, 0x40
int 0x21
push ss
pop ds
jc .error
mov bx, sp
mov bx, 10(bx)
mov (bx), ax
.error:
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,770
|
host-ack/dos/dos-keep.s
|
#
/*
* Copyright (c) 2019--2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_keep
.define ___libi86_bc_keep
__dos_keep:
___libi86_bc_keep:
mov bx, sp
movb al, 2(bx)
mov dx, 4(bx)
movb ah, 0x31
int 0x21
#endif
|
stsp/libi86
| 1,835
|
host-ack/dos/dos-allocmem.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_allocmem
__dos_allocmem:
mov bx, sp
push si
mov si, 4(bx)
movb ah, 0x48
mov bx, 2(bx)
int 0x21
jc .0
mov (si), ax
xor ax, ax
pop si
ret
.0:
mov (si), bx
pop si
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,852
|
host-ack/dos/dos-read.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_read
__dos_read:
mov bx, sp
mov ax, 2(bx)
mov cx, 8(bx)
lds dx, 4(bx)
xchg bx, ax
movb ah, 0x3f
int 0x21
push ss
pop ds
jc .error
mov bx, sp
mov bx, 10(bx)
mov (bx), ax
.error:
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,750
|
host-ack/dos/dos-wait.s
|
#
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_wait
__dos_wait:
mov bx, sp
mov bx, 2(bx)
movb ah, 0x4d
int 0x21
mov (bx), ax
xor ax, ax
ret
#endif /* __MSDOS__ */
|
stsp/libi86
| 1,768
|
host-ack/dos/peekb.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define ___libi86_peekb
___libi86_peekb:
mov bx, sp
mov cx, es
mov es, 2(bx)
mov bx, 4(bx)
eseg movb al, (bx)
mov es, cx
ret
#endif /* __MSDOS__ */
|
stsp/libi86
| 1,756
|
host-ack/dos/dos-getdrive.s
|
#
/*
* Copyright (c) 2019--2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_getdrive
__dos_getdrive:
mov bx, sp
mov bx, 2(bx)
movb ah, 0x19
int 0x21
inc ax
xorb ah, ah
mov (bx), ax
ret
#endif
|
stsp/libi86
| 1,745
|
host-ack/dos/libi86-ret-set-errno.s
|
#
/*
* Copyright (c) 2018--2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define .__libi86_ret_set_errno
.__libi86_ret_set_errno:
jc .0
xor ax, ax
ret
.0:
push ax
call ___libi86_ret_really_set_errno
pop cx
ret
|
stsp/libi86
| 1,733
|
host-ack/dos/libi86-msdos-set-dta.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define ___libi86_msdos_set_dta
___libi86_msdos_set_dta:
mov bx, sp
mov dx, 2(bx)
movb ah, 0x1a
int 0x21
ret
#endif
|
stsp/libi86
| 1,722
|
host-ack/dos/setswitchar.s
|
#
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __setswitchar
__setswitchar:
mov bx, sp
movb dl, 2(bx)
mov ax, 0x3701
ret
#endif /* __MSDOS__ */
|
stsp/libi86
| 1,867
|
host-ack/dos/dos-getftime.s
|
#
/*
* Copyright (c) 2019--2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_getftime
__dos_getftime:
mov bx, sp
push 4(bx)
push 6(bx)
mov bx, 2(bx)
mov ax, 0x5700
int 0x21
pop bx
jc .0
mov (bx), cx
pop bx
mov (bx), dx
.data1 0xb1 /* movb cl, ... */
.0:
pop bx
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,808
|
host-ack/dos/dos-creat.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __dos_creat
__dos_creat:
mov bx, sp
mov dx, 2(bx)
mov cx, 4(bx)
movb ah, 0x3c
int 0x21
jc .error
mov bx, sp
mov bx, 6(bx)
mov (bx), ax
.error:
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,653
|
host-ack/bios/bios-equiplist.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __bios_equiplist
__bios_equiplist:
int 0x11
ret
|
stsp/libi86
| 1,712
|
host-ack/bios/bios-serialcom.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __bios_serialcom
__bios_serialcom:
mov bx, sp
movb ah, 2(bx)
mov dx, 4(bx)
movb al, 6(bx)
int 0x14
ret
|
stsp/libi86
| 1,821
|
host-ack/bios/bios-joystick.s
|
#
/*
* Copyright (c) 2020--2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __bios_joystick
__bios_joystick:
push di
mov di, sp
mov dx, 4(di)
mov di, 6(di)
movb ah, 0x84
int 0x15
jc .error
mov (di), ax
mov 2(di), bx
mov 4(di), cx
mov 6(di), dx
xor ax, ax
.error:
pop di
ret
|
stsp/libi86
| 2,007
|
host-ack/bios/bios-keybrd.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __bios_keybrd
__bios_keybrd:
mov bx, sp
mov ax, 2(bx) ! service
xchgb ah, al
cmpb ah, 0x01 ! test for _KEYBRD_READY (0x01) or
jz .withzf ! _NKEYBRD_READY (0x11) --- for these
cmpb ah, 0x11 ! we must test ZF after the int 0x16
jz .withzf
push bp ! if neither, just do an int 0x16
int 0x16 ! and return whatever is in ax
pop bp
.done:
ret
.withzf:
int 0x16
jnz .done
xor ax, ax
ret
|
stsp/libi86
| 1,733
|
host-ack/bios/bios-printer.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __bios_printer
__bios_printer:
mov bx, sp
movb ah, 2(bx)
mov dx, 4(bx)
movb al, 6(bx)
int 0x17
movb al, ah
movb ah, 0
ret
|
stsp/libi86
| 1,649
|
host-ack/bios/bios-memsize.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __bios_memsize
__bios_memsize:
int 0x12
ret
|
stsp/libi86
| 1,983
|
host-ack/bios/bios-timeofday.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __bios_timeofday
__bios_timeofday:
mov bx, sp
mov ax, 2(bx) ! service
xchgb ah, al
mov bx, 4(bx) ! timeval
test ax, ax ! bswap16 (_TIME_GETCLOCK)
jnz .notgetclock
int 0x1a
mov 2(bx), cx
mov (bx), dx
movb ah, 0
ret
.notgetclock:
cmp ax, 0x0100 ! bswap16 (_TIME_SETCLOCK)
jnz .error
mov cx, 2(bx)
mov dx, (bx)
int 0x1a
xor ax, ax
ret
.error:
mov ax, -1
ret
|
stsp/libi86
| 2,736
|
host-ack/bios/bios-disk.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __bios_disk
__bios_disk:
mov bx, sp
movb ah, 2(bx) ! service
mov bx, 4(bx) ! diskinfo
movb dl, (bx) ! diskinfo->drive
cmpb ah, 8 ! _DISK_DRIVEPARAMS is a special case
jz .driveparams
movb al, 8(bx) ! diskinfo->nsectors
mov cx, 4(bx) ! diskinfo->track
xchgb ch, cl
rorb cl, 1
rorb cl, 1
andb cl, 0xc0
orb cl, 6(bx) ! diskinfo->sector
movb dh, 2(bx) ! diskinfo->head
les bx, 10(bx) ! diskinfo->buffer
stc
int 0x13
jc .err1
movb ah, 0
.err1:
push ds
pop es
ret
.driveparams:
push di ! Ralf Brown's Interrupt List says
xor di, di ! to set es = di = 0 "to guard
mov es, di ! against BIOS bugs"
push bx
stc
int 0x13
jc .err2
movb ah, 0
.err2:
pop bx
mov 10(bx), di ! FP_OFF (diskinfo->buffer)
mov 12(bx), es ! FP_SEG (diskinfo->buffer)
push ds
pop es
xchg di, ax
xorb ah, ah
movb al, dl
mov (bx), ax ! diskinfo->drive --- actually the
! number of drives...
movb al, dh
mov 2(bx), ax ! diskinfo->head
movb al, cl
andb al, 0x3f
mov 6(bx), ax ! diskinfo->sector
xor ax, cx
xchgb ah, al
rolb ah, 1
rolb ah, 1
mov 4(bx), ax ! diskinfo->track
xchg di, ax
pop di
ret
|
stsp/libi86
| 1,920
|
host-ack/direct/chdir.s
|
#
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/acconfig.h"
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define ___libi86_chdir
___libi86_chdir:
# ifndef _LIBI86_INTERNAL_HAVE__CHDIR
.define __chdir
__chdir:
# endif
# ifndef _LIBI86_INTERNAL_HAVE_CHDIR
.define _chdir
_chdir:
# endif
mov bx, sp
mov dx, 2(bx)
movb ah, 0x3b
int 0x21
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,920
|
host-ack/direct/rmdir.s
|
#
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/acconfig.h"
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define ___libi86_rmdir
___libi86_rmdir:
# ifndef _LIBI86_INTERNAL_HAVE__RMDIR
.define __rmdir
__rmdir:
# endif
# ifndef _LIBI86_INTERNAL_HAVE_RMDIR
.define _rmdir
_rmdir:
# endif
mov bx, sp
mov dx, 2(bx)
movb ah, 0x3a
int 0x21
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,845
|
host-ack/direct/libi86-msdos-do-getdcwd.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define ___libi86_msdos_do_getdcwd
___libi86_msdos_do_getdcwd:
mov bx, sp
push si
mov si, 2(bx)
movb dl, 4(bx)
movb ah, 0x47
int 0x21
pop si
sbb ax, ax
jnc .ok
push ax
call .__libi86_ret_set_errno
pop ax
.ok:
ret
#endif
|
stsp/libi86
| 1,707
|
host-ack/direct/getdrive.s
|
#
/*
* Copyright (c) 2019--2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define __getdrive
__getdrive:
movb ah, 0x19
int 0x21
inc ax
xorb ah, ah
ret
#endif
|
stsp/libi86
| 1,966
|
host-ack/direct/mkdir.s
|
#
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
#include "libi86/internal/acconfig.h"
#ifdef __MSDOS__
.define ___libi86_mkdir2
.define ___libi86_mkdir1
___libi86_mkdir2:
___libi86_mkdir1:
# ifndef _LIBI86_INTERNAL_HAVE__MKDIR
.define __mkdir
__mkdir:
# endif
# ifndef _LIBI86_INTERNAL_HAVE_MKDIR
.define _mkdir
_mkdir:
# endif
mov bx, sp
mov dx, 2(bx)
movb ah, 0x39
int 0x21
jmp .__libi86_ret_set_errno
#endif
|
stsp/libi86
| 1,066
|
host-ack/dos-dbcs/libi86-msdos-dbcs-lead-p.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include "libi86/internal/sect.h"
#ifdef __MSDOS__
.define ___libi86_msdos_dbcs_lead_p
___libi86_msdos_dbcs_lead_p:
mov bx, sp
mov dx, 4(bx)
mov cx, 6(bx)
movb al, 2(bx)
mov bx, dx
or bx, cx
jnz .20
xchg dx, ax
ret
.20:
push es
push si
mov si, dx
mov es, cx
xchg cx, ax
.21:
eseg lodsw
testb al, al
jz .29
cmpb cl, al
jb .21
cmpb cl, ah
ja .21
movb al, 1
.29:
cbw
pop si
pop es
ret
#endif
|
stsp/libi86
| 1,385
|
host-ack/dos-dbcs/dos-get-dbcs-lead-table.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include "libi86/internal/sect.h"
#include "libi86/internal/acconfig.h"
#ifdef __MSDOS__
# ifndef _LIBI86_INTERNAL_HAVE__DOS_GET_DBCS_LEAD_TABLE
.define __dos_get_dbcs_lead_table
__dos_get_dbcs_lead_table:
# endif
.define ___libi86_msdos_get_dbcs_lead_table
___libi86_msdos_get_dbcs_lead_table:
call ___libi86_get_osmajor_osminor
push bp
push si
push di
push ds
push es
cmpb al, 3
mov ax, 0x6300
mov si, -1
jb .18
int 0x21
.11:
inc si
jz .19
dec si
testb al, al
jnz .19
cmpb (si), al
jz .19
xchg si, ax
mov dx, ds
.12:
pop es
pop ds
pop di
pop si
pop bp
mov bx, sp
mov bx, 2(bx)
mov (bx), ax
mov 2(bx), dx
xchg bx, ax
ret
.18:
stc
int 0x21
sbbb al, al
jmp .11
.19:
xor ax, ax
cwd
jmp .12
#endif
|
stsp/libi86
| 2,349
|
host-ack/kompress/lz4len.s
|
#
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __lz4len
__lz4len:
mov bx, sp
push si
push di
lds si, 2(bx) /* ds:si := BLK_SRC */
sseg mov bx, 6(bx) /* bx := BLK_SZ */
add bx, si /* bx := FP_OFF (BLK_SRC + BLK_SZ) */
xor di, di /* di := UNPACKLEN */
jmp .chk
.loopy:
lodsb
xchg dx, ax
movb ch, dl
movb cl, 12
shr cx, cl
call .full_len_ckd
jc .ouch
add si, cx
add di, cx
jc .ouch
cmp si, bx
jnb .done
lodsw
movb cl, dl
and cx, 0x0f
call .full_len_ckd
jc .ouch
add cx, 4
jc .ouch
add di, cx
jc .ouch
.chk:
cmp si, bx
jb .loopy
.done:
xchg di, ax
.data1 0x3d /* cmp ax, ... */
.ouch:
xor ax, ax
push ss
pop ds
pop di
pop si
ret
.full_len_ckd:
cmpb cl, 0x0f
jnz .8
movb ah, 0
.1:
lodsb
add cx, ax
jc .9
cmpb al, 0xff
jz .1
.8:
clc
.9:
ret
|
stsp/libi86
| 2,400
|
host-ack/kompress/lz4cpy.s
|
#
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
.define __lz4cpy
__lz4cpy:
mov bx, sp
push si
push di
push es
les di, 4(bx) /* es:di := DEST */
lds si, 8(bx) /* ds:si := BLK_SRC */
sseg mov bx, 12(bx) /* bx := BLK_SZ */
add bx, si /* bx := FP_OFF (BLK_SRC + BLK_SZ) */
jmp .chk
.loopy:
lodsb
xchg dx, ax
movb ch, dl
movb cl, 12
shr cx, cl
call .full_len
rep movsb
cmp si, bx
jnb .done
lodsw
movb cl, dl
mov dx, di
sub dx, ax
and cx, 0x0f
call .full_len
add cx, 4
push ds
push es
pop ds
xchg si, dx
rep movsb
mov si, dx
pop ds
.chk:
cmp si, bx
jb .loopy
.done:
push ss
pop ds
mov bx, sp
mov bx, 6+2(bx) /* return value := updated DEST */
mov (bx), di
mov 2(bx), es
xchg bx, ax
pop es
pop di
pop si
ret
.full_len:
cmpb cl, 0x0f
jnz .9
movb ah, 0
.1:
lodsb
add cx, ax
cmpb al, 0xff
jz .1
.9:
ret
|
stsp/libi86
| 2,859
|
host-ack/stdio/vsscanf.s
|
#
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/sect.h"
/*
* As of Oct 2021, ACK's C runtime library lacks a vsscanf (...) function,
* though it does have sscanf (...).
*
* I try to implement vsscanf (...) in terms of sscanf (...): first (over-)
* estimate the size of the va_list'd argument list passed to vsscanf (...),
* then copy these variadic arguments & pass them to sscanf (...). This is
* relatively easy to do for ...scanf (...), since the argument list will
* comprise only pointers.
*
* (We could alternatively implement vsscanf (...) in terms of ACK's
* internal code & data structures, but this may break more easily.)
*/
.define ___libi86_vsscanf
___libi86_vsscanf:
push si
push di
push bp
mov bp, sp
mov si, 10(bp) ! get format string
xor cx, cx ! cx := no. of variadic arguments
.loop: ! scan format string for `%' characters
lodsb
cmpb al, '%'
ja .loop
jnz .next
inc cx ! if we see a `%', assume we have
lodsb ! one more argument
.next:
testb al, al
jnz .loop
mov si, 12(bp) ! we scanned the format string; now
mov di, sp ! copy arguments
sub di, cx
sub di, cx
mov sp, di
rep movsw
push 10(bp) ! push the remaining arguments that
push 8(bp) ! sscanf (...) needs
call _sscanf ! ...& call
mov sp, bp ! we are done
pop bp
pop di
pop si
ret
|
stsp/libi86
| 1,960
|
host-gcc/stdlib/psp.S
|
/*
* Copyright (c) 2019--2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/acconfig.h"
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (psp.S.LIBI86)
.Lctor_psp:
movb $0x51, %ah
int $0x21
movw %bx, __libi86_psp
RET_(0)
.section .ctors.65535
.balign 2
TEXT_PTR_ (.Lctor_psp)
.bss
#ifndef _LIBI86_INTERNAL_HAVE__PSP
.global _psp
_psp:
#endif
.global __libi86_psp
__libi86_psp:
.skip 2
|
stsp/libi86
| 2,281
|
host-gcc/stdlib/osmajor-osminor.S
|
/*
* Copyright (c) 2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/acconfig.h"
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (osmajor_osminor.S.LIBI86)
.Lctor_osmajor_osminor:
movb $0x30, %ah
int $0x21
movw %ax, 0f
RET_(0)
.section .ctors.65535
.balign 2
TEXT_PTR_ (.Lctor_osmajor_osminor)
.bss
/* The variables must be arranged like this, so that a single store of %ax
can correctly fill both {__libi86_}_osmajor and {__libi86_}_osminor. */
0:
#ifndef _LIBI86_INTERNAL_HAVE__OSMAJOR
.global _osmajor
_osmajor:
#endif
.global __libi86_osmajor
__libi86_osmajor:
.skip 1
#ifndef _LIBI86_INTERNAL_HAVE__OSMINOR
.global _osminor
_osminor:
#endif
.global __libi86_osminor
__libi86_osminor:
.skip 1
|
stsp/libi86
| 2,526
|
host-gcc/process/libi86-init-causeway.S
|
/*
* Copyright (c) 2022 TK Chia
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/acconfig.h"
.arch i286, jumps
.code16
.att_syntax prefix
/*
* In DOS extender mode, some libi86 modules only work properly with the
* CauseWay (or compatible) DOS extender. These modules link in the code
* below to check if the DOS extender at runtime is indeed CauseWay.
*
* Such a check is probably prudent, as there is a practice of replacing a
* program's DOS extender with a different DOS extender. (For example,
* DOS/32A describes itself as "a drop-in replacement for the DOS/4GW DOS
* Extender and compatibles" (https://sourceforge.net/projects/dos32a/).)
*
* Try to make the check happen early during the initialization of
* newlib-ia16's C runtime.
*/
#define epsp_parent 0x100
.section .msdos_init.causeway, "ax"
pushaw
pushw %es
movw $0xff00, %ax
xorw %bx, %bx
clc
int $0x31
call .1 /* check if %bx:0 if an EPSP; also
load %es */
movw %es:epsp_parent, %bx /* get the parent EPSP */
call .2 /* now check that the parent is
actually also an EPSP */
popw %es
popaw
.section .text.startup.msdos_init.causeway, "ax"
.0:
pushw %ss
popw %ds
movb $9, %ah
movw $.msg, %dx
int $0x21
movw $0x4cff, %ax
int $0x21
.1:
jc .0
.2:
larw %bx, %ax /* check descr. %bx's access rights: */
jnz .0 /* should be data segment & not */
andb $0b10011100, %ah /* expand-down */
cmpb $0b10010000, %ah
jnz .0
lslw %bx, %ax /* check %bx's limit --- the */
jnz .0 /* epsp_parent field should be */
cmpw $epsp_parent+1, %ax /* accessible */
jb .0
movw %bx, %es /* check for PSP signature at %bx:0 */
cmpw $0x20cd, %es:0 /* also load %es */
jnz .0
ret
.section .msdos_init_rodata, "a"
.balign 2
.msg: .ascii "Not running on CauseWay-compatible DOS extender!$"
.balign 2
.global __libi86_have_init_causeway
.set __libi86_have_init_causeway, 1
|
stsp/libi86
| 4,920
|
host-gcc/process/spawnlx.S
|
/*
* Copyright (c) 2022 TK Chia
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include "libi86/internal/arch.h"
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/acconfig.h"
.code16
.att_syntax prefix
TEXT_ (dos_spawnlx.S.LIBI86)
#if defined __TINY__ || defined __SMALL__
# define FAR_ADJ 0
#elif defined __MEDIUM__
# define FAR_ADJ 2
#else
# error "unknown memory model"
#endif
#if defined L_spawnl
.global _spawnl
.weak spawnl
_spawnl:
spawnl:
#elif defined L_spawnle
.global _spawnle
.weak spawnle
_spawnle:
spawnle:
#elif defined L_spawnlp
.global _spawnlp
.weak spawnlp
_spawnlp:
spawnlp:
#elif defined L_spawnlpe
.global _spawnlpe
.weak spawnlpe
_spawnlpe:
spawnlpe:
#else
# error "which function are we assembling?"
#endif
#if defined __IA16_CALLCVT_REGPARMCALL
/*
* In a _spawnl... (MODE, PATH, ARG0 [, ARG1, ... NULL ...]) call,
* ARG0 is the last fixed argument, & _not_ part of the variable
* argument list. (This follows newlib-ia16 &, well, pretty much
* everyone else.)
*
* For the `regparmcall' parameter passing convention, this means
* that ARG0 is still in a register at this point. Try to fit
* ARG0 onto the stack such that we end up with a nicely laid out
* ARGV[] := { ARG0, ARG1, ARG2, ... NULL } array. To do that, we
* need to move the function return address out of the way.
*
* We also later need to push the ENVP pointer before calling
* _spawnve (...) or _spawnvpe (...) call. Unfortunately this call
* cannot be a tail call: the callee will pop ENVP, but neither the
* caller nor the callee will be responsible for popping the stack
* copy of ARG0.
*/
pushw %ds /* `pushw %ds' is a dummy push */
pushw %es
pushw %si
pushw %di
pushw %ax
pushw %ds
popw %es
movw %sp, %di
addw $8, %di
leaw 2(%di), %si
movsw /* move return %ip */
# ifdef __MEDIUM__
movsw /* move return %cs */
# endif
movw %di, %ax /* set %cx := ARGV; store ARG0 */
xchgw %ax, %cx
stosw
# if defined L_spawnle || defined L_spawnlpe
/* Fish out ENVP by scanning for the null pointer after the ARG's. */
.byte 0x3c /* `cmpb ..., %al': skip 1 byte */
.find_envp:
lodsw
testw %ax, %ax
jnz .find_envp
movw (%si), %bx /* set %bx := ENVP */
# endif /* spawnle || spawnlpe */
popw %ax
popw %di
popw %si
popw %es
# if defined L_spawnle || defined L_spawnlpe
pushw %bx /* push ENVP */
# else
PUSH_IMM_VIA_ (0, %bx)
# endif
# if defined L_spawnlp || defined L_spawnlpe
CALL_ (_spawnvpe)
# else
CALL_ (_spawnve)
# endif
# ifdef __MEDIUM__
lretw $2
# else
retw $2
# endif
#elif defined __IA16_CALLCVT_STDCALL /* ! regparmcall */
/*
* For the `stdcall' convention, ARG0 is already on the stack, _&_
* also we can do a tail call. We still need to move the return
* address, & possibly locate ENVP, though.
*/
subw $8, %sp
push %es
pushw %si
pushw %di
pushw %ds
popw %es
movw %sp, %di
addw $6, %di
leaw 8(%di), %si
movsw /* move return %ip */
# ifdef __MEDIUM__
movsw /* move return %cs */
# endif
movsw /* move MODE */
movsw /* move PATH */
movw %si, %ax /* store ARGV */
stosw
# if defined L_spawnle || defined L_spawnlpe
.find_envp: /* look for ENVP */
lodsw
testw %ax, %ax
jnz .find_envp
movsw /* move ENVP */
# else /* spawnl || spawnlp */
xorw %ax, %ax /* store ENVP = 0 */
stosw
# endif /* spawnl || spawnlp */
pop %di
pop %si
pop %es
# if defined L_spawnlp || defined L_spawnlpe
JMP_ (_spawnvpe)
# else
JMP_ (_spawnve)
# endif
#elif defined __IA16_CALLCVT_CDECL /* ! regparmcall && ! stdcall */
/* For `cdecl': no tail call. :-| */
subw $8, %sp
push %es
pushw %si
pushw %di
pushw %ds
popw %es
movw %sp, %di
addw $6, %di
leaw 8+2+FAR_ADJ(%di), %si
movsw /* move MODE */
movsw /* move PATH */
movw %si, %ax /* store ARGV */
stosw
# if defined L_spawnle || defined L_spawnlpe
.find_envp: /* look for ENVP */
lodsw
testw %ax, %ax
jnz .find_envp
movsw /* move ENVP */
# else /* spawnl || spawnlp */
xorw %ax, %ax /* store ENVP = 0 */
stosw
# endif /* spawnl || spawnlp */
pop %di
pop %si
pop %es
# if defined L_spawnlp || defined L_spawnlpe
CALL_ (_spawnvpe)
# else
CALL_ (_spawnve)
# endif
addw $8, %sp
RET_VA_
#else /* ! regparmcall && ! stdcall && ! cdecl */
# error "unknown calling convention"
#endif /* ! regparmcall && ! stdcall && ! cdecl */
|
stsp/libi86
| 2,578
|
host-gcc/process/getpid.S
|
/*
* Copyright (c) 2022 TK Chia
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/acconfig.h"
#ifndef __IA16_FEATURE_DOSX
.arch i8086, jumps
#else
.arch i286, jumps
#endif
.code16
.att_syntax prefix
/*
* Get the current process identifier. For MS-DOS, use the Program Segment
* Prefix (PSP) segment as the PID, unless the system supports an actual
* `getpid' syscall, e.g. European MS-DOS 4.0.
*
* Special case for the CauseWay DOS extender: CauseWay is able to create
* "subprocesses" each of which has its own protected mode "PSP". If we are
* running under both European MS-DOS and CauseWay, combine the pid from
* MS-DOS with the current CauseWay "PSP" to form a 32-bit pid. Do not do
* this though if the CauseWay PSP is not the child of any parent PSP.
*
* For ELKS OS, assume that the libc already has getpid (). We define only
* __libi86_getpid (), which is used for testing.
*/
#define epsp_parent 0x100
TEXT_ (process_getpid.S.LIBI86)
/* If in DOS extender mode, force linking in libi86-init-causeway.S. */
#ifdef __IA16_FEATURE_DOSX
.reloc ., R_386_NONE, __libi86_have_init_causeway
#endif
#if defined __MSDOS__
.global __libi86_getpid
__libi86_getpid:
# ifndef _LIBI86_INTERNAL_HAVE__GETPID
.global _getpid
_getpid:
# endif
# ifndef _LIBI86_INTERNAL_HAVE_GETPID
.global getpid
getpid:
# endif
movb $0x87, %ah
stc
int $0x21
jnc .eur_dos
movw _psp, %ax
# ifndef __IA16_FEATURE_DOSX
.eur_dos:
# endif
.norm_dos:
xorw %dx, %dx
RET_ (0)
# ifdef __IA16_FEATURE_DOSX
.eur_dos:
movw _psp, %dx
pushw %ds
movw %dx, %ds
cmpw epsp_parent, %dx
popw %ds
jz .norm_dos
shrw $2, %dx /* try to ensure pid is positive... */
RET_ (0)
# endif
#elif defined __ELKS__ /* ! __MSDOS__ */
.global __libi86_getpid
__libi86_getpid:
pushw %ax
movw %sp, %bx
movw $20, %ax
int $0x80
pop %ax
RET_ (0)
#else /* ! __MSDOS__ && ! __ELKS__ */
# warning "unknown target OS; __libi86_getpid () not implemented"
#endif
|
stsp/libi86
| 2,000
|
host-gcc/dpmi/dpmigetsegmentbaseaddress.S
|
/*
* Copyright (c) 2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmigetsegmentbaseaddress.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIGetSegmentBaseAddress
_DPMIGetSegmentBaseAddress:
ENTER_BX_ (2)
MOV_ARG0W_BX_ (%bx)
movw $-1, %cx
movw %cx, %dx
movw $0x0006, %ax
int $0x31
xchgw %ax, %cx
xchgw %ax, %dx
RET_ (2)
#else
# warning "unknown target OS; _DPMIGetSegmentBaseAddress (.) not implemented"
#endif
|
stsp/libi86
| 1,988
|
host-gcc/dpmi/dpmisetdescaccrights.S
|
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmisetdescaccrights.S.LIBI86)
#ifdef __MSDOS__
.global _DPMISetDescriptorAccessRights
_DPMISetDescriptorAccessRights:
ENTER_BX_ (4)
MOV_ARG2W_BX_ (%cx)
MOV_ARG0W_BX_ (%bx)
movw $0x0009, %ax
int $0x31
sbbw %ax, %ax
RET_ (4)
#else
# warning \
"unknown target OS; _DPMISetDescriptorAccessRights (, ) not implemented"
#endif
|
stsp/libi86
| 1,974
|
host-gcc/dpmi/dpmiallocatedosmemoryblock.S
|
/*
* Copyright (c) 2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmiallocatedosmemoryblock.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIAllocateDOSMemoryBlock
_DPMIAllocateDOSMemoryBlock:
ENTER_BX_ (2)
MOV_ARG0W_BX_ (%bx)
movw $0x0100, %ax
int $0x31
jnc 0f
xorw %ax, %ax
cwtd
0:
RET_ (2)
#else
# warning "unknown target OS; _DPMIAllocateDOSMemoryBlock (.) not implemented"
#endif
|
stsp/libi86
| 1,985
|
host-gcc/dpmi/dpmicreatecsaliasdesc.S
|
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmicreatecsaliasdesc.S.LIBI86)
#ifdef __MSDOS__
.global _DPMICreateCodeSegmentAliasDescriptor
_DPMICreateCodeSegmentAliasDescriptor:
ENTER_BX_ (2)
MOV_ARG0W_BX_ (%bx)
movw $0x000a, %ax
int $0x31
sbbw %dx, %dx
RET_ (2)
#else
# warning \
"unknown target OS; _DPMICreateCodeSegmentAliasDescriptor (.) not implemented"
#endif
|
stsp/libi86
| 2,005
|
host-gcc/dpmi/dpmisetdescriptor.S
|
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmisetdescriptor.S.LIBI86)
#ifdef __MSDOS__
.global _DPMISetDescriptor
_DPMISetDescriptor:
ENTER_BX_ (6)
pushw %di
pushw %es
LES_ARG2W_BX_ (%di)
MOV_ARG0W_BX_ (%bx)
movw $0x000c, %ax
CALLI_ (__libi86_dpmi16_shim)
sbbw %ax, %ax
popw %es
popw %di
RET_ (6)
#else
# warning "unknown target OS; _DPMISetDescriptor (, ) not implemented"
#endif
|
stsp/libi86
| 3,915
|
host-gcc/dpmi/libi86-dpmi16-shim.S
|
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i286, jumps
.code16
.att_syntax prefix
TEXT_ (libi86_dpmi_32bit.S.LIBI86)
/*
* Figure out whether we were started as a 32-bit DPMI application
* (even though we are running 16-bit code), which may happen if the
* program was built in "dual mode" (-mdosx32). If so, we need to
* clear the high halves of certain 32-bit registers when calling
* certain DPMI functions.
*
* FIXME: this is all incredibly ugly.
*/
.Lctor_dpmi16_shim:
#ifndef __IA16_FEATURE_DOSX
CALL_ (__DPMI_hosted)
decw %ax
jnz .done2
#endif
movw $0x0400, %ax /* if the CPU is an 80286, then */
int $0x31 /* we are done */
cmpb $2, %cl
jz .done2
.arch i386 /* not 286? assume 386+ */
movw $0x0202, %ax /* back up vector for exception 4 */
movb $4, %bl /* (overflow) */
int $0x31
jc .done2
pushw %cx /* temporarily direct exception 4 */
pushl %edx /* to ourselves */
incw %ax
movw %cs, %cx
movl $.Lisr, %edx
int $0x31
jc .done
rorb %al /* %al was 3 */
into /* trigger overflow exception */
into /* trigger again; one of these
`into's will be 2-byte misaligned */
.done: /* restore exception 4 vector */
popl %edx
popw %cx
movw $0x0203, %ax
int $0x31
.done2:
RET_ (0)
.Lisr:
testb $1, 0xc(%esp) /* 0xc(%esp) should be caller %sp
(aligned) for 16-bit frame, lower
half of caller %eip (possibly
unaligned) for 32-bit frame */
jz .maybe16bit
.32bit:
movb $1, __libi86_dpmi_32bit
movw $.Ldpmi16_32, __libi86_dpmi16_shim
movw $.Ldpmimux16_32, __libi86_dpmimux16_shim
lretl
.maybe16bit:
cmpw $0, 0xe(%esp) /* 0xe(%esp) should be caller %ss
for 16-bit frame, upper half of
caller %eip for 32-bit frame */
jz .32bit
lretw
.Ldpmi16_16:
int $0x31
RET_ (0)
.Ldpmimux16_16:
int $0x2f
RET_ (0)
.Ldpmi16_32:
pushl %edi
popw %di
movzx %di, %edi
int $0x31
pushw %di
popl %edi
RET_ (0)
.Ldpmimux16_32:
pushl %esi
popw %si
movzx %si, %esi
pushl %edi
popw %di
movzx %di, %edi
int $0x2f
pushw %di
popl %edi
pushw %si
popl %esi
RET_ (0)
.section .data, "aw"
.global __libi86_dpmi16_shim
__libi86_dpmi16_shim:
TEXT_PTR_ (.Ldpmi16_16)
.global __libi86_dpmimux16_shim
__libi86_dpmimux16_shim:
TEXT_PTR_ (.Ldpmimux16_16)
.section .ctors.65435
TEXT_PTR_ (.Lctor_dpmi16_shim)
.comm __libi86_dpmi_32bit, 1
|
stsp/libi86
| 2,181
|
host-gcc/dpmi/dpmigetvendorspecificapi.S
|
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmigetvendorspecificapi.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIGetVendorSpecificAPI
_DPMIGetVendorSpecificAPI:
ENTER_BX_ (4)
pushw %si
pushw %di
pushw %ds
pushw %es
LDS_ARG0W_BX_ (%si)
xorw %di, %di
movw %di, %es
movw $0x168a, %ax
CALLI_ (%ss:__libi86_dpmimux16_shim)
testb %al, %al
jnz .error
xchgw %ax, %di
movw %es, %di
.done:
popw %es
popw %ds
popw %di
popw %si
RET_ (4)
.error:
xorw %ax, %ax
cwtd
jmp .done
#else
# warning "unknown target OS; _DPMIGetVendorSpecificAPI (.) not implemented"
#endif
|
stsp/libi86
| 1,932
|
host-gcc/dpmi/dpmigetnextselectorincrval.S
|
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmigetnextselectorincrval.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIGetNextSelectorIncrementValue
_DPMIGetNextSelectorIncrementValue:
movw $0x0003, %ax
int $0x31
RET_ (0)
#else
# warning \
"unknown target OS; _DPMIGetNextSelectorIncrementValue () not implemented"
#endif
|
stsp/libi86
| 1,941
|
host-gcc/dpmi/dpmifreedosmemoryblock.S
|
/*
* Copyright (c) 2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmifreedosmemoryblock.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIFreeDOSMemoryBlock
_DPMIFreeDOSMemoryBlock:
ENTER_BX_ (2)
MOV_ARG0W_BX_ (%dx)
movw $0x0101, %ax
int $0x31
sbbw %ax, %ax
RET_ (2)
#else
# warning "unknown target OS; _DPMIFreeDOSMemoryBlock (.) not implemented"
#endif
|
stsp/libi86
| 1,972
|
host-gcc/dpmi/dpmisetsegmentlimit.S
|
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmisetsegmentlimit.S.LIBI86)
#ifdef __MSDOS__
.global _DPMISetSegmentLimit
_DPMISetSegmentLimit:
ENTER_BX_ (6)
MOV_ARG2W_BX_ (%dx)
MOV_ARG4W_BX_ (%cx)
MOV_ARG0W_BX_ (%bx)
movw $0x0008, %ax
int $0x31
sbbw %ax, %ax
RET_ (6)
#else
# warning "unknown target OS; _DPMISetSegmentLimit (, ) not implemented"
#endif
|
stsp/libi86
| 1,945
|
host-gcc/dpmi/dpmisegmenttodescriptor.S
|
/*
* Copyright (c) 2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmisegmenttodescriptor.S.LIBI86)
#ifdef __MSDOS__
.global _DPMISegmentToDescriptor
_DPMISegmentToDescriptor:
ENTER_BX_ (2)
MOV_ARG0W_BX_ (%bx)
movw $0x0002, %ax
int $0x31
sbbw %dx, %dx
RET_ (2)
#else
# warning "unknown target OS; _DPMISegmentToDescriptor (.) not implemented"
#endif
|
stsp/libi86
| 1,992
|
host-gcc/dpmi/dpmifreememoryblock.S
|
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmifreememoryblock.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIFreeMemoryBlock
_DPMIFreeMemoryBlock:
ENTER_BX_ (4)
pushw %si
pushw %di
MOV_ARG0W_BX_ (%di)
MOV_ARG2W_BX_ (%si)
movw $0x0502, %ax
int $0x31
popw %di
popw %si
sbbw %ax, %ax
RET_ (4)
#else
# warning "unknown target OS; _DPMIFreeMemoryBlock (.) not implemented"
#endif
|
stsp/libi86
| 2,102
|
host-gcc/dpmi/dpmisimulaterealmodeint.S
|
/*
* Copyright (c) 2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmisimulaterealmodeint.S.LIBI86)
#ifdef __MSDOS__
.global _DPMISimulateRealModeInterrupt
_DPMISimulateRealModeInterrupt:
ENTER_BX_ (10)
pushw %di
pushw %es
LES_ARG6W_BX_ (%di)
MOV_ARG4W_BX_ (%cx)
MOV_ARG0B_BX_ (%al)
MOV_ARG2B_BX_ (%ah)
xchgw %ax, %bx
movw $0x0300, %ax
CALLI_ (__libi86_dpmi16_shim)
sbbw %ax, %ax
popw %es
popw %di
RET_ (10)
#else
# warning "unknown target OS; _DPMISimulateRealModeInterrupt not implemented"
#endif
|
stsp/libi86
| 1,871
|
host-gcc/dpmi/dpmiidle.S
|
/*
* Copyright (c) 2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/acconfig.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmiidle.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIIdle
_DPMIIdle:
movw $0x1680, %ax
int $0x2f
RET_ (0)
#else
# warning "unknown target OS; _DPMIIdle () not implemented"
#endif
|
stsp/libi86
| 1,895
|
host-gcc/dpmi/dpmimodedetect.S
|
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/acconfig.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmimodedetect.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIModeDetect
_DPMIModeDetect:
movw $0x1686, %ax
int $0x2f
RET_ (0)
#else
# warning "unknown target OS; _DPMIModeDetect () not implemented"
#endif
|
stsp/libi86
| 1,937
|
host-gcc/dpmi/dpmifreeldtdescriptor.S
|
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmifreeldtdescriptor.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIFreeLDTDescriptor
_DPMIFreeLDTDescriptor:
ENTER_BX_ (2)
MOV_ARG0W_BX_ (%bx)
movw $0x0001, %ax
int $0x31
sbbw %ax, %ax
RET_ (2)
#else
# warning "unknown target OS; _DPMIFreeLDTDescriptor (.) not implemented"
#endif
|
stsp/libi86
| 1,953
|
host-gcc/dpmi/dpmiallocateldtdescriptors.S
|
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmiallocateldtdescriptors.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIAllocateLDTDescriptors
_DPMIAllocateLDTDescriptors:
ENTER_BX_ (2)
MOV_ARG0W_BX_ (%cx)
xorw %ax, %ax
int $0x31
sbbw %dx, %dx
RET_ (2)
#else
# warning "unknown target OS; _DPMIAllocateLDTDescriptors (.) not implemented"
#endif
|
stsp/libi86
| 3,100
|
host-gcc/dpmi/dpmi-hosted.S
|
/*
* Copyright (c) 2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/acconfig.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmi_hosted.S.LIBI86)
#ifdef __MSDOS__
# ifndef _LIBI86_INTERNAL_HAVE___DPMI_HOSTED
.weak __DPMI_hosted
__DPMI_hosted:
# endif
.global __libi86_DPMI_hosted
__libi86_DPMI_hosted:
/*
* We could try using int 0x2f, ax = 0x1686, but the _DOS Protected
* Mode Interface (DPMI)_ version 1.0 warns,
*
* "This function should not be used to determine if a DPMI host
* is present. A client should make sure that DPMI services are
* available before calling this function; otherwise, the
* results returned by the function may not be valid."
*
* So instead, we do some tests with the segment registers to see if
* they behave like in real mode (or V86 mode) or like in protected
* mode.
*/
subw $0x30, %sp
movw %sp, %bx
movw $1, %ax
movb %ah, (%bx)
movb %al, 0x10(%bx)
movb $2, 0x20(%bx)
/*
* Frob the lowest bit of the segment value.
* * In real or V86 mode, the resulting value will refer to the
* segment one paragraph higher or lower than our data segment.
* * In protected mode, this will refer to the same segment, with
* only a different requested privilege level (RPL).
*/
movw %ds, %cx
xorb %al, %cl
movw %cx, %ds
/* Return 1 if running under DPMI, -1 otherwise. */
cmpb %al, 0x10(%bx)
jz .pm
negw %ax
.pm:
movw %ss, %cx
movw %cx, %ds
addw $0x30, %sp
RET_ (0)
#else
# warning "unknown target OS; __DPMI_hosted () not implemented"
#endif
|
stsp/libi86
| 2,241
|
host-gcc/dpmi/dpmiallocatememoryblock.S
|
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmiallocatememoryblock.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIAllocateMemoryBlock
_DPMIAllocateMemoryBlock:
ENTER_BX_ (6)
#ifdef __IA16_CALLCVT_REGPARMCALL
xchgw %ax, %dx
xchgw %ax, %cx
xchgw %ax, %bx
#else
MOV_ARG0W_BX_ (%dx)
MOV_ARG2W_BX_ (%cx)
MOV_ARG4W_BX_ (%bx)
#endif
pushw %si
pushw %di
movw $0x0501, %ax
int $0x31
jc 0f
xchgw %dx, %di
xchgw %ax, %cx
stosw
xchgw %ax, %bx
stosw
xchgw %ax, %dx
stosw
xchgw %ax, %si
stosw
0:
sbbw %ax, %ax
pop %di
pop %si
RET_ (6)
#else
# warning "unknown target OS; _DPMIAllocateMemoryBlock (, ) not implemented"
#endif
|
stsp/libi86
| 1,945
|
host-gcc/dpmi/dpmigetvirtualintstate.S
|
/*
* Copyright (c) 2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/acconfig.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmigetvirtualintstate.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIGetVirtualInterruptState
_DPMIGetVirtualInterruptState:
movw $0x0902, %ax
int $0x31
RET_ (0)
#else
# warning "unknown target OS; _DPMIGetVirtualInterruptState () not implemented"
#endif
|
stsp/libi86
| 1,996
|
host-gcc/dpmi/dpmisetsegmentbaseaddress.S
|
/*
* Copyright (c) 2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmisetsegmentbaseaddress.S.LIBI86)
#ifdef __MSDOS__
.global _DPMISetSegmentBaseAddress
_DPMISetSegmentBaseAddress:
ENTER_BX_ (6)
MOV_ARG2W_BX_ (%dx)
MOV_ARG4W_BX_ (%cx)
MOV_ARG0W_BX_ (%bx)
movw $0x0007, %ax
int $0x31
sbbw %ax, %ax
RET_ (6)
#else
# warning "unknown target OS; _DPMISetSegmentBaseAddress (, ) not implemented"
#endif
|
stsp/libi86
| 2,005
|
host-gcc/dpmi/dpmigetdescriptor.S
|
/*
* Copyright (c) 2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmigetdescriptor.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIGetDescriptor
_DPMIGetDescriptor:
ENTER_BX_ (6)
pushw %di
pushw %es
LES_ARG2W_BX_ (%di)
MOV_ARG0W_BX_ (%bx)
movw $0x000b, %ax
CALLI_ (__libi86_dpmi16_shim)
sbbw %ax, %ax
popw %es
popw %di
RET_ (6)
#else
# warning "unknown target OS; _DPMIGetDescriptor (, ) not implemented"
#endif
|
stsp/libi86
| 2,194
|
host-gcc/dpmi/dpmigetcapabilities.S
|
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (dpmigetcapabilities.S.LIBI86)
#ifdef __MSDOS__
.global _DPMIGetCapabilities
_DPMIGetCapabilities:
ENTER_BX_ (10)
pushw %di
pushw %es
pushw ARG4W_BX_
pushw ARG2W_BX_
pushw ARG0W_BX_
LES_ARG6W_BX_ (%di)
movw $0x0401, %ax
CALLI_ (__libi86_dpmi16_shim)
jc .error
popw %bx
movw %ax, (%bx)
popw %bx
movw %cx, (%bx)
popw %bx
movw %dx, (%bx)
.done:
sbbw %ax, %ax
popw %es
popw %di
RET_ (10)
.error:
popw %bx
popw %bx
popw %bx
jmp .done
#else
# warning "unknown target OS; _DPMIGetCapabilities (...) not implemented"
#endif
|
stsp/libi86
| 2,817
|
host-gcc/i86/libi86-int86x-do.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Internal implementation routine used by both the inline and out-of-line
* versions of int86 (...) and _int86f (...). This takes as its first
* argument not an interrupt number, but a pointer to a routine that calls
* the interrupt.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/arch.h"
#include "libi86/internal/struc.h"
.code16
.att_syntax prefix
.text /* N.B. */
#ifndef _BORLANDC_SOURCE
.global __libi86_int86x_do
__libi86_int86x_do:
#else
.global __libi86_bc_int86x_do
__libi86_bc_int86x_do:
#endif
ENTER_BX_(8)
pushw %bp
pushw %si
pushw %di
pushw %es
MOV_ARG6W_BX_(%si) /* seg_regs */
pushw %si
movw (%si), %es
pushw ARG4W_BX_ /* out_regs */
PUSH_IMM_VIA_(.done, %di)
pushw ARG0W_BX_ /* intr_call */
pushw 6(%si)
MOV_ARG2W_BX_(%bx) /* in_regs */
LOAD_UNION_REGS_BX_
popw %ds
ret
.done:
pushw %bx
movw %sp, %bx
movw %ss:4(%bx), %bx /* seg_regs */
movw %ds, %ss:6(%bx) /* store %ds from interrupt call */
pushw %ss /* restore %ds */
popw %ds
movw %es, (%bx) /* store %es, %cs, %ss */
movw %cs, 2(%bx)
movw %ss, 4(%bx)
movw %sp, %bx
movw 2(%bx), %bx /* out_regs */
STORE_UNION_REGS_BX_POP_CLOBBER_
popw %cx
popw %cx
cld
popw %es
popw %di
popw %si
popw %bp
RET_(8)
|
stsp/libi86
| 1,783
|
host-gcc/i86/nosound.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (nosound.S.LIBI86)
.global nosound
nosound:
pushfw
cli
inb $0x61, %al
andb $0xfc, %al
outb %al, $0x61
popfw
RET_(0)
|
stsp/libi86
| 1,717
|
host-gcc/i86/enable.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (enable.S.LIBI86)
.global _enable
_enable:
sti
RET_(0)
|
stsp/libi86
| 2,601
|
host-gcc/i86/libi86-int86-do.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Internal implementation routine used by both the inline and out-of-line
* versions of int86 (...) and _int86f (...). This takes as its first
* argument not an interrupt number, but a pointer to a routine that calls
* the interrupt.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/arch.h"
#include "libi86/internal/struc.h"
.code16
.att_syntax prefix
.text /* N.B. */
#ifndef _BORLANDC_SOURCE
.global __libi86_int86_do
__libi86_int86_do:
#else
.global __libi86_bc_int86_do
__libi86_bc_int86_do:
#endif
ENTER_BX_(6)
pushw %bp
pushw %si
pushw %di
pushw %es
movw %ds, %si /* good idea to set %es = %ds here */
movw %si, %es
pushw ARG4W_BX_ /* out_regs */
PUSH_IMM_VIA_(.done, %si)
pushw ARG0W_BX_ /* intr_call */
MOV_ARG2W_BX_(%bx) /* in_regs */
LOAD_UNION_REGS_BX_
ret
.done:
pushw %bx
movw %ss, %bx /* restore %ds */
movw %bx, %ds
movw %sp, %bx
movw 2(%bx), %bx /* out_regs */
STORE_UNION_REGS_BX_POP_CLOBBER_
popw %cx
cld
popw %es
popw %di
popw %si
popw %bp
RET_(6)
|
stsp/libi86
| 1,720
|
host-gcc/i86/disable.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (disable.S.LIBI86)
.global _disable
_disable:
cli
RET_(0)
|
stsp/libi86
| 2,540
|
host-gcc/i86/sound.S
|
/*
* Copyright (c) 2018--2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
#define KIOCSOUND 0x4b2f
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (sound.S.LIBI86)
.global __libi86_sound
.global sound
__libi86_sound:
sound:
#ifdef __ELKS__ /* if not console tty, do nothing */
cmpb $0, __libi86_vid_is_console
jz .Ldone
#endif
ENTER_BX_(2)
MOV_ARG0W_BX_CLOBBER_(%cx)
movw $0x34dd, %ax /* 1193181 == 0x1234dd */
cwtd
cmpw $19, %cx
jb .Lplay /* %dx == 0 */
movw %cx, %bx
shrw %bx
addw %bx, %ax
adcw $0x12, %dx
divw %cx /* this will never overflow */
xchgw %ax, %dx
.Lplay:
#ifdef __ELKS__
movw $54, %ax /* ioctl syscall */
movw __libi86_con_out_fd, %bx
movw $KIOCSOUND, %cx
int $0x80
testw %ax, %ax /* return if OK, otherwise... */
jns .Ldone
#endif
pushfw /* do direct I/O on PC speaker */
cli
inb $0x61, %al
orb $0x03, %al
outb %al, $0x61
movb $0xb6, %al
outb %al, $0x43
xchgw %dx, %ax
outb %al, $0x42
movb %ah, %al
outb %al, $0x42
popfw
.Ldone:
RET_(2)
|
stsp/libi86
| 2,055
|
host-gcc/i86/segread.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* For the %cs value, this implementation simply fills in segread (.)'s text
* segment value, following Open Watcom. For the medium memory model, it
* might make a bit more sense to fill in the _caller's_ %cs value...
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (segread.S.LIBI86)
.global segread
segread:
ENTER_BX_(2)
MOV_ARG0W_BX_CLOBBER_(%bx)
movw %es, (%bx)
movw %cs, 2(%bx)
movw %ss, 4(%bx)
movw %ds, 6(%bx)
RET_(2)
|
stsp/libi86
| 2,339
|
host-gcc/i86/libi86-sound-by-divisor.S
|
/*
* Copyright (c) 2018--2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
#define KIOCSOUND 0x4b2f
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (libi86_sound_by_divisor.S.LIBI86)
.global __libi86_sound_by_divisor
__libi86_sound_by_divisor:
#ifdef __ELKS__ /* if not console tty, do nothing */
cmpb $0, __libi86_vid_is_console
jz .Ldone
#endif
ENTER_BX_(2)
MOV_ARG0W_BX_CLOBBER_(%dx)
#ifdef __ELKS__
movw $54, %ax /* ioctl syscall */
movw __libi86_con_out_fd, %bx
movw $KIOCSOUND, %cx
int $0x80
testw %ax, %ax /* return if OK, otherwise... */
jns .Ldone
#endif
pushfw /* do direct I/O on PC speaker */
cli
inb $0x61, %al
orb $0x03, %al
outb %al, $0x61
movb $0xb6, %al
outb %al, $0x43
xchgw %dx, %ax
outb %al, $0x42
movb %ah, %al
outb %al, $0x42
popfw
.Ldone:
RET_(2)
|
stsp/libi86
| 2,429
|
host-gcc/i86/libi86-intrf-do.S
|
/*
* Copyright (c) 2018--2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Internal implementation routine used by both the inline and out-of-line
* versions of intr (...) and _intrf (...). This takes as its first argument
* not an interrupt number, but a pointer to a routine that calls the
* interrupt.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/arch.h"
#include "libi86/internal/struc.h"
.code16
.att_syntax prefix
.text /* N.B. */
.global __libi86_intrf_do
__libi86_intrf_do:
ENTER_BX_(6)
pushw %bp
pushw %si
pushw %di
pushw %es
MOV_ARG2W_BX_(%di) /* regs */
pushw %di
PUSH_IMM_VIA_(.done, %si)
pushw ARG0W_BX_ /* intr_call */
MOV_ARG4B_BX_(%ah) /* flags */
sahf
LOAD_UNION_REGPACK_DI_
ret
.done:
pushw %bp
movw %sp, %bp
movw 2(%bp), %bp /* regs */
STORE_UNION_REGPACK_BP_POP_
popw %ax
cld
movw %ss, %ax
movw %ax, %ds
popw %es
popw %di
popw %si
popw %bp
RET_(6)
|
stsp/libi86
| 1,782
|
host-gcc/i86/libi86-intr-dispatch.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.code16
.att_syntax prefix
.data
.balign 2
.global __libi86_intr_dispatch
__libi86_intr_dispatch:
.irpc da, 0123
.irpc db, 01234567
.irpc dc, 01234567
.hword __libi86_intr_call_0\da\db\dc
.endr
.endr
.endr
|
stsp/libi86
| 2,301
|
host-gcc/i86/libi86-intr-call.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This file will be compiled with intr_no spanning values from 0000 to 0377
* (numerically, 0x00 to 0xff).
*
* All the routines here are near routines in the default text segment
* (.text). The external routines that reference these (__libi86_int86_do
* (...) etc.) should also go into .text, even if they are far, so that they
* can directly invoke the routines here.
*/
#APP
#define P_(x, y) P2_ (x, y)
#define P2_(x, y) x ## y
.code16
.att_syntax prefix
.text
.global P_ (__libi86_intr_call_, intr_no)
P_ (__libi86_intr_call_, intr_no):
#if intr_no == 3
int3
ret
#else
int $(intr_no)
# ifdef __MSDOS__
# if intr_no == 0x25 || intr_no == 0x26
jc 0f
popfw
clc
ret
0:
popfw
stc
# endif
# endif
ret
#endif
|
stsp/libi86
| 1,983
|
host-gcc/conio/ungetch.S
|
/*
* Copyright (c) 2018--2023 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (ungetch.S.LIBI86)
.global _ungetch
.weak ungetch
_ungetch:
ungetch:
ENTER_BX_(2)
MOV_ARG0B_BX_(%al)
movw $__libi86_ungetch_buf, %bx
cmpw $0, (%bx)
jnz .Lerr
lahf /* put something non-zero into %ah;
we know ZF is set at this point */
movw %ax, (%bx)
movb $0, %ah
RET_(2)
.Lerr:
movw $-1, %ax
RET_(2)
|
stsp/libi86
| 1,926
|
host-gcc/conio/outp.S
|
/*
* Copyright (c) 2018--2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (outp.S.LIBI86)
.text
.global __libi86_outp
.weak outp
.weak _outp
.weak outportb
__libi86_outp:
outp:
_outp:
outportb:
ENTER_BX_(4)
#ifndef __IA16_CALLCVT_REGPARMCALL
MOV_ARG0W_BX_(%dx)
MOV_ARG2W_BX_(%ax)
#else
xchgw %ax, %dx
#endif
outb %al, %dx
RET_(4)
|
stsp/libi86
| 1,980
|
host-gcc/conio/outpw.S
|
/*
* Copyright (c) 2018--2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (outpw.S.LIBI86)
.global __libi86_outpw
.global __libi86_outpw_signed
.weak outpw
.weak _outpw
.weak outportw
__libi86_outpw:
__libi86_outpw_signed:
outpw:
_outpw:
outportw:
ENTER_BX_(4)
#ifndef __IA16_CALLCVT_REGPARMCALL
MOV_ARG0W_BX_(%dx)
MOV_ARG2W_BX_(%ax)
#else
xchgw %ax, %dx
#endif
outw %ax, %dx
RET_(4)
|
stsp/libi86
| 1,892
|
host-gcc/conio/inpw.S
|
/*
* Copyright (c) 2018--2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (inpw.S.LIBI86)
.global __libi86_inpw
.global __libi86_inpw_signed
.weak inpw
.weak _inpw
.weak inportw
__libi86_inpw:
__libi86_inpw_signed:
inpw:
_inpw:
inportw:
ENTER_BX_(2)
MOV_ARG0W_BX_CLOBBER_(%dx)
inw %dx, %ax
RET_(2)
|
stsp/libi86
| 1,847
|
host-gcc/conio/inp.S
|
/*
* Copyright (c) 2018--2020 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (inp.S.LIBI86)
.global __libi86_inp
.weak inp
.weak _inp
.weak inportb
__libi86_inp:
inp:
_inp:
inportb:
ENTER_BX_(2)
MOV_ARG0W_BX_CLOBBER_(%dx)
inb %dx, %al
movb $0, %ah
RET_(2)
|
stsp/libi86
| 2,421
|
host-gcc/conio/vcscanf-autofloat.S
|
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Under gcc-ia16 with -mnewlib-autofloat-stdio, this module is linked in if
* a program uses cscanf (...) or vcscanf (...) with floating-point
* arguments. This module will in turn trigger the linking in of floating-
* -point vsscanf (...).
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
.global __ia16_have_scanf_float.cscanf.v2
.set __ia16_have_scanf_float.cscanf.v2, 1
.global __ia16_have_scanf_float.vcscanf.v2
.set __ia16_have_scanf_float.vcscanf.v2, 1
.global __ia16_have_scanf_float.__libi86_bc_cscanf.v2
.set __ia16_have_scanf_float.__libi86_bc_cscanf.v2, 1
.global __ia16_have_scanf_float.__libi86_bc_vcscanf.v2
.set __ia16_have_scanf_float.__libi86_bc_vcscanf.v2, 1
.section .autofloat_stdio.__ia16_have_scanf_float.vsscanf.v2, "a"
.reloc ., R_386_NONE, __ia16_have_scanf_float.vsscanf.v2
|
stsp/libi86
| 2,808
|
host-gcc/conio/vcprintf-autofloat.S
|
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Under gcc-ia16 with -mnewlib-autofloat-stdio, this module is linked in if
* a program uses cprintf (...) or vcprintf (...) with floating-point
* arguments. This module will in turn trigger the linking in of floating-
* -point vfprintf (...), vprintf (...), or vsnprintf (...).
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
#ifndef _BORLANDC_SOURCE
.global __ia16_have_printf_float.cprintf.v2
.set __ia16_have_printf_float.cprintf.v2, 1
.global __ia16_have_printf_float.vcprintf.v2
.set __ia16_have_printf_float.vcprintf.v2, 1
# ifdef __MSDOS__
.section .autofloat_stdio.__ia16_have_printf_float.vfprintf.v2, "a"
.reloc ., R_386_NONE, __ia16_have_printf_float.vfprintf.v2
# else
.section .autofloat_stdio.__ia16_have_printf_float.vprintf.v2, "a"
.reloc ., R_386_NONE, __ia16_have_printf_float.vprintf.v2
# endif
#else
.global __ia16_have_printf_float.__libi86_bc_cprintf.v2
.set __ia16_have_printf_float.__libi86_bc_cprintf.v2, 1
.global __ia16_have_printf_float.__libi86_bc_vcprintf.v2
.set __ia16_have_printf_float.__libi86_bc_vcprintf.v2, 1
.section .autofloat_stdio.__ia16_have_printf_float.vsnprintf.v2, "a"
.reloc ., R_386_NONE, __ia16_have_printf_float.vsnprintf.v2
#endif
|
stsp/libi86
| 2,260
|
host-gcc/string/fmemset.S
|
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
#ifdef __IA16_CMODEL_IS_FAR_TEXT /* 1st stack arg. offset from %di */
# define SA0 6
#else
# define SA0 4
#endif
TEXT_ (fmemset.S.LIBI86)
.global _fmemset
_fmemset:
pushw %di
movw %sp, %di
pushw %es
#ifdef __IA16_CALLCVT_REGPARMCALL /* we will return DEST as %dx:%ax; */
xchgw %ax, %bx /* stash offset part in %bx first */
xchgw %ax, %cx
movw SA0(%di), %cx
movw %dx, %es
movw %bx, %di
#else
movb SA0+4(%di), %al
movw SA0+6(%di), %cx
lesw SA0(%di), %di
movw %es, %dx
movw %di, %bx
#endif
movb %al, %ah
shrw %cx
rep stosw
adcw %cx, %cx
rep stosb
xchgw %ax, %bx
popw %es
popw %di
RET_ (8)
|
stsp/libi86
| 2,080
|
host-gcc/string/fmemcpy.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (fmemcpy.S.LIBI86)
.global _fmemcpy
.global __libi86_fmemmove_forward
_fmemcpy:
__libi86_fmemmove_forward:
ENTER2_BX_(10)
pushw %ds
pushw %es
pushw %si
pushw %di
MOV_ARG8W2_BX_(%cx)
MOV_ARG0W_BX_(%ax) /* we will return DEST as %dx:%ax */
MOV_ARG2W_BX_(%dx)
movw %ax, %di
movw %dx, %es
LDS_ARG4W2_BX_(%si)
shrw $1, %cx
rep movsw
adcw %cx, %cx
rep movsb
popw %di
popw %si
popw %es
popw %ds
RET2_(10)
|
stsp/libi86
| 2,024
|
host-gcc/string/fmempcpy.S
|
/*
* Copyright (c) 2018--2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (fmempcpy.S.LIBI86)
.global _fmempcpy
_fmempcpy:
ENTER2_BX_(10)
pushw %ds
pushw %es
pushw %si
pushw %di
MOV_ARG8W2_BX_(%cx)
MOV_ARG0W_BX_(%di) /* we'll return DEST + N as %dx:%ax */
MOV_ARG2W_BX_(%dx)
movw %dx, %es
LDS_ARG4W2_BX_(%si)
shrw $1, %cx
rep movsw
adcw %cx, %cx
rep movsb
xchgw %ax, %di
popw %di
popw %si
popw %es
popw %ds
RET2_(10)
|
stsp/libi86
| 1,914
|
host-gcc/string/fstrlen.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (fstrlen.S.LIBI86)
.global _fstrlen
_fstrlen:
ENTER_BX_(4)
pushw %di
pushw %es
LES_ARG0W_BX_(%di)
movw %di, %bx
xorw %ax, %ax
movw $-1, %cx
repne scasb
jnz .0
decw %ax
.0:
decw %ax
subw %cx, %ax
popw %es
popw %di
RET_(4)
|
stsp/libi86
| 2,171
|
host-gcc/string/libi86-fmemmove-backward.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (libi86_fmemmove_backward.S.LIBI86)
.global __libi86_fmemmove_backward
__libi86_fmemmove_backward:
ENTER2_BX_(10)
pushw %ds
pushw %es
pushw %si
pushw %di
MOV_ARG8W2_BX_(%cx)
MOV_ARG0W_BX_(%ax) /* we will return DEST as %dx:%ax */
MOV_ARG2W_BX_(%dx)
movw %ax, %di
movw %dx, %es
LDS_ARG4W2_BX_(%si)
addw %cx, %si
addw %cx, %di
decw %si
decw %si
decw %di
decw %di
std
shrw $1, %cx
rep movsw
adcw %cx, %cx
incw %si
incw %di
rep movsb
cld
popw %di
popw %si
popw %es
popw %ds
RET2_(10)
|
stsp/libi86
| 2,053
|
host-gcc/string/fstpcpy.S
|
/*
* Copyright (c) 2018--2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (fstpcpy.S.LIBI86)
.global _fstpcpy
_fstpcpy:
ENTER2_BX_ (8)
pushw %ds
pushw %es
pushw %si
pushw %di
MOV_ARG0W_BX_ (%di) /* %dx:%di := DEST */
MOV_ARG2W_BX_ (%dx) /* %dx := FP_SEG (DEST) */
movw %dx, %es
LDS_ARG4W2_BX_ (%si)
0:
lodsb
stosb
testb %al, %al
jnz 0b
decw %di
xchgw %ax, %di /* return %dx:%ax := DEST + length */
popw %di
popw %si
popw %es
popw %ds
RET2_ (8)
|
stsp/libi86
| 2,021
|
host-gcc/string/fstrcpy.S
|
/*
* Copyright (c) 2018--2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (fstrcpy.S.LIBI86)
.global _fstrcpy
_fstrcpy:
ENTER2_BX_ (8)
pushw %ds
pushw %es
pushw %si
pushw %di
MOV_ARG0W_BX_ (%cx) /* %dx:%cx := DEST */
MOV_ARG2W_BX_ (%dx)
movw %cx, %di
movw %dx, %es
LDS_ARG4W2_BX_ (%si)
0:
lodsb
stosb
testb %al, %al
jnz 0b
xchgw %ax, %cx /* return %dx:%ax := DEST */
popw %di
popw %si
popw %es
popw %ds
RET2_ (8)
|
stsp/libi86
| 2,337
|
host-gcc/string/fmemcmp.S
|
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (fmemcmp.S.LIBI86)
.global _fmemcmp
_fmemcmp:
ENTER2_BX_ (10)
pushw %ds
pushw %es
pushw %si
pushw %di
MOV_ARG8W2_BX_ (%cx)
LES_ARG4W2_BX_ (%di)
LDS_ARG0W_BX_ (%si)
shrw %cx
sbbw %ax, %ax
jcxz .done_words
repz cmpsw
jnz .unequal_word
.done_words:
xchgw %ax, %cx
jcxz .munge_flags
.final_byte:
cmpsb
.munge_flags:
lahf /* SZ-A-P-C */
rorb %ah
andw $0b1010000000000000, %ax /* CF set => ret. < 0 */
/* CSZ-A-P- */ /* CF clear, ZF set => ret. == 0 */
xorw $0b0010000000000000, %ax /* CF, ZF clear => ret > 0 */
popw %di
popw %si
popw %es
popw %ds
RET2_ (10)
.unequal_word:
decw %si
decw %si
decw %di
decw %di
cmpsb
jnz .munge_flags
jmp .final_byte
|
stsp/libi86
| 1,945
|
host-gcc/string/fmemchr.S
|
/*
* Copyright (c) 2018--2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (fmemchr.S.LIBI86)
.global _fmemchr
_fmemchr:
ENTER_BX_ (8)
pushw %di
pushw %es
LES_ARG0W_BX_ (%di)
MOV_ARG4B_BX_ (%al)
MOV_ARG6W_BX_ (%cx)
repnz scasb
jnz .1
decw %di
xchgw %ax, %di
movw %es, %dx
.0:
popw %es
popw %di
RET_ (8)
.1:
xorw %ax, %ax
cwtd
jmp .0
|
stsp/libi86
| 1,856
|
host-gcc/dos/getswitchar.S
|
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (getswitchar.S.LIBI86)
.global _getswitchar
.weak getswitchar
_getswitchar:
getswitchar:
movw $0x3700, %ax
int $0x21
testb %al, %al
xchgw %ax, %dx
jz 0f
movb $'/', %al
0:
movb $0, %ah
RET_ (0)
|
stsp/libi86
| 1,868
|
host-gcc/dos/dos-getvect.S
|
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.code16
.att_syntax prefix
TEXT_ (dos_getvect.S.LIBI86)
.global _dos_getvect
.global __libi86_bc_getvect
_dos_getvect:
__libi86_bc_getvect:
ENTER_BX_ (2)
pushw %es
MOV_ARG0B_BX_ (%al)
movb $0x35, %ah
int $0x21
movw %es, %dx
xchgw %ax, %bx
popw %es
RET_ (2)
|
stsp/libi86
| 1,858
|
host-gcc/dos/dos-setvect.S
|
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.code16
.att_syntax prefix
TEXT_ (dos_setvect.S.LIBI86)
.global _dos_setvect
.global __libi86_bc_setvect
_dos_setvect:
__libi86_bc_setvect:
ENTER_BX_ (6)
MOV_ARG0B_BX_ (%al)
movb $0x25, %ah
LDS_ARG2W_BX_ (%dx)
int $0x21
pushw %ss
popw %ds
RET_ (6)
|
stsp/libi86
| 3,929
|
host-gcc/dos/dos-spawn.S
|
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
#include "libi86/internal/arch.h"
.code16
.att_syntax prefix
TEXT_ (dos_spawn.S.LIBI86)
.global _dos_spawn
_dos_spawn:
ENTER_BX_ (6)
pushw %ds
pushw %es
pushw %si
pushw %di
pushw %bp
pushw %ds
popw %es
MOV_ARG0B_BX_ (%al)
MOV_ARG2W_BX_ (%dx)
MOV_ARG4W_BX_ (%bx)
xorw %cx, %cx
movb $0x4b, %ah
cmpb $4, %al
jnz .not_aexec
movb $0x80, %ah
.not_aexec:
#ifndef __IA16_FEATURE_DOSX
/*
* If we are in real or V86 mode, then according to RBIL, for int
* 0x21, %ah = 0x4b, "DOS 2.x destroys all registers, including
* SS:SP".
*
* However, the syscall obviously needs to return to the correct
* %cs:%ip, i.e. it cannot destroy %cs:%ip. So what we can do is
* to point %cs:%ip into our current stack, so that the return
* %cs:%ip gives us %ss:%sp. And we can place code on the stack
* since we are not in protected mode. :-)
*
* Push the instruction sequence
* int $0x21
* nop
* lcall $OUR_TEXT_SEG, $.cont
* onto the stack, & branch to it.
*/
pushw %cs
PUSH_IMM_VIA_ (.cont, %si)
PUSH_IMM_VIA_ (0x9a90, %si)
PUSH_IMM_VIA_ (0x21cd, %si)
movw %sp, %si
pushw %ss
pushw %si
lretw
.cont:
popw %si
cli
popw %ss
movw %si, %sp
sti
#else /* __IA16_FEATURE_DOSX */
/*
* In DOS extender mode, %ss:%sp is preserved, & we need not worry
* about any of the above silliness. :-|
*
* However, the DOS extender brings a different problem. We may be
* started in 32-bit DPMI mode, so the CauseWay DOS extender may
* expect 16:32 segment:offset pointers, not 16:16 ones, in the
* parameter block. If so, we must convert the parameter block.
*/
cmpb $0, __libi86_dpmi_32bit
jnz .convert
int $0x21
#endif /* __IA16_FEATURE_DOSX */
.done:
popw %bp
popw %di
popw %si
popw %es
popw %ds
RET_SET_ERRNO_ (6)
#ifdef __IA16_FEATURE_DOSX
.convert:
.arch i386
testb %al, %al /* we only handle %ax = 0x4b00 */
jnz .wut
pushw 0xc(%bx) /* FCB #2 segment */
pushw %cx /* (cx = 0) */
pushl 0x8(%bx) /* FCB #1 segment, FCB #2 offset */
pushw %cx
pushl 0x4(%bx) /* cmd. tail segment, FCB #1 offset */
pushw %cx
pushl (%bx) /* env. segment, cmd. tail offset */
movw %sp, %bx
int $0x21
leaw 0x14(%esp), %sp /* pop away the converted parameter
block without touching flags */
jmp .done
.wut:
movw $1, %ax
stc
jmp .done
#endif /* __IA16_FEATURE_DOSX */
|
stsp/libi86
| 1,812
|
host-gcc/dos/dos-keep.S
|
/*
* Copyright (c) 2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.code16
.att_syntax prefix
TEXT_ (dos_keep.S.LIBI86)
.global _dos_keep
.global __libi86_bc_keep
_dos_keep:
__libi86_bc_keep:
ENTER_BX_ (2)
MOV_ARG0B_BX_ (%al)
MOV_ARG2W_BX_ (%dx)
movb $0x31, %ah
int $0x21
|
stsp/libi86
| 2,885
|
host-gcc/dos/libi86-call5.S
|
/*
* Copyright (c) 2022 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (libi86_call5.S.LIBI86)
#ifdef __MSDOS__
.global __libi86_call5
__libi86_call5:
ENTER_BX_(6)
pushw %si
pushw %di
pushw %es
pushw %bp
# ifdef __IA16_CALLCVT_REGPARMCALL
xchgw %ax, %cx
# else
MOV_ARG0B_BX_(%cl)
MOV_ARG2W_BX_(%dx)
MOV_ARG4B_BX_(%al)
# endif
/*
* PSP:0x0005 only handles a near return address, but we are most
* probably running in a code segment other than the PSP segment.
* Fortunately, on MS-DOS 2+ there is a
* int $0x21
* lretw
* code sequence at offset PSP:0x0050, & we can get PSP:0x0005 to
* return to the `lretw'...
*/
pushw %cs
call 1f
popw %bp
popw %es
popw %di
popw %si
pushw %ss
popw %ds
RET_(6)
1:
pushw .Llretw_off
pushw _psp
movw $0x0005, %bx
pushw %bx
lretw
#else
# error
#endif
/*
* Handle the (unlikely) case where PSP:0x0052 is not a `lretw'
* opcode. Search PSP:0x0050--0x007e for a `lretw', & if none is
* found, stash one at PSP:0x007f.
*/
.Lctor_psp_lretw:
pushw %es
pushw %di
movw _psp, %es
movw $0x0050, %di
movb $0xcb, %al /* lretw */
movw $0x007f-0x0050, %cx
repnz scasb
jz 2f
stosb
2:
decw %di
movw %di, .Llretw_off
popw %di
popw %es
RET_ (0)
.section .ctors.65435
TEXT_PTR_ (.Lctor_psp_lretw)
.lcomm .Llretw_off, 2
|
stsp/libi86
| 1,880
|
host-gcc/dos/dos-setdate.S
|
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.code16
.att_syntax prefix
TEXT_ (dos_setdate.S.LIBI86)
.global _dos_setdate
_dos_setdate:
ENTER_BX_ (2)
MOV_ARG0W_BX_ (%bx)
movb $0x2b, %ah
movw (%bx), %dx
movw 2(%bx), %cx
int $0x21
testb %al, %al
jnz .error
cbtw
RET_ (2)
.error:
TAIL_CALL_ (__libi86_ret_einval, 2)
|
stsp/libi86
| 1,931
|
host-gcc/dos/dos-getftime.S
|
/*
* Copyright (c) 2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.code16
.att_syntax prefix
TEXT_ (dos_getftime.S.LIBI86)
.global _dos_getftime
_dos_getftime:
ENTER_BX_ (6)
pushw ARG2W_BX_
pushw ARG4W_BX_
MOV_ARG0W_BX_CLOBBER_ (%bx)
movw $0x5700, %ax
int $0x21
popw %bx
jc 0f
movw %cx, (%bx)
popw %bx
movw %dx, (%bx)
.byte 0xb1 /* movb ..., %cl */
0:
popw %bx
RET_SET_ERRNO_ (6)
|
stsp/libi86
| 1,819
|
host-gcc/dos/dos-getdate.S
|
/*
* Copyright (c) 2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.code16
.att_syntax prefix
TEXT_ (dos_getdate.S.LIBI86)
.global _dos_getdate
_dos_getdate:
ENTER_BX_ (2)
MOV_ARG0W_BX_ (%bx)
movb $0x2a, %ah
int $0x21
movw %dx, (%bx)
movw %cx, 2(%bx)
movb %al, 4(%bx)
RET_ (2)
|
stsp/libi86
| 1,871
|
host-gcc/dos/poke.S
|
/*
* Copyright (c) 2021 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.arch i8086, jumps
.code16
.att_syntax prefix
TEXT_ (poke.S.LIBI86)
.global __libi86_poke
.weak poke
__libi86_poke:
poke:
ENTER_BX_ (6)
pushw %es
MOV_ARG0W_BX_ (%es)
MOV_ARG4W_BX_CLOBBER_ (%ax)
MOV_ARG2W_BX_CLOBBER_ (%bx)
movw %ax, %es:(%bx)
popw %es
RET_ (6)
|
stsp/libi86
| 1,723
|
host-gcc/dos/dos-findclose.S
|
/*
* Copyright (c) 2019 TK Chia
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the developer(s) nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "libi86/internal/call-cvt.h"
.code16
.att_syntax prefix
TEXT_ (dos_findclose.S.LIBI86)
.global _dos_findclose
_dos_findclose:
xorw %ax, %ax
RET_ (2)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.