2 ;; -----------------------------------------------------------------------
4 ;; Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
6 ;; This program is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 ;; Bostom MA 02111-1307, USA; either version 2 of the License, or
10 ;; (at your option) any later version; incorporated herein by reference.
12 ;; -----------------------------------------------------------------------
17 ;; Common code for running a COMBOOT image
21 ; Load a COMBOOT image. A COMBOOT image is basically a DOS .COM file,
22 ; except that it may, of course, not contain any DOS system calls. We
23 ; do, however, allow the execution of INT 20h to return to SYSLINUX.
27 jnz near comboot_too_large
28 cmp ax,0ff00h ; Max size in bytes
32 ; Set up the DOS vectors in the IVT (INT 20h-3fh)
34 mov dword [4*0x20],comboot_return ; INT 20h vector
37 mov cx,31 ; All remaining DOS vectors
43 mov bx,100h ; Load at <seg>:0100h
45 mov cx,[ClustPerMoby] ; Absolute maximum # of clusters
49 mov cx,64 ; 256 bytes (size of PSP)
50 xor eax,eax ; Clear PSP
53 mov word [es:0], 020CDh ; INT 20h instruction
54 ; First non-free paragraph
55 mov word [es:02h], comboot_seg+1000h
57 ; Copy the command line from high memory
58 mov cx,125 ; Max cmdline len (minus space and CR)
60 mov di,081h ; Offset in PSP for command line
61 mov al,' ' ; DOS command lines begin with a space
69 comboot_end_cmd: mov al,0Dh ; CR after last character
71 mov al,126 ; Include space but not CR
73 mov [es:80h], al ; Store command line length
76 mov ax,ss ; Save away SS:SP
79 call vgaclearmode ; Reset video
85 push word 0 ; Return to address 0 -> exit
87 jmp comboot_seg:100h ; Run it
89 ; Looks like a COMBOOT image but too large
93 cb_enter: jmp enter_command
95 ; Proper return vector
96 comboot_return: cli ; Don't trust anyone
104 ; Attempted to execute DOS system call
105 comboot_bogus: cli ; Don't trust anyone
106 lss sp,[cs:SavedSSSP]