[org 0x0] ; Offset zero is desired jmp START ; jump to executable code ; definition of boot sector data for a diskette BS_OEMName db "MSWIN4.1" ; 8 characters BPB_BytsPerSec dw 0x0200 ; 512 bytes per sector BPB_SecPerClus db 0x01 ; one sector per cluster BPB_RsvdSecCnt dw 0x0001 ; one reserved sector BPB_NumFATs db 0x02 ; two FATs BPB_RootEntCnt dw 0x00E0 ; 224 entries BPB_TotSec16 dw 0x0B40 ; 2880 sectors on disk BPB_Media db 0xF0 ; media type code BPB_FATSz16 dw 0x0009 ; 9 sectors in one FAT BPB_SecPerTrk dw 0x0012 ; 18 sectors per track BPB_NumHeads dw 0x0002 ; 2 heads BPB_HiddSec dd 0x00000000 ; no hidden sectors BPB_TotSec32 dd 0x00000000 ; no FAT32 sectors BS_DrvNum db 0x00 ; drive number 0 BS_Reserved1 db 0x00 ; reserved BS_BootSig db 0x29 ; extended boot signature BS_VolID dd 0x12345678 ; serial number BS_VolLab db "a_nice_disc" ; volume label BS_FilSysType db "FAT12 " ; file system %define MD_Get_MD_Status 0xf9 %define MD_Write_Port 0x70 %define MD_Read_Port 0x71 %define MD_Bit_To_Test 0x08 START: ; start of CODE cli ; disable interrupts ;; Enable 320x200 graphics mode mov eax,0x13 int 0x10 ;; Check if the button is pressed mov al,MD_Get_MD_Status out MD_Write_Port,al in al,MD_Read_Port test al,MD_Bit_To_Test mov al,0x0 out MD_Write_Port,al jz set_red ;; Set green in first palette position set_green: mov ax,0 mov dx,0x3c8 ; Set first palette value out dx,al inc dx ; Palette is at 0x3c9 mov al,0x00 ; Set red value out dx,al mov al,0xff ; Set green value out dx,al mov ax,0x0 ; Set blue value out dx,al jmp hang_here ;; Set red in first palette position set_red: mov ax,0 mov dx,0x3c8 ; Set first palette value out dx,al inc dx ; Palette is at 0x3c9 mov al,0xff out dx,al ; Set red value mov al,0x0 out dx,al ; Set green value mov ax,0x0 out dx,al ; Set blue value hang_here: jmp hang_here ;; ---------------------- ;; Finish up ;; ---------------------- times 512-($-$$)-2 db 0 ; make the code exactly 512 bytes dw 0xAA55 ; the required final two bytes for a boot sector