wok view BootProg/stuff/bootex.asm @ rev 25865

libsdl*: update urls
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Sep 01 12:45:35 2025 +0000 (13 days ago)
parents 7db7b7aaf63e
children
line source
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;; ;;
3 ;; "BootProg" Loader v 1.5 by Alexey Frunze (c) 2000-2015 ;;
4 ;; 2-clause BSD license. ;;
5 ;; ;;
6 ;; ;;
7 ;; How to Compile: ;;
8 ;; ~~~~~~~~~~~~~~~ ;;
9 ;; nasm bootex.asm -f bin -o bootex.bin ;;
10 ;; ;;
11 ;; ;;
12 ;; Features: ;;
13 ;; ~~~~~~~~~ ;;
14 ;; - exFAT supported using BIOS int 13h function 42h. ;;
15 ;; ;;
16 ;; - Loads a 16-bit executable file in the MS-DOS .COM or .EXE format ;;
17 ;; from the root directory of a disk and transfers control to it ;;
18 ;; (the "ProgramName" variable holds the name of the file to be loaded) ;;
19 ;; Its maximum size can be up to 637KB without Extended BIOS Data area. ;;
20 ;; ;;
21 ;; - Prints an error if the file isn't found or couldn't be read ;;
22 ;; ("No bootfile" or "Read error") ;;
23 ;; and waits for a key to be pressed, then executes the Int 19h ;;
24 ;; instruction and lets the BIOS continue bootstrap. ;;
25 ;; ;;
26 ;; ;;
27 ;; Known Bugs: ;;
28 ;; ~~~~~~~~~~~ ;;
29 ;; - All bugs are fixed as far as I know. The boot sector has been tested ;;
30 ;; on a 128MB qemu image. ;;
31 ;; ;;
32 ;; ;;
33 ;; Memory Layout: ;;
34 ;; ~~~~~~~~~~~~~~ ;;
35 ;; The diagram below shows the typical memory layout. The actual location ;;
36 ;; of the boot sector and its stack may be lower than A0000H if the BIOS ;;
37 ;; reserves memory for its Extended BIOS Data Area just below A0000H and ;;
38 ;; reports less than 640 KB of RAM via its Int 12H function. ;;
39 ;; ;;
40 ;; physical address ;;
41 ;; +------------------------+ 00000H ;;
42 ;; | Interrupt Vector Table | ;;
43 ;; +------------------------+ 00400H ;;
44 ;; | BIOS Data Area | ;;
45 ;; +------------------------+ 00500H ;;
46 ;; | PrtScr Status / Unused | ;;
47 ;; +------------------------+ 00600H ;;
48 ;; | Loaded Image | ;;
49 ;; +------------------------+ nnnnnH ;;
50 ;; | Available Memory | ;;
51 ;; +------------------------+ A0000H - 1KB ;;
52 ;; | Boot Sector | ;;
53 ;; +------------------------+ A0000H - 0.5KB ;;
54 ;; | 0.5KB Boot Stack | ;;
55 ;; +------------------------+ A0000H ;;
56 ;; | Video RAM | ;;
57 ;; ;;
58 ;; ;;
59 ;; Boot Image Startup (register values): ;;
60 ;; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;;
61 ;; ax = 0ffffh (both FCB in the PSP don't have a valid drive identifier), ;;
62 ;; bx = 0, dl = BIOS boot drive number (e.g. 0, 80H) ;;
63 ;; cs:ip = program entry point ;;
64 ;; ss:sp = program stack (don't confuse with boot sector's stack) ;;
65 ;; COM program defaults: cs = ds = es = ss = 50h, sp = 0, ip = 100h ;;
66 ;; EXE program defaults: ds = es = EXE data - 10h (fake MS-DOS psp), ;;
67 ;; cs:ip and ss:sp depends on EXE header ;;
68 ;; Magic numbers: ;;
69 ;; si = 16381 (prime number 2**14-3) ;;
70 ;; di = 32749 (prime number 2**15-19) ;;
71 ;; bp = 65521 (prime number 2**16-15) ;;
72 ;; The magic numbers let the program know whether it has been loaded by ;;
73 ;; this boot sector or by MS-DOS, which may be handy for universal, bare- ;;
74 ;; metal and MS-DOS programs. ;;
75 ;; The command line contains no arguments. ;;
76 ;; ;;
77 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
79 %define bx(label) bx+label-boot
80 %define si(label) si+label-boot
81 NullEntryCheck equ 1 ; +3/5 bytes
82 ReadRetry equ 1 ; +7 bytes
83 SectorOf512Bytes equ 0 ; -11 bytes
84 CheckAttrib equ 0 ; +16/18 bytes
85 WaitForKey equ 0 ; +5 bytes
86 TfatSupport equ 1 ; +10 bytes
87 CheckLBAsupport equ 0 ; +11/21 bytes
88 AnyWhere equ 1 ; +2 bytes
90 [BITS 16]
91 [CPU 386]
93 ImageLoadSeg equ 60h
94 StackSize equ 512
96 [SECTION .text]
97 [ORG 0]
99 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
100 ;; Boot sector starts here ;;
101 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
103 boot:
104 DriveNumber:
105 jmp short start ; Windows checks for this jump
106 nop
107 bsOemName times 8 db " " ; 0x03 "EXFAT "
108 times 53 db 0 ; 0x0B
110 ;;;;;;;;;;;;;;;;;;;;;
111 ;; BPB starts here ;;
112 ;;;;;;;;;;;;;;;;;;;;;
114 bpbSectorStart DQ 0 ; 0x40 partition first sector
115 bpbSectorCount DQ 0 ; 0x48 partition sectors count
116 bpbFatSectorStart DD 0 ; 0x50 FAT first sector
117 bpbFatSectorCount DD 0 ; 0x54 FAT sectors count
118 bpbClusterSectorStart DD 0 ; 0x58 first cluster sector
119 bpbClusterCount DD 0 ; 0x5C total clusters count
120 bpbRootDirCluster DD 0 ; 0x60 first cluster of the root dir
121 bpbVolumeSerial DD 0 ; 0x64 volume serial number
122 bpbFSVersionMinor DB 0 ; 0x68
123 bpbFSVersionMajor DB 0 ; 0x69
124 bpbVolumeStateFlags DW 0 ; 0x6A bit0 = fat used, bit1 = dirty, bit2 = media error
125 bpbSectorSizeBits DB 0 ; 0x6C sector size as (1 << n)
126 bpbSectorPerClusterBits DB 0 ; 0x6D sector per cluster as (1 << n)
127 bpbNumberOfFATs DB 0 ; 0x6E always 1 or 2 (Tfat case)
128 bpbDriveNumber DB 0 ; 0x6F always 0x80
129 bpbAllocatedPercent DB 0 ; 0x70 percentage of allocated space
131 ;;;;;;;;;;;;;;;;;;;
132 ;; BPB ends here ;;
133 ;;;;;;;;;;;;;;;;;;;
135 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
136 ;; Boot sector code starts here ;;
137 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
139 start:
141 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
142 ;; How much RAM is there? ;;
143 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
145 int 12h ; get conventional memory size (in KBs)
146 %if AnyWhere
147 call start2
148 here:
149 %macro BootAnyWhere 0
150 start2:
151 pop si
152 sub si, here - boot - 2 ; exclude DriveNumber
153 %endif
154 mov cx, 106h
155 dec ax ; reserve 1K bytes for the code and the stack
156 shl ax, cl ; and convert it to 16-byte paragraphs
158 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
159 ;; Reserve memory for the boot sector and its stack ;;
160 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
162 mov es, ax ; cs:0 = ds:0 = ss:0 -> top - 512 - StackSize
163 mov ss, ax
164 mov sp, 512+StackSize ; bytes 0-511 are reserved for the boot code
166 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
167 ;; Copy ourselves to top of memory ;;
168 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
170 xor di, di
171 %if AnyWhere == 0
172 mov si, 7C02h ; exclude DriveNumber
173 mov ds, di
174 %endif
175 push es
176 cld
177 xchg ax, dx
178 stosw ; store BIOS boot drive number
179 %if AnyWhere
180 rep cs movsw ; move 512 bytes (+ 12)
181 %else
182 rep movsw ; move 512 bytes (+ 12)
183 %endif
185 ;;;;;;;;;;;;;;;;;;;;;;
186 ;; Jump to the copy ;;
187 ;;;;;;;;;;;;;;;;;;;;;;
189 %if AnyWhere
190 push byte main
191 retf
192 %endm
193 %else
194 push word main
195 retf
196 %endif
198 %if CheckLBAsupport != 0
199 %macro BootFileName 0
200 main:
201 push cs
202 pop ds
203 mov ah, 41h ; clobbers AX, BX, CX, DH
204 mov bx, 55AAh
205 int 13h
206 jc ReadError
207 ; xor bx, 0AA55h
208 ; jnz ReadError
209 ; shr cx, 1 ; function 42h support ?
210 ; jnc ReadError
211 xor cx, cx
212 %else
213 main:
214 push cs
215 pop ds
216 %endif
217 xor ebx, ebx
219 mov esi, [bx(bpbRootDirCluster)] ; esi=cluster # of root dir
221 push byte ImageLoadSeg
222 pop es ; cx = 0
224 RootDirReadContinue:
225 call ReadCluster ; read one sector of root dir
227 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
228 ;; Look for the COM/EXE file to load and run ;;
229 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
231 ; es:di -> root entries array
233 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
234 ;; Looks for the file/dir ProgramName ;;
235 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
236 ;; Input: ES:DI -> root directory array ;;
237 ;; Output: ESI = cluster number ;;
238 ;; dword [bx+FileSize] file size ;;
239 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
241 FLAG_CONTIGUOUS equ 2
242 FileFlags equ 01h ; 1 byte
243 CurNameSize equ 03h ; 1 byte
244 StartCluster equ 14h ; 4 bytes
245 FileSize equ 18h ; 8 bytes
247 FindNameCycle:
248 pusha
250 %if NullEntryCheck != 0
251 xor ax, ax
252 or al, [es:di]
253 je FindNameFailed
254 %define curtag al
255 %define chktag al
256 %else
257 %define curtag byte [es:di]
258 %define chktag ax
259 %endif
260 cmp curtag, 0c0h ; EXFAT_ENTRY_FILE_INFO ?
261 jne NotFileInfo
263 mov bl, 32
264 CopyInfo:
265 mov [bx], al
266 dec bx
267 mov al, [es:di+bx]
268 jnz CopyInfo ; keep BIOS boot drive number
270 NotFileInfo:
271 %if CheckAttrib != 0
272 Attributes equ 0Bh ; 1 byte
273 cmp curtag, 85h ; EXFAT_ENTRY_FILE ?
274 jne NotEntryFile
275 mov al, [es:di+Attributes]
276 mov [ProgramName+NameLength+1], al
277 NotEntryFile:
278 %endif
279 mov chktag, 0c1h ; EXFAT_ENTRY_FILE_NAME ?
280 mov cx, NameLength+1
281 mov si, ProgramName ; ds:si -> program name
282 CheckName:
283 scasw ; compare UTF-16
284 lodsb ; with ASCII
285 loope CheckName
286 VolumeLabel equ 8
287 SubDirectory equ 10h
288 %if CheckAttrib != 0
289 jnz SkipFindName
290 test byte [si], VolumeLabel+SubDirectory
291 SkipFindName:
292 %endif
293 %if SectorOf512Bytes == 0
294 mov esi, [bx+StartCluster]
295 push es
296 je FindNameFound ; cx = 0
297 pop es
298 %else
299 je FindNameFound ; cx = 0
300 %endif
301 popa ; restore ax, cx, si, di
303 add di, byte 32
304 cmp di, bp
305 jne FindNameCycle ; next root entry
306 loop RootDirReadContinue ; continue to the next root dir sector
307 cmp esi, byte -10 ; carry=0 if last cluster, and carry=1 otherwise
308 jc RootDirReadContinue ; continue to the next root dir cluster
309 FindNameFailed: ; end of root directory (dir end reached)
310 ;mov dl, [bx(DriveNumber)] ; restore BIOS boot drive number
311 call Error
312 db "No bootfile."
314 ;;;;;;;;;;;;;;;;;;;;;;;;;;
315 ;; Load the entire file ;;
316 ;; Input: ESI = cluster ;;
317 ;; CX = 0 ;;
318 ;;;;;;;;;;;;;;;;;;;;;;;;;;
320 %if SectorOf512Bytes == 0
321 FileReadContinue:
322 shr bp, 4 ; bytes to paragraphs
323 mov di, es
324 add di, bp ; adjust segment for next sector
325 mov es, di ; es:0 updated
326 FindNameFound:
327 %else
328 FindNameFound:
329 mov esi, [bx+StartCluster]
330 push es
331 FileReadContinue:
332 %endif
333 call ReadCluster ; read one more sector of the boot file
334 test byte [bx+FileFlags], FLAG_CONTIGUOUS
335 jne SameCluster
336 dec cx
337 SameCluster:
338 sub [bx+FileSize], ebp ; max FileSize is < 640KB : check low 32 bits only
339 %if SectorOf512Bytes != 0
340 mov bp, es
341 lea bp, [bp+32]
342 mov es, bp ; es:0 updated
343 %endif
344 ja FileReadContinue
345 mov dx, [bx(DriveNumber)] ; restore BIOS boot drive number
346 xchg ax, di
347 pop bp
349 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
350 ;; Type detection, .COM or .EXE? ;;
351 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
353 mov ds, bp ; bp=ds=seg the file is loaded to
355 add bp, [bx+08h] ; bp = image base
356 mov di, [bx+18h] ; di = reloc table pointer
358 cmp word [bx], 5A4Dh ; "MZ" signature?
359 je RelocateEXE ; yes, it's an EXE program
361 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
362 ;; Setup and run a .COM program ;;
363 ;; Set CS=DS=ES=SS SP=0 IP=100h ;;
364 ;; AX=0ffffh BX=0 DX=drive and ;;
365 ;; cmdline=void ;;
366 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
368 mov di, 100h ; ip
369 mov bp, ImageLoadSeg-10h ; "org 100h" stuff :)
370 mov ss, bp
371 xor sp, sp
372 push bp ; cs, ds and es
373 jmp short Run
375 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376 ;; Relocate, setup and run a .EXE program ;;
377 ;; Set CS:IP, SS:SP, DS, ES and AX according ;;
378 ;; to wiki.osdev.org/MZ#Initial_Program_State ;;
379 ;; AX=0ffffh BX=0 DX=drive cmdline=void ;;
380 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
382 ReloCycle:
383 add [di+2], bp ; item seg (abs)
384 les si, [di] ; si = item ofs, es = item seg
385 add [es:si], bp ; fixup
386 scasw ; di += 2
387 scasw ; point to next entry
389 RelocateEXE:
390 dec word [bx+06h] ; reloc items, 32768 max (128KB table)
391 jns ReloCycle
393 les si, [bx+0Eh]
394 add si, bp
395 mov ss, si ; ss for EXE
396 mov sp, es ; sp for EXE
398 lea si, [bp-10h] ; ds and es both point to the segment
399 push si ; containing the PSP structure
401 add bp, [bx+16h] ; cs for EXE
402 mov di, [bx+14h] ; ip for EXE
403 Run:
404 pop ds
405 push bp
406 push di
407 push ds
408 pop es
409 mov [80h], ax ; clear cmdline
410 dec ax ; both FCB in the PSP don't have a valid drive identifier
412 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
413 ;; Set the magic numbers so the program knows that it ;;
414 ;; has been loaded by this bootsector and not by MS-DOS ;;
415 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
416 mov si, 16381 ; prime number 2**14-3
417 mov di, 32749 ; prime number 2**15-19
418 mov bp, 65521 ; prime number 2**16-15
420 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
421 ;; All done, transfer control to the program now ;;
422 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
423 retf
424 %if CheckLBAsupport != 0
425 %endm
426 %endif
428 %if AnyWhere
429 BootAnyWhere
430 %endif
432 ;;;;;;;;;;;;;;;;;;;;;;;;;;
433 ;; Error Messaging Code ;;
434 ;;;;;;;;;;;;;;;;;;;;;;;;;;
436 Error:
437 pop si
439 PutStr:
440 mov ah, 0Eh
441 mov bl, 7
442 lodsb
443 int 10h
444 cmp al, "."
445 jne PutStr
446 %if WaitForKey != 0
447 cbw
448 int 16h ; wait for a key...
449 int 19h ; bootstrap
450 %endif
451 Stop:
452 hlt
453 jmp short Stop
455 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
456 ;; Reads a exFAT cluster ;;
457 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
458 ;; Input: EDX:EAX = LBA ;;
459 ;; EBX = 0 ;;
460 ;; CX = sector cnt ;;
461 ;; ESI = cluster no ;;
462 ;; ES:0 -> buffer adrs ;;
463 ;; Output: EDX:EAX = next LBA ;;
464 ;; CX = sector cnt ;;
465 ;; ESI = cluster no ;;
466 ;; EBP = bytes/sector;;
467 ;; Keep: EDI = 0 ;;
468 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
470 ReadCluster:
471 add eax, byte 1
473 inc cx ; jcxnz
474 loop ReadSectorC
476 mul ebx ; edx:eax = 0
477 %if SectorOf512Bytes != 0
478 mov al, 128
479 %define SectorPerClusterBits [bx(bpbSectorPerClusterBits)]
480 %else
481 mov ah, 40h
482 mov cx, [bx(bpbSectorSizeBits)]
483 %define SectorPerClusterBits ch
484 rol ax, cl ; eax=# of exFAT entries per sector
485 %endif
486 lea edi, [esi-2] ; edi=cluster #-2
487 xchg eax, esi
488 div esi ; eax=FAT sector #, edx=entry # in sector
490 imul si, dx, byte 4 ; si=entry # offset in sector
492 cdq
493 add eax, [bx(bpbFatSectorStart)] ; sector # relative to exFAT
494 %if TfatSupport
495 test byte [bx(bpbVolumeStateFlags)], 1
496 jz UseFat0
497 add eax, [bx(bpbFatSectorCount)]
498 UseFat0:
499 %endif
500 call ReadSectorFAT ; read 1 exFAT sector, keep edx=0, set C
502 mov esi, [es:si] ; esi=next cluster #
504 mov dl, SectorPerClusterBits
505 xor ecx, ecx
506 bts ecx, edx ; 10000h max (32MB cluster)
507 xchg eax, edi ; get cluster #-2
508 mul ecx
510 add eax, [bx(bpbClusterSectorStart)]
511 ReadSectorC:
512 mov di, bx
513 ReadSectorFAT:
514 adc edx, ebx
516 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
517 ;; Reads a sector using BIOS Int 13h ;;
518 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
519 ;; Input: EDX:EAX = LBA ;;
520 ;; EBX = 0 ;;
521 ;; ES:0 -> buffer address ;;
522 ;; Output: EBP = bytes/sector ;;
523 ;; Keep: ESI = cluster ;;
524 ;; EDI = FAT sector or 0 ;;
525 ;; ECX = sector count ;;
526 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
528 %if SectorOf512Bytes != 0
529 lea ebp, [bx+512]
530 %else
531 lea ebp, [bx+1]
532 %endif
534 pushad
536 add eax, [bx(bpbSectorStart)]
537 adc edx, [bx(bpbSectorStart)+4]
539 push edx
540 push eax
541 push es
542 push bx
543 %if SectorOf512Bytes != 0
544 push byte 1 ; sector count word = 1
545 %else
546 push bp ; sector count word = 1
547 %endif
548 push byte 16 ; packet size byte = 16, reserved byte = 0
549 ReadSectorRetry:
550 mov si, sp
551 mov ah, 42h ; ah = 42h = extended read function no.
552 mov dl, [bx(DriveNumber)] ; restore BIOS boot drive number
553 int 13h ; extended read sectors (DL, DS:SI)
555 jnc ReadSuccess
557 %if ReadRetry != 0
558 xor ax, ax
559 int 13h ; reset drive (DL)
560 dec bp
561 %if SectorOf512Bytes != 0
562 jne ReadSectorRetry ; up to 511 tries
563 %else
564 jpe ReadSectorRetry ; up to 3 tries
565 %endif
566 %endif
568 ReadError:
569 call Error
570 db "Read error."
572 ReadSuccess:
573 %if SectorOf512Bytes == 0
574 mov cl, [bx(bpbSectorSizeBits)]
575 shl word [si+16+8], cl ; (e)bp si+16: EDI ESI EBP ESP EBX EDX ECX EAX
576 %endif
577 popa ; sp += 16
578 popad ; real registers
579 ret
581 %if CheckLBAsupport != 0
582 BootFileName
583 %endif
585 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
586 ;; Fill free space with zeroes ;;
587 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
589 ; times (512-13-($-$$)) db 0
591 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
592 ;; Name of the file to load and run ;;
593 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
595 %if 512-2-($-$$) > 15
596 NameLength equ 15
597 %else
598 NameLength equ 512-2-($-$$)
599 %endif
600 ProgramName times NameLength db 0
602 %if NameLength < 11
603 %warning "Short program name"
604 %endif
606 times (512-2-($-$$)) db 0
608 ;;;;;;;;;;;;;;;;;;;;;;;;;;
609 ;; End of the sector ID ;;
610 ;;;;;;;;;;;;;;;;;;;;;;;;;;
612 dw 0AA55h ; BIOS checks for this ID