1;  enter.ash -- function entry code assembler stuff
2;
3;  This file is part of the UCL data compression library.
4;
5;  Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
6;  All Rights Reserved.
7;
8;  The UCL library is free software; you can redistribute it and/or
9;  modify it under the terms of the GNU General Public License as
10;  published by the Free Software Foundation; either version 2 of
11;  the License, or (at your option) any later version.
12;
13;  The UCL library is distributed in the hope that it will be useful,
14;  but WITHOUT ANY WARRANTY; without even the implied warranty of
15;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16;  GNU General Public License for more details.
17;
18;  You should have received a copy of the GNU General Public License
19;  along with the UCL library; see the file COPYING.
20;  If not, write to the Free Software Foundation, Inc.,
21;  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22;
23;  Markus F.X.J. Oberhumer
24;  <markus@oberhumer.com>
25;  http://www.oberhumer.com/opensource/ucl/
26;
27
28
29; /***********************************************************************
30; //
31; ************************************************************************/
32
33%ifndef UCL_BB
34  %include "error!"
35%endif
36
37%define FP esp
38
39%ifdef UCL_SAFE
40  %if (UCL_BB == 8)
41    %define locals_size     8
42    %define OUT_END         dword [FP]
43    %define IN_END          dword [FP + 4]
44  %elif (UCL_BB == 16)
45    %define locals_size     12
46    %define OUT_END         dword [FP]
47    %define IN_END          dword [FP + 4]
48    %define IN_END2         dword [FP + 8]
49  %elif (UCL_BB == 32)
50    %define locals_size     12
51    %define OUT_END         dword [FP]
52    %define IN_END          dword [FP + 4]
53    %define IN_END4         dword [FP + 8]
54  %else
55    %include "error!"
56  %endif
57%else
58  %define locals_size       0
59%endif
60
61
62%define IN          dword [FP + locals_size + cregs_size + 4]
63%define IN_LEN      dword [FP + locals_size + cregs_size + 8]
64%define OUT         dword [FP + locals_size + cregs_size + 12]
65%define OUT_LEN     dword [FP + locals_size + cregs_size + 16]
66
67
68
69; /***********************************************************************
70; //
71; ************************************************************************/
72
73                push_cregs
74%if locals_size > 0
75                sub     esp, byte locals_size
76%endif
77%ifdef UCL_SAFE
78                mov     ebx, esp
79  %undef FP
80  %define FP ebx
81%endif
82
83                cld
84                mov     esi, IN
85                mov     edi, OUT
86
87%ifdef UCL_SAFE
88                mov     eax, edi
89                mov     edx, OUT_LEN
90                add     eax, [edx]
91                jc      L_error
92                mov     OUT_END, eax
93
94                mov     eax, esi
95                add     eax, IN_LEN
96                jc      L_error
97                mov     IN_END, eax
98
99  %if (UCL_BB == 16)
100                sub     eax, byte 2
101                jc      L_input_overrun
102                cmp     eax, esi
103                jb      L_input_overrun
104                mov     IN_END2, eax
105  %elif (UCL_BB == 32)
106                sub     eax, byte 4
107                jc      L_input_overrun
108                cmp     eax, esi
109                jb      L_input_overrun
110                mov     IN_END4, eax
111  %endif
112%endif ; ifdef UCL_SAFE
113
114
115%undef FP
116%define FP esp
117
118
119; vi:ts=8:et
120
121