~ubuntu-branches/ubuntu/precise/arj/precise-security

« back to all changes in this revision

Viewing changes to arj_xms.asm

  • Committer: Bazaar Package Importer
  • Author(s): Guillem Jover
  • Date: 2004-06-27 08:07:09 UTC
  • Revision ID: james.westby@ubuntu.com-20040627080709-1gkxm72ex66gkwe4
Tags: upstream-3.10.21
ImportĀ upstreamĀ versionĀ 3.10.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;*
 
2
;* $Id: arj_xms.asm,v 1.1.1.1 2002/03/28 00:02:01 andrew_belov Exp $
 
3
;* ---------------------------------------------------------------------------
 
4
;* To make FILELIST.C less platform-dependent, its XMS routies are placed into
 
5
;* this file.
 
6
;*
 
7
 
 
8
INCLUDE         ASM_INCL.INC
 
9
 
 
10
;*
 
11
;* XMS move structure as proposed by XMS v 2.0
 
12
;*
 
13
 
 
14
xms_move        struc
 
15
  blk_length    dd      ?
 
16
  src_handle    dw      ?
 
17
  src_offset    dd      ?
 
18
  dest_handle   dw      ?
 
19
  dest_offset   dd      ?
 
20
xms_move        ends
 
21
 
 
22
;*
 
23
;* Exported stubs
 
24
;*
 
25
 
 
26
public          detect_xms, get_xms_entry, allocate_xms, free_xms, move_xms
 
27
 
 
28
.CODE
 
29
 
 
30
;*
 
31
;* Detects XMS presence. Returns 1 if it's present
 
32
;*
 
33
 
 
34
detect_xms      proc
 
35
                mov     ah, 30h
 
36
                int     21h
 
37
                cmp     al, 3
 
38
                jb      dx_none
 
39
                mov     ax, 4300h
 
40
                int     2Fh
 
41
                cmp     al, 80h
 
42
                jne     dx_none
 
43
                mov     ax, 1
 
44
                jmp     short dx_return
 
45
dx_none:
 
46
                sub     ax, ax
 
47
dx_return:
 
48
                ret
 
49
detect_xms      endp
 
50
 
 
51
;*
 
52
;* Stores XMS entry point in an internal area
 
53
;*
 
54
 
 
55
get_xms_entry   proc    uses es bx
 
56
                mov     ax, 4310h
 
57
                int     2Fh
 
58
                mov     word ptr xms_entry, bx
 
59
                mov     word ptr xms_entry+2, es
 
60
                ret
 
61
get_xms_entry   endp
 
62
 
 
63
;*
 
64
;* Allocates N kilobytes of XMS memory
 
65
;*
 
66
 
 
67
allocate_xms    proc    uses bx, kbs:word, hptr:ptr word
 
68
                mov     ah, 9
 
69
                mov     dx, kbs
 
70
                call    dword ptr xms_entry
 
71
IF @DataSize
 
72
                push    es
 
73
                les     bx, hptr
 
74
                mov     word ptr es:[bx], dx
 
75
                pop     es
 
76
ELSE
 
77
                mov     bx, hptr
 
78
                mov     word ptr ss:[bx], dx
 
79
ENDIF
 
80
                ret
 
81
allocate_xms    endp
 
82
 
 
83
;*
 
84
;* Frees a block of XMS memory
 
85
;*
 
86
 
 
87
free_xms        proc    uses bx, handle:word
 
88
                mov     ah, 0Ah
 
89
                mov     dx, handle
 
90
                call    dword ptr xms_entry
 
91
                ret
 
92
free_xms        endp
 
93
 
 
94
;*
 
95
;* Moves a block
 
96
;*
 
97
 
 
98
move_xms        proc    uses bx si ds, xms_mm:ptr xms_move
 
99
                mov     ah, 0Bh
 
100
IF @DataSize
 
101
                lds     si, xms_mm
 
102
ELSE
 
103
                mov     si, xms_mm
 
104
                push    ss
 
105
                pop     ds
 
106
ENDIF
 
107
                call    dword ptr xms_entry
 
108
                ret
 
109
move_xms        endp
 
110
 
 
111
.DATA?
 
112
 
 
113
xms_entry       dd      ?
 
114
 
 
115
                end