5 boot_driveno equ 7b00h ; 1 byte
6 stage2_size equ stage2_end - stage2_start
17 mov [boot_driveno], dl
19 ; load the rest of the code at 7e00
23 mov ah, 2 ; read sectors LBA call
24 mov al, (stage2_size + 511) / 512 ; num sectors
25 mov cx, 2 ; ch: cylinder, cl: sector
27 mov dl, [boot_driveno]
29 jnc stage2_start ; loaded successfully, jump to it
31 ; failed to load second sector
38 ; expects string ptr in ax
51 str_load_fail db "Failed to load second stage!",0
52 str_booting db "Booting ...",0
58 ; start of the second stage
73 ; splash screen effect
96 ; decode RLE from ds:si to es:di, cx: number of decoded bytes (0 means 65536)
97 ; - high bit set for the repetition count, followed by a value byte to
99 ; - high bit not set for raw data that should be copied directly
103 mov bl, 1 ; default to "copy once" for raw values
104 test al, 0x80 ; test the high bit to see if it's a count or a raw value
106 ; it's a count, clear the high bit, and read the next byte for the value
111 .copy: mov [es:di], al
113 dec cx ; decrement decoded bytes counter
114 jz .end ; as soon as it reaches 0, bail
130 pic: incbin "nuclear.rle"