;This code was written specifically for the A86 assembler, although it may ;work with others such as TASM .MODEL SMALL .STACK 20H .CODE MAIN: BOOTSEC: THE_JUMP DB 0EBH, 3CH, 90H ;Jump to start of boot sector code DOS_ID: DB "FD1", 0, 0, 0, 0, 0 ;Name of this boot sector (8 bytes) SEC_SIZE: DW 200H ;Size of a sector, in bytes SECS_PER_CLUST: DB 1 ;Number of sectors in a cluster FAT_START: DW 2 ;Starting sector for the first FAT FAT_COUNT: DB 2 ;Number of FATs on this disk ROOT_ENTRIES: DW 0 ;Number of root directory entries SEC_COUNT: DW 0B04H ;Total number of sectors on this disk DISK_ID: DB 0F0H ;Disk type code (This is 360KB) SECS_PER_FAT: DW 38 ;Number of sectors per FAT SECS_PER_TRK: DW 18 ;Sectors per track for this drive HEADS: DW 2 ;Number of heads (sides) on this drive HIDDEN_SECS: DW 0 ;Number of hidden sectors on the disk DSKBASETBL: DB 0 ;Specify byte 1 DB 0 ;Specify byte 2 DB 0 ;Wait time until motor turned off, in clk ticks DB 2 ;Bytes per sector (0=128, 1=256, 2=512, 3=1024) DB 12H ;Last sector number (lg enough to handle 1.44M) DB 0 ;Gap length between sectors for r/w operations DB 0 ;Data xfer lgth when sector lgth not specified DB 0 ;Gap lgth between sectors for formatting DB 0 ;Value stored in newly formatted sectors DB 1 ;Head settle time, in milliseconds DB 0 ;Motor startup time, in 1/8 seconds HEAD: DB 0 ;Current head to read from ;Here is the start of the boot sector code PRE_DNAME DB "Brian's Disk" PRE_MESSAGE DB "Hello!!!" ;Many boot disks use a jump to offset 62 for code BOOT: ;so I am too. MOV AX, 7B0H MOV DS, AX MOV ES, AX JMP OVERDATA1 MESSAGE1 DB 13, 10, "Welcome to HCP OS 0.001!", 13, 10, 0 OVERDATA1: MOV BH, 0 MOV SI, OFFSET MESSAGE1 ;[7C00H + 62 + 4] ;[OFFSET MESSAGE1 + 7B00H] ; + 7C00H - 100H MOV AH, 0EH THELOOP: LODSB INT 10H CMP BYTE PTR [ES:SI], 0 JZ TO_OS JMP THELOOP TO_OS: MOV AH, 0 MOV DL, 0 INT 13H MOV BX, OFFSET BUFFER ;[7C00H + 512] ;[OFFSET BUFFER + 7B00H] ;this code below loads 10 sectors (5120 bytes) from the floppy after the fat ;to mem at 7d0h MOV AH, 02H ;byte offset = 77 * 512 = 39424 MOV AL, 15 ;sector = int[(39424/512) + 1] mod 9 = 6 : CL = 6 MOV CH, 2 ;track = int[(39424/512) / 9] = 8 MOV CL, 6 ;head = track mod 2 = 8 mod 2 = 0 : DH = 0 MOV DX, 0 ;cylinder = fix(8 / 4) = 2 : CH = 2 & CL bits 7,6 = 0,0 ;DX = 0 b/c DL = 0 (floppy) & Head = 0 INT 13H MOV AX, 7D0H MOV DS, AX MOV ES, AX JMP BUFFER THE_STACK_SPACE DB 100 DUP (?) STACK_POINTER: ;Precompiled this was 153 bytes, need 512 so I added ;this 357 byte dup & the boot signature bytes SOME_SPACE DB 259 DUP (?) SIGNATURE DB 55H, 0AAH BUFFER: END MAIN