The assembled image is available at
http://mikegonta.com/HelloDawn/BOOTABLE_CD.ISO
Mike Gonta - mikegonta at hotmail dot com
look and see - many look but few see
bits 16
org 7C00h
lgdt [cs:gdt]
mov eax, 1
mov cr0, eax
jmp 8:start32
gdt
dw 23
dd gdt
dw 0
dw 0FFFFh, 0 ; code
dw 9A00h, 0CFh
dw 0FFFFh, 0
dw 9200h, 0CFh ; data
bits 32
start32
cli
mov eax, 10h
mov ds, ax
mov ss, ax
mov esp, 0A0000h
mov al, 0D1h ; A20 enable
out 64h, al
..1
in al, 64h
test al, 2
jnz .1
mov al, 4Bh
out 60h, al
mov ebx, "5678"
mov edi, 100000h
mov [edi], ebx
cmp [edi], ebx
je .2
in al, 92h ; PS/2 A20 enable
or al, 2
out 0EDh, al
out 92h, al
..2
mov [edi], ebx
cmp [edi], ebx
jne nothing_to_load
mov edx, 3F2h ; floppy disk controller
mov al, 0Ch ; turn floppy disk motor off
out dx, al
mov dl, 0D4h ; CRT controller
mov ax, 0F0Ah ; cursor starts at line 16
out dx, ax
mov ax, 0Bh ; cursor ends at line 0 - hides cursor
out dx, ax
clear_screen
mov edi, 0B8000h
mov eax, 20h
mov ecx, 80*25
..1
mov [edi], ax
inc edi
inc edi
dec ecx
jne .1
mov edx, 177h ; Secondary
mov al, 0A0h ; Master
call cd_loader
mov edx, 1F7h ; Primary
mov al, 0B0h ; Slave
call cd_loader
mov edx, 177h ; Secondary
mov al, 0B0h ; Slave
call cd_loader
mov edx, 1F7h ; Primary
mov al, 0A0h ; Master
call cd_loader
nothing_to_load
mov edx, 3C8h ; PEL Address Write Mode Register
mov al, 3dh
out dx, al
inc edx ; PEL Address Data Register
xor eax, eax
out dx, al
out dx, al
out dx, al
mov esi, bootable_CD
mov edi, 0B8000h +(12*80+18)*2
mov ah, 0Dh
call put_string
fade_in
xor ebx, ebx
mov ecx, 3D00h
..2
mov al, ch
mov ebp, 27000 ; approx. 1/24 second
..3
mov edx, 3C8h ; PEL Address Write Mode Register
out 0EDh, al ; non existing port for delay
dec ebp
jne .3
out dx, al
inc edx ; PEL Address Data Register
mov al, bl
out dx, al
out dx, al
mov al, cl
out dx, al
inc cl
cmp cl, 64
jne .2
mov ebp, 650000 ; approximately 1 second delay
..11
out 0EDh, al ; non existing port for delay
dec ebp
jne .11
mov esi, anykey
mov edi, 0B8000h +(18*80+33)*2
mov ah, 0Fh
call put_string
done
in al, 64h
test al, 1 ; wait for keypress
jz done
int3
put_string
mov al, [esi]
inc esi
test al, al
je .3
mov [edi], ax
inc edi
inc edi
jmp put_string
..3
ret
cd_loader
push eax
..1
in al, dx
test al, al
js .1
dec dl ; drive/head register
pop eax
out dx, al
inc dl ; command/status register
mov al, 0A0h
out dx, al
..11
in al, dx
test al, al
js .11 ; busy
test al, 1 ; error
je .2
ret
..2
sub dl, 7
mov eax, 28h
out dx, ax
xor eax, eax
out dx, ax
mov eax, 1A00h
out dx, ax
xor eax, eax
out dx, ax
mov al, 16
out dx, ax
xor eax, eax
out dx, ax
add dl, 7
mov ecx, 650000*2
..3
in al, dx
test al, 8 ; drq
jne .31
dec ecx
jne .3
ret
..31
sub dl, 7
mov bl, 16
mov edi, 100000h
..4
mov ecx, 2048/2
..41
in ax, dx
mov [edi], ax
inc edi
inc edi
dec ecx
jne .41
dec bl
je .43
add dl, 7
..42
in al, dx
test al, al
js .42
sub dl, 7
jmp .4
..43
cmp dword [100000h], "1234"
jne .44
pop eax
jmp 100004h
..44
ret
anykey
db "press any key!",0
times 512-($-$$)-45 db 0
bootable_CD
db "Bootable CD Copyright 2005 MikeGonta.com",0
times 512*3 db 0
times 2048*14 db 0
BootCat.Bin
db 1
times 27 db 0
db 0AAh, 55h, 55h, 0AAh
..Bootable
db 88h
..Type
db 2
..Location
dd 7C0h
..Sector_count
db 1, 0
dd 0
times 2048-($-BootCat.Bin) db 0
Primary_Volume_Descriptor
db 1, "CD001", 1, 0
times 32 db " "
db "BOOTABLE_CD "
times 8 db 0
db 26,0,0,0,0,0,0,26,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1
db 0,8,8,0,10,0,0,0,0,0,0,10,21,0,0,0
db 0,0,0,0,0,0,0,22,0,0,0,0
db 34,0,20,0,0,0,0,0,0,20,0,8,0,0,0,0,8
db 0,105,11,6,16,17,44,0,2,0,0,0,0,0,0,1,0
times 128 db " "
db "Copyright 2005, MikeGonta.com"
times 128*3-29 db " "
db "2005110600000000",48,"2005110600000000",48
times 34 db 0
db 1
times 2048-($-Primary_Volume_Descriptor) db 0
Boot_Record_Descriptor
db 0, "CD001", 1
..System_Identifier
db "EL TORITO SPECIFICATION"
times 64-($-.System_Identifier) db 0
..Boot_Catalog_Location
db 15
times 2048-($-Boot_Record_Descriptor) db 0
Supplementary_Volume_Descriptor
db 2, "CD001", 1, 0
times 32 db 0
db 0,"B",0,"o",0,"o",0,"t",0,"a",0,"b",0,"l",0,"e"
db 0," ",0,"C",0,"D",0,0,0,0,0,0,0,0,0,0
times 8 db 0
db 26,0,0,0,0,0,0,26,37,47,69,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1
db 0,8,8,0,10,0,0,0,0,0,0,10,24,0,0,0
db 0,0,0,0,0,0,0,25,0,0,0,0
db 34,0,23,0,0,0,0,0,0,23,0,8,0,0,0,0,8
db 0,105,11,6,21,9,46,0,2,0,0,0,0,0,0,1,0
times 128 db 0
db 0,"C",0,"o",0,"p",0,"y",0,"r",0,"i",0,"g",0,"h"
db 0,"t",0," ",0,"2",0,"0",0,"0",0,"5",0,",",0," "
db 0,"M",0,"i",0,"k",0,"e",0,"G",0,"o",0,"n",0,"t"
db 0,"a",0,".",0,"c",0,"o",0,"m"
times 128*3-58 db 0
db "2005110600000000",48,"2005110600000000",48
times 34 db 0
db 1
times 2048-($-Supplementary_Volume_Descriptor) db 0
Terminator_Volume_Descriptor
db 255,67,68,48,48,49,1,0,0,0,0,0,0,0,0,0
times 2032 db 0
Primary_Directory_Records
db 34,0,20,0,0,0,0,0,0,20,0,8,0,0,0,0,8
db 0,105,11,6,16,17,44,0,2,0,0,0,0,0,0,1,0
db 34,0,20,0,0,0,0,0,0,20,0,8,0,0,0,0,8
db 0,105,11,6,16,17,44,0,2,0,0,0,0,0,0,1,1
times 2048-68 db 0
Primary_Type_L_Path_Table
db 1,0,20,0,0,0,1,0,0,0,0,0,0,0,0,0
times 2032 db 0
Primary_Type_M_Path_Table
db 1,0,0,0,0,20,0,1,0,0,0,0,0,0,0,0
times 2032 db 0
Supplementary_Directory_Records
db 34,0,23,0,0,0,0,0,0,23,0,8,0,0,0,0,8
db 0,105,11,6,16,17,44,0,2,0,0,0,0,0,0,1,0
db 34,0,23,0,0,0,0,0,0,23,0,8,0,0,0,0,8
db 0,105,11,6,16,17,44,0,2,0,0,0,0,0,0,1,1
times 2048-68 db 0
Supplementary_Type_L_Path_Table
db 1,0,23,0,0,0,1,0,0,0,0,0,0,0,0,0
times 2032 db 0
Supplementary_Type_M_Path_Table
db 1,0,0,0,0,23,0,1,0,0,0,0,0,0,0,0
times 2032 db 0