summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>1998-02-02 02:53:33 +0000
committerhpa <hpa>1998-02-02 02:53:33 +0000
commit15baf6b9b375781c41f6799ff1f17d20962c82a7 (patch)
treedaf9055d8b8084983f3ee6586016ed9fcf0d2ad5
parentd758cc2286206ca1fd40b1ce659e70df046919bd (diff)
downloadsyslinux-15baf6b9b375781c41f6799ff1f17d20962c82a7.tar.gz
Added TODO file; working on DOS installer program.
-rw-r--r--Makefile6
-rw-r--r--TODO3
-rw-r--r--syslinux.asm128
3 files changed, 136 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 5fcc5401..7ed8f22b 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
NASM = nasm
-all: bootsect.bin ldlinux.sys
+all: bootsect.bin ldlinux.sys syslinux.com
ldlinux.bin: ldlinux.asm
$(NASM) -f bin -dHEX_TIME="`perl now.pl`" -l ldlinux.lst -o ldlinux.bin ldlinux.asm
@@ -30,6 +30,10 @@ ldlinux.sys: ldlinux.bin
dd if=ldlinux.bin of=ldlinux.sys bs=512 skip=1
ls -l ldlinux.sys
+syslinux.com: syslinux.asm bootsect.bin ldlinux.sys
+ $(NASM) -f bin -l syslinux.lst -o syslinux.com syslinux.asm
+ ls -l syslinux.com
+
clean:
rm -f *.bin *.lst *.sys
diff --git a/TODO b/TODO
new file mode 100644
index 00000000..866a46c2
--- /dev/null
+++ b/TODO
@@ -0,0 +1,3 @@
+- FAT16 support (for LS120 floppies mainly).
+- "Comboot" style boot files.
+- Booting DOS for a DOS/Linux dual rescue disk.
diff --git a/syslinux.asm b/syslinux.asm
new file mode 100644
index 00000000..84e5ef4e
--- /dev/null
+++ b/syslinux.asm
@@ -0,0 +1,128 @@
+; -*- fundamental -*- (asm-mode sucks)
+; $Id$
+; -----------------------------------------------------------------------
+;
+; Copyright 1998 H. Peter Anvin - All Rights Reserved
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License as published by
+; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
+; USA; either version 2 of the License, or (at your option) any later
+; version; incorporated herein by reference.
+;
+; -----------------------------------------------------------------------
+
+;
+; syslinux.asm
+;
+; DOS installer for SYSLINUX
+;
+
+ absolute 0080h
+psp_cmdlen resb 1
+psp_cmdline resb 127
+
+ section .text
+ org 0100h
+_start:
+ ; BUG: check DOS version
+
+;
+; Scan command line for a drive letter followed by a colon
+;
+ xor cx,cx
+ mov si,psp_cmdline
+ mov cl,[psp_cmdlen]
+
+cmdscan1: jcxz bad_usage ; End of command line?
+ lodsb ; Load character
+ dec cx
+ cmp al,' ' ; White space
+ jbe cmdscan1
+ or al,020h ; -> lower case
+ cmp al,'a' ; Check for letter
+ jb bad_usage
+ cmp al,'z'
+ ja bad_usage
+ sub al,'a' ; Convert to zero-based index
+ mov [DriveNo],al ; Save away drive index
+
+ section .bss
+DriveNo resb 1
+
+ section .text
+;
+; Got the leading letter, now the next character must be a colon
+;
+got_letter: jcxz bad_usage
+ lodsb
+ dec cx
+ cmp al,':'
+ jne bad_usage
+;
+; Got the colon; the rest better be whitespace
+;
+got_colon: jcxz got_cmdline
+ lodsb
+ dec cx
+ cmp al,' '
+ jbe got_colon
+;
+; We end up here if the command line doesn't parse
+;
+bad_usage: mov dx,msg_unfair
+ mov ah,09h
+ int 21h
+
+ mov ax,4C01h ; Exit with error code
+ int 21h
+
+ section .data
+msg_unfair db 'Usage: syslinux <drive>:', 0Dh, 0Ah, '$'
+
+ section .text
+;
+; Parsed the command line OK, now get to work
+;
+got_cmdline: ; BUG: check sector size == 512
+
+ mov bx,SectorBuffer
+ mov al,[DriveNo]
+ mov cx,1 ; One sector
+ xor dx,dx ; Absolute sector 0
+ int 25h ; DOS absolute disk read
+ add sp,byte 2 ; Remove flags from stack
+ jc disk_read_error
+
+ ; BUG: check FAT12, clustersize < 128 sectors
+
+ mov si,SectorBuffer+11 ; Offset of superblock
+ mov di,BootSector+11
+ mov cx,51 ; Superblock = 51 bytes
+ rep movsb ; Copy the superblock
+
+ ; Write LDLINUX.SYS here (*before* writing boot sector)
+
+ mov bx,BootSector
+ mov cx,1 ; One sector
+ xor dx,dx ; Absolute sector 0
+ int 26h ; DOS absolute disk write
+ add sp,byte 2 ; Remove flags
+ jc disk_write_error
+
+all_done: mov ax,4C00h ; Exit good status
+ int 21h
+
+disk_read_error:
+disk_write_error:
+ mov ax,4C01h
+ int 21h
+
+ section .data
+ align 4, db 0
+BootSector: incbin "bootsect.bin"
+LDLinuxSYS: incbin "ldlinux.sys"
+
+ section .bss
+ alignb 4
+SectorBuffer: resb 512