2007-03-21 23:58:33 +01:00
|
|
|
|
$Revision$
|
2007-03-26 14:18:08 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
|
|
|
|
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; BOOTCODE.INC ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; KolibriOS 16-bit loader, ;;
|
|
|
|
|
;; based on bootcode for MenuetOS ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;==========================================================================
|
|
|
|
|
;
|
|
|
|
|
; 16 BIT FUNCTIONS
|
|
|
|
|
;
|
|
|
|
|
;==========================================================================
|
|
|
|
|
|
2006-10-16 14:17:49 +02:00
|
|
|
|
|
2005-12-14 09:09:29 +01:00
|
|
|
|
putchar:
|
|
|
|
|
; in: al=character
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov ah, 0Eh
|
|
|
|
|
mov bh, 0
|
|
|
|
|
int 10h
|
|
|
|
|
ret
|
2005-12-14 09:09:29 +01:00
|
|
|
|
|
|
|
|
|
print:
|
|
|
|
|
; in: si->string
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov al, 186
|
|
|
|
|
call putchar
|
|
|
|
|
mov al, ' '
|
|
|
|
|
call putchar
|
2005-12-14 09:09:29 +01:00
|
|
|
|
|
|
|
|
|
printplain:
|
|
|
|
|
; in: si->string
|
2006-05-06 16:34:30 +02:00
|
|
|
|
pusha
|
|
|
|
|
lodsb
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call putchar
|
|
|
|
|
lodsb
|
|
|
|
|
cmp al, 0
|
|
|
|
|
jnz @b
|
|
|
|
|
popa
|
|
|
|
|
ret
|
2005-12-14 09:09:29 +01:00
|
|
|
|
|
|
|
|
|
getkey:
|
|
|
|
|
; get number in range [bl,bh] (bl,bh in ['0'..'9'])
|
|
|
|
|
; in: bx=range
|
|
|
|
|
; out: ax=digit (1..9, 10 for 0)
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov ah, 0
|
|
|
|
|
int 16h
|
|
|
|
|
cmp al, bl
|
|
|
|
|
jb getkey
|
|
|
|
|
cmp al, bh
|
|
|
|
|
ja getkey
|
|
|
|
|
push ax
|
|
|
|
|
call putchar
|
|
|
|
|
pop ax
|
|
|
|
|
and ax, 0Fh
|
|
|
|
|
jnz @f
|
|
|
|
|
mov al, 10
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
ret
|
2005-12-14 09:09:29 +01:00
|
|
|
|
|
|
|
|
|
setcursor:
|
|
|
|
|
; in: dl=column, dh=row
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov ah, 2
|
|
|
|
|
mov bh, 0
|
|
|
|
|
int 10h
|
|
|
|
|
ret
|
2005-12-14 09:09:29 +01:00
|
|
|
|
|
|
|
|
|
macro _setcursor row,column
|
|
|
|
|
{
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov dx, row*256 + column
|
|
|
|
|
call setcursor
|
2005-12-14 09:09:29 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-08-24 14:33:31 +02:00
|
|
|
|
boot_read_floppy:
|
|
|
|
|
push si
|
|
|
|
|
xor si, si
|
|
|
|
|
mov ah, 2 ; read
|
|
|
|
|
@@:
|
|
|
|
|
push ax
|
|
|
|
|
int 0x13
|
|
|
|
|
pop ax
|
|
|
|
|
jnc @f
|
|
|
|
|
inc si
|
|
|
|
|
cmp si, 10
|
|
|
|
|
jb @b
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, badsect
|
2006-08-24 14:33:31 +02:00
|
|
|
|
sayerr_plain:
|
|
|
|
|
call printplain
|
|
|
|
|
jmp $
|
|
|
|
|
@@:
|
|
|
|
|
pop si
|
|
|
|
|
ret
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;=========================================================================
|
|
|
|
|
;
|
|
|
|
|
; 16 BIT CODE
|
|
|
|
|
;
|
|
|
|
|
;=========================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start_of_code:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cld
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; \begin{diamond}[02.12.2005]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp ax, 'KL'
|
|
|
|
|
jnz @f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov word [cs:cfgmanager.loader_block], si
|
|
|
|
|
mov word [cs:cfgmanager.loader_block+2], ds
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
|
|
|
|
; \end{diamond}[02.12.2005]
|
|
|
|
|
|
|
|
|
|
; set up stack
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov ax, 3000h
|
|
|
|
|
mov ss, ax
|
|
|
|
|
mov sp, 0EC00h
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; set up segment registers
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
push cs
|
|
|
|
|
pop es
|
2005-12-14 09:09:29 +01:00
|
|
|
|
|
|
|
|
|
; set videomode
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov ax, 3
|
2005-10-06 19:56:22 +02:00
|
|
|
|
int 0x10
|
|
|
|
|
|
2006-08-24 14:33:31 +02:00
|
|
|
|
if lang eq ru
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; Load & set russian VGA font (RU.INC)
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov bp, RU_FNT1 ; RU_FNT1 - First part
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov bx,1000h ; 768 bytes
|
|
|
|
|
mov cx,30h ; 48 symbols
|
|
|
|
|
mov dx,80h ; 128 - position of first symbol
|
|
|
|
|
mov ax,1100h
|
|
|
|
|
int 10h
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov bp,RU_FNT2 ; RU_FNT2 -Second part
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov bx,1000h ; 512 bytes
|
|
|
|
|
mov cx,20h ; 32 symbols
|
|
|
|
|
mov dx,0E0h ; 224 - position of first symbol
|
|
|
|
|
mov ax,1100h
|
|
|
|
|
int 10h
|
|
|
|
|
; End set VGA russian font
|
2007-01-13 21:34:33 +01:00
|
|
|
|
else if lang eq et
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov bp,ET_FNT ; ET_FNT1
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov bx,1000h ;
|
2007-01-13 21:34:33 +01:00
|
|
|
|
mov cx,255 ; 256 symbols
|
|
|
|
|
mov dx,0h ; 0 - position of first symbol
|
|
|
|
|
mov ax,1100h
|
|
|
|
|
int 10h
|
2006-08-24 14:33:31 +02:00
|
|
|
|
end if
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; draw frames
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push 0xb800
|
|
|
|
|
pop es
|
|
|
|
|
xor di, di
|
|
|
|
|
mov ah, 1*16+15
|
2007-04-18 08:37:14 +02:00
|
|
|
|
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; draw top
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, d80x25_top
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov cx, d80x25_top_num * 80
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
lodsb
|
|
|
|
|
stosw
|
|
|
|
|
loop @b
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; draw spaces
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, space_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov cx, 25 - d80x25_top_num - d80x25_bottom_num
|
2005-12-14 09:09:29 +01:00
|
|
|
|
dfl1:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push cx
|
|
|
|
|
push si
|
|
|
|
|
mov cx, 80
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
lodsb
|
|
|
|
|
stosw
|
|
|
|
|
loop @b
|
|
|
|
|
pop si
|
|
|
|
|
pop cx
|
|
|
|
|
loop dfl1
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; draw bottom
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, d80x25_bottom
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov cx, d80x25_bottom_num * 80
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
lodsb
|
|
|
|
|
stosw
|
|
|
|
|
loop @b
|
2005-12-14 09:09:29 +01:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov byte [space_msg+80], 0 ; now space_msg is null terminated
|
2005-12-14 09:09:29 +01:00
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor d80x25_top_num,0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; TEST FOR 386+
|
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov bx, 0x4000
|
2005-10-06 19:56:22 +02:00
|
|
|
|
pushf
|
|
|
|
|
pop ax
|
|
|
|
|
mov dx,ax
|
2005-12-14 09:09:29 +01:00
|
|
|
|
xor ax,bx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
push ax
|
|
|
|
|
popf
|
|
|
|
|
pushf
|
|
|
|
|
pop ax
|
2005-12-14 09:09:29 +01:00
|
|
|
|
and ax,bx
|
|
|
|
|
and dx,bx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ax,dx
|
|
|
|
|
jnz cpugood
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si,not386
|
2006-01-25 14:19:21 +01:00
|
|
|
|
sayerr:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call print
|
|
|
|
|
jmp $
|
|
|
|
|
cpugood:
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
push 0
|
|
|
|
|
popf
|
|
|
|
|
sti
|
|
|
|
|
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; set up esp
|
2006-05-06 16:34:30 +02:00
|
|
|
|
movzx esp, sp
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-09-27 16:58:51 +02:00
|
|
|
|
push 0
|
|
|
|
|
pop es
|
|
|
|
|
and word [es:0x9031], 0
|
2006-10-06 08:09:41 +02:00
|
|
|
|
; \begin{Mario79}
|
|
|
|
|
; find HDD IDE DMA PCI device
|
2006-09-27 16:58:51 +02:00
|
|
|
|
; check for PCI BIOS
|
|
|
|
|
mov ax, 0xB101
|
|
|
|
|
int 0x1A
|
|
|
|
|
jc .nopci
|
|
|
|
|
cmp edx, 'PCI '
|
|
|
|
|
jnz .nopci
|
|
|
|
|
; find PCI class code
|
|
|
|
|
; class 1 = mass storage
|
|
|
|
|
; subclass 1 = IDE controller
|
|
|
|
|
; a) class 1, subclass 1, programming interface 0x80
|
|
|
|
|
mov ax, 0xB103
|
|
|
|
|
mov ecx, 1*10000h + 1*100h + 0x80
|
|
|
|
|
mov si, 0 ; device index = 0
|
|
|
|
|
int 0x1A
|
|
|
|
|
jnc .found
|
2006-10-20 10:35:15 +02:00
|
|
|
|
; b) class 1, subclass 1, programming interface 0x8A
|
2006-09-27 16:58:51 +02:00
|
|
|
|
mov ax, 0xB103
|
2006-10-20 10:35:15 +02:00
|
|
|
|
mov ecx, 1*10000h + 1*100h + 0x8A
|
2006-09-27 16:58:51 +02:00
|
|
|
|
mov si, 0 ; device index = 0
|
|
|
|
|
int 0x1A
|
|
|
|
|
jnc .found
|
2006-10-20 10:35:15 +02:00
|
|
|
|
; c) class 1, subclass 1, programming interface 0x85
|
2006-09-27 16:58:51 +02:00
|
|
|
|
mov ax, 0xB103
|
2006-10-20 10:35:15 +02:00
|
|
|
|
mov ecx, 1*10000h + 1*100h + 0x85
|
2006-09-27 16:58:51 +02:00
|
|
|
|
mov si, 0
|
|
|
|
|
int 0x1A
|
|
|
|
|
jc .nopci
|
|
|
|
|
.found:
|
|
|
|
|
; get memory base
|
|
|
|
|
mov ax, 0xB10A
|
|
|
|
|
mov di, 0x20 ; memory base is config register at 0x20
|
|
|
|
|
int 0x1A
|
|
|
|
|
jc .nopci
|
|
|
|
|
and cx, 0xFFF0 ; clear address decode type
|
|
|
|
|
mov [es:0x9031], cx
|
|
|
|
|
.nopci:
|
2006-10-06 08:09:41 +02:00
|
|
|
|
; \end{Mario79}
|
2006-09-27 16:58:51 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov al,0xf6 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
out 0x60,al
|
2005-12-14 09:09:29 +01:00
|
|
|
|
xor cx,cx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
wait_loop: ; variant 2
|
|
|
|
|
; reading state of port of 8042 controller
|
2006-10-06 08:09:41 +02:00
|
|
|
|
in al,64h
|
2005-10-06 19:56:22 +02:00
|
|
|
|
and al,00000010b ; ready flag
|
2006-10-06 08:09:41 +02:00
|
|
|
|
; wait until 8042 controller is ready
|
2005-10-06 19:56:22 +02:00
|
|
|
|
loopnz wait_loop
|
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
; --------------- APM ---------------------
|
|
|
|
|
push 0
|
|
|
|
|
pop es
|
|
|
|
|
mov word [es : 0x9044], 0 ; ver = 0.0 (APM not found)
|
|
|
|
|
mov ax, 0x5300
|
|
|
|
|
xor bx, bx
|
|
|
|
|
int 0x15
|
|
|
|
|
jc apm_end ; APM not found
|
|
|
|
|
test cx, 2
|
|
|
|
|
jz apm_end ; APM 32-bit protected-mode interface not supported
|
|
|
|
|
mov [es : 0x9044], ax ; Save APM Version
|
|
|
|
|
mov [es : 0x9046], cx ; Save APM flags
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
; Write APM ver ----
|
2006-05-26 12:48:09 +02:00
|
|
|
|
and ax, 0xf0f
|
2006-05-06 16:34:30 +02:00
|
|
|
|
add ax, '00'
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, msg_apm
|
2006-05-26 12:48:09 +02:00
|
|
|
|
mov [si + 5], ah
|
|
|
|
|
mov [si + 7], al
|
|
|
|
|
_setcursor 0, 3
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
|
|
|
|
; ------------------
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov ax, 0x5304 ; Disconnect interface
|
|
|
|
|
xor bx, bx
|
|
|
|
|
int 0x15
|
|
|
|
|
mov ax, 0x5303 ; Connect 32 bit mode interface
|
|
|
|
|
xor bx, bx
|
|
|
|
|
int 0x15
|
2007-04-18 08:37:14 +02:00
|
|
|
|
|
|
|
|
|
push 0
|
|
|
|
|
pop es
|
|
|
|
|
|
|
|
|
|
mov [es:0x9040], ebx
|
|
|
|
|
mov [es:0x9050], ax
|
|
|
|
|
mov [es:0x9052], cx
|
|
|
|
|
mov [es:0x9054], dx
|
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
apm_end:
|
2007-03-29 12:24:08 +02:00
|
|
|
|
_setcursor d80x25_top_num, 0
|
2007-03-22 02:09:49 +01:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; DISPLAY VESA INFORMATION
|
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push 0
|
|
|
|
|
pop es
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ax,0x4f00
|
|
|
|
|
mov di,0xa000
|
|
|
|
|
int 0x10
|
|
|
|
|
cmp ax,0x004f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, novesa
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jnz @f
|
2006-10-06 08:09:41 +02:00
|
|
|
|
mov bx, word [es:di+0x12]
|
|
|
|
|
shl ebx,16
|
|
|
|
|
mov [es:0x9050], ebx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ax,[es:di+4]
|
|
|
|
|
add ax,'0'*256+'0'
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si,vervesa
|
2006-01-25 14:19:21 +01:00
|
|
|
|
mov [si+vervesa_off], ah
|
|
|
|
|
mov [si+vervesa_off+2], al
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@: call print
|
|
|
|
|
|
|
|
|
|
; \begin{diamond}[30.11.2005]
|
|
|
|
|
cfgmanager:
|
|
|
|
|
; settings:
|
|
|
|
|
; a) preboot_graph = graphical mode
|
|
|
|
|
; preboot_gprobe = probe this mode?
|
2007-02-14 17:01:07 +01:00
|
|
|
|
; b) preboot_dma_write = use DMA write?
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; c) preboot_vrrm = use VRR?
|
|
|
|
|
; d) preboot_device = from what boot?
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov di, preboot_graph
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; check bootloader block
|
2007-04-18 08:37:14 +02:00
|
|
|
|
cmp [.loader_block], -1
|
2006-10-06 08:09:41 +02:00
|
|
|
|
jz .noloaderblock
|
2007-04-18 08:37:14 +02:00
|
|
|
|
les bx, [.loader_block]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp byte [es:bx], 1
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, loader_block_error
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jnz sayerr
|
|
|
|
|
test byte [es:bx+1], 1
|
|
|
|
|
jz @f
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; image in memory present
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp [di+preboot_device-preboot_graph], 0
|
|
|
|
|
jnz @f
|
|
|
|
|
mov [di+preboot_device-preboot_graph], 3
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
|
|
|
|
.noloaderblock:
|
|
|
|
|
; determine default settings
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [.bSettingsChanged], 0
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp byte [di], 0
|
|
|
|
|
jnz .preboot_gr_end
|
|
|
|
|
mov [di+preboot_gprobe-preboot_graph], 0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al, [vervesa+vervesa_off]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp al, 'x'
|
|
|
|
|
jz .novesa
|
|
|
|
|
cmp al, '1'
|
|
|
|
|
jz .vesa12
|
|
|
|
|
mov [di+preboot_gprobe-preboot_graph], 2
|
|
|
|
|
mov al, 3
|
|
|
|
|
jmp @f
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.vesa12:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov al, 7
|
|
|
|
|
jmp @f
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.novesa:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov al, 10
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov [di], al
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.preboot_gr_end:
|
2007-02-14 17:01:07 +01:00
|
|
|
|
cmp [di+preboot_dma_write-preboot_graph], 1
|
|
|
|
|
adc [di+preboot_dma_write-preboot_graph], 0
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp [di+preboot_vrrm-preboot_graph], 1
|
|
|
|
|
adc [di+preboot_vrrm-preboot_graph], 0
|
|
|
|
|
cmp [di+preboot_device-preboot_graph], 1
|
|
|
|
|
adc [di+preboot_device-preboot_graph], 0
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; notify user
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, linef
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, start_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, time_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; get start time
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call .gettime
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [.starttime], eax
|
|
|
|
|
mov word [.timer], .newtimer
|
|
|
|
|
mov word [.timer+2], cs
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.printcfg:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 9,0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, current_cfg_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, curvideo_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al, [preboot_graph]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp al, 8
|
|
|
|
|
ja .pnovesa
|
|
|
|
|
mov dl, al
|
|
|
|
|
and eax, 3
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, [modes_msg+eax*2]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, modevesa20
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp dl, 4
|
|
|
|
|
jbe @f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, modevesa12
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
|
|
|
|
cmp dl, 4
|
|
|
|
|
ja .x
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, probeno_msg
|
|
|
|
|
cmp [preboot_gprobe], 2
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jnz @f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, probeok_msg
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.x:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jmp .c
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.pnovesa:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp al, 9
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, mode9
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jz @b
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, mode10
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jmp @b
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.c:
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, linef
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, dma_msg
|
|
|
|
|
cmp [preboot_dma_write], 1
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call .say_on_off
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, vrrm_msg
|
|
|
|
|
cmp [preboot_vrrm], 1
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call .say_on_off
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, preboot_device_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al, [preboot_device]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
and eax, 3
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, [preboot_device_msgs+eax*2]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.wait:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 25,0 ; out of screen
|
2006-01-11 10:46:06 +01:00
|
|
|
|
; set timer interrupt handler
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cli
|
|
|
|
|
push 0
|
|
|
|
|
pop es
|
|
|
|
|
mov eax, [es:8*4]
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [.oldtimer], eax
|
|
|
|
|
mov eax, [.timer]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov [es:8*4], eax
|
|
|
|
|
sti
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; wait for keypressed
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov ah, 0
|
|
|
|
|
int 16h
|
|
|
|
|
push ax
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; restore timer interrupt
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push 0
|
|
|
|
|
pop es
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov eax, [.oldtimer]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov [es:8*4], eax
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [.timer], eax
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 7,0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, space_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
|
|
|
|
pop ax
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; switch on key
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp al, 13
|
|
|
|
|
jz .continue
|
|
|
|
|
or al, 20h
|
|
|
|
|
cmp al, 'a'
|
|
|
|
|
jz .change_a
|
|
|
|
|
cmp al, 'b'
|
|
|
|
|
jz .change_b
|
|
|
|
|
cmp al, 'c'
|
|
|
|
|
jz .change_c
|
|
|
|
|
cmp al, 'd'
|
|
|
|
|
jnz .wait
|
|
|
|
|
_setcursor 15,0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si,bdev
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
|
|
|
|
mov bx,'13'
|
|
|
|
|
call getkey
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [preboot_device], al
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 13,0
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.d:
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [.bSettingsChanged], 1
|
|
|
|
|
mov si, space_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
|
|
|
|
_setcursor 15,0
|
|
|
|
|
mov cx, 6
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
|
|
|
|
loop @b
|
|
|
|
|
jmp .printcfg
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.change_a:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 15,0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, gr_mode
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
|
|
|
|
mov bx, '09'
|
|
|
|
|
call getkey
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [preboot_graph], al
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp al, 4
|
|
|
|
|
ja @f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, probetext
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
|
|
|
|
mov bx, '12'
|
|
|
|
|
call getkey
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [preboot_gprobe], al
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 10,0
|
|
|
|
|
jmp .d
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.change_b:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 15,0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, ask_dma
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
|
|
|
|
mov bx, '12'
|
|
|
|
|
call getkey
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [preboot_dma_write], al
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 11,0
|
|
|
|
|
jmp .d
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.change_c:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 15,0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, vrrmprint
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
|
|
|
|
mov bx, '12'
|
|
|
|
|
call getkey
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [preboot_vrrm], al
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 12,0
|
|
|
|
|
jmp .d
|
2006-01-25 14:19:21 +01:00
|
|
|
|
.say_on_off:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
pushf
|
|
|
|
|
call print
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, on_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
popf
|
|
|
|
|
jz @f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, off_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
@@: call printplain
|
|
|
|
|
ret
|
2006-01-25 14:19:21 +01:00
|
|
|
|
; novesa and vervesa strings are not used at the moment of executing this code
|
|
|
|
|
virtual at novesa
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.oldtimer dd ?
|
|
|
|
|
.starttime dd ?
|
|
|
|
|
.bSettingsChanged db ?
|
2006-01-11 10:46:06 +01:00
|
|
|
|
.timer dd ?
|
2006-01-25 14:19:21 +01:00
|
|
|
|
end virtual
|
2006-08-31 14:56:29 +02:00
|
|
|
|
.loader_block dd -1
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.gettime:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov ah, 0
|
|
|
|
|
int 1Ah
|
|
|
|
|
xchg ax, cx
|
|
|
|
|
shl eax, 10h
|
|
|
|
|
xchg ax, dx
|
|
|
|
|
ret
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.newtimer:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push ds
|
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
|
|
|
|
pushf
|
2007-04-18 08:37:14 +02:00
|
|
|
|
call [.oldtimer]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
pushad
|
|
|
|
|
call .gettime
|
2007-04-18 08:37:14 +02:00
|
|
|
|
sub eax, [.starttime]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
sub ax, 18*5
|
|
|
|
|
jae .timergo
|
|
|
|
|
neg ax
|
|
|
|
|
add ax, 18-1
|
|
|
|
|
mov bx, 18
|
|
|
|
|
xor dx, dx
|
|
|
|
|
div bx
|
2005-12-14 09:09:29 +01:00
|
|
|
|
if lang eq ru
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 ᥪ㭤, 4/3/2 ᥪ㭤<EFBFBD>, 1 ᥪ㭤<EFBFBD>
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp al, 5
|
|
|
|
|
mov cl, ' '
|
|
|
|
|
jae @f
|
|
|
|
|
cmp al, 1
|
|
|
|
|
mov cl, '<27>'
|
|
|
|
|
jz @f
|
|
|
|
|
mov cl, '<27>'
|
2007-04-18 08:37:14 +02:00
|
|
|
|
@@: mov [time_str+9], cl
|
2007-01-13 21:34:33 +01:00
|
|
|
|
else if lang eq et
|
|
|
|
|
cmp al, 1
|
|
|
|
|
ja @f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [time_str+9], ' '
|
|
|
|
|
mov [time_str+10],' '
|
2007-03-01 21:32:19 +01:00
|
|
|
|
@@:
|
2005-12-14 09:09:29 +01:00
|
|
|
|
else
|
|
|
|
|
; wait 5/4/3/2 seconds, 1 second
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp al, 1
|
|
|
|
|
mov cl, 's'
|
|
|
|
|
ja @f
|
|
|
|
|
mov cl, ' '
|
2007-04-18 08:37:14 +02:00
|
|
|
|
@@: mov [time_str+9], cl
|
2005-12-14 09:09:29 +01:00
|
|
|
|
end if
|
2006-05-06 16:34:30 +02:00
|
|
|
|
add al, '0'
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [time_str+1], al
|
|
|
|
|
mov si, time_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
_setcursor 7,0
|
|
|
|
|
call print
|
|
|
|
|
_setcursor 25,0
|
|
|
|
|
popad
|
|
|
|
|
pop ds
|
|
|
|
|
iret
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.timergo:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push 0
|
|
|
|
|
pop es
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov eax, [.oldtimer]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov [es:8*4], eax
|
|
|
|
|
mov sp, 0EC00h
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.continue:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
sti
|
|
|
|
|
_setcursor 6,0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, space_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call printplain
|
|
|
|
|
call printplain
|
|
|
|
|
_setcursor 6,0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, loading_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
|
|
|
|
_setcursor 15,0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
cmp [.bSettingsChanged], 0
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jz .load
|
2007-04-18 08:37:14 +02:00
|
|
|
|
cmp [.loader_block], -1
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jz .load
|
2007-04-18 08:37:14 +02:00
|
|
|
|
les bx, [.loader_block]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov eax, [es:bx+3]
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
test eax, eax
|
|
|
|
|
jz .load
|
|
|
|
|
push eax
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, save_quest
|
2006-05-06 16:34:30 +02:00
|
|
|
|
call print
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.waityn:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov ah, 0
|
|
|
|
|
int 16h
|
|
|
|
|
or al, 20h
|
|
|
|
|
cmp al, 'n'
|
|
|
|
|
jz .loadc
|
|
|
|
|
cmp al, 'y'
|
|
|
|
|
jnz .waityn
|
|
|
|
|
call putchar
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov byte [space_msg+80], 186
|
2006-05-06 16:34:30 +02:00
|
|
|
|
pop eax
|
|
|
|
|
push cs
|
2006-05-26 12:48:09 +02:00
|
|
|
|
push .cont
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push eax
|
|
|
|
|
retf
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.loadc:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
pop eax
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.cont:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, space_msg
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov byte [si+80], 0
|
|
|
|
|
_setcursor 15,0
|
|
|
|
|
call printplain
|
|
|
|
|
_setcursor 15,0
|
2005-12-14 09:09:29 +01:00
|
|
|
|
.load:
|
|
|
|
|
; \end{diamond}[02.12.2005]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; ASK GRAPHICS MODE
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
movzx ax, [preboot_graph]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push 0
|
|
|
|
|
pop es
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; address is gr_table+6*(ax-1)
|
2006-05-06 16:34:30 +02:00
|
|
|
|
add ax, ax
|
2007-04-18 08:37:14 +02:00
|
|
|
|
lea si, [gr_table + eax + eax*2 - 6]
|
2005-12-14 09:09:29 +01:00
|
|
|
|
mov bx,[si+0]
|
|
|
|
|
mov cx,[si+2]
|
|
|
|
|
mov dx,[si+4]
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp al, 9*2
|
|
|
|
|
mov al, 32 ; BPP
|
|
|
|
|
jb @f
|
|
|
|
|
mov [es:0x9000], al
|
2006-10-06 08:09:41 +02:00
|
|
|
|
mov dword [es:0x9018], 0xFFFFFFFF; 0x800000
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [es:0x9008],bx
|
|
|
|
|
mov [es:0x900A],cx
|
|
|
|
|
mov [es:0x900C],dx
|
2006-05-06 16:34:30 +02:00
|
|
|
|
test bh, bh
|
|
|
|
|
jz nov
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; USE DEFAULTS OR PROBE
|
|
|
|
|
|
|
|
|
|
; bx - mode : cx - x size : dx - y size
|
2007-04-18 08:37:14 +02:00
|
|
|
|
cmp [preboot_gprobe], 1
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jz noprobe
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
mov bx,0x100
|
|
|
|
|
newprobe:
|
|
|
|
|
inc bx
|
|
|
|
|
cmp bx,0x17f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si,prnotfnd
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jz sayerr
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
probemore:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push cx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ax,0x4f01
|
|
|
|
|
mov cx,bx
|
|
|
|
|
and cx,0xfff
|
|
|
|
|
mov di,0xa000
|
|
|
|
|
int 0x10
|
2006-05-06 16:34:30 +02:00
|
|
|
|
pop cx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
test byte [es:di], 80h ; lfb?
|
|
|
|
|
jz newprobe
|
|
|
|
|
cmp [es:di+0x12], cx ; x size?
|
|
|
|
|
jnz newprobe
|
|
|
|
|
cmp [es:di+0x14], dx ; y size?
|
|
|
|
|
jnz newprobe
|
|
|
|
|
cmp byte [es:di+0x19], 32 ;24
|
|
|
|
|
jb newprobe
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-01-25 14:19:21 +01:00
|
|
|
|
; add bx,0100000000000000b
|
2006-05-06 16:34:30 +02:00
|
|
|
|
or bh, 40h
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [es:0x9008],bx
|
|
|
|
|
|
|
|
|
|
noprobe:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; FIND VESA 2.0 LFB & BPP
|
|
|
|
|
|
|
|
|
|
mov ax,0x4f01
|
|
|
|
|
mov cx,bx
|
|
|
|
|
and cx,0xfff
|
|
|
|
|
mov di,0xa000
|
|
|
|
|
int 0x10
|
|
|
|
|
; LFB
|
2006-01-25 14:19:21 +01:00
|
|
|
|
mov eax,[es:di+0x28]
|
|
|
|
|
mov [es:0x9018],eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; ---- vbe voodoo
|
2007-03-01 21:32:19 +01:00
|
|
|
|
BytesPerLine equ 0x10
|
|
|
|
|
mov ax, [es:di+BytesPerLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [es:0x9001],ax
|
2005-12-14 09:09:29 +01:00
|
|
|
|
; BPP
|
2006-01-25 14:19:21 +01:00
|
|
|
|
mov al,byte [es:di+0x19]
|
2005-12-14 09:09:29 +01:00
|
|
|
|
mov [es:0x9000],al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
nov:
|
2006-01-25 14:19:21 +01:00
|
|
|
|
cmp al,24
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si,bt24
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jz bppl
|
2006-01-25 14:19:21 +01:00
|
|
|
|
cmp al,32
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si,bt32
|
2005-12-14 09:09:29 +01:00
|
|
|
|
jz bppl
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si,btns
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jmp sayerr
|
2005-10-06 19:56:22 +02:00
|
|
|
|
bppl:
|
2006-01-25 14:19:21 +01:00
|
|
|
|
call print
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; FIND VESA 1.2 PM BANK SWITCH ADDRESS
|
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push es
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ax,0x4f0A
|
2006-05-06 16:34:30 +02:00
|
|
|
|
xor bx, bx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
int 0x10
|
|
|
|
|
xor eax,eax
|
|
|
|
|
mov ax,es
|
|
|
|
|
shl eax,4
|
2005-12-14 09:09:29 +01:00
|
|
|
|
movzx ebx,di
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,ebx
|
|
|
|
|
mov bx,[es:di]
|
|
|
|
|
add eax,ebx
|
|
|
|
|
pop es
|
|
|
|
|
mov [es:0x9014],eax
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; GRAPHICS ACCELERATION
|
2007-02-14 17:01:07 +01:00
|
|
|
|
; force yes
|
|
|
|
|
mov [es:0x901C], byte 1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-02-14 17:01:07 +01:00
|
|
|
|
; DMA WRITE
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al, [preboot_dma_write]
|
2007-02-14 17:01:07 +01:00
|
|
|
|
mov [es:0x901F],al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; VRR_M USE
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al,[preboot_vrrm]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [es:0x9030],al
|
|
|
|
|
mov [es:0x901E],byte 1
|
|
|
|
|
|
|
|
|
|
; BOOT DEVICE
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al, [preboot_device]
|
2006-01-25 14:19:21 +01:00
|
|
|
|
dec al
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [boot_dev],al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; READ DISKETTE TO MEMORY
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; cmp [boot_dev],0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_sys_on_floppy
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si,diskload
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call print
|
2006-05-06 16:34:30 +02:00
|
|
|
|
xor ax, ax ; reset drive
|
|
|
|
|
xor dx, dx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
int 0x13
|
2006-08-24 14:33:31 +02:00
|
|
|
|
; now load floppy image to memory
|
|
|
|
|
; at first load boot sector and first FAT table
|
|
|
|
|
mov cx, 0x0001 ; startcyl,startsector
|
|
|
|
|
xor dx, dx ; starthead,drive
|
|
|
|
|
mov al, 1+9 ; no of sectors to read
|
|
|
|
|
mov bx, 0xB000 ; es:bx -> data area
|
|
|
|
|
call boot_read_floppy
|
|
|
|
|
; and copy them to extended memory
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, movedesc
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov [si+8*2+3], bh
|
|
|
|
|
push es
|
|
|
|
|
push ds
|
|
|
|
|
pop es
|
|
|
|
|
mov cx, 256*10
|
|
|
|
|
mov ah, 0x87
|
|
|
|
|
int 0x15
|
2006-05-06 16:34:30 +02:00
|
|
|
|
test ah, ah
|
2006-08-24 14:33:31 +02:00
|
|
|
|
jz @f
|
|
|
|
|
sayerr_floppy:
|
|
|
|
|
mov dx, 0x3f2
|
|
|
|
|
mov al, 0
|
|
|
|
|
out dx, al
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, memmovefailed
|
2006-08-24 14:33:31 +02:00
|
|
|
|
jmp sayerr_plain
|
|
|
|
|
@@:
|
|
|
|
|
add dword [si+8*3+2], 512*10
|
|
|
|
|
; copy FAT to second copy
|
|
|
|
|
mov byte [si+8*2+3], 0xB2
|
|
|
|
|
mov cx, 256*9
|
|
|
|
|
mov ah, 0x87
|
|
|
|
|
int 0x15
|
|
|
|
|
pop es
|
|
|
|
|
test ah, ah
|
|
|
|
|
jnz sayerr_floppy
|
|
|
|
|
add dword [si+8*3+2], 512*9
|
|
|
|
|
; calculate total number of sectors to read
|
|
|
|
|
mov ax, 1+9+14 ; boot+FAT+root
|
|
|
|
|
mov di, 0xB203
|
|
|
|
|
.calc_loop:
|
|
|
|
|
test word [es:di], 0xFFF
|
|
|
|
|
jz @f
|
|
|
|
|
inc ax
|
|
|
|
|
@@:
|
|
|
|
|
test word [es:di+1], 0xFFF0
|
|
|
|
|
jz @f
|
|
|
|
|
inc ax
|
|
|
|
|
@@:
|
|
|
|
|
add di, 3
|
|
|
|
|
cmp di, 0xB200+1440*3
|
|
|
|
|
jb .calc_loop
|
|
|
|
|
push ax
|
|
|
|
|
mov bp, 1+9 ; already read sectors
|
|
|
|
|
; now read rest
|
|
|
|
|
mov byte [si+8*2+3], 0xA0
|
|
|
|
|
mov di, 2-14 ; absolute sector-31
|
|
|
|
|
mov cx, 0x0002 ; cylinder=0, sector=2
|
|
|
|
|
mov dx, 0x0100 ; head=1, disk=0
|
|
|
|
|
.read_loop:
|
|
|
|
|
; determine whether sector must be read
|
|
|
|
|
cmp di, 2
|
|
|
|
|
jl .read
|
|
|
|
|
mov bx, di
|
|
|
|
|
shr bx, 1
|
|
|
|
|
jnc .even
|
|
|
|
|
test word [es:bx+di+0xB200], 0xFFF0
|
|
|
|
|
jmp @f
|
|
|
|
|
.even:
|
|
|
|
|
test word [es:bx+di+0xB200], 0xFFF
|
|
|
|
|
@@:
|
|
|
|
|
jz .skip
|
|
|
|
|
.read:
|
|
|
|
|
mov bx, 0xA000
|
|
|
|
|
mov al, 1 ; 1 sector
|
|
|
|
|
call boot_read_floppy
|
|
|
|
|
inc bp
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push es
|
|
|
|
|
push ds
|
2005-10-06 19:56:22 +02:00
|
|
|
|
pop es
|
2006-08-24 14:33:31 +02:00
|
|
|
|
pusha
|
|
|
|
|
mov cx, 256
|
|
|
|
|
mov ah, 0x87
|
2005-10-06 19:56:22 +02:00
|
|
|
|
int 0x15
|
2006-08-24 14:33:31 +02:00
|
|
|
|
test ah, ah
|
2005-10-06 19:56:22 +02:00
|
|
|
|
popa
|
2006-08-24 14:33:31 +02:00
|
|
|
|
pop es
|
|
|
|
|
jnz sayerr_floppy
|
|
|
|
|
.skip:
|
|
|
|
|
add dword [si+8*3+2], 512
|
|
|
|
|
inc cx
|
|
|
|
|
cmp cl, 19
|
|
|
|
|
jnz @f
|
|
|
|
|
mov cl, 1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
inc dh
|
2006-08-24 14:33:31 +02:00
|
|
|
|
cmp dh, 2
|
|
|
|
|
jnz @f
|
|
|
|
|
mov dh, 0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
inc ch
|
2005-12-14 09:09:29 +01:00
|
|
|
|
@@:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
pop ax
|
|
|
|
|
push ax
|
2006-08-24 14:33:31 +02:00
|
|
|
|
pusha
|
|
|
|
|
; draw percentage
|
|
|
|
|
; total sectors: ax
|
|
|
|
|
; read sectors: bp
|
|
|
|
|
xchg ax, bp
|
|
|
|
|
mov cx, 100
|
|
|
|
|
mul cx
|
|
|
|
|
div bp
|
|
|
|
|
aam
|
|
|
|
|
xchg al, ah
|
|
|
|
|
add ax, '00'
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, pros
|
2006-08-24 14:33:31 +02:00
|
|
|
|
cmp [si], ax
|
|
|
|
|
jz @f
|
|
|
|
|
mov [si], ax
|
|
|
|
|
call printplain
|
|
|
|
|
@@:
|
|
|
|
|
popa
|
|
|
|
|
inc di
|
|
|
|
|
cmp di, 2880-31
|
|
|
|
|
jnz .read_loop
|
|
|
|
|
|
|
|
|
|
; mov cx, 0x0001 ; startcyl,startsector
|
|
|
|
|
; xor dx, dx ; starthead,drive
|
|
|
|
|
; push word 80*2 ; read no of sect
|
|
|
|
|
; reads:
|
|
|
|
|
; pusha
|
|
|
|
|
; xor si,si
|
|
|
|
|
; newread:
|
|
|
|
|
; mov bx,0xa000 ; es:bx -> data area
|
|
|
|
|
; mov ax,0x0200+18 ; read, no of sectors to read
|
|
|
|
|
; int 0x13
|
|
|
|
|
; test ah, ah
|
|
|
|
|
; jz goodread
|
|
|
|
|
; inc si
|
|
|
|
|
; cmp si,10
|
|
|
|
|
; jnz newread
|
|
|
|
|
; mov si,badsect-0x10000
|
|
|
|
|
;sayerr_plain:
|
|
|
|
|
; call printplain
|
|
|
|
|
; jmp $
|
|
|
|
|
; goodread:
|
|
|
|
|
; ; move -> 1mb
|
|
|
|
|
; mov si,movedesc-0x10000
|
|
|
|
|
; push es
|
|
|
|
|
; push ds
|
|
|
|
|
; pop es
|
|
|
|
|
; mov cx,256*18
|
|
|
|
|
; mov ah,0x87
|
|
|
|
|
; int 0x15
|
|
|
|
|
; pop es
|
|
|
|
|
;
|
|
|
|
|
; test ah,ah ; was the move successfull ?
|
|
|
|
|
; je goodmove
|
|
|
|
|
; mov dx,0x3f2 ; floppy motor off
|
|
|
|
|
; mov al,0
|
|
|
|
|
; out dx,al
|
|
|
|
|
; mov si,memmovefailed-0x10000
|
|
|
|
|
; jmp sayerr_plain
|
|
|
|
|
; goodmove:
|
|
|
|
|
;
|
|
|
|
|
; add dword [movedesc-0x10000+0x18+2], 512*18
|
|
|
|
|
; popa
|
|
|
|
|
; inc dh
|
|
|
|
|
; cmp dh,2
|
|
|
|
|
; jnz bb2
|
|
|
|
|
; mov dh,0
|
|
|
|
|
; inc ch
|
|
|
|
|
; pusha ; print prosentage
|
|
|
|
|
; mov si,pros-0x10000
|
|
|
|
|
; shr ch, 2
|
|
|
|
|
; mov al, '5'
|
|
|
|
|
; test ch, 1
|
|
|
|
|
; jnz @f
|
|
|
|
|
; mov al, '0'
|
|
|
|
|
;@@:
|
|
|
|
|
; mov [si+1], al
|
|
|
|
|
; shr ch, 1
|
|
|
|
|
; add ch, '0'
|
|
|
|
|
; mov [si], ch
|
|
|
|
|
; call printplain
|
|
|
|
|
; popa
|
|
|
|
|
; bb2:
|
|
|
|
|
; pop ax
|
|
|
|
|
; dec ax
|
|
|
|
|
; push ax
|
|
|
|
|
; jnz reads
|
|
|
|
|
; readdone:
|
|
|
|
|
; pop ax
|
2007-04-18 08:37:14 +02:00
|
|
|
|
|
|
|
|
|
mov si,backspace2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call printplain
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si,okt
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call printplain
|
|
|
|
|
no_sys_on_floppy:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
xor ax, ax ; reset drive
|
|
|
|
|
xor dx, dx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
int 0x13
|
|
|
|
|
mov dx,0x3f2 ; floppy motor off
|
|
|
|
|
mov al,0
|
2005-12-14 09:09:29 +01:00
|
|
|
|
out dx,al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; SET GRAPHICS
|
|
|
|
|
|
2006-10-06 08:09:41 +02:00
|
|
|
|
xor ax, ax
|
|
|
|
|
mov es, ax
|
|
|
|
|
|
|
|
|
|
mov ax,[es:0x9008] ; vga & 320x200
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov bx, ax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ax,0x13
|
|
|
|
|
je setgr
|
|
|
|
|
cmp ax,0x12
|
|
|
|
|
je setgr
|
|
|
|
|
mov ax,0x4f02 ; Vesa
|
2007-03-10 17:04:35 +01:00
|
|
|
|
setgr:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
int 0x10
|
2006-05-06 16:34:30 +02:00
|
|
|
|
test ah,ah
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov si, fatalsel
|
2006-05-06 16:34:30 +02:00
|
|
|
|
jnz sayerr
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; set mode 0x12 graphics registers:
|
|
|
|
|
cmp bx,0x12
|
|
|
|
|
jne gmok2
|
|
|
|
|
|
|
|
|
|
mov al,0x05
|
|
|
|
|
mov dx,0x03ce
|
2006-01-25 14:19:21 +01:00
|
|
|
|
push dx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
out dx,al ; select GDC mode register
|
|
|
|
|
mov al,0x02
|
2006-05-06 16:34:30 +02:00
|
|
|
|
inc dx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
out dx,al ; set write mode 2
|
|
|
|
|
|
|
|
|
|
mov al,0x02
|
|
|
|
|
mov dx,0x03c4
|
|
|
|
|
out dx,al ; select VGA sequencer map mask register
|
|
|
|
|
mov al,0x0f
|
2006-05-06 16:34:30 +02:00
|
|
|
|
inc dx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
out dx,al ; set mask for all planes 0-3
|
|
|
|
|
|
|
|
|
|
mov al,0x08
|
2006-05-06 16:34:30 +02:00
|
|
|
|
pop dx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
out dx,al ; select GDC bit mask register
|
|
|
|
|
; for writes to 0x03cf
|
2007-03-10 17:04:35 +01:00
|
|
|
|
gmok2:
|
2006-05-06 16:34:30 +02:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|