call writemsg
mov al,dl
call writehex2
- call crlf
+ call crlf_early
%endif
;
; Initialize spec packet buffers
call writemsg
mov al,byte [sp_drive]
call writehex2
- call crlf
+ call crlf_early
%endif
found_drive:
mov si,offset_msg
call writemsg
call writehex8
- call crlf
+ call crlf_early
%endif
; Load the rest of the file. However, just in case there
call writemsg
mov al,dl
call writehex2
- call crlf
+ call crlf_early
cmp byte [sp_drive],dl
jne .maybe_broken
call writemsg
mov al,dl
call writehex2
- call crlf
+ call crlf_early
mov si,trysbm_msg
call writemsg
jmp .found_drive ; Pray that this works...
pop ax
ret
+writestr_early:
+ pushfd
+ pushad
+.top: lodsb
+ and al,al
+ jz .end
+ call writechr
+ jmp short .top
+.end: popad
+ popfd
+ ret
+
+crlf_early: push ax
+ mov al,CR
+ call writechr
+ mov al,LF
+ call writechr
+ pop ax
+ ret
+
;
; Write a character to the screen. There is a more "sophisticated"
; version of this in the subsequent code, so we patch the pointer
call writestr_early
mov al,dl
call writehex2
- call crlf
+ call crlf_early
; Fall through to kaboom
;
kaboom:
RESET_STACK_AND_SEGS AX
mov si,err_bootfailed
- call writestr
- call getchar
+ pm_call pm_writestr
+ pm_call pm_getchar
cli
mov word [BIOS_magic],0 ; Cold reboot
jmp 0F000h:0FFF0h ; Reset vector address
; Common modules needed in the first sector
; -----------------------------------------------------------------------------
-%include "writestr.inc" ; String output
-writestr_early equ writestr
%include "writehex.inc" ; Hexadecimal output
; -----------------------------------------------------------------------------
;
%include "init.inc"
- ; Patch the writechr routine to point to the full code
- mov di,writechr
- mov al,0e9h
- stosb
- mov ax,writechr_full-2
- sub ax,di
- stosw
-
; Tell the user we got this far...
%ifndef DEBUG_MESSAGES ; Gets messy with debugging on
mov si,copyright_str
- call writestr_early
+ pm_call pm_writestr
%endif
;
pop cx
loop .wait1
.keypress:
- call crlf
+ pm_call crlf
mov word [BIOS_magic],0 ; Cold reboot
jmp 0F000h:0FFF0h ; Reset vector address
+++ /dev/null
-;
-; writechr: Write a single character in AL to the console without
-; mangling any registers. This does raw console writes,
-; since some PXE BIOSes seem to interfere regular console I/O.
-;
-%if IS_ISOLINUX
-writechr_full:
-%else
-writechr:
-%endif
- pushfd
- push ds
- push cs
- pop ds
- test byte [UsingVGA], 08h
- jz .videook
- call vgaclearmode
-.videook:
- call write_serial ; write to serial port if needed
- test byte [DisplayCon],01h ; Write to screen?
- jz .nothing
-
- pushad
- mov bh,[BIOS_page]
- push ax
- mov ah,03h ; Read cursor position
- int 10h
- pop ax
- cmp al,8
- je .bs
- cmp al,13
- je .cr
- cmp al,10
- je .lf
- push dx
- mov bh,[BIOS_page]
- mov bl,07h ; White on black
- mov cx,1 ; One only
- mov ah,09h ; Write char and attribute
- int 10h
- pop dx
- inc dl
- cmp dl,[VidCols]
- jna .curxyok
- xor dl,dl
-.lf: inc dh
- cmp dh,[VidRows]
- ja .scroll
-.curxyok: mov bh,[BIOS_page]
- mov ah,02h ; Set cursor position
- int 10h
-.ret: popad
-.nothing:
- pop ds
- popfd
- ret
-.scroll: dec dh
- mov bh,[BIOS_page]
- mov ah,02h
- int 10h
- mov ax,0601h ; Scroll up one line
- mov bh,[ScrollAttribute]
- xor cx,cx
- mov dx,[ScreenSize] ; The whole screen
- int 10h
- jmp short .ret
-.cr: xor dl,dl
- jmp short .curxyok
-.bs: sub dl,1
- jnc .curxyok
- mov dl,[VidCols]
- sub dh,1
- jnc .curxyok
- xor dh,dh
- jmp short .curxyok
--- /dev/null
+/*
+ * -----------------------------------------------------------------------
+ *
+ * Copyright 1994-2008 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., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * -----------------------------------------------------------------------
+ *
+ *
+ * writestr.c
+ *
+ * Code to write a simple string.
+ */
+#include <com32.h>
+
+/*
+ * crlf: Print a newline
+ */
+void crlf(void)
+{
+ writechr('\r');
+ writechr('\n');
+}
+
+/*
+ * writestr: write a null-terminated string to the console, saving
+ * registers on entry.
+ *
+ * Note: writestr_early and writestr are distinct in
+ * SYSLINUX and EXTLINUX, but not PXELINUX and ISOLINUX
+ */
+void writestr(char *str)
+{
+ while (*str)
+ writechr(*str++);
+}
+
+void pm_writestr(com32sys_t *regs)
+{
+ writestr(MK_PTR(regs->ds, regs->esi.w[0]));
+}
ret
%include "../core/macros.inc" ; CR/LF
-%include "../core/writestr.inc" ; String output
+%include "writestr.inc" ; String output
%include "../core/writehex.inc" ; Hexadecimal output
%include "../core/writedec.inc" ; Decimal output