⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boot1.asm

📁 Jazmyn is a 32-bit, protected mode, multitasking OS which runs on i386 & above CPU`s. Its complete
💻 ASM
字号:
;***********************First stage boot loader*****************************

code_seg segment use16
assume cs:code_seg

jmp start

        no386m db 'Sorry. Jasmine needs atleast 386',13,10
               db 'Press a key to reboot',0
        loading db 'Loading Jasmine....',0

        BOOT2_BASE equ 0100h  ;second stage boot loader load address  

display proc near             ;procedure : displays strings
prnt:  lodsb                  ;loads ds:si to al 
       or al,al         
       jz over
       mov ah,0Eh               ;function  
       mov bh,0                 ;page no 0
       int 10h                  
       jmp prnt
over:
       ret
display endp

check_cpu proc near           ;procedure : checks for 386 CPU
                              ;if 386 then al=1 else al=0
        pushf                 ;save flags
               
        xor ah,ah             ;check for 86 
        push ax
        popf
        pushf
        pop ax
        
        and ah,0f0h
        cmp ah,0f0h           ;86 sets high nibble of flag register to 0xF
        je no386
        
        mov ah,0f0h           ;check for 286
        push ax
        popf
        pushf
        pop ax
        
        and ah,0f0h           ;286 sets high nibble of flag register to 0
        jz no386
        
        popf
        mov al,1
        jmp over
        
no386:
        popf
        mov al,0
over:
        ret

check_cpu endp

key macro
        mov ah,0
        int 16h
endm

start:
        mov ax,07C0h        
        mov ds,ax

        cli                 ;setup boot stack
        mov ax,1000h
        mov ss,ax
        mov sp,0ffffh
        sti

        mov si,offset loading   ;display start message
        call display

        call check_cpu          ;check for a 386

        .if al == 0
                mov si,offset no386m
                key
                jmp reboot
        .endif


        mov ax,BOOT2_BASE    ;load second stage boot loader
        mov es,ax
        mov bx,0             ;int 13h loads sector(s) into ES:BX
        mov ah,02            ;command
        mov al,2             ;number of sectors to read
        mov ch,0             ;track/cylinder
        mov cl,2             ;starting sector
        mov dh,0             ;head
        mov dl,0             ;drive
        int 13h              ;BIOS disk interrupt


        db 0eah
        dw 0000h
        dw 0100h

reboot:
        db 0eah
        dw 0000h
        dw 0ffffh      

        org 510
        dw 0aa55h

code_seg ends
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -