Sunday, 3 January 2016

Display an animated picture in grub4dos

We can display bitmaps fairly quickly in grub4dos if we load them into memory first. This could allow us to display an animation sequence on first boot of E2B (move over Walt Disney!).

The lines below can be added into a \_ISO\MyE2B.cfg file to show 3 bitmaps in a loop until a key is pressed by the user. It is assumed that the bitmaps have a black background and are each exactly 800x600 in dimension.



!BAT

# only run on first boot
if exist DONEMENU goto :Blpe
# console colour set by 0x00rrggbb00RRGGBB  (rrggbb = background, RRGGBB=text)
color standard 0x0000000000FFFFFF

graphicsmode -1 800 600 > nul
call Fn.70 3 > nul
errorcheck on
clear
echo -n -e Loading bitmaps - press a key to abort...
# move cursor to line 50 off-screen
call Fn.5 0 50 > nul
# copy bitmaps to memory
dd if=()/_ISO/1.bmp of=(md)0x20000+0x2000 bs=500K > nul
dd if=()/_ISO/2.bmp of=(md)0x30000+0x2000 bs=500K > nul
dd if=()/_ISO/3.bmp of=(md)0x40000+0x2000 bs=500K > nul

set key=
:Blp
splashimage (md)0x20000+0x2000 > nul
clear > nul
call Fn.5 0 50 > nul
pause --test-key --wait=1 > nul
set /A key=*0x4CB00 > nul
if not "%key%"=="0x1" goto :Blpe

splashimage (md)0x30000+0x2000 > nul
clear > nul
call Fn.5 0 50 > nul
pause --test-key --wait=1 > nul
set /A key=*0x4CB00 > nul
if not "%key%"=="0x1" goto :Blpe

splashimage (md)0x40000+0x2000 > nul
clear > nul
call Fn.5 0 50 > nul
pause --test-key --wait=1 > nul
set /A key=*0x4CB00 > nul
if "%key%"=="0x1" goto :Blp

:Blpe
set key=
clear
# normal mode
call Fn.70 2 > nul



Here is an alternative which uses a shorter delay and waits for 1 second at the end of picture 3 for a key press to abort. It uses a BIOS call for a shorter delay than 1 second.

!BAT

# only run on first boot
if exist DONEMENU goto :Blpe
# console colour set by 0x00rrggbb00RRGGBB  (rrggbb = background, RRGGBB=text)
color standard 0x0000000000FFFFFF

graphicsmode -1 800 600 > nul
call Fn.70 3 > nul
errorcheck on
clear
echo -n -e Loading bitmaps - press a key to abort...
# move cursor to line 50 off-screen
call Fn.5 0 50 > nul
# copy bitmaps to memory
dd if=()/_ISO/1.bmp of=(md)0x20000+0x2000 bs=500K > nul
dd if=()/_ISO/2.bmp of=(md)0x30000+0x2000 bs=500K > nul
dd if=()/_ISO/3.bmp of=(md)0x40000+0x2000 bs=500K > nul

# one delay unit = approx 65 milliseconds
set delay=0x05

set key=
:Blp
splashimage (md)0x20000+0x2000 > nul
clear > nul
call Fn.5 0 50 > nul
/_ISO/e2b/grub/bios int=0x15 eax=0x8600 ecx=%delay% edx=0x0000 > nul

splashimage (md)0x30000+0x2000 > nul
clear > nul
call Fn.5 0 50 > nul
/_ISO/e2b/grub/bios int=0x15 eax=0x8600 ecx=%delay% edx=0x0000 > nul

splashimage (md)0x40000+0x2000 > nul
clear > nul
call Fn.5 0 50 > nul
/_ISO/e2b/grub/bios int=0x15 eax=0x8600 ecx=%delay% edx=0x0000 > nul

pause --test-key --wait=1 > nul
set /A key=*0x4CB00 > nul
if "%key%"=="0x1" goto :Blp


:Blpe
set key=
clear
# normal mode
call Fn.70 2 > nul



This MyE2B.cfg file and three (pathetic) attempts at animated bitmaps, can be downloaded here.


No comments:

Post a Comment