@@ -285,20 +285,53 @@ Eval: test %ax,%ax # Eval(e:ax,a:dx):ax
285285 call Evlis
286286 xchg %ax ,%si
287287 pop %ax
288- call Apply
288+ jmp 2f
289+
290+ .fill 0x1BE - (. - _start), 1 , 0xce # to have this boot from a USB
291+ # drive on a modern PC, make a
292+ # degenerate "partition table"
293+ # where this sector starts the
294+ # bootable partition; inactive
295+ # partition table entries must
296+ # also be empty, or have valid
297+ # starting sector LBA numbers!
298+
299+ # * 1st partition entry *
300+ .byte 0x80 # - bootable indicator
301+ .byte 0 , 1 , 0 # - h₀, s₀ (& c₀ hi bits), c₀
302+ .byte 0x7F # - OS or filesystem indicator
303+ .byte 0xFF , 0xFF , 0xFF # - h₉, s₉ (& c₉ hi bits), c₉
304+ .long 0 # - c₀*Cₙ + h₀*Hₙ + s₀*Sₙ
305+
306+ 2: call Apply
307+ .byte 0x3C
308+ # * 2nd partition entry *
309+ .byte 0x00 # - bootable indicator
289310 pop %dx # restore A
290311 mov %cx ,%si # si = B
291312 xchg %ax ,%di
292313 call Gc
293314 mov %dx ,%di # di = A
315+ .byte 0x3C #
316+ .byte 0x00 # - hi8(c₀*Cₙ + h₀*Hₙ + s₀*Sₙ)
294317 sub %si ,%cx # cx = C - B
295318 rep movsb
319+ # * 3rd partition entry *
320+ .byte 0x00 # - bootable indicator
321+ .byte 0xC9
296322 mov %di ,%cx # cx = A + (C - B)
297323 pop %dx # restore a
2983241: ret
299325
300- .sig: .fill 512 - (2f - 1f) - (. - _start), 1 , 0xce
301- 1: .ascii " SECTORLISP v2 "
326+ .fill 0x1DE + 0x8 - (. - _start), 1 , 0xce
327+ .long 0 # - c₀*Cₙ + h₀*Hₙ + s₀*Sₙ
328+
329+ .fill 0x1EE - (. - _start), 1 , 0xce # * 4th partition entry *
330+ .byte 0x00 # - bootable indicator
331+ .sig: .fill 0x200 - (2f - 1f) - (. - _start), 1 , 0xce
332+ 1: .ascii "SECTORLISP"
333+ .byte 0 # - hi8(c₀*Cₙ + h₀*Hₙ + s₀*Sₙ)
334+ .ascii " v2 "
302335 .word 0xAA55
3033362: .type .sig,@object
304337 .type kQuote,@object
0 commit comments