x86_fat12bs/src/stage1.asm

46 lines
587 B
NASM

org 0x7c00
%include "addr.inc"
;;;;;;;;;;;;;;;;;;;;;;;
; Constant definition
;;;;;;;;;;;;;;;;;;;;;;;
section .text
bits 16
stack:
;;;;;;;;;;;;;;;;;
; FAT12 Header
;;;;;;;;;;;;;;;;;
jmp short start
%include "fat12_hdr.inc"
;;;;;;;;;;;;;;;;;;;;;
; Bootstrap code
;;;;;;;;;;;;;;;;;;;;;
start:
cld
cli
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, stack
push fn_stage2
push STAGE2_OFFSET
push STAGE2_BASE
call fat12_read_file
cmp ax, 1
je .err
jmp STAGE2_BASE:STAGE2_OFFSET
.err:
jmp $
fn_stage2: db 'STAGE2 BIN',0
%include "fat12_drv.lib"
times 510-($ - $$) db 0
dw 0xaa55