modify for compile fasm 1.68 and add build.bat

git-svn-id: svn://kolibrios.org@1132 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2009-08-18 18:15:03 +00:00
parent d165a4f143
commit 69eaca2fef
10 changed files with 2253 additions and 2227 deletions

View File

@ -0,0 +1,2 @@
@fasm -m 65535 kordldr.win.asm kordldr.win
@pause

View File

@ -0,0 +1,16 @@
echo off
cls
echo ** bulding after win loader **
@fasm -m 65535 after_win/kordldr.win.asm after_win/kordldr.win
echo ==============================
echo ** building first loader for cd/dvd **
@fasm -m 65535 cdfs/bootsect.asm cdfs/bootsect.bin
echo ==============================
echo ** building first loader for fat12/fat16 **
@fasm -m 65535 fat1x/bootsect.asm fat1x/bootsect.bin
@fasm -m 65535 fat1x/kordldr.f1x.asm fat1x/kordldr.f1x
echo ==============================
echo ** building firs loader for fat32 **
@fasm -m 65535 fat32/bootsect.asm fat32/bootsect.bin
@fasm -m 65535 fat32/kordldr.f1x.asm fat32/kordldr.f1x
@pause

View File

@ -42,11 +42,11 @@ real_start:
mov bx, 55AAh mov bx, 55AAh
int 13h int 13h
mov si, aNoLBA mov si, aNoLBA
jc err jc err_
cmp bx, 0AA55h cmp bx, 0AA55h
jnz err jnz err_
test cl, 1 test cl, 1
jz err jz err_
; get file system information ; get file system information
; scan for Primary Volume Descriptor ; scan for Primary Volume Descriptor
db 66h db 66h
@ -60,7 +60,7 @@ pvd_scan_loop:
jnc @f jnc @f
fatal_read_err: fatal_read_err:
mov si, aReadError mov si, aReadError
err: err_:
call out_string call out_string
mov si, aPressAnyKey mov si, aPressAnyKey
call out_string call out_string
@ -84,7 +84,7 @@ err:
jnz pvd_scan_loop jnz pvd_scan_loop
; Volume Descriptor Set Terminator reached, no PVD found - fatal error ; Volume Descriptor Set Terminator reached, no PVD found - fatal error
mov si, no_pvd mov si, no_pvd
jmp err jmp err_
pvd_found: pvd_found:
add bx, 80h add bx, 80h
mov ax, [bx] mov ax, [bx]
@ -103,7 +103,7 @@ pvd_found:
int 12h int 12h
mov si, nomem_str mov si, nomem_str
cmp ax, 71000h / 400h cmp ax, 71000h / 400h
jb err jb err_
shr ax, 1 shr ax, 1
sub ax, 60000h / 800h sub ax, 60000h / 800h
mov [size_rest], ax mov [size_rest], ax
@ -159,7 +159,7 @@ nopathtable:
noloader: noloader:
mov si, aKernelNotFound mov si, aKernelNotFound
jmp err jmp err_
read_sectors: read_sectors:
; es:bx = pointer to data ; es:bx = pointer to data

View File

@ -0,0 +1,2 @@
@fasm -m 65535 bootsect.asm bootsect.bin
@pause

View File

@ -68,11 +68,11 @@ if use_lba
mov bx, 55AAh mov bx, 55AAh
int 13h int 13h
mov si, aNoLBA mov si, aNoLBA
jc err jc err_
cmp bx, 0AA55h cmp bx, 0AA55h
jnz err jnz err_
test cx, 1 test cx, 1
jz err jz err_
else else
mov ah, 8 mov ah, 8
int 13h int 13h
@ -122,7 +122,7 @@ end if
jz kordldr_ok jz kordldr_ok
noloader: noloader:
mov si, aLoaderNotFound mov si, aLoaderNotFound
err: err_:
call out_string call out_string
mov si, aPressAnyKey mov si, aPressAnyKey
call out_string call out_string
@ -185,7 +185,7 @@ do_read_sectors:
mov ah, 42h mov ah, 42h
int 13h int 13h
mov si, aReadError mov si, aReadError
jc err jc err_
; restore stack ; restore stack
add sp, 10h add sp, 10h
; increase current sector & buffer; decrease number of sectors ; increase current sector & buffer; decrease number of sectors
@ -257,7 +257,7 @@ do_read_sectors:
dec si dec si
jnz @b jnz @b
mov si, aReadError mov si, aReadError
jmp err jmp err_
@@: @@:
pop ax pop ax
mov ax, es mov ax, es
@ -389,4 +389,4 @@ macro show [procedure]
display 13,10 display 13,10
} }
show read_sectors, read_sectors2, lookup_in_root_dir, scan_for_filename, err, noloader show read_sectors, read_sectors2, lookup_in_root_dir, scan_for_filename, err_, noloader

View File

@ -0,0 +1,3 @@
@fasm -m 65535 bootsect.asm bootsect.bin
@fasm -m 65535 kordldr.f1x.asm kordldr.f1x
@pause

View File

@ -53,7 +53,7 @@ read_sectors dw ?
read_sectors2 dw ? read_sectors2 dw ?
lookup_in_root_dir dw ? lookup_in_root_dir dw ?
scan_for_filename dw ? scan_for_filename dw ?
err dw ? err_ dw ?
noloader dw ? noloader dw ?
cachelimit dw ? cachelimit dw ?
filesize: ; will be used to save file size filesize: ; will be used to save file size
@ -116,7 +116,7 @@ chs_noloader = 7CAEh
jae @f jae @f
nomem: nomem:
mov si, nomem_str mov si, nomem_str
jmp [err] jmp [err_]
@@: @@:
shr ax, 3 shr ax, 3
mov [cachelimit], ax ; size of cache - 1 mov [cachelimit], ax ; size of cache - 1
@ -182,7 +182,7 @@ kordldr_full:
mov di, secondary_loader_info mov di, secondary_loader_info
call load_file call load_file
test bx, bx test bx, bx
mov bx, [err] mov bx, [err_]
jz @f jz @f
mov si, aKernelNotFound mov si, aKernelNotFound
jmp bx jmp bx

View File

@ -73,11 +73,11 @@ if use_lba
mov bx, 55AAh mov bx, 55AAh
int 13h int 13h
mov si, aNoLBA mov si, aNoLBA
jc err jc err_
cmp bx, 0AA55h cmp bx, 0AA55h
jnz err jnz err_
test cl, 1 test cl, 1
jz err jz err_
else else
mov ah, 8 mov ah, 8
int 13h int 13h
@ -106,7 +106,7 @@ end if
jnc kordldr_ok jnc kordldr_ok
noloader: noloader:
mov si, aLoaderNotFound mov si, aLoaderNotFound
err: err_:
call out_string call out_string
mov si, aPressAnyKey mov si, aPressAnyKey
call out_string call out_string
@ -170,7 +170,7 @@ do_read_sectors:
mov ah, 42h mov ah, 42h
int 13h int 13h
mov si, aReadError mov si, aReadError
jc err jc err_
; restore stack ; restore stack
add sp, 10h add sp, 10h
; increase current sector & buffer; decrease number of sectors ; increase current sector & buffer; decrease number of sectors
@ -236,7 +236,7 @@ do_read_sectors:
dec si dec si
jnz @b jnz @b
mov si, aReadError mov si, aReadError
jmp err jmp err_
@@: @@:
pop ax pop ax
mov ax, es mov ax, es
@ -355,4 +355,4 @@ macro show [procedure]
display 13,10 display 13,10
} }
show read_sectors32, read_sectors2, err, noloader show read_sectors32, read_sectors2, err_, noloader

View File

@ -0,0 +1,3 @@
@fasm -m 65535 bootsect.asm bootsect.bin
@fasm -m 65535 kordldr.f32.asm kordldr.f32
@pause

View File

@ -59,7 +59,7 @@ BS_DrvNum db ?
; rb 5 ; BS_FilSysType, first 5 bytes ; rb 5 ; BS_FilSysType, first 5 bytes
read_sectors32 dw ? read_sectors32 dw ?
read_sectors2 dw ? read_sectors2 dw ?
err dw ? err_ dw ?
noloader dw ? noloader dw ?
cachelimit dw ? cachelimit dw ?
fatcachehead rw 2 fatcachehead rw 2
@ -87,12 +87,12 @@ chs_noloader = 7CA3h ; = chs_err - 3
; determine version of bootsector (LBA vs CHS) ; determine version of bootsector (LBA vs CHS)
mov [read_sectors2], chs_read_sectors2 mov [read_sectors2], chs_read_sectors2
mov bx, chs_err mov bx, chs_err
mov [err], bx mov [err_], bx
; mov [noloader], chs_noloader ; mov [noloader], chs_noloader
cmp byte [bx], 0xE8 ; [chs_err] = 0xE8 for CHS version, 0x14 for LBA version cmp byte [bx], 0xE8 ; [chs_err] = 0xE8 for CHS version, 0x14 for LBA version
jz @f jz @f
add [read_sectors2], lba_read_sectors2 - chs_read_sectors2 add [read_sectors2], lba_read_sectors2 - chs_read_sectors2
add [err], lba_err - chs_err add [err_], lba_err - chs_err
; mov [noloader], lba_noloader ; mov [noloader], lba_noloader
@@: @@:
xor bx, bx xor bx, bx
@ -102,7 +102,7 @@ chs_noloader = 7CA3h ; = chs_err - 3
jae @f jae @f
nomem: nomem:
mov si, nomem_str mov si, nomem_str
jmp [err] jmp [err_]
@@: @@:
shr ax, 3 shr ax, 3
mov [cachelimit], ax ; size of cache - 1 mov [cachelimit], ax ; size of cache - 1
@ -141,7 +141,7 @@ nomem:
call get_next_cluster call get_next_cluster
jc @f jc @f
; jmp [noloader] ; jmp [noloader]
mov ax, [err] mov ax, [err_]
sub ax, 3 sub ax, 3
jmp ax jmp ax
@@: @@:
@ -173,7 +173,7 @@ kordldr_full:
mov di, secondary_loader_info mov di, secondary_loader_info
call load_file call load_file
test bx, bx test bx, bx
mov bx, [err] mov bx, [err_]
jz @f jz @f
mov si, aKernelNotFound mov si, aKernelNotFound
jmp bx jmp bx