set cursor for out blue screen

git-svn-id: svn://kolibrios.org@816 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2008-07-04 06:15:05 +00:00
parent 0c807b742c
commit e3f6e939d2

View File

@ -125,18 +125,18 @@ conv_abs_to_THS:
pop bx pop bx
retn retn
; needed variables ; needed variables
BPB_SecPerTrk dw 0 ; sectors per track BPB_SecPerTrk dw 0 ; sectors per track
BPB_NumHeads dw 0 ; number of heads BPB_NumHeads dw 0 ; number of heads
BPB_FATSz16 dw 0 ; size of FAT BPB_FATSz16 dw 0 ; size of FAT
BPB_RootEntCnt dw 0 ; count of root dir. entries BPB_RootEntCnt dw 0 ; count of root dir. entries
BPB_BytsPerSec dw 0 ; bytes per sector BPB_BytsPerSec dw 0 ; bytes per sector
BPB_RsvdSecCnt dw 0 ; number of reserved sectors BPB_RsvdSecCnt dw 0 ; number of reserved sectors
BPB_TotSec16 dw 0 ; count of the sectors on the volume BPB_TotSec16 dw 0 ; count of the sectors on the volume
BPB_SecPerClus db 0 ; number of sectors per cluster BPB_SecPerClus db 0 ; number of sectors per cluster
BPB_NumFATs db 0 ; number of FAT tables BPB_NumFATs db 0 ; number of FAT tables
abs_sector_adj dw 0 ; adjustment to make abs. sector number abs_sector_adj dw 0 ; adjustment to make abs. sector number
end_of_FAT dw 0 ; end of FAT table end_of_FAT dw 0 ; end of FAT table
FirstDataSector dw 0 ; begin of data FirstDataSector dw 0 ; begin of data
;========================================================================= ;=========================================================================
; ;
@ -560,7 +560,7 @@ cfgmanager:
.change_a: .change_a:
.loops: .loops:
call draw_vmodes_table call draw_vmodes_table
_setcursor 25,0 ; out of screen
xor ax,ax xor ax,ax
int 0x16 int 0x16
; call clear_table_cursor ;clear current position of cursor ; call clear_table_cursor ;clear current position of cursor
@ -626,7 +626,7 @@ cfgmanager:
pop word [x_save] pop word [x_save]
push word [es:bp+2] push word [es:bp+2]
pop word [y_save] pop word [y_save]
push word [es:bp+6] push word [es:bp+6]
pop word [number_vm] pop word [number_vm]
mov word [preboot_graph],bp ;save choose mov word [preboot_graph],bp ;save choose
@ -847,7 +847,7 @@ end if
; ... ; ...
; TODO: !!! then read flippy image track by track ; TODO: !!! then read flippy image track by track
mov cx, 0x0001 ; startcyl,startsector mov cx, 0x0001 ; startcyl,startsector
.a1: .a1:
push cx dx push cx dx
mov al, 18 mov al, 18
@ -890,66 +890,66 @@ end if
; at first load boot sector and first FAT table ; at first load boot sector and first FAT table
; read only first sector and fill variables ; read only first sector and fill variables
mov cx, 0x0001 ; first logical sector mov cx, 0x0001 ; first logical sector
xor dx, dx ; head = 0, drive = 0 (a:) xor dx, dx ; head = 0, drive = 0 (a:)
mov al, 1 ; read one sector mov al, 1 ; read one sector
mov bx, 0xB000 ; es:bx -> data area mov bx, 0xB000 ; es:bx -> data area
call boot_read_floppy call boot_read_floppy
; fill the necessary parameters to work with a floppy ; fill the necessary parameters to work with a floppy
mov ax, word [es:bx+24] mov ax, word [es:bx+24]
mov word [BPB_SecPerTrk], ax mov word [BPB_SecPerTrk], ax
mov ax, word [es:bx+26] mov ax, word [es:bx+26]
mov word [BPB_NumHeads], ax mov word [BPB_NumHeads], ax
mov ax, word [es:bx+22] mov ax, word [es:bx+22]
mov word [BPB_FATSz16], ax mov word [BPB_FATSz16], ax
mov ax, word [es:bx+17] mov ax, word [es:bx+17]
mov word [BPB_RootEntCnt], ax mov word [BPB_RootEntCnt], ax
mov ax, word [es:bx+11] mov ax, word [es:bx+11]
mov word [BPB_BytsPerSec], ax mov word [BPB_BytsPerSec], ax
mov ax, word [es:bx+14] mov ax, word [es:bx+14]
mov word [BPB_RsvdSecCnt], ax mov word [BPB_RsvdSecCnt], ax
mov ax, word [es:bx+19] mov ax, word [es:bx+19]
mov word [BPB_TotSec16], ax mov word [BPB_TotSec16], ax
mov al, byte [es:bx+13] mov al, byte [es:bx+13]
mov byte [BPB_SecPerClus], al mov byte [BPB_SecPerClus], al
mov al, byte [es:bx+16] mov al, byte [es:bx+16]
mov byte [BPB_NumFATs], al mov byte [BPB_NumFATs], al
; count of clusters in FAT12 ((size_of_FAT*2)/3) ; count of clusters in FAT12 ((size_of_FAT*2)/3)
mov ax, word [BPB_FATSz16] mov ax, word [BPB_FATSz16]
mov cx, word [BPB_BytsPerSec] mov cx, word [BPB_BytsPerSec]
xor dx, dx xor dx, dx
mul cx mul cx
shl ax, 1 shl ax, 1
mov cx, 3 mov cx, 3
div cx ; now ax - number of clusters in FAT12 div cx ; now ax - number of clusters in FAT12
mov word [end_of_FAT], ax mov word [end_of_FAT], ax
; load first FAT table ; load first FAT table
mov cx, 0x0002 ; startcyl,startsector ; TODO!!!!! mov cx, 0x0002 ; startcyl,startsector ; TODO!!!!!
xor dx, dx ; starthead,drive xor dx, dx ; starthead,drive
mov al, byte [BPB_FATSz16] ; no of sectors to read mov al, byte [BPB_FATSz16] ; no of sectors to read
add bx, word [BPB_BytsPerSec] ; es:bx -> data area add bx, word [BPB_BytsPerSec] ; es:bx -> data area
call boot_read_floppy call boot_read_floppy
mov bx, 0xB000 mov bx, 0xB000
; and copy them to extended memory ; and copy them to extended memory
mov si, movedesc mov si, movedesc
mov [si+8*2+3], bh ; from mov [si+8*2+3], bh ; from
mov ax, word [BPB_BytsPerSec] mov ax, word [BPB_BytsPerSec]
shr ax, 1 ; words per sector shr ax, 1 ; words per sector
mov cx, word [BPB_RsvdSecCnt] mov cx, word [BPB_RsvdSecCnt]
add cx, word [BPB_FATSz16] add cx, word [BPB_FATSz16]
mul cx mul cx
push ax ; save to stack count of words in boot+FAT push ax ; save to stack count of words in boot+FAT
xchg ax, cx xchg ax, cx
push es push es
push ds push ds
pop es pop es
mov ah, 0x87 mov ah, 0x87
int 0x15 int 0x15
pop es pop es
test ah, ah test ah, ah
jz @f jz @f
sayerr_floppy: sayerr_floppy:
@ -959,21 +959,21 @@ sayerr_floppy:
mov si, memmovefailed mov si, memmovefailed
jmp sayerr_plain jmp sayerr_plain
@@: @@:
pop ax ; restore from stack count of words in boot+FAT pop ax ; restore from stack count of words in boot+FAT
shl ax, 1 ; make bytes count from count of words shl ax, 1 ; make bytes count from count of words
and eax, 0ffffh and eax, 0ffffh
add dword [si+8*3+2], eax add dword [si+8*3+2], eax
; copy first FAT to second copy ; copy first FAT to second copy
; TODO: BPB_NumFATs !!!!! ; TODO: BPB_NumFATs !!!!!
add bx, word [BPB_BytsPerSec] ; !!! TODO: may be need multiply by BPB_RsvdSecCnt !!! add bx, word [BPB_BytsPerSec] ; !!! TODO: may be need multiply by BPB_RsvdSecCnt !!!
mov byte [si+8*2+3], bh ; bx - begin of FAT mov byte [si+8*2+3], bh ; bx - begin of FAT
mov ax, word [BPB_BytsPerSec] mov ax, word [BPB_BytsPerSec]
shr ax, 1 ; words per sector shr ax, 1 ; words per sector
mov cx, word [BPB_FATSz16] mov cx, word [BPB_FATSz16]
mul cx mul cx
mov cx, ax ; cx - count of words in FAT mov cx, ax ; cx - count of words in FAT
push es push es
push ds push ds
@ -984,128 +984,128 @@ sayerr_floppy:
test ah, ah test ah, ah
jnz sayerr_floppy jnz sayerr_floppy
mov ax, cx mov ax, cx
shl ax, 1 shl ax, 1
and eax, 0ffffh ; ax - count of bytes in FAT and eax, 0ffffh ; ax - count of bytes in FAT
add dword [si+8*3+2], eax add dword [si+8*3+2], eax
; reading RootDir ; reading RootDir
; TODO: BPB_NumFATs ; TODO: BPB_NumFATs
add bx, ax add bx, ax
add bx, 100h add bx, 100h
and bx, 0ff00h ; bx - place in buffer to write RootDir and bx, 0ff00h ; bx - place in buffer to write RootDir
push bx push bx
mov bx, word [BPB_BytsPerSec] mov bx, word [BPB_BytsPerSec]
shr bx, 5 ; divide bx by 32 shr bx, 5 ; divide bx by 32
mov ax, word [BPB_RootEntCnt] mov ax, word [BPB_RootEntCnt]
xor dx, dx xor dx, dx
div bx div bx
push ax ; ax - count of RootDir sectors push ax ; ax - count of RootDir sectors
mov ax, word [BPB_FATSz16] mov ax, word [BPB_FATSz16]
xor cx, cx xor cx, cx
mov cl, byte [BPB_NumFATs] mov cl, byte [BPB_NumFATs]
mul cx mul cx
add ax, word [BPB_RsvdSecCnt] ; ax - first sector of RootDir add ax, word [BPB_RsvdSecCnt] ; ax - first sector of RootDir
mov word [FirstDataSector], ax mov word [FirstDataSector], ax
pop bx pop bx
push bx push bx
add word [FirstDataSector], bx ; Begin of data region of floppy add word [FirstDataSector], bx ; Begin of data region of floppy
; read RootDir ; read RootDir
call conv_abs_to_THS call conv_abs_to_THS
pop ax pop ax
pop bx ; place in buffer to write pop bx ; place in buffer to write
push ax push ax
call boot_read_floppy ; read RootDir into buffer call boot_read_floppy ; read RootDir into buffer
; copy RootDir ; copy RootDir
mov byte [si+8*2+3], bh ; from buffer mov byte [si+8*2+3], bh ; from buffer
pop ax ; ax = count of RootDir sectors pop ax ; ax = count of RootDir sectors
mov cx, word [BPB_BytsPerSec] mov cx, word [BPB_BytsPerSec]
mul cx mul cx
shr ax, 1 shr ax, 1
mov cx, ax ; count of words to copy mov cx, ax ; count of words to copy
push es push es
push ds push ds
pop es pop es
mov ah, 0x87 mov ah, 0x87
int 0x15 int 0x15
pop es pop es
mov ax, cx mov ax, cx
shl ax, 1 shl ax, 1
and eax, 0ffffh ; ax - count of bytes in RootDir and eax, 0ffffh ; ax - count of bytes in RootDir
add dword [si+8*3+2], eax ; add count of bytes copied add dword [si+8*3+2], eax ; add count of bytes copied
; Reading data clusters from floppy ; Reading data clusters from floppy
mov byte [si+8*2+3], bh mov byte [si+8*2+3], bh
push bx push bx
mov di, 2 ; First data cluster mov di, 2 ; First data cluster
.read_loop: .read_loop:
mov bx, di mov bx, di
shr bx, 1 ; bx+di = di*1.5 shr bx, 1 ; bx+di = di*1.5
jnc .even jnc .even
test word [es:bx+di+0xB200], 0xFFF0 ; TODO: may not be 0xB200 !!! test word [es:bx+di+0xB200], 0xFFF0 ; TODO: may not be 0xB200 !!!
jmp @f jmp @f
.even: .even:
test word [es:bx+di+0xB200], 0xFFF ; TODO: may not be 0xB200 !!! test word [es:bx+di+0xB200], 0xFFF ; TODO: may not be 0xB200 !!!
@@: @@:
jz .skip jz .skip
; read cluster di ; read cluster di
;.read: ;.read:
;conv cluster di to abs. sector ax ;conv cluster di to abs. sector ax
; ax = (N-2) * BPB_SecPerClus + FirstDataSector ; ax = (N-2) * BPB_SecPerClus + FirstDataSector
mov ax, di mov ax, di
sub ax, 2 sub ax, 2
xor bx, bx xor bx, bx
mov bl, byte [BPB_SecPerClus] mov bl, byte [BPB_SecPerClus]
mul bx mul bx
add ax, word [FirstDataSector] add ax, word [FirstDataSector]
call conv_abs_to_THS call conv_abs_to_THS
pop bx pop bx
push bx push bx
mov al, byte [BPB_SecPerClus] ; number of sectors in cluster mov al, byte [BPB_SecPerClus] ; number of sectors in cluster
call boot_read_floppy call boot_read_floppy
push es push es
push ds push ds
pop es pop es
pusha pusha
; ;
mov ax, word [BPB_BytsPerSec] mov ax, word [BPB_BytsPerSec]
xor cx, cx xor cx, cx
mov cl, byte [BPB_SecPerClus] mov cl, byte [BPB_SecPerClus]
mul cx mul cx
shr ax, 1 ; ax = (BPB_BytsPerSec * BPB_SecPerClus)/2 shr ax, 1 ; ax = (BPB_BytsPerSec * BPB_SecPerClus)/2
mov cx, ax ; number of words to copy (count words in cluster) mov cx, ax ; number of words to copy (count words in cluster)
; ;
mov ah, 0x87 mov ah, 0x87
int 0x15 ; copy data int 0x15 ; copy data
test ah, ah test ah, ah
popa popa
pop es pop es
jnz sayerr_floppy jnz sayerr_floppy
; skip cluster di ; skip cluster di
.skip: .skip:
mov ax, word [BPB_BytsPerSec] mov ax, word [BPB_BytsPerSec]
xor cx, cx xor cx, cx
mov cl, byte [BPB_SecPerClus] mov cl, byte [BPB_SecPerClus]
mul cx mul cx
and eax, 0ffffh ; ax - count of bytes in cluster and eax, 0ffffh ; ax - count of bytes in cluster
add dword [si+8*3+2], eax add dword [si+8*3+2], eax
mov ax, word [end_of_FAT] ; max cluster number mov ax, word [end_of_FAT] ; max cluster number
pusha pusha
; draw percentage ; draw percentage
; total clusters: ax ; total clusters: ax
; read clusters: di ; read clusters: di
xchg ax, di xchg ax, di
mov cx, 100 mov cx, 100
mul cx mul cx
div di div di
aam aam
xchg al, ah xchg al, ah
add ax, '00' add ax, '00'
@ -1117,9 +1117,9 @@ sayerr_floppy:
@@: @@:
popa popa
inc di inc di
cmp di, word [end_of_FAT] ; max number of cluster cmp di, word [end_of_FAT] ; max number of cluster
jnz .read_loop jnz .read_loop
pop bx ; clear stack pop bx ; clear stack
ok_sys_on_floppy: ok_sys_on_floppy:
mov si, backspace2 mov si, backspace2