Subversion Repositories Kolibri OS

Rev

Rev 2 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ha 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                        ;;
3
;;  BOOTCODE.INC                                          ;;
4
;;                                                        ;;
5
;;  16 bit bootcode for MenuetOS                          ;;
6
;;                                                        ;;
7
;;  Copyright 2002 Ville Turjanmaa                        ;;
8
;;                                                        ;;
9
;;  See file COPYING for details                          ;;
10
;;                                                        ;;
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
 
13
 
14
 
15
;==========================================================================
16
;
17
;                           16 BIT FUNCTIONS
18
;
19
;==========================================================================
20
 
21
print:       push  si
22
             mov   si,leftpr-0x10000
23
             call  printplain
24
             pop   si
25
 
26
printplain:  pusha
27
             mov   dx,0x1000
28
             mov   es,dx
29
             cmp   byte [es:display_atboot-0x10000],2
30
             je    printplain_exit
31
             mov   ds,dx
32
             cld
33
             lodsb
34
           prpl1:
35
             mov   ah,0xe
36
             xor   bh,bh
37
             int   0x10
38
             lodsb
39
             cmp   al,0
40
             jne   prpl1
41
           printplain_exit:
42
             popa
43
             ret
44
 
45
setbase1000: push ax
46
             mov  ax,0x1000
47
             mov  es,ax
48
             mov  ds,ax
49
             pop  ax
50
             ret
51
 
52
getkey:      push  ecx
53
             push  edx
54
             add   ebx,0x0101
55
             xor   eax,eax
56
 
57
           gk1:
58
             in    al,0x60
59
             mov   cl,al
60
           gk0:
61
             in    al,0x60
62
             cmp   al,cl
63
             je    gk0
64
             cmp   ax,11
65
             jg    gk0
66
             gk0_1:
67
             mov   cl,al
68
 
69
;             add   al,47
70
;             mov   [ds:keyinbs-0x10000],al
71
;             mov   si,keyinbs-0x10000
72
;             call  printplain
73
 
74
           gk12:
75
             in    al,0x60
76
             cmp   al,cl
77
             je    gk12
78
             cmp   ax,240
79
             jne   gk13
80
             mov   al,cl
81
             jmp   gk14
82
           gk13:
83
             add   cl,128
84
             cmp   al,cl
85
             jne   gk1
86
             sub   al,128
87
           gk14:
88
 
89
             movzx edx,bl
90
             cmp   eax,edx
91
             jb    gk1
92
             movzx edx,bh
93
             cmp   eax,edx
94
             jg    gk1
95
             test  ebx,0x010000
96
             jnz   gk3
97
             mov   cx,0x1000
98
             mov   dx,cx
99
             add   eax,47
100
             mov   cx,ax
101
             cmp   cx,58
102
             jb    gk_nozero
103
             sub   cx,10
104
           gk_nozero:
105
             mov   [ds:keyin-0x10000],cl
106
             mov   si,keyin-0x10000
107
             call  printplain
108
           gk3:
109
             sub   eax,48
110
             pop   edx
111
             pop   ecx
112
             ret
113
 
114
 
115
;=========================================================================
116
;
117
;                           16 BIT CODE
118
;
119
;=========================================================================
120
 
121
 
122
start_of_code:
123
 
124
; RESET 16 BIT SELECTORS/REGISTERS/STACK
125
 
126
        mov  ax,0x1000
127
        mov  es,ax
128
        mov  ds,ax
129
 
130
        mov  ax,0x2000
131
        mov  ss,ax
132
        mov  sp,0xffff
133
 
134
        xor  ax,ax
135
        xor  bx,bx
136
        xor  cx,cx
137
        xor  dx,dx
138
        xor  si,si
139
        xor  di,di
140
        xor  bp,bp
141
 
142
 
143
 
144
; DRAW FRAMES
145
 
146
        call setbase1000
147
 
148
        cmp  byte [es:display_atboot-0x10000],2
149
        je   no_mode_atboot
150
 
151
        mov  ax,0x0003
152
        mov  bx,0x0000
153
        mov  dx,0x0000
154
        int  0x10
155
 
156
   no_mode_atboot:
157
 
158
 ; Load & set russian VGA font (RU.INC)
159
        mov  bp,RU_FNT1-10000h   ; RU_FNT1 - First part
160
          mov  bx,1000h            ; 768 bytes
161
          mov  cx,30h              ; 48 symbols
162
          mov  dx,80h              ; 128 - position of first symbol
163
        mov  ax,1100h
164
          push cs
165
          pop  es
166
          int  10h
167
 
168
        mov  bp,RU_FNT2-10000h   ; RU_FNT2 -Second part
169
        mov  bx,1000h            ; 512 bytes
170
        mov  cx,20h              ; 32 symbols
171
        mov  dx,0E0h             ; 224 - position of first symbol
172
        mov  ax,1100h
173
          push cs
174
          pop  es
175
          int  10h
176
 ; End set VGA russian font
177
 
178
        call setbase1000
179
        mov  ax,0xb800
180
        mov  es,ax
181
        mov  di,0
182
        mov  si,d80x25-0x10000
183
        mov  cx,80*25
184
        mov  ah,1*16+15
185
       dfl1:
186
        cld
187
        lodsb
188
        stosw
189
        loop dfl1
190
 
191
        call setbase1000
192
 
193
 
194
; SAY HI TO USER
195
 
196
        mov     si,linef2-0x10000
197
        call    printplain
198
        mov     si,version-0x10000
199
        call    print
200
 
201
 
202
; TEST FOR 386+
203
 
204
        pushf
205
        pop     ax
206
        mov     dx,ax
207
        xor     ax,0x4000
208
        push    ax
209
        popf
210
        pushf
211
        pop     ax
212
        and     ax,0x4000
213
        and     dx,0x4000
214
        cmp     ax,dx
215
        jnz     cpugood
216
        mov     si,not386-0x10000
217
        call    print
218
        jmp     $
219
     cpugood:
220
 
221
; RESET 32 BIT SELECTORS/REGISTERS/SELECTORS
222
 
223
        mov  ax,0x1000
224
        mov  es,ax
225
        mov  ds,ax
226
 
227
        mov  ax,0x2000
228
        mov  ss,ax
229
        mov  esp,0xffff
230
 
231
        xor  eax,eax
232
        xor  ebx,ebx
233
        xor  ecx,ecx
234
        xor  edx,edx
235
        xor  esi,esi
236
        xor  edi,edi
237
        xor  ebp,ebp
238
 
239
 
240
 
241
; FLUSH 8042 KEYBOARD CONTROLLER
242
 
243
;// mike.dld [
244
 ;       mov     al,0xED
245
 ;       out     0x60,al
246
 ;       or      cx,-1
247
 ;     @@:
248
 ;       in      al,0x64
249
 ;       test    al,2
250
 ;       jz      @f
251
 ;       loop    @b
252
 ;     @@:
253
 ;       mov     al,0
254
 ;       out     0x60,al
255
 ;       or      cx,-1
256
 ;     @@:
257
 ;       in      al,0x64
258
 ;       test    al,2
259
 ;       jz      @f
260
 ;       loop    @b
261
 ;     @@:
262
;// mike.dld ]
263
 
264
;       mov     ecx,10000
265
;      fl1:
266
;       in      al,0x64
267
;       loop    fl1
268
;       test    al,1
269
;       jz      fl2
270
;       in      al,0x60
271
;       jmp     fl1
272
;      fl2:
273
 
274
;****************************************************************
275
; The function is modified Mario79
276
;*****************************************************************
277
; wait_kbd:        ; variant 1
278
;       mov      cx,2500h  ;задержка порядка 10 мсек
279
; test_kbd:
280
;       in       al,64h    ;читаем состояние клавиатуры