Documente Academic
Documente Profesional
Documente Cultură
Lab2 Somipp
Lab2 Somipp
RAPORT
la disciplina
SOMIPP
Lucrare de laborator 2
Condiii
Una din concepiile de baz, care servete pentru nelegerea corect a structurii sistemelor de
operare (SO), este concepia procesului. Acest termen a fost pentru prima dat utilizat n anii 60
de ctre elaboratorii SO MULTIX i se folosete pe larg n teoria SO. Exist mai multe definiii a
termenului proces, dintre care menionm:
1. Programul ce se execut;
2. Date necesare pentru lucrul programului (variabile, spaiul de lucru, bufer, .a.)
Condiii:
a) sectorul unde va fi nscris nucleul se va seta conform numrului de ordine din registrul grupei.
b) se vor utiliza ntreruperile : int 10h, 13h, 16h, 20h
La citirea sectorului boot de pe dischet, pe ecran vor fi afiate 2 mesaje ce vor cere efectuarea
urmtoarei operaiuni :
a) ncrcarea nucleului cu butonul ENTER
b) Restartarea sistemului la tastarea butonului ESC
Dup evenimentul de ncrcare a nucleului, pe ecran vor fi afiate 2 - 3 mesaje despre sistem.
Cursorul de text va fi ascuns din nucleu.
Codul surs:
Boot.asm
[BITS 16]
[ORG 0x7C00]
jmp loader
times 8 - ($-$$) db 0
loader:
jmp 0:loader2
loader2:
push cs
pop ds
call clrscr
MOV AH, 0x0E ;function nr
MOV BH, 0x00 ;page
MOV BL, 0x07 ;color
read:
mov ah, 00h
int 16h
cmp al,13
jz kernel
cmp al,27
jz reboot
jmp read
JMP $ ;hang
reboot:
mov ax, 0040h
mov ds, ax
mov word[0072h], 000h
jmp 0ffffh:0000h
ret
kernel:
MOV DL, 0x0 ;drive 0 = floppy 1
MOV DH, 0x0 ;head (0=base)
MOV CH, 0x0 ;track/cylinder
MOV CL, 0x2 ;sector (1=bootloader, apparently sectors starts counting at 1 instead of 0)
MOV BX, 0x1000 ;place in RAM for kernel - I suppose randomly chosen on examples
MOV ES, BX ;place BX in pointer ES
MOV BX, 0x0 ;back to zero - also has something to do with RAM position
ReadFloppy:
MOV AH, 0x02
MOV AL, 0x01
INT 0x13
JC ReadFloppy ;if it went wrong, try again
JMP 0x1000:0x0
sterge_tot_ecranu:
mov dx, 0 ; Position cursor at top-left
mov bh, 0
mov ah, 2
int 10h
PrintString:
.next_char:
MOV AL, [SI] ;current character
OR AL, AL
JZ .print_done ;if current char is zero, go to end
INT 0x10 ;print character
INC SI ;increase pointer to msg (next character)
JMP .next_char
.exit_char
RET
.print_done:
ret
clrscr:
mov dx, 0
mov bh, 0
mov ah, 2
int 10h
mov cx, 2000
mov bh, 0
mov bl, 07h
mov al, 32
mov ah, 9h
int 10h
ret
Kernel.asm
;set print-registers
call clrscr
mov dl, 30
mov dh, 10
mov bh, 0
mov ah, 2
int 10h
MOV SI, os
CALL PrintString
mov dl, 30
mov dh, 12
mov bh, 0
mov ah, 2
int 10h
MOV SI, version
CALL PrintString
mov dl, 30
mov dh, 14
mov bh, 0
mov ah, 2
int 10h
MOV SI, dev
CALL PrintString
JMP $ ;hang
PrintString:
MOV AH, 0x0E ;function nr
MOV BH, 0x00 ;page
MOV BL, 0x07 ;color
.next_char:
MOV AL, [SI] ;current character
OR AL, AL
JZ .print_done ;if current char is zero, go to end
INT 0x10 ;print character
INC SI ;increase pointer to msg (next character)
JMP .next_char
.exit_char
RET
.print_done:
ret
clrscr:
mov dx, 0
mov bh, 0
mov ah, 2
int 10h
mov cx, 2000
mov bh, 0
mov bl, 07h
mov al, 32
mov ah, 9h
int 10h
ret
os db "OS: RSystem",0
Concluzie:
In aceasta lucrare de laborator mam invatat cum sa creez un kernel in assembler, sa-l scriu pe
disketa care va fi incarcat in memorie la tastarea unei taste.