Releasing debian version 3:6.03+dfsg-10.
[syslinux-debian.git] / com32 / gfxboot / realmode_callback.asm
blob2ff30f26c3aec84316a1e09965dce308a86347a6
1 bits 16
3 section .text
5 ; must be filled in
6 f_buf_size dw 0
7 f_buf_seg dw 0
10 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11 gfx_cb:
12 push cs
13 pop ds
15 cmp al,cb_len
16 jae gfx_cb_80
18 movzx bx,al
19 add bx,bx
20 call word [bx+cb_table]
21 jmp gfx_cb_90
23 gfx_cb_80:
24 mov al,0ffh
25 gfx_cb_90:
26 retf
29 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
30 ; Return status info.
32 ; return:
33 ; edx filename buffer (64 bytes)
35 cb_status:
36 mov edx,cs
37 shl edx,4
38 add edx,f_name
39 xor al,al
40 ret
43 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
44 ; Open file.
46 ; return:
47 ; al 0: ok, 1: file not found
48 ; ecx file length (al = 0)
50 cb_fopen:
51 mov si,f_name
52 push ds
53 pop es
54 mov ax,6
55 int 22h
56 xchg edx,eax
57 mov al,1
58 jc cb_fopen_90
59 cmp cx,[f_buf_size]
60 ja cb_fopen_90
61 or cx,cx
62 jz cb_fopen_90
63 mov [f_block_size],cx
64 or edx,edx
65 jz cb_fopen_90
66 mov [f_handle],si
67 mov [f_size],edx
68 mov ecx,edx
69 mov ax,[f_buf_size]
70 cwd
71 div word [f_block_size]
72 mov [f_blocks],ax
74 xor al,al
75 cb_fopen_90:
76 ret
79 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
80 ; Read next chunk.
82 ; return:
83 ; edx buffer address (linear)
84 ; ecx data length (< 64k)
86 cb_fread:
87 xor ecx,ecx
88 mov si,[f_handle]
89 or si,si
90 jz cb_fread_80
91 mov cx,[f_blocks]
92 mov es,[f_buf_seg]
93 xor bx,bx
94 mov ax,7
95 int 22h
96 mov [f_handle],si
97 mov al,1
98 jc cb_fread_90
99 cb_fread_80:
100 xor al,al
101 cb_fread_90:
102 movzx edx,word [f_buf_seg]
103 shl edx,4
107 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
108 ; Return current working directory.
110 ; return:
111 ; edx filename
113 cb_getcwd:
114 mov ax,1fh
115 int 22h
116 mov edx,es
117 shl edx,4
118 movzx ebx,bx
119 add edx,ebx
120 xor al,al
124 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
125 ; Set current working directory.
127 cb_chdir:
128 mov bx,f_name
129 push ds
130 pop es
131 mov ax,25h
132 int 22h
133 xor al,al
137 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
138 ; read sector
140 ; edx sector
142 ; return:
143 ; edx buffer (linear address)
145 ; Note: does not return on error!
147 cb_readsector:
148 xor edi,edi
149 xor esi,esi
150 mov cx,1
151 mov es,[f_buf_seg]
152 xor bx,bx
153 mov ax,19h
154 int 22h
155 movzx edx,word [f_buf_seg]
156 shl edx,4
157 xor al,al
161 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
162 ; Re-read fs structures.
164 cb_mount:
165 mov ax,26h
166 int 22h
167 setc al
171 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
173 align 2, db 0
175 cb_table dw cb_status
176 dw cb_fopen
177 dw cb_fread
178 dw cb_getcwd
179 dw cb_chdir
180 dw cb_readsector
181 dw cb_mount
182 cb_len equ ($-cb_table)/2
184 f_handle dw 0
185 f_block_size dw 0
186 f_blocks dw 0
187 f_size dd 0
188 f_name times 64 db 0
189 f_name_len equ $ - f_name