Jump to content

SUBIECTE NOI
« 1 / 5 »
RSS
Dacia 1316 cu 6 usi ...

Frecventa modificata radio

Un nou pericol pt batrani

Ar trebuii sa vindem imobiliarele...
 Dupa renuntarea la aparat dentar

pelerinaj in Balcik

Noul format Jpegli iși propu...

Dade, dade
 Probleme accesare nr test telefon

Parola la lock screen

Deparazitare externa pisici fara ...

Seriale turcesti/coreene online H...
 Merita un Termostat Smart pentru ...

Sfat achizitie MTB Devron Riddle

Problema mare cu parintii= nervi ...

switch microtik
 

Creare Bootloader

- - - - -
  • Please log in to reply
2 replies to this topic

#1
nikushoru

nikushoru

    Junior Member

  • Grup: Members
  • Posts: 219
  • Înscris: 17.03.2010
Bună ziua, de cîteva zile tot încerc să creez un bootloader care să se încarce de pe floppy drive, dar întîlnesc niște dificultăți. Eu am scris codul în emu8086, rulează totul perfect, dar cînd să-l înscriu pe floppy și să boot-ez, aici apăreau erori.
Iată codul pentru emu8086:
ORG 7C00h
clrscr MACRO
		MOV DL,25
		MOV DH,8 ; Set cursor to top left-most corner of screen
		mov bh, 0
		mov ah, 0x2
		int 0x10
		mov cx, 2000 ; print 2000 chars
		mov bh, 0
		mov bl, 0x2 ; black bg/blue fg
		mov al, 0x20 ; blank char
		mov ah, 0x9
		int 0x10
ENDM
delay MACRO
	; delay   1s
	MOV	 CX, 0FH
	MOV	 DX, 4240H
	MOV	 AH, 86H
	INT	 15H
ENDM
printText MACRO text, x, y   
		MOV AH,02H ; WRITE CHARACTER TO STANDARD OUTPUT
		MOV BH,0h
		MOV DL,x
		MOV DH,y
		INT 10H
		MOV AH,09H
		LEA DX,text
		INT 21H	   
		ENDM
changingTextColor MACRO color
	mov ah,09h 
	mov bl,color
	mov bh, 0h
	mov cx, 16 
	int 10h
	mov dx,offset firstMessage
	int 21h
	ENDM
.model tiny
.stack 100h
.data
	firstMessage db 'First BootLoader$'
	secondMessage db 'Run$'
	thirdMessage db 'from$'
	fourthMessage db 'FDD$'
	pos db 0
	nrColor db 4
.code
main proc
	mov ax,@data
	mov ds,ax
	mov ah,03h		   
	mov bh,0h			
	int 10h
mov cx,5
loopstart:
push cx
cmp pos, 80
je resetPosition
clrscr
changingTextColor nrColor
printText secondMessage,pos,10
printText thirdMessage,pos,11
printText fourthMessage,pos,12
add pos, 5
dec nrColor
cmp nrColor, 0
je resetColor
delay
pop cx
dec cx
jnz loopstart
resetPosition:
mov pos,0
cmp pos,0
je loopstart
resetColor:
mov nrColor, 4
delay
je loopstart
MOV	 AX, 0040h
MOV	 DS, AX
MOV	 w.[0072h], 0000h ; cold boot.
main endp
end main

Apoi am încercat să-l transform pentr al putea compila cu NASM și să-l înscriu pe floppy. Dar aceiași problemă, nu se boot-ează.

[BITS 16]		   ;Tells the assembler that its a 16 bit code
[ORG 7c00h]
	firstMessage db 'First BootLoader$'
	secondMessage db 'Run$'
	thirdMessage db 'from$'
	fourthMessage db 'FDD$'
	pos db 0
	nrColor db 4
jmp main
clrscr:
		MOV DL,25
		MOV DH,8 ; Set cursor to top left-most corner of screen
		mov bh, 0
		mov ah, 0x2
		int 0x10
		mov cx, 2000 ; print 2000 chars
		mov bh, 0
		mov bl, 0x2 ; black bg/blue fg
		mov al, 0x20 ; blank char
		mov ah, 0x9
		int 0x10
ret
delay:
	; delay   1s
	MOV	 CX, 0FH
	MOV	 DX, 4240H
	MOV	 AH, 86H
	INT	 15H
ret
printText1:
	mov ah,09h 
	mov bl,9
	mov bh, 0h
	mov cx, 16 
	int 10h
	mov dx, secondMessage
	int 21h	   
ret
printText2:
	mov ah,09h 
	mov bl,9
	mov bh, 0h
	mov cx, 16 
	int 10h
	mov dx, thirdMessage
	int 21h	   
ret
printText3:
	mov ah,09h 
	mov bl,9
	mov bh, 0h
	mov cx, 16 
	int 10h
	mov dx, fourthMessage
	int 21h	   
ret
changingTextColor1:
	mov ah,09h 
	mov bl,9
	mov bh, 0h
	mov cx, 16 
	int 10h
	mov dx, firstMessage
	int 21h
ret
changingTextColor2:
	mov ah,09h 
	mov bl,7
	mov bh, 0h
	mov cx, 16 
	int 10h
	mov dx, firstMessage
	int 21h
ret
changingTextColor3:
	mov ah,09h
	mov bl,2
	mov bh, 0h
	mov cx, 16 
	int 10h
	mov dx, firstMessage
	int 21h
ret
changingTextColor4:
	mov ah,09h 
	mov bl,5
	mov bh, 0h
	mov cx, 16 
	int 10h
	mov dx, firstMessage
	int 21h
ret
main:  
mov ds,ax
push cs
pop ds
mov ah,03h		
mov bh,0h		   
int 10h
call clrscr
call changingTextColor1
call printText1
call printText2
call printText3
call delay
call clrscr
call changingTextColor2
call printText1
call printText2
call printText3
call delay
call clrscr
call changingTextColor3
call printText1
call printText2
call printText3
call delay
call clrscr
call changingTextColor4
call printText1
call printText2
call printText3
call delay   
TIMES 510 - ($ - $$) db 0   ;Fill the rest of sector with 0
DW 0xAA55		   ;Add boot signature at the end of bootloader




Poate cineva să mă ajute să fac acest bootloader ?

#2
neagu_laurentiu

neagu_laurentiu

    Guru Member

  • Grup: Senior Members
  • Posts: 40,604
  • Înscris: 30.07.2003

View Postnikushoru, on 29 septembrie 2014 - 15:52, said:

INT 21H
Aceasta e o intrerupere din DOS ori tu nu ai nici un sistem incarcat la care sa faci referire. Ca atare doar intreruperi BIOS (daca ai asa ceva) sau lucrul direct cu hardware-ul.

#3
neagu_laurentiu

neagu_laurentiu

    Guru Member

  • Grup: Senior Members
  • Posts: 40,604
  • Înscris: 30.07.2003
Pentru UEFI ai un API expus: https://software.int...efi-application

Anunturi

Chirurgia spinală minim invazivă Chirurgia spinală minim invazivă

Chirurgia spinală minim invazivă oferă pacienților oportunitatea unui tratament eficient, permițându-le o recuperare ultra rapidă și nu în ultimul rând minimizând leziunile induse chirurgical.

Echipa noastră utilizează un spectru larg de tehnici minim invazive, din care enumerăm câteva: endoscopia cu variantele ei (transnazală, transtoracică, transmusculară, etc), microscopul operator, abordurile trans tubulare și nu în ultimul rând infiltrațiile la toate nivelurile coloanei vertebrale.

www.neurohope.ro

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Forumul Softpedia foloseste "cookies" pentru a imbunatati experienta utilizatorilor Accept
Pentru detalii si optiuni legate de cookies si datele personale, consultati Politica de utilizare cookies si Politica de confidentialitate