📄 main.asm
字号:
;/++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; main program, it reads the configuration file, check the syntax, the magic
; number present on the Minix file system volume, also it initializes the
; super block slot in memory, verify if root inode structure is all right
; after all has been done, it calls eatpath to analysis the parameter buf
; and batch processing the whole requirements in configuration file
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++/
include const.inc
include comstruc.inc
sseg segment stack
db 128 dup (0)
sseg ends
dseg segment para public 'global'
;Global varibles store here
;May be linked to other modual
public parambuf,paramnr,inodeblk,superblk,zonespace
public dirp,fn,dbuf,prom
superblk equ this byte ; superblk is used once, just multiplex
zonespace db 1024 dup (0) ; in floppy fs, block = zone
parambuf db 4096 dup (0) ; store the character read from config file
paramnr dw 0 ; init to 0, only used for syntax checking
inodeblk db 1024 dup (0) ; block incore version
dirp dw 0 ; path character indicator
fn dw 0 ; files have been processed
dbuf db 14 dup (0) ; current pathname component
prom db '%d files have been converted!','$'
dseg ends
overlap segment para common 'strucinfo'
; this is the only way to reference
; extern struct
inodeinfo minixinode <>
superinfo minixsuper <>
dent dirent <>
overlap ends
cseg segment para public 'code'
extrn panic:near
extrn rdconfig:near
extrn getinode:near
extrn getsuper:near
extrn getzone:near
extrn printn:near
extrn printf:near
extrn eatpath:near
extrn chksynx:near
assume cs:cseg,ds:dseg,es:dseg,ss:sseg
start:
mov ax,dseg
mov ds,ax
mov es,ax
call rdconfig
jnc next
push ax
call panic
;never return
next:
call chksynx ; check if the syntax is correct
call getsuper ; init incore super structure slot
; if the fs magic number can't be found
; we have to stop here
; next we will try to analysis the parambuf
mov ax,1 ; get root inode
push ax
call getinode
pop ax
mov ax,1 ; read zone 1
push ax
call getzone
pop ax
; verify the attrib of root inode
push ds
mov ax,overlap
mov ds,ax
assume ds:overlap
mov ax,[inodeinfo.i_mode]
pop ds
assume ds:dseg ; restore segment
and ax,I_TYPE
cmp ax,I_DIRECTORY
je next1
mov ax,88h ; generate an unknow error
push ax
call panic
next1:
call eatpath
mov ah,4ch
int 21h
cseg ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -