Making .ico file with fasm

Sometimes there is a need to create icon (say, favicon for you site). And you don’t want to download any software (if you want there is google://pixelformer).

There is a short script in flatassembler that, i hope, explains windows icon format. Not bad thing, although *.ico files now become obsolete more and more. But obsolete not means unused :)

pixels fix 0x10 ; icon size
bpx fix 0x20 ; bits per pixel

dw 0x0000 ; Signature
dw 0x0001 ; Type - icon
dw 0x0001 ; Images Count - 1

db pixels ; width
db pixels ; height
dd 0x01 ; use mask (false)
dw bpx ; bits per colour - 32
dd sz_data
dd idata ; offset

idata:

bitmapinfoheader:
dd sz_bitmapinfoheader
dd pixels ; width
dd pixels * 2 ; height - strange but need
dw 0x01 ; planes
dw bpx ; bpc - 32
dd 0x00 ; no compression
dd sz_raw
dd 0x00, 0x00, 0x00, 0x00
sz_bitmapinfoheader = $ - bitmapinfoheader
rept 256 x {
dd 0x11 ; icon data (dd - 32bit bitmap)
}
rept 16 y {
dd 0 ; icon mask
}
raw:

sz_raw = $ - raw
sz_data = $ - idata


About this entry