📄 nucloada.lst
字号:
244 <1> %%another:
245 000000AC AC <1> lodsb
246 000000AD 3C00 <1> cmp al,0
247 000000AF 7406 <1> jz %%done
248 000000B1 AA <1> stosb
249 000000B2 B007 <1> mov al,7
250 000000B4 AA <1> stosb
251 000000B5 EBF5 <1> jmp %%another
252 <1> %%done:
253 <1>
254 000000B7 66B80008 <1> mov ax,0x0800
255 <1> %%another2:
256 000000BB 66AB <1> stosw
257 000000BD 81FFA0800B00 <1> cmp edi,0xB8000 + 80*2
258 000000C3 72F6 <1> jb %%another2
259 <1>
260 <1> %if USE_MSG_DELAY
261 <1> mov ecx,200000000
262 <1> %else
263 000000C5 B901000000 <1> mov ecx,1
264 <1> %endif
265 <1>
266 <1> %%spin:
267 000000CA 49 <1> dec ecx
268 000000CB 75FD <1> jnz %%spin
269 <1>
270 000000CD 61 <1> popad
271 <1> %endif
272
273 ; mov esi,[ebp+8]
274 ; mov edi,[ebp+12]
275 ; mov ecx,[ebp+16]
276 000000CE FC cld
277 000000CF F3A4 rep movsb
278
279 safemsg_pm "Done copy"
280 <1> %if 1
281 000000D1 EB0C <1> jmp %%overtext
282 000000D3 0A446F6E6520636F70- <1> %%msg db 10,%1,10,0
283 000000DC 790A00 <1>
284 <1> %%overtext:
285 000000DF 60 <1> pushad
286 000000E0 BE[D3000000] <1> mov esi,%%msg
287 000000E5 BF00800B00 <1> mov edi,0xB8000
288 <1> %%another:
289 000000EA AC <1> lodsb
290 000000EB 3C00 <1> cmp al,0
291 000000ED 7406 <1> jz %%done
292 000000EF AA <1> stosb
293 000000F0 B007 <1> mov al,7
294 000000F2 AA <1> stosb
295 000000F3 EBF5 <1> jmp %%another
296 <1> %%done:
297 <1>
298 000000F5 66B80008 <1> mov ax,0x0800
299 <1> %%another2:
300 000000F9 66AB <1> stosw
301 000000FB 81FFA0800B00 <1> cmp edi,0xB8000 + 80*2
302 00000101 72F6 <1> jb %%another2
303 <1>
304 <1> %if USE_MSG_DELAY
305 <1> mov ecx,200000000
306 <1> %else
307 00000103 B901000000 <1> mov ecx,1
308 <1> %endif
309 <1>
310 <1> %%spin:
311 00000108 49 <1> dec ecx
312 00000109 75FD <1> jnz %%spin
313 <1>
314 0000010B 61 <1> popad
315 <1> %endif
316
317 ; Load CS register for real mode
318 0000010C EA[13010000]1800 jmp dword 0x0018:.loadcsrm
319 .loadcsrm:
320
321 ; Load segment registers for real mode
322 00000113 B820000000 mov eax,0x0020
323 00000118 8ED8 mov ds,ax
324 0000011A 8EC0 mov es,ax
325 0000011C 8EE0 mov fs,ax
326 0000011E 8EE8 mov gs,ax
327 00000120 8ED0 mov ss,ax
328
329 00000122 0F20C0 mov eax,cr0
330 00000125 48 dec eax
331 00000126 0F22C0 mov cr0,eax
332
333 00000129 EB01 jmp .clear_pfq2
334 0000012B 90 nop
335 .clear_pfq2:
336
337 0000012C EA[34010000]0000 jmp dword 0x0000:.rmode
338
339 00000133 90 nop
340 .rmode:
341 [BITS 16]
342 ; Real mode
343
344 00000134 31C0 xor ax,ax
345 00000136 8ED8 mov ds,ax
346 00000138 8EC0 mov es,ax
347 0000013A 8EE0 mov fs,ax
348 0000013C 8EE8 mov gs,ax
349 0000013E 8ED0 mov ss,ax
350
351 safemsg "Back to real mode"
352 <1> %if 1
353 00000140 EB14 <1> jmp %%overtext
354 00000142 0A4261636B20746F20- <1> %%msg: db 10,%1,10,0
355 0000014B 7265616C206D6F6465- <1>
356 00000154 0A00 <1>
357 <1> %%overtext:
358 00000156 6660 <1> pushad
359 00000158 6606 <1> o32 push es
360 0000015A B800B8 <1> mov ax,0xb800
361 0000015D 8EC0 <1> mov es,ax
362 0000015F 66BE[42010000] <1> mov esi,%%msg
363 00000165 31FF <1> xor di,di
364 <1> %%another:
365 00000167 AC <1> lodsb
366 00000168 3C00 <1> cmp al,0
367 0000016A 7406 <1> jz %%done
368 0000016C AA <1> stosb
369 0000016D B007 <1> mov al,7
370 0000016F AA <1> stosb
371 00000170 EBF5 <1> jmp %%another
372 <1> %%done:
373 <1>
374 00000172 B80008 <1> mov ax,0x0800
375 <1> %%another2:
376 00000175 AB <1> stosw
377 00000176 81FFA000 <1> cmp di,80*2
378 0000017A 72F9 <1> jb %%another2
379 <1>
380 <1> %if USE_MSG_DELAY
381 <1> mov ecx,200000000
382 <1> %else
383 0000017C 66B901000000 <1> mov ecx,1
384 <1> %endif
385 <1>
386 <1> %%spin:
387 00000182 6649 <1> dec ecx
388 00000184 75FC <1> jnz %%spin
389 <1>
390 00000186 6607 <1> o32 pop es
391 00000188 6661 <1> popad
392 <1> %endif
393
394 0000018A 66E8AA000000 call dword _disable_A20
395
396 00000190 665D pop ebp
397 00000192 665F pop edi
398 00000194 665E pop esi
399 00000196 665B pop ebx
400 00000198 66C9 o32 leave
401 0000019A 66C3 o32 ret
402
403 ; ------------------
404 ; Delay approximately 20ms
405 _shortdelay:
406 0000019C 6650 push eax
407 0000019E 6651 push ecx
408 %if USE_REAL_DELAY
409 000001A0 66B9204E0000 mov ecx,20000
410 %else
411 mov ecx,1
412 %endif
413 000001A6 B000 mov al,0
414 .again:
415 000001A8 E680 out 0x80,al
416 000001AA E2FC loop .again
417 000001AC 6659 pop ecx
418 000001AE 6658 pop eax
419 000001B0 66C3 o32 ret
420
421 ; ------------------
422 _EnterKernel:
423 ; safemsg "Cleaning flags"
424
425 ; Clean eflags
426 000001B2 666A02 push dword 0x00000002
427 000001B5 669D popfd
428
429 ; safemsg "Enabling A20"
430
431 000001B7 66E859000000 call dword _enable_A20
432
433 ; safemsg "Loading GDT"
434
435 000001BD 670F0115[0A000000] lgdt [dword gdtr]
436
437 ; safemsg "Disabling IRQs"
438
439 ; Disable every IRQ
440 000001C5 B0FF mov al,0xff
441 000001C7 E621 out 0x21,al
442 000001C9 E6A1 out 0xa1,al
443
444 ; safemsg "Discarding pending IRQs"
445
446 ; Throw away pending interrupts
447 000001CB B020 mov al,0x20
448 000001CD E620 out 0x20,al
449 000001CF E6A0 out 0xa0,al
450
451 ; safemsg "Enabling protected mode"
452
453 000001D1 0F20C0 mov eax,cr0
454 ; Enable native FPU exception handling and enable protected mode
455 000001D4 6683C821 or eax,0x00000021
456 000001D8 0F22C0 mov cr0,eax
457
458 000001DB EB00 jmp .clear_pfq
459 .clear_pfq:
460
461 000001DD 66EA[E6010000]0800 jmp dword 0x0008:.pmode
462 000001E5 90 nop
463 .pmode:
464 [BITS 32]
465
466 ; Load segment registers
467 000001E6 B810000000 mov eax,0x10
468 000001EB 8ED8 mov ds,ax
469 000001ED 8EC0 mov es,ax
470 000001EF 8EE0 mov fs,ax
471 000001F1 8EE8 mov gs,ax
472
473 ; Calculate temporary protected mode stack from real mode stack
474 000001F3 0FB7C4 movzx eax,sp
475 000001F6 6A10 push dword 0x0010
476 000001F8 50 push eax
477 000001F9 3E0FB22424 lss esp,[ds:esp]
478
479 ; safemsg_pm "Initializing FPU"
480
481 ; Reset FPU
482 ; clts
483 ; fninit
484
485 000001FE 83C8FF or eax,-1
486 00000201 89C3 mov ebx,eax
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -