X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=bootsplash.asm;h=a6a552a1b79cfa180f0ae6b4273dcfd7e149e130;hb=5731d2abe8e8c4b838f8d1b0eefdc25754f6ad78;hp=26f557acb8f2c36ee4ece51967e7053e59e60f02;hpb=8a2e90cd377e7177f32ffc3ffc30a508e3f5f474;p=bootsplash diff --git a/bootsplash.asm b/bootsplash.asm index 26f557a..a6a552a 100644 --- a/bootsplash.asm +++ b/bootsplash.asm @@ -37,9 +37,9 @@ start: ; expects string ptr in ax printstr: - mov bx, ax -.loop: mov al, [bx] - inc bx + mov si, ax +.loop: mov al, [si] + inc si test al, al jz .done mov ah, 0eh @@ -49,7 +49,7 @@ printstr: .done: ret str_load_fail db "Failed to load second stage!",0 -str_foo db "Loaded 2nd stage boot loader",0 +str_booting db "Booting ...",0 times 510-($-$$) db 0 @@ -57,30 +57,66 @@ str_foo db "Loaded 2nd stage boot loader",0 ; start of the second stage stage2_start: + call splash + + xor ax, ax + mov es, ax + mov ds, ax + + mov ax, str_booting + call printstr + + cli +.hang: hlt + jmp .hang + + ; splash screen effect +splash: mov ax, 13h int 10h mov ax, 0a000h mov es, ax xor di, di - mov cx, 32000 - mov ax, 0505h - rep stosw + + mov ax, pic + shr ax, 4 + mov ds, ax + xor si, si + + mov cx, 64000 + call decode_rle call waitkey mov ax, 3 int 10h + ret - xor ax, ax - mov es, ax - - mov ax, str_foo - call printstr - -.hang: cli - hlt - jmp .hang + ; decode RLE from ds:si to es:di, cx: number of decoded bytes (0 means 65536) + ; - high bit set for the repetition count, followed by a value byte to + ; be repeated N times + ; - high bit not set for raw data that should be copied directly +decode_rle: + mov al, [si] + inc si + mov bl, 1 ; default to "copy once" for raw values + test al, 0x80 ; test the high bit to see if it's a count or a raw value + jz .copy + ; it's a count, clear the high bit, and read the next byte for the value + and al, 0x7f + mov bl, al + mov al, [si] + inc si +.copy: mov [es:di], al + inc di + dec cx ; decrement decoded bytes counter + jz .end ; as soon as it reaches 0, bail + dec bl + jnz .copy + jmp decode_rle +.end: ret + waitkey: in al, 64h @@ -89,6 +125,10 @@ waitkey: in al, 60h ret + ; data + align 16 +pic: incbin "nuclear.rle" + stage2_end: ; vi:set ft=nasm: