grunge
Joined: 11 Sep 2005
Posts: 21
Location: Brasil
|
Hello All
I have one new problem ... now I use the vesa mode in my OS... but have one problem in the boot... when I use the vesa mode directely in bootloader, the graph is correct, but when I use the all code of vesa mode as kernel, the graph is not correct, think that problem must be in the segments when kernel is loaded, I trying, but dont have one positive result, this problem can be solved? I use the "bootmosf.asm"(MenuetOS) for my study... already tried others bootloaders... but dont have one positive result... I need help...
Thanks for All...
My code (is my vesa test...)
;ORG 100h
; Mov AX,1000h ; HERE IS POSSIBLE PROBLEM
; Mov DS,AX
; Mov ES,AX
Start:
mov ax,4f02h
mov bx,101h
int 10h
mov dx,0xa000
mov es,dx
call window
StartAgain:
xor dx,dx
mov [Cor],0
MainLoop:
Mov [y],100
Mov [x],100
Call Pixel
B1:
push dx
call window
xor bx,bx
pop dx
inc dx
push dx
call window
xor bx,bx
pop dx
B2:
push dx
call window
xor bx,bx
pop dx
inc dx
push dx
call window
xor bx,bx
pop dx
B3:
push dx
call window
xor bx,bx
pop dx
inc dx
push dx
call window
xor bx,bx
pop dx
B4:
push dx
call window
xor bx,bx
pop dx
inc dx
push dx
call window
xor bx,bx
pop dx
mov byte [Row],7
mov edi,262500 ; Position
mov bx,di ; ver
mov si,LetterR
mov dh,0ah
call DrawImage
Mov [y],410
Mov [x],20
Call Pixel
Mov [y],410
Mov [x],620
Call Pixel
B0:
push dx
mov dx,0xa000
mov es,dx
call window
xor dx,dx
pop dx
mov byte [Row],7
mov edi,51250
mov bx,di
mov si,LetterR
mov dh,0ah
call DrawImage
Mov [y],100
Mov [x],200
Call Pixel
mov ah,01h
int 16h
mov ah,00h
int 16h
mov ax,0003h
int 10h
ret
Pixel:
Push DX
Push ES
Mov AX,0A000h
Mov ES,AX
Mov AX,640
Mul [y]
Add AX,[x]
Mov BX,AX
Mov DL,9
Mov [ES:BX],DL
Pop ES
Pop DX
Retn
window:
mov ax,4f05h
mov bx,0
int 10h
xor bx,bx
ret
DrawImage:
mov di,bx ; ver
mov dl,[Row]
cld
GetData:
lodsw
mov bx,ax
mov cl,16
CheckBit:
test bx,0x8000 ; bx
jz ZeroBit
mov al,dh
stosb
jmp Skip
ZeroBit:
inc di
Skip:
shl bx,1
loop CheckBit
add di,624
dec dl
jnz GetData
ret
Cor DB 0
x DW 0
y DW 0
Row DB 0
LetterR DW 7800h,4400h,4400h,7800h,4400h,4400h,4400h
BootMosf:
;=======================================================
;= boot program for Menuet OS version 1.00
;= January 2002
;=
;= Copyright (C) Alex Nogueira Teixeira
;= E-Mail : alexwal@siteplanet.com.br
;=
;= Distributed under GPL, see file COPYING for details
;=
;= equates for program
;=======================================================
lf equ 0ah
cr equ 0dh
pos_read_tmp equ 0700h ;position for temporary read
boot_program equ 07c00h ;position for boot code
seg_read_kernel equ 01000h ;seguiment to kernel read
jmp start_program
nop
oemname db 'MENUETOS'
bytespersector dw 512
sectorspercluster db 1
ressectors dw 1
numcopiesfat db 2
maxallocrootdir dw 224
maxsectors dw 2880 ;for 1.44 mbytes disk
mediadescriptor db 0f0h ;fd = 2 sides 18 sectors
sectorsperfat dw 9
sectorspertrack dw 18
heads dw 2
hiddensectors dd 0
hugesectors dd 0 ;if sectors > 65536
drivenumber db 0
db 0
bootsignature db 029h ;extended boot signature
volumeid dd 0
volumelabel db 'MENUET DISK'
filesystemtype db 'FAT12 '
start_program:
xor ax,ax
mov ss,ax
mov sp,boot_program
push ss
pop ds
mov si,loading+boot_program
loop_loading:
lodsb
or al,al
jz procura_arquivo_novamente
mov ah,0eh
mov bx,07h
int 010h
jmp loop_loading
procura_arquivo_novamente:
push ss
pop es
mov bp,16
newtry:
dec bp
jz mensagem_erro_arquivo
mov ax,020eh ;read, 14 sectors for directory
mov bx,pos_read_tmp ;es:bx read position
mov cx,02h ;track 0, sector 2
mov dx,0100h ;head 1, drive 0 (a
call read_sector
; int 013h ;read sectors
; jc newtry ; mensagem_erro_arquivo
mov si,bx
loop_compara_entrada_diretorio:
push si
mov cx,11 ;file name
mov di,arq_boot+boot_program
rep cmpsb
pop si
je le_arquivo_kernel
add si,32
cmp si,pos_read_tmp+(512*14) ;end of directory
jb loop_compara_entrada_diretorio
mensagem_erro_arquivo:
mov si,mens_erro+boot_program
loop_envio_mensagem:
lodsb
or al,al
jz espera_digitar_tecla
mov ah,0eh
mov bx,07h
int 010h
jmp loop_envio_mensagem
espera_digitar_tecla:
jmp $
; load kernel
le_arquivo_kernel:
mov bp,[si+01ah]
mov ax,0209h ;read, 9 sectors
mov bx,pos_read_tmp ;es:bx read position
mov cx,02h ;track 0, sector 2
xor dx,dx ;head 0, drive 0 (a
call read_sector
; int 013h ;read sectors
jc mensagem_erro_arquivo
mov ax,seg_read_kernel
mov es,ax
xor bx,bx
; read kernel to es:bx
loop_obtem_dados_kernel:
call le_setor_dados
jc mensagem_erro_arquivo
; add bx,0200h ;add one sector
push bx
mov bx,es
add bx,0x20
mov es,bx
pop bx
mov di,bp
shr di,01h
pushf
add di,bp
add di,pos_read_tmp
mov ax,[di]
popf
jc desloca_4_direita
and ax,0fffh
jmp verifica_fim_setores
desloca_4_direita:
mov cl,4
shr ax,cl
verifica_fim_setores:
cmp ax,0ff8h
jae executa_kernel
mov bp,ax
jmp loop_obtem_dados_kernel
executa_kernel:
push word seg_read_kernel
push word 00h
retf
le_setor_dados: ;es:bx -> position in read buffer
;bp -> logical sector to read
;carry <- 0 read OK
;carry <- 1 read error
push bx
mov ax,0e2eh ;decimal point
xor bh,bh
int 010h
pop bx
mov ax,bp ;data sector to read
add ax,31 ;get logical sector
mov cx,36 ;sector/track
xor dx,dx
div cx
mov ch,al ;track transfer
xor dh,dh ;head 0
cmp dl,18
jb cabeca_correta
sub dl,18
inc dh ;head 1
cabeca_correta:
inc dl
mov cl,dl
xor dl,dl ;drive 0 (a
mov ax,0201h ;read 1 sector
call read_sector
; int 013h
retn
read_sector:
push bp
mov bp,20
newread:
dec bp
jz mensagem_erro_arquivo
push ax bx cx dx
int 0x13
pop dx cx bx ax
jc newread
pop bp
retn
loading db 13,10,'Starting MenuetOS ',00h
mens_erro:
db 13,10
arq_boot:
db 'KERNEL BIN ?',cr,lf,00h
errors db 16
times 0x1fe-$ db 00h
db 55h,0aah ;boot signature
|