Hi,
I have just begun a new project, this time a utility which is to be placed in the boot sector of a logical drive. It reqires 16 bit assembly which I (believe) can handle.
But -- how do I make the linker generate a real FLAT binary (not COM nor EXE)?
Can anybody provide me a link to a linker documentation which also covers my subject?
Thanks in advance
SolASM creates the type of binary you are talking about here. Currently, it is the only type it can create. You are looking in the wrong place for a solution, by the way. It is the assembler that creates what you want, not the linker.
Using ml.exe, just make sure you do not include /coff or /omf to get a flat assembly.
Paul
Hi,
this is a boot sector sample:
;--- boot sector sample
;--- to get a simple binary of size 512 3 things are important
;--- 1. provide a start address with "END"
;--- 2. place org 7C00h at the start of ".CODE"
;--- 3. link with /TINY (MS OMF linker)
.286
.model small
.code
org 7c00h
start:
JMP realstart
NOP
db "MSDOS5.0"
dw 200h ;bp+0B bytes/sector
db 1 ;bp+0D sector/cluster
dw 0001 ;bp+0E reserved sectors
db 2 ;bp+10 number of fats
dw 00E0h ;bp+11 root dir entries
dw 18*80+2 ;bp+13 number of sectors
db 0F0h ;bp+15 media byte
dw 0009 ;bp+16 sectors/fat
dw 0012h ;bp+18 sectors/track
dw 0002 ;bp+1A number of heads
dd 0 ;bp+1C FAT16 number of hidden sectors
dd 0 ;bp+20 FAT16 total number of sectors
db 0 ;bp+21 FAT16 logical drive number
db 0 ;bp+22 FAT16 reserved
db 29h ;bp+26 FAT16 extended signature (28h/29h)
dd 0 ;bp+27 FAT16 serial number
db "NO NAME " ;bp+2B FAT16 volume label
db "FAT12 " ;bp+3 FAT16 file system type
realstart:
CLI
CLD
XOR AX,AX
MOV DS,AX
MOV SS,AX
MOV SP,7C00h
MOV BP,offset start
waitforever:
jmp waitforever
org 7C00h + 1FEh
dw 0AA55h
end start