Last active
July 12, 2017 18:13
-
-
Save Centrinia/f1d7f694d43cad0e5c3e326f43b5a9c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.code16 | |
start: | |
/* Set the palette. */ | |
#define WARM 0x1010e0 | |
#define HOT 0xe4e0ff | |
/* Switch into mode 0x13. */ | |
movw $0x0013, %ax | |
int $0x10 | |
cld | |
xorb %al, %al | |
movw $0x3c8, %dx | |
outb %al, %dx | |
incw %dx | |
xorb %cl, %cl | |
1: | |
.macro load_palette i | |
movb $((HOT >> (\i*8)) & 0xff), %al | |
subb $((WARM >> (\i*8)) & 0xff), %al | |
mulb %cl | |
addb $((WARM >> (\i*8)) & 0xff), %ah | |
movb %ah, %al | |
mulb %cl | |
cmpw $(30<<10), %ax | |
sbbw %bx, %bx | |
shrw $9, %ax | |
andb %bl, %al | |
notb %bl | |
orb %bl, %al | |
movw $0x3c9, %dx | |
outb %al, %dx | |
.endm | |
/* Red */ | |
load_palette 0 | |
/* Green */ | |
load_palette 1 | |
/* Blue */ | |
load_palette 2 | |
incb %cl | |
jnz 1b | |
2: | |
#define MEMORY_SECTOR 0x07e0 | |
#define BACKUP_SECTOR 0x27e0 | |
movw $BACKUP_SECTOR, %ax | |
movw %ax, %es | |
xorw %cx, %cx | |
notw %cx | |
xorb %al, %al | |
rep stosb | |
movw $MEMORY_SECTOR, %ax | |
movw %ax, %es | |
movw %ax, %ds | |
xorw %cx, %cx | |
notw %cx | |
xorb %al, %al | |
rep stosb | |
#define VGA_SECTOR 0xA000 | |
movw $VGA_SECTOR, %ax | |
movw %ax, %fs | |
#define PRNG_A 1103515245 | |
#define PRNG_C 123345 | |
xorl %ebx, %ebx | |
2: | |
xorl %ecx, %ecx | |
/* Set flame base. */ | |
1: | |
movl $PRNG_A, %eax | |
mull %ebx | |
addl $PRNG_C, %eax | |
movl %eax, %ebx | |
movl %ebx, %eax | |
shrl $24, %eax | |
movb %al, %ds:(%ecx) | |
incw %cx | |
cmpw $(320*1), %cx | |
jc 1b | |
/* Update flame. */ | |
movw $MEMORY_SECTOR, %ax | |
movw %ax, %es | |
movw $BACKUP_SECTOR, %ax | |
movw %ax, %ds | |
xorw %cx, %cx | |
xorw %si, %si | |
3: | |
movw %si, %bx | |
addw $4, %bx | |
addw $50, %bx | |
xorw %dx, %dx | |
4: | |
xorw %ax, %ax | |
movb %es:-1(%bx), %al | |
addb %es:(%bx), %al | |
adcb $0, %ah | |
addb %es:1(%bx), %al | |
adcb $0, %ah | |
addb %es:320(%bx), %al | |
adcb $0, %ah | |
movw %dx, %bp | |
movw $65400, %dx | |
mulw %dx | |
movw %dx, %ax | |
movw %bp, %dx | |
shrl $2, %ax | |
movb %al, %ds:320(%bx) | |
incw %bx | |
incw %dx | |
cmpw $(320-100), %dx | |
jc 4b | |
addw $320, %si | |
incw %cx | |
cmpw $200, %cx | |
jc 3b | |
xorw %si, %si | |
xorw %di, %di | |
movw $(320*200), %cx | |
rep movsb | |
/* Draw flame. */ | |
movw $VGA_SECTOR, %ax | |
movw %ax, %es | |
xorw %di, %di | |
movw $(320*200), %si | |
xorw %dx, %dx | |
1: | |
movw $320, %cx | |
rep movsb | |
subw $(2*320), %si | |
incw %dx | |
cmpw $200, %dx | |
jc 1b | |
jmp 2b | |
. = start + 510 | |
.byte 0x55, 0xaa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uBMAzRD8MMC6yAPuQjDJsP8s4PbhgMTgiOD24T0AeBnbwegJINj20wjYuskD7rDgLBD24YDEEIjg | |
9uE9AHgZ28HoCSDY9tMI2LrJA+6w5CwQ9uGAxBCI4PbhPQB4GdvB6Akg2PbTCNi6yQPu/sF1n7jg | |
J47AMcn30TDA86q44AeOwI7YMcn30TDA86q4AKCO4GYx22YxyWa4bU7GQWb342YF0eEBAGaJw2aJ | |
2GbB6BhniAFBgflAAXLduOAHjsC44CeO2DHJMfaJ84PDBIPDMjHSMcAmikf/JgIHgNQAJgJHAYDU | |
ACYCh0ABgNQAidW6eP/34onQiepmwegCiIdAAUNCgfrcAHLKgcZAAUGB+cgAcrUx9jH/uQD686S4 | |
AKCOwDH/vgD6MdK5QAHzpIHugAJCgfrIAHLw6Vn/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVao= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment