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
20 ; Looks like a COMBOOT image but too large
24 cb_enter: jmp enter_command
27 ; Load a COMBOOT image. A COMBOOT image is basically a DOS .COM file,
28 ; except that it may, of course, not contain any DOS system calls. We
29 ; do, however, allow the execution of INT 20h to return to SYSLINUX.
34 cmp ax,0ff00h ; Max size in bytes
38 ; Set up the DOS vectors in the IVT (INT 20h-3fh)
40 mov di,4*0x20 ; DOS interrupt vectors
41 mov eax,comboot_return
46 mov cx,30 ; All remaining DOS vectors
52 mov bx,100h ; Load at <seg>:0100h
54 mov cx,[ClustPerMoby] ; Absolute maximum # of clusters
58 mov cx,64 ; 256 bytes (size of PSP)
59 xor eax,eax ; Clear PSP
62 mov word [es:0], 020CDh ; INT 20h instruction
63 ; First non-free paragraph
64 mov word [es:02h], comboot_seg+1000h
66 ; Copy the command line from high memory
67 mov cx,125 ; Max cmdline len (minus space and CR)
69 mov di,081h ; Offset in PSP for command line
70 mov al,' ' ; DOS command lines begin with a space
78 comboot_end_cmd: mov al,0Dh ; CR after last character
80 mov al,126 ; Include space but not CR
82 mov [es:80h], al ; Store command line length
85 mov [SavedSSSP+2],ss ; Save away SS:SP
87 call vgaclearmode ; Reset video
93 push word 0 ; Return to address 0 -> exit
95 jmp comboot_seg:100h ; Run it
97 ; Proper return vector
98 comboot_return: cli ; Don't trust anyone
102 ; INT 21h: generic DOS system call
103 comboot_int21: and ah,ah ; 00 = return
105 cmp ah,4Ch ; 4C = return with status
108 ; Otherwise fall through to comboot_bogus
110 ; Attempted to execute non-21h DOS system call
111 comboot_bogus: cli ; Don't trust anyone
115 ; Generic COMBOOT return to command line code
118 lss sp,[cs:SavedSSSP]