forked from KolibriOS/kolibrios
small change. Add make a fdd image.
git-svn-id: svn://kolibrios.org@1151 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
8861a95ef3
commit
3146588b83
@ -13,4 +13,8 @@ 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
|
||||
echo ==============================
|
||||
echo ** make a image of fdd **
|
||||
@fasm -m 65535 floppy.asc kord.img
|
||||
|
||||
@pause
|
||||
|
49
kernel/trunk/sec_loader/trunk/boot/floppy.asc
Normal file
49
kernel/trunk/sec_loader/trunk/boot/floppy.asc
Normal file
@ -0,0 +1,49 @@
|
||||
include "mkfloppy.inc"
|
||||
;// insert boot sect
|
||||
file "fat1x/bootsect.bin", 512
|
||||
|
||||
; fat1
|
||||
db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0
|
||||
; fat2
|
||||
db 0F0h, 0FFh, 0FFh, 9*512-3 dup 0
|
||||
|
||||
; root
|
||||
dent kordldr, "KORDLDR F1X", FA_ARC
|
||||
dent kord, "KORD ",FA_DIR
|
||||
dent kolibri, "KOLIBRI ",FA_DIR
|
||||
; ...
|
||||
|
||||
rb 33*512-$
|
||||
;///////////////////////////
|
||||
defdir kord
|
||||
{
|
||||
dent loader, "LOADER ", FA_ARC
|
||||
dent ini,"STARTOS INI", FA_ARC
|
||||
}
|
||||
|
||||
defdir kolibri
|
||||
{
|
||||
dent kolibri_ldm, "KOLIBRI LDM", FA_ARC
|
||||
}
|
||||
|
||||
|
||||
; data
|
||||
stof kordldr, "fat1x/kordldr.f1x"
|
||||
stod kord,root
|
||||
|
||||
stof loader, "../loader"
|
||||
stof ini,"../startos.ini"
|
||||
|
||||
store dword ini_base/512+1 at ini_base+1F8h
|
||||
store word (ini_size+511)/512-1 at ini_base+1FCh
|
||||
store word 220h at ini_base+1FEh
|
||||
|
||||
stod kolibri,root
|
||||
stof kolibri_ldm, "../kolibri_ldm/bin/kolibri.ldm"
|
||||
store dword kolibri_ldm_base/512+1 at kolibri_ldm_base+1F8h
|
||||
store word (kolibri_ldm_size+511)/512-1 at kolibri_ldm_base+1FCh
|
||||
store word 220h at kolibri_ldm_base+1FEh
|
||||
|
||||
|
||||
; ...
|
||||
rb 2*80*18*512-$
|
90
kernel/trunk/sec_loader/trunk/boot/mkfloppy.inc
Normal file
90
kernel/trunk/sec_loader/trunk/boot/mkfloppy.inc
Normal file
@ -0,0 +1,90 @@
|
||||
; ---------------------------------------------------------------------------
|
||||
; mkfloppy.inc
|
||||
; ---------------------------------------------------------------------------
|
||||
; Created by Phantom-84
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
FA_RO equ 01h
|
||||
FA_HID equ 02h
|
||||
FA_SYS equ 04h
|
||||
FA_VOL equ 08h
|
||||
FA_DIR equ 10h
|
||||
FA_ARC equ 20h
|
||||
|
||||
DSTAMP equ 28C1h
|
||||
TSTAMP equ 6000h
|
||||
|
||||
root_size=0
|
||||
|
||||
macro reset id
|
||||
{
|
||||
local count, cur, disp, val, var
|
||||
times 511-($+511) mod 512 db 0
|
||||
if id#_size>0
|
||||
count=(id#_size+511)/512
|
||||
cur=id#_base/512-(33-2)
|
||||
repeat count
|
||||
if %=count
|
||||
val=0FFFh
|
||||
else
|
||||
val=cur+1
|
||||
end if
|
||||
if cur and 1
|
||||
val=val shl 4
|
||||
end if
|
||||
disp=(cur*3)/2
|
||||
load var word from 512+disp
|
||||
var=var or val
|
||||
store word var at 512+disp
|
||||
store word var at 10*512+disp
|
||||
cur=cur+1
|
||||
end repeat
|
||||
end if
|
||||
}
|
||||
|
||||
macro dent id, name, attr
|
||||
{
|
||||
@@ db name
|
||||
times @b+11-$ db 32
|
||||
db attr
|
||||
dw 0, TSTAMP, DSTAMP, DSTAMP, 0, TSTAMP, DSTAMP
|
||||
if id#_size=0
|
||||
dw 0
|
||||
else
|
||||
dw id#_base/512-(33-2)
|
||||
end if
|
||||
if (attr) and FA_DIR
|
||||
dd 0
|
||||
else
|
||||
dd id#_size
|
||||
end if
|
||||
}
|
||||
|
||||
macro orgdir id, parentid
|
||||
{
|
||||
id#_base:
|
||||
dent id, ".", FA_DIR
|
||||
dent parentid, "..", FA_DIR
|
||||
}
|
||||
|
||||
macro findir id
|
||||
{
|
||||
id#_size=$-id#_base
|
||||
reset id
|
||||
}
|
||||
|
||||
macro stod id, parentid
|
||||
{
|
||||
orgdir id, parentid
|
||||
id
|
||||
findir id
|
||||
}
|
||||
|
||||
macro stof id, name
|
||||
{
|
||||
id#_base: file name
|
||||
id#_size=$-id#_base
|
||||
reset id
|
||||
}
|
||||
|
||||
defdir fix macro
|
@ -31,14 +31,14 @@
|
||||
;======================================================================
|
||||
|
||||
|
||||
version db 'Secondary Loader v 0.009',0
|
||||
version db 'Secondary Loader v 0.010',0
|
||||
version_end:
|
||||
|
||||
select_section db 'Select section:'
|
||||
select_section_end:
|
||||
section_description db 'Section description:'
|
||||
section_description_end:
|
||||
soft_mes db 'Soft (c) 2008'
|
||||
soft_mes db 'Soft (c) 2008-2009'
|
||||
soft_mes_end:
|
||||
|
||||
badprocessor db '>Fatal - CPU 586+ required.',0
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
;Òóò îïðåäåëåíû âñå ñîîáùåíèÿ, êîòîðûå íóæíû â ïðîöåññå îòëàäêè, è ñîâñåì íå íóæíû â ðàáî÷åé êîïèè ïðîãðàììû.
|
||||
If DEBUG
|
||||
cseg_msg db ' - Adress of code segment',0
|
||||
stack_msg db 'Set stack & segments is have completed',0
|
||||
show_string db 'Have loaded size:'
|
||||
show_decode db ' ',0
|
||||
@ -57,7 +58,8 @@ firstDataSect_msg db ' -first data sector, offset to data in sectors',0
|
||||
size_root_dir_msg db ' -size root dir in sectrors',0
|
||||
DataClasters_msg db ' -size data in Clasters',0
|
||||
check_name_fat_msg db ' -if -1 name is present, else 0 then not present name',0
|
||||
convertion_file_name_msg db ' -if -1, then destination name is bad',0
|
||||
convertion_file_name_msg db ' -if -1, then destination name of file is bad',0
|
||||
start_making_FAT12_msg db '>>>>>> Begin making fat12 FS on RAMDISK <<<<<<<',0
|
||||
make_fat12_RFS_msg db '-Make FAT12 Ram FS',0
|
||||
get_type_FS_msg db '-End make RamDisk',0
|
||||
return_code_af_move db ' -return code after 0x87 int 0x15, move block',0
|
||||
|
635
kernel/trunk/sec_loader/trunk/listing.inc
Normal file
635
kernel/trunk/sec_loader/trunk/listing.inc
Normal file
@ -0,0 +1,635 @@
|
||||
; Listing generator
|
||||
; LocoDelAssembly 2007.06.01
|
||||
|
||||
INSTRUCTIONS equ bt in ja jb jc je jg jl jo jp js jz or \
|
||||
aaa aad aam aas adc add and bsf bsr btc btr bts cbw cdq clc \
|
||||
cld cli cmc cmp cqo cwd daa das dec div fld fst hlt inc ins \
|
||||
int jae jbe jge jle jmp jna jnb jnc jne jng jnl jno jnp jns \
|
||||
jnz jpe jpo lar lds lea les lfs lgs lsl lss ltr mov mul neg \
|
||||
nop not out pop por rcl rcr ret rol ror rsm sal sar sbb shl \
|
||||
shr stc std sti str sub ud2 xor \
|
||||
arpl call cdqe clgi clts cmps cwde emms fabs fadd fbld fchs \
|
||||
fcom fcos fdiv feni fild fist fld1 fldz fmul fnop fsin fstp \
|
||||
fsub ftst fxam fxch idiv imul insb insd insw int1 int3 into \
|
||||
invd iret jcxz jnae jnbe jnge jnle lahf lgdt lidt lldt lmsw \
|
||||
lods loop movd movq movs orpd orps outs pand popa popd popf \
|
||||
popq popw push pxor retd retf retn retq retw sahf salc scas \
|
||||
seta setb setc sete setg setl seto setp sets setz sgdt shld \
|
||||
shrd sidt sldt smsw stgi stos test verr verw wait xadd xchg \
|
||||
xlat \
|
||||
addpd addps addsd addss andpd andps bound bswap cmova cmovb \
|
||||
cmovc cmove cmovg cmovl cmovo cmovp cmovs cmovz cmppd cmpps \
|
||||
cmpsb cmpsd cmpsq cmpss cmpsw cpuid divpd divps divsd divss \
|
||||
enter f2xm1 faddp fbstp fclex fcomi fcomp fdisi fdivp fdivr \
|
||||
femms ffree fiadd ficom fidiv fimul finit fistp fisub fldcw \
|
||||
fldpi fmulp fneni fprem fptan fsave fsqrt fstcw fstsw fsubp \
|
||||
fsubr fucom fwait fyl2x icebp iretd iretq iretw jecxz jrcxz \
|
||||
lddqu leave lodsb lodsd lodsq lodsw loopd loope loopq loopw \
|
||||
loopz maxpd maxps maxsd maxss minpd minps minsd minss movsb \
|
||||
movsd movsq movss movsw movsx movzx mulpd mulps mulsd mulss \
|
||||
mwait outsb outsd outsw pabsb pabsd pabsw paddb paddd paddq \
|
||||
paddw pandn pause pavgb pavgw pf2id pf2iw pfacc pfadd pfmax \
|
||||
pfmin pfmul pfrcp pfsub pi2fd pi2fw popad popaw popfd popfq \
|
||||
popfw pslld psllq psllw psrad psraw psrld psrlq psrlw psubb \
|
||||
psubd psubq psubw pusha pushd pushf pushq pushw rcpps rcpss \
|
||||
rdmsr rdpmc rdtsc retfd retfq retfw retnd retnq retnw scasb \
|
||||
scasd scasq scasw setae setbe setge setle setna setnb setnc \
|
||||
setne setng setnl setno setnp setns setnz setpe setpo stosb \
|
||||
stosd stosq stosw subpd subps subsd subss vmrun vmxon wrmsr \
|
||||
xlatb xorpd xorps \
|
||||
andnpd andnps cmovae cmovbe cmovge cmovle cmovna cmovnb cmovnc\
|
||||
cmovne cmovng cmovnl cmovno cmovnp cmovns cmovnz cmovpe cmovpo\
|
||||
comisd comiss fcmovb fcmove fcmovu fcomip fcompp fdivrp ffreep\
|
||||
ficomp fidivr fisttp fisubr fldenv fldl2e fldl2t fldlg2 fldln2\
|
||||
fnclex fndisi fninit fnsave fnstcw fnstsw fpatan fprem1 frstor\
|
||||
frstpm fscale fsetpm fstenv fsubrp fucomi fucomp fxsave haddpd\
|
||||
haddps hsubpd hsubps invlpg lfence looped loopeq loopew loopne\
|
||||
loopnz loopzd loopzq loopzw mfence movapd movaps movdqa movdqu\
|
||||
movhpd movhps movlpd movlps movnti movntq movsxd movupd movups\
|
||||
paddsb paddsw pextrw pfnacc pfsubr phaddd phaddw phsubd phsubw\
|
||||
pinsrw pmaxsw pmaxub pminsw pminub pmulhw pmullw psadbw pshufb\
|
||||
pshufd pshufw psignb psignd psignw pslldq psrldq psubsb psubsw\
|
||||
pswapd pushad pushaw pushfd pushfq pushfw rdmsrq rdtscp setalc\
|
||||
setnae setnbe setnge setnle sfence shufpd shufps skinit sqrtpd\
|
||||
sqrtps sqrtsd sqrtss swapgs sysret vmcall vmload vmread vmsave\
|
||||
vmxoff wbinvd wrmsrq \
|
||||
clflush cmovnae cmovnbe cmovnge cmovnle cmpeqpd cmpeqps \
|
||||
cmpeqsd cmpeqss cmplepd cmpleps cmplesd cmpless cmpltpd \
|
||||
cmpltps cmpltsd cmpltss cmpxchg fcmovbe fcmovnb fcmovne \
|
||||
fcmovnu fdecstp fincstp fnstenv frndint fsincos fucomip \
|
||||
fucompp fxrstor fxtract fyl2xp1 invlpga ldmxcsr loopned \
|
||||
loopneq loopnew loopnzd loopnzq loopnzw monitor movddup \
|
||||
movdq2q movhlps movlhps movntdq movntpd movntps movq2dq \
|
||||
paddusb paddusw palignr pavgusb pcmpeqb pcmpeqd pcmpeqw \
|
||||
pcmpgtb pcmpgtd pcmpgtw pfcmpeq pfcmpge pfcmpgt pfpnacc \
|
||||
pfrsqrt phaddsw phsubsw pmaddwd pmulhrw pmulhuw pmuludq \
|
||||
pshufhw pshuflw psubusb psubusw rsqrtps rsqrtss stmxcsr \
|
||||
syscall sysexit sysretq ucomisd ucomiss vmclear vmmcall \
|
||||
vmptrld vmptrst vmwrite \
|
||||
addsubpd addsubps cmpneqpd cmpneqps cmpneqsd cmpneqss cmpnlepd\
|
||||
cmpnleps cmpnlesd cmpnless cmpnltpd cmpnltps cmpnltsd cmpnltss\
|
||||
cmpordpd cmpordps cmpordsd cmpordss cvtdq2pd cvtdq2ps cvtpd2dq\
|
||||
cvtpd2pi cvtpd2ps cvtpi2pd cvtpi2ps cvtps2dq cvtps2pd cvtps2pi\
|
||||
cvtsd2si cvtsd2ss cvtsi2sd cvtsi2ss cvtss2sd cvtss2si fcmovnbe\
|
||||
maskmovq movmskpd movmskps movshdup movsldup packssdw packsswb\
|
||||
packuswb pfrcpit1 pfrcpit2 pfrsqit1 pmovmskb pmulhrsw prefetch\
|
||||
sysenter sysexitq unpckhpd unpckhps unpcklpd unpcklps vmlaunch\
|
||||
vmresume \
|
||||
cmpxchg8b cvttpd2dq cvttpd2pi cvttps2dq cvttps2pi cvttsd2si \
|
||||
cvttss2si pmaddubsw prefetchw punpckhbw punpckhdq punpckhwd \
|
||||
punpcklbw punpckldq punpcklwd \
|
||||
cmpunordpd cmpunordps cmpunordsd cmpunordss cmpxchg16b \
|
||||
loadall286 loadall386 maskmovdqu prefetcht0 prefetcht1 \
|
||||
prefetcht2 punpckhqdq punpcklqdq prefetchnta
|
||||
|
||||
PREFIXES equ rep lock repe repz repne repnz
|
||||
|
||||
DATA_DEFINITORS equ db dw du dd dp df dq dt file
|
||||
DATA_RESERVERS equ rb rw rd rp rf rq rt
|
||||
|
||||
CRLF equ 13, 10 ; Remove 13 for Linux
|
||||
MAX_BYTES equ 13
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MODE MACROSES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
macro use16
|
||||
{
|
||||
use16
|
||||
_USE = 16
|
||||
}
|
||||
|
||||
macro use32
|
||||
{
|
||||
use32
|
||||
_USE = 32
|
||||
}
|
||||
|
||||
macro use64
|
||||
{
|
||||
use64
|
||||
_USE = 64
|
||||
}
|
||||
|
||||
macro detect_mode
|
||||
{
|
||||
local aux
|
||||
|
||||
_USE = 32
|
||||
|
||||
virtual at 0
|
||||
xchg eax, eax
|
||||
load aux byte from 0
|
||||
|
||||
if aux = $66
|
||||
_USE = 16
|
||||
else if aux = $87
|
||||
_USE = 64
|
||||
end if
|
||||
end virtual
|
||||
}
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;; DISPLAYING MACROSES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
macro display_address address*
|
||||
{
|
||||
local aux, digit
|
||||
|
||||
aux = address
|
||||
|
||||
repeat _USE / 4
|
||||
digit = aux shr (_USE - 4 * %) and $F
|
||||
|
||||
display digit + '0' + ('9' - 'B') and (9 - digit) shr 4 and $F
|
||||
end repeat
|
||||
|
||||
display ': '
|
||||
}
|
||||
|
||||
macro display_bytes pointer
|
||||
{
|
||||
local aux, size, digit
|
||||
|
||||
size = $ - pointer
|
||||
|
||||
if size > MAX_BYTES
|
||||
size = MAX_BYTES
|
||||
end if
|
||||
|
||||
repeat size
|
||||
load aux byte from pointer+%-1
|
||||
|
||||
digit = aux shr 4
|
||||
display digit + '0' + ('9' - 'B') and (9 - digit) shr 4 and $F
|
||||
|
||||
digit = aux and $F
|
||||
display digit + '0' + ('9' - 'B') and (9 - digit) shr 4 and $F
|
||||
|
||||
|
||||
display ' '
|
||||
end repeat
|
||||
|
||||
repeat MAX_BYTES - size
|
||||
display ' '
|
||||
end repeat
|
||||
}
|
||||
|
||||
; The macro below in some situations doesn't adds a space to separate things unfortunatelly, so for readability ensurance
|
||||
; another one will be used instead...
|
||||
;macro display_args [args]
|
||||
;{
|
||||
;common
|
||||
; aux = 1
|
||||
;
|
||||
;forward
|
||||
; if ~args eq
|
||||
; if aux
|
||||
; display ' '
|
||||
; else
|
||||
; display ', '
|
||||
; end if
|
||||
;
|
||||
; aux = 0
|
||||
;
|
||||
; match =ON, _RESOLVE_EQUATES
|
||||
; \{
|
||||
; match args, args
|
||||
; \\{
|
||||
; irps arg, args
|
||||
; \\\{
|
||||
; display \\\`arg
|
||||
; \\\}
|
||||
; \\}
|
||||
; \}
|
||||
; match =OFF, _RESOLVE_EQUATES
|
||||
; \{
|
||||
; irps arg, args
|
||||
; \\{
|
||||
; display \\`arg
|
||||
; \\}
|
||||
;
|
||||
; \}
|
||||
; end if
|
||||
;}
|
||||
|
||||
; This one separates everything with one space. A very ugly listing but at least you will not see things
|
||||
; like "push ebxesiedi" nor "ret word0"
|
||||
|
||||
macro display_args [args]
|
||||
{
|
||||
common
|
||||
aux = 1
|
||||
|
||||
forward
|
||||
if ~args eq
|
||||
if ~aux
|
||||
display ','
|
||||
end if
|
||||
|
||||
aux = 0
|
||||
|
||||
match =ON, _RESOLVE_EQUATES
|
||||
\{
|
||||
match args, args
|
||||
\\{
|
||||
if ~args eqtype ""
|
||||
irps arg, args
|
||||
\\\{
|
||||
display ' ', \\\`arg
|
||||
\\\}
|
||||
else
|
||||
display " '", args, "'"
|
||||
end if
|
||||
\\}
|
||||
\}
|
||||
match =OFF, _RESOLVE_EQUATES
|
||||
\{
|
||||
if ~args eqtype ""
|
||||
irps arg, args
|
||||
\\{
|
||||
display ' ', \\`arg
|
||||
\\}
|
||||
else
|
||||
display " '", args, "'"
|
||||
end if
|
||||
\}
|
||||
end if
|
||||
}
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;; INSTRUCTIONS & PREFIXES MACROSES ;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
macro prefix mnemonic
|
||||
{
|
||||
local aux
|
||||
|
||||
macro mnemonic [args]
|
||||
\{
|
||||
\common
|
||||
match =1, _ON_VIRTUAL\\{_LISTING equ 0\\}
|
||||
match =equ, args\\{_LISTING equ 0\\}
|
||||
match =equ any, args\\{_LISTING equ 0\\}
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_address $
|
||||
aux = $
|
||||
\\}
|
||||
|
||||
mnemonic
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_bytes aux
|
||||
|
||||
display \`mnemonic
|
||||
display CRLF
|
||||
\\}
|
||||
|
||||
match =1, _ON_VIRTUAL\\{restore _LISTING\\}
|
||||
match =equ, args\\{restore _LISTING\\}
|
||||
match =equ any, args\\{restore _LISTING\\}
|
||||
|
||||
def_prefix mnemonic
|
||||
args
|
||||
purge mnemonic
|
||||
\}
|
||||
}
|
||||
|
||||
macro def_prefix mnemonic
|
||||
{
|
||||
macro def_prefix mnemonic
|
||||
\{
|
||||
prefix mnemonic
|
||||
\}
|
||||
def_prefix mnemonic
|
||||
}
|
||||
|
||||
macro instruction mnemonic
|
||||
{
|
||||
local aux
|
||||
|
||||
macro mnemonic [args]
|
||||
\{
|
||||
\common
|
||||
match =1, _ON_VIRTUAL\\{_LISTING equ 0\\}
|
||||
match =equ, args\\{_LISTING equ 0\\}
|
||||
match =equ any, args\\{_LISTING equ 0\\}
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_address $
|
||||
aux = $
|
||||
\\}
|
||||
|
||||
mnemonic args
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_bytes aux
|
||||
|
||||
display \`mnemonic
|
||||
|
||||
virtual at 0
|
||||
db \`mnemonic
|
||||
repeat 11 - $
|
||||
display ' '
|
||||
end repeat
|
||||
end virtual
|
||||
|
||||
display_args args
|
||||
display CRLF
|
||||
\\}
|
||||
|
||||
match =1, _ON_VIRTUAL\\{restore _LISTING\\}
|
||||
match =equ, args\\{restore _LISTING\\}
|
||||
match =equ any, args\\{restore _LISTING\\}
|
||||
\}
|
||||
}
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATA MACROSES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
macro data_define mnemonic
|
||||
{
|
||||
local aux
|
||||
macro mnemonic [args]
|
||||
\{
|
||||
\common
|
||||
match =1, _ON_VIRTUAL\\{_LISTING equ 0\\}
|
||||
match =equ, args\\{_LISTING equ 0\\}
|
||||
match =equ any, args\\{_LISTING equ 0\\}
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_address $
|
||||
aux = $
|
||||
\\}
|
||||
|
||||
mnemonic args
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_bytes aux
|
||||
|
||||
display \`mnemonic
|
||||
|
||||
display_args args
|
||||
display CRLF
|
||||
|
||||
aux = aux + MAX_BYTES
|
||||
|
||||
repeat ($ - aux + MAX_BYTES - 1) / MAX_BYTES
|
||||
display_address aux
|
||||
display_bytes aux
|
||||
display CRLF
|
||||
|
||||
aux = aux + MAX_BYTES
|
||||
end repeat
|
||||
\\}
|
||||
|
||||
match =1, _ON_VIRTUAL\\{restore _LISTING\\}
|
||||
match =equ, args\\{restore _LISTING\\}
|
||||
match =equ any, args\\{restore _LISTING\\}
|
||||
\}
|
||||
|
||||
struc mnemonic [args]
|
||||
\{
|
||||
\common
|
||||
match =1, _ON_VIRTUAL\\{_LISTING equ 0\\}
|
||||
match =equ, args\\{_LISTING equ 0\\}
|
||||
match =equ any, args\\{_LISTING equ 0\\}
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_address $
|
||||
aux = $
|
||||
\\}
|
||||
|
||||
. mnemonic args
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_bytes aux
|
||||
|
||||
display \`., ' ', \`mnemonic
|
||||
|
||||
display_args args
|
||||
display CRLF
|
||||
|
||||
aux = aux + MAX_BYTES
|
||||
|
||||
repeat ($ - aux + MAX_BYTES - 1) / MAX_BYTES
|
||||
display_address aux
|
||||
display_bytes aux
|
||||
display CRLF
|
||||
|
||||
aux = aux + MAX_BYTES
|
||||
end repeat
|
||||
\\}
|
||||
|
||||
match =1, _ON_VIRTUAL\\{restore _LISTING\\}
|
||||
match =equ, args\\{restore _LISTING\\}
|
||||
match =equ any, args\\{restore _LISTING\\}
|
||||
\}
|
||||
}
|
||||
|
||||
macro data_reserve mnemonic
|
||||
{
|
||||
local aux
|
||||
macro mnemonic [args]
|
||||
\{
|
||||
\common
|
||||
match =1, _ON_VIRTUAL\\{_LISTING equ 0\\}
|
||||
match =equ, args\\{_LISTING equ 0\\}
|
||||
match =equ any, args\\{_LISTING equ 0\\}
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_address $
|
||||
aux = $
|
||||
\\}
|
||||
|
||||
mnemonic args
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
times MAX_BYTES display ' '
|
||||
|
||||
display \`mnemonic
|
||||
|
||||
display_args args
|
||||
display CRLF
|
||||
\\}
|
||||
|
||||
match =1, _ON_VIRTUAL\\{restore _LISTING\\}
|
||||
match =equ, args\\{restore _LISTING\\}
|
||||
match =equ any, args\\{restore _LISTING\\}
|
||||
\}
|
||||
|
||||
struc mnemonic [args]
|
||||
\{
|
||||
\common
|
||||
match =1, _ON_VIRTUAL\\{_LISTING equ 0\\}
|
||||
match =equ, args\\{_LISTING equ 0\\}
|
||||
match =equ any, args\\{_LISTING equ 0\\}
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
display_address $
|
||||
aux = $
|
||||
\\}
|
||||
|
||||
. mnemonic args
|
||||
|
||||
match =1, _LISTING
|
||||
\\{
|
||||
times MAX_BYTES display ' '
|
||||
|
||||
display \`., ' ', \`mnemonic
|
||||
|
||||
display_args args
|
||||
display CRLF
|
||||
\\}
|
||||
|
||||
match =1, _ON_VIRTUAL\\{restore _LISTING\\}
|
||||
match =equ, args\\{restore _LISTING\\}
|
||||
match =equ any, args\\{restore _LISTING\\}
|
||||
\}
|
||||
}
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;; LISTING CONTROL MACROSES ;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
macro virtual [args]
|
||||
{
|
||||
common
|
||||
_ON_VIRTUAL equ 1
|
||||
|
||||
virtual args
|
||||
}
|
||||
|
||||
macro end [args]
|
||||
{
|
||||
common
|
||||
match =virtual, args\{restore _ON_VIRTUAL\}
|
||||
|
||||
end args
|
||||
}
|
||||
|
||||
macro enable_listing
|
||||
{
|
||||
detect_mode
|
||||
|
||||
match =0, _MACROSES_INSTALLED
|
||||
\{
|
||||
match instructions, INSTRUCTIONS
|
||||
\\{
|
||||
irps ins, instructions
|
||||
\\\{
|
||||
instruction ins
|
||||
\\\}
|
||||
\\}
|
||||
|
||||
match prefixes, PREFIXES
|
||||
\\{
|
||||
irps prefix, prefixes
|
||||
\\\{
|
||||
def_prefix prefix
|
||||
\\\}
|
||||
\\}
|
||||
|
||||
match data_definitors, DATA_DEFINITORS
|
||||
\\{
|
||||
irps def, data_definitors
|
||||
\\\{
|
||||
data_define def
|
||||
\\\}
|
||||
\\}
|
||||
|
||||
match data_reservers, DATA_RESERVERS
|
||||
\\{
|
||||
irps def, data_reservers
|
||||
\\\{
|
||||
data_reserve def
|
||||
\\\}
|
||||
\\}
|
||||
\}
|
||||
|
||||
_MACROSES_INSTALLED equ 1
|
||||
_LISTING equ 1
|
||||
}
|
||||
|
||||
macro disable_listing
|
||||
{
|
||||
_LISTING equ 0
|
||||
}
|
||||
|
||||
macro enable [feature*]
|
||||
{
|
||||
forward
|
||||
UNKNOWN equ 1
|
||||
|
||||
match =resolve_equates, feature
|
||||
\{
|
||||
restore _RESOLVE_EQUATES
|
||||
_RESOLVE_EQUATES equ ON
|
||||
UNKNOWN equ 0
|
||||
\}
|
||||
|
||||
match =listing, feature
|
||||
\{
|
||||
enable_listing
|
||||
UNKNOWN equ 0
|
||||
\}
|
||||
|
||||
match =1, UNKNOWN
|
||||
\{
|
||||
display 'ERROR: Unknown "',`feature, '" feature', 13, 10
|
||||
err
|
||||
\}
|
||||
|
||||
restore UNKNOWN
|
||||
restore UNKNOWN
|
||||
}
|
||||
|
||||
macro disable [feature*]
|
||||
{
|
||||
UNKNOWN equ 1
|
||||
|
||||
match =resolve_equates, feature
|
||||
\{
|
||||
restore _RESOLVE_EQUATES
|
||||
_RESOLVE_EQUATES equ OFF
|
||||
UNKNOWN equ 0
|
||||
\}
|
||||
|
||||
match =listing, feature
|
||||
\{
|
||||
disable_listing
|
||||
UNKNOWN equ 0
|
||||
\}
|
||||
|
||||
match =1, UNKNOWN
|
||||
\{
|
||||
display 'ERROR: Unknown "',`feature, '" feature', 13, 10
|
||||
err
|
||||
\}
|
||||
|
||||
restore UNKNOWN
|
||||
restore UNKNOWN
|
||||
}
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; INITIALIZATION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
_MACROSES_INSTALLED equ 0
|
||||
_ON_VIRTUAL equ 0
|
||||
|
||||
disable resolve_equates
|
@ -1,4 +1,4 @@
|
||||
; Copyright (c) 2009, <Lrz>
|
||||
; Copyright (c) 2008-2009, <Lrz>
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
@ -12,7 +12,7 @@
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname <Lrz> ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
@ -25,94 +25,20 @@
|
||||
;*****************************************************************************
|
||||
|
||||
;start of the project 13.02.2008 year.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Secondary Loader copyright Alexey Teplov aka <Lrz> & K Soft team
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Secondary Loader copyright Alexey Teplov nickname <Lrz>
|
||||
;if you need log preproc
|
||||
;/////////////
|
||||
;include 'listing.inc'
|
||||
;enable listing
|
||||
;////////////
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;start of code:
|
||||
;;;;;;;;;;;;;;;
|
||||
DEBUG equ 1
|
||||
root_dir_entry_count equ 224 ;êîë-âî ýëåìåíòîâ â êîðíåâîé äèððåêòîðèè
|
||||
;point_to_fat_struc equ 0xA000 ;âðåìåííûé áóôåð, êóäà áóäåò ðàçìåùåíà Fat òàáëèöà, è çàòåì ïåðåíåñåíà çà 1 ìá
|
||||
ini_data_ equ 0x2000 ;ôàéë ãäå ðàçìåùåí ôàéë ñöåíàðèÿ çàãðóçêè, òàì ïðîèñõîäèò ñèíòàêñè÷åñêèé ðàçáîð
|
||||
size_show_section equ 18
|
||||
default_timeout_value equ 5 ;default value to timeout is will was some errors
|
||||
flag_found_default equ 0x1 ;default value is found
|
||||
flag_found_timeout equ 0x2 ;timeout value is found
|
||||
flag_found_LM equ 0x1 ;found LM value
|
||||
flag_found_RS equ 0x2 ;found RS value
|
||||
flag_found_GTRFMS equ 0x4 ;found type RamFS
|
||||
flag_found_RamdiskSector equ 0x8 ;found RamdiskSector
|
||||
flag_found_RamdiskCluster equ 0x16 ;found RamdiskCluster
|
||||
;statick data ýòè äàííûå íå ïðåäîïðåäåëÿþòñÿ â òå÷åíèè âûïîëíåíèÿ âñåé ïðîãðàììû.
|
||||
save_cx equ word [bp-2] ;save cx size ini file
|
||||
ret_on_ch equ word [bp-4] ;point to return ðàçðóøàåìîå çíà÷åíèå
|
||||
save_cx_d equ word [bp-6] ;save cx - size default section and working section
|
||||
status_flag equ word [bp-8] ;status flag
|
||||
point_loader equ word [bp-10]
|
||||
point_default equ word [bp-12] ;point to default
|
||||
|
||||
;äàííûå êîòîðûå çàâèñèìû îò âåòêè âûïîëíåíèÿ è êîòîðûå ìîãóò áûòü ïåðåîïðåäåëåíû â ïðîöåññå âûïîëíåíèÿ ïðîãðàììû.
|
||||
point_to_hframe equ word [bp-14] ;point on start frame (for change section)
|
||||
point_to_1 equ word [bp-16]
|
||||
point_to_2 equ word [bp-18]
|
||||
point_to_3 equ word [bp-20]
|
||||
point_to_4 equ word [bp-22]
|
||||
point_to_5 equ word [bp-24]
|
||||
point_to_6 equ word [bp-26]
|
||||
point_to_7 equ word [bp-28]
|
||||
point_to_8 equ word [bp-30]
|
||||
point_to_9 equ word [bp-32]
|
||||
point_to_10 equ word [bp-34]
|
||||
point_to_11 equ word [bp-36]
|
||||
point_to_12 equ word [bp-38]
|
||||
point_to_13 equ word [bp-40]
|
||||
point_to_14 equ word [bp-42]
|
||||
point_to_15 equ word [bp-44]
|
||||
point_to_16 equ word [bp-46]
|
||||
point_to_16 equ word [bp-48]
|
||||
point_to_17 equ word [bp-50]
|
||||
point_to_18 equ word [bp-52]
|
||||
;here array for fast scroling 16 word - poin to start section
|
||||
point_to_point_def equ word [bp-54]
|
||||
point_to_eframe equ word [bp-56] ;point on point frame
|
||||
|
||||
|
||||
|
||||
; òóò ðàñïîëîæåíî âðåìåííîå õðàíèëèùå äëÿ cx è di ïðè ïåðåõîäå íà ñëåäóþùèé áóôåð ïðè ïîèñêå ñåêöèé
|
||||
find_sec_di equ word [bp-58] ;òóò áóäåò õðàíèòüñÿ di
|
||||
info_real_mode_size equ word [bp-60];òóò õðàíèòüñÿ èíôîðìàöèÿ î çàíÿòîé îáëàñòè ò.å. ðàçìåð, ìîæíî óçíàòü ñêîëüêî îñòàëîñü ìåñòà âû÷èñëèâ
|
||||
free_ad_memory equ word [bp-62] ;ñêîëüêî ó íàñ ðàñøèðåííîé ïàìÿòè äëÿ ôîðìèðîâàíèÿ ðàì äèñêà è çàãðóçêè ìîäóëåé
|
||||
show_errors_sect equ word [bp-64] ;ïåðåìåíàÿ êîòîðàÿ õðàíèò áèòû îøèáîê äëÿ êàæäîé ëîãè÷åñêîé ñåêöèè.
|
||||
save_descript_size equ word [bp-66] ;save descript size previos section ñîõðàíèì ðàçìåð ïðåäûäóùåé ñåêöèè êîòîðóþ âûâîäèëè
|
||||
save_ramdisksize equ dword [bp-70] ;save size of ramdisk in byte
|
||||
save_file_size equ dword [bp-74] ;save size of reading file
|
||||
set_ramfs equ word [bp-76] ;îïðåäåëåííûé òèï ôàéëîâîé ñèñòåìû,íóæíî äëÿ ôîðìèðîâàíèÿ ðàì äèñêà
|
||||
point_next_fat_str equ word [bp-78] ;óêàçàòåëü íà ñëåäóþùèé ýëåìåíò fat òàáëèöû
|
||||
size_root_dir equ word [bp-80] ;êîë-âî ýëåìåíòîâ â ñåêòîðàõ ïî 512 áàéò êîðíåâîé äèðåêòîðèè
|
||||
firstDataSect equ word [bp-82] ;ïåðâûé ñåêòîð äàííûõ â ñåòîðàõ îò 0
|
||||
DataClasters equ word [bp-84] ;ðàçìåð ìàññèâà äîñòóïíîé äëÿ çàïèñè äàííûõ â êëàñòåðàõ.
|
||||
point_to_free_root equ word [bp-86] ;óêàçàòåëü íà ñëåäóþùèé ïóñòóþ çàïèñü â ðóò äèð
|
||||
point_to_dest_file_name equ word [bp-88] ;óêàçûâàåò íà íà÷àëî èìåíè ôàéëà íàçíà÷åíèÿ.
|
||||
data_offset equ word [bp-90] ;ñìåùåíèå â êëàñòåðàõ äëÿ çàïèñàííûõ äàííûõ ò.å ïåðåêèíóòûõ çà 1-é ìá
|
||||
first_input equ word [bp-92] ;ïîëå äëÿ ôëàãîâ â ïðåîáðàçîâàíèè èìåíè.
|
||||
save_di_RAMDISK equ word [bp-94] ;ñîõðàíèì di -óêàçàòåëÿ ïðè îáðàáîòêå ñåêöèè
|
||||
save_cx_RAMDISK equ word [bp-96] ;ñîõðàíèì ðàçìåð îñòàòêà ñåêöèè
|
||||
status_flag_loader_f equ word [bp-98] ;ñîõðàíèì ðåçóëüòàò âûïîëåíåíèÿ çàãðóçêè ôàéëà
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;äàííûå êîòîðûå èñïîëüçóþòñÿ ïðè îáðàáîòêå ñåêöèè, ò.å. ïîñëå íàæàòèÿ Enter, óæå íå âîçìîæíî âåðíóòüñÿ â ïåðâîíà÷àëüíûé ýêðàí
|
||||
;äëÿ âîçâðàòà, íåîáõîäèìî ïåðåçàïóñòèòü ïîëíîñòüþ êîä ò.å. ñòàðòîâàòü ñ 0õ1000:0000
|
||||
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;start of code: ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use16
|
||||
org 0x0
|
||||
jmp start
|
||||
include 'sl_equ.inc' ; â ôàéëå ðàçìåùåíû âñå equ ïðåäîïðåäåëåíèÿ
|
||||
include 'boot_st.inc'
|
||||
include 'debug_msg.inc' ;here is message from debug
|
||||
include 'parse_dat.inc'
|
||||
@ -165,6 +91,18 @@ start:
|
||||
call putchar
|
||||
loop @b
|
||||
|
||||
if DEBUG
|
||||
pushad
|
||||
mov ax,cs
|
||||
shl eax,4 ; â äåñÿòè÷íîé ñèñòåìå àäðåñ ñåãìåíòà
|
||||
mov cx,0xa
|
||||
mov di,cseg_msg
|
||||
call decode
|
||||
;***************
|
||||
mov si,cseg_msg
|
||||
call printplain
|
||||
popad
|
||||
end if
|
||||
|
||||
|
||||
if DEBUG
|
||||
@ -216,19 +154,64 @@ cpugood:
|
||||
; set up esp
|
||||
movzx esp, sp
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; init memory
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
|
||||
|
||||
; Load startos.ini
|
||||
xor ax,ax ; function 1 - read file
|
||||
mov cx,loop_read_startos_file ;êîë-âî ïîïûòîê ÷òåíèÿ ôàéëà êîíôèãóðàöèè startos.ini
|
||||
align 4
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Load startos.ini ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
load_startos_file:
|
||||
|
||||
xor ax,ax
|
||||
mov di,file_data
|
||||
inc ax
|
||||
inc ax ;function 1 - read file
|
||||
push cx
|
||||
call far dword [loader_callback]
|
||||
pop cx
|
||||
push cs
|
||||
push cs
|
||||
pop ds
|
||||
pop es
|
||||
|
||||
test bx,bx
|
||||
jnz error_ini
|
||||
jz check_conf_file
|
||||
dec cx
|
||||
jnz load_startos_file
|
||||
|
||||
;SET DEFAULT Not use ini file
|
||||
error_ini:
|
||||
mov si, error_ini_f1 ;Error: cannot load ini file, buffer is full
|
||||
dec bx
|
||||
jz err_show_ini
|
||||
mov si, error_ini_f2 ;Error: ini file not found
|
||||
dec bx
|
||||
jz err_show_ini
|
||||
mov si, error_ini_f3 ;Error: cannot read ini file
|
||||
dec bx
|
||||
jz err_show_ini
|
||||
|
||||
mov si, error_ini_nf ;Error: unrecognized error when loading ini file
|
||||
err_show_ini:
|
||||
call printplain
|
||||
mov si, error_ini_common
|
||||
call printplain
|
||||
; wait for keypress
|
||||
xor ax,ax
|
||||
int 16h
|
||||
|
||||
ini_loaded:
|
||||
|
||||
jmp $
|
||||
|
||||
align 4
|
||||
check_conf_file:
|
||||
;Check config file in current dir
|
||||
push ax ;save size file
|
||||
if DEBUG
|
||||
@ -250,39 +233,11 @@ use_parse ;parsing startos.ini
|
||||
;
|
||||
jmp ini_loaded
|
||||
|
||||
;SET DEFAULT Not use ini file
|
||||
error_ini:
|
||||
mov si, error_ini_f1 ;Error: cannot load ini file, buffer is full
|
||||
dec bx
|
||||
jz err_show_ini
|
||||
mov si, error_ini_f2 ;Error: ini file not found
|
||||
dec bx
|
||||
jz err_show_ini
|
||||
mov si, error_ini_f3 ;Error: cannot read ini file
|
||||
dec bx
|
||||
jz err_show_ini
|
||||
|
||||
mov si, error_ini_nf ;Error: unrecognized error when loading ini file
|
||||
err_show_ini:
|
||||
call printplain
|
||||
mov si, error_ini_common
|
||||
call printplain
|
||||
; wait for keypress
|
||||
mov ah, 0
|
||||
int 16h
|
||||
|
||||
ini_loaded:
|
||||
|
||||
jmp $
|
||||
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;DATA
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; table for move to extended memory (int 15h, ah=87h)
|
||||
align 8
|
||||
align 4
|
||||
table_15_87:
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
@ -345,7 +300,7 @@ struc FAT_32_entry ;Byte Directory Entry Structure
|
||||
;Òóò áóäóò ðàñïîëîãàòñüÿ äàííûå, êîòîðûå çàòðóäíèòåëüíî ðàñïîëîãàòü â ñòåêîâîé îáëàñòè....
|
||||
;;;
|
||||
;timer
|
||||
shot_name_fat rb 11
|
||||
shot_name_fat rb 11 ;âðåìåííûé áóôåð äëÿ fat12, â íåì õðàíÿòüñÿ èìåíà ôàéëîâ ïðèâåäåííûå ê ïðàâèëàì FAT /* âäàëüíåéøåì ïåðåíåñòè â ñòýê
|
||||
if DEBUG
|
||||
rb 1 ;íóæåí äëÿ îòëàäêè è âûâîäà èìåíè ôàéëà ïîñëå ïðåîáðàçîâàíèÿ
|
||||
dest_name_fat rb 12
|
||||
|
@ -12,7 +12,7 @@
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname <Lrz> ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
|
@ -307,7 +307,7 @@ end if
|
||||
stosw
|
||||
loop @b
|
||||
;;;;;;;;;;;;;;;;;;;;;;; show firm ))
|
||||
mov di,286
|
||||
mov di,(2*160-(2*(soft_mes_end-soft_mes+4))) ;286
|
||||
mov ah,color_sym_pink;color_sym_red
|
||||
mov al,'K'
|
||||
stosw
|
||||
|
@ -12,7 +12,7 @@
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname <Lrz> ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
|
@ -12,7 +12,7 @@
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname <Lrz> ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
@ -177,8 +177,6 @@ local .found_end_str
|
||||
jmp far dword [es:si]
|
||||
|
||||
|
||||
|
||||
|
||||
.error_LM:
|
||||
call error.LoaderModule
|
||||
.rest_value_loop_LM:
|
||||
@ -194,6 +192,10 @@ macro use_RamdiskFS
|
||||
{
|
||||
if DEBUG
|
||||
local ._not_memory_in_sys
|
||||
;//////// clear window
|
||||
mov ax,3
|
||||
int 0x10
|
||||
;\\\\\\\\\ clear window is end
|
||||
mov si,ramdiskFS_st
|
||||
call printplain
|
||||
end if
|
||||
@ -342,7 +344,7 @@ end if
|
||||
macro use_free_memory
|
||||
{
|
||||
local _support_function_use_free_memory
|
||||
;макрос для получения общего числа доступной памяти для формирования рам диска за пределами 1 мб.
|
||||
;макрос для получения общего числа доступной памяти в кб, для формирования рам диска за пределами 1 мб.
|
||||
;èñïîëüçóåòñÿ 0õ88 ôóíêöèÿ 0õ15 ïðåðûâàíèÿ
|
||||
; åñëè ïîääåðæèâàåòñÿ ôóíêöèÿ, òî â ax çíà÷åíèå â êá, åñëè íåò, òî â ax=0
|
||||
mov ah,0x88 ;ah,0x88
|
||||
@ -353,7 +355,7 @@ local _support_function_use_free_memory
|
||||
._support_function_use_free_memory:
|
||||
mov free_ad_memory,ax ; åñëè íå ïîääåðæèâàåòñÿ áèîñîì, òî â ax=0
|
||||
if DEBUG
|
||||
pusha
|
||||
pushad
|
||||
movzx eax,ax
|
||||
mov cx,0x0a
|
||||
mov di,free_memory_msg
|
||||
@ -364,7 +366,7 @@ if DEBUG
|
||||
mov si,free_memory_msg
|
||||
call printplain
|
||||
|
||||
popa
|
||||
popad
|
||||
end if
|
||||
|
||||
|
||||
@ -612,6 +614,16 @@ use_RamdiskCluster ;
|
||||
|
||||
|
||||
.fat12: ;fat12
|
||||
if DEBUG
|
||||
; выведем в отладке, что собираемся делать образ диска c FS=fat12
|
||||
pushad
|
||||
mov si,start_making_FAT12_msg
|
||||
call printplain
|
||||
popad
|
||||
end if
|
||||
|
||||
|
||||
|
||||
;Äëÿ FAT12 è FAT16 äèñêîâ ýòî ïîëå ñîäåðæèò êîëè÷åñòâî ñåêòîðîâ, à BPB_TotSec32 ðàâíî 0, åñëè çíà÷åíèå <óìåùàåòñÿ> (ìåíüøå 0x10000).
|
||||
mov set_ramfs,12 ;óñòàíîâèì òèï ôàéëîâîé ñèñòåìû
|
||||
movzx ebx,byte [fat12_buffer.BPB_SecPerClus]
|
||||
@ -1309,7 +1321,7 @@ macro first_create_fat_table
|
||||
mov point_to_free_root,di ;çíà÷åíèå ñìåùåíèÿ =0 â êîðíåâîé ôàò òàáëèöå îïèñàíèÿ
|
||||
|
||||
|
||||
pop ds
|
||||
pop ds ; загружен следующий сегмент т.е. пустой сегмент
|
||||
|
||||
mov byte [di],al
|
||||
or ax,-1
|
||||
@ -1322,7 +1334,7 @@ macro first_create_fat_table
|
||||
mov point_next_fat_str,3
|
||||
|
||||
if DEBUG
|
||||
pusha
|
||||
pushad
|
||||
mov ax,point_next_fat_str
|
||||
mov cx,0x0a
|
||||
mov di,fat_create_msg
|
||||
@ -1330,7 +1342,7 @@ if DEBUG
|
||||
;Show size
|
||||
mov si,fat_create_msg
|
||||
call printplain
|
||||
popa
|
||||
popad
|
||||
end if
|
||||
|
||||
}
|
||||
@ -1532,7 +1544,7 @@ macro get_firstDataSector
|
||||
mov DataClasters,ax
|
||||
|
||||
if DEBUG
|
||||
pusha
|
||||
pushad
|
||||
mov ax,firstDataSect ;ïåðâûé ñåêòîð äàííûõ
|
||||
mov cx,0x0a
|
||||
mov di,firstDataSect_msg
|
||||
@ -1556,7 +1568,7 @@ if DEBUG
|
||||
;Show size
|
||||
mov si,DataClasters_msg
|
||||
call printplain
|
||||
popa
|
||||
popad
|
||||
|
||||
end if
|
||||
|
||||
@ -1615,6 +1627,25 @@ local .exit
|
||||
@@:
|
||||
mov al,byte [ds:si+bx]
|
||||
mov ah,byte [gs:di+bx] ;gs:di - point to name in fat struct
|
||||
|
||||
if DEBUG
|
||||
pushad
|
||||
|
||||
|
||||
mov cx,11
|
||||
;input cx=size al=char будет выведен символ сколько раз указано в cx
|
||||
@@:
|
||||
mov al,byte [gs:di]
|
||||
inc di
|
||||
call putchar
|
||||
loop @b
|
||||
|
||||
xor ax,ax
|
||||
int 0x16
|
||||
|
||||
|
||||
popad
|
||||
end if
|
||||
inc bx
|
||||
|
||||
cmp ah,al
|
||||
@ -1661,6 +1692,7 @@ end if
|
||||
macro convertion_file_name
|
||||
;ìàêðîñ êîíâåðòàöèè èìåíè, ýòî íóæíî ïîñêîëüêó ôîðìàò ïðåäñòàâëåííûé íå ñîîòâåòñâóåò ôàò è íàïðÿìóþ ðåäêî ìîæíî êîãäà èñïîëüçîâàòü
|
||||
;ïðåîáðàçîâàíèå èìåíè òèïà hello.asm â 'HELLO ASM', â ñîîòâåòñòâèè ñ ïðàâèëàìè fat.
|
||||
;входные параметры es:di указатель на имя файла которое нужно преобразовать, конечный буфер shot_name_fat
|
||||
{
|
||||
local .next_step
|
||||
local .error
|
||||
|
@ -12,7 +12,7 @@
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname <Lrz> ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
|
98
kernel/trunk/sec_loader/trunk/sl_equ.inc
Normal file
98
kernel/trunk/sec_loader/trunk/sl_equ.inc
Normal file
@ -0,0 +1,98 @@
|
||||
; Copyright (c) 2008-2009, <Lrz>
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
; modification, are permitted provided that the following conditions are met:
|
||||
; * Redistributions of source code must retain the above copyright
|
||||
; notice, this list of conditions and the following disclaimer.
|
||||
; * Redistributions in binary form must reproduce the above copyright
|
||||
; notice, this list of conditions and the following disclaimer in the
|
||||
; documentation and/or other materials provided with the distribution.
|
||||
; * Neither the name of the <organization> nor the
|
||||
; names of its contributors may be used to endorse or promote products
|
||||
; derived from this software without specific prior written permission.
|
||||
;
|
||||
; THIS SOFTWARE IS PROVIDED BY Alexey Teplov aka <Lrz> ''AS IS'' AND ANY
|
||||
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;*****************************************************************************
|
||||
; Ïðåäîïðåäåëåíèÿ
|
||||
DEBUG equ 1 ;êîìïèëÿöèÿ ñ îòëàäî÷íîé èíôîðìàöèåé =1 áåç îòëàäî÷íîé èíôîðàöèè =0
|
||||
loop_read_startos_file equ 3 ;êîë-âî ïîïûòîê ñ÷èòàòü ÷åðåç callback ñåðâèñ ôàéë êîíôèãóðàöèè áëîê2
|
||||
root_dir_entry_count equ 224 ;êîë-âî ýëåìåíòîâ â êîðíåâîé äèððåêòîðèè
|
||||
;point_to_fat_struc equ 0xA000 ;âðåìåííûé áóôåð, êóäà áóäåò ðàçìåùåíà Fat òàáëèöà, è çàòåì ïåðåíåñåíà çà 1 ìá
|
||||
ini_data_ equ 0x2000 ;ôàéë ãäå ðàçìåùåí ôàéë ñöåíàðèÿ çàãðóçêè, òàì ïðîèñõîäèò ñèíòàêñè÷åñêèé ðàçáîð
|
||||
size_show_section equ 18
|
||||
default_timeout_value equ 5 ;default value to timeout is will was some errors
|
||||
flag_found_default equ 0x1 ;default value is found
|
||||
flag_found_timeout equ 0x2 ;timeout value is found
|
||||
flag_found_LM equ 0x1 ;found LM value
|
||||
flag_found_RS equ 0x2 ;found RS value
|
||||
flag_found_GTRFMS equ 0x4 ;found type RamFS
|
||||
flag_found_RamdiskSector equ 0x8 ;found RamdiskSector
|
||||
flag_found_RamdiskCluster equ 0x16 ;found RamdiskCluster
|
||||
;statick data ýòè äàííûå íå ïðåäîïðåäåëÿþòñÿ â òå÷åíèè âûïîëíåíèÿ âñåé ïðîãðàììû.
|
||||
save_cx equ word [bp-2] ;save cx size ini file
|
||||
ret_on_ch equ word [bp-4] ;point to return ðàçðóøàåìîå çíà÷åíèå
|
||||
save_cx_d equ word [bp-6] ;save cx - size default section and working section
|
||||
status_flag equ word [bp-8] ;status flag
|
||||
point_loader equ word [bp-10]
|
||||
point_default equ word [bp-12] ;point to default
|
||||
|
||||
;äàííûå êîòîðûå çàâèñèìû îò âåòêè âûïîëíåíèÿ è êîòîðûå ìîãóò áûòü ïåðåîïðåäåëåíû â ïðîöåññå âûïîëíåíèÿ ïðîãðàììû.
|
||||
point_to_hframe equ word [bp-14] ;point on start frame (for change section)
|
||||
point_to_1 equ word [bp-16]
|
||||
point_to_2 equ word [bp-18]
|
||||
point_to_3 equ word [bp-20]
|
||||
point_to_4 equ word [bp-22]
|
||||
point_to_5 equ word [bp-24]
|
||||
point_to_6 equ word [bp-26]
|
||||
point_to_7 equ word [bp-28]
|
||||
point_to_8 equ word [bp-30]
|
||||
point_to_9 equ word [bp-32]
|
||||
point_to_10 equ word [bp-34]
|
||||
point_to_11 equ word [bp-36]
|
||||
point_to_12 equ word [bp-38]
|
||||
point_to_13 equ word [bp-40]
|
||||
point_to_14 equ word [bp-42]
|
||||
point_to_15 equ word [bp-44]
|
||||
point_to_16 equ word [bp-46]
|
||||
point_to_16 equ word [bp-48]
|
||||
point_to_17 equ word [bp-50]
|
||||
point_to_18 equ word [bp-52]
|
||||
;here array for fast scroling 16 word - poin to start section
|
||||
point_to_point_def equ word [bp-54]
|
||||
point_to_eframe equ word [bp-56] ;point on point frame
|
||||
|
||||
|
||||
|
||||
; òóò ðàñïîëîæåíî âðåìåííîå õðàíèëèùå äëÿ cx è di ïðè ïåðåõîäå íà ñëåäóþùèé áóôåð ïðè ïîèñêå ñåêöèé
|
||||
find_sec_di equ word [bp-58] ;òóò áóäåò õðàíèòüñÿ di
|
||||
info_real_mode_size equ word [bp-60];òóò õðàíèòüñÿ èíôîðìàöèÿ î çàíÿòîé îáëàñòè ò.å. ðàçìåð, ìîæíî óçíàòü ñêîëüêî îñòàëîñü ìåñòà âû÷èñëèâ
|
||||
free_ad_memory equ word [bp-62] ;ñêîëüêî ó íàñ ðàñøèðåííîé ïàìÿòè äëÿ ôîðìèðîâàíèÿ ðàì äèñêà è çàãðóçêè ìîäóëåé
|
||||
show_errors_sect equ word [bp-64] ;ïåðåìåíàÿ êîòîðàÿ õðàíèò áèòû îøèáîê äëÿ êàæäîé ëîãè÷åñêîé ñåêöèè.
|
||||
save_descript_size equ word [bp-66] ;save descript size previos section ñîõðàíèì ðàçìåð ïðåäûäóùåé ñåêöèè êîòîðóþ âûâîäèëè
|
||||
save_ramdisksize equ dword [bp-70] ;save size of ramdisk in byte
|
||||
save_file_size equ dword [bp-74] ;save size of reading file
|
||||
set_ramfs equ word [bp-76] ;îïðåäåëåííûé òèï ôàéëîâîé ñèñòåìû,íóæíî äëÿ ôîðìèðîâàíèÿ ðàì äèñêà
|
||||
point_next_fat_str equ word [bp-78] ;óêàçàòåëü íà ñëåäóþùèé ýëåìåíò fat òàáëèöû
|
||||
size_root_dir equ word [bp-80] ;êîë-âî ýëåìåíòîâ â ñåêòîðàõ ïî 512 áàéò êîðíåâîé äèðåêòîðèè
|
||||
firstDataSect equ word [bp-82] ;ïåðâûé ñåêòîð äàííûõ â ñåòîðàõ îò 0
|
||||
DataClasters equ word [bp-84] ;ðàçìåð ìàññèâà äîñòóïíîé äëÿ çàïèñè äàííûõ â êëàñòåðàõ.
|
||||
point_to_free_root equ word [bp-86] ;óêàçàòåëü íà ñëåäóþùèé ïóñòóþ çàïèñü â ðóò äèð
|
||||
point_to_dest_file_name equ word [bp-88] ;óêàçûâàåò íà íà÷àëî èìåíè ôàéëà íàçíà÷åíèÿ.
|
||||
data_offset equ word [bp-90] ;ñìåùåíèå â êëàñòåðàõ äëÿ çàïèñàííûõ äàííûõ ò.å ïåðåêèíóòûõ çà 1-é ìá
|
||||
first_input equ word [bp-92] ;ïîëå äëÿ ôëàãîâ â ïðåîáðàçîâàíèè èìåíè.
|
||||
save_di_RAMDISK equ word [bp-94] ;ñîõðàíèì di -óêàçàòåëÿ ïðè îáðàáîòêå ñåêöèè
|
||||
save_cx_RAMDISK equ word [bp-96] ;ñîõðàíèì ðàçìåð îñòàòêà ñåêöèè
|
||||
status_flag_loader_f equ word [bp-98] ;ñîõðàíèì ðåçóëüòàò âûïîëåíåíèÿ çàãðóçêè ôàéëà
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;äàííûå êîòîðûå èñïîëüçóþòñÿ ïðè îáðàáîòêå ñåêöèè, ò.å. ïîñëå íàæàòèÿ Enter, óæå íå âîçìîæíî âåðíóòüñÿ â ïåðâîíà÷àëüíûé ýêðàí
|
||||
;äëÿ âîçâðàòà, íåîáõîäèìî ïåðåçàïóñòèòü ïîëíîñòüþ êîä ò.å. ñòàðòîâàòü ñ 0õ1000:0000
|
Loading…
Reference in New Issue
Block a user