A i386
bootsector rickroll.
A custom image can be displayed in place of the rickroll.
You can use images with less than (approximatively) 812
pixels
(512 - 106) * 2 = 812
:
512
bytes, size of bootsector106
bytes, size of code2
pixels / byte
Depending on the opcodes pixels create, there could be less space available.
Image can't be larger than 255
pixels.
- Craft your PNG with a paint like software, using the BIOS color palette
- Generate the bytecode of your image with
png2hex.py
$ python png2hex.py rick.png
- Paste the bytecode in
rick.asm
, after settingwidth
andheight
img:
.width db 27
.height db 29
.pixels db 0xff,0xab,...
- Compile (you need the
make
package)
$ make
nasm -f bin rick.asm
- Run in a QEMU environment (you need
qemu
andqemu-system-i386
packages)
$ make run
qemu-system-i386 -display spice-app -fda rick
When drawing your PNG, you need to use these colors:
Color | Hex |
---|---|
Dark | #000000 |
Blue | #0000AA |
Green | #00AA00 |
Cyan | #00AAAA |
Red | #AA0000 |
Magenta | #AA00AA |
Brown | #AA5500 |
Light gray | #AAAAAA |
Dark gray | #555555 |
Light blue | #5555FF |
Light green | #55FF55 |
Light cyan | #55FFFF |
Light red | #FF5555 |
Light magenta | #FF55FF |
Yellow | #FFFF55 |
White | #FFFFFF |
Reference: BIOS color attributes